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
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.
Preflight Checklist
Issue Details
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 contextActual 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.
To Reproduce
index.html
webview-test.html
preload.js
forked quick start repo with reproduction
https://github.com/Tim91084/electron-window-open-bug
Screenshots
The text was updated successfully, but these errors were encountered: