mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-25 19:25:43 +00:00
ede8c44ef2
This excludes dom/, otherwise the file size is too large for phabricator to handle. This is an autogenerated commit to handle scripts loading mochitest harness files, in the simple case where the script src is on the same line as the tag. This was generated with https://bug1544322.bmoattachments.org/attachment.cgi?id=9058170 using the `--part 2` argument. Differential Revision: https://phabricator.services.mozilla.com/D27456 --HG-- extra : moz-landing-system : lando
109 lines
2.5 KiB
HTML
109 lines
2.5 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<!--
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=646641
|
|
-->
|
|
<head>
|
|
<title>Test for Bug 646641</title>
|
|
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
<script src="/tests/SimpleTest/WindowSnapshot.js"></script>
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
|
</head>
|
|
<body>
|
|
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=646641">Mozilla Bug 646641</a>
|
|
<p id="display"></p>
|
|
<div id="content" style="display: none">
|
|
|
|
</div>
|
|
<pre id="test">
|
|
<script type="application/javascript">
|
|
|
|
/** Test for Bug 646641 **/
|
|
|
|
/*
|
|
* In a popup (because navigating the main frame confuses Mochitest), do the
|
|
* following:
|
|
*
|
|
* * Call history.pushState().
|
|
* * Navigate to a new page.
|
|
* * Go back two history entries.
|
|
*
|
|
* Check that we go back, we retrieve the document from bfcache.
|
|
*/
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
function debug(msg) {
|
|
// Wrap dump so we can turn debug messages on and off easily.
|
|
dump(msg + "\n");
|
|
}
|
|
|
|
var expectedLoadNum = -1;
|
|
function childLoad(n) {
|
|
if (n == expectedLoadNum) {
|
|
debug("Got load " + n);
|
|
expectedLoadNum = -1;
|
|
|
|
// Spin the event loop before calling gGen.next() so the generator runs
|
|
// outside the onload handler. This prevents us from encountering all
|
|
// sorts of docshell quirks.
|
|
setTimeout(function() { gGen.next(); }, 0);
|
|
} else {
|
|
debug("Got unexpected load " + n);
|
|
ok(false, "Got unexpected load " + n);
|
|
}
|
|
}
|
|
|
|
var expectedPageshowNum = -1;
|
|
function childPageshow(n) {
|
|
if (n == expectedPageshowNum) {
|
|
debug("Got expected pageshow " + n);
|
|
expectedPageshowNum = -1;
|
|
ok(true, "Got expected pageshow " + n);
|
|
setTimeout(function() { gGen.next(); }, 0);
|
|
} else {
|
|
debug("Got pageshow " + n);
|
|
}
|
|
|
|
// Since a pageshow comes along with an onload, don't fail the test if we get
|
|
// an unexpected pageshow.
|
|
}
|
|
|
|
function waitForLoad(n) {
|
|
debug("Waiting for load " + n);
|
|
expectedLoadNum = n;
|
|
}
|
|
|
|
function waitForShow(n) {
|
|
debug("Waiting for show " + n);
|
|
expectedPageshowNum = n;
|
|
}
|
|
|
|
function* test() {
|
|
var popup = window.open("file_bfcache_plus_hash_1.html");
|
|
waitForLoad(1);
|
|
yield undefined;
|
|
|
|
popup.history.pushState("", "", "");
|
|
|
|
popup.location = "file_bfcache_plus_hash_2.html";
|
|
waitForLoad(2);
|
|
yield undefined;
|
|
|
|
// Now go back 2. The first page should be retrieved from bfcache.
|
|
popup.history.go(-2);
|
|
waitForShow(1);
|
|
yield undefined;
|
|
|
|
popup.close();
|
|
SimpleTest.finish();
|
|
}
|
|
|
|
var gGen = test();
|
|
gGen.next();
|
|
|
|
</script>
|
|
</pre>
|
|
</body>
|
|
</html>
|