Backed out changeset 79d111e76fc9 (bug 1317470) for xpcshell failures a=backout
authorWes Kocher <wkocher@mozilla.com>
Thu, 19 Jan 2017 18:14:55 -0800
changeset 377505 18775df0c5946acc24da018a7c4eb7011663017e
parent 377504 79d111e76fc98325a190cbe634859e67c504cab7
child 377506 ba650eee2f3b1c340bdbcef33ad16c8d552e1e3d
push id1419
push userjlund@mozilla.com
push dateMon, 10 Apr 2017 20:44:07 +0000
treeherdermozilla-release@5e6801b73ef6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs1317470
milestone53.0a1
backs out79d111e76fc98325a190cbe634859e67c504cab7
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
Backed out changeset 79d111e76fc9 (bug 1317470) for xpcshell failures a=backout MozReview-Commit-ID: ATEluhMBccR
browser/base/content/browser-addons.js
browser/base/content/test/general/browser.ini
browser/base/content/test/general/browser_extension_update.js
browser/base/content/test/general/browser_webext_update.json
browser/base/content/test/general/browser_webext_update1.xpi
browser/base/content/test/general/browser_webext_update2.xpi
browser/modules/ExtensionsUI.jsm
toolkit/mozapps/extensions/AddonManager.jsm
--- a/browser/base/content/browser-addons.js
+++ b/browser/base/content/browser-addons.js
@@ -497,51 +497,33 @@ const gExtensionsNotifications = {
     if (!this.initialized) {
       return;
     }
     ExtensionsUI.off("change", this.boundUpdate);
   },
 
   updateAlerts() {
     let sideloaded = ExtensionsUI.sideloaded;
-    let updates = ExtensionsUI.updates;
-    if (sideloaded.size + updates.size == 0) {
+    if (sideloaded.size == 0) {
       gMenuButtonBadgeManager.removeBadge(gMenuButtonBadgeManager.BADGEID_ADDONS);
     } else {
       gMenuButtonBadgeManager.addBadge(gMenuButtonBadgeManager.BADGEID_ADDONS,
                                        "addon-alert");
     }
 
     let container = document.getElementById("PanelUI-footer-addons");
 
     while (container.firstChild) {
       container.firstChild.remove();
     }
 
     // Strings below to be properly localized in bug 1316996
     const DEFAULT_EXTENSION_ICON =
       "chrome://mozapps/skin/extensions/extensionGeneric.svg";
     let items = 0;
-    for (let update of updates) {
-      if (++items > 4) {
-        break;
-      }
-      let button = document.createElement("toolbarbutton");
-      button.setAttribute("label", `"${update.addon.name}" requires new permissions`);
-
-      let icon = update.addon.iconURL || DEFAULT_EXTENSION_ICON;
-      button.setAttribute("image", icon);
-
-      button.addEventListener("click", evt => {
-        ExtensionsUI.showUpdate(gBrowser, update);
-      });
-
-      container.appendChild(button);
-    }
-
     for (let addon of sideloaded) {
       if (++items > 4) {
         break;
       }
       let button = document.createElement("toolbarbutton");
       button.setAttribute("label", `"${addon.name}" added to Firefox`);
 
       let icon = addon.iconURL || DEFAULT_EXTENSION_ICON;
--- a/browser/base/content/test/general/browser.ini
+++ b/browser/base/content/test/general/browser.ini
@@ -115,19 +115,16 @@ support-files =
   test_mcb_redirect.sjs
   file_bug1045809_1.html
   file_bug1045809_2.html
   file_csp_block_all_mixedcontent.html
   file_csp_block_all_mixedcontent.js
   file_install_extensions.html
   browser_webext_permissions.xpi
   browser_webext_nopermissions.xpi
-  browser_webext_update1.xpi
-  browser_webext_update2.xpi
-  browser_webext_update.json
   !/image/test/mochitest/blue.png
   !/toolkit/components/passwordmgr/test/browser/form_basic.html
   !/toolkit/components/passwordmgr/test/browser/insecure_test.html
   !/toolkit/components/passwordmgr/test/browser/insecure_test_subframe.html
   !/toolkit/content/tests/browser/common/mockTransfer.js
   !/toolkit/modules/tests/browser/metadata_*.html
   !/toolkit/mozapps/extensions/test/xpinstall/amosigned.xpi
   !/toolkit/mozapps/extensions/test/xpinstall/corrupt.xpi
@@ -304,17 +301,16 @@ skip-if = os == "mac" # decoder doctor i
 [browser_discovery.js]
 [browser_double_close_tab.js]
 [browser_documentnavigation.js]
 [browser_duplicateIDs.js]
 [browser_drag.js]
 skip-if = true # browser_drag.js is disabled, as it needs to be updated for the new behavior from bug 320638.
 [browser_extension_permissions.js]
 [browser_extension_sideloading.js]
-[browser_extension_update.js]
 [browser_favicon_change.js]
 [browser_favicon_change_not_in_document.js]
 [browser_findbarClose.js]
 [browser_focusonkeydown.js]
 [browser_fullscreen-window-open.js]
 tags = fullscreen
 skip-if = os == "linux" # Linux: Intermittent failures - bug 941575.
 [browser_fxaccounts.js]
deleted file mode 100644
--- a/browser/base/content/test/general/browser_extension_update.js
+++ /dev/null
@@ -1,192 +0,0 @@
-const {AddonManagerPrivate} = Cu.import("resource://gre/modules/AddonManager.jsm", {});
-
-const URL_BASE = "https://example.com/browser/browser/base/content/test/general";
-const ID = "update@tests.mozilla.org";
-
-function promiseViewLoaded(tab, viewid) {
-  let win = tab.linkedBrowser.contentWindow;
-  if (win.gViewController && !win.gViewController.isLoading &&
-      win.gViewController.currentViewId == viewid) {
-     return Promise.resolve();
-  }
-
-  return new Promise(resolve => {
-    function listener() {
-      if (win.gViewController.currentViewId != viewid) {
-        return;
-      }
-      win.document.removeEventListener("ViewChanged", listener);
-      resolve();
-    }
-    win.document.addEventListener("ViewChanged", listener);
-  });
-}
-
-function promisePopupNotificationShown(name) {
-  return new Promise(resolve => {
-    function popupshown() {
-      let notification = PopupNotifications.getNotification(name);
-      if (!notification) { return; }
-
-      ok(notification, `${name} notification shown`);
-      ok(PopupNotifications.isPanelOpen, "notification panel open");
-
-      PopupNotifications.panel.removeEventListener("popupshown", popupshown);
-      resolve(PopupNotifications.panel.firstChild);
-    }
-
-    PopupNotifications.panel.addEventListener("popupshown", popupshown);
-  });
-}
-
-function getBadgeStatus() {
-  let menuButton = document.getElementById("PanelUI-menu-button");
-  return menuButton.getAttribute("badge-status");
-}
-
-function promiseUpdateDownloaded(addon) {
-  return new Promise(resolve => {
-    let listener = {
-      onDownloadEnded(install) {
-        if (install.addon.id == addon.id) {
-          AddonManager.removeInstallListener(listener);
-          resolve();
-        }
-      },
-    };
-    AddonManager.addInstallListener(listener);
-  });
-}
-
-function promiseUpgrade(addon) {
-  return new Promise(resolve => {
-    let listener = {
-      onInstallEnded(install, newAddon) {
-        if (newAddon.id == addon.id) {
-          AddonManager.removeInstallListener(listener);
-          resolve(newAddon);
-        }
-      },
-    };
-    AddonManager.addInstallListener(listener);
-  });
-}
-
-add_task(function* () {
-  yield SpecialPowers.pushPrefEnv({set: [
-    // Turn on background updates
-    ["extensions.update.enabled", true],
-
-    // Point updates to the local mochitest server
-    ["extensions.update.background.url", `${URL_BASE}/browser_webext_update.json`],
-
-    // We don't have pre-pinned certificates for the local mochitest server
-    ["extensions.install.requireBuiltInCerts", false],
-    ["extensions.update.requireBuiltInCerts", false],
-
-    // XXX remove this when prompts are enabled by default
-    ["extensions.webextPermissionPrompts", true],
-  ]});
-
-  // Install version 1.0 of the test extension
-  let url1 = `${URL_BASE}/browser_webext_update1.xpi`;
-  let install = yield AddonManager.getInstallForURL(url1, null, "application/x-xpinstall");
-  ok(install, "Created install");
-
-  let addon = yield new Promise(resolve => {
-    install.addListener({
-      onInstallEnded(_install, _addon) {
-        resolve(_addon);
-      },
-    });
-    install.install();
-  });
-
-  ok(addon, "Addon was installed");
-  is(getBadgeStatus(), "", "Should not start out with an addon alert badge");
-
-  // Trigger an update check and wait for the update for this addon
-  // to be downloaded.
-  let updatePromise = promiseUpdateDownloaded(addon);
-  AddonManagerPrivate.backgroundUpdateCheck();
-  yield updatePromise;
-
-  is(getBadgeStatus(), "addon-alert", "Should have addon alert badge");
-
-  // Find the menu entry for the update
-  yield PanelUI.show();
-
-  let addons = document.getElementById("PanelUI-footer-addons");
-  is(addons.children.length, 1, "Have a menu entry for the update");
-
-  // Click the menu item
-  let tabPromise = BrowserTestUtils.waitForNewTab(gBrowser, "about:addons");
-  let popupPromise = promisePopupNotificationShown("addon-webext-permissions");
-  addons.children[0].click();
-
-  // about:addons should load and go to the list of extensions
-  let tab = yield tabPromise;
-  is(tab.linkedBrowser.currentURI.spec, "about:addons");
-
-  const VIEW = "addons://list/extension";
-  yield promiseViewLoaded(tab, VIEW);
-  let win = tab.linkedBrowser.contentWindow;
-  ok(!win.gViewController.isLoading, "about:addons view is fully loaded");
-  is(win.gViewController.currentViewId, VIEW, "about:addons is at extensions list");
-
-  // Wait for the permission prompt and cancel it
-  let panel = yield popupPromise;
-  panel.secondaryButton.click();
-
-  addon = yield AddonManager.getAddonByID(ID);
-  is(addon.version, "1.0", "Should still be running the old version");
-
-  yield BrowserTestUtils.removeTab(tab);
-
-  // Alert badge and hamburger menu items should be gone
-  is(getBadgeStatus(), "", "Addon alert badge should be gone");
-
-  yield PanelUI.show();
-  addons = document.getElementById("PanelUI-footer-addons");
-  is(addons.children.length, 0, "Update menu entries should be gone");
-  yield PanelUI.hide();
-
-  // Re-check for an update
-  updatePromise = promiseUpdateDownloaded(addon);
-  yield AddonManagerPrivate.backgroundUpdateCheck();
-  yield updatePromise;
-
-  is(getBadgeStatus(), "addon-alert", "Should have addon alert badge");
-
-  // Find the menu entry for the update
-  yield PanelUI.show();
-
-  addons = document.getElementById("PanelUI-footer-addons");
-  is(addons.children.length, 1, "Have a menu entry for the update");
-
-  // Click the menu item
-  tabPromise = BrowserTestUtils.waitForNewTab(gBrowser, "about:addons");
-  popupPromise = promisePopupNotificationShown("addon-webext-permissions");
-  addons.children[0].click();
-
-  // Wait for about:addons to load
-  tab = yield tabPromise;
-  is(tab.linkedBrowser.currentURI.spec, "about:addons");
-
-  yield promiseViewLoaded(tab, VIEW);
-  win = tab.linkedBrowser.contentWindow;
-  ok(!win.gViewController.isLoading, "about:addons view is fully loaded");
-  is(win.gViewController.currentViewId, VIEW, "about:addons is at extensions list");
-
-  // Wait for the permission prompt and accept it this time
-  updatePromise = promiseUpgrade(addon);
-  panel = yield popupPromise;
-  panel.button.click();
-
-  addon = yield updatePromise;
-  is(addon.version, "2.0", "Should have upgraded to the new version");
-
-  yield BrowserTestUtils.removeTab(tab);
-
-  is(getBadgeStatus(), "", "Addon alert badge should be gone");
-});
deleted file mode 100644
--- a/browser/base/content/test/general/browser_webext_update.json
+++ /dev/null
@@ -1,18 +0,0 @@
-{
-  "addons": {
-    "update@tests.mozilla.org": {
-      "updates": [
-        {
-          "version": "2.0",
-          "update_link": "https://example.com/browser/browser/base/content/test/general/browser_webext_update2.xpi",
-          "applications": {
-            "gecko": {
-              "strict_min_version": "1",
-              "advisory_max_version": "55.0"
-            }
-          }
-        }
-      ]
-    }
-  }
-}
deleted file mode 100644
index 8eac9daa01745a2247eb9284b51858546b52f6a1..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 81c7407ba7f17e486ce553318369dc7aaf1b017b..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
--- a/browser/modules/ExtensionsUI.jsm
+++ b/browser/modules/ExtensionsUI.jsm
@@ -21,21 +21,19 @@ XPCOMUtils.defineLazyPreferenceGetter(th
                                       "extensions.webextPermissionPrompts", false);
 
 const DEFAULT_EXENSION_ICON = "chrome://mozapps/skin/extensions/extensionGeneric.svg";
 
 const HTML_NS = "http://www.w3.org/1999/xhtml";
 
 this.ExtensionsUI = {
   sideloaded: new Set(),
-  updates: new Set(),
 
   init() {
     Services.obs.addObserver(this, "webextension-permission-prompt", false);
-    Services.obs.addObserver(this, "webextension-update-permissions", false);
 
     this._checkForSideloaded();
   },
 
   _checkForSideloaded() {
     AddonManager.getAllAddons(addons => {
       // Check for any side-loaded addons that the user is allowed
       // to enable.
@@ -57,98 +55,66 @@ this.ExtensionsUI = {
         let win = RecentWindow.getMostRecentBrowserWindow();
         for (let addon of sideloaded) {
           win.openUILinkIn(`about:newaddon?id=${addon.id}`, "tab");
         }
       }
     });
   },
 
-  showAddonsManager(browser, info) {
+  showSideloaded(browser, addon) {
+    addon.markAsSeen();
+    this.sideloaded.delete(addon);
+    this.emit("change");
+
     let loadPromise = new Promise(resolve => {
       let listener = (subject, topic) => {
         if (subject.location.href == "about:addons") {
           Services.obs.removeObserver(listener, topic);
           resolve(subject);
         }
       };
       Services.obs.addObserver(listener, "EM-loaded", false);
     });
     let tab = browser.addTab("about:addons");
     browser.selectedTab = tab;
-
-    return loadPromise.then(win => {
+    loadPromise.then(win => {
       win.loadView("addons://list/extension");
-      return this.showPermissionsPrompt(browser.selectedBrowser, info);
-    });
-  },
-
-  showSideloaded(browser, addon) {
-    addon.markAsSeen();
-    this.sideloaded.delete(addon);
-    this.emit("change");
-
-    let info = {
-      addon,
-      permissions: addon.userPermissions,
-      icon: addon.iconURL,
-      type: "sideload",
-    };
-    this.showAddonsManager(browser, info).then(answer => {
-      addon.userDisabled = !answer;
-    });
-  },
-
-  showUpdate(browser, info) {
-    info.type = "update";
-    this.showAddonsManager(browser, info).then(answer => {
-      if (answer) {
-        info.resolve();
-      } else {
-        info.reject();
-      }
-      // At the moment, this prompt will re-appear next time we do an update
-      // check.  See bug 1332360 for proposal to avoid this.
-      this.updates.delete(info);
-      this.emit("change");
+      let info = {
+        addon,
+        icon: addon.iconURL,
+        type: "sideload",
+      };
+      this.showPermissionsPrompt(browser.selectedBrowser, info).then(answer => {
+        addon.userDisabled = !answer;
+      });
     });
   },
 
   observe(subject, topic, data) {
     if (topic == "webextension-permission-prompt") {
       let {target, info} = subject.wrappedJSObject;
 
       // Dismiss the progress notification.  Note that this is bad if
       // there are multiple simultaneous installs happening, see
       // bug 1329884 for a longer explanation.
       let progressNotification = target.ownerGlobal.PopupNotifications.getNotification("addon-progress", target);
       if (progressNotification) {
         progressNotification.remove();
       }
 
-      let reply = answer => {
+      this.showPermissionsPrompt(target, info).then(answer => {
         Services.obs.notifyObservers(subject, "webextension-permission-response",
                                      JSON.stringify(answer));
-      };
-
-      let perms = info.addon.userPermissions;
-      if (!perms) {
-        reply(true);
-      } else {
-        info.permissions = perms;
-        this.showPermissionsPrompt(target, info).then(reply);
-      }
-    } else if (topic == "webextension-update-permissions") {
-      this.updates.add(subject.wrappedJSObject);
-      this.emit("change");
+      });
     }
   },
 
   showPermissionsPrompt(target, info) {
-    let perms = info.permissions;
+    let perms = info.addon.userPermissions;
     if (!perms) {
       return Promise.resolve();
     }
 
     let win = target.ownerGlobal;
 
     let name = info.addon.name;
     if (name.length > 50) {
@@ -176,21 +142,16 @@ this.ExtensionsUI = {
 
     if (info.type == "sideload") {
       header = `${name} added`;
       text = "Another program on your computer installed an add-on that may affect your browser.  Please review this add-on's permission requests and choose to Enable or Disable";
       acceptText = "Enable";
       acceptKey = "E";
       cancelText = "Disable";
       cancelKey = "D";
-    } else if (info.type == "update") {
-      header = "";
-      text = `${name} has been updated.  You must approve new permissions before the updated version will install.`;
-      acceptText = "Update";
-      acceptKey = "U";
     }
 
     let formatPermission = perm => {
       try {
         // return bundle.getString(`webextPerms.description.${perm}`);
         return `localized description of permission ${perm}`;
       } catch (err) {
         // return bundle.getFormattedString("webextPerms.description.unknown",
--- a/toolkit/mozapps/extensions/AddonManager.jsm
+++ b/toolkit/mozapps/extensions/AddonManager.jsm
@@ -1371,45 +1371,16 @@ var AddonManagerInternal = {
         return aMatch;
       }
     });
 
     // escape() does not properly encode + symbols in any embedded FVF strings.
     return uri.replace(/\+/g, "%2B");
   },
 
-  _updatePromptHandler(info) {
-    let oldPerms = info.existingAddon.userPermissions || {hosts: [], permissions: []};
-    let newPerms = info.addon.userPermissions;
-
-    // See bug 1331769: should we do something more complicated to
-    // compare host permissions?
-    // e.g., if we go from <all_urls> to a specific host or from
-    // a *.domain.com to specific-host.domain.com that's actually a
-    // drop in permissions but the simple test below will cause a prompt.
-    let difference = {
-      hosts: newPerms.hosts.filter(perm => !oldPerms.hosts.includes(perm)),
-      permissions: newPerms.permissions.filter(perm => !oldPerms.permissions.includes(perm)),
-    };
-
-    // If there are no new permissions, just go ahead with the update
-    if (difference.hosts.length == 0 && difference.permissions.length == 0) {
-      return Promise.resolve();
-    }
-
-    return new Promise((resolve, reject) => {
-      let subject = {wrappedJSObject: {
-        addon: info.addon,
-        permissions: difference,
-        resolve, reject
-      }};
-      Services.obs.notifyObservers(subject, "webextension-update-permissions", null);
-    });
-  },
-
   /**
    * Performs a background update check by starting an update for all add-ons
    * that can be updated.
    * @return Promise{null} Resolves when the background update check is complete
    *                       (the resulting addon installations may still be in progress).
    */
   backgroundUpdateCheck() {
     if (!gStarted)
@@ -1454,17 +1425,16 @@ var AddonManagerInternal = {
                 // Start installing updates when the add-on can be updated and
                 // background updates should be applied.
                 logger.debug("Found update for add-on ${id}", aAddon);
                 if (aAddon.permissions & AddonManager.PERM_CAN_UPGRADE &&
                     AddonManager.shouldAutoUpdate(aAddon)) {
                   // XXX we really should resolve when this install is done,
                   // not when update-available check completes, no?
                   logger.debug(`Starting upgrade install of ${aAddon.id}`);
-                  aInstall.promptHandler = (...args) => AddonManagerInternal._updatePromptHandler(...args);
                   aInstall.install();
                 }
               },
 
               onUpdateFinished: aAddon => { logger.debug("onUpdateFinished for ${id}", aAddon); resolve(); }
             }, AddonManager.UPDATE_WHEN_PERIODIC_UPDATE);
           }));
         }