mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Update web-platform-tests to revision 912d5081b62d6e6a2f847935c82722e31cca7a1f
This commit is contained in:
parent
eeaca0b26d
commit
a44e48301c
75 changed files with 1894 additions and 292 deletions
|
@ -0,0 +1,33 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<title>Ensure images from available images list can be drawn to a canvas</title>
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-list-of-available-images">
|
||||
<meta charset="utf-8">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(function(t) {
|
||||
var i = new Image();
|
||||
i.onerror = t.unreached_func();
|
||||
i.onload = t.step_func(function() {
|
||||
var i2 = new Image();
|
||||
// Potentially start multiple image loading tasks by performing several
|
||||
// relevant mutations. This could lead to an invalid state later in an
|
||||
// erroneous implementation.
|
||||
i2.crossOrigin = true;
|
||||
// Start an image loading task that is expected to short-circuit since
|
||||
// the requested image is present in the list of available images.
|
||||
i2.src = "3.jpg";
|
||||
i2.onerror = t.unreached_func();
|
||||
// Ensure the loaded image is in a state that is usable by a 2d canvas.
|
||||
i2.onload = t.step_func_done(function() {
|
||||
var c = document.createElement('canvas');
|
||||
var ctx = c.getContext('2d');
|
||||
ctx.drawImage(i2, 0, 0);
|
||||
});
|
||||
});
|
||||
// Request an image which should be added to the list of available images.
|
||||
i.src = "3.jpg";
|
||||
});
|
||||
</script>
|
|
@ -146,4 +146,65 @@ test(t => {
|
|||
|
||||
}, "clicking a button inside a disabled fieldset's legend *should* trigger submit");
|
||||
|
||||
async_test(t => {
|
||||
|
||||
const form = document.createElement("form");
|
||||
const button = document.createElement("button");
|
||||
const span = document.createElement("span");
|
||||
button.appendChild(span);
|
||||
form.appendChild(button);
|
||||
document.body.appendChild(form);
|
||||
|
||||
form.addEventListener("submit", t.step_func_done(ev => {
|
||||
ev.preventDefault();
|
||||
assert_equals(ev.target, form);
|
||||
}));
|
||||
|
||||
span.click();
|
||||
|
||||
}, "clicking the child of a button with .click() should trigger a submit");
|
||||
|
||||
async_test(t => {
|
||||
|
||||
const form = document.createElement("form");
|
||||
const button = document.createElement("button");
|
||||
const span = document.createElement("span");
|
||||
button.appendChild(span);
|
||||
form.appendChild(button);
|
||||
document.body.appendChild(form);
|
||||
|
||||
form.addEventListener("submit", t.step_func_done(ev => {
|
||||
ev.preventDefault();
|
||||
assert_equals(ev.target, form);
|
||||
}));
|
||||
|
||||
const e = new MouseEvent("click", { bubbles: true });
|
||||
span.dispatchEvent(e);
|
||||
|
||||
}, "clicking the child of a button by dispatching a bubbling event should trigger a submit");
|
||||
|
||||
async_test(t => {
|
||||
|
||||
const form = document.createElement("form");
|
||||
const button = document.createElement("button");
|
||||
const span = document.createElement("span");
|
||||
button.appendChild(span);
|
||||
form.appendChild(button);
|
||||
document.body.appendChild(form);
|
||||
|
||||
form.addEventListener("submit", t.step_func_done(ev => {
|
||||
ev.preventDefault();
|
||||
assert_unreached("Form should not be submitted");
|
||||
}));
|
||||
|
||||
span.addEventListener("click", t.step_func(ev => {
|
||||
ev.preventDefault();
|
||||
t.step_timeout(() => t.done(), 500);
|
||||
}));
|
||||
|
||||
const e = new MouseEvent("click", { bubbles: false });
|
||||
span.dispatchEvent(e);
|
||||
|
||||
}, "clicking the child of a button by dispatching a non-bubbling event should not trigger submit");
|
||||
|
||||
</script>
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
<!DOCTYPE html>
|
||||
<script>
|
||||
let bc = new BroadcastChannel(window.location.search.substring(1));
|
||||
bc.postMessage({ hasOpener: opener !== null });
|
||||
window.close();
|
||||
</script>
|
|
@ -0,0 +1,60 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset=utf-8>
|
||||
<title>Test behavior of rel="noopener" links</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
</head>
|
||||
<body>
|
||||
<a href="support/target_blank_iplicit_noopener.html?a1" id="a1" rel="noopener" target="_blank">Click me</a>
|
||||
<a href="support/target_blank_iplicit_noopener.html?a2" id="a2" rel="opener" target="_blank">Click me</a>
|
||||
<a href="support/target_blank_iplicit_noopener.html?a3" id="a3" target="_blank">Click me</a>
|
||||
<a href="support/target_blank_iplicit_noopener.html?a4" id="a4" rel="opener noopener" target="_blank">Click me</a>
|
||||
<a href="support/target_blank_iplicit_noopener.html?a5" id="a5" rel="noopener opener" target="_blank">Click me</a>
|
||||
|
||||
<img src="/images/threecolors.png" />
|
||||
<area shape="rect" coords="0,0,99,50" href="support/target_blank_iplicit_noopener.html?area1" id="area1" rel="noopener" target="_blank" />
|
||||
</img>
|
||||
<img src="/images/threecolors.png" />
|
||||
<area shape="rect" coords="0,0,99,50" href="support/target_blank_iplicit_noopener.html?area2" id="area2" rel="opener" target="_blank" />
|
||||
</img>
|
||||
<img src="/images/threecolors.png" />
|
||||
<area shape="rect" coords="0,0,99,50" href="support/target_blank_iplicit_noopener.html?area3" id="area3" target="_blank" />
|
||||
</img>
|
||||
<img src="/images/threecolors.png" />
|
||||
<area shape="rect" coords="0,0,99,50" href="support/target_blank_iplicit_noopener.html?area4" id="area4" rel="opener noopener" target="_blank" />
|
||||
</img>
|
||||
<img src="/images/threecolors.png" />
|
||||
<area shape="rect" coords="0,0,99,50" href="support/target_blank_iplicit_noopener.html?area5" id="area5" rel="noopener opener" target="_blank" />
|
||||
</img>
|
||||
|
||||
<script>
|
||||
|
||||
let tests = [
|
||||
{ id: "a1", hasOpener: false, name: "Anchor element with target=_blank with rel=noopener" },
|
||||
{ id: "a2", hasOpener: true, name: "Anchor element with target=_blank with rel=opener" },
|
||||
{ id: "a3", hasOpener: false, name: "Anchor element with target=_blank with implicit rel=noopener" },
|
||||
{ id: "a4", hasOpener: false, name: "Anchor element with target=_blank with rel=opener+noopener" },
|
||||
{ id: "a5", hasOpener: false, name: "Anchor element with target=_blank with rel=noopener+opener" },
|
||||
{ id: "area1", hasOpener: false, name: "Area element with target=_blank with rel=noopener" },
|
||||
{ id: "area2", hasOpener: true, name: "Area element with target=_blank with rel=opener" },
|
||||
{ id: "area3", hasOpener: false, name: "Area element with target=_blank with implicit rel=noopener" },
|
||||
{ id: "area4", hasOpener: false, name: "Area element with target=_blank with rel=opener+noopener" },
|
||||
{ id: "area5", hasOpener: false, name: "Area element with target=_blank with rel=noopener+opener" },
|
||||
];
|
||||
|
||||
tests.forEach(data => {
|
||||
async_test(
|
||||
test => {
|
||||
let bc = new BroadcastChannel(data.id);
|
||||
bc.addEventListener("message", test.step_func_done(e => {
|
||||
assert_equals(e.data.hasOpener, data.hasOpener);
|
||||
}), {once: true});
|
||||
|
||||
document.getElementById(data.id).click();
|
||||
}, data.name);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -4,7 +4,7 @@
|
|||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
// https://html.spec.whatwg.org/#report-the-error
|
||||
// https://html.spec.whatwg.org/multipage/webappapis.html#report-the-error
|
||||
// If script's muted errors is true, then set message to "Script error.",
|
||||
// urlString to the empty string, line and col to 0, and errorValue to null.
|
||||
setup({allow_uncaught_exception: true});
|
||||
|
@ -43,6 +43,16 @@
|
|||
script.onload = test3.step_func_done(() => check(true));
|
||||
document.body.appendChild(script);
|
||||
}
|
||||
|
||||
var test4 = async_test("Errors for same-origin scripts redirected to a " +
|
||||
"cross-origin url and redirected back to " +
|
||||
"same-origin should be muted");
|
||||
var check4 = test4.step_func_done(() => check(true));
|
||||
|
||||
var test5 = async_test("Errors for cross-origin scripts redirected to a " +
|
||||
"same-origin url should be muted");
|
||||
var check5 = test5.step_func_done(() => check(true));
|
||||
|
||||
function unreachable() { log.push("unexpected"); }
|
||||
</script>
|
||||
<script src="cacheable-script-throw.py" onerror="test1.unreached_func()()" onload="check1()"></script>
|
||||
|
@ -50,3 +60,10 @@
|
|||
onerror="test2.unreached_func()()" onload="check2()"></script>
|
||||
<iframe src="//{{domains[www2]}}:{{ports[http][0]}}/html/semantics/scripting-1/the-script-element/muted-errors-iframe.html"
|
||||
onerror="test3.unreached_func()()" onload="step3()"></iframe>
|
||||
<script src="/fetch/api/resources/redirect.py?location=
|
||||
//{{domains[www2]}}:{{ports[http][0]}}/fetch/api/resources/redirect.py?location=
|
||||
//{{host}}:{{ports[http][0]}}/html/semantics/scripting-1/the-script-element/cacheable-script-throw.py?same-cross-same"
|
||||
onerror="test4.unreached_func()()" onload="check4()"></script>
|
||||
<script src="//{{domains[www2]}}:{{ports[http][0]}}/fetch/api/resources/redirect.py?location=
|
||||
//{{host}}:{{ports[http][0]}}/html/semantics/scripting-1/the-script-element/cacheable-script-throw.py?cross-same"
|
||||
onerror="test5.unreached_func()()" onload="check5()"></script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue