Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 3 subtest issues.
- This WPT test may be referenced by the following Test IDs:
- /html/semantics/embedded-content/the-embed-element/embed-network-error.sub.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<meta charset="utf-8">
<title>Network errors with embed elements</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<body>
<script>
"use strict";
async_test(t => {
const embed = document.createElement("embed");
embed.src = "//{{hosts[][nonexistent]}}/";
embed.onload = () => t.done();
embed.onerror = t.unreached_func("error event must not fire");
document.body.append(embed);
}, "new embed: nonexistent host");
async_test(t => {
const embed = document.createElement("embed");
embed.src = "../resources/not-embeddable.html";
embed.onload = () => t.done();
embed.onerror = t.unreached_func("error event must not fire");
document.body.append(embed);
}, "new embed: X-Frame-Options prevents embedding");
async_test(t => {
const embed = document.createElement("embed");
embed.src = "/common/blank.html";
embed.name = "existingEmbed1";
embed.onload = t.step_func(() => {
embed.onload = () => t.done();
embed.onerror = t.unreached_func("error event must not fire 2");
frames.existingEmbed1.location.href = "//{{hosts[][nonexistent]}}/";
});
embed.onerror = t.unreached_func("error event must not fire 1");
document.body.append(embed);
}, "navigating an existing embed: nonexistent host");
async_test(t => {
const embed = document.createElement("embed");
embed.src = "/common/blank.html";
embed.name = "existingEmbed2";
embed.onload = t.step_func(() => {
embed.onload = () => t.done();
embed.onerror = t.unreached_func("error event must not fire 2");
frames.existingEmbed2.location.href = "../resources/not-embeddable.html";
});
embed.onerror = t.unreached_func("error event must not fire 1");
document.body.append(embed);
}, "navigating an existing embed: X-Frame-Options prevents embedding");
</script>