tor-browser

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

ownerdiscard.html (1784B)


      1 <!DOCTYPE html>
      2 <html class="reftest-wait">
      3 <body>
      4  <div id=tCF0>
      5    <img id=victim src=ie.png>
      6    <iframe src=discardframe.htm></iframe>
      7  </div>
      8  <script>
      9    const Ci = SpecialPowers.Ci;
     10    const Cc = SpecialPowers.Cc;
     11 
     12    function ImageDecoderObserverStub()
     13    {
     14      this.sizeAvailable = function sizeAvailable(aRequest)   {}
     15      this.frameComplete = function frameComplete(aRequest)   {}
     16      this.decodeComplete = function decodeComplete(aRequest) {}
     17      this.loadComplete = function loadComplete(aRequest)     {}
     18      this.frameUpdate = function frameUpdate(aRequest)       {}
     19      this.discard = function discard(aRequest)               {}
     20      this.isAnimated = function isAnimated(aRequest)         {}
     21    }
     22    var img = document.getElementById('victim');
     23    var observer = new ImageDecoderObserverStub();
     24    observer.discard = function() {
     25      cleanupAndFinish();
     26    }
     27    observer = SpecialPowers.wrapCallbackObject(observer);
     28    var gObserver = Cc["@mozilla.org/image/tools;1"].getService(Ci.imgITools)
     29                                                    .createScriptedObserver(observer);
     30    var imgLoadingContent = SpecialPowers.wrap(img);
     31    imgLoadingContent.addObserver(gObserver);
     32    function initCF() {
     33      setTimeout(function() { document.adoptNode(tCF0); }, 0);
     34    }
     35    document.addEventListener("DOMContentLoaded", initCF);
     36 
     37    function cleanupAndFinish() {
     38      imgLoadingContent.removeObserver(gObserver);
     39      setTimeout("document.documentElement.className = '';", 0);
     40    }
     41    function loadhandler() {
     42      setTimeout("cleanupAndFinish();", 30000);
     43    }
     44    window.addEventListener("load", function() {
     45      SpecialPowers.pushPrefEnv({"set":[["min_discard_timeout_ms", 1]]}, loadhandler)});
     46  </script>
     47 </body>
     48 </html>