Skip to content

Commit

Permalink
Bug 1632922 - use const instead of let - manual fixes. r=snorp
Browse files Browse the repository at this point in the history
This commit was generated manually fixing all remaining eslint failures.

Differential Revision: https://phabricator.services.mozilla.com/D72413
  • Loading branch information
agi committed Apr 24, 2020
1 parent b7b7d9c commit b3e0db6
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 20 deletions.
11 changes: 11 additions & 0 deletions mobile/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* 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/. */

"use strict";

module.exports = {
rules: {
"prefer-const": "error",
},
};
11 changes: 4 additions & 7 deletions mobile/android/chrome/geckoview/GeckoViewContentChild.js
Original file line number Diff line number Diff line change
Expand Up @@ -340,23 +340,20 @@ class GeckoViewContentChild extends GeckoViewChildModule {

const webNavigation = docShell.QueryInterface(Ci.nsIWebNavigation);

let {
const {
referrerInfo,
triggeringPrincipal,
uri,
flags,
csp,
headers,
} = loadOptions;
referrerInfo = E10SUtils.deserializeReferrerInfo(referrerInfo);
triggeringPrincipal = E10SUtils.deserializePrincipal(triggeringPrincipal);
csp = E10SUtils.deserializeCSP(csp);

webNavigation.loadURI(uri, {
triggeringPrincipal,
referrerInfo,
triggeringPrincipal: E10SUtils.deserializePrincipal(triggeringPrincipal),
referrerInfo: E10SUtils.deserializeReferrerInfo(referrerInfo),
loadFlags: flags,
csp,
csp: E10SUtils.deserializeCSP(csp),
headers,
});
}
Expand Down
5 changes: 3 additions & 2 deletions mobile/android/components/extensions/ext-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ const BrowserStatusFilter = Components.Constructor(

const WINDOW_TYPE = "navigator:geckoview";

let tabTracker;
// We need let to break cyclic dependency
/* eslint-disable-next-line prefer-const */
let windowTracker;

/**
Expand Down Expand Up @@ -290,7 +291,7 @@ class TabTracker extends TabTrackerBase {
}

windowTracker = new WindowTracker();
tabTracker = new TabTracker();
const tabTracker = new TabTracker();

Object.assign(global, { tabTracker, windowTracker });

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,12 @@
try {
const [tab] = await browser.tabs.query({currentWindow: true, active: true});

let [jpeg, png, ...pngs] = await Promise.all([
let [jpeg, png] = await Promise.all([
browser.tabs.captureVisibleTab(tab.windowId, {format: "jpeg", quality: 95}),
browser.tabs.captureVisibleTab(tab.windowId, {format: "png", quality: 95}),
]);

const pngs = await Promise.all([
browser.tabs.captureVisibleTab(tab.windowId, {quality: 95}),
browser.tabs.captureVisibleTab(tab.windowId),
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
useAddonManager: "permanent",

background: async function() {
// eslint-disable-next-line prefer-const
let firstTab;
const promiseResponse = new Promise(resolve => {
browser.runtime.onMessage.addListener((msg, sender, respond) => {
Expand Down
17 changes: 10 additions & 7 deletions mobile/android/components/geckoview/GeckoViewPrompt.js
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,9 @@ PromptDelegate.prototype = {
aAuthInfo.flags & Ci.nsIAuthInformation.CROSS_ORIGIN_SUB_RESOURCE;

const username = aAuthInfo.username;
let [displayHost, realm] = this._getAuthTarget(aChannel, aAuthInfo);
const authTarget = this._getAuthTarget(aChannel, aAuthInfo);
const { displayHost } = authTarget;
let { realm } = authTarget;

// Suppress "the site says: $realm" when we synthesized a missing realm.
if (!aAuthInfo.realm && !isProxy) {
Expand Down Expand Up @@ -982,27 +984,28 @@ PromptDelegate.prototype = {
const idnService = Cc["@mozilla.org/network/idn-service;1"].getService(
Ci.nsIIDNService
);
const hostname =
const displayHost =
"moz-proxy://" +
idnService.convertUTF8toACE(info.host) +
":" +
info.port;
let realm = aAuthInfo.realm;
if (!realm) {
realm = hostname;
realm = displayHost;
}
return [hostname, realm];
return { displayHost, realm };
}

const hostname = aChannel.URI.scheme + "://" + aChannel.URI.displayHostPort;
const displayHost =
aChannel.URI.scheme + "://" + aChannel.URI.displayHostPort;
// If a HTTP WWW-Authenticate header specified a realm, that value
// will be available here. If it wasn't set or wasn't HTTP, we'll use
// the formatted hostname instead.
let realm = aAuthInfo.realm;
if (!realm) {
realm = hostname;
realm = displayHost;
}
return [hostname, realm];
return { displayHost, realm };
},
};

Expand Down
3 changes: 0 additions & 3 deletions mobile/android/modules/geckoview/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,4 @@ module.exports = {
debug: false,
warn: false,
},
rules: {
"prefer-const": "error",
},
};

0 comments on commit b3e0db6

Please sign in to comment.