Difference between revisions of "User:Jamesboston/nsIProcess"

From CDOT Wiki
Jump to: navigation, search
(Meetings (Chronological))
(Name of Project)
 
(41 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
=Name of Project=
 
=Name of Project=
Fix nsIProcess
+
nsIProcess2
 +
 
 +
'''Currently on hiatus.'''
  
 
=Description=
 
=Description=
  
The [http://developer.mozilla.org/en/NsIProcess nsIProcess] API will be given a new spec that includes inter-process communication and then implemented.  
+
Replace the existing [http://developer.mozilla.org/en/NsIProcess nsIProcess] interface with new interface that:
 +
* supports Unicode on all platforms
 +
* supports piping to and from processes
 +
* can handle asynchronous I/O via callbacks
 +
* is available through Components.utils.import("resource://gre/process.js") or a similar JS module approach.
  
=Leader=
+
=People=
 +
==Leader==
 
[[User:jamesboston|James Boston]]
 
[[User:jamesboston|James Boston]]
  
=Contributors=
+
==Contributors==
None (yet).
+
Steve Lee
 +
 
 +
==Mentors==
 +
Mark Finkle, Benjamin Smedberg, Ted Mielczarek, Jason Orendorff
 +
 
 +
=News and updates=
 +
 
 +
==Blog==
 +
All posts are tagged 'nsIProcess':<br />
 +
http://jamesboston.ca/cms/taxonomy/term/16
 +
 
 +
Or an RSS feed of the same:<br />
 +
http://jamesboston.ca/cms/taxonomy/term/16/0/feed
 +
 
 +
==News and Progress==
 +
 
 +
'''Currently on hiatus. Work will resume after final exams in Decemeber 2009.'''
 +
 
 +
<small>(Click dates for attachments or info)</small>
 +
 
 +
[https://wiki.mozilla.org/NsIProcess Sept 21, 2008]: A first draft (an alpha version really) of the API is posted.
 +
 
 +
[http://jamesboston.ca/cms/node/66 Sept 22, 2008]: Released an updated version of an extension that serves as a temporary work around for nsIProcess bugs.
 +
 
 +
[https://bugzilla.mozilla.org/show_bug.cgi?id=442393#attach_340506 Sept 25, 2008]: Submitted patch to bugzilla.
 +
 
 +
[https://bugzilla.mozilla.org/show_bug.cgi?id=442393#attach_341723 Oct 3, 2008]: Submitted revised patch to bugzilla.
 +
 
 +
[https://bugzilla.mozilla.org/show_bug.cgi?id=459572 Oct 12, 2008]: Opened a bug on NSPR lack of unicode support for Unicode arguments.
 +
 
 +
[https://bugzilla.mozilla.org/show_bug.cgi?id=442393#c9 Nov 11, 2008]: Submitted a new patch to bugzilla with Unicode support for Windows.
 +
 
 +
[https://bugzilla.mozilla.org/show_bug.cgi?id=442393#c11 Nov 23, 2008]: Submitted a new patch to bugzilla with isRunning() method.
 +
 
 +
[https://bugzilla.mozilla.org/show_bug.cgi?id=442393#c15 Jan 25, 2009]: Submitted a new patch with unit tests.
 +
 
 +
[https://bugzilla.mozilla.org/show_bug.cgi?id=442393#c17 Mar 5, 2009]: Submitted a new patch with minor revisions. The bug has now also been marked ''blocking‑fennec''.
 +
 
 +
[https://bugzilla.mozilla.org/show_bug.cgi?id=442393#c26 Mar 9, 2009]: Changed interface to return void on run.
 +
 
 +
[https://bugzilla.mozilla.org/show_bug.cgi?id=442393#c27 Mar 12, 2009]: Patch pushed to mozilla-central. (Followed by a minor bustage fix.)
 +
 
 +
[https://bugzilla.mozilla.org/show_bug.cgi?id=484246 Mar 19, 2009]: Filed a new enhancement bug that ties together the various features in the next stage of development.
 +
 
 +
=Downloads=
 +
 
 +
The code will be done in trunk. To get changeset:
 +
 
 +
hg pull http://hg.jamesboston.ca/mozilla/gsoc
 +
 
 +
Or to generate a plain text patch file containing all deviations from trunk visit:<br />
 +
http://jamesboston.ca/misc/patch.cgi
  
 
=Details=
 
=Details=
Line 30: Line 88:
  
 
==Existing Code==
 
==Existing Code==
http://mxr.mozilla.org/mozilla-central/source/xpcom/threads/nsProcessCommon.cpp
+
http://mxr.mozilla.org/mozilla-central/source/xpcom/threads/nsIProcess.idl<br />
 +
http://mxr.mozilla.org/mozilla-central/source/xpcom/threads/nsProcess.h<br />
 +
http://mxr.mozilla.org/mozilla-central/source/xpcom/threads/nsProcessCommon.cpp<br />
 +
http://mxr.mozilla.org/mozilla-central/source/xpcom/tests/unit/test_nsIProcess.js
  
 
==Relevant bugs==
 
==Relevant bugs==
 +
 +
Implement a replacement for nsIProcess<br />
 +
https://bugzilla.mozilla.org/show_bug.cgi?id=484246
  
 
nsIProcess.kill() does not work on Win32<br />
 
nsIProcess.kill() does not work on Win32<br />
Line 43: Line 107:
 
https://bugzilla.mozilla.org/show_bug.cgi?id=459572
 
https://bugzilla.mozilla.org/show_bug.cgi?id=459572
  
==Proposed patches==
+
==Submitted patches==
 
 
[http://jamesboston.ca/patches/patch092408.txt <del>patch092408.txt</del>]: 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.
 
  
[http://jamesboston.ca/patches/patch092508.txt <del>patch092508.txt</del>]: 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.
+
[https://bugzilla.mozilla.org/attachment.cgi?bugid=442393&action=viewall Bug 442393 patches]: Patches submitted to fix Bug 442393 - nsIProcess.kill() does not work on Win32
 
 
[http://jamesboston.ca/patches/patch100308.txt <del>patch100308.txt</del>]: Removed the Mac code. The NSPR seems to do everything necessary. The destructor has also been coded to detach a process if it hasn't been killed yet.
 
 
 
[http://jamesboston.ca/patches/patch102208.txt <del>patch102208.txt</del>]: Implemented returning the PID for Windows. Added some code to clean up memory after kill is used, but haven't verified that it works.
 
 
 
[http://jamesboston.ca/patches/patch102808.txt patch102808.txt]: Implemented returning the PID for Mac. Need to test this code on Linux.
 
  
 
==Meetings (Chronological)==
 
==Meetings (Chronological)==
Line 67: Line 123:
 
[[User:Jamesboston/nsIProcess/meeting-102908|Oct 29, 2008]]: Advice regarding PRProcess type.
 
[[User:Jamesboston/nsIProcess/meeting-102908|Oct 29, 2008]]: Advice regarding PRProcess type.
  
=News and updates=
+
[[User:Jamesboston/nsIProcess/meeting-110508|Nov 5, 2008]]: Getting advice on callbacks across XPConnect divide.
 
 
==Blog==
 
A blog about the ongoing project to fix nsIProcess:<br />
 
http://jamesboston.ca/cms/taxonomy/term/16
 
 
 
==Hot off the presses==
 
  
[http://jamesboston.ca/patches/patch102808.txt Oct 28, 2008]: New patch. PID return on Mac.
+
[[User:Jamesboston/nsIProcess/meeting-110708|Nov 7, 2008]]: Round table on Unicode support.
  
[http://jamesboston.ca/patches/patch102208.txt Oct 22, 2008]: New patch. PID return on Windows.
+
[[User:Jamesboston/nsIProcess/meeting-112308|Nov 23, 2008]]: Discussion about pathnames in xpcshell.
 
 
[https://bugzilla.mozilla.org/show_bug.cgi?id=459572 Oct 12, 2008]: Opened a bug on NSPR lack of unicode support for Unicode arguments.
 
 
 
[[User:Jamesboston/nsIProcess/meeting-100808|Oct 8, 2008]]: Discussion about string types and Windows paths in NSPR.
 
 
 
[http://jamesboston.ca/patches/patch100308.txt Oct 3, 2008]: A patch that clears out Mac code as well. All platforms should be good now.
 
 
 
[http://jamesboston.ca/patches/patch092508.txt 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.
 
 
 
[http://jamesboston.ca/patches/patch092408.txt Sept 24, 2008]: Wrote a patch so that nsIProcess.run() uses NSPR for all platforms. Also solves the kill bug.
 
 
 
[http://zenit.senecac.on.ca/wiki/index.php/User:Jamesboston/nsIProcess/meetin-092308 Sept 23, 2008]: Discussion with Mark Finkle about using NSPR.
 
 
 
[http://jamesboston.ca/cms/node/66 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.
 
 
 
[http://zenit.senecac.on.ca/wiki/index.php/User:Jamesboston/nsIProcess/meeting-092208 Sept 22, 2008]: Discussion with Mark Finkle and David Humphrey about the API design.
 
 
 
[https://wiki.mozilla.org/NsIProcess Sept 21, 2008]: A first draft (an alpha version really) of the API is posted
 
 
 
[http://jamesboston.ca/patches/Patch210908.txt Sept 21, 2008]: Wrote a patch for the existing API so that the kill() method works for Win32.
 
 
 
[http://zenit.senecac.on.ca/wiki/index.php/User:Jamesboston/nsIProcess/meeting-092008 Sept 19, 2008]: Discussion with Benjamin Smedberg and David Humphrey to discuss the new API proposal.<br />
 

Latest revision as of 12:31, 5 March 2010

Name of Project

nsIProcess2

Currently on hiatus.

Description

Replace the existing nsIProcess interface with new interface that:

  • supports Unicode on all platforms
  • supports piping to and from processes
  • can handle asynchronous I/O via callbacks
  • is available through Components.utils.import("resource://gre/process.js") or a similar JS module approach.

People

Leader

James Boston

Contributors

Steve Lee

Mentors

Mark Finkle, Benjamin Smedberg, Ted Mielczarek, Jason Orendorff

News and updates

Blog

All posts are tagged 'nsIProcess':
http://jamesboston.ca/cms/taxonomy/term/16

Or an RSS feed of the same:
http://jamesboston.ca/cms/taxonomy/term/16/0/feed

News and Progress

Currently on hiatus. Work will resume after final exams in Decemeber 2009.

(Click dates for attachments or info)

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

Sept 22, 2008: Released an updated version of an extension that serves as a temporary work around for nsIProcess bugs.

Sept 25, 2008: Submitted patch to bugzilla.

Oct 3, 2008: Submitted revised patch to bugzilla.

Oct 12, 2008: Opened a bug on NSPR lack of unicode support for Unicode arguments.

Nov 11, 2008: Submitted a new patch to bugzilla with Unicode support for Windows.

Nov 23, 2008: Submitted a new patch to bugzilla with isRunning() method.

Jan 25, 2009: Submitted a new patch with unit tests.

Mar 5, 2009: Submitted a new patch with minor revisions. The bug has now also been marked blocking‑fennec.

Mar 9, 2009: Changed interface to return void on run.

Mar 12, 2009: Patch pushed to mozilla-central. (Followed by a minor bustage fix.)

Mar 19, 2009: Filed a new enhancement bug that ties together the various features in the next stage of development.

Downloads

The code will be done in trunk. To get changeset:

hg pull http://hg.jamesboston.ca/mozilla/gsoc

Or to generate a plain text patch file containing all deviations from trunk visit:
http://jamesboston.ca/misc/patch.cgi

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/nsIProcess.idl
http://mxr.mozilla.org/mozilla-central/source/xpcom/threads/nsProcess.h
http://mxr.mozilla.org/mozilla-central/source/xpcom/threads/nsProcessCommon.cpp
http://mxr.mozilla.org/mozilla-central/source/xpcom/tests/unit/test_nsIProcess.js

Relevant bugs

Implement a replacement for nsIProcess
https://bugzilla.mozilla.org/show_bug.cgi?id=484246

nsIProcess.kill() does not work on Win32
https://bugzilla.mozilla.org/show_bug.cgi?id=442393

Implement inter-process communication (IPC) in Mozilla
https://bugzilla.mozilla.org/show_bug.cgi?id=68702

PR_CreateProcess in NSPR needs unicode support
https://bugzilla.mozilla.org/show_bug.cgi?id=459572

Submitted patches

Bug 442393 patches: Patches submitted to fix Bug 442393 - nsIProcess.kill() does not work on Win32

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.

Oct 8, 2008: Discussion about string types and Windows paths in NSPR.

Oct 29, 2008: Advice regarding PRProcess type.

Nov 5, 2008: Getting advice on callbacks across XPConnect divide.

Nov 7, 2008: Round table on Unicode support.

Nov 23, 2008: Discussion about pathnames in xpcshell.