tor-browser

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

printpreview_images_sw.html (1345B)


      1 <!doctype html>
      2 <style>
      3  img, object, svg, input { display: block }
      4  div {
      5    /* Defeats the stylesheet cache also caching our image responses */
      6    --u: url(nonexistent.png?1);
      7    content: var(--u);
      8    width: 32px;
      9    height: 32px;
     10  }
     11 </style>
     12 <script>
     13 const WORKER = "printpreview_images_sw.js";
     14 if (location.href.includes("registered")) {
     15  console.log("REGISTERED");
     16  onload = function() {
     17    postMessage("ready", "*");
     18  }
     19  onbeforeunload = function() {
     20    navigator.serviceWorker.getRegistrations().then(function(registrations) {
     21      for(let registration of registrations) {
     22        registration.unregister()
     23      }
     24    })
     25    navigator.serviceWorker.unregister(WORKER);
     26  }
     27 } else {
     28  navigator.serviceWorker.oncontrollerchange = function() {
     29    location.href = location.href + "?registered";
     30  };
     31  navigator.serviceWorker.register(WORKER);
     32 }
     33 </script>
     34 <div></div>
     35 <picture>
     36  <source srcset="nonexistent.png?2">
     37  <img width=32 height=32>
     38 </picture>
     39 <picture>
     40  <source srcset="nonexistent.png?3" media="print">
     41  <source srcset="animated.gif" media="not print">
     42  <img width=32 height=32>
     43 </picture>
     44 <img src="nonexistent.png?4" width=32 height=32>
     45 <svg width="32" height="32">
     46  <image x=0 y=0 href="nonexistent.png?7" width=32 height=32></image>
     47 </svg>
     48 <input type="image" src="nonexistent.png?6" width=32 height=32>