tor-browser

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

browser_jsterm_eager_evaluation_warnings.js (1024B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 "use strict";
      6 
      7 const TEST_URI = `data:text/html;charset=utf-8,<!DOCTYPE html>Test that eager evaluation can't log warnings in the output`;
      8 add_task(async function () {
      9  const hud = await openNewTabAndConsole(TEST_URI);
     10 
     11  setInputValue(hud, `document.getElementById("")`);
     12  await waitForEagerEvaluationResult(hud, "null");
     13 
     14  info("Wait for a bit so a warning message could be displayed");
     15  await wait(2000);
     16  is(
     17    findWarningMessage(hud, "getElementById"),
     18    undefined,
     19    "The eager evaluation did not triggered a warning message"
     20  );
     21 
     22  info("Sanity check for the warning message when the expression is evaluated");
     23  EventUtils.synthesizeKey("KEY_Enter");
     24  await waitFor(() => findWarningMessage(hud, "getElementById"));
     25  ok(true, "Evaluation of the expression does trigger the warning message");
     26 });