mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-15 14:25:52 +00:00
Bug 874425 - Ensure that we never return an negative duration. r=froydnj
This commit is contained in:
parent
b55a962c1b
commit
992f997845
@ -160,6 +160,11 @@ let Scheduler = {
|
||||
if (!("durationMs" in data)) {
|
||||
return data.ok;
|
||||
}
|
||||
// Bug 874425 demonstrates that two successive calls to Date.now()
|
||||
// can actually produce an interval with negative duration.
|
||||
// We assume that this is due to an operation that is so short
|
||||
// that Date.now() is not monotonic, so we round this up to 0.
|
||||
let durationMs = Math.max(0, data.durationMs);
|
||||
// Accumulate (or initialize) outExecutionDuration
|
||||
if (typeof options.outExecutionDuration == "number") {
|
||||
options.outExecutionDuration += data.durationMs;
|
||||
|
Loading…
Reference in New Issue
Block a user