summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/performance-timeline/buffered-flag-observer.any.js
blob: 31dc39c128ad55c13eef66583a6888622f86bf63 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
async_test( t=> {
  for (let i = 0; i < 50; i++)
    performance.mark('foo' + i);
  let marksCreated = 50;
  let marksReceived = 0;
  new PerformanceObserver(list => {
    marksReceived += list.getEntries().length;
    if (marksCreated < 100) {
      performance.mark('bar' + marksCreated);
      marksCreated++;
    }
    if (marksReceived == 100)
      t.done();
  }).observe({type: 'mark', buffered: true});
}, 'PerformanceObserver with buffered flag should see past and future entries.');