summaryrefslogtreecommitdiffstats
path: root/netwerk/test/unit/node_execute/test_node_execute_loop.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /netwerk/test/unit/node_execute/test_node_execute_loop.js
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'netwerk/test/unit/node_execute/test_node_execute_loop.js')
-rw-r--r--netwerk/test/unit/node_execute/test_node_execute_loop.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/netwerk/test/unit/node_execute/test_node_execute_loop.js b/netwerk/test/unit/node_execute/test_node_execute_loop.js
new file mode 100644
index 0000000000..10400b8b54
--- /dev/null
+++ b/netwerk/test/unit/node_execute/test_node_execute_loop.js
@@ -0,0 +1,22 @@
+// This test checks that the interaction between NodeServer.execute defined in
+// httpd.js and the node server that we're interacting with defined in
+// moz-http2.js is working properly.
+// This test spawns a node server that loops on while true and makes sure
+// the the process group is killed by runxpcshelltests.py at exit.
+// See bug 1855174
+
+"use strict";
+
+const { NodeServer } = ChromeUtils.importESModule(
+ "resource://testing-common/httpd.sys.mjs"
+);
+
+add_task(async function killOnEnd() {
+ let id = await NodeServer.fork();
+ await NodeServer.execute(id, `console.log("hello");`);
+ await NodeServer.execute(id, `console.error("hello");`);
+ // Make the forked subprocess hang forever.
+ NodeServer.execute(id, "while (true) {}").catch(e => {});
+ await new Promise(resolve => do_timeout(10, resolve));
+ // Should get killed at the end of the test by the harness.
+});