tor-browser

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

test_performance_server_timing_plain_http.html (1138B)


      1 <!--
      2  Any copyright is dedicated to the Public Domain.
      3  http://creativecommons.org/publicdomain/zero/1.0/
      4 -->
      5 <!DOCTYPE html>
      6 <html>
      7 <head>
      8 <meta charset=utf-8>
      9 <title>Plain HTTP Test for PerformanceServerTiming</title>
     10 <script src="/resources/testharness.js"></script>
     11 <script src="/resources/testharnessreport.js"></script>
     12 </head>
     13 <body>
     14 <div id="log"></div>
     15 <script>
     16 function makeXHR(aUrl) {
     17  var xmlhttp = new XMLHttpRequest();
     18  xmlhttp.open("get", aUrl, true);
     19  xmlhttp.send();
     20 }
     21 
     22 promise_test(t => {
     23  var promise = new Promise(resolve => {
     24    performance.clearResourceTimings();
     25 
     26    var observer = new PerformanceObserver(list => resolve(list));
     27    observer.observe({entryTypes: ['resource']});
     28    t.add_cleanup(() => observer.disconnect());
     29  });
     30 
     31  makeXHR("serverTiming.sjs");
     32 
     33  return promise.then(list => {
     34    assert_equals(list.getEntries().length, 1);
     35    assert_equals(list.getEntries()[0].serverTiming, undefined);
     36    assert_equals(list.getEntries()[0].toJSON().serverTiming, undefined,
     37 	  "toJSON should not pick up properties that aren't on the object");
     38  });
     39 }, "server-timing test");
     40 
     41 </script>
     42 </body>