tor-browser

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

script-module-import-dynamic.sub.html (1094B)


      1 <!DOCTYPE html>
      2 <!--
      3 [%provenance%]
      4 -->
      5 <html lang="en">
      6  <meta charset="utf-8">
      7  <title>HTTP headers on request for dynamic ECMAScript module import</title>
      8  <script src="/resources/testharness.js"></script>
      9  <script src="/resources/testharnessreport.js"></script>
     10  <script src="/fetch/metadata/resources/helper.sub.js"></script>
     11  <script type="module">
     12  'use strict';
     13  {%- for subtest in subtests %}
     14 
     15  promise_test(() => {
     16    const key = '{{uuid()}}';
     17    const url = makeRequestURL(
     18      key, [% subtest.origins %], { mime: 'application/javascript' }
     19    );
     20 
     21    return import(url)
     22      .then(() => retrieve(key))
     23      .then((headers) => {
     24        {%- if subtest.expected == none %}
     25          assert_not_own_property(headers, '[%subtest.headerName%]');
     26        {%- else %}
     27          assert_own_property(headers, '[%subtest.headerName%]');
     28          assert_array_equals(headers['[%subtest.headerName%]'], ['[%subtest.expected%]']);
     29        {%- endif %}
     30        });
     31  }, '[%subtest.headerName%][%subtest.description | pad("start", " - ")%]');
     32 
     33  {%- endfor %}
     34  </script>
     35 </html>