mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Update web-platform-tests to revision e45156b5e558c062a609356905c83a0258c516e3
This commit is contained in:
parent
9f6005be16
commit
5fcf52d946
199 changed files with 4430 additions and 530 deletions
|
@ -0,0 +1,43 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<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>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Autofocus shouldn't work in cross-origin iframe.</h1>
|
||||
<iframe id="child" width="200" height="100"></iframe>
|
||||
|
||||
<script>
|
||||
let parent_loaded = false;
|
||||
let child_loaded = false;
|
||||
|
||||
async_test(function(t) {
|
||||
function pingChildIfBothFramesLoaded() {
|
||||
if (parent_loaded && child_loaded)
|
||||
frames[0].postMessage("report_focus_state", "*");
|
||||
}
|
||||
|
||||
window.addEventListener("load", t.step_func(event => {
|
||||
parent_loaded = true;
|
||||
pingChildIfBothFramesLoaded();
|
||||
}));
|
||||
|
||||
window.addEventListener("message", t.step_func(event => {
|
||||
if (event.data == "child_loaded") {
|
||||
child_loaded = true;
|
||||
pingChildIfBothFramesLoaded();
|
||||
} else if (event.data == "child_is_focused") {
|
||||
assert_unreached("The iframe shouldn't get focus");
|
||||
} else if (event.data == "child_is_not_focused") {
|
||||
t.done();
|
||||
}
|
||||
}));
|
||||
document.getElementById("child").src =
|
||||
"http://{{domains[www]}}:{{ports[http][0]}}/html/semantics/forms/autofocus/resources/child-autofocus.html";
|
||||
}, "Autofocus shouldn't work in cross-origin iframe");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,20 @@
|
|||
<!DOCTYPE html>
|
||||
<input id="target" value="This should be unfocused!" autofocus></input>
|
||||
|
||||
<script>
|
||||
let got_focus = false;
|
||||
document.getElementById("target").addEventListener("focus", () => {
|
||||
got_focus = true;
|
||||
});
|
||||
|
||||
window.addEventListener("load", () => {
|
||||
parent.postMessage("child_loaded", "*");
|
||||
});
|
||||
|
||||
window.addEventListener("message", event => {
|
||||
if (event.data == "report_focus_state") {
|
||||
let msg = got_focus ? "child_is_focused" : "child_is_not_focused";
|
||||
parent.postMessage(msg, "*");
|
||||
}
|
||||
});
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue