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

RESOLVED FIXED in Firefox 55

Status

()

Core
XPCOM
RESOLVED FIXED
9 months ago
9 months ago

People

(Reporter: gsvelto, Assigned: gsvelto)

Tracking

unspecified
mozilla55
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox55 fixed)

Details

MozReview Requests

()

Submitter Diff Changes Open Issues Last Updated
Loading...
Error loading review requests:

Attachments

(1 attachment)

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 hidden (mozreview-request)

Comment 2

9 months ago
mozreview-review
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 hidden (mozreview-request)

Comment 5

9 months ago
mozreview-review
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!

Comment 7

9 months ago
Pushed by gsvelto@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/1df25c9d3299
Make it possible to hide applications launched with nsIProcess; r=bsmedberg

Comment 8

9 months ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/1df25c9d3299
Status: ASSIGNED → RESOLVED
Last Resolved: 9 months ago
status-firefox55: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
You need to log in before you can comment on or make changes to this bug.