mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Update web-platform-tests to revision a46616a5b18e83587ddbbed756c7b96cbb4b015d
This commit is contained in:
parent
3f07cfec7c
commit
578498ba24
4001 changed files with 159517 additions and 30260 deletions
|
@ -0,0 +1,21 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>HTML contextmenu event is a MouseEvent</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<style>#contextmenutarget { width: 100px; height: 100px; background-color: red; }</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id='contextmenutarget'>Trigger context menu in this box.</div>
|
||||
<div id="log"></div>
|
||||
<script type="text/javascript">
|
||||
var t = async_test('contextmenu event generated from user action is MouseEvent');
|
||||
document.querySelector("#contextmenutarget").addEventListener('contextmenu', t.step_func(function (e) {
|
||||
assert_equals(e.constructor, window.MouseEvent);
|
||||
document.querySelector("#contextmenutarget").style.backgroundColor = "green";
|
||||
t.done();
|
||||
}));
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,74 @@
|
|||
<!DOCTYPE html>
|
||||
<title>GlobalEventHandlers</title>
|
||||
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#globaleventhandlers">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#event-handler-idl-attributes">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#event-handler-content-attributes">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/resources/WebIDLParser.js"></script>
|
||||
|
||||
<script>
|
||||
"use strict";
|
||||
setup({ explicit_done: true });
|
||||
|
||||
fetch("/interfaces/html.idl").then(res => res.text()).then(htmlIDL => {
|
||||
const parsedHTMLIDL = WebIDL2.parse(htmlIDL);
|
||||
const globalEventHandlers = parsedHTMLIDL.find(idl => idl.name === "GlobalEventHandlers");
|
||||
|
||||
// onerror is too special
|
||||
const names = globalEventHandlers.members.map(member => member.name).filter(name => name !== "onerror");
|
||||
|
||||
for (const name of names) {
|
||||
const withoutOn = name.substring(2);
|
||||
|
||||
test(() => {
|
||||
for (const location of [window, HTMLElement.prototype, SVGElement.prototype, Document.prototype]) {
|
||||
assert_true(location.hasOwnProperty(name),
|
||||
`${location.constructor.name} has an own property named "${name}"`);
|
||||
}
|
||||
assert_false(name in Element.prototype, `Element.prototype must not contain a "${name}" property`);
|
||||
}, `${name}: must be on the appropriate locations for GlobalEventHandlers`);
|
||||
|
||||
test(() => {
|
||||
const htmlElement = document.createElement("span");
|
||||
const svgElement = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
||||
|
||||
for (var location of [window, htmlElement, svgElement, document]) {
|
||||
assert_equals(location[name], null,
|
||||
`The default value of the property is null for a ${location.constructor.name} instance`);
|
||||
}
|
||||
}, `${name}: the default value must be null`);
|
||||
|
||||
test(() => {
|
||||
const el = document.createElement("div");
|
||||
el.setAttribute(name, `window.${name}Happened = true;`);
|
||||
const compiledHandler = el[name];
|
||||
|
||||
assert_equals(typeof compiledHandler, "function", `The ${name} property must be a function`);
|
||||
compiledHandler();
|
||||
assert_true(window[name + "Happened"], "Calling the handler must run the code");
|
||||
}, `${name}: the content attribute must be compiled into a function as the corresponding property`);
|
||||
|
||||
test(() => {
|
||||
const el = document.createElement("div");
|
||||
el.setAttribute(name, `window.${name}Happened2 = true;`);
|
||||
|
||||
el.dispatchEvent(new Event(withoutOn));
|
||||
|
||||
assert_true(window[name + "Happened2"], "Dispatching an event must run the code");
|
||||
}, `${name}: the content attribute must execute when an event is dispatched`);
|
||||
|
||||
test(() => {
|
||||
const element = document.createElement("meta");
|
||||
element[name] = e => {
|
||||
assert_equals(e.currentTarget, element, "The event must be fired at the <meta> element");
|
||||
};
|
||||
|
||||
element.dispatchEvent(new Event(withoutOn));
|
||||
}, `${name}: dispatching an Event at a <meta> element must trigger element.${name}`);
|
||||
}
|
||||
|
||||
done();
|
||||
});
|
||||
</script>
|
|
@ -1,58 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<title>onauxclick</title>
|
||||
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#handler-onauxclick">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
<div id="auxclickme1" onauxclick="window.auxClick1Happened = true;"></div>
|
||||
<div id="auxclickme2" onauxclick="window.auxClick2Happened = true;"></div>
|
||||
|
||||
<script>
|
||||
"use strict";
|
||||
window.auxClick1Happened = false;
|
||||
window.auxClick2Happened = false;
|
||||
|
||||
test(() => {
|
||||
for (var location of [window, HTMLElement.prototype, SVGElement.prototype, Document.prototype]) {
|
||||
assert_true(location.hasOwnProperty("onauxclick"),
|
||||
`${location.constructor.name} has an own property named "onauxclick"`);
|
||||
}
|
||||
}, "onauxclick is on the appropriate locations for GlobalEventHandlers");
|
||||
|
||||
test(() => {
|
||||
const htmlElement = document.createElement("span");
|
||||
const svgElement = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
||||
|
||||
for (var location of [window, htmlElement, svgElement, document]) {
|
||||
assert_equals(location.onauxclick, null,
|
||||
`The default value of the property is null for a ${location.constructor.name} instance`);
|
||||
}
|
||||
}, "The default value of onauxclick is always null");
|
||||
|
||||
test(() => {
|
||||
const element = document.querySelector("#auxclickme1");
|
||||
const compiledHandler = element.onauxclick;
|
||||
|
||||
assert_equals(typeof compiledHandler, "function", "The onauxclick property must be a function");
|
||||
compiledHandler();
|
||||
assert_true(window.auxClick1Happened, "Calling the handler must run the code");
|
||||
}, "The onauxclick content attribute must be compiled into the onauxclick property");
|
||||
|
||||
test(() => {
|
||||
const element = document.querySelector("#auxclickme2");
|
||||
element.dispatchEvent(new Event("auxclick"));
|
||||
|
||||
assert_true(window.auxClick2Happened, "Dispatching the event must run the code");
|
||||
}, "The onauxclick content attribute must execute when an event is dispatched");
|
||||
|
||||
test(() => {
|
||||
const element = document.createElement("meta");
|
||||
element.onauxclick = e => {
|
||||
assert_equals(e.currentTarget, element, "The event must be fired at the <meta> element");
|
||||
};
|
||||
|
||||
element.dispatchEvent(new Event("auxclick"));
|
||||
}, "dispatching an auxclick event must trigger element.onauxclick");
|
||||
|
||||
</script>
|
|
@ -5,6 +5,7 @@
|
|||
<script src="/resources/testharnessreport.js"></script>
|
||||
<body>
|
||||
<script>
|
||||
setup({ allow_uncaught_exception: true });
|
||||
var events = [];
|
||||
|
||||
test(function() {
|
||||
|
|
|
@ -10,7 +10,7 @@ setup({ allow_uncaught_exception: true });
|
|||
test(function() {
|
||||
var events = [];
|
||||
window.onerror = function() {
|
||||
events.push("Error");
|
||||
events.push("error");
|
||||
};
|
||||
|
||||
var div = document.createElement("div");
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>[[CanBlock]] in a dedicated worker agent</title>
|
||||
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#dedicated-worker-agent">
|
||||
<link rel="help" href="https://tc39.github.io/ecma262/#sec-agentcansuspend">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
<script>
|
||||
"use strict";
|
||||
fetch_tests_from_worker(new Worker("worker-that-requires-success.js"));
|
||||
</script>
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>[[CanBlock]] in a service worker agent</title>
|
||||
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#service-worker-agent">
|
||||
<link rel="help" href="https://tc39.github.io/ecma262/#sec-agentcansuspend">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/service-workers/service-worker/resources/test-helpers.sub.js"></script>
|
||||
|
||||
<script>
|
||||
"use strict";
|
||||
service_worker_test("worker-that-requires-failure.js", "Service worker test setup");
|
||||
</script>
|
|
@ -0,0 +1,13 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>[[CanBlock]] in a shared worker agent</title>
|
||||
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#shared-worker-agent">
|
||||
<link rel="help" href="https://tc39.github.io/ecma262/#sec-agentcansuspend">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
<script>
|
||||
"use strict";
|
||||
fetch_tests_from_worker(new SharedWorker("worker-that-requires-success.js"));
|
||||
</script>
|
|
@ -0,0 +1,21 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>[[CanBlock]] in a similar-origin window agent</title>
|
||||
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#similar-origin-window-agent">
|
||||
<link rel="help" href="https://tc39.github.io/ecma262/#sec-agentcansuspend">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
<script>
|
||||
"use strict";
|
||||
|
||||
const sab = new SharedArrayBuffer(16);
|
||||
const ta = new Int32Array(sab);
|
||||
|
||||
assert_throws(new TypeError(), () => {
|
||||
Atomics.wait(ta, 0, 0, 10);
|
||||
}, "Atomics.wait must throw in a window context");
|
||||
|
||||
done();
|
||||
</script>
|
|
@ -0,0 +1,13 @@
|
|||
"use strict";
|
||||
importScripts("/resources/testharness.js");
|
||||
|
||||
test(() => {
|
||||
const sab = new SharedArrayBuffer(16);
|
||||
const ta = new Int32Array(sab);
|
||||
|
||||
assert_throws(new TypeError(), () => {
|
||||
Atomics.wait(ta, 0, 0, 10);
|
||||
});
|
||||
}, `[[CanBlock]] in a ${self.constructor.name}`);
|
||||
|
||||
done();
|
|
@ -0,0 +1,11 @@
|
|||
"use strict";
|
||||
importScripts("/resources/testharness.js");
|
||||
|
||||
test(() => {
|
||||
const sab = new SharedArrayBuffer(16);
|
||||
const ta = new Int32Array(sab);
|
||||
|
||||
assert_equals(Atomics.wait(ta, 0, 0, 10), "timed-out");
|
||||
}, `[[CanBlock]] in a ${self.constructor.name}`);
|
||||
|
||||
done();
|
Loading…
Add table
Add a link
Reference in a new issue