Bug 202655 - iOS Safari: timestamps can be identical for consecutive rAF callbacks
Summary: iOS Safari: timestamps can be identical for consecutive rAF callbacks
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: Safari 12
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-10-07 14:36 PDT by Nolan Lawson
Modified: 2019-10-10 18:11 PDT (History)
7 users (show)

See Also:


Attachments
Repro HTML page (843 bytes, text/html)
2019-10-07 14:36 PDT, Nolan Lawson
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nolan Lawson 2019-10-07 14:36:18 PDT
Created attachment 380363 [details]
Repro HTML page

Consider a web page trying to measure framerate by using the timestamps passed in to requestAnimationFrame callbacks. Per the event loop spec (https://html.spec.whatwg.org/multipage/webappapis.html#event-loop-processing-model) it seems that the timestamps should typically be ~16ms apart (and certainly >0ms apart), but on iOS Safari it's possible for them to be 0ms apart.

Here is a sample page to demonstrate: https://bl.ocks.org/nolanlawson/raw/99773cc8edc4115e6ba156a503dd2c41/

You might have to refresh the page a few times to reproduce, but often there will be one rAF callback whose timestamp is exactly the same as the previous one, e.g.:

    12
    24 (+12)
    34 (+10)
    34 (+0)  <-- exactly the same as the last one
    43 (+9)

So far this seems only reproducible on iOS Safari. I can repro on both iOS 12.4 and 13.0 (using a real iPhone for the first and a simulator for the second).

I'm not sure if the issue is with the timestamp or if the rAF callbacks are truly firing on the same turn of the event loop.
Comment 1 Radar WebKit Bug Importer 2019-10-07 14:52:00 PDT
<rdar://problem/56051818>