Skip to content

Commit 22be9a9

Browse files
mikewestchromium-wpt-export-bot
authored andcommitted
Verify Sec-Fetch-Site is correct for domains with trailing dots.
`example.com` != `example.com.`. These are clearly distinct origins, and we don't currently consider them to have the same registrable domain (though there's a bit of a question about that. See publicsuffix/list#792), so they ought to compare as `cross-site` This patch adds a test for this behavior, and teaches the test harness to resolve domains that end in `.test.`. Closes w3c/webappsec-fetch-metadata#15. Bug: 843478 Change-Id: Ic71afeda69f274c23c19608177756d882307a59d Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1536180 Commit-Queue: Mike West <mkwst@chromium.org> Reviewed-by: Łukasz Anforowicz <lukasza@chromium.org> Cr-Commit-Position: refs/heads/master@{#644261}
1 parent a960bba commit 22be9a9

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<!DOCTYPE html>
2+
<script src=/resources/testharness.js></script>
3+
<script src=/resources/testharnessreport.js></script>
4+
<script src=/fetch/sec-metadata/resources/helper.js></script>
5+
<script>
6+
// Site
7+
promise_test(t => {
8+
return fetch("https://{{host}}.:{{ports[https][0]}}/fetch/sec-metadata/resources/echo-as-json.py")
9+
.then(r => r.json())
10+
.then(j => {
11+
assert_header_equals(j, {
12+
"dest": "empty",
13+
"site": "cross-site",
14+
"user": "?F",
15+
"mode": "cors",
16+
});
17+
});
18+
}, "Fetching a resource from the same origin, but spelled with a trailing dot.");
19+
20+
promise_test(t => {
21+
return fetch("https://{{hosts[][www]}}.:{{ports[https][0]}}/fetch/sec-metadata/resources/echo-as-json.py")
22+
.then(r => r.json())
23+
.then(j => {
24+
assert_header_equals(j, {
25+
"dest": "empty",
26+
"site": "cross-site",
27+
"user": "?F",
28+
"mode": "cors",
29+
});
30+
});
31+
}, "Fetching a resource from the same site, but spelled with a trailing dot.");
32+
33+
promise_test(t => {
34+
return fetch("https://{{hosts[alt][www]}}.:{{ports[https][0]}}/fetch/sec-metadata/resources/echo-as-json.py")
35+
.then(r => r.json())
36+
.then(j => {
37+
assert_header_equals(j, {
38+
"dest": "empty",
39+
"site": "cross-site",
40+
"user": "?F",
41+
"mode": "cors",
42+
});
43+
});
44+
}, "Fetching a resource from a cross-site host, spelled with a trailing dot.");
45+
</script>

0 commit comments

Comments
 (0)