tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_bug703855.html (1821B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=703855
      5 -->
      6 <head>
      7  <meta charset="utf-8">
      8  <title>Test for Bug 703855</title>
      9  <script src="/tests/SimpleTest/SimpleTest.js"></script>
     10  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
     11 </head>
     12 <body>
     13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=703855">Mozilla Bug 703855</a>
     14 <p id="display"></p>
     15 <div id="content" style="display: none">
     16  <iframe id="f" src="file_bug703855.html"></iframe>
     17 </div>
     18 <pre id="test">
     19 <script type="application/javascript">
     20 
     21 /** Test for Bug 703855 */
     22 
     23 SimpleTest.waitForExplicitFinish();
     24 
     25 var timingAttributes = [
     26  "connectEnd",
     27  "connectStart",
     28  "domComplete",
     29  "domContentLoadedEventEnd",
     30  "domContentLoadedEventStart",
     31  "domInteractive",
     32  "domLoading",
     33  "domainLookupEnd",
     34  "domainLookupStart",
     35  "fetchStart",
     36  "loadEventEnd",
     37  "loadEventStart",
     38  "navigationStart",
     39  "redirectEnd",
     40  "redirectStart",
     41  "requestStart",
     42  "responseEnd",
     43  "responseStart",
     44  "unloadEventEnd",
     45  "unloadEventStart",
     46 ];
     47 var originalTiming = {};
     48 
     49 function runTest() {
     50  var timing = $("f").contentWindow.performance.timing;
     51  for (let i in timingAttributes) {
     52    originalTiming[timingAttributes[i]] = timing[timingAttributes[i]];
     53  }
     54 
     55  var doc = $("f").contentDocument;
     56  doc.open();
     57  doc.write("<!DOCTYPE html>");
     58  doc.close();
     59 
     60  SimpleTest.executeSoon(function() {
     61    var newTiming = $("f").contentWindow.performance.timing;
     62    for (let i in timingAttributes) {
     63      is(newTiming[timingAttributes[i]], originalTiming[timingAttributes[i]],
     64         "document.open should not affect value of " + timingAttributes[i]);
     65    }
     66    SimpleTest.finish();
     67  });
     68 }
     69 
     70 addLoadEvent(function() {
     71  SimpleTest.executeSoon(runTest);
     72 });
     73 
     74 
     75 
     76 </script>
     77 </pre>
     78 </body>
     79 </html>