зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 4 changesets (bug 1783565) for causing failures at test_origin.js. CLOSED TREE
Backed out changeset 289d233f1266 (bug 1783565) Backed out changeset 3523c3cede7d (bug 1783565) Backed out changeset cc2d5eaf69d2 (bug 1783565) Backed out changeset 7e11b0d6e731 (bug 1783565)
This commit is contained in:
Родитель
c37d8bfef7
Коммит
57077f89fc
|
@ -237,7 +237,15 @@ module.exports = {
|
|||
"netwerk/test/unit*/**",
|
||||
],
|
||||
rules: {
|
||||
"mozilla/no-arbitrary-setTimeout": "off",
|
||||
"mozilla/no-define-cc-etc": "off",
|
||||
"consistent-return": "off",
|
||||
"no-eval": "off",
|
||||
"no-global-assign": "off",
|
||||
"no-nested-ternary": "off",
|
||||
"no-redeclare": "off",
|
||||
"no-shadow": "off",
|
||||
"no-throw-literal": "off",
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
|
@ -197,7 +197,6 @@ document.getElementById('form').submit();
|
|||
|
||||
function frameScript() {
|
||||
/* eslint-env mozilla/frame-script */
|
||||
/* eslint-disable mozilla/no-arbitrary-setTimeout */
|
||||
addMessageListener("Test:WaitForIFrame", function() {
|
||||
var check = function() {
|
||||
if (content) {
|
||||
|
@ -224,7 +223,6 @@ function frameScript() {
|
|||
|
||||
check();
|
||||
});
|
||||
/* eslint-enable mozilla/no-arbitrary-setTimeout */
|
||||
}
|
||||
|
||||
function loadTestTab(uri) {
|
||||
|
|
|
@ -69,7 +69,7 @@ function pumpReadStream(inputStream, goon) {
|
|||
Ci.nsIInputStreamPump
|
||||
);
|
||||
pump.init(inputStream, 0, 0, true);
|
||||
let data = "";
|
||||
var data = "";
|
||||
pump.asyncRead({
|
||||
onStartRequest(aRequest) {},
|
||||
onDataAvailable(aRequest, aInputStream, aOffset, aCount) {
|
||||
|
@ -89,7 +89,7 @@ function pumpReadStream(inputStream, goon) {
|
|||
});
|
||||
} else {
|
||||
// blocking stream
|
||||
let data = read_stream(inputStream, inputStream.available());
|
||||
var data = read_stream(inputStream, inputStream.available());
|
||||
goon(data);
|
||||
}
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ OpenCallback.prototype = {
|
|||
return;
|
||||
}
|
||||
|
||||
let self = this;
|
||||
var self = this;
|
||||
executeSoon(function() {
|
||||
// emulate network latency
|
||||
entry.setMetaDataElement("meto", self.workingMetadata);
|
||||
|
@ -210,7 +210,7 @@ OpenCallback.prototype = {
|
|||
if (self.behavior & DOOMED) {
|
||||
LOG_C2(self, "checking doom state");
|
||||
try {
|
||||
let os = entry.openOutputStream(0, -1);
|
||||
var os = entry.openOutputStream(0, -1);
|
||||
// Unfortunately, in the undetermined state we cannot even check whether the entry
|
||||
// is actually doomed or not.
|
||||
os.close();
|
||||
|
@ -226,7 +226,7 @@ OpenCallback.prototype = {
|
|||
|
||||
var offset = self.behavior & PARTIAL ? entry.dataSize : 0;
|
||||
LOG_C2(self, "openOutputStream @ " + offset);
|
||||
let os = entry.openOutputStream(offset, -1);
|
||||
var os = entry.openOutputStream(offset, -1);
|
||||
LOG_C2(self, "writing data");
|
||||
var wrt = os.write(self.workingData, self.workingData.length);
|
||||
Assert.equal(wrt, self.workingData.length);
|
||||
|
@ -249,7 +249,7 @@ OpenCallback.prototype = {
|
|||
this.goon(entry, true);
|
||||
}
|
||||
|
||||
let self = this;
|
||||
var self = this;
|
||||
pumpReadStream(entry.openInputStream(0), function(data) {
|
||||
Assert.equal(data, self.workingData);
|
||||
self.onDataCheckPassed = true;
|
||||
|
|
|
@ -25,7 +25,6 @@ class BaseNodeHTTPServerCode {
|
|||
resp.setHeader("Content-Length", response.length);
|
||||
resp.writeHead(404);
|
||||
resp.end(response);
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -271,8 +271,7 @@ class TRRServerCode {
|
|||
let u = url.parse(req.url, true);
|
||||
let handler = global.path_handlers[u.pathname];
|
||||
if (handler) {
|
||||
handler(req, resp, u);
|
||||
return;
|
||||
return handler(req, resp, u);
|
||||
}
|
||||
|
||||
// Didn't find a handler for this path.
|
||||
|
@ -351,7 +350,7 @@ function trrQueryHandler(req, resp, url) {
|
|||
req.on("data", chunk => {
|
||||
requestBody = Buffer.concat([requestBody, chunk]);
|
||||
if (requestBody.length == contentLength) {
|
||||
processRequest(req, resp, requestBody);
|
||||
return processRequest(req, resp, requestBody);
|
||||
}
|
||||
});
|
||||
} else if (method == "GET") {
|
||||
|
@ -362,7 +361,7 @@ function trrQueryHandler(req, resp, url) {
|
|||
}
|
||||
|
||||
requestBody = Buffer.from(url.query.dns, "base64");
|
||||
processRequest(req, resp, requestBody);
|
||||
return processRequest(req, resp, requestBody);
|
||||
} else {
|
||||
// unexpected method.
|
||||
resp.writeHead(405);
|
||||
|
@ -575,9 +574,7 @@ class TRRProxyCode {
|
|||
}
|
||||
});
|
||||
socket.on("error", error => {
|
||||
throw new Error(
|
||||
`Unxpected error when conneting the HTTP/2 server from the HTTP/2 proxy during CONNECT handling: '${error}'`
|
||||
);
|
||||
throw `Unxpected error when conneting the HTTP/2 server from the HTTP/2 proxy during CONNECT handling: '${error}'`;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -690,7 +690,7 @@ function do_tests(whichRFC) {
|
|||
tests[i].length == 3 || whichRFC == 0 ? tests[i][1] : tests[i][3];
|
||||
|
||||
try {
|
||||
let result;
|
||||
var result;
|
||||
|
||||
if (whichRFC == 0) {
|
||||
result = mhp.getParameter(tests[i][0], "", "UTF-8", true, unused);
|
||||
|
@ -715,7 +715,7 @@ function do_tests(whichRFC) {
|
|||
tests[i].length == 3 || whichRFC == 0 ? tests[i][2] : tests[i][4];
|
||||
|
||||
try {
|
||||
let result;
|
||||
var result;
|
||||
|
||||
if (whichRFC == 0) {
|
||||
result = mhp.getParameter(
|
||||
|
|
|
@ -167,7 +167,7 @@ function run_test() {
|
|||
|
||||
var xhr;
|
||||
|
||||
for (let i = 0; i < tests.length; ++i) {
|
||||
for (var i = 0; i < tests.length; ++i) {
|
||||
dump("Testing " + tests[i] + "\n");
|
||||
xhr = createXHR(
|
||||
false,
|
||||
|
@ -178,7 +178,7 @@ function run_test() {
|
|||
checkResults(xhr, tests[i][2], tests[i][3], tests[i][4]);
|
||||
}
|
||||
|
||||
for (let i = 0; i < othertests.length; ++i) {
|
||||
for (var i = 0; i < othertests.length; ++i) {
|
||||
dump("Testing " + othertests[i] + " (cross-origin)\n");
|
||||
xhr = createXHR(
|
||||
false,
|
||||
|
|
|
@ -53,11 +53,10 @@ function contentHandler(metadata, response) {
|
|||
response.setHeader("Cache-Control", "no-cache");
|
||||
response.setHeader("ETag", "test-etag1");
|
||||
|
||||
let etag;
|
||||
try {
|
||||
etag = metadata.getHeader("If-None-Match");
|
||||
var etag = metadata.getHeader("If-None-Match");
|
||||
} catch (ex) {
|
||||
etag = "";
|
||||
var etag = "";
|
||||
}
|
||||
|
||||
if (etag == "test-etag1" && shouldPassRevalidation) {
|
||||
|
|
|
@ -42,11 +42,10 @@ function contentHandler(metadata, response) {
|
|||
response.setHeader("Cache-Control", "no-cache");
|
||||
response.setHeader("ETag", "test-etag1");
|
||||
|
||||
let etag;
|
||||
try {
|
||||
etag = metadata.getHeader("If-None-Match");
|
||||
var etag = metadata.getHeader("If-None-Match");
|
||||
} catch (ex) {
|
||||
etag = "";
|
||||
var etag = "";
|
||||
}
|
||||
|
||||
if (etag == "test-etag1" && shouldPassRevalidation) {
|
||||
|
|
|
@ -42,11 +42,10 @@ function contentHandler(metadata, response) {
|
|||
response.setHeader("Cache-Control", "no-cache");
|
||||
response.setHeader("ETag", "test-etag1");
|
||||
|
||||
let etag;
|
||||
try {
|
||||
etag = metadata.getHeader("If-None-Match");
|
||||
var etag = metadata.getHeader("If-None-Match");
|
||||
} catch (ex) {
|
||||
etag = "";
|
||||
var etag = "";
|
||||
}
|
||||
|
||||
if (etag == "test-etag1" && shouldPassRevalidation) {
|
||||
|
|
|
@ -147,8 +147,7 @@ function makeChan(origin) {
|
|||
}).QueryInterface(Ci.nsIHttpChannel);
|
||||
}
|
||||
|
||||
// Avoid ESLint no-global-assign rules.
|
||||
/* global origin:true */
|
||||
var origin;
|
||||
var xaltsvc;
|
||||
var retryCounter = 0;
|
||||
var loadWithoutClearingMappings = false;
|
||||
|
|
|
@ -139,8 +139,7 @@ function makeChan(origin) {
|
|||
}).QueryInterface(Ci.nsIHttpChannel);
|
||||
}
|
||||
|
||||
// Avoid ESLint no-global-assign rules.
|
||||
/* global origin:true */
|
||||
var origin;
|
||||
var xaltsvc;
|
||||
var retryCounter = 0;
|
||||
var loadWithoutClearingMappings = false;
|
||||
|
|
|
@ -58,8 +58,7 @@ function makeChan(origin) {
|
|||
}
|
||||
|
||||
var nextTest;
|
||||
// Avoid ESLint no-global-assign rules.
|
||||
/* global origin:true */
|
||||
var origin;
|
||||
var nextPortExpectedToBeSame = false;
|
||||
var currentPort = 0;
|
||||
var forceReload = false;
|
||||
|
|
|
@ -79,10 +79,10 @@ AuthPrompt2.prototype = {
|
|||
authInfo.password = cred.pass;
|
||||
cred.flags &= ~FLAG_PREVIOUS_FAILED;
|
||||
}
|
||||
return true;
|
||||
} catch (e) {
|
||||
do_throw(e);
|
||||
}
|
||||
return true;
|
||||
},
|
||||
|
||||
asyncPromptAuth: function ap2_async(
|
||||
|
@ -92,31 +92,35 @@ AuthPrompt2.prototype = {
|
|||
encryptionLevel,
|
||||
authInfo
|
||||
) {
|
||||
var me = this;
|
||||
var allOverAndDead = false;
|
||||
executeSoon(function() {
|
||||
try {
|
||||
try {
|
||||
var me = this;
|
||||
var allOverAndDead = false;
|
||||
executeSoon(function() {
|
||||
try {
|
||||
if (allOverAndDead) {
|
||||
throw "already canceled";
|
||||
}
|
||||
var ret = me.promptAuth(channel, encryptionLevel, authInfo);
|
||||
if (!ret) {
|
||||
callback.onAuthCancelled(context, true);
|
||||
} else {
|
||||
callback.onAuthAvailable(context, authInfo);
|
||||
}
|
||||
allOverAndDead = true;
|
||||
} catch (e) {
|
||||
do_throw(e);
|
||||
}
|
||||
});
|
||||
return new Cancelable(function() {
|
||||
if (allOverAndDead) {
|
||||
throw new Error("already canceled");
|
||||
}
|
||||
var ret = me.promptAuth(channel, encryptionLevel, authInfo);
|
||||
if (!ret) {
|
||||
callback.onAuthCancelled(context, true);
|
||||
} else {
|
||||
callback.onAuthAvailable(context, authInfo);
|
||||
throw "can't cancel, already ran";
|
||||
}
|
||||
callback.onAuthAvailable(context, authInfo);
|
||||
allOverAndDead = true;
|
||||
} catch (e) {
|
||||
do_throw(e);
|
||||
}
|
||||
});
|
||||
return new Cancelable(function() {
|
||||
if (allOverAndDead) {
|
||||
throw new Error("can't cancel, already ran");
|
||||
}
|
||||
callback.onAuthAvailable(context, authInfo);
|
||||
allOverAndDead = true;
|
||||
});
|
||||
});
|
||||
} catch (e) {
|
||||
do_throw(e);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
@ -145,7 +145,6 @@ AuthPrompt2.prototype = {
|
|||
const kAllKnownFlags = 127; // Don't fail test for newly added flags
|
||||
Assert.equal(expectedFlags, authInfo.flags & kAllKnownFlags);
|
||||
|
||||
// eslint-disable-next-line no-nested-ternary
|
||||
var expectedScheme = isNTLM ? "ntlm" : isDigest ? "digest" : "basic";
|
||||
Assert.equal(expectedScheme, authInfo.authenticationScheme);
|
||||
|
||||
|
|
|
@ -159,7 +159,6 @@ add_task(async function test_http2() {
|
|||
0x3e,
|
||||
])
|
||||
);
|
||||
// eslint-disable-next-line mozilla/no-arbitrary-setTimeout
|
||||
setTimeout(function() {
|
||||
resp.write(
|
||||
Buffer.from([
|
||||
|
@ -303,7 +302,6 @@ add_task(async function test_http2() {
|
|||
);
|
||||
}, 100);
|
||||
|
||||
// eslint-disable-next-line mozilla/no-arbitrary-setTimeout
|
||||
setTimeout(function() {
|
||||
resp.end(
|
||||
Buffer.from([
|
||||
|
|
|
@ -50,7 +50,7 @@ function contentHandler2(metadata, response) {
|
|||
response.bodyOutputStream.write(responseBody2b, responseBody2b.length);
|
||||
break;
|
||||
default:
|
||||
throw new Error("Unexpected request in the test");
|
||||
throw "Unexpected request in the test";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -65,6 +65,14 @@ registerCleanupFunction(async () => {
|
|||
await httpserv.stop();
|
||||
});
|
||||
|
||||
function makeChan(url) {
|
||||
let chan = NetUtil.newChannel({
|
||||
uri: url,
|
||||
loadUsingSystemPrincipal: true,
|
||||
}).QueryInterface(Ci.nsIHttpChannel);
|
||||
return chan;
|
||||
}
|
||||
|
||||
function channelOpenPromise(chan) {
|
||||
return new Promise(resolve => {
|
||||
let topic = "http-on-transaction-suspended-authentication";
|
||||
|
|
|
@ -110,7 +110,7 @@ function run_test() {
|
|||
let baseRoot = resProto.resolveURI(Services.io.newURI("resource:///"));
|
||||
let greRoot = resProto.resolveURI(Services.io.newURI("resource://gre/"));
|
||||
|
||||
for (let spec of specs) {
|
||||
for (var spec of specs) {
|
||||
check_safe_resolution(spec, rootURI.spec);
|
||||
check_safe_resolution(
|
||||
spec.replace("res-test", "res-inexistent"),
|
||||
|
@ -120,7 +120,7 @@ function run_test() {
|
|||
check_safe_resolution(spec.replace("res-test", "gre"), greRoot);
|
||||
}
|
||||
|
||||
for (let spec of error_specs) {
|
||||
for (var spec of error_specs) {
|
||||
check_resolution_error(spec);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ function run_test() {
|
|||
|
||||
// Make sure our prefs are set such that this test actually means something
|
||||
var prefs = Services.prefs;
|
||||
for (let pref of prefData) {
|
||||
for (var pref of prefData) {
|
||||
prefs.setBoolPref(pref.name, pref.newVal);
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ function run_test() {
|
|||
Assert.equal(uri4.displayHost, uri5.displayHost);
|
||||
Assert.equal(uri4.asciiHost, uri5.asciiHost);
|
||||
} finally {
|
||||
for (let pref of prefData) {
|
||||
for (var pref of prefData) {
|
||||
if (prefs.prefHasUserValue(pref.name)) {
|
||||
prefs.clearUserPref(pref.name);
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ var invalid_URIs = [
|
|||
];
|
||||
|
||||
function run_test() {
|
||||
for (let i = 0; i < valid_URIs.length; i++) {
|
||||
for (var i = 0; i < valid_URIs.length; i++) {
|
||||
try {
|
||||
Services.io.newURI(valid_URIs[i]);
|
||||
} catch (e) {
|
||||
|
@ -61,7 +61,7 @@ function run_test() {
|
|||
}
|
||||
}
|
||||
|
||||
for (let i = 0; i < invalid_URIs.length; i++) {
|
||||
for (var i = 0; i < invalid_URIs.length; i++) {
|
||||
try {
|
||||
Services.io.newURI(invalid_URIs[i]);
|
||||
do_throw("should throw: " + invalid_URIs[i]);
|
||||
|
|
|
@ -68,8 +68,7 @@ function redirect(metadata, response) {
|
|||
// If called second time, just return the PAC but set failed-flag
|
||||
if (called) {
|
||||
failed = true;
|
||||
pac(metadata, response);
|
||||
return;
|
||||
return pac(metadata, response);
|
||||
}
|
||||
|
||||
called = true;
|
||||
|
|
|
@ -370,11 +370,10 @@ function run_next_test() {
|
|||
|
||||
function handler(httpStatus, metadata, response) {
|
||||
gHitServer = true;
|
||||
let etag;
|
||||
try {
|
||||
etag = metadata.getHeader("If-None-Match");
|
||||
var etag = metadata.getHeader("If-None-Match");
|
||||
} catch (ex) {
|
||||
etag = "";
|
||||
var etag = "";
|
||||
}
|
||||
if (etag == "testtag") {
|
||||
// Allow using the cached data
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
/* globals NetUtil*/
|
||||
/* globals HttpServer */
|
||||
const { HttpServer } = ChromeUtils.import("resource://testing-common/httpd.js");
|
||||
|
||||
let httpserver;
|
||||
|
|
|
@ -36,13 +36,11 @@ function run_test() {
|
|||
|
||||
function run_test_number(num) {
|
||||
var testPath = testPathBase + num;
|
||||
// eslint-disable-next-line no-eval
|
||||
httpserver.registerPathHandler(testPath, eval("handler" + num));
|
||||
|
||||
var channel = setupChannel(testPath);
|
||||
var flags = test_flags[num]; // OK if flags undefined for test
|
||||
channel.asyncOpen(
|
||||
// eslint-disable-next-line no-eval
|
||||
new ChannelListener(eval("completeTest" + num), channel, flags)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -46,20 +46,17 @@ function run_test() {
|
|||
|
||||
function run_test_number(num) {
|
||||
let testPath = testPathBase + num;
|
||||
// eslint-disable-next-line no-eval
|
||||
httpserver.registerPathHandler(testPath, eval("handler" + num));
|
||||
|
||||
var channel = setupChannel(testPath);
|
||||
let flags = test_flags[num]; // OK if flags undefined for test
|
||||
channel.asyncOpen(
|
||||
// eslint-disable-next-line no-eval
|
||||
new ChannelListener(eval("completeTest" + num), channel, flags)
|
||||
);
|
||||
}
|
||||
|
||||
function run_gzip_test(num) {
|
||||
let testPath = testPathBase + num;
|
||||
// eslint-disable-next-line no-eval
|
||||
httpserver.registerPathHandler(testPath, eval("handler" + num));
|
||||
|
||||
var channel = setupChannel(testPath);
|
||||
|
|
|
@ -322,9 +322,7 @@ class http2ProxyCode {
|
|||
}
|
||||
});
|
||||
socket.on("error", error => {
|
||||
throw new Error(
|
||||
`Unexpected error when conneting the HTTP/2 server from the HTTP/2 proxy during CONNECT handling: '${error}'`
|
||||
);
|
||||
throw `Unxpected error when conneting the HTTP/2 server from the HTTP/2 proxy during CONNECT handling: '${error}'`;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -724,7 +724,7 @@ var altsvcClientListener = {
|
|||
);
|
||||
if (!isHttp2Connection) {
|
||||
dump("/altsvc1 not over h2 yet - retry\n");
|
||||
let chan = makeChan(
|
||||
var chan = makeChan(
|
||||
"http://foo.example.com:" + httpserv.identity.primaryPort + "/altsvc1"
|
||||
).QueryInterface(Ci.nsIHttpChannel);
|
||||
// we use this header to tell the server to issue a altsvc frame for the
|
||||
|
@ -738,7 +738,7 @@ var altsvcClientListener = {
|
|||
chan.asyncOpen(altsvcClientListener);
|
||||
} else {
|
||||
Assert.ok(isHttp2Connection);
|
||||
let chan = makeChan(
|
||||
var chan = makeChan(
|
||||
"http://foo.example.com:" + httpserv2.identity.primaryPort + "/altsvc2"
|
||||
).QueryInterface(Ci.nsIHttpChannel);
|
||||
chan.loadFlags = Ci.nsIRequest.LOAD_BYPASS_CACHE;
|
||||
|
|
|
@ -81,7 +81,6 @@ async function test_0RTT(enable_ssl_tokens_cache, enable_0rtt, resumed) {
|
|||
|
||||
// Make sure the h3 connection created by the previous test is cleared.
|
||||
Services.obs.notifyObservers(null, "net:cancel-all-connections");
|
||||
// eslint-disable-next-line mozilla/no-arbitrary-setTimeout
|
||||
await new Promise(resolve => setTimeout(resolve, 1000));
|
||||
|
||||
// This connecion should be resumed.
|
||||
|
|
|
@ -63,6 +63,16 @@ function makeChan(url) {
|
|||
return chan;
|
||||
}
|
||||
|
||||
function makeChan(url) {
|
||||
let chan = NetUtil.newChannel({
|
||||
uri: url,
|
||||
loadUsingSystemPrincipal: true,
|
||||
contentPolicyType: Ci.nsIContentPolicy.TYPE_DOCUMENT,
|
||||
}).QueryInterface(Ci.nsIHttpChannel);
|
||||
chan.loadFlags = Ci.nsIChannel.LOAD_INITIAL_DOCUMENT_URI;
|
||||
return chan;
|
||||
}
|
||||
|
||||
function channelOpenPromise(chan, flags) {
|
||||
return new Promise(resolve => {
|
||||
function finish(req, buffer) {
|
||||
|
@ -114,7 +124,6 @@ add_task(async function testH3CoalescingWithSpeculativeConnection() {
|
|||
add_task(async function testH3CoalescingWithoutSpeculativeConnection() {
|
||||
Services.prefs.setIntPref("network.http.speculative-parallel-limit", 0);
|
||||
Services.obs.notifyObservers(null, "net:cancel-all-connections");
|
||||
// eslint-disable-next-line mozilla/no-arbitrary-setTimeout
|
||||
await new Promise(resolve => setTimeout(resolve, 1000));
|
||||
await H3CoalescingTest("baz.h3_coalescing.org", "qux.h3_coalescing.org");
|
||||
});
|
||||
|
|
|
@ -98,7 +98,6 @@ function channelOpenPromise(chan, flags, delay) {
|
|||
true
|
||||
);
|
||||
if (delay) {
|
||||
// eslint-disable-next-line mozilla/no-arbitrary-setTimeout
|
||||
await new Promise(r => setTimeout(r, delay));
|
||||
}
|
||||
chan.asyncOpen(new ChannelListener(finish, null, flags));
|
||||
|
@ -172,7 +171,6 @@ add_task(async function test_fast_fallback_with_speculative_connection() {
|
|||
add_task(async function test_fast_fallback_without_speculative_connection() {
|
||||
// Make sure the h3 connection created by the previous test is cleared.
|
||||
Services.obs.notifyObservers(null, "net:cancel-all-connections");
|
||||
// eslint-disable-next-line mozilla/no-arbitrary-setTimeout
|
||||
await new Promise(resolve => setTimeout(resolve, 1000));
|
||||
// Clear the h3 excluded list, otherwise the Alt-Svc mapping will not be used.
|
||||
Services.obs.notifyObservers(null, "network:reset-http3-excluded-list");
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
// uses head_http3.js, which uses http2-ca.pem
|
||||
"use strict";
|
||||
|
||||
/* exported inChildProcess, test_flag_priority */
|
||||
/*global inChildProcess, test_flag_priority */
|
||||
function inChildProcess() {
|
||||
return Services.appinfo.processType != Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT;
|
||||
}
|
||||
|
@ -28,10 +28,18 @@ function parse_priority_response_header(priority) {
|
|||
const priority_array = priority.split(",");
|
||||
|
||||
// parse for urgency string
|
||||
const urgency = priority_array.find(element => element.includes("u="));
|
||||
const urgency = priority_array.find(element => {
|
||||
if (element.includes("u=")) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
// parse for incremental bool
|
||||
const incremental = !!priority_array.find(element => element == "i");
|
||||
const incremental = !!priority_array.find(element => {
|
||||
if (element == "i") {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
return [urgency ? urgency : null, incremental];
|
||||
}
|
||||
|
|
|
@ -35,7 +35,6 @@ add_task(async function test() {
|
|||
let oldSock = global.socket;
|
||||
global.socket = resp.socket;
|
||||
if (global.socket == oldSock) {
|
||||
// eslint-disable-next-line mozilla/no-arbitrary-setTimeout
|
||||
setTimeout(
|
||||
arg => {
|
||||
arg.writeHead(408);
|
||||
|
|
|
@ -25,11 +25,11 @@ function run_test() {
|
|||
chan.setRequestHeader("foopy", "baz", true);
|
||||
check_request_header(chan, "foopy", "bar, baz");
|
||||
|
||||
for (let i = 0; i < 100; ++i) {
|
||||
for (var i = 0; i < 100; ++i) {
|
||||
chan.setRequestHeader("foopy" + i, i, false);
|
||||
}
|
||||
|
||||
for (let i = 0; i < 100; ++i) {
|
||||
for (var i = 0; i < 100; ++i) {
|
||||
check_request_header(chan, "foopy" + i, i);
|
||||
}
|
||||
|
||||
|
|
|
@ -95,7 +95,6 @@ class EventSinkListener {
|
|||
if (iid.equals(Ci.nsIChannelEventSink)) {
|
||||
return this;
|
||||
}
|
||||
throw Components.Exception("", Cr.NS_ERROR_NO_INTERFACE);
|
||||
}
|
||||
asyncOnChannelRedirect(oldChan, newChan, flags, callback) {
|
||||
Assert.equal(oldChan.URI.hostPort, newChan.URI.hostPort);
|
||||
|
|
|
@ -239,7 +239,6 @@ add_task(async function testConnectWithECH() {
|
|||
|
||||
add_task(async function testEchRetry() {
|
||||
Services.obs.notifyObservers(null, "net:cancel-all-connections");
|
||||
// eslint-disable-next-line mozilla/no-arbitrary-setTimeout
|
||||
await new Promise(resolve => setTimeout(resolve, 1000));
|
||||
|
||||
dns.clearCache(true);
|
||||
|
@ -411,7 +410,6 @@ add_task(async function testH3ConnectWithECH() {
|
|||
add_task(async function testH3ConnectWithECHRetry() {
|
||||
dns.clearCache(true);
|
||||
Services.obs.notifyObservers(null, "net:cancel-all-connections");
|
||||
// eslint-disable-next-line mozilla/no-arbitrary-setTimeout
|
||||
await new Promise(resolve => setTimeout(resolve, 1000));
|
||||
|
||||
function base64ToArray(base64) {
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
|
||||
var prefs;
|
||||
var http2pref;
|
||||
// Avoid ESLint no-global-assign rules.
|
||||
/* global origin:true */
|
||||
var origin;
|
||||
var rcwnpref;
|
||||
|
||||
function run_test() {
|
||||
|
|
|
@ -144,7 +144,6 @@ add_task(async function testSimpleRequestAfterCrash() {
|
|||
killSocketProcess(socketProcessId);
|
||||
|
||||
info("wait socket process restart...");
|
||||
// eslint-disable-next-line mozilla/no-arbitrary-setTimeout
|
||||
await new Promise(resolve => setTimeout(resolve, 1000));
|
||||
await TestUtils.waitForCondition(() => Services.io.socketProcessLaunched);
|
||||
|
||||
|
|
|
@ -119,8 +119,6 @@ const PROXY_CHALLENGE =
|
|||
// i.e. successful proxy auth and successful web server auth
|
||||
//
|
||||
function authHandler(metadata, response) {
|
||||
let authorization;
|
||||
let authPrefix;
|
||||
switch (requestsMade) {
|
||||
case 0:
|
||||
// Proxy - First request to the Proxy resppond with a 407 to start auth
|
||||
|
@ -129,8 +127,8 @@ function authHandler(metadata, response) {
|
|||
break;
|
||||
case 1:
|
||||
// Proxy - Expecting a type 1 negotiate message from the client
|
||||
authorization = metadata.getHeader("Proxy-Authorization");
|
||||
authPrefix = authorization.substring(0, NTLM_PREFIX_LEN);
|
||||
var authorization = metadata.getHeader("Proxy-Authorization");
|
||||
var authPrefix = authorization.substring(0, NTLM_PREFIX_LEN);
|
||||
Assert.equal(NTLM_TYPE1_PREFIX, authPrefix, "Expecting a Type 1 message");
|
||||
response.setStatusLine(metadata.httpVersion, 407, "Unauthorized");
|
||||
response.setHeader("Proxy-Authenticate", PROXY_CHALLENGE, false);
|
||||
|
@ -138,31 +136,31 @@ function authHandler(metadata, response) {
|
|||
case 2:
|
||||
// Proxy - Expecting a type 3 Authenticate message from the client
|
||||
// Will respond with a 401 to start web server auth sequence
|
||||
authorization = metadata.getHeader("Proxy-Authorization");
|
||||
authPrefix = authorization.substring(0, NTLM_PREFIX_LEN);
|
||||
var authorization = metadata.getHeader("Proxy-Authorization");
|
||||
var authPrefix = authorization.substring(0, NTLM_PREFIX_LEN);
|
||||
Assert.equal(NTLM_TYPE3_PREFIX, authPrefix, "Expecting a Type 3 message");
|
||||
response.setStatusLine(metadata.httpVersion, 401, "Unauthorized");
|
||||
response.setHeader("WWW-Authenticate", "NTLM", false);
|
||||
break;
|
||||
case 3:
|
||||
// Web Server - Expecting a type 1 negotiate message from the client
|
||||
authorization = metadata.getHeader("Authorization");
|
||||
authPrefix = authorization.substring(0, NTLM_PREFIX_LEN);
|
||||
var authorization = metadata.getHeader("Authorization");
|
||||
var authPrefix = authorization.substring(0, NTLM_PREFIX_LEN);
|
||||
Assert.equal(NTLM_TYPE1_PREFIX, authPrefix, "Expecting a Type 1 message");
|
||||
response.setStatusLine(metadata.httpVersion, 401, "Unauthorized");
|
||||
response.setHeader("WWW-Authenticate", NTLM_CHALLENGE, false);
|
||||
break;
|
||||
case 4:
|
||||
// Web Server - Expecting a type 3 Authenticate message from the client
|
||||
authorization = metadata.getHeader("Authorization");
|
||||
authPrefix = authorization.substring(0, NTLM_PREFIX_LEN);
|
||||
var authorization = metadata.getHeader("Authorization");
|
||||
var authPrefix = authorization.substring(0, NTLM_PREFIX_LEN);
|
||||
Assert.equal(NTLM_TYPE3_PREFIX, authPrefix, "Expecting a Type 3 message");
|
||||
response.setStatusLine(metadata.httpVersion, 200, "Successful");
|
||||
break;
|
||||
default:
|
||||
// We should be authenticated and further requests are permitted
|
||||
authorization = metadata.getHeader("Authorization");
|
||||
authorization = metadata.getHeader("Proxy-Authorization");
|
||||
var authorization = metadata.getHeader("Authorization");
|
||||
var authorization = metadata.getHeader("Proxy-Authorization");
|
||||
Assert.isnull(authorization);
|
||||
response.setStatusLine(metadata.httpVersion, 200, "Successful");
|
||||
}
|
||||
|
@ -174,8 +172,6 @@ function authHandler(metadata, response) {
|
|||
// proxy auth fails.
|
||||
//
|
||||
function authHandlerInvalidProxyPassword(metadata, response) {
|
||||
let authorization;
|
||||
let authPrefix;
|
||||
switch (requestsMade) {
|
||||
case 0:
|
||||
// Proxy - First request respond with a 407 to initiate auth sequence
|
||||
|
@ -184,8 +180,8 @@ function authHandlerInvalidProxyPassword(metadata, response) {
|
|||
break;
|
||||
case 1:
|
||||
// Proxy - Expecting a type 1 negotiate message from the client
|
||||
authorization = metadata.getHeader("Proxy-Authorization");
|
||||
authPrefix = authorization.substring(0, NTLM_PREFIX_LEN);
|
||||
var authorization = metadata.getHeader("Proxy-Authorization");
|
||||
var authPrefix = authorization.substring(0, NTLM_PREFIX_LEN);
|
||||
Assert.equal(NTLM_TYPE1_PREFIX, authPrefix, "Expecting a Type 1 message");
|
||||
response.setStatusLine(metadata.httpVersion, 407, "Unauthorized");
|
||||
response.setHeader("Proxy-Authenticate", PROXY_CHALLENGE, false);
|
||||
|
@ -194,8 +190,8 @@ function authHandlerInvalidProxyPassword(metadata, response) {
|
|||
// Proxy - Expecting a type 3 Authenticate message from the client
|
||||
// Respond with a 407 to indicate invalid credentials
|
||||
//
|
||||
authorization = metadata.getHeader("Proxy-Authorization");
|
||||
authPrefix = authorization.substring(0, NTLM_PREFIX_LEN);
|
||||
var authorization = metadata.getHeader("Proxy-Authorization");
|
||||
var authPrefix = authorization.substring(0, NTLM_PREFIX_LEN);
|
||||
Assert.equal(NTLM_TYPE3_PREFIX, authPrefix, "Expecting a Type 3 message");
|
||||
response.setStatusLine(metadata.httpVersion, 407, "Unauthorized");
|
||||
response.setHeader("Proxy-Authenticate", "NTLM", false);
|
||||
|
@ -215,8 +211,6 @@ function authHandlerInvalidProxyPassword(metadata, response) {
|
|||
// Note: the connection should not be reused once the password failure is
|
||||
// detected
|
||||
function authHandlerInvalidWebPassword(metadata, response) {
|
||||
let authorization;
|
||||
let authPrefix;
|
||||
switch (requestsMade) {
|
||||
case 0:
|
||||
// Proxy - First request return a 407 to start Proxy auth
|
||||
|
@ -225,8 +219,8 @@ function authHandlerInvalidWebPassword(metadata, response) {
|
|||
break;
|
||||
case 1:
|
||||
// Proxy - Expecting a type 1 negotiate message from the client
|
||||
authorization = metadata.getHeader("Proxy-Authorization");
|
||||
authPrefix = authorization.substring(0, NTLM_PREFIX_LEN);
|
||||
var authorization = metadata.getHeader("Proxy-Authorization");
|
||||
var authPrefix = authorization.substring(0, NTLM_PREFIX_LEN);
|
||||
Assert.equal(NTLM_TYPE1_PREFIX, authPrefix, "Expecting a Type 1 message");
|
||||
response.setStatusLine(metadata.httpVersion, 407, "Unauthorized");
|
||||
response.setHeader("Proxy-Authenticate", NTLM_CHALLENGE, false);
|
||||
|
@ -234,16 +228,16 @@ function authHandlerInvalidWebPassword(metadata, response) {
|
|||
case 2:
|
||||
// Proxy - Expecting a type 3 Authenticate message from the client
|
||||
// Responds with a 401 to start web server auth
|
||||
authorization = metadata.getHeader("Proxy-Authorization");
|
||||
authPrefix = authorization.substring(0, NTLM_PREFIX_LEN);
|
||||
var authorization = metadata.getHeader("Proxy-Authorization");
|
||||
var authPrefix = authorization.substring(0, NTLM_PREFIX_LEN);
|
||||
Assert.equal(NTLM_TYPE3_PREFIX, authPrefix, "Expecting a Type 3 message");
|
||||
response.setStatusLine(metadata.httpVersion, 401, "Unauthorized");
|
||||
response.setHeader("WWW-Authenticate", "NTLM", false);
|
||||
break;
|
||||
case 3:
|
||||
// Web Server - Expecting a type 1 negotiate message from the client
|
||||
authorization = metadata.getHeader("Authorization");
|
||||
authPrefix = authorization.substring(0, NTLM_PREFIX_LEN);
|
||||
var authorization = metadata.getHeader("Authorization");
|
||||
var authPrefix = authorization.substring(0, NTLM_PREFIX_LEN);
|
||||
Assert.equal(NTLM_TYPE1_PREFIX, authPrefix, "Expecting a Type 1 message");
|
||||
response.setStatusLine(metadata.httpVersion, 401, "Unauthorized");
|
||||
response.setHeader("WWW-Authenticate", NTLM_CHALLENGE, false);
|
||||
|
@ -251,8 +245,8 @@ function authHandlerInvalidWebPassword(metadata, response) {
|
|||
case 4:
|
||||
// Web Server - Expecting a type 3 Authenticate message from the client
|
||||
// Respond with a 401 to restart the auth sequence.
|
||||
authorization = metadata.getHeader("Authorization");
|
||||
authPrefix = authorization.substring(0, NTLM_PREFIX_LEN);
|
||||
var authorization = metadata.getHeader("Authorization");
|
||||
var authPrefix = authorization.substring(0, NTLM_PREFIX_LEN);
|
||||
Assert.equal(NTLM_TYPE3_PREFIX, authPrefix, "Expecting a Type 1 message");
|
||||
response.setStatusLine(metadata.httpVersion, 401, "Unauthorized");
|
||||
break;
|
||||
|
|
|
@ -121,8 +121,6 @@ const PROXY_CHALLENGE =
|
|||
// i.e. successful proxy auth
|
||||
//
|
||||
function successfulAuth(metadata, response) {
|
||||
let authorization;
|
||||
let authPrefix;
|
||||
switch (requestsMade) {
|
||||
case 0:
|
||||
// Proxy - First request to the Proxy resppond with a 407 to start auth
|
||||
|
@ -131,8 +129,8 @@ function successfulAuth(metadata, response) {
|
|||
break;
|
||||
case 1:
|
||||
// Proxy - Expecting a type 1 negotiate message from the client
|
||||
authorization = metadata.getHeader("Proxy-Authorization");
|
||||
authPrefix = authorization.substring(0, NTLM_PREFIX_LEN);
|
||||
var authorization = metadata.getHeader("Proxy-Authorization");
|
||||
var authPrefix = authorization.substring(0, NTLM_PREFIX_LEN);
|
||||
Assert.equal(NTLM_TYPE1_PREFIX, authPrefix, "Expecting a Type 1 message");
|
||||
response.setStatusLine(metadata.httpVersion, 407, "Unauthorized");
|
||||
response.setHeader("Proxy-Authenticate", PROXY_CHALLENGE, false);
|
||||
|
@ -140,14 +138,14 @@ function successfulAuth(metadata, response) {
|
|||
case 2:
|
||||
// Proxy - Expecting a type 3 Authenticate message from the client
|
||||
// Will respond with a 401 to start web server auth sequence
|
||||
authorization = metadata.getHeader("Proxy-Authorization");
|
||||
authPrefix = authorization.substring(0, NTLM_PREFIX_LEN);
|
||||
var authorization = metadata.getHeader("Proxy-Authorization");
|
||||
var authPrefix = authorization.substring(0, NTLM_PREFIX_LEN);
|
||||
Assert.equal(NTLM_TYPE3_PREFIX, authPrefix, "Expecting a Type 3 message");
|
||||
response.setStatusLine(metadata.httpVersion, 200, "Successful");
|
||||
break;
|
||||
default:
|
||||
// We should be authenticated and further requests are permitted
|
||||
authorization = metadata.getHeader("Proxy-Authorization");
|
||||
var authorization = metadata.getHeader("Proxy-Authorization");
|
||||
Assert.isnull(authorization);
|
||||
response.setStatusLine(metadata.httpVersion, 200, "Successful");
|
||||
}
|
||||
|
@ -159,8 +157,6 @@ function successfulAuth(metadata, response) {
|
|||
// proxy auth fails.
|
||||
//
|
||||
function failedAuth(metadata, response) {
|
||||
let authorization;
|
||||
let authPrefix;
|
||||
switch (requestsMade) {
|
||||
case 0:
|
||||
// Proxy - First request respond with a 407 to initiate auth sequence
|
||||
|
@ -169,8 +165,8 @@ function failedAuth(metadata, response) {
|
|||
break;
|
||||
case 1:
|
||||
// Proxy - Expecting a type 1 negotiate message from the client
|
||||
authorization = metadata.getHeader("Proxy-Authorization");
|
||||
authPrefix = authorization.substring(0, NTLM_PREFIX_LEN);
|
||||
var authorization = metadata.getHeader("Proxy-Authorization");
|
||||
var authPrefix = authorization.substring(0, NTLM_PREFIX_LEN);
|
||||
Assert.equal(NTLM_TYPE1_PREFIX, authPrefix, "Expecting a Type 1 message");
|
||||
response.setStatusLine(metadata.httpVersion, 407, "Unauthorized");
|
||||
response.setHeader("Proxy-Authenticate", PROXY_CHALLENGE, false);
|
||||
|
@ -179,8 +175,8 @@ function failedAuth(metadata, response) {
|
|||
// Proxy - Expecting a type 3 Authenticate message from the client
|
||||
// Respond with a 407 to indicate invalid credentials
|
||||
//
|
||||
authorization = metadata.getHeader("Proxy-Authorization");
|
||||
authPrefix = authorization.substring(0, NTLM_PREFIX_LEN);
|
||||
var authorization = metadata.getHeader("Proxy-Authorization");
|
||||
var authPrefix = authorization.substring(0, NTLM_PREFIX_LEN);
|
||||
Assert.equal(NTLM_TYPE3_PREFIX, authPrefix, "Expecting a Type 3 message");
|
||||
response.setStatusLine(metadata.httpVersion, 407, "Unauthorized");
|
||||
response.setHeader("Proxy-Authenticate", "NTLM", false);
|
||||
|
@ -199,8 +195,6 @@ function failedAuth(metadata, response) {
|
|||
// Detects bug 486508
|
||||
//
|
||||
function connectionReset(metadata, response) {
|
||||
let authorization;
|
||||
let authPrefix;
|
||||
switch (requestsMade) {
|
||||
case 0:
|
||||
// Proxy - First request to the Proxy resppond with a 407 to start auth
|
||||
|
@ -209,16 +203,16 @@ function connectionReset(metadata, response) {
|
|||
break;
|
||||
case 1:
|
||||
// Proxy - Expecting a type 1 negotiate message from the client
|
||||
authorization = metadata.getHeader("Proxy-Authorization");
|
||||
authPrefix = authorization.substring(0, NTLM_PREFIX_LEN);
|
||||
var authorization = metadata.getHeader("Proxy-Authorization");
|
||||
var authPrefix = authorization.substring(0, NTLM_PREFIX_LEN);
|
||||
Assert.equal(NTLM_TYPE1_PREFIX, authPrefix, "Expecting a Type 1 message");
|
||||
ntlmTypeOneCount++;
|
||||
response.setStatusLine(metadata.httpVersion, 407, "Unauthorized");
|
||||
response.setHeader("Proxy-Authenticate", PROXY_CHALLENGE, false);
|
||||
break;
|
||||
case 2:
|
||||
authorization = metadata.getHeader("Proxy-Authorization");
|
||||
authPrefix = authorization.substring(0, NTLM_PREFIX_LEN);
|
||||
var authorization = metadata.getHeader("Proxy-Authorization");
|
||||
var authPrefix = authorization.substring(0, NTLM_PREFIX_LEN);
|
||||
Assert.equal(NTLM_TYPE3_PREFIX, authPrefix, "Expecting a Type 3 message");
|
||||
ntlmTypeTwoCount++;
|
||||
response.seizePower();
|
||||
|
|
|
@ -117,8 +117,6 @@ const NTLM_CHALLENGE =
|
|||
// i.e. successful web server auth
|
||||
//
|
||||
function successfulAuth(metadata, response) {
|
||||
let authorization;
|
||||
let authPrefix;
|
||||
switch (requestsMade) {
|
||||
case 0:
|
||||
// Web Server - Initial request
|
||||
|
@ -128,22 +126,22 @@ function successfulAuth(metadata, response) {
|
|||
break;
|
||||
case 1:
|
||||
// Web Server - Expecting a type 1 negotiate message from the client
|
||||
authorization = metadata.getHeader("Authorization");
|
||||
authPrefix = authorization.substring(0, NTLM_PREFIX_LEN);
|
||||
var authorization = metadata.getHeader("Authorization");
|
||||
var authPrefix = authorization.substring(0, NTLM_PREFIX_LEN);
|
||||
Assert.equal(NTLM_TYPE1_PREFIX, authPrefix, "Expecting a Type 1 message");
|
||||
response.setStatusLine(metadata.httpVersion, 401, "Unauthorized");
|
||||
response.setHeader("WWW-Authenticate", NTLM_CHALLENGE, false);
|
||||
break;
|
||||
case 2:
|
||||
// Web Server - Expecting a type 3 Authenticate message from the client
|
||||
authorization = metadata.getHeader("Authorization");
|
||||
authPrefix = authorization.substring(0, NTLM_PREFIX_LEN);
|
||||
var authorization = metadata.getHeader("Authorization");
|
||||
var authPrefix = authorization.substring(0, NTLM_PREFIX_LEN);
|
||||
Assert.equal(NTLM_TYPE3_PREFIX, authPrefix, "Expecting a Type 3 message");
|
||||
response.setStatusLine(metadata.httpVersion, 200, "Successful");
|
||||
break;
|
||||
default:
|
||||
// We should be authenticated and further requests are permitted
|
||||
authorization = metadata.getHeader("Authorization");
|
||||
var authorization = metadata.getHeader("Authorization");
|
||||
Assert.isnull(authorization);
|
||||
response.setStatusLine(metadata.httpVersion, 200, "Successful");
|
||||
}
|
||||
|
@ -152,8 +150,6 @@ function successfulAuth(metadata, response) {
|
|||
|
||||
// web server responses simulating an unsuccessful web server auth
|
||||
function failedAuth(metadata, response) {
|
||||
let authorization;
|
||||
let authPrefix;
|
||||
switch (requestsMade) {
|
||||
case 0:
|
||||
// Web Server - First request return a 401 to start auth sequence
|
||||
|
@ -162,8 +158,8 @@ function failedAuth(metadata, response) {
|
|||
break;
|
||||
case 1:
|
||||
// Web Server - Expecting a type 1 negotiate message from the client
|
||||
authorization = metadata.getHeader("Authorization");
|
||||
authPrefix = authorization.substring(0, NTLM_PREFIX_LEN);
|
||||
var authorization = metadata.getHeader("Authorization");
|
||||
var authPrefix = authorization.substring(0, NTLM_PREFIX_LEN);
|
||||
Assert.equal(NTLM_TYPE1_PREFIX, authPrefix, "Expecting a Type 1 message");
|
||||
response.setStatusLine(metadata.httpVersion, 401, "Unauthorized");
|
||||
response.setHeader("WWW-Authenticate", NTLM_CHALLENGE, false);
|
||||
|
@ -171,8 +167,8 @@ function failedAuth(metadata, response) {
|
|||
case 2:
|
||||
// Web Server - Expecting a type 3 Authenticate message from the client
|
||||
// Respond with a 401 to restart the auth sequence.
|
||||
authorization = metadata.getHeader("Authorization");
|
||||
authPrefix = authorization.substring(0, NTLM_PREFIX_LEN);
|
||||
var authorization = metadata.getHeader("Authorization");
|
||||
var authPrefix = authorization.substring(0, NTLM_PREFIX_LEN);
|
||||
Assert.equal(NTLM_TYPE3_PREFIX, authPrefix, "Expecting a Type 1 message");
|
||||
response.setStatusLine(metadata.httpVersion, 401, "Unauthorized");
|
||||
break;
|
||||
|
|
|
@ -51,8 +51,7 @@ function makeChan(origin) {
|
|||
}).QueryInterface(Ci.nsIHttpChannel);
|
||||
}
|
||||
|
||||
// Avoid ESLint no-global-assign rules.
|
||||
/* global origin:true */
|
||||
let origin;
|
||||
var nextTest;
|
||||
var nextPortExpectedToBeSame = false;
|
||||
var currentPort = 0;
|
||||
|
|
|
@ -90,11 +90,10 @@ function serverHandler(metadata, response) {
|
|||
print("============== serverHandler: in");
|
||||
}
|
||||
|
||||
let etag;
|
||||
try {
|
||||
etag = metadata.getHeader("If-None-Match");
|
||||
var etag = metadata.getHeader("If-None-Match");
|
||||
} catch (ex) {
|
||||
etag = "";
|
||||
var etag = "";
|
||||
}
|
||||
if (etag == "testtag") {
|
||||
if (dbg) {
|
||||
|
|
|
@ -36,11 +36,11 @@ function contentHandler(metadata, response) {
|
|||
if (!metadata.hasHeader("If-Range")) {
|
||||
response.setHeader("Content-Length", responseBody.length + "");
|
||||
response.processAsync();
|
||||
let slice = responseBody.slice(0, 100);
|
||||
var slice = responseBody.slice(0, 100);
|
||||
response.bodyOutputStream.write(slice, slice.length);
|
||||
response.finish();
|
||||
} else {
|
||||
let slice = responseBody.slice(100);
|
||||
var slice = responseBody.slice(100);
|
||||
response.setStatusLine(metadata.httpVersion, 206, "Partial Content");
|
||||
response.setHeader(
|
||||
"Content-Range",
|
||||
|
|
|
@ -45,7 +45,7 @@ function run_test() {
|
|||
}
|
||||
|
||||
// put a few hosts in
|
||||
for (let i = 0; i < hosts.length; ++i) {
|
||||
for (var i = 0; i < hosts.length; ++i) {
|
||||
let uri = ioService.newURI(hosts[i][0]);
|
||||
let principal = secMan.createContentPrincipal(uri, {});
|
||||
|
||||
|
@ -53,7 +53,7 @@ function run_test() {
|
|||
}
|
||||
|
||||
// test the result
|
||||
for (let i = 0; i < results.length; ++i) {
|
||||
for (var i = 0; i < results.length; ++i) {
|
||||
let uri = ioService.newURI(results[i][0]);
|
||||
let principal = secMan.createContentPrincipal(uri, {});
|
||||
|
||||
|
@ -72,13 +72,13 @@ function run_test() {
|
|||
Assert.equal(perms.length, hosts.length);
|
||||
|
||||
// ... remove all the hosts ...
|
||||
for (let j = 0; j < perms.length; ++j) {
|
||||
for (var j = 0; j < perms.length; ++j) {
|
||||
pm.removePermission(perms[j]);
|
||||
}
|
||||
|
||||
// ... ensure each and every element is equal ...
|
||||
for (let i = 0; i < hosts.length; ++i) {
|
||||
for (let j = 0; j < perms.length; ++j) {
|
||||
for (var i = 0; i < hosts.length; ++i) {
|
||||
for (var j = 0; j < perms.length; ++j) {
|
||||
if (
|
||||
perms[j].matchesURI(ioService.newURI(hosts[i][0]), true) &&
|
||||
hosts[i][1] == perms[j].type &&
|
||||
|
|
|
@ -752,6 +752,7 @@ function host_filter_cb(proxy) {
|
|||
// Verify that hists in the host filter list are not proxied
|
||||
// refers to "network.proxy.no_proxies_on"
|
||||
|
||||
var uriStrUseProxyList;
|
||||
var uriStrUseProxyList;
|
||||
var hostFilterList;
|
||||
var uriStrFilterList;
|
||||
|
|
|
@ -25,11 +25,10 @@ function test_handler(metadata, response) {
|
|||
response.setHeader("Cache-Control", "no-cache");
|
||||
response.setHeader("ETag", "test-etag1");
|
||||
|
||||
let etag;
|
||||
try {
|
||||
etag = metadata.getHeader("If-None-Match");
|
||||
var etag = metadata.getHeader("If-None-Match");
|
||||
} catch (ex) {
|
||||
etag = "";
|
||||
var etag = "";
|
||||
}
|
||||
|
||||
if (etag == "test-etag1") {
|
||||
|
@ -106,7 +105,7 @@ function* testSteps() {
|
|||
});
|
||||
|
||||
// Initial request. Stores the response in the cache.
|
||||
let channel = make_channel("http://localhost:" + PORT + "/rcwn");
|
||||
var channel = make_channel("http://localhost:" + PORT + "/rcwn");
|
||||
channel.asyncOpen(new ChannelListener(checkContent, null));
|
||||
yield undefined;
|
||||
equal(gResponseCounter, 1);
|
||||
|
@ -114,7 +113,7 @@ function* testSteps() {
|
|||
equal(g304Counter, 0, "check number of 304 responses");
|
||||
|
||||
// Checks that response is returned from the cache, after a 304 response.
|
||||
channel = make_channel("http://localhost:" + PORT + "/rcwn");
|
||||
var channel = make_channel("http://localhost:" + PORT + "/rcwn");
|
||||
channel.asyncOpen(new ChannelListener(checkContent, null));
|
||||
yield undefined;
|
||||
equal(gResponseCounter, 2);
|
||||
|
@ -122,7 +121,7 @@ function* testSteps() {
|
|||
equal(g304Counter, 1, "check number of 304 responses");
|
||||
|
||||
// Checks that delaying the response from the cache works.
|
||||
channel = make_channel("http://localhost:" + PORT + "/rcwn");
|
||||
var channel = make_channel("http://localhost:" + PORT + "/rcwn");
|
||||
channel
|
||||
.QueryInterface(Ci.nsIRaceCacheWithNetwork)
|
||||
.test_delayCacheEntryOpeningBy(200);
|
||||
|
@ -139,7 +138,7 @@ function* testSteps() {
|
|||
equal(g304Counter, 2, "check number of 304 responses");
|
||||
|
||||
// Checks that we can trigger the cache open immediately, even if the cache delay is set very high.
|
||||
channel = make_channel("http://localhost:" + PORT + "/rcwn");
|
||||
var channel = make_channel("http://localhost:" + PORT + "/rcwn");
|
||||
channel
|
||||
.QueryInterface(Ci.nsIRaceCacheWithNetwork)
|
||||
.test_delayCacheEntryOpeningBy(100000);
|
||||
|
@ -155,7 +154,7 @@ function* testSteps() {
|
|||
equal(g304Counter, 3, "check number of 304 responses");
|
||||
|
||||
// Sets a high delay for the cache fetch, and triggers the network activity.
|
||||
channel = make_channel("http://localhost:" + PORT + "/rcwn");
|
||||
var channel = make_channel("http://localhost:" + PORT + "/rcwn");
|
||||
channel
|
||||
.QueryInterface(Ci.nsIRaceCacheWithNetwork)
|
||||
.test_delayCacheEntryOpeningBy(100000);
|
||||
|
@ -170,7 +169,7 @@ function* testSteps() {
|
|||
// Sets a high delay for the cache fetch, and triggers the network activity.
|
||||
// While the network response is produced, we trigger the cache fetch.
|
||||
// Because the network response was the first, a non-conditional request is sent.
|
||||
channel = make_channel("http://localhost:" + PORT + "/rcwn");
|
||||
var channel = make_channel("http://localhost:" + PORT + "/rcwn");
|
||||
channel
|
||||
.QueryInterface(Ci.nsIRaceCacheWithNetwork)
|
||||
.test_delayCacheEntryOpeningBy(100000);
|
||||
|
@ -189,7 +188,7 @@ function* testSteps() {
|
|||
equal(g304Counter, 3, "check number of 304 responses");
|
||||
|
||||
// Triggers cache open before triggering network.
|
||||
channel = make_channel("http://localhost:" + PORT + "/rcwn");
|
||||
var channel = make_channel("http://localhost:" + PORT + "/rcwn");
|
||||
channel
|
||||
.QueryInterface(Ci.nsIRaceCacheWithNetwork)
|
||||
.test_delayCacheEntryOpeningBy(100000);
|
||||
|
@ -206,7 +205,7 @@ function* testSteps() {
|
|||
equal(g304Counter, 4, "check number of 304 responses");
|
||||
|
||||
// Load the cached handler so we don't need to revalidate
|
||||
channel = make_channel("http://localhost:" + PORT + "/rcwn_cached");
|
||||
var channel = make_channel("http://localhost:" + PORT + "/rcwn_cached");
|
||||
channel.asyncOpen(new ChannelListener(checkContent, null));
|
||||
yield undefined;
|
||||
equal(gResponseCounter, 8);
|
||||
|
@ -214,7 +213,7 @@ function* testSteps() {
|
|||
equal(g304Counter, 4, "check number of 304 responses");
|
||||
|
||||
// Make sure response is loaded from the cache, not the network
|
||||
channel = make_channel("http://localhost:" + PORT + "/rcwn_cached");
|
||||
var channel = make_channel("http://localhost:" + PORT + "/rcwn_cached");
|
||||
channel.asyncOpen(new ChannelListener(checkContent, null));
|
||||
yield undefined;
|
||||
equal(gResponseCounter, 9);
|
||||
|
@ -223,7 +222,7 @@ function* testSteps() {
|
|||
|
||||
// Cache times out, so we trigger the network
|
||||
gIsFromCache = 0;
|
||||
channel = make_channel("http://localhost:" + PORT + "/rcwn_cached");
|
||||
var channel = make_channel("http://localhost:" + PORT + "/rcwn_cached");
|
||||
channel
|
||||
.QueryInterface(Ci.nsIRaceCacheWithNetwork)
|
||||
.test_delayCacheEntryOpeningBy(100000);
|
||||
|
@ -237,7 +236,7 @@ function* testSteps() {
|
|||
equal(g304Counter, 4, "check number of 304 responses");
|
||||
|
||||
// Cache callback comes back right after network is triggered.
|
||||
channel = make_channel("http://localhost:" + PORT + "/rcwn_cached");
|
||||
var channel = make_channel("http://localhost:" + PORT + "/rcwn_cached");
|
||||
channel
|
||||
.QueryInterface(Ci.nsIRaceCacheWithNetwork)
|
||||
.test_delayCacheEntryOpeningBy(100000);
|
||||
|
@ -259,7 +258,7 @@ function* testSteps() {
|
|||
// and some we will get from the cache.
|
||||
gIsFromCache = 0;
|
||||
for (var i = 0; i < 50; i++) {
|
||||
channel = make_channel("http://localhost:" + PORT + "/rcwn_cached");
|
||||
var channel = make_channel("http://localhost:" + PORT + "/rcwn_cached");
|
||||
channel
|
||||
.QueryInterface(Ci.nsIRaceCacheWithNetwork)
|
||||
.test_delayCacheEntryOpeningBy(100000);
|
||||
|
|
|
@ -492,35 +492,35 @@ function run_test() {
|
|||
evict_cache_entries();
|
||||
|
||||
// Case 2: zero-length partial entry must not trigger range-request
|
||||
let chan = make_channel("http://localhost:" + port + "/test_2");
|
||||
var chan = make_channel("http://localhost:" + port + "/test_2");
|
||||
chan.asyncOpen(new Canceler(received_partial_2));
|
||||
|
||||
// Case 3: no-store response must not trigger range-request
|
||||
chan = make_channel("http://localhost:" + port + "/test_3");
|
||||
var chan = make_channel("http://localhost:" + port + "/test_3");
|
||||
chan.asyncOpen(new MyListener(received_partial_3));
|
||||
|
||||
// Case 4: response with content-encoding must not trigger range-request
|
||||
chan = make_channel("http://localhost:" + port + "/test_4");
|
||||
var chan = make_channel("http://localhost:" + port + "/test_4");
|
||||
chan.asyncOpen(new MyListener(received_partial_4));
|
||||
|
||||
// Case 5: conditional request-header set by client
|
||||
chan = make_channel("http://localhost:" + port + "/test_5");
|
||||
var chan = make_channel("http://localhost:" + port + "/test_5");
|
||||
chan.asyncOpen(new MyListener(received_partial_5));
|
||||
|
||||
// Case 6: response is not resumable (drop the Accept-Ranges header)
|
||||
chan = make_channel("http://localhost:" + port + "/test_6");
|
||||
var chan = make_channel("http://localhost:" + port + "/test_6");
|
||||
chan.asyncOpen(new MyListener(received_partial_6));
|
||||
|
||||
// Case 7: a basic positive test
|
||||
chan = make_channel("http://localhost:" + port + "/test_7");
|
||||
var chan = make_channel("http://localhost:" + port + "/test_7");
|
||||
chan.asyncOpen(new MyListener(received_partial_7));
|
||||
|
||||
// Case 8: check that mismatched 206 and 200 sizes throw error
|
||||
chan = make_channel("http://localhost:" + port + "/test_8");
|
||||
var chan = make_channel("http://localhost:" + port + "/test_8");
|
||||
chan.asyncOpen(new MyListener(received_partial_8));
|
||||
|
||||
// Case 9: check that weak etag is not used for a range request
|
||||
chan = make_channel("http://localhost:" + port + "/test_9");
|
||||
var chan = make_channel("http://localhost:" + port + "/test_9");
|
||||
chan.asyncOpen(new MyListener(received_partial_9));
|
||||
|
||||
do_test_pending();
|
||||
|
|
|
@ -87,14 +87,14 @@ function run_test() {
|
|||
let testGenerator = testSteps();
|
||||
function* testSteps() {
|
||||
// Store first version of the content in the cache.
|
||||
let channel = make_channel("http://localhost:" + PORT + "/rcwn");
|
||||
var channel = make_channel("http://localhost:" + PORT + "/rcwn");
|
||||
channel.asyncOpen(new ChannelListener(checkContent, null));
|
||||
yield undefined;
|
||||
equal(gRequestCounter, 1);
|
||||
|
||||
// Simulate the network victory by setting high delay for the cache fetch and
|
||||
// triggering the network.
|
||||
channel = make_channel("http://localhost:" + PORT + "/rcwn");
|
||||
var channel = make_channel("http://localhost:" + PORT + "/rcwn");
|
||||
channel
|
||||
.QueryInterface(Ci.nsIRaceCacheWithNetwork)
|
||||
.test_delayCacheEntryOpeningBy(100000);
|
||||
|
@ -105,7 +105,7 @@ function* testSteps() {
|
|||
equal(gRequestCounter, 2);
|
||||
|
||||
// Simulate navigation back by specifying VALIDATE_NEVER flag.
|
||||
channel = make_channel("http://localhost:" + PORT + "/rcwn");
|
||||
var channel = make_channel("http://localhost:" + PORT + "/rcwn");
|
||||
channel.loadFlags = Ci.nsIRequest.VALIDATE_NEVER;
|
||||
channel.asyncOpen(new ChannelListener(checkContent, null));
|
||||
yield undefined;
|
||||
|
|
|
@ -33,7 +33,7 @@ AuthPrompt2.prototype = {
|
|||
},
|
||||
|
||||
asyncPromptAuth: function ap2_async(chan, cb, ctx, lvl, info) {
|
||||
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
|
||||
throw 0x80004001;
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
@ -41,11 +41,11 @@ function runScriptSubprocess(script, args) {
|
|||
do_throw("Can't find xpcshell binary");
|
||||
}
|
||||
|
||||
var file = do_get_file(script);
|
||||
var script = do_get_file(script);
|
||||
var proc = new Process(bin);
|
||||
var procArgs = [file.path].concat(args);
|
||||
var args = [script.path].concat(args);
|
||||
|
||||
proc.run(false, procArgs, procArgs.length);
|
||||
proc.run(false, args, args.length);
|
||||
|
||||
return proc;
|
||||
}
|
||||
|
@ -399,7 +399,6 @@ SocksTestServer.prototype = {
|
|||
}
|
||||
}
|
||||
do_throw("No test case with id " + id);
|
||||
return null;
|
||||
},
|
||||
|
||||
testCompleted(client) {
|
||||
|
|
|
@ -604,7 +604,7 @@ add_test(function test_hugeStringThrows() {
|
|||
});
|
||||
|
||||
add_test(function test_filterWhitespace() {
|
||||
let url = stringToURL(
|
||||
var url = stringToURL(
|
||||
" \r\n\th\nt\rt\tp://ex\r\n\tample.com/path\r\n\t/\r\n\tto the/fil\r\n\te.e\r\n\txt?que\r\n\try#ha\r\n\tsh \r\n\t "
|
||||
);
|
||||
Assert.equal(
|
||||
|
@ -613,7 +613,7 @@ add_test(function test_filterWhitespace() {
|
|||
);
|
||||
|
||||
// These setters should escape \r\n\t, not filter them.
|
||||
url = stringToURL("http://test.com/path?query#hash");
|
||||
var url = stringToURL("http://test.com/path?query#hash");
|
||||
url = url
|
||||
.mutate()
|
||||
.setFilePath("pa\r\n\tth")
|
||||
|
@ -722,7 +722,7 @@ add_test(function test_encode_C0_and_space() {
|
|||
) {
|
||||
continue;
|
||||
}
|
||||
let url = stringToURL(
|
||||
var url = stringToURL(
|
||||
"http://example.com/pa" +
|
||||
String.fromCharCode(i) +
|
||||
"th?qu" +
|
||||
|
@ -744,7 +744,7 @@ add_test(function test_encode_C0_and_space() {
|
|||
}
|
||||
|
||||
// Additionally, we need to check the setters.
|
||||
let url = stringToURL("http://example.com/path?query#hash");
|
||||
var url = stringToURL("http://example.com/path?query#hash");
|
||||
url = url
|
||||
.mutate()
|
||||
.setFilePath("pa\0th")
|
||||
|
@ -790,7 +790,7 @@ add_test(function test_ipv4Normalize() {
|
|||
"http://127.0.0.1.",
|
||||
].map(stringToURL);
|
||||
|
||||
let url;
|
||||
var url;
|
||||
for (url of localIPv4s) {
|
||||
Assert.equal(url.spec, "http://127.0.0.1/");
|
||||
}
|
||||
|
@ -821,7 +821,7 @@ add_test(function test_ipv4Normalize() {
|
|||
Assert.equal(url.spec, spec);
|
||||
}
|
||||
|
||||
url = stringToURL("resource://path/to/resource/");
|
||||
var url = stringToURL("resource://path/to/resource/");
|
||||
url = url
|
||||
.mutate()
|
||||
.setHost("123")
|
||||
|
|
|
@ -74,7 +74,7 @@ requestListenerObserver.prototype = {
|
|||
subject instanceof Ci.nsIHttpChannel
|
||||
) {
|
||||
if (this.suspendOnBeforeConnect) {
|
||||
let chan = subject.QueryInterface(Ci.nsIHttpChannel);
|
||||
var chan = subject.QueryInterface(Ci.nsIHttpChannel);
|
||||
executeSoon(() => {
|
||||
this.resumeOnBeforeConnect = true;
|
||||
chan.resume();
|
||||
|
@ -87,7 +87,7 @@ requestListenerObserver.prototype = {
|
|||
subject instanceof Ci.nsIHttpChannel
|
||||
) {
|
||||
if (this.suspendOnModifyRequest) {
|
||||
let chan = subject.QueryInterface(Ci.nsIHttpChannel);
|
||||
var chan = subject.QueryInterface(Ci.nsIHttpChannel);
|
||||
executeSoon(() => {
|
||||
this.resumeOnModifyRequest = true;
|
||||
chan.resume();
|
||||
|
|
|
@ -276,7 +276,7 @@ add_test(function() {
|
|||
// network request.
|
||||
add_test(function() {
|
||||
var chan = make_channel(URL + "/body", null, function(chan) {
|
||||
throw new Error("boom");
|
||||
throw "boom";
|
||||
});
|
||||
chan.asyncOpen(new ChannelListener(handle_remote_response, null));
|
||||
});
|
||||
|
|
|
@ -92,7 +92,6 @@ class EventSinkListener {
|
|||
if (iid.equals(Ci.nsIChannelEventSink)) {
|
||||
return this;
|
||||
}
|
||||
throw Components.Exception("", Cr.NS_ERROR_NO_INTERFACE);
|
||||
}
|
||||
asyncOnChannelRedirect(oldChan, newChan, flags, callback) {
|
||||
Assert.equal(oldChan.URI.hostPort, newChan.URI.hostPort);
|
||||
|
|
|
@ -10,10 +10,10 @@ function inChildProcess() {
|
|||
);
|
||||
}
|
||||
|
||||
let uri = null;
|
||||
let URL = null;
|
||||
function makeChan() {
|
||||
return NetUtil.newChannel({
|
||||
uri,
|
||||
uri: URL,
|
||||
loadUsingSystemPrincipal: true,
|
||||
}).QueryInterface(Ci.nsIHttpChannel);
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ add_task(async function setup() {
|
|||
ok(inChildProcess(), "Sanity check. This should run in the child process");
|
||||
// Initialize the URL. Parent runs the server
|
||||
do_send_remote_message("start-test");
|
||||
uri = await do_await_remote_message("start-test-done");
|
||||
URL = await do_await_remote_message("start-test-done");
|
||||
});
|
||||
|
||||
// This test performs a request, and checks that no cookie header are visible
|
||||
|
|
|
@ -7,7 +7,7 @@ var cacheFlushObserver = {
|
|||
};
|
||||
|
||||
// We get this from the child a bit later
|
||||
var url = null;
|
||||
var URL = null;
|
||||
|
||||
// needs to be rooted
|
||||
var cacheFlushObserver2 = {
|
||||
|
@ -32,20 +32,17 @@ function run_test() {
|
|||
run_test_in_child("../unit/test_alt-data_cross_process.js");
|
||||
}
|
||||
|
||||
function load_channel(channelUrl) {
|
||||
ok(channelUrl);
|
||||
url = channelUrl; // save this to open the alt data channel later
|
||||
var chan = make_channel(channelUrl);
|
||||
function load_channel(url) {
|
||||
ok(url);
|
||||
URL = url; // save this to open the alt data channel later
|
||||
var chan = make_channel(url);
|
||||
var cc = chan.QueryInterface(Ci.nsICacheInfoChannel);
|
||||
cc.preferAlternativeDataType("text/binary", "", Ci.nsICacheInfoChannel.ASYNC);
|
||||
chan.asyncOpen(new ChannelListener(readTextData, null));
|
||||
}
|
||||
|
||||
function make_channel(channelUrl, callback, ctx) {
|
||||
return NetUtil.newChannel({
|
||||
uri: channelUrl,
|
||||
loadUsingSystemPrincipal: true,
|
||||
});
|
||||
function make_channel(url, callback, ctx) {
|
||||
return NetUtil.newChannel({ uri: url, loadUsingSystemPrincipal: true });
|
||||
}
|
||||
|
||||
function readTextData(request, buffer) {
|
||||
|
@ -74,7 +71,7 @@ function readTextData(request, buffer) {
|
|||
}
|
||||
|
||||
function openAltChannel() {
|
||||
var chan = make_channel(url);
|
||||
var chan = make_channel(URL);
|
||||
var cc = chan.QueryInterface(Ci.nsICacheInfoChannel);
|
||||
cc.preferAlternativeDataType(
|
||||
"text/parent-binary",
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
/* globals HttpServer */
|
||||
const { HttpServer } = ChromeUtils.import("resource://testing-common/httpd.js");
|
||||
|
||||
let httpserver;
|
||||
|
|
Загрузка…
Ссылка в новой задаче