Files
firefox/testing/web-platform/tests/preload/prefetch-headers.https.html
Weizhong Xia d271048404 Bug 1922017 [wpt PR 48407] - Fix external/wpt/preload/prefetch-headers.https.html, a=testonly
Automatic update from web-platform-tests
Fix external/wpt/preload/prefetch-headers.https.html

prefetch-info.py takes the basename of the file parameter[1] to
construct the path of the resource to use. Adding green.png to the same
directory and removed the extra and unnecessary part of the file
parameter.

[1] https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/web_tests/external/wpt/preload/resources/prefetch-info.py;l=34

Bug: None
Change-Id: I62f3ab6d4e90c1ac0dbdbcd544625e7e3d443418
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5898200
Auto-Submit: Weizhong Xia <[email protected]>
Bot-Commit: Rubber Stamper <[email protected]>
Commit-Queue: Rubber Stamper <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1362439}

--

wpt-commits: 442c1d5135d7abe34ce9b7c7657208f8d937450e
wpt-pr: 48407
2024-10-08 08:17:27 +00:00

36 lines
1.3 KiB
HTML

<!DOCTYPE html>
<title>Ensures that prefetch sends headers as per-spec</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/utils.js"></script>
<script src="resources/prefetch-helper.js"></script>
<body>
<script>
promise_test(async t => {
const {href} = await prefetch({"type": "image/png", file: "green.png"}, t);
const [info] = await get_prefetch_info(href);
const {headers} = info;
assert_equals(headers["sec-fetch-dest"], "empty");
assert_equals(headers["sec-purpose"], "prefetch");
assert_false("origin" in headers);
}, "Prefetch should include Sec-Purpose=prefetch and Sec-Fetch-Dest=empty headers");
promise_test(async t => {
const {href} = await prefetch({"type": "image/png", file: "green.png"}, t);
const [info] = await get_prefetch_info(href);
const {headers} = info;
assert_false("purpose" in headers);
assert_false("x-moz" in headers);
}, "Prefetch should not include proprietary headers (X-moz/Purpose)");
promise_test(async t => {
const {href} = await prefetch({"type": "image/png", file: "green.png", crossOrigin: "anonymous"}, t);
const [info] = await get_prefetch_info(href);
const {headers} = info;
assert_equals(headers["origin"], document.origin);
}, "Prefetch should respect CORS mode");
</script>
</body>