Add check for invalid origins - requestStorageAccessFor

Bug: 1505841
Change-Id: Icd117212acaa0f8f1421fdbb9f7e3860af63188e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5085211
Reviewed-by: Dominic Farolino <dom@chromium.org>
Reviewed-by: Chris Fredrickson <cfredric@chromium.org>
Reviewed-by: Ayu Ishii <ayui@chromium.org>
Commit-Queue: Edwin Daniel <edwindaniel@google.com>
Cr-Commit-Position: refs/heads/main@{#1234753}
diff --git a/top-level-storage-access-api/tentative/requestStorageAccessFor.sub.https.window.js b/top-level-storage-access-api/tentative/requestStorageAccessFor.sub.https.window.js
index 8af30c4..dd2975e 100644
--- a/top-level-storage-access-api/tentative/requestStorageAccessFor.sub.https.window.js
+++ b/top-level-storage-access-api/tentative/requestStorageAccessFor.sub.https.window.js
@@ -93,9 +93,9 @@
     '[top-level-context] document.requestStorageAccessFor() should be resolved when called properly with a user gesture and the same origin');
 
 promise_test(
-    async t => {
-      await RunCallbackWithGesture(
-        () => promise_rejects_dom(t, 'NotAllowedError', document.requestStorageAccessFor('bogus-url'),
+   async t =>{
+    await RunCallbackWithGesture(
+      () => promise_rejects_js(t, TypeError, document.requestStorageAccessFor('bogus-url'),
           'document.requestStorageAccessFor() call with bogus URL'));
     },
     '[top-level-context] document.requestStorageAccessFor() should be rejected when called with an invalid origin');