From 6425fbd2dd63034fe490044e31a849d2e78bc874 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Fri, 12 Nov 2010 21:36:10 -0500 Subject: [PATCH] Deprecate liberator alias. --- common/content/dactyl.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/common/content/dactyl.js b/common/content/dactyl.js index 8506b7d9..a1e919df 100644 --- a/common/content/dactyl.js +++ b/common/content/dactyl.js @@ -23,12 +23,12 @@ function deprecated(reason, fn) { let name, func = callable(fn) ? fn : function () this[fn].apply(this, arguments); function deprecatedMethod() { let frame = Components.stack.caller; + let obj = this.className || this.constructor.className; if (!set.add(deprecatedMethod.seen, frame.filename)) dactyl.echoerr( - frame.filename.replace(/^.*? -> /, "") + + (frame.filename || "unknown").replace(/^.*? -> /, "") + ":" + frame.lineNumber + ": " + - (this.className || this.constructor.className) + "." + - (fn.name || name) + " is deprecated: " + reason); + (obj ? obj + "." : "") + (fn.name || name) + " is deprecated: " + reason); return func.apply(this, arguments); } deprecatedMethod.seen = { "chrome://dactyl/content/javascript.js": true }; @@ -42,8 +42,9 @@ const Dactyl = Module("dactyl", { init: function () { window.dactyl = this; // cheap attempt at compatibility - window.liberator = this; - modules.liberator = this; + let prop = { get: deprecated("Please use dactyl instead", function liberator() dactyl) }; + Object.defineProperty(window, "liberator", prop); + Object.defineProperty(modules, "liberator", prop); this.commands = {}; this.modules = modules; this.observers = {};