summaryrefslogtreecommitdiffstats
path: root/image/test/crashtests/ownerdiscard.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /image/test/crashtests/ownerdiscard.html
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'image/test/crashtests/ownerdiscard.html')
-rw-r--r--image/test/crashtests/ownerdiscard.html48
1 files changed, 48 insertions, 0 deletions
diff --git a/image/test/crashtests/ownerdiscard.html b/image/test/crashtests/ownerdiscard.html
new file mode 100644
index 0000000000..2e5be86023
--- /dev/null
+++ b/image/test/crashtests/ownerdiscard.html
@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+<body>
+ <div id=tCF0>
+ <img id=victim src=ie.png>
+ <iframe src=discardframe.htm></iframe>
+ </div>
+ <script>
+ const Ci = SpecialPowers.Ci;
+ const Cc = SpecialPowers.Cc;
+
+ function ImageDecoderObserverStub()
+ {
+ this.sizeAvailable = function sizeAvailable(aRequest) {}
+ this.frameComplete = function frameComplete(aRequest) {}
+ this.decodeComplete = function decodeComplete(aRequest) {}
+ this.loadComplete = function loadComplete(aRequest) {}
+ this.frameUpdate = function frameUpdate(aRequest) {}
+ this.discard = function discard(aRequest) {}
+ this.isAnimated = function isAnimated(aRequest) {}
+ }
+ var img = document.getElementById('victim');
+ var observer = new ImageDecoderObserverStub();
+ observer.discard = function() {
+ cleanupAndFinish();
+ }
+ observer = SpecialPowers.wrapCallbackObject(observer);
+ var gObserver = Cc["@mozilla.org/image/tools;1"].getService(Ci.imgITools)
+ .createScriptedObserver(observer);
+ var imgLoadingContent = SpecialPowers.wrap(img);
+ imgLoadingContent.addObserver(gObserver);
+ function initCF() {
+ setTimeout(function() { document.adoptNode(tCF0); }, 0);
+ }
+ document.addEventListener("DOMContentLoaded", initCF);
+
+ function cleanupAndFinish() {
+ imgLoadingContent.removeObserver(gObserver);
+ setTimeout("document.documentElement.className = '';", 0);
+ }
+ function loadhandler() {
+ setTimeout("cleanupAndFinish();", 30000);
+ }
+ window.addEventListener("load", function() {
+ SpecialPowers.pushPrefEnv({"set":[["min_discard_timeout_ms", 1]]}, loadhandler)});
+ </script>
+</body>
+</html>