зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1536471 - Write tests for nsISHistory::RemoveFrameEntries, r=peterv
Differential Revision: https://phabricator.services.mozilla.com/D24977 --HG-- extra : rebase_source : 8eceb765754180b8fa64ca300497b61503b1a37a extra : source : b081ebe7b3f52dec2a85e744b2dd2a4b0f344f8e extra : histedit_source : 42000d31c502554cdcd91a326c369b375f90429e
This commit is contained in:
Родитель
bee5c226d0
Коммит
d4a3299bea
|
@ -0,0 +1,8 @@
|
|||
<html>
|
||||
<body onload="opener.bodyOnLoad()">
|
||||
Nested Frame
|
||||
<div id="frameContainer">
|
||||
<iframe id="staticFrame" src="frame0.html"></iframe>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -70,6 +70,8 @@ skip-if = (!debug && (os == 'mac' || os == 'win')) # Bug 874423
|
|||
[test_bug1364364.html]
|
||||
skip-if = (os == "android") # Bug 1560378
|
||||
[test_bug1375833.html]
|
||||
[test_bug1536471.html]
|
||||
support-files = file_bug1536471.html
|
||||
[test_child.html]
|
||||
skip-if = fission # Times out.
|
||||
[test_grandchild.html]
|
||||
|
|
|
@ -0,0 +1,75 @@
|
|||
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=1536471
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 1536471</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
<script type="application/javascript">
|
||||
|
||||
let testWin;
|
||||
async function test() {
|
||||
// Open a new tab and load a document with an iframe inside
|
||||
testWin = window.open("file_bug1536471.html");
|
||||
await waitForLoad();
|
||||
var iframe = testWin.document.getElementById("staticFrame");
|
||||
is(testWin.history.length, 1, "Checking the number of session history entries when there is only one iframe");
|
||||
|
||||
// Navigate the iframe to different pages
|
||||
await loadUriInFrame(iframe, "frame1.html");
|
||||
is(testWin.history.length, 2, "Checking the number of session history entries after having navigated a single iframe 1 time");
|
||||
await loadUriInFrame(iframe, "frame2.html");
|
||||
is(testWin.history.length, 3, "Checking the number of session history entries after having navigated a single iframe 2 times");
|
||||
await loadUriInFrame(iframe, "frame3.html");
|
||||
is(testWin.history.length, 4, "Checking the number of session history entries after having navigated a single iframe 3 times");
|
||||
|
||||
// Reload the top document
|
||||
testWin.location.reload(true);
|
||||
await waitForLoad();
|
||||
is(testWin.history.length, 1, "Checking the number of session history entries after reloading the top document");
|
||||
|
||||
testWin.close();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
async function waitForLoad() {
|
||||
await new Promise(resolve => {
|
||||
window.bodyOnLoad = function() {
|
||||
setTimeout(resolve, 0);
|
||||
window.bodyOnLoad = undefined;
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
async function iframeOnload(frame) {
|
||||
return new Promise(resolve => {
|
||||
frame.addEventListener("load", () => {
|
||||
setTimeout(resolve, 0);
|
||||
}, {once: true});
|
||||
});
|
||||
}
|
||||
|
||||
async function loadUriInFrame(frame, uri) {
|
||||
let onloadPromise = iframeOnload(frame);
|
||||
frame.src = uri;
|
||||
await onloadPromise;
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1536471">Mozilla Bug </a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="text/javascript">
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
</script>
|
||||
</pre>
|
||||
<body onload="test()">
|
||||
</body>
|
||||
</html>
|
||||
|
Загрузка…
Ссылка в новой задаче