docshell/test/test_bug580069.html

Wed, 31 Dec 2014 13:27:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 13:27:57 +0100
branch
TOR_BUG_3246
changeset 6
8bccb770b82d
permissions
-rw-r--r--

Ignore runtime configuration files generated during quality assurance.

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <html>
michael@0 3 <!--
michael@0 4 https://bugzilla.mozilla.org/show_bug.cgi?id=580069
michael@0 5 -->
michael@0 6 <head>
michael@0 7 <title>Test for Bug 580069</title>
michael@0 8 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 9 <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
michael@0 10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
michael@0 11 </head>
michael@0 12 <body>
michael@0 13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=580069">Mozilla Bug 580069</a>
michael@0 14
michael@0 15 <iframe id='iframe' src='file_bug580069_1.html'></iframe>
michael@0 16
michael@0 17 <script type="application/javascript">
michael@0 18
michael@0 19 SimpleTest.expectAssertions(1);
michael@0 20
michael@0 21 SimpleTest.waitForExplicitFinish();
michael@0 22
michael@0 23 var iframe = document.getElementById('iframe');
michael@0 24 var iframeCw = iframe.contentWindow;
michael@0 25
michael@0 26 // Called when file_bug580069_1.html loads.
michael@0 27 function page1Load() {
michael@0 28 // This should cause us to load file 2.
michael@0 29 dump('page1Load\n');
michael@0 30 iframeCw.document.getElementById('form').submit();
michael@0 31 }
michael@0 32
michael@0 33 // Called when file_bug580069_2.html loads.
michael@0 34 var page2Loads = 0;
michael@0 35 function page2Load(method) {
michael@0 36
michael@0 37 dump("iframe's location is: " + iframeCw.location + ", method is " + method + "\n");
michael@0 38
michael@0 39 if (page2Loads == 0) {
michael@0 40 is(method, "POST", "Method for first load should be POST.");
michael@0 41 iframeCw.history.replaceState('', '', '?replaced');
michael@0 42
michael@0 43 // This refresh shouldn't pop up the "are you sure you want to refresh a page
michael@0 44 // with POST data?" dialog. If it does, this test will hang and fail, and
michael@0 45 // we'll see 'Refreshing iframe...' at the end of the test log.
michael@0 46 dump('Refreshing iframe...\n');
michael@0 47 iframeCw.location.reload();
michael@0 48 }
michael@0 49 else if (page2Loads == 1) {
michael@0 50 is(method, "GET", "Method for second load should be GET.");
michael@0 51 is(iframeCw.location.search, "?replaced", "Wrong search on iframe after refresh.");
michael@0 52 SimpleTest.finish();
michael@0 53 }
michael@0 54 else {
michael@0 55 ok(false, "page2Load should only be called twice.");
michael@0 56 }
michael@0 57
michael@0 58 page2Loads++;
michael@0 59 }
michael@0 60 </script>
michael@0 61
michael@0 62 </body>
michael@0 63 </html>

mercurial