diff options
Diffstat (limited to 'docshell/test/mochitest/test_bug1121701.html')
-rw-r--r-- | docshell/test/mochitest/test_bug1121701.html | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/docshell/test/mochitest/test_bug1121701.html b/docshell/test/mochitest/test_bug1121701.html new file mode 100644 index 0000000000..9e931a8997 --- /dev/null +++ b/docshell/test/mochitest/test_bug1121701.html @@ -0,0 +1,71 @@ +<!DOCTYPE HTML> +<html> +<!-- +https://bugzilla.mozilla.org/show_bug.cgi?id=1121701 +--> +<head> + <meta charset="utf-8"> + <title>Test for Bug 1121701</title> + <script src="/tests/SimpleTest/SimpleTest.js"></script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> + <script type="application/javascript"> + + /** Test for Bug 1121701 **/ + + var testUrl1 = "file_bug1121701_1.html"; + var testUrl2 = "file_bug1121701_2.html"; + var testWin; + + var page1LoadCount = 0; + function child1PageShow(e) { + ++page1LoadCount; + if (page1LoadCount == 1) { + SimpleTest.executeSoon(function() { + is(e.persisted, false, "Initial page load shouldn't be persisted."); + testWin.document.body.innerHTML = "modified"; + testWin.onpagehide = function(event) { + testWin.onpagehide = null; + ok(event.persisted, "test page 1 should have been persisted"); + is(testWin.document.body.innerHTML, "modified"); + }; + testWin.location.href = testUrl2; + }); + } else if (page1LoadCount == 2) { + is(e.persisted, true, "Page load from bfcache should be persisted."); + is(testWin.document.body.innerHTML, "modified"); + testWin.close(); + SimpleTest.finish(); + } + } + + function child2PageShow(e) { + testWin.document.body.innerHTML = "<img>"; + SimpleTest.executeSoon(function() { + testWin.onmessage = function() { + ok(true, "Got message"); + testWin.document.body.firstChild.src = location.href; + }; + testWin.onbeforeunload = function() { + testWin.postMessage("foo", "*"); + }; + testWin.history.back(); + }); + } + + SimpleTest.waitForExplicitFinish(); + addLoadEvent(function() { + testWin = window.open(testUrl1); + }); + + </script> +</head> +<body> +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1121701">Mozilla Bug 1121701</a> +<p id="display"></p> +<div id="content" style="display: none"> + +</div> +<pre id="test"> +</pre> +</body> +</html> |