browser_webconsole_bug_611795.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. "use strict";
  5. const TEST_URI = 'data:text/html;charset=utf-8,<div style="-moz-opacity:0;">' +
  6. 'test repeated css warnings</div><p style="-moz-opacity:0">' +
  7. "hi</p>";
  8. var hud;
  9. /**
  10. * Unit test for bug 611795:
  11. * Repeated CSS messages get collapsed into one.
  12. */
  13. add_task(function* () {
  14. yield loadTab(TEST_URI);
  15. hud = yield openConsole();
  16. hud.jsterm.clearOutput(true);
  17. BrowserReload();
  18. yield loadBrowser(gBrowser.selectedBrowser);
  19. yield onContentLoaded();
  20. yield testConsoleLogRepeats();
  21. hud = null;
  22. });
  23. function onContentLoaded() {
  24. let cssWarning = "Unknown property \u2018-moz-opacity\u2019. Declaration dropped.";
  25. return waitForMessages({
  26. webconsole: hud,
  27. messages: [{
  28. text: cssWarning,
  29. category: CATEGORY_CSS,
  30. severity: SEVERITY_WARNING,
  31. repeats: 2,
  32. }],
  33. });
  34. }
  35. function testConsoleLogRepeats() {
  36. let jsterm = hud.jsterm;
  37. jsterm.clearOutput();
  38. jsterm.setInputValue("for (let i = 0; i < 10; ++i) console.log('this is a " +
  39. "line of reasonably long text that I will use to " +
  40. "verify that the repeated text node is of an " +
  41. "appropriate size.');");
  42. jsterm.execute();
  43. return waitForMessages({
  44. webconsole: hud,
  45. messages: [{
  46. text: "this is a line of reasonably long text",
  47. category: CATEGORY_WEBDEV,
  48. severity: SEVERITY_LOG,
  49. repeats: 10,
  50. }],
  51. });
  52. }