tor-browser

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

reports-are-not-observable.https.html (1028B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <head>
      4  <title>
      5    Test that NEL reports are not observable from JavaScript
      6  </title>
      7  <script src='/resources/testharness.js'></script>
      8  <script src='/resources/testharnessreport.js'></script>
      9  <script src='./support/nel.sub.js'></script>
     10 </head>
     11 <body>
     12  <script>
     13    nel_test(async t => {
     14      // Register an observer for NEL reports.
     15      var observer = new ReportingObserver((reports, _) => {
     16        assert_unreached("NEL reports should not be observable");
     17      }, {"types": ["network-error"]});
     18      observer.observe();
     19      // Make a request to a resource whose response headers include a NEL
     20      // policy.  If NEL reports are observable, this will queue a task that
     21      // calls the observer function above (which we don't want).
     22      await fetchResourceWithBasicPolicy();
     23      // Wait for one second to give any observer callback task a chance to
     24      // fire.
     25      await new Promise(resolve => t.step_timeout(resolve, 1000 /* msec */));
     26    });
     27  </script>
     28 </body>
     29 </html>