Commit efe44b43 authored by Matthew Finkel's avatar Matthew Finkel Committed by Pier Angelo Vendrame
Browse files

BB 41598: Prevent NoScript from being removed/disabled.

Bug 40253: Explicitly allow NoScript in Private Browsing mode.
parent ea52c9af
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -954,6 +954,15 @@ export class ExtensionData {
    this.eventPagesEnabled = lazy.eventPagesEnabled;
  }

  /**
   * Whether this is the NoScript extension.
   *
   * @type {boolean}
   */
  get isNoScript() {
    return this.id === "{73a6fe31-595d-460b-a920-fcc0f8843232}";
  }

  /**
   * A factory function that allows the construction of ExtensionData, with
   * the isPrivileged flag computed asynchronously.
@@ -4216,6 +4225,14 @@ export class Extension extends ExtensionData {
        });
        this.permissions.delete(PRIVATE_ALLOWED_PERMISSION);
      }

    // Bug 40253: Explicitly allow NoScript in Private Browsing mode.
    if (this.isNoScript) {
      lazy.ExtensionPermissions.add(this.id, {
        permissions: [PRIVATE_ALLOWED_PERMISSION],
        origins: [],
      });
      this.permissions.add(PRIVATE_ALLOWED_PERMISSION);
    }

    // We only want to update the SVG_CONTEXT_PROPERTIES_PERMISSION during
+9 −0
Original line number Diff line number Diff line
@@ -859,6 +859,15 @@ export class AddonInternal {
      }
    }

    // Bug 41598: prevent NoScript from being uninstalled/disabled
    if (this.id === "{73a6fe31-595d-460b-a920-fcc0f8843232}") {
      permissions &= ~(
        lazy.AddonManager.PERM_CAN_UNINSTALL |
        lazy.AddonManager.PERM_CAN_DISABLE |
        lazy.AddonManager.PERM_CAN_CHANGE_PRIVATEBROWSING_ACCESS
      );
    }

    return permissions;
  }