Bug 1392119 - Enable the ESLint no-caller rule across mozilla-central r=standard8

MozReview-Commit-ID: JOC1330iFnh

--HG--
extra : rebase_source : 2afcb219d4a0d78f996bdc2c841456d2dccff605
This commit is contained in:
Dan Banner 2017-08-23 13:38:24 +01:00
parent 1184431374
commit f1eb5aaa84
51 changed files with 141 additions and 163 deletions

View File

@ -31,7 +31,6 @@ module.exports = {
"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",

View File

@ -370,7 +370,7 @@ appUpdater.prototype =
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" ||
@ -391,7 +391,7 @@ appUpdater.prototype =
self.setupDownloadingUI();
return;
}
Services.obs.removeObserver(arguments.callee, "update-staged");
Services.obs.removeObserver(observer, "update-staged");
}, "update-staged");
} else {
this.selectPanel("apply");

View File

@ -110,9 +110,9 @@ var tabPreviewPanelHelper = {
},
_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);
}
};

View File

@ -71,9 +71,9 @@ function test2Setup() {
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");
@ -107,10 +107,10 @@ function test3Setup() {
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();

View File

@ -82,15 +82,15 @@ 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 {

View File

@ -30,21 +30,21 @@ function record(aName) {
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");
}
};

View File

@ -2,7 +2,7 @@
* 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;
@ -13,7 +13,7 @@
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);
@ -51,4 +51,3 @@
// Press enter!
EventUtils.synthesizeKey("VK_RETURN", {});
});

View File

@ -23,9 +23,9 @@ function checkAnimationState() {
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();

View File

@ -1,9 +1,9 @@
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");

View File

@ -49,18 +49,18 @@ function testClosePrintPreviewWithClosingWindowShortcutKey() {
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;
@ -69,6 +69,6 @@ function checkPrintPreviewClosed(aCallback) {
// The test might fail.
PrintUtils.exitPrintPreview();
}
executeSoon(arguments.callee);
executeSoon(waitForPrintPreviewClosed);
});
}

View File

@ -6,11 +6,11 @@ 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();

View File

@ -83,7 +83,7 @@ add_task(async function() {
let deleted = 0;
while (deleted < charsToDelete) {
await urlbarBackspace(arguments.callee);
await urlbarBackspace();
deleted++;
}
@ -104,5 +104,3 @@ add_task(async function() {
await cycleTabs();
cleanUp();
});

View File

@ -311,7 +311,7 @@ gTests.push({
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});

View File

@ -27,7 +27,7 @@ var dragDirections = { LEFT: 0, UP: 1, RIGHT: 2, DOWN: 3 };
*/
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,
@ -54,7 +54,7 @@ function synthesizeDragWithDirection(aElement, aExpectedDragData, aDirection, aC
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.

View File

@ -14,25 +14,25 @@ function waitForBookmarkNotification(aNotification, aCallback, aProperty) {
// 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);
@ -50,11 +50,11 @@ function waitForBookmarkNotification(aNotification, aCallback, aProperty) {
});
},
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 });
}

View File

