diff --git a/common/content/bookmarks.js b/common/content/bookmarks.js index 887187a7..7565de63 100644 --- a/common/content/bookmarks.js +++ b/common/content/bookmarks.js @@ -197,7 +197,7 @@ var Bookmarks = Module("bookmarks", { } }, - getSearchEngines: deprecated("Please use bookmarks.searchEngines instead", function getSearchEngines() this.searchEngines), + getSearchEngines: deprecated("bookmarks.searchEngines", function getSearchEngines() this.searchEngines), /** * Returns a list of all visible search engines in the search * services, augmented with keyword, title, and icon properties for diff --git a/common/content/buffer.js b/common/content/buffer.js index 55a164f0..b136f18e 100644 --- a/common/content/buffer.js +++ b/common/content/buffer.js @@ -600,7 +600,7 @@ var Buffer = Module("buffer", { * @param {bool} follow Whether to follow the matching link. * @param {string} path The XPath to use for the search. @optional */ - followDocumentRelationship: deprecated("Please use buffer.findLink instead", + followDocumentRelationship: deprecated("buffer.findLink", function followDocumentRelationship(rel) { this.findLink(rel, options[rel + "pattern"], 0, true); }), @@ -1102,24 +1102,24 @@ var Buffer = Module("buffer", { this.setZoom(Math.round(values[i] * 100), fullZoom); }, - getAllFrames: deprecated("Please use buffer.allFrames instead", function getAllFrames() buffer.getAllFrames.apply(buffer, arguments)), - scrollTop: deprecated("Please use buffer.scrollToPercent instead", function scrollTop() buffer.scrollToPercent(null, 0)), - scrollBottom: deprecated("Please use buffer.scrollToPercent instead", function scrollBottom() buffer.scrollToPercent(null, 100)), - scrollStart: deprecated("Please use buffer.scrollToPercent instead", function scrollStart() buffer.scrollToPercent(0, null)), - scrollEnd: deprecated("Please use buffer.scrollToPercent instead", function scrollEnd() buffer.scrollToPercent(100, null)), - scrollColumns: deprecated("Please use buffer.scrollHorizontal instead", function scrollColumns(cols) buffer.scrollHorizontal("columns", cols)), - scrollPages: deprecated("Please use buffer.scrollHorizontal instead", function scrollPages(pages) buffer.scrollVertical("pages", pages)), - scrollTo: deprecated("Please use Buffer.scrollTo instead", function scrollTo(x, y) content.scrollTo(x, y)), - textZoom: deprecated("Please use buffer.zoomValue and buffer.fullZoom instead", function textZoom() config.browser.markupDocumentViewer.textZoom * 100) + getAllFrames: deprecated("buffer.allFrames", function getAllFrames() buffer.getAllFrames.apply(buffer, arguments)), + scrollTop: deprecated("buffer.scrollToPercent", function scrollTop() buffer.scrollToPercent(null, 0)), + scrollBottom: deprecated("buffer.scrollToPercent", function scrollBottom() buffer.scrollToPercent(null, 100)), + scrollStart: deprecated("buffer.scrollToPercent", function scrollStart() buffer.scrollToPercent(0, null)), + scrollEnd: deprecated("buffer.scrollToPercent", function scrollEnd() buffer.scrollToPercent(100, null)), + scrollColumns: deprecated("buffer.scrollHorizontal", function scrollColumns(cols) buffer.scrollHorizontal("columns", cols)), + scrollPages: deprecated("buffer.scrollHorizontal", function scrollPages(pages) buffer.scrollVertical("pages", pages)), + scrollTo: deprecated("Buffer.scrollTo", function scrollTo(x, y) content.scrollTo(x, y)), + textZoom: deprecated("buffer.zoomValue and buffer.fullZoom", function textZoom() config.browser.markupDocumentViewer.textZoom * 100) }, { ZOOM_MIN: Class.memoize(function () prefs.get("zoom.minPercent")), ZOOM_MAX: Class.memoize(function () prefs.get("zoom.maxPercent")), - setZoom: deprecated("Please use buffer.setZoom instead", function setZoom() buffer.setZoom.apply(buffer, arguments)), - bumpZoomLevel: deprecated("Please use buffer.bumpZoomLevel instead", function bumpZoomLevel() buffer.bumpZoomLevel.apply(buffer, arguments)), + setZoom: deprecated("buffer.setZoom", function setZoom() buffer.setZoom.apply(buffer, arguments)), + bumpZoomLevel: deprecated("buffer.bumpZoomLevel", function bumpZoomLevel() buffer.bumpZoomLevel.apply(buffer, arguments)), - findScrollableWindow: deprecated("Please use buffer.findScrollableWindow instead", function findScrollableWindow() buffer.findScrollableWindow.apply(buffer, arguments)), - findScrollable: deprecated("Please use buffer.findScrollable instead", function findScrollable() buffer.findScrollable.apply(buffer, arguments)), + findScrollableWindow: deprecated("buffer.findScrollableWindow", function findScrollableWindow() buffer.findScrollableWindow.apply(buffer, arguments)), + findScrollable: deprecated("buffer.findScrollable", function findScrollable() buffer.findScrollable.apply(buffer, arguments)), isScrollable: function isScrollable(elem, dir, horizontal) { let pos = "scrollTop", size = "clientHeight", max = "scrollHeight", layoutSize = "offsetHeight", diff --git a/common/content/dactyl.js b/common/content/dactyl.js index 61cfdbd1..6918964a 100644 --- a/common/content/dactyl.js +++ b/common/content/dactyl.js @@ -23,7 +23,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { init: function () { window.dactyl = this; // cheap attempt at compatibility - let prop = { get: deprecated("Please use dactyl instead", function liberator() dactyl) }; + let prop = { get: deprecated("dactyl", function liberator() dactyl) }; Object.defineProperty(window, "liberator", prop); Object.defineProperty(modules, "liberator", prop); this.commands = {}; @@ -92,7 +92,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { * @property {number} The current main mode. * @see modes#mainModes */ - mode: deprecated("Please use modes.main instead", { + mode: deprecated("modes.main", { get: function mode() modes.main, set: function mode(val) modes.main = val }), @@ -108,7 +108,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { forceNewTab: false, forceNewWindow: false, - version: deprecated("Please use config.version instead", { get: function version() config.version }), + version: deprecated("config.version", { get: function version() config.version }), /** * @property {Object} The map of command-line options. These are @@ -290,9 +290,9 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { } }, - dump: deprecated("Please use util.dump instead", + dump: deprecated("util.dump", { get: function dump() util.closure.dump }), - dumpStack: deprecated("Please use util.dumpStack instead", + dumpStack: deprecated("util.dumpStack", { get: function dumpStack() util.closure.dumpStack }), /** @@ -887,7 +887,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { * These are set and accessed with the "g:" prefix. */ _globalVariables: {}, - globalVariables: deprecated("Please use the options system instead", { + globalVariables: deprecated("the options system", { get: function globalVariables() this._globalVariables }), @@ -1102,7 +1102,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { * @param {string} str * @returns {string[]} */ - stringToURLArray: deprecated("Please use dactyl.parseURLs instead", "parseURLs"), + stringToURLArray: deprecated("dactyl.parseURLs", "parseURLs"), parseURLs: function parseURLs(str) { let urls; diff --git a/common/content/options.js b/common/content/options.js index 6ba6754f..2df535e3 100644 --- a/common/content/options.js +++ b/common/content/options.js @@ -159,11 +159,11 @@ var Option = Class("Option", { dactyl.triggerObserver("options." + this.name, newValues); }, - getValues: deprecated("Please use Option#get instead", "get"), - setValues: deprecated("Please use Option#set instead", "set"), - joinValues: deprecated("Please use Option#stringify instead", "stringify"), - parseValues: deprecated("Please use Option#parse instead", "parse"), - values: deprecated("Please use Option#value instead", { + getValues: deprecated("Option#get", "get"), + setValues: deprecated("Option#set", "set"), + joinValues: deprecated("Option#stringify", "stringify"), + parseValues: deprecated("Option#parse", "parse"), + values: deprecated("Option#value", { get: function values() this.value, set: function values(val) this.value = val }), @@ -686,18 +686,18 @@ var Options = Module("options", { this.__defineSetter__(name, function (value) { this._optionMap[name].value = value; }); }, - allPrefs: deprecated("Please use prefs.getNames instead", function allPrefs() prefs.getNames.apply(prefs, arguments)), - getPref: deprecated("Please use prefs.get instead", function getPref() prefs.get.apply(prefs, arguments)), - invertPref: deprecated("Please use prefs.invert instead", function invertPref() prefs.invert.apply(prefs, arguments)), - listPrefs: deprecated("Please use prefs.list instead", function listPrefs() { commandline.commandOutput(prefs.list.apply(prefs, arguments)); }), - observePref: deprecated("Please use prefs.observe instead", function observePref() prefs.observe.apply(prefs, arguments)), - popContext: deprecated("Please use prefs.popContext instead", function popContext() prefs.popContext.apply(prefs, arguments)), - pushContext: deprecated("Please use prefs.pushContext instead", function pushContext() prefs.pushContext.apply(prefs, arguments)), - resetPref: deprecated("Please use prefs.reset instead", function resetPref() prefs.reset.apply(prefs, arguments)), - safeResetPref: deprecated("Please use prefs.safeReset instead", function safeResetPref() prefs.safeReset.apply(prefs, arguments)), - safeSetPref: deprecated("Please use prefs.safeSet instead", function safeSetPref() prefs.safeSet.apply(prefs, arguments)), - setPref: deprecated("Please use prefs.set instead", function setPref() prefs.set.apply(prefs, arguments)), - withContext: deprecated("Please use prefs.withContext instead", function withContext() prefs.withContext.apply(prefs, arguments)), + allPrefs: deprecated("prefs.getNames", function allPrefs() prefs.getNames.apply(prefs, arguments)), + getPref: deprecated("prefs.get", function getPref() prefs.get.apply(prefs, arguments)), + invertPref: deprecated("prefs.invert", function invertPref() prefs.invert.apply(prefs, arguments)), + listPrefs: deprecated("prefs.list", function listPrefs() { commandline.commandOutput(prefs.list.apply(prefs, arguments)); }), + observePref: deprecated("prefs.observe", function observePref() prefs.observe.apply(prefs, arguments)), + popContext: deprecated("prefs.popContext", function popContext() prefs.popContext.apply(prefs, arguments)), + pushContext: deprecated("prefs.pushContext", function pushContext() prefs.pushContext.apply(prefs, arguments)), + resetPref: deprecated("prefs.reset", function resetPref() prefs.reset.apply(prefs, arguments)), + safeResetPref: deprecated("prefs.safeReset", function safeResetPref() prefs.safeReset.apply(prefs, arguments)), + safeSetPref: deprecated("prefs.safeSet", function safeSetPref() prefs.safeSet.apply(prefs, arguments)), + setPref: deprecated("prefs.set", function setPref() prefs.set.apply(prefs, arguments)), + withContext: deprecated("prefs.withContext", function withContext() prefs.withContext.apply(prefs, arguments)), /** * Returns the option with *name* in the specified *scope*. @@ -1122,7 +1122,7 @@ var Options = Module("options", { dactyl.echoerr("E18: Unexpected characters in :let"); }, { - deprecated: "Please use the options system instead", + deprecated: "the options system", literal: 0 } ); @@ -1202,7 +1202,7 @@ var Options = Module("options", { { argCount: "+", bang: true, - deprecated: "Please use the options system instead" + deprecated: "the options system" }); }, completion: function () { diff --git a/common/modules/base.jsm b/common/modules/base.jsm index de4b2ca1..f65e3f5d 100644 --- a/common/modules/base.jsm +++ b/common/modules/base.jsm @@ -260,9 +260,9 @@ function properties(obj, prototypes, debugger_) { } } -function deprecated(reason, fn) { +function deprecated(alternative, fn) { if (isObject(fn)) - return Class.Property(iter(fn).map(function ([k, v]) [k, callable(v) ? deprecated(reason, v) : v]) + return Class.Property(iter(fn).map(function ([k, v]) [k, callable(v) ? deprecated(alternative, v) : v]) .toObject()); let name, func = callable(fn) ? fn : function () this[fn].apply(this, arguments); @@ -276,7 +276,7 @@ function deprecated(reason, fn) { if (!set.add(deprecatedMethod.seen, filename)) util.dactyl(fn).echoerr( util.urlPath(filename) + ":" + frame.lineNumber + ": " + - obj + (fn.name || name) + " is deprecated: " + reason); + obj + (fn.name || name) + " is deprecated: Please use " + alternative + " instead"); return func.apply(this, arguments); } memoize(deprecatedMethod, "seen", function () set([ @@ -319,8 +319,8 @@ function values(obj) iter(function values() { yield obj[k]; }()); -var forEach = deprecated("Please use iter.forEach instead", function forEach() iter.forEach.apply(iter, arguments)); -var iterAll = deprecated("Please use iter instead", function iterAll() iter.apply(null, arguments)); +var forEach = deprecated("iter.forEach", function forEach() iter.forEach.apply(iter, arguments)); +var iterAll = deprecated("iter", function iterAll() iter.apply(null, arguments)); /** * Utility for managing sets of strings. Given an array, returns an diff --git a/common/modules/io.jsm b/common/modules/io.jsm index 70dfa6ba..d4a44a24 100644 --- a/common/modules/io.jsm +++ b/common/modules/io.jsm @@ -250,7 +250,7 @@ var IO = Module("io", { */ sourcing: null, - expandPath: deprecated("Please use File.expandPath instead", function expandPath() File.expandPath.apply(File, arguments)), + expandPath: deprecated("File.expandPath", function expandPath() File.expandPath.apply(File, arguments)), /** * Returns the first user RC file found in *dir*. @@ -475,7 +475,7 @@ var IO = Module("io", { /** * @property {string} The current platform's path separator. */ - PATH_SEP: deprecated("Please use File.PATH_SEP instead", { get: function PATH_SEP() File.PATH_SEP }) + PATH_SEP: deprecated("File.PATH_SEP", { get: function PATH_SEP() File.PATH_SEP }) }, { init: function init(dactyl, modules, window) { modules.plugins.contexts = {}; diff --git a/common/modules/styles.jsm b/common/modules/styles.jsm index acc6ae5a..b8b0a3e2 100644 --- a/common/modules/styles.jsm +++ b/common/modules/styles.jsm @@ -239,16 +239,16 @@ var Styles = Module("Styles", { let (obj = this[args[0] ? "system" : "user"]) obj[name].apply(obj, Array.slice(args, 1)), - addSheet: deprecated("Please use Styles#{user,system}.add instead", function addSheet() this._proxy("add", arguments)), - findSheets: deprecated("Please use Styles#{user,system}.find instead", function findSheets() this._proxy("find", arguments)), - get: deprecated("Please use Styles#{user,system}.get instead", function get() this._proxy("get", arguments)), - removeSheet: deprecated("Please use Styles#{user,system}.remove instead", function removeSheet() this._proxy("remove", arguments)), + addSheet: deprecated("Styles#{user,system}.add", function addSheet() this._proxy("add", arguments)), + findSheets: deprecated("Styles#{user,system}.find", function findSheets() this._proxy("find", arguments)), + get: deprecated("Styles#{user,system}.get", function get() this._proxy("get", arguments)), + removeSheet: deprecated("Styles#{user,system}.remove", function removeSheet() this._proxy("remove", arguments)), - userSheets: Class.Property({ get: deprecated("Please use Styles#user.sheets instead", function userSheets() this.user.sheets) }), - systemSheets: Class.Property({ get: deprecated("Please use Styles#system.sheets instead", function systemSheets() this.system.sheets) }), - userNames: Class.Property({ get: deprecated("Please use Styles#user.names instead", function userNames() this.user.names) }), - systemNames: Class.Property({ get: deprecated("Please use Styles#system.names instead", function systemNames() this.system.names) }), - sites: Class.Property({ get: deprecated("Please use Styles#user.sites instead", function sites() this.user.sites) }), + userSheets: Class.Property({ get: deprecated("Styles#user.sheets", function userSheets() this.user.sheets) }), + systemSheets: Class.Property({ get: deprecated("Styles#system.sheets", function systemSheets() this.system.sheets) }), + userNames: Class.Property({ get: deprecated("Styles#user.names", function userNames() this.user.names) }), + systemNames: Class.Property({ get: deprecated("Styles#system.names", function systemNames() this.system.names) }), + sites: Class.Property({ get: deprecated("Styles#user.sites", function sites() this.user.sites) }), registerSheet: function registerSheet(url, agent, reload) { let uri = services.io.newURI(url, null, null); diff --git a/common/modules/util.jsm b/common/modules/util.jsm index 45997ccc..be9ab867 100644 --- a/common/modules/util.jsm +++ b/common/modules/util.jsm @@ -817,10 +817,9 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]), .map(function (node) "//" + node).join(" | "); }, - map: deprecated("Please use iter.map instead", function map(obj, fn, self) iter(obj).map(fn, self).toArray()), - - writeToClipboard: deprecated("Please use dactyl.clipboardWrite instead", function writeToClipboard(str, verbose) util.dactyl.clipboardWrite(str, verbose)), - readFromClipboard: deprecated("Please use dactyl.clipboardRead instead", function readFromClipboard() util.dactyl.clipboardRead(false)), + map: deprecated("iter.map", function map(obj, fn, self) iter(obj).map(fn, self).toArray()), + writeToClipboard: deprecated("dactyl.clipboardWrite", function writeToClipboard(str, verbose) util.dactyl.clipboardWrite(str, verbose)), + readFromClipboard: deprecated("dactyl.clipboardRead", function readFromClipboard() util.dactyl.clipboardRead(false)), /** * Converts a URI string into a URI object.