Bug 889158 part 1 - Fix chrome and tests to not use arrow functions with arguments. r=Waldo

This commit is contained in:
Jan de Mooij 2015-08-22 13:49:11 +02:00
parent 24352f9317
commit d44488d68c
9 changed files with 20 additions and 20 deletions

View File

@ -30,7 +30,7 @@ const TEST_DOC_URL = module.uri.replace(/context-menu\/test-helper\.js$/, "test-
function TestHelper(assert, done) {
// Methods on the wrapped test can be called on this object.
for (var prop in assert)
this[prop] = () => assert[prop].apply(assert, arguments);
this[prop] = (...args) => assert[prop].apply(assert, args);
this.assert = assert;
this.end = done;
this.loaders = [];

View File

@ -26,7 +26,7 @@ const { defer } = require("sdk/core/promise");
* A promise resolved once the delay given is passed, or the object
* receives the event specified
*/
const wait = (target, type, capture) => {
const wait = function(target, type, capture) {
let { promise, resolve, reject } = defer();
if (!arguments.length) {
@ -105,4 +105,4 @@ exports.FIFO = scenario(function(target, expected, actual) {
return expected.reduce(function(result, value) {
return result.concat(value + "#1", value + "#2", value + "#3");
}, []);
});
});

View File

@ -558,8 +558,8 @@ let FullZoomHelper = {
let didPs = false;
let didZoom = false;
gBrowser.addEventListener("pageshow", function (event) {
gBrowser.removeEventListener("pageshow", arguments.callee, true);
gBrowser.addEventListener("pageshow", function listener(event) {
gBrowser.removeEventListener("pageshow", listener, true);
didPs = true;
if (didZoom)
resolve();
@ -718,9 +718,9 @@ function assertWebRTCIndicatorStatus(expected) {
let win = Services.wm.getMostRecentWindow("Browser:WebRTCGlobalIndicator");
if (win) {
yield new Promise((resolve, reject) => {
win.addEventListener("unload", (e) => {
win.addEventListener("unload", function listener(e) {
if (e.target == win.document) {
win.removeEventListener("unload", arguments.callee);
win.removeEventListener("unload", listener);
resolve();
}
}, false);

View File

@ -60,7 +60,7 @@ add_task(function* test_date_container() {
// Execute the delete command and check visit has been removed.
let promiseURIRemoved = promiseHistoryNotification("onDeleteURI",
() => TEST_URI.equals(arguments[0]));
v => TEST_URI.equals(v));
PO._places.controller.doCommand("cmd_delete");
yield promiseURIRemoved;
@ -125,7 +125,7 @@ add_task(function* test_query_on_toolbar() {
// Execute the delete command and check bookmark has been removed.
let promiseItemRemoved = promiseBookmarksNotification("onItemRemoved",
() => query.guid == arguments[5]);
(...args) => query.guid == args[5]);
PO._places.controller.doCommand("cmd_delete");
yield promiseItemRemoved;

View File

@ -170,13 +170,13 @@ function promiseBookmarksNotification(notification, conditionFn) {
return XPCOMUtils.generateQI([ Ci.nsINavBookmarkObserver ]);
info(`promiseBookmarksNotification: got ${name} notification`);
if (name == notification)
return () => {
if (conditionFn.apply(this, arguments)) {
return (...args) => {
if (conditionFn.apply(this, args)) {
clearTimeout(timeout);
PlacesUtils.bookmarks.removeObserver(proxifiedObserver, false);
executeSoon(resolve);
} else {
info(`promiseBookmarksNotification: skip cause condition doesn't apply to ${JSON.stringify(arguments)}`);
info(`promiseBookmarksNotification: skip cause condition doesn't apply to ${JSON.stringify(args)}`);
}
}
return () => {};
@ -198,8 +198,8 @@ function promiseHistoryNotification(notification, conditionFn) {
if (name == "QueryInterface")
return XPCOMUtils.generateQI([ Ci.nsINavHistoryObserver ]);
if (name == notification)
return () => {
if (conditionFn.apply(this, arguments)) {
return (...args) => {
if (conditionFn.apply(this, args)) {
clearTimeout(timeout);
PlacesUtils.history.removeObserver(proxifiedObserver, false);
executeSoon(resolve);

View File

@ -430,8 +430,8 @@ function expectNotifications() {
}
if (name.startsWith("onItem")) {
return () => {
let args = Array.from(arguments, arg => {
return (...origArgs) => {
let args = Array.from(origArgs, arg => {
if (arg && arg instanceof Ci.nsIURI)
return new URL(arg.spec);
if (arg && typeof(arg) == "number" && arg >= Date.now() * 1000)

View File

@ -44,7 +44,7 @@ function expectNotifications() {
}
if (name.startsWith("onItemChanged")) {
return (id, prop, isAnno, val, lastMod, itemType, parentId, guid, parentGuid, oldVal) => {
return function(id, prop, isAnno, val, lastMod, itemType, parentId, guid, parentGuid, oldVal) {
if (prop != "keyword")
return;
let args = Array.from(arguments, arg => {

View File

@ -56,7 +56,7 @@ function expectBookmarkNotifications() {
}
if (name.startsWith("onItemChanged")) {
return (itemId, property) => {
return function(itemId, property) {
if (property != "keyword")
return;
let args = Array.from(arguments, arg => {

View File

@ -86,10 +86,10 @@ EventEmitter.prototype = {
once: function EventEmitter_once(aEvent, aListener) {
let deferred = promise.defer();
let handler = (aEvent, aFirstArg) => {
let handler = (aEvent, aFirstArg, ...aRest) => {
this.off(aEvent, handler);
if (aListener) {
aListener.apply(null, arguments);
aListener.apply(null, [aEvent, aFirstArg, ...aRest]);
}
deferred.resolve(aFirstArg);
};