Skip to content

Commit

Permalink
FSA: Fix more manual WPTs
Browse files Browse the repository at this point in the history
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 <memmott@chromium.org>
Reviewed-by: Ayu Ishii <ayui@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1363384}
  • Loading branch information
Nathan Memmott authored and chromium-wpt-export-bot committed Oct 3, 2024
1 parent 1796ea2 commit d22edce
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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));
Expand All @@ -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));
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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));
Expand All @@ -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));
Expand All @@ -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.
Expand Down
17 changes: 10 additions & 7 deletions file-system-access/resources/local-fs-test-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,22 +151,25 @@ 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();
send(newIframe(cross_site_origin),
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);

Expand Down

0 comments on commit d22edce

Please sign in to comment.