Bug 1967608 - Make all prefs accessed by worker thread atomic, r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D250349
This commit is contained in:
@@ -322,7 +322,7 @@ TimeDuration TimeoutManager::CalculateDelay(Timeout* aTimeout) const {
|
||||
TimeDuration result = aTimeout->mInterval;
|
||||
|
||||
if (aTimeout->mNestingLevel >=
|
||||
StaticPrefs::dom_clamp_timeout_nesting_level_AtStartup()) {
|
||||
StaticPrefs::dom_clamp_timeout_nesting_level()) {
|
||||
uint32_t minTimeoutValue = StaticPrefs::dom_min_timeout_value();
|
||||
result = TimeDuration::Max(result,
|
||||
TimeDuration::FromMilliseconds(minTimeoutValue));
|
||||
@@ -529,7 +529,7 @@ nsresult TimeoutManager::SetTimeout(TimeoutHandler* aHandler, int32_t interval,
|
||||
const uint32_t nestingLevel{mIsWindow ? GetNestingLevelForWindow()
|
||||
: GetNestingLevelForWorker()};
|
||||
timeout->mNestingLevel =
|
||||
nestingLevel < StaticPrefs::dom_clamp_timeout_nesting_level_AtStartup()
|
||||
nestingLevel < StaticPrefs::dom_clamp_timeout_nesting_level()
|
||||
? nestingLevel + 1
|
||||
: nestingLevel;
|
||||
}
|
||||
@@ -1039,7 +1039,7 @@ bool TimeoutManager::RescheduleTimeout(Timeout* aTimeout,
|
||||
// Automatically increase the nesting level when a setInterval()
|
||||
// is rescheduled just as if it was using a chained setTimeout().
|
||||
if (aTimeout->mNestingLevel <
|
||||
StaticPrefs::dom_clamp_timeout_nesting_level_AtStartup()) {
|
||||
StaticPrefs::dom_clamp_timeout_nesting_level()) {
|
||||
aTimeout->mNestingLevel += 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -1094,18 +1094,17 @@ struct WorkerPrivate::TimeoutInfo {
|
||||
}
|
||||
|
||||
void AccumulateNestingLevel(const uint32_t& aBaseLevel) {
|
||||
if (aBaseLevel < StaticPrefs::dom_clamp_timeout_nesting_level_AtStartup()) {
|
||||
if (aBaseLevel < StaticPrefs::dom_clamp_timeout_nesting_level()) {
|
||||
mNestingLevel = aBaseLevel + 1;
|
||||
return;
|
||||
}
|
||||
mNestingLevel = StaticPrefs::dom_clamp_timeout_nesting_level_AtStartup();
|
||||
mNestingLevel = StaticPrefs::dom_clamp_timeout_nesting_level();
|
||||
}
|
||||
|
||||
void CalculateTargetTime() {
|
||||
auto target = mInterval;
|
||||
// Don't clamp timeout for chrome workers
|
||||
if (mNestingLevel >=
|
||||
StaticPrefs::dom_clamp_timeout_nesting_level_AtStartup() &&
|
||||
if (mNestingLevel >= StaticPrefs::dom_clamp_timeout_nesting_level() &&
|
||||
!mOnChromeWorker) {
|
||||
target = TimeDuration::Max(
|
||||
mInterval,
|
||||
|
||||
@@ -2528,9 +2528,9 @@
|
||||
# HTML specification says the level should be 5
|
||||
# https://html.spec.whatwg.org/#timer-initialisation-steps
|
||||
- name: dom.clamp.timeout.nesting.level
|
||||
type: uint32_t
|
||||
type: RelaxedAtomicUint32
|
||||
value: 5
|
||||
mirror: once
|
||||
mirror: always
|
||||
|
||||
# Skip the security checks for document.cookie.
|
||||
- name: dom.cookie.testing.enabled
|
||||
@@ -3537,13 +3537,13 @@
|
||||
|
||||
# Timeout clamp in ms for background windows.
|
||||
- name: dom.min_background_timeout_value
|
||||
type: int32_t
|
||||
type: RelaxedAtomicInt32
|
||||
value: 1000
|
||||
mirror: always
|
||||
|
||||
# Timeout clamp in ms for background windows when throttling isn't enabled.
|
||||
- name: dom.min_background_timeout_value_without_budget_throttling
|
||||
type: int32_t
|
||||
type: RelaxedAtomicInt32
|
||||
value: 1000
|
||||
mirror: always
|
||||
|
||||
|
||||
Reference in New Issue
Block a user