tor-browser

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

dynamic.html (1130B)


      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 <script>
      9 const log = [];
     10 
     11 // First, use a module specifier
     12 promise_test(() => {
     13  return import("../resources/log.js?pipe=sub&name=A")
     14    .then(() => {
     15      assert_array_equals(log, ["log:A"], "First import should use original module");
     16    });
     17 }, "Initial import before import map");
     18 
     19 // Now try to redefine it with multiple import map rules
     20 </script>
     21 <script type="importmap">
     22 {
     23  "imports": {
     24    "../resources/log.js?pipe=sub&name=A": "../resources/log.js?pipe=sub&name=B",
     25    "http:/": "../resources/log.js?pipe=sub&name=scheme",
     26    "https:/": "../resources/log.js?pipe=sub&name=scheme"
     27  }
     28 }
     29 </script>
     30 <script type="module">
     31 // Testing that the resolution is correct using `resolve`, as you can't import
     32 // the same module twice.
     33 test(() => {
     34  assert_true(import.meta.resolve("../resources/log.js?pipe=sub&name=A")
     35              .endsWith("/resources/log.js?pipe=sub&name=A"));
     36 }, "Resolution after import map should not be redefined");
     37 </script>
     38 </body>
     39 </html>