image/test/crashtests/ownerdiscard.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial