Bug 247863

Summary: PerformanceObserver does not queue a task on observe call
Product: WebKit Reporter: Philip Walton <philip>
Component: New BugsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED CONFIGURATION CHANGED    
Severity: Normal CC: achristensen, ahmad.saleem792, cdumez, karlcow, noam, rbuis, webkit-bug-importer
Priority: P2 Keywords: BrowserCompat, InRadar
Version: Safari Technology Preview   
Hardware: Mac (Intel)   
OS: macOS 12   

Philip Walton
Reported 2022-11-13 11:30:21 PST
Steps to reproduce: 1. Navigate to https://example.com in Safari and wait for content to appear on the screen 2. Open the Web Inspector and paste the following code into the JavaScript console: ``` const po = new PerformanceObserver(() => { console.log('PO handler scope'); }); po.observe({type: 'paint', buffered: true}); console.log('Top-level scope'); ``` 3. Notice the order in which the log statements are printed. In Safari the order is: ``` PO handler scope Top-level scope ``` But in Chrome and Firefox the order is reversed: ``` Top-level scope PO handler scope ``` Based on my reading of the observe processing model in the spec [1] both Chrome and Firefox are correct. The last line in the processing model "5.2 observe() method" reads "Queue the PerformanceObserver task with relevantGlobal as input.", which should defer execution of the observer callback until after the current call stack finishes. [1] https://www.w3.org/TR/performance-timeline/#observe-method
Attachments
Karl Dubost
Comment 1 2022-11-14 19:17:07 PST
Wondering if there is a WPT for this.
Radar WebKit Bug Importer
Comment 2 2022-11-20 11:31:15 PST
Noam Rosenthal
Comment 3 2022-11-20 21:33:48 PST
(In reply to Karl Dubost from comment #1) > Wondering if there is a WPT for this. I took a rough look at the WPT folders and I'm pretty sure there isn't.
Ahmad Saleem
Comment 4 2025-12-14 00:13:35 PST
I am unable to reproduce this anymore in Safari Technology Preview 233, so it seems to be fixed. Might be something worth tracking to add WPT or we can close this as `Configuration Changed`.
Note You need to log in before you can comment on or make changes to this bug.