Update web-platform-tests to revision 58eb04cecbbec2e18531ab440225e38944a9c444

This commit is contained in:
Josh Matthews 2017-04-17 12:06:02 +10:00 committed by Anthony Ramine
parent 25e8bf69e6
commit 665817d2a6
35333 changed files with 1818077 additions and 16036 deletions

View file

@ -0,0 +1,69 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Entry and incumbent settings objects when compiling an inline event handler</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
"use strict";
window.name = "parent frame";
async_test(t => {
const iframe = document.createElement("iframe");
iframe.src = "resources/compiled-event-handler-settings-objects-support.html";
iframe.onload = t.step_func(() => {
const button = iframe.contentDocument.querySelector("button");
const compiled = button.onclick;
assert_equals(compiled.constructor, iframe.contentWindow.Function, "The constructor must be from the iframe");
assert_not_equals(compiled.constructor, Function, "The constructor must not be from this page");
t.done();
});
document.body.appendChild(iframe);
}, "The Function instance must be created in the Realm of the node document");
async_test(t => {
const iframe = document.createElement("iframe");
iframe.src = "resources/compiled-event-handler-settings-objects-support.html";
iframe.onload = t.step_func(() => {
const button = iframe.contentDocument.querySelector("button");
window.onWindowLoaded = t.step_func_done(url => {
const pathname = new URL(url).pathname;
assert_equals(pathname,
"/html/webappapis/scripting/events/resources/open-window.html");
// This tests that the entry settings object used to resolve URLs in that window.open() was the same as that
// of the node document (i.e. the iframe document), not e.g. this window.
});
button.click();
});
document.body.appendChild(iframe);
}, "The entry settings object while executing the compiled callback via Web IDL's invoke must be that " +
"of the node document");
async_test(t => {
const iframe = document.createElement("iframe");
iframe.src = "resources/compiled-event-handler-settings-objects-support.html";
iframe.onload = t.step_func(() => {
window.onmessage = t.step_func_done(event => {
assert_equals(event.data, "PASS");
assert_equals(event.source.name, "iframe");
assert_equals(event.source, iframe.contentWindow, "The source must be the iframe");
});
iframe.src = "about:blank";
});
document.body.appendChild(iframe);
}, "The incumbent settings object while executing the compiled callback via Web IDL's invoke must be that " +
"of the node document");
</script>

View file

@ -0,0 +1,30 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Event handlers processing algorithm: error events</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-event-handler-processing-algorithm">
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
<div id="log"></div>
<script>
"use strict";
setup({ allow_uncaught_exception: true });
promise_test(t => {
document.onerror = t.step_func((...args) => {
assert_equals(args.length, 1);
return true;
});
const eventWatcher = new EventWatcher(t, document, "error");
const promise = eventWatcher.wait_for("error").then(e => {
assert_equals(e.defaultPrevented, false);
});
document.dispatchEvent(new ErrorEvent("error", { cancelable: true }));
return promise;
}, "error event is normal (return true does not cancel; one arg) on Document, with a synthetic ErrorEvent");
</script>

View file

@ -0,0 +1,30 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Event handlers processing algorithm: error events</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-event-handler-processing-algorithm">
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
<div id="log"></div>
<script>
"use strict";
setup({ allow_uncaught_exception: true });
promise_test(t => {
document.onerror = t.step_func((...args) => {
assert_equals(args.length, 1);
return true;
});
const eventWatcher = new EventWatcher(t, document, "error");
const promise = eventWatcher.wait_for("error").then(e => {
assert_equals(e.defaultPrevented, false);
});
document.dispatchEvent(new Event("error", { cancelable: true }));
return promise;
}, "error event is normal (return true does not cancel; one arg) on Document, with a synthetic Event");
</script>

View file

