Bug 606498 - Make sure the new nsIScriptError2 is used in all possible places- part 4; r=bzbarsky,dbaron,mrbkap sr=jst a=blocking2.0
authorMihai Sucan <mihai.sucan@gmail.com>
Mon, 20 Dec 2010 12:21:59 -0400
changeset 59515 0b88e1ab00c12dc278d460c8d9d81c23397c1d06
parent 59514 1c10afc9c6cc7cb357962f624eab862e660b087a
child 59516 4e6f930a1363007b847f460ece9ff072d7f76c12
push id1
push usershaver@mozilla.com
push dateTue, 04 Jan 2011 17:58:04 +0000
reviewersbzbarsky, dbaron, mrbkap, jst, blocking2
bugs606498
milestone2.0b9pre
Bug 606498 - Make sure the new nsIScriptError2 is used in all possible places- part 4; r=bzbarsky,dbaron,mrbkap sr=jst a=blocking2.0
toolkit/components/console/hudservice/HUDService.jsm
toolkit/components/console/hudservice/tests/browser/Makefile.in
toolkit/components/console/hudservice/tests/browser/browser_webconsole_bug_595934_message_categories.js
toolkit/components/console/hudservice/tests/browser/test-bug-595934-canvas-css.html
toolkit/components/console/hudservice/tests/browser/test-bug-595934-canvas-css.js
toolkit/components/console/hudservice/tests/browser/test-bug-595934-canvas.html
toolkit/components/console/hudservice/tests/browser/test-bug-595934-canvas.js
toolkit/components/console/hudservice/tests/browser/test-bug-595934-css-parser.css
toolkit/components/console/hudservice/tests/browser/test-bug-595934-css-parser.html
toolkit/components/console/hudservice/tests/browser/test-bug-595934-dom-events-external.html
toolkit/components/console/hudservice/tests/browser/test-bug-595934-dom-events-external.js
toolkit/components/console/hudservice/tests/browser/test-bug-595934-dom-events-external2.html
toolkit/components/console/hudservice/tests/browser/test-bug-595934-dom-events-external2.js
toolkit/components/console/hudservice/tests/browser/test-bug-595934-dom-html-external.html
toolkit/components/console/hudservice/tests/browser/test-bug-595934-dom-html-external.js
toolkit/components/console/hudservice/tests/browser/test-bug-595934-empty-getelementbyid.html
toolkit/components/console/hudservice/tests/browser/test-bug-595934-empty-getelementbyid.js
toolkit/components/console/hudservice/tests/browser/test-bug-595934-malformedxml-external.html
toolkit/components/console/hudservice/tests/browser/test-bug-595934-malformedxml-external.xml
toolkit/components/console/hudservice/tests/browser/test-bug-595934-workers.html
toolkit/components/console/hudservice/tests/browser/test-bug-595934-workers.js
--- a/toolkit/components/console/hudservice/HUDService.jsm
+++ b/toolkit/components/console/hudservice/HUDService.jsm
@@ -5610,17 +5610,16 @@ HUDConsoleObserver = {
       case "XPConnect JavaScript":
       case "component javascript":
       case "chrome javascript":
       case "chrome registration":
       case "XBL":
       case "XBL Prototype Handler":
       case "XBL Content Sink":
       case "xbl javascript":
-      case "FrameConstructor":
         return;
 
       default:
         let hudIds = ConsoleUtils.getHUDIdsForScriptError(aSubject);
         for (let i = 0; i < hudIds.length; i++) {
           HUDService.logActivity("console-listener", hudIds[i], aSubject);
         }
         return;
--- a/toolkit/components/console/hudservice/tests/browser/Makefile.in
+++ b/toolkit/components/console/hudservice/tests/browser/Makefile.in
@@ -136,16 +136,34 @@ include $(topsrcdir)/config/rules.mk
 	test-bug-595934-css-loader.html \
 	test-bug-595934-css-loader.css \
 	test-bug-595934-css-loader.css^headers^ \
 	test-bug-595934-dom-html.html \
 	test-bug-595934-imagemap.html \
 	test-bug-595934-html.html \
 	test-bug-595934-malformedxml.xhtml \
 	test-bug-595934-svg.xhtml \
+	test-bug-595934-workers.html \
+	test-bug-595934-workers.js \
+	test-bug-595934-dom-html-external.html \
+	test-bug-595934-dom-html-external.js \
+	test-bug-595934-dom-events-external.html \
+	test-bug-595934-dom-events-external.js \
+	test-bug-595934-dom-events-external2.html \
+	test-bug-595934-dom-events-external2.js \
+	test-bug-595934-canvas.html \
+	test-bug-595934-canvas.js \
+	test-bug-595934-css-parser.html \
+	test-bug-595934-css-parser.css \
+	test-bug-595934-canvas-css.html \
+	test-bug-595934-canvas-css.js \
+	test-bug-595934-malformedxml-external.html \
+	test-bug-595934-malformedxml-external.xml \
+	test-bug-595934-empty-getelementbyid.html \
+	test-bug-595934-empty-getelementbyid.js \
 	test-bug-597136-external-script-errors.html \
 	test-bug-597136-external-script-errors.js \
 	test-bug-613013-console-api-iframe.html \
 	test-bug-597756-reopen-closed-tab.html \
 	test-bug-600183-charset.html \
 	test-bug-600183-charset.html^headers^ \
 	test-bug-601177-log-levels.html \
 	test-bug-601177-log-levels.js \
--- a/toolkit/components/console/hudservice/tests/browser/browser_webconsole_bug_595934_message_categories.js
+++ b/toolkit/components/console/hudservice/tests/browser/browser_webconsole_bug_595934_message_categories.js
@@ -44,31 +44,76 @@ const TESTS = [
     category: "malformed-xml",
     matchString: "malformed-xml",
   },
   { // #6
     file: "test-bug-595934-svg.xhtml",
     category: "SVG",
     matchString: "fooBarSVG",
   },
+  { // #7
+    file: "test-bug-595934-workers.html",
+    category: "DOM Worker javascript",
+    matchString: "fooBarWorker",
+  },
+  { // #8
+    file: "test-bug-595934-dom-html-external.html",
+    category: "DOM:HTML",
+    matchString: "document.all",
+  },
+  { // #9
+    file: "test-bug-595934-dom-events-external.html",
+    category: "DOM Events",
+    matchString: "clientWidth",
+  },
+  { // #10
+    file: "test-bug-595934-dom-events-external2.html",
+    category: "DOM Events",
+    matchString: "preventBubble()",
+  },
+  { // #11
+    file: "test-bug-595934-canvas.html",
+    category: "Canvas",
+    matchString: "strokeStyle",
+  },
+  { // #12
+    file: "test-bug-595934-css-parser.html",
+    category: "CSS Parser",
+    matchString: "foobarCssParser",
+  },
+  { // #13
+    file: "test-bug-595934-malformedxml-external.html",
+    category: "malformed-xml",
+    matchString: "malformed-xml",
+  },
+  { // #14
+    file: "test-bug-595934-empty-getelementbyid.html",
+    category: "DOM",
+    matchString: "getElementById",
+  },
+  { // #15
+    file: "test-bug-595934-canvas-css.html",
+    category: "CSS Parser",
+    matchString: "foobarCanvasCssParser",
+  },
 ];
 
 let pos = -1;
 
 let TestObserver = {
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]),
 
   observe: function test_observe(aSubject)
   {
     if (!(aSubject instanceof Ci.nsIScriptError)) {
       return;
     }
 
     is(aSubject.category, TESTS[pos].category,
-      "test #" + pos + ": error category");
+      "test #" + pos + ": error category '" + TESTS[pos].category + "'");
 
     if (aSubject.category == TESTS[pos].category) {
       executeSoon(performTest);
     }
     else {
       testEnd();
     }
   }
@@ -109,18 +154,18 @@ function testNext() {
 function testEnd() {
   Services.console.unregisterListener(TestObserver);
   finishTest();
 }
 
 function performTest() {
   let textContent = hud.outputNode.textContent;
   isnot(textContent.indexOf(TESTS[pos].matchString), -1,
-    "test #" + pos + ": message found");
+    "test #" + pos + ": message found '" + TESTS[pos].matchString + "'");
 
   testNext();
 }
 
 function test() {
-  addTab("data:text/html,Web Console test for bug 595934.");
+  addTab("data:text/html,Web Console test for bug 595934 - message categories coverage.");
   browser.addEventListener("load", tabLoad, true);
 }
 
new file mode 100644
--- /dev/null
+++ b/toolkit/components/console/hudservice/tests/browser/test-bug-595934-canvas-css.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html lang="en">
+  <head>
+    <title>Web Console test for bug 595934 - category: CSS Parser (with
+      Canvas)</title>
+    <!-- Any copyright is dedicated to the Public Domain.
+         http://creativecommons.org/publicdomain/zero/1.0/ -->
+    <script type="text/javascript"
+            src="test-bug-595934-canvas-css.js"></script>
+  </head>
+  <body>
+    <p>Web Console test for bug 595934 - category "CSS Parser" (with
+    Canvas).</p>
+    <p><canvas width="200" height="200">Canvas support is required!</canvas></p>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/toolkit/components/console/hudservice/tests/browser/test-bug-595934-canvas-css.js
@@ -0,0 +1,10 @@
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/
+ */
+
+window.addEventListener("DOMContentLoaded", function() {
+  var canvas = document.querySelector("canvas");
+  var context = canvas.getContext("2d");
+  context.strokeStyle = "foobarCanvasCssParser";
+}, false);
new file mode 100644
--- /dev/null
+++ b/toolkit/components/console/hudservice/tests/browser/test-bug-595934-canvas.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html lang="en">
+  <head>
+    <title>Web Console test for bug 595934 - category: Canvas</title>
+<!-- Any copyright is dedicated to the Public Domain.
+     http://creativecommons.org/publicdomain/zero/1.0/ -->
+    <script type="text/javascript"
+      src="test-bug-595934-canvas.js"></script>
+  </head>
+  <body>
+    <p>Web Console test for bug 595934 - category "Canvas".</p>
+    <p><canvas width="200" height="200">Canvas support is required!</canvas></p>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/toolkit/components/console/hudservice/tests/browser/test-bug-595934-canvas.js
@@ -0,0 +1,11 @@
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/
+ */
+
+window.addEventListener("DOMContentLoaded", function() {
+  var canvas = document.querySelector("canvas");
+  var context = canvas.getContext("2d");
+  context.strokeStyle = document;
+}, false);
+
new file mode 100644
--- /dev/null
+++ b/toolkit/components/console/hudservice/tests/browser/test-bug-595934-css-parser.css
@@ -0,0 +1,10 @@
+/*
+ * Any copyright is dedicated to the Public Domain.     
+ * http://creativecommons.org/publicdomain/zero/1.0/
+ */
+
+p {
+  color: #0f0;
+  foobarCssParser: failure;
+}
+
new file mode 100644
--- /dev/null
+++ b/toolkit/components/console/hudservice/tests/browser/test-bug-595934-css-parser.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html lang="en">
+  <head>
+    <title>Web Console test for bug 595934 - category: CSS Parser</title>
+<!-- Any copyright is dedicated to the Public Domain.
+     http://creativecommons.org/publicdomain/zero/1.0/ -->
+     <link rel="stylesheet" type="text/css"
+     href="test-bug-595934-css-parser.css">
+  </head>
+  <body>
+    <p>Web Console test for bug 595934 - category "CSS Parser".</p>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/toolkit/components/console/hudservice/tests/browser/test-bug-595934-dom-events-external.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html lang="en">
+  <head>
+    <title>Web Console test for bug 595934 - category: DOM Events.
+      (external script)</title>
+<!-- Any copyright is dedicated to the Public Domain.
+     http://creativecommons.org/publicdomain/zero/1.0/ -->
+    <script type="text/javascript"
+      src="test-bug-595934-dom-events-external.js"></script>
+  </head>
+  <body>
+    <p>Web Console test for bug 595934 - category "DOM Events" (external
+    script).</p>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/toolkit/components/console/hudservice/tests/browser/test-bug-595934-dom-events-external.js
@@ -0,0 +1,9 @@
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/
+ */
+
+window.addEventListener("DOMContentLoaded", function() {
+  document.width;
+}, false);
+
new file mode 100644
--- /dev/null
+++ b/toolkit/components/console/hudservice/tests/browser/test-bug-595934-dom-events-external2.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html lang="en">
+  <head>
+    <title>Web Console test for bug 595934 - category: DOM Events.
+      (external script 2)</title>
+<!-- Any copyright is dedicated to the Public Domain.
+     http://creativecommons.org/publicdomain/zero/1.0/ -->
+    <script type="text/javascript"
+      src="test-bug-595934-dom-events-external2.js"></script>
+  </head>
+  <body>
+    <p>Web Console test for bug 595934 - category "DOM Events" (external
+    script 2).</p>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/toolkit/components/console/hudservice/tests/browser/test-bug-595934-dom-events-external2.js
@@ -0,0 +1,10 @@
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/
+ */
+
+window.addEventListener("DOMContentLoaded", function(aEvent) {
+  aEvent.preventBubble();
+}, false);
+
+
new file mode 100644
--- /dev/null
+++ b/toolkit/components/console/hudservice/tests/browser/test-bug-595934-dom-html-external.html
@@ -0,0 +1,13 @@
+<html lang="en">
+  <head>
+    <title>Web Console test for bug 595934 - category: DOM:HTML
+      (external script)</title>
+<!-- Any copyright is dedicated to the Public Domain.
+     http://creativecommons.org/publicdomain/zero/1.0/ -->
+    <script type="text/javascript" src="test-bug-595934-dom-html-external.js"></script>
+  </head>
+  <body>
+    <p id="foobar">Web Console test for bug 595934 - category "DOM:HTML" 
+    (external script).</p>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/toolkit/components/console/hudservice/tests/browser/test-bug-595934-dom-html-external.js
@@ -0,0 +1,9 @@
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/
+ */
+
+window.addEventListener("load", function() {
+  document.all.foobar.style.color = "#00f";
+}, false);
+
new file mode 100644
--- /dev/null
+++ b/toolkit/components/console/hudservice/tests/browser/test-bug-595934-empty-getelementbyid.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html lang="en">
+  <head>
+    <title>Web Console test for bug 595934 - category: DOM.
+    (empty getElementById())</title>
+<!-- Any copyright is dedicated to the Public Domain.
+     http://creativecommons.org/publicdomain/zero/1.0/ -->
+    <script type="text/javascript"
+      src="test-bug-595934-empty-getelementbyid.js"></script>
+  </head>
+  <body>
+    <p>Web Console test for bug 595934 - category "DOM"
+    (empty getElementById()).</p>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/toolkit/components/console/hudservice/tests/browser/test-bug-595934-empty-getelementbyid.js
@@ -0,0 +1,8 @@
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/
+ */
+
+window.addEventListener("load", function() {
+  document.getElementById("");
+}, false);
new file mode 100644
--- /dev/null
+++ b/toolkit/components/console/hudservice/tests/browser/test-bug-595934-malformedxml-external.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html lang="en">
+  <head>
+    <title>Web Console test for bug 595934 - category: malformed-xml.
+      (external file)</title>
+<!-- Any copyright is dedicated to the Public Domain.
+     http://creativecommons.org/publicdomain/zero/1.0/ -->
+     <script type="text/javascript"><!--
+       var req = new XMLHttpRequest();
+       req.open("GET", "test-bug-595934-malformedxml-external.xml", true);
+       req.send(null);
+     // --></script>
+  </head>
+  <body>
+    <p>Web Console test for bug 595934 - category "malformed-xml"
+    (external file).</p>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/toolkit/components/console/hudservice/tests/browser/test-bug-595934-malformedxml-external.xml
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<!-- Any copyright is dedicated to the Public Domain.
+     http://creativecommons.org/publicdomain/zero/1.0/ -->
+  </head>
+  <body>
+    <p>Web Console test for bug 595934 - category "malformed-xml".</p>
+  </body>
new file mode 100644
--- /dev/null
+++ b/toolkit/components/console/hudservice/tests/browser/test-bug-595934-workers.html
@@ -0,0 +1,17 @@
+<html lang="en">
+  <head>
+    <title>Web Console test for bug 595934 - category: DOM Worker
+      javascript</title>
+    <!-- Any copyright is dedicated to the Public Domain.
+         http://creativecommons.org/publicdomain/zero/1.0/ -->
+  </head>
+  <body>
+    <p id="foobar">Web Console test for bug 595934 - category "DOM Worker
+    javascript".</p>
+    <script type="text/javascript">
+      var myWorker = new Worker("test-bug-595934-workers.js");
+      myWorker.postMessage("hello world");
+    </script>
+  </body>
+</html>
+
new file mode 100644
--- /dev/null
+++ b/toolkit/components/console/hudservice/tests/browser/test-bug-595934-workers.js
@@ -0,0 +1,9 @@
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/
+ */
+
+onmessage = function() {
+  fooBarWorker();
+}
+