Backed out 4 changesets (bug 1494476) for build bustage and lining failure. CLOSED TREE
authorDorel Luca <dluca@mozilla.com>
Wed, 10 Oct 2018 18:29:04 +0300
changeset 498987 68f1999b78a1bc6f33ce2fa9e578697cfd794c89
parent 498986 70d95bda84582be0a55cea86d5deafd19962a547
child 498988 db4990bc9b4cefd8f4e85a17de49796093cf6e90
push id1864
push userffxbld-merge
push dateMon, 03 Dec 2018 15:51:40 +0000
treeherdermozilla-release@f040763d99ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1494476
milestone64.0a1
backs out70d95bda84582be0a55cea86d5deafd19962a547
f89516a277dcd86555f8334cce9bb1ea9bc47e24
3c38fad722a64d3aef996f70faffcc1ccd96dbfc
47336225032067d3fa8d5bf1af22c3809eaa2143
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 4 changesets (bug 1494476) for build bustage and lining failure. CLOSED TREE Backed out changeset 70d95bda8458 (bug 1494476) Backed out changeset f89516a277dc (bug 1494476) Backed out changeset 3c38fad722a6 (bug 1494476) Backed out changeset 473362250320 (bug 1494476)
dom/base/nsDocument.cpp
dom/base/nsGlobalWindowOuter.cpp
toolkit/components/antitracking/AntiTrackingCommon.cpp
toolkit/components/antitracking/AntiTrackingCommon.h
toolkit/components/antitracking/test/browser/3rdParty.html
toolkit/components/antitracking/test/browser/3rdPartyOpenUI.html
toolkit/components/antitracking/test/browser/3rdPartyUI.html
toolkit/components/antitracking/test/browser/3rdPartyWO.html
toolkit/components/antitracking/test/browser/browser.ini
toolkit/components/antitracking/test/browser/browser_blockingCookies.js
toolkit/components/antitracking/test/browser/browser_blockingIndexedDb.js
toolkit/components/antitracking/test/browser/browser_blockingLocalStorage.js
toolkit/components/antitracking/test/browser/browser_blockingMessaging.js
toolkit/components/antitracking/test/browser/browser_blockingSessionStorage.js
toolkit/components/antitracking/test/browser/browser_blockingWorkers.js
toolkit/components/antitracking/test/browser/browser_script.js
toolkit/components/antitracking/test/browser/browser_storageAccessPrivateWindow.js
toolkit/components/antitracking/test/browser/browser_storageAccessPromiseResolveHandlerUserInteraction.js
toolkit/components/antitracking/test/browser/browser_storageAccessSandboxed.js
toolkit/components/antitracking/test/browser/browser_storageAccessWithHeuristics.js
toolkit/components/antitracking/test/browser/head.js
toolkit/components/antitracking/test/browser/storageAccessAPIHelpers.js
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -12821,18 +12821,29 @@ nsIDocument::MaybeAllowStorageForOpener(
   // If the opener is not a 3rd party and if this window is not a 3rd party, we
   // should not continue.
   if (!nsContentUtils::IsThirdPartyWindowOrChannel(inner, nullptr, openerURI) &&
       !nsContentUtils::IsThirdPartyWindowOrChannel(openerInner, nullptr,
                                                    nullptr)) {
     return;
   }
 
+  nsCOMPtr<nsIURI> uri = GetDocumentURI();
+  if (NS_WARN_IF(!uri)) {
+    return;
+  }
+
+  nsAutoString origin;
+  nsresult rv = nsContentUtils::GetUTFOrigin(uri, origin);
+  if (NS_WARN_IF(NS_FAILED(rv))) {
+    return;
+  }
+
   // We don't care when the asynchronous work finishes here.
-  Unused << AntiTrackingCommon::AddFirstPartyStorageAccessGrantedFor(NodePrincipal(),
+  Unused << AntiTrackingCommon::AddFirstPartyStorageAccessGrantedFor(origin,
                                                                      openerInner,
                                                                      AntiTrackingCommon::eHeuristic);
 }
 
 namespace {
 
 // Documents can stay alive for days. We don't want to update the permission
 // value at any user-interaction, and, using a timer triggered any X seconds
@@ -13730,17 +13741,17 @@ nsIDocument::RequestStorageAccess(mozill
   RefPtr<Promise> promise = Promise::Create(global, aRv,
                                             Promise::ePropagateUserInteraction);
   if (aRv.Failed()) {
     return nullptr;
   }
 
   // Step 1. If the document already has been granted access, resolve.
   nsPIDOMWindowInner* inner = GetInnerWindow();
-  RefPtr<nsGlobalWindowOuter> outer;
+  nsGlobalWindowOuter* outer = nullptr;
   if (inner) {
     outer = nsGlobalWindowOuter::Cast(inner->GetOuterWindow());
     if (outer->HasStorageAccess()) {
       promise->MaybeResolveWithUndefined();
       return promise.forget();
     }
   }
 
@@ -13824,27 +13835,37 @@ nsIDocument::RequestStorageAccess(mozill
       // TODO: prompt for permission
     }
   }
 
   // Step 10. Grant the document access to cookies and store that fact for
   //          the purposes of future calls to hasStorageAccess() and
   //          requestStorageAccess().
   if (granted && inner) {
+    outer->SetHasStorageAccess(true);
     if (isTrackingWindow) {
-      AntiTrackingCommon::AddFirstPartyStorageAccessGrantedFor(NodePrincipal(),
+      nsCOMPtr<nsIURI> uri = GetDocumentURI();
+      if (NS_WARN_IF(!uri)) {
+        aRv.Throw(NS_ERROR_NOT_AVAILABLE);
+        return nullptr;
+      }
+      nsAutoString origin;
+      nsresult rv = nsContentUtils::GetUTFOrigin(uri, origin);
+      if (NS_WARN_IF(NS_FAILED(rv))) {
+        aRv.Throw(rv);
+        return nullptr;
+      }
+      AntiTrackingCommon::AddFirstPartyStorageAccessGrantedFor(origin,
                                                                inner,
                                                                AntiTrackingCommon::eStorageAccessAPI)
         ->Then(GetCurrentThreadSerialEventTarget(), __func__,
-               [outer, promise] (bool) {
-                 outer->SetHasStorageAccess(true);
+               [promise] (bool) {
                  promise->MaybeResolveWithUndefined();
                },
-               [outer, promise] (bool) {
-                 outer->SetHasStorageAccess(false);
+               [promise] (bool) {
                  promise->MaybeRejectWithUndefined();
                });
     } else {
       promise->MaybeResolveWithUndefined();
     }
   }
   return promise.forget();
 }
--- a/dom/base/nsGlobalWindowOuter.cpp
+++ b/dom/base/nsGlobalWindowOuter.cpp
@@ -7096,26 +7096,24 @@ nsGlobalWindowOuter::MaybeAllowStorageFo
     return;
   }
 
   // No 3rd party URL/window.
   if (!nsContentUtils::IsThirdPartyWindowOrChannel(inner, nullptr, aURI)) {
     return;
   }
 
-  nsIDocument* doc = inner->GetDoc();
-  if (!doc) {
+  nsAutoString origin;
+  nsresult rv = nsContentUtils::GetUTFOrigin(aURI, origin);
+  if (NS_WARN_IF(NS_FAILED(rv))) {
     return;
   }
-  nsCOMPtr<nsIPrincipal> principal =
-    BasePrincipal::CreateCodebasePrincipal(aURI,
-      doc->NodePrincipal()->OriginAttributesRef());
 
   // We don't care when the asynchronous work finishes here.
-  Unused << AntiTrackingCommon::AddFirstPartyStorageAccessGrantedFor(principal,
+  Unused << AntiTrackingCommon::AddFirstPartyStorageAccessGrantedFor(origin,
                                                                      inner,
                                                                      AntiTrackingCommon::eHeuristic);
 }
 
 //*****************************************************************************
 // nsGlobalWindowOuter: Helper Functions
 //*****************************************************************************
 
--- a/toolkit/components/antitracking/AntiTrackingCommon.cpp
+++ b/toolkit/components/antitracking/AntiTrackingCommon.cpp
@@ -59,18 +59,17 @@ static const nsCString::size_type sMaxSp
     }                                                                         \
   PR_END_MACRO
 
 namespace {
 
 bool
 GetParentPrincipalAndTrackingOrigin(nsGlobalWindowInner* a3rdPartyTrackingWindow,
                                     nsIPrincipal** aTopLevelStoragePrincipal,
-                                    nsACString& aTrackingOrigin,
-                                    nsIPrincipal** aTrackingPrincipal)
+                                    nsACString& aTrackingOrigin)
 {
   if (!nsContentUtils::IsTrackingResourceWindow(a3rdPartyTrackingWindow)) {
     return false;
   }
 
   nsIDocument* doc = a3rdPartyTrackingWindow->GetDocument();
   // Make sure storage access isn't disabled
   if (doc && ((doc->GetSandboxFlags() & SANDBOXED_STORAGE_ACCESS) != 0 ||
@@ -81,30 +80,27 @@ GetParentPrincipalAndTrackingOrigin(nsGl
   // Now we need the principal and the origin of the parent window.
   nsCOMPtr<nsIPrincipal> topLevelStoragePrincipal =
     a3rdPartyTrackingWindow->GetTopLevelStorageAreaPrincipal();
   if (NS_WARN_IF(!topLevelStoragePrincipal)) {
     return false;
   }
 
   // Let's take the principal and the origin of the tracker.
-  nsCOMPtr<nsIPrincipal> trackingPrincipal = a3rdPartyTrackingWindow->GetPrincipal();
+  nsIPrincipal* trackingPrincipal = a3rdPartyTrackingWindow->GetPrincipal();
   if (NS_WARN_IF(!trackingPrincipal)) {
     return false;
   }
 
   nsresult rv = trackingPrincipal->GetOriginNoSuffix(aTrackingOrigin);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return false;
   }
 
   topLevelStoragePrincipal.forget(aTopLevelStoragePrincipal);
-  if (aTrackingPrincipal) {
-    trackingPrincipal.forget(aTrackingPrincipal);
-  }
   return true;
 };
 
 void
 CreatePermissionKey(const nsCString& aTrackingOrigin,
                     const nsCString& aGrantedOrigin,
                     nsACString& aPermissionKey)
 {
@@ -360,38 +356,24 @@ GetTopWindow(nsPIDOMWindowInner* aWindow
 
 /* static */ bool
 AntiTrackingCommon::ShouldHonorContentBlockingCookieRestrictions()
 {
   return StaticPrefs::browser_contentblocking_enabled();
 }
 
 /* static */ RefPtr<AntiTrackingCommon::StorageAccessGrantPromise>
-AntiTrackingCommon::AddFirstPartyStorageAccessGrantedFor(nsIPrincipal* aPrincipal,
+AntiTrackingCommon::AddFirstPartyStorageAccessGrantedFor(const nsAString& aOrigin,
                                                          nsPIDOMWindowInner* aParentWindow,
                                                          StorageAccessGrantedReason aReason)
 {
   MOZ_ASSERT(aParentWindow);
 
-  nsCOMPtr<nsIURI> uri;
-  nsresult rv = aPrincipal->GetURI(getter_AddRefs(uri));
-  if (NS_WARN_IF(!uri)) {
-    LOG(("Can't get the URI from the principal"));
-    return StorageAccessGrantPromise::CreateAndReject(false, __func__);
-  }
-
-  nsAutoString origin;
-  rv = nsContentUtils::GetUTFOrigin(uri, origin);
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    LOG(("Can't get the origin from the URI"));
-    return StorageAccessGrantPromise::CreateAndReject(false, __func__);
-  }
-
   LOG(("Adding a first-party storage exception for %s...",
-       NS_ConvertUTF16toUTF8(origin).get()));
+       NS_ConvertUTF16toUTF8(aOrigin).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(true, __func__);
   }
 
@@ -401,81 +383,70 @@ AntiTrackingCommon::AddFirstPartyStorage
   }
 
   if (CheckContentBlockingAllowList(aParentWindow)) {
     return StorageAccessGrantPromise::CreateAndResolve(true, __func__);
   }
 
   nsCOMPtr<nsIPrincipal> topLevelStoragePrincipal;
   nsAutoCString trackingOrigin;
-  nsCOMPtr<nsIPrincipal> trackingPrincipal;
 
   nsGlobalWindowInner* parentWindow = nsGlobalWindowInner::Cast(aParentWindow);
   nsGlobalWindowOuter* outerParentWindow =
     nsGlobalWindowOuter::Cast(parentWindow->GetOuterWindow());
   if (NS_WARN_IF(!outerParentWindow)) {
     LOG(("No outer window found for our parent window, bailing out early"));
     return StorageAccessGrantPromise::CreateAndReject(false, __func__);
   }
 
   LOG(("The current resource is %s-party",
        outerParentWindow->IsTopLevelWindow() ? "first" : "third"));
 
   // We are a first party resource.
   if (outerParentWindow->IsTopLevelWindow()) {
-    CopyUTF16toUTF8(origin, trackingOrigin);
-    trackingPrincipal = aPrincipal;
+    CopyUTF16toUTF8(aOrigin, trackingOrigin);
     topLevelStoragePrincipal = parentWindow->GetPrincipal();
     if (NS_WARN_IF(!topLevelStoragePrincipal)) {
       LOG(("Top-level storage area principal not found, bailing out early"));
       return StorageAccessGrantPromise::CreateAndReject(false, __func__);
     }
 
   // We are a 3rd party source.
   } else if (!GetParentPrincipalAndTrackingOrigin(parentWindow,
                                                   getter_AddRefs(topLevelStoragePrincipal),
-                                                  trackingOrigin,
-                                                  getter_AddRefs(trackingPrincipal))) {
+                                                  trackingOrigin)) {
     LOG(("Error while computing the parent principal and tracking origin, bailing out early"));
     return StorageAccessGrantPromise::CreateAndReject(false, __func__);
   }
 
-  nsCOMPtr<nsIURI> trackingURI;
-  rv = NS_NewURI(getter_AddRefs(trackingURI), trackingOrigin);
+  nsCOMPtr<nsIURI> uri;
+  nsresult rv = NS_NewURI(getter_AddRefs(uri), trackingOrigin);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     LOG(("Couldn't make a new URI out of the tracking origin"));
     return StorageAccessGrantPromise::CreateAndReject(false, __func__);
   }
 
-  // We hardcode this block reason since the first-party storage access permission
-  // is granted for the purpose of blocking trackers.
-  const uint32_t blockReason = nsIWebProgressListener::STATE_COOKIES_BLOCKED_TRACKER;
-  if (!HasUserInteraction(trackingPrincipal)) {
-    LOG_SPEC(("Tracking principal (%s) hasn't been interacted with before, "
-              "refusing to add a first-party storage permission to access it",
-              _spec), trackingURI);
-    NotifyRejection(aParentWindow, blockReason);
-    return StorageAccessGrantPromise::CreateAndReject(false, __func__);
-  }
-
   nsCOMPtr<nsPIDOMWindowOuter> pwin = GetTopWindow(parentWindow);
   if (!pwin) {
     LOG(("Couldn't get the top window"));
     return StorageAccessGrantPromise::CreateAndReject(false, __func__);
   }
 
   nsIChannel* channel =
     pwin->GetCurrentInnerWindow()->GetExtantDoc()->GetChannel();
 
-  pwin->NotifyContentBlockingState(blockReason, channel, false, trackingURI);
+  // We hardcode this block reason since the first-party storage access permission
+  // is granted for the purpose of blocking trackers.
+  const uint32_t blockReason = nsIWebProgressListener::STATE_COOKIES_BLOCKED_TRACKER;
+  pwin->NotifyContentBlockingState(blockReason, channel, false, uri);
 
-  NS_ConvertUTF16toUTF8 grantedOrigin(origin);
+  NS_ConvertUTF16toUTF8 grantedOrigin(aOrigin);
 
   ReportUnblockingConsole(parentWindow, NS_ConvertUTF8toUTF16(trackingOrigin),
-                          origin, aReason);
+                          aOrigin, aReason);
 
   if (XRE_IsParentProcess()) {
     LOG(("Saving the permission: trackingOrigin=%s, grantedOrigin=%s",
          trackingOrigin.get(), grantedOrigin.get()));
 
     RefPtr<StorageAccessGrantPromise::Private> p = new StorageAccessGrantPromise::Private(__func__);
     SaveFirstPartyStorageAccessGrantedForOriginOnParentProcess(topLevelStoragePrincipal,
                                                                trackingOrigin,
@@ -667,18 +638,17 @@ AntiTrackingCommon::IsFirstPartyStorageA
     LOG(("Our window isn't a tracking window"));
     return true;
   }
 
   nsCOMPtr<nsIPrincipal> parentPrincipal;
   nsAutoCString trackingOrigin;
   if (!GetParentPrincipalAndTrackingOrigin(nsGlobalWindowInner::Cast(aWindow),
                                            getter_AddRefs(parentPrincipal),
-                                           trackingOrigin,
-                                           nullptr)) {
+                                           trackingOrigin)) {
     LOG(("Failed to obtain the parent principal and the tracking origin"));
     return false;
   }
 
   nsAutoString origin;
   nsresult rv = nsContentUtils::GetUTFOrigin(aURI, origin);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     LOG_SPEC(("Failed to compute the origin from %s", _spec), aURI);
--- a/toolkit/components/antitracking/AntiTrackingCommon.h
+++ b/toolkit/components/antitracking/AntiTrackingCommon.h
@@ -99,17 +99,17 @@ public:
   //   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<bool, bool, false> StorageAccessGrantPromise;
   static MOZ_MUST_USE RefPtr<StorageAccessGrantPromise>
-  AddFirstPartyStorageAccessGrantedFor(nsIPrincipal* aPrincipal,
+  AddFirstPartyStorageAccessGrantedFor(const nsAString& aOrigin,
                                        nsPIDOMWindowInner* aParentWindow,
                                        StorageAccessGrantedReason aReason);
 
   static void
   StoreUserInteractionFor(nsIPrincipal* aPrincipal);
 
   // For IPC only.
   static void
--- a/toolkit/components/antitracking/test/browser/3rdParty.html
+++ b/toolkit/components/antitracking/test/browser/3rdParty.html
@@ -1,12 +1,11 @@
 <html>
 <head>
   <title>3rd party content!</title>
-  <script type="text/javascript" src="https://example.com/browser/toolkit/components/antitracking/test/browser/storageAccessAPIHelpers.js"></script>
 </head>
 <body>
 <h1>Here the 3rd party content!</h1>
 <script>
 
 function info(msg) {
   parent.postMessage({ type: "info", msg }, "*");
 }
--- a/toolkit/components/antitracking/test/browser/3rdPartyOpenUI.html
+++ b/toolkit/components/antitracking/test/browser/3rdPartyOpenUI.html
@@ -2,17 +2,14 @@
 <head>
   <title>A popup!</title>
 </head>
 <body>
 <h1>hi!</h1>
 <script>
 
 SpecialPowers.wrap(document).userInteractionForTesting();
-if (window.location.search == "?messageme") {
-  window.opener.postMessage("done", "*");
-}
 window.close();
 
 </script>
 </body>
 </html>
 
--- a/toolkit/components/antitracking/test/browser/3rdPartyUI.html
+++ b/toolkit/components/antitracking/test/browser/3rdPartyUI.html
@@ -1,12 +1,11 @@
 <html>
 <head>
   <title>Tracker</title>
-  <script type="text/javascript" src="https://example.com/browser/toolkit/components/antitracking/test/browser/storageAccessAPIHelpers.js"></script>
 </head>
 <body>
 <h1>Tracker</h1>
 <script>
 
 function info(msg) {
   parent.postMessage({ type: "info", msg }, "*");
 }
--- a/toolkit/components/antitracking/test/browser/3rdPartyWO.html
+++ b/toolkit/components/antitracking/test/browser/3rdPartyWO.html
@@ -1,12 +1,11 @@
 <html>
 <head>
   <title>Interact with me!</title>
-  <script type="text/javascript" src="https://example.com/browser/toolkit/components/antitracking/test/browser/storageAccessAPIHelpers.js"></script>
 </head>
 <body>
 <h1>Interact with me!</h1>
 <script>
 
 function info(msg) {
   parent.postMessage({ type: "info", msg }, "*");
 }
@@ -34,47 +33,16 @@ onmessage = function(e) {
       } else {
         onmessage = resolve;
 
         window.open("3rdPartyOpen.html");
       }
     });
   }).then(_ => {
     info("The popup has been dismissed!");
-    // First time storage access should not be granted because the tracker has
-    // not had user interaction yet.
-    let runnableStr = `(() => {return (${e.data.blockingCallback});})();`;
-    let runnable = eval(runnableStr); // eslint-disable-line no-eval
-    return runnable.call(this, /* Phase */ 2);
-  }).then(_ => {
-    info("Let's interact with the tracker");
-    return new Promise(resolve => {
-
-      onmessage = resolve;
-
-      window.open("3rdPartyOpenUI.html?messageme");
-    });
-  }).then(_ => {
-    info("Let's do another window.open()");
-    return new Promise(resolve => {
-
-      if (location.search == "?noopener") {
-        let features = "noopener";
-
-        window.open("3rdPartyOpen.html", undefined, features);
-        setTimeout(resolve, 1000);
-      } else {
-        onmessage = resolve;
-
-        window.open("3rdPartyOpen.html");
-      }
-    });
-  }).then(_ => {
-    // This time the tracker must have been able to ontain first-party storage
-    // access because it has had user interaction before.
     let runnableStr = `(() => {return (${e.data.nonBlockingCallback});})();`;
     let runnable = eval(runnableStr); // eslint-disable-line no-eval
     return runnable.call(this, /* Phase */ 2);
   }).then(_ => {
     parent.postMessage({ type: "finish" }, "*");
   });
 };
 
