Bug 1372834 - browser/browser_updatesBackgroundWindowFailures.js fails when ran with --verify and when it runs without other tests. r=mhowell
authorRobert Strong <robert.bugzilla@gmail.com>
Mon, 31 Dec 2018 03:24:04 -0800
changeset 509281 07b8f593f7b3ab8dd1c8a0312a2d79b3f07cf753
parent 509280 16823b6a72c5885ce37849fe5d2526d9600696c6
child 509282 9f2d4be8d8c808cb4549549ac41ab023a4dde91e
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmhowell
bugs1372834
milestone66.0a1
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 1372834 - browser/browser_updatesBackgroundWindowFailures.js fails when ran with --verify and when it runs without other tests. r=mhowell Changed checkWhatsNewLink to take a window param so the currently focused window is checked. Changed PREF_APP_UPDATE_DOWNLOADPROMPTMAXATTEMPTS to PREF_APP_UPDATE_DOWNLOADPROMPT_MAXATTEMPTS so it is properly named.
toolkit/mozapps/update/tests/browser/browser.ini
toolkit/mozapps/update/tests/browser/browser_TelemetryUpdatePing.js
toolkit/mozapps/update/tests/browser/browser_updatesBackgroundWindow.js
toolkit/mozapps/update/tests/browser/browser_updatesBackgroundWindowFailures.js
toolkit/mozapps/update/tests/browser/browser_updatesBasicPrompt.js
toolkit/mozapps/update/tests/browser/browser_updatesBasicPromptNoStaging.js
toolkit/mozapps/update/tests/browser/browser_updatesCompleteAndPartialPatchesWithBadSizes.js
toolkit/mozapps/update/tests/browser/browser_updatesCompletePatchApplyFailure.js
toolkit/mozapps/update/tests/browser/browser_updatesCompletePatchWithBadCompleteSize.js
toolkit/mozapps/update/tests/browser/browser_updatesDownloadFailures.js
toolkit/mozapps/update/tests/browser/browser_updatesMalformedXml.js
toolkit/mozapps/update/tests/browser/browser_updatesPartialPatchApplyFailure.js
toolkit/mozapps/update/tests/browser/browser_updatesPartialPatchApplyFailureWithCompleteValidationFailure.js
toolkit/mozapps/update/tests/browser/browser_updatesPartialPatchWithBadPartialSize.js
toolkit/mozapps/update/tests/browser/head.js
toolkit/mozapps/update/tests/data/shared.js
--- a/toolkit/mozapps/update/tests/browser/browser.ini
+++ b/toolkit/mozapps/update/tests/browser/browser.ini
@@ -6,17 +6,16 @@ support-files =
   testConstants.js
 
 [browser_TelemetryUpdatePing.js]
 [browser_updateAutoPrefUI.js]
 skip-if = os != 'win'
 reason = Tests that update config is properly written to file, which is a Windows-only feature
 [browser_updatesBackgroundWindow.js]
 [browser_updatesBackgroundWindowFailures.js]
-skip-if = verify
 [browser_updatesBasicPrompt.js]
 skip-if = asan
 reason = Bug 1168003
 [browser_updatesBasicPromptNoStaging.js]
 [browser_updatesCantApply.js]
 skip-if = os != 'win'
 [browser_updatesCompleteAndPartialPatchesWithBadCompleteSize.js]
 [browser_updatesCompleteAndPartialPatchesWithBadPartialSize.js]
