Commit 5d693629 authored by Gijs Kruitbosch's avatar Gijs Kruitbosch
Browse files

Bug 1528335, r=aswan

Differential Revision: https://phabricator.services.mozilla.com/D25775

--HG--
extra : moz-landing-system : lando
parent 38e2c781
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -1559,6 +1559,8 @@ var AddonManagerInternal = {
   *         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.
@@ -2690,6 +2692,8 @@ var AddonManagerInternal = {
      }

      return AddonManagerInternal.getInstallForURL(options.url, {
        browser: target,
        triggeringPrincipal: options.triggeringPrincipal,
        hash: options.hash,
        telemetryInfo: {
          source: AddonManager.getInstallSourceFromHost(options.sourceHost),
+1 −0
Original line number Diff line number Diff line
@@ -102,6 +102,7 @@ amManager.prototype = {
      name,
      icon,
      browser: aBrowser,
      triggeringPrincipal,
      telemetryInfo,
      sendCookies: true,
    }).then(aInstall => {
+1 −0
Original line number Diff line number Diff line
@@ -237,6 +237,7 @@ class WebAPI extends APIObject {
      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;
+6 −1
Original line number Diff line number Diff line
@@ -1803,6 +1803,8 @@ var DownloadAddonInstall = class extends AddonInstall {
   * @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]
@@ -1820,6 +1822,7 @@ var DownloadAddonInstall = class extends AddonInstall {
    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;
@@ -1928,7 +1931,9 @@ var DownloadAddonInstall = class extends AddonInstall {

      this.channel = NetUtil.newChannel({
        uri: this.sourceURI,
        loadUsingSystemPrincipal: true,
        securityFlags: Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_INHERITS,
        contentPolicyType: Ci.nsIContentPolicy.TYPE_SAVEAS_DOWNLOAD,
        loadingPrincipal: this.loadingPrincipal,
      });
      this.channel.notificationCallbacks = this;
      if (this.sendCookies) {