--- a/toolkit/components/antitracking/test/browser/browser.ini
+++ b/toolkit/components/antitracking/test/browser/browser.ini
@@ -8,17 +8,16 @@ support-files =
   3rdParty.html
   3rdPartySVG.html
   3rdPartyUI.html
   3rdPartyWO.html
   3rdPartyOpen.html
   3rdPartyOpenUI.html
   empty.js
   popup.html
-  storageAccessAPIHelpers.js
 
 [browser_backgroundImageAssertion.js]
 [browser_blockingCookies.js]
 support-files = server.sjs
 [browser_blockingIndexedDb.js]
 [browser_blockingLocalStorage.js]
 skip-if = serviceworker_e10s
 [browser_blockingSessionStorage.js]
--- a/toolkit/components/antitracking/test/browser/browser_blockingCookies.js
+++ b/toolkit/components/antitracking/test/browser/browser_blockingCookies.js
@@ -42,42 +42,54 @@ AntiTracking.runTest("Set/Get Cookies",
     await new Promise(resolve => {
       Services.clearData.deleteData(Ci.nsIClearDataService.CLEAR_ALL, value => resolve());
     });
   });
 
 AntiTracking.runTest("Cookies and Storage Access API",
   // Blocking callback
   async _ => {
-    await noStorageAccessInitially();
-
+    let hasAccess = await document.hasStorageAccess();
+    ok(!hasAccess, "Doesn't yet have storage access");
     is(document.cookie, "", "No cookies for me");
     document.cookie = "name=value";
     is(document.cookie, "", "No cookies for me");
 
     await fetch("server.sjs").then(r => r.text()).then(text => {
       is(text, "cookie-not-present", "We should not have cookies");
     });
     // Let's do it twice.
     await fetch("server.sjs").then(r => r.text()).then(text => {
       is(text, "cookie-not-present", "We should not have cookies");
     });
 
     is(document.cookie, "", "Still no cookies for me");
 
-    await callRequestStorageAccess();
+    let dwu = SpecialPowers.getDOMWindowUtils(window);
+    let helper = dwu.setHandlingUserInput(true);
 
+    let p;
+    try {
+      p = document.requestStorageAccess();
+    } finally {
+      helper.destruct();
+    }
+    await p;
+
+    hasAccess = await document.hasStorageAccess();
+    ok(hasAccess, "Now has storage access");
     is(document.cookie, "", "No cookies for me");
     document.cookie = "name=value";
     is(document.cookie, "name=value", "I have the cookies!");
   },
 
   // Non blocking callback
   async _ => {
-    await noStorageAccessInitially();
+    let hasAccess = await document.hasStorageAccess();
+    ok(!hasAccess, "Doesn't yet have storage access");
 
     is(document.cookie, "", "No cookies for me");
 
     await fetch("server.sjs").then(r => r.text()).then(text => {
       is(text, "cookie-not-present", "We should not have cookies");
     });
 
     document.cookie = "name=value";
@@ -85,18 +97,32 @@ AntiTracking.runTest("Cookies and Storag
     ok(document.cookie.includes("foopy=1"), "Some cookies for me");
 
     await fetch("server.sjs").then(r => r.text()).then(text => {
       is(text, "cookie-present", "We should have cookies");
     });
 
     ok(document.cookie.length, "Some Cookies for me");
 
-    await callRequestStorageAccess();
+    hasAccess = await document.hasStorageAccess();
+    ok(!hasAccess, "Doesn't yet have storage access");
+
+    let dwu = SpecialPowers.getDOMWindowUtils(window);
+    let helper = dwu.setHandlingUserInput(true);
 
+    let p;
+    try {
+      p = document.requestStorageAccess();
+    } finally {
+      helper.destruct();
+    }
+    await p;
+
+    hasAccess = await document.hasStorageAccess();
+    ok(hasAccess, "Now has storage access");
     // For non-tracking windows, calling the API is a no-op
     ok(document.cookie.length, "Still some Cookies for me");
     ok(document.cookie.includes("name=value"), "Some cookies for me");
     ok(document.cookie.includes("foopy=1"), "Some cookies for me");
   },
 
   // Cleanup callback
   async _ => {
--- a/toolkit/components/antitracking/test/browser/browser_blockingIndexedDb.js
+++ b/toolkit/components/antitracking/test/browser/browser_blockingIndexedDb.js
@@ -80,45 +80,63 @@ AntiTracking.runTest("IndexedDB in worke
     await new Promise(resolve => {
       Services.clearData.deleteData(Ci.nsIClearDataService.CLEAR_ALL, value => resolve());
     });
   });
 
 AntiTracking.runTest("IndexedDB and Storage Access API",
   // blocking callback
   async _ => {
-    await noStorageAccessInitially();
-
+    let hasAccess = await document.hasStorageAccess();
+    ok(!hasAccess, "Doesn't yet have storage access");
     try {
       indexedDB.open("test", "1");
       ok(false, "IDB should be blocked");
     } catch (e) {
       ok(true, "IDB should be blocked");
       is(e.name, "SecurityError", "We want a security error message.");
     }
 
     let dwu = SpecialPowers.getDOMWindowUtils(window);
     let helper = dwu.setHandlingUserInput(true);
 
-    await callRequestStorageAccess();
+    let p;
+    try {
+      p = document.requestStorageAccess();
+    } finally {
+      helper.destruct();
+    }
+    await p;
+
+    hasAccess = await document.hasStorageAccess();
+    ok(hasAccess, "Now has storage access");
 
     indexedDB.open("test", "1");
     ok(true, "IDB should be allowed");
   },
   // non-blocking callback
   async _ => {
-    await noStorageAccessInitially();
-
+    let hasAccess = await document.hasStorageAccess();
+    ok(!hasAccess, "Doesn't yet have storage access");
     indexedDB.open("test", "1");
     ok(true, "IDB should be allowed");
 
     let dwu = SpecialPowers.getDOMWindowUtils(window);
     let helper = dwu.setHandlingUserInput(true);
 
-    await callRequestStorageAccess();
+    let p;
+    try {
+      p = document.requestStorageAccess();
+    } finally {
+      helper.destruct();
+    }
+    await p;
+
+    hasAccess = await document.hasStorageAccess();
+    ok(hasAccess, "Now has storage access");
 
     // For non-tracking windows, calling the API is a no-op
     indexedDB.open("test", "1");
     ok(true, "IDB should be allowed");
   },
   // Cleanup callback
   async _ => {
     await new Promise(resolve => {
@@ -137,17 +155,18 @@ AntiTracking.runTest("IndexedDB in worke
         postMessage(e.name == "SecurityError");
       }
     }
     function nonBlockCode() {
       indexedDB.open("test", "1");
       postMessage(true);
     }
 
-    await noStorageAccessInitially();
+    let hasAccess = await document.hasStorageAccess();
+    ok(!hasAccess, "Doesn't yet have storage access");
 
     let blob = new Blob([blockCode.toString() + "; blockCode();"]);
     ok(blob, "Blob has been created");
 
     let blobURL = URL.createObjectURL(blob);
     ok(blobURL, "Blob URL has been created");
 
     let worker = new Worker(blobURL);
@@ -158,17 +177,29 @@ AntiTracking.runTest("IndexedDB in worke
         if (e) {
           resolve();
         } else {
           reject();
         }
       };
     });
 
-    await callRequestStorageAccess();
+    let dwu = SpecialPowers.getDOMWindowUtils(window);
+    let helper = dwu.setHandlingUserInput(true);
+
+    let p;
+    try {
+      p = document.requestStorageAccess();
+    } finally {
+      helper.destruct();
+    }
+    await p;
+
+    hasAccess = await document.hasStorageAccess();
+    ok(hasAccess, "Now has storage access");
 
     blob = new Blob([nonBlockCode.toString() + "; nonBlockCode();"]);
     ok(blob, "Blob has been created");
 
     blobURL = URL.createObjectURL(blob);
     ok(blobURL, "Blob URL has been created");
 
     worker = new Worker(blobURL);
@@ -185,17 +216,18 @@ AntiTracking.runTest("IndexedDB in worke
     });
   },
   async _ => {
     function nonBlockCode() {
       indexedDB.open("test", "1");
       postMessage(true);
     }
 
-    await noStorageAccessInitially();
+    let hasAccess = await document.hasStorageAccess();
+    ok(!hasAccess, "Doesn't yet have storage access");
 
     let blob = new Blob([nonBlockCode.toString() + "; nonBlockCode();"]);
     ok(blob, "Blob has been created");
 
     let blobURL = URL.createObjectURL(blob);
     ok(blobURL, "Blob URL has been created");
 
     let worker = new Worker(blobURL);
@@ -206,17 +238,29 @@ AntiTracking.runTest("IndexedDB in worke
         if (e) {
           resolve();
         } else {
           reject();
         }
       };
     });
 
-    await callRequestStorageAccess();
+    let dwu = SpecialPowers.getDOMWindowUtils(window);
+    let helper = dwu.setHandlingUserInput(true);
+
+    let p;
+    try {
+      p = document.requestStorageAccess();
+    } finally {
+      helper.destruct();
+    }
+    await p;
+
+    hasAccess = await document.hasStorageAccess();
+    ok(hasAccess, "Now has storage access");
 
     // For non-tracking windows, calling the API is a no-op
 
     worker = new Worker(blobURL);
     ok(worker, "Worker has been created");
 
     await new Promise((resolve, reject) => {
       worker.onmessage = function(e) {
--- a/toolkit/components/antitracking/test/browser/browser_blockingLocalStorage.js
+++ b/toolkit/components/antitracking/test/browser/browser_blockingLocalStorage.js
@@ -15,38 +15,64 @@ AntiTracking.runTest("localStorage",
   async _ => {
     await new Promise(resolve => {
       Services.clearData.deleteData(Ci.nsIClearDataService.CLEAR_ALL, value => resolve());
     });
   });
 
 AntiTracking.runTest("localStorage and Storage Access API",
   async _ => {
-    await noStorageAccessInitially();
+    let hasAccess = await document.hasStorageAccess();
+    ok(!hasAccess, "Doesn't yet have storage access");
 
     try {
       localStorage.foo = 42;
       ok(false, "LocalStorage cannot be used!");
     } catch (e) {
       ok(true, "LocalStorage cannot be used!");
       is(e.name, "SecurityError", "We want a security error message.");
     }
 
-    await callRequestStorageAccess();
+    let dwu = SpecialPowers.getDOMWindowUtils(window);
+    let helper = dwu.setHandlingUserInput(true);
+
+    let p;
+    try {
+      p = document.requestStorageAccess();
+    } finally {
+      helper.destruct();
+    }
+    await p;
+
+    hasAccess = await document.hasStorageAccess();
+    ok(hasAccess, "Now has storage access");
 
     localStorage.foo = 42;
     ok(true, "LocalStorage is allowed");
   },
   async _ => {
-    await noStorageAccessInitially();
+    let hasAccess = await document.hasStorageAccess();
+    ok(!hasAccess, "Doesn't yet have storage access");
 
     localStorage.foo = 42;
     ok(true, "LocalStorage is allowed");
 
-    await callRequestStorageAccess();
+    let dwu = SpecialPowers.getDOMWindowUtils(window);
+    let helper = dwu.setHandlingUserInput(true);
+
+    let p;
+    try {
+      p = document.requestStorageAccess();
+    } finally {
+      helper.destruct();
+    }
+    await p;
+
+    hasAccess = await document.hasStorageAccess();
+    ok(hasAccess, "Now has storage access");
 
     // For non-tracking windows, calling the API is a no-op
     localStorage.foo = 42;
     ok(true, "LocalStorage is allowed");
   },
   async _ => {
     await new Promise(resolve => {
       Services.clearData.deleteData(Ci.nsIClearDataService.CLEAR_ALL, value => resolve());
--- a/toolkit/components/antitracking/test/browser/browser_blockingMessaging.js
+++ b/toolkit/components/antitracking/test/browser/browser_blockingMessaging.js
@@ -76,39 +76,61 @@ AntiTracking.runTest("BroadcastChannel i
   async _ => {
     await new Promise(resolve => {
       Services.clearData.deleteData(Ci.nsIClearDataService.CLEAR_ALL, value => resolve());
     });
   });
 
 AntiTracking.runTest("BroadcastChannel and Storage Access API",
   async _ => {
-    await noStorageAccessInitially();
-
+    let hasAccess = await document.hasStorageAccess();
+    ok(!hasAccess, "Doesn't yet have storage access");
     try {
       new BroadcastChannel("hello");
       ok(false, "BroadcastChannel cannot be used!");
     } catch (e) {
       ok(true, "BroadcastChannel cannot be used!");
       is(e.name, "SecurityError", "We want a security error message.");
     }
 
-    await callRequestStorageAccess();
+    let dwu = SpecialPowers.getDOMWindowUtils(window);
+    let helper = dwu.setHandlingUserInput(true);
 
+    let p;
+    try {
+      p = document.requestStorageAccess();
+    } finally {
+      helper.destruct();
+    }
+    await p;
+
+    hasAccess = await document.hasStorageAccess();
+    ok(hasAccess, "Now has storage access");
     new BroadcastChannel("hello");
     ok(true, "BroadcastChannel can be used");
   },
   async _ => {
-    await noStorageAccessInitially();
-
+    let hasAccess = await document.hasStorageAccess();
+    ok(!hasAccess, "Doesn't yet have storage access");
     new BroadcastChannel("hello");
     ok(true, "BroadcastChanneli can be used");
 
-    await callRequestStorageAccess();
+    let dwu = SpecialPowers.getDOMWindowUtils(window);
+    let helper = dwu.setHandlingUserInput(true);
 
+    let p;
+    try {
+      p = document.requestStorageAccess();
+    } finally {
+      helper.destruct();
+    }
+    await p;
+
+    hasAccess = await document.hasStorageAccess();
+    ok(hasAccess, "Now has storage access");
     new BroadcastChannel("hello");
     ok(true, "BroadcastChannel can be used");
   },
   async _ => {
     await new Promise(resolve => {
       Services.clearData.deleteData(Ci.nsIClearDataService.CLEAR_ALL, value => resolve());
     });
   },
@@ -124,17 +146,18 @@ AntiTracking.runTest("BroadcastChannel i
         postMessage(e.name == "SecurityError");
       }
     }
     function nonBlockingCode() {
       new BroadcastChannel("hello");
       postMessage(true);
     }
 
-    await noStorageAccessInitially();
+    let hasAccess = await document.hasStorageAccess();
+    ok(!hasAccess, "Doesn't yet have storage access");
 
     let blob = new Blob([blockingCode.toString() + "; blockingCode();"]);
     ok(blob, "Blob has been created");
 
     let blobURL = URL.createObjectURL(blob);
     ok(blobURL, "Blob URL has been created");
 
     let worker = new Worker(blobURL);
@@ -145,17 +168,29 @@ AntiTracking.runTest("BroadcastChannel i
         if (e) {
           resolve();
         } else {
           reject();
         }
       };
     });
 
-    await callRequestStorageAccess();
+    let dwu = SpecialPowers.getDOMWindowUtils(window);
+    let helper = dwu.setHandlingUserInput(true);
+
+    let p;
+    try {
+      p = document.requestStorageAccess();
+    } finally {
+      helper.destruct();
+    }
+    await p;
+
+    hasAccess = await document.hasStorageAccess();
+    ok(hasAccess, "Now has storage access");
 
     blob = new Blob([nonBlockingCode.toString() + "; nonBlockingCode();"]);
     ok(blob, "Blob has been created");
 
     blobURL = URL.createObjectURL(blob);
     ok(blobURL, "Blob URL has been created");
 
     worker = new Worker(blobURL);
@@ -172,17 +207,18 @@ AntiTracking.runTest("BroadcastChannel i
     });
   },
   async _ => {
     function nonBlockingCode() {
       new BroadcastChannel("hello");
       postMessage(true);
     }
 
-    await noStorageAccessInitially();
+    let hasAccess = await document.hasStorageAccess();
+    ok(!hasAccess, "Doesn't yet have storage access");
 
     let blob = new Blob([nonBlockingCode.toString() + "; nonBlockingCode();"]);
     ok(blob, "Blob has been created");
 
     let blobURL = URL.createObjectURL(blob);
     ok(blobURL, "Blob URL has been created");
 
     let worker = new Worker(blobURL);
@@ -193,17 +229,29 @@ AntiTracking.runTest("BroadcastChannel i
         if (e) {
           resolve();
         } else {
           reject();
         }
       };
     });
 
-    await callRequestStorageAccess();
+    let dwu = SpecialPowers.getDOMWindowUtils(window);
+    let helper = dwu.setHandlingUserInput(true);
+
+    let p;
+    try {
+      p = document.requestStorageAccess();
+    } finally {
+      helper.destruct();
+    }
+    await p;
+
+    hasAccess = await document.hasStorageAccess();
+    ok(hasAccess, "Now has storage access");
 
     // For non-tracking windows, calling the API is a no-op
 
     worker = new Worker(blobURL);
     ok(worker, "Worker has been created");
 
     await new Promise((resolve, reject) => {
       worker.onmessage = function(e) {
--- a/toolkit/components/antitracking/test/browser/browser_blockingSessionStorage.js
+++ b/toolkit/components/antitracking/test/browser/browser_blockingSessionStorage.js
@@ -14,33 +14,59 @@ AntiTracking.runTest("sessionStorage",
   },
   [],
   true,
   true,
   false);
 
 AntiTracking.runTest("sessionStorage and Storage Access API",
   async _ => {
-    await noStorageAccessInitially();
+    let hasAccess = await document.hasStorageAccess();
+    ok(!hasAccess, "Doesn't yet have storage access");
 
     sessionStorage.foo = 42;
     ok(true, "SessionStorage is always allowed");
 
-    await callRequestStorageAccess();
+    let dwu = SpecialPowers.getDOMWindowUtils(window);
+    let helper = dwu.setHandlingUserInput(true);
+
+    let p;
+    try {
+      p = document.requestStorageAccess();
+    } finally {
+      helper.destruct();
+    }
+    await p;
+
+    hasAccess = await document.hasStorageAccess();
+    ok(hasAccess, "Now has storage access");
 
     sessionStorage.foo = 42;
     ok(true, "SessionStorage is allowed after calling the storage access API too");
   },
   async _ => {
-    await noStorageAccessInitially();
+    let hasAccess = await document.hasStorageAccess();
+    ok(!hasAccess, "Doesn't yet have storage access");
 
     sessionStorage.foo = 42;
     ok(true, "SessionStorage is always allowed");
 
-    await callRequestStorageAccess();
+    let dwu = SpecialPowers.getDOMWindowUtils(window);
+    let helper = dwu.setHandlingUserInput(true);
+
+    let p;
+    try {
+      p = document.requestStorageAccess();
+    } finally {
+      helper.destruct();
+    }
+    await p;
+
+    hasAccess = await document.hasStorageAccess();
+    ok(hasAccess, "Now has storage access");
 
     // For non-tracking windows, calling the API is a no-op
     sessionStorage.foo = 42;
     ok(true, "SessionStorage is allowed after calling the storage access API too");
   },
   async _ => {
     await new Promise(resolve => {
       Services.clearData.deleteData(Ci.nsIClearDataService.CLEAR_ALL, value => resolve());
--- a/toolkit/components/antitracking/test/browser/browser_blockingWorkers.js
+++ b/toolkit/components/antitracking/test/browser/browser_blockingWorkers.js
@@ -50,41 +50,67 @@ AntiTracking.runTest("DOM Cache",
   async _ => {
     await new Promise(resolve => {
       Services.clearData.deleteData(Ci.nsIClearDataService.CLEAR_ALL, value => resolve());
     });
   });
 
 AntiTracking.runTest("SharedWorkers and Storage Access API",
   async _ => {
-    await noStorageAccessInitially();
+    let hasAccess = await document.hasStorageAccess();
+    ok(!hasAccess, "Doesn't yet have storage access");
 
     try {
       new SharedWorker("a.js", "foo");
       ok(false, "SharedWorker cannot be used!");
     } catch (e) {
       ok(true, "SharedWorker cannot be used!");
       is(e.name, "SecurityError", "We want a security error message.");
     }
 
-    await callRequestStorageAccess();
+    let dwu = SpecialPowers.getDOMWindowUtils(window);
+    let helper = dwu.setHandlingUserInput(true);
+
+    let p;
+    try {
+      p = document.requestStorageAccess();
+    } finally {
+      helper.destruct();
+    }
+    await p;
+
+    hasAccess = await document.hasStorageAccess();
+    ok(hasAccess, "Now has storage access");
 
     new SharedWorker("a.js", "foo");
     ok(true, "SharedWorker is allowed");
   },
   async _ => {
-    await noStorageAccessInitially();
+    let hasAccess = await document.hasStorageAccess();
+    ok(!hasAccess, "Doesn't yet have storage access");
 
     new SharedWorker("a.js", "foo");
     ok(true, "SharedWorker is allowed");
 
-    await callRequestStorageAccess();
+    let dwu = SpecialPowers.getDOMWindowUtils(window);
+    let helper = dwu.setHandlingUserInput(true);
+
+    let p;
+    try {
+      p = document.requestStorageAccess();
+    } finally {
+      helper.destruct();
+    }
+    await p;
+
+    hasAccess = await document.hasStorageAccess();
+    ok(hasAccess, "Now has storage access");
 
     // For non-tracking windows, calling the API is a no-op
-    new SharedWorker("a.js", "bar");
+    new SharedWorker("a.js", "foo");
     ok(true, "SharedWorker is allowed");
   },
   async _ => {
     await new Promise(resolve => {
       Services.clearData.deleteData(Ci.nsIClearDataService.CLEAR_ALL, value => resolve());
     });
   },
   null, false, false);
@@ -92,49 +118,75 @@ AntiTracking.runTest("SharedWorkers and 
 AntiTracking.runTest("ServiceWorkers and Storage Access API",
   async _ => {
     await SpecialPowers.pushPrefEnv({"set": [
        ["dom.serviceWorkers.exemptFromPerDomainMax", true],
        ["dom.serviceWorkers.enabled", true],
        ["dom.serviceWorkers.testing.enabled", true],
     ]});
 
-    await noStorageAccessInitially();
+    let hasAccess = await document.hasStorageAccess();
+    ok(!hasAccess, "Doesn't yet have storage access");
 
     await navigator.serviceWorker.register("empty.js").then(
       _ => { ok(false, "ServiceWorker cannot be used!"); },
       _ => { ok(true, "ServiceWorker cannot be used!"); }).
       catch(e => ok(false, "Promise rejected: " + e));
 
-    await callRequestStorageAccess();
+    let dwu = SpecialPowers.getDOMWindowUtils(window);
+    let helper = dwu.setHandlingUserInput(true);
+
+    let p;
+    try {
+      p = document.requestStorageAccess();
+    } finally {
+      helper.destruct();
+    }
+    await p;
+
+    hasAccess = await document.hasStorageAccess();
+    ok(hasAccess, "Now has storage access");
 
     await navigator.serviceWorker.register("empty.js").then(
       reg => { ok(true, "ServiceWorker can be used!"); return reg; },
       _ => { ok(false, "ServiceWorker cannot be used! " + _); }).then(
       reg => reg.unregister(),
       _ => { ok(false, "unregister failed"); }).
       catch(e => ok(false, "Promise rejected: " + e));
   },
   async _ => {
     await SpecialPowers.pushPrefEnv({"set": [
        ["dom.serviceWorkers.exemptFromPerDomainMax", true],
        ["dom.serviceWorkers.enabled", true],
        ["dom.serviceWorkers.testing.enabled", true],
     ]});
 
-    await noStorageAccessInitially();
+    let hasAccess = await document.hasStorageAccess();
+    ok(!hasAccess, "Doesn't yet have storage access");
 
     await navigator.serviceWorker.register("empty.js").then(
       reg => { ok(true, "ServiceWorker can be used!"); return reg; },
       _ => { ok(false, "ServiceWorker cannot be used!"); }).then(
       reg => reg.unregister(),
       _ => { ok(false, "unregister failed"); }).
       catch(e => ok(false, "Promise rejected: " + e));
 
-    await callRequestStorageAccess();
+    let dwu = SpecialPowers.getDOMWindowUtils(window);
+    let helper = dwu.setHandlingUserInput(true);
+
+    let p;
+    try {
+      p = document.requestStorageAccess();
+    } finally {
+      helper.destruct();
+    }
+    await p;
+
+    hasAccess = await document.hasStorageAccess();
+    ok(hasAccess, "Now has storage access");
 
     // For non-tracking windows, calling the API is a no-op
     await navigator.serviceWorker.register("empty.js").then(
       reg => { ok(true, "ServiceWorker can be used!"); return reg; },
       _ => { ok(false, "ServiceWorker cannot be used!"); }).then(
       reg => reg.unregister(),
       _ => { ok(false, "unregister failed"); }).
       catch(e => ok(false, "Promise rejected: " + e));
@@ -146,36 +198,62 @@ AntiTracking.runTest("ServiceWorkers and
   },
   [["dom.serviceWorkers.exemptFromPerDomainMax", true],
    ["dom.serviceWorkers.enabled", true],
    ["dom.serviceWorkers.testing.enabled", true]],
   false, false);
 
 AntiTracking.runTest("DOM Cache and Storage Access API",
   async _ => {
-    await noStorageAccessInitially();
+    let hasAccess = await document.hasStorageAccess();
+    ok(!hasAccess, "Doesn't yet have storage access");
 
     await caches.open("wow").then(
       _ => { ok(false, "DOM Cache cannot be used!"); },
       _ => { ok(true, "DOM Cache cannot be used!"); });
 
-    await callRequestStorageAccess();
+    let dwu = SpecialPowers.getDOMWindowUtils(window);
+    let helper = dwu.setHandlingUserInput(true);
+
+    let p;
+    try {
+      p = document.requestStorageAccess();
+    } finally {
+      helper.destruct();
+    }
+    await p;
+
+    hasAccess = await document.hasStorageAccess();
+    ok(hasAccess, "Now has storage access");
 
     await caches.open("wow").then(
       _ => { ok(true, "DOM Cache can be used!"); },
       _ => { ok(false, "DOM Cache can be used!"); });
   },
   async _ => {
-    await noStorageAccessInitially();
+    let hasAccess = await document.hasStorageAccess();
+    ok(!hasAccess, "Doesn't yet have storage access");
 
     await caches.open("wow").then(
       _ => { ok(true, "DOM Cache can be used!"); },
       _ => { ok(false, "DOM Cache can be used!"); });
 
-    await callRequestStorageAccess();
+    let dwu = SpecialPowers.getDOMWindowUtils(window);
+    let helper = dwu.setHandlingUserInput(true);
+
+    let p;
+    try {
+      p = document.requestStorageAccess();
+    } finally {
+      helper.destruct();
+    }
+    await p;
+
+    hasAccess = await document.hasStorageAccess();
+    ok(hasAccess, "Now has storage access");
 
     // For non-tracking windows, calling the API is a no-op
     await caches.open("wow").then(
       _ => { ok(true, "DOM Cache can be used!"); },
       _ => { ok(false, "DOM Cache can be used!"); });
   },
   async _ => {
     await new Promise(resolve => {
--- a/toolkit/components/antitracking/test/browser/browser_script.js
+++ b/toolkit/components/antitracking/test/browser/browser_script.js
@@ -35,82 +35,16 @@ add_task(async function() {
         localStorage.foo = 42;
         ok(false, "LocalStorage cannot be used!");
       } catch (e) {
         ok(true, "LocalStorage cannot be used!");
         is(e.name, "SecurityError", "We want a security error message.");
       }
     };
 
-    let assertBlocked = () => new content.Promise(resolve => {
-      let ifr = content.document.createElement("iframe");
-      ifr.onload = function() {
-        info("Sending code to the 3rd party content");
-        ifr.contentWindow.postMessage(callbackBlocked.toString(), "*");
-      };
-
-      content.addEventListener("message", function msg(event) {
-        if (event.data.type == "finish") {
-          content.removeEventListener("message", msg);
-          resolve();
-          return;
-        }
-
-        if (event.data.type == "ok") {
-          ok(event.data.what, event.data.msg);
-          return;
-        }
-
-        if (event.data.type == "info") {
-          info(event.data.msg);
-          return;
-        }
-
-        ok(false, "Unknown message");
-      });
-
-      content.document.body.appendChild(ifr);
-      ifr.src = obj.page;
-    });
-
-    await assertBlocked();
-
-    info("Triggering a 3rd party script...");
-    let p = new content.Promise(resolve => {
-      let bc = new content.BroadcastChannel("a");
-      bc.onmessage = resolve;
-    });
-
-    let src = content.document.createElement("script");
-    content.document.body.appendChild(src);
-    src.src = obj.scriptURL;
-
-    await p;
-
-    info("Checking if permission is denied before interacting with tracker");
-    await assertBlocked();
-  });
-
-  await AntiTracking.interactWithTracker();
-
-  info("Loading tracking scripts");
-  await ContentTask.spawn(browser, { scriptURL: TEST_DOMAIN + TEST_PATH + "tracker.js",
-                                     page: TEST_3RD_PARTY_PAGE,
-                                   }, async obj => {
-    info("Checking if permission is denied");
-    let callbackBlocked = async _ => {
-      try {
-        localStorage.foo = 42;
-        ok(false, "LocalStorage cannot be used!");
-      } catch (e) {
-        ok(true, "LocalStorage cannot be used!");
-        is(e.name, "SecurityError", "We want a security error message.");
-      }
-    };
-
     await new content.Promise(resolve => {
       let ifr = content.document.createElement("iframe");
       ifr.onload = function() {
         info("Sending code to the 3rd party content");
         ifr.contentWindow.postMessage(callbackBlocked.toString(), "*");
       };
 
       content.addEventListener("message", function msg(event) {
--- a/toolkit/components/antitracking/test/browser/browser_storageAccessPrivateWindow.js
+++ b/toolkit/components/antitracking/test/browser/browser_storageAccessPrivateWindow.js
@@ -1,24 +1,36 @@
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 AntiTracking.runTest("Storage Access API called in a private window",
   // blocking callback
   async _ => {
-    let [threw, rejected] = await callRequestStorageAccess();
+    let dwu = SpecialPowers.getDOMWindowUtils(window);
+    let helper = dwu.setHandlingUserInput(true);
+
+    let p;
+    let threw = false;
+    try {
+      p = document.requestStorageAccess();
+    } catch (e) {
+      threw = true;
+    } finally {
+      helper.destruct();
+    }
     ok(!threw, "requestStorageAccess should not throw");
-    ok(rejected, "requestStorageAccess shouldn't be available");
+    threw = false;
+    try {
+      await p;
+    } catch (e) {
+      threw = true;
+    }
+    ok(threw, "requestStorageAccess shouldn't be available");
   },
 
   null, // non-blocking callback
-  // cleanup function
-  async _ => {
-    await new Promise(resolve => {
-      Services.clearData.deleteData(Ci.nsIClearDataService.CLEAR_ALL, value => resolve());
-    });
-  },
+  null, // cleanup function
   [["dom.storage_access.enabled", true]], // extra prefs
   false, // no window open test
   false, // no user-interaction test
   false, // no blocking notifications
   true, // run in private window
   null // iframe sandbox
 );
--- a/toolkit/components/antitracking/test/browser/browser_storageAccessPromiseResolveHandlerUserInteraction.js
+++ b/toolkit/components/antitracking/test/browser/browser_storageAccessPromiseResolveHandlerUserInteraction.js
@@ -1,24 +1,47 @@
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 AntiTracking.runTest("Storage Access API returns promises that maintain user activation",
   // blocking callback
   async _ => {
-    let [threw, rejected] = await callRequestStorageAccess(dwu => {
-      ok(dwu.isHandlingUserInput,
-         "Promise handler must run as if we're handling user input");
+    let dwu = SpecialPowers.getDOMWindowUtils(window);
+    let helper = dwu.setHandlingUserInput(true);
+
+    let p;
+    let threw = false;
+    try {
+      p = document.requestStorageAccess();
+    } catch (e) {
+      threw = true;
+    } finally {
+      helper.destruct();
+    }
+    ok(!threw, "requestStorageAccess should not throw");
+    threw = false;
+    await p.then(() => {
     });
-    ok(!threw, "requestStorageAccess should not throw");
-    ok(!rejected, "requestStorageAccess should be available");
+    threw = false;
+    try {
+      await p.then(() => {
+        ok(dwu.isHandlingUserInput,
+           "Promise handler must run as if we're handling user input");
+      });
+    } catch (e) {
+      threw = true;
+    }
+    ok(!threw, "requestStorageAccess should be available");
   },
 
   null, // non-blocking callback
   // cleanup function
   async _ => {
     await new Promise(resolve => {
       Services.clearData.deleteData(Ci.nsIClearDataService.CLEAR_ALL, value => resolve());
     });
   },
-  null, // extra prefs
+  [["dom.storage_access.enabled", true]], // extra prefs
   false, // no window open test
-  false // no user-interaction test
+  false, // no user-interaction test
+  true, // expect blocking notifications
+  false, // run in normal window
+  null // iframe sandbox
 );
--- a/toolkit/components/antitracking/test/browser/browser_storageAccessSandboxed.js
+++ b/toolkit/components/antitracking/test/browser/browser_storageAccessSandboxed.js
@@ -1,47 +1,71 @@
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 let counter = 0;
 
 AntiTracking.runTest("Storage Access API called in a sandboxed iframe",
   // blocking callback
   async _ => {
-    let [threw, rejected] = await callRequestStorageAccess();
+    let dwu = SpecialPowers.getDOMWindowUtils(window);
+    let helper = dwu.setHandlingUserInput(true);
+
+    let p;
+    let threw = false;
+    try {
+      p = document.requestStorageAccess();
+    } catch (e) {
+      threw = true;
+    } finally {
+      helper.destruct();
+    }
     ok(!threw, "requestStorageAccess should not throw");
-    ok(rejected, "requestStorageAccess shouldn't be available");
+    threw = false;
+    try {
+      await p;
+    } catch (e) {
+      threw = true;
+    }
+    ok(threw, "requestStorageAccess shouldn't be available");
   },
 
   null, // non-blocking callback
-  // cleanup function
-  async _ => {
-    // Only clear the user-interaction permissions for the tracker here so that
-    // the next test has a clean slate.
-    await new Promise(resolve => {
-      Services.clearData.deleteDataFromHost(Services.io.newURI(TEST_3RD_PARTY_DOMAIN).host,
-                                            true,
-                                            Ci.nsIClearDataService.CLEAR_PERMISSIONS,
-                                            value => resolve());
-    });
-  },
+  null, // cleanup function
   [["dom.storage_access.enabled", true]], // extra prefs
   false, // no window open test
   false, // no user-interaction test
   false, // no blocking notifications
   false, // run in normal window
-  "allow-scripts allow-same-origin allow-popups"
+  "allow-scripts allow-same-origin"
 );
 
 AntiTracking.runTest("Storage Access API called in a sandboxed iframe with" +
                      " allow-storage-access-by-user-activation",
   // blocking callback
   async _ => {
-    let [threw, rejected] = await callRequestStorageAccess();
+    let dwu = SpecialPowers.getDOMWindowUtils(window);
+    let helper = dwu.setHandlingUserInput(true);
+
+    let p;
+    let threw = false;
+    try {
+      p = document.requestStorageAccess();
+    } catch (e) {
+      threw = true;
+    } finally {
+      helper.destruct();
+    }
     ok(!threw, "requestStorageAccess should not throw");
-    ok(!rejected, "requestStorageAccess should be available");
+    threw = false;
+    try {
+      await p;
+    } catch (e) {
+      threw = true;
+    }
+    ok(!threw, "requestStorageAccess should be available");
   },
 
   null, // non-blocking callback
   // cleanup function
   async _ => {
     // The test harness calls this function twice.  Our cleanup function is set
     // up so that the first time that it's called, it would do the cleanup, but
     // the second time it would bail out early.  This ensures that after the
@@ -55,23 +79,24 @@ AntiTracking.runTest("Storage Access API
       Services.clearData.deleteData(Ci.nsIClearDataService.CLEAR_ALL, value => resolve());
     });
   },
   [["dom.storage_access.enabled", true]], // extra prefs
   false, // no window open test
   false, // no user-interaction test
   true, // expect blocking notifications
   false, // run in normal window
-  "allow-scripts allow-same-origin allow-popups allow-storage-access-by-user-activation"
+  "allow-scripts allow-same-origin allow-storage-access-by-user-activation"
 );
 
 AntiTracking.runTest("Verify that sandboxed contexts don't get the saved permission",
   // blocking callback
   async _ => {
-    await noStorageAccessInitially();
+    let hasAccess = await document.hasStorageAccess();
+    ok(!hasAccess, "Doesn't yet have storage access");
 
     try {
       localStorage.foo = 42;
       ok(false, "LocalStorage cannot be used!");
     } catch (e) {
       ok(true, "LocalStorage cannot be used!");
       is(e.name, "SecurityError", "We want a security error message.");
     }
@@ -79,44 +104,46 @@ AntiTracking.runTest("Verify that sandbo
 
   null, // non-blocking callback
   null, // cleanup function
   [["dom.storage_access.enabled", true]], // extra prefs
   false, // no window open test
   false, // no user-interaction test
   false, // no blocking notifications
   false, // run in normal window
-  "allow-scripts allow-same-origin allow-popups"
+  "allow-scripts allow-same-origin"
 );
 
 AntiTracking.runTest("Verify that sandboxed contexts with" +
                      " allow-storage-access-by-user-activation get the" +
                      " saved permission",
   // blocking callback
   async _ => {
-    await hasStorageAccessInitially();
+    let hasAccess = await document.hasStorageAccess();
+    ok(hasAccess, "Has storage access");
 
     localStorage.foo = 42;
     ok(true, "LocalStorage can be used!");
   },
 
   null, // non-blocking callback
   null, // cleanup function
   [["dom.storage_access.enabled", true]], // extra prefs
   false, // no window open test
   false, // no user-interaction test
   false, // no blocking notifications
   false, // run in normal window
-  "allow-scripts allow-same-origin allow-popups allow-storage-access-by-user-activation"
+  "allow-scripts allow-same-origin allow-storage-access-by-user-activation"
 );
 
 AntiTracking.runTest("Verify that private browsing contexts don't get the saved permission",
   // blocking callback
   async _ => {
-    await noStorageAccessInitially();
+    let hasAccess = await document.hasStorageAccess();
+    ok(!hasAccess, "Doesn't yet have storage access");
 
     try {
       localStorage.foo = 42;
       ok(false, "LocalStorage cannot be used!");
     } catch (e) {
       ok(true, "LocalStorage cannot be used!");
       is(e.name, "SecurityError", "We want a security error message.");
     }
@@ -131,17 +158,18 @@ AntiTracking.runTest("Verify that privat
   true, // run in private window
   null // iframe sandbox
 );
 
 AntiTracking.runTest("Verify that non-sandboxed contexts get the" +
                      " saved permission",
   // blocking callback
   async _ => {
-    await hasStorageAccessInitially();
+    let hasAccess = await document.hasStorageAccess();
+    ok(hasAccess, "Has storage access");
 
     localStorage.foo = 42;
     ok(true, "LocalStorage can be used!");
   },
 
   null, // non-blocking callback
   // cleanup function
   async _ => {
--- a/toolkit/components/antitracking/test/browser/browser_storageAccessWithHeuristics.js
+++ b/toolkit/components/antitracking/test/browser/browser_storageAccessWithHeuristics.js
@@ -31,21 +31,23 @@ add_task(async function testWindowOpenHe
   await BrowserTestUtils.browserLoaded(browser);
 
   info("Loading tracking scripts");
   await ContentTask.spawn(browser, {
                                      page: TEST_3RD_PARTY_PAGE_WO,
                                    }, async obj => {
     let msg = {};
     msg.blockingCallback = (async _ => {
-      await noStorageAccessInitially();
+      let hasAccess = await document.hasStorageAccess();
+      ok(!hasAccess, "Doesn't yet have storage access");
     }).toString();
 
     msg.nonBlockingCallback = (async _ => {
-      await hasStorageAccessInitially();
+      let hasAccess = await document.hasStorageAccess();
+      ok(hasAccess, "Now obtained storage access");
     }).toString();
 
     info("Checking if storage access is denied");
     await new content.Promise(resolve => {
       let ifr = content.document.createElement("iframe");
       ifr.onload = function() {
         info("Sending code to the 3rd party content");
         ifr.contentWindow.postMessage(msg, "*");
@@ -99,105 +101,23 @@ add_task(async function testUserInteract
 
   info("Loading tracking scripts");
   await ContentTask.spawn(browser, {
                                      page: TEST_3RD_PARTY_PAGE_UI,
                                      popup: TEST_POPUP_PAGE,
                                    }, async obj => {
     let msg = {};
     msg.blockingCallback = (async _ => {
-      await noStorageAccessInitially();
-    }).toString();
-
-    info("Checking if storage access is denied");
-
-    let ifr = content.document.createElement("iframe");
-    let loading = new content.Promise(resolve => { ifr.onload = resolve; });
-    content.document.body.appendChild(ifr);
-    ifr.src = obj.page;
-    await loading;
-
-    info("The 3rd party content should not have access to first party storage.");
-    await new content.Promise(resolve => {
-      content.addEventListener("message", function msg(event) {
-        if (event.data.type == "finish") {
-          content.removeEventListener("message", msg);
-          resolve();
-          return;
-        }
-
-        if (event.data.type == "ok") {
-          ok(event.data.what, event.data.msg);
-          return;
-        }
-
-        if (event.data.type == "info") {
-          info(event.data.msg);
-          return;
-        }
-
-        ok(false, "Unknown message");
-      });
-      ifr.contentWindow.postMessage({ callback: msg.blockingCallback }, "*");
-    });
-
-    let windowClosed = new content.Promise(resolve => {
-      Services.ww.registerNotification(function notification(aSubject, aTopic, aData) {
-        if (aTopic == "domwindowclosed") {
-          Services.ww.unregisterNotification(notification);
-          resolve();
-        }
-      });
-    });
-
-    info("Opening a window from the iframe.");
-    ifr.contentWindow.open(obj.popup);
-
-    info("Let's wait for the window to be closed");
-    await windowClosed;
-
-    info("The 3rd party content should have access to first party storage.");
-    await new content.Promise(resolve => {
-      content.addEventListener("message", function msg(event) {
-        if (event.data.type == "finish") {
-          content.removeEventListener("message", msg);
-          resolve();
-          return;
-        }
-
-        if (event.data.type == "ok") {
-          ok(event.data.what, event.data.msg);
-          return;
-        }
-
-        if (event.data.type == "info") {
-          info(event.data.msg);
-          return;
-        }
-
-        ok(false, "Unknown message");
-      });
-      ifr.contentWindow.postMessage({ callback: msg.blockingCallback }, "*");
-    });
-  });
-
-  await AntiTracking.interactWithTracker();
-
-  info("Loading tracking scripts");
-  await ContentTask.spawn(browser, {
-                                     page: TEST_3RD_PARTY_PAGE_UI,
-                                     popup: TEST_POPUP_PAGE,
-                                   }, async obj => {
-    let msg = {};
-    msg.blockingCallback = (async _ => {
-      await noStorageAccessInitially();
+      let hasAccess = await document.hasStorageAccess();
+      ok(!hasAccess, "Doesn't yet have storage access");
     }).toString();
 
     msg.nonBlockingCallback = (async _ => {
-      await hasStorageAccessInitially();
+      let hasAccess = await document.hasStorageAccess();
+      ok(hasAccess, "Now obtained storage access");
     }).toString();
 
     info("Checking if storage access is denied");
 
     let ifr = content.document.createElement("iframe");
     let loading = new content.Promise(resolve => { ifr.onload = resolve; });
     content.document.body.appendChild(ifr);
     ifr.src = obj.page;
--- a/toolkit/components/antitracking/test/browser/head.js
+++ b/toolkit/components/antitracking/test/browser/head.js
@@ -350,31 +350,16 @@ this.AntiTracking = {
         this._createUserInteractionTask(name, callbackTracking, callbackNonTracking,
                                         runInPrivateWindow, iframeSandbox,
                                         expectedBlockingNotifications, extraPrefs);
         this._createCleanupTask(cleanupFunction);
       }
     }
   },
 
-  async interactWithTracker() {
-    let windowClosed = new Promise(resolve => {
-      Services.ww.registerNotification(function notification(aSubject, aTopic, aData) {
-        if (aTopic == "domwindowclosed") {
-          Services.ww.unregisterNotification(notification);
-          resolve();
-        }
-      });
-    });
-
-    info("Let's interact with the tracker");
-    window.open(TEST_3RD_PARTY_DOMAIN + TEST_PATH + "3rdPartyOpenUI.html");
-    await windowClosed;
-  },
-
   async _setupTest(win, cookieBehavior, blockingByContentBlocking,
                    blockingByContentBlockingRTUI,
                    extraPrefs) {
     await SpecialPowers.flushPrefEnv();
     await SpecialPowers.pushPrefEnv({"set": [
       ["dom.storage_access.enabled", true],
       ["browser.contentblocking.allowlist.annotations.enabled", blockingByContentBlockingRTUI],
       ["browser.contentblocking.allowlist.storage.enabled", blockingByContentBlockingRTUI],
@@ -421,69 +406,58 @@ this.AntiTracking = {
           if (state & Ci.nsIWebProgressListener.STATE_COOKIES_BLOCKED_TRACKER) {
             ++cookieBlocked;
           }
           let contentBlockingLog = {};
           try {
             contentBlockingLog = JSON.parse(contentBlockingLogJSON);
           } catch (e) {
           }
-
-          let trackerInteractionHelper = false;
-          if (request) {
-            request.QueryInterface(Ci.nsIChannel);
-            trackerInteractionHelper = request.URI.spec.endsWith("?messageme");
-          }
-
           // If this is the first cookie to be blocked, our state should have
           // just changed, otherwise it should have previously contained the
           // STATE_COOKIES_BLOCKED_TRACKER bit too.
           if (options.expectedBlockingNotifications && cookieBlocked &&
-              !options.allowList && !trackerInteractionHelper) {
+              !options.allowList) {
             if (cookieBlocked == 1) {
               is(oldState & Ci.nsIWebProgressListener.STATE_COOKIES_BLOCKED_TRACKER, 0,
                  "When blocking the first cookie, old state should not have had the " +
                  "STATE_COOKIES_BLOCKED_TRACKER bit");
             }
 
+            let trackerOriginCount = 0;
             for (let trackerOrigin in contentBlockingLog) {
+              ++trackerOriginCount;
               is(trackerOrigin, TEST_3RD_PARTY_DOMAIN, "Correct tracker origin must be reported");
               let originLog = contentBlockingLog[trackerOrigin];
               if (originLog.length == 1) {
                 is(originLog[0][0], Ci.nsIWebProgressListener.STATE_COOKIES_BLOCKED_TRACKER,
                    "Correct blocking type reported");
                 is(originLog[0][1], true,
                    "Correct blocking status reported");
                 ok(originLog[0][2] >= 1,
                    "Correct repeat count reported");
               } else {
                 // This branch is needed here because of the tests that use the storage
                 // access API to gain storage access.
                 is(originLog.length, 2, "Correct origin log length");
-                if (originLog.length > 2) {
-                  console.log(originLog);
-                  console.log(originLog.toSource());
-                }
                 is(originLog[0][0], Ci.nsIWebProgressListener.STATE_COOKIES_BLOCKED_TRACKER,
                    "Correct blocking type reported");
                 is(originLog[0][1], true,
                    "Correct blocking status reported");
                 ok(originLog[0][2] >= 1,
                    "Correct repeat count reported");
                 is(originLog[1][0], Ci.nsIWebProgressListener.STATE_COOKIES_BLOCKED_TRACKER,
                    "Correct blocking type reported");
                 is(originLog[1][1], false,
                    "Correct blocking status reported");
                 is(originLog[1][2], 1,
                    "Correct repeat count reported");
               }
             }
-            // Can't assert the number of tracker origins because we may get 0
-            // for web progress navigations coming from the window opening from
-            // storage access API tracker interaction attempts...
+            is(trackerOriginCount, 1, "Should only report one tracker origin");
           }
           if (!options.expectedBlockingNotifications) {
             is(oldState & Ci.nsIWebProgressListener.STATE_COOKIES_BLOCKED_TRACKER, 0,
                "When not blocking, old state should not have had the " +
                "STATE_COOKIES_BLOCKED_TRACKER bit");
             is(Object.keys(contentBlockingLog).length, 0,
                "Content blocking log JSON must be empty");
           }
@@ -787,16 +761,17 @@ this.AntiTracking = {
       let browser = win.gBrowser.getBrowserForTab(tab);
       await BrowserTestUtils.browserLoaded(browser);
 
       info("Creating a 3rd party content");
       await ContentTask.spawn(browser,
                               { page: TEST_3RD_PARTY_PAGE_UI,
                                 popup: TEST_POPUP_PAGE,
                                 blockingCallback: blockingCallback.toString(),
+                                nonBlockingCallback: nonBlockingCallback.toString(),
                                 iframeSandbox,
                               },
                               async function(obj) {
         let ifr = content.document.createElement("iframe");
         let loading = new content.Promise(resolve => { ifr.onload = resolve; });
         if (typeof obj.iframeSandbox == "string") {
           ifr.setAttribute("sandbox", obj.iframeSandbox);
         }
@@ -838,76 +813,17 @@ this.AntiTracking = {
         });
 
         info("Opening a window from the iframe.");
         ifr.contentWindow.open(obj.popup);
 
         info("Let's wait for the window to be closed");
         await windowClosed;
 
-        info("First time, the 3rd party content should not have access to first party storage " +
-             "because the tracker did not have user interaction");
-        await new content.Promise(resolve => {
-          content.addEventListener("message", function msg(event) {
-            if (event.data.type == "finish") {
-              content.removeEventListener("message", msg);
-              resolve();
-              return;
-            }
-
-            if (event.data.type == "ok") {
-              ok(event.data.what, event.data.msg);
-              return;
-            }
-
-            if (event.data.type == "info") {
-              info(event.data.msg);
-              return;
-            }
-
-            ok(false, "Unknown message");
-          });
-          ifr.contentWindow.postMessage({ callback: obj.blockingCallback }, "*");
-        });
-      });
-
-      await AntiTracking.interactWithTracker();
-
-      await ContentTask.spawn(browser,
-                              { page: TEST_3RD_PARTY_PAGE_UI,
-                                popup: TEST_POPUP_PAGE,
-                                nonBlockingCallback: nonBlockingCallback.toString(),
-                                iframeSandbox,
-                              },
-                              async function(obj) {
-        let ifr = content.document.createElement("iframe");
-        let loading = new content.Promise(resolve => { ifr.onload = resolve; });
-        if (typeof obj.iframeSandbox == "string") {
-          ifr.setAttribute("sandbox", obj.iframeSandbox);
-        }
-        content.document.body.appendChild(ifr);
-        ifr.src = obj.page;
-        await loading;
-
-        let windowClosed = new content.Promise(resolve => {
-          Services.ww.registerNotification(function notification(aSubject, aTopic, aData) {
-            if (aTopic == "domwindowclosed") {
-              Services.ww.unregisterNotification(notification);
-              resolve();
-            }
-          });
-        });
-
-        info("Opening a window from the iframe.");
-        ifr.contentWindow.open(obj.popup);
-
-        info("Let's wait for the window to be closed");
-        await windowClosed;
-
-        info("The 3rd party content should now have access to first party storage.");
+        info("The 3rd party content should have access to first party storage.");
         await new content.Promise(resolve => {
           content.addEventListener("message", function msg(event) {
             if (event.data.type == "finish") {
               content.removeEventListener("message", msg);
               resolve();
               return;
             }
 
deleted file mode 100644
--- a/toolkit/components/antitracking/test/browser/storageAccessAPIHelpers.js
+++ /dev/null
@@ -1,152 +0,0 @@
-async function hasStorageAccessInitially() {
-  let hasAccess = await document.hasStorageAccess();
-  ok(hasAccess, "Has storage access");
-}
-
-async function noStorageAccessInitially() {
-  let hasAccess = await document.hasStorageAccess();
-  ok(!hasAccess, "Doesn't yet have storage access");
-}
-
-async function callRequestStorageAccess(callback) {
-  let dwu = SpecialPowers.getDOMWindowUtils(window);
-  let helper = dwu.setHandlingUserInput(true);
-
-  let success = true;
-  // We only grant storage exceptions when the reject tracker behavior is enabled.
-  let rejectTrackers = SpecialPowers.Services.prefs.getIntPref("network.cookie.cookieBehavior") ==
-                         SpecialPowers.Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER &&
-                       SpecialPowers.Services.prefs.getBoolPref("browser.contentblocking.enabled") &&
-                       !isOnContentBlockingAllowList();
-  if (rejectTrackers) {
-    let p;
-    let threw = false;
-    try {
-      p = document.requestStorageAccess();
-    } catch(e) {
-      threw = true;
-    } finally {
-      helper.destruct();
-    }
-    ok(!threw, "requestStorageAccess should not throw");
-    try {
-      if (callback) {
-        await p.then(_ => callback(dwu));
-      } else {
-        await p;
-      }
-    } catch(e) {
-      success = false;
-    }
-    ok(!success, "Should not have worked without user interaction");
-
-    await noStorageAccessInitially();
-
-    await interactWithTracker();
-
-    helper = dwu.setHandlingUserInput(true);
-  }
-  if (SpecialPowers.Services.prefs.getIntPref("network.cookie.cookieBehavior") ==
-        SpecialPowers.Ci.nsICookieService.BEHAVIOR_ACCEPT &&
-      !isOnContentBlockingAllowList()) {
-    try {
-      if (callback) {
-        await document.requestStorageAccess().then(_ => callback(dwu));
-      } else {
-        await document.requestStorageAccess();
-      }
-    } catch(e) {
-      success = false;
-    } finally {
-      helper.destruct();
-    }
-    ok(success, "Should not have thrown");
-
-    await noStorageAccessInitially();
-
-    await interactWithTracker();
-
-    helper = dwu.setHandlingUserInput(true);
-  }
-
-  let p;
-  let threw = false;
-  try {
-    p = document.requestStorageAccess();
-  } catch (e) {
-    threw = true;
-  } finally {
-    helper.destruct();
-  }
-  let rejected = false;
-  try {
-    if (callback) {
-      await p.then(_ => callback(dwu));
-    } else {
-      await p;
-    }
-  } catch (e) {
-    rejected = true;
-  }
-
-  success = rejectTrackers && !threw && !rejected;
-  let hasAccess = await document.hasStorageAccess();
-  is(hasAccess, success,
-     "Should " + (success ? "" : "not ") + "have storage access now");
-  if (success) {
-    // Wait until the permission is visible in our process to avoid race
-    // conditions.
-    await waitUntilPermission("http://example.net/browser/toolkit/components/antitracking/test/browser/page.html",
-                              "3rdPartyStorage^https://tracking.example.org");
-  }
-
-  return [threw, rejected];
-}
-
-async function waitUntilPermission(url, name) {
-  await new Promise(resolve => {
-    let id = setInterval(_ => {
-      let Services = SpecialPowers.Services;
-      let uri = Services.io.newURI(url);
-      if (Services.perms.testPermission(uri, name) ==
-            Services.perms.ALLOW_ACTION) {
-        clearInterval(id);
-        resolve();
-      }
-    }, 0);
-  });
-}
-
-async function interactWithTracker() {
-  await new Promise(resolve => {
-    onmessage = resolve;
-
-    info("Let's interact with the tracker");
-    window.open("https://tracking.example.org/browser/toolkit/components/antitracking/test/browser/3rdPartyOpenUI.html?messageme");
-  });
-
-  // Wait until the user interaction permission becomes visible in our process
-  await waitUntilPermission("https://tracking.example.org",
-                            "storageAccessAPI");
-}
-
-function isOnContentBlockingAllowList() {
-  let prefs = ["browser.contentblocking.allowlist.storage.enabled",
-               "browser.contentblocking.allowlist.annotations.enabled"];
-  function allEnabled(prev, pref) {
-    return pref &&
-           SpecialPowers.Services.prefs.getBoolPref(pref);
-  }
-  if (!prefs.reduce(allEnabled)) {
-    return false;
-  }
-
-  let url = new URL(SpecialPowers.wrap(top).location.href);
-  let origin = SpecialPowers.Services.io.newURI("https://" + url.host);
-  let types = ["trackingprotection", "trackingprotection-pb"];
-  return types.some(type => {
-    return SpecialPowers.Services.perms.testPermission(origin, type) ==
-             SpecialPowers.Services.perms.ALLOW_ACTION;
-  });
-}
-