From 7f834e8478d647e63e80f1e0c1930858bf382dc2 Mon Sep 17 00:00:00 2001 From: "bzbarsky%mit.edu" Date: Fri, 20 Nov 2009 01:40:50 +0000 Subject: [PATCH] Update bug 529119 tests to not rely on error page titles. git-svn-id: svn://10.0.0.236/trunk@259044 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/docshell/test/test_bug529119-1.html | 17 ++++++++--------- mozilla/docshell/test/test_bug529119-2.html | 15 +++++++-------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/mozilla/docshell/test/test_bug529119-1.html b/mozilla/docshell/test/test_bug529119-1.html index 7a864ac9cac..994e89ef76b 100644 --- a/mozilla/docshell/test/test_bug529119-1.html +++ b/mozilla/docshell/test/test_bug529119-1.html @@ -17,25 +17,24 @@ var w = null; var phase = 0; var gotWrongPageOnTryAgainClick = false; -function pollForPage(expected_title, f, w) +function pollForPage(f, w) { // Start with polling after a delay, we might mistakenly take the current page // as an expected one. window.setTimeout(function() { - var iterationsLeft = 20; + var iterationsLeft = 200; var int = window.setInterval(function() { iterationsLeft--; - - netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); + + var haveErrorPage = false; try { var title = w.document.title; } catch (ex) { - alert(ex); - return; + haveErrorPage = true; } - if (iterationsLeft == 0 || title.match(expected_title)) { + if (iterationsLeft == 0 || haveErrorPage) { window.clearInterval(int); f(iterationsLeft > 0); } @@ -56,7 +55,7 @@ function windowLoaded() phase = 1; - pollForPage("Problem loading page", function(succeeded) { + pollForPage(function(succeeded) { ok(succeeded, "Waiting for error page succeeded"); netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); @@ -64,7 +63,7 @@ function windowLoaded() click the "Try Again" button */ w.location.reload(); - pollForPage("Problem loading page", function(succeeded) { + pollForPage(function(succeeded) { ok(succeeded, "Waiting for error page succeeded"); netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); diff --git a/mozilla/docshell/test/test_bug529119-2.html b/mozilla/docshell/test/test_bug529119-2.html index db33c06598d..d4b7b5379d9 100644 --- a/mozilla/docshell/test/test_bug529119-2.html +++ b/mozilla/docshell/test/test_bug529119-2.html @@ -16,25 +16,24 @@ var faultyURL = "http://some-non-existent-domain-27489274c892748217cn2384.com/"; var w = null; var phase = 0; -function pollForPage(expected_title, f, w) +function pollForPage(expectErrorPage, f, w) { // Start with polling after a delay, we might mistakenly take the current page // as an expected one. window.setTimeout(function() { - var iterationsLeft = 20; + var iterationsLeft = 200; var int = window.setInterval(function() { iterationsLeft--; - netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); + var haveErrorPage = false; try { var title = w.document.title; } catch (ex) { - alert(ex); - return; + haveErrorPage = true; } - if (iterationsLeft == 0 || title.match(expected_title)) { + if (iterationsLeft == 0 || expectErrorPage == haveErrorPage) { window.clearInterval(int); f(iterationsLeft > 0); } @@ -52,7 +51,7 @@ function windowLoaded() w.location.href = faultyURL; }, 0); - pollForPage("Problem loading page", function(succeeded) { + pollForPage(true, function(succeeded) { ok(succeeded, "Waiting for error page succeeded"); netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); @@ -64,7 +63,7 @@ function windowLoaded() ok(false, "w.back() threw " + ex); } - pollForPage("Test bug 529119, sub-window", function(succeeded) { + pollForPage(false, function(succeeded) { ok(succeeded, "Waiting for original page succeeded"); netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");