Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign up`will-navigate` event not fired when in sandbox mode #8841
Comments
This comment has been minimized.
This comment has been minimized.
Hi there, I'm experiencing a similar issue: when the user presses This happens even when the |
This comment has been minimized.
This comment has been minimized.
This happens in OS X only for me, without sandbox. |
Users can currently force the browser window to reload by using Cmd+R in macOS. The `will-navigate` even handler in this same file is supposed to protect us from this case, however its not fired at all just in macOS for some reason. As a solution, we attach dummy keyboard shortcut handlers for Cmd+R, Ctrl+R, and F5, to override the normal browser window behaviour. The reason behind disallowing reloads is that a reload during a critical operation such as writing, validation, elevating, unmounting, drive scanning, etc will cause undefined behaviour, resulting in non sense errors that we can't solve coming to TrackJS. See: electron/electron#8841 Fixes: #1210 Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
This comment has been minimized.
This comment has been minimized.
https://github.com/resin-io/etcher/pull/1219/files implements a workaround for this. |
This comment has been minimized.
This comment has been minimized.
Thanks for your input. I just want to point out that this is not a workaround for this specific issue. The issue here is that |
This comment has been minimized.
This comment has been minimized.
Lol, whoops ;-) My apologies for misunderstanding. |
Users can currently force the browser window to reload by using Cmd+R in macOS. The `will-navigate` event handler in this same file is supposed to protect us from this case, however it's not fired at all just in macOS for some reason. As a solution, we attach dummy keyboard shortcut handlers for Cmd+R, Ctrl+R, and F5, to override the normal browser window behaviour. The reason behind disallowing reloads is that a reload during a critical operation such as writing, validation, elevating, unmounting, drive scanning, etc will cause undefined behaviour, resulting in nonsense errors that we can't solve coming to TrackJS. See: electron/electron#8841 Fixes: #1210 Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
Users can currently force the browser window to reload by using Cmd+R in macOS. The `will-navigate` event handler in this same file is supposed to protect us from this case, however it's not fired at all just in macOS for some reason. As a solution, we attach dummy keyboard shortcut handlers for Cmd+R, Ctrl+R, and F5, to override the normal browser window behaviour. The reason behind disallowing reloads is that a reload during a critical operation such as writing, validation, elevating, unmounting, drive scanning, etc will cause undefined behaviour, resulting in nonsense errors that we can't solve coming to TrackJS. See: electron/electron#8841 Fixes: #1210 Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
This comment has been minimized.
This comment has been minimized.
what is the status on a fix here? |
This comment has been minimized.
This comment has been minimized.
Actually |
This comment has been minimized.
This comment has been minimized.
We are no longer implementing bugfixes for versions of Electron <= |
This comment has been minimized.
This comment has been minimized.
@codebytere This bug still exists in v3.0.0, so please reopen the issue. |
This comment has been minimized.
This comment has been minimized.
Great! will do, thanks for the fast response |
This is now more of a problem in the Electron app because of electron/electron#8841 but is still annoying in the webapp if you're taken away from your chat client. Exception is the SSO link, as commented (issue filed at vector-im/riot-web#8247). Fixes vector-im/riot-web#8226
This comment has been minimized.
This comment has been minimized.
Still exists in 4.* Is there any workaround to make it works? |
This comment has been minimized.
This comment has been minimized.
As well as in v5 beta |
This comment has been minimized.
This comment has been minimized.
I can reproduce this too, will-navigate is never fired, which makes aborting navigations for security reasons a hassle. Also nothing in the docs state that sandboxing will prevent the firing of this event. |
sandbox: true 指定すると will-navigate イベントが発火しない問題がある rel. electron/electron#8841
This comment has been minimized.
This comment has been minimized.
you can "fix" this by doing the following:
but note that it disables CMD+R across all applications the user has open (e.g. they won't be able to reload a page in Chrome using CMD+R) |
This comment has been minimized.
This comment has been minimized.
We still observe this on 5.0.5. Any updates? The workaround of disabling the cmd-R shortcut is not applicable for us, as we are trying to prevent link navigations (i.e. not just page reloads) for security and user experience purposes. |
This comment has been minimized.
This comment has been minimized.
This is still a problem at:
Any news on this? |
This comment has been minimized.
This comment has been minimized.
same issue in 5.0.6 |
This comment has been minimized.
This comment has been minimized.
No news, but i did some brief digging and it seems the sandbox codepath never invokes |
This comment has been minimized.
This comment has been minimized.
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 v4.2.x 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 Thanks in advance! Your help is appreciated. |
This comment has been minimized.
This comment has been minimized.
There are 6+ months of comments confirming it is still present in versions post-4.2, please do not close this issue again. |
This comment has been minimized.
This comment has been minimized.
I did some more in-depth digging to understand when OpenURLFromTab was called. It appears it was only called when a new process was created. I've created a pull request that fixes the tactical issue. |
This comment has been minimized.
This comment has been minimized.
Perhaps this should rely on |
Thanks for Electron! Amazing project :)
It happens when
BrowserWindow
is opened withsandbox: true
. It might be on purpose, but I couldn't find any Electron/Chromium documentation that explains why. So I'm suspecting it's a bug. I can submit a PR with a failing test to this repo if you agree that it's a bug.Expected behavior
webContents
'will-navigate
event should fire when user reloads page fx.Actual behavior
It does not fire.
How to reproduce
package.json:
main.js:
index.html:
Perform these steps:
npm install
./node_modules/.bin/electron .
Expected output:
Actual output:
(will-navigate is not fired).
If you outcomment the line
sandbox:true
inmain.js
, then it works as expected.