-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1651493 [wpt PR 24518] - Add a test for network errors with <embe…
…d>, a=testonly Automatic update from web-platform-tests Add a test for network errors with <embed> and <iframe> Follows whatwg/html#4247 for <embed> and existing spec text for <iframe>. -- wpt-commits: 91b0d35770bcb521c540d08002d8d3700666180c wpt-pr: 24518
- Loading branch information
1 parent
4a25c48
commit 795e500
Showing
4 changed files
with
112 additions
and
0 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
testing/web-platform/tests/html/semantics/embedded-content/resources/not-embeddable.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>I should not be embeddable because of X-Frame-Options</title> |
1 change: 1 addition & 0 deletions
1
.../web-platform/tests/html/semantics/embedded-content/resources/not-embeddable.html.headers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
X-Frame-Options: deny |
54 changes: 54 additions & 0 deletions
54
...form/tests/html/semantics/embedded-content/the-embed-element/embed-network-error.sub.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<!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> |
54 changes: 54 additions & 0 deletions
54
...rm/tests/html/semantics/embedded-content/the-iframe-element/iframe-network-error.sub.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>Network errors with iframe elements</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
|
||
<body> | ||
<script> | ||
"use strict"; | ||
|
||
async_test(t => { | ||
const iframe = document.createElement("iframe"); | ||
iframe.src = "//{{hosts[][nonexistent]}}/"; | ||
iframe.onload = () => t.done(); | ||
iframe.onerror = t.unreached_func("error event must not fire"); | ||
document.body.append(iframe); | ||
}, "new iframe: nonexistent host"); | ||
|
||
async_test(t => { | ||
const iframe = document.createElement("iframe"); | ||
iframe.src = "../resources/not-embeddable.html"; | ||
iframe.onload = () => t.done(); | ||
iframe.onerror = t.unreached_func("error event must not fire"); | ||
document.body.append(iframe); | ||
}, "new iframe: X-Frame-Options prevents embedding"); | ||
|
||
async_test(t => { | ||
const iframe = document.createElement("iframe"); | ||
iframe.src = "/common/blank.html"; | ||
iframe.name = "existingIframe1"; | ||
iframe.onload = t.step_func(() => { | ||
iframe.onload = () => t.done(); | ||
iframe.onerror = t.unreached_func("error event must not fire 2"); | ||
|
||
frames.existingIframe1.location.href = "//{{hosts[][nonexistent]}}/"; | ||
}); | ||
iframe.onerror = t.unreached_func("error event must not fire 1"); | ||
document.body.append(iframe); | ||
}, "navigating an existing iframe: nonexistent host"); | ||
|
||
async_test(t => { | ||
const iframe = document.createElement("iframe"); | ||
iframe.src = "/common/blank.html"; | ||
iframe.name = "existingIframe2"; | ||
iframe.onload = t.step_func(() => { | ||
iframe.onload = () => t.done(); | ||
iframe.onerror = t.unreached_func("error event must not fire 2"); | ||
|
||
frames.existingIframe2.location.href = "../resources/not-embeddable.html"; | ||
}); | ||
iframe.onerror = t.unreached_func("error event must not fire 1"); | ||
document.body.append(iframe); | ||
}, "navigating an existing iframe: X-Frame-Options prevents embedding"); | ||
</script> |