tor-browser

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

request-headers.https.html (1771B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8">
      3 <title>Navigation Preload request headers</title>
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 <script src="../resources/test-helpers.sub.js"></script>
      7 <script>
      8 promise_test(t => {
      9    var script = 'resources/request-headers-worker.js';
     10    var scope = 'resources/request-headers-scope.py';
     11    return service_worker_unregister_and_register(t, script, scope)
     12      .then(registration => {
     13          add_completion_callback(_ => registration.unregister());
     14          var worker = registration.installing;
     15          return wait_for_state(t, worker, 'activated');
     16        })
     17      .then(_ => with_iframe(scope))
     18      .then(frame => {
     19          var headers = JSON.parse(frame.contentDocument.body.textContent);
     20          assert_true(
     21            'SERVICE-WORKER-NAVIGATION-PRELOAD' in headers,
     22            'The Navigation Preload request must specify a ' +
     23            '"Service-Worker-Navigation-Preload" header.');
     24          assert_array_equals(
     25            headers['SERVICE-WORKER-NAVIGATION-PRELOAD'],
     26            ['hello'],
     27            'The Navigation Preload request must specify the correct value ' +
     28            'for the "Service-Worker-Navigation-Preload" header.');
     29          assert_true(
     30            'UPGRADE-INSECURE-REQUESTS' in headers,
     31            'The Navigation Preload request must specify an ' +
     32            '"Upgrade-Insecure-Requests" header.');
     33          assert_array_equals(
     34            headers['UPGRADE-INSECURE-REQUESTS'],
     35            ['1'],
     36            'The Navigation Preload request must specify the correct value ' +
     37            'for the "Upgrade-Insecure-Requests" header.');
     38        });
     39  }, 'Navigation Preload request headers.');
     40 
     41 </script>