diff options
Diffstat (limited to 'testing/web-platform/tests/fetch/metadata/embed.https.sub.tentative.html')
-rw-r--r-- | testing/web-platform/tests/fetch/metadata/embed.https.sub.tentative.html | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/testing/web-platform/tests/fetch/metadata/embed.https.sub.tentative.html b/testing/web-platform/tests/fetch/metadata/embed.https.sub.tentative.html new file mode 100644 index 0000000000..1900dbdf08 --- /dev/null +++ b/testing/web-platform/tests/fetch/metadata/embed.https.sub.tentative.html @@ -0,0 +1,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> |