@ -22,9 +22,9 @@ add_task(async function test() {
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",

View File

@ -14,11 +14,11 @@ function test() {
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
@ -26,20 +26,20 @@ function test() {
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;
}

View File

@ -12,14 +12,14 @@ function test() {
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() {

View File

@ -12,17 +12,17 @@ function test() {
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

View File

@ -12,17 +12,17 @@ function test() {
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

View File

@ -151,13 +151,13 @@ add_task(async function() {
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);
});

View File

@ -78,9 +78,6 @@ module.exports = {
// 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",

View File

@ -26,9 +26,6 @@ module.exports = {
// 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",

View File

@ -13,14 +13,14 @@ function initializeMemoryCollector(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");

View File

@ -156,9 +156,6 @@ module.exports = {
// 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",

View File

@ -76,8 +76,8 @@ add_task(async function test() {
}
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();

View File

@ -87,7 +87,7 @@ add_task(async function test_setup() {
// 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() {
@ -95,7 +95,7 @@ add_task(async function test_setup() {
}, win);
} else if (aSubject.location == pwmgrdlg.location && aTopic == "domwindowclosed") {
// Unregister ourself.
Services.ww.unregisterNotification(arguments.callee);
Services.ww.unregisterNotification(notification);
}
});

View File

@ -49,10 +49,10 @@ add_task(async function test() {
"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();

View File

@ -74,9 +74,9 @@ add_task(async function test() {
// 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() {
@ -86,9 +86,9 @@ add_task(async function test() {
});
}
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");
@ -191,9 +191,9 @@ add_task(async function test() {
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();

View File

@ -85,9 +85,9 @@ add_task(async function test() {
// 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() {
@ -97,9 +97,9 @@ add_task(async function test() {
});
}
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");
@ -177,9 +177,9 @@ add_task(async function test() {
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();

View File

@ -33,7 +33,6 @@ module.exports = {
"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",

View File

@ -33,7 +33,6 @@ module.exports = {
"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",

View File

@ -137,10 +137,10 @@
} 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();
});
}

View File

@ -502,7 +502,7 @@ async function test_push_cleared() {
// 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

View File

@ -47,6 +47,7 @@ this.NS_ASSERT = function NS_ASSERT(condition, message) {
}
} catch (ex) {}
// eslint-disable-next-line no-caller
var caller = arguments.callee.caller;
var assertionText = "ASSERT: " + message + "\n";

View File

@ -396,10 +396,10 @@ add_test(function() {
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() {
@ -408,20 +408,20 @@ add_test(function() {
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() {
@ -430,10 +430,10 @@ add_test(function() {
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);
@ -539,10 +539,10 @@ add_test(function() {
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() {
@ -550,10 +550,10 @@ add_test(function() {
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");
@ -590,10 +590,10 @@ add_test(function() {
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");
@ -626,10 +626,10 @@ add_test(function() {
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");
@ -812,10 +812,10 @@ 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) {

View File

@ -54,8 +54,8 @@ function delayMS(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);
});
@ -153,13 +153,13 @@ function promise_open_compatibility_window(aInactiveAddonIds) {
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");

View File

@ -61,13 +61,13 @@ function promise_open_compatibility_window(aInactiveAddonIds) {
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");

View File

@ -399,8 +399,8 @@ function open_manager(aView, aCallback, aLoadCallback, aLongerTimeout) {
}
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;
@ -425,10 +425,10 @@ function close_manager(aManagerWindow, aCallback, aLongerTimeout) {
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);

View File

@ -1335,8 +1335,8 @@ async function updateAllSystemAddons(xml, testserver) {
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");

View File

@ -38,8 +38,8 @@ 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");
@ -100,8 +100,8 @@ function run_test_2() {
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;

View File

@ -52,8 +52,8 @@ var WindowWatcher = {
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");

View File

@ -58,8 +58,8 @@ var WindowWatcher = {
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");

View File

@ -54,8 +54,8 @@ 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");

View File

@ -395,8 +395,8 @@ 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");
@ -438,8 +438,8 @@ function Pbackground_update() {
}
})
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
@ -554,7 +554,6 @@ add_task(async function init() {
// 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();
@ -632,7 +631,6 @@ add_task(async function app_update_step_4() {
// 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);
@ -736,7 +734,6 @@ add_task(async function update_schema_5() {
// 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();
@ -809,7 +806,6 @@ add_task(async function run_blocklist_update_test() {
// 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();
@ -936,7 +932,6 @@ add_task(async function run_addon_change_4() {
// 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);
@ -1043,7 +1038,6 @@ add_task(async function addon_change_2_test_3() {
// 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);
@ -1073,7 +1067,6 @@ add_task(async function run_background_update_test() {
// 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);
@ -1133,7 +1126,6 @@ add_task(async function run_background_update_2_test() {
// 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();
@ -1187,7 +1179,6 @@ add_task(async function run_manual_update_test() {
// 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);
@ -1258,7 +1249,6 @@ add_task(async function run_manual_update_2_test() {
// 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);

View File

@ -66,8 +66,8 @@ 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");

View File

@ -54,8 +54,8 @@ var WindowWatcher = {
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");

View File

@ -15,8 +15,8 @@ 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");

View File

@ -50,8 +50,8 @@ 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");

View File

@ -26,8 +26,8 @@ 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");

View File

@ -154,6 +154,8 @@ module.exports = {
// Use [] instead of Array()
"no-array-constructor": "error",
"no-caller": "error",
// Disallow modifying variables of class declarations.
"no-class-assign": "error",