@ -0,0 +1,67 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Event handlers processing algorithm: error events</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-event-handler-processing-algorithm">
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
<div id="log"></div>
<script>
"use strict";
promise_test(t => {
const script = document.createElement("script");
script.onerror = t.step_func((...args) => {
assert_equals(args.length, 1);
return true;
});
const eventWatcher = new EventWatcher(t, script, "error");
const promise = eventWatcher.wait_for("error").then(e => {
assert_equals(e.constructor, Event); // not ErrorEvent
assert_equals(e.defaultPrevented, false);
});
script.src = "404.js";
document.body.appendChild(script);
return promise;
}, "error event behaves normally (return true does not cancel; one arg) on a script element, with a 404 error");
promise_test(t => {
const script = document.createElement("script");
script.onerror = t.step_func((...args) => {
assert_equals(args.length, 1);
return true;
});
const eventWatcher = new EventWatcher(t, script, "error");
const promise = eventWatcher.wait_for("error").then(e => {
assert_equals(e.defaultPrevented, false);
});
script.dispatchEvent(new Event("error", { cancelable: true }));
return promise;
}, "error event behaves normally (return true does not cancel; one arg) on a script element, with a synthetic Event");
promise_test(t => {
const script = document.createElement("script");
script.onerror = t.step_func((...args) => {
assert_equals(args.length, 1);
return true;
});
const eventWatcher = new EventWatcher(t, script, "error");
const promise = eventWatcher.wait_for("error").then(e => {
assert_equals(e.defaultPrevented, false);
});
script.dispatchEvent(new ErrorEvent("error", { cancelable: true }));
return promise;
}, "error event behaves normally (return true does not cancel; one arg) on a script element, with a synthetic ErrorEvent");
</script>

View file

@ -0,0 +1,78 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Event handlers processing algorithm: click events using ErrorEvent</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-event-handler-processing-algorithm">
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
<div id="log"></div>
<script>
"use strict";
promise_test(t => {
document.onclick = t.step_func((...args) => {
assert_equals(args.length, 1);
return true;
});
const eventWatcher = new EventWatcher(t, document, "click");
const promise = eventWatcher.wait_for("click").then(e => {
assert_equals(e.defaultPrevented, false);
});
document.dispatchEvent(new ErrorEvent("click", { cancelable: true }));
return promise;
}, "click event is normal (return true does not cancel; one arg) on Document, with a synthetic ErrorEvent");
promise_test(t => {
window.onclick = t.step_func((...args) => {
assert_equals(args.length, 1);
return true;
});
const eventWatcher = new EventWatcher(t, window, "click");
const promise = eventWatcher.wait_for("click").then(e => {
assert_equals(e.defaultPrevented, false);
});
window.dispatchEvent(new ErrorEvent("click", { cancelable: true }));
return promise;
}, "click event is normal (return true does not cancel; one arg) on Window, with a synthetic ErrorEvent");
promise_test(t => {
const el = document.createElement("script");
el.onclick = t.step_func((...args) => {
assert_equals(args.length, 1);
return true;
});
const eventWatcher = new EventWatcher(t, el, "click");
const promise = eventWatcher.wait_for("click").then(e => {
assert_equals(e.defaultPrevented, false);
});
el.dispatchEvent(new ErrorEvent("click", { cancelable: true }));
return promise;
}, "click event is normal (return true does not cancel; one arg) on a script element, with a synthetic ErrorEvent");
promise_test(t => {
const worker = new Worker("resources/no-op-worker.js");
worker.onerror = t.step_func((...args) => {
assert_equals(args.length, 1);
return true;
});
const eventWatcher = new EventWatcher(t, worker, "click");
const promise = eventWatcher.wait_for("click").then(e => {
assert_equals(e.defaultPrevented, false);
});
worker.dispatchEvent(new ErrorEvent("click", { cancelable: true }));
return promise;
}, "click event is normal (return true does not cancel; one arg) on Worker, with a synthetic ErrorEvent");
</script>

View file

