Bug 1675318 - Part 10: Split up test for bug 1326251 from test_sessionhistory.html, r=peterv

Differential Revision: https://phabricator.services.mozilla.com/D96873
This commit is contained in:
Anny Gakhokidze 2020-11-13 23:29:17 +00:00
Родитель 6f21987309
Коммит 33ff5ea576
4 изменённых файлов: 77 добавлений и 46 удалений

Просмотреть файл

@ -141,8 +141,7 @@
innerStaticFrame = staticFrame.contentDocument.getElementById("staticFrame");
opener.is(innerStaticFrame.contentDocument.location.href, BASE_URL + "frame1.html", "innerStaticFrame location");
opener.ok(!staticFrame.contentDocument.getElementById("dynamicFrame"), "innerDynamicFrame should not exist");
opener.nextTest();
window.close();
opener.finishTest();
},
];
@ -177,13 +176,6 @@
function test() {
if (opener) {
// Disable the subtest for now since it relies on the bfcache.
if (opener.SpecialPowers.Services.appinfo.sessionHistoryInParent) {
opener.nextTest();
window.close();
return;
}
// Ensure the tests are not executed in onload hander.
setTimeout(testSteps[opener.testCount++], 0);
}

Просмотреть файл

@ -103,6 +103,8 @@ skip-if = fission # It relies on the bfcache
[test_bug1609475.html]
[test_bug1300461.html]
skip-if = fission
[test_bug1326251.html]
skip-if = toolkit == 'android' || fission # It relies on the bfcache
[test_sibling-matching-parent.html]
[test_sibling-off-domain.html]
[test_triggeringprincipal_frame_nav.html]

Просмотреть файл

@ -0,0 +1,74 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=
-->
<head>
<title>Test for Bug 1326251</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body onload="runTest()">
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1326251">Mozilla Bug 1326251</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
let chromeScript = null;
if (SpecialPowers.Services.appinfo.sessionHistoryInParent) {
chromeScript = SpecialPowers.loadChromeScript(() => {
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
function doSend(message, fn) {
try {
// eslint-disable-next-line no-undef
sendAsyncMessage(message, {success: true, value: fn()});
} catch(_) {
// eslint-disable-next-line no-undef
sendAsyncMessage(message, {success: false});
}
}
// eslint-disable-next-line no-undef
addMessageListener("evictAllContentViewers", _ => {
doSend("evictAllContentViewers", () => {
let win = Services.wm.getMostRecentWindow("navigator:browser");
let shistory = win.gBrowser.selectedBrowser.browsingContext.sessionHistory;
return shistory.evictAllContentViewers();
})
});
});
}
async function evictAllContentViewers() {
let p = chromeScript.promiseOneMessage("evictAllContentViewers");
chromeScript.sendAsyncMessage("evictAllContentViewers");
let result = await p;
ok(result.success, "Called evictAllContentViewers from parent");
}
var testCount = 0;
SimpleTest.waitForExplicitFinish();
var testWindow;
function runTest() {
testWindow = window.open("file_bug1326251.html", "", "width=360,height=480");
testWindow.onunload = function() { }; // to prevent bfcache
}
function finishTest() {
if (chromeScript) {
chromeScript.destroy();
}
testWindow.close();
SimpleTest.finish();
}
</script>
</pre>
</body>
</html>

Просмотреть файл

@ -17,39 +17,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=
<pre id="test">
<script type="application/javascript">
let chromeScript = null;
if (SpecialPowers.Services.appinfo.sessionHistoryInParent) {
chromeScript = SpecialPowers.loadChromeScript(() => {
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
function doSend(message, fn) {
try {
// eslint-disable-next-line no-undef
sendAsyncMessage(message, {success: true, value: fn()});
} catch(_) {
// eslint-disable-next-line no-undef
sendAsyncMessage(message, {success: false});
}
}
// eslint-disable-next-line no-undef
addMessageListener("evictAllContentViewers", _ => {
doSend("evictAllContentViewers", () => {
let win = Services.wm.getMostRecentWindow("navigator:browser");
let shistory = win.gBrowser.selectedBrowser.browsingContext.sessionHistory;
return shistory.evictAllContentViewers();
})
});
});
}
async function evictAllContentViewers() {
let p = chromeScript.promiseOneMessage("evictAllContentViewers");
chromeScript.sendAsyncMessage("evictAllContentViewers");
let result = await p;
ok(result.success, "Called evictAllContentViewers from parent");
}
/** Test for Bug **/
var testFiles =
@ -57,7 +24,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=
"file_bug462076_2.html", // Dynamic frames when handling onload
"file_bug462076_3.html", // Dynamic frames after onload
// "file_static_and_dynamic_1.html",// Static and dynamic frames and forward-back
"file_bug1326251.html",
"file_bug1379762-1.html",
];
var testCount = 0; // Used by the test files.
@ -74,9 +40,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=
testWindow = window.open(nextFile, "", "width=360,height=480");
testWindow.onunload = function() { }; // to prevent bfcache
} else {
if (chromeScript) {
chromeScript.destroy();
}
SimpleTest.finish();
}
}