-
Notifications
You must be signed in to change notification settings - Fork 15k
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
[Bug]: Frame unable to use preload scripts when contentWindow is used to early. #34727
Comments
Reproducable with Electron 20.1.0. |
Reproducable with Electron 21.3.1. |
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment! |
This is still an issue with Electron 23.1.1. Also tested and an issue with v24.0.0-alpha.5. |
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment! |
The problem still exists with Electron v25.0.0 and possible the previous versions too. |
I can verify I have this same issue as well, though I haven't tried the workaround described above. Electron v25.0.1 |
bump |
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment! |
bump |
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment! |
This issue is still affecting us. |
bump |
Preflight Checklist
Electron Version
19.0.4, 20.1.0, 21.3.1
What operating system are you using?
Windows
Operating System Version
Windows 10 Pro 21H2
What arch are you using?
x64
Last Known Working Electron version
No response
Expected Behavior
Preload scripts should load in sub frames when nodeIntegrationInSubFrames is set to true.
Actual Behavior
Preload scripts wont load in sub frames.
Testcase Gist URL
https://gist.github.com/83f23ea2dea571eedb1b9048c8d8c111
Additional Information
By adding iframes dynamically to the DOM and then accessing the contentWindow or contentDocument property of the iframe the loading of preload scripts for this iframe wont happen until the iframe navigates to a different src or is reloaded.
Simple sample:
Executing a script directly inside the webContents frame-created event will also ensure that the preload scriptes are not loaded:
This happens very often in the wild, just browsing a little bit and I can see that many frames wont load the preload scripts.
Workaround:
A way around it seems to be to check if new frames have executed the preload script which is mentioned in #32453. And as mentioned there, this is a very janky workaround
In most cases this "workaround" will break whatever a website intended to do with such an IFrame, so use it with caution.
This issue is similar to #32453 but I created a separate issue because the way of causing this effect seems to be different.
Possible related to #32661.
The text was updated successfully, but these errors were encountered: