summaryrefslogtreecommitdiffstats
path: root/devtools/client/webconsole/test/browser/browser_jsterm_eager_evaluation_warnings.js
blob: 446024c7b9a628a5cbcfda8984feade49c8dce2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

"use strict";

const TEST_URI = `data:text/html;charset=utf-8,<!DOCTYPE html>Test that eager evaluation can't log warnings in the output`;
add_task(async function () {
  const hud = await openNewTabAndConsole(TEST_URI);

  setInputValue(hud, `document.getElementById("")`);
  await waitForEagerEvaluationResult(hud, "null");

  info("Wait for a bit so a warning message could be displayed");
  await wait(2000);
  is(
    findWarningMessage(hud, "getElementById"),
    undefined,
    "The eager evaluation did not triggered a warning message"
  );

  info("Sanity check for the warning message when the expression is evaluated");
  EventUtils.synthesizeKey("KEY_Enter");
  await waitFor(() => findWarningMessage(hud, "getElementById"));
  ok(true, "Evaluation of the expression does trigger the warning message");
});