Files
sousa-gecko/testing/web-platform/tests/fenced-frame/show-open-file-picker.https.html
T
Blink WPT Bot 73db1095d7 Bug 1925636 [wpt PR 48701] - Reland "Fenced frame: Fix some WPTs in headless mode.", a=testonly
Automatic update from web-platform-tests
Reland "Fenced frame: Fix some WPTs in headless mode." (#48701)

The original CL was crashing in an instance where multiClick() was
invoked without an await. This fixes the crash by awaiting the clicks
instead of continuing with/finishing the test before all the clicks
have propagated inside navigate-ancestor-test-runner.https.html.

Original change's description:
> Fenced frame: Fix some WPTs in headless mode.
>
> There is currently a push to allow Chromium web platform tests to run
> in headless mode (i.e. without a content shell). This requires some
> changes to how fenced frame tests work. Headless mode does not support
> test_driver functions from inside of fenced frames, as those require
> access to the main frame's window to pass the message onto, which
> fenced frames deliberately block for privacy reasons. This CL fixes
> some of the tests that fail in headless mode by moving those
> test_driver calls to the main frame, specifically clicking actions
> (which we already have multiClick() to handle this in main frames),
> and set_permission().
>
> See the headless mode explainer:
> https://chromium.googlesource.com/chromium/src/+/HEAD/headless/README.md
>
> Change-Id: Iab82a581b67f8f8851c7716a2d72caf566f3b2ae
> Bug: 366257368
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5935060
> Reviewed-by: Andrew Verge <averge@chromium.org>
> Commit-Queue: Liam Brady <lbrady@google.com>
> Cr-Commit-Position: refs/heads/main@{#1370151}

Bug: 366257368
Change-Id: Id998687c2f3de41a7b0dcd5197ba74fb22ef979e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5938155
Reviewed-by: Andrew Verge <averge@chromium.org>
Commit-Queue: Liam Brady <lbrady@google.com>
Cr-Commit-Position: refs/heads/main@{#1370703}

Co-authored-by: Liam Brady <lbrady@google.com>
--

wpt-commits: f50cf7fbd84ccdf90f6973b8ce7d75175adb3dc1
wpt-pr: 48701
2024-10-22 23:41:34 +00:00

33 lines
1.2 KiB
HTML

<!DOCTYPE html>
<title>showOpenFilePicker API test</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script src="resources/utils.js"></script>
<script src="/common/utils.js"></script>
<script src="/common/dispatcher/dispatcher.js"></script>
<script src="/resources/testdriver-actions.js"></script>
<body>
<script>
promise_test(async () => {
const frame = attachFencedFrameContext();
await multiClick(10, 10, frame.element);
const result = await frame.execute(async () => {
try {
const dir = await window.showOpenFilePicker();
return 'opened file picker';
} catch (e) {
if (e.name === 'SecurityError' &&
e.message === "Failed to execute 'showOpenFilePicker' on 'Window': Cross origin sub frames aren't allowed to show a file picker.") {
return 'Access to the open file picker was disallowed';
}
return `showOpenFilePicker failed with unknown error ${e.name} ${e.message}`;
}
});
assert_equals(result, 'Access to the open file picker was disallowed');
}, 'Directory information should not be read in the fenced frame.');
</script>
</body>