Skip to content
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

Preload script executed twice on Electron 2.0.x #12045

Closed
MarshallOfSound opened this issue Feb 26, 2018 · 1 comment
Closed

Preload script executed twice on Electron 2.0.x #12045

MarshallOfSound opened this issue Feb 26, 2018 · 1 comment
Assignees
Labels
2-0-x bug/regression ↩️ A new version of Electron broke something

Comments

@MarshallOfSound
Copy link
Member

  • Electron version: 2.0.0-beta.1
  • Operating system: macOS

Expected behavior

Preload script should execute once

Actual behavior

Preload script (and in fact node_bootstrap.js) is executed twice in the same process but in a different context.

How to reproduce

Struggling to isolate this from the application that is experiencing it but I have narrowed it down to this being kind of expected behavior but with a newly introduced bug in 2.0.x. Basically when you call loadURL a renderer process is initially launched pointing at about:blank. In this process renderer/init.js is called and then the window navigates to the URL you requested.

For an as yet unknown reason in 2.0.x the --preload argument is present on the renderer process when the about:blank page is loaded causing user code to execute twice in the same process. This is only a problem because native modules can only be loaded once in a given process.

The fix for this would be to revert to original behavior where the --preload (amongst others) arguments are not sent to the renderer until the users page is loaded. (Don't send them for about:blank).

I'm currently working on a minimal sample

@MarshallOfSound MarshallOfSound added 2-0-x fixme/bug bug/regression ↩️ A new version of Electron broke something labels Feb 26, 2018
@deepak1556 deepak1556 self-assigned this Feb 26, 2018
@MarshallOfSound MarshallOfSound self-assigned this Mar 5, 2018
MarshallOfSound added a commit that referenced this issue Mar 9, 2018
* Reverts 370476c in favor of moving the previous logic to the new RenderFrameObserver instead of RenderViewObserver

Fixes #12045
sethlu pushed a commit to sethlu/electron that referenced this issue May 3, 2018
* Reverts 370476c in favor of moving the previous logic to the new RenderFrameObserver instead of RenderViewObserver

Fixes electron#12045
@nornagon
Copy link
Member

Did you manage to find a minimal sample? It'd be great to have a test for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2-0-x bug/regression ↩️ A new version of Electron broke something
Projects
None yet
Development

No branches or pull requests

4 participants