You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Electron 5 webview with no contextIsolation and nativeWindowOpen fails to load a preload in a popup window in the correct context #17989
I agree to follow the Code of Conduct that this project adheres to.
I have searched the issue tracker for an issue that matches the one I want to file, without success.
Issue Details
Electron Version:
5.0.0
Operating System:
Windows (didn't test anywhere else)
Last Known Working Electron version::
? not sure.
Expected Behavior
When opening a popup window from a webview with contextIsolation=no,nativeWindowOpen=yes, the preload script for that webview should load in the popup window in the correct context
Actual Behavior
The preload script appears to fail to load in the correct context, causing things like fetch to fail with the following error: TypeError: Failed to execute 'fetch' on 'Window': The global scope is shutting down.
// window.location.href always reports about:blank in this situation for some reasonconsole.log('window.location.href',window.location.href)fetch('https://www.google.com').then(x=>console.log('success',x.text())).catch(x=>console.log('error',x))
We observed that preloads scripts are not executed after a window.open only when the opener and the opened window shares the same origin domain. But, after navigating the opened window to a different domain, preloads are executed. More details here
It really looks like #15821 has something to do with that:
When a new WebContents is created in an existing browsing instance, will renderer initialization scripts (responsible for preload scripts execution) be executed?
Thank you for taking the time to report this issue and helping to make Electron better.
The version of Electron you reported this on has been superseded by newer releases.
If you're still experiencing this issue in Electron 6.x.y or later, please add a comment specifying the version you're testing with and any other new information that a maintainer trying to reproduce the issue should know.
I'm setting the blocked/need-info label for the above reasons. This issue will be closed 7 days from now if there is no response.
We haven't gotten a response to our questions in our comment above. With only the information that is currently in the issue, we don't have enough information to take action. I'm going to close this but don't hesitate to reach out if you have or find the answers we need, we'll be happy to reopen the issue.
Activity
hugomano commentedon Apr 30, 2019
We observed that preloads scripts are not executed after a
window.openonly when the opener and the opened window shares the same origin domain. But, after navigating the opened window to a different domain, preloads are executed. More details hereIt really looks like #15821 has something to do with that:
When a new
WebContentsis created in an existing browsing instance, will renderer initialization scripts (responsible for preload scripts execution) be executed?@ppontes @deepak1556 @zcbenz any idea?
alexstrat commentedon Apr 30, 2019
Wouldn't this condition on
Opener()be preventing the execution of renderer initialization scripts?electron/atom/renderer/atom_renderer_client.cc
Lines 76 to 79 in 53f6cbc
electron-triage commentedon Feb 19, 2020
Thank you for taking the time to report this issue and helping to make Electron better.
The version of Electron you reported this on has been superseded by newer releases.
If you're still experiencing this issue in Electron 6.x.y or later, please add a comment specifying the version you're testing with and any other new information that a maintainer trying to reproduce the issue should know.
I'm setting the
blocked/need-infolabel for the above reasons. This issue will be closed 7 days from now if there is no response.Thanks in advance! Your help is appreciated.
electron-triage commentedon Feb 26, 2020
Thank you for your issue!
We haven't gotten a response to our questions in our comment above. With only the information that is currently in the issue, we don't have enough information to take action. I'm going to close this but don't hesitate to reach out if you have or find the answers we need, we'll be happy to reopen the issue.