@ -0,0 +1,22 @@
"use strict";
importScripts("/resources/testharness.js");
setup({ allow_uncaught_exception: true });
promise_test(t => {
self.onerror = t.step_func((...args) => {
assert_equals(args.length, 1);
return true;
});
const eventWatcher = new EventWatcher(t, self, "click");
const promise = eventWatcher.wait_for("click").then(e => {
assert_equals(e.defaultPrevented, false);
});
self.dispatchEvent(new ErrorEvent("click", { cancelable: true }));
return promise;
}, "error event is normal (return true does not cancel; one arg) on WorkerGlobalScope, with a synthetic ErrorEvent");
done();

View file

@ -0,0 +1,48 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Event handlers processing algorithm: error events</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-event-handler-processing-algorithm">
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
<div id="log"></div>
<script>
"use strict";
setup({ allow_uncaught_exception: true });
promise_test(t => {
window.onerror = t.step_func((...args) => {
assert_greater_than(args.length, 1);
return true;
});
const eventWatcher = new EventWatcher(t, window, "error");
const promise = eventWatcher.wait_for("error").then(e => {
assert_equals(e.defaultPrevented, true);
});
setTimeout(() => thisFunctionDoesNotExist(), 0);
return promise;
}, "error event is weird (return true cancels; many args) on Window, with a runtime error");
promise_test(t => {
window.onerror = t.step_func(function (message, filename, lineno, colno, error) {
assert_equals(arguments.length, 5, "There must be exactly 5 arguments");
assert_equals(typeof message, "string", "message argument must be a string");
assert_equals(typeof filename, "string", "filename argument must be a string");
assert_equals(typeof lineno, "number", "lineno argument must be a number");
assert_equals(typeof colno, "number", "colno argument must be a number");
assert_equals(typeof error, "object", "error argument must be an object");
assert_equals(error.constructor, ReferenceError, "error argument must be a ReferenceError");
return true;
});
setTimeout(() => thisFunctionDoesNotExist(), 0);
const eventWatcher = new EventWatcher(t, window, "error");
return eventWatcher.wait_for("error");
}, "error event has the right 5 args on Window, with a runtime error");
</script>

View file

@ -0,0 +1,57 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Event handlers processing algorithm: error events</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-event-handler-processing-algorithm">
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
<div id="log"></div>
<script>
"use strict";
setup({ allow_uncaught_exception: true });
promise_test(t => {
window.onerror = t.step_func((...args) => {
assert_greater_than(args.length, 1);
return true;
});
const eventWatcher = new EventWatcher(t, window, "error");
const promise = eventWatcher.wait_for("error").then(e => {
assert_equals(e.defaultPrevented, true);
});
window.dispatchEvent(new ErrorEvent("error", { cancelable: true }));
return promise;
}, "error event is weird (return true cancels; many args) on Window, with a synthetic ErrorEvent");
promise_test(t => {
const theError = { the: "error object" };
window.onerror = t.step_func(function (message, filename, lineno, colno, error) {
assert_equals(arguments.length, 5, "There must be exactly 5 arguments");
assert_equals(message, "message");
assert_equals(filename, "filename");
assert_equals(lineno, 1);
assert_equals(colno, 2);
assert_equals(error, theError);
return true;
});
const eventWatcher = new EventWatcher(t, window, "error");
const promise = eventWatcher.wait_for("error");
window.dispatchEvent(new ErrorEvent("error", {
message: "message",
filename: "filename",
lineno: 1,
colno: 2,
error: theError
}));
return promise;
}, "error event has the right 5 args on Window, with a synthetic ErrorEvent");
</script>

View file

@ -0,0 +1,30 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Event handlers processing algorithm: error events</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-event-handler-processing-algorithm">
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
<div id="log"></div>
<script>
"use strict";
setup({ allow_uncaught_exception: true });
promise_test(t => {
window.onerror = t.step_func((...args) => {
assert_equals(args.length, 1);
return true;
});
const eventWatcher = new EventWatcher(t, window, "error");
const promise = eventWatcher.wait_for("error").then(e => {
assert_equals(e.defaultPrevented, false);
});
window.dispatchEvent(new Event("error", { cancelable: true }));
return promise;
}, "error event is normal (return true does not cancel; one arg) on Window, with a synthetic Event");
</script>

View file

@ -0,0 +1,63 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Event handlers processing algorithm: error events</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-event-handler-processing-algorithm">
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
<div id="log"></div>
<script>
"use strict";
setup({ allow_uncaught_exception: true });
promise_test(t => {
const worker = new Worker("resources/worker-with-syntax-error.js");
worker.onerror = t.step_func((...args) => {
assert_equals(args.length, 1);
return true;
});
const eventWatcher = new EventWatcher(t, worker, "error");
const promise = eventWatcher.wait_for("error").then(e => {
assert_equals(e.defaultPrevented, false);
});
return promise;
}, "error event is normal (return true does not cancel; one arg) on Worker, with a syntax error in the worker code");
promise_test(t => {
const worker = new Worker("resources/no-op-worker.js");
worker.onerror = t.step_func((...args) => {
assert_equals(args.length, 1);
return true;
});
const eventWatcher = new EventWatcher(t, worker, "error");
const promise = eventWatcher.wait_for("error").then(e => {
assert_equals(e.defaultPrevented, false);
});
worker.dispatchEvent(new Event("error", { cancelable: true }));
return promise;
}, "error event is normal (return true does not cancel; one arg) on Worker, with a synthetic Event");
promise_test(t => {
const worker = new Worker("resources/no-op-worker.js");
worker.onerror = t.step_func((...args) => {
assert_equals(args.length, 1);
return true;
});
const eventWatcher = new EventWatcher(t, worker, "error");
const promise = eventWatcher.wait_for("error").then(e => {
assert_equals(e.defaultPrevented, false);
});
worker.dispatchEvent(new ErrorEvent("error", { cancelable: true }));
return promise;
}, "error event is normal (return true does not cancel; one arg) on Worker, with a synthetic ErrorEvent");
</script>

View file

@ -0,0 +1,40 @@
"use strict";
importScripts("/resources/testharness.js");
setup({ allow_uncaught_exception: true });
promise_test(t => {
self.onerror = t.step_func((...args) => {
assert_greater_than(args.length, 1);
return true;
});
const eventWatcher = new EventWatcher(t, self, "error");
const promise = eventWatcher.wait_for("error").then(e => {
assert_equals(e.defaultPrevented, true);
});
setTimeout(() => thisFunctionDoesNotExist(), 0);
return promise;
}, "error event is weird (return true cancels; many args) on WorkerGlobalScope, with a runtime error");
promise_test(t => {
self.onerror = t.step_func(function (message, filename, lineno, colno, error) {
assert_equals(arguments.length, 5, "There must be exactly 5 arguments");
assert_equals(typeof message, "string", "message argument must be a string");
assert_equals(typeof filename, "string", "filename argument must be a string");
assert_equals(typeof lineno, "number", "lineno argument must be a number");
assert_equals(typeof colno, "number", "colno argument must be a number");
assert_equals(typeof error, "object", "error argument must be an object");
assert_equals(error.constructor, ReferenceError, "error argument must be a ReferenceError");
return true;
});
setTimeout(() => thisFunctionDoesNotExist(), 0);
const eventWatcher = new EventWatcher(t, self, "error");
return eventWatcher.wait_for("error");
}, "error event has the right 5 args on WorkerGlobalScope, with a runtime error");
done();

View file

@ -0,0 +1,49 @@
"use strict";
importScripts("/resources/testharness.js");
setup({ allow_uncaught_exception: true });
promise_test(t => {
self.onerror = t.step_func((...args) => {
assert_greater_than(args.length, 1);
return true;
});
const eventWatcher = new EventWatcher(t, self, "error");
const promise = eventWatcher.wait_for("error").then(e => {
assert_equals(e.defaultPrevented, true);
});
self.dispatchEvent(new ErrorEvent("error", { cancelable: true }));
return promise;
}, "error event is weird (return true cancels; many args) on WorkerGlobalScope, with a synthetic ErrorEvent");
promise_test(t => {
const theError = { the: "error object" };
self.onerror = t.step_func(function (message, filename, lineno, colno, error) {
assert_equals(arguments.length, 5, "There must be exactly 5 arguments");
assert_equals(message, "message");
assert_equals(filename, "filename");
assert_equals(lineno, 1);
assert_equals(colno, 2);
assert_equals(error, theError);
return true;
});
const eventWatcher = new EventWatcher(t, self, "error");
const promise = eventWatcher.wait_for("error");
self.dispatchEvent(new ErrorEvent("error", {
message: "message",
filename: "filename",
lineno: 1,
colno: 2,
error: theError
}));
return promise;
}, "error event has the right 5 args on WorkerGlobalScope, with a synthetic ErrorEvent");
done();

View file

@ -0,0 +1,22 @@
"use strict";
importScripts("/resources/testharness.js");
setup({ allow_uncaught_exception: true });
promise_test(t => {
self.onerror = t.step_func((...args) => {
assert_equals(args.length, 1);
return true;
});
const eventWatcher = new EventWatcher(t, self, "error");
const promise = eventWatcher.wait_for("error").then(e => {
assert_equals(e.defaultPrevented, false);
});
self.dispatchEvent(new Event("error", { cancelable: true }));
return promise;
}, "error event is normal (return true does not cancel; one arg) on WorkerGlobalScope, with a synthetic Event");
done();

View file

@ -0,0 +1,62 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Event handlers processing algorithm: manual tests</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-event-handler-processing-algorithm">
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
<style>
div[id^="d"] {
width: 100px;
height: 100px;
background-color: blue;
}
</style>
<div id="log"></div>
<p>Mouseover these four divs</p>
<div id="d1"></div>
<div id="d2"></div>
<div id="d3" onmouseover="return false"></div>
<div id="d4" onmouseover="return true"></div>
<script>
"use strict";
async_test(t => {
const div = document.querySelector("#d1");
div.onmouseover = t.step_func(() => false);
div.addEventListener("mouseover", t.step_func_done(e => {
assert_equals(e.defaultPrevented, true);
}));
}, "Listener added via JavaScript, returns false: cancels the event");
async_test(t => {
const div = document.querySelector("#d2");
div.onmouseover = t.step_func(() => true);
div.addEventListener("mouseover", t.step_func_done(e => {
assert_equals(e.defaultPrevented, false);
}));
}, "Listener added via JavaScript, returns true: does not cancel the event");
async_test(t => {
const div = document.querySelector("#d3");
div.addEventListener("mouseover", t.step_func_done(e => {
assert_equals(e.defaultPrevented, true);
}));
}, "Listener added via markup, returns false: cancels the event");
async_test(t => {
const div = document.querySelector("#d4");
div.addEventListener("mouseover", t.step_func_done(e => {
assert_equals(e.defaultPrevented, false);
}));
}, "Listener added via markup, returns true: does not cancel the event");
</script>

View file

