[Webkit-unassigned] [Bug 221124] New: Not clamp setTimout(..., 0) to 1ms

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Jan 29 00:23:43 PST 2021


https://bugs.webkit.org/show_bug.cgi?id=221124

            Bug ID: 221124
           Summary: Not clamp setTimout(..., 0) to 1ms
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: New Bugs
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: wanming.lin at intel.com

Calls to setTimeout(..., 0) is clamped to a 1 ms timeout in WebKit(https://github.com/WebKit/WebKit/blob/main/Source/WebCore/page/DOMTimer.cpp#L384), this is actually a bug since there's no 1ms clamp in the spec(https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#timer-initialisation-steps), and which will cause scheduling error, e.g.

setTimeout(()=> console.log('1ms timeout'), 1);
setTimeout(()=> console.log('0ms timeout'), 0);

Outputs:
Safari:  1ms timeout, 0ms timeout

Moreover, 1ms clamp may bring performance penalty.

Compatibility:
Firefox: no 1ms clamp
Safari: 1ms clamp
Chrome: 1ms clamp

Chrome is planning to remove this 1ms clamp, see discussion at https://groups.google.com/a/chromium.org/g/blink-dev/c/HKPTp7C1LwY/m/kIbTxKSPAwAJ

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20210129/efc52adb/attachment.htm>


More information about the webkit-unassigned mailing list