зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1646609: Don't assert when an inactive/OOP inner window tries to navigate an OOP BrowsingContext. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D81731
This commit is contained in:
Родитель
9c264b7cf2
Коммит
d646c6cbe9
|
@ -1578,12 +1578,7 @@ nsresult BrowsingContext::LoadURI(nsDocShellLoadState* aLoadState,
|
|||
win->GetCurrentInnerWindow()->GetWindowGlobalChild()) {
|
||||
wgc->SendLoadURI(this, aLoadState, aSetNavigating);
|
||||
}
|
||||
} else {
|
||||
MOZ_DIAGNOSTIC_ASSERT(XRE_IsParentProcess());
|
||||
if (!XRE_IsParentProcess()) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
} else if (XRE_IsParentProcess()) {
|
||||
if (Canonical()->LoadInParent(aLoadState, aSetNavigating)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1616,6 +1611,13 @@ nsresult BrowsingContext::LoadURI(nsDocShellLoadState* aLoadState,
|
|||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
MOZ_DIAGNOSTIC_ASSERT(sourceBC);
|
||||
if (!sourceBC) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
// If we're in a content process and the source BC is no longer in-process,
|
||||
// just fail silently.
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -116,6 +116,7 @@ support-files = file_bug675587.html
|
|||
[test_framedhistoryframes.html]
|
||||
support-files = file_framedhistoryframes.html
|
||||
[test_pushState_after_document_open.html]
|
||||
[test_navigate_after_pagehide.html]
|
||||
[test_windowedhistoryframes.html]
|
||||
[test_triggeringprincipal_location_seturi.html]
|
||||
[test_bug1507702.html]
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for navigation attempts by scripts in inactive inner window</title>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<iframe src="dummy_page.html" id="iframe"></iframe>
|
||||
|
||||
<script>
|
||||
"use strict";
|
||||
|
||||
add_task(async function() {
|
||||
let iframe = document.getElementById("iframe");
|
||||
|
||||
let navigate = iframe.contentWindow.eval(`(function() {
|
||||
location.href = "/";
|
||||
})`);
|
||||
|
||||
iframe.src = "http://example.com/";
|
||||
await new Promise(resolve =>
|
||||
iframe.addEventListener("load", resolve, { once: true })
|
||||
);
|
||||
|
||||
// This should do nothing. But, importantly, it should especially not crash.
|
||||
navigate();
|
||||
|
||||
ok(true, "We didn't crash");
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Загрузка…
Ссылка в новой задаче