-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support as=fetch in Early Hints preload
The spec doesn't prohibit as=fetch. Bug: 1408649 Change-Id: I81c50de77b362c8fa1c6ecfcc8332bba4c5e5d66 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4177723 Reviewed-by: Yoav Weiss <yoavweiss@chromium.org> Commit-Queue: Kenichi Ishibashi <bashi@chromium.org> Reviewed-by: Takashi Toyoshima <toyoshim@chromium.org> Cr-Commit-Position: refs/heads/main@{#1098451}
- Loading branch information
Showing
10 changed files
with
64 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
third_party/blink/web_tests/external/wpt/loading/early-hints/preload-fetch.h2.window.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// META: script=resources/early-hints-helpers.sub.js | ||
|
||
test(() => { | ||
const preloads = [{ | ||
"url": "empty.json?" + Date.now(), | ||
"as_attr": "fetch", | ||
"crossorigin_attr": "", | ||
}]; | ||
navigateToTestWithEarlyHints("resources/preload-fetch.html", preloads); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
third_party/blink/web_tests/external/wpt/loading/early-hints/resources/empty.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
4 changes: 4 additions & 0 deletions
4
third_party/blink/web_tests/external/wpt/loading/early-hints/resources/empty.json.headers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
cache-control: max-age=600 | ||
access-control-allow-origin: * | ||
timing-allow-origin: * | ||
cross-origin-resource-policy: cross-origin |
18 changes: 18 additions & 0 deletions
18
third_party/blink/web_tests/external/wpt/loading/early-hints/resources/preload-fetch.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<!DOCTYPE html> | ||
<meta charset=utf-8> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="early-hints-helpers.sub.js"></script> | ||
<body> | ||
<script> | ||
promise_test(async (t) => { | ||
const preloads = getPreloadsFromSearchParams(); | ||
assert_equals(preloads.length, 1); | ||
const preload = preloads[0]; | ||
|
||
await fetch(preload.url).then((response) => response.json()); | ||
const name = new URL(preload.url, window.location); | ||
assert_true(isPreloadedByEarlyHints(name)); | ||
}, "Ensure early hints preload works for fetch()"); | ||
</script> | ||
</body> |