Bug 1215203 - Log a deprecation warning when DevToolsUtils.dbg_assert is called. r=jlongster

This commit is contained in:
Nick Fitzgerald 2015-10-15 16:04:00 -04:00
parent e8e1387f15
commit dbcefad986

View File

@ -441,7 +441,18 @@ exports.defineLazyGetter = function defineLazyGetter(aObject, aName, aLambda) {
};
// DEPRECATED: use DevToolsUtils.assert(condition, message) instead!
let haveLoggedDeprecationMessage = false;
exports.dbg_assert = function dbg_assert(cond, e) {
if (!haveLoggedDeprecationMessage) {
haveLoggedDeprecationMessage = true;
const deprecationMessage = "DevToolsUtils.dbg_assert is deprecated! Use DevToolsUtils.assert instead!\n"
+ Error().stack;
dump(deprecationMessage);
if (typeof console === "object" && console && console.warn) {
console.warn(deprecationMessage);
}
}
if (!cond) {
return e;
}