Bug 1613903 - Enable ESLint for testing/marionette/harness and testing/marionette/legacyaction.js (manual changes). r=whimboo,marionette-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D62026

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Mark Banner 2020-02-10 16:28:09 +00:00
Родитель 9122889407
Коммит 8346839a9e
11 изменённых файлов: 37 добавлений и 32 удалений

Просмотреть файл

@ -178,19 +178,13 @@ services/fxaccounts/FxAccountsPairingChannel.js
# Servo is imported.
servo/
# Remote protocol exclusions
testing/marionette/atom.js
testing/marionette/legacyaction.js
testing/marionette/harness
# other testing/ exclusions
# third party modules
testing/mochitest/tests/Harness_sanity/
testing/mochitest/tests/SimpleTest/
# octothorpe used for pref file comment causes parsing error
testing/mozbase/mozprofile/tests/files/prefs_with_comments.js
# Test files that we don't want to lint.
# Test files that we don't want to lint (preprocessed, minified etc)
testing/marionette/atom.js
testing/mozbase/mozprofile/tests/files/prefs_with_comments.js
testing/talos/talos/scripts/jszip.min.js
testing/talos/talos/startup_test/sessionrestore/profile/sessionstore.js
testing/talos/talos/startup_test/sessionrestore/profile-manywindows/sessionstore.js

Просмотреть файл

@ -11,6 +11,7 @@
function addBack() {
let iframe = '<iframe src="formPage.html" marginheight="0" marginwidth="0" topmargin="0" leftmargin="600" allowtransparency="true" frameborder="0" height="600" scrolling="no" width="120" id="iframe1"></iframe>';
let myDiv2 = document.getElementById("myDiv2");
// eslint-disable-next-line no-unsanitized/property
myDiv2.innerHTML = iframe;
}
</script>

Просмотреть файл

@ -1,3 +1,5 @@
/* eslint-disable no-unsanitized/property */
function success(position) {
let message = document.getElementById("status");
message.innerHTML =

Просмотреть файл

@ -29,9 +29,10 @@ limitations under the License.
<div id="images">
<p>Current network status: <span id="state"></span></p>
<script>
var state = document.getElementById('state')
const state = document.getElementById('state')
setInterval(function () {
state.className = navigator.onLine ? 'online' : 'offline';
// eslint-disable-next-line no-unsanitized/property
state.innerHTML = navigator.onLine ? 'online' : 'offline';
}, 250);
</script>

Просмотреть файл

@ -8,7 +8,7 @@
<title>Testing Javascript</title>
<meta name="viewport" content="user-scalable=no">
<script type="text/javascript">
var seen = {};
const seen = {};
function updateResult(event) {
document.getElementById('result').innerText = event.target.value;

Просмотреть файл

@ -165,14 +165,16 @@
let tracking =
MouseEventShim.trackMouseMoves && !MouseEventShim.capturing;
let oldtarget;
let newtarget;
if (tracking) {
// If the touch point moves, then the element it is over
// may have changed as well. Note that calling elementFromPoint()
// forces a layout if one is needed.
// XXX: how expensive is it to do this on each touchmove?
// Can we listen for (non-standard) touchleave events instead?
var oldtarget = target;
var newtarget = document.elementFromPoint(touch.clientX, touch.clientY);
oldtarget = target;
newtarget = document.elementFromPoint(touch.clientX, touch.clientY);
if (newtarget === null) {
// this can happen as the touch is moving off of the screen, e.g.
newtarget = oldtarget;
@ -256,7 +258,7 @@
}
})();
var MouseEventShim = {
const MouseEventShim = {
// It is a known gecko bug that synthetic events have timestamps measured
// in microseconds while regular events have timestamps measured in
// milliseconds. This utility function returns a the timestamp converted

Просмотреть файл

@ -19,8 +19,8 @@
<h2 id="hidden" style="visibility: hidden" class="linkClass">Hidden</h2>
<button id="buttonFlick" style="position:absolute;left:0px;top:255px;" type="button" allowevents=true>buttonFlick</button>
<script type="text/javascript">
var button3Timer = null;
var button4Timer = null;
let button3Timer = null;
let button4Timer = null;
//appends passed in text to the innerHTML of the event's target
function appendText(text) {
return function(evt) {
@ -31,7 +31,7 @@
}
else {
//since the target of touchstart is the target of all subsequent events, then
//changedTouches holds the current coordinates of this touch event, so we
//changedTouches holds the current coordinates of this touch event, so we
//use these coordinates to find the element under the touch event
let touches = evt.changedTouches;
let x = touches[0].clientX;
@ -43,6 +43,7 @@
else {
element = evt.target;
}
// eslint-disable-next-line no-unsanitized/property
element.innerHTML += text;
};
};
@ -66,6 +67,7 @@
function addTimers(id, timer) {
let element = document.getElementById(id);
element.addEventListener("touchstart", function(evt) { timer = (new Date()).getTime();});
// eslint-disable-next-line no-unsanitized/property
element.addEventListener("touchend", function(evt) { timer = (new Date()).getTime() - timer; evt.target.innerHTML += "-" + timer;});
}
attachListeners("button1");
@ -75,7 +77,7 @@
attachListeners("buttonScroll");
addTimers("button3");
addTimers("button4");
var buttonFlick = document.getElementById("buttonFlick");
const buttonFlick = document.getElementById("buttonFlick");
attachMouseListeners(buttonFlick);
function createDelayed() {
let newButton = document.createElement("button");

Просмотреть файл

@ -4,7 +4,7 @@
<head>
<title></title>
<script type="text/javascript">
var next = 0;
let next = 0;
function addMore() {
let box = document.createElement('DIV');

Просмотреть файл

@ -14,12 +14,12 @@
<div id="empty-host"></div>
<script>
'use strict';
var host = document.getElementById('host');
var root = host.attachShadow({ mode: "open" });
const host = document.getElementById('host');
const root = host.attachShadow({ mode: "open" });
root.innerHTML = '<button id="button">Foo</button>' +
'<div id="inner-host"></div>';
var innerHost = host.shadowRoot.getElementById('inner-host');
var innerRoot = innerHost.attachShadow({ mode: "open" });
const innerHost = host.shadowRoot.getElementById('inner-host');
const innerRoot = innerHost.attachShadow({ mode: "open" });
innerRoot.innerHTML = '<button id="inner-button">Bar</button>';
</script>
</body>

Просмотреть файл

@ -8,6 +8,7 @@
<title>Dialog Test</title>
<script type="text/javascript">
function setInnerText(id, value) {
// eslint-disable-next-line no-unsanitized/property
document.getElementById(id).innerHTML = "<p>" + value + "</p>";
}

Просмотреть файл

@ -8,7 +8,9 @@ const { Preferences } = ChromeUtils.import(
const { XPCOMUtils } = ChromeUtils.import(
"resource://gre/modules/XPCOMUtils.jsm"
);
const { WebDriverError } = ChromeUtils.import(
"chrome://marionette/content/error.js"
);
const { element, WebElement } = ChromeUtils.import(
"chrome://marionette/content/element.js"
);
@ -25,6 +27,7 @@ const DEFAULT_CONTEXT_MENU_DELAY = 750; // ms
this.EXPORTED_SYMBOLS = ["legacyaction"];
/* global action */
/** @namespace */
this.legacyaction = this.action = {};
@ -387,6 +390,7 @@ action.Chain.prototype.generateEvents = function(
switch (type) {
case "tap":
if (this.mouseEventsOnly) {
let touch = this.touchProvider.createATouch(target, x, y, touchId);
this.mouseTap(
touch.target.ownerDocument,
touch.clientX,
@ -497,14 +501,11 @@ action.Chain.prototype.generateEvents = function(
target = this.touchIds[touchId].target;
}
let [
clientX,
clientY,
pageX,
pageY,
screenX,
screenY,
] = this.getCoordinateInfo(target, x, y);
let [clientX, clientY, , , screenX, screenY] = this.getCoordinateInfo(
target,
x,
y
);
event.initMouseEvent(
"contextmenu",
@ -529,6 +530,7 @@ action.Chain.prototype.generateEvents = function(
default:
throw new WebDriverError("Unknown event type: " + type);
}
return null;
};
action.Chain.prototype.mouseTap = function(doc, x, y, button, count, mod) {