Remove unnecessary `rootdocument` parameter

Change-Id: I9dfcd7041e0eaab91bb7a40e5dbc6169d018c13b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4284640
Auto-Submit: Chris Fredrickson <cfredric@chromium.org>
Reviewed-by: Matt Reichhoff <mreichhoff@chromium.org>
Commit-Queue: Matt Reichhoff <mreichhoff@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1108936}
diff --git a/storage-access-api/hasStorageAccess-insecure.sub.window.js b/storage-access-api/hasStorageAccess-insecure.sub.window.js
index 334d1d6..2f9f9f4 100644
--- a/storage-access-api/hasStorageAccess-insecure.sub.window.js
+++ b/storage-access-api/hasStorageAccess-insecure.sub.window.js
@@ -31,16 +31,16 @@
   // of various iFrames
 
   // Create a test with a single-child same-origin iframe.
-  RunTestsInIFrame("resources/hasStorageAccess-iframe.html?testCase=same-origin-frame&rootdocument=false");
+  RunTestsInIFrame("resources/hasStorageAccess-iframe.html?testCase=same-origin-frame");
 
   // Create a test with a single-child cross-origin iframe.
-  RunTestsInIFrame("http://{{domains[www]}}:{{ports[http][0]}}/storage-access-api/resources/hasStorageAccess-iframe.html?testCase=cross-origin-frame&rootdocument=false");
+  RunTestsInIFrame("http://{{domains[www]}}:{{ports[http][0]}}/storage-access-api/resources/hasStorageAccess-iframe.html?testCase=cross-origin-frame");
 
   // Validate the nested-iframe scenario where the same-origin frame containing
   // the tests is not the first child.
-  RunTestsInNestedIFrame("resources/hasStorageAccess-iframe.html?testCase=nested-same-origin-frame&rootdocument=false");
+  RunTestsInNestedIFrame("resources/hasStorageAccess-iframe.html?testCase=nested-same-origin-frame");
 
   // Validate the nested-iframe scenario where the cross-origin frame containing
   //  the tests is not the first child.
-  RunTestsInNestedIFrame("http://{{domains[www]}}:{{ports[http][0]}}/storage-access-api/resources/hasStorageAccess-iframe.html?testCase=nested-cross-origin-frame&rootdocument=false");
+  RunTestsInNestedIFrame("http://{{domains[www]}}:{{ports[http][0]}}/storage-access-api/resources/hasStorageAccess-iframe.html?testCase=nested-cross-origin-frame");
 }
diff --git a/storage-access-api/hasStorageAccess.sub.https.window.js b/storage-access-api/hasStorageAccess.sub.https.window.js
index f7796c5..d2345b7 100644
--- a/storage-access-api/hasStorageAccess.sub.https.window.js
+++ b/storage-access-api/hasStorageAccess.sub.https.window.js
@@ -35,16 +35,16 @@
   // of various iFrames
 
   // Create a test with a single-child same-origin iframe.
-  RunTestsInIFrame("resources/hasStorageAccess-iframe.https.html?testCase=same-origin-frame&rootdocument=false");
+  RunTestsInIFrame("resources/hasStorageAccess-iframe.https.html?testCase=same-origin-frame");
 
   // Create a test with a single-child cross-origin iframe.
-  RunTestsInIFrame("https://{{domains[www]}}:{{ports[https][0]}}/storage-access-api/resources/hasStorageAccess-iframe.https.html?testCase=cross-origin-frame&rootdocument=false");
+  RunTestsInIFrame("https://{{domains[www]}}:{{ports[https][0]}}/storage-access-api/resources/hasStorageAccess-iframe.https.html?testCase=cross-origin-frame");
 
   // Validate the nested-iframe scenario where the same-origin frame containing
   // the tests is not the first child.
-  RunTestsInNestedIFrame("resources/hasStorageAccess-iframe.https.html?testCase=nested-same-origin-frame&rootdocument=false");
+  RunTestsInNestedIFrame("resources/hasStorageAccess-iframe.https.html?testCase=nested-same-origin-frame");
 
   // Validate the nested-iframe scenario where the cross-origin frame containing
   //  the tests is not the first child.
-  RunTestsInNestedIFrame("https://{{domains[www]}}:{{ports[https][0]}}/storage-access-api/resources/hasStorageAccess-iframe.https.html?testCase=nested-cross-origin-frame&rootdocument=false");
+  RunTestsInNestedIFrame("https://{{domains[www]}}:{{ports[https][0]}}/storage-access-api/resources/hasStorageAccess-iframe.https.html?testCase=nested-cross-origin-frame");
 }
