tor-browser

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

test_imagecache.html (1898B)


      1 <!--
      2  Any copyright is dedicated to the Public Domain.
      3  http://creativecommons.org/publicdomain/zero/1.0/
      4 -->
      5 <!DOCTYPE HTML>
      6 <html>
      7 <head>
      8  <title>Bug 1202085 - Test that images from different controllers don't cached together</title>
      9  <script src="/tests/SimpleTest/SimpleTest.js"></script>
     10  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
     11 </head>
     12 <body>
     13 <p id="display"></p>
     14 <div id="content">
     15 <iframe></iframe>
     16 </div>
     17 <pre id="test"></pre>
     18 <script class="testbody" type="text/javascript">
     19 
     20  var iframe;
     21  function runTest() {
     22    iframe = document.querySelector("iframe");
     23    iframe.src = "/tests/dom/serviceworkers/test/fetch/imagecache/register.html";
     24    window.onmessage = function(e) {
     25      if (e.data.status == "ok") {
     26        ok(e.data.result, e.data.message);
     27      } else if (e.data.status == "registrationdone") {
     28        iframe.src = "/tests/dom/serviceworkers/test/fetch/imagecache/index.html";
     29      } else if (e.data.status == "result") {
     30        is(e.data.url, "image-40px.png", "Correct url expected");
     31        is(e.data.width, 40, "Correct width expected");
     32        iframe.src = "/tests/dom/serviceworkers/test/fetch/imagecache/unregister.html";
     33      } else if (e.data.status == "unregistrationdone") {
     34        iframe.src = "/tests/dom/serviceworkers/test/fetch/imagecache/postmortem.html";
     35      } else if (e.data.status == "postmortem") {
     36        is(e.data.width, 20, "Correct width expected");
     37        window.onmessage = null;
     38        ok(true, "Test finished successfully");
     39        SimpleTest.finish();
     40      }
     41    };
     42  }
     43 
     44  SimpleTest.waitForExplicitFinish();
     45  onload = function() {
     46    SpecialPowers.pushPrefEnv({"set": [
     47      ["dom.serviceWorkers.exemptFromPerDomainMax", true],
     48      ["dom.serviceWorkers.enabled", true],
     49      ["dom.serviceWorkers.testing.enabled", true],
     50    ]}, runTest);
     51  };
     52 </script>
     53 </pre>
     54 </body>
     55 </html>