Backed out 2 changesets (bug 1740517, bug 1740516) for causing failures at browser_bug343515.js and browser_browsingContext-webProgress.js. CLOSED TREE

Backed out changeset e656dd82e48a (bug 1740517)
Backed out changeset 9eb7a39f39b7 (bug 1740516)
This commit is contained in:
Butkovits Atila
2021-11-23 23:28:54 +02:00
parent 003eb16923
commit f11c69b446
10 changed files with 6 additions and 238 deletions

View File

@@ -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) {

View File

@@ -657,10 +657,6 @@ NS_IMETHODIMP
SessionHistoryEntry::SetLayoutHistoryState(
nsILayoutHistoryState* aLayoutHistoryState) {
SharedInfo()->mLayoutHistoryState = aLayoutHistoryState;
if (SharedInfo()->mLayoutHistoryState) {
SharedInfo()->mLayoutHistoryState->SetScrollPositionOnly(
!SharedInfo()->mSaveLayoutState);
}
return NS_OK;
}

View File

@@ -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>

View File

@@ -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>

View File

@@ -1,11 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<script>
addEventListener("pageshow", () => { history.back(); });
</script>
</head>
<body>
</body>
</html>

View File

@@ -1,32 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<script>
window.addEventListener("pageshow", ({ persisted }) => {
let bc = new BroadcastChannel("bug1740517");
bc.addEventListener("message", ({ data }) => {
switch (data) {
case "enter_data":
document.getElementById("formElement").value = "test";
break;
case "navigate":
bc.close();
document.location = "file_bug1740517.html?1";
break;
case "back":
history.back();
break;
case "close":
window.close();
break;
}
});
bc.postMessage({ persisted, formData: document.getElementById("formElement").value });
});
</script>
</head>
<body>
<input id="formElement" type="text" value="initial">
</body>
</html>

View File

@@ -1 +0,0 @@
Cache-Control: no-store

View File

@@ -112,15 +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_bug1740517.html]
support-files =
file_bug1740517.html
file_bug1740517.html^headers^
[test_close_onpagehide_by_history_back.html]
[test_close_onpagehide_by_window_close.html]
[test_compressed_multipart.html]

View File

@@ -1,76 +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");
SimpleTest.finish();
}
</script>
</head>
<body onload="runTest();">
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test"></pre>
</body>
</html>

View File

@@ -1,46 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Test form restoration for no-store pages</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" href="/tests/SimpleTest/test.css"/>
<script>
SimpleTest.waitForExplicitFinish();
function runTest() {
let bc = new BroadcastChannel("bug1740517");
new Promise(resolve => {
bc.addEventListener("message", resolve, { once: true });
}).then(() => {
return new Promise((resolve) => {
bc.postMessage("enter_data");
bc.addEventListener("message", resolve, { once: true });
bc.postMessage("navigate");
});
}).then(() => {
return new Promise((resolve) => {
bc.addEventListener("message", ({ data }) => {
resolve(data);
}, { once: true });
bc.postMessage("back");
});
}).then(({ persisted, formData }) => {
ok(!persisted, "Page with a no-store header shouldn't be bfcached.");
is(formData, "initial", "We shouldn't restore form data when going back to a page with a no-store header.");
bc.postMessage("close");
SimpleTest.finish();
});
window.open("file_bug1740517.html", "", "noopener");
}
</script>
</head>
<body onload="runTest();">
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test"></pre>
</body>
</html>