mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-04 13:07:52 +00:00
Bug 355195: only enable debug.js assertions in non-release builds (based on the app update channel pref), r=mconnor
This commit is contained in:
parent
13f37503dc
commit
6037b10a05
@ -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 = "";
|
||||
|
Loading…
x
Reference in New Issue
Block a user