Skip to content

Commit

Permalink
Bug 1785549, ensure requestIdleCallback's callback doesn't get deadli…
Browse files Browse the repository at this point in the history
…nes > 50ms, r=mccr8

Differential Revision: https://phabricator.services.mozilla.com/D155867
  • Loading branch information
Olli Pettay authored and Olli Pettay committed Aug 29, 2022
1 parent 00b74d2 commit fa09370
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
4 changes: 3 additions & 1 deletion dom/base/IdleDeadline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ DOMHighResTimeStamp IdleDeadline::TimeRemaining() {
return 0.0;
}

return std::max(mDeadline - performance->Now(), 0.0);
// The web API doesn't expect deadlines > 50ms, but conversion from the
// internal API may lead to some rounding errors.
return std::min(std::max(mDeadline - performance->Now(), 0.0), 50.0);
}

// If there's no window, we're in a system scope, and can just use
Expand Down

This file was deleted.

0 comments on commit fa09370

Please sign in to comment.