mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-03-01 15:25:52 +01:00
Cleanup crufty apply code.
This commit is contained in:
@@ -957,7 +957,7 @@ var CommandLine = Module("commandline", {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.savingOutput = true;
|
this.savingOutput = true;
|
||||||
dactyl.trapErrors.apply(dactyl, [fn, self].concat(args));
|
apply(dactyl, "trapErrors", [fn, self].concat(args));
|
||||||
this.savingOutput = false;
|
this.savingOutput = false;
|
||||||
return output.map(elem => elem instanceof Node ? DOM.stringify(elem) : elem)
|
return output.map(elem => elem instanceof Node ? DOM.stringify(elem) : elem)
|
||||||
.join("\n");
|
.join("\n");
|
||||||
@@ -1755,7 +1755,7 @@ var CommandLine = Module("commandline", {
|
|||||||
return Events.PASS;
|
return Events.PASS;
|
||||||
});
|
});
|
||||||
|
|
||||||
let bind = function bind(...args) mappings.add.apply(mappings, [[modes.COMMAND_LINE]].concat(args));
|
let bind = function bind(...args) apply(mappings, "add", [[modes.COMMAND_LINE]].concat(args));
|
||||||
|
|
||||||
bind(["<Esc>", "<C-[>"], "Stop waiting for completions or exit Command Line mode",
|
bind(["<Esc>", "<C-[>"], "Stop waiting for completions or exit Command Line mode",
|
||||||
function ({ self }) {
|
function ({ self }) {
|
||||||
|
|||||||
@@ -1334,7 +1334,7 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), {
|
|||||||
},
|
},
|
||||||
{ count: true });
|
{ count: true });
|
||||||
|
|
||||||
bind = function bind(...args) mappings.add.apply(mappings, [[modes.AUTOCOMPLETE]].concat(args));
|
bind = function bind(...args) apply(mappings, "add", [[modes.AUTOCOMPLETE]].concat(args));
|
||||||
|
|
||||||
bind(["<Esc>"], "Return to Insert mode",
|
bind(["<Esc>"], "Return to Insert mode",
|
||||||
() => Events.PASS_THROUGH);
|
() => Events.PASS_THROUGH);
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ var EventHive = Class("EventHive", Contexts.Hive, {
|
|||||||
capture,
|
capture,
|
||||||
allowUntrusted];
|
allowUntrusted];
|
||||||
|
|
||||||
target.addEventListener.apply(target, args.slice(2));
|
apply(target, "addEventListener", args.slice(2));
|
||||||
this.sessionListeners.push(args);
|
this.sessionListeners.push(args);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -83,7 +83,7 @@ var EventHive = Class("EventHive", Contexts.Hive, {
|
|||||||
&& args[3].wrapped == events[args[2]]
|
&& args[3].wrapped == events[args[2]]
|
||||||
&& args[4] == capture) {
|
&& args[4] == capture) {
|
||||||
|
|
||||||
elem.removeEventListener.apply(elem, args.slice(2));
|
apply(elem, "removeEventListener", args.slice(2));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return elem;
|
return elem;
|
||||||
@@ -426,7 +426,7 @@ var Events = Module("events", {
|
|||||||
|
|
||||||
canonicalKeys: deprecated("DOM.Event.canonicalKeys", { get: function canonicalKeys() DOM.Event.bound.canonicalKeys }),
|
canonicalKeys: deprecated("DOM.Event.canonicalKeys", { get: function canonicalKeys() DOM.Event.bound.canonicalKeys }),
|
||||||
create: deprecated("DOM.Event", function create() DOM.Event.apply(null, arguments)),
|
create: deprecated("DOM.Event", function create() DOM.Event.apply(null, arguments)),
|
||||||
dispatch: deprecated("DOM.Event.dispatch", function dispatch() DOM.Event.dispatch.apply(DOM.Event, arguments)),
|
dispatch: deprecated("DOM.Event.dispatch", function dispatch() apply(DOM.Event, "dispatch", arguments)),
|
||||||
fromString: deprecated("DOM.Event.parse", { get: function fromString() DOM.Event.bound.parse }),
|
fromString: deprecated("DOM.Event.parse", { get: function fromString() DOM.Event.bound.parse }),
|
||||||
iterKeys: deprecated("DOM.Event.iterKeys", { get: function iterKeys() DOM.Event.bound.iterKeys }),
|
iterKeys: deprecated("DOM.Event.iterKeys", { get: function iterKeys() DOM.Event.bound.iterKeys }),
|
||||||
|
|
||||||
@@ -435,7 +435,7 @@ var Events = Module("events", {
|
|||||||
return toString.supercall(this);
|
return toString.supercall(this);
|
||||||
|
|
||||||
deprecated.warn(toString, "toString", "DOM.Event.stringify");
|
deprecated.warn(toString, "toString", "DOM.Event.stringify");
|
||||||
return DOM.Event.stringify.apply(DOM.Event, arguments);
|
return apply(DOM.Event, "stringify", arguments);
|
||||||
},
|
},
|
||||||
|
|
||||||
get defaultTarget() dactyl.focusedElement || content.document.body || document.documentElement,
|
get defaultTarget() dactyl.focusedElement || content.document.body || document.documentElement,
|
||||||
|
|||||||
@@ -354,7 +354,7 @@ var History = Module("history", {
|
|||||||
completion.addUrlCompleter("history", "History", completion.history);
|
completion.addUrlCompleter("history", "History", completion.history);
|
||||||
},
|
},
|
||||||
mappings: function initMappings() {
|
mappings: function initMappings() {
|
||||||
function bind(...args) mappings.add.apply(mappings, [config.browserModes].concat(args));
|
function bind(...args) apply(mappings, "add", [config.browserModes].concat(args));
|
||||||
|
|
||||||
bind(["<C-o>"], "Go to an older position in the jump list",
|
bind(["<C-o>"], "Go to an older position in the jump list",
|
||||||
function ({ count }) { history.stepTo(-Math.max(count, 1), true); },
|
function ({ count }) { history.stepTo(-Math.max(count, 1), true); },
|
||||||
|
|||||||
@@ -252,13 +252,13 @@ var KeyProcessor = Class("KeyProcessor", {
|
|||||||
execute: function execute(map, args)
|
execute: function execute(map, args)
|
||||||
() => {
|
() => {
|
||||||
if (this.preExecute)
|
if (this.preExecute)
|
||||||
this.preExecute.apply(this, args);
|
apply(this, "preExecute", args);
|
||||||
|
|
||||||
args.self = this.main.params.mappingSelf || this.main.mappingSelf || map;
|
args.self = this.main.params.mappingSelf || this.main.mappingSelf || map;
|
||||||
let res = map.execute.call(map, args);
|
let res = map.execute.call(map, args);
|
||||||
|
|
||||||
if (this.postExecute)
|
if (this.postExecute)
|
||||||
this.postExecute.apply(this, args);
|
apply(this, "postExecute", args);
|
||||||
return res;
|
return res;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -414,7 +414,7 @@ var Mappings = Module("mappings", {
|
|||||||
group = this.user;
|
group = this.user;
|
||||||
}
|
}
|
||||||
|
|
||||||
let map = group.add.apply(group, arguments);
|
let map = apply(group, "add", arguments);
|
||||||
map.definedAt = contexts.getCaller(Components.stack.caller);
|
map.definedAt = contexts.getCaller(Components.stack.caller);
|
||||||
return map;
|
return map;
|
||||||
},
|
},
|
||||||
@@ -431,7 +431,7 @@ var Mappings = Module("mappings", {
|
|||||||
* @optional
|
* @optional
|
||||||
*/
|
*/
|
||||||
addUserMap: deprecated("group.mappings.add", function addUserMap() {
|
addUserMap: deprecated("group.mappings.add", function addUserMap() {
|
||||||
let map = this.user.add.apply(this.user, arguments);
|
let map = apply(this.user, "add", arguments);
|
||||||
map.definedAt = contexts.getCaller(Components.stack.caller);
|
map.definedAt = contexts.getCaller(Components.stack.caller);
|
||||||
return map;
|
return map;
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -450,7 +450,7 @@ var Modes = Module("modes", {
|
|||||||
for (let mode of array.iterValues(queue))
|
for (let mode of array.iterValues(queue))
|
||||||
if (!seen.add(mode)) {
|
if (!seen.add(mode)) {
|
||||||
res.push(mode);
|
res.push(mode);
|
||||||
queue.push.apply(queue, mode.bases);
|
apply(queue, "push", mode.bases);
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}),
|
}),
|
||||||
@@ -649,7 +649,7 @@ var Modes = Module("modes", {
|
|||||||
},
|
},
|
||||||
prefs: function initPrefs() {
|
prefs: function initPrefs() {
|
||||||
prefs.watch("accessibility.browsewithcaret",
|
prefs.watch("accessibility.browsewithcaret",
|
||||||
function () { modes.onCaretChange.apply(modes, arguments); });
|
function () { apply(modes, "onCaretChange", arguments); });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ var MOW = Module("mow", {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
__noSuchMethod__: function (meth, args) Buffer[meth].apply(Buffer, [this.body].concat(args)),
|
__noSuchMethod__: function (meth, args) apply(Buffer, meth, [this.body].concat(args)),
|
||||||
|
|
||||||
get widget() this.widgets.multilineOutput,
|
get widget() this.widgets.multilineOutput,
|
||||||
|
|
||||||
|
|||||||
@@ -237,7 +237,7 @@ var StatusLine = Module("statusline", {
|
|||||||
},
|
},
|
||||||
|
|
||||||
unsafeURI: deprecated("util.unsafeURI", { get: function unsafeURI() util.unsafeURI }),
|
unsafeURI: deprecated("util.unsafeURI", { get: function unsafeURI() util.unsafeURI }),
|
||||||
losslessDecodeURI: deprecated("util.losslessDecodeURI", function losslessDecodeURI() util.losslessDecodeURI.apply(util, arguments)),
|
losslessDecodeURI: deprecated("util.losslessDecodeURI", function losslessDecodeURI() apply(util, "losslessDecodeURI", arguments)),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the URL displayed in the status line. Also displays status
|
* Update the URL displayed in the status line. Also displays status
|
||||||
|
|||||||
@@ -238,7 +238,7 @@ var Addon = Class("Addon", {
|
|||||||
|
|
||||||
["cancelUninstall", "findUpdates", "getResourceURI", "hasResource", "isCompatibleWith",
|
["cancelUninstall", "findUpdates", "getResourceURI", "hasResource", "isCompatibleWith",
|
||||||
"uninstall"].forEach(function (prop) {
|
"uninstall"].forEach(function (prop) {
|
||||||
Addon.prototype[prop] = function proxy() this.addon[prop].apply(this.addon, arguments);
|
Addon.prototype[prop] = function proxy() apply(this.addon, prop, arguments);
|
||||||
});
|
});
|
||||||
|
|
||||||
["aboutURL", "appDisabled", "applyBackgroundUpdates", "blocklistState", "contributors", "creator",
|
["aboutURL", "appDisabled", "applyBackgroundUpdates", "blocklistState", "contributors", "creator",
|
||||||
|
|||||||
@@ -270,7 +270,7 @@ function literal(comment) {
|
|||||||
function apply(obj, meth, args) {
|
function apply(obj, meth, args) {
|
||||||
// The function's own apply method breaks in strange ways
|
// The function's own apply method breaks in strange ways
|
||||||
// when using CPOWs.
|
// when using CPOWs.
|
||||||
Function.prototype.apply.call(obj[meth], obj, args);
|
return Function.prototype.apply.call(obj[meth], obj, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -354,7 +354,7 @@ function deprecated(alternative, fn) {
|
|||||||
|
|
||||||
let name,
|
let name,
|
||||||
func = callable(fn) ? fn
|
func = callable(fn) ? fn
|
||||||
: function () this[fn].apply(this, arguments);
|
: function () apply(this, fn, arguments);
|
||||||
|
|
||||||
function deprecatedMethod() {
|
function deprecatedMethod() {
|
||||||
let obj = !this ? "" :
|
let obj = !this ? "" :
|
||||||
@@ -561,7 +561,7 @@ function set() {
|
|||||||
Object.keys(Set).forEach(function (meth) {
|
Object.keys(Set).forEach(function (meth) {
|
||||||
set[meth] = function proxy() {
|
set[meth] = function proxy() {
|
||||||
deprecated.warn(proxy, "set." + meth, "Set." + meth);
|
deprecated.warn(proxy, "set." + meth, "Set." + meth);
|
||||||
return Set[meth].apply(Set, arguments);
|
return apply(Set, meth, arguments);
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -617,7 +617,7 @@ function curry(fn, length, self, acc) {
|
|||||||
var bind = function bind(meth, self, ...args) {
|
var bind = function bind(meth, self, ...args) {
|
||||||
let func = callable(meth) ? meth : self[meth];
|
let func = callable(meth) ? meth : self[meth];
|
||||||
|
|
||||||
return func.bind.apply(func, [self].concat(args));
|
return apply(func, "bind", [self].concat(args));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1728,12 +1728,12 @@ const Iter = Class("Iter", {
|
|||||||
this.iter = iter.__iterator__();
|
this.iter = iter.__iterator__();
|
||||||
|
|
||||||
if (this.iter.finalize)
|
if (this.iter.finalize)
|
||||||
this.finalize = function finalize() this.iter.finalize.apply(this.iter, arguments);
|
this.finalize = function finalize() apply(this.iter, "finalize", arguments);
|
||||||
},
|
},
|
||||||
|
|
||||||
next: function next() this.iter.next(),
|
next: function next() this.iter.next(),
|
||||||
|
|
||||||
send: function send() this.iter.send.apply(this.iter, arguments),
|
send: function send() apply(this.iter, "send", arguments),
|
||||||
|
|
||||||
"@@iterator": function () this.iter,
|
"@@iterator": function () this.iter,
|
||||||
});
|
});
|
||||||
@@ -1915,7 +1915,7 @@ var array = Class("array", Array, {
|
|||||||
let iterProto = Iter.prototype;
|
let iterProto = Iter.prototype;
|
||||||
Object.keys(iter).forEach(function (k) {
|
Object.keys(iter).forEach(function (k) {
|
||||||
iterProto[k] = function (...args) {
|
iterProto[k] = function (...args) {
|
||||||
let res = iter[k].apply(iter, [this].concat(args));
|
let res = apply(iter, k, [this].concat(args));
|
||||||
if (isinstance(res, ["Iterator", "Generator"]))
|
if (isinstance(res, ["Iterator", "Generator"]))
|
||||||
return Iter(res);
|
return Iter(res);
|
||||||
return res;
|
return res;
|
||||||
@@ -1925,7 +1925,7 @@ Object.keys(iter).forEach(function (k) {
|
|||||||
Object.keys(array).forEach(function (k) {
|
Object.keys(array).forEach(function (k) {
|
||||||
if (!(k in iterProto))
|
if (!(k in iterProto))
|
||||||
iterProto[k] = function (...args) {
|
iterProto[k] = function (...args) {
|
||||||
let res = array[k].apply(array, [this.toArray()].concat(args));
|
let res = apply(array, k, [this.toArray()].concat(args));
|
||||||
if (isinstance(res, ["Iterator", "Generator"]))
|
if (isinstance(res, ["Iterator", "Generator"]))
|
||||||
return Iter(res);
|
return Iter(res);
|
||||||
if (isArray(res))
|
if (isArray(res))
|
||||||
@@ -1938,7 +1938,7 @@ Object.getOwnPropertyNames(Array.prototype).forEach(function (k) {
|
|||||||
if (!(k in iterProto) && callable(Array.prototype[k]))
|
if (!(k in iterProto) && callable(Array.prototype[k]))
|
||||||
iterProto[k] = function () {
|
iterProto[k] = function () {
|
||||||
let ary = iter(this).toArray();
|
let ary = iter(this).toArray();
|
||||||
let res = ary[k].apply(ary, arguments);
|
let res = apply(ary, k, arguments);
|
||||||
if (isArray(res))
|
if (isArray(res))
|
||||||
return array(res);
|
return array(res);
|
||||||
return res;
|
return res;
|
||||||
|
|||||||
@@ -204,7 +204,7 @@ var Buffer = Module("Buffer", {
|
|||||||
/**
|
/**
|
||||||
* @property {number} True when the buffer is fully loaded.
|
* @property {number} True when the buffer is fully loaded.
|
||||||
*/
|
*/
|
||||||
get loaded() Math.min.apply(null,
|
get loaded() apply(Math, "min",
|
||||||
this.allFrames()
|
this.allFrames()
|
||||||
.map(frame => ["loading", "interactive", "complete"]
|
.map(frame => ["loading", "interactive", "complete"]
|
||||||
.indexOf(frame.document.readyState))),
|
.indexOf(frame.document.readyState))),
|
||||||
|
|||||||
@@ -596,7 +596,7 @@ var CommandHive = Class("CommandHive", Contexts.Hive, {
|
|||||||
_add: function _add(names, description, action, extra={}, replace=false) {
|
_add: function _add(names, description, action, extra={}, replace=false) {
|
||||||
const { contexts } = this.modules;
|
const { contexts } = this.modules;
|
||||||
extra.definedAt = contexts.getCaller(Components.stack.caller.caller);
|
extra.definedAt = contexts.getCaller(Components.stack.caller.caller);
|
||||||
return this.add.apply(this, arguments);
|
return apply(this, "add", arguments);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -837,7 +837,7 @@ var Commands = Module("commands", {
|
|||||||
group = this.user;
|
group = this.user;
|
||||||
}
|
}
|
||||||
|
|
||||||
return group._add.apply(group, arguments);
|
return apply(group, "_add", arguments);
|
||||||
},
|
},
|
||||||
addUserCommand: deprecated("group.commands.add", { get: function addUserCommand() this.user.bound._add }),
|
addUserCommand: deprecated("group.commands.add", { get: function addUserCommand() this.user.bound._add }),
|
||||||
getUserCommands: deprecated("iter(group.commands)", function getUserCommands() iter(this.user).toArray()),
|
getUserCommands: deprecated("iter(group.commands)", function getUserCommands() iter(this.user).toArray()),
|
||||||
|
|||||||
@@ -241,7 +241,7 @@ var CompletionContext = Class("CompletionContext", {
|
|||||||
return this.cache.allItemsResult;
|
return this.cache.allItemsResult;
|
||||||
this.cache.allItems = allItems;
|
this.cache.allItems = allItems;
|
||||||
|
|
||||||
let minStart = Math.min.apply(Math, this.activeContexts.map(function m(c) c.offset));
|
let minStart = apply(Math, "min", this.activeContexts.map(function m(c) c.offset));
|
||||||
if (minStart == Infinity)
|
if (minStart == Infinity)
|
||||||
minStart = 0;
|
minStart = 0;
|
||||||
|
|
||||||
@@ -271,7 +271,7 @@ var CompletionContext = Class("CompletionContext", {
|
|||||||
// Temporary
|
// Temporary
|
||||||
get allSubstrings() {
|
get allSubstrings() {
|
||||||
let contexts = this.activeContexts;
|
let contexts = this.activeContexts;
|
||||||
let minStart = Math.min.apply(Math, contexts.map(function m(c) c.offset));
|
let minStart = apply(Math, "min", contexts.map(function m(c) c.offset));
|
||||||
let lists = contexts.map(function m(context) {
|
let lists = contexts.map(function m(context) {
|
||||||
let prefix = context.value.substring(minStart, context.offset);
|
let prefix = context.value.substring(minStart, context.offset);
|
||||||
return context.substrings.map(function m(s) prefix + s);
|
return context.substrings.map(function m(s) prefix + s);
|
||||||
@@ -906,7 +906,7 @@ var Completion = Module("completion", {
|
|||||||
_runCompleter: function _runCompleter(name, filter, maxItems, ...args) {
|
_runCompleter: function _runCompleter(name, filter, maxItems, ...args) {
|
||||||
let context = modules.CompletionContext(filter);
|
let context = modules.CompletionContext(filter);
|
||||||
context.maxItems = maxItems;
|
context.maxItems = maxItems;
|
||||||
let res = context.fork.apply(context, ["run", 0, this, name].concat(args));
|
let res = apply(context, "fork", ["run", 0, this, name].concat(args));
|
||||||
if (res) {
|
if (res) {
|
||||||
if (Components.stack.caller.name === "runCompleter") // FIXME
|
if (Components.stack.caller.name === "runCompleter") // FIXME
|
||||||
return { items: res.map(function m(i) ({ item: i })) };
|
return { items: res.map(function m(i) ({ item: i })) };
|
||||||
@@ -917,14 +917,14 @@ var Completion = Module("completion", {
|
|||||||
},
|
},
|
||||||
|
|
||||||
runCompleter: function runCompleter(name, filter, maxItems) {
|
runCompleter: function runCompleter(name, filter, maxItems) {
|
||||||
return this._runCompleter.apply(this, arguments)
|
return apply(this, "_runCompleter", arguments)
|
||||||
.items.map(function m(i) i.item);
|
.items.map(function m(i) i.item);
|
||||||
},
|
},
|
||||||
|
|
||||||
listCompleter: function listCompleter(name, filter, maxItems, ...args) {
|
listCompleter: function listCompleter(name, filter, maxItems, ...args) {
|
||||||
let context = modules.CompletionContext(filter || "");
|
let context = modules.CompletionContext(filter || "");
|
||||||
context.maxItems = maxItems;
|
context.maxItems = maxItems;
|
||||||
context.fork.apply(context, ["list", 0, this, name].concat(args));
|
apply(context, "fork", ["list", 0, this, name].concat(args));
|
||||||
context = context.contexts["/list"];
|
context = context.contexts["/list"];
|
||||||
context.wait(null, true);
|
context.wait(null, true);
|
||||||
|
|
||||||
|
|||||||
@@ -553,7 +553,7 @@ var Contexts = Module("contexts", {
|
|||||||
if (callable(params))
|
if (callable(params))
|
||||||
action = dactyl.userEval("(function action() { with (action.makeParams(this, arguments)) {" + args.literalArg + "} })");
|
action = dactyl.userEval("(function action() { with (action.makeParams(this, arguments)) {" + args.literalArg + "} })");
|
||||||
else
|
else
|
||||||
action = dactyl.userFunc.apply(dactyl, params.concat(args.literalArg));
|
action = apply(dactyl, "userFunc", params.concat(args.literalArg));
|
||||||
process = param => isObject(param) && param.valueOf ? param.valueOf() : param;
|
process = param => isObject(param) && param.valueOf ? param.valueOf() : param;
|
||||||
action.params = params;
|
action.params = params;
|
||||||
action.makeParams = makeParams;
|
action.makeParams = makeParams;
|
||||||
|
|||||||
@@ -1002,12 +1002,7 @@ var DOM = Class("DOM", {
|
|||||||
for (k in opts)
|
for (k in opts)
|
||||||
if (k in params)));
|
if (k in params)));
|
||||||
|
|
||||||
// Because security boundaries :/
|
apply(evt, "init" + t + "Event", args.map(arg => params[arg]));
|
||||||
let ary = new doc.defaultView.Array;
|
|
||||||
for (let arg of args)
|
|
||||||
ary.push(params[arg]);
|
|
||||||
|
|
||||||
evt["init" + t + "Event"].apply(evt, ary);
|
|
||||||
return evt;
|
return evt;
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
|
|||||||
@@ -306,7 +306,7 @@ var IO = Module("io", {
|
|||||||
*/
|
*/
|
||||||
sourcing: null,
|
sourcing: null,
|
||||||
|
|
||||||
expandPath: deprecated("File.expandPath", function expandPath() File.expandPath.apply(File, arguments)),
|
expandPath: deprecated("File.expandPath", function expandPath() apply(File, "expandPath", arguments)),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the first user RC file found in *dir*.
|
* Returns the first user RC file found in *dir*.
|
||||||
@@ -523,7 +523,7 @@ var IO = Module("io", {
|
|||||||
stdin.write(input);
|
stdin.write(input);
|
||||||
|
|
||||||
function result(status, output) ({
|
function result(status, output) ({
|
||||||
__noSuchMethod__: function (meth, args) this.output[meth].apply(this.output, args),
|
__noSuchMethod__: function (meth, args) apply(this.output, meth, args),
|
||||||
valueOf: function () this.output,
|
valueOf: function () this.output,
|
||||||
output: output.replace(/^(.*)\n$/, "$1"),
|
output: output.replace(/^(.*)\n$/, "$1"),
|
||||||
returnValue: status,
|
returnValue: status,
|
||||||
|
|||||||
@@ -760,7 +760,7 @@ var JavaScript = Module("javascript", {
|
|||||||
return this.rootNode;
|
return this.rootNode;
|
||||||
}),
|
}),
|
||||||
|
|
||||||
__noSuchMethod__: function (meth, args) Buffer[meth].apply(Buffer, [this.rootNode].concat(args))
|
__noSuchMethod__: function (meth, args) apply(Buffer, meth, [this.rootNode].concat(args))
|
||||||
});
|
});
|
||||||
|
|
||||||
modules.CommandREPLMode = Class("CommandREPLMode", modules.CommandMode, {
|
modules.CommandREPLMode = Class("CommandREPLMode", modules.CommandMode, {
|
||||||
@@ -859,7 +859,7 @@ var JavaScript = Module("javascript", {
|
|||||||
mappings: function initMappings(dactyl, modules, window) {
|
mappings: function initMappings(dactyl, modules, window) {
|
||||||
const { mappings, modes } = modules;
|
const { mappings, modes } = modules;
|
||||||
|
|
||||||
function bind(...args) mappings.add.apply(mappings, [[modes.REPL]].concat(args))
|
function bind(...args) apply(mappings, "add", [[modes.REPL]].concat(args))
|
||||||
|
|
||||||
bind(["<Return>"], "Accept the current input",
|
bind(["<Return>"], "Accept the current input",
|
||||||
function ({ self }) { self.accept(); });
|
function ({ self }) { self.accept(); });
|
||||||
|
|||||||
@@ -985,18 +985,18 @@ var Options = Module("options", {
|
|||||||
"@@iterator": function __iterator__()
|
"@@iterator": function __iterator__()
|
||||||
values(this._options.sort((a, b) => String.localeCompare(a.name, b.name))),
|
values(this._options.sort((a, b) => String.localeCompare(a.name, b.name))),
|
||||||
|
|
||||||
allPrefs: deprecated("prefs.getNames", function allPrefs() prefs.getNames.apply(prefs, arguments)),
|
allPrefs: deprecated("prefs.getNames", function allPrefs() apply(prefs, "getNames", arguments)),
|
||||||
getPref: deprecated("prefs.get", function getPref() prefs.get.apply(prefs, arguments)),
|
getPref: deprecated("prefs.get", function getPref() apply(prefs, "get", arguments)),
|
||||||
invertPref: deprecated("prefs.invert", function invertPref() prefs.invert.apply(prefs, arguments)),
|
invertPref: deprecated("prefs.invert", function invertPref() apply(prefs, "invert", arguments)),
|
||||||
listPrefs: deprecated("prefs.list", function listPrefs() { this.modules.commandline.commandOutput(prefs.list.apply(prefs, arguments)); }),
|
listPrefs: deprecated("prefs.list", function listPrefs() { this.modules.commandline.commandOutput(apply(prefs, "list", arguments)); }),
|
||||||
observePref: deprecated("prefs.observe", function observePref() prefs.observe.apply(prefs, arguments)),
|
observePref: deprecated("prefs.observe", function observePref() apply(prefs, "observe", arguments)),
|
||||||
popContext: deprecated("prefs.popContext", function popContext() prefs.popContext.apply(prefs, arguments)),
|
popContext: deprecated("prefs.popContext", function popContext() apply(prefs, "popContext", arguments)),
|
||||||
pushContext: deprecated("prefs.pushContext", function pushContext() prefs.pushContext.apply(prefs, arguments)),
|
pushContext: deprecated("prefs.pushContext", function pushContext() apply(prefs, "pushContext", arguments)),
|
||||||
resetPref: deprecated("prefs.reset", function resetPref() prefs.reset.apply(prefs, arguments)),
|
resetPref: deprecated("prefs.reset", function resetPref() apply(prefs, "reset", arguments)),
|
||||||
safeResetPref: deprecated("prefs.safeReset", function safeResetPref() prefs.safeReset.apply(prefs, arguments)),
|
safeResetPref: deprecated("prefs.safeReset", function safeResetPref() apply(prefs, "safeReset", arguments)),
|
||||||
safeSetPref: deprecated("prefs.safeSet", function safeSetPref() prefs.safeSet.apply(prefs, arguments)),
|
safeSetPref: deprecated("prefs.safeSet", function safeSetPref() apply(prefs, "safeSet", arguments)),
|
||||||
setPref: deprecated("prefs.set", function setPref() prefs.set.apply(prefs, arguments)),
|
setPref: deprecated("prefs.set", function setPref() apply(prefs, "set", arguments)),
|
||||||
withContext: deprecated("prefs.withContext", function withContext() prefs.withContext.apply(prefs, arguments)),
|
withContext: deprecated("prefs.withContext", function withContext() apply(prefs, "withContext", arguments)),
|
||||||
|
|
||||||
cleanupPrefs: Class.Memoize(() => config.prefs.Branch("cleanup.option.")),
|
cleanupPrefs: Class.Memoize(() => config.prefs.Branch("cleanup.option.")),
|
||||||
|
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ var Overlay = Module("Overlay", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReferen
|
|||||||
capture,
|
capture,
|
||||||
allowUntrusted];
|
allowUntrusted];
|
||||||
|
|
||||||
target.addEventListener.apply(target, args.slice(1));
|
apply(target, "addEventListener", args.slice(1));
|
||||||
listeners.push(args);
|
listeners.push(args);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -105,7 +105,7 @@ var Overlay = Module("Overlay", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReferen
|
|||||||
this.setData(doc, "listeners", listeners.filter(function (args) {
|
this.setData(doc, "listeners", listeners.filter(function (args) {
|
||||||
let elem = args[0].get();
|
let elem = args[0].get();
|
||||||
if (target == null || elem == target && args[1] == event && args[2].wrapped == callback && args[3] == capture) {
|
if (target == null || elem == target && args[1] == event && args[2].wrapped == callback && args[3] == capture) {
|
||||||
elem.removeEventListener.apply(elem, args.slice(1));
|
apply(elem, "removeEventListener", args.slice(1));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return elem;
|
return elem;
|
||||||
|
|||||||
@@ -265,7 +265,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
|
|||||||
storage.addObserver("sanitizer",
|
storage.addObserver("sanitizer",
|
||||||
function (key, event, arg) {
|
function (key, event, arg) {
|
||||||
if (names.has(event))
|
if (names.has(event))
|
||||||
params.action.apply(params, arg);
|
apply(params, "action", arg);
|
||||||
},
|
},
|
||||||
getWindow(params.action));
|
getWindow(params.action));
|
||||||
|
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ var Services = Module("Services", {
|
|||||||
|
|
||||||
if (service.init && args.length) {
|
if (service.init && args.length) {
|
||||||
if (service.callable)
|
if (service.callable)
|
||||||
res[service.init].apply(res, args);
|
apply(res, service.init, args);
|
||||||
else
|
else
|
||||||
res[service.init] = args[0];
|
res[service.init] = args[0];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ var ArrayStore = Class("ArrayStore", StoreBase, {
|
|||||||
mutate: function mutate(funcName) {
|
mutate: function mutate(funcName) {
|
||||||
var _funcName = funcName;
|
var _funcName = funcName;
|
||||||
arguments[0] = this._object;
|
arguments[0] = this._object;
|
||||||
this._object = Array[_funcName].apply(Array, arguments)
|
this._object = apply(Array, _funcName, arguments)
|
||||||
.map(this.makeOwn.bind(this));
|
.map(this.makeOwn.bind(this));
|
||||||
this.fireEvent("change", null);
|
this.fireEvent("change", null);
|
||||||
},
|
},
|
||||||
@@ -271,7 +271,7 @@ var Storage = Module("Storage", {
|
|||||||
throw Error("Invalid argument type");
|
throw Error("Invalid argument type");
|
||||||
|
|
||||||
if (this.isLocalModule) {
|
if (this.isLocalModule) {
|
||||||
this.globalInstance.newObject.apply(this.globalInstance, arguments);
|
apply(this.globalInstance, "newObject", arguments);
|
||||||
|
|
||||||
if (!(key in this.keys) && this.privateMode && key in this.globalInstance.keys) {
|
if (!(key in this.keys) && this.privateMode && key in this.globalInstance.keys) {
|
||||||
let obj = this.globalInstance.keys[key];
|
let obj = this.globalInstance.keys[key];
|
||||||
@@ -799,7 +799,7 @@ var File = Class("File", {
|
|||||||
catch (e) {}
|
catch (e) {}
|
||||||
|
|
||||||
if (isFunction)
|
if (isFunction)
|
||||||
File.prototype[prop] = util.wrapCallback(function wrapper() this.file[prop].apply(this.file, arguments));
|
File.prototype[prop] = util.wrapCallback(function wrapper() apply(this.file, prop, arguments));
|
||||||
else
|
else
|
||||||
Object.defineProperty(File.prototype, prop, {
|
Object.defineProperty(File.prototype, prop, {
|
||||||
configurable: true,
|
configurable: true,
|
||||||
|
|||||||
@@ -299,7 +299,7 @@ var Styles = Module("Styles", {
|
|||||||
_proxy: function (name, args) {
|
_proxy: function (name, args) {
|
||||||
let obj = this[args[0] ? "system" : "user"];
|
let obj = this[args[0] ? "system" : "user"];
|
||||||
|
|
||||||
return obj[name].apply(obj, Array.slice(args, 1));
|
return apply(obj, name, Array.slice(args, 1));
|
||||||
},
|
},
|
||||||
|
|
||||||
addSheet: deprecated("Styles#{user,system}.add", function addSheet() this._proxy("add", arguments)),
|
addSheet: deprecated("Styles#{user,system}.add", function addSheet() this._proxy("add", arguments)),
|
||||||
@@ -720,7 +720,7 @@ var Styles = Module("Styles", {
|
|||||||
get sites() this.hive.sites,
|
get sites() this.hive.sites,
|
||||||
|
|
||||||
__noSuchMethod__: function __noSuchMethod__(meth, args) {
|
__noSuchMethod__: function __noSuchMethod__(meth, args) {
|
||||||
return this.hive[meth].apply(this.hive, args);
|
return apply(this.hive, meth, args);
|
||||||
},
|
},
|
||||||
|
|
||||||
destroy: function () {
|
destroy: function () {
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ var Binding = Class("Binding", {
|
|||||||
configurable: true,
|
configurable: true,
|
||||||
writeable: true,
|
writeable: true,
|
||||||
value: function __noSuchMethod__(meth, args) {
|
value: function __noSuchMethod__(meth, args) {
|
||||||
return this.node[meth].apply(this.node, args);
|
return apply(this.node, meth, args);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}, {
|
}, {
|
||||||
@@ -88,7 +88,7 @@ var Binding = Class("Binding", {
|
|||||||
Object.defineProperty(Binding.prototype, key, {
|
Object.defineProperty(Binding.prototype, key, {
|
||||||
configurable: true,
|
configurable: true,
|
||||||
enumerable: false,
|
enumerable: false,
|
||||||
value: function () this.node[key].apply(this.node, arguments),
|
value: function () apply(this.node, key, arguments),
|
||||||
writable: true
|
writable: true
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -799,7 +799,8 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
|||||||
args.push(params.user);
|
args.push(params.user);
|
||||||
if (params.pass != null)
|
if (params.pass != null)
|
||||||
args.push(prams.pass);
|
args.push(prams.pass);
|
||||||
xmlhttp.open.apply(xmlhttp, args);
|
|
||||||
|
apply(xmlhttp, "open", args);
|
||||||
|
|
||||||
for (let [header, val] of iter(params.headers || {}))
|
for (let [header, val] of iter(params.headers || {}))
|
||||||
xmlhttp.setRequestHeader(header, val);
|
xmlhttp.setRequestHeader(header, val);
|
||||||
|
|||||||
Reference in New Issue
Block a user