From 6037b10a05a1b8a559d00338f6dcfe8488a909ff Mon Sep 17 00:00:00 2001 From: "gavin@gavinsharp.com" Date: Mon, 23 Jul 2007 19:48:54 -0700 Subject: [PATCH] Bug 355195: only enable debug.js assertions in non-release builds (based on the app update channel pref), r=mconnor --- toolkit/content/debug.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/toolkit/content/debug.js b/toolkit/content/debug.js index 45da5c07bc66..7287c49514dd 100644 --- a/toolkit/content/debug.js +++ b/toolkit/content/debug.js @@ -65,8 +65,29 @@ function NS_ASSERT(condition, message) { if (condition) return; + 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 "beta": + case "default": + releaseBuild = false; + } + } catch(ex) {} + var caller = arguments.callee.caller; var assertionText = "ASSERT: " + message + "\n"; + + 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); var stackText = "";