Skip to content

Fix NodeJS check for electron renderer#25

Open
greymoth-jp wants to merge 1 commit into
emn178:masterfrom
greymoth-jp:fix-nodejs-electron-renderer
Open

Fix NodeJS check for electron renderer#25
greymoth-jp wants to merge 1 commit into
emn178:masterfrom
greymoth-jp:fix-nodejs-electron-renderer

Conversation

@greymoth-jp

Copy link
Copy Markdown

The same NODE_JS detection issue was fixed in js-sha256 (emn178/js-sha256#49) but not here. The check returns true in an Electron renderer started with nodeIntegrationInWorker: true, because process exists in that context. Electron sets process.type to "renderer" there, so this adds the matching process.type != 'renderer' guard. With it the renderer takes the pure-JS path instead of trying to wrap Node's crypto.

The change is the same one-line guard already merged in js-sha256. mocha tests/node-test.js still passes (8360 tests): under normal Node process.type is undefined, so NODE_JS stays true and behavior there is unchanged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant