From e3474dc92ea4c7e986d86c603490d0ec11741195 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Tue, 1 Nov 2022 12:05:24 +0000 Subject: [PATCH] Bug 1798369 - Part 3: Esmify dom/network/tests/tcpsocket_test.jsm r=necko-reviewers,kershaw Depends on D160825 Differential Revision: https://phabricator.services.mozilla.com/D160826 --- dom/network/tests/chrome.ini | 2 +- dom/network/tests/tcpsocket_test.jsm | 18 ------------------ dom/network/tests/tcpsocket_test.sys.mjs | 12 ++++++++++++ ...est_tcpsocket_client_and_server_basics.html | 2 +- dom/network/tests/test_tcpsocket_jsm.html | 2 +- 5 files changed, 15 insertions(+), 21 deletions(-) delete mode 100644 dom/network/tests/tcpsocket_test.jsm create mode 100644 dom/network/tests/tcpsocket_test.sys.mjs diff --git a/dom/network/tests/chrome.ini b/dom/network/tests/chrome.ini index 1be7af7b2556..a0b6c2ae3fc2 100644 --- a/dom/network/tests/chrome.ini +++ b/dom/network/tests/chrome.ini @@ -1,6 +1,6 @@ [DEFAULT] support-files = - tcpsocket_test.jsm + tcpsocket_test.sys.mjs test_tcpsocket_client_and_server_basics.js file_postMessage_opener.html file_udpsocket_iframe.html diff --git a/dom/network/tests/tcpsocket_test.jsm b/dom/network/tests/tcpsocket_test.jsm deleted file mode 100644 index b72588360f9e..000000000000 --- a/dom/network/tests/tcpsocket_test.jsm +++ /dev/null @@ -1,18 +0,0 @@ -var EXPORTED_SYMBOLS = [ - "createSocket", - "createServer", - "socketCompartmentInstanceOfArrayBuffer", -]; - -var createSocket = function(host, port, options) { - return new TCPSocket(host, port, options); -}; - -var createServer = function(port, options, backlog) { - return new TCPServerSocket(port, options, backlog); -}; - -// See test_tcpsocket_client_and_server_basics.html's version for rationale. -var socketCompartmentInstanceOfArrayBuffer = function(obj) { - return obj instanceof ArrayBuffer; -}; diff --git a/dom/network/tests/tcpsocket_test.sys.mjs b/dom/network/tests/tcpsocket_test.sys.mjs new file mode 100644 index 000000000000..04f9fd1f9356 --- /dev/null +++ b/dom/network/tests/tcpsocket_test.sys.mjs @@ -0,0 +1,12 @@ +export var createSocket = function(host, port, options) { + return new TCPSocket(host, port, options); +}; + +export var createServer = function(port, options, backlog) { + return new TCPServerSocket(port, options, backlog); +}; + +// See test_tcpsocket_client_and_server_basics.html's version for rationale. +export var socketCompartmentInstanceOfArrayBuffer = function(obj) { + return obj instanceof ArrayBuffer; +}; diff --git a/dom/network/tests/test_tcpsocket_client_and_server_basics.html b/dom/network/tests/test_tcpsocket_client_and_server_basics.html index 0c6be896fa4e..d7e40a432828 100644 --- a/dom/network/tests/test_tcpsocket_client_and_server_basics.html +++ b/dom/network/tests/test_tcpsocket_client_and_server_basics.html @@ -24,7 +24,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1084245 // In the JSM case, ArrayBuffers will be created in the compartment of the // JSM with different globals than the // test_tcpsocket_client_and_server_basics.js test logic sees, so we (and - // tcpsocket_test.jsm) need to do something. To avoid complexity relating + // tcpsocket_test.sys.mjs) need to do something. To avoid complexity relating // to wrappers and the varying nuances of the module scope and global scope // in JSM's (they differ on B2G), we hardcode ArrayBuffer rather than taking // a string that we look up, etc. diff --git a/dom/network/tests/test_tcpsocket_jsm.html b/dom/network/tests/test_tcpsocket_jsm.html index b8f8adc613f9..026d71ed1436 100644 --- a/dom/network/tests/test_tcpsocket_jsm.html +++ b/dom/network/tests/test_tcpsocket_jsm.html @@ -14,7 +14,7 @@ createSocket, createServer, socketCompartmentInstanceOfArrayBuffer - } = ChromeUtils.import("chrome://mochitests/content/chrome/dom/network/tests/tcpsocket_test.jsm"); + } = ChromeUtils.importESModule("chrome://mochitests/content/chrome/dom/network/tests/tcpsocket_test.sys.mjs");