no bug - Bumping Firefox l10n changesets r=release a=l10n-bump DONTBUILD CLOSED TREE
[gecko.git] / docshell / test / navigation / test_bug1379762.html
blobeda3b539a55311b1eff1c74bfd7c485714351861
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=
5 -->
6 <head>
7 <title>Test for Bug 1379762</title>
8 <script src="/tests/SimpleTest/SimpleTest.js"></script>
9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
10 </head>
11 <body onload="runTest()">
12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1379762">Mozilla Bug 1379762</a>
13 <p id="display"></p>
14 <div id="content" style="display: none">
16 </div>
17 <pre id="test">
18 <script type="application/javascript">
19 /**
20 * - This page opens new window
21 * - new window sends 'init' msg
22 * - onload() in new window sends 'increment_loadCount' msg
23 * - onpageshow() in new window sends 'increment_testCount' msg
24 * - This page sends 'forward_back' msg
25 * - onpageshow() in new window 'increment_testCount'
26 * - This page sends 'finish_test' msg
27 * - onpageshow() in new window sends 'finished' msg
29 var testCount = 0; // Used by the test files.
30 var loadCount = 0;
31 var goneBack = false;
32 var bc = new BroadcastChannel("bug1379762");
33 bc.onmessage = (messageEvent) => {
34 let message = messageEvent.data;
35 if (message == "init") {
36 is(testCount, 0, "new window should only be loaded once; otherwise the loadCount variable makes no sense");
37 } else if (message == "increment_loadCount") {
38 loadCount++;
39 is(loadCount, 1, "Should only get one load")
40 } else if (message == 'increment_testCount') {
41 testCount++;
42 if (testCount == 1) {
43 bc.postMessage("forward_back");
44 goneBack = true;
45 } else if (testCount == 2) {
46 ok(goneBack, "We had a chance to navigate backwards and forwards in the new window to test BFCache");
47 bc.postMessage("finish_test");
49 } else if (message == "finished") {
50 bc.close();
51 SimpleTest.finish();
55 SimpleTest.waitForExplicitFinish();
57 function runTest() {
58 // If Fission is disabled, the pref is no-op.
59 SpecialPowers.pushPrefEnv({set: [["fission.bfcacheInParent", true]]}, () => {
60 window.open("file_bug1379762-1.html", "", "width=360,height=480,noopener");
61 });
64 </script>
65 </pre>
66 </body>
67 </html>