Bug 546169 - Use an event listener instead of a timeout to avoid intermittent failures. r=gavin, a=test-only
authorSteven MacLeod <smacleod@mozilla.com>
Sun, 15 Dec 2013 14:05:53 -0500
changeset 167773 df1dead3ff6747fd1d402b4001f1e6e043d6b29d
parent 167772 8bb67e4b5d97ec96e3c59e606568d84faf3479bd
child 167774 069d7c01db7d65c55b6d63594afff1277a1683a3
push id428
push userbbajaj@mozilla.com
push dateTue, 28 Jan 2014 00:16:25 +0000
treeherdermozilla-release@cd72a7ff3a75 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgavin, test-only
bugs546169
milestone27.0
Bug 546169 - Use an event listener instead of a timeout to avoid intermittent failures. r=gavin, a=test-only
browser/components/safebrowsing/content/test/browser.ini
browser/components/safebrowsing/content/test/browser_bug415846.js
--- a/browser/components/safebrowsing/content/test/browser.ini
+++ b/browser/components/safebrowsing/content/test/browser.ini
@@ -1,8 +1,8 @@
 [DEFAULT]
 support-files = head.js
 
 [browser_bug400731.js]
-# [browser_bug415846.js]
-# Disabled for too many intermittent failures (bug 546169)
-# Previously disabled on Mac because of its bizarre special-and-unique
+[browser_bug415846.js]
+skip-if = os == "mac"
+# Disabled on Mac because of its bizarre special-and-unique
 # snowflake of a help menu.
--- a/browser/components/safebrowsing/content/test/browser_bug415846.js
+++ b/browser/components/safebrowsing/content/test/browser_bug415846.js
@@ -32,21 +32,23 @@ function testNormal_PopupListener() {
   var reportMenu = document.getElementById("menu_HelpPopup_reportPhishingtoolmenu");
   var errorMenu = document.getElementById("menu_HelpPopup_reportPhishingErrortoolmenu");
   is(reportMenu.hidden, false, "Report phishing menu should be visible on normal sites");
   is(errorMenu.hidden, true, "Report error menu item should be hidden on normal sites");
   menu.hidePopup();
   
   // Now launch the phishing test.  Can't use onload here because error pages don't
   // fire normal load events.
+  window.addEventListener("DOMContentLoaded", testPhishing, true);
   content.location = "http://www.mozilla.org/firefox/its-a-trap.html";
-  setTimeout(testPhishing, 2000);
 }
 
 function testPhishing() {
+  window.removeEventListener("DOMContentLoaded", testPhishing, true);
+
   menu.addEventListener("popupshown", testPhishing_PopupListener, false);
   menu.openPopup(null, "", 0, 0, false, null);
 }
 
 function testPhishing_PopupListener() {
   menu.removeEventListener("popupshown", testPhishing_PopupListener, false);
   
   var reportMenu = document.getElementById("menu_HelpPopup_reportPhishingtoolmenu");