зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1770727 - Fix failures of ESLint rule mozilla/use-includes-instead-of-indexOf in sjs files. r=Gijs
Depends on D147081 Differential Revision: https://phabricator.services.mozilla.com/D147082
This commit is contained in:
Родитель
dac6401c3b
Коммит
18b014551e
|
@ -8,7 +8,7 @@ function parseQuery(request, key) {
|
|||
if (p.indexOf(key + "=") == 0) {
|
||||
return p.substring(key.length + 1);
|
||||
}
|
||||
if (p.indexOf("=") < 0 && key == "") {
|
||||
if (!p.includes("=") && key == "") {
|
||||
return p;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ function parseQuery(request, key) {
|
|||
if (p.indexOf(key + "=") == 0) {
|
||||
return p.substring(key.length + 1);
|
||||
}
|
||||
if (p.indexOf("=") < 0 && key == "") {
|
||||
if (!p.includes("=") && key == "") {
|
||||
return p;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ function parseQuery(request, key) {
|
|||
if (p.indexOf(key + "=") == 0) {
|
||||
return p.substring(key.length + 1);
|
||||
}
|
||||
if (p.indexOf("=") < 0 && key == "") {
|
||||
if (!p.includes("=") && key == "") {
|
||||
return p;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ function parseQuery(request, key) {
|
|||
if (p.indexOf(key + "=") === 0) {
|
||||
return p.substring(key.length + 1);
|
||||
}
|
||||
if (p.indexOf("=") < 0 && key === "") {
|
||||
if (!p.includes("=") && key === "") {
|
||||
return p;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ function parseQuery(request, key) {
|
|||
if (p.indexOf(key + "=") == 0) {
|
||||
return p.substring(key.length + 1);
|
||||
}
|
||||
if (p.indexOf("=") < 0 && key == "") {
|
||||
if (!p.includes("=") && key == "") {
|
||||
return p;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ function parseQuery(request, key) {
|
|||
if (p.indexOf(key + "=") == 0) {
|
||||
return p.substring(key.length + 1);
|
||||
}
|
||||
if (p.indexOf("=") < 0 && key == "") {
|
||||
if (!p.includes("=") && key == "") {
|
||||
return p;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ function parseQuery(request, key) {
|
|||
if (p.indexOf(key + "=") == 0) {
|
||||
return p.substring(key.length + 1);
|
||||
}
|
||||
if (p.indexOf("=") < 0 && key == "") {
|
||||
if (!p.includes("=") && key == "") {
|
||||
return p;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ function handleRequest(request, response) {
|
|||
}
|
||||
|
||||
// just in case error handling for unexpected queries
|
||||
if (expectedQueries.indexOf(queryString) == -1) {
|
||||
if (!expectedQueries.includes(queryString)) {
|
||||
response.write("unexpected-response");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ function handleRequest(request, response) {
|
|||
}
|
||||
|
||||
// just in case error handling for unexpected queries
|
||||
if (expectedQueries.indexOf(queryString) == -1) {
|
||||
if (!expectedQueries.includes(queryString)) {
|
||||
response.write("unexpected-response");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ function handleRequest(request, response) {
|
|||
|
||||
var data = String.fromCharCode.apply(null, bytes);
|
||||
response.setHeader("Result-Content-Length", "" + data.length);
|
||||
if (data.indexOf("TEST_REDIRECT_STR") >= 0) {
|
||||
if (data.includes("TEST_REDIRECT_STR")) {
|
||||
var newURL = "http://" + data.split("&url=")[1];
|
||||
response.setStatusLine(null, 307, "redirect");
|
||||
response.setHeader("Location", newURL, false);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
function handleRequest(request, response) {
|
||||
response.setHeader("Content-Type", "text/javascript", false);
|
||||
if (request.queryString.indexOf("report") != -1) {
|
||||
if (request.queryString.includes("report")) {
|
||||
if (getState("loaded") == "loaded") {
|
||||
response.write(
|
||||
"ok(false, 'This script was not supposed to get fetched.'); continueAfterReport();"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
function handleRequest(request, response) {
|
||||
if (request.queryString.indexOf("report") != -1) {
|
||||
if (request.queryString.includes("report")) {
|
||||
response.setHeader("Content-Type", "text/javascript", false);
|
||||
if (getState("loaded") == "loaded") {
|
||||
response.write(
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
function handleRequest(request, response) {
|
||||
response.setHeader("Content-Type", "text/javascript", false);
|
||||
if (request.queryString.indexOf("report") != -1) {
|
||||
if (request.queryString.includes("report")) {
|
||||
if (getState("loaded") == "loaded") {
|
||||
response.write("ok(true, 'This script was supposed to get fetched.');");
|
||||
} else {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
function handleRequest(request, response) {
|
||||
response.setHeader("Content-Type", "text/javascript", false);
|
||||
if (request.queryString.indexOf("report") != -1) {
|
||||
if (request.queryString.includes("report")) {
|
||||
if (getState("loaded") == "loaded") {
|
||||
response.write(
|
||||
"ok(false, 'This script was not supposed to get fetched.'); continueAfterReport();"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
function handleRequest(request, response) {
|
||||
response.setHeader("Content-Type", "text/javascript", false);
|
||||
if (request.queryString.indexOf("report") != -1) {
|
||||
if (request.queryString.includes("report")) {
|
||||
if (getState("loaded") == "loaded") {
|
||||
response.write(
|
||||
"ok(false, 'This script was not supposed to get fetched.');"
|
||||
|
|
|
@ -24,11 +24,11 @@ function armTimer(response) {
|
|||
function handleRequest(request, response) {
|
||||
response.setHeader("Cache-Control", "no-cache", false);
|
||||
response.setHeader("Content-Type", "text/javascript", false);
|
||||
if (request.queryString.indexOf("first") != -1) {
|
||||
if (request.queryString.includes("first")) {
|
||||
response.write("// first\n");
|
||||
response.processAsync();
|
||||
armTimer(response);
|
||||
} else if (request.queryString.indexOf("second") != -1) {
|
||||
} else if (request.queryString.includes("second")) {
|
||||
response.write("// second\n");
|
||||
setState("docwritepreloadssecond", "second");
|
||||
} else {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
function handleRequest(request, response) {
|
||||
if (request.queryString.indexOf("report") != -1) {
|
||||
if (request.queryString.includes("report")) {
|
||||
response.setHeader("Content-Type", "text/javascript", false);
|
||||
if (getState("loaded") == "loaded") {
|
||||
response.write(
|
||||
|
|
|
@ -2,7 +2,7 @@ var timer;
|
|||
var callback;
|
||||
|
||||
function handleRequest(request, response) {
|
||||
if (request.queryString.indexOf("trigger") != -1) {
|
||||
if (request.queryString.includes("trigger")) {
|
||||
setState("triggered", "triggered");
|
||||
response.setHeader("Cache-Control", "no-cache", false);
|
||||
response.setHeader("Content-Type", "text/javascript; charset=utf-8", false);
|
||||
|
|
|
@ -46,7 +46,7 @@ function handleRequest(req, resp) {
|
|||
req
|
||||
.getHeader("Cookie")
|
||||
.split(";")
|
||||
.indexOf("red") >= 0
|
||||
.includes("red")
|
||||
) {
|
||||
resp.write(
|
||||
'<html style="background: #f00;">' + setCookieScript + "</html>"
|
||||
|
@ -60,7 +60,7 @@ function handleRequest(req, resp) {
|
|||
req
|
||||
.getHeader("Cookie")
|
||||
.split(";")
|
||||
.indexOf("green") >= 0
|
||||
.includes("green")
|
||||
) {
|
||||
resp.write(
|
||||
'<html style="background: #0f0;">' + setCookieScript + "</html>"
|
||||
|
|
|
@ -32,7 +32,7 @@ function handleRequest(request, response) {
|
|||
setState(list, hashes);
|
||||
|
||||
let lists = getState("lists");
|
||||
if (lists.indexOf(list) == -1) {
|
||||
if (!lists.includes(list)) {
|
||||
lists += list + "\n";
|
||||
setState("lists", lists);
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ function handleRequest(request, response) {
|
|||
setState(list, hashes);
|
||||
|
||||
let lists = getState("lists");
|
||||
if (lists.indexOf(list) == -1) {
|
||||
if (!lists.includes(list)) {
|
||||
lists += list + "\n";
|
||||
setState("lists", lists);
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ function handleRequest(request, response) {
|
|||
setState(list, hashes);
|
||||
|
||||
let lists = getState("lists");
|
||||
if (lists.indexOf(list) == -1) {
|
||||
if (!lists.includes(list)) {
|
||||
lists += list + "\n";
|
||||
setState("lists", lists);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче