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
|
<!DOCTYPE html>
<meta charset="utf-8"/>
<link rel="author" href="mtrzos@google.com" title="Maciek Trzos">
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=/fetch/metadata/resources/helper.js></script>
<script src=/common/utils.js></script>
<body>
<p>Relevant issue: <a href="https://github.com/whatwg/html/issues/513">
<embed> should support loading random HTML documents, like <object>
</a></p>
<script>
const nonce = token();
const origins = {
"same-origin": "https://{{host}}:{{ports[https][0]}}",
"same-site": "https://{{hosts[][www]}}:{{ports[https][0]}}",
"cross-site": "https://{{hosts[alt][www]}}:{{ports[https][0]}}",
};
for (let site in origins) {
promise_test(t => {
return new Promise((resolve, reject) => {
let key = "embed-" + site + "-" + nonce;
let el = document.createElement('embed');
el.src = origins[site] + "/fetch/metadata/resources/record-header.py?file=" + key;
el.onload = _ => {
let expected = {"dest": "embed", "site": site, "user": "", "mode": "navigate"};
validate_expectations(key, expected, site + " embed")
.then(resolve)
.catch(reject);
};
document.body.appendChild(el);
})
}, "Wrapper: " + site + " embed");
promise_test(t => {
return new Promise((resolve, reject) => {
let key = "post-embed-" + site + "-" + nonce;
let el = document.createElement('embed');
el.src = "/common/blank.html";
el.addEventListener("load", _ => {
el.addEventListener("load", _ => {
let expected = {"dest": "embed", "site": site, "user":"", "mode":"navigate"};
validate_expectations(key, expected, "Navigate to " + site + " embed")
.then(resolve)
.catch(reject);
}, { once: true });
// Navigate the existing `<embed>`
window.frames[window.length - 1].location = origins[site] + "/fetch/metadata/resources/record-header.py?file=" + key;
}, { once: true });
document.body.appendChild(el);
})
}, "Wrapper: Navigate to " + site + " embed");
}
</script>
|