forked from web-platform-tests/wpt
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathform.tentative.https.sub.html
More file actions
85 lines (74 loc) · 2.25 KB
/
form.tentative.https.sub.html
File metadata and controls
85 lines (74 loc) · 2.25 KB
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
<!DOCTYPE html>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=/resources/testdriver.js></script>
<script src=/resources/testdriver-vendor.js></script>
<script src=/fetch/metadata/resources/helper.js></script>
<script src=/common/utils.js></script>
<body>
<script>
const USER = true;
const FORCED = false;
function create_test(host, user_activated, expectations) {
async_test(t => {
let nonce = token();
let w = window.open("", nonce);
let f = document.createElement('form');
window.addEventListener('message', t.step_func(e => {
if (e.source != w)
return;
assert_header_equals(e.data, expectations,
`{{host}} -> ${host} iframe: ${user_activated ? "user-activated" : "forced"}`);
t.done();
}));
let url = `https://${host}/fetch/metadata/resources/post-to-owner.py`;
f.action = url;
f.target = nonce;
document.body.appendChild(f);
if (user_activated == FORCED) {
f.submit();
} else if (user_activated == USER) {
let s = document.createElement('input');
s.type = "submit";
f.appendChild(s);
test_driver.click(s);
}
}, `{{host}} -> ${host} iframe: ${user_activated ? "user-activated" : "forced"}`);
}
create_test("{{host}}:{{ports[https][0]}}", FORCED, {
"site": "same-origin",
"user": "",
"mode": "navigate",
"dest": "document"
});
create_test("{{hosts[][www]}}:{{ports[https][0]}}", FORCED, {
"site": "same-site",
"user": "",
"mode": "navigate",
"dest": "document"
});
create_test("{{hosts[alt][www]}}:{{ports[https][0]}}", FORCED, {
"site": "cross-site",
"user": "",
"mode": "navigate",
"dest": "document"
});
create_test("{{host}}:{{ports[https][0]}}", USER, {
"site": "same-origin",
"user": "?1",
"mode": "navigate",
"dest": "document"
});
create_test("{{hosts[][www]}}:{{ports[https][0]}}", USER, {
"site": "same-site",
"user": "?1",
"mode": "navigate",
"dest": "document"
});
create_test("{{hosts[alt][www]}}:{{ports[https][0]}}", USER, {
"site": "cross-site",
"user": "?1",
"mode": "navigate",
"dest": "document"
});
</script>