Bug 1340735 - Terminate process when failing to attach it to job group. r=mhowell, a=jcristau
authorKris Maglione <maglione.k@gmail.com>
Fri, 17 Feb 2017 15:30:24 -0800
changeset 369426 8173156d60e0aaa2abf4da543fdf61c03f240a75
parent 369425 3434e8e52c3f7725aabc237a9eb893058694fbe3
child 369427 732a5221be43ac411b14b77dc4a686ac812fb495
push id1369
push userjlorenzo@mozilla.com
push dateMon, 27 Feb 2017 14:59:41 +0000
treeherdermozilla-release@d75a1dba431f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmhowell, jcristau
bugs1340735
milestone52.0
Bug 1340735 - Terminate process when failing to attach it to job group. r=mhowell, a=jcristau MozReview-Commit-ID: BVCPRFH6TV2
toolkit/modules/subprocess/subprocess_worker_win.js
--- a/toolkit/modules/subprocess/subprocess_worker_win.js
+++ b/toolkit/modules/subprocess/subprocess_worker_win.js
@@ -516,17 +516,20 @@ class Process extends BaseProcess {
       ok = libc.SetInformationJobObject(this.jobHandle, win32.JobObjectExtendedLimitInformation,
                                         ctypes.cast(info.address(), ctypes.voidptr_t),
                                         info.constructor.size);
       errorMessage = `Failed to set job limits: 0x${(ctypes.winLastError || 0).toString(16)}`;
     }
 
     if (ok) {
       ok = libc.AssignProcessToJobObject(this.jobHandle, procInfo.hProcess);
-      errorMessage = `Failed to attach process to job object: 0x${(ctypes.winLastError || 0).toString(16)}`;
+      if (!ok) {
+        errorMessage = `Failed to attach process to job object: 0x${(ctypes.winLastError || 0).toString(16)}`;
+        libc.TerminateProcess(procInfo.hProcess, TERMINATE_EXIT_CODE);
+      }
     }
 
     if (!ok) {
       for (let pipe of this.pipes) {
         pipe.close();
       }
       throw new Error(errorMessage);
     }