Bug 1584481 - Throw from NodeServer.execute if it cant't find MOZNODE_EXEC_PORT r=kershaw
authorValentin Gosu <valentin.gosu@gmail.com>
Fri, 27 Sep 2019 11:01:50 +0000
changeset 495330 37e07edfb660ade9c8dc5d1c7bfc1e7fbdc7b692
parent 495329 40d374fb9455e5aa58f4d3c3c98f031b94e5d01d
child 495331 b19d946a62e06c2df1027393a7679d0b6467113b
push id36627
push userdluca@mozilla.com
push dateFri, 27 Sep 2019 21:57:13 +0000
treeherdermozilla-central@d23a0a0ffa93 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskershaw
bugs1584481
milestone71.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1584481 - Throw from NodeServer.execute if it cant't find MOZNODE_EXEC_PORT r=kershaw Differential Revision: https://phabricator.services.mozilla.com/D47404
netwerk/test/httpserver/httpd.js
--- a/netwerk/test/httpserver/httpd.js
+++ b/netwerk/test/httpserver/httpd.js
@@ -898,16 +898,20 @@ class NodeServer {
   // > "bla"
   // let result = await NodeServer.execute(`f("test")`);
   // > "test"
   static execute(command) {
     let env = Cc["@mozilla.org/process/environment;1"].getService(
       Ci.nsIEnvironment
     );
     let h2Port = env.get("MOZNODE_EXEC_PORT");
+    if (!h2Port) {
+      throw new Error("Could not find MOZNODE_EXEC_PORT");
+    }
+
     let req = new XMLHttpRequest();
     req.open("POST", `http://127.0.0.1:${h2Port}/execute`);
 
     // Passing a function to NodeServer.execute will define that function
     // in node. It can be called in a later execute command.
     let isFunction = function(obj) {
       return !!(obj && obj.constructor && obj.call && obj.apply);
     };