--- a/accessible/tests/browser/.eslintrc.js
+++ b/accessible/tests/browser/.eslintrc.js
@@ -26,17 +26,16 @@ module.exports = {
"handle-callback-err": ["error", "er"],
"indent": ["error", 2, {"SwitchCase": 1}],
"max-nested-callbacks": ["error", 4],
"max-params": "off",
"max-statements": "off",
"new-cap": ["error", {"capIsNew": false}],
"new-parens": "error",
"no-bitwise": "off",
- "no-caller": "error",
"no-catch-shadow": "error",
"no-comma-dangle": "off",
"no-console": "off",
"no-constant-condition": "off",
"no-continue": "off",
"no-div-regex": "off",
"no-extend-native": "error",
"no-extra-parens": "off",
--- a/browser/base/content/aboutDialog-appUpdater.js
+++ b/browser/base/content/aboutDialog-appUpdater.js
@@ -365,17 +365,17 @@ appUpdater.prototype =
case Components.results.NS_BINDING_ABORTED:
// Do not remove UI listener since the user may resume downloading again.
break;
case Components.results.NS_OK:
this.removeDownloadListener();
if (this.backgroundUpdateEnabled) {
this.selectPanel("applying");
let self = this;
- Services.obs.addObserver(function(aSubject, aTopic, aData) {
+ Services.obs.addObserver(function observer(aSubject, aTopic, aData) {
// Update the UI when the background updater is finished
let status = aData;
if (status == "applied" || status == "applied-service" ||
status == "pending" || status == "pending-service" ||
status == "pending-elevate") {
// If the update is successfully applied, or if the updater has
// fallen back to non-staged updates, show the "Restart to Update"
// button.
@@ -386,17 +386,17 @@ appUpdater.prototype =
self.selectPanel("downloadFailed");
} else if (status == "downloading") {
// We've fallen back to downloading the full update because the
// partial update failed to get staged in the background.
// Therefore we need to keep our observer.
self.setupDownloadingUI();
return;
}
- Services.obs.removeObserver(arguments.callee, "update-staged");
+ Services.obs.removeObserver(observer, "update-staged");
}, "update-staged");
} else {
this.selectPanel("apply");
}
break;
default:
this.removeDownloadListener();
this.selectPanel("downloadFailed");
--- a/browser/base/content/browser-ctrlTab.js
+++ b/browser/base/content/browser-ctrlTab.js
@@ -105,19 +105,19 @@ var tabPreviewPanelHelper = {
var handler = this._generateHandler(host);
host.panel.addEventListener("popupshown", handler);
host.panel.addEventListener("popuphiding", handler);
host._prevFocus = document.commandDispatcher.focusedElement;
},
_generateHandler(host) {
var self = this;
- return function(event) {
+ return function listener(event) {
if (event.target == host.panel) {
- host.panel.removeEventListener(event.type, arguments.callee);
+ host.panel.removeEventListener(event.type, listener);
self["_" + event.type](host);
}
};
},
_popupshown(host) {
if ("setupGUI" in host)
host.setupGUI();
},
--- a/browser/base/content/test/general/browser_bug423833.js
+++ b/browser/base/content/test/general/browser_bug423833.js
@@ -66,19 +66,19 @@ function test2Setup() {
// Now let's do the whole thing again, but this time for "Open frame in new tab"
var badFrame = content.frames[1];
document.popupNode = badFrame.document.firstChild;
var contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
var contextMenu = new nsContextMenu(contentAreaContextMenu);
- gBrowser.tabContainer.addEventListener("TabOpen", function(event) {
+ gBrowser.tabContainer.addEventListener("TabOpen", function listener(event) {
test2tab = event.target;
- gBrowser.tabContainer.removeEventListener("TabOpen", arguments.callee);
+ gBrowser.tabContainer.removeEventListener("TabOpen", listener);
});
contextMenu.openFrameInTab();
ok(test2tab, "openFrameInTab() opened a tab");
gBrowser.selectedTab = test2tab;
intervalID = setInterval(testOpenFrameInTab, 3000);
}
@@ -102,20 +102,20 @@ function testOpenFrameInTab() {
function test3Setup() {
// One more time, for "Open frame in new window"
var badFrame = content.frames[1];
document.popupNode = badFrame.document.firstChild;
var contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
var contextMenu = new nsContextMenu(contentAreaContextMenu);
- Services.ww.registerNotification(function(aSubject, aTopic, aData) {
+ Services.ww.registerNotification(function notification(aSubject, aTopic, aData) {
if (aTopic == "domwindowopened")
test3window = aSubject;
- Services.ww.unregisterNotification(arguments.callee);
+ Services.ww.unregisterNotification(notification);
});
contextMenu.openFrame();
intervalID = setInterval(testOpenFrame, 3000);
}
function testOpenFrame() {
--- a/browser/base/content/test/general/browser_bug432599.js
+++ b/browser/base/content/test/general/browser_bug432599.js
@@ -77,25 +77,25 @@ var currentInvoker = 0;
var initialValue;
var initialRemoveHidden;
var popupElement = document.getElementById("editBookmarkPanel");
var titleElement = document.getElementById("editBookmarkPanelTitle");
var removeElement = document.getElementById("editBookmarkPanelRemoveButton");
function checkBookmarksPanel(invoker, phase) {
- let onPopupShown = function(aEvent) {
+ let onPopupShown = function popupShownListener(aEvent) {
if (aEvent.originalTarget == popupElement) {
- popupElement.removeEventListener("popupshown", arguments.callee);
+ popupElement.removeEventListener("popupshown", popupShownListener);
checkBookmarksPanel(invoker, phase + 1);
}
};
- let onPopupHidden = function(aEvent) {
+ let onPopupHidden = function listener(aEvent) {
if (aEvent.originalTarget == popupElement) {
- popupElement.removeEventListener("popuphidden", arguments.callee);
+ popupElement.removeEventListener("popuphidden", listener);
if (phase < 4) {
checkBookmarksPanel(invoker, phase + 1);
} else {
++currentInvoker;
if (currentInvoker < invokers.length) {
checkBookmarksPanel(invokers[currentInvoker], 1);
} else {
gBrowser.removeTab(gBrowser.selectedTab, {skipPermitUnload: true});
--- a/browser/base/content/test/general/browser_bug521216.js
+++ b/browser/base/content/test/general/browser_bug521216.js
@@ -25,26 +25,26 @@ function record(aName) {
gBrowser.tabContainer.removeEventListener("TabOpen", TabOpen);
finish();
}.bind(null, tab));
}
}
function TabOpen(aEvent) {
if (aEvent.target == tab)
- record(arguments.callee.name);
+ record("TabOpen");
}
var progressListener = {
onLocationChange: function onLocationChange(aBrowser) {
if (aBrowser == tab.linkedBrowser)
- record(arguments.callee.name);
+ record("onLocationChange");
},
onStateChange: function onStateChange(aBrowser) {
if (aBrowser == tab.linkedBrowser)
- record(arguments.callee.name);
+ record("onStateChange");
},
onLinkIconAvailable: function onLinkIconAvailable(aBrowser, aIconURL) {
if (aBrowser == tab.linkedBrowser &&
aIconURL == "about:logo")
- record(arguments.callee.name);
+ record("onLinkIconAvailable");
}
};
--- a/browser/base/content/test/general/browser_bug555767.js
+++ b/browser/base/content/test/general/browser_bug555767.js
@@ -1,24 +1,24 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
- add_task(async function() {
+ add_task(async function listener() {
let testURL = "http://example.org/browser/browser/base/content/test/general/dummy_page.html";
let tabSelected = false;
// Open the base tab
let baseTab = BrowserTestUtils.addTab(gBrowser, testURL);
// Wait for the tab to be fully loaded so matching happens correctly
await promiseTabLoaded(baseTab);
if (baseTab.linkedBrowser.currentURI.spec == "about:blank")
return;
- baseTab.linkedBrowser.removeEventListener("load", arguments.callee, true);
+ baseTab.linkedBrowser.removeEventListener("load", listener, true);
let testTab = BrowserTestUtils.addTab(gBrowser);
// Select the testTab
gBrowser.selectedTab = testTab;
// Set the urlbar to include the moz-action
gURLBar.value = "moz-action:switchtab," + JSON.stringify({url: testURL});
@@ -46,9 +46,8 @@
// Add the TabClose, TabSelect event listeners before we press enter
gBrowser.tabContainer.addEventListener("TabClose", onTabClose);
gBrowser.tabContainer.addEventListener("TabSelect", onTabSelect);
// Press enter!
EventUtils.synthesizeKey("VK_RETURN", {});
});
-
--- a/browser/base/content/test/general/browser_bug585785.js
+++ b/browser/base/content/test/general/browser_bug585785.js
@@ -18,18 +18,18 @@ function checkAnimationState() {
if (!tab.parentNode) {
ok(true, "tab removed synchronously since the opening animation hasn't moved yet");
finish();
return;
}
info("tab didn't close immediately, so the tab opening animation must have started moving");
info("waiting for the tab to close asynchronously");
- tab.addEventListener("transitionend", function(event) {
+ tab.addEventListener("transitionend", function listener(event) {
if (event.propertyName == "max-width") {
- tab.removeEventListener("transitionend", arguments.callee);
+ tab.removeEventListener("transitionend", listener);
executeSoon(function() {
ok(!tab.parentNode, "tab removed asynchronously");
finish();
});
}
});
}
--- a/browser/base/content/test/general/browser_bug609700.js
+++ b/browser/base/content/test/general/browser_bug609700.js
@@ -1,14 +1,14 @@
function test() {
waitForExplicitFinish();
- Services.ww.registerNotification(function(aSubject, aTopic, aData) {
+ Services.ww.registerNotification(function notification(aSubject, aTopic, aData) {
if (aTopic == "domwindowopened") {
- Services.ww.unregisterNotification(arguments.callee);
+ Services.ww.unregisterNotification(notification);
ok(true, "duplicateTabIn opened a new window");
whenDelayedStartupFinished(aSubject, function() {
executeSoon(function() {
aSubject.close();
finish();
});
--- a/browser/base/content/test/general/browser_printpreview.js
+++ b/browser/base/content/test/general/browser_printpreview.js
@@ -44,31 +44,31 @@ function testClosePrintPreviewWithClosin
ok(aSucceeded,
"print preview mode should be finished by closing window shortcut key");
tidyUp();
});
}
function openPrintPreview(aCallback) {
document.getElementById("cmd_printPreview").doCommand();
- executeSoon(function() {
+ executeSoon(function waitForPrintPreview() {
if (gInPrintPreviewMode) {
executeSoon(aCallback);
return;
}
- executeSoon(arguments.callee);
+ executeSoon(waitForPrintPreview);
});
}
function checkPrintPreviewClosed(aCallback) {
let count = 0;
- executeSoon(function() {
+ executeSoon(function waitForPrintPreviewClosed() {
if (!gInPrintPreviewMode) {
executeSoon(function() { aCallback(count < 1000); });
return;
}
if (++count == 1000) {
// The test might fail.
PrintUtils.exitPrintPreview();
}
- executeSoon(arguments.callee);
+ executeSoon(waitForPrintPreviewClosed);
});
}
--- a/browser/base/content/test/general/browser_zbug569342.js
+++ b/browser/base/content/test/general/browser_zbug569342.js
@@ -1,21 +1,21 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
var gTab = null;
function load(url, cb) {
gTab = BrowserTestUtils.addTab(gBrowser, url);
- gBrowser.addEventListener("load", function(event) {
+ gBrowser.addEventListener("load", function listener(event) {
if (event.target.location != url)
return;
- gBrowser.removeEventListener("load", arguments.callee, true);
+ gBrowser.removeEventListener("load", listener, true);
// Trigger onLocationChange by switching tabs.
gBrowser.selectedTab = gTab;
cb();
}, true);
}
function test() {
waitForExplicitFinish();
--- a/browser/base/content/test/urlbar/browser_bug304198.js
+++ b/browser/base/content/test/urlbar/browser_bug304198.js
@@ -78,17 +78,17 @@ add_task(async function() {
await BrowserTestUtils.switchTab(gBrowser, partialURLTab);
is(gURLBar.textValue, testURL, "gURLBar.textValue should be testURL after initial switch to partialURLTab");
// simulate the user removing part of the url from the location bar
gPrefService.setBoolPref("browser.urlbar.clickSelectsAll", false);
let deleted = 0;
while (deleted < charsToDelete) {
- await urlbarBackspace(arguments.callee);
+ await urlbarBackspace();
deleted++;
}
is(gURLBar.textValue, testPartialURL, "gURLBar.textValue should be testPartialURL (just set)");
if (gPrefService.prefHasUserValue("browser.urlbar.clickSelectsAll")) {
gPrefService.clearUserPref("browser.urlbar.clickSelectsAll");
}
}
@@ -99,10 +99,8 @@ add_task(async function() {
await prepareFullURLTab();
await preparePartialURLTab();
await prepareDeletedURLTab();
// now cycle the tabs and make sure everything looks good
await cycleTabs();
cleanUp();
});
-
-
--- a/browser/components/places/tests/browser/browser_bookmarksProperties.js
+++ b/browser/components/places/tests/browser/browser_bookmarksProperties.js
@@ -306,17 +306,17 @@ gTests.push({
resolve();
});
}, {capture: true, once: true});
});
folderTree.addEventListener("DOMAttrModified", function onDOMAttrModified(event) {
if (event.attrName != "place")
return;
- folderTree.removeEventListener("DOMAttrModified", arguments.callee);
+ folderTree.removeEventListener("DOMAttrModified", onDOMAttrModified);
executeSoon(async function() {
await self._addObserver;
let bookmark = await PlacesUtils.bookmarks.fetch({url: TEST_URL});
self._bookmarkGuid = bookmark.guid;
// Create a new folder.
var newFolderButton = self.window.document.getElementById("editBMPanel_newFolderButton");
newFolderButton.doCommand();
--- a/browser/components/places/tests/browser/browser_drag_bookmarks_on_toolbar.js
+++ b/browser/components/places/tests/browser/browser_drag_bookmarks_on_toolbar.js
@@ -22,17 +22,17 @@ var dragDirections = { LEFT: 0, UP: 1, R
* Array of flavors and values in the form:
* [ ["text/plain: sometext", "text/html: <b>sometext</b>"], [...] ]
* Pass an empty array to check that drag even has been canceled.
* @param aDirection
* Direction for the dragging gesture, see dragDirections helper object.
*/
function synthesizeDragWithDirection(aElement, aExpectedDragData, aDirection, aCallback) {
// Dragstart listener function.
- gBookmarksToolbar.addEventListener("dragstart", function(event) {
+ gBookmarksToolbar.addEventListener("dragstart", function listener(event) {
info("A dragstart event has been trapped.");
var dataTransfer = event.dataTransfer;
is(dataTransfer.mozItemCount, aExpectedDragData.length,
"Number of dragged items should be the same.");
for (var t = 0; t < dataTransfer.mozItemCount; t++) {
var types = dataTransfer.mozTypesAt(t);
var expecteditem = aExpectedDragData[t];
@@ -49,17 +49,17 @@ function synthesizeDragWithDirection(aEl
}
if (!aExpectedDragData.length)
ok(event.defaultPrevented, "Drag has been canceled.");
event.preventDefault();
event.stopPropagation();
- gBookmarksToolbar.removeEventListener("dragstart", arguments.callee);
+ gBookmarksToolbar.removeEventListener("dragstart", listener);
// This is likely to cause a click event, and, in case we are dragging a
// bookmark, an unwanted page visit. Prevent the click event.
aElement.addEventListener("click", prevent);
EventUtils.synthesizeMouse(aElement,
startingPoint.x + xIncrement * 9,
startingPoint.y + yIncrement * 9,
{ type: "mouseup" });
--- a/browser/components/places/tests/unit/test_PUIU_makeTransaction.js
+++ b/browser/components/places/tests/unit/test_PUIU_makeTransaction.js
@@ -9,35 +9,35 @@ function waitForBookmarkNotification(aNo
PlacesUtils.bookmarks.removeObserver(this);
aCallback(aData);
}
},
// nsINavBookmarkObserver
QueryInterface: XPCOMUtils.generateQI([Ci.nsINavBookmarkObserver]),
onBeginUpdateBatch: function onBeginUpdateBatch() {
- return this.validate(arguments.callee.name, arguments);
+ return this.validate("onBeginUpdateBatch", arguments);
},
onEndUpdateBatch: function onEndUpdateBatch() {
- return this.validate(arguments.callee.name, arguments);
+ return this.validate("onEndUpdateBatch", arguments);
},
onItemAdded: function onItemAdded(aItemId, aParentId, aIndex, aItemType,
aURI, aTitle) {
- return this.validate(arguments.callee.name, { id: aItemId,
+ return this.validate("onItemAdded", { id: aItemId,
index: aIndex,
type: aItemType,
url: aURI ? aURI.spec : null,
title: aTitle });
},
onItemRemoved: function onItemRemoved() {
- return this.validate(arguments.callee.name, arguments);
+ return this.validate("onItemRemoved", arguments);
},
onItemChanged: function onItemChanged(id, property, aIsAnno,
aNewValue, aLastModified, type) {
- return this.validate(arguments.callee.name,
+ return this.validate("onItemChanged",
{ id,
get index() {
return PlacesUtils.bookmarks.getItemIndex(this.id);
},
type,
property,
get url() {
return type == PlacesUtils.bookmarks.TYPE_BOOKMARK ?
@@ -45,21 +45,21 @@ function waitForBookmarkNotification(aNo
null;
},
get title() {
return PlacesUtils.bookmarks.getItemTitle(this.id);
},
});
},
onItemVisited: function onItemVisited() {
- return this.validate(arguments.callee.name, arguments);
+ return this.validate("onItemVisited", arguments);
},
onItemMoved: function onItemMoved(aItemId, aOldParentId, aOldIndex,
aNewParentId, aNewIndex, aItemType) {
- this.validate(arguments.callee.name, { id: aItemId,
+ this.validate("onItemMoved", { id: aItemId,
index: aNewIndex,
type: aItemType });
}
});
}
function wrapNodeByIdAndParent(aItemId, aParentId) {
let wrappedNode;
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_popupblocker.js
+++ b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_popupblocker.js
@@ -17,19 +17,19 @@ add_task(async function test() {
aWindow.gBrowser.addEventListener("DOMUpdatePageReport", function() {
executeSoon(function() {
let notification = aWindow.gBrowser.getNotificationBox().getNotificationWithValue("popup-blocked");
ok(notification, "The notification box should be displayed");
function checkMenuItem(callback) {
dump("CMI: in\n");
- aWindow.document.addEventListener("popupshown", function(event) {
+ aWindow.document.addEventListener("popupshown", function listener(event) {
dump("CMI: popupshown\n");
- aWindow.document.removeEventListener("popupshown", arguments.callee);
+ aWindow.document.removeEventListener("popupshown", listener);
if (aExpectedDisabled)
is(aWindow.document.getElementById("blockedPopupAllowSite").getAttribute("disabled"), "true",
"The allow popups menu item should be disabled");
event.originalTarget.hidePopup();
dump("CMI: calling back\n");
callback();
--- a/browser/components/sessionstore/test/browser_459906.js
+++ b/browser/components/sessionstore/test/browser_459906.js
@@ -9,42 +9,42 @@ function test() {
waitForExplicitFinish();
let testURL = "http://mochi.test:8888/browser/" +
"browser/components/sessionstore/test/browser_459906_sample.html";
let uniqueValue = "<b>Unique:</b> " + Date.now();
var frameCount = 0;
let tab = BrowserTestUtils.addTab(gBrowser, testURL);
- tab.linkedBrowser.addEventListener("load", function(aEvent) {
+ tab.linkedBrowser.addEventListener("load", function listener(aEvent) {
// wait for all frames to load completely
if (frameCount++ < 2)
return;
- tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
+ tab.linkedBrowser.removeEventListener("load", listener, true);
let iframes = tab.linkedBrowser.contentWindow.frames;
// eslint-disable-next-line no-unsanitized/property
iframes[1].document.body.innerHTML = uniqueValue;
frameCount = 0;
let tab2 = gBrowser.duplicateTab(tab);
- tab2.linkedBrowser.addEventListener("load", function(eventTab2) {
+ tab2.linkedBrowser.addEventListener("load", function loadListener(eventTab2) {
// wait for all frames to load (and reload!) completely
if (frameCount++ < 2)
return;
- tab2.linkedBrowser.removeEventListener("load", arguments.callee, true);
+ tab2.linkedBrowser.removeEventListener("load", loadListener, true);
- executeSoon(function() {
+ executeSoon(function innerHTMLPoller() {
let iframesTab2 = tab2.linkedBrowser.contentWindow.frames;
if (iframesTab2[1].document.body.innerHTML !== uniqueValue) {
// Poll again the value, since we can't ensure to run
// after SessionStore has injected innerHTML value.
// See bug 521802.
info("Polling for innerHTML value");
- setTimeout(arguments.callee, 100);
+ setTimeout(innerHTMLPoller, 100);
return;
}
is(iframesTab2[1].document.body.innerHTML, uniqueValue,
"rich textarea's content correctly duplicated");
let innerDomain = null;
try {
--- a/browser/components/sessionstore/test/browser_461743.js
+++ b/browser/components/sessionstore/test/browser_461743.js
@@ -7,24 +7,24 @@ function test() {
waitForExplicitFinish();
let testURL = "http://mochi.test:8888/browser/" +
"browser/components/sessionstore/test/browser_461743_sample.html";
let frameCount = 0;
let tab = BrowserTestUtils.addTab(gBrowser, testURL);
- tab.linkedBrowser.addEventListener("load", function(aEvent) {
+ tab.linkedBrowser.addEventListener("load", function loadListener(aEvent) {
// Wait for all frames to load completely.
if (frameCount++ < 2)
return;
- tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
+ tab.linkedBrowser.removeEventListener("load", loadListener, true);
let tab2 = gBrowser.duplicateTab(tab);
- tab2.linkedBrowser.addEventListener("461743", function(eventTab2) {
- tab2.linkedBrowser.removeEventListener("461743", arguments.callee, true);
+ tab2.linkedBrowser.addEventListener("461743", function listener(eventTab2) {
+ tab2.linkedBrowser.removeEventListener("461743", listener, true);
is(aEvent.data, "done", "XSS injection was attempted");
executeSoon(function() {
let iframes = tab2.linkedBrowser.contentWindow.frames;
let innerHTML = iframes[1].document.body.innerHTML;
isnot(innerHTML, Components.utils.reportError.toString(),
"chrome access denied!");
--- a/browser/components/sessionstore/test/browser_464620_a.js
+++ b/browser/components/sessionstore/test/browser_464620_a.js
@@ -7,27 +7,27 @@ function test() {
waitForExplicitFinish();
let testURL = "http://mochi.test:8888/browser/" +
"browser/components/sessionstore/test/browser_464620_a.html";
var frameCount = 0;
let tab = BrowserTestUtils.addTab(gBrowser, testURL);
- tab.linkedBrowser.addEventListener("load", function(aEvent) {
+ tab.linkedBrowser.addEventListener("load", function loadListener(aEvent) {
// wait for all frames to load completely
if (frameCount++ < 4)
return;
- this.removeEventListener("load", arguments.callee, true);
+ this.removeEventListener("load", loadListener, true);
executeSoon(function() {
frameCount = 0;
let tab2 = gBrowser.duplicateTab(tab);
- tab2.linkedBrowser.addEventListener("464620_a", function(eventTab2) {
- tab2.linkedBrowser.removeEventListener("464620_a", arguments.callee, true);
+ tab2.linkedBrowser.addEventListener("464620_a", function listener(eventTab2) {
+ tab2.linkedBrowser.removeEventListener("464620_a", listener, true);
is(aEvent.data, "done", "XSS injection was attempted");
// let form restoration complete and take into account the
// setTimeout(..., 0) in sss_restoreDocument_proxy
executeSoon(function() {
setTimeout(function() {
let win = tab2.linkedBrowser.contentWindow;
isnot(win.frames[0].document.location, testURL,
--- a/browser/components/sessionstore/test/browser_464620_b.js
+++ b/browser/components/sessionstore/test/browser_464620_b.js
@@ -7,27 +7,27 @@ function test() {
waitForExplicitFinish();
let testURL = "http://mochi.test:8888/browser/" +
"browser/components/sessionstore/test/browser_464620_b.html";
var frameCount = 0;
let tab = BrowserTestUtils.addTab(gBrowser, testURL);
- tab.linkedBrowser.addEventListener("load", function(aEvent) {
+ tab.linkedBrowser.addEventListener("load", function loadListener(aEvent) {
// wait for all frames to load completely
if (frameCount++ < 6)
return;
- this.removeEventListener("load", arguments.callee, true);
+ this.removeEventListener("load", loadListener, true);
executeSoon(function() {
frameCount = 0;
let tab2 = gBrowser.duplicateTab(tab);
- tab2.linkedBrowser.addEventListener("464620_b", function(eventTab2) {
- tab2.linkedBrowser.removeEventListener("464620_b", arguments.callee, true);
+ tab2.linkedBrowser.addEventListener("464620_b", function listener(eventTab2) {
+ tab2.linkedBrowser.removeEventListener("464620_b", listener, true);
is(aEvent.data, "done", "XSS injection was attempted");
// let form restoration complete and take into account the
// setTimeout(..., 0) in sss_restoreDocument_proxy
executeSoon(function() {
setTimeout(function() {
let win = tab2.linkedBrowser.contentWindow;
isnot(win.frames[1].document.location, testURL,
--- a/browser/components/sessionstore/test/browser_frame_history.js
+++ b/browser/components/sessionstore/test/browser_frame_history.js
@@ -146,23 +146,23 @@ add_task(async function() {
is(state.indexOf("c1.html"), -1, "History entry was not stored in the session state");
gBrowser.removeTab(tab);
});
// helper functions
function waitForLoadsInBrowser(aBrowser, aLoadCount) {
return new Promise(resolve => {
let loadCount = 0;
- aBrowser.addEventListener("load", function(aEvent) {
+ aBrowser.addEventListener("load", function listener(aEvent) {
if (++loadCount < aLoadCount) {
info("Got " + loadCount + " loads, waiting until we have " + aLoadCount);
return;
}
- aBrowser.removeEventListener("load", arguments.callee, true);
+ aBrowser.removeEventListener("load", listener, true);
resolve();
}, true);
});
}
function timeout(delay, task) {
return new Promise((resolve, reject) => {
setTimeout(() => resolve(true), delay);
--- a/browser/extensions/formautofill/.eslintrc.js
+++ b/browser/extensions/formautofill/.eslintrc.js
@@ -73,19 +73,16 @@ module.exports = {
// Maximum length of a line.
// This should be 100 but too many lines were longer than that so set a
// conservative upper bound for now.
"max-len": ["error", 140],
// Maximum depth callbacks can be nested.
"max-nested-callbacks": ["error", 4],
- // Disallow use of arguments.caller or arguments.callee.
- "no-caller": "error",
-
// Disallow using the console API.
"no-console": "error",
// Disallow fallthrough of case statements, except if there is a comment.
"no-fallthrough": "error",
// Disallow use of multiline strings (use template strings instead).
"no-multi-str": "warn",
--- a/security/.eslintrc.js
+++ b/security/.eslintrc.js
@@ -21,19 +21,16 @@ module.exports = {
"generator-star-spacing": ["error", {"before": false, "after": true}],
// Always require parenthesis for new calls
"new-parens": "error",
// Disallow use of alert(), confirm(), and prompt().
"no-alert": "error",
- // Disallow use of arguments.caller or arguments.callee.
- "no-caller": "error",
-
// Disallow likely erroneous `switch` scoped lexical declarations in
// case/default clauses.
"no-case-declarations": "error",
// Disallow use of the console API.
"no-console": "error",
// Disallow constant expressions in conditions (except for loops).
--- a/testing/talos/talos/pageloader/chrome/memory.js
+++ b/testing/talos/talos/pageloader/chrome/memory.js
@@ -8,24 +8,24 @@ var gMemCallback = null;
* Initialize memory collector. Determine if we have a child process.
*/
function initializeMemoryCollector(callback, args) {
gMemCallback = function() { return callback(args); };
var os = Components.classes["@mozilla.org/observer-service;1"].
getService(Components.interfaces.nsIObserverService);
- os.addObserver(function() {
+ os.addObserver(function observer() {
var os = Components.classes["@mozilla.org/observer-service;1"].
getService(Components.interfaces.nsIObserverService);
memTimer.cancel();
memTimer = null;
- os.removeObserver(arguments.callee, "child-memory-reporter-update");
+ os.removeObserver(observer, "child-memory-reporter-update");
os.addObserver(collectAndReport, "child-memory-reporter-update");
gMemCallback();
}, "child-memory-reporter-update");
/*
* Assume we have a child process, but if timer fires before we call the observer
* we will assume there is no child process.
*/
--- a/toolkit/components/extensions/.eslintrc.js
+++ b/toolkit/components/extensions/.eslintrc.js
@@ -151,19 +151,16 @@ module.exports = {
// Don't require a capital letter for constructors, only check if all new
// operators are followed by a capital letter. Don't warn when capitalized
// functions are used without the new operator.
"new-cap": ["off", {"capIsNew": false}],
// Allow use of bitwise operators.
"no-bitwise": "off",
- // Disallow use of arguments.caller or arguments.callee.
- "no-caller": "error",
-
// Disallow the catch clause parameter name being the same as a variable in
// the outer scope, to avoid confusion.
"no-catch-shadow": "off",
// Disallow using the console API.
"no-console": "error",
// Allow using constant expressions in conditions like while (true)
--- a/toolkit/components/passwordmgr/test/browser/browser_passwordmgr_contextmenu.js
+++ b/toolkit/components/passwordmgr/test/browser/browser_passwordmgr_contextmenu.js
@@ -71,18 +71,18 @@ add_task(async function test() {
function assertMenuitemEnabled(idSuffix, expected, reason = "") {
doc.defaultView.UpdateContextMenu();
let actual = !doc.getElementById("context-" + idSuffix).getAttribute("disabled");
is(actual, expected, idSuffix + " should be " + (expected ? "enabled" : "disabled") +
(reason ? ": " + reason : ""));
}
function cleanUp() {
- Services.ww.registerNotification(function(aSubject, aTopic, aData) {
- Services.ww.unregisterNotification(arguments.callee);
+ Services.ww.registerNotification(function notification(aSubject, aTopic, aData) {
+ Services.ww.unregisterNotification(notification);
Services.logins.removeAllLogins();
doc.getElementById("passwordCol").hidden = true;
resolve();
});
pwmgrdlg.close();
}
function testPassword() {
--- a/toolkit/components/passwordmgr/test/browser/browser_passwordmgr_editing.js
+++ b/toolkit/components/passwordmgr/test/browser/browser_passwordmgr_editing.js
@@ -82,25 +82,25 @@ add_task(async function test_setup() {
registerCleanupFunction(function() {
Services.logins.removeAllLogins();
});
Services.logins.removeAllLogins();
// Open the password manager dialog.
pwmgrdlg = window.openDialog(PWMGR_DLG, "Toolkit:PasswordManager", "");
- Services.ww.registerNotification(function(aSubject, aTopic, aData) {
+ Services.ww.registerNotification(function notification(aSubject, aTopic, aData) {
if (aTopic == "domwindowopened") {
let win = aSubject.QueryInterface(Ci.nsIDOMEventTarget);
SimpleTest.waitForFocus(function() {
EventUtils.sendKey("RETURN", win);
}, win);
} else if (aSubject.location == pwmgrdlg.location && aTopic == "domwindowclosed") {
// Unregister ourself.
- Services.ww.unregisterNotification(arguments.callee);
+ Services.ww.unregisterNotification(notification);
}
});
await new Promise((resolve) => {
SimpleTest.waitForFocus(() => {
doc = pwmgrdlg.document;
signonsTree = doc.querySelector("#signonsTree");
resolve();
--- a/toolkit/components/passwordmgr/test/browser/browser_passwordmgr_fields.js
+++ b/toolkit/components/passwordmgr/test/browser/browser_passwordmgr_fields.js
@@ -44,20 +44,20 @@ add_task(async function test() {
is(timeLastUsedCol.getAttribute("hidden"), "true",
"Last Used column is not displayed");
let timePasswordChangedCol = doc.getElementById("timePasswordChangedCol");
is(timePasswordChangedCol.getAttribute("hidden"), "",
"Last Changed column is displayed");
// cleanup
- Services.ww.registerNotification(function(aSubject, aTopic, aData) {
+ Services.ww.registerNotification(function notification(aSubject, aTopic, aData) {
if (aSubject.location == pwmgrdlg.location && aTopic == "domwindowclosed") {
// unregister ourself
- Services.ww.unregisterNotification(arguments.callee);
+ Services.ww.unregisterNotification(notification);
pwmgr.removeAllLogins();
resolve();
}
});
pwmgrdlg.close();
--- a/toolkit/components/passwordmgr/test/browser/browser_passwordmgr_sort.js
+++ b/toolkit/components/passwordmgr/test/browser/browser_passwordmgr_sort.js
@@ -69,31 +69,31 @@ add_task(async function test() {
let toggleCalls = 0;
function toggleShowPasswords(func) {
let toggleButton = doc.getElementById("togglePasswords");
let showMode = (toggleCalls++ % 2) == 0;
// only watch for a confirmation dialog every other time being called
if (showMode) {
- Services.ww.registerNotification(function(aSubject, aTopic, aData) {
+ Services.ww.registerNotification(function notification(aSubject, aTopic, aData) {
if (aTopic == "domwindowclosed")
- Services.ww.unregisterNotification(arguments.callee);
+ Services.ww.unregisterNotification(notification);
else if (aTopic == "domwindowopened") {
let targetWin = aSubject.QueryInterface(Ci.nsIDOMEventTarget);
SimpleTest.waitForFocus(function() {
EventUtils.sendKey("RETURN", targetWin);
}, targetWin);
}
});
}
- Services.obs.addObserver(function(aSubject, aTopic, aData) {
+ Services.obs.addObserver(function observer(aSubject, aTopic, aData) {
if (aTopic == "passwordmgr-password-toggle-complete") {
- Services.obs.removeObserver(arguments.callee, aTopic);
+ Services.obs.removeObserver(observer, aTopic);
func();
}
}, "passwordmgr-password-toggle-complete");
EventUtils.synthesizeMouse(toggleButton, 1, 1, {}, win);
}
function clickCol(col) {
@@ -186,19 +186,19 @@ add_task(async function test() {
// Reset filter
setFilter("");
break;
case 5:
expectedValues = pwds.slice().sort();
checkColumnEntries(2, expectedValues);
checkSortDirection(passwordCol, true);
// cleanup
- Services.ww.registerNotification(function(aSubject, aTopic, aData) {
+ Services.ww.registerNotification(function notification(aSubject, aTopic, aData) {
// unregister ourself
- Services.ww.unregisterNotification(arguments.callee);
+ Services.ww.unregisterNotification(notification);
pwmgr.removeAllLogins();
resolve();
});
pwmgrdlg.close();
}
}
--- a/toolkit/components/passwordmgr/test/browser/browser_passwordmgrdlg.js
+++ b/toolkit/components/passwordmgr/test/browser/browser_passwordmgrdlg.js
@@ -80,31 +80,31 @@ add_task(async function test() {
let toggleCalls = 0;
function toggleShowPasswords(func) {
let toggleButton = doc.getElementById("togglePasswords");
let showMode = (toggleCalls++ % 2) == 0;
// only watch for a confirmation dialog every other time being called
if (showMode) {
- Services.ww.registerNotification(function(aSubject, aTopic, aData) {
+ Services.ww.registerNotification(function notification(aSubject, aTopic, aData) {
if (aTopic == "domwindowclosed")
- Services.ww.unregisterNotification(arguments.callee);
+ Services.ww.unregisterNotification(notification);
else if (aTopic == "domwindowopened") {
let targetWin = aSubject.QueryInterface(Ci.nsIDOMEventTarget);
SimpleTest.waitForFocus(function() {
EventUtils.sendKey("RETURN", targetWin);
}, targetWin);
}
});
}
- Services.obs.addObserver(function(aSubject, aTopic, aData) {
+ Services.obs.addObserver(function observer(aSubject, aTopic, aData) {
if (aTopic == "passwordmgr-password-toggle-complete") {
- Services.obs.removeObserver(arguments.callee, aTopic);
+ Services.obs.removeObserver(observer, aTopic);
func();
}
}, "passwordmgr-password-toggle-complete");
EventUtils.synthesizeMouse(toggleButton, 1, 1, {}, win);
}
function runTests(mode, endFunction) {
@@ -172,19 +172,19 @@ add_task(async function test() {
function step3() {
toggleShowPasswords(function() {
runTests(3, lastStep);
});
}
function lastStep() {
// cleanup
- Services.ww.registerNotification(function(aSubject, aTopic, aData) {
+ Services.ww.registerNotification(function notification(aSubject, aTopic, aData) {
// unregister ourself
- Services.ww.unregisterNotification(arguments.callee);
+ Services.ww.unregisterNotification(notification);
pwmgr.removeAllLogins();
finish();
});
pwmgrdlg.close();
}
step1();
--- a/toolkit/components/payments/.eslintrc.js
+++ b/toolkit/components/payments/.eslintrc.js
@@ -28,17 +28,16 @@ module.exports = {
},
// XXX: following line is used in eslint v4 to not throw an error when chaining methods
//MemberExpression: "off",
outerIIFEBody: 0,
}],
"max-len": ["error", 100],
"max-nested-callbacks": ["error", 4],
"new-parens": "error",
- "no-caller": "error",
"no-console": "error",
"no-fallthrough": "error",
"no-multi-str": "error",
"no-multiple-empty-lines": ["error", {
max: 2,
}],
"no-proto": "error",
"no-throw-literal": "error",
--- a/toolkit/components/satchel/.eslintrc.js
+++ b/toolkit/components/satchel/.eslintrc.js
@@ -28,17 +28,16 @@ module.exports = {
},
// XXX: following line is used in eslint v4 to not throw an error when chaining methods
//MemberExpression: "off",
outerIIFEBody: 0,
}],
"max-len": ["error", 100],
"max-nested-callbacks": ["error", 4],
"new-parens": "error",
- "no-caller": "error",
"no-console": "error",
"no-fallthrough": "error",
"no-multi-str": "error",
"no-multiple-empty-lines": ["error", {
max: 2,
}],
"no-proto": "error",
"no-throw-literal": "error",
--- a/toolkit/content/widgets/toolbar.xml
+++ b/toolkit/content/widgets/toolbar.xml
@@ -132,20 +132,20 @@
<constructor>
<![CDATA[
if (document.readyState == "complete") {
this._init();
} else {
// Need to wait until XUL overlays are loaded. See bug 554279.
let self = this;
- document.addEventListener("readystatechange", function(event) {
+ document.addEventListener("readystatechange", function listener(event) {
if (document.readyState != "complete")
return;
- document.removeEventListener("readystatechange", arguments.callee);
+ document.removeEventListener("readystatechange", listener);
self._init();
});
}
]]>
</constructor>
<method name="_init">
<body>
--- a/toolkit/forgetaboutsite/test/unit/test_removeDataFromDomain.js
+++ b/toolkit/forgetaboutsite/test/unit/test_removeDataFromDomain.js
@@ -497,17 +497,17 @@ async function test_push_cleared() {
} finally {
await PushService._shutdownService();
}
}
// Cache
async function test_cache_cleared() {
// Because this test is asynchronous, it should be the last test
- do_check_true(tests[tests.length - 1] == arguments.callee);
+ do_check_true(tests[tests.length - 1] == test_cache_cleared);
// NOTE: We could be more extensive with this test and actually add an entry
// to the cache, and then make sure it is gone. However, we trust that
// the API is well tested, and that when we get the observer
// notification, we have actually cleared the cache.
// This seems to happen asynchronously...
let os = Cc["@mozilla.org/observer-service;1"].
getService(Ci.nsIObserverService);
--- a/toolkit/modules/debug.js
+++ b/toolkit/modules/debug.js
@@ -42,16 +42,17 @@ this.NS_ASSERT = function NS_ASSERT(cond
case "nightly":
case "aurora":
case "beta":
case "default":
releaseBuild = false;
}
} catch (ex) {}
+ // eslint-disable-next-line no-caller
var caller = arguments.callee.caller;
var assertionText = "ASSERT: " + message + "\n";
// Report the error to the console
Components.utils.reportError(assertionText);
if (releaseBuild) {
return;
--- a/toolkit/mozapps/extensions/test/browser/browser_bug562797.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_bug562797.js
@@ -391,54 +391,54 @@ add_test(function() {
// previous view
add_test(function() {
open_manager("addons://list/plugin", function(aManager) {
info("Part 1");
is_in_list(aManager, "addons://list/plugin", false, false);
gBrowser.loadURI("http://example.com/");
- gBrowser.addEventListener("pageshow", function(event) {
+ gBrowser.addEventListener("pageshow", function listener(event) {
if (event.target.location != "http://example.com/")
return;
- gBrowser.removeEventListener("pageshow", arguments.callee);
+ gBrowser.removeEventListener("pageshow", listener);
info("Part 2");
executeSoon(function() {
ok(gBrowser.canGoBack, "Should be able to go back");
ok(!gBrowser.canGoForward, "Should not be able to go forward");
go_back();
- gBrowser.addEventListener("pageshow", function(event) {
+ gBrowser.addEventListener("pageshow", function listener(event) {
if (event.target.location != "about:addons")
return;
- gBrowser.removeEventListener("pageshow", arguments.callee);
+ gBrowser.removeEventListener("pageshow", listener);
wait_for_view_load(gBrowser.contentWindow.wrappedJSObject, function(aManager) {
info("Part 3");
is_in_list(aManager, "addons://list/plugin", false, true);
executeSoon(() => go_forward());
- gBrowser.addEventListener("pageshow", function(event) {
+ gBrowser.addEventListener("pageshow", function listener(event) {
if (event.target.location != "http://example.com/")
return;
- gBrowser.removeEventListener("pageshow", arguments.callee);
+ gBrowser.removeEventListener("pageshow", listener);
info("Part 4");
executeSoon(function() {
ok(gBrowser.canGoBack, "Should be able to go back");
ok(!gBrowser.canGoForward, "Should not be able to go forward");
go_back();
- gBrowser.addEventListener("pageshow", function(event) {
+ gBrowser.addEventListener("pageshow", function listener(event) {
if (event.target.location != "about:addons")
return;
- gBrowser.removeEventListener("pageshow", arguments.callee);
+ gBrowser.removeEventListener("pageshow", listener);
wait_for_view_load(gBrowser.contentWindow.wrappedJSObject, function(aManager) {
info("Part 5");
is_in_list(aManager, "addons://list/plugin", false, true);
close_manager(aManager, run_next_test);
});
});
});
@@ -534,31 +534,31 @@ add_test(function() {
double_click_addon_element(aManager, "test2@tests.mozilla.org");
wait_for_view_load(aManager, function(aManager) {
info("Part 3");
is_in_detail(aManager, "addons://search/", true, false);
gBrowser.loadURI("http://example.com/");
- gBrowser.addEventListener("pageshow", function(event) {
+ gBrowser.addEventListener("pageshow", function listener(event) {
if (event.target.location != "http://example.com/")
return;
- gBrowser.removeEventListener("pageshow", arguments.callee);
+ gBrowser.removeEventListener("pageshow", listener);
info("Part 4");
executeSoon(function() {
ok(gBrowser.canGoBack, "Should be able to go back");
ok(!gBrowser.canGoForward, "Should not be able to go forward");
go_back();
- gBrowser.addEventListener("pageshow", function(event) {
+ gBrowser.addEventListener("pageshow", function listener(event) {
if (event.target.location != "about:addons")
return;
- gBrowser.removeEventListener("pageshow", arguments.callee);
+ gBrowser.removeEventListener("pageshow", listener);
wait_for_view_load(gBrowser.contentWindow.wrappedJSObject, function(aManager) {
info("Part 5");
is_in_detail(aManager, "addons://search/", true, true);
go_back();
wait_for_view_load(aManager, function(aManager) {
info("Part 6");
@@ -585,20 +585,20 @@ add_test(function() {
EventUtils.synthesizeMouseAtCenter(aManager.document.getElementById("category-plugin"), { }, aManager);
wait_for_view_load(aManager, function(aManager) {
info("Part 2");
is_in_list(aManager, "addons://list/plugin", true, false);
gBrowser.reload();
- gBrowser.addEventListener("pageshow", function(event) {
+ gBrowser.addEventListener("pageshow", function listener(event) {
if (event.target.location != "about:addons")
return;
- gBrowser.removeEventListener("pageshow", arguments.callee);
+ gBrowser.removeEventListener("pageshow", listener);
wait_for_view_load(gBrowser.contentWindow.wrappedJSObject, function(aManager) {
info("Part 3");
is_in_list(aManager, "addons://list/plugin", true, false);
go_back();
wait_for_view_load(aManager, function(aManager) {
info("Part 4");
@@ -621,20 +621,20 @@ add_test(function() {
double_click_addon_element(aManager, "test1@tests.mozilla.org");
wait_for_view_load(aManager, function(aManager) {
info("Part 2");
is_in_detail(aManager, "addons://list/extension", true, false);
gBrowser.reload();
- gBrowser.addEventListener("pageshow", function(event) {
+ gBrowser.addEventListener("pageshow", function listener(event) {
if (event.target.location != "about:addons")
return;
- gBrowser.removeEventListener("pageshow", arguments.callee);
+ gBrowser.removeEventListener("pageshow", listener);
wait_for_view_load(gBrowser.contentWindow.wrappedJSObject, function(aManager) {
info("Part 3");
is_in_detail(aManager, "addons://list/extension", true, false);
go_back();
wait_for_view_load(aManager, function(aManager) {
info("Part 4");
@@ -807,20 +807,20 @@ add_test(function() {
// Tests that when displaying in-content and opened in the background the back
// and forward buttons still appear when switching tabs
add_test(function() {
var tab = BrowserTestUtils.addTab(gBrowser, "about:addons");
var browser = gBrowser.getBrowserForTab(tab);
- browser.addEventListener("pageshow", function(event) {
+ browser.addEventListener("pageshow", function listener(event) {
if (event.target.location.href != "about:addons")
return;
- browser.removeEventListener("pageshow", arguments.callee, true);
+ browser.removeEventListener("pageshow", listener, true);
wait_for_manager_load(browser.contentWindow.wrappedJSObject, function() {
wait_for_view_load(browser.contentWindow.wrappedJSObject, function(aManager) {
gBrowser.selectedTab = tab;
var doc = aManager.document;
var btn = document.getElementById("back-button");
if (!btn || is_hidden(btn)) {
--- a/toolkit/mozapps/extensions/test/browser/browser_cancelCompatCheck.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_cancelCompatCheck.js
@@ -49,18 +49,18 @@ function delayMS(aDelay) {
return new Promise(resolve => {
setTimeout(resolve, aDelay);
});
}
// Return a promise that resolves when the specified observer topic is notified
function promise_observer(aTopic) {
return new Promise(resolve => {
- Services.obs.addObserver(function observe(aSubject, aObsTopic, aData) {
- Services.obs.removeObserver(arguments.callee, aObsTopic);
+ Services.obs.addObserver(function observer(aSubject, aObsTopic, aData) {
+ Services.obs.removeObserver(observer, aObsTopic);
resolve([aSubject, aData]);
}, aTopic);
});
}
// Install a set of addons using a bogus update URL so that we can force
// the compatibility update to happen later
// @param aUpdateURL The real update URL to use after the add-ons are installed
@@ -148,23 +148,23 @@ function promise_open_compatibility_wind
// Cannot be modal as we want to interract with it, shouldn't cause problems
// with testing though.
var features = "chrome,centerscreen,dialog,titlebar";
var ww = Cc["@mozilla.org/embedcomp/window-watcher;1"].
getService(Ci.nsIWindowWatcher);
var win = ww.openWindow(null, URI_EXTENSION_UPDATE_DIALOG, "", features, variant);
- win.addEventListener("load", function() {
+ win.addEventListener("load", function listener() {
function page_shown(aEvent) {
if (aEvent.target.pageid)
info("Page " + aEvent.target.pageid + " shown");
}
- win.removeEventListener("load", arguments.callee);
+ win.removeEventListener("load", listener);
info("Compatibility dialog opened");
win.addEventListener("pageshow", page_shown);
win.addEventListener("unload", function() {
win.removeEventListener("pageshow", page_shown);
dump("Compatibility dialog closed\n");
}, {once: true});
--- a/toolkit/mozapps/extensions/test/browser/browser_metadataTimeout.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_metadataTimeout.js
@@ -56,23 +56,23 @@ function promise_open_compatibility_wind
// Cannot be modal as we want to interract with it, shouldn't cause problems
// with testing though.
var features = "chrome,centerscreen,dialog,titlebar";
var ww = Cc["@mozilla.org/embedcomp/window-watcher;1"].
getService(Ci.nsIWindowWatcher);
var win = ww.openWindow(null, URI_EXTENSION_UPDATE_DIALOG, "", features, variant);
- win.addEventListener("load", function() {
+ win.addEventListener("load", function listener() {
function page_shown(aEvent) {
if (aEvent.target.pageid)
info("Page " + aEvent.target.pageid + " shown");
}
- win.removeEventListener("load", arguments.callee);
+ win.removeEventListener("load", listener);
info("Compatibility dialog opened");
win.addEventListener("pageshow", page_shown);
win.addEventListener("unload", function() {
win.removeEventListener("pageshow", page_shown);
dump("Compatibility dialog closed\n");
}, {once: true});
--- a/toolkit/mozapps/extensions/test/browser/head.js
+++ b/toolkit/mozapps/extensions/test/browser/head.js
@@ -394,18 +394,18 @@ function open_manager(aView, aCallback,
wait_for_view_load(aManagerWindow, function() {
resolve(aManagerWindow);
}, null, aLongerTimeout);
});
}, aManagerWindow);
}
info("Loading manager window in tab");
- Services.obs.addObserver(function(aSubject, aTopic, aData) {
- Services.obs.removeObserver(arguments.callee, aTopic);
+ Services.obs.addObserver(function observer(aSubject, aTopic, aData) {
+ Services.obs.removeObserver(observer, aTopic);
if (aSubject.location.href != MANAGER_URI) {
info("Ignoring load event for " + aSubject.location.href);
return;
}
setup_manager(aSubject);
}, "EM-loaded");
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
@@ -420,20 +420,20 @@ function open_manager(aView, aCallback,
function close_manager(aManagerWindow, aCallback, aLongerTimeout) {
let p = new Promise((resolve, reject) => {
requestLongerTimeout(aLongerTimeout ? aLongerTimeout : 2);
ok(aManagerWindow != null, "Should have an add-ons manager window to close");
is(aManagerWindow.location, MANAGER_URI, "Should be closing window with correct URI");
- aManagerWindow.addEventListener("unload", function() {
+ aManagerWindow.addEventListener("unload", function listener() {
try {
dump("Manager window unload handler\n");
- this.removeEventListener("unload", arguments.callee);
+ this.removeEventListener("unload", listener);
resolve();
} catch (e) {
reject(e);
}
});
});
info("Telling manager window to close");
--- a/toolkit/mozapps/extensions/test/xpcshell/head_addons.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/head_addons.js
@@ -1330,18 +1330,18 @@ async function installSystemAddons(xml,
// Runs a full add-on update check which will in some cases do a system add-on
// update check. Always succeeds.
async function updateAllSystemAddons(xml, testserver) {
do_print("Triggering full add-on update check.");
await serveSystemUpdate(xml, function() {
return new Promise(resolve => {
- Services.obs.addObserver(function() {
- Services.obs.removeObserver(arguments.callee, "addons-background-update-complete");
+ Services.obs.addObserver(function observer() {
+ Services.obs.removeObserver(observer, "addons-background-update-complete");
resolve();
}, "addons-background-update-complete");
// Trigger the background update timer handler
gInternalManager.notify(null);
});
}, testserver);
--- a/toolkit/mozapps/extensions/test/xpcshell/test_backgroundupdate.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_backgroundupdate.js
@@ -33,18 +33,18 @@ function end_test() {
}
// Verify that with no add-ons installed the background update notifications get
// called
function run_test_1() {
AddonManager.getAddonsByTypes(["extension", "theme", "locale"], function(aAddons) {
do_check_eq(aAddons.length, 0);
- Services.obs.addObserver(function() {
- Services.obs.removeObserver(arguments.callee, "addons-background-update-complete");
+ Services.obs.addObserver(function observer() {
+ Services.obs.removeObserver(observer, "addons-background-update-complete");
do_execute_soon(run_test_2);
}, "addons-background-update-complete");
// Trigger the background update timer handler
gInternalManager.notify(null);
});
}
@@ -95,18 +95,18 @@ function run_test_2() {
// Do hotfix checks
Services.prefs.setCharPref("extensions.hotfix.id", "hotfix@tests.mozilla.org");
Services.prefs.setCharPref("extensions.hotfix.url", "http://localhost:" + gPort + "/missing.rdf");
let installCount = 0;
let completeCount = 0;
let sawCompleteNotification = false;
- Services.obs.addObserver(function() {
- Services.obs.removeObserver(arguments.callee, "addons-background-update-complete");
+ Services.obs.addObserver(function observer() {
+ Services.obs.removeObserver(observer, "addons-background-update-complete");
do_check_eq(installCount, 3);
sawCompleteNotification = true;
}, "addons-background-update-complete");
AddonManager.addInstallListener({
onNewInstall(aInstall) {
installCount++;
--- a/toolkit/mozapps/extensions/test/xpcshell/test_blocklist_metadata_filters.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_blocklist_metadata_filters.js
@@ -47,18 +47,18 @@ var WindowWatcher = {
throw Cr.NS_ERROR_NO_INTERFACE;
}
};
MockRegistrar.register("@mozilla.org/embedcomp/window-watcher;1", WindowWatcher);
function load_blocklist(aFile, aCallback) {
- Services.obs.addObserver(function() {
- Services.obs.removeObserver(arguments.callee, "blocklist-updated");
+ Services.obs.addObserver(function observer() {
+ Services.obs.removeObserver(observer, "blocklist-updated");
do_execute_soon(aCallback);
}, "blocklist-updated");
Services.prefs.setCharPref("extensions.blocklist.url", "http://localhost:" +
gPort + "/data/" + aFile);
var blocklist = Cc["@mozilla.org/extensions/blocklist;1"].
getService(Ci.nsITimerCallback);
--- a/toolkit/mozapps/extensions/test/xpcshell/test_blocklist_prefs.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_blocklist_prefs.js
@@ -53,18 +53,18 @@ var WindowWatcher = {
throw Cr.NS_ERROR_NO_INTERFACE;
}
};
MockRegistrar.register("@mozilla.org/embedcomp/window-watcher;1", WindowWatcher);
function load_blocklist(aFile, aCallback) {
- Services.obs.addObserver(function() {
- Services.obs.removeObserver(arguments.callee, "blocklist-updated");
+ Services.obs.addObserver(function observer() {
+ Services.obs.removeObserver(observer, "blocklist-updated");
do_execute_soon(aCallback);
}, "blocklist-updated");
Services.prefs.setCharPref("extensions.blocklist.url", "http://localhost:" +
gPort + "/data/" + aFile);
var blocklist = Cc["@mozilla.org/extensions/blocklist;1"].
getService(Ci.nsITimerCallback);
--- a/toolkit/mozapps/extensions/test/xpcshell/test_blocklist_regexp.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_blocklist_regexp.js
@@ -49,18 +49,18 @@ var WindowWatcher = {
throw Cr.NS_ERROR_NO_INTERFACE;
}
};
MockRegistrar.register("@mozilla.org/embedcomp/window-watcher;1", WindowWatcher);
function load_blocklist(aFile, aCallback) {
- Services.obs.addObserver(function() {
- Services.obs.removeObserver(arguments.callee, "blocklist-updated");
+ Services.obs.addObserver(function observer() {
+ Services.obs.removeObserver(observer, "blocklist-updated");
do_execute_soon(aCallback);
}, "blocklist-updated");
Services.prefs.setCharPref("extensions.blocklist.url", "http://localhost:" +
gPort + "/data/" + aFile);
var blocklist = Cc["@mozilla.org/extensions/blocklist;1"].
getService(Ci.nsITimerCallback);
--- a/toolkit/mozapps/extensions/test/xpcshell/test_blocklistchange.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_blocklistchange.js
@@ -390,18 +390,18 @@ registrar.registerFactory(Components.ID(
"Fake Install Prompt",
"@mozilla.org/addons/web-install-prompt;1", InstallConfirmFactory);
const profileDir = gProfD.clone();
profileDir.append("extensions");
function Pload_blocklist(aFile) {
let blocklist_updated = new Promise((resolve, reject) => {
- Services.obs.addObserver(function() {
- Services.obs.removeObserver(arguments.callee, "blocklist-updated");
+ Services.obs.addObserver(function observer() {
+ Services.obs.removeObserver(observer, "blocklist-updated");
resolve();
}, "blocklist-updated");
});
Services.prefs.setCharPref("extensions.blocklist.url", "http://localhost:" + gPort + "/data/blocklistchange/" + aFile);
var blocklist = Cc["@mozilla.org/extensions/blocklist;1"].
getService(Ci.nsITimerCallback);
@@ -433,18 +433,18 @@ function Pbackground_update() {
// callback when it is done
if (!backgroundCheckCompleted)
return;
resolve();
}
})
- Services.obs.addObserver(function() {
- Services.obs.removeObserver(arguments.callee, "addons-background-update-complete");
+ Services.obs.addObserver(function observer() {
+ Services.obs.removeObserver(observer, "addons-background-update-complete");
backgroundCheckCompleted = true;
// If any new installs have started then we'll call the callback once they
// are completed
if (installCount)
return;
resolve();
@@ -549,17 +549,16 @@ add_task(async function init() {
let [/* s1 */, /* s2 */, /* s3 */, s4, s5, /* h, r */] = await promiseAddonsByIDs(ADDON_IDS);
s4.userDisabled = true;
s5.userDisabled = false;
});
// Starts with add-ons unblocked and then switches application versions to
// change add-ons to blocked and back
add_task(async function run_app_update_test() {
- do_print("Test: " + arguments.callee.name);
await promiseRestartManager();
await Pload_blocklist("app_update.xml");
await promiseRestartManager();
let [s1, s2, s3, s4, s5, h, r] = await promiseAddonsByIDs(ADDON_IDS);
check_addon(s1, "1.0", false, false, Ci.nsIBlocklistService.STATE_NOT_BLOCKED);
check_addon(s2, "1.0", false, false, Ci.nsIBlocklistService.STATE_NOT_BLOCKED);
@@ -627,17 +626,16 @@ add_task(async function app_update_step_
s2.userDisabled = false;
s5.userDisabled = false;
});
// Starts with add-ons unblocked and then switches application versions to
// change add-ons to blocked and back. A DB schema change is faked to force a
// rebuild when the application version changes
add_task(async function run_app_update_schema_test() {
- do_print("Test: " + arguments.callee.name);
await promiseRestartManager();
let [s1, s2, s3, s4, s5, h, r] = await promiseAddonsByIDs(ADDON_IDS);
check_addon(s1, "1.0", false, false, Ci.nsIBlocklistService.STATE_NOT_BLOCKED);
check_addon(s2, "1.0", false, false, Ci.nsIBlocklistService.STATE_NOT_BLOCKED);
check_addon(s3, "1.0", false, false, Ci.nsIBlocklistService.STATE_NOT_BLOCKED);
check_addon(s4, "1.0", true, false, Ci.nsIBlocklistService.STATE_NOT_BLOCKED);
@@ -731,17 +729,16 @@ add_task(async function update_schema_5(
s1.userDisabled = false;
s2.userDisabled = false;
s5.userDisabled = false;
});
// Starts with add-ons unblocked and then loads new blocklists to change add-ons
// to blocked and back again.
add_task(async function run_blocklist_update_test() {
- do_print("Test: " + arguments.callee.name + "\n");
await Pload_blocklist("blocklist_update1.xml");
await promiseRestartManager();
let [s1, s2, s3, s4, s5, h, r] = await promiseAddonsByIDs(ADDON_IDS);
check_addon(s1, "1.0", false, false, Ci.nsIBlocklistService.STATE_NOT_BLOCKED);
check_addon(s2, "1.0", false, false, Ci.nsIBlocklistService.STATE_NOT_BLOCKED);
check_addon(s3, "1.0", false, false, Ci.nsIBlocklistService.STATE_NOT_BLOCKED);
@@ -804,17 +801,16 @@ add_task(async function run_blocklist_up
s1.userDisabled = false;
s2.userDisabled = false;
s5.userDisabled = false;
});
// Starts with add-ons unblocked and then new versions are installed outside of
// the app to change them to blocked and back again.
add_task(async function run_addon_change_test() {
- do_print("Test: " + arguments.callee.name + "\n");
await Pload_blocklist("addon_change.xml");
await promiseRestartManager();
let [s1, s2, s3, s4, s5, h, r] = await promiseAddonsByIDs(ADDON_IDS);
check_addon(s1, "1.0", false, false, Ci.nsIBlocklistService.STATE_NOT_BLOCKED);
check_addon(s2, "1.0", false, false, Ci.nsIBlocklistService.STATE_NOT_BLOCKED);
check_addon(s3, "1.0", false, false, Ci.nsIBlocklistService.STATE_NOT_BLOCKED);
@@ -931,17 +927,16 @@ add_task(async function run_addon_change
s1.userDisabled = false;
s2.userDisabled = false;
s5.userDisabled = false;
});
// Starts with add-ons blocked and then new versions are installed outside of
// the app to change them to unblocked.
add_task(async function run_addon_change_2_test() {
- do_print("Test: " + arguments.callee.name + "\n");
await promiseShutdownManager();
getFileForAddon(profileDir, softblock1_1.id).remove(true);
getFileForAddon(profileDir, softblock2_1.id).remove(true);
getFileForAddon(profileDir, softblock3_1.id).remove(true);
getFileForAddon(profileDir, softblock4_1.id).remove(true);
getFileForAddon(profileDir, softblock5_1.id).remove(true);
getFileForAddon(profileDir, hardblock_1.id).remove(true);
@@ -1038,17 +1033,16 @@ add_task(async function addon_change_2_t
s2.userDisabled = false;
s4.userDisabled = true;
s5.userDisabled = false;
});
// Add-ons are initially unblocked then attempts to upgrade to blocked versions
// in the background which should fail
add_task(async function run_background_update_test() {
- do_print("Test: " + arguments.callee.name + "\n");
await promiseRestartManager();
let [s1, s2, s3, s4, s5, h, r] = await promiseAddonsByIDs(ADDON_IDS);
check_addon(s1, "1.0", false, false, Ci.nsIBlocklistService.STATE_NOT_BLOCKED);
check_addon(s2, "1.0", false, false, Ci.nsIBlocklistService.STATE_NOT_BLOCKED);
check_addon(s3, "1.0", false, false, Ci.nsIBlocklistService.STATE_NOT_BLOCKED);
check_addon(s4, "1.0", true, false, Ci.nsIBlocklistService.STATE_NOT_BLOCKED);
@@ -1068,17 +1062,16 @@ add_task(async function run_background_u
check_addon(s5, "1.0", false, false, Ci.nsIBlocklistService.STATE_NOT_BLOCKED);
check_addon(h, "1.0", false, false, Ci.nsIBlocklistService.STATE_NOT_BLOCKED);
check_addon(r, "1.0", false, false, Ci.nsIBlocklistService.STATE_NOT_BLOCKED);
});
// Starts with add-ons blocked and then new versions are detected and installed
// automatically for unblocked versions.
add_task(async function run_background_update_2_test() {
- do_print("Test: " + arguments.callee.name + "\n");
await promiseShutdownManager();
getFileForAddon(profileDir, softblock1_1.id).remove(true);
getFileForAddon(profileDir, softblock2_1.id).remove(true);
getFileForAddon(profileDir, softblock3_1.id).remove(true);
getFileForAddon(profileDir, softblock4_1.id).remove(true);
getFileForAddon(profileDir, softblock5_1.id).remove(true);
getFileForAddon(profileDir, hardblock_1.id).remove(true);
@@ -1128,17 +1121,16 @@ add_task(async function run_background_u
s2.userDisabled = false;
s4.userDisabled = true;
s5.userDisabled = true;
});
// Starts with add-ons blocked and then simulates the user upgrading them to
// unblocked versions.
add_task(async function run_manual_update_test() {
- do_print("Test: " + arguments.callee.name + "\n");
await promiseRestartManager();
await Pload_blocklist("manual_update.xml");
await promiseRestartManager();
let [s1, s2, s3, s4, s5, h, r] = await promiseAddonsByIDs(ADDON_IDS);
check_addon(s1, "1.0", true, true, Ci.nsIBlocklistService.STATE_SOFTBLOCKED);
check_addon(s2, "1.0", true, true, Ci.nsIBlocklistService.STATE_SOFTBLOCKED);
@@ -1182,17 +1174,16 @@ add_task(async function run_manual_updat
check_addon(s5, "3.0", false, false, Ci.nsIBlocklistService.STATE_NOT_BLOCKED);
check_addon(h, "3.0", false, false, Ci.nsIBlocklistService.STATE_NOT_BLOCKED);
check_addon(r, "3.0", false, false, Ci.nsIBlocklistService.STATE_NOT_BLOCKED);
});
// Starts with add-ons blocked and then new versions are installed outside of
// the app to change them to unblocked.
add_task(async function run_manual_update_2_test() {
- do_print("Test: " + arguments.callee.name + "\n");
await promiseShutdownManager();
getFileForAddon(profileDir, softblock1_1.id).remove(true);
getFileForAddon(profileDir, softblock2_1.id).remove(true);
getFileForAddon(profileDir, softblock3_1.id).remove(true);
getFileForAddon(profileDir, softblock4_1.id).remove(true);
getFileForAddon(profileDir, softblock5_1.id).remove(true);
getFileForAddon(profileDir, hardblock_1.id).remove(true);
@@ -1253,17 +1244,16 @@ add_task(async function run_manual_updat
s1.userDisabled = false;
s2.userDisabled = false;
s4.userDisabled = true;
});
// Uses the API to install blocked add-ons from the local filesystem
add_task(async function run_local_install_test() {
- do_print("Test: " + arguments.callee.name + "\n");
await promiseShutdownManager();
getFileForAddon(profileDir, softblock1_1.id).remove(true);
getFileForAddon(profileDir, softblock2_1.id).remove(true);
getFileForAddon(profileDir, softblock3_1.id).remove(true);
getFileForAddon(profileDir, softblock4_1.id).remove(true);
getFileForAddon(profileDir, softblock5_1.id).remove(true);
getFileForAddon(profileDir, hardblock_1.id).remove(true);
--- a/toolkit/mozapps/extensions/test/xpcshell/test_bug393285.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_bug393285.js
@@ -61,18 +61,18 @@ var WindowWatcher = {
throw Cr.NS_ERROR_NO_INTERFACE;
}
};
MockRegistrar.register("@mozilla.org/embedcomp/window-watcher;1", WindowWatcher);
function load_blocklist(aFile, aCallback) {
- Services.obs.addObserver(function() {
- Services.obs.removeObserver(arguments.callee, "blocklist-updated");
+ Services.obs.addObserver(function observer() {
+ Services.obs.removeObserver(observer, "blocklist-updated");
do_execute_soon(aCallback);
}, "blocklist-updated");
Services.prefs.setCharPref("extensions.blocklist.url", "http://localhost:" +
gPort + "/data/" + aFile);
var blocklist = Cc["@mozilla.org/extensions/blocklist;1"].
getService(Ci.nsITimerCallback);
--- a/toolkit/mozapps/extensions/test/xpcshell/test_bug406118.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_bug406118.js
@@ -49,18 +49,18 @@ var WindowWatcher = {
throw Cr.NS_ERROR_NO_INTERFACE;
}
};
MockRegistrar.register("@mozilla.org/embedcomp/window-watcher;1", WindowWatcher);
function load_blocklist(aFile, aCallback) {
- Services.obs.addObserver(function() {
- Services.obs.removeObserver(arguments.callee, "blocklist-updated");
+ Services.obs.addObserver(function observer() {
+ Services.obs.removeObserver(observer, "blocklist-updated");
do_execute_soon(aCallback);
}, "blocklist-updated");
Services.prefs.setCharPref("extensions.blocklist.url", "http://localhost:" +
gPort + "/data/" + aFile);
var blocklist = Cc["@mozilla.org/extensions/blocklist;1"].
getService(Ci.nsITimerCallback);
--- a/toolkit/mozapps/extensions/test/xpcshell/test_bug619730.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_bug619730.js
@@ -10,18 +10,18 @@ var Cu = Components.utils;
Cu.import("resource://testing-common/httpd.js");
var gTestserver = new HttpServer();
gTestserver.start(-1);
gPort = gTestserver.identity.primaryPort;
mapFile("/data/test_bug619730.xml", gTestserver);
function load_blocklist(file, aCallback) {
- Services.obs.addObserver(function() {
- Services.obs.removeObserver(arguments.callee, "blocklist-updated");
+ Services.obs.addObserver(function observer() {
+ Services.obs.removeObserver(observer, "blocklist-updated");
do_execute_soon(aCallback);
}, "blocklist-updated");
Services.prefs.setCharPref("extensions.blocklist.url", "http://localhost:" +
gPort + "/data/" + file);
var blocklist = Cc["@mozilla.org/extensions/blocklist;1"].
getService(Ci.nsITimerCallback);
--- a/toolkit/mozapps/extensions/test/xpcshell/test_softblocked.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_softblocked.js
@@ -45,18 +45,18 @@ var WindowWatcher = {
MockRegistrar.register("@mozilla.org/embedcomp/window-watcher;1", WindowWatcher);
const profileDir = gProfD.clone();
profileDir.append("extensions");
function load_blocklist(aFile) {
return new Promise((resolve, reject) => {
- Services.obs.addObserver(function() {
- Services.obs.removeObserver(arguments.callee, "blocklist-updated");
+ Services.obs.addObserver(function observer() {
+ Services.obs.removeObserver(observer, "blocklist-updated");
resolve();
}, "blocklist-updated");
Services.prefs.setCharPref("extensions.blocklist.url", `http://localhost:${gPort}/data/${aFile}`);
var blocklist = Cc["@mozilla.org/extensions/blocklist;1"].
getService(Ci.nsITimerCallback);
blocklist.notify(null);
--- a/toolkit/mozapps/extensions/test/xpcshell/test_sourceURI.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_sourceURI.js
@@ -21,18 +21,18 @@ var addon = {
maxVersion: "1"
}]
};
const profileDir = gProfD.clone();
profileDir.append("extensions");
function backgroundUpdate(aCallback) {
- Services.obs.addObserver(function() {
- Services.obs.removeObserver(arguments.callee, "addons-background-update-complete");
+ Services.obs.addObserver(function observer() {
+ Services.obs.removeObserver(observer, "addons-background-update-complete");
aCallback();
}, "addons-background-update-complete");
AddonManagerPrivate.backgroundUpdateCheck();
}
function run_test() {
do_test_pending();
--- a/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/recommended.js
+++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/recommended.js
@@ -149,16 +149,18 @@ module.exports = {
"mozilla/use-ownerGlobal": "error",
// Always require parenthesis for new calls
// "new-parens": "error",
// Use [] instead of Array()
"no-array-constructor": "error",
+ "no-caller": "error",
+
// Disallow modifying variables of class declarations.
"no-class-assign": "error",
// Disallow assignment operators in conditional statements
"no-cond-assign": "error",
// Disallow modifying variables that are declared using const.
"no-const-assign": "error",