Bug 1864896: Autofix unused function arguments (browser/components/newtab). r=omc-reviewers,aminomancer,thecount

Differential Revision: https://phabricator.services.mozilla.com/D202950
This commit is contained in:
Dave Townsend
2024-03-01 15:20:17 +00:00
parent ad6df9d5f5
commit 20b5d8c60f
53 changed files with 123 additions and 138 deletions

View File

@@ -43,7 +43,7 @@ export class ASRouterChild extends JSWindowActorChild {
});
}
handleEvent(event) {
handleEvent() {
// DOMDocElementCreated is only used to create the actor.
}

View File

@@ -258,7 +258,7 @@ export class ASRouterAdminInner extends React.PureComponent {
ASRouterUtils.sendMessage({ type: "RESET_PROVIDER_PREF" });
}
resetGroups(id, value) {
resetGroups() {
ASRouterUtils.sendMessage({
type: "RESET_GROUPS_STATE",
}).then(this.setStateFromParent);
@@ -387,7 +387,7 @@ export class ASRouterAdminInner extends React.PureComponent {
}
// Simulate a copy event that sets to clipboard all targeting paramters and values
onCopyTargetingParams(event) {
onCopyTargetingParams() {
const stringTargetingParameters = {
...this.state.stringTargetingParameters,
};
@@ -507,7 +507,7 @@ export class ASRouterAdminInner extends React.PureComponent {
isBlocked ? null : isModified ? (
<button
className="button restore"
onClick={e => this.resetJSON(msg)}
onClick={() => this.resetJSON(msg)}
>
Reset
</button>
@@ -523,7 +523,7 @@ export class ASRouterAdminInner extends React.PureComponent {
{isBlocked ? null : (
<button
className="button modify"
onClick={e => this.modifyJson(msg)}
onClick={() => this.modifyJson(msg)}
>
Modify
</button>
@@ -557,7 +557,7 @@ export class ASRouterAdminInner extends React.PureComponent {
name={msg.id}
className="general-textarea"
disabled={isBlocked}
onChange={e => this.handleChange(msg.id)}
onChange={() => this.handleChange(msg.id)}
>
{JSON.stringify(msg, null, 2)}
</textarea>
@@ -647,7 +647,7 @@ export class ASRouterAdminInner extends React.PureComponent {
</button>
<button
className="ASRouterButton slim button"
onClick={e => this.resetPBJSON(msg)}
onClick={() => this.resetPBJSON(msg)}
>
Reset JSON
</button>
@@ -698,7 +698,7 @@ export class ASRouterAdminInner extends React.PureComponent {
<div>
<button
className="ASRouterButton slim"
onClick={e => this.toggleAllMessages(messagesToShow)}
onClick={() => this.toggleAllMessages(messagesToShow)}
>
Collapse/Expand All
</button>
@@ -1046,7 +1046,7 @@ export class ASRouterAdminInner extends React.PureComponent {
});
}
setAttribution(e) {
setAttribution() {
ASRouterUtils.sendMessage({
type: "FORCE_ATTRIBUTION",
data: this.state.attributionParameters,
@@ -1307,7 +1307,7 @@ export class ASRouterAdminInner extends React.PureComponent {
<h2>Messages</h2>
<button
className="ASRouterButton slim button"
onClick={e => this.toggleAllMessages(messagesToShow)}
onClick={() => this.toggleAllMessages(messagesToShow)}
>
Collapse/Expand All
</button>
@@ -1359,10 +1359,7 @@ export class ASRouterAdminInner extends React.PureComponent {
<tbody>
{this.state.groups &&
this.state.groups.map(
(
{ id, enabled, frequency, userPreferences = [] },
index
) => (
({ id, enabled, frequency, userPreferences = [] }) => (
<Row key={id}>
<td>
<TogglePrefCheckbox

View File

@@ -26,7 +26,7 @@ export const CopyButton = ({
timeout.current = setTimeout(() => setCopied(false), 1500);
}, [inputSelector, transformer]);
return (
<button className={className} onClick={e => onClick()} {...props}>
<button className={className} onClick={() => onClick()} {...props}>
{(copied && copiedLabel) || label}
</button>
);

View File

@@ -947,7 +947,7 @@ export class _ASRouter {
return this.state;
}
async _onLocaleChanged(subject, topic, data) {
async _onLocaleChanged() {
await this._maybeUpdateL10nAttachment();
}
@@ -1743,7 +1743,7 @@ export class _ASRouter {
}
// Update storage
this._storage.set("groupImpressions", newGroupImpressions);
return this.setState(({ groups }) => ({
return this.setState(() => ({
groupImpressions: newGroupImpressions,
}));
}

View File

@@ -576,7 +576,7 @@ const TargetingGetters = {
lazy.fxAccounts
.getSignedInUser()
.then(data => resolve(!!data))
.catch(e => resolve(false));
.catch(() => resolve(false));
});
},
get sync() {

View File

@@ -446,7 +446,7 @@ export const ASRouterTriggerListeners = new Map([
}
},
observe(aSubject, aTopic, aData) {
observe(aSubject, aTopic) {
if (aSubject.currentURI.asciiHost === "accounts.firefox.com") {
// Don't notify about saved logins on the FxA login origin since this
// trigger is used to promote login Sync and getting a recommendation
@@ -562,7 +562,7 @@ export const ASRouterTriggerListeners = new Map([
_sessionPageLoad: 0,
onLocationChange: null,
init(triggerHandler, params, patterns) {
init(triggerHandler, params) {
params.forEach(p => this._events.push(p));
if (!this._initialized) {
@@ -610,7 +610,7 @@ export const ASRouterTriggerListeners = new Map([
this._sessionPageLoad = 0;
},
observe(aSubject, aTopic, aData) {
observe(aSubject, aTopic) {
switch (aTopic) {
case "SiteProtection:ContentBlockingEvent":
const { browser, host, event } = aSubject.wrappedJSObject;
@@ -690,7 +690,7 @@ export const ASRouterTriggerListeners = new Map([
this._triggerHandler = triggerHandler;
},
observe(aSubject, aTopic, aData) {
observe(aSubject, aTopic) {
switch (aTopic) {
case "captive-portal-login-success":
const browser = Services.wm.getMostRecentBrowserWindow();

View File

@@ -792,7 +792,7 @@ export class PageAction {
* Respond to a user click on the recommendation by showing a doorhanger/
* popup notification or running the action defined in the message
*/
async _cfrUrlbarButtonClick(event) {
async _cfrUrlbarButtonClick() {
const browser = this.window.gBrowser.selectedBrowser;
if (!RecommendationMap.has(browser)) {
// There's no recommendation for this browser, so the user shouldn't have

View File

@@ -192,7 +192,7 @@ export class _FeatureCalloutBroker {
return item;
}
handleFeatureCalloutCallback(win, event, data) {
handleFeatureCalloutCallback(win, event) {
switch (event) {
case "end":
const item = this.#calloutMap.get(win);

View File

@@ -123,7 +123,7 @@ export const ToastNotification = {
}
let shownPromise = Promise.withResolvers();
let obs = (subject, topic, data) => {
let obs = (subject, topic) => {
if (topic === "alertshow") {
shownPromise.resolve();
}

View File

@@ -81,7 +81,7 @@ export class _ToolbarBadgeHub {
win.MozXULElement.insertFTLIfNeeded("browser/newtab/asrouter.ftl");
}
executeAction({ id, data, message_id }) {
executeAction({ id }) {
switch (id) {
case "show-whatsnew-button":
lazy.ToolbarPanelHub.enableToolbarButton();

View File

@@ -183,7 +183,7 @@ add_setup(async function () {
// Store it in order to restore to the original value
const { _fetchLatestAddonVersion } = CFRPageActions;
// Prevent fetching the real addon url and making a network request
CFRPageActions._fetchLatestAddonVersion = x => "http://example.com";
CFRPageActions._fetchLatestAddonVersion = () => "http://example.com";
registerCleanupFunction(() => {
CFRPageActions._fetchLatestAddonVersion = _fetchLatestAddonVersion;

View File

@@ -444,7 +444,7 @@ add_task(async function test_emptyMessage() {
);
// Clear all messages
ASRouter.setState(state => ({
ASRouter.setState(() => ({
messages: [],
}));

View File

@@ -93,7 +93,7 @@ add_task(async function return_nothing_for_no_matching_message() {
add_task(async function check_other_error_handling() {
let called = false;
function onError(...args) {
function onError() {
called = true;
}

View File

@@ -186,7 +186,7 @@ add_task(async function panel_feature_callout_anchor_open_attr() {
win.document.querySelector(calloutDismissSelector).click();
},
(win, calloutContainer) => {
() => {
ok(
!anchor.hasAttribute("open"),
"Callout container's anchor node should not have its [open] attribute set"

View File

@@ -16,10 +16,10 @@ const mockIdleService = {
},
QueryInterface: ChromeUtils.generateQI(["nsIUserIdleService"]),
idleTime: 1200000,
addIdleObserver(observer, time) {
addIdleObserver(observer) {
this._observers.add(observer);
},
removeIdleObserver(observer, time) {
removeIdleObserver(observer) {
this._observers.delete(observer);
},
};

View File

@@ -32,11 +32,11 @@ describe("#CachedTargetingGetter", () => {
globals.set(
"TargetingContext",
class {
static combineContexts(...args) {
static combineContexts() {
return sinon.stub();
}
evalWithDefault(expr) {
evalWithDefault() {
return sinon.stub();
}
}

View File

@@ -554,7 +554,7 @@ describe("CFRPageActions", () => {
);
const htmlFooterEl = fakeRemoteL10n.createElement.args.find(
/* eslint-disable-next-line max-nested-callbacks */
([doc, el, args]) =>
([, , args]) =>
args && args.content === fakeRecommendation.content.text
);
assert.ok(htmlFooterEl);
@@ -849,7 +849,7 @@ describe("CFRPageActions", () => {
);
const [, , headerElementArgs] = fakeRemoteL10n.createElement.args.find(
/* eslint-disable-next-line max-nested-callbacks */
([doc, el, args]) => args && args.content && args.attributes
([, , args]) => args && args.content && args.attributes
);
assert.equal(
headerElementArgs.content.string_id,
@@ -872,7 +872,7 @@ describe("CFRPageActions", () => {
);
const [, , headerElementArgs] = fakeRemoteL10n.createElement.args.find(
/* eslint-disable-next-line max-nested-callbacks */
([doc, el, args]) => args && args.content && args.attributes
([, , args]) => args && args.content && args.attributes
);
assert.equal(
headerElementArgs.content.string_id,

View File

@@ -392,14 +392,13 @@ describe("ToolbarPanelHub", () => {
for (let message of messages) {
assert.ok(
fakeRemoteL10n.createElement.args.find(
([doc, el, args]) =>
args && args.classList === "whatsNew-message-title"
([, , args]) => args && args.classList === "whatsNew-message-title"
)
);
if (message.content.layout === "tracking-protections") {
assert.ok(
fakeRemoteL10n.createElement.args.find(
([doc, el, args]) =>
([, , args]) =>
args && args.classList === "whatsNew-message-subtitle"
)
);
@@ -407,13 +406,13 @@ describe("ToolbarPanelHub", () => {
if (message.id === "WHATS_NEW_FINGERPRINTER_COUNTER_72") {
assert.ok(
fakeRemoteL10n.createElement.args.find(
([doc, el, args]) => el === "h2" && args.content === 3
([, el, args]) => el === "h2" && args.content === 3
)
);
}
assert.ok(
fakeRemoteL10n.createElement.args.find(
([doc, el, args]) =>
([, , args]) =>
args && args.classList === "whatsNew-message-content"
)
);
@@ -456,10 +455,9 @@ describe("ToolbarPanelHub", () => {
// value as the `order` field of the message
const titleEls = fakeRemoteL10n.createElement.args
.filter(
([doc, el, args]) =>
args && args.classList === "whatsNew-message-title"
([, , args]) => args && args.classList === "whatsNew-message-title"
)
.map(([doc, el, args]) => args.content);
.map(([, , args]) => args.content);
assert.deepEqual(titleEls, [1, 2, 3]);
});
it("should accept string for image attributes", async () => {
@@ -488,7 +486,7 @@ describe("ToolbarPanelHub", () => {
await instance.renderMessages(fakeWindow, fakeDocument, "container-id");
const [, , args] = fakeRemoteL10n.createElement.args.find(
([doc, el, elArgs]) => elArgs && elArgs.attributes
([, , elArgs]) => elArgs && elArgs.attributes
);
assert.ok(args);
// Currently this.state.contentArguments has 8 different entries
@@ -510,7 +508,7 @@ describe("ToolbarPanelHub", () => {
await instance.renderMessages(fakeWindow, fakeDocument, "container-id");
const dateElements = fakeRemoteL10n.createElement.args.filter(
([doc, el, args]) =>
([, el, args]) =>
el === "p" && args.classList === "whatsNew-message-date"
);
assert.lengthOf(dateElements, uniqueDates.length);

View File

@@ -105,8 +105,8 @@ const TEST_GLOBAL = {
JSWindowActorParent,
JSWindowActorChild,
AboutReaderParent: {
addMessageListener: (messageName, listener) => {},
removeMessageListener: (messageName, listener) => {},
addMessageListener: (_messageName, _listener) => {},
removeMessageListener: (_messageName, _listener) => {},
},
AboutWelcomeTelemetry: class {
submitGleanPingForPing() {}
@@ -289,8 +289,8 @@ const TEST_GLOBAL = {
},
dump() {},
EveryWindow: {
registerCallback: (id, init, uninit) => {},
unregisterCallback: id => {},
registerCallback: (_id, _init, _uninit) => {},
unregisterCallback: _id => {},
},
setTimeout: window.setTimeout.bind(window),
clearTimeout: window.clearTimeout.bind(window),
@@ -410,7 +410,7 @@ const TEST_GLOBAL = {
},
urlFormatter: { formatURL: str => str, formatURLPref: str => str },
mm: {
addMessageListener: (msg, cb) => this.receiveMessage(),
addMessageListener: (_msg, _cb) => this.receiveMessage(),
removeMessageListener() {},
},
obs: {
@@ -420,7 +420,7 @@ const TEST_GLOBAL = {
},
telemetry: {
setEventRecordingEnabled: () => {},
recordEvent: eventDetails => {},
recordEvent: _eventDetails => {},
scalarSet: () => {},
keyedScalarAdd: () => {},
},
@@ -578,7 +578,7 @@ const TEST_GLOBAL = {
finish: () => {},
},
Sampling: {
ratioSample(seed, ratios) {
ratioSample(_seed, _ratios) {
return Promise.resolve(0);
},
},

View File

@@ -339,7 +339,7 @@ export const AboutHomeStartupCacheChild = {
});
},
observe(subject, topic, data) {
observe(subject, topic) {
if (topic === "memory-pressure" && this._cacheWorker) {
this._cacheWorker.terminate();
this._cacheWorker = null;
@@ -447,7 +447,7 @@ class BaseAboutNewTabService {
return this.defaultURL;
}
aboutHomeChannel(uri, loadInfo) {
aboutHomeChannel() {
throw Components.Exception(
"AboutHomeChannel not implemented for this process.",
Cr.NS_ERROR_NOT_IMPLEMENTED

View File

@@ -49,7 +49,7 @@
return ["fluent-remote-id"];
}
attributeChangedCallback(name, oldValue, newValue) {
attributeChangedCallback() {
this.render();
}

View File

@@ -16,7 +16,7 @@ export class ContextMenuButton extends React.PureComponent {
this.onUpdate = this.onUpdate.bind(this);
}
openContextMenu(isKeyBoard, event) {
openContextMenu(isKeyBoard) {
if (this.props.onUpdate) {
this.props.onUpdate(true);
}

View File

@@ -143,7 +143,7 @@ export class DiscoveryStreamAdminUI extends React.PureComponent {
);
}
restorePrefDefaults(event) {
restorePrefDefaults() {
this.props.dispatch(
ac.OnlyToMain({
type: at.DISCOVERY_STREAM_CONFIG_RESET_DEFAULTS,

View File

@@ -110,7 +110,7 @@ export class _DiscoveryStreamBase extends React.PureComponent {
});
}
renderComponent(component, embedWidth) {
renderComponent(component) {
switch (component.type) {
case "Highlights":
return <Highlights />;

View File

@@ -31,11 +31,7 @@ export function DSSubHeader({ children }) {
);
}
export function OnboardingExperience({
children,
dispatch,
windowObj = global,
}) {
export function OnboardingExperience({ dispatch, windowObj = global }) {
const [dismissed, setDismissed] = useState(false);
const [maxHeight, setMaxHeight] = useState(null);
const heightElement = useRef(null);

View File

@@ -85,7 +85,6 @@ export const DefaultMeta = ({
sponsor,
sponsored_by_override,
saveToPocketCard,
isRecentSave,
ctaButtonVariant,
}) => (
<div className="meta">
@@ -183,7 +182,7 @@ export class _DSCard extends React.PureComponent {
];
}
onLinkClick(event) {
onLinkClick() {
if (this.props.dispatch) {
this.props.dispatch(
ac.DiscoveryStreamUserEvent({
@@ -223,7 +222,7 @@ export class _DSCard extends React.PureComponent {
}
}
onSaveClick(event) {
onSaveClick() {
if (this.props.dispatch) {
this.props.dispatch(
ac.AlsoToMain({
@@ -526,4 +525,4 @@ export const DSCard = connect(state => ({
DiscoveryStream: state.DiscoveryStream,
}))(_DSCard);
export const PlaceholderDSCard = props => <DSCard placeholder={true} />;
export const PlaceholderDSCard = () => <DSCard placeholder={true} />;

View File

@@ -17,7 +17,7 @@ export class DSPrivacyModal extends React.PureComponent {
this.onManageLinkClick = this.onManageLinkClick.bind(this);
}
onLearnLinkClick(event) {
onLearnLinkClick() {
this.props.dispatch(
ac.DiscoveryStreamUserEvent({
event: "CLICK_PRIVACY_INFO",
@@ -26,7 +26,7 @@ export class DSPrivacyModal extends React.PureComponent {
);
}
onManageLinkClick(event) {
onManageLinkClick() {
this.props.dispatch(ac.OnlyToMain({ type: at.SETTINGS_OPEN }));
}

View File

@@ -52,7 +52,7 @@ export class ErrorBoundary extends React.PureComponent {
this.state = { hasError: false };
}
componentDidCatch(error, info) {
componentDidCatch() {
this.setState({ hasError: true });
}

View File

@@ -206,7 +206,7 @@ export class _TopSites extends React.PureComponent {
}
}
export const TopSites = connect((state, props) => ({
export const TopSites = connect(state => ({
TopSites: state.TopSites,
Prefs: state.Prefs,
TopSitesRows: state.Prefs.values.topSitesRows,

View File

@@ -44,7 +44,7 @@ function mergeStateReducer(mainReducer) {
/**
* messageMiddleware - Middleware that looks for SentToMain type actions, and sends them if necessary
*/
const messageMiddleware = store => next => action => {
const messageMiddleware = () => next => action => {
const skipLocal = action.meta && action.meta.skipLocal;
if (au.isSendToMain(action)) {
RPMSendAsyncMessage(OUTGOING_MESSAGE_NAME, action);

View File

@@ -25,7 +25,7 @@ const _OpenInPrivateWindow = site => ({
export const LinkMenuOptions = {
Separator: () => ({ type: "separator" }),
EmptyItem: () => ({ type: "empty" }),
ShowPrivacyInfo: site => ({
ShowPrivacyInfo: () => ({
id: "newtab-menu-show-privacy-info",
icon: "info",
action: {

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/. */
export const selectLayoutRender = ({ state = {}, prefs = {}, locale = "" }) => {
export const selectLayoutRender = ({ state = {}, prefs = {} }) => {
const { layout, feeds, spocs } = state;
let spocIndexPlacementMap = {};

View File

@@ -682,7 +682,7 @@ class DiscoveryStreamAdminUI extends (external_React_default()).PureComponent {
}
}));
}
restorePrefDefaults(event) {
restorePrefDefaults() {
this.props.dispatch(actionCreators.OnlyToMain({
type: actionTypes.DISCOVERY_STREAM_CONFIG_RESET_DEFAULTS
}));
@@ -1423,7 +1423,7 @@ const LinkMenuOptions = {
EmptyItem: () => ({
type: "empty"
}),
ShowPrivacyInfo: site => ({
ShowPrivacyInfo: () => ({
id: "newtab-menu-show-privacy-info",
icon: "info",
action: {
@@ -1820,7 +1820,7 @@ class ContextMenuButton extends (external_React_default()).PureComponent {
this.onKeyDown = this.onKeyDown.bind(this);
this.onUpdate = this.onUpdate.bind(this);
}
openContextMenu(isKeyBoard, event) {
openContextMenu(isKeyBoard) {
if (this.props.onUpdate) {
this.props.onUpdate(true);
}
@@ -2517,7 +2517,6 @@ const DefaultMeta = ({
sponsor,
sponsored_by_override,
saveToPocketCard,
isRecentSave,
ctaButtonVariant
}) => /*#__PURE__*/external_React_default().createElement("div", {
className: "meta"
@@ -2592,7 +2591,7 @@ class _DSCard extends (external_React_default()).PureComponent {
height: 101
}];
}
onLinkClick(event) {
onLinkClick() {
if (this.props.dispatch) {
this.props.dispatch(actionCreators.DiscoveryStreamUserEvent({
event: "CLICK",
@@ -2624,7 +2623,7 @@ class _DSCard extends (external_React_default()).PureComponent {
}));
}
}
onSaveClick(event) {
onSaveClick() {
if (this.props.dispatch) {
this.props.dispatch(actionCreators.AlsoToMain({
type: actionTypes.SAVE_TO_POCKET,
@@ -2874,7 +2873,7 @@ const DSCard = (0,external_ReactRedux_namespaceObject.connect)(state => ({
App: state.App,
DiscoveryStream: state.DiscoveryStream
}))(_DSCard);
const PlaceholderDSCard = props => /*#__PURE__*/external_React_default().createElement(DSCard, {
const PlaceholderDSCard = () => /*#__PURE__*/external_React_default().createElement(DSCard, {
placeholder: true
});
;// CONCATENATED MODULE: ./content-src/components/DiscoveryStreamComponents/DSEmptyState/DSEmptyState.jsx
@@ -3163,7 +3162,6 @@ function DSSubHeader({
}, children));
}
function OnboardingExperience({
children,
dispatch,
windowObj = __webpack_require__.g
}) {
@@ -3776,7 +3774,7 @@ class ErrorBoundary extends (external_React_default()).PureComponent {
hasError: false
};
}
componentDidCatch(error, info) {
componentDidCatch() {
this.setState({
hasError: true
});
@@ -4013,13 +4011,13 @@ class DSPrivacyModal extends (external_React_default()).PureComponent {
this.onLearnLinkClick = this.onLearnLinkClick.bind(this);
this.onManageLinkClick = this.onManageLinkClick.bind(this);
}
onLearnLinkClick(event) {
onLearnLinkClick() {
this.props.dispatch(actionCreators.DiscoveryStreamUserEvent({
event: "CLICK_PRIVACY_INFO",
source: "DS_PRIVACY_MODAL"
}));
}
onManageLinkClick(event) {
onManageLinkClick() {
this.props.dispatch(actionCreators.OnlyToMain({
type: actionTypes.SETTINGS_OPEN
}));
@@ -7537,7 +7535,7 @@ class _TopSites extends (external_React_default()).PureComponent {
}))))));
}
}
const TopSites_TopSites = (0,external_ReactRedux_namespaceObject.connect)((state, props) => ({
const TopSites_TopSites = (0,external_ReactRedux_namespaceObject.connect)(state => ({
TopSites: state.TopSites,
Prefs: state.Prefs,
TopSitesRows: state.Prefs.values.topSitesRows
@@ -8039,8 +8037,7 @@ class SectionTitle extends (external_React_default()).PureComponent {
const selectLayoutRender = ({
state = {},
prefs = {},
locale = ""
prefs = {}
}) => {
const {
layout,
@@ -8323,7 +8320,7 @@ class _DiscoveryStreamBase extends (external_React_default()).PureComponent {
});
});
}
renderComponent(component, embedWidth) {
renderComponent(component) {
switch (component.type) {
case "Highlights":
return /*#__PURE__*/external_React_default().createElement(Highlights, null);
@@ -9406,7 +9403,7 @@ function mergeStateReducer(mainReducer) {
/**
* messageMiddleware - Middleware that looks for SentToMain type actions, and sends them if necessary
*/
const messageMiddleware = store => next => action => {
const messageMiddleware = () => next => action => {
const skipLocal = action.meta && action.meta.skipLocal;
if (actionUtils.isSendToMain(action)) {
RPMSendAsyncMessage(OUTGOING_MESSAGE_NAME, action);

View File

@@ -306,7 +306,7 @@ export const PREFS_CONFIG = new Map([
"discoverystream.config",
{
title: "Configuration for the new pocket new tab",
getValue: ({ geo, locale }) => {
getValue: () => {
return JSON.stringify({
api_key_pref: "extensions.pocket.oAuthConsumerKey",
collapsible: true,
@@ -689,7 +689,7 @@ export class ActivityStream {
}
}
observe(subject, topic, data) {
observe(subject, topic) {
switch (topic) {
case "intl:app-locales-changed":
case lazy.Region.REGION_TOPIC:

View File

@@ -67,7 +67,7 @@ export class ActivityStreamMessageChannel {
* @param {object} store A redux store
* @return {function} Redux middleware
*/
middleware(store) {
middleware() {
return next => action => {
const skipMain = action.meta && action.meta.skipMain;
if (au.isSendToOneContent(action)) {

View File

@@ -331,7 +331,7 @@ export class DiscoveryStreamFeed {
},
});
},
error(error) {},
error() {},
});
}
}

View File

@@ -16,7 +16,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
const DOWNLOAD_CHANGED_DELAY_TIME = 1000; // time in ms to delay timer for downloads changed events
export class DownloadsManager {
constructor(store) {
constructor() {
this._downloadData = null;
this._store = null;
this._downloadItems = new Map();

View File

@@ -161,7 +161,7 @@ export class RecipeExecutor {
* Config:
* Not configurable
*/
conditionallyNmfTag(item, config) {
conditionallyNmfTag(item) {
let nestedNmfTags = {};
let parentTags = {};
let parentWeights = {};
@@ -1052,7 +1052,7 @@ export class RecipeExecutor {
} else if (config.operation === "overwrite") {
op = (a, b) => b;
} else if (config.operation === "count") {
op = (a, b) => a + 1;
op = a => a + 1;
} else {
return null;
}

View File

@@ -79,7 +79,7 @@ export class PrefsFeed {
/**
* Handler for when experiment data updates.
*/
onExperimentUpdated(event, reason) {
onExperimentUpdated() {
const value = lazy.NimbusFeatures.newtab.getAllVariables() || {};
this.store.dispatch(
ac.BroadcastToContent({
@@ -238,7 +238,7 @@ export class PrefsFeed {
}
}
observe(subject, topic, data) {
observe(subject, topic) {
switch (topic) {
case lazy.Region.REGION_TOPIC:
this.store.dispatch(

View File

@@ -242,7 +242,7 @@ export class RecommendationProvider {
);
}
async observe(subject, topic, data) {
async observe(subject, topic) {
switch (topic) {
case "idle-daily":
await this.updatePersonalizationScores();

View File

@@ -31,7 +31,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
* `${feed_pref_name}.options`.
*/
const BUILT_IN_SECTIONS = ({ newtab, pocketNewtab }) => ({
const BUILT_IN_SECTIONS = ({ pocketNewtab }) => ({
"feeds.section.topstories": options => ({
id: "topstories",
pref: {
@@ -107,7 +107,7 @@ const BUILT_IN_SECTIONS = ({ newtab, pocketNewtab }) => ({
shouldSendImpressionStats: true,
dedupeFrom: ["highlights"],
}),
"feeds.section.highlights": options => ({
"feeds.section.highlights": () => ({
id: "highlights",
pref: {
titleString: {

View File

@@ -144,7 +144,7 @@ export class Store {
this._messageChannel.simulateMessagesForExistingTabs();
}
async _initIndexedDB(telemetryKey) {
async _initIndexedDB() {
// "snippets" is the name of one storage space, but these days it is used
// not for snippet-related data (snippets were removed in bug 1715158),
// but storage for impression or session data for all ASRouter messages.

View File

@@ -165,7 +165,7 @@ class TopSitesTelemetry {
{},
...Object.entries(this.allSponsoredTiles)
.filter(
([k, v]) =>
([, v]) =>
v.display_fail_reason === null ||
v.display_fail_reason === undefined
)
@@ -196,8 +196,8 @@ class TopSitesTelemetry {
clearTilesForProvider(provider) {
Object.entries(this.allSponsoredTiles)
.filter(([k, v]) => k.startsWith(provider))
.map(([k, v]) => delete this.allSponsoredTiles[k]);
.filter(([k]) => k.startsWith(provider))
.map(([k]) => delete this.allSponsoredTiles[k]);
}
_getAdvertiser(tile) {

View File

@@ -187,7 +187,7 @@ add_task(async function test_newtab_doesnt_send_nimbus() {
let { sessions } =
AboutNewTab.activityStream.store.feeds.get("feeds.telemetry");
return !Array.from(sessions.entries()).filter(
([k, v]) => v.session_id === sessionId
([, v]) => v.session_id === sessionId
).length;
}, "Waiting for sessions to clean up.");
// Session ended without a ping being sent. Success!

View File

@@ -143,7 +143,7 @@ export const UTSessionPing = Joi.array().items(
eventsTelemetryExtraKeys
);
export function chaiAssertions(_chai, utils) {
export function chaiAssertions(_chai) {
const { Assertion } = _chai;
Assertion.addMethod("validate", function (schema, schemaName) {

View File

@@ -146,7 +146,7 @@ describe("AboutPreferences Feed", () => {
},
},
createProcessingInstruction: sandbox.stub(),
createElementNS: sandbox.stub().callsFake((NS, el) => node),
createElementNS: sandbox.stub().callsFake(() => node),
getElementById: sandbox.stub().returns(node),
insertBefore: sandbox.stub().returnsArg(0),
querySelector: sandbox

View File

@@ -417,13 +417,11 @@ describe("ActivityStream", () => {
clock = sinon.useFakeTimers();
// Have addObserver cause prefHasUserValue to now return true then observe
sandbox
.stub(global.Services.obs, "addObserver")
.callsFake((pref, obs) => {
setTimeout(() => {
Services.obs.notifyObservers("US", "browser-region-updated");
});
sandbox.stub(global.Services.obs, "addObserver").callsFake(() => {
setTimeout(() => {
Services.obs.notifyObservers("US", "browser-region-updated");
});
});
});
afterEach(() => clock.restore());

View File

@@ -19,7 +19,7 @@ describe("Personality Provider", () => {
RemoteSettingsOffStub = sandbox.stub().returns();
RemoteSettingsGetStub = sandbox.stub().returns([]);
RemoteSettingsStub = name => ({
RemoteSettingsStub = () => ({
get: RemoteSettingsGetStub,
on: RemoteSettingsOnStub,
off: RemoteSettingsOffStub,
@@ -142,7 +142,7 @@ describe("Personality Provider", () => {
},
]);
sinon.spy(instance, "getAttachment");
RemoteSettingsStub = name => ({
RemoteSettingsStub = () => ({
get: RemoteSettingsGetStub,
on: RemoteSettingsOnStub,
off: RemoteSettingsOffStub,

View File

@@ -6,7 +6,7 @@ class MockTagger {
this.mode = mode;
this.tagScoreMap = tagScoreMap;
}
tagTokens(tokens) {
tagTokens() {
if (this.mode === "nb") {
// eslint-disable-next-line prefer-destructuring
let tag = Object.keys(this.tagScoreMap)[0];

View File

@@ -97,8 +97,8 @@ const TEST_GLOBAL = {
JSWindowActorParent,
JSWindowActorChild,
AboutReaderParent: {
addMessageListener: (messageName, listener) => {},
removeMessageListener: (messageName, listener) => {},
addMessageListener: (_messageName, _listener) => {},
removeMessageListener: (_messageName, _listener) => {},
},
AboutWelcomeTelemetry: class {
submitGleanPingForPing() {}
@@ -281,8 +281,8 @@ const TEST_GLOBAL = {
},
dump() {},
EveryWindow: {
registerCallback: (id, init, uninit) => {},
unregisterCallback: id => {},
registerCallback: (_id, _init, _uninit) => {},
unregisterCallback: _id => {},
},
setTimeout: window.setTimeout.bind(window),
clearTimeout: window.clearTimeout.bind(window),
@@ -402,7 +402,7 @@ const TEST_GLOBAL = {
},
urlFormatter: { formatURL: str => str, formatURLPref: str => str },
mm: {
addMessageListener: (msg, cb) => this.receiveMessage(),
addMessageListener: (_msg, _cb) => this.receiveMessage(),
removeMessageListener() {},
},
obs: {
@@ -412,7 +412,7 @@ const TEST_GLOBAL = {
},
telemetry: {
setEventRecordingEnabled: () => {},
recordEvent: eventDetails => {},
recordEvent: _eventDetails => {},
scalarSet: () => {},
keyedScalarAdd: () => {},
},
@@ -570,7 +570,7 @@ const TEST_GLOBAL = {
finish: () => {},
},
Sampling: {
ratioSample(seed, ratios) {
ratioSample(_seed, _ratios) {
return Promise.resolve(0);
},
},

View File

@@ -176,7 +176,7 @@ export class FakensIPrefBranch {
prefHasUserValue(prefName) {
return this.prefs.has(prefName);
}
prefIsLocked(prefName) {
prefIsLocked(_prefName) {
return false;
}
}
@@ -187,7 +187,7 @@ export class FakensIPrefBranch {
*/
export class FakensIPrefService extends FakensIPrefBranch {
getBranch() {}
getDefaultBranch(prefix) {
getDefaultBranch(_prefix) {
return {
setBoolPref() {},
setIntPref() {},
@@ -208,8 +208,8 @@ export class FakePrefs extends FakensIPrefBranch {
ignore(prefName, callback) {
super.removeObserver(prefName, callback);
}
observeBranch(listener) {}
ignoreBranch(listener) {}
observeBranch(_listener) {}
ignoreBranch(_listener) {}
set(prefName, value) {
this.prefs.set(prefName, value);
@@ -312,7 +312,7 @@ FakePerformance.prototype = {
return 10000.234;
},
// XXX assumes type == "mark"
getEntriesByName(name, type) {
getEntriesByName(name, _type) {
if (this.marks.has(name)) {
return this.marks.get(name);
}

View File

@@ -424,7 +424,7 @@ add_task(async function test_onAction_OPEN_LINK() {
data: { url: "https://foo.com" },
_target: {
browser: {
ownerGlobal: { openTrustedLinkIn, whereToOpenLink: e => "current" },
ownerGlobal: { openTrustedLinkIn, whereToOpenLink: () => "current" },
},
},
};
@@ -450,7 +450,7 @@ add_task(async function test_onAction_OPEN_LINK_referrer() {
data: { url: "https://foo.com", referrer: "https://foo.com/ref" },
_target: {
browser: {
ownerGlobal: { openTrustedLinkIn, whereToOpenLink: e => "tab" },
ownerGlobal: { openTrustedLinkIn, whereToOpenLink: () => "tab" },
},
},
};
@@ -496,7 +496,7 @@ add_task(async function test_onAction_OPEN_LINK_typed_bonus() {
},
_target: {
browser: {
ownerGlobal: { openTrustedLinkIn, whereToOpenLink: e => "tab" },
ownerGlobal: { openTrustedLinkIn, whereToOpenLink: () => "tab" },
},
},
};
@@ -524,7 +524,7 @@ add_task(async function test_onAction_OPEN_LINK_pocket() {
},
_target: {
browser: {
ownerGlobal: { openTrustedLinkIn, whereToOpenLink: e => "current" },
ownerGlobal: { openTrustedLinkIn, whereToOpenLink: () => "current" },
},
},
};
@@ -551,7 +551,7 @@ add_task(async function test_onAction_OPEN_LINK_not_http() {
data: { url: "file:///foo.com" },
_target: {
browser: {
ownerGlobal: { openTrustedLinkIn, whereToOpenLink: e => "current" },
ownerGlobal: { openTrustedLinkIn, whereToOpenLink: () => "current" },
},
},
};

View File

@@ -41,7 +41,7 @@ add_task(async function test_messagechannel() {
let sandbox = sinon.createSandbox();
sandbox
.stub(ActivityStreamMessageChannel.prototype, "middleware")
.returns(s => next => action => next(action));
.returns(() => next => action => next(action));
let store = new Store();
info(