summaryrefslogtreecommitdiffstats
path: root/netwerk/test/unit/node_execute/test_node_execute_loop.js
diff options
context:
space:
mode:
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.
+});