tor-browser

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

head.js (964B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 const WEB_ROOT = getRootDirectory(gTestPath).replace(
      5  "chrome://mochitests/content",
      6  "https://example.com"
      7 );
      8 
      9 /**
     10 * Waits for the stylesheets to be loaded into the browser menu.
     11 *
     12 * @param browser
     13 *        The browser that contains the webpage we're testing.
     14 * @param styleSheetCount
     15 *        How many stylesheets we expect to be loaded.
     16 * @return Promise
     17 */
     18 function promiseStylesheetsLoaded(browser, styleSheetCount) {
     19  return TestUtils.waitForCondition(() => {
     20    let actor =
     21      browser.browsingContext?.currentWindowGlobal?.getActor("PageStyle");
     22    if (!actor) {
     23      info("No jswindowactor (yet?)");
     24      return false;
     25    }
     26    let sheetCount = actor.getSheetInfo().filteredStyleSheets.length;
     27    info(`waiting for sheets: ${sheetCount}`);
     28    return sheetCount >= styleSheetCount;
     29  }, "waiting for style sheets to load");
     30 }