tor-browser

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

status-codes-create-entry.html (1757B)


      1 <!doctype html>
      2 <html>
      3 <head>
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 </head>
      7 <body>
      8 <img src="resources/status-code.py?status=200">
      9 <img src="resources/status-code.py?status=307">
     10 <img src="resources/status-code.py?status=404">
     11 <img src="resources/status-code.py?status=502">
     12 <script src="resources/status-code.py?status=200&script=1"></script>
     13 <script src="resources/status-code.py?status=307&script=1"></script>
     14 <script src="resources/status-code.py?status=404&script=1"></script>
     15 <script src="resources/status-code.py?status=502&script=1"></script>
     16 <script>
     17 async_test(t => {
     18  window.addEventListener("load", t.step_func_done(() => {
     19    const images = document.getElementsByTagName("img");
     20    for (let img of images) {
     21      const entries = performance.getEntriesByName(img.src);
     22      assert_greater_than(entries.length, 0, img.src);
     23      assert_greater_than(entries[0].duration, 0, img.src);
     24    }
     25    const scripts = document.getElementsByTagName("script");
     26    let ignoredScripts = 0;
     27    for (let script of scripts) {
     28      if (!script.src || script.src.match(/testharness(report)?\.js$/)) {
     29        // Ignore this script, which has no src value, and the `testharness*.js`
     30        // scripts. `testharness*.js` may be cached from a previous test and
     31        // served quickly enough for a coarsened `duration` to be zero exactly.
     32        ignoredScripts++;
     33      } else {
     34        const entries = performance.getEntriesByName(script.src);
     35        assert_greater_than(entries.length, 0, script.src);
     36        assert_greater_than(entries[0].duration, 0, script.src);
     37      }
     38    }
     39    assert_equals(ignoredScripts, 3);
     40  }));
     41 }, "Make sure all status codes are reported");
     42 </script>