Backed out changeset ba745ab8ec4a (bug 1525635) for linting failure
authorAndreea Pavel <apavel@mozilla.com>
Wed, 13 Feb 2019 03:15:14 +0200
changeset 458832 5f6a77f08081
parent 458831 eb177b6fdd37
child 458833 0379792adfbb
push id35548
push useropoprus@mozilla.com
push dateWed, 13 Feb 2019 09:48:26 +0000
treeherdermozilla-central@93e37c529818 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1525635
milestone67.0a1
backs outba745ab8ec4a
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 ba745ab8ec4a (bug 1525635) for linting failure
toolkit/mozapps/extensions/AddonManager.jsm
toolkit/mozapps/extensions/test/browser/browser_webapi_install.js
toolkit/mozapps/extensions/test/xpinstall/browser_doorhanger_installs.js
toolkit/mozapps/extensions/test/xpinstall/incompatible.xpi
--- a/toolkit/mozapps/extensions/AddonManager.jsm
+++ b/toolkit/mozapps/extensions/AddonManager.jsm
@@ -1804,17 +1804,17 @@ var AddonManagerInternal = {
 
       onDownloadFailed() {
         install.removeListener(listener);
         self.installNotifyObservers("addon-install-failed", browser, url, install);
       },
 
       onDownloadEnded() {
         if (install.addon.appDisabled) {
-          // App disabled items are not compatible and so fail to install.
+          // App disabled items are not compatible and so fail to install
           install.removeListener(listener);
           install.cancel();
           self.installNotifyObservers("addon-install-failed", browser, url, install);
         }
       },
 
       onInstallCancelled() {
         install.removeListener(listener);
@@ -2610,16 +2610,55 @@ var AddonManagerInternal = {
     // helper to copy (and convert) the properties we care about
     copyProps(install, obj) {
       obj.state = AddonManager.stateToString(install.state);
       obj.error = AddonManager.errorToString(install.error);
       obj.progress = install.progress;
       obj.maxProgress = install.maxProgress;
     },
 
+    makeListener(id, mm) {
+      const events = [
+        "onDownloadStarted",
+        "onDownloadProgress",
+        "onDownloadEnded",
+        "onDownloadCancelled",
+        "onDownloadFailed",
+        "onInstallStarted",
+        "onInstallEnded",
+        "onInstallCancelled",
+        "onInstallFailed",
+      ];
+
+      let listener = {};
+      let installPromise = new Promise((resolve, reject) => {
+        events.forEach(event => {
+          listener[event] = (install, addon) => {
+            let data = {event, id};
+            AddonManager.webAPI.copyProps(install, data);
+            this.sendEvent(mm, data);
+            if (event == "onInstallEnded") {
+              resolve(addon);
+            } else if (event == "onDownloadFailed" || event == "onInstallFailed") {
+              reject({message: "install failed"});
+            } else if (event == "onDownloadCancelled" || event == "onInstallCancelled") {
+              reject({message: "install cancelled"});
+            }
+          };
+        });
+      });
+
+      // We create the promise here since this is where we're setting
+      // up the InstallListener, but if the install is never started,
+      // no handlers will be attached so make sure we terminate errors.
+      installPromise.catch(() => {});
+
+      return {listener, installPromise};
+    },
+
     forgetInstall(id) {
       let info = this.installs.get(id);
       if (!info) {
         throw new Error(`forgetInstall cannot find ${id}`);
       }
       info.install.removeListener(info.listener);
       this.installs.delete(id);
     },
@@ -2635,78 +2674,33 @@ var AddonManagerInternal = {
         if (Services.prefs.getBoolPref(PREF_WEBAPI_TESTING)
             && WEBAPI_TEST_INSTALL_HOSTS.includes(host)) {
           return;
         }
 
         throw new Error(`Install from ${host} not permitted`);
       }
 
-      const makeListener = (id, mm) => {
-        const events = [
-          "onDownloadStarted",
-          "onDownloadProgress",
-          "onDownloadEnded",
-          "onDownloadCancelled",
-          "onDownloadFailed",
-          "onInstallStarted",
-          "onInstallEnded",
-          "onInstallCancelled",
-          "onInstallFailed",
-         ];
-
-        let listener = {};
-        let installPromise = new Promise((resolve, reject) => {
-          events.forEach(event => {
-            listener[event] = (install, addon) => {
-              let data = {event, id};
-              AddonManager.webAPI.copyProps(install, data);
-              this.sendEvent(mm, data);
-              if (event == "onInstallEnded") {
-                resolve(addon);
-              } else if (event == "onDownloadFailed" || event == "onInstallFailed") {
-                reject({message: "install failed"});
-              } else if (event == "onDownloadCancelled" || event == "onInstallCancelled") {
-                reject({message: "install cancelled"});
-              } else if (event == "onDownloadEnded") {
-                if (install.addon.appDisabled) {
-                  // App disabled items are not compatible and so fail to install
-                  install.cancel();
-                  AddonManagerInternal.installNotifyObservers("addon-install-failed", target, Services.io.newURI(options.url), install);
-                }
-              }
-            };
-          });
-        });
-
-        // We create the promise here since this is where we're setting
-        // up the InstallListener, but if the install is never started,
-        // no handlers will be attached so make sure we terminate errors.
-        installPromise.catch(() => {});
-
-        return {listener, installPromise};
-     }
-
       try {
         checkInstallUrl(options.url);
       } catch (err) {
         return Promise.reject({message: err.message});
       }
 
       return AddonManagerInternal.getInstallForURL(options.url, {
         hash: options.hash,
         telemetryInfo: {
           source: AddonManager.getInstallSourceFromHost(options.sourceHost),
           method: "amWebAPI",
         },
       }).then(install => {
         AddonManagerInternal.setupPromptHandler(target, null, install, false, "AMO");
 
         let id = this.nextInstall++;
-        let {listener, installPromise} = makeListener(id, target.messageManager);
+        let {listener, installPromise} = this.makeListener(id, target.messageManager);
         install.addListener(listener);
 
         this.installs.set(id, {install, target, listener, installPromise});
 
         let result = {id};
         this.copyProps(install, result);
         return result;
       });
--- a/toolkit/mozapps/extensions/test/browser/browser_webapi_install.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_webapi_install.js
@@ -323,29 +323,8 @@ add_task(async function test_permissions
 
   await testBadUrl("i am not a url", "NS_ERROR_MALFORMED_URI",
                    "Installing from an unparseable URL fails");
 
   await testBadUrl("https://addons.not-really-mozilla.org/impostor.xpi",
                    "not permitted",
                    "Installing from non-approved URL fails");
 });
-
-add_task(makeInstallTest(async function(browser) {
-  let xpiURL = `${SECURE_TESTROOT}../xpinstall/incompatible.xpi`;
-  let id = "incompatible-xpi@tests.mozilla.org";
-
-  let steps = [
-    {action: "install", expectError: true},
-    {
-      event: "onDownloadStarted",
-      props: {state: "STATE_DOWNLOADING"},
-    },
-    {event: "onDownloadProgress"},
-    {event: "onDownloadEnded"},
-    {event: "onDownloadCancelled"},
-  ];
-
-  await testInstall(browser, {url: xpiURL}, steps, "install of an incompatible XPI fails");
-
-  let addons = await promiseAddonsByIDs([id]);
-  is(addons[0], null, "The addon was not installed");
-}));
--- a/toolkit/mozapps/extensions/test/xpinstall/browser_doorhanger_installs.js
+++ b/toolkit/mozapps/extensions/test/xpinstall/browser_doorhanger_installs.js
@@ -370,21 +370,19 @@ async function test_incompatible() {
   let triggers = encodeURIComponent(JSON.stringify({
     "XPI": "incompatible.xpi",
   }));
   BrowserTestUtils.openNewForegroundTab(gBrowser, TESTROOT + "installtrigger.html?" + triggers);
   await progressPromise;
   let panel = await failPromise;
 
   let notification = panel.childNodes[0];
-  let brandBundle = Services.strings.createBundle("chrome://branding/locale/brand.properties");
-  let brandShortName = brandBundle.GetStringFromName("brandShortName");
-  let message = `XPI Test could not be installed because it is not compatible with ${brandShortName} ${Services.appinfo.version}.`;
   is(notification.getAttribute("label"),
-     message,
+     "The add-on downloaded from this site could not be installed " +
+     "because it appears to be corrupt.",
      "Should have seen the right message");
 
   Services.perms.remove(makeURI("http://example.com/"), "install");
   await removeTabAndWaitForNotificationClose();
 },
 
 async function test_localFile() {
   let cr = Cc["@mozilla.org/chrome/chrome-registry;1"]
index de895fd1d9edcb0b249a439852d9e34c5b974af3..262ed38a7928eb78a9df5e57aa4b1dc71259abd6
GIT binary patch
literal 4442
zc$|$`XHXMrvkrvbF@gvp2!gawq<5r~1nE_Zbm<tX0!pt^LzmuELKCEh5*4LNgh;Q_
zksc1A3HkKS-22UO&Y8LU&i>eUcAt56clO7wJ`_lD6#xKG0M1@mYhSS-tW(kg0Co%j
z!0%sO4dZ)Yo%@<1p59MgJv{7$;l6frW=~|kT`)^0z7^4sV2PoO7wdkXlMe2&a*Db-
zWm9=8GWV^w0U4q~yFcAy%BVR5JRqz|ZGn(9P;W3X%znDia@=*Cay}8ddpJvYR<vMI
z=sSFzk9k6eW_TC*c*o&N&Q=H~oe#5GDupOX(tA#ZEb_&Ow}Ln|wEeaR03*Vq&m4J7
ziGH|8%#w<-U=XFCi3u0Vko6D)EEHLC7J|#_$2snEX6ffJOpX!@62*A}y>8tCS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