New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't require browser process API in renderer process #8766

merged 4 commits into from Feb 28, 2017


None yet
3 participants

kevinsawicki commented Feb 24, 2017

Currently the remote module loads the browser process require('electron') in the renderer process to get a list of module names to add as properties to the remote object (like

Requiring this file puts it in the require cache which can then cause issues if it is accessed from that cache directly or indirectly since the properties on the exports object will throw errors when accessed since it will lazily require modules that cannot run in the renderer process.

This pull request switches remote.js to use a local list of module names to add as properties so this file isn't required at all.

This does mean the lists need to be kept in sync but that seems better to do than attempting to load browser process code in the renderer process. Also we infrequently add new top-level modules and the comment at the top of electron.js now mentions it.

Closes #8423

kevinsawicki added some commits Feb 23, 2017

Don't require browser process module from renderer
This can cause issues when it is accessed from the
require cache or module tree since the getters throw
errors when called.

@kevinsawicki kevinsawicki merged commit dba154b into master Feb 28, 2017

8 of 9 checks passed

continuous-integration/travis-ci/pr The Travis CI build is in progress
continuous-integration/appveyor/pr AppVeyor build succeeded
electron-linux-arm Build #5678939 succeeded in 68s
electron-linux-ia32 Build #5678940 succeeded in 61s
electron-linux-x64 Build #5678941 succeeded in 138s
electron-mas-x64 Build #3527 succeeded in 8 min 32 sec
electron-osx-x64 Build #3534 succeeded in 8 min 48 sec
electron-win-ia32 Build #2545 succeeded in 8 min 25 sec
electron-win-x64 Build #2516 succeeded in 8 min 6 sec

@kevinsawicki kevinsawicki deleted the browser-require-in-renderer-process branch Feb 28, 2017

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