tor-browser

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

external-script-descendent.html (1185B)


      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 type="module" src="../resources/importer.sub.js?name=..%2Fresources%2Flog.sub.js%3Fname%3DA"></script>
      9 <script>
     10 const log = [];
     11 (async (variable) => {
     12  await new Promise((resolve) => {
     13    const interval = setInterval(() => {
     14      if (variable.length > 0) {
     15        clearInterval(interval);
     16        resolve(variable);
     17      }
     18    }, 10);
     19  });
     20  const importMapScript = document.createElement('script');
     21  importMapScript.type = 'importmap';
     22  importMapScript.textContent = JSON.stringify({
     23    imports: {
     24      "../resources/log.sub.js?name=A": "../resources/log.sub.js?name=B"
     25    }
     26  });
     27  document.head.appendChild(importMapScript);
     28 
     29  const inlineModule = document.createElement('script');
     30  inlineModule.type = 'module';
     31  inlineModule.innerHTML = `test(() => {
     32  assert_true(import.meta.resolve("../resources/log.sub.js?name=A").endsWith("/resources/log.sub.js?name=A"));
     33 }, "Resolution after import map should not be redefined");`;
     34  document.head.appendChild(inlineModule);
     35 })(log);
     36 </script>
     37 </body>
     38 </html>