Bug 1881094 - 9. remove most remaining firefox-android eslint exclusions r=android-reviewers,frontend-codestyle-reviewers,webcompat-reviewers,gl,Gijs,Standard8,twisniewski

Differential Revision: https://phabricator.services.mozilla.com/D214041
This commit is contained in:
Geoff Brown
2024-06-19 16:19:14 +00:00
parent 956df06616
commit f3622debc5
22 changed files with 73 additions and 31 deletions

View File

@@ -194,20 +194,9 @@ mobile/android/locales/
mobile/android/android-components/components/feature/readerview/src/main/assets/extensions/readerview/manifest.json mobile/android/android-components/components/feature/readerview/src/main/assets/extensions/readerview/manifest.json
mobile/android/android-components/samples/browser/src/main/assets/extensions/test/manifest.json mobile/android/android-components/samples/browser/src/main/assets/extensions/test/manifest.json
# TODO - Bug 1881094: temporarily ignored for firefox-android migration # Bug 1903138: remaining issues from the firefox-android migration
mobile/android/android-components/components/browser/errorpages/src/main/assets/errorPageScripts.js
mobile/android/android-components/components/browser/icons/src/main/assets/extensions/browser-icons/icons.js
mobile/android/android-components/components/feature/accounts/src/main/assets/extensions/fxawebchannel/background.js
mobile/android/android-components/components/feature/accounts/src/main/assets/extensions/fxawebchannel/fxawebchannel.js
mobile/android/android-components/components/feature/readerview/src/main/assets/extensions/readerview/
mobile/android/android-components/components/feature/search/src/main/assets/extensions/ads/adsTelemetry.js
mobile/android/android-components/components/feature/search/src/main/assets/extensions/search/searchTelemetry.js
mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/
mobile/android/android-components/docs/assets/js/icon-js.js mobile/android/android-components/docs/assets/js/icon-js.js
mobile/android/android-components/samples/browser/src/main/assets/extensions/test/background.js
mobile/android/fenix/app/src/androidTest/assets/ mobile/android/fenix/app/src/androidTest/assets/
mobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix/syncintegration/
mobile/android/fenix/app/src/main/assets/
mobile/android/focus-android/app/src/androidTest/assets/ mobile/android/focus-android/app/src/androidTest/assets/
# Pre-processed/pref files # Pre-processed/pref files

View File

@@ -271,6 +271,7 @@ const rollouts = [
"gfx/layers/layerviewer/layerTreeView.js", "gfx/layers/layerviewer/layerTreeView.js",
"layout/tools/reftest/reftest-analyzer.xhtml", "layout/tools/reftest/reftest-analyzer.xhtml",
"mobile/android/geckoview/src/androidTest/**", "mobile/android/geckoview/src/androidTest/**",
"mobile/android/android-components/components/feature/webcompat/**",
"services/automation/ServicesAutomation.sys.mjs", "services/automation/ServicesAutomation.sys.mjs",
"services/settings/RemoteSettings.worker.mjs", "services/settings/RemoteSettings.worker.mjs",
"services/sync/modules/SyncDisconnect.sys.mjs", "services/sync/modules/SyncDisconnect.sys.mjs",

View File

@@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* eslint-disable no-unsanitized/property */ /* bug 1889942 */
/** /**
* Handles the parsing of the ErrorPages URI and then passes them to injectValues * Handles the parsing of the ErrorPages URI and then passes them to injectValues
*/ */

View File

@@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* eslint-env webextensions */
/* /*
* This web extension looks for known icon tags, collects URLs and available * This web extension looks for known icon tags, collects URLs and available
* meta data (e.g. sizes) and passes that to the app code. * meta data (e.g. sizes) and passes that to the app code.
@@ -25,7 +27,7 @@ function sizesToList(sizes) {
function collect_link_icons(icons, rel) { function collect_link_icons(icons, rel) {
document document
.querySelectorAll('link[rel="' + rel + '"]') .querySelectorAll('link[rel="' + rel + '"]')
.forEach(function (currentValue, currentIndex, listObj) { .forEach(function (currentValue) {
icons.push({ icons.push({
type: rel, type: rel,
href: currentValue.href, href: currentValue.href,
@@ -38,7 +40,7 @@ function collect_link_icons(icons, rel) {
function collect_meta_property_icons(icons, property) { function collect_meta_property_icons(icons, property) {
document document
.querySelectorAll('meta[property="' + property + '"]') .querySelectorAll('meta[property="' + property + '"]')
.forEach(function (currentValue, currentIndex, listObj) { .forEach(function (currentValue) {
icons.push({ icons.push({
type: property, type: property,
href: currentValue.content, href: currentValue.content,
@@ -49,7 +51,7 @@ function collect_meta_property_icons(icons, property) {
function collect_meta_name_icons(icons, name) { function collect_meta_name_icons(icons, name) {
document document
.querySelectorAll('meta[name="' + name + '"]') .querySelectorAll('meta[name="' + name + '"]')
.forEach(function (currentValue, currentIndex, listObj) { .forEach(function (currentValue) {
icons.push({ icons.push({
type: name, type: name,
href: currentValue.content, href: currentValue.content,

View File

@@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file, * 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/. */ * You can obtain one at http://mozilla.org/MPL/2.0/. */
/* eslint-env webextensions */
/* /*
Establish communication with native application. Establish communication with native application.
*/ */

View File

@@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file, * 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/. */ * You can obtain one at http://mozilla.org/MPL/2.0/. */
/* eslint-env webextensions */
/* /*
Establish communication with native application. Establish communication with native application.
*/ */

View File

@@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file, * 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/. */ * You can obtain one at http://mozilla.org/MPL/2.0/. */
/* eslint-env webextensions */
// This background script is needed to update the current tab // This background script is needed to update the current tab
// and activate reader view. // and activate reader view.
@@ -18,5 +20,6 @@ browser.runtime.onMessage.addListener(message => {
})(); })();
default: default:
console.error(`Received unsupported action ${message.action}`); console.error(`Received unsupported action ${message.action}`);
return false;
} }
}); });

View File

@@ -2,6 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file, * 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/. */ * You can obtain one at http://mozilla.org/MPL/2.0/. */
/* eslint-env webextensions */
/* import-globals-from readability/readability-readerable-0.4.2.js */
// This script is injected into content to determine whether or not a // This script is injected into content to determine whether or not a
// page is readerable, and to open a reader view extension page via // page is readerable, and to open a reader view extension page via
// the background script. // the background script.
@@ -46,7 +49,7 @@ function connectNativePort() {
let port = browser.runtime.connectNative("mozacReaderview"); let port = browser.runtime.connectNative("mozacReaderview");
port.onMessage.addListener(message => { port.onMessage.addListener(message => {
switch (message.action) { switch (message.action) {
case "cachePage": case "cachePage": {
let serializedDoc = new XMLSerializer().serializeToString(document); let serializedDoc = new XMLSerializer().serializeToString(document);
browser.runtime.sendMessage({ browser.runtime.sendMessage({
action: "addSerializedDoc", action: "addSerializedDoc",
@@ -54,6 +57,7 @@ function connectNativePort() {
id: message.id, id: message.id,
}); });
break; break;
}
case "checkReaderState": case "checkReaderState":
port.postMessage({ port.postMessage({
type: "checkReaderState", type: "checkReaderState",
@@ -75,11 +79,11 @@ let port = connectNativePort();
// do want to connect a new native port to trigger a new readerable check and // do want to connect a new native port to trigger a new readerable check and
// apply the same logic (as on page load) in our feature class (e.g. updating the // apply the same logic (as on page load) in our feature class (e.g. updating the
// toolbar etc.) // toolbar etc.)
window.addEventListener("pageshow", event => { window.addEventListener("pageshow", _event => {
port = port != null ? port : connectNativePort(); port = port != null ? port : connectNativePort();
}); });
window.addEventListener("pagehide", event => { window.addEventListener("pagehide", _event => {
port.disconnect(); port.disconnect();
port = null; port = null;
}); });

View File

@@ -2,6 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file, * 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/. */ * You can obtain one at http://mozilla.org/MPL/2.0/. */
/* eslint-env webextensions */
/* eslint-disable no-unsanitized/property */ /* bug 1903144 */
/* import-globals-from readability/readability-0.4.2.js */
/* import-globals-from readability/JSDOMParser-0.4.2.js */
// Class names to preserve in the readerized output. We preserve these class // Class names to preserve in the readerized output. We preserve these class
// names so that rules in readerview.css can match them. This list is taken from Fennec: // names so that rules in readerview.css can match them. This list is taken from Fennec:
// https://dxr.mozilla.org/mozilla-central/rev/7d47e7fa2489550ffa83aae67715c5497048923f/toolkit/components/reader/ReaderMode.jsm#21 // https://dxr.mozilla.org/mozilla-central/rev/7d47e7fa2489550ffa83aae67715c5497048923f/toolkit/components/reader/ReaderMode.jsm#21
@@ -277,7 +282,7 @@ function fetchDocument(url) {
xhr.open("GET", url, true); xhr.open("GET", url, true);
xhr.onerror = evt => reject(evt.error); xhr.onerror = evt => reject(evt.error);
xhr.responseType = "document"; xhr.responseType = "document";
xhr.onload = evt => { xhr.onload = _evt => {
if (xhr.status !== 200) { if (xhr.status !== 200) {
reject("Reader mode XHR failed with status: " + xhr.status); reject("Reader mode XHR failed with status: " + xhr.status);
return; return;
@@ -299,6 +304,7 @@ function getPreparedDocument(id, url) {
.sendMessage({ action: "getSerializedDoc", id }) .sendMessage({ action: "getSerializedDoc", id })
.then(serializedDoc => { .then(serializedDoc => {
if (serializedDoc) { if (serializedDoc) {
// eslint-disable-next-line no-undef
let doc = new JSDOMParser().parse(serializedDoc, url); let doc = new JSDOMParser().parse(serializedDoc, url);
resolve(doc); resolve(doc);
} else { } else {
@@ -321,7 +327,7 @@ function connectNativePort() {
let port = browser.runtime.connectNative("mozacReaderviewActive"); let port = browser.runtime.connectNative("mozacReaderviewActive");
port.onMessage.addListener(message => { port.onMessage.addListener(message => {
switch (message.action) { switch (message.action) {
case "show": case "show": {
async function showAsync(options) { async function showAsync(options) {
try { try {
let doc; let doc;
@@ -339,6 +345,7 @@ function connectNativePort() {
} }
readerView.show(doc, articleUrl, options); readerView.show(doc, articleUrl, options);
} catch (e) { } catch (e) {
// eslint-disable-next-line no-console
console.log(e); console.log(e);
// We weren't able to find the prepared document and also // We weren't able to find the prepared document and also
// failed to fetch it. Let's load the original page which // failed to fetch it. Let's load the original page which
@@ -348,8 +355,10 @@ function connectNativePort() {
} }
showAsync(message.value); showAsync(message.value);
break; break;
}
case "hide": case "hide":
window.location.href = articleUrl; window.location.href = articleUrl;
break;
case "setColorScheme": case "setColorScheme":
readerView.setColorScheme(message.value.toLowerCase()); readerView.setColorScheme(message.value.toLowerCase());
break; break;

View File

@@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* eslint-env webextensions */
/** /**
* Send * Send
* - current URL * - current URL
@@ -74,6 +76,7 @@ const eventLogger = event => {
} }
break; break;
default: default:
// eslint-disable-next-line no-console
console.log("Event:", event.type); console.log("Event:", event.type);
} }
}; };

View File

@@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* eslint-env webextensions */
/** /**
* Send * Send
* - current URL * - current URL
@@ -53,6 +55,7 @@ const eventLogger = event => {
} }
break; break;
default: default:
// eslint-disable-next-line no-console
console.log("Event:", event.type); console.log("Event:", event.type);
} }
}; };

View File

@@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file, * 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/. */ * You can obtain one at http://mozilla.org/MPL/2.0/. */
/* eslint-env webextensions */
/* Avoid adding ID selector rules in this style sheet, since they could /* Avoid adding ID selector rules in this style sheet, since they could
* inadvertently match elements in the article content. */ * inadvertently match elements in the article content. */

View File

@@ -37,12 +37,12 @@
mutedVideo.requestFullscreen(); mutedVideo.requestFullscreen();
} }
mutedVideo.addEventListener("playing", event => { mutedVideo.addEventListener("playing", _event => {
document.querySelector(".playbackState").innerHTML = document.querySelector(".playbackState").innerHTML =
"Media file is playing"; "Media file is playing";
}); });
mutedVideo.addEventListener("pause", event => { mutedVideo.addEventListener("pause", _event => {
document.querySelector(".playbackState").innerHTML = document.querySelector(".playbackState").innerHTML =
"Media file is paused"; "Media file is paused";
}); });

View File

@@ -30,7 +30,7 @@
} }
var textToShow = valSwap(); var textToShow = valSwap();
window.addEventListener("DOMContentLoaded", event => { window.addEventListener("DOMContentLoaded", _event => {
document.querySelector("h1").innerHTML = textToShow; document.querySelector("h1").innerHTML = textToShow;
}); });
</script> </script>

View File

@@ -37,12 +37,12 @@
video.requestFullscreen(); video.requestFullscreen();
} }
video.addEventListener("playing", event => { video.addEventListener("playing", _event => {
document.querySelector(".playbackState").innerHTML = document.querySelector(".playbackState").innerHTML =
"Media file is playing"; "Media file is playing";
}); });
video.addEventListener("pause", event => { video.addEventListener("pause", _event => {
document.querySelector(".playbackState").innerHTML = document.querySelector(".playbackState").innerHTML =
"Media file is paused"; "Media file is paused";
}); });

View File

@@ -0,0 +1,15 @@
/* 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 = {
globals: {
Bookmarks: false,
EnableEngines: false,
Passwords: false,
Phase: false,
Sync: false,
},
};

View File

@@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* eslint-disable no-unsanitized/property */ /* bug 1889942 */
/** /**
* Handles the parsing of the ErrorPages URI and then passes them to injectValues * Handles the parsing of the ErrorPages URI and then passes them to injectValues
*/ */

View File

@@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* eslint-disable no-unsanitized/property */ /* bug 1889942 */
/** /**
* Handles the parsing of the ErrorPages URI and then passes them to injectValues * Handles the parsing of the ErrorPages URI and then passes them to injectValues
*/ */

View File

@@ -73,6 +73,7 @@
</body> </body>
<script type="text/javascript"> <script type="text/javascript">
/* import-globals-from /mobile/android/android-components/components/browser/errorpages/src/main/assets/errorPageScripts.js */
if (window.history.length == 1) { if (window.history.length == 1) {
document.getElementById("advancedPanelBackButton").style.display = "none"; document.getElementById("advancedPanelBackButton").style.display = "none";
} }

View File

@@ -17,7 +17,7 @@
const audio = document.querySelector("audio"); const audio = document.querySelector("audio");
var showPlayingAlert = true; var showPlayingAlert = true;
audio.addEventListener("playing", event => { audio.addEventListener("playing", _event => {
<!--document.querySelector('.playbackState').innerText="Media file is playing"--> <!--document.querySelector('.playbackState').innerText="Media file is playing"-->
<!--Need this hack to verify that the video is playing,--> <!--Need this hack to verify that the video is playing,-->
<!--the test cannot currently verify the text displayed on the page--> <!--the test cannot currently verify the text displayed on the page-->
@@ -27,7 +27,7 @@
} }
}); });
audio.addEventListener("pause", event => { audio.addEventListener("pause", _event => {
<!--document.querySelector('.playbackState').innerText="Media file is paused"--> <!--document.querySelector('.playbackState').innerText="Media file is paused"-->
alert("Media file is paused"); alert("Media file is paused");
}); });

View File

@@ -33,7 +33,7 @@
var showPlayAlert = true; var showPlayAlert = true;
mutedVideo.addEventListener("playing", event => { mutedVideo.addEventListener("playing", _event => {
<!-- document.querySelector('.playbackState').innerHTML="Media file is playing";--> <!-- document.querySelector('.playbackState').innerHTML="Media file is playing";-->
<!-- Need this hack to verify that the video is playing, --> <!-- Need this hack to verify that the video is playing, -->
<!-- the test cannot currently verify the text displayed on the page--> <!-- the test cannot currently verify the text displayed on the page-->
@@ -43,7 +43,7 @@
} }
}); });
mutedVideo.addEventListener("pause", event => { mutedVideo.addEventListener("pause", _event => {
// document.querySelector('.playbackState').innerHTML="Media file is paused"; // document.querySelector('.playbackState').innerHTML="Media file is paused";
alert("Media file is paused"); alert("Media file is paused");
}); });

View File

@@ -33,7 +33,7 @@
var showPlayingAlert = true; var showPlayingAlert = true;
video.addEventListener("playing", event => { video.addEventListener("playing", _event => {
<!-- document.querySelector('.playbackState').innerHTML="Media file is playing";--> <!-- document.querySelector('.playbackState').innerHTML="Media file is playing";-->
<!-- Need this hack to verify that the video is playing, --> <!-- Need this hack to verify that the video is playing, -->
<!-- the test cannot currently verify the text displayed on the page--> <!-- the test cannot currently verify the text displayed on the page-->
@@ -43,7 +43,7 @@
} }
}); });
video.addEventListener("pause", event => { video.addEventListener("pause", _event => {
// document.querySelector('.playbackState').innerHTML="Media file is paused"; // document.querySelector('.playbackState').innerHTML="Media file is paused";
alert("Media file is paused"); alert("Media file is paused");
}); });