docshell/test/test_bug691547.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=691547
michael@0 5 -->
michael@0 6 <head>
michael@0 7 <title>Test for Bug 691547</title>
michael@0 8 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
michael@0 10 <script type="application/javascript">
michael@0 11 var navStart = 0;
michael@0 12 var beforeReload = 0;
michael@0 13 function onContentLoad() {
michael@0 14 var frame = frames[0];
michael@0 15 if (!navStart) {
michael@0 16 // First time we perform navigation in subframe. The bug is that
michael@0 17 // load in subframe causes timing.navigationStart to be recorded
michael@0 18 // as if it was a start of the next navigation.
michael@0 19 var innerFrame = frame.frames[0];
michael@0 20 navStart = frame.performance.timing.navigationStart;
michael@0 21 innerFrame.location = 'bug570341_recordevents.html';
michael@0 22 // Let's wait a bit so the difference is clear anough.
michael@0 23 setTimeout(reload, 3000);
michael@0 24 }
michael@0 25 else {
michael@0 26 // Content reloaded, time to check. We are allowing a huge time slack,
michael@0 27 // in case clock is imprecise. If we have a bug, the difference is
michael@0 28 // expected to be about the timeout value set above.
michael@0 29 var diff = frame.performance.timing.navigationStart - beforeReload;
michael@0 30 ok(diff >= -200,
michael@0 31 'navigationStart should be set after reload request. ' +
michael@0 32 'Measured difference: ' + diff + ' (should be positive)');
michael@0 33 SimpleTest.finish();
michael@0 34 }
michael@0 35 }
michael@0 36 function reload() {
michael@0 37 var frame = frames[0];
michael@0 38 ok(navStart == frame.performance.timing.navigationStart,
michael@0 39 'navigationStart should not change when frame loads.');
michael@0 40 beforeReload = Date.now();
michael@0 41 frame.location.reload();
michael@0 42 }
michael@0 43 </script>
michael@0 44 </head>
michael@0 45 <body>
michael@0 46 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=570341">Mozilla Bug 570341</a>
michael@0 47 <div id="frames">
michael@0 48 <iframe name="frame0" id="frame0" src="bug691547_frame.html" onload="onContentLoad()"></iframe>
michael@0 49 </div>
michael@0 50 <div id="content" style="display: none">
michael@0 51
michael@0 52 </div>
michael@0 53 <pre id="test">
michael@0 54 <script type="application/javascript">
michael@0 55 SimpleTest.waitForExplicitFinish();
michael@0 56 </script>
michael@0 57 </pre>
michael@0 58 </body>
michael@0 59 </html>

mercurial