author | Gabriele Svelto <gsvelto@mozilla.com> |
Mon, 22 May 2017 10:23:00 +0200 | |
changeset 361087 | 1df25c9d3299711f01643e51f2a277b6c23b102d |
parent 361086 | 99de7cf38c1289a33f92f848185a165eedb75880 |
child 361088 | 6380ec73b69604f39e081a5d67b0fbe000210380 |
push id | 43607 |
push user | gsvelto@mozilla.com |
push date | Mon, 29 May 2017 09:29:55 +0000 |
treeherder | autoland@1df25c9d3299 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | bsmedberg |
bugs | 1366711 |
milestone | 55.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/xpcom/threads/nsIProcess.idl +++ b/xpcom/threads/nsIProcess.idl @@ -70,16 +70,23 @@ interface nsIProcess : nsISupports * observer will be notified on the main thread. * @param holdWeak Whether to use a weak reference to hold the observer. */ void runwAsync([array, size_is(count)] in wstring args, 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 * some platforms. */ readonly attribute unsigned long pid; /** * The exit value of the process. This is only valid after the process has
--- a/xpcom/threads/nsProcess.h +++ b/xpcom/threads/nsProcess.h @@ -57,16 +57,17 @@ private: // The 'args' array is null-terminated. nsresult RunProcess(bool aBlocking, char** aArgs, nsIObserver* aObserver, bool aHoldWeak, bool aArgsUTF8); PRThread* mThread; mozilla::Mutex mLock; bool mShutdown; bool mBlocking; + bool mStartHidden; nsCOMPtr<nsIFile> mExecutable; nsString mTargetPath; int32_t mPid; nsCOMPtr<nsIObserver> mObserver; nsWeakPtr mWeakObserver; // These members are modified by multiple threads, any accesses should be
--- a/xpcom/threads/nsProcessCommon.cpp +++ b/xpcom/threads/nsProcessCommon.cpp @@ -67,16 +67,17 @@ NS_IMPL_ISUPPORTS(nsProcess, nsIProcess, nsIObserver) //Constructor nsProcess::nsProcess() : mThread(nullptr) , mLock("nsProcess.mLock") , mShutdown(false) , mBlocking(false) + , mStartHidden(false) , mPid(-1) , mObserver(nullptr) , mWeakObserver(nullptr) , mExitValue(-1) #if !defined(XP_MACOSX) , mProcess(nullptr) #endif { @@ -482,17 +483,17 @@ nsProcess::RunProcess(bool aBlocking, ch // The program name in aMyArgv[0] is always UTF-8 NS_ConvertUTF8toUTF16 wideFile(aMyArgv[0]); SHELLEXECUTEINFOW sinfo; memset(&sinfo, 0, sizeof(SHELLEXECUTEINFOW)); 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; if (cmdLine) { sinfo.lpParameters = cmdLine; } @@ -584,16 +585,30 @@ nsProcess::GetIsRunning(bool* aIsRunning } else { *aIsRunning = false; } 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) { if (!mThread) { return NS_ERROR_FAILURE; } if (mPid < 0) { return NS_ERROR_NOT_IMPLEMENTED; }