Skip to content

Commit 88d8cf9

Browse files
mikewestchromium-wpt-export-bot
authored andcommitted
Verify Sec-Fetch-Site is correct for domains with trailing dots.
`example.com` != `example.com.`. They ought to have the same registrable domain, and therefore compare as `same-site`, rather than `same-origin`. Addresses w3c/webappsec-fetch-metadata#15. Bug: 843478 Change-Id: Ic71afeda69f274c23c19608177756d882307a59d
1 parent 4cc42c3 commit 88d8cf9

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": "same-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": "same-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)