Bug 889911 - Fix tests that unconditionally throw for things reported to the console. r=mrbkap
authorBobby Holley <bobbyholley@gmail.com>
Wed, 31 Jul 2013 10:59:24 -0700
changeset 148163 b935f76df94a1792ee56587fbfdd9db32f159578
parent 148162 4d14436b3b5a3e38220d97582a472dd31b50f2f9
child 148164 772aac97a20ccae01d6a50f88d43ebae8877db29
push id2697
push userbbajaj@mozilla.com
push dateMon, 05 Aug 2013 18:49:53 +0000
treeherdermozilla-beta@dfec938c7b63 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmrbkap
bugs889911
milestone24.0a2
Bug 889911 - Fix tests that unconditionally throw for things reported to the console. r=mrbkap When we start sending everything reported to the JSErrorReporter to the console, these tests end up getting confused by warnings.
toolkit/components/contentprefs/tests/unit_cps2/AsyncRunner.jsm
toolkit/components/social/test/xpcshell/head.js
--- a/toolkit/components/contentprefs/tests/unit_cps2/AsyncRunner.jsm
+++ b/toolkit/components/contentprefs/tests/unit_cps2/AsyncRunner.jsm
@@ -58,12 +58,15 @@ AsyncRunner.prototype = {
   destroy: function AR_destroy() {
     Cc["@mozilla.org/consoleservice;1"].
       getService(Ci.nsIConsoleService).
       unregisterListener(this);
     this.destroy = function AR_alreadyDestroyed() {};
   },
 
   observe: function AR_consoleServiceListener(msg) {
-    if (msg instanceof Ci.nsIScriptError)
+    if (msg instanceof Ci.nsIScriptError &&
+        !(msg.flags & Ci.nsIScriptError.warningFlag))
+    {
       this._callbacks.consoleError(msg);
+    }
   },
 };
--- a/toolkit/components/social/test/xpcshell/head.js
+++ b/toolkit/components/social/test/xpcshell/head.js
@@ -146,18 +146,21 @@ AsyncRunner.prototype = {
   destroy: function destroy() {
     Cc["@mozilla.org/consoleservice;1"].
       getService(Ci.nsIConsoleService).
       unregisterListener(this);
     this.destroy = function alreadyDestroyed() {};
   },
 
   observe: function observe(msg) {
-    if (msg instanceof Ci.nsIScriptError)
+    if (msg instanceof Ci.nsIScriptError &&
+        !(msg.flags & Ci.nsIScriptError.warningFlag))
+    {
       this._callbacks.consoleError(msg);
+    }
   },
 };
 
 
 function promiseAddVisits(aPlaceInfo)
 {
   let deferred = Promise.defer();
   let places = [];