Closed Bug 1366711 Opened 7 years ago Closed 7 years ago

Provide a way for nsIProcess to launch an application on Windows without it being visible

Categories

(Core :: XPCOM, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: gsvelto, Assigned: gsvelto)

References

Details

Attachments

(1 file)

This is needed for both bug 1359326 and bug 1364673. In both cases we either have a console window that pops up (when the application is built as a console application) or the mouse throbber that appears (if it's a GUI application). I've tried multiple workarounds in the application themselves to avoid this but couldn't find a satisfying solution.

I've thought for a while about the best way to expose this. I didn't want to add another parameter to run()/runw()/runAsync()/runwAsync() because that would require adjusting a dozen C++ call sites and the same applies to adding a parameter to init(). I also didn't want to add an attribute because it made no sense to flip it after the application was launched. So I've settled on adding a new initialization method initHidden() that sets the appropriate state; I hope it's a good enough solution.
Assignee: nobody → gsvelto
Status: NEW → ASSIGNED
Comment on attachment 8869974 [details]
Bug 1366711 - Make it possible to hide applications launched with nsIProcess;

https://reviewboard.mozilla.org/r/141522/#review146232

::: xpcom/threads/nsIProcess.idl:27
(Diff revision 1)
> +   * window and will run hidden. This currently affects the Windows platform
> +   * alone.
> +   *
> +   * @param executable The executable to run.
> +   */
> +  void initHidden(in nsIFile executable);

Having a separate initHidden method is complex API. I can think of two ways to do this more extensibly:

 init(nsIFile executable, [optional] unsigned int flags)

OR

 process.startHidden = true
 process.init(file)
Attachment #8869974 - Flags: review?(benjamin) → review-
OK, thanks, I'll go for the latter then because the former would require changing quite a few unrelated C++ call sites.
Comment on attachment 8869974 [details]
Bug 1366711 - Make it possible to hide applications launched with nsIProcess;

https://reviewboard.mozilla.org/r/141522/#review146978

I don't think it should require changing callsites, because of the [optional] ? But this is fine.
Attachment #8869974 - Flags: review?(benjamin) → review+
(In reply to Benjamin Smedberg [:bsmedberg] from comment #5)
> Comment on attachment 8869974 [details]
> Bug 1366711 - Make it possible to hide applications launched with nsIProcess;
> 
> https://reviewboard.mozilla.org/r/141522/#review146978
> 
> I don't think it should require changing callsites, because of the
> [optional] ? But this is fine.

I tried that but there doesn't seem to be a way to provide a default parameter to the C++ interface, so the argument isn't really optional in C++. Anyway, thanks for the review!
Pushed by gsvelto@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/1df25c9d3299
Make it possible to hide applications launched with nsIProcess; r=bsmedberg
https://hg.mozilla.org/mozilla-central/rev/1df25c9d3299
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: