tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

buffered-flag.any.js (1339B)


      1 async_test(t => {
      2  // First observer creates second in callback to ensure the entry has been dispatched by the time
      3  // the second observer begins observing.
      4  new PerformanceObserver(() => {
      5    // Second observer requires 'buffered: true' to see an entry.
      6    new PerformanceObserver(t.step_func_done(list => {
      7      const entries = list.getEntries();
      8      assert_equals(entries.length, 1, 'There should be 1 mark entry.');
      9      assert_equals(entries[0].entryType, 'mark');
     10    })).observe({type: 'mark', buffered: true});
     11  }).observe({entryTypes: ['mark']});
     12  performance.mark('foo');
     13 }, 'PerformanceObserver with buffered flag sees previous marks');
     14 
     15 async_test(t => {
     16  // First observer creates second in callback to ensure the entry has been dispatched by the time
     17  // the second observer begins observing.
     18  new PerformanceObserver(() => {
     19    // Second observer requires 'buffered: true' to see an entry.
     20    new PerformanceObserver(t.step_func_done(list => {
     21      const entries = list.getEntries();
     22      assert_equals(entries.length, 1, 'There should be 1 measure entry.');
     23      assert_equals(entries[0].entryType, 'measure');
     24    })).observe({type: 'measure', buffered: true});
     25  }).observe({entryTypes: ['measure']});
     26  performance.measure('bar');
     27 }, 'PerformanceObserver with buffered flag sees previous measures');