Bug 997440 - Fix some error reporting nastiness in the CPS tests. r=bz
authorBobby Holley <bobbyholley@gmail.com>
Tue, 20 May 2014 22:52:19 -0700
changeset 184059 267663b1b22af87082820e5115cda3ede47e1b28
parent 184058 cde76de1bea63d50916fe2b56be3907e43e6ab48
child 184060 93188d7e82e8af1899759562d51409f7b1adaf0f
push id26810
push usercbook@mozilla.com
push dateWed, 21 May 2014 11:46:36 +0000
treeherdermozilla-central@50fb8c4db2fd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs997440
milestone32.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 997440 - Fix some error reporting nastiness in the CPS tests. r=bz
toolkit/components/contentprefs/tests/unit_cps2/head.js
--- a/toolkit/components/contentprefs/tests/unit_cps2/head.js
+++ b/toolkit/components/contentprefs/tests/unit_cps2/head.js
@@ -37,21 +37,30 @@ function runAsyncTests(tests) {
         if (err.stack) {
           err = err + "\n\nTraceback (most recent call first):\n" + err.stack +
                       "\nUseless do_throw stack:";
         }
         do_throw(err);
       }
     },
     consoleError: function (scriptErr) {
-      // As much as possible make sure the error is related to the test.  On the
-      // other hand if this fails to catch a test-related error, we'll hang.
-      let filename = scriptErr.sourceName || scriptErr.toString() || "";
-      if (/contentpref/i.test(filename))
-        do_throw(scriptErr);
+      // Previously, this code checked for console errors related to the test,
+      // and treated them as failures. This was problematic, because our current
+      // very-broken exception reporting machinery in XPCWrappedJSClass reports
+      // errors to the console even if there's actually JS on the stack above
+      // that will catch them. And a lot of the tests here intentionally trigger
+      // error conditions on the JS-implemented XPCOM component (see erroneous()
+      // in test_getSubdomains.js, for example). In the old world, we got lucky,
+      // and the errors were never reported to the console due to happenstantial
+      // JSContext reasons that aren't really worth going into.
+      //
+      // So. We make sure to dump this stuff so that it shows up in the logs, but
+      // don't turn them into duplicate failures of the exception that was already
+      // propagated to the caller.
+      dump("AsyncRunner.jsm observed console error: " +  scriptErr + "\n");
     }
   });
 
   next = asyncRunner.next.bind(asyncRunner);
 
   do_register_cleanup(function () {
     asyncRunner.destroy();
     asyncRunner = null;