author | Boris Zbarsky <bzbarsky@mit.edu> |
Thu, 01 Mar 2018 14:24:20 -0500 | |
changeset 406274 | 0d9766eb6f0f77235b0184a5fbc41e1dfa1e2320 |
parent 406273 | cb363ac1897a78d1d8c4cbd0b2f4b7636097547c |
child 406275 | 193fe425f5e2c56655bfe7ed53b5a40467ede76e |
push id | 33551 |
push user | bzbarsky@mozilla.com |
push date | Fri, 02 Mar 2018 17:28:07 +0000 |
treeherder | mozilla-central@9caf14e0b300 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | bkelly |
bugs | 1442313 |
milestone | 60.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
|
dom/workers/WorkerPrivate.cpp | file | annotate | diff | comparison | revisions | |
dom/workers/WorkerPrivate.h | file | annotate | diff | comparison | revisions |
--- a/dom/workers/WorkerPrivate.cpp +++ b/dom/workers/WorkerPrivate.cpp @@ -2612,31 +2612,34 @@ WorkerPrivate::WorkerPrivate(WorkerPriva , mWorkerScriptExecutedSuccessfully(false) , mFetchHandlerWasAdded(false) , mOnLine(false) , mMainThreadObjectsForgotten(false) , mIsChromeWorker(aIsChromeWorker) , mParentFrozen(false) , mIsSecureContext(false) , mDebuggerRegistered(false) + , mIsInAutomation(false) { MOZ_ASSERT_IF(!IsDedicatedWorker(), NS_IsMainThread()); mLoadInfo.StealFrom(aLoadInfo); if (aParent) { aParent->AssertIsOnWorkerThread(); // Note that this copies our parent's secure context state into mJSSettings. aParent->CopyJSSettings(mJSSettings); // And manually set our mIsSecureContext, though it's not really relevant to // dedicated workers... mIsSecureContext = aParent->IsSecureContext(); MOZ_ASSERT_IF(mIsChromeWorker, mIsSecureContext); + mIsInAutomation = aParent->IsInAutomation(); + MOZ_ASSERT(IsDedicatedWorker()); if (aParent->mParentFrozen) { Freeze(nullptr); } mOnLine = aParent->OnLine(); } @@ -2660,16 +2663,18 @@ WorkerPrivate::WorkerPrivate(WorkerPriva if (mIsSecureContext) { mJSSettings.chrome.compartmentOptions .creationOptions().setSecureContext(true); mJSSettings.content.compartmentOptions .creationOptions().setSecureContext(true); } + mIsInAutomation = xpc::IsInAutomation(); + // Our parent can get suspended after it initiates the async creation // of a new worker thread. In this case suspend the new worker as well. if (mLoadInfo.mWindow && mLoadInfo.mWindow->IsSuspended()) { ParentWindowPaused(); } if (mLoadInfo.mWindow && mLoadInfo.mWindow->IsFrozen()) { Freeze(mLoadInfo.mWindow);
--- a/dom/workers/WorkerPrivate.h +++ b/dom/workers/WorkerPrivate.h @@ -628,16 +628,22 @@ public: // compartment of the worker global. The only reason we don't // AssertIsOnParentThread() here is so we can assert that this value matches // the one on the compartment, which has to be done from the worker thread. bool IsSecureContext() const { return mIsSecureContext; } + // Check whether we're running in automation. + bool IsInAutomation() const + { + return mIsInAutomation; + } + TimeStamp CreationTimeStamp() const { return mCreationTimeStamp; } DOMHighResTimeStamp CreationTime() const { return mCreationTimeHighRes; @@ -1474,16 +1480,20 @@ private: // of state (loadinfo, worker type, parent). // // It's a bit unfortunate that we have to have an out-of-band boolean for // this, but we need access to this state from the parent thread, and we can't // use our global object's secure state there. bool mIsSecureContext; bool mDebuggerRegistered; + + // mIsInAutomation is true when we're running in test automation. + // We expose some extra testing functions in that case. + bool mIsInAutomation; }; class AutoSyncLoopHolder { WorkerPrivate* mWorkerPrivate; nsCOMPtr<nsIEventTarget> mTarget; uint32_t mIndex;