mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-03 02:25:34 +00:00
Backed out changeset a905fca36db2 (bug 1740516) for causing bc failures on browser_bug343515.js. CLOSED TREE
This commit is contained in:
parent
ee404e4fd7
commit
4ec6cdf544
@ -2910,21 +2910,12 @@ void BrowsingContext::DidSet(FieldIndex<IDX_IsInBFCache>) {
|
||||
nsDocShell::Cast(mDocShell)->MaybeDisconnectChildListenersOnPageHide();
|
||||
}
|
||||
|
||||
if (isInBFCache) {
|
||||
PreOrderWalk([&](BrowsingContext* aContext) {
|
||||
nsCOMPtr<nsIDocShell> shell = aContext->GetDocShell();
|
||||
if (shell) {
|
||||
nsDocShell::Cast(shell)->FirePageHideShowNonRecursive(false);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
PostOrderWalk([&](BrowsingContext* aContext) {
|
||||
nsCOMPtr<nsIDocShell> shell = aContext->GetDocShell();
|
||||
if (shell) {
|
||||
nsDocShell::Cast(shell)->FirePageHideShowNonRecursive(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
PreOrderWalk([&](BrowsingContext* aContext) {
|
||||
nsCOMPtr<nsIDocShell> shell = aContext->GetDocShell();
|
||||
if (shell) {
|
||||
nsDocShell::Cast(shell)->FirePageHideShowNonRecursive(!isInBFCache);
|
||||
}
|
||||
});
|
||||
|
||||
if (isInBFCache) {
|
||||
PreOrderWalk([&](BrowsingContext* aContext) {
|
||||
|
@ -154,7 +154,7 @@ add_task(async function() {
|
||||
is(request.URI.spec, secondLocation);
|
||||
}
|
||||
|
||||
const onBackLocationChanged = waitForNextLocationChange(webProgress, true);
|
||||
const onBackLocationChanged = waitForNextLocationChange(webProgress);
|
||||
const onBackDocumentStart = waitForNextDocumentStart(webProgress);
|
||||
browser.goBack();
|
||||
|
||||
@ -190,7 +190,7 @@ add_task(async function() {
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
|
||||
function waitForNextLocationChange(webProgress, onlyTopLevel = false) {
|
||||
function waitForNextLocationChange(webProgress) {
|
||||
return new Promise(resolve => {
|
||||
const wpl = {
|
||||
QueryInterface: ChromeUtils.generateQI([
|
||||
@ -198,10 +198,6 @@ function waitForNextLocationChange(webProgress, onlyTopLevel = false) {
|
||||
"nsISupportsWeakReference",
|
||||
]),
|
||||
onLocationChange(progress, request, location, flags) {
|
||||
if (onlyTopLevel && progress.browsingContext.parent) {
|
||||
// Ignore non-toplevel.
|
||||
return;
|
||||
}
|
||||
webProgress.removeProgressListener(wpl, Ci.nsIWebProgress.NOTIFY_ALL);
|
||||
resolve({
|
||||
browsingContext: progress.browsingContext,
|
||||
|
@ -1,29 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<script>
|
||||
window.addEventListener("pageshow", ({ persisted }) => {
|
||||
let bc = new BroadcastChannel("bug1740516_1");
|
||||
bc.addEventListener("message", ({ data }) => {
|
||||
bc.close();
|
||||
switch (data) {
|
||||
case "block_bfcache_and_navigate":
|
||||
window.onunload = () => {};
|
||||
// Fall through
|
||||
case "navigate":
|
||||
document.location = "file_bug1740516_2.html";
|
||||
break;
|
||||
case "close":
|
||||
window.close();
|
||||
break;
|
||||
}
|
||||
});
|
||||
bc.postMessage(persisted);
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<iframe src="file_bug1740516_1_inner.html"></iframe>
|
||||
</body>
|
||||
</html>
|
@ -1,15 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<script>
|
||||
window.addEventListener("pageshow", ({ persisted }) => {
|
||||
let bc = new BroadcastChannel("bug1740516_1_inner");
|
||||
bc.postMessage(persisted);
|
||||
bc.close();
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
@ -1,11 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<script>
|
||||
addEventListener("pageshow", () => { history.back(); });
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
@ -112,11 +112,6 @@ support-files = file_bug675587.html
|
||||
[test_bug1729662.html]
|
||||
support-files =
|
||||
file_bug1729662.html
|
||||
[test_bug1740516.html]
|
||||
support-files =
|
||||
file_bug1740516_1.html
|
||||
file_bug1740516_1_inner.html
|
||||
file_bug1740516_2.html
|
||||
[test_close_onpagehide_by_history_back.html]
|
||||
[test_close_onpagehide_by_window_close.html]
|
||||
[test_compressed_multipart.html]
|
||||
|
@ -1,79 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test pageshow event order for iframe</title>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css"/>
|
||||
<script>
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function waitForPageShow(outer, inner) {
|
||||
return new Promise((resolve) => {
|
||||
let results = [];
|
||||
outer.addEventListener("message", ({ data: persisted }) => {
|
||||
results.push({ name: outer.name, persisted });
|
||||
if (results.length == 2) {
|
||||
resolve(results);
|
||||
}
|
||||
}, { once: true });
|
||||
inner.addEventListener("message", ({ data: persisted }) => {
|
||||
results.push({ name: inner.name, persisted });
|
||||
if (results.length == 2) {
|
||||
resolve(results);
|
||||
}
|
||||
}, { once: true });
|
||||
});
|
||||
}
|
||||
async function runTest() {
|
||||
let outerBC = new BroadcastChannel("bug1740516_1");
|
||||
let innerBC = new BroadcastChannel("bug1740516_1_inner");
|
||||
|
||||
let check = waitForPageShow(outerBC, innerBC).then(([first, second]) => {
|
||||
is(first.name, "bug1740516_1_inner", "Should get pageShow from inner iframe page first.");
|
||||
ok(!first.persisted, "First navigation shouldn't come from BFCache.");
|
||||
is(second.name, "bug1740516_1", "Should get pageShow from outer page second.");
|
||||
ok(!second.persisted, "First navigation shouldn't come from BFCache.");
|
||||
}, () => {
|
||||
ok(false, "The promises should not be rejected.");
|
||||
});
|
||||
window.open("file_bug1740516_1.html", "", "noopener");
|
||||
await check;
|
||||
|
||||
check = waitForPageShow(outerBC, innerBC).then(([first, second]) => {
|
||||
is(first.name, "bug1740516_1_inner", "Should get pageShow from inner iframe page first.");
|
||||
ok(first.persisted, "Second navigation should come from BFCache");
|
||||
is(second.name, "bug1740516_1", "Should get pageShow from outer page second.");
|
||||
ok(second.persisted, "Second navigation should come from BFCache");
|
||||
}, () => {
|
||||
ok(false, "The promises should not be rejected.");
|
||||
});
|
||||
outerBC.postMessage("navigate");
|
||||
await check;
|
||||
|
||||
check = waitForPageShow(outerBC, innerBC).then(([first, second]) => {
|
||||
is(first.name, "bug1740516_1_inner", "Should get pageShow from inner iframe page first.");
|
||||
ok(!first.persisted, "Third navigation should not come from BFCache");
|
||||
is(second.name, "bug1740516_1", "Should get pageShow from outer page second.");
|
||||
ok(!second.persisted, "Third navigation should not come from BFCache");
|
||||
}, () => {
|
||||
ok(false, "The promises should not be rejected.");
|
||||
});
|
||||
outerBC.postMessage("block_bfcache_and_navigate");
|
||||
await check;
|
||||
|
||||
outerBC.postMessage("close");
|
||||
|
||||
outerBC.close();
|
||||
innerBC.close();
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body onload="runTest();">
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<pre id="test"></pre>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user