Bug 1529394 revert early breakout to support test infra extensions r=rpl
authorShane Caraveo <scaraveo@mozilla.com>
Tue, 05 Mar 2019 20:56:07 +0000
changeset 520381 53ac343019c69ea5b529a47308761626f903497b
parent 520380 31694cc74f7d2aaf3178ffa5ccb29b58486d89a1
child 520382 095dde8fb209840abc24088020b67f144784d292
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrpl
bugs1529394
milestone67.0a1
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
Bug 1529394 revert early breakout to support test infra extensions r=rpl Differential Revision: https://phabricator.services.mozilla.com/D22170
toolkit/components/extensions/Extension.jsm
toolkit/components/extensions/test/xpcshell/test_ext_background_private_browsing.js
--- a/toolkit/components/extensions/Extension.jsm
+++ b/toolkit/components/extensions/Extension.jsm
@@ -48,17 +48,16 @@ XPCOMUtils.defineLazyModuleGetters(this,
   ExtensionTelemetry: "resource://gre/modules/ExtensionTelemetry.jsm",
   FileSource: "resource://gre/modules/L10nRegistry.jsm",
   L10nRegistry: "resource://gre/modules/L10nRegistry.jsm",
   Log: "resource://gre/modules/Log.jsm",
   MessageChannel: "resource://gre/modules/MessageChannel.jsm",
   NetUtil: "resource://gre/modules/NetUtil.jsm",
   OS: "resource://gre/modules/osfile.jsm",
   PluralForm: "resource://gre/modules/PluralForm.jsm",
-  PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.jsm",
   Schemas: "resource://gre/modules/Schemas.jsm",
   XPIProvider: "resource://gre/modules/addons/XPIProvider.jsm",
 });
 
 // This is used for manipulating jar entry paths, which always use Unix
 // separators.
 XPCOMUtils.defineLazyGetter(
   this, "OSPath", () => {
@@ -1901,20 +1900,17 @@ class Extension extends ExtensionData {
       if (this.errors.length) {
         return Promise.reject({errors: this.errors});
       }
 
       if (this.hasShutdown) {
         return;
       }
 
-      // We automatically add permissions to some extensions:
-      // 1. system/built-in extensions
-      // 2. all extensions when in permanent private browsing
-      //
+      // We automatically add permissions to system/built-in extensions.
       // Extensions expliticy stating not_allowed will never get permission.
       if (!allowPrivateBrowsingByDefault && this.manifest.incognito !== "not_allowed" &&
           !this.permissions.has(PRIVATE_ALLOWED_PERMISSION)) {
         if (this.isPrivileged && !this.addonData.temporarilyInstalled) {
           // Add to EP so it is preserved after ADDON_INSTALL.  We don't wait on the add here
           // since we are pushing the value into this.permissions.  EP will eventually save.
           ExtensionPermissions.add(this.id, {permissions: [PRIVATE_ALLOWED_PERMISSION], origins: []});
           this.permissions.add(PRIVATE_ALLOWED_PERMISSION);
@@ -1939,27 +1935,16 @@ class Extension extends ExtensionData {
         } else if (ExtensionStorageIDB.isMigratedExtension(this)) {
           this.setSharedData("storageIDBBackend", true);
           this.setSharedData("storageIDBPrincipal", ExtensionStorageIDB.getStoragePrincipal(this));
         }
       }
 
       resolveReadyPromise(this.policy);
 
-      // When in PPB skip any startup and disable the policy if the extension
-      // does not have permission.
-      if (PrivateBrowsingUtils.permanentPrivateBrowsing && !this.privateBrowsingAllowed) {
-        this.state = "Startup: Cancelled: (not running in permenant private browsing mode)";
-
-        this.policy.active = false;
-
-        this.cleanupGeneratedFile();
-        return;
-      }
-
       // The "startup" Management event sent on the extension instance itself
       // is emitted just before the Management "startup" event,
       // and it is used to run code that needs to be executed before
       // any of the "startup" listeners.
       this.emit("startup", this);
 
       let state = new Set(["Emit startup", "Run manifest"]);
       this.state = `Startup: ${Array.from(state)}`;
--- a/toolkit/components/extensions/test/xpcshell/test_ext_background_private_browsing.js
+++ b/toolkit/components/extensions/test/xpcshell/test_ext_background_private_browsing.js
@@ -28,32 +28,8 @@ add_task(async function test_background_
   });
 
   await extension.startup();
 
   await extension.awaitFinish("incognito");
 
   await extension.unload();
 });
-
-add_task(async function test_background_PPB_not_allowed() {
-  info("Test background page incognito value with permanent private browsing enabled");
-
-  Services.prefs.setBoolPref("extensions.allowPrivateBrowsingByDefault", false);
-  Services.prefs.setBoolPref("browser.privatebrowsing.autostart", true);
-  registerCleanupFunction(() => {
-    Services.prefs.clearUserPref("browser.privatebrowsing.autostart");
-    Services.prefs.clearUserPref("extensions.allowPrivateBrowsingByDefault");
-  });
-
-  let extension = ExtensionTestUtils.loadExtension({
-    async background() {
-      browser.test.notifyFail("incognito");
-    },
-  });
-
-  await extension.startup();
-
-  let state = extension.extension.state;
-  ok(state.startsWith("Startup: Cancelled"), `extension startup state should be cancelled "${state}"`);
-
-  await extension.unload();
-});