diff --git a/storage-access-api/helpers.js b/storage-access-api/helpers.js
index bb8f1e7..4df0b4a 100644
--- a/storage-access-api/helpers.js
+++ b/storage-access-api/helpers.js
@@ -5,7 +5,7 @@
   const queryParams = url.searchParams;
   return {
     secure: url.protocol === "https:",
-    topLevelDocument: queryParams.get("rootdocument") != "false",
+    topLevelDocument: window === window.top,
     testPrefix: queryParams.get("testCase") || "top-level-context",
   };
 }
diff --git a/storage-access-api/requestStorageAccess-cross-origin-iframe.sub.https.window.js b/storage-access-api/requestStorageAccess-cross-origin-iframe.sub.https.window.js
index 2367afd..9183832 100644
--- a/storage-access-api/requestStorageAccess-cross-origin-iframe.sub.https.window.js
+++ b/storage-access-api/requestStorageAccess-cross-origin-iframe.sub.https.window.js
@@ -5,5 +5,5 @@
 
 (async function() {
   // Create a test with a single-child cross-origin iframe.
-  RunTestsInIFrame('https://{{domains[www]}}:{{ports[https][0]}}/storage-access-api/resources/requestStorageAccess-iframe.https.html?testCase=cross-origin-frame&rootdocument=false');
+  RunTestsInIFrame('https://{{domains[www]}}:{{ports[https][0]}}/storage-access-api/resources/requestStorageAccess-iframe.https.html?testCase=cross-origin-frame');
 })();
diff --git a/storage-access-api/requestStorageAccess-cross-site-iframe.sub.https.window.js b/storage-access-api/requestStorageAccess-cross-site-iframe.sub.https.window.js
index f7c35ca..53f90de 100644
--- a/storage-access-api/requestStorageAccess-cross-site-iframe.sub.https.window.js
+++ b/storage-access-api/requestStorageAccess-cross-site-iframe.sub.https.window.js
@@ -5,5 +5,5 @@
 
 (async function() {
   // Create a test with a single-child cross-site iframe.
-  RunTestsInIFrame('https://{{hosts[alt][www]}}:{{ports[https][0]}}/storage-access-api/resources/requestStorageAccess-iframe.https.html?testCase=cross-site-frame&rootdocument=false');
+  RunTestsInIFrame('https://{{hosts[alt][www]}}:{{ports[https][0]}}/storage-access-api/resources/requestStorageAccess-iframe.https.html?testCase=cross-site-frame');
 })();
diff --git a/storage-access-api/requestStorageAccess-insecure.sub.window.js b/storage-access-api/requestStorageAccess-insecure.sub.window.js
index f845f06..34d275b 100644
--- a/storage-access-api/requestStorageAccess-insecure.sub.window.js
+++ b/storage-access-api/requestStorageAccess-insecure.sub.window.js
@@ -43,21 +43,21 @@
 
   // Create a test with a single-child same-origin iframe.
   const sameOriginFramePromise = RunTestsInIFrame(
-      'resources/requestStorageAccess-iframe.html?testCase=same-origin-frame&rootdocument=false');
+      'resources/requestStorageAccess-iframe.html?testCase=same-origin-frame');
 
   // Create a test with a single-child cross-origin iframe.
   const crossOriginFramePromise = RunTestsInIFrame(
-      'http://{{domains[www]}}:{{ports[http][0]}}/storage-access-api/resources/requestStorageAccess-iframe.html?testCase=cross-origin-frame&rootdocument=false');
+      'http://{{domains[www]}}:{{ports[http][0]}}/storage-access-api/resources/requestStorageAccess-iframe.html?testCase=cross-origin-frame');
 
   // Validate the nested-iframe scenario where the same-origin frame
   // containing the tests is not the first child.
   const nestedSameOriginFramePromise = RunTestsInNestedIFrame(
-      'resources/requestStorageAccess-iframe.html?testCase=nested-same-origin-frame&rootdocument=false');
+      'resources/requestStorageAccess-iframe.html?testCase=nested-same-origin-frame');
 
   // Validate the nested-iframe scenario where the cross-origin frame
   // containing the tests is not the first child.
   const nestedCrossOriginFramePromise = RunTestsInNestedIFrame(
-      'http://{{domains[www]}}:{{ports[http][0]}}/storage-access-api/resources/requestStorageAccess-iframe.html?testCase=nested-cross-origin-frame&rootdocument=false');
+      'http://{{domains[www]}}:{{ports[http][0]}}/storage-access-api/resources/requestStorageAccess-iframe.html?testCase=nested-cross-origin-frame');
 
   // Because the iframe tests expect no user activation, and because they
   // load asynchronously, we want to first run those tests before simulating
