[webkit-changes] [WebKit/WebKit] 09e6c5: Regression(248952 at main) setInterval and setTimeout...

Chris Dumez noreply at github.com
Tue May 30 15:14:21 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 09e6c5eb406c8f5d1b112d1fb0fda1cb5db53751
      https://github.com/WebKit/WebKit/commit/09e6c5eb406c8f5d1b112d1fb0fda1cb5db53751
  Author: Chris Dumez <cdumez at apple.com>
  Date:   2023-05-30 (Tue, 30 May 2023)

  Changed paths:
    A LayoutTests/fast/dom/Window/setInterval-setTimeout-zero-ordering-expected.txt
    A LayoutTests/fast/dom/Window/setInterval-setTimeout-zero-ordering.html
    M Source/WebCore/page/DOMTimer.cpp
    M Source/WebCore/page/SuspendableTimer.cpp
    M Source/WebCore/page/SuspendableTimer.h

  Log Message:
  -----------
  Regression(248952 at main) setInterval and setTimeout order isn't respected when timeout is 0
https://bugs.webkit.org/show_bug.cgi?id=253423
rdar://106576260

Reviewed by Darin Adler.

In 248952 at main, we made it so that the setTimeout() delay no longer gets clamped
to 1ms. However, we didn't change the behavior for setInterval(). As a result, the
ordering between `setInterval(0)` and `setTimeout(0)` would no longer be preserved.

To address the issue, we no longer clamp the initial `setInterval()`'s fire
interval to 1ms, only its repeat interval. As a result, `setInterval(0)` will run
on next runloop iteration and then every 1ms.

* LayoutTests/fast/dom/Window/setInterval-setTimeout-zero-ordering-expected.txt: Added.
* LayoutTests/fast/dom/Window/setInterval-setTimeout-zero-ordering.html: Added.
* Source/WebCore/page/DOMTimer.cpp:
(WebCore::DOMTimer::DOMTimer):
* Source/WebCore/page/SuspendableTimer.cpp:
(WebCore::SuspendableTimerBase::startRepeating):
* Source/WebCore/page/SuspendableTimer.h:
(WebCore::SuspendableTimerBase::startRepeating):

Canonical link: https://commits.webkit.org/264701@main




More information about the webkit-changes mailing list