Open main menu

CDOT Wiki β

User:Jamesboston/nsIProcess

< User:Jamesboston
Revision as of 18:54, 26 September 2008 by Jamesboston (talk | contribs)

Name of Project

Fix nsIProcess

Description

The nsIProcess API will be given a new spec that includes inter-process communication and then implemented.

Leader

Contributors

None (yet).

Details

The API for nsIProcess is not fully implemented. At present, the PID of a created process is not retained and cannot be killed. The API would also benifit from a new spec that includes inter-process communication.

An example of an API that for creating processes and communicating with them through STDIN/STDOUT is the Python subprocess module: http://docs.python.org/lib/node528.html

The goal of this project is to create a similar API for Mozilla.

API proposal

https://wiki.mozilla.org/NsIProcess

Existing API

Code snippet of how to use the existing API

Existing Code

http://mxr.mozilla.org/mozilla-central/source/xpcom/threads/nsProcessCommon.cpp

Relevant bugs

https://bugzilla.mozilla.org/show_bug.cgi?id=442393
https://bugzilla.mozilla.org/show_bug.cgi?id=68702

Proposed patches

patch092408.txt: This patch fixes the kill() method by putting an attribute into the class that is a Win32 defined struct for holding a reference to a process, and then using that reference to terminate the process. This approach is not considered optimal because it adds more code complexity.

patch092508.txt: This patch removes Window's specific code from the implementation. Instead, Windows and all other platforms use the Netscape Portable Runtime (NSPR) to create processes. Additionally, the logic for blocking is modified. For non-blocking processes, the code previously invoked logic in the NSPR that detached a process and deleted the reference to it, rendering the kill() function useless. This has been changed so that the kill() function works unmodified. However, it looks as the the NSPR does not support OS X process creation/termination. (In fact, the remaining Mac specific code in nsProcessCommon.cpp may not actually do anything.) Additional implementation may be necessary in the NSPR.

Meetings (Chronological)

Sept 19, 2008: Discussion with Benjamin Smedberg and David Humphrey to discuss the new API proposal.

Sept 22, 2008: Discussion with Mark Finkle and David Humphrey about the API design.

Sept 23, 2008: Discussion with Mark Finkle about using NSPR.

News and updates

Blog

A blog about the ongoing project to fix nsIProcess:
http://jamesboston.ca/cms/taxonomy/term/16

Hot off the presses

Sept 25, 2008: Revised patch to clear out some unused code. Tested console app. No console windows appeared on Vista or XP. This is the desired behaviour.

Sept 24, 2008: Wrote a patch so that nsIProcess.run() uses NSPR for all platforms. Also solves the kill bug.

Sept 23, 2008: Discussion with Mark Finkle about using NSPR.

Sept 22, 2008: A little something related. I've released an updated version of an extension that serves as a temporary work around for nsIProcess bugs.

Sept 22, 2008: Discussion with Mark Finkle and David Humphrey about the API design.

Sept 21, 2008: A first draft (an alpha version really) of the API is posted

Sept 21, 2008: Wrote a patch for the existing API so that the kill() method works for Win32.

Sept 19, 2008: Discussion with Benjamin Smedberg and David Humphrey to discuss the new API proposal.