aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/wpt/meta/MANIFEST.json4
-rw-r--r--tests/wpt/meta/html/dom/idlharness.any.js.ini3
-rw-r--r--tests/wpt/meta/html/dom/idlharness.https.html.ini6
-rw-r--r--tests/wpt/meta/webmessaging/message-channels/close-event/explicitly-closed.tentative.window.js.ini7
-rw-r--r--tests/wpt/tests/webmessaging/message-channels/close-event/explicitly-closed.tentative.window.js10
-rw-r--r--tests/wpt/tests/webmessaging/message-channels/close-event/resources/helper.js38
6 files changed, 50 insertions, 18 deletions
diff --git a/tests/wpt/meta/MANIFEST.json b/tests/wpt/meta/MANIFEST.json
index 750266dc59c..72c930afccf 100644
--- a/tests/wpt/meta/MANIFEST.json
+++ b/tests/wpt/meta/MANIFEST.json
@@ -518802,7 +518802,7 @@
"close-event": {
"resources": {
"helper.js": [
- "cb9ea9fe981e95374b836255c752a42de788fc7b",
+ "48744ac1c5b530ef8d46c3d9a0378c698353a5bc",
[]
]
}
@@ -848537,7 +848537,7 @@
]
],
"explicitly-closed.tentative.window.js": [
- "612003d58eaea908ad93294a7bbf777184356a28",
+ "12bfa0bd73e9278e39b825d4fa81437f943cbd02",
[
"webmessaging/message-channels/close-event/explicitly-closed.tentative.window.html",
{
diff --git a/tests/wpt/meta/html/dom/idlharness.any.js.ini b/tests/wpt/meta/html/dom/idlharness.any.js.ini
index f17466adc7f..ad5e57e0759 100644
--- a/tests/wpt/meta/html/dom/idlharness.any.js.ini
+++ b/tests/wpt/meta/html/dom/idlharness.any.js.ini
@@ -95,9 +95,6 @@
[History interface: existence and properties of interface object]
expected: FAIL
- [MessagePort interface: attribute onclose]
- expected: FAIL
-
[WorkerGlobalScope interface: attribute onlanguagechange]
expected: FAIL
diff --git a/tests/wpt/meta/html/dom/idlharness.https.html.ini b/tests/wpt/meta/html/dom/idlharness.https.html.ini
index 64533ac1838..ac7504347d7 100644
--- a/tests/wpt/meta/html/dom/idlharness.https.html.ini
+++ b/tests/wpt/meta/html/dom/idlharness.https.html.ini
@@ -1517,9 +1517,6 @@
[SVGSVGElement interface: attribute onpagereveal]
expected: FAIL
- [MessagePort interface: attribute onclose]
- expected: FAIL
-
[NotRestoredReasonDetails interface: existence and properties of interface object]
expected: FAIL
@@ -5363,9 +5360,6 @@
[Navigator interface: window.navigator must inherit property "pdfViewerEnabled" with the proper type]
expected: FAIL
- [MessagePort interface: attribute onclose]
- expected: FAIL
-
[SharedWorker interface: existence and properties of interface object]
expected: FAIL
diff --git a/tests/wpt/meta/webmessaging/message-channels/close-event/explicitly-closed.tentative.window.js.ini b/tests/wpt/meta/webmessaging/message-channels/close-event/explicitly-closed.tentative.window.js.ini
deleted file mode 100644
index c625c16f713..00000000000
--- a/tests/wpt/meta/webmessaging/message-channels/close-event/explicitly-closed.tentative.window.js.ini
+++ /dev/null
@@ -1,7 +0,0 @@
-[explicitly-closed.tentative.window.html]
- expected: TIMEOUT
- [Close event on port2 is fired when port1 is explicitly closed]
- expected: TIMEOUT
-
- [Close event on port2 is fired when port1, which is in a different window, is explicitly closed.]
- expected: TIMEOUT
diff --git a/tests/wpt/tests/webmessaging/message-channels/close-event/explicitly-closed.tentative.window.js b/tests/wpt/tests/webmessaging/message-channels/close-event/explicitly-closed.tentative.window.js
index 612003d58ea..12bfa0bd73e 100644
--- a/tests/wpt/tests/webmessaging/message-channels/close-event/explicitly-closed.tentative.window.js
+++ b/tests/wpt/tests/webmessaging/message-channels/close-event/explicitly-closed.tentative.window.js
@@ -33,3 +33,13 @@ promise_test(async t => {
});
await closeEventPromise;
}, 'Close event on port2 is fired when port1, which is in a different window, is explicitly closed.')
+
+promise_test(async t => {
+ const rc = await addWindow();
+ const waitForPort = expectMessagePortFromWindowWithoutStartingIt(window);
+ await createMessageChannelAndSendPortFollowedByClose(rc);
+ const port = await waitForPort;
+ const closeEventPromise = createCloseEventPromise(port);
+ port.start();
+ await closeEventPromise;
+}, 'Close event on port2 is fired when port1, in a different window, is closed during the transfer of port2.')
diff --git a/tests/wpt/tests/webmessaging/message-channels/close-event/resources/helper.js b/tests/wpt/tests/webmessaging/message-channels/close-event/resources/helper.js
index cb9ea9fe981..48744ac1c5b 100644
--- a/tests/wpt/tests/webmessaging/message-channels/close-event/resources/helper.js
+++ b/tests/wpt/tests/webmessaging/message-channels/close-event/resources/helper.js
@@ -22,6 +22,44 @@ function expectMessagePortFromWindow(window) {
}
/**
+ * Create a new promise that resolves when the window receives
+ * the MessagePort and does not start it.
+ *
+ * @param {Window} window - The window to wait for the MessagePort.
+ * @returns {Promise<MessagePort>} A promise you should await to ensure the
+ * window
+ * receives the MessagePort.
+ */
+function expectMessagePortFromWindowWithoutStartingIt(window) {
+ return new Promise(resolve => {
+ window.onmessage = e => {
+ try {
+ assert_true(e.ports[0] instanceof window.MessagePort);
+ resolve(e.ports[0]);
+ } catch (e) {
+ reject(e);
+ }
+ };
+ });
+}
+
+/**
+ * Create a new MessageChannel and transfers one of the ports to
+ * the window which opened the window with a remote context provided
+ * as an argument, and immediately closes the entangled port.
+ *
+ * @param {RemoteContextWrapper} remoteContextWrapper
+ */
+async function createMessageChannelAndSendPortFollowedByClose(remoteContextWrapper) {
+ await remoteContextWrapper.executeScript(() => {
+ const {port1, port2} = new MessageChannel();
+ port1.start();
+ window.opener.postMessage({}, '*', [port2]);
+ port1.close();
+ });
+}
+
+/**
* Create a new MessageChannel and transfers one of the ports to
* the window which opened the window with a remote context provided
* as an argument.