From d22edced497cfb8eaf3572a3c29b84fb1115a54d Mon Sep 17 00:00:00 2001 From: Nathan Memmott Date: Wed, 2 Oct 2024 16:46:17 -0700 Subject: [PATCH] FSA: Fix more manual WPTs Two tests were using await in a non-async function. And a test helper was using newAnonymousIframe which was updated at some point to newIframeCredentialless. Bug: 346991169 Change-Id: I4333b6abee03ed48cf0d10d3417a2c15fba06d30 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5906718 Commit-Queue: Nathan Memmott Reviewed-by: Ayu Ishii Cr-Commit-Position: refs/heads/main@{#1363384} --- ...ndle-partitioned-manual.https.tentative.html | 8 ++++---- ...ndle-partitioned-manual.https.tentative.html | 8 ++++---- .../resources/local-fs-test-helpers.js | 17 ++++++++++------- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/file-system-access/local_FileSystemDirectoryHandle-partitioned-manual.https.tentative.html b/file-system-access/local_FileSystemDirectoryHandle-partitioned-manual.https.tentative.html index 3422914e23d7c1..3f1e82fde9e6a5 100644 --- a/file-system-access/local_FileSystemDirectoryHandle-partitioned-manual.https.tentative.html +++ b/file-system-access/local_FileSystemDirectoryHandle-partitioned-manual.https.tentative.html @@ -60,7 +60,7 @@ // To be resilient against tests not cleaning up properly, cleanup before // every test. -function clearDirectories() { +async function clearDirectories() { const directory = await directory_promise; for await (let entry of directory.values()) { await directory.removeEntry( @@ -72,7 +72,7 @@ // that send assertion scripts to multiple executor subframes. framed_test(async (t, sendTo) => { - clearDirectories(); + await clearDirectories(); // Ensure we have directory picker access in all child contexts. await sendTo(childContexts, setUpChildFrame); await sendTo(sameSiteContexts, assertNumEntries(0)); @@ -85,7 +85,7 @@ }, 'getDirectoryHandle can access handles across same-site contexts.'); framed_test(async (t, sendTo) => { - clearDirectories(); + await clearDirectories(); // Ensure we have directory picker access in all child contexts. await sendTo(childContexts, setUpChildFrame); await sendTo(sameSiteContexts, assertNumEntries(0)); @@ -101,7 +101,7 @@ }, 'Directory handles can be removed from other same-site contexts.'); framed_test(async (t, sendTo) => { - clearDirectories(); + await clearDirectories(); // Ensure we have directory picker access in all child contexts. await sendTo(childContexts, setUpChildFrame); // Assert that an error is raised when attempting to access diff --git a/file-system-access/local_FileSystemFileHandle-partitioned-manual.https.tentative.html b/file-system-access/local_FileSystemFileHandle-partitioned-manual.https.tentative.html index 0aefd9eca396b5..9f982bb8dbf4a4 100644 --- a/file-system-access/local_FileSystemFileHandle-partitioned-manual.https.tentative.html +++ b/file-system-access/local_FileSystemFileHandle-partitioned-manual.https.tentative.html @@ -70,7 +70,7 @@ // To be resilient against tests not cleaning up properly, cleanup before // every test. -function clearDirectories() { +async function clearDirectories() { const directory = await directory_promise; for await (let entry of directory.values()) { await directory.removeEntry( @@ -82,7 +82,7 @@ // that send assertion scripts to multiple executor subframes. framed_test(async (t, sendTo) => { - clearDirectories(); + await clearDirectories(); // Ensure we have directory picker access in all child contexts. await sendTo(childContexts, setUpChildFrame); await sendTo(sameSiteContexts, assertNumEntries(0)); @@ -95,7 +95,7 @@ }, 'getFileHandle can access handles across same-site contexts.'); framed_test(async (t, sendTo) => { - clearDirectories(); + await clearDirectories(); // Ensure we have directory picker access in all child frames. await sendTo(childContexts, setUpChildFrame); await sendTo(sameSiteContexts, assertNumEntries(0)); @@ -111,7 +111,7 @@ }, 'File handles can be removed from other same-site contexts.'); framed_test(async (t, sendTo) => { - clearDirectories(); + await clearDirectories(); // Ensure we have directory picker access in all child contexts. await sendTo(childContexts, setUpChildFrame); // Assert that an error is raised when attempting to access getFileHandle. diff --git a/file-system-access/resources/local-fs-test-helpers.js b/file-system-access/resources/local-fs-test-helpers.js index a4c0b8bdd39f23..dfbd637fa51757 100644 --- a/file-system-access/resources/local-fs-test-helpers.js +++ b/file-system-access/resources/local-fs-test-helpers.js @@ -151,13 +151,14 @@ function framed_test(func, description) { try { // Set up handles to all third party frames. const handles = [ - null, // firstParty - newIframe(same_site_origin), // thirdPartySameSite - null, // thirdPartySameSite_AncestorBit + null, // firstParty + newIframe(same_site_origin), // thirdPartySameSite + null, // thirdPartySameSite_AncestorBit newIframe(cross_site_origin), // thirdPartyCrossSite - newAnonymousIframe(same_site_origin), // anonymousFrameSameSite + newIframeCredentialless(same_site_origin), // anonymousFrameSameSite null, // anonymousFrameSameSite_AncestorBit - newAnonymousIframe(cross_site_origin), // anonymousFrameCrossSite + newIframeCredentialless( + cross_site_origin), // anonymousFrameCrossSite ]; // Set up nested SameSite frames for ancestor bit contexts. const setUpQueue = token(); @@ -165,8 +166,10 @@ function framed_test(func, description) { child_frame_js(same_site_origin, "newIframe", setUpQueue)); handles[FRAME_CONTEXT.thirdPartySameSite_AncestorBit] = await receive(setUpQueue); - send(newAnonymousIframe(cross_site_origin), - child_frame_js(same_site_origin, "newAnonymousIframe", setUpQueue)); + send( + newIframeCredentialless(cross_site_origin), + child_frame_js( + same_site_origin, 'newIframeCredentialless', setUpQueue)); handles[FRAME_CONTEXT.anonymousFrameSameSite_AncestorBit] = await receive(setUpQueue);