forked from web-platform-tests/wpt
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathiframe.tentative.https.sub.html
More file actions
85 lines (74 loc) · 2.29 KB
/
iframe.tentative.https.sub.html
File metadata and controls
85 lines (74 loc) · 2.29 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 i = document.createElement('iframe');
window.addEventListener('message', t.step_func(e => {
if (e.source != i.contentWindow)
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`;
if (user_activated == FORCED) {
i.src = url;
document.body.appendChild(i);
} else if (user_activated == USER) {
let uuid = token();
i.name = uuid;
let a = document.createElement('a');
a.href = url;
a.target = uuid;
a.text = "This is a link!";
document.body.appendChild(i);
document.body.appendChild(a);
test_driver.click(a);
}
}, `{{host}} -> ${host} iframe: ${user_activated ? "user-activated" : "forced"}`);
}
create_test("{{host}}:{{ports[https][0]}}", FORCED, {
"site": "same-origin",
"user": "",
"mode": "navigate",
"dest": "iframe"
});
create_test("{{hosts[][www]}}:{{ports[https][0]}}", FORCED, {
"site": "same-site",
"user": "",
"mode": "navigate",
"dest": "iframe"
});
create_test("{{hosts[alt][www]}}:{{ports[https][0]}}", FORCED, {
"site": "cross-site",
"user": "",
"mode": "navigate",
"dest": "iframe"
});
create_test("{{host}}:{{ports[https][0]}}", USER, {
"site": "same-origin",
"user": "?1",
"mode": "navigate",
"dest": "iframe"
});
create_test("{{hosts[][www]}}:{{ports[https][0]}}", USER, {
"site": "same-site",
"user": "?1",
"mode": "navigate",
"dest": "iframe"
});
create_test("{{hosts[alt][www]}}:{{ports[https][0]}}", USER, {
"site": "cross-site",
"user": "?1",
"mode": "navigate",
"dest": "iframe"
});
</script>