From 6aa5d9168b0a4e9b03c670d2161675fcc62cdbd3 Mon Sep 17 00:00:00 2001 From: Marco Bonardo Date: Thu, 19 Nov 2009 14:15:01 +0100 Subject: [PATCH] Bug 521889 - browser_461743.js is randomly timing out, r=zeniko --- .../test/browser/browser_461743.js | 51 +++++++++---------- .../test/browser/browser_461743_sample.html | 20 +++++--- 2 files changed, 39 insertions(+), 32 deletions(-) diff --git a/browser/components/sessionstore/test/browser/browser_461743.js b/browser/components/sessionstore/test/browser/browser_461743.js index 702ca7ce918..744480608cf 100644 --- a/browser/components/sessionstore/test/browser/browser_461743.js +++ b/browser/components/sessionstore/test/browser/browser_461743.js @@ -36,37 +36,36 @@ function test() { /** Test for Bug 461743 **/ - + waitForExplicitFinish(); - + let testURL = "http://localhost:8888/browser/" + "browser/components/sessionstore/test/browser/browser_461743_sample.html"; - + + let frameCount = 0; let tab = gBrowser.addTab(testURL); - info("New tab added"); tab.linkedBrowser.addEventListener("load", function(aEvent) { - info("New tab loaded"); + // Wait for all frames to load completely. + if (frameCount++ < 2) + return; tab.linkedBrowser.removeEventListener("load", arguments.callee, true); - executeSoon(function() { - let tab2 = gBrowser.duplicateTab(tab); - info("Duplicated tab"); - tab2.linkedBrowser.addEventListener("461743", function(aEvent) { - tab2.linkedBrowser.removeEventListener("461743", arguments.callee, true); - is(aEvent.data, "done", "XSS injection was attempted"); - - executeSoon(function() { - let iframes = tab2.linkedBrowser.contentWindow.frames; - let innerHTML = iframes[1].document.body.innerHTML; - isnot(innerHTML, Components.utils.reportError.toString(), - "chrome access denied!"); - - // clean up - gBrowser.removeTab(tab2); - gBrowser.removeTab(tab); - - finish(); - }); - }, true, true); - }); + let tab2 = gBrowser.duplicateTab(tab); + tab2.linkedBrowser.addEventListener("461743", function(aEvent) { + tab2.linkedBrowser.removeEventListener("461743", arguments.callee, true); + is(aEvent.data, "done", "XSS injection was attempted"); + + executeSoon(function() { + let iframes = tab2.linkedBrowser.contentWindow.frames; + let innerHTML = iframes[1].document.body.innerHTML; + isnot(innerHTML, Components.utils.reportError.toString(), + "chrome access denied!"); + + // Clean up. + gBrowser.removeTab(tab2); + gBrowser.removeTab(tab); + + finish(); + }); + }, true, true); }, true); } diff --git a/browser/components/sessionstore/test/browser/browser_461743_sample.html b/browser/components/sessionstore/test/browser/browser_461743_sample.html index 4150ede3236..e2d41634e68 100644 --- a/browser/components/sessionstore/test/browser/browser_461743_sample.html +++ b/browser/components/sessionstore/test/browser/browser_461743_sample.html @@ -10,17 +10,25 @@