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
[Bug]: clicking on a link before loadURL has resolved causes the promise to reject, even if the link navigation was prevented #28338
I agree to follow the Code of Conduct that this project adheres to.
I have searched the issue tracker for a feature request that matches the one I want to file, without success.
Electron Version
12.0.1, 11.2.1
What operating system are you using?
Windows
Operating System Version
Windows 10 v1909
What arch are you using?
x64
Last Known Working Electron version
No response
Expected Behavior
I expect that calling preventDefault in the will-navigate handler will prevent us from attempting the navigation
Actual Behavior
This doesn't seem to happen if we're in the middle of a loadURL call
Testcase Gist URL
No response
this issue may very well be a dupe of this one and related to this one though I'm not calling loadURL twice.
I'm experiencing an issue in my app where if there's network delay, I make a loadURL and click a link on the main page before loadURL has finished, we get an ERR_ABORTED error. From reading in other issues, this is expected when a navigation happens in the middle of a navigation.
So I attempted to solve this by canceling the navigation in the will-navigate handler when the main window's webcontents are still loading (isLoadingMainFrame()), however, this doesn't solve the crash. The navigation is prevented, but WebContents::did-start-navigation has already fired for whatever reason (I'd expect it to fire afterwill-navigate), and we get the crash
add network delay. What I did was start Fiddler, Rules -> Performance -> Simulate Modem speeds
Both will-navigate and did-start-navigation are pretty direct exposures of the underlying Chromium callbacks. Perhaps we should be hooking something other than did-start-navigation in loadURL to reject the promise if the page is navigated away before finishing the load?
side note, i'm changing the title here to reflect that this is a rejected promise rather than a crash per se.
changed the title [-][Bug]: clicking on a link before loadURL has resolved causes a crash[/-][+][Bug]: clicking on a link before loadURL has resolved causes a rejection, even if the link navigation was prevented[/+]on Mar 22, 2021
changed the title [-][Bug]: clicking on a link before loadURL has resolved causes a rejection, even if the link navigation was prevented[/-][+][Bug]: clicking on a link before loadURL has resolved causes the promise to reject, even if the link navigation was prevented[/+]on Mar 22, 2021
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 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 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 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 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 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 has been closed due to inactivity, and will not be monitored. If this is a bug and you can reproduce this issue on a supported version of Electron please open a new issue and include instructions for reproducing the issue.
Activity
nornagon commentedon Mar 22, 2021
Here's a Fiddle version using an in-process server that responds slowly: https://gist.github.com/0926377bbb9d14cd9319f8d26698e543
This is somewhat intentional: we explicitly listen to
did-start-navigationand cancel the promise withERR_ABORTEDin navigation-controller.ts:electron/lib/browser/navigation-controller.ts
Line 111 in 665ac6f
Both
will-navigateanddid-start-navigationare pretty direct exposures of the underlying Chromium callbacks. Perhaps we should be hooking something other thandid-start-navigationinloadURLto reject the promise if the page is navigated away before finishing the load?side note, i'm changing the title here to reflect that this is a rejected promise rather than a crash per se.
[-][Bug]: clicking on a link before loadURL has resolved causes a crash[/-][+][Bug]: clicking on a link before loadURL has resolved causes a rejection, even if the link navigation was prevented[/+][-][Bug]: clicking on a link before loadURL has resolved causes a rejection, even if the link navigation was prevented[/-][+][Bug]: clicking on a link before loadURL has resolved causes the promise to reject, even if the link navigation was prevented[/+]github-actions commentedon Oct 6, 2022
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!
pushkin- commentedon Oct 7, 2022
repros in Electron 21
github-actions commentedon Jan 10, 2023
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!
pushkin- commentedon Jan 12, 2023
repros in v22
github-actions commentedon Apr 14, 2023
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!
pushkin- commentedon Apr 14, 2023
bump
github-actions commentedon Jul 14, 2023
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!
pushkin- commentedon Jul 14, 2023
bump
electron-issue-triage commentedon Oct 14, 2023
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!
pushkin- commentedon Oct 16, 2023
my original gist repros in v27. The gist by nornagon stopped being repro-able for several versions already for a reason I didn't dig into.
electron-issue-triage commentedon Jan 15, 2024
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!
electron-issue-triage commentedon Feb 15, 2024
This issue has been closed due to inactivity, and will not be monitored. If this is a bug and you can reproduce this issue on a supported version of Electron please open a new issue and include instructions for reproducing the issue.