Skip to content

Commit 4f6052a

Browse files
mikewestchromium-wpt-export-bot
authored andcommitted
Set Sec-Fetch-Mode from the network service.
In order to move `Sec-Fetch-Mode` into the network service to ensure that it's consistently set every time `Sec-Fetch-Site` is set, this patch does a few things: 1. Based on the conversation in [1] and [2], this patch extends `network::mojom::RequestMode` to include two new values to represent nested navigations and object/embed navigations as distinct from main-frame navigations. 2. It introduces a new `network::IsNavigationRequestMode()` function to replace direct comparisons to `kNavigate` in various parts of the codebase. 3. It refactors `network::SetSecFetchSiteHeader()` into `network::SetFetchMetadataHeaders()`. This creates a single entry point from `URLLoader` to set all Fetch Metadata headers, and fleshes out the `Sec-Fetch-Mode` header. [1]: w3c/webappsec-fetch-metadata#37 [2]: whatwg/fetch#755 Bug: 972263, 990864 Change-Id: Icd20c7640d3d08ecb34a739f0203140fdcc195d5 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1780725 Reviewed-by: Kinuko Yasuda <[email protected]> Reviewed-by: Łukasz Anforowicz <[email protected]> Commit-Queue: Mike West <[email protected]> Cr-Commit-Position: refs/heads/master@{#693517}
1 parent f2fc63e commit 4f6052a

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<!DOCTYPE html>
2+
<html manifest="/fetch/sec-metadata/resources/record-header.py?file=appcache-manifest">
3+
<script src=/resources/testharness.js></script>
4+
<script src=/resources/testharnessreport.js></script>
5+
<script src=/fetch/sec-metadata/resources/helper.js></script>
6+
<script src=/common/utils.js></script>
7+
<body></body>
8+
<script>
9+
async_test(t => {
10+
window.applicationCache.oncached = window.applicationCache.onnoupdate = window.applicationCache.onerror = t.step_func(e => {
11+
fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=appcache-manifest")
12+
.then(t.step_func(response => response.text()))
13+
.then(t.step_func_done(text => assert_header_equals(text, {
14+
"dest": "",
15+
"site": "same-origin",
16+
"user": "",
17+
"mode": "no-cors"
18+
})))
19+
.catch(t.unreached_func("Fetching and verifying the results should succeed."));
20+
});
21+
}, "Appcache!");
22+
</script>

0 commit comments

Comments
 (0)