--- a/toolkit/mozapps/update/tests/browser/browser_TelemetryUpdatePing.js
+++ b/toolkit/mozapps/update/tests/browser/browser_TelemetryUpdatePing.js
@@ -24,17 +24,17 @@ add_task(async function testUpdatePingRe
   await archiveChecker.promiseInit();
 
   // Trigger an "update" ping by downloading and applying an update.
   await runUpdateTest(updateParams, 1, [
     {
       notificationId: "update-available",
       button: "button",
       beforeClick() {
-        checkWhatsNewLink("update-available-whats-new");
+        checkWhatsNewLink(window, "update-available-whats-new");
       },
     },
     {
       notificationId: "update-restart",
       button: "secondarybutton",
       cleanup() {
         AppMenuNotifications.removeNotification(/.*/);
       },
--- a/toolkit/mozapps/update/tests/browser/browser_updatesBackgroundWindow.js
+++ b/toolkit/mozapps/update/tests/browser/browser_updatesBackgroundWindow.js
@@ -16,17 +16,17 @@ add_task(async function testUpdatesBackg
          "The doorhanger is not showing for the background window");
       is(PanelUI.menuButton.getAttribute("badge-status"), "update-available",
          "The badge is showing for the background window");
       let popupShownPromise = BrowserTestUtils.waitForEvent(PanelUI.notificationPanel, "popupshown");
       await BrowserTestUtils.closeWindow(extraWindow);
       await SimpleTest.promiseFocus(window);
       await popupShownPromise;
 
-      checkWhatsNewLink("update-available-whats-new");
+      checkWhatsNewLink(window, "update-available-whats-new");
       let buttonEl = getNotificationButton(window, "update-available", "button");
       buttonEl.click();
     },
     {
       notificationId: "update-restart",
       button: "secondarybutton",
       cleanup() {
         AppMenuNotifications.removeNotification(/.*/);
--- a/toolkit/mozapps/update/tests/browser/browser_updatesBackgroundWindowFailures.js
+++ b/toolkit/mozapps/update/tests/browser/browser_updatesBackgroundWindowFailures.js
@@ -1,30 +1,30 @@
 add_task(async function testBackgroundWindowFailures() {
   const maxBackgroundErrors = 5;
   SpecialPowers.pushPrefEnv({set: [
     [PREF_APP_UPDATE_BACKGROUNDMAXERRORS, maxBackgroundErrors],
-    [PREF_APP_UPDATE_DOWNLOADPROMPTMAXATTEMPTS, 2],
+    [PREF_APP_UPDATE_DOWNLOADPROMPT_MAXATTEMPTS, 2],
   ]});
 
   let updateParams = "badURL=1";
   let extraWindow = await BrowserTestUtils.openNewBrowserWindow();
   await SimpleTest.promiseFocus(extraWindow);
 
   function getBackgroundWindowHandler(destroyWindow) {
     return async function() {
       await BrowserTestUtils.waitForCondition(() => PanelUI.menuButton.hasAttribute("badge-status"),
                                               "Background window has a badge.");
 
       is(PanelUI.notificationPanel.state, "closed",
          "The doorhanger is not showing for the background window");
       is(PanelUI.menuButton.getAttribute("badge-status"), "update-available",
          "The badge is showing for the background window");
 
-      checkWhatsNewLink("update-available-whats-new");
+      checkWhatsNewLink(extraWindow, "update-available-whats-new");
       let buttonEl = getNotificationButton(extraWindow, "update-available", "button");
       buttonEl.click();
 
       if (destroyWindow) {
         await BrowserTestUtils.closeWindow(extraWindow);
         await SimpleTest.promiseFocus(window);
       }
     };
--- a/toolkit/mozapps/update/tests/browser/browser_updatesBasicPrompt.js
+++ b/toolkit/mozapps/update/tests/browser/browser_updatesBasicPrompt.js
@@ -7,17 +7,17 @@ add_task(async function testBasicPrompt(
   let updateParams = "promptWaitTime=0";
   gUseTestUpdater = true;
 
   await runUpdateTest(updateParams, 1, [
     {
       notificationId: "update-available",
       button: "button",
       beforeClick() {
-        checkWhatsNewLink("update-available-whats-new");
+        checkWhatsNewLink(window, "update-available-whats-new");
       },
     },
     {
       notificationId: "update-restart",
       button: "secondarybutton",
       cleanup() {
         AppMenuNotifications.removeNotification(/.*/);
       },
--- a/toolkit/mozapps/update/tests/browser/browser_updatesBasicPromptNoStaging.js
+++ b/toolkit/mozapps/update/tests/browser/browser_updatesBasicPromptNoStaging.js
@@ -6,17 +6,17 @@ add_task(async function testBasicPromptN
 
   let updateParams = "promptWaitTime=0";
 
   await runUpdateTest(updateParams, 1, [
     {
       notificationId: "update-available",
       button: "button",
       beforeClick() {
-        checkWhatsNewLink("update-available-whats-new");
+        checkWhatsNewLink(window, "update-available-whats-new");
       },
     },
     {
       notificationId: "update-restart",
       button: "secondarybutton",
       cleanup() {
         AppMenuNotifications.removeNotification(/.*/);
       },
--- a/toolkit/mozapps/update/tests/browser/browser_updatesCompleteAndPartialPatchesWithBadSizes.js
+++ b/toolkit/mozapps/update/tests/browser/browser_updatesCompleteAndPartialPatchesWithBadSizes.js
@@ -1,10 +1,12 @@
 add_task(async function testCompleteAndPartialPatchesWithBadSizes() {
-  SpecialPowers.pushPrefEnv({set: [[PREF_APP_UPDATE_DOWNLOADPROMPTMAXATTEMPTS, 2]]});
+  SpecialPowers.pushPrefEnv({set: [
+    [PREF_APP_UPDATE_DOWNLOADPROMPT_MAXATTEMPTS, 2],
+  ]});
   let updateParams = "invalidPartialSize=1&invalidCompleteSize=1";
 
   await runUpdateTest(updateParams, 1, [
     {
       // if we fail maxBackgroundErrors download attempts, then we want to
       // first show the user an update available prompt.
       notificationId: "update-available",
       button: "button",
@@ -15,17 +17,17 @@ add_task(async function testCompleteAndP
     },
     {
       // if we have only an invalid patch, then something's wrong and we don't
       // have an automatic way to fix it, so show the manual update
       // doorhanger.
       notificationId: "update-manual",
       button: "button",
       beforeClick() {
-        checkWhatsNewLink("update-manual-whats-new");
+        checkWhatsNewLink(window, "update-manual-whats-new");
       },
       async cleanup() {
         await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
         is(gBrowser.selectedBrowser.currentURI.spec,
            URL_MANUAL_UPDATE, "Landed on manual update page.");
         gBrowser.removeTab(gBrowser.selectedTab);
       },
     },
--- a/toolkit/mozapps/update/tests/browser/browser_updatesCompletePatchApplyFailure.js
+++ b/toolkit/mozapps/update/tests/browser/browser_updatesCompletePatchApplyFailure.js
@@ -6,17 +6,17 @@ add_task(async function testCompletePatc
   await runUpdateProcessingTest(updates, [
     {
       // if we have only an invalid patch, then something's wrong and we don't
       // have an automatic way to fix it, so show the manual update
       // doorhanger.
       notificationId: "update-manual",
       button: "button",
       beforeClick() {
-        checkWhatsNewLink("update-manual-whats-new");
+        checkWhatsNewLink(window, "update-manual-whats-new");
       },
       async cleanup() {
         await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
         is(gBrowser.selectedBrowser.currentURI.spec,
            URL_MANUAL_UPDATE, "Landed on manual update page.");
         gBrowser.removeTab(gBrowser.selectedTab);
       },
     },
--- a/toolkit/mozapps/update/tests/browser/browser_updatesCompletePatchWithBadCompleteSize.js
+++ b/toolkit/mozapps/update/tests/browser/browser_updatesCompletePatchWithBadCompleteSize.js
@@ -1,10 +1,12 @@
 add_task(async function testCompletePatchWithBadCompleteSize() {
-  SpecialPowers.pushPrefEnv({set: [[PREF_APP_UPDATE_DOWNLOADPROMPTMAXATTEMPTS, 2]]});
+  SpecialPowers.pushPrefEnv({set: [
+    [PREF_APP_UPDATE_DOWNLOADPROMPT_MAXATTEMPTS, 2],
+  ]});
 
   let updateParams = "completePatchOnly=1&invalidCompleteSize=1";
 
   await runUpdateTest(updateParams, 1, [
     {
       // if we fail maxBackgroundErrors download attempts, then we want to
       // first show the user an update available prompt.
       notificationId: "update-available",
@@ -16,17 +18,17 @@ add_task(async function testCompletePatc
     },
     {
       // if we have only an invalid patch, then something's wrong and we don't
       // have an automatic way to fix it, so show the manual update
       // doorhanger.
       notificationId: "update-manual",
       button: "button",
       beforeClick() {
-        checkWhatsNewLink("update-manual-whats-new");
+        checkWhatsNewLink(window, "update-manual-whats-new");
       },
       async cleanup() {
         await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
         is(gBrowser.selectedBrowser.currentURI.spec,
            URL_MANUAL_UPDATE, "Landed on manual update page.");
         gBrowser.removeTab(gBrowser.selectedTab);
       },
     },
--- a/toolkit/mozapps/update/tests/browser/browser_updatesDownloadFailures.js
+++ b/toolkit/mozapps/update/tests/browser/browser_updatesDownloadFailures.js
@@ -1,13 +1,13 @@
 add_task(async function testDownloadFailures() {
   const maxBackgroundErrors = 5;
   SpecialPowers.pushPrefEnv({set: [
     [PREF_APP_UPDATE_BACKGROUNDMAXERRORS, maxBackgroundErrors],
-    [PREF_APP_UPDATE_DOWNLOADPROMPTMAXATTEMPTS, 2],
+    [PREF_APP_UPDATE_DOWNLOADPROMPT_MAXATTEMPTS, 2],
   ]});
   let updateParams = "badURL=1";
 
   await runUpdateTest(updateParams, 1, [
     {
       // if we fail maxBackgroundErrors download attempts, then we want to
       // first show the user an update available prompt.
       notificationId: "update-available",
--- a/toolkit/mozapps/update/tests/browser/browser_updatesMalformedXml.js
+++ b/toolkit/mozapps/update/tests/browser/browser_updatesMalformedXml.js
@@ -10,17 +10,17 @@ add_task(async function testMalformedXml
 
   await runUpdateTest(updateParams, maxBackgroundErrors, [
     {
       // if we fail 10 check attempts, then we want to just show the user a manual update
       // workflow.
       notificationId: "update-manual",
       button: "button",
       beforeClick() {
-        checkWhatsNewLink("update-manual-whats-new", updateDetailsUrl);
+        checkWhatsNewLink(window, "update-manual-whats-new", updateDetailsUrl);
       },
       async cleanup() {
         await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
         is(gBrowser.selectedBrowser.currentURI.spec,
            URL_MANUAL_UPDATE, "Landed on manual update page.");
         gBrowser.removeTab(gBrowser.selectedTab);
       },
     },
--- a/toolkit/mozapps/update/tests/browser/browser_updatesPartialPatchApplyFailure.js
+++ b/toolkit/mozapps/update/tests/browser/browser_updatesPartialPatchApplyFailure.js
@@ -8,17 +8,17 @@ add_task(async function testPartialPatch
   await runUpdateProcessingTest(updates, [
     {
       // if we have only an invalid patch, then something's wrong and we don't
       // have an automatic way to fix it, so show the manual update
       // doorhanger.
       notificationId: "update-manual",
       button: "button",
       beforeClick() {
-        checkWhatsNewLink("update-manual-whats-new");
+        checkWhatsNewLink(window, "update-manual-whats-new");
       },
       async cleanup() {
         await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
         is(gBrowser.selectedBrowser.currentURI.spec,
            URL_MANUAL_UPDATE, "Landed on manual update page.");
         gBrowser.removeTab(gBrowser.selectedTab);
       },
     },
--- a/toolkit/mozapps/update/tests/browser/browser_updatesPartialPatchApplyFailureWithCompleteValidationFailure.js
+++ b/toolkit/mozapps/update/tests/browser/browser_updatesPartialPatchApplyFailureWithCompleteValidationFailure.js
@@ -1,12 +1,14 @@
 add_task(async function testPartialPatchApplyFailureWithCompleteValidationFailure() {
   // because of the way we're simulating failure, we have to just pretend we've already
   // retried.
-  SpecialPowers.pushPrefEnv({set: [[PREF_APP_UPDATE_DOWNLOADPROMPTMAXATTEMPTS, 0]]});
+  SpecialPowers.pushPrefEnv({set: [
+    [PREF_APP_UPDATE_DOWNLOADPROMPT_MAXATTEMPTS, 0],
+  ]});
 
   let patchProps = {type: "partial",
                     state: STATE_PENDING};
   let patches = getLocalPatchString(patchProps);
   patchProps = {size: "1234",
                 selected: "false"};
   patches += getLocalPatchString(patchProps);
   let updateProps = {isCompleteUpdate: "false"};
@@ -15,17 +17,17 @@ add_task(async function testPartialPatch
   await runUpdateProcessingTest(updates, [
     {
       // if we have only an invalid patch, then something's wrong and we don't
       // have an automatic way to fix it, so show the manual update
       // doorhanger.
       notificationId: "update-manual",
       button: "button",
       beforeClick() {
-        checkWhatsNewLink("update-manual-whats-new");
+        checkWhatsNewLink(window, "update-manual-whats-new");
       },
       async cleanup() {
         await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
         is(gBrowser.selectedBrowser.currentURI.spec,
            URL_MANUAL_UPDATE, "Landed on manual update page.");
         gBrowser.removeTab(gBrowser.selectedTab);
       },
     },
--- a/toolkit/mozapps/update/tests/browser/browser_updatesPartialPatchWithBadPartialSize.js
+++ b/toolkit/mozapps/update/tests/browser/browser_updatesPartialPatchWithBadPartialSize.js
@@ -1,10 +1,12 @@
 add_task(async function testPartialPatchWithBadPartialSize() {
-  SpecialPowers.pushPrefEnv({set: [[PREF_APP_UPDATE_DOWNLOADPROMPTMAXATTEMPTS, 2]]});
+  SpecialPowers.pushPrefEnv({set: [
+    [PREF_APP_UPDATE_DOWNLOADPROMPT_MAXATTEMPTS, 2],
+  ]});
   let updateParams = "partialPatchOnly=1&invalidPartialSize=1";
 
   await runUpdateTest(updateParams, 1, [
     {
       // if we fail maxBackgroundErrors download attempts, then we want to
       // first show the user an update available prompt.
       notificationId: "update-available",
       button: "button",
@@ -15,17 +17,17 @@ add_task(async function testPartialPatch
     },
     {
       // if we have only an invalid patch, then something's wrong and we don't
       // have an automatic way to fix it, so show the manual update
       // doorhanger.
       notificationId: "update-manual",
       button: "button",
       beforeClick() {
-        checkWhatsNewLink("update-manual-whats-new");
+        checkWhatsNewLink(window, "update-manual-whats-new");
       },
       async cleanup() {
         await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
         is(gBrowser.selectedBrowser.currentURI.spec,
            URL_MANUAL_UPDATE, "Landed on manual update page.");
         gBrowser.removeTab(gBrowser.selectedTab);
       },
     },
--- a/toolkit/mozapps/update/tests/browser/head.js
+++ b/toolkit/mozapps/update/tests/browser/head.js
@@ -278,41 +278,44 @@ function waitForEvent(topic, status = nu
       }
     },
   }, topic));
 }
 
 /**
  * Gets the specified button for the notification.
  *
- * @param  window
+ * @param  win
  *         The window to get the notification button for.
  * @param  notificationId
  *         The ID of the notification to get the button for.
  * @param  button
  *         The anonid of the button to get.
+ * @return The button element.
  */
 function getNotificationButton(win, notificationId, button) {
   let notification = win.document.getElementById(`appMenu-${notificationId}-notification`);
   is(notification.hidden, false, `${notificationId} notification is showing`);
   return win.document.getAnonymousElementByAttribute(notification, "anonid", button);
 }
 
 /**
  * Ensures that the "What's new" link with the provided ID is displayed and
  * matches the url parameter provided. If no URL is provided, it will instead
  * ensure that the link matches the default link URL.
  *
+ * @param  win
+ *         The window to get the "What's new" link for.
  * @param  id
  *         The ID of the "What's new" link element.
  * @param  url (optional)
  *         The URL to check against. If none is provided, a default will be used.
  */
-function checkWhatsNewLink(id, url) {
-  let whatsNewLink = document.getElementById(id);
+function checkWhatsNewLink(win, id, url) {
+  let whatsNewLink = win.document.getElementById(id);
   is(whatsNewLink.href,
      url || URL_HTTP_UPDATE_SJS + "?uiURL=DETAILS",
      "What's new link points to the test_details URL");
   is(whatsNewLink.hidden, false, "What's new link is not hidden.");
 }
 
 /**
  * For tests that use the test updater restores the backed up real updater if
--- a/toolkit/mozapps/update/tests/data/shared.js
+++ b/toolkit/mozapps/update/tests/data/shared.js
@@ -12,17 +12,17 @@ ChromeUtils.defineModuleGetter(this, "Up
 
 const PREF_APP_UPDATE_AUTO                       = "app.update.auto";
 const PREF_APP_UPDATE_BACKGROUNDERRORS           = "app.update.backgroundErrors";
 const PREF_APP_UPDATE_BACKGROUNDMAXERRORS        = "app.update.backgroundMaxErrors";
 const PREF_APP_UPDATE_CANCELATIONS               = "app.update.cancelations";
 const PREF_APP_UPDATE_CHANNEL                    = "app.update.channel";
 const PREF_APP_UPDATE_DOORHANGER                 = "app.update.doorhanger";
 const PREF_APP_UPDATE_DOWNLOADPROMPTATTEMPTS     = "app.update.download.attempts";
-const PREF_APP_UPDATE_DOWNLOADPROMPTMAXATTEMPTS  = "app.update.download.maxAttempts";
+const PREF_APP_UPDATE_DOWNLOADPROMPT_MAXATTEMPTS = "app.update.download.maxAttempts";
 const PREF_APP_UPDATE_DISABLEDFORTESTING         = "app.update.disabledForTesting";
 const PREF_APP_UPDATE_IDLETIME                   = "app.update.idletime";
 const PREF_APP_UPDATE_LOG                        = "app.update.log";
 const PREF_APP_UPDATE_NOTIFIEDUNSUPPORTED        = "app.update.notifiedUnsupported";
 const PREF_APP_UPDATE_PROMPTWAITTIME             = "app.update.promptWaitTime";
 const PREF_APP_UPDATE_RETRYTIMEOUT               = "app.update.socket.retryTimeout";
 const PREF_APP_UPDATE_SERVICE_ENABLED            = "app.update.service.enabled";
 const PREF_APP_UPDATE_SILENT                     = "app.update.silent";