tor-browser

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

mime-sniffing.https.html (1082B)


      1 <!DOCTYPE html>
      2 <title>Service Worker: MIME sniffing</title>
      3 <script src="/resources/testharness.js"></script>
      4 <script src="/resources/testharnessreport.js"></script>
      5 <script src="/common/get-host-info.sub.js"></script>
      6 <script src="resources/test-helpers.sub.js"></script>
      7 <script>
      8 promise_test(t => {
      9    const SCOPE = 'resources/blank.html?mime-sniffing';
     10    const SCRIPT = 'resources/mime-sniffing-worker.js';
     11    return service_worker_unregister_and_register(t, SCRIPT, SCOPE)
     12      .then(registration => {
     13          add_completion_callback(() => registration.unregister());
     14          return wait_for_state(t, registration.installing, 'activated');
     15        })
     16      .then(_ => with_iframe(SCOPE))
     17      .then(frame => {
     18          add_completion_callback(() => frame.remove());
     19          assert_equals(frame.contentWindow.document.body.innerText, 'test');
     20          const h1 = frame.contentWindow.document.getElementById('testid');
     21          assert_equals(h1.innerText,'test');
     22        });
     23  }, 'The response from service worker should be correctly MIME siniffed.');
     24 </script>