1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-20 18:47:58 +01:00

Be somewhat less insistent/more informative in deprecation complaints.

This commit is contained in:
Kris Maglione
2010-10-05 11:10:13 -04:00
parent 3da8b7af2a
commit 37e209bb15
3 changed files with 14 additions and 12 deletions

View File

@@ -25,16 +25,14 @@ const FailedAssertion = Class("FailedAssertion", Error, {
}
});
deprecated.seen = {};
function deprecated(fn)
deprecated.seen = { "chrome://dactyl/content/javascript.js": true };
function deprecated(reason, fn)
function deprecatedMethod() {
let frame = Components.stack.caller;
let caller = frame.filename + ":" + frame.lineNumber;
if (frame.filename != "chrome://dactyl/content/javascript.js" &&
!set.add(deprecated.seen, caller))
dactyl.echoerr(caller + ": " +
if (!set.add(deprecated.seen, frame.filename))
dactyl.echoerr(frame.filename + ":" + frame.lineNumber + ": " +
(this.className || this.constructor.className) + "." + fn.name +
" is deprecated");
" is deprecated: " + reason);
return fn.apply(this, arguments);
}
@@ -691,7 +689,8 @@ const Dactyl = Module("dactyl", {
*/
_globalVariables: {},
globalVariables: Class.Property({
get: deprecated(function globalVariables() this._globalVariables)
get: deprecated("Please use the options system instead",
function globalVariables() this._globalVariables)
}),
loadPlugins: function () {