Bug 634680: Fix intermittent failure in browser_bug553455.js test_check_security. r=gavin, a=tests
authorDave Townsend <dtownsend@oxymoronical.com>
Thu, 17 Feb 2011 09:53:45 -0800
changeset 62753 ca8863ba339b3d3171300af6a0287cf49bf4569b
parent 62752 79bbb1de25774e00508917b672d36dda3c5ebdb2
child 62754 b99674516b458e19dd1652b56cc95b9013b46109
push id18860
push userdtownsend@mozilla.com
push dateThu, 17 Feb 2011 17:57:54 +0000
treeherdermozilla-central@b99674516b45 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgavin, tests
bugs634680, 553455
milestone2.0b12pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 634680: Fix intermittent failure in browser_bug553455.js test_check_security. r=gavin, a=tests
browser/base/content/test/browser_bug553455.js
--- a/browser/base/content/test/browser_bug553455.js
+++ b/browser/base/content/test/browser_bug553455.js
@@ -796,30 +796,36 @@ function test_failed_security() {
     is(PopupNotifications.panel.childNodes.length, 1, "Should be only one notification");
     notification = aPanel.childNodes[0];
     is(notification.id, "addon-progress-notification", "Should have seen the progress notification");
 
     // Wait for it to fail
     Services.obs.addObserver(function() {
       Services.obs.removeObserver(arguments.callee, "addon-install-failed");
 
-      // Wait for the browser code to add the failure notification
-      executeSoon(function() {
-        // Wait for the progress notification to dismiss itself
-        executeSoon(function() {
-          ok(PopupNotifications.isPanelOpen, "Notification should still be open");
-          is(PopupNotifications.panel.childNodes.length, 1, "Should be only one notification");
-          notification = aPanel.childNodes[0];
-          is(notification.id, "addon-install-failed-notification", "Should have seen the install fail");
+      function waitForSingleNotification() {
+        // Notification should never close while we wait
+        ok(PopupNotifications.isPanelOpen, "Notification should still be open");
+        if (PopupNotifications.panel.childNodes.length == 2) {
+          executeSoon(waitForSingleNotification);
+          return;
+        }
 
-          Services.prefs.setBoolPref(PREF_INSTALL_REQUIREBUILTINCERTS, true);
-          wait_for_notification_close(runNextTest);
-          gBrowser.removeTab(gBrowser.selectedTab);
-        });
-      });
+        is(PopupNotifications.panel.childNodes.length, 1, "Should be only one notification");
+        notification = aPanel.childNodes[0];
+        is(notification.id, "addon-install-failed-notification", "Should have seen the install fail");
+
+        Services.prefs.setBoolPref(PREF_INSTALL_REQUIREBUILTINCERTS, true);
+        wait_for_notification_close(runNextTest);
+        gBrowser.removeTab(gBrowser.selectedTab);
+      }
+
+      // Allow the browser code to add the failure notification and then wait
+      // for the progress notification to dismiss itself
+      executeSoon(waitForSingleNotification);
     }, "addon-install-failed", false);
   });
 
   var triggers = encodeURIComponent(JSON.stringify({
     "XPI": "redirect.sjs?mode=redirect"
   }));
   gBrowser.selectedTab = gBrowser.addTab();
   gBrowser.loadURI(SECUREROOT + "installtrigger.html?" + triggers);