tor-browser

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

browser_target_cached-front.js (1005B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 * http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 add_task(async function () {
      5  gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
      6  await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser, {
      7    wantLoad: "about:blank",
      8  });
      9 
     10  const target = await createAndAttachTargetForTab(gBrowser.selectedTab);
     11 
     12  info("Cached front when getFront has not been called");
     13  let getCachedFront = target.getCachedFront("accessibility");
     14  ok(!getCachedFront, "no front exists");
     15 
     16  info("Cached front when getFront has been called but has not finished");
     17  const asyncFront = target.getFront("accessibility");
     18  getCachedFront = target.getCachedFront("accessibility");
     19  ok(!getCachedFront, "no front exists");
     20 
     21  info("Cached front when getFront has been called and has finished");
     22  const front = await asyncFront;
     23  getCachedFront = target.getCachedFront("accessibility");
     24  is(getCachedFront, front, "front is the same as async front");
     25 });