Backed out 5 changesets (bug 1509047) for ES Lint failure CLOSED TREE
authorBogdan Tara <btara@mozilla.com>
Thu, 29 Nov 2018 03:36:47 +0200
changeset 507870 0f4be93319f6df5739f29fed76288e0861a5b7d1
parent 507869 53f6c4e1f112024f662351dd346a966f0fb77f8e
child 507871 30accf21bb0afe33b1459daa2dd80340fb05cb87
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1509047
milestone65.0a1
backs out53f6c4e1f112024f662351dd346a966f0fb77f8e
7bfa4179a341674e066171c33a8bad746b68cd92
37172d2d6f99802975761c9e26bac9f2b94d8c44
cc9d468d6ba6a52d06f7fb03b8778e1ce6e70e69
1aa87e9e3c71eb756c446b285f098d0dc267b38e
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 5 changesets (bug 1509047) for ES Lint failure CLOSED TREE Backed out changeset 53f6c4e1f112 (bug 1509047) Backed out changeset 7bfa4179a341 (bug 1509047) Backed out changeset 37172d2d6f99 (bug 1509047) Backed out changeset cc9d468d6ba6 (bug 1509047) Backed out changeset 1aa87e9e3c71 (bug 1509047)
browser/app/profile/firefox.js
browser/modules/BrowserUsageTelemetry.jsm
browser/modules/PermissionUI.jsm
browser/modules/test/browser/browser.ini
browser/modules/test/browser/browser_PermissionUI.js
browser/modules/test/browser/browser_PermissionUI_prompts.js
browser/modules/test/browser/browser_UsageTelemetry_uniqueOriginsVisitedInPast24Hours.js
dom/base/StorageAccessPermissionRequest.cpp
dom/base/StorageAccessPermissionRequest.h
dom/base/nsDocument.cpp
toolkit/components/antitracking/AntiTrackingCommon.cpp
toolkit/components/antitracking/AntiTrackingCommon.h
toolkit/components/antitracking/test/browser/browser_storageAccessDoorHanger.js
toolkit/components/antitracking/test/browser/head.js
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -1527,19 +1527,16 @@ pref("network.cookie.cookieBehavior", 4 
 
 pref("browser.contentblocking.allowlist.storage.enabled", true);
 
 #ifdef NIGHTLY_BUILD
 // Enable the Storage Access API in Nightly
 pref("dom.storage_access.enabled", true);
 #endif
 
-pref("dom.storage_access.auto_grants", true);
-pref("dom.storage_access.max_concurrent_auto_grants", 5);
-
 // Define a set of default features for the Content Blocking UI.
 pref("browser.contentblocking.trackingprotection.control-center.ui.enabled", true);
 pref("browser.contentblocking.rejecttrackers.control-center.ui.enabled", true);
 
 // Enable the Report Breakage UI on Nightly and Beta but not on Release yet.
 #ifdef EARLY_BETA_OR_EARLIER
 pref("browser.contentblocking.reportBreakage.enabled", true);
 #else
@@ -1793,10 +1790,8 @@ pref("toolkit.coverage.endpoint.base", "
 #if defined(NIGHTLY_BUILD) && defined(MOZ_LIBPRIO)
 pref("prio.enabled", true);
 #endif
 
 // Discovery prefs
 pref("browser.discovery.enabled", false);
 pref("browser.discovery.containers.enabled", true);
 pref("browser.discovery.sites", "addons.mozilla.org");
-
-pref("browser.engagement.recent_visited_origins.expiry", 86400); // 24 * 60 * 60 (24 hours in seconds)
--- a/browser/modules/BrowserUsageTelemetry.jsm
+++ b/browser/modules/BrowserUsageTelemetry.jsm
@@ -2,36 +2,29 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 var EXPORTED_SYMBOLS = [
   "BrowserUsageTelemetry",
-  "URICountListener",
   "URLBAR_SELECTED_RESULT_TYPES",
   "URLBAR_SELECTED_RESULT_METHODS",
   "MINIMUM_TAB_COUNT_INTERVAL_MS",
  ];
 
 const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm", null);
 
 XPCOMUtils.defineLazyModuleGetters(this, {
   PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.jsm",
   SearchTelemetry: "resource:///modules/SearchTelemetry.jsm",
   Services: "resource://gre/modules/Services.jsm",
-  setTimeout: "resource://gre/modules/Timer.jsm",
 });
 
-// This pref is in seconds!
-XPCOMUtils.defineLazyPreferenceGetter(this,
-  "gRecentVisitedOriginsExpiry",
-  "browser.engagement.recent_visited_origins.expiry");
-
 // The upper bound for the count of the visited unique domain names.
 const MAX_UNIQUE_VISITED_DOMAINS = 100;
 
 // Observed topic names.
 const TAB_RESTORING_TOPIC = "SSTabRestoring";
 const TELEMETRY_SUBSESSIONSPLIT_TOPIC = "internal-telemetry-after-subsession-split";
 const DOMWINDOW_OPENED_TOPIC = "domwindowopened";
 const AUTOCOMPLETE_ENTER_TEXT_TOPIC = "autocomplete-did-enter-text";
@@ -130,18 +123,16 @@ function getSearchEngineId(engine) {
 function shouldRecordSearchCount(tabbrowser) {
   return !PrivateBrowsingUtils.isWindowPrivate(tabbrowser.ownerGlobal) ||
          !Services.prefs.getBoolPref("browser.engagement.search_counts.pbm", false);
 }
 
 let URICountListener = {
   // A set containing the visited domains, see bug 1271310.
   _domainSet: new Set(),
-  // A set containing the visited origins during the last 24 hours (similar to domains, but not quite the same)
-  _origin24hrSet: new Set(),
   // A map to keep track of the URIs loaded from the restored tabs.
   _restoredURIsMap: new WeakMap(),
 
   isHttpURI(uri) {
     // Only consider http(s) schemas.
     return uri.schemeIs("http") || uri.schemeIs("https");
   },
 
@@ -234,63 +225,35 @@ let URICountListener = {
 
     // We only want to count the unique domains up to MAX_UNIQUE_VISITED_DOMAINS.
     if (this._domainSet.size == MAX_UNIQUE_VISITED_DOMAINS) {
       return;
     }
 
     // Unique domains should be aggregated by (eTLD + 1): x.test.com and y.test.com
     // are counted once as test.com.
-    let baseDomain;
     try {
       // Even if only considering http(s) URIs, |getBaseDomain| could still throw
       // due to the URI containing invalid characters or the domain actually being
       // an ipv4 or ipv6 address.
-      baseDomain = Services.eTLD.getBaseDomain(uri);
-      this._domainSet.add(baseDomain);
+      this._domainSet.add(Services.eTLD.getBaseDomain(uri));
     } catch (e) {
-      baseDomain = uri.host;
-    }
-
-    // Record the origin, but with the base domain (eTLD + 1).
-    let baseDomainURI = uri.mutate()
-                           .setHost(baseDomain)
-                           .finalize();
-    this._origin24hrSet.add(baseDomainURI.prePath);
-    if (gRecentVisitedOriginsExpiry) {
-      setTimeout(() => {
-        this._origin24hrSet.delete(baseDomainURI.prePath);
-      }, gRecentVisitedOriginsExpiry * 1000);
+      return;
     }
 
     Services.telemetry.scalarSet(UNIQUE_DOMAINS_COUNT_SCALAR_NAME, this._domainSet.size);
   },
 
   /**
    * Reset the counts. This should be called when breaking a session in Telemetry.
    */
   reset() {
     this._domainSet.clear();
   },
 
-  /**
-   * Returns the number of unique origins visited in this session during the
-   * last 24 hours.
-   */
-  get uniqueOriginsVisitedInPast24Hours() {
-    return this._origin24hrSet.size;
-  },
-
-  /**
-   * Resets the number of unique origins visited in this session.
-   */
-  resetUniqueOriginsVisitedInPast24Hours() {
-    this._origin24hrSet.clear();
-  },
-
   QueryInterface: ChromeUtils.generateQI([Ci.nsIWebProgressListener,
                                           Ci.nsISupportsWeakReference]),
 };
 
 let urlbarListener = {
 
   // This is needed for recordUrlbarSelectedResultMethod().
   selectedIndex: -1,
--- a/browser/modules/PermissionUI.jsm
+++ b/browser/modules/PermissionUI.jsm
@@ -63,18 +63,16 @@ var EXPORTED_SYMBOLS = [
 ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 
 ChromeUtils.defineModuleGetter(this, "Services",
   "resource://gre/modules/Services.jsm");
 ChromeUtils.defineModuleGetter(this, "SitePermissions",
   "resource:///modules/SitePermissions.jsm");
 ChromeUtils.defineModuleGetter(this, "PrivateBrowsingUtils",
   "resource://gre/modules/PrivateBrowsingUtils.jsm");
-ChromeUtils.defineModuleGetter(this, "URICountListener",
-  "resource:///modules/BrowserUsageTelemetry.jsm");
 
 XPCOMUtils.defineLazyGetter(this, "gBrowserBundle", function() {
   return Services.strings
                  .createBundle("chrome://browser/locale/browser.properties");
 });
 
 var PermissionUI = {};
 
@@ -250,22 +248,18 @@ var PermissionPromptPrototype = {
     return [];
   },
 
   /**
    * If the prompt will be shown to the user, this callback will
    * be called just before. Subclasses may want to override this
    * in order to, for example, bump a counter Telemetry probe for
    * how often a particular permission request is seen.
-   *
-   * If this returns false, it cancels the process of showing the prompt.  In
-   * that case, it is the responsibility of the onBeforeShow() implementation
-   * to ensure that allow() or cancel() are called on the object appropriately.
    */
-  onBeforeShow() { return true; },
+  onBeforeShow() {},
 
   /**
    * If the prompt was shown to the user, this callback will be called just
    * after it's been shown.
    */
   onShown() {},
 
   /**
@@ -441,25 +435,24 @@ var PermissionPromptPrototype = {
       }
       // The prompt has been removed, notify the PermissionUI.
       if (topic == "removed") {
         this.onAfterShow();
       }
       return false;
     };
 
-    if (this.onBeforeShow() !== false) {
-      chromeWin.PopupNotifications.show(this.browser,
-                                        this.notificationID,
-                                        this.message,
-                                        this.anchorID,
-                                        mainAction,
-                                        secondaryActions,
-                                        options);
-    }
+    this.onBeforeShow();
+    chromeWin.PopupNotifications.show(this.browser,
+                                      this.notificationID,
+                                      this.message,
+                                      this.anchorID,
+                                      mainAction,
+                                      secondaryActions,
+                                      options);
   },
 };
 
 PermissionUI.PermissionPromptPrototype = PermissionPromptPrototype;
 
 /**
  * A subclass of PermissionPromptPrototype that assumes
  * that this.request is an nsIContentPermissionRequest
@@ -592,17 +585,16 @@ GeolocationPermissionPrompt.prototype = 
       },
     }];
   },
 
   onBeforeShow() {
     let secHistogram = Services.telemetry.getHistogramById("SECURITY_UI");
     const SHOW_REQUEST = Ci.nsISecurityUITelemetry.WARNING_GEOLOCATION_REQUEST;
     secHistogram.add(SHOW_REQUEST);
-    return true;
   },
 };
 
 PermissionUI.GeolocationPermissionPrompt = GeolocationPermissionPrompt;
 
 /**
  * Creates a PermissionPrompt for a nsIContentPermissionRequest for
  * the Desktop Notification API.
@@ -829,16 +821,19 @@ MIDIPermissionPrompt.prototype = {
         action: Ci.nsIPermissionManager.ALLOW_ACTION,
       },
       {
         label: gBrowserBundle.GetStringFromName("midi.DontAllow.label"),
         accessKey: gBrowserBundle.GetStringFromName("midi.DontAllow.accesskey"),
         action: Ci.nsIPermissionManager.DENY_ACTION,
     }];
   },
+
+  onBeforeShow() {
+  },
 };
 
 PermissionUI.MIDIPermissionPrompt = MIDIPermissionPrompt;
 
 function AutoplayPermissionPrompt(request) {
   this.request = request;
 }
 
@@ -911,29 +906,23 @@ AutoplayPermissionPrompt.prototype = {
       let notification = chromeWin.PopupNotifications.getNotification(
         this.notificationID, this.browser);
       if (notification) {
         chromeWin.PopupNotifications.remove(notification);
       }
     };
     this.browser.addEventListener(
       "DOMAudioPlaybackStarted", this.handlePlaybackStart);
-    return true;
   },
 };
 
 PermissionUI.AutoplayPermissionPrompt = AutoplayPermissionPrompt;
 
 function StorageAccessPermissionPrompt(request) {
   this.request = request;
-
-  XPCOMUtils.defineLazyPreferenceGetter(this, "_autoGrants",
-                                        "dom.storage_access.auto_grants");
-  XPCOMUtils.defineLazyPreferenceGetter(this, "_maxConcurrentAutoGrants",
-                                        "dom.storage_access.max_concurrent_auto_grants");
 }
 
 StorageAccessPermissionPrompt.prototype = {
   __proto__: PermissionPromptForRequestPrototype,
 
   get usePermissionManager() {
     return false;
   },
@@ -1014,43 +1003,11 @@ StorageAccessPermissionPrompt.prototype 
           self.allow({"storage-access": "allow-on-any-site"});
         },
     }];
   },
 
   get topLevelPrincipal() {
     return this.request.topLevelPrincipal;
   },
-
-  get maxConcurrentAutomaticGrants() {
-    // one percent of the number of top-levels origins visited in the current
-    // session (but not to exceed 24 hours), or the value of the
-    // dom.storage_access.max_concurrent_auto_grants preference, whichever is
-    // higher.
-    return Math.max(Math.max(Math.floor(URICountListener.uniqueOriginsVisitedInPast24Hours / 100),
-                             this._maxConcurrentAutoGrants), 0);
-  },
-
-  getOriginsThirdPartyHasAccessTo(thirdPartyOrigin) {
-    let prefix = `3rdPartyStorage^${thirdPartyOrigin}`;
-    let perms = Services.perms.getAllWithTypePrefix(prefix);
-    let origins = new Set();
-    while (perms.length) {
-      let perm = perms.shift();
-      origins.add(perm.principal.origin);
-    }
-    return origins.size;
-  },
-
-  onBeforeShow() {
-    let thirdPartyOrigin = this.request.principal.origin;
-    if (this._autoGrants &&
-        this.getOriginsThirdPartyHasAccessTo(thirdPartyOrigin) <
-          this.maxConcurrentAutomaticGrants) {
-      // Automatically accept the prompt
-      this.allow({"storage-access": "allow-auto-grant"});
-      return false;
-    }
-    return true;
-  },
 };
 
 PermissionUI.StorageAccessPermissionPrompt = StorageAccessPermissionPrompt;
--- a/browser/modules/test/browser/browser.ini
+++ b/browser/modules/test/browser/browser.ini
@@ -34,17 +34,16 @@ skip-if = !e10s
 skip-if = os != win || (os == win && bits == 64) # bug 1456807
 [browser_UnsubmittedCrashHandler.js]
 run-if = crashreporter
 [browser_urlBar_zoom.js]
 [browser_UsageTelemetry.js]
 [browser_UsageTelemetry_domains.js]
 [browser_UsageTelemetry_private_and_restore.js]
 skip-if = verify && debug
-[browser_UsageTelemetry_uniqueOriginsVisitedInPast24Hours.js]
 [browser_UsageTelemetry_urlbar.js]
 support-files =
   usageTelemetrySearchSuggestions.sjs
   usageTelemetrySearchSuggestions.xml
 [browser_UsageTelemetry_searchbar.js]
 support-files =
   usageTelemetrySearchSuggestions.sjs
   usageTelemetrySearchSuggestions.xml
--- a/browser/modules/test/browser/browser_PermissionUI.js
+++ b/browser/modules/test/browser/browser_PermissionUI.js
@@ -289,17 +289,16 @@ add_task(async function test_on_before_s
     let TestPrompt = {
       __proto__: PermissionUI.PermissionPromptForRequestPrototype,
       request: mockRequest,
       notificationID: kTestNotificationID,
       message: kTestMessage,
       promptActions: [mainAction],
       onBeforeShow() {
         beforeShown = true;
-        return true;
       },
     };
 
     let shownPromise =
       BrowserTestUtils.waitForEvent(PopupNotifications.panel, "popupshown");
     TestPrompt.prompt();
     Assert.ok(beforeShown, "Should have called onBeforeShown");
     await shownPromise;
@@ -349,17 +348,16 @@ add_task(async function test_no_request(
       __proto__: PermissionUI.PermissionPromptPrototype,
       notificationID: kTestNotificationID,
       principal,
       browser,
       message: kTestMessage,
       promptActions: [mainAction, secondaryAction],
       onBeforeShow() {
         beforeShown = true;
-        return true;
       },
     };
 
     let shownPromise =
       BrowserTestUtils.waitForEvent(PopupNotifications.panel, "popupshown");
     TestPrompt.prompt();
     Assert.ok(beforeShown, "Should have called onBeforeShown");
     await shownPromise;
--- a/browser/modules/test/browser/browser_PermissionUI_prompts.js
+++ b/browser/modules/test/browser/browser_PermissionUI_prompts.js
@@ -34,19 +34,17 @@ add_task(async function test_midi_permis
 add_task(async function test_autoplay_permission_prompt() {
   Services.prefs.setIntPref("media.autoplay.default", Ci.nsIAutoplay.PROMPT);
   await testPrompt(PermissionUI.AutoplayPermissionPrompt);
   Services.prefs.clearUserPref("media.autoplay.default");
 });
 
 // Tests that AutoplayPermissionPrompt works as expected
 add_task(async function test_storage_access_permission_prompt() {
-  Services.prefs.setBoolPref("dom.storage_access.auto_grants", false);
   await testPrompt(PermissionUI.StorageAccessPermissionPrompt);
-  Services.prefs.clearUserPref("dom.storage_access.auto_grants");
 });
 
 async function testPrompt(Prompt) {
   await BrowserTestUtils.withNewTab({
     gBrowser,
     url: "http://example.com",
   }, async function(browser) {
     let mockRequest = makeMockPermissionRequest(browser);
deleted file mode 100644
--- a/browser/modules/test/browser/browser_UsageTelemetry_uniqueOriginsVisitedInPast24Hours.js
+++ /dev/null
@@ -1,51 +0,0 @@
-/* eslint-disable mozilla/no-arbitrary-setTimeout */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-"use strict";
-
-ChromeUtils.defineModuleGetter(this, "URICountListener",
-                               "resource:///modules/BrowserUsageTelemetry.jsm");
-
-add_task(async function test_uniqueOriginsVisitedInPast24Hours() {
-  URICountListener.resetUniqueOriginsVisitedInPast24Hours();
-  let startingCount = URICountListener.uniqueOriginsVisitedInPast24Hours;
-  is(startingCount, 0, "We should have no origins recorded in the history right after resetting");
-
-  // Add a new window and then some tabs in it.
-  let win = await BrowserTestUtils.openNewBrowserWindow();
-  await BrowserTestUtils.openNewForegroundTab(win.gBrowser, "http://example.com");
-
-  await BrowserTestUtils.openNewForegroundTab(win.gBrowser, "http://test1.example.com");
-  is(URICountListener.uniqueOriginsVisitedInPast24Hours, startingCount + 1,
-     "test1.example.com should only count as a unique visit if example.com wasn't visited before");
-
-  // http://www.exämple.test
-  await BrowserTestUtils.openNewForegroundTab(win.gBrowser, "http://xn--exmple-cua.test");
-  is(URICountListener.uniqueOriginsVisitedInPast24Hours, startingCount + 2,
-     "www.exämple.test should count as a unique visit");
-
-  // Set the expiry time to 1 second
-  SpecialPowers.setIntPref("browser.engagement.recent_visited_origins.expiry", 1);
-
-  await BrowserTestUtils.openNewForegroundTab(win.gBrowser, "http://127.0.0.1");
-  is(URICountListener.uniqueOriginsVisitedInPast24Hours, startingCount + 3,
-     "127.0.0.1 should count as a unique visit");
-
-  let countBefore = URICountListener.uniqueOriginsVisitedInPast24Hours;
-
-  await new Promise(resolve => {
-    setTimeout(_ => {
-      let countAfter = URICountListener.uniqueOriginsVisitedInPast24Hours;
-      is(countAfter, countBefore - 1,
-         "The expiry should work correctly");
-      resolve();
-    }, 1100);
-  });
-
-  BrowserTestUtils.removeTab(win.gBrowser.selectedTab);
-  BrowserTestUtils.removeTab(win.gBrowser.selectedTab);
-  await BrowserTestUtils.closeWindow(win);
-});
-
--- a/dom/base/StorageAccessPermissionRequest.cpp
+++ b/dom/base/StorageAccessPermissionRequest.cpp
@@ -14,24 +14,22 @@ NS_IMPL_CYCLE_COLLECTION_INHERITED(Stora
 
 NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED_0(StorageAccessPermissionRequest,
                                                ContentPermissionRequestBase)
 
 StorageAccessPermissionRequest::StorageAccessPermissionRequest(
     nsPIDOMWindowInner* aWindow,
     nsIPrincipal* aNodePrincipal,
     AllowCallback&& aAllowCallback,
-    AllowAutoGrantCallback&& aAllowAutoGrantCallback,
     AllowAnySiteCallback&& aAllowAnySiteCallback,
     CancelCallback&& aCancelCallback)
   : ContentPermissionRequestBase(aNodePrincipal, false, aWindow,
                                  NS_LITERAL_CSTRING("dom.storage_access"),
                                  NS_LITERAL_CSTRING("storage-access")),
     mAllowCallback(std::move(aAllowCallback)),
-    mAllowAutoGrantCallback(std::move(aAllowAutoGrantCallback)),
     mAllowAnySiteCallback(std::move(aAllowAnySiteCallback)),
     mCancelCallback(std::move(aCancelCallback)),
     mCallbackCalled(false)
 {
   mPermissionRequests.AppendElement(PermissionRequest(mType, nsTArray<nsString>()));
 }
 
 StorageAccessPermissionRequest::~StorageAccessPermissionRequest()
@@ -58,44 +56,39 @@ StorageAccessPermissionRequest::Allow(JS
     return rv;
   }
 
   if (!mCallbackCalled) {
     mCallbackCalled = true;
     if (choices.Length() == 1 &&
         choices[0].choice().EqualsLiteral("allow-on-any-site")) {
       mAllowAnySiteCallback();
-    } else if (choices.Length() == 1 &&
-               choices[0].choice().EqualsLiteral("allow-auto-grant")) {
-      mAllowAutoGrantCallback();
     } else {
       mAllowCallback();
     }
   }
   return NS_OK;
 }
 
 already_AddRefed<StorageAccessPermissionRequest>
 StorageAccessPermissionRequest::Create(nsPIDOMWindowInner* aWindow,
                                        AllowCallback&& aAllowCallback,
-                                       AllowAutoGrantCallback&& aAllowAutoGrantCallback,
                                        AllowAnySiteCallback&& aAllowAnySiteCallback,
                                        CancelCallback&& aCancelCallback)
 {
   if (!aWindow) {
     return nullptr;
   }
   nsGlobalWindowInner* win = nsGlobalWindowInner::Cast(aWindow);
   if (!win->GetPrincipal()) {
     return nullptr;
   }
   RefPtr<StorageAccessPermissionRequest> request =
     new StorageAccessPermissionRequest(aWindow,
                                        win->GetPrincipal(),
                                        std::move(aAllowCallback),
-                                       std::move(aAllowAutoGrantCallback),
                                        std::move(aAllowAnySiteCallback),
                                        std::move(aCancelCallback));
   return request.forget();
 }
 
 } // namespace dom
 } // namespace mozilla
--- a/dom/base/StorageAccessPermissionRequest.h
+++ b/dom/base/StorageAccessPermissionRequest.h
@@ -23,38 +23,34 @@ public:
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(StorageAccessPermissionRequest,
                                            ContentPermissionRequestBase)
 
   // nsIContentPermissionRequest
   NS_IMETHOD Cancel(void) override;
   NS_IMETHOD Allow(JS::HandleValue choices) override;
 
   typedef std::function<void()> AllowCallback;
-  typedef std::function<void()> AllowAutoGrantCallback;
   typedef std::function<void()> AllowAnySiteCallback;
   typedef std::function<void()> CancelCallback;
 
   static already_AddRefed<StorageAccessPermissionRequest> Create(
     nsPIDOMWindowInner* aWindow,
     AllowCallback&& aAllowCallback,
-    AllowAutoGrantCallback&& aAllowAutoGrantCallback,
     AllowAnySiteCallback&& aAllowAnySiteCallback,
     CancelCallback&& aCancelCallback);
 
 private:
   StorageAccessPermissionRequest(nsPIDOMWindowInner* aWindow,
                                  nsIPrincipal* aNodePrincipal,
                                  AllowCallback&& aAllowCallback,
-                                 AllowAutoGrantCallback&& aAllowAutoGrantCallback,
                                  AllowAnySiteCallback&& aAllowAnySiteCallback,
                                  CancelCallback&& aCancelCallback);
   ~StorageAccessPermissionRequest();
 
   AllowCallback mAllowCallback;
-  AllowAutoGrantCallback mAllowAutoGrantCallback;
   AllowAnySiteCallback mAllowAnySiteCallback;
   CancelCallback mCancelCallback;
   nsTArray<PermissionRequest> mPermissionRequests;
   bool mCallbackCalled;
 };
 
 } // namespace dom
 } // namespace mozilla
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -13983,21 +13983,19 @@ nsIDocument::RequestStorageAccess(mozill
                     !isOnAllowList);
 
       auto performFinalChecks = [inner] () -> RefPtr<AntiTrackingCommon::StorageAccessFinalCheckPromise> {
           RefPtr<AntiTrackingCommon::StorageAccessFinalCheckPromise::Private> p =
             new AntiTrackingCommon::StorageAccessFinalCheckPromise::Private(__func__);
           RefPtr<StorageAccessPermissionRequest> sapr =
             StorageAccessPermissionRequest::Create(inner,
               // Allow
-              [p] { p->Resolve(AntiTrackingCommon::eAllow, __func__); },
-              // Allow auto grant
-              [p] { p->Resolve(AntiTrackingCommon::eAllowAutoGrant, __func__); },
+              [p] { p->Resolve(false, __func__); },
               // Allow on any site
-              [p] { p->Resolve(AntiTrackingCommon::eAllowOnAnySite, __func__); },
+              [p] { p->Resolve(true, __func__); },
               // Block
               [p] { p->Reject(false, __func__); });
 
           typedef ContentPermissionRequestBase::PromptResult PromptResult;
           PromptResult pr = sapr->CheckPromptPrefs();
           bool onAnySite = false;
           if (pr == PromptResult::Pending) {
             // Also check our custom pref for the "Allow on any site" case
@@ -14008,18 +14006,17 @@ nsIDocument::RequestStorageAccess(mozill
             }
           }
 
           if (pr != PromptResult::Pending) {
             MOZ_ASSERT_IF(pr != PromptResult::Granted,
                           pr == PromptResult::Denied);
             if (pr == PromptResult::Granted) {
               return AntiTrackingCommon::StorageAccessFinalCheckPromise::
-                CreateAndResolve(onAnySite ? AntiTrackingCommon::eAllowOnAnySite :
-                                             AntiTrackingCommon::eAllow, __func__);
+                CreateAndResolve(onAnySite, __func__);
             }
             return AntiTrackingCommon::StorageAccessFinalCheckPromise::
               CreateAndReject(false, __func__);
           }
 
           sapr->RequestDelayedTask(inner->EventTargetFor(TaskCategory::Other),
                                    ContentPermissionRequestBase::DelayedTaskType::Request);
           return p.forget();
--- a/toolkit/components/antitracking/AntiTrackingCommon.cpp
+++ b/toolkit/components/antitracking/AntiTrackingCommon.cpp
@@ -403,99 +403,16 @@ CompareBaseDomains(nsIURI* aTrackingURI,
     LOG(("Can't get the base domain from parent principal"));
     return false;
   }
 
   return trackingBaseDomain.Equals(parentPrincipalBaseDomain,
                                    nsCaseInsensitiveCStringComparator());
 }
 
