<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>236155</bug_id>
          
          <creation_ts>2022-02-04 13:32:41 -0800</creation_ts>
          <short_desc>PerformanceObserver should work with {type: &apos;paint&apos;, buffered: true }</short_desc>
          <delta_ts>2022-02-09 10:08:33 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>DOM</component>
          <version>Safari 15</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>225305</dup_id>
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>BrowserCompat, InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Andrew Scheuermann">andrewscheuermann</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>bfulgham</cc>
    
    <cc>noam</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>wilander</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1837575</commentid>
    <comment_count>0</comment_count>
    <who name="Andrew Scheuermann">andrewscheuermann</who>
    <bug_when>2022-02-04 13:32:41 -0800</bug_when>
    <thetext>** Steps to reproduce: **

1. Navigate to example.com (or any web page) in Safari and run the following code in the console:

```
new PerformanceObserver((list) =&gt; {
  console.log(&apos;callback invoked&apos;);
  list.getEntries().forEach(console.log);
}).observe({ type: &apos;paint&apos;, buffered: true });
```

** Actual Results: **

Nothing is logged and the callback is not invoked.

** Expected Results: **

A PerformancePaintTiming entry should be logged. The paint entry is logged with this other approach...

```
performance.getEntriesByType(&apos;paint&apos;).forEach(console.log);
```

** Additional Information: **
Related Stack Overflow question -&gt; https://stackoverflow.com/questions/70989089/new-performanceobservercb-observe-type-paint-buffered-true-doesnt-w</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1837628</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2022-02-04 16:14:19 -0800</bug_when>
    <thetext>&lt;rdar://problem/88513217&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1838280</commentid>
    <comment_count>2</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2022-02-07 11:58:01 -0800</bug_when>
    <thetext>

*** This bug has been marked as a duplicate of bug 78011 ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1838963</commentid>
    <comment_count>3</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2022-02-08 16:57:46 -0800</bug_when>
    <thetext>Not a dup.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1839022</commentid>
    <comment_count>4</comment_count>
    <who name="Noam Rosenthal">noam</who>
    <bug_when>2022-02-08 22:34:41 -0800</bug_when>
    <thetext>This is already covered in a web platform test: https://wpt.live/paint-timing/fcp-only/fcp-iframe.html

From what I checked it works as expected in safari. I also tested it manually in a fresh page.

Note that the observer needs to be added before the paint happens - in your example steps that&apos;s not the case.

Can you post a test page where you add an observer before the paint and the observer is not called?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1839226</commentid>
    <comment_count>5</comment_count>
    <who name="Andrew Scheuermann">andrewscheuermann</who>
    <bug_when>2022-02-09 09:48:36 -0800</bug_when>
    <thetext>To clarify, the &quot;Steps to reproduce&quot; show a PerformanceObserver that is created with {type: &apos;paint&apos;, buffered: true}. The presence of the buffered parameter means that the PerformanceObserver callback should invoke with paint entries that occurred ~before~ the observer is added.

You can reproduce this buffered behavior on Chrome, Firefox, Opera, and Edge by copying in the code at any time after the initial paint occurs.


I&apos;ve updated the bug description to &quot;PerformanceObserver should work with {type: &apos;paint&apos;, buffered: true }&quot;

https://developer.mozilla.org/en-US/docs/Web/API/PerformanceObserver/observe#parameters</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1839240</commentid>
    <comment_count>6</comment_count>
    <who name="Noam Rosenthal">noam</who>
    <bug_when>2022-02-09 09:58:57 -0800</bug_when>
    <thetext>(In reply to Andrew Scheuermann from comment #5)
&gt; To clarify, the &quot;Steps to reproduce&quot; show a PerformanceObserver that is
&gt; created with {type: &apos;paint&apos;, buffered: true}. The presence of the buffered
&gt; parameter means that the PerformanceObserver callback should invoke with
&gt; paint entries that occurred ~before~ the observer is added.
&gt; 
&gt; You can reproduce this buffered behavior on Chrome, Firefox, Opera, and Edge
&gt; by copying in the code at any time after the initial paint occurs.
&gt; 
&gt; 
&gt; I&apos;ve updated the bug description to &quot;PerformanceObserver should work with
&gt; {type: &apos;paint&apos;, buffered: true }&quot;
&gt; 
&gt; https://developer.mozilla.org/en-US/docs/Web/API/PerformanceObserver/
&gt; observe#parameters

Ah. I think this is a dup of https://bugs.webkit.org/show_bug.cgi?id=225305</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1839244</commentid>
    <comment_count>7</comment_count>
    <who name="Noam Rosenthal">noam</who>
    <bug_when>2022-02-09 10:05:46 -0800</bug_when>
    <thetext>

*** This bug has been marked as a duplicate of bug 225305 ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1839249</commentid>
    <comment_count>8</comment_count>
    <who name="Noam Rosenthal">noam</who>
    <bug_when>2022-02-09 10:08:33 -0800</bug_when>
    <thetext>I marked it as dup, and found an existing failing WPT for this https://wpt.fyi/results/paint-timing/fcp-only/buffered-flag.window.html?label=experimental&amp;label=master&amp;aligned which would make it easier to reproduce and fix.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>