tor-browser

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

script-304.html (1134B)


      1 <!doctype html>
      2 <html>
      3  <head>
      4    <meta charset="utf-8">
      5    <script src="/resources/testharness.js"></script>
      6    <script src="/resources/testharnessreport.js"></script>
      7    <script src="/common/get-host-info.sub.js"></script>
      8    <script src="/common/utils.js"></script>
      9  </head>
     10  <body>
     11    <div id="testDiv"></div>
     12    <script>
     13 
     14 const scriptURL = get_host_info().HTTP_REMOTE_ORIGIN + "/cors/resources/cache-304.py?" + token();
     15 
     16 function loadScript(test)
     17 {
     18    const script = document.createElement("script");
     19    script.crossOrigin = "anonymous";
     20    script.src = scriptURL;
     21    return new Promise((resolve, reject) => {
     22        // Let's add a small timeout so that the script is fully loaded in memory cache before reloading it.
     23        script.onload = test.step_timeout(resolve, 50);
     24        script.onerror = reject;
     25        testDiv.appendChild(script);
     26    });
     27 }
     28 
     29 promise_test((test) => {
     30    return loadScript(test);
     31 }, "Load a fresh cross-origin script");
     32 
     33 promise_test((test) => {
     34    return loadScript(test);
     35 }, "Reload same cross-origin script from the memory cache after revalidation");
     36 
     37 </script>
     38  </body>
     39 </html>