summaryrefslogtreecommitdiff
path: root/dom
diff options
context:
space:
mode:
Diffstat (limited to 'dom')
-rw-r--r--dom/workers/WorkerPrivate.cpp6
-rw-r--r--dom/workers/WorkerPrivate.h4
2 files changed, 8 insertions, 2 deletions
diff --git a/dom/workers/WorkerPrivate.cpp b/dom/workers/WorkerPrivate.cpp
index f0542e63ce..622a882a65 100644
--- a/dom/workers/WorkerPrivate.cpp
+++ b/dom/workers/WorkerPrivate.cpp
@@ -1963,6 +1963,7 @@ struct WorkerPrivate::TimeoutInfo
, mNestingLevel(0)
, mIsInterval(false)
, mCanceled(false)
+ , mOnChromeWorker(false)
{
MOZ_COUNT_CTOR(mozilla::dom::workers::WorkerPrivate::TimeoutInfo);
}
@@ -1992,7 +1993,8 @@ struct WorkerPrivate::TimeoutInfo
void CalculateTargetTime() {
auto target = mInterval;
- if (mNestingLevel >= kClampTimeoutNestingLevel) {
+ // Clamp timeout for workers, except chrome workers
+ if (mNestingLevel >= kClampTimeoutNestingLevel && !mOnChromeWorker) {
target = TimeDuration::Max(
mInterval,
TimeDuration::FromMilliseconds(Preferences::GetInt("dom.min_timeout_value")));
@@ -2007,6 +2009,7 @@ struct WorkerPrivate::TimeoutInfo
uint32_t mNestingLevel;
bool mIsInterval;
bool mCanceled;
+ bool mOnChromeWorker;
};
class WorkerJSContextStats final : public JS::RuntimeStats
@@ -6100,6 +6103,7 @@ WorkerPrivate::SetTimeout(JSContext* aCx,
}
nsAutoPtr<TimeoutInfo> newInfo(new TimeoutInfo());
+ newInfo->mOnChromeWorker = mIsChromeWorker;
newInfo->mIsInterval = aIsInterval;
newInfo->mId = timerId;
newInfo->AccumulateNestingLevel(this->mCurrentTimerNestingLevel);
diff --git a/dom/workers/WorkerPrivate.h b/dom/workers/WorkerPrivate.h
index 018d14321a..9effdccc9a 100644
--- a/dom/workers/WorkerPrivate.h
+++ b/dom/workers/WorkerPrivate.h
@@ -213,6 +213,9 @@ protected:
RefPtr<EventTarget> mEventTarget;
nsTArray<RefPtr<WorkerRunnable>> mPreStartRunnables;
+ // True if the worker is used in the UI
+ bool mIsChromeWorker;
+
private:
WorkerPrivate* mParent;
nsString mScriptURL;
@@ -242,7 +245,6 @@ private:
uint32_t mParentWindowPausedDepth;
Status mParentStatus;
bool mParentFrozen;
- bool mIsChromeWorker;
bool mMainThreadObjectsForgotten;
// mIsSecureContext is set once in our constructor; after that it can be read
// from various threads. We could make this const if we were OK with setting