[tor-commits] [tor-browser/tor-browser-17.0.7esr-2] Add processID API to nsXULAppInfo.

mikeperry at torproject.org mikeperry at torproject.org
Mon Jul 15 23:56:49 UTC 2013


commit ac1d62429de71e03eda09669d41e7bbe9f7b5575
Author: Kathleen Brade <brade at pearlcrescent.com>
Date:   Mon Jul 15 16:36:42 2013 -0700

    Add processID API to nsXULAppInfo.
    
    This is needed to allow Tor Launcher to pass Firefox's PID as the owning
    controller process, so Tor knows to exit when Firefox does.
---
 toolkit/xre/nsAppRunner.cpp    |   12 ++++++++++++
 xpcom/system/nsIXULRuntime.idl |    8 +++++++-
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp
index 68a52e6..fc2446a 100644
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -762,6 +762,18 @@ nsXULAppInfo::GetProcessType(uint32_t* aResult)
 }
 
 NS_IMETHODIMP
+nsXULAppInfo::GetProcessID(uint32_t* aResult)
+{
+  NS_ENSURE_ARG_POINTER(aResult);
+#ifdef XP_WIN
+  *aResult = GetCurrentProcessId();
+#else
+  *aResult = getpid();
+#endif
+  return NS_OK;
+}
+
+NS_IMETHODIMP
 nsXULAppInfo::EnsureContentProcess()
 {
   if (XRE_GetProcessType() != GeckoProcessType_Default)
diff --git a/xpcom/system/nsIXULRuntime.idl b/xpcom/system/nsIXULRuntime.idl
index 07466fc..e3948b6 100644
--- a/xpcom/system/nsIXULRuntime.idl
+++ b/xpcom/system/nsIXULRuntime.idl
@@ -11,7 +11,8 @@
  *                    stable/frozen, please contact Benjamin Smedberg.
  */
 
-[scriptable, uuid(cb0b8eda-4c83-4d0e-a63c-d3b65714bc85)]
+
+[scriptable, uuid(e080b1f6-8452-4bde-9368-c795808b86d1)]
 interface nsIXULRuntime : nsISupports
 {
   /**
@@ -68,6 +69,11 @@ interface nsIXULRuntime : nsISupports
   readonly attribute unsigned long processType;
 
   /**
+   * The system process ID of the caller's process.
+   */
+  readonly attribute unsigned long processID;
+
+  /**
    * Signal the apprunner to invalidate caches on the next restart.
    * This will cause components to be autoregistered and all
    * fastload data to be re-created.





More information about the tor-commits mailing list