Project

Profile

Help

Bug #4639

SaxonJS in Electron appears non-standard.

Added by Grant Vergottini about 1 month ago. Updated 3 days ago.

Status:
New
Priority:
Low
Assignee:
-
Category:
-
Sprint/Milestone:
-
Start date:
2020-07-10
Due date:
% Done:

0%

Estimated time:
Applies to JS Branch:
Fix Committed on JS Branch:
Fixed in JS Release:
SEF Generated with:
Company:
-
Contact person:
-
Additional contact persons:
-

History

#1 Updated by Michael Kay about 1 month ago

Could you expand on this please?

#2 Updated by Grant Vergottini about 1 month ago

I don’t know where my description disappeared to.

I am finding the require(‘saxon-js’) does not work as expected in a node.js service within electron.

In a normal node.js environment, this works:

const SaxonJS = require(‘saxon-js’); // SaxonJS = an object with methods

However, in Electron, the exact same code results in SaxonJS being just the empty object {}.

In experimenting, I discovered that:

const foobar = require(‘saxon-js’); // SaxonJS is assigned properly somehow, foobar = undefined

Or even just:

require(‘saxon-js’); // SaxonJS is assigned properly somehow

would result in the SaxonJS object magically being defined. It appears that, at least in Electron’s way of scoping variables, the SaxonJS object is globally defined within the require() and that the assignment to an external constant of the same name mucks things up in a way that causes the resulting SaxonJS object to be an empty object

#3 Updated by Debbie Lockett about 1 month ago

  • Project changed from Saxon to Saxon-JS

Thanks for logging this issue. We have no experience of Electron, but will certainly need to investigate this.

#4 Updated by Debbie Lockett 3 days ago

As suggested, we are indeed declaring SaxonJS as a global variable internally, as well as adding it to module.exports; and I can believe that this is the cause of the problem.

I'm currently testing changes to remove the global variable, to check for regression. (Running our usual browser and Node.js test suite test drivers, and Mocha test suites).

I haven't actually tested anything in Electron though.

Please register to edit this issue

Also available in: Atom PDF Tracking page