From 20834f1ce34896fc87ad070c3e5c8411b3b1b070 Mon Sep 17 00:00:00 2001 From: Timothy Nikkel Date: Thu, 4 Sep 2014 11:46:06 -0700 Subject: [PATCH] Bug 1061894 - Clean up correctly in ownerdiscard.html. r=seth --- image/test/crashtests/ownerdiscard.html | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/image/test/crashtests/ownerdiscard.html b/image/test/crashtests/ownerdiscard.html index 7af6194c32e..4b7519d82da 100644 --- a/image/test/crashtests/ownerdiscard.html +++ b/image/test/crashtests/ownerdiscard.html @@ -22,9 +22,7 @@ var img = document.getElementById('victim'); var observer = new ImageDecoderObserverStub(); observer.discard = function() { - SpecialPowers.clearUserPref('min_discard_timeout_ms'); - imgLoadingContent.removeObserver(gObserver); - setTimeout("document.documentElement.className = '';", 0); + cleanupAndFinish(); } observer = SpecialPowers.wrapCallbackObject(observer); var gObserver = Cc["@mozilla.org/image/tools;1"].getService(Ci.imgITools) @@ -39,10 +37,16 @@ setTimeout(function() { document.adoptNode(tCF0); }, 0); } document.addEventListener("DOMContentLoaded", initCF, false); - function finish() { - setTimeout("document.documentElement.className = '';", 30000); + + function cleanupAndFinish() { + SpecialPowers.clearUserPref('min_discard_timeout_ms'); + imgLoadingContent.removeObserver(gObserver); + setTimeout("document.documentElement.className = '';", 0); } - window.addEventListener("load", finish, false); + function loadhandler() { + setTimeout("cleanupAndFinish();", 30000); + } + window.addEventListener("load", loadhandler, false);