Bug 932419. Stop NS_ASSERT's from popping up a modal dialog in non-release builds, and fix aurora builds to be considered non-release builds for such purposes. r=dao
authorTimothy Nikkel <tnikkel@gmail.com>
Fri, 01 Nov 2013 22:47:22 -0500
changeset 153215 a96aea73b2cf2d8954ef06db5748abf70517d9a0
parent 153214 d6a58ae71318d072d7331c4a1b510c77d6377c5a
child 153216 a769047ad5ad1b2fa026b34a25eb194c0bf23052
push id35718
push usertnikkel@gmail.com
push dateSat, 02 Nov 2013 03:48:11 +0000
treeherdermozilla-inbound@a96aea73b2cf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdao
bugs932419
milestone28.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 932419. Stop NS_ASSERT's from popping up a modal dialog in non-release builds, and fix aurora builds to be considered non-release builds for such purposes. r=dao
toolkit/modules/debug.js
--- a/toolkit/modules/debug.js
+++ b/toolkit/modules/debug.js
@@ -35,34 +35,34 @@ this.NS_ASSERT = function NS_ASSERT(cond
 
   var releaseBuild = true;
   var defB = Components.classes["@mozilla.org/preferences-service;1"]
                        .getService(Components.interfaces.nsIPrefService)
                        .getDefaultBranch(null);
   try {
     switch (defB.getCharPref("app.update.channel")) {
       case "nightly":
+      case "aurora":
       case "beta":
       case "default":
         releaseBuild = false;
     }
   } catch(ex) {}
 
   var caller = arguments.callee.caller;
   var assertionText = "ASSERT: " + message + "\n";
 
+  // Report the error to the console
+  Components.utils.reportError(assertionText);
+
   if (releaseBuild) {
-    // Just report the error to the console
-    Components.utils.reportError(assertionText);
     return;
   }
 
-  // Otherwise, dump to stdout and launch an assertion failure dialog
-  dump(assertionText);
-
+  // dump the stack to stdout too in non-release builds
   var stackText = "";
   if (gTraceOnAssert) {
     stackText = "Stack Trace: \n";
     var count = 0;
     while (caller) {
       stackText += count++ + ":" + caller.name + "(";
       for (var i = 0; i < caller.arguments.length; ++i) {
         var arg = caller.arguments[i];
@@ -70,21 +70,10 @@ this.NS_ASSERT = function NS_ASSERT(cond
         if (i < caller.arguments.length - 1)
           stackText += ",";
       }
       stackText += ")\n";
       caller = caller.arguments.callee.caller;
     }
   }
 
-  var environment = Components.classes["@mozilla.org/process/environment;1"].
-                    getService(Components.interfaces.nsIEnvironment);
-  if (environment.exists("XUL_ASSERT_PROMPT") &&
-      !parseInt(environment.get("XUL_ASSERT_PROMPT")))
-    return;
-
-  var source = null;
-  if (this.window)
-    source = this.window;
-  var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].
-           getService(Components.interfaces.nsIPromptService);
-  ps.alert(source, "Assertion Failed", assertionText + stackText);
+  dump(assertionText + stackText);
 }