From c889e7cd2205d108035ce0e9d311ba6afb688e54 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Sat, 22 Jan 2011 05:11:04 -0500 Subject: [PATCH] Use WarningMsg rather than ErrorMsg for deprecation warnings. --- common/content/dactyl.js | 12 +++++++++++- common/modules/base.jsm | 2 +- common/modules/prefs.jsm | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/common/content/dactyl.js b/common/content/dactyl.js index ceaab02d..08a717f2 100644 --- a/common/content/dactyl.js +++ b/common/content/dactyl.js @@ -303,7 +303,6 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { commandline.echo(str, commandline.HL_NORMAL, flags); }, - // TODO: Vim replaces unprintable characters in echoerr/echomsg /** * Outputs an error message to the command line. * @@ -327,6 +326,17 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { commandline.echo(str, commandline.HL_ERRORMSG, flags); }, + /** + * Outputs a warning message to the command line. + * + * @param {string} str The message to output. + * @param {number} flags These control the multi-line message behavior. + * See {@link CommandLine#echo}. + */ + warn: function warn(str, flags) { + commandline.echo(str, "WarningMsg", flags | commandline.APPEND_TO_MESSAGES); + }, + // TODO: add proper level constants /** * Outputs an information message to the command line. diff --git a/common/modules/base.jsm b/common/modules/base.jsm index ef3f4928..071688eb 100644 --- a/common/modules/base.jsm +++ b/common/modules/base.jsm @@ -274,7 +274,7 @@ function deprecated(alternative, fn) { ""; let filename = (frame.filename || "unknown").replace(/.* -> /, ""); if (!set.add(deprecatedMethod.seen, filename)) - util.dactyl(fn).echoerr( + util.dactyl(fn).warn( util.urlPath(filename) + ":" + frame.lineNumber + ": " + obj + (fn.name || name) + " is deprecated: Please use " + alternative + " instead"); return func.apply(this, arguments); diff --git a/common/modules/prefs.jsm b/common/modules/prefs.jsm index 04a131b3..4675095c 100644 --- a/common/modules/prefs.jsm +++ b/common/modules/prefs.jsm @@ -174,7 +174,7 @@ var Prefs = Module("prefs", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]) let msg = "Warning: setting preference " + name + ", but it's changed from its default value."; if (message) msg = template.linkifyHelp(msg + " " + message); - util.dactyl.echomsg(msg); + util.dactyl.warn(msg); } },