From e8051a2512c9e9ceb7bd62e033d831de9d529d9e Mon Sep 17 00:00:00 2001 From: Justin Wood Date: Fri, 5 Dec 2008 23:04:18 -0500 Subject: [PATCH] Bug 467206, Correctly remove the load listener in mochibrowser: browser_bug441778.js r=gavin --- browser/base/content/test/browser_bug441778.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/browser/base/content/test/browser_bug441778.js b/browser/base/content/test/browser_bug441778.js index 58f35510c392..253c75a0e84e 100644 --- a/browser/base/content/test/browser_bug441778.js +++ b/browser/base/content/test/browser_bug441778.js @@ -77,9 +77,6 @@ function test() { }; let continueTest = function() { - // Remove the load listener so it doesn't get called for the sub-document. - testBrowser.removeEventListener("load", continueTest, true); - // Change the zoom level and then save it so we can compare it to the level // after loading the sub-document. FullZoom.enlarge(); @@ -97,7 +94,12 @@ function test() { // Note: in order for the sub-document load to trigger a location change // the way it does under real world usage scenarios, we have to continue // the test in a timeout for some unknown reason. - let continueListener = function() { window.setTimeout(continueTest, 0) }; + let continueListener = function() { + window.setTimeout(continueTest, 0); + + // Remove the load listener so it doesn't get called for the sub-document. + testBrowser.removeEventListener("load", continueListener, true); + }; testBrowser.addEventListener("load", continueListener, true); // Start the test by loading the test page.