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
This commit is contained in:
Kagami Sascha Rosylight 2022-11-01 12:05:24 +00:00
Родитель 50ce5b4e42
Коммит e3474dc92e
5 изменённых файлов: 15 добавлений и 21 удалений

Просмотреть файл

@ -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

Просмотреть файл

@ -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;
};

Просмотреть файл

@ -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;
};

Просмотреть файл

@ -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.

Просмотреть файл

@ -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");
</script>
<script type="application/javascript" src="test_tcpsocket_client_and_server_basics.js"></script>
</head>