w3c / performance-timeline

Performance Timeline
https://w3c.github.io/performance-timeline/
Other
111 stars 27 forks source link

Is the observer buffer of a PerformanceObserver a PerformanceObserverEntryList or a PerformanceEntryList? #167

Closed joyeecheung closed 4 years ago

joyeecheung commented 4 years ago

The last step of Queue a PerformanceEntry is currently specified as:

  1. For each PerformanceObserver object po in notify list, run these steps:
    1. Let entries be a copy of po’s observer buffer.
    2. Empty po’s observer buffer.
    3. If entries is non-empty, call po’s callback with entries as first argument and po as the second argument and callback this value. If this throws an exception, report the exception.

While The PerformanceObserver interface is defined with

callback PerformanceObserverCallback = void (PerformanceObserverEntryList entries,
                                             PerformanceObserver observer);

and

A PerformanceEntryList object called the observer buffer that is initially empty.

From what I can tell, PerformanceObserverEntryList just wraps around a (unsorted) PerformanceEntryList so it seems there is specification missing on

  1. How a PerformanceObserverEntryList should be created from a PerformanceEntryList
  2. The conversion should be done before passing the entires to the performance observer's callback
npm1 commented 4 years ago

True, that's not quite right. The PerformanceObserverEntryList constructor should receive a list, and the methods should be defined in terms of that list. The 'context object's observer buffer' is wrong since the context object is a PerformanceObserverEntryList, not a PerformanceObserver. Thanks for reporting the issue :)