-class TemporaryAccessGrantObserver final : public nsIObserver
-{
-public:
-  NS_DECL_ISUPPORTS
-  NS_DECL_NSIOBSERVER
-
-  static void
-  Create(nsIPermissionManager* aPM,
-         nsIPrincipal* aPrincipal,
-         const nsACString& aType)
-  {
-    nsCOMPtr<nsITimer> timer;
-    RefPtr<TemporaryAccessGrantObserver> observer =
-      new TemporaryAccessGrantObserver(aPM, aPrincipal, aType);
-    nsresult rv =
-      NS_NewTimerWithObserver(getter_AddRefs(timer),
-                              observer,
-                              24 * 60 * 60 * 1000, // 24 hours
-                              nsITimer::TYPE_ONE_SHOT);
-
-    if (NS_SUCCEEDED(rv)) {
-      observer->SetTimer(timer);
-    } else {
-      timer->Cancel();
-    }
-  }
-
-  void SetTimer(nsITimer* aTimer)
-  {
-    mTimer = aTimer;
-    nsCOMPtr<nsIObserverService> observerService =
-      mozilla::services::GetObserverService();
-    if (observerService) {
-      observerService->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, false);
-    }
-  }
-
-private:
-  TemporaryAccessGrantObserver(nsIPermissionManager* aPM,
-                               nsIPrincipal* aPrincipal,
-                               const nsACString& aType)
-    : mPM(aPM)
-    , mPrincipal(aPrincipal)
-    , mType(aType)
-  {
-    MOZ_ASSERT(XRE_IsParentProcess(),
-               "Enforcing temporary access grant lifetimes can only be done in "
-               "the parent process");
-  }
-
-  ~TemporaryAccessGrantObserver() = default;
-
-private:
-  nsCOMPtr<nsITimer> mTimer;
-  nsCOMPtr<nsIPermissionManager> mPM;
-  nsCOMPtr<nsIPrincipal> mPrincipal;
-  nsCString mType;
-};
-
-NS_IMPL_ISUPPORTS(TemporaryAccessGrantObserver, nsIObserver)
-
-NS_IMETHODIMP
-TemporaryAccessGrantObserver::Observe(nsISupports* aSubject,
-                                      const char* aTopic,
-                                      const char16_t* aData)
-{
-  if (strcmp(aTopic, NS_TIMER_CALLBACK_TOPIC) == 0) {
-    Unused << mPM->RemoveFromPrincipal(mPrincipal, mType.get());
-  } else if (strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID) == 0) {
-    nsCOMPtr<nsIObserverService> observerService =
-      mozilla::services::GetObserverService();
-    if (observerService) {
-      observerService->RemoveObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID);
-    }
-    if (mTimer) {
-      mTimer->Cancel();
-      mTimer = nullptr;
-    }
-  }
-
-  return NS_OK;
-}
-
 } // anonymous
 
 /* static */ RefPtr<AntiTrackingCommon::StorageAccessGrantPromise>
 AntiTrackingCommon::AddFirstPartyStorageAccessGrantedFor(nsIPrincipal* aPrincipal,
                                                          nsPIDOMWindowInner* aParentWindow,
                                                          StorageAccessGrantedReason aReason,
                                                          const AntiTrackingCommon::PerformFinalChecks& aPerformFinalChecks)
 {
@@ -517,21 +434,21 @@ AntiTrackingCommon::AddFirstPartyStorage
 
   LOG(("Adding a first-party storage exception for %s...",
        NS_ConvertUTF16toUTF8(origin).get()));
 
   if (StaticPrefs::network_cookie_cookieBehavior() !=
         nsICookieService::BEHAVIOR_REJECT_TRACKER) {
     LOG(("Disabled by network.cookie.cookieBehavior pref (%d), bailing out early",
          StaticPrefs::network_cookie_cookieBehavior()));
-    return StorageAccessGrantPromise::CreateAndResolve(eAllowOnAnySite, __func__);
+    return StorageAccessGrantPromise::CreateAndResolve(true, __func__);
   }
 
   if (CheckContentBlockingAllowList(aParentWindow)) {
-    return StorageAccessGrantPromise::CreateAndResolve(eAllowOnAnySite, __func__);
+    return StorageAccessGrantPromise::CreateAndResolve(true, __func__);
   }
 
   nsCOMPtr<nsIPrincipal> topLevelStoragePrincipal;
   nsCOMPtr<nsIURI> trackingURI;
   nsAutoCString trackingOrigin;
   nsCOMPtr<nsIPrincipal> trackingPrincipal;
 
   RefPtr<nsGlobalWindowInner> parentWindow = nsGlobalWindowInner::Cast(aParentWindow);
@@ -612,17 +529,17 @@ AntiTrackingCommon::AddFirstPartyStorage
   if (!pwin) {
     LOG(("Couldn't get the top window"));
     return StorageAccessGrantPromise::CreateAndReject(false, __func__);
   }
 
   auto storePermission = [pwin, parentWindow, origin, trackingOrigin,
                           trackingPrincipal, trackingURI, topInnerWindow,
                           topLevelStoragePrincipal, aReason]
-                         (int aAllowMode) -> RefPtr<StorageAccessGrantPromise> {
+                         (bool aAnySite) -> RefPtr<StorageAccessGrantPromise> {
     NS_ConvertUTF16toUTF8 grantedOrigin(origin);
 
     nsAutoCString permissionKey;
     CreatePermissionKey(trackingOrigin, grantedOrigin, permissionKey);
 
     // Let's store the permission in the current parent window.
     topInnerWindow->SaveStorageAccessGranted(permissionKey);
 
@@ -640,22 +557,21 @@ AntiTrackingCommon::AddFirstPartyStorage
     if (XRE_IsParentProcess()) {
       LOG(("Saving the permission: trackingOrigin=%s, grantedOrigin=%s",
            trackingOrigin.get(), grantedOrigin.get()));
 
       return SaveFirstPartyStorageAccessGrantedForOriginOnParentProcess(topLevelStoragePrincipal,
                                                                         trackingPrincipal,
                                                                         trackingOrigin,
                                                                         grantedOrigin,
-                                                                        aAllowMode)
+                                                                        aAnySite)
         ->Then(GetCurrentThreadSerialEventTarget(), __func__,
                [] (FirstPartyStorageAccessGrantPromise::ResolveOrRejectValue&& aValue) {
                  if (aValue.IsResolve()) {
-                   return StorageAccessGrantPromise::CreateAndResolve(NS_SUCCEEDED(aValue.ResolveValue()) ?
-                                                                      eAllowOnAnySite : eAllow, __func__);
+                   return StorageAccessGrantPromise::CreateAndResolve(NS_SUCCEEDED(aValue.ResolveValue()), __func__);
                  }
                  return StorageAccessGrantPromise::CreateAndReject(false, __func__);
                });
     }
 
     ContentChild* cc = ContentChild::GetSingleton();
     MOZ_ASSERT(cc);
 
@@ -663,17 +579,17 @@ AntiTrackingCommon::AddFirstPartyStorage
          trackingOrigin.get(), grantedOrigin.get()));
 
     // This is not really secure, because here we have the content process sending
     // the request of storing a permission.
     return cc->SendFirstPartyStorageAccessGrantedForOrigin(IPC::Principal(topLevelStoragePrincipal),
                                                            IPC::Principal(trackingPrincipal),
                                                            trackingOrigin,
                                                            grantedOrigin,
-                                                           aAllowMode)
+                                                           aAnySite)
       ->Then(GetCurrentThreadSerialEventTarget(), __func__,
              [] (const ContentChild::FirstPartyStorageAccessGrantedForOriginPromise::ResolveOrRejectValue& aValue) {
                if (aValue.IsResolve()) {
                  return StorageAccessGrantPromise::CreateAndResolve(aValue.ResolveValue(), __func__);
                }
                return StorageAccessGrantPromise::CreateAndReject(false, __func__);
              });
   };