diff --git a/storage-access-api/requestStorageAccess-nested-cross-origin-iframe.sub.https.window.js b/storage-access-api/requestStorageAccess-nested-cross-origin-iframe.sub.https.window.js
index e79148b..eeac9c2 100644
--- a/storage-access-api/requestStorageAccess-nested-cross-origin-iframe.sub.https.window.js
+++ b/storage-access-api/requestStorageAccess-nested-cross-origin-iframe.sub.https.window.js
@@ -6,5 +6,5 @@
 (async function() {
   // Validate the nested-iframe scenario where the cross-origin frame
   // containing the tests is not the first child.
-  RunTestsInNestedIFrame('https://{{domains[www]}}:{{ports[https][0]}}/storage-access-api/resources/requestStorageAccess-iframe.https.html?testCase=nested-cross-origin-frame&rootdocument=false');
+  RunTestsInNestedIFrame('https://{{domains[www]}}:{{ports[https][0]}}/storage-access-api/resources/requestStorageAccess-iframe.https.html?testCase=nested-cross-origin-frame');
 })();
diff --git a/storage-access-api/requestStorageAccess-nested-cross-site-iframe.sub.https.window.js b/storage-access-api/requestStorageAccess-nested-cross-site-iframe.sub.https.window.js
index f3ac0e8..59442d9 100644
--- a/storage-access-api/requestStorageAccess-nested-cross-site-iframe.sub.https.window.js
+++ b/storage-access-api/requestStorageAccess-nested-cross-site-iframe.sub.https.window.js
@@ -6,5 +6,5 @@
 (async function() {
   // Validate the nested-iframe scenario where the cross-site frame
   // containing the tests is not the first child.
-  RunTestsInNestedIFrame('https://{{hosts[alt][www]}}:{{ports[https][0]}}/storage-access-api/resources/requestStorageAccess-iframe.https.html?testCase=nested-cross-site-frame&rootdocument=false');
+  RunTestsInNestedIFrame('https://{{hosts[alt][www]}}:{{ports[https][0]}}/storage-access-api/resources/requestStorageAccess-iframe.https.html?testCase=nested-cross-site-frame');
 })();
diff --git a/storage-access-api/requestStorageAccess-nested-same-origin-iframe.sub.https.window.js b/storage-access-api/requestStorageAccess-nested-same-origin-iframe.sub.https.window.js
index b3847bb..24d82c4 100644
--- a/storage-access-api/requestStorageAccess-nested-same-origin-iframe.sub.https.window.js
+++ b/storage-access-api/requestStorageAccess-nested-same-origin-iframe.sub.https.window.js
@@ -5,4 +5,4 @@
 
 // Validate the nested-iframe scenario where the same-origin frame
 // containing the tests is not the first child.
-RunTestsInNestedIFrame('resources/requestStorageAccess-iframe.https.html?testCase=nested-same-origin-frame&rootdocument=false');
+RunTestsInNestedIFrame('resources/requestStorageAccess-iframe.https.html?testCase=nested-same-origin-frame');
diff --git a/storage-access-api/requestStorageAccess-same-origin-iframe.sub.https.window.js b/storage-access-api/requestStorageAccess-same-origin-iframe.sub.https.window.js
index 9c41d6c..1aa5d4e 100644
--- a/storage-access-api/requestStorageAccess-same-origin-iframe.sub.https.window.js
+++ b/storage-access-api/requestStorageAccess-same-origin-iframe.sub.https.window.js
@@ -4,4 +4,4 @@
 'use strict';
 
 // Create a test with a single-child same-origin iframe.
-RunTestsInIFrame('resources/requestStorageAccess-iframe.html?testCase=same-origin-frame&rootdocument=false');
+RunTestsInIFrame('resources/requestStorageAccess-iframe.html?testCase=same-origin-frame');
diff --git a/storage-access-api/requestStorageAccess.sub.https.window.js b/storage-access-api/requestStorageAccess.sub.https.window.js
index 061c87f..08eef37 100644
--- a/storage-access-api/requestStorageAccess.sub.https.window.js
+++ b/storage-access-api/requestStorageAccess.sub.https.window.js
@@ -12,7 +12,7 @@
 // don't want to recurse forever.
 const {testPrefix, topLevelDocument} = processQueryParams();
 
-if (window !== window.top) {
+if (!topLevelDocument) {
   // WPT synthesizes a top-level HTML test for this JS file, and in that case we
   // don't want to, or need to, call set_test_context.
   test_driver.set_test_context(window.top);