-
Notifications
You must be signed in to change notification settings - Fork 3.2k
/
Copy pathheader-parsing.https.html
53 lines (46 loc) · 2.25 KB
/
header-parsing.https.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<!doctype html>
<meta charset=utf-8>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src="/common/get-host-info.sub.js"></script>
<script src="resources/common.js"></script>
<div id=log></div>
<script>
let tests = [
// popup Origin, popup COOP, expect opener
// None of the following should be recognized as "same-origin" (hence the
// "expected opener" value of `true`).
[SAME_ORIGIN, "same\u2014origin", true], // non-ASCII character (em dash)
[SAME_ORIGIN, "same-origin;", true],
[SAME_ORIGIN, "\u000bsame-origin\u000b", true], // vertical tab
[SAME_ORIGIN, "\u000csame-origin\u000c", true], // form feed
[SAME_ORIGIN, "\u000dsame-origin\u000d", true], // carriage return
[SAME_ORIGIN, "Same-origin", true],
[SAME_ORIGIN, "same-origin\0", true],
[SAME_ORIGIN, "same-origin;\tfoo=bar", true],
[SAME_ORIGIN, "same-origin ;foo=bar", true],
[SAME_ORIGIN, "same-origin; foo=bar;", true],
[SAME_ORIGIN, "\"same-origin\"", true], // HTTP structured fields "string" item
[SAME_ORIGIN, ":c2FtZS1vcmlnaW4=:", true], // HTTP structured fields "byte sequence" item
[SAME_ORIGIN, "?1", true], // HTTP structured fields "boolean" item
[SAME_ORIGIN, "1", true], // HTTP structured fields "integer or decimal" item
[SAME_ORIGIN, "$same-origin", true], // the item type is unrecognized
[SAME_ORIGIN, "same-origin same-origin", true],
[SAME_ORIGIN, "same-origin,same-origin", true],
[SAME_ORIGIN, "*same-origin ", true],
// All of the following should be recognized as "same-origin" (hence the
// "expected opener" value of `false`).
[SAME_ORIGIN, " same-origin", false],
[SAME_ORIGIN, "same-origin ", false],
[SAME_ORIGIN, "\tsame-origin", false],
[SAME_ORIGIN, "same-origin\t", false],
[SAME_ORIGIN, "same-origin;same-origin", false],
[SAME_ORIGIN, "same-origin; foo=bar", false],
];
run_coop_tests("unspecified", tests);
async_test((t) => {
const channelName = `none_to_${SAME_ORIGIN.name}_duplicated-header`;
const url = `${SAME_ORIGIN.origin}/html/cross-origin-opener-policy/resources/coop-same-origin-repeated.asis?channel=${channelName}`;
url_test(t, url, channelName, true);
}, `unspecified document opening popup to ${SAME_ORIGIN.origin} with repeated COOP header`);
</script>