mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-17 22:32:51 +00:00
Backed out changeset b60f98f26664 (bug 1576768) for causing mochitest failures. CLOSED TREE
This commit is contained in:
parent
f8aa415792
commit
152f71d4d3
29
.eslintrc.js
29
.eslintrc.js
@ -81,35 +81,6 @@ module.exports = {
|
||||
browser: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
files: "*.sjs",
|
||||
rules: {
|
||||
radix: "warn",
|
||||
strict: "warn",
|
||||
"no-var": "warn",
|
||||
complexity: "warn",
|
||||
"no-undef": "warn",
|
||||
"no-empty": "warn",
|
||||
"no-shadow": "warn",
|
||||
"valid-jsdoc": "warn",
|
||||
"no-redeclare": "warn",
|
||||
"no-unused-vars": "warn",
|
||||
"no-fallthrough": "warn",
|
||||
"mozilla/no-aArgs": "warn",
|
||||
"block-scoped-var": "warn",
|
||||
"no-control-regex": "warn",
|
||||
"no-throw-literal": "warn",
|
||||
"no-useless-concat": "warn",
|
||||
"consistent-return": "warn",
|
||||
"mozilla/use-cc-etc": "warn",
|
||||
"no-use-before-define": "warn",
|
||||
"mozilla/use-services": "warn",
|
||||
"mozilla/use-includes-instead-of-indexOf": "warn",
|
||||
"mozilla/no-compare-against-boolean-literals": "warn",
|
||||
"mozilla/reject-importGlobalProperties": "warn",
|
||||
"mozilla/var-only-at-top-level": "warn",
|
||||
},
|
||||
},
|
||||
{
|
||||
files: [
|
||||
"*.html",
|
||||
|
@ -1,16 +1,14 @@
|
||||
"use strict";
|
||||
|
||||
function handleRequest(request, response) {
|
||||
let match;
|
||||
let requestAuth = true;
|
||||
var match;
|
||||
var requestAuth = true;
|
||||
|
||||
// Allow the caller to drive how authentication is processed via the query.
|
||||
// Eg, http://localhost:8888/authenticate.sjs?user=foo&realm=bar
|
||||
// The extra ? allows the user/pass/realm checks to succeed if the name is
|
||||
// at the beginning of the query string.
|
||||
let query = "?" + request.queryString;
|
||||
var query = "?" + request.queryString;
|
||||
|
||||
let expected_user = "test",
|
||||
var expected_user = "test",
|
||||
expected_pass = "testpass",
|
||||
realm = "mochitest";
|
||||
|
||||
@ -39,17 +37,19 @@ function handleRequest(request, response) {
|
||||
// This test only supports Basic auth. The value sent by the client is
|
||||
// "username:password", obscured with base64 encoding.
|
||||
|
||||
let actual_user = "",
|
||||
var actual_user = "",
|
||||
actual_pass = "",
|
||||
authHeader;
|
||||
authHeader,
|
||||
authPresent = false;
|
||||
if (request.hasHeader("Authorization")) {
|
||||
authPresent = true;
|
||||
authHeader = request.getHeader("Authorization");
|
||||
match = /Basic (.+)/.exec(authHeader);
|
||||
if (match.length != 2) {
|
||||
throw new Error("Couldn't parse auth header: " + authHeader);
|
||||
}
|
||||
/* eslint-disable-next-line no-use-before-define */
|
||||
let userpass = base64ToString(match[1]); // no atob() :-(
|
||||
|
||||
var userpass = base64ToString(match[1]); // no atob() :-(
|
||||
match = /(.*):(.*)/.exec(userpass);
|
||||
if (match.length != 3) {
|
||||
throw new Error("Couldn't decode auth header: " + userpass);
|
||||
@ -104,14 +104,14 @@ const toBinaryTable = [
|
||||
const base64Pad = "=";
|
||||
|
||||
function base64ToString(data) {
|
||||
let result = "";
|
||||
let leftbits = 0; // number of bits decoded, but yet to be appended
|
||||
let leftdata = 0; // bits decoded, but yet to be appended
|
||||
var result = "";
|
||||
var leftbits = 0; // number of bits decoded, but yet to be appended
|
||||
var leftdata = 0; // bits decoded, but yet to be appended
|
||||
|
||||
// Convert one by one.
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
let c = toBinaryTable[data.charCodeAt(i) & 0x7f];
|
||||
let padding = data[i] == base64Pad;
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var c = toBinaryTable[data.charCodeAt(i) & 0x7f];
|
||||
var padding = data[i] == base64Pad;
|
||||
// Skip illegal characters and whitespace
|
||||
if (c == -1) {
|
||||
continue;
|
||||
|
@ -9,17 +9,14 @@ function handleRequest(request, response) {
|
||||
|
||||
switch (params.get("test")) {
|
||||
case "cache":
|
||||
/* eslint-disable-next-line no-use-before-define */
|
||||
handleCacheTestRequest(request, response);
|
||||
break;
|
||||
|
||||
case "user-agent":
|
||||
/* eslint-disable-next-line no-use-before-define */
|
||||
handleUserAgentTestRequest(request, response);
|
||||
break;
|
||||
|
||||
case "injected-script":
|
||||
/* eslint-disable-next-line no-use-before-define */
|
||||
handleInjectedScriptTestRequest(request, response, params);
|
||||
break;
|
||||
}
|
||||
@ -100,7 +97,7 @@ function handleInjectedScriptTestRequest(request, response, params) {
|
||||
response.setHeader("Content-Type", "text/html; charset=UTF-8", false);
|
||||
|
||||
let content = "";
|
||||
const frames = parseInt(params.get("frames"), 10);
|
||||
const frames = parseInt(params.get("frames"));
|
||||
if (frames > 0) {
|
||||
// Output an iframe in seamless mode, so that there is an higher chance that in case
|
||||
// of test failures we get a screenshot where the nested iframes are all visible.
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
function handleRequest(request, response) {
|
||||
// redirect_to.sjs?ctxmenu-image.png
|
||||
// redirects to : ctxmenu-image.png
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
"use strict";
|
||||
|
||||
function handleRequest(req, resp) {
|
||||
let suffixes = ["foo", "bar"];
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
function handleRequest(request, response) {
|
||||
try {
|
||||
reallyHandleRequest(request, response);
|
||||
@ -10,26 +8,26 @@ function handleRequest(request, response) {
|
||||
}
|
||||
|
||||
function reallyHandleRequest(request, response) {
|
||||
let match;
|
||||
let requestAuth = true,
|
||||
var match;
|
||||
var requestAuth = true,
|
||||
requestProxyAuth = true;
|
||||
|
||||
// Allow the caller to drive how authentication is processed via the query.
|
||||
// Eg, http://localhost:8888/authenticate.sjs?user=foo&realm=bar
|
||||
// The extra ? allows the user/pass/realm checks to succeed if the name is
|
||||
// at the beginning of the query string.
|
||||
let query = "?" + request.queryString;
|
||||
var query = "?" + request.queryString;
|
||||
|
||||
let expected_user = "",
|
||||
var expected_user = "",
|
||||
expected_pass = "",
|
||||
realm = "mochitest";
|
||||
let proxy_expected_user = "",
|
||||
var proxy_expected_user = "",
|
||||
proxy_expected_pass = "",
|
||||
proxy_realm = "mochi-proxy";
|
||||
let huge = false,
|
||||
var huge = false,
|
||||
plugin = false,
|
||||
anonymous = false;
|
||||
let authHeaderCount = 1;
|
||||
var authHeaderCount = 1;
|
||||
// user=xxx
|
||||
match = /[^_]user=([^&]*)/.exec(query);
|
||||
if (match) {
|
||||
@ -97,7 +95,7 @@ function reallyHandleRequest(request, response) {
|
||||
// This test only supports Basic auth. The value sent by the client is
|
||||
// "username:password", obscured with base64 encoding.
|
||||
|
||||
let actual_user = "",
|
||||
var actual_user = "",
|
||||
actual_pass = "",
|
||||
authHeader,
|
||||
authPresent = false;
|
||||
@ -109,7 +107,7 @@ function reallyHandleRequest(request, response) {
|
||||
throw "Couldn't parse auth header: " + authHeader;
|
||||
}
|
||||
|
||||
let userpass = base64ToString(match[1]); // no atob() :-(
|
||||
var userpass = base64ToString(match[1]); // no atob() :-(
|
||||
match = /(.*):(.*)/.exec(userpass);
|
||||
if (match.length != 3) {
|
||||
throw "Couldn't decode auth header: " + userpass;
|
||||
@ -118,7 +116,7 @@ function reallyHandleRequest(request, response) {
|
||||
actual_pass = match[2];
|
||||
}
|
||||
|
||||
let proxy_actual_user = "",
|
||||
var proxy_actual_user = "",
|
||||
proxy_actual_pass = "";
|
||||
if (request.hasHeader("Proxy-Authorization")) {
|
||||
authHeader = request.getHeader("Proxy-Authorization");
|
||||
@ -127,7 +125,7 @@ function reallyHandleRequest(request, response) {
|
||||
throw "Couldn't parse auth header: " + authHeader;
|
||||
}
|
||||
|
||||
let userpass = base64ToString(match[1]); // no atob() :-(
|
||||
var userpass = base64ToString(match[1]); // no atob() :-(
|
||||
match = /(.*):(.*)/.exec(userpass);
|
||||
if (match.length != 3) {
|
||||
throw "Couldn't decode auth header: " + userpass;
|
||||
@ -237,14 +235,14 @@ const toBinaryTable = [
|
||||
const base64Pad = "=";
|
||||
|
||||
function base64ToString(data) {
|
||||
let result = "";
|
||||
let leftbits = 0; // number of bits decoded, but yet to be appended
|
||||
let leftdata = 0; // bits decoded, but yet to be appended
|
||||
var result = "";
|
||||
var leftbits = 0; // number of bits decoded, but yet to be appended
|
||||
var leftdata = 0; // bits decoded, but yet to be appended
|
||||
|
||||
// Convert one by one.
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
let c = toBinaryTable[data.charCodeAt(i) & 0x7f];
|
||||
let padding = data[i] == base64Pad;
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var c = toBinaryTable[data.charCodeAt(i) & 0x7f];
|
||||
var padding = data[i] == base64Pad;
|
||||
// Skip illegal characters and whitespace
|
||||
if (c == -1) {
|
||||
continue;
|
||||
|
@ -10,16 +10,16 @@ function handleRequest(request, response) {
|
||||
if (request.method == "GET") {
|
||||
response.write(request.queryString);
|
||||
} else {
|
||||
let body = new BinaryInputStream(request.bodyInputStream);
|
||||
var body = new BinaryInputStream(request.bodyInputStream);
|
||||
|
||||
let avail;
|
||||
let bytes = [];
|
||||
var avail;
|
||||
var bytes = [];
|
||||
|
||||
while ((avail = body.available()) > 0) {
|
||||
Array.prototype.push.apply(bytes, body.readByteArray(avail));
|
||||
}
|
||||
|
||||
let data = String.fromCharCode.apply(null, bytes);
|
||||
var data = String.fromCharCode.apply(null, bytes);
|
||||
response.bodyOutputStream.write(data, data.length);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
"use strict";
|
||||
|
||||
function handleRequest(request, response) {
|
||||
response.processAsync();
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
"use strict";
|
||||
|
||||
const key = "json-viewer-chunked-response";
|
||||
function setResponse(response) {
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
"use strict";
|
||||
|
||||
function handleRequest(request, response) {
|
||||
response.setStatusLine(request.httpVersion, 304, "Not Modified");
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
"use strict";
|
||||
|
||||
function handleRequest(request, response) {
|
||||
response.setHeader("Set-Cookie", "tom=cool; Max-Age=10; HttpOnly", true);
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
Cu.importGlobalProperties(["TextEncoder"]);
|
||||
|
||||
function gzipCompressString(string, obs) {
|
||||
const scs = Cc["@mozilla.org/streamConverters;1"].getService(
|
||||
@ -97,9 +97,7 @@ function handleRequest(request, response) {
|
||||
}
|
||||
|
||||
let timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
|
||||
|
||||
timer.initWithCallback(
|
||||
// eslint-disable-next-line complexity
|
||||
() => {
|
||||
// to avoid garbage collection
|
||||
timer = null;
|
||||
@ -318,12 +316,11 @@ function handleRequest(request, response) {
|
||||
response.setHeader("Content-Type", "text/plain", false);
|
||||
response.setHeader("Content-Encoding", "gzip\t ,gzip", false);
|
||||
setCacheHeaders();
|
||||
|
||||
const observer = {
|
||||
onStreamComplete: function(
|
||||
loader,
|
||||
context,
|
||||
statusl,
|
||||
status,
|
||||
length,
|
||||
result
|
||||
) {
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
"use strict";
|
||||
|
||||
function handleRequest(request, response) {
|
||||
response.setStatusLine(request.httpVersion, 200, "Och Aye");
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
"use strict";
|
||||
|
||||
function handleRequest(request, response) {
|
||||
response.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
"use strict";
|
||||
|
||||
function handleRequest(request, response) {
|
||||
response.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
"use strict";
|
||||
|
||||
function handleRequest(request, response) {
|
||||
response.setStatusLine(request.httpVersion, 200, "OK");
|
||||
|
@ -1,7 +1,6 @@
|
||||
/* 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";
|
||||
|
||||
const CC = Components.Constructor;
|
||||
const BinaryInputStream = CC(
|
||||
@ -14,11 +13,11 @@ function handleRequest(request, response) {
|
||||
response.setStatusLine(request.httpVersion, 200, "Och Aye");
|
||||
response.setHeader("Content-Type", "text/plain; charset=utf-8", false);
|
||||
|
||||
let body = "";
|
||||
var body = "";
|
||||
if (request.method == "POST") {
|
||||
const bodyStream = new BinaryInputStream(request.bodyInputStream);
|
||||
|
||||
let avail = 0;
|
||||
var bodyStream = new BinaryInputStream(request.bodyInputStream);
|
||||
var bytes = [],
|
||||
avail = 0;
|
||||
while ((avail = bodyStream.available()) > 0) {
|
||||
body += String.fromCharCode.apply(
|
||||
String,
|
||||
@ -26,11 +25,10 @@ function handleRequest(request, response) {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const contentType = request.hasHeader("content-type")
|
||||
var contentType = request.hasHeader("content-type")
|
||||
? request.getHeader("content-type")
|
||||
: "";
|
||||
var bodyOutput = [request.method, contentType, body].join("\n");
|
||||
|
||||
const bodyOutput = [request.method, contentType, body].join("\n");
|
||||
response.bodyOutputStream.write(bodyOutput, bodyOutput.length);
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
"use strict";
|
||||
|
||||
function handleRequest(request, response) {
|
||||
response.setStatusLine(request.httpVersion, 200, "OK");
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
"use strict";
|
||||
|
||||
function handleRequest(request, response) {
|
||||
response.setStatusLine(request.httpVersion, 200, "Och Aye");
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
"use strict";
|
||||
|
||||
function handleRequest(request, response) {
|
||||
response.setStatusLine(request.httpVersion, 200, "Och Aye");
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
"use strict";
|
||||
|
||||
function handleRequest(request, response) {
|
||||
response.setStatusLine(request.httpVersion, 200, "Och Aye");
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
"use strict";
|
||||
|
||||
function handleRequest(request, response) {
|
||||
response.processAsync();
|
||||
|
@ -1,4 +1,3 @@
|
||||
"use strict";
|
||||
function handleRequest(request, response) {
|
||||
response.processAsync();
|
||||
response.setHeader("Content-Type", "text/event-stream");
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
"use strict";
|
||||
|
||||
function handleRequest(request, response) {
|
||||
response.processAsync();
|
||||
|
@ -1,19 +1,18 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
"use strict";
|
||||
|
||||
const trailerServerTiming = [
|
||||
var trailerServerTiming = [
|
||||
{ metric: "metric3", duration: "99789.11", description: "time3" },
|
||||
{ metric: "metric4", duration: "1112.13", description: "time4" },
|
||||
];
|
||||
|
||||
const responseServerTiming = [
|
||||
var responseServerTiming = [
|
||||
{ metric: "metric1", duration: "123.4", description: "time1" },
|
||||
{ metric: "metric2", duration: "0", description: "time2" },
|
||||
];
|
||||
|
||||
function handleRequest(request, response) {
|
||||
const body = "c\r\ndata reached\r\n3\r\nhej\r\n0\r\n";
|
||||
var body = "c\r\ndata reached\r\n3\r\nhej\r\n0\r\n";
|
||||
|
||||
response.seizePower();
|
||||
response.write("HTTP/1.1 200 OK\r\n");
|
||||
@ -28,8 +27,8 @@ function handleRequest(request, response) {
|
||||
}
|
||||
|
||||
function createServerTimingHeader(headerData) {
|
||||
let header = "";
|
||||
for (let i = 0; i < headerData.length; i++) {
|
||||
var header = "";
|
||||
for (var i = 0; i < headerData.length; i++) {
|
||||
header +=
|
||||
"Server-Timing: " +
|
||||
headerData[i].metric +
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
"use strict";
|
||||
|
||||
function handleRequest(request, response) {
|
||||
const params = request.queryString.split("&");
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
"use strict";
|
||||
|
||||
function handleRequest(request, response) {
|
||||
response.setStatusLine(request.httpVersion, 200, "Och Aye");
|
||||
|
@ -1,5 +1,6 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
function handleRequest(request, response) {
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
"use strict";
|
||||
|
||||
function handleRequest(request, response) {
|
||||
response.processAsync();
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
"use strict";
|
||||
|
||||
function handleRequest(request, response) {
|
||||
response.setHeader("Content-Type", "text/plain; charset=utf-8", false);
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
Components.utils.importGlobalProperties(["URLSearchParams"]);
|
||||
|
||||
function handleRequest(request, response) {
|
||||
@ -45,7 +43,7 @@ function handleUserAgentTestRequest(request, response) {
|
||||
function handleInjectedScriptTestRequest(request, response, params) {
|
||||
response.setHeader("Content-Type", "text/html; charset=UTF-8", false);
|
||||
|
||||
const frames = parseInt(params.get("frames"), 10);
|
||||
const frames = parseInt(params.get("frames"));
|
||||
let content = "";
|
||||
|
||||
if (frames > 0) {
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
function handleRequest(request, response) {
|
||||
response.processAsync();
|
||||
response.setHeader("Content-Type", "text/event-stream");
|
||||
|
@ -1,15 +1,13 @@
|
||||
"use strict";
|
||||
|
||||
function handleRequest(request, response) {
|
||||
const Etag = '"4d881ab-b03-435f0a0f9ef00"';
|
||||
const IfNoneMatch = request.hasHeader("If-None-Match")
|
||||
? request.getHeader("If-None-Match")
|
||||
: "";
|
||||
|
||||
const counter = getState("cache-counter") || 1;
|
||||
var counter = getState("cache-counter") || 1;
|
||||
const page = "<script>var jsValue = '" + counter + "';</script>" + counter;
|
||||
|
||||
setState("cache-counter", "" + (parseInt(counter, 10) + 1));
|
||||
setState("cache-counter", "" + (parseInt(counter) + 1));
|
||||
|
||||
response.setHeader("Etag", Etag, false);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
const createPage = function(msg) {
|
||||
const createPage = function (msg) {
|
||||
return `
|
||||
<html>
|
||||
<script>
|
||||
|
@ -28,12 +28,12 @@ function handleRequest(request, response) {
|
||||
request
|
||||
.getHeader("Content-Type")
|
||||
.split(/\s*\;\s*/)
|
||||
.forEach(function(str) {
|
||||
if (str.indexOf("=") >= 0) {
|
||||
let [name, value] = str.split("=");
|
||||
.forEach(function(s) {
|
||||
if (s.indexOf("=") >= 0) {
|
||||
let [name, value] = s.split("=");
|
||||
contentTypeParams[name] = value;
|
||||
} else {
|
||||
contentTypeParams[""] = str;
|
||||
contentTypeParams[""] = s;
|
||||
}
|
||||
});
|
||||
|
||||
@ -49,9 +49,9 @@ function handleRequest(request, response) {
|
||||
let headerEnd = s.indexOf("\r\n\r\n");
|
||||
s.substr(2, headerEnd - 2)
|
||||
.split("\r\n")
|
||||
.forEach(function(str) {
|
||||
.forEach(function(s) {
|
||||
// We're assuming UTF8 for now
|
||||
let [name, value] = str.split(": ");
|
||||
let [name, value] = s.split(": ");
|
||||
headers[name] = utf8decode(value);
|
||||
});
|
||||
|
||||
|
@ -47,9 +47,9 @@ function handleRequest(request, response) {
|
||||
let headerEnd = s.indexOf("\r\n\r\n");
|
||||
s.substr(2, headerEnd - 2)
|
||||
.split("\r\n")
|
||||
.forEach(function(str) {
|
||||
.forEach(function(s) {
|
||||
// We're assuming UTF8 for now
|
||||
let [name, value] = str.split(": ");
|
||||
let [name, value] = s.split(": ");
|
||||
headers[name] = utf8decode(value);
|
||||
});
|
||||
|
||||
|
@ -18,9 +18,9 @@ function loadHTMLFromFile(path) {
|
||||
|
||||
path
|
||||
.split("/")
|
||||
.filter(path_1 => path_1)
|
||||
.reduce((file, path_2) => {
|
||||
testHTMLFile.append(path_2);
|
||||
.filter(path => path)
|
||||
.reduce((file, path) => {
|
||||
testHTMLFile.append(path);
|
||||
return testHTMLFile;
|
||||
}, testHTMLFile);
|
||||
testHTMLFileStream.init(testHTMLFile, -1, 0, 0);
|
||||
|
@ -104,7 +104,7 @@ function handleRequest(request, response) {
|
||||
if (!queryResponse) {
|
||||
return;
|
||||
}
|
||||
receivedQueries = getState("receivedQueries");
|
||||
var receivedQueries = getState("receivedQueries");
|
||||
queryResponse.write(receivedQueries);
|
||||
queryResponse.finish();
|
||||
});
|
||||
|
@ -1,9 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
function handleRequest(request, response) {
|
||||
// The string "hello" repeated 10 times followed by newline. Compressed using gzip.
|
||||
/* eslint-disable prettier/prettier */
|
||||
let bytes = [0x1f, 0x8b, 0x08, 0x08, 0x4d, 0xe2, 0xf9, 0x54, 0x00, 0x03, 0x68,
|
||||
var bytes = [0x1f, 0x8b, 0x08, 0x08, 0x4d, 0xe2, 0xf9, 0x54, 0x00, 0x03, 0x68,
|
||||
0x65, 0x6c, 0x6c, 0x6f, 0x00, 0xcb, 0x48, 0xcd, 0xc9, 0xc9, 0xcf,
|
||||
0x20, 0x85, 0xe0, 0x02, 0x00, 0xf5, 0x4b, 0x38, 0xcf, 0x33, 0x00,
|
||||
0x00, 0x00];
|
||||
@ -14,7 +12,7 @@ function handleRequest(request, response) {
|
||||
response.setHeader("Content-Length", "" + bytes.length, false);
|
||||
response.setHeader("Content-Type", "text/plain", false);
|
||||
|
||||
let bos = Components.classes[
|
||||
var bos = Components.classes[
|
||||
"@mozilla.org/binaryoutputstream;1"
|
||||
].createInstance(Components.interfaces.nsIBinaryOutputStream);
|
||||
bos.setOutputStream(response.bodyOutputStream);
|
||||
|
@ -19,7 +19,7 @@ function handleRequest(request, response) {
|
||||
response.write('<body onload="window.opener.fullyLoaded()">');
|
||||
|
||||
// Send half of the content.
|
||||
for (let i = 0; i < 100; ++i) {
|
||||
for (var i = 0; i < 100; ++i) {
|
||||
response.write("<p>Some text.</p>");
|
||||
}
|
||||
|
||||
@ -30,7 +30,7 @@ function handleRequest(request, response) {
|
||||
timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
|
||||
timer.init(
|
||||
() => {
|
||||
for (let i = 0; i < 100; ++i) {
|
||||
for (var i = 0; i < 100; ++i) {
|
||||
response.write("<p>Some text.</p>");
|
||||
}
|
||||
response.write("</body>");
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
const BinaryOutputStream = Components.Constructor(
|
||||
"@mozilla.org/binaryoutputstream;1",
|
||||
"nsIBinaryOutputStream",
|
||||
@ -22,11 +20,12 @@ const RED_SQUARE =
|
||||
0xA3, 0xC4, 0x01, 0x3F, 0x58, 0x1D, 0xEF, 0x27, 0x00, 0x00,
|
||||
0x00, 0x00, 0x49, 0x45, 0x4E, 0x44, 0xAE, 0x42, 0x60, 0x82
|
||||
];
|
||||
|
||||
/* eslint-enable prettier/prettier */
|
||||
function handleRequest(request, response) {
|
||||
let query = {};
|
||||
var query = {};
|
||||
request.queryString.split("&").forEach(function(val) {
|
||||
let [name, value] = val.split("=");
|
||||
var [name, value] = val.split("=");
|
||||
query[name] = unescape(value);
|
||||
});
|
||||
|
||||
@ -35,9 +34,9 @@ function handleRequest(request, response) {
|
||||
response.setStatusLine(request.httpVersion, 200, "OK");
|
||||
response.setHeader("Content-Type", "text/plain", false);
|
||||
|
||||
let log = getState("bug-879963-request-log") || "";
|
||||
var log = getState("bug-879963-request-log") || "";
|
||||
|
||||
let stream = new BinaryOutputStream(response.bodyOutputStream);
|
||||
var stream = new BinaryOutputStream(response.bodyOutputStream);
|
||||
|
||||
if (query.q == "init") {
|
||||
log = "init"; // initialize the log, and return a PNG image
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
"use strict";
|
||||
|
||||
function handleRequest(request, response) {
|
||||
let hstsHeader = "max-age=300";
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
function handleRequest(request, response) {
|
||||
response.setStatusLine(request.httpVersion, 200, "OK");
|
||||
response.setHeader("Access-Control-Allow-Origin", "*");
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
function handleRequest(request, response) {
|
||||
response.setStatusLine(request.httpVersion, 200, "OK");
|
||||
//response.setHeader("Content-type", "image/gif");
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
function handleRequest(request, response) {
|
||||
response.setStatusLine(request.httpVersion, 200, "OK");
|
||||
response.setHeader("Content-type", "image/bitmap");
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
function handleRequest(request, response) {
|
||||
response.setStatusLine(request.httpVersion, 307, "Moved temporarly");
|
||||
response.setHeader(
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
function handleRequest(request, response) {
|
||||
response.setStatusLine(request.httpVersion, 307, "Moved temporarly");
|
||||
response.setHeader(
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
function handleRequest(request, response) {
|
||||
response.setStatusLine(request.httpVersion, 307, "Moved temporarly");
|
||||
response.setHeader(
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
function handleRequest(request, response) {
|
||||
response.setStatusLine(request.httpVersion, 307, "Moved temporarly");
|
||||
response.setHeader(
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
function handleRequest(request, response) {
|
||||
response.setStatusLine(request.httpVersion, 204, "No Content");
|
||||
}
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
function handleRequest(request, response) {
|
||||
response.setStatusLine(request.httpVersion, 307, "Moved temporarly");
|
||||
response.setHeader(
|
||||
|
@ -16,14 +16,11 @@ const IFRAME =
|
||||
function handleRequest(aRequest, aResponse) {
|
||||
aResponse.setStatusLine(aRequest.httpVersion, 200);
|
||||
|
||||
let key;
|
||||
if (aRequest.queryString.includes("what=script")) {
|
||||
key = "script";
|
||||
} else if (aRequest.queryString.includes("what=image")) {
|
||||
key = "image";
|
||||
} else {
|
||||
key = "iframe";
|
||||
}
|
||||
let key = aRequest.queryString.includes("what=script")
|
||||
? "script"
|
||||
: aRequest.queryString.includes("what=image")
|
||||
? "image"
|
||||
: "iframe";
|
||||
|
||||
if (aRequest.queryString.includes("result")) {
|
||||
aResponse.write(getState(key));
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
function handleRequest(request, response) {
|
||||
let page = "<!DOCTYPE html><html><body><p>HSTS page</p></body></html>";
|
||||
response.setStatusLine(request.httpVersion, "200", "OK");
|
||||
|
@ -1,7 +1,6 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
"use strict";
|
||||
Components.utils.importGlobalProperties(["URLSearchParams", "URL"]);
|
||||
|
||||
function handleRequest(request, response) {
|
||||
|
@ -1,6 +1,4 @@
|
||||
"use strict";
|
||||
|
||||
function handleRequest(request, response) {
|
||||
response.setStatusLine(request.httpVersion, 302);
|
||||
response.setHeader("Location", "./dummy_page.html");
|
||||
function handleRequest(aRequest, aResponse) {
|
||||
aResponse.setStatusLine(aRequest.httpVersion, 302);
|
||||
aResponse.setHeader("Location", "./dummy_page.html");
|
||||
}
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
function handleRequest(request, response) {
|
||||
try {
|
||||
reallyHandleRequest(request, response);
|
||||
@ -116,7 +114,7 @@ function reallyHandleRequest(request, response) {
|
||||
throw new Error("Couldn't parse auth header: " + authHeader);
|
||||
}
|
||||
|
||||
let userpass = base64ToString(match[1]); // no atob() :-(
|
||||
var userpass = base64ToString(match[1]); // no atob() :-(
|
||||
match = /(.*):(.*)/.exec(userpass);
|
||||
if (match.length != 3) {
|
||||
throw new Error("Couldn't decode auth header: " + userpass);
|
||||
@ -134,7 +132,7 @@ function reallyHandleRequest(request, response) {
|
||||
throw new Error("Couldn't parse auth header: " + authHeader);
|
||||
}
|
||||
|
||||
let userpass = base64ToString(match[1]); // no atob() :-(
|
||||
var userpass = base64ToString(match[1]); // no atob() :-(
|
||||
match = /(.*):(.*)/.exec(userpass);
|
||||
if (match.length != 3) {
|
||||
throw new Error("Couldn't decode auth header: " + userpass);
|
||||
|
@ -39,9 +39,10 @@ function handleRequest(request, response) {
|
||||
|
||||
var actual_user = "",
|
||||
actual_pass = "",
|
||||
authHeader;
|
||||
|
||||
authHeader,
|
||||
authPresent = false;
|
||||
if (request.hasHeader("Authorization")) {
|
||||
authPresent = true;
|
||||
authHeader = request.getHeader("Authorization");
|
||||
match = /Basic (.+)/.exec(authHeader);
|
||||
if (match.length != 2) {
|
||||
|
@ -9,6 +9,7 @@ function handleRequest(request, response) {
|
||||
|
||||
function reallyHandleRequest(request, response) {
|
||||
let match;
|
||||
let requestAuth = true;
|
||||
|
||||
// XXX I bet this doesn't work for POST requests.
|
||||
let query = request.queryString;
|
||||
|
@ -8,26 +8,26 @@ function handleRequest(request, response) {
|
||||
}
|
||||
|
||||
function reallyHandleRequest(request, response) {
|
||||
let match;
|
||||
let requestAuth = true,
|
||||
var match;
|
||||
var requestAuth = true,
|
||||
requestProxyAuth = true;
|
||||
|
||||
// Allow the caller to drive how authentication is processed via the query.
|
||||
// Eg, http://localhost:8888/authenticate.sjs?user=foo&realm=bar
|
||||
// The extra ? allows the user/pass/realm checks to succeed if the name is
|
||||
// at the beginning of the query string.
|
||||
let query = "?" + request.queryString;
|
||||
var query = "?" + request.queryString;
|
||||
|
||||
let expected_user = "",
|
||||
var expected_user = "",
|
||||
expected_pass = "",
|
||||
realm = "mochitest";
|
||||
let proxy_expected_user = "",
|
||||
var proxy_expected_user = "",
|
||||
proxy_expected_pass = "",
|
||||
proxy_realm = "mochi-proxy";
|
||||
let huge = false,
|
||||
var huge = false,
|
||||
plugin = false,
|
||||
anonymous = false;
|
||||
let authHeaderCount = 1;
|
||||
var authHeaderCount = 1;
|
||||
// user=xxx
|
||||
match = /[^_]user=([^&]*)/.exec(query);
|
||||
if (match) {
|
||||
@ -95,7 +95,7 @@ function reallyHandleRequest(request, response) {
|
||||
// This test only supports Basic auth. The value sent by the client is
|
||||
// "username:password", obscured with base64 encoding.
|
||||
|
||||
let actual_user = "",
|
||||
var actual_user = "",
|
||||
actual_pass = "",
|
||||
authHeader,
|
||||
authPresent = false;
|
||||
@ -107,7 +107,7 @@ function reallyHandleRequest(request, response) {
|
||||
throw new Error("Couldn't parse auth header: " + authHeader);
|
||||
}
|
||||
|
||||
let userpass = base64ToString(match[1]); // no atob() :-(
|
||||
var userpass = base64ToString(match[1]); // no atob() :-(
|
||||
match = /(.*):(.*)/.exec(userpass);
|
||||
if (match.length != 3) {
|
||||
throw new Error("Couldn't decode auth header: " + userpass);
|
||||
@ -116,7 +116,7 @@ function reallyHandleRequest(request, response) {
|
||||
actual_pass = match[2];
|
||||
}
|
||||
|
||||
let proxy_actual_user = "",
|
||||
var proxy_actual_user = "",
|
||||
proxy_actual_pass = "";
|
||||
if (request.hasHeader("Proxy-Authorization")) {
|
||||
authHeader = request.getHeader("Proxy-Authorization");
|
||||
@ -125,7 +125,7 @@ function reallyHandleRequest(request, response) {
|
||||
throw new Error("Couldn't parse auth header: " + authHeader);
|
||||
}
|
||||
|
||||
let userpass = base64ToString(match[1]); // no atob() :-(
|
||||
var userpass = base64ToString(match[1]); // no atob() :-(
|
||||
match = /(.*):(.*)/.exec(userpass);
|
||||
if (match.length != 3) {
|
||||
throw new Error("Couldn't decode auth header: " + userpass);
|
||||
@ -235,14 +235,14 @@ const toBinaryTable = [
|
||||
const base64Pad = "=";
|
||||
|
||||
function base64ToString(data) {
|
||||
let result = "";
|
||||
let leftbits = 0; // number of bits decoded, but yet to be appended
|
||||
let leftdata = 0; // bits decoded, but yet to be appended
|
||||
var result = "";
|
||||
var leftbits = 0; // number of bits decoded, but yet to be appended
|
||||
var leftdata = 0; // bits decoded, but yet to be appended
|
||||
|
||||
// Convert one by one.
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
let c = toBinaryTable[data.charCodeAt(i) & 0x7f];
|
||||
let padding = data[i] == base64Pad;
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var c = toBinaryTable[data.charCodeAt(i) & 0x7f];
|
||||
var padding = data[i] == base64Pad;
|
||||
// Skip illegal characters and whitespace
|
||||
if (c == -1) {
|
||||
continue;
|
||||
|
@ -26,9 +26,6 @@ function handleRequest(request, response) {
|
||||
|
||||
/**
|
||||
* Create an OpenSearch engine for the given base URL.
|
||||
*
|
||||
* @param {Response} response
|
||||
* @param {object} engineData
|
||||
*/
|
||||
function createOpenSearchEngine(response, engineData) {
|
||||
let params = "",
|
||||
|
@ -18,8 +18,8 @@ function handleRequest(request, response) {
|
||||
return String.fromCharCode(...new TextEncoder().encode(str));
|
||||
}
|
||||
|
||||
function writeSuggestions(q, completions = []) {
|
||||
let jsonString = JSON.stringify([q, completions]);
|
||||
function writeSuggestions(query, completions = []) {
|
||||
let jsonString = JSON.stringify([query, completions]);
|
||||
|
||||
// This script must be evaluated as UTF-8 for this to write out the bytes of
|
||||
// the string in UTF-8. If it's evaluated as Latin-1, the written bytes
|
||||
|
@ -4,7 +4,7 @@ eslint:
|
||||
# ESLint infra handles its own path filtering, so just include cwd
|
||||
include: ['.']
|
||||
exclude: []
|
||||
extensions: ['js', 'jsm', 'jsx', 'xul', 'html', 'xhtml', 'sjs']
|
||||
extensions: ['js', 'jsm', 'jsx', 'xul', 'html', 'xhtml']
|
||||
support-files:
|
||||
- '**/.eslintrc.js'
|
||||
- '.eslintignore'
|
||||
|
@ -26,6 +26,7 @@ module.exports = function(context) {
|
||||
let testType = helpers.getTestType(context);
|
||||
if (testType == "browser") {
|
||||
context.markVariableAsUsed("test");
|
||||
return;
|
||||
}
|
||||
|
||||
if (testType == "xpcshell") {
|
||||
|
Loading…
x
Reference in New Issue
Block a user