browser_webconsole_execution_scope.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
  2. /* Any copyright is dedicated to the Public Domain.
  3. * http://creativecommons.org/publicdomain/zero/1.0/ */
  4. // Tests that commands run by the user are executed in content space.
  5. "use strict";
  6. const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" +
  7. "test/test-console.html";
  8. add_task(function* () {
  9. yield loadTab(TEST_URI);
  10. let hud = yield openConsole();
  11. hud.jsterm.clearOutput();
  12. hud.jsterm.execute("window.location.href;");
  13. let [input, output] = yield waitForMessages({
  14. webconsole: hud,
  15. messages: [{
  16. text: "window.location.href;",
  17. category: CATEGORY_INPUT,
  18. },
  19. {
  20. text: TEST_URI,
  21. category: CATEGORY_OUTPUT,
  22. }],
  23. });
  24. let inputNode = [...input.matched][0];
  25. let outputNode = [...output.matched][0];
  26. is(inputNode.getAttribute("category"), "input",
  27. "input node category is correct");
  28. is(outputNode.getAttribute("category"), "output",
  29. "output node category is correct");
  30. });