-
Notifications
You must be signed in to change notification settings - Fork 15.8k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Fix window.opener being null when nativeWindowOpen is used #9961
Conversation
This appears to cause the renderer process to crash after the second navigation. This is due to the webContents launched from |
Two additional things here.
|
The newly opened window appears to crash when switching domains in some cases, can't figure out why. If anyone has any ideas would be appreciated 👍 |
Haven't confirmed, but possibly related to if |
Yeah, I was looking into this a bit as well via #9928, I think we need to get all the preferences supported that can overridden via |
Do you have the stack trace for this crash? |
@kevinsawicki As much as I try I can't get Electron to dump a crash stack on me. The renderer window just closes by itself just after a page navigation is started. Repro is as easy as |
130cb50
to
3ac2f67
Compare
Just figured out how to stop the random crash on navigation in the opened window Pinging @electron/maintainers this is a pretty important fix for |
atom/browser/atom_browser_client.cc
Outdated
// reuse the same site to allow cross-window scripting. We do | ||
// not need to check urls / domains as native window open logic | ||
// handles cross site scripting protection. | ||
if (WebContentsPreferences::UsesNativeWindowOpen(web_contents)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like this is effectively if (true)
since we already checked for if (!WebContentsPreferences::UsesNativeWindowOpen(web_contents))
above. Could you remove the unnecessary check?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically yeah, thought it would be good to be explicit in code though. I'll change it to still be explicit but not fetch the preferences twice 👍
atom/browser/atom_browser_client.cc
Outdated
// | ||
// NOTE: We know that nativeWindowOpen is enabled at this point | ||
// because we check if it is NOT enabled above this point. We | ||
// will only reach this return if sanbox is disabled but |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sandbox
Fixes #9581 #8100 #9533
Not 100% sure if this is the correct fix but (a) it works and (b) it looks right to me 😆
/cc @zcbenz @kevinsawicki Can you make sure this isn't doing something silly