Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

'run' of interface 'nsIProcess' failed in Thunderbird 3 RC1 but works in Thunderbird 2

20 views
Skip to first unread message

Friedemann Kunze

unread,
Dec 1, 2009, 2:23:40 AM12/1/09
to
Hi all,

I've got a problem with a Thunderbird add-on which works always fine in
Thunderbird 2. But in Thunderbird 3 (RC1) there are some problems. I hope
someone can help me with the following point:

The extension should start a windows application (exe) with some arguments,
first time. The application keeps itself in the memory. All following calls
of the application with arguments should call the still existing application
with new arguments and so on (keep itself in memory and get the new
arguments is managed by the application). But with Tunderbird 3 (RC1) there
is a problem with currently used behaviour in Thunderbird 2 (see code
below):
...
this.appToProcess =
Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
this.process =
Components.classes["@mozilla.org/process/util;1"].createInstance(Components.interfaces.nsIProcess);
...
// initialize objects for process calls
this.appToProcess.initWithPath(C:\\Temp\\test.exe); // only a simple
example.
this.process.init(this.appToProcess);
...
var executionParameters = new Array(1);
executionParameters[0] = "/mailclient:thunderbird /combitapp:cRM
/command:config"; // only a simple example.

// In Thunderbird 2 it works always fine!
// In Thunderbird 3 - up to the second call - the exception
NS_ERROR_ALREADY_INITIALIZED is always triggered (application 'test.exe' is
there in memory!)
this.process.run(false, executionParameters, executionParameters.length);
...

I'll be glad, if someone could help me. Thanks in advance.


Pavol Mišík

unread,
Dec 1, 2009, 5:15:13 AM12/1/09
to
Friedemann Kunze wrote:
> Hi all,
>
> I've got a problem with a Thunderbird add-on which works always fine in
> Thunderbird 2. But in Thunderbird 3 (RC1) there are some problems. I hope
> someone can help me with the following point:
>
> The extension should start a windows application (exe) with some arguments,
> first time. The application keeps itself in the memory. All following calls
> of the application with arguments should call the still existing application
> with new arguments and so on (keep itself in memory and get the new
> arguments is managed by the application). But with Tunderbird 3 (RC1) there
> is a problem with currently used behaviour in Thunderbird 2 (see code
> below):
> ....

> this.appToProcess =
> Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
> this.process =
> Components.classes["@mozilla.org/process/util;1"].createInstance(Components.interfaces.nsIProcess);
> ....

> // initialize objects for process calls
> this.appToProcess.initWithPath(C:\\Temp\\test.exe); // only a simple
> example.
> this.process.init(this.appToProcess);
> ....

> var executionParameters = new Array(1);
> executionParameters[0] = "/mailclient:thunderbird /combitapp:cRM
> /command:config"; // only a simple example.
>
> // In Thunderbird 2 it works always fine!
> // In Thunderbird 3 - up to the second call - the exception
> NS_ERROR_ALREADY_INITIALIZED is always triggered (application 'test.exe' is
> there in memory!)
> this.process.run(false, executionParameters, executionParameters.length);
> ....

>
> I'll be glad, if someone could help me. Thanks in advance.
>
>
I would expect that it is because this.process already called
nsIProcess::Init. Tb2 uses gecko 1.8.1 where is missing check for
repeated initialization in tb3 (gecko 1.9.1) is this check present.
So you have to release process object before you use it again.

something like this:
if ( this.process )
{ this.process = nil; }

this.process.init(....


PM-

Pavol Mišík

unread,
Dec 1, 2009, 5:25:27 AM12/1/09
to
it should be
this.process = null;

PM-

Friedemann Kunze

unread,
Dec 1, 2009, 8:01:11 AM12/1/09
to
Thank you for the extended infos.
For simple tests I had changed the bahaviour to "reset" the process-object
and it works fine!

"Pavol Mi��k" <pmi...@gmail.com> schrieb im Newsbeitrag
news:P6mdnbjHM42KconW...@mozilla.org...

gNeandr

unread,
Dec 1, 2009, 10:20:37 AM12/1/09
to
Just to get it completely.
Also Pavol point to the Gecko version -- saying it's dependent of OS?

But which OS do you run?

This question is because I have used that nsIProcess with an extension
on different platforms: WINxp and Linux no problem, but on OSX it
doesn't work for multiple calls -- similar error messages.

See also my discussion and bug about it:
mozilla.dev.extensions: OSX with "cmdline" options works different as on
other platforms
See also [Bug 528683 <http://bugzilla.mozilla.org/show_bug.cgi?id=528683>]

The answer was like "this is a special case, you need to change the
nsIProcess for OSX by yourself" .. sounds a bit rude and disappointing.
I thought the Mozilla calls should function equally -- "platform
independent".
The bug was canceled as "RESOLVED INVALID ".

Will test Pavol's approach later.
Thanks
G�nter


[01.12.2009 14:01] �Friedemann Kunze� wrote:
> Thank you for the extended infos.
> For simple tests I had changed the bahaviour to "reset" the process-object
> and it works fine!
>

> "Pavol Mi��k"<pmi...@gmail.com> schrieb im Newsbeitrag
> news:P6mdnbjHM42KconW...@mozilla.org...

Pavol Mišík

unread,
Dec 1, 2009, 10:41:18 AM12/1/09
to
gNeandr wrote:
> Just to get it completely.
> Also Pavol point to the Gecko version -- saying it's dependent of OS?
>
> But which OS do you run?
>
> This question is because I have used that nsIProcess with an extension
> on different platforms: WINxp and Linux no problem, but on OSX it
> doesn't work for multiple calls -- similar error messages.
>
> See also my discussion and bug about it:
> mozilla.dev.extensions: OSX with "cmdline" options works different as on
> other platforms
> See also [Bug 528683 <http://bugzilla.mozilla.org/show_bug.cgi?id=528683>]
>
> The answer was like "this is a special case, you need to change the
> nsIProcess for OSX by yourself" .. sounds a bit rude and disappointing.
> I thought the Mozilla calls should function equally -- "platform
> independent".
> The bug was canceled as "RESOLVED INVALID ".
>
> Will test Pavol's approach later.
> Thanks
> G�nter


Well,
I have just taken look at
http://mxr.mozilla.org/mozilla1.8.0/source/xpcom/threads/nsProcessCommon.cpp#84
and
http://mxr.mozilla.org/mozilla1.9.1/source/xpcom/threads/nsProcessCommon.cpp#104
and as you can see in gecko 1.9.1 there is additional check:

106 if (mExecutable)
107 return NS_ERROR_ALREADY_INITIALIZED;

Because of this I thing this has thrown an exception in javascript.

PM-

Friedemann Kunze

unread,
Dec 2, 2009, 1:46:48 AM12/2/09
to
@gNeandr:
Our extension have to run only on windows (up to Win2k) systems.

I think Pavol is rigth. Since I changed the behaviour in our code it works
fine in both Thunderbird versions.

"Pavol Mi��k" <pmi...@gmail.com> schrieb im Newsbeitrag
news:LZmdnbF_BtSCpIjW...@mozilla.org...


> gNeandr wrote:
>> Just to get it completely.
>> Also Pavol point to the Gecko version -- saying it's dependent of OS?
>>
>> But which OS do you run?
>>
>> This question is because I have used that nsIProcess with an extension on
>> different platforms: WINxp and Linux no problem, but on OSX it doesn't
>> work for multiple calls -- similar error messages.
>>
>> See also my discussion and bug about it:
>> mozilla.dev.extensions: OSX with "cmdline" options works different as on
>> other platforms
>> See also [Bug 528683
>> <http://bugzilla.mozilla.org/show_bug.cgi?id=528683>]
>>
>> The answer was like "this is a special case, you need to change the
>> nsIProcess for OSX by yourself" .. sounds a bit rude and disappointing. I
>> thought the Mozilla calls should function equally -- "platform
>> independent".
>> The bug was canceled as "RESOLVED INVALID ".
>>
>> Will test Pavol's approach later.
>> Thanks

>> G�nter

0 new messages