mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Bug 889158 part 1 - Fix chrome and tests to not use arrow functions with arguments. r=Waldo
This commit is contained in:
parent
24352f9317
commit
d44488d68c
@ -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 = [];
|
||||
|
@ -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");
|
||||
}, []);
|
||||
});
|
||||
});
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
|
@ -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 => {
|
||||
|
@ -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 => {
|
||||
|
@ -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);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user