@ -5,45 +5,56 @@
<body>
<div id="foo" style="width: 100px; height: 100px; background-color: black"></div>
<script>
async_test(function(t) {
// Historically mouseover was special in the spec, but now it is not. See https://github.com/whatwg/html/pull/2398.
test(function(t) {
var ev = new Event('mouseover', {cancelable: true});
document.getElementById("foo").onmouseover = t.step_func(function() { return false });
document.getElementById("foo").dispatchEvent(ev);
assert_equals(ev.defaultPrevented, true)
}, "mouseover listener returning false cancels event (using Event)");
test(function(t) {
var ev = new MouseEvent('mouseover', {cancelable: true});
document.getElementById("foo").onmouseover = t.step_func(function() { return false });
document.getElementById("foo").dispatchEvent(ev);
assert_equals(ev.defaultPrevented, true)
}, "mouseover listener returning false cancels event (using MouseEvent)");
test(function(t) {
var ev = new Event('mouseover', {cancelable: true});
document.getElementById("foo").onmouseover = t.step_func(function() { return true });
document.getElementById("foo").dispatchEvent(ev);
assert_equals(ev.defaultPrevented, true)
t.done();
}, "mouseover listener returning true cancels event");
assert_equals(ev.defaultPrevented, false)
}, "mouseover listener returning true doesn't cancel event (using Event)");
async_test(function(t) {
var ev = new Event('mouseover', {cancelable: true});
document.getElementById("foo").onmouseover = t.step_func(function() { return false; });
test(function(t) {
var ev = new MouseEvent('mouseover', {cancelable: true});
document.getElementById("foo").onmouseover = t.step_func(function() { return true });
document.getElementById("foo").dispatchEvent(ev);
assert_equals(ev.defaultPrevented, false);
t.done();
}, "mouseover listener returning false doesn't cancel event");
assert_equals(ev.defaultPrevented, false)
}, "mouseover listener returning true doesn't cancel event (using MouseEvent)");
// beforeunload is tested in html/browsers/browsing-the-web/unloading-documents/beforeunload-canceling.html
async_test(function(t) {
test(function(t) {
var ev = new Event("click", {cancelable: true});
document.getElementById("foo").onclick = t.step_func(function() { return false; });
document.getElementById("foo").dispatchEvent(ev);
assert_equals(ev.defaultPrevented, true);
t.done();
}, "click listener returning false cancels event");
async_test(function(t) {
test(function(t) {
var ev = new Event("blur", {cancelable: true});
document.getElementById("foo").onblur = t.step_func(function() { return false; });
document.getElementById("foo").dispatchEvent(ev);
assert_equals(ev.defaultPrevented, true);
t.done();
}, "blur listener returning false cancels event");
async_test(function(t) {
test(function(t) {
var ev = new Event("dblclick", {cancelable: true});
document.getElementById("foo").ondblclick = t.step_func(function() { return false; });
document.getElementById("foo").dispatchEvent(ev);
assert_equals(ev.defaultPrevented, true);
t.done();
}, "dblclick listener returning false cancels event");
</script>

View file

@ -70,11 +70,17 @@ test(function() {
test(function() {
var ev = document.createEvent("messageevent")
assert_equals(MessageEvent.prototype.initMessageEvent.length, 8, "MessageEvent.prototype.initMessageEvent.length should be 8")
assert_throws(new TypeError(), function() {
ev.initMessageEvent("test", true, false, "testData", "testOrigin", "testId", window)
}, "Calling initMessageEvent with only 7 parameters should throw a TypeError")
}, "All parameters to initMessageEvent should be mandatory")
assert_equals(MessageEvent.prototype.initMessageEvent.length, 1, "MessageEvent.prototype.initMessageEvent.length should be 1")
ev.initMessageEvent("test")
assert_equals(ev.type, "test", "type attribute")
assert_equals(ev.bubbles, false, "bubbles attribute")
assert_equals(ev.cancelable, false, "bubbles attribute")
assert_equals(ev.data, null, "data attribute")
assert_equals(ev.origin, "", "origin attribute")
assert_equals(ev.lastEventId, "", "lastEventId attribute")
assert_equals(ev.source, null, "source attribute")
assert_array_equals(ev.ports, [], "ports attribute")
}, "initMessageEvent operation default parameter values")
promise_test(function(t) {
var worker_url = "/service-workers/service-worker/resources/empty-worker.js";

View file

@ -0,0 +1,12 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>This will be in an iframe</title>
<script>
window.name = "iframe";
</script>
<body onbeforeunload="return { toString: parent.postMessage.bind(parent, 'PASS', '*') };">
<!-- window.open() uses the entry settings object to determine how the URL will be parsed -->
<button onclick="var w = window.open('open-window.html'); w.onload = () => { parent.onWindowLoaded(w.document.URL); };">This will be clicked</button>

View file

@ -0,0 +1,4 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>This window will open during the course of the test</title>
<h1>Hello</h1>