fix: do not mark navigations interupted with same-document navigations as aborted (#18109)
* fix: do not mark navigations interupted with same-document navigations as aborted * spec: add tests for the loadURL promise
This commit is contained in:
parent
99d4537075
commit
636273b6cb
2 changed files with 28 additions and 1 deletions
|
@ -86,10 +86,16 @@ const NavigationController = (function () {
|
|||
let navigationStarted = false
|
||||
const navigationListener = (event, url, isSameDocument, isMainFrame, frameProcessId, frameRoutingId, navigationId) => {
|
||||
if (isMainFrame) {
|
||||
if (navigationStarted) {
|
||||
if (navigationStarted && !isSameDocument) {
|
||||
// the webcontents has started another unrelated navigation in the
|
||||
// main frame (probably from the app calling `loadURL` again); reject
|
||||
// the promise
|
||||
// We should only consider the request aborted if the "navigation" is
|
||||
// actually navigating and not simply transitioning URL state in the
|
||||
// current context. E.g. pushState and `location.hash` changes are
|
||||
// considered navigation events but are triggered with isSameDocument.
|
||||
// We can ignore these to allow virtual routing on page load as long
|
||||
// as the routing does not leave the document
|
||||
return rejectAndCleanup(-3, 'ERR_ABORTED', url)
|
||||
}
|
||||
navigationStarted = true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue