Bug 1366711 - Make it possible to hide applications launched with nsIProcess; r=bsmedberg

MozReview-Commit-ID: K3vadzPg8SR

--HG--
extra : rebase_source : 9803bdca46c7dceb9bae0eefa4972369c7b36202
This commit is contained in:
Gabriele Svelto 2017-05-22 10:23:00 +02:00
parent 651bf6d362
commit 69f2bbaf90
3 changed files with 24 additions and 1 deletions

View File

@ -74,6 +74,13 @@ interface nsIProcess : nsISupports
in unsigned long count,
[optional] in nsIObserver observer, [optional] in boolean holdWeak);
/**
* When set to true the process will not open a new window when started and
* will run hidden from the user. This currently affects only the Windows
* platform.
*/
attribute boolean startHidden;
/**
* The process identifier of the currently running process. This will only
* be available after the process has started and may not be available on

View File

@ -62,6 +62,7 @@ private:
mozilla::Mutex mLock;
bool mShutdown;
bool mBlocking;
bool mStartHidden;
nsCOMPtr<nsIFile> mExecutable;
nsString mTargetPath;

View File

@ -72,6 +72,7 @@ nsProcess::nsProcess()
, mLock("nsProcess.mLock")
, mShutdown(false)
, mBlocking(false)
, mStartHidden(false)
, mPid(-1)
, mObserver(nullptr)
, mWeakObserver(nullptr)
@ -487,7 +488,7 @@ nsProcess::RunProcess(bool aBlocking, char** aMyArgv, nsIObserver* aObserver,
sinfo.cbSize = sizeof(SHELLEXECUTEINFOW);
sinfo.hwnd = nullptr;
sinfo.lpFile = wideFile.get();
sinfo.nShow = SW_SHOWNORMAL;
sinfo.nShow = mStartHidden ? SW_HIDE : SW_SHOWNORMAL;
sinfo.fMask = SEE_MASK_FLAG_DDEWAIT |
SEE_MASK_NO_CONSOLE |
SEE_MASK_NOCLOSEPROCESS;
@ -588,6 +589,20 @@ nsProcess::GetIsRunning(bool* aIsRunning)
return NS_OK;
}
NS_IMETHODIMP
nsProcess::GetStartHidden(bool* aStartHidden)
{
*aStartHidden = mStartHidden;
return NS_OK;
}
NS_IMETHODIMP
nsProcess::SetStartHidden(bool aStartHidden)
{
mStartHidden = aStartHidden;
return NS_OK;
}
NS_IMETHODIMP
nsProcess::GetPid(uint32_t* aPid)
{