blob: 5886ab6f32c85af027872947d3b4682228e75dc1 (
plain)
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
<!doctype html>
<meta charset="utf-8">
<title>HTMLScriptElement: crossorigin attribute network test</title>
<link rel="author" title="KiChjang" href="mailto:kungfukeith11@gmail.com">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#cors-settings-attribute">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<body>
<script type="text/javascript">
var test1 = async_test("same-origin use-credentials");
var test2 = async_test("same-origin invalid");
var test3 = async_test("same-origin missing");
var test4 = async_test("cross-origin use-credentials");
var test5 = async_test("cross-origin invalid");
var test6 = async_test("cross-origin missing");
var test7 = async_test("cross-origin use-credentials mixed case");
var test8 = async_test("cross-origin use-credentials non-ASCII");
var same = "resources/cross-origin.py";
var cross = new URL(same, location);
cross.port = {{ports[http][1]}};
var script1 = document.createElement("script");
script1.src = same;
script1.crossOrigin = "use-credentials";
var script2 = document.createElement("script");
script2.src = same;
script2.crossOrigin = "gibberish";
var script3 = document.createElement("script");
script3.src = same;
var script4 = document.createElement("script");
script4.src = cross;
script4.crossOrigin = "use-credentials";
var script5 = document.createElement("script");
script5.src = cross;
script5.crossOrigin = "gibberish";
var script6 = document.createElement("script");
script6.src = cross;
var script7 = document.createElement("script");
script7.src = cross;
script7.crossOrigin = "UsE-cReDenTiAlS";
var script8 = document.createElement("script");
script8.src = cross;
script8.crossOrigin = "uſe-credentialſ";
document.cookie = "milk=yes";
document.body.appendChild(script1);
script1.onload = function() {
test1.step(function() {
assert_true(included, "credentials included (credentialsMode include)");
test1.done();
});
};
document.body.appendChild(script2);
script2.onload = function() {
test2.step(function() {
assert_true(included, "credentials included (credentialsMode same-origin)");
test2.done();
});
};
document.body.appendChild(script3);
script3.onload = function() {
test3.step(function() {
assert_true(included, "credentials included (credentialsMode include)");
test3.done();
});
};
document.body.appendChild(script4);
script4.onload = function() {
test4.step(function() {
assert_true(included, "credentials included (credentialsMode include)");
test4.done();
});
};
document.body.appendChild(script5);
script5.onload = function() {
test5.step(function() {
assert_false(included, "credentials excluded (credentialsMode same-origin)");
test5.done();
});
};
document.body.appendChild(script6);
script6.onload = function() {
test6.step(function() {
assert_true(included, "credentials included (credentialsMode include)");
test6.done();
});
};
document.body.appendChild(script7);
script7.onload = function() {
test7.step(function() {
assert_true(included, "credentials included (credentialsMode include)");
test7.done();
});
};
document.body.appendChild(script8);
script8.onload = function() {
test8.step(function() {
assert_false(included, "credentials excluded (credentialsMode same-origin)");
test8.done();
});
};
</script>
</body>
|