tor-browser

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

wpt_reftest_wait.ts (715B)


      1 import { timeout } from './timeout.js';
      2 
      3 // Copied from https://github.com/web-platform-tests/wpt/blob/master/common/reftest-wait.js
      4 
      5 /**
      6 * Remove the `reftest-wait` class on the document element.
      7 * The reftest runner will wait with taking a screenshot while
      8 * this class is present.
      9 *
     10 * See https://web-platform-tests.org/writing-tests/reftests.html#controlling-when-comparison-occurs
     11 */
     12 export function takeScreenshot() {
     13  document.documentElement.classList.remove('reftest-wait');
     14 }
     15 
     16 /**
     17 * Call `takeScreenshot()` after a delay of at least `ms` milliseconds.
     18 * @param {number} ms - milliseconds
     19 */
     20 export function takeScreenshotDelayed(ms: number) {
     21  timeout(() => {
     22    takeScreenshot();
     23  }, ms);
     24 }