tor-browser

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

idlharness.window.js (870B)


      1 // META: script=/resources/WebIDLParser.js
      2 // META: script=/resources/idlharness.js
      3 
      4 'use strict';
      5 
      6 // https://w3c.github.io/paint-timing/
      7 
      8 idl_test(
      9  ['paint-timing'],
     10  ['performance-timeline', 'hr-time'],
     11  (idl_array, t) => {
     12    idl_array.add_objects({
     13      PerformancePaintTiming: ['paintTiming'],
     14    });
     15 
     16    const awaitPaint = new Promise(resolve => {
     17      let observer = new PerformanceObserver(list => {
     18        self.paintTiming = list.getEntries()[0];
     19        resolve();
     20      });
     21      observer.observe({ entryTypes: ['paint'] });
     22      const div = document.createElement('div');
     23      div.innerHTML = 'Hello World';
     24      document.body.appendChild(div);
     25    });
     26    const timeout = new Promise((_, reject) => {
     27      t.step_timeout(() => reject('Timed out waiting for paint event'), 3000);
     28    });
     29    return Promise.race([awaitPaint, timeout]);
     30  }
     31 );