Files
Andrew Williams 4dd4f8fb6d Bug 2000643 [wpt PR 56062] - Add blob URL partitioning self-fetch test and refactor helper functions, a=testonly
Automatic update from web-platform-tests
Add blob URL partitioning self-fetch test and refactor helper functions

This change introduces a new test, `cross-partition-self-fetch.html`,
which verifies that a Blob URL created in a cross-partition context can
successfully fetch itself when opened in a same-partition context. This
is to support upcoming spec changes proposed here:
https://github.com/w3c/FileAPI/issues/210

This change also moves the `add_iframe_js` and `create_test_iframes`
functions into a new `resources/common.js` file to reduce code
duplication across Blob URL cross-partition tests.

Also deletes support/file_test2.txt  which appears to be unused.

Bug: 426787402
Change-Id: I0080fa35b98ed9a1307a313181d2e6b30b56a37c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7016969
Reviewed-by: Koji Ishii <kojii@chromium.org>
Reviewed-by: Ari Chivukula <arichiv@chromium.org>
Commit-Queue: Andrew Williams <awillia@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1545891}

--

wpt-commits: d57037d6c71dbc47edbca522e5bbd81b8aeffd23
wpt-pr: 56062
2025-11-19 16:53:10 +00:00

33 lines
1.5 KiB
JavaScript

const add_iframe_js = (iframe_origin, response_queue_uuid) => `
const importScript = ${importScript};
await importScript("/html/cross-origin-embedder-policy/credentialless" +
"/resources/common.js");
await importScript("/html/anonymous-iframe/resources/common.js");
await importScript("/common/utils.js");
// dispatcher.js has already been loaded by the popup this is running in.
await send("${response_queue_uuid}", newIframe("${iframe_origin}"));
`;
async function create_test_iframes(t, response_queue_uuid) {
const same_site_origin = get_host_info().HTTPS_ORIGIN;
const cross_site_origin = get_host_info().HTTPS_NOTSAMESITE_ORIGIN;
assert_equals("https://" + window.location.host, same_site_origin,
"this test assumes that the page's window.location.host corresponds to " +
"get_host_info().HTTPS_ORIGIN");
// Create a same-origin iframe in a cross-site popup.
const not_same_site_popup_uuid = newPopup(t, cross_site_origin);
await send(not_same_site_popup_uuid,
add_iframe_js(same_site_origin, response_queue_uuid));
const cross_site_iframe_uuid = await receive(response_queue_uuid);
// Create a same-origin iframe in a same-site popup.
const same_origin_popup_uuid = newPopup(t, same_site_origin);
await send(same_origin_popup_uuid,
add_iframe_js(same_site_origin, response_queue_uuid));
const same_site_iframe_uuid = await receive(response_queue_uuid);
return [cross_site_iframe_uuid, same_site_iframe_uuid];
}