Backed out 2 changesets (bug 1528335) for test_ext_privacy_update.js failures CLOSED TREE
authorBogdan Tara <btara@mozilla.com>
Wed, 03 Apr 2019 06:17:54 +0300
changeset 467685 182738789fa93f9af4e4f5c7d1f84ebdb5dc1820
parent 467684 82df33c088cd8548b0c8eb849d1b9f10d546f2d6
child 467698 92b682ee0acc9f903480910e1aced6b8baa73ed9
push id82126
push userbtara@mozilla.com
push dateWed, 03 Apr 2019 03:18:13 +0000
treeherderautoland@182738789fa9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1528335
milestone68.0a1
backs outfd9468269591a389893ae72182e9d998a2ef7854
acce10271d625dffea6b3d4440612093edbfb947
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 2 changesets (bug 1528335) for test_ext_privacy_update.js failures CLOSED TREE Backed out changeset fd9468269591 (bug 1528335) Backed out changeset acce10271d62 (bug 1528335)
toolkit/mozapps/extensions/AddonManager.jsm
toolkit/mozapps/extensions/addonManager.js
toolkit/mozapps/extensions/amWebAPI.jsm
toolkit/mozapps/extensions/internal/XPIInstall.jsm
toolkit/mozapps/extensions/test/xpinstall/browser.ini
toolkit/mozapps/extensions/test/xpinstall/browser_containers.js
toolkit/mozapps/extensions/test/xpinstall/browser_privatebrowsing.js
toolkit/mozapps/extensions/test/xpinstall/head.js
--- a/toolkit/mozapps/extensions/AddonManager.jsm
+++ b/toolkit/mozapps/extensions/AddonManager.jsm
@@ -1554,18 +1554,16 @@ var AddonManagerInternal = {
    * @param  {string} [aOptions.name]
    *         An optional placeholder name while the add-on is being downloaded
    * @param  {string|Object} [aOptions.icons]
    *         Optional placeholder icons while the add-on is being downloaded
    * @param  {string} [aOptions.version]
    *         An optional placeholder version while the add-on is being downloaded
    * @param  {XULElement} [aOptions.browser]
    *         An optional <browser> element for download permissions prompts.
-   * @param  {nsIPrincipal} [aOptions.triggeringPrincipal]
-   *         The principal which is attempting to install the add-on.
    * @param  {Object} [aOptions.telemetryInfo]
    *         An optional object which provides details about the installation source
    *         included in the addon manager telemetry events.
    * @throws if aUrl is not specified or if an optional argument of
    *         an improper type is passed.
    */
   async getInstallForURL(aUrl, aOptions = {}) {
     if (!gStarted)
@@ -2678,27 +2676,25 @@ var AddonManagerInternal = {
         });
 
         // 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, {
-        browser: target,
-        triggeringPrincipal: options.triggeringPrincipal,
         hash: options.hash,
         telemetryInfo: {
           source: AddonManager.getInstallSourceFromHost(options.sourceHost),
           method: "amWebAPI",
         },
       }).then(install => {
         AddonManagerInternal.setupPromptHandler(target, null, install, false, "AMO");
 
--- a/toolkit/mozapps/extensions/addonManager.js
+++ b/toolkit/mozapps/extensions/addonManager.js
@@ -97,17 +97,16 @@ amManager.prototype = {
       telemetryInfo.method = aPayload.method;
     }
 
     AddonManager.getInstallForURL(uri, {
       hash,
       name,
       icon,
       browser: aBrowser,
-      triggeringPrincipal,
       telemetryInfo,
       sendCookies: true,
     }).then(aInstall => {
       function callCallback(status) {
         try {
           aCallback.onInstallEnded(uri, status);
         } catch (e) {
           Cu.reportError(e);
--- a/toolkit/mozapps/extensions/amWebAPI.jsm
+++ b/toolkit/mozapps/extensions/amWebAPI.jsm
@@ -232,17 +232,16 @@ class WebAPI extends APIObject {
     let installOptions = {
       ...options,
       // Provide the host from which the amWebAPI is being called
       // (so that we can detect if the API is being used from the disco pane,
       // AMO, testpilot or another unknown webpage).
       sourceHost: this.window.document.nodePrincipal.URI &&
         this.window.document.nodePrincipal.URI.host,
     };
-    installOptions.triggeringPrincipal = this.window.document.nodePrincipal;
     return this._apiTask("createInstall", [installOptions], installInfo => {
       if (!installInfo) {
         return null;
       }
       let install = new AddonInstall(this.window, this.broker, installInfo);
       this.allInstalls.push(installInfo.id);
       return this.window.AddonInstall._create(this.window, install);
     });
--- a/toolkit/mozapps/extensions/internal/XPIInstall.jsm
+++ b/toolkit/mozapps/extensions/internal/XPIInstall.jsm
@@ -1798,18 +1798,16 @@ var DownloadAddonInstall = class extends
    *        Additional options for the install
    * @param {string} [options.hash]
    *        An optional hash for the add-on
    * @param {AddonInternal} [options.existingAddon]
    *        The add-on this install will update if known
    * @param {XULElement} [options.browser]
    *        The browser performing the install, used to display
    *        authentication prompts.
-   * @param {nsIPrincipal} [options.principal]
-   *        The principal to use. If not present, will default to browser.contentPrincipal.
    * @param {string} [options.name]
    *        An optional name for the add-on
    * @param {string} [options.type]
    *        An optional type for the add-on
    * @param {Object} [options.icons]
    *        Optional icons for the add-on
    * @param {string} [options.version]
    *        An optional version for the add-on
@@ -1817,17 +1815,16 @@ var DownloadAddonInstall = class extends
    *        A callback to prompt the user before installing.
    * @param {boolean} [options.sendCookies]
    *        Whether cookies should be sent when downloading the add-on.
    */
   constructor(installLocation, url, options = {}) {
     super(installLocation, url, options);
 
     this.browser = options.browser;
-    this.loadingPrincipal = options.triggeringPrincipal || options.browser.contentPrincipal;
     this.sendCookies = Boolean(options.sendCookies);
 
     this.state = AddonManager.STATE_AVAILABLE;
 
     this.stream = null;
     this.crypto = null;
     this.badCertHandler = null;
     this.restartDownload = false;
@@ -1926,19 +1923,17 @@ var DownloadAddonInstall = class extends
     let listener = Cc["@mozilla.org/network/stream-listener-tee;1"].createInstance(Ci.nsIStreamListenerTee);
     listener.init(this, this.stream);
     try {
       let requireBuiltIn = Services.prefs.getBoolPref(PREF_INSTALL_REQUIREBUILTINCERTS, true);
       this.badCertHandler = new CertUtils.BadCertHandler(!requireBuiltIn);
 
       this.channel = NetUtil.newChannel({
         uri: this.sourceURI,
-        securityFlags: Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_INHERITS,
-        contentPolicyType: Ci.nsIContentPolicy.TYPE_SAVEAS_DOWNLOAD,
-        loadingPrincipal: this.loadingPrincipal,
+        loadUsingSystemPrincipal: true,
       });
       this.channel.notificationCallbacks = this;
       if (this.sendCookies) {
         if (this.channel instanceof Ci.nsIHttpChannelInternal) {
           this.channel.forceAllowThirdPartyCookie = true;
         }
       } else {
         this.channel.loadFlags |= Ci.nsIRequest.LOAD_ANONYMOUS;
--- a/toolkit/mozapps/extensions/test/xpinstall/browser.ini
+++ b/toolkit/mozapps/extensions/test/xpinstall/browser.ini
@@ -34,17 +34,16 @@ support-files =
 [browser_badhash.js]
 [browser_badhashtype.js]
 [browser_bug540558.js]
 [browser_bug611242.js]
 [browser_bug638292.js]
 [browser_bug645699.js]
 [browser_bug672485.js]
 skip-if = true # disabled due to a leak. See bug 682410.
-[browser_containers.js]
 [browser_cookies.js]
 [browser_cookies2.js]
 [browser_cookies3.js]
 [browser_cookies4.js]
 skip-if = true # Bug 1084646
 [browser_corrupt.js]
 [browser_datauri.js]
 [browser_doorhanger_installs.js]
@@ -62,17 +61,16 @@ skip-if = true # Bug 1084646
 [browser_httphash6.js]
 skip-if = true # Bug 1449788
 [browser_installchrome.js]
 [browser_localfile.js]
 [browser_localfile2.js]
 [browser_localfile3.js]
 [browser_localfile4.js]
 [browser_offline.js]
-[browser_privatebrowsing.js]
 [browser_relative.js]
 [browser_softwareupdate.js]
 [browser_trigger_redirect.js]
 [browser_unsigned_trigger.js]
 skip-if = require_signing
 [browser_unsigned_trigger_iframe.js]
 skip-if = require_signing
 [browser_unsigned_trigger_xorigin.js]
deleted file mode 100644
--- a/toolkit/mozapps/extensions/test/xpinstall/browser_containers.js
+++ /dev/null
@@ -1,75 +0,0 @@
-const MY_CONTEXT = 2;
-let gDidSeeChannel = false;
-
-function check_channel(subject) {
-  if (!(subject instanceof Ci.nsIHttpChannel)) {
-    return;
-  }
-  let channel = subject.QueryInterface(Ci.nsIHttpChannel);
-  let uri = channel.URI;
-  if (!uri || !uri.spec.endsWith("amosigned.xpi")) {
-    return;
-  }
-  gDidSeeChannel = true;
-  ok(true, "Got request for " + uri.spec);
-
-  let loadInfo = channel.loadInfo;
-  is(loadInfo.originAttributes.userContextId, MY_CONTEXT, "Got expected usercontextid");
-}
-// ----------------------------------------------------------------------------
-// Tests we send the right cookies when installing through an InstallTrigger call
-function test() {
-  Harness.installConfirmCallback = confirm_install;
-  Harness.installEndedCallback = install_ended;
-  Harness.installsCompletedCallback = finish_test;
-  Harness.finalContentEvent = "InstallComplete";
-  Harness.setup();
-
-  var pm = Services.perms;
-  pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
-
-  var triggers = encodeURIComponent(JSON.stringify({
-    "Unsigned XPI": {
-      URL: TESTROOT + "amosigned.xpi",
-      IconURL: TESTROOT + "icon.png",
-      toString() { return this.URL; },
-    },
-  }));
-  gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser, "", {userContextId: MY_CONTEXT});
-  Services.obs.addObserver(check_channel, "http-on-before-connect");
-  BrowserTestUtils.loadURI(gBrowser, TESTROOT + "installtrigger.html?" + triggers);
-}
-
-function confirm_install(panel) {
-  is(panel.getAttribute("name"), "XPI Test", "Should have seen the name");
-  return true;
-}
-
-function install_ended(install, addon) {
-  Assert.deepEqual(install.installTelemetryInfo, {source: "test-host", method: "installTrigger"},
-                   "Got the expected install.installTelemetryInfo");
-  install.cancel();
-}
-
-const finish_test = async function(count) {
-  ok(gDidSeeChannel, "Should have seen the request for the XPI and verified it was sent the right way.");
-  is(count, 1, "1 Add-on should have been successfully installed");
-
-  Services.obs.removeObserver(check_channel, "http-on-before-connect");
-
-  Services.perms.remove(makeURI("http://example.com"), "install");
-
-  const results = await ContentTask.spawn(gBrowser.selectedBrowser, null, () => {
-    return {
-      return: content.document.getElementById("return").textContent,
-      status: content.document.getElementById("status").textContent,
-    };
-  });
-
-  is(results.return, "true", "installTrigger should have claimed success");
-  is(results.status, "0", "Callback should have seen a success");
-
-  gBrowser.removeCurrentTab();
-  Harness.finish();
-};
-
deleted file mode 100644
--- a/toolkit/mozapps/extensions/test/xpinstall/browser_privatebrowsing.js
+++ /dev/null
@@ -1,84 +0,0 @@
-let gDidSeeChannel = false;
-
-function check_channel(subject) {
-  if (!(subject instanceof Ci.nsIHttpChannel)) {
-    return;
-  }
-  let channel = subject.QueryInterface(Ci.nsIHttpChannel);
-  let uri = channel.URI;
-  if (!uri || !uri.spec.endsWith("amosigned.xpi")) {
-    return;
-  }
-  gDidSeeChannel = true;
-  ok(true, "Got request for " + uri.spec);
-
-  let loadInfo = channel.loadInfo;
-  is(loadInfo.originAttributes.privateBrowsingId, 1, "Request should have happened using private browsing");
-}
-// ----------------------------------------------------------------------------
-// Tests we send the right cookies when installing through an InstallTrigger call
-let gPrivateWin;
-async function test() {
-  waitForExplicitFinish(); // have to call this ourselves because we're async.
-  Harness.installConfirmCallback = confirm_install;
-  Harness.installEndedCallback = install_ended;
-  Harness.installsCompletedCallback = finish_test;
-  Harness.finalContentEvent = "InstallComplete";
-  gPrivateWin = await BrowserTestUtils.openNewBrowserWindow({private: true});
-  Harness.setup(gPrivateWin);
-
-  var pm = Services.perms;
-  pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
-
-  var triggers = encodeURIComponent(JSON.stringify({
-    "Unsigned XPI": {
-      URL: TESTROOT + "amosigned.xpi",
-      IconURL: TESTROOT + "icon.png",
-      toString() { return this.URL; },
-    },
-  }));
-  gPrivateWin.gBrowser.selectedTab = BrowserTestUtils.addTab(gPrivateWin.gBrowser);
-  Services.obs.addObserver(check_channel, "http-on-before-connect");
-  BrowserTestUtils.loadURI(gPrivateWin.gBrowser, TESTROOT + "installtrigger.html?" + triggers);
-}
-
-function confirm_install(panel) {
-  is(panel.getAttribute("name"), "XPI Test", "Should have seen the name");
-  return true;
-}
-
-function install_ended(install, addon) {
-  Assert.deepEqual(install.installTelemetryInfo, {source: "test-host", method: "installTrigger"},
-                   "Got the expected install.installTelemetryInfo");
-  install.cancel();
-}
-
-const finish_test = async function(count) {
-  ok(gDidSeeChannel, "Should have seen the request for the XPI and verified it was sent the right way.");
-  is(count, 1, "1 Add-on should have been successfully installed");
-
-  Services.obs.removeObserver(check_channel, "http-on-before-connect");
-
-  Services.perms.remove(makeURI("http://example.com"), "install");
-
-  const results = await ContentTask.spawn(gPrivateWin.gBrowser.selectedBrowser, null, () => {
-    return {
-      return: content.document.getElementById("return").textContent,
-      status: content.document.getElementById("status").textContent,
-    };
-  });
-
-  is(results.return, "true", "installTrigger should have claimed success");
-  is(results.status, "0", "Callback should have seen a success");
-
-  // Explicitly click the "OK" button to avoid the panel reopening in the other window once this
-  // window closes (see also bug 1535069):
-  await BrowserTestUtils.waitForEvent(gPrivateWin.PanelUI.notificationPanel, "popupshown");
-  gPrivateWin.PanelUI.notificationPanel.querySelector("popupnotification[popupid=addon-installed]").button.click();
-
-  // Now finish the test:
-  Harness.finish(gPrivateWin);
-  await BrowserTestUtils.closeWindow(gPrivateWin);
-};
-
-
--- a/toolkit/mozapps/extensions/test/xpinstall/head.js
+++ b/toolkit/mozapps/extensions/test/xpinstall/head.js
@@ -86,17 +86,17 @@ var Harness = {
 
   waitingForFinish: false,
 
   // A unique value to return from the installConfirmCallback to indicate that
   // the install UI shouldn't be closed automatically
   leaveOpen: {},
 
   // Setup and tear down functions
-  setup(win = window) {
+  setup() {
     if (!this.waitingForFinish) {
       waitForExplicitFinish();
       this.waitingForFinish = true;
 
       Services.prefs.setBoolPref(PREF_INSTALL_REQUIRESECUREORIGIN, false);
       Services.prefs.setBoolPref(PREF_LOGGING_ENABLED, true);
       Services.prefs.setBoolPref("network.cookieSettings.unblocked_for_testing", true);
 
@@ -104,23 +104,22 @@ var Harness = {
       Services.obs.addObserver(this, "addon-install-disabled");
       // XXX this breaks a bunch of stuff, see comment in onInstallCancelled
       // Services.obs.addObserver(this, "addon-install-cancelled", false);
       Services.obs.addObserver(this, "addon-install-origin-blocked");
       Services.obs.addObserver(this, "addon-install-blocked");
       Services.obs.addObserver(this, "addon-install-failed");
       Services.obs.addObserver(this, "addon-install-complete");
 
-      this._boundWin = win; // need this so our addon manager listener knows which window to use.
       AddonManager.addInstallListener(this);
 
       Services.wm.addListener(this);
 
-      win.addEventListener("popupshown", this);
-      win.PanelUI.notificationPanel.addEventListener("popupshown", this);
+      window.addEventListener("popupshown", this);
+      PanelUI.notificationPanel.addEventListener("popupshown", this);
 
       var self = this;
       registerCleanupFunction(async function() {
         Services.prefs.clearUserPref(PREF_LOGGING_ENABLED);
         Services.prefs.clearUserPref(PREF_INSTALL_REQUIRESECUREORIGIN);
         Services.prefs.clearUserPref("network.cookieSettings.unblocked_for_testing");
 
         Services.obs.removeObserver(self, "addon-install-started");
@@ -130,40 +129,39 @@ var Harness = {
         Services.obs.removeObserver(self, "addon-install-blocked");
         Services.obs.removeObserver(self, "addon-install-failed");
         Services.obs.removeObserver(self, "addon-install-complete");
 
         AddonManager.removeInstallListener(self);
 
         Services.wm.removeListener(self);
 
-        win.removeEventListener("popupshown", self);
-        win.PanelUI.notificationPanel.removeEventListener("popupshown", self);
+        window.removeEventListener("popupshown", self);
+        PanelUI.notificationPanel.removeEventListener("popupshown", self);
 
         let aInstalls = await AddonManager.getAllInstalls();
         is(aInstalls.length, 0, "Should be no active installs at the end of the test");
         aInstalls.forEach(function(aInstall) {
           info("Install for " + aInstall.sourceURI + " is in state " + aInstall.state);
           aInstall.cancel();
         });
       });
     }
 
     this.installCount = 0;
     this.pendingCount = 0;
     this.runningInstalls = [];
   },
 
-  finish(win = window) {
+  finish() {
     // Some tests using this harness somehow finish leaving
     // the addon-installed panel open.  hiding here addresses
     // that which fixes the rest of the tests.  Since no test
     // here cares about this panel, we just need it to close.
-    win.PanelUI.notificationPanel.hidePopup();
-    delete this._boundWin;
+    PanelUI.notificationPanel.hidePopup();
     finish();
   },
 
   endTest() {
     let callback = this.installsCompletedCallback;
     let count = this.installCount;
 
     is(this.runningInstalls.length, 0, "Should be no running installs left");
@@ -243,18 +241,18 @@ var Harness = {
       panel.secondaryButton.click();
     } else {
       panel.button.click();
     }
   },
 
   handleEvent(event) {
     if (event.type === "popupshown") {
-      if (event.target == event.view.PanelUI.notificationPanel) {
-        event.view.PanelUI.notificationPanel.hidePopup();
+      if (event.target == PanelUI.notificationPanel) {
+        PanelUI.notificationPanel.hidePopup();
       } else if (event.target.firstElementChild) {
         let popupId = event.target.firstElementChild.getAttribute("popupid");
         if (popupId === "addon-webext-permissions") {
           this.popupReady(event.target.firstElementChild);
         } else if (popupId === "addon-install-failed") {
           event.target.firstElementChild.button.click();
         }
       }
@@ -320,17 +318,17 @@ var Harness = {
   // Addon Install Listener
 
   onNewInstall(install) {
     this.runningInstalls.push(install);
 
     if (this.finalContentEvent && !this.waitingForEvent) {
       this.waitingForEvent = true;
       info("Waiting for " + this.finalContentEvent);
-      let mm = this._boundWin.gBrowser.selectedBrowser.messageManager;
+      let mm = gBrowser.selectedBrowser.messageManager;
       mm.loadFrameScript(`data:,content.addEventListener("${this.finalContentEvent}", () => { sendAsyncMessage("Test:GotNewInstallEvent"); });`, false);
       let listener = () => {
         info("Saw " + this.finalContentEvent);
         mm.removeMessageListener("Test:GotNewInstallEvent", listener);
         this.waitingForEvent = false;
         if (this.pendingCount == 0)
           this.endTest();
       };