tor-browser

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

browser_jsterm_focus_reload.js (965B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 * http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 // Check that the console does not steal the focus when reloading a page, if the focus
      5 // is on the content page.
      6 
      7 "use strict";
      8 
      9 const TEST_URI = `data:text/html,<!DOCTYPE html><meta charset=utf8>Focus test`;
     10 
     11 add_task(async function () {
     12  info("Testing that messages disappear on a refresh if logs aren't persisted");
     13  const hud = await openNewTabAndConsole(TEST_URI);
     14  is(isInputFocused(hud), true, "JsTerm is focused when opening the console");
     15 
     16  info("Put the focus on the content page");
     17  SpecialPowers.spawn(gBrowser.selectedBrowser, [], () => content.focus());
     18  await waitFor(() => isInputFocused(hud) === false);
     19 
     20  info(
     21    "Reload the page to check that JsTerm does not steal the content page focus"
     22  );
     23  await reloadBrowser();
     24  is(
     25    isInputFocused(hud),
     26    false,
     27    "JsTerm is still unfocused after reloading the page"
     28  );
     29 });