1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-02-10 21:25:46 +01:00

Replace Array.slice conversions of the arguments object with rest parameters.

This commit is contained in:
Doug Kearns
2013-09-05 20:46:21 +10:00
parent e0a0388382
commit 99bfcbf2fc
16 changed files with 82 additions and 93 deletions

View File

@@ -1622,11 +1622,11 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
* @param {function} func The function to call
* @param {object} self The 'this' object for the function.
*/
trapErrors: function trapErrors(func, self) {
trapErrors: function trapErrors(func, self, ...args) {
try {
if (!callable(func))
func = self[func];
return func.apply(self || this, Array.slice(arguments, 2));
return func.apply(self || this, args);
}
catch (e) {
this.reportError(e);
@@ -1708,9 +1708,9 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
* @param {object} self The 'this' object of the method.
* @param ... Arguments to pass to *meth*.
*/
withProperErrors: function withProperErrors(meth, self) {
withProperErrors: function withProperErrors(meth, self, ...args) {
try {
return (callable(meth) ? meth : self[meth]).apply(self, Array.slice(arguments, withProperErrors.length));
return (callable(meth) ? meth : self[meth]).apply(self, args);
}
catch (e) {
throw e.stack ? e : Error(e);