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.

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

mercurial