@@ -691,22 +607,19 @@ AntiTrackingCommon::AddFirstPartyStorage
   return storePermission(false);
 }
 
 /* static */ RefPtr<mozilla::AntiTrackingCommon::FirstPartyStorageAccessGrantPromise>
 AntiTrackingCommon::SaveFirstPartyStorageAccessGrantedForOriginOnParentProcess(nsIPrincipal* aParentPrincipal,
                                                                                nsIPrincipal* aTrackingPrincipal,
                                                                                const nsCString& aTrackingOrigin,
                                                                                const nsCString& aGrantedOrigin,
-                                                                               int aAllowMode)
+                                                                               bool aAnySite)
 {
   MOZ_ASSERT(XRE_IsParentProcess());
-  MOZ_ASSERT(aAllowMode == eAllow ||
-             aAllowMode == eAllowAutoGrant ||
-             aAllowMode == eAllowOnAnySite);
 
   nsCOMPtr<nsIURI> parentPrincipalURI;
   Unused << aParentPrincipal->GetURI(getter_AddRefs(parentPrincipalURI));
   LOG_SPEC(("Saving a first-party storage permission on %s for trackingOrigin=%s grantedOrigin=%s",
             _spec, aTrackingOrigin.get(), aGrantedOrigin.get()), parentPrincipalURI);
 
   if (NS_WARN_IF(!aParentPrincipal)) {
     // The child process is sending something wrong. Let's ignore it.
@@ -722,17 +635,17 @@ AntiTrackingCommon::SaveFirstPartyStorag
 
   // Remember that this pref is stored in seconds!
   uint32_t expirationType = nsIPermissionManager::EXPIRE_TIME;
   uint32_t expirationTime =
     StaticPrefs::privacy_restrict3rdpartystorage_expiration() * 1000;
   int64_t when = (PR_Now() / PR_USEC_PER_MSEC) + expirationTime;
 
   nsresult rv;
-  if (aAllowMode == eAllowOnAnySite) {
+  if (aAnySite) {
     uint32_t privateBrowsingId = 0;
     rv = aTrackingPrincipal->GetPrivateBrowsingId(&privateBrowsingId);
     if (!NS_WARN_IF(NS_FAILED(rv)) && privateBrowsingId > 0) {
       // If we are coming from a private window, make sure to store a session-only
       // permission which won't get persisted to disk.
       expirationType = nsIPermissionManager::EXPIRE_SESSION;
       when = 0;
     }
@@ -741,39 +654,32 @@ AntiTrackingCommon::SaveFirstPartyStorag
          expirationTime));
 
     rv = pm->AddFromPrincipal(aTrackingPrincipal, "cookie",
                               nsICookiePermission::ACCESS_ALLOW,
                               expirationType, when);
   } else {
     uint32_t privateBrowsingId = 0;
     rv = aParentPrincipal->GetPrivateBrowsingId(&privateBrowsingId);
-    if ((!NS_WARN_IF(NS_FAILED(rv)) && privateBrowsingId > 0) ||
-        (aAllowMode == eAllowAutoGrant)) {
-      // If we are coming from a private window or are automatically granting a
-      // permission, make sure to store a session-only permission which won't
-      // get persisted to disk.
+    if (!NS_WARN_IF(NS_FAILED(rv)) && privateBrowsingId > 0) {
+      // If we are coming from a private window, make sure to store a session-only
+      // permission which won't get persisted to disk.
       expirationType = nsIPermissionManager::EXPIRE_SESSION;
       when = 0;
     }
 
     nsAutoCString type;
     CreatePermissionKey(aTrackingOrigin, aGrantedOrigin, type);
 
     LOG(("Computed permission key: %s, expiry: %u, proceeding to save in the permission manager",
          type.get(), expirationTime));
 
     rv = pm->AddFromPrincipal(aParentPrincipal, type.get(),
                               nsIPermissionManager::ALLOW_ACTION,
                               expirationType, when);
-
-    if (NS_SUCCEEDED(rv) && (aAllowMode == eAllowAutoGrant)) {
-      // Make sure temporary access grants do not survive more than 24 hours.
-      TemporaryAccessGrantObserver::Create(pm, aParentPrincipal, type);
-    }
   }
   Unused << NS_WARN_IF(NS_FAILED(rv));
 
   LOG(("Result: %s", NS_SUCCEEDED(rv) ? "success" : "failure"));
   return FirstPartyStorageAccessGrantPromise::CreateAndResolve(rv, __func__);
 }
 
 // static
--- a/toolkit/components/antitracking/AntiTrackingCommon.h
+++ b/toolkit/components/antitracking/AntiTrackingCommon.h
@@ -72,41 +72,35 @@ public:
   IsFirstPartyStorageAccessGrantedFor(nsIPrincipal* aPrincipal);
 
   enum StorageAccessGrantedReason
   {
     eStorageAccessAPI,
     eOpenerAfterUserInteraction,
     eOpener
   };
-  enum StorageAccessPromptChoices
-  {
-    eAllow,
-    eAllowAutoGrant,
-    eAllowOnAnySite
-  };
 
   // Grant the permission for aOrigin to have access to the first party storage.
   // This method can handle 2 different scenarios:
   // - aParentWindow is a 3rd party context, it opens an aOrigin window and the
   //   user interacts with it. We want to grant the permission at the
   //   combination: top-level + aParentWindow + aOrigin.
   //   Ex: example.net loads an iframe tracker.com, which opens a popup
   //   tracker.prg and the user interacts with it. tracker.org is allowed if
   //   loaded by tracker.com when loaded by example.net.
   // - aParentWindow is a first party context and a 3rd party resource (probably
   //   becuase of a script) opens a popup and the user interacts with it. We
   //   want to grant the permission for the 3rd party context to have access to
   //   the first party stoage when loaded in aParentWindow.
   //   Ex: example.net import tracker.com/script.js which does opens a popup and
   //   the user interacts with it. tracker.com is allowed when loaded by
   //   example.net.
-  typedef MozPromise<int, bool, true> StorageAccessFinalCheckPromise;
+  typedef MozPromise<bool, bool, true> StorageAccessFinalCheckPromise;
   typedef std::function<RefPtr<StorageAccessFinalCheckPromise>()> PerformFinalChecks;
-  typedef MozPromise<int, bool, true> StorageAccessGrantPromise;
+  typedef MozPromise<bool, bool, true> StorageAccessGrantPromise;
   static MOZ_MUST_USE RefPtr<StorageAccessGrantPromise>
   AddFirstPartyStorageAccessGrantedFor(nsIPrincipal* aPrincipal,
                                        nsPIDOMWindowInner* aParentWindow,
                                        StorageAccessGrantedReason aReason,
                                        const PerformFinalChecks& aPerformFinalChecks = nullptr);
 
   // Returns true if the permission passed in is a storage access permission
   // for the passed in principal argument.
@@ -121,17 +115,17 @@ public:
 
   // For IPC only.
   typedef MozPromise<nsresult, bool, true> FirstPartyStorageAccessGrantPromise;
   static RefPtr<FirstPartyStorageAccessGrantPromise>
   SaveFirstPartyStorageAccessGrantedForOriginOnParentProcess(nsIPrincipal* aPrincipal,
                                                              nsIPrincipal* aTrackingPrinciapl,
                                                              const nsCString& aParentOrigin,
                                                              const nsCString& aGrantedOrigin,
-                                                             int aAllowMode);
+                                                             bool aAnySite);
 
   enum ContentBlockingAllowListPurpose {
     eStorageChecks,
     eTrackingProtection,
     eTrackingAnnotations,
   };
 
   // Check whether a top window URI is on the content blocking allow list.
--- a/toolkit/components/antitracking/test/browser/browser_storageAccessDoorHanger.js
+++ b/toolkit/components/antitracking/test/browser/browser_storageAccessDoorHanger.js
@@ -1,58 +1,40 @@
-/* eslint-disable mozilla/no-arbitrary-setTimeout */
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 const CHROME_BASE = "chrome://mochitests/content/browser/browser/modules/test/browser/";
 Services.scriptloader.loadSubScript(CHROME_BASE + "head.js", this);
 /* import-globals-from ../../../../../browser/modules/test/browser/head.js */
 
-const BLOCK = 0;
-const ALLOW = 1;
-const ALLOW_ON_ANY_SITE = 2;
-
-async function testDoorHanger(choice, showPrompt, topPage, maxConcurrent) {
-  info(`Running doorhanger test with choice #${choice}, showPrompt: ${showPrompt} and ` +
-       `topPage: ${topPage}, maxConcurrent: ${maxConcurrent}`);
-
-  if (!showPrompt) {
-    is(choice, ALLOW, "When not showing a prompt, we can only auto-grant");
-  }
+async function testDoorHanger(choice) {
+  info(`Running doorhanger test with choice #${choice}`);
 
   await SpecialPowers.flushPrefEnv();
   await SpecialPowers.pushPrefEnv({"set": [
     ["browser.contentblocking.allowlist.annotations.enabled", true],
     ["browser.contentblocking.allowlist.storage.enabled", true],
     [ContentBlocking.prefIntroCount, ContentBlocking.MAX_INTROS],
-    ["dom.storage_access.auto_grants", true],
     ["dom.storage_access.enabled", true],
-    ["dom.storage_access.max_concurrent_auto_grants", maxConcurrent],
     ["dom.storage_access.prompt.testing", false],
     ["network.cookie.cookieBehavior", Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER],
     ["privacy.trackingprotection.enabled", false],
     ["privacy.trackingprotection.pbmode.enabled", false],
     ["privacy.trackingprotection.annotate_channels", true],
     ["privacy.restrict3rdpartystorage.userInteractionRequiredForHosts", "tracking.example.com,tracking.example.org"],
   ]});
 
   await UrlClassifierTestUtils.addTestTrackers();
 
-  let tab = BrowserTestUtils.addTab(gBrowser, topPage);
+  let tab = BrowserTestUtils.addTab(gBrowser, TEST_TOP_PAGE);
   gBrowser.selectedTab = tab;
 
   let browser = gBrowser.getBrowserForTab(tab);
   await BrowserTestUtils.browserLoaded(browser);
 
   async function runChecks() {
-    // We need to repeat these constants here since runChecks is stringified
-    // and sent to the content process.
-    const BLOCK = 0;
-    const ALLOW = 1;
-    const ALLOW_ON_ANY_SITE = 2;
-
     await new Promise(resolve => {
       addEventListener("message", function onMessage(e) {
         if (e.data.startsWith("choice:")) {
           window.choice = e.data.split(":")[1];
           removeEventListener("message", onMessage);
           resolve();
         }
       }, false);
@@ -74,78 +56,72 @@ async function testDoorHanger(choice, sh
       is(text, "cookie-not-present", "We should not have cookies");
     });
 
     is(document.cookie, "", "Still no cookies for me");
 
     /* import-globals-from storageAccessAPIHelpers.js */
     await callRequestStorageAccess();
 
-    if (choice == BLOCK) {
+    if (choice == 0) {
       // We've said no, so cookies are still blocked
       is(document.cookie, "", "Still no cookies for me");
       document.cookie = "name=value";
       is(document.cookie, "", "No cookies for me");
     } else {
       // We've said yes, so cookies are allowed now
       is(document.cookie, "", "No cookies for me");
       document.cookie = "name=value";
       is(document.cookie, "name=value", "I have the cookies!");
     }
   }
 
-  let permChanged = TestUtils.topicObserved("perm-changed",
-    (subject, data) => {
-      let result;
-      if (choice == ALLOW) {
-        result = subject &&
-                 subject.QueryInterface(Ci.nsIPermission)
-                        .type.startsWith("3rdPartyStorage^") &&
-                 subject.principal.origin == (new URL(topPage)).origin &&
-                 data == "added";
-      } else if (choice == ALLOW_ON_ANY_SITE) {
-        result = subject &&
-                 subject.QueryInterface(Ci.nsIPermission)
-                        .type == "cookie" &&
-                 subject.principal.origin == "https://tracking.example.org" &&
-                 data == "added";
-      }
-      return result;
-    });
   let shownPromise =
     BrowserTestUtils.waitForEvent(PopupNotifications.panel, "popupshown");
   shownPromise.then(async _ => {
-    if (topPage != gBrowser.currentURI.spec) {
-      return;
-    }
-    ok(showPrompt, "We shouldn't show the prompt when we don't intend to");
-    let notification = await new Promise(function poll(resolve) {
-      let notification =
-        PopupNotifications.getNotification("storage-access", browser);
-      if (notification) {
-        resolve(notification);
-        return;
-      }
-      setTimeout(poll, 10);
-    });
+    let notification =
+      PopupNotifications.getNotification("storage-access", browser);
     Assert.ok(notification, "Should have gotten the notification");
 
-    if (choice == BLOCK) {
+    let permChanged = TestUtils.topicObserved("perm-changed",
+      (subject, data) => {
+        let result;
+        if (choice == 1) {
+          result = subject &&
+                   subject.QueryInterface(Ci.nsIPermission)
+                          .type.startsWith("3rdPartyStorage^") &&
+                   subject.principal.origin == "http://example.net" &&
+                   data == "added";
+        } else if (choice == 2) {
+          result = subject &&
+                   subject.QueryInterface(Ci.nsIPermission)
+                          .type == "cookie" &&
+                   subject.principal.origin == "https://tracking.example.org" &&
+                   data == "added";
+        }
+        return result;
+      });
+    if (choice == 0) {
       await clickMainAction();
-    } else if (choice == ALLOW) {
+    } else if (choice == 1) {
       await clickSecondaryAction(choice - 1);
-    } else if (choice == ALLOW_ON_ANY_SITE) {
+    } else if (choice == 2) {
       await clickSecondaryAction(choice - 1);
     }
-    if (choice != BLOCK) {
+    if (choice != 0) {
       await permChanged;
     }
   });
 
-  let url = TEST_3RD_PARTY_PAGE + "?disableWaitUntilPermission";
+  let url;
+  if (choice == 2) {
+    url = TEST_3RD_PARTY_PAGE + "?disableWaitUntilPermission";
+  } else {
+    url = TEST_3RD_PARTY_PAGE;
+  }
   let ct = ContentTask.spawn(browser,
                              { page: url,
                                callback: runChecks.toString(),
                                choice,
                              },
                              async function(obj) {
     await new content.Promise(resolve => {
       let ifr = content.document.createElement("iframe");
@@ -178,150 +154,32 @@ async function testDoorHanger(choice, sh
 
         ok(false, "Unknown message");
       });
 
       content.document.body.appendChild(ifr);
       ifr.src = obj.page;
     });
   });
-  if (showPrompt) {
-    await Promise.all([ct, shownPromise]);
-  } else {
-    await Promise.all([ct, permChanged]);
-  }
+  await Promise.all([ct, shownPromise]);
 
   BrowserTestUtils.removeTab(tab);
 
   UrlClassifierTestUtils.cleanupTestTrackers();
 }
 
-async function preparePermissionsFromOtherSites(topPage) {
-  info("Faking permissions from other sites");
-  let type = "3rdPartyStorage^https://tracking.example.org";
-  let permission = Services.perms.ALLOW_ACTION;
-  let expireType = Services.perms.EXPIRE_SESSION;
-  if (topPage == TEST_TOP_PAGE) {
-    // For the first page, don't do anything
-  } else if (topPage == TEST_TOP_PAGE_2) {
-    // For the second page, only add the permission from the first page
-    Services.perms.add(Services.io.newURI(TEST_DOMAIN),
-                       type,
-                       permission,
-                       expireType,
-                       0);
-  } else if (topPage == TEST_TOP_PAGE_3) {
-    // For the third page, add the permissions from the first two pages
-    Services.perms.add(Services.io.newURI(TEST_DOMAIN),
-                       type,
-                       permission,
-                       expireType,
-                       0);
-    Services.perms.add(Services.io.newURI(TEST_DOMAIN_2),
-                       type,
-                       permission,
-                       expireType,
-                       0);
-  } else if (topPage == TEST_TOP_PAGE_4) {
-    // For the fourth page, add the permissions from the first three pages
-    Services.perms.add(Services.io.newURI(TEST_DOMAIN),
-                       type,
-                       permission,
-                       expireType,
-                       0);
-    Services.perms.add(Services.io.newURI(TEST_DOMAIN_2),
-                       type,
-                       permission,
-                       expireType,
-                       0);
-    Services.perms.add(Services.io.newURI(TEST_DOMAIN_3),
-                       type,
-                       permission,
-                       expireType,
-                       0);
-  } else if (topPage == TEST_TOP_PAGE_5) {
-    // For the fifth page, add the permissions from the first four pages
-    Services.perms.add(Services.io.newURI(TEST_DOMAIN),
-                       type,
-                       permission,
-                       expireType,
-                       0);
-    Services.perms.add(Services.io.newURI(TEST_DOMAIN_2),
-                       type,
-                       permission,
-                       expireType,
-                       0);
-    Services.perms.add(Services.io.newURI(TEST_DOMAIN_3),
-                       type,
-                       permission,
-                       expireType,
-                       0);
-    Services.perms.add(Services.io.newURI(TEST_DOMAIN_4),
-                       type,
-                       permission,
-                       expireType,
-                       0);
-  } else if (topPage == TEST_TOP_PAGE_6) {
-    // For the sixth page, add the permissions from the first five pages
-    Services.perms.add(Services.io.newURI(TEST_DOMAIN),
-                       type,
-                       permission,
-                       expireType,
-                       0);
-    Services.perms.add(Services.io.newURI(TEST_DOMAIN_2),
-                       type,
-                       permission,
-                       expireType,
-                       0);
-    Services.perms.add(Services.io.newURI(TEST_DOMAIN_3),
-                       type,
-                       permission,
-                       expireType,
-                       0);
-    Services.perms.add(Services.io.newURI(TEST_DOMAIN_4),
-                       type,
-                       permission,
-                       expireType,
-                       0);
-    Services.perms.add(Services.io.newURI(TEST_DOMAIN_5),
-                       type,
-                       permission,
-                       expireType,
-                       0);
-  } else {
-    ok(false, "Unexpected top page: " + topPage);
-  }
-}
-
 async function cleanUp() {
   info("Cleaning up.");
   await new Promise(resolve => {
     Services.clearData.deleteData(Ci.nsIClearDataService.CLEAR_ALL, value => resolve());
   });
 }
 
-async function runRound(topPage, showPrompt, maxConcurrent) {
-  if (showPrompt) {
-    await preparePermissionsFromOtherSites(topPage);
-    await testDoorHanger(BLOCK, showPrompt, topPage, maxConcurrent);
-    await cleanUp();
-    await preparePermissionsFromOtherSites(topPage);
-    await testDoorHanger(ALLOW, showPrompt, topPage, maxConcurrent);
-    await cleanUp();
-    await preparePermissionsFromOtherSites(topPage);
-    await testDoorHanger(ALLOW_ON_ANY_SITE, showPrompt, topPage, maxConcurrent);
-  } else {
-    await preparePermissionsFromOtherSites(topPage);
-    await testDoorHanger(ALLOW, showPrompt, topPage, maxConcurrent);
-  }
+async function runRound(n) {
+  await testDoorHanger(n);
   await cleanUp();
 }
 
 add_task(async function() {
-  await runRound(TEST_TOP_PAGE, false, 1);
-  await runRound(TEST_TOP_PAGE_2, true, 1);
-  await runRound(TEST_TOP_PAGE, false, 5);
-  await runRound(TEST_TOP_PAGE_2, false, 5);
-  await runRound(TEST_TOP_PAGE_3, false, 5);
-  await runRound(TEST_TOP_PAGE_4, false, 5);
-  await runRound(TEST_TOP_PAGE_5, false, 5);
-  await runRound(TEST_TOP_PAGE_6, true, 5);
+  await runRound(0);
+  await runRound(1);
+  await runRound(2);
 });
--- a/toolkit/components/antitracking/test/browser/head.js
+++ b/toolkit/components/antitracking/test/browser/head.js
@@ -1,27 +1,17 @@
 const TEST_DOMAIN = "http://example.net";
-const TEST_DOMAIN_2 = "http://xn--exmple-cua.test";
-const TEST_DOMAIN_3 = "https://xn--hxajbheg2az3al.xn--jxalpdlp";
-const TEST_DOMAIN_4 = "http://prefixexample.com";
-const TEST_DOMAIN_5 = "http://test";
-const TEST_DOMAIN_6 = "http://mochi.test:8888";
 const TEST_3RD_PARTY_DOMAIN = "https://tracking.example.org";
 const TEST_3RD_PARTY_DOMAIN_TP = "https://tracking.example.com";
 const TEST_4TH_PARTY_DOMAIN = "http://not-tracking.example.com";
 const TEST_ANOTHER_3RD_PARTY_DOMAIN = "https://another-tracking.example.net";
 
 const TEST_PATH = "/browser/toolkit/components/antitracking/test/browser/";
 
 const TEST_TOP_PAGE = TEST_DOMAIN + TEST_PATH + "page.html";
-const TEST_TOP_PAGE_2 = TEST_DOMAIN_2 + TEST_PATH + "page.html";
-const TEST_TOP_PAGE_3 = TEST_DOMAIN_3 + TEST_PATH + "page.html";
-const TEST_TOP_PAGE_4 = TEST_DOMAIN_4 + TEST_PATH + "page.html";
-const TEST_TOP_PAGE_5 = TEST_DOMAIN_5 + TEST_PATH + "page.html";
-const TEST_TOP_PAGE_6 = TEST_DOMAIN_6 + TEST_PATH + "page.html";
 const TEST_EMBEDDER_PAGE = TEST_DOMAIN + TEST_PATH + "embedder.html";
 const TEST_POPUP_PAGE = TEST_DOMAIN + TEST_PATH + "popup.html";
 const TEST_3RD_PARTY_PAGE = TEST_3RD_PARTY_DOMAIN + TEST_PATH + "3rdParty.html";
 const TEST_3RD_PARTY_PAGE_WO = TEST_3RD_PARTY_DOMAIN + TEST_PATH + "3rdPartyWO.html";
 const TEST_3RD_PARTY_PAGE_UI = TEST_3RD_PARTY_DOMAIN + TEST_PATH + "3rdPartyUI.html";
 const TEST_3RD_PARTY_PAGE_WITH_SVG = TEST_3RD_PARTY_DOMAIN + TEST_PATH + "3rdPartySVG.html";
 const TEST_4TH_PARTY_PAGE = TEST_4TH_PARTY_DOMAIN + TEST_PATH + "3rdParty.html";
 const TEST_ANOTHER_3RD_PARTY_PAGE = TEST_ANOTHER_3RD_PARTY_DOMAIN + TEST_PATH + "3rdParty.html";