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
Some ipc messages are not sent when contextIsolation and sandbox are set to true #11922
Comments
👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can. To help make it easier for us to investigate your issue, please follow the contributing guidelines. |
Updated issue to reflect this presents on Windows 10 as well. |
Reproducible in 2.0.x on Ubuntu, as well |
I think this might be a dupe of #10868? |
It looks like the same issue, but when I try to run this code on 1.7.x line, everything performs as expected. It's only when you move to 1.8 that things stop being sent. I created a repo that has similar code to the gist above: https://github.com/pcad/electron-ipc-test Commit 98be5386 uses electron 1.7.15 In 1.7 the message is passed through correctly. While the commits reference 1.7.15, I also tried 1.7.3 directly to see if something may have happened in some commits in the 1.7.x line. |
+1 desktopCapturer.getSources is also not working in preload.js when contextIsolation and sandbox are enabled. |
Thanks to @pcad for providing the context around the last version where it worked and first version where it didn't work. |
IPC events were not being delivered to renderer processes when both `contextIsolation` and `sandbox` were enabled. This is because the `AtomSandboxedRenderFrameObserver` class was incorrectly using the `MainWorldScriptContext`, rather than conditionally selecting the context based on if isolation was enabled. Fixes electron#11922
…ed (#16352) * fix: emit IPC event in correct context if isolation and sandbox enabled IPC events were not being delivered to renderer processes when both `contextIsolation` and `sandbox` were enabled. This is because the `AtomSandboxedRenderFrameObserver` class was incorrectly using the `MainWorldScriptContext`, rather than conditionally selecting the context based on if isolation was enabled. Fixes #11922
IPC events were not being delivered to renderer processes when both `contextIsolation` and `sandbox` were enabled. This is because the `AtomSandboxedRenderFrameObserver` class was incorrectly using the `MainWorldScriptContext`, rather than conditionally selecting the context based on if isolation was enabled. Fixes electron#11922
…ed (backport: 4-0-x) (#16376) * fix: emit IPC event in correct context if isolation and sandbox enabled IPC events were not being delivered to renderer processes when both `contextIsolation` and `sandbox` were enabled. This is because the `AtomSandboxedRenderFrameObserver` class was incorrectly using the `MainWorldScriptContext`, rather than conditionally selecting the context based on if isolation was enabled. Fixes #11922
…ed (electron#16352) * fix: emit IPC event in correct context if isolation and sandbox enabled IPC events were not being delivered to renderer processes when both `contextIsolation` and `sandbox` were enabled. This is because the `AtomSandboxedRenderFrameObserver` class was incorrectly using the `MainWorldScriptContext`, rather than conditionally selecting the context based on if isolation was enabled. Fixes electron#11922
…ed (#16352) * fix: emit IPC event in correct context if isolation and sandbox enabled IPC events were not being delivered to renderer processes when both `contextIsolation` and `sandbox` were enabled. This is because the `AtomSandboxedRenderFrameObserver` class was incorrectly using the `MainWorldScriptContext`, rather than conditionally selecting the context based on if isolation was enabled. Fixes #11922
…ed (#16352) * fix: emit IPC event in correct context if isolation and sandbox enabled IPC events were not being delivered to renderer processes when both `contextIsolation` and `sandbox` were enabled. This is because the `AtomSandboxedRenderFrameObserver` class was incorrectly using the `MainWorldScriptContext`, rather than conditionally selecting the context based on if isolation was enabled. Fixes #11922
…ed (#16352) (#18668) * fix: emit IPC event in correct context if isolation and sandbox enabled IPC events were not being delivered to renderer processes when both `contextIsolation` and `sandbox` were enabled. This is because the `AtomSandboxedRenderFrameObserver` class was incorrectly using the `MainWorldScriptContext`, rather than conditionally selecting the context based on if isolation was enabled. Fixes #11922
Expected behavior
ipc messages from the main process should be sent to the renderer process when both
sandbox
andcontextIsolation
are set.Actual behavior
ipc messages sent in listeners to webview events are not visible in the renderer process.
How to reproduce
The devtools will open and the console will log one message. But the second message on the ipc
ping
channel is not observed.Toggling either
sandbox
orcontextIsolation
to false allows theping
to travel to the renderer process. In the 1.7.X branch setting both values to true still allows the message to pass through successfully.The text was updated successfully, but these errors were encountered: