Bug 1656295 - Enable ESLint rule no-unused-vars for all of netwerk/. r=necko-reviewers,dragana

Patch by joaovanzuita, updated by Standard8.

Differential Revision: https://phabricator.services.mozilla.com/D92333
This commit is contained in:
joaovanzuita 2021-01-12 13:39:11 +00:00
parent f005165f1b
commit e740ed7de3
71 changed files with 177 additions and 247 deletions

View file

@ -172,7 +172,6 @@ module.exports = {
"no-redeclare": "off", "no-redeclare": "off",
"no-shadow": "off", "no-shadow": "off",
"no-throw-literal": "off", "no-throw-literal": "off",
"no-unused-vars": "off",
}, },
}, },
{ {

View file

@ -266,14 +266,14 @@ add_task(async function() {
}); });
add_task(async function() { add_task(async function() {
var [hasUploadStream, postData] = await loadTestTab(NORMAL_FORM_URI); var [hasUploadStream] = await loadTestTab(NORMAL_FORM_URI);
is(hasUploadStream, "no", "normal action should not have uploadStream"); is(hasUploadStream, "no", "normal action should not have uploadStream");
gBrowser.removeCurrentTab(); gBrowser.removeCurrentTab();
}); });
add_task(async function() { add_task(async function() {
var [hasUploadStream, postData] = await loadTestTab(UPLOAD_FORM_URI); var [hasUploadStream] = await loadTestTab(UPLOAD_FORM_URI);
is(hasUploadStream, "no", "upload action should not have uploadStream"); is(hasUploadStream, "no", "upload action should not have uploadStream");
gBrowser.removeCurrentTab(); gBrowser.removeCurrentTab();

View file

@ -5,10 +5,7 @@
let cs = Cc["@mozilla.org/cookiemanager;1"].getService(Ci.nsICookieManager); let cs = Cc["@mozilla.org/cookiemanager;1"].getService(Ci.nsICookieManager);
addMessageListener("getCookieCountAndClear", () => { addMessageListener("getCookieCountAndClear", () => {
let count = 0; let count = cs.cookies.length;
for (let cookie of cs.cookies) {
++count;
}
cs.removeAll(); cs.removeAll();
sendAsyncMessage("getCookieCountAndClear:return", { count }); sendAsyncMessage("getCookieCountAndClear:return", { count });

View file

@ -21,7 +21,7 @@ function test()
ta[0] = 'a'.charCodeAt(0); ta[0] = 'a'.charCodeAt(0);
ta[1] = 'b'.charCodeAt(0); ta[1] = 'b'.charCodeAt(0);
const Cc = SpecialPowers.Cc, Ci = SpecialPowers.Ci, Cr = SpecialPowers.Cr; const Cc = SpecialPowers.Cc, Ci = SpecialPowers.Ci;
var abis = Cc["@mozilla.org/io/arraybuffer-input-stream;1"] var abis = Cc["@mozilla.org/io/arraybuffer-input-stream;1"]
.createInstance(Ci.nsIArrayBufferInputStream); .createInstance(Ci.nsIArrayBufferInputStream);

View file

@ -249,9 +249,6 @@ OpenCallback.prototype = {
this.goon(entry, true); this.goon(entry, true);
} }
var wrapper = Cc["@mozilla.org/scriptableinputstream;1"].createInstance(
Ci.nsIScriptableInputStream
);
var self = this; var self = this;
pumpReadStream(entry.openInputStream(0), function(data) { pumpReadStream(entry.openInputStream(0), function(data) {
Assert.equal(data, self.workingData); Assert.equal(data, self.workingData);

View file

@ -96,7 +96,7 @@ _observer.prototype = {
// once the close is complete. // once the close is complete.
function do_close_profile(generator) { function do_close_profile(generator) {
// Register an observer for db close. // Register an observer for db close.
let obs = new _observer(generator, "cookie-db-closed"); new _observer(generator, "cookie-db-closed");
// Close the db. // Close the db.
let service = Services.cookies.QueryInterface(Ci.nsIObserver); let service = Services.cookies.QueryInterface(Ci.nsIObserver);
@ -152,7 +152,7 @@ function promise_load_profile() {
// once the load is complete. // once the load is complete.
function do_load_profile(generator) { function do_load_profile(generator) {
// Register an observer for read completion. // Register an observer for read completion.
let obs = new _observer(generator, "cookie-db-read"); new _observer(generator, "cookie-db-read");
// Load the profile. // Load the profile.
let service = Services.cookies.QueryInterface(Ci.nsIObserver); let service = Services.cookies.QueryInterface(Ci.nsIObserver);

View file

@ -52,7 +52,7 @@ function write_data() {
function open_big_altdata_output(entry) { function open_big_altdata_output(entry) {
try { try {
var os = entry.openAlternativeOutputStream("text/binary", altData.length); entry.openAlternativeOutputStream("text/binary", altData.length);
} catch (e) { } catch (e) {
Assert.equal(e.result, Cr.NS_ERROR_FILE_TOO_BIG); Assert.equal(e.result, Cr.NS_ERROR_FILE_TOO_BIG);
} }

View file

@ -616,7 +616,6 @@ add_task(async function test_enableAppend_hash() {
add_task(async function test_finish_only() { add_task(async function test_finish_only() {
// This test checks creating the object and doing nothing. // This test checks creating the object and doing nothing.
let destFile = getTempFile(TEST_FILE_NAME_1);
let saver = new BackgroundFileSaverOutputStream(); let saver = new BackgroundFileSaverOutputStream();
function onTargetChange(aTarget) { function onTargetChange(aTarget) {
do_throw("Should not receive the onTargetChange notification."); do_throw("Should not receive the onTargetChange notification.");
@ -680,7 +679,7 @@ add_task(async function test_invalid_hash() {
let completionPromise = promiseSaverComplete(saver); let completionPromise = promiseSaverComplete(saver);
// We shouldn't be able to get the hash if hashing hasn't been enabled // We shouldn't be able to get the hash if hashing hasn't been enabled
try { try {
let hash = saver.sha256Hash; saver.sha256Hash;
do_throw("Shouldn't be able to get hash if hashing not enabled"); do_throw("Shouldn't be able to get hash if hashing not enabled");
} catch (ex) { } catch (ex) {
if (ex.result != Cr.NS_ERROR_NOT_AVAILABLE) { if (ex.result != Cr.NS_ERROR_NOT_AVAILABLE) {
@ -697,7 +696,7 @@ add_task(async function test_invalid_hash() {
// successfully. // successfully.
saver.finish(Cr.NS_ERROR_FAILURE); saver.finish(Cr.NS_ERROR_FAILURE);
try { try {
let hash = saver.sha256Hash; saver.sha256Hash;
do_throw("Shouldn't be able to get hash if save did not succeed"); do_throw("Shouldn't be able to get hash if save did not succeed");
} catch (ex) { } catch (ex) {
if (ex.result != Cr.NS_ERROR_NOT_AVAILABLE) { if (ex.result != Cr.NS_ERROR_NOT_AVAILABLE) {
@ -724,7 +723,7 @@ add_task(async function test_signature() {
let completionPromise = promiseSaverComplete(saver); let completionPromise = promiseSaverComplete(saver);
try { try {
let signatureInfo = saver.signatureInfo; saver.signatureInfo;
do_throw("Can't get signature if saver is not complete"); do_throw("Can't get signature if saver is not complete");
} catch (ex) { } catch (ex) {
if (ex.result != Cr.NS_ERROR_NOT_AVAILABLE) { if (ex.result != Cr.NS_ERROR_NOT_AVAILABLE) {
@ -759,7 +758,7 @@ add_task(async function test_signature_not_enabled() {
saver.finish(Cr.NS_OK); saver.finish(Cr.NS_OK);
await completionPromise; await completionPromise;
try { try {
let signatureInfo = saver.signatureInfo; saver.signatureInfo;
do_throw("Can't get signature if not enabled"); do_throw("Can't get signature if not enabled");
} catch (ex) { } catch (ex) {
if (ex.result != Cr.NS_ERROR_NOT_AVAILABLE) { if (ex.result != Cr.NS_ERROR_NOT_AVAILABLE) {

View file

@ -27,7 +27,7 @@ add_task(async function test() {
); );
let chan = NetUtil.newChannel({ uri: URL, loadUsingSystemPrincipal: true }); let chan = NetUtil.newChannel({ uri: URL, loadUsingSystemPrincipal: true });
let [req, buff] = await new Promise(resolve => { let [, buff] = await new Promise(resolve => {
chan.asyncOpen( chan.asyncOpen(
new ChannelListener( new ChannelListener(
(req, buff) => { (req, buff) => {

View file

@ -91,7 +91,6 @@ function setup_http_server() {
"network.http.max-persistent-connections-per-server" "network.http.max-persistent-connections-per-server"
); );
var allDummyHttpRequestReceived = false;
// Start server; will be stopped at test cleanup time. // Start server; will be stopped at test cleanup time.
server.registerPathHandler("/", function(metadata, response) { server.registerPathHandler("/", function(metadata, response) {
var id = metadata.getHeader("X-ID"); var id = metadata.getHeader("X-ID");

View file

@ -48,7 +48,7 @@ function contentHandler(metadata, response) {
Assert.throws( Assert.throws(
() => { () => {
var etag = metadata.getHeader("If-None-Match"); metadata.getHeader("If-None-Match");
}, },
/NS_ERROR_NOT_AVAILABLE/, /NS_ERROR_NOT_AVAILABLE/,
"conditional request not expected" "conditional request not expected"

View file

@ -36,15 +36,13 @@ function set_private_cookie(value, callback) {
} }
function check_cookie_presence(value, isPrivate, expected, callback) { function check_cookie_presence(value, isPrivate, expected, callback) {
var chan = setup_chan( setup_chan("present?cookie=" + value.replace("=", "|"), isPrivate, function(
"present?cookie=" + value.replace("=", "|"), req
isPrivate, ) {
function(req) { req.QueryInterface(Ci.nsIHttpChannel);
req.QueryInterface(Ci.nsIHttpChannel); Assert.equal(req.responseStatus, expected ? 200 : 404);
Assert.equal(req.responseStatus, expected ? 200 : 404); callback(req);
callback(req); });
}
);
} }
function presentHandler(metadata, response) { function presentHandler(metadata, response) {

View file

@ -22,7 +22,7 @@ function run_test() {
success = false; success = false;
try { try {
newURI = newURI newURI
.mutate() .mutate()
.setHost(" foo.com") .setHost(" foo.com")
.finalize(); .finalize();

View file

@ -30,8 +30,6 @@ var uri = NetUtil.newURI("http://www.example.com");
var principal = Services.scriptSecurityManager.createContentPrincipal(uri, {}); var principal = Services.scriptSecurityManager.createContentPrincipal(uri, {});
function get_channel(spec) { function get_channel(spec) {
var channelURI = NetUtil.newURI(spec);
var channel = NetUtil.newChannel({ var channel = NetUtil.newChannel({
uri: NetUtil.newURI(spec), uri: NetUtil.newURI(spec),
loadingPrincipal: principal, loadingPrincipal: principal,

View file

@ -4,9 +4,6 @@ function run_test() {
var tld = Cc["@mozilla.org/network/effective-tld-service;1"].getService( var tld = Cc["@mozilla.org/network/effective-tld-service;1"].getService(
Ci.nsIEffectiveTLDService Ci.nsIEffectiveTLDService
); );
var etld;
Assert.equal(tld.getPublicSuffixFromHost("localhost"), "localhost"); Assert.equal(tld.getPublicSuffixFromHost("localhost"), "localhost");
Assert.equal(tld.getPublicSuffixFromHost("localhost."), "localhost."); Assert.equal(tld.getPublicSuffixFromHost("localhost."), "localhost.");
Assert.equal(tld.getPublicSuffixFromHost("domain.com"), "com"); Assert.equal(tld.getPublicSuffixFromHost("domain.com"), "com");
@ -18,63 +15,63 @@ function run_test() {
Assert.equal(tld.getBaseDomainFromHost("domain.co.uk."), "domain.co.uk."); Assert.equal(tld.getBaseDomainFromHost("domain.co.uk."), "domain.co.uk.");
try { try {
etld = tld.getPublicSuffixFromHost(""); tld.getPublicSuffixFromHost("");
do_throw("this should fail"); do_throw("this should fail");
} catch (e) { } catch (e) {
Assert.equal(e.result, Cr.NS_ERROR_INSUFFICIENT_DOMAIN_LEVELS); Assert.equal(e.result, Cr.NS_ERROR_INSUFFICIENT_DOMAIN_LEVELS);
} }
try { try {
etld = tld.getBaseDomainFromHost("domain.co.uk", 1); tld.getBaseDomainFromHost("domain.co.uk", 1);
do_throw("this should fail"); do_throw("this should fail");
} catch (e) { } catch (e) {
Assert.equal(e.result, Cr.NS_ERROR_INSUFFICIENT_DOMAIN_LEVELS); Assert.equal(e.result, Cr.NS_ERROR_INSUFFICIENT_DOMAIN_LEVELS);
} }
try { try {
etld = tld.getBaseDomainFromHost("co.uk"); tld.getBaseDomainFromHost("co.uk");
do_throw("this should fail"); do_throw("this should fail");
} catch (e) { } catch (e) {
Assert.equal(e.result, Cr.NS_ERROR_INSUFFICIENT_DOMAIN_LEVELS); Assert.equal(e.result, Cr.NS_ERROR_INSUFFICIENT_DOMAIN_LEVELS);
} }
try { try {
etld = tld.getBaseDomainFromHost(""); tld.getBaseDomainFromHost("");
do_throw("this should fail"); do_throw("this should fail");
} catch (e) { } catch (e) {
Assert.equal(e.result, Cr.NS_ERROR_INSUFFICIENT_DOMAIN_LEVELS); Assert.equal(e.result, Cr.NS_ERROR_INSUFFICIENT_DOMAIN_LEVELS);
} }
try { try {
etld = tld.getPublicSuffixFromHost("1.2.3.4"); tld.getPublicSuffixFromHost("1.2.3.4");
do_throw("this should fail"); do_throw("this should fail");
} catch (e) { } catch (e) {
Assert.equal(e.result, Cr.NS_ERROR_HOST_IS_IP_ADDRESS); Assert.equal(e.result, Cr.NS_ERROR_HOST_IS_IP_ADDRESS);
} }
try { try {
etld = tld.getPublicSuffixFromHost("2010:836B:4179::836B:4179"); tld.getPublicSuffixFromHost("2010:836B:4179::836B:4179");
do_throw("this should fail"); do_throw("this should fail");
} catch (e) { } catch (e) {
Assert.equal(e.result, Cr.NS_ERROR_HOST_IS_IP_ADDRESS); Assert.equal(e.result, Cr.NS_ERROR_HOST_IS_IP_ADDRESS);
} }
try { try {
etld = tld.getPublicSuffixFromHost("3232235878"); tld.getPublicSuffixFromHost("3232235878");
do_throw("this should fail"); do_throw("this should fail");
} catch (e) { } catch (e) {
Assert.equal(e.result, Cr.NS_ERROR_HOST_IS_IP_ADDRESS); Assert.equal(e.result, Cr.NS_ERROR_HOST_IS_IP_ADDRESS);
} }
try { try {
etld = tld.getPublicSuffixFromHost("::ffff:192.9.5.5"); tld.getPublicSuffixFromHost("::ffff:192.9.5.5");
do_throw("this should fail"); do_throw("this should fail");
} catch (e) { } catch (e) {
Assert.equal(e.result, Cr.NS_ERROR_HOST_IS_IP_ADDRESS); Assert.equal(e.result, Cr.NS_ERROR_HOST_IS_IP_ADDRESS);
} }
try { try {
etld = tld.getPublicSuffixFromHost("::1"); tld.getPublicSuffixFromHost("::1");
do_throw("this should fail"); do_throw("this should fail");
} catch (e) { } catch (e) {
Assert.equal(e.result, Cr.NS_ERROR_HOST_IS_IP_ADDRESS); Assert.equal(e.result, Cr.NS_ERROR_HOST_IS_IP_ADDRESS);
@ -83,14 +80,14 @@ function run_test() {
// Check IP addresses with trailing dot as well, Necko sometimes accepts // Check IP addresses with trailing dot as well, Necko sometimes accepts
// those (depending on operating system, see bug 380543) // those (depending on operating system, see bug 380543)
try { try {
etld = tld.getPublicSuffixFromHost("127.0.0.1."); tld.getPublicSuffixFromHost("127.0.0.1.");
do_throw("this should fail"); do_throw("this should fail");
} catch (e) { } catch (e) {
Assert.equal(e.result, Cr.NS_ERROR_HOST_IS_IP_ADDRESS); Assert.equal(e.result, Cr.NS_ERROR_HOST_IS_IP_ADDRESS);
} }
try { try {
etld = tld.getPublicSuffixFromHost("::ffff:127.0.0.1."); tld.getPublicSuffixFromHost("::ffff:127.0.0.1.");
do_throw("this should fail"); do_throw("this should fail");
} catch (e) { } catch (e) {
Assert.equal(e.result, Cr.NS_ERROR_HOST_IS_IP_ADDRESS); Assert.equal(e.result, Cr.NS_ERROR_HOST_IS_IP_ADDRESS);
@ -113,42 +110,42 @@ function run_test() {
// check that malformed hosts are rejected as invalid args // check that malformed hosts are rejected as invalid args
try { try {
etld = tld.getBaseDomainFromHost("domain.co.uk.."); tld.getBaseDomainFromHost("domain.co.uk..");
do_throw("this should fail"); do_throw("this should fail");
} catch (e) { } catch (e) {
Assert.equal(e.result, Cr.NS_ERROR_ILLEGAL_VALUE); Assert.equal(e.result, Cr.NS_ERROR_ILLEGAL_VALUE);
} }
try { try {
etld = tld.getBaseDomainFromHost("domain.co..uk"); tld.getBaseDomainFromHost("domain.co..uk");
do_throw("this should fail"); do_throw("this should fail");
} catch (e) { } catch (e) {
Assert.equal(e.result, Cr.NS_ERROR_ILLEGAL_VALUE); Assert.equal(e.result, Cr.NS_ERROR_ILLEGAL_VALUE);
} }
try { try {
etld = tld.getBaseDomainFromHost(".domain.co.uk"); tld.getBaseDomainFromHost(".domain.co.uk");
do_throw("this should fail"); do_throw("this should fail");
} catch (e) { } catch (e) {
Assert.equal(e.result, Cr.NS_ERROR_ILLEGAL_VALUE); Assert.equal(e.result, Cr.NS_ERROR_ILLEGAL_VALUE);
} }
try { try {
etld = tld.getBaseDomainFromHost(".domain.co.uk"); tld.getBaseDomainFromHost(".domain.co.uk");
do_throw("this should fail"); do_throw("this should fail");
} catch (e) { } catch (e) {
Assert.equal(e.result, Cr.NS_ERROR_ILLEGAL_VALUE); Assert.equal(e.result, Cr.NS_ERROR_ILLEGAL_VALUE);
} }
try { try {
etld = tld.getBaseDomainFromHost("."); tld.getBaseDomainFromHost(".");
do_throw("this should fail"); do_throw("this should fail");
} catch (e) { } catch (e) {
Assert.equal(e.result, Cr.NS_ERROR_ILLEGAL_VALUE); Assert.equal(e.result, Cr.NS_ERROR_ILLEGAL_VALUE);
} }
try { try {
etld = tld.getBaseDomainFromHost(".."); tld.getBaseDomainFromHost("..");
do_throw("this should fail"); do_throw("this should fail");
} catch (e) { } catch (e) {
Assert.equal(e.result, Cr.NS_ERROR_ILLEGAL_VALUE); Assert.equal(e.result, Cr.NS_ERROR_ILLEGAL_VALUE);

View file

@ -5,7 +5,7 @@ function test_not_too_long() {
var spec = "jar:http://example.com/bar.jar!/"; var spec = "jar:http://example.com/bar.jar!/";
try { try {
var newURI = ios.newURI(spec); ios.newURI(spec);
} catch (e) { } catch (e) {
do_throw("newURI threw even though it wasn't passed a large nested URI?"); do_throw("newURI threw even though it wasn't passed a large nested URI?");
} }
@ -30,7 +30,7 @@ function test_too_long() {
// unchecked would lead to a stack overflow. If we // unchecked would lead to a stack overflow. If we
// do not crash here and thus an exception is caught // do not crash here and thus an exception is caught
// we have passed the test. // we have passed the test.
var newURI = ios.newURI(spec); ios.newURI(spec);
} catch (e) {} } catch (e) {}
} }

View file

@ -91,7 +91,7 @@ function run_test() {
for (let i = 0; i < badURIs.length; ++i) { for (let i = 0; i < badURIs.length; ++i) {
Assert.throws( Assert.throws(
() => { () => {
let result = stringToURL("http://" + badURIs[i][0]).host; stringToURL("http://" + badURIs[i][0]).host;
}, },
/NS_ERROR_MALFORMED_URI/, /NS_ERROR_MALFORMED_URI/,
"bad escaped character" "bad escaped character"

View file

@ -25,7 +25,7 @@ function run_test() {
exception_threw = false; exception_threw = false;
newURI = ios.newURI("http://foo.com"); newURI = ios.newURI("http://foo.com");
try { try {
newURI = newURI newURI
.mutate() .mutate()
.setSpec("http://foo.com" + port) .setSpec("http://foo.com" + port)
.finalize(); .finalize();

View file

@ -57,7 +57,7 @@ function run_test() {
for (var i = 0; i < valid_URIs.length; i++) { for (var i = 0; i < valid_URIs.length; i++) {
try { try {
var uri = ios.newURI(valid_URIs[i]); ios.newURI(valid_URIs[i]);
} catch (e) { } catch (e) {
do_throw("cannot create URI:" + valid_URIs[i]); do_throw("cannot create URI:" + valid_URIs[i]);
} }
@ -65,7 +65,7 @@ function run_test() {
for (var i = 0; i < invalid_URIs.length; i++) { for (var i = 0; i < invalid_URIs.length; i++) {
try { try {
var uri = ios.newURI(invalid_URIs[i]); ios.newURI(invalid_URIs[i]);
do_throw("should throw: " + invalid_URIs[i]); do_throw("should throw: " + invalid_URIs[i]);
} catch (e) { } catch (e) {
Assert.equal(e.result, Cr.NS_ERROR_MALFORMED_URI); Assert.equal(e.result, Cr.NS_ERROR_MALFORMED_URI);

View file

@ -51,7 +51,7 @@ function run_test() {
function handler(metadata, response) { function handler(metadata, response) {
try { try {
var IMS = metadata.getHeader("If-Modified-Since"); metadata.getHeader("If-Modified-Since");
response.setStatusLine(metadata.httpVersion, 500, "Failed"); response.setStatusLine(metadata.httpVersion, 500, "Failed");
var msg = "Client should not set If-Modified-Since header"; var msg = "Client should not set If-Modified-Since header";
response.bodyOutputStream.write(msg, msg.length); response.bodyOutputStream.write(msg, msg.length);

View file

@ -4,7 +4,6 @@
"use strict"; "use strict";
add_task(async () => { add_task(async () => {
var cs = Cc["@mozilla.org/cookieService;1"].getService(Ci.nsICookieService);
var cm = Cc["@mozilla.org/cookiemanager;1"].getService(Ci.nsICookieManager); var cm = Cc["@mozilla.org/cookiemanager;1"].getService(Ci.nsICookieManager);
var expiry = (Date.now() + 1000) * 1000; var expiry = (Date.now() + 1000) * 1000;
@ -146,10 +145,7 @@ add_task(async () => {
}); });
var uri = NetUtil.newURI("http://baz.com/"); var uri = NetUtil.newURI("http://baz.com/");
const principal = Services.scriptSecurityManager.createContentPrincipal( Services.scriptSecurityManager.createContentPrincipal(uri, {});
uri,
{}
);
Assert.equal(uri.asciiHost, "baz.com"); Assert.equal(uri.asciiHost, "baz.com");
@ -245,16 +241,11 @@ add_task(async () => {
}); });
function getCookieCount() { function getCookieCount() {
var count = 0;
var cm = Cc["@mozilla.org/cookiemanager;1"].getService(Ci.nsICookieManager); var cm = Cc["@mozilla.org/cookiemanager;1"].getService(Ci.nsICookieManager);
for (let cookie of cm.cookies) { return cm.cookies.length;
++count;
}
return count;
} }
async function testDomainCookie(uriString, domain) { async function testDomainCookie(uriString, domain) {
var cs = Cc["@mozilla.org/cookieService;1"].getService(Ci.nsICookieService);
var cm = Cc["@mozilla.org/cookiemanager;1"].getService(Ci.nsICookieManager); var cm = Cc["@mozilla.org/cookiemanager;1"].getService(Ci.nsICookieManager);
cm.removeAll(); cm.removeAll();
@ -281,7 +272,6 @@ async function testDomainCookie(uriString, domain) {
} }
async function testTrailingDotCookie(uriString, domain) { async function testTrailingDotCookie(uriString, domain) {
var cs = Cc["@mozilla.org/cookieService;1"].getService(Ci.nsICookieService);
var cm = Cc["@mozilla.org/cookiemanager;1"].getService(Ci.nsICookieManager); var cm = Cc["@mozilla.org/cookiemanager;1"].getService(Ci.nsICookieManager);
cm.removeAll(); cm.removeAll();

View file

@ -6,7 +6,6 @@
add_task(async () => { add_task(async () => {
Services.prefs.setBoolPref("network.cookie.sameSite.schemeful", false); Services.prefs.setBoolPref("network.cookie.sameSite.schemeful", false);
var cs = Cc["@mozilla.org/cookieService;1"].getService(Ci.nsICookieService);
var cm = Cc["@mozilla.org/cookiemanager;1"].getService(Ci.nsICookieManager); var cm = Cc["@mozilla.org/cookiemanager;1"].getService(Ci.nsICookieManager);
var expiry = (Date.now() + 1000) * 1000; var expiry = (Date.now() + 1000) * 1000;

View file

@ -6,7 +6,7 @@ function run_test() {
// Bug 1301621 makes invalid ports throw // Bug 1301621 makes invalid ports throw
Assert.throws( Assert.throws(
() => { () => {
var chan = NetUtil.newChannel({ NetUtil.newChannel({
uri: "http://localhost:80000/", uri: "http://localhost:80000/",
loadUsingSystemPrincipal: true, loadUsingSystemPrincipal: true,
}); });

View file

@ -4,7 +4,6 @@
"use strict"; "use strict";
add_task(async () => { add_task(async () => {
var cs = Cc["@mozilla.org/cookieService;1"].getService(Ci.nsICookieService);
var cm = Cc["@mozilla.org/cookiemanager;1"].getService(Ci.nsICookieManager); var cm = Cc["@mozilla.org/cookiemanager;1"].getService(Ci.nsICookieManager);
var expiry = (Date.now() + 1000) * 1000; var expiry = (Date.now() + 1000) * 1000;

View file

@ -21,10 +21,7 @@ add_task(async () => {
loadUsingSystemPrincipal: true, loadUsingSystemPrincipal: true,
contentPolicyType: Ci.nsIContentPolicy.TYPE_DOCUMENT, contentPolicyType: Ci.nsIContentPolicy.TYPE_DOCUMENT,
}); });
const principal = Services.scriptSecurityManager.createContentPrincipal( Services.scriptSecurityManager.createContentPrincipal(uri, {});
uri,
{}
);
CookieXPCShellUtils.createServer({ hosts: ["example.com"] }); CookieXPCShellUtils.createServer({ hosts: ["example.com"] });

View file

@ -243,8 +243,6 @@ function check_evict_cache(appcache) {
Ci.nsICacheStorage.OPEN_READONLY, Ci.nsICacheStorage.OPEN_READONLY,
null, null,
function(status, entry, appcache) { function(status, entry, appcache) {
var hold_entry_foo3 = entry;
// evict all documents. // evict all documents.
let storage = get_cache_service().appCacheStorage( let storage = get_cache_service().appCacheStorage(
Services.loadContextInfo.default, Services.loadContextInfo.default,

View file

@ -61,7 +61,7 @@ RequestObserver.prototype = {
do_throw(notification + " observed a non-HTTP channel."); do_throw(notification + " observed a non-HTTP channel.");
} }
try { try {
let authHeader = subject.getRequestHeader("Authorization"); subject.getRequestHeader("Authorization");
} catch (e) { } catch (e) {
// Throw if there is no header to delete. We should get one iff caching // Throw if there is no header to delete. We should get one iff caching
// the auth credentials is working and the header gets added _before_ // the auth credentials is working and the header gets added _before_

View file

@ -1,7 +1,7 @@
"use strict"; "use strict";
function run_test() { function run_test() {
var storage = getCacheStorage("disk"); getCacheStorage("disk");
var lcis = [ var lcis = [
Services.loadContextInfo.default, Services.loadContextInfo.default,
Services.loadContextInfo.custom(false, { userContextId: 1 }), Services.loadContextInfo.custom(false, { userContextId: 1 }),

View file

@ -53,8 +53,6 @@ add_task(async function() {
const PORT = httpserver.identity.primaryPort; const PORT = httpserver.identity.primaryPort;
const URI = `http://localhost:${PORT}/testdir`; const URI = `http://localhost:${PORT}/testdir`;
let response;
await get_response(make_channel(URI, "GET"), false); await get_response(make_channel(URI, "GET"), false);
await get_response(make_channel(URI, "GET"), true); await get_response(make_channel(URI, "GET"), true);

View file

@ -96,10 +96,6 @@ function run_test() {
async function run_test_continued() { async function run_test_continued() {
var chan = makeChan(); var chan = makeChan();
var cookServ = Cc["@mozilla.org/cookieService;1"].getService(
Ci.nsICookieService
);
var cookie2 = "C2=V2"; var cookie2 = "C2=V2";
await CookieXPCShellUtils.setCookieToDocument(chan.URI.spec, cookie2); await CookieXPCShellUtils.setCookieToDocument(chan.URI.spec, cookie2);

View file

@ -44,7 +44,7 @@ add_task(async function test_cookie_ipv6() {
uri: URL, uri: URL,
loadUsingSystemPrincipal: true, loadUsingSystemPrincipal: true,
}); });
let req = await new Promise(resolve => { await new Promise(resolve => {
chan.asyncOpen(new ChannelListener(resolve)); chan.asyncOpen(new ChannelListener(resolve));
}); });
var cm = Cc["@mozilla.org/cookiemanager;1"].getService(Ci.nsICookieManager); var cm = Cc["@mozilla.org/cookiemanager;1"].getService(Ci.nsICookieManager);

View file

@ -126,9 +126,6 @@ function run_test() {
// this test does not emulate a response in the body, // this test does not emulate a response in the body,
// rather we only set the cookies in the header of response. // rather we only set the cookies in the header of response.
add_test(function test_safebrowsing_update() { add_test(function test_safebrowsing_update() {
var dbservice = Cc["@mozilla.org/url-classifier/dbservice;1"].getService(
Ci.nsIUrlClassifierDBService
);
var streamUpdater = Cc[ var streamUpdater = Cc[
"@mozilla.org/url-classifier/streamupdater;1" "@mozilla.org/url-classifier/streamupdater;1"
].getService(Ci.nsIUrlClassifierStreamUpdater); ].getService(Ci.nsIUrlClassifierStreamUpdater);

View file

@ -9,7 +9,7 @@
add_task(async () => { add_task(async () => {
// Set up a profile. // Set up a profile.
let profile = do_get_profile(); do_get_profile();
CookieXPCShellUtils.createServer({ CookieXPCShellUtils.createServer({
hosts: ["foo.com", "bar.com", "third.com"], hosts: ["foo.com", "bar.com", "third.com"],

View file

@ -20,7 +20,7 @@ function getCookieStringFromPrivateDocument(uriSpec) {
add_task(async () => { add_task(async () => {
// Set up a profile. // Set up a profile.
let profile = do_get_profile(); do_get_profile();
// We don't want to have CookieJarSettings blocking this test. // We don't want to have CookieJarSettings blocking this test.
Services.prefs.setBoolPref( Services.prefs.setBoolPref(

View file

@ -7,7 +7,7 @@
add_task(async () => { add_task(async () => {
// Set up a profile. // Set up a profile.
let profile = do_get_profile(); do_get_profile();
// Allow all cookies. // Allow all cookies.
Services.prefs.setIntPref("network.cookie.cookieBehavior", 0); Services.prefs.setIntPref("network.cookie.cookieBehavior", 0);
@ -29,10 +29,7 @@ add_task(async () => {
contentPolicyType: Ci.nsIContentPolicy.TYPE_DOCUMENT, contentPolicyType: Ci.nsIContentPolicy.TYPE_DOCUMENT,
}); });
let principal = Services.scriptSecurityManager.createContentPrincipal( Services.scriptSecurityManager.createContentPrincipal(uri, {});
uri,
{}
);
await CookieXPCShellUtils.setCookieToDocument( await CookieXPCShellUtils.setCookieToDocument(
uri.spec, uri.spec,

View file

@ -9,7 +9,7 @@
add_task(async () => { add_task(async () => {
// Set up a profile. // Set up a profile.
let profile = do_get_profile(); do_get_profile();
// We don't want to have CookieJarSettings blocking this test. // We don't want to have CookieJarSettings blocking this test.
Services.prefs.setBoolPref( Services.prefs.setBoolPref(

View file

@ -42,7 +42,7 @@ add_task(async function() {
// Do something that will cause the cookie service access and upgrade the // Do something that will cause the cookie service access and upgrade the
// database. // database.
let cookies = Services.cookies.cookies; Services.cookies.cookies;
// Pretend that we're about to shut down, to tell the cookie manager // Pretend that we're about to shut down, to tell the cookie manager
// to clean up its connection with its database. // to clean up its connection with its database.

View file

@ -78,7 +78,6 @@ function run_test() {
do_test_finished(); do_test_finished();
} }
var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
for (var i = 0; i < urls.length; ++i) { for (var i = 0; i < urls.length; ++i) {
dump("*** opening channel " + i + "\n"); dump("*** opening channel " + i + "\n");
do_test_pending(); do_test_pending();

View file

@ -8,10 +8,9 @@ add_task(async function ftp_disabled() {
Services.prefs.setBoolPref("network.ftp.enabled", false); Services.prefs.setBoolPref("network.ftp.enabled", false);
Services.prefs.setBoolPref("network.protocol-handler.external.ftp", false); Services.prefs.setBoolPref("network.protocol-handler.external.ftp", false);
let chan = null;
Assert.throws( Assert.throws(
() => { () => {
chan = NetUtil.newChannel({ NetUtil.newChannel({
uri: "ftp://ftp.de.debian.org/", uri: "ftp://ftp.de.debian.org/",
loadUsingSystemPrincipal: true, loadUsingSystemPrincipal: true,
}).QueryInterface(Ci.nsIHttpChannel); }).QueryInterface(Ci.nsIHttpChannel);

View file

@ -33,7 +33,7 @@ class Listener {
} }
async addresses() { async addresses() {
let [inRequest, inRecord, inStatus] = await this.promise; let [, inRecord] = await this.promise;
let addresses = []; let addresses = [];
if (!inRecord) { if (!inRecord) {
return addresses; // returns [] return addresses; // returns []
@ -262,7 +262,7 @@ add_task(async function test_cname_flag() {
mainThread, mainThread,
defaultOriginAttributes defaultOriginAttributes
); );
let [inRequest, inRecord, inStatus] = await listener; let [, inRecord] = await listener;
inRecord.QueryInterface(Ci.nsIDNSAddrRecord); inRecord.QueryInterface(Ci.nsIDNSAddrRecord);
Assert.throws( Assert.throws(
() => inRecord.canonicalName, () => inRecord.canonicalName,
@ -281,7 +281,7 @@ add_task(async function test_cname_flag() {
mainThread, mainThread,
defaultOriginAttributes defaultOriginAttributes
); );
[inRequest, inRecord, inStatus] = await listener; [, inRecord] = await listener;
inRecord.QueryInterface(Ci.nsIDNSAddrRecord); inRecord.QueryInterface(Ci.nsIDNSAddrRecord);
Assert.equal(inRecord.canonicalName, DOMAIN, "No canonical name specified"); Assert.equal(inRecord.canonicalName, DOMAIN, "No canonical name specified");
Assert.equal(inRecord.getNextAddrAsString(), "2.2.2.2"); Assert.equal(inRecord.getNextAddrAsString(), "2.2.2.2");
@ -301,7 +301,7 @@ add_task(async function test_cname_flag() {
mainThread, mainThread,
defaultOriginAttributes defaultOriginAttributes
); );
[inRequest, inRecord, inStatus] = await listener; [, inRecord] = await listener;
inRecord.QueryInterface(Ci.nsIDNSAddrRecord); inRecord.QueryInterface(Ci.nsIDNSAddrRecord);
Assert.equal(inRecord.canonicalName, OTHER, "Must have correct CNAME"); Assert.equal(inRecord.canonicalName, OTHER, "Must have correct CNAME");
Assert.equal(inRecord.getNextAddrAsString(), "2.2.2.2"); Assert.equal(inRecord.getNextAddrAsString(), "2.2.2.2");

View file

@ -24,7 +24,7 @@ class Listener {
} }
async addresses() { async addresses() {
let [inRequest, inRecord, inStatus] = await this.promise; let [, inRecord] = await this.promise;
let addresses = []; let addresses = [];
if (!inRecord) { if (!inRecord) {
return addresses; // returns [] return addresses; // returns []

View file

@ -45,7 +45,7 @@ add_task(async function test_dns_localhost() {
mainThread, mainThread,
defaultOriginAttributes defaultOriginAttributes
); );
let [inRequest, inRecord, inStatus] = await listener; let [, inRecord] = await listener;
inRecord.QueryInterface(Ci.nsIDNSAddrRecord); inRecord.QueryInterface(Ci.nsIDNSAddrRecord);
let answer = inRecord.getNextAddrAsString(); let answer = inRecord.getNextAddrAsString();
Assert.ok(answer == ADDR1 || answer == ADDR2); Assert.ok(answer == ADDR1 || answer == ADDR2);
@ -62,7 +62,7 @@ add_task(async function test_idn_cname() {
mainThread, mainThread,
defaultOriginAttributes defaultOriginAttributes
); );
let [inRequest, inRecord, inStatus] = await listener; let [, inRecord] = await listener;
inRecord.QueryInterface(Ci.nsIDNSAddrRecord); inRecord.QueryInterface(Ci.nsIDNSAddrRecord);
Assert.equal(inRecord.canonicalName, ACE_IDN, "IDN is returned as punycode"); Assert.equal(inRecord.canonicalName, ACE_IDN, "IDN is returned as punycode");
}); });

View file

@ -50,7 +50,7 @@ function get_expiry_delay() {
function* do_run_test() { function* do_run_test() {
// Set up a profile. // Set up a profile.
let profile = do_get_profile(); do_get_profile();
// twiddle prefs to convenient values for this test // twiddle prefs to convenient values for this test
Services.prefs.setIntPref("network.cookie.purgeAge", gPurgeAge); Services.prefs.setIntPref("network.cookie.purgeAge", gPurgeAge);

View file

@ -102,7 +102,7 @@ function run_test() {
observe() { observe() {
dump("got offline-cache-update-completed\n"); dump("got offline-cache-update-completed\n");
// offline cache update completed. // offline cache update completed.
var _x = randomURI; // doing this so the lazy value gets computed randomURI; // doing this so the lazy value gets computed
httpServer.stop(function() { httpServer.stop(function() {
// Now shut the server down to have an error in onstartrequest // Now shut the server down to have an error in onstartrequest
var chan = make_channel(randomURI); var chan = make_channel(randomURI);

View file

@ -51,11 +51,11 @@ function test_accepted_languages() {
let acceptedLanguagesLength = acceptedLanguages.length; let acceptedLanguagesLength = acceptedLanguages.length;
for (let i = 0; i < acceptedLanguagesLength; i++) { for (let i = 0; i < acceptedLanguagesLength; i++) {
let acceptedLanguage, qualityValue, unused; let qualityValue;
try { try {
// The q-value must conform to the definition in HTTP/1.1 Section 3.9. // The q-value must conform to the definition in HTTP/1.1 Section 3.9.
[unused, acceptedLanguage, qualityValue] = acceptedLanguages[i] [, , qualityValue] = acceptedLanguages[i]
.trim() .trim()
.match(/^([a-z0-9_-]*?)(?:;q=(1(?:\.0{0,3})?|0(?:\.[0-9]{0,3})))?$/i); .match(/^([a-z0-9_-]*?)(?:;q=(1(?:\.0{0,3})?|0(?:\.[0-9]{0,3})))?$/i);
} catch (e) { } catch (e) {

View file

@ -89,7 +89,6 @@ function handler1(metadata, response) {
response.setStatusLine(metadata.httpVersion, 200, "OK"); response.setStatusLine(metadata.httpVersion, 200, "OK");
response.setHeader("Content-Disposition", "attachment; filename=foo"); response.setHeader("Content-Disposition", "attachment; filename=foo");
response.setHeader("Content-Type", "text/plain", false); response.setHeader("Content-Type", "text/plain", false);
var body = "foo";
} }
function completeTest1(request, data, ctx) { function completeTest1(request, data, ctx) {
@ -119,8 +118,7 @@ function completeTest2(request, data, ctx) {
var chan = request.QueryInterface(Ci.nsIChannel); var chan = request.QueryInterface(Ci.nsIChannel);
Assert.equal(chan.contentDisposition, chan.DISPOSITION_ATTACHMENT); Assert.equal(chan.contentDisposition, chan.DISPOSITION_ATTACHMENT);
Assert.equal(chan.contentDispositionHeader, "attachment"); Assert.equal(chan.contentDispositionHeader, "attachment");
chan.contentDispositionFilename; // should barf
let filename = chan.contentDispositionFilename; // should barf
do_throw("Should have failed getting Content-Disposition filename"); do_throw("Should have failed getting Content-Disposition filename");
} catch (ex) { } catch (ex) {
info("correctly ate exception"); info("correctly ate exception");
@ -143,8 +141,8 @@ function completeTest3(request, data, ctx) {
var chan = request.QueryInterface(Ci.nsIChannel); var chan = request.QueryInterface(Ci.nsIChannel);
Assert.equal(chan.contentDisposition, chan.DISPOSITION_ATTACHMENT); Assert.equal(chan.contentDisposition, chan.DISPOSITION_ATTACHMENT);
Assert.equal(chan.contentDispositionHeader, "attachment; filename="); Assert.equal(chan.contentDispositionHeader, "attachment; filename=");
chan.contentDispositionFilename; // should barf
let filename = chan.contentDispositionFilename; // should barf
do_throw("Should have failed getting Content-Disposition filename"); do_throw("Should have failed getting Content-Disposition filename");
} catch (ex) { } catch (ex) {
info("correctly ate exception"); info("correctly ate exception");
@ -168,7 +166,7 @@ function completeTest4(request, data, ctx) {
Assert.equal(chan.contentDisposition, chan.DISPOSITION_INLINE); Assert.equal(chan.contentDisposition, chan.DISPOSITION_INLINE);
Assert.equal(chan.contentDispositionHeader, "inline"); Assert.equal(chan.contentDispositionHeader, "inline");
let filename = chan.contentDispositionFilename; // should barf chan.contentDispositionFilename; // should barf
do_throw("Should have failed getting Content-Disposition filename"); do_throw("Should have failed getting Content-Disposition filename");
} catch (ex) { } catch (ex) {
info("correctly ate exception"); info("correctly ate exception");

View file

@ -338,7 +338,7 @@ add_task(async function testFastfallback() {
]); ]);
let chan = makeChan(`https://test.fastfallback.com/server-timing`); let chan = makeChan(`https://test.fastfallback.com/server-timing`);
let [req, resp] = await channelOpenPromise(chan); let [req] = await channelOpenPromise(chan);
Assert.equal(req.protocolVersion, "h2"); Assert.equal(req.protocolVersion, "h2");
let internal = req.QueryInterface(Ci.nsIHttpChannelInternal); let internal = req.QueryInterface(Ci.nsIHttpChannelInternal);
Assert.equal(internal.remotePort, h2Port); Assert.equal(internal.remotePort, h2Port);
@ -421,7 +421,7 @@ add_task(async function testFastfallback1() {
]); ]);
let chan = makeChan(`https://test.fastfallback.org/server-timing`); let chan = makeChan(`https://test.fastfallback.org/server-timing`);
let [req, resp] = await channelOpenPromise(chan); let [req] = await channelOpenPromise(chan);
Assert.equal(req.protocolVersion, "h2"); Assert.equal(req.protocolVersion, "h2");
let internal = req.QueryInterface(Ci.nsIHttpChannelInternal); let internal = req.QueryInterface(Ci.nsIHttpChannelInternal);
Assert.equal(internal.remotePort, h2Port); Assert.equal(internal.remotePort, h2Port);
@ -519,7 +519,7 @@ add_task(async function testFastfallbackWithEchConfig() {
]); ]);
let chan = makeChan(`https://test.ech.org/server-timing`); let chan = makeChan(`https://test.ech.org/server-timing`);
let [req, resp] = await channelOpenPromise(chan); let [req] = await channelOpenPromise(chan);
Assert.equal(req.protocolVersion, "h2"); Assert.equal(req.protocolVersion, "h2");
let internal = req.QueryInterface(Ci.nsIHttpChannelInternal); let internal = req.QueryInterface(Ci.nsIHttpChannelInternal);
Assert.equal(internal.remotePort, h2Port); Assert.equal(internal.remotePort, h2Port);

View file

@ -236,7 +236,7 @@ add_task(async function test_sfv_list() {
); );
// check inner list member's params // check inner list member's params
let inner_list_parameters = list_members[1] list_members[1]
.QueryInterface(Ci.nsISFVInnerList) .QueryInterface(Ci.nsISFVInnerList)
.params.QueryInterface(Ci.nsISFVParams); .params.QueryInterface(Ci.nsISFVParams);
@ -300,7 +300,7 @@ add_task(async function test_sfv_dictionary() {
"must throw exception as key does not exist in dictionary" "must throw exception as key does not exist in dictionary"
); );
let dict_member1 = dict.get("key_1").QueryInterface(Ci.nsISFVItem); // let dict_member1 = dict.get("key_1").QueryInterface(Ci.nsISFVItem);
let dict_member2 = dict.get("key_2").QueryInterface(Ci.nsISFVInnerList); let dict_member2 = dict.get("key_2").QueryInterface(Ci.nsISFVInnerList);
let dict_member3 = dict.get("key_3").QueryInterface(Ci.nsISFVItem); let dict_member3 = dict.get("key_3").QueryInterface(Ci.nsISFVItem);

View file

@ -168,7 +168,7 @@ add_task(async function testUseHTTPSSVCAsHSTS() {
defaultOriginAttributes defaultOriginAttributes
); );
let [inRequest, inRecord, inStatus] = await dnsListener; let [inRequest, , inStatus] = await dnsListener;
Assert.equal(inRequest, request, "correct request was used"); Assert.equal(inRequest, request, "correct request was used");
Assert.equal(inStatus, Cr.NS_OK, "status OK"); Assert.equal(inStatus, Cr.NS_OK, "status OK");
@ -178,7 +178,7 @@ add_task(async function testUseHTTPSSVCAsHSTS() {
let listener = new EventSinkListener(); let listener = new EventSinkListener();
chan.notificationCallbacks = listener; chan.notificationCallbacks = listener;
let [req, resp] = await channelOpenPromise(chan); let [req] = await channelOpenPromise(chan);
req.QueryInterface(Ci.nsIHttpChannel); req.QueryInterface(Ci.nsIHttpChannel);
Assert.equal(req.getResponseHeader("x-connection-http2"), "yes"); Assert.equal(req.getResponseHeader("x-connection-http2"), "yes");
@ -187,7 +187,7 @@ add_task(async function testUseHTTPSSVCAsHSTS() {
listener = new EventSinkListener(); listener = new EventSinkListener();
chan.notificationCallbacks = listener; chan.notificationCallbacks = listener;
[req, resp] = await channelOpenPromise(chan); [req] = await channelOpenPromise(chan);
req.QueryInterface(Ci.nsIHttpChannel); req.QueryInterface(Ci.nsIHttpChannel);
Assert.equal(req.getResponseHeader("x-connection-http2"), "yes"); Assert.equal(req.getResponseHeader("x-connection-http2"), "yes");
@ -209,12 +209,12 @@ add_task(async function testInvalidDNSResult() {
defaultOriginAttributes defaultOriginAttributes
); );
let [inRequest, inRecord, inStatus] = await dnsListener; let [inRequest, , inStatus] = await dnsListener;
Assert.equal(inRequest, request, "correct request was used"); Assert.equal(inRequest, request, "correct request was used");
Assert.equal(inStatus, Cr.NS_ERROR_UNKNOWN_HOST, "status error"); Assert.equal(inStatus, Cr.NS_ERROR_UNKNOWN_HOST, "status error");
let chan = makeChan(`http://foo.notexisted.com:8888/server-timing`); let chan = makeChan(`http://foo.notexisted.com:8888/server-timing`);
let [req, resp] = await channelOpenPromise( let [req] = await channelOpenPromise(
chan, chan,
CL_EXPECT_LATE_FAILURE | CL_ALLOW_UNKNOWN_CL CL_EXPECT_LATE_FAILURE | CL_ALLOW_UNKNOWN_CL
); );
@ -223,7 +223,7 @@ add_task(async function testInvalidDNSResult() {
add_task(async function testLiteralIP() { add_task(async function testLiteralIP() {
let chan = makeChan(`http://127.0.0.1:8888/server-timing`); let chan = makeChan(`http://127.0.0.1:8888/server-timing`);
let [req, resp] = await channelOpenPromise( let [req] = await channelOpenPromise(
chan, chan,
CL_EXPECT_LATE_FAILURE | CL_ALLOW_UNKNOWN_CL CL_EXPECT_LATE_FAILURE | CL_ALLOW_UNKNOWN_CL
); );

View file

@ -272,7 +272,7 @@ add_task(async function testConnectionWithIPHint() {
defaultOriginAttributes defaultOriginAttributes
); );
let [inRequest, inRecord, inStatus] = await listener; let [inRequest, , inStatus] = await listener;
Assert.equal(inRequest, request, "correct request was used"); Assert.equal(inRequest, request, "correct request was used");
Assert.equal( Assert.equal(
inStatus, inStatus,
@ -286,7 +286,7 @@ add_task(async function testConnectionWithIPHint() {
// The connection should be succeeded since the IP hint is 127.0.0.1. // The connection should be succeeded since the IP hint is 127.0.0.1.
let chan = makeChan(`https://test.iphint.com:8080/`); let chan = makeChan(`https://test.iphint.com:8080/`);
let [req, resp] = await channelOpenPromise(chan); let [req] = await channelOpenPromise(chan);
Assert.equal(req.getResponseHeader("x-connection-http2"), "yes"); Assert.equal(req.getResponseHeader("x-connection-http2"), "yes");
certOverrideService.setDisableAllSecurityChecksAndLetAttackersInterceptMyData( certOverrideService.setDisableAllSecurityChecksAndLetAttackersInterceptMyData(

View file

@ -199,7 +199,7 @@ add_task(async function testConnectWithECH() {
defaultOriginAttributes defaultOriginAttributes
); );
let [inRequest, inRecord, inStatus] = await listener; let [inRequest, , inStatus] = await listener;
Assert.equal(inRequest, request, "correct request was used"); Assert.equal(inRequest, request, "correct request was used");
Assert.equal(inStatus, Cr.NS_OK, "status OK"); Assert.equal(inStatus, Cr.NS_OK, "status OK");
@ -272,7 +272,7 @@ add_task(async function testEchRetry() {
defaultOriginAttributes defaultOriginAttributes
); );
let [inRequest, inRecord, inStatus] = await listener; let [inRequest, , inStatus] = await listener;
Assert.equal(inRequest, request, "correct request was used"); Assert.equal(inRequest, request, "correct request was used");
Assert.equal(inStatus, Cr.NS_OK, "status OK"); Assert.equal(inStatus, Cr.NS_OK, "status OK");

View file

@ -205,7 +205,7 @@ add_task(async function testRetryWithoutECH() {
defaultOriginAttributes defaultOriginAttributes
); );
let [inRequest, inRecord, inStatus] = await listener; let [inRequest, , inStatus] = await listener;
Assert.equal(inRequest, request, "correct request was used"); Assert.equal(inRequest, request, "correct request was used");
Assert.equal(inStatus, Cr.NS_OK, "status OK"); Assert.equal(inStatus, Cr.NS_OK, "status OK");

View file

@ -56,7 +56,7 @@ function test_stream(stream) {
dump("Trying to read " + avail + " bytes\n"); dump("Trying to read " + avail + " bytes\n");
// Note: Verification that this does return as much bytes as we asked for is // Note: Verification that this does return as much bytes as we asked for is
// done in the binarystream implementation // done in the binarystream implementation
var data = binstream.readByteArray(avail); binstream.readByteArray(avail);
numread += avail; numread += avail;
} }

View file

@ -67,7 +67,7 @@ XPCOMUtils.defineLazyGetter(this, "listener_2", function() {
}, },
onStopRequest: function test_onStopR(request, status) { onStopRequest: function test_onStopR(request, status) {
var channel = request.QueryInterface(Ci.nsIHttpChannel); request.QueryInterface(Ci.nsIHttpChannel);
var chan = NetUtil.newChannel({ var chan = NetUtil.newChannel({
uri: "http://localhost:" + httpserver.identity.primaryPort + "/test1", uri: "http://localhost:" + httpserver.identity.primaryPort + "/test1",
loadUsingSystemPrincipal: true, loadUsingSystemPrincipal: true,
@ -95,7 +95,7 @@ XPCOMUtils.defineLazyGetter(this, "listener_1", function() {
}, },
onStopRequest: function test_onStopR(request, status) { onStopRequest: function test_onStopR(request, status) {
var channel = request.QueryInterface(Ci.nsIHttpChannel); request.QueryInterface(Ci.nsIHttpChannel);
var chan = NetUtil.newChannel({ var chan = NetUtil.newChannel({
uri: "http://localhost:" + httpserver.identity.primaryPort + "/test1", uri: "http://localhost:" + httpserver.identity.primaryPort + "/test1",
loadUsingSystemPrincipal: true, loadUsingSystemPrincipal: true,

View file

@ -297,7 +297,7 @@ Http2PushApiListener.prototype = {
offset, offset,
cnt cnt
) { ) {
var data = read_stream(stream, cnt); read_stream(stream, cnt);
}, },
onStopRequest: function test_onStopR(request, status) { onStopRequest: function test_onStopR(request, status) {

View file

@ -236,7 +236,6 @@ function start_cache_nonpinned_app() {
* file) * file)
*/ */
function start_cache_nonpinned_app2_for_partial() { function start_cache_nonpinned_app2_for_partial() {
let error_count = [0];
info("Start non-pinned App2 for partial\n"); info("Start non-pinned App2 for partial\n");
start_and_watch_app_cache( start_and_watch_app_cache(
kHttpLocation_ip + "app2.appcache", kHttpLocation_ip + "app2.appcache",

View file

@ -156,7 +156,7 @@ function run_filter_test1() {
uri: "http://www.mozilla.org/", uri: "http://www.mozilla.org/",
loadUsingSystemPrincipal: true, loadUsingSystemPrincipal: true,
}); });
var req = pps.asyncResolve(channel, 0, cb); pps.asyncResolve(channel, 0, cb);
} }
function filter_test1_1(pi) { function filter_test1_1(pi) {
@ -171,7 +171,7 @@ function filter_test1_1(pi) {
uri: "http://www.mozilla.org/", uri: "http://www.mozilla.org/",
loadUsingSystemPrincipal: true, loadUsingSystemPrincipal: true,
}); });
var req = pps.asyncResolve(channel, 0, cb); pps.asyncResolve(channel, 0, cb);
} }
function filter_test1_2(pi) { function filter_test1_2(pi) {
@ -185,7 +185,7 @@ function filter_test1_2(pi) {
uri: "http://www.mozilla.org/", uri: "http://www.mozilla.org/",
loadUsingSystemPrincipal: true, loadUsingSystemPrincipal: true,
}); });
var req = pps.asyncResolve(channel, 0, cb); pps.asyncResolve(channel, 0, cb);
} }
function filter_test1_3(pi) { function filter_test1_3(pi) {
@ -205,7 +205,7 @@ function run_filter2_sync_async() {
uri: "http://www.mozilla.org/", uri: "http://www.mozilla.org/",
loadUsingSystemPrincipal: true, loadUsingSystemPrincipal: true,
}); });
var req = pps.asyncResolve(channel, 0, cb); pps.asyncResolve(channel, 0, cb);
} }
function filter_test2_1(pi) { function filter_test2_1(pi) {
@ -230,7 +230,7 @@ function run_filter3_async_sync() {
uri: "http://www.mozilla.org/", uri: "http://www.mozilla.org/",
loadUsingSystemPrincipal: true, loadUsingSystemPrincipal: true,
}); });
var req = pps.asyncResolve(channel, 0, cb); pps.asyncResolve(channel, 0, cb);
} }
function filter_test3_1(pi) { function filter_test3_1(pi) {
@ -257,7 +257,7 @@ function run_filter4_throwing_sync_sync() {
uri: "http://www.mozilla2.org/", uri: "http://www.mozilla2.org/",
loadUsingSystemPrincipal: true, loadUsingSystemPrincipal: true,
}); });
var req = pps.asyncResolve(channel, 0, cb); pps.asyncResolve(channel, 0, cb);
} }
function filter_test4_1(pi) { function filter_test4_1(pi) {
@ -285,7 +285,7 @@ function run_filter5_sync_sync_throwing() {
uri: "http://www.mozilla.org/", uri: "http://www.mozilla.org/",
loadUsingSystemPrincipal: true, loadUsingSystemPrincipal: true,
}); });
var req = pps.asyncResolve(channel, 0, cb); pps.asyncResolve(channel, 0, cb);
} }
function filter_test5_1(pi) { function filter_test5_1(pi) {
@ -313,7 +313,7 @@ function run_filter5_2_throwing_async_async() {
uri: "http://www.mozilla.org/", uri: "http://www.mozilla.org/",
loadUsingSystemPrincipal: true, loadUsingSystemPrincipal: true,
}); });
var req = pps.asyncResolve(channel, 0, cb); pps.asyncResolve(channel, 0, cb);
} }
function filter_test5_2(pi) { function filter_test5_2(pi) {
@ -341,7 +341,7 @@ function run_filter6_async_async_throwing() {
uri: "http://www.mozilla.org/", uri: "http://www.mozilla.org/",
loadUsingSystemPrincipal: true, loadUsingSystemPrincipal: true,
}); });
var req = pps.asyncResolve(channel, 0, cb); pps.asyncResolve(channel, 0, cb);
} }
function filter_test6_1(pi) { function filter_test6_1(pi) {
@ -369,7 +369,7 @@ function run_filter7_async_throwing_async() {
uri: "http://www.mozilla.org/", uri: "http://www.mozilla.org/",
loadUsingSystemPrincipal: true, loadUsingSystemPrincipal: true,
}); });
var req = pps.asyncResolve(channel, 0, cb); pps.asyncResolve(channel, 0, cb);
} }
function filter_test7_1(pi) { function filter_test7_1(pi) {
@ -397,7 +397,7 @@ function run_filter8_sync_throwing_sync() {
uri: "http://www.mozilla.org/", uri: "http://www.mozilla.org/",
loadUsingSystemPrincipal: true, loadUsingSystemPrincipal: true,
}); });
var req = pps.asyncResolve(channel, 0, cb); pps.asyncResolve(channel, 0, cb);
} }
function filter_test8_1(pi) { function filter_test8_1(pi) {
@ -421,7 +421,7 @@ function run_filter9_throwing() {
uri: "http://www.mozilla.org/", uri: "http://www.mozilla.org/",
loadUsingSystemPrincipal: true, loadUsingSystemPrincipal: true,
}); });
var req = pps.asyncResolve(channel, 0, cb); pps.asyncResolve(channel, 0, cb);
} }
function filter_test9_1(pi) { function filter_test9_1(pi) {

View file

@ -176,7 +176,7 @@ function run_filter_test() {
// Verify initial state // Verify initial state
var cb = new resolveCallback(); var cb = new resolveCallback();
cb.nextFunction = filter_test0_1; cb.nextFunction = filter_test0_1;
var req = pps.asyncResolve(channel, 0, cb); pps.asyncResolve(channel, 0, cb);
} }
var filter01; var filter01;
@ -198,7 +198,7 @@ function filter_test0_1(pi) {
uri: "http://www.mozilla.org/", uri: "http://www.mozilla.org/",
loadUsingSystemPrincipal: true, loadUsingSystemPrincipal: true,
}); });
var req = pps.asyncResolve(channel, 0, cb); pps.asyncResolve(channel, 0, cb);
} }
function filter_test0_2(pi) { function filter_test0_2(pi) {
@ -213,7 +213,7 @@ function filter_test0_2(pi) {
uri: "http://www.mozilla.org/", uri: "http://www.mozilla.org/",
loadUsingSystemPrincipal: true, loadUsingSystemPrincipal: true,
}); });
var req = pps.asyncResolve(channel, 0, cb); pps.asyncResolve(channel, 0, cb);
} }
function filter_test0_3(pi) { function filter_test0_3(pi) {
@ -230,7 +230,7 @@ function filter_test0_3(pi) {
uri: "http://www.mozilla.org/", uri: "http://www.mozilla.org/",
loadUsingSystemPrincipal: true, loadUsingSystemPrincipal: true,
}); });
var req = pps.asyncResolve(channel, 0, cb); pps.asyncResolve(channel, 0, cb);
} }
var filter03; var filter03;
@ -245,7 +245,7 @@ function filter_test0_4(pi) {
uri: "http://www.mozilla.org/", uri: "http://www.mozilla.org/",
loadUsingSystemPrincipal: true, loadUsingSystemPrincipal: true,
}); });
var req = pps.asyncResolve(channel, 0, cb); pps.asyncResolve(channel, 0, cb);
} }
function filter_test0_5(pi) { function filter_test0_5(pi) {
@ -326,7 +326,7 @@ function run_filter_test2() {
uri: "http://www.mozilla.org/", uri: "http://www.mozilla.org/",
loadUsingSystemPrincipal: true, loadUsingSystemPrincipal: true,
}); });
var req = pps.asyncResolve(channel, 0, cb); pps.asyncResolve(channel, 0, cb);
} }
function filter_test1_1(pi) { function filter_test1_1(pi) {
@ -341,7 +341,7 @@ function filter_test1_1(pi) {
uri: "http://www.mozilla.org/", uri: "http://www.mozilla.org/",
loadUsingSystemPrincipal: true, loadUsingSystemPrincipal: true,
}); });
var req = pps.asyncResolve(channel, 0, cb); pps.asyncResolve(channel, 0, cb);
} }
function filter_test1_2(pi) { function filter_test1_2(pi) {
@ -357,7 +357,7 @@ function filter_test1_2(pi) {
uri: "http://www.mozilla.org/", uri: "http://www.mozilla.org/",
loadUsingSystemPrincipal: true, loadUsingSystemPrincipal: true,
}); });
var req = pps.asyncResolve(channel, 0, cb); pps.asyncResolve(channel, 0, cb);
} }
function filter_test1_3(pi) { function filter_test1_3(pi) {
@ -379,7 +379,7 @@ function run_filter_test3() {
var cb = new resolveCallback(); var cb = new resolveCallback();
cb.nextFunction = filter_test3_1; cb.nextFunction = filter_test3_1;
var req = pps.asyncResolve(channel, 0, cb); pps.asyncResolve(channel, 0, cb);
} }
function filter_test3_1(pi) { function filter_test3_1(pi) {
@ -399,7 +399,7 @@ function run_pref_test() {
var cb = new resolveCallback(); var cb = new resolveCallback();
cb.nextFunction = pref_test1_1; cb.nextFunction = pref_test1_1;
var req = pps.asyncResolve(channel, 0, cb); pps.asyncResolve(channel, 0, cb);
} }
function pref_test1_1(pi) { function pref_test1_1(pi) {
@ -414,7 +414,7 @@ function pref_test1_1(pi) {
uri: "http://www.mozilla.org/", uri: "http://www.mozilla.org/",
loadUsingSystemPrincipal: true, loadUsingSystemPrincipal: true,
}); });
var req = pps.asyncResolve(channel, 0, cb); pps.asyncResolve(channel, 0, cb);
} }
function pref_test1_2(pi) { function pref_test1_2(pi) {
@ -431,7 +431,7 @@ function pref_test1_2(pi) {
uri: "http://www.mozilla.org/", uri: "http://www.mozilla.org/",
loadUsingSystemPrincipal: true, loadUsingSystemPrincipal: true,
}); });
var req = pps.asyncResolve(channel, 0, cb); pps.asyncResolve(channel, 0, cb);
} }
function pref_test1_3(pi) { function pref_test1_3(pi) {
@ -450,7 +450,7 @@ function pref_test1_3(pi) {
uri: "http://www.mozilla.org/", uri: "http://www.mozilla.org/",
loadUsingSystemPrincipal: true, loadUsingSystemPrincipal: true,
}); });
var req = pps.asyncResolve(channel, 0, cb); pps.asyncResolve(channel, 0, cb);
} }
function pref_test1_4(pi) { function pref_test1_4(pi) {
@ -512,11 +512,7 @@ function run_pac_test() {
prefs.setIntPref("network.proxy.type", 2); prefs.setIntPref("network.proxy.type", 2);
prefs.setCharPref("network.proxy.autoconfig_url", pac); prefs.setCharPref("network.proxy.autoconfig_url", pac);
var req = pps.asyncResolve( pps.asyncResolve(channel, 0, new TestResolveCallback("http", run_pac2_test));
channel,
0,
new TestResolveCallback("http", run_pac2_test)
);
} }
function run_pac2_test() { function run_pac2_test() {
@ -535,11 +531,7 @@ function run_pac2_test() {
prefs.setCharPref("network.proxy.autoconfig_url", pac); prefs.setCharPref("network.proxy.autoconfig_url", pac);
prefs.setBoolPref("network.proxy.proxy_over_tls", true); prefs.setBoolPref("network.proxy.proxy_over_tls", true);
var req = pps.asyncResolve( pps.asyncResolve(channel, 0, new TestResolveCallback("https", run_pac3_test));
channel,
0,
new TestResolveCallback("https", run_pac3_test)
);
} }
function run_pac3_test() { function run_pac3_test() {
@ -556,11 +548,7 @@ function run_pac3_test() {
prefs.setCharPref("network.proxy.autoconfig_url", pac); prefs.setCharPref("network.proxy.autoconfig_url", pac);
prefs.setBoolPref("network.proxy.proxy_over_tls", false); prefs.setBoolPref("network.proxy.proxy_over_tls", false);
var req = pps.asyncResolve( pps.asyncResolve(channel, 0, new TestResolveCallback(null, run_pac4_test));
channel,
0,
new TestResolveCallback(null, run_pac4_test)
);
} }
function run_pac4_test() { function run_pac4_test() {
@ -599,7 +587,7 @@ function run_pac4_test() {
prefs.setIntPref("network.proxy.type", 2); prefs.setIntPref("network.proxy.type", 2);
prefs.setCharPref("network.proxy.autoconfig_url", pac); prefs.setCharPref("network.proxy.autoconfig_url", pac);
var req = pps.asyncResolve( pps.asyncResolve(
channel, channel,
0, 0,
new TestResolveCallback("http", run_utf8_pac_test) new TestResolveCallback("http", run_utf8_pac_test)
@ -631,7 +619,7 @@ function run_utf8_pac_test() {
prefs.setIntPref("network.proxy.type", 2); prefs.setIntPref("network.proxy.type", 2);
prefs.setCharPref("network.proxy.autoconfig_url", pac); prefs.setCharPref("network.proxy.autoconfig_url", pac);
var req = pps.asyncResolve( pps.asyncResolve(
channel, channel,
0, 0,
new TestResolveCallback("http", run_latin1_pac_test) new TestResolveCallback("http", run_latin1_pac_test)
@ -659,7 +647,7 @@ function run_latin1_pac_test() {
prefs.setIntPref("network.proxy.type", 2); prefs.setIntPref("network.proxy.type", 2);
prefs.setCharPref("network.proxy.autoconfig_url", pac); prefs.setCharPref("network.proxy.autoconfig_url", pac);
var req = pps.asyncResolve( pps.asyncResolve(
channel, channel,
0, 0,
new TestResolveCallback("http", finish_pac_test) new TestResolveCallback("http", finish_pac_test)
@ -739,7 +727,6 @@ function check_host_filters_cb() {
} }
function check_host_filter(i) { function check_host_filter(i) {
var uri;
dump( dump(
"*** uri=" + hostList[i] + " bShouldBeFiltered=" + bShouldBeFiltered + "\n" "*** uri=" + hostList[i] + " bShouldBeFiltered=" + bShouldBeFiltered + "\n"
); );
@ -749,7 +736,7 @@ function check_host_filter(i) {
}); });
var cb = new resolveCallback(); var cb = new resolveCallback();
cb.nextFunction = host_filter_cb; cb.nextFunction = host_filter_cb;
var req = pps.asyncResolve(channel, 0, cb); pps.asyncResolve(channel, 0, cb);
} }
function host_filter_cb(proxy) { function host_filter_cb(proxy) {
@ -790,7 +777,6 @@ function run_proxy_host_filters_test() {
hostFilterList hostFilterList
); );
var rv;
// Check the hosts that should be filtered out // Check the hosts that should be filtered out
uriStrFilterList = [ uriStrFilterList = [
"http://www.mozilla.org/", "http://www.mozilla.org/",
@ -866,7 +852,7 @@ function run_myipaddress_test() {
var cb = new resolveCallback(); var cb = new resolveCallback();
cb.nextFunction = myipaddress_callback; cb.nextFunction = myipaddress_callback;
var req = pps.asyncResolve(channel, 0, cb); pps.asyncResolve(channel, 0, cb);
} }
function myipaddress_callback(pi) { function myipaddress_callback(pi) {
@ -903,7 +889,7 @@ function run_myipaddress_test_2() {
var cb = new resolveCallback(); var cb = new resolveCallback();
cb.nextFunction = myipaddress2_callback; cb.nextFunction = myipaddress2_callback;
var req = pps.asyncResolve(channel, 0, cb); pps.asyncResolve(channel, 0, cb);
} }
function myipaddress2_callback(pi) { function myipaddress2_callback(pi) {
@ -933,7 +919,7 @@ function run_failed_script_test() {
var cb = new resolveCallback(); var cb = new resolveCallback();
cb.nextFunction = failed_script_callback; cb.nextFunction = failed_script_callback;
var req = pps.asyncResolve(channel, 0, cb); pps.asyncResolve(channel, 0, cb);
} }
var directFilter; var directFilter;
@ -1012,7 +998,7 @@ function run_isresolvable_test() {
var cb = new resolveCallback(); var cb = new resolveCallback();
cb.nextFunction = isresolvable_callback; cb.nextFunction = isresolvable_callback;
var req = pps.asyncResolve(channel, 0, cb); pps.asyncResolve(channel, 0, cb);
} }
function isresolvable_callback(pi) { function isresolvable_callback(pi) {
@ -1044,7 +1030,7 @@ function run_localhost_pac() {
var cb = new resolveCallback(); var cb = new resolveCallback();
cb.nextFunction = localhost_callback; cb.nextFunction = localhost_callback;
var req = pps.asyncResolve(channel, 0, cb); pps.asyncResolve(channel, 0, cb);
} }
function localhost_callback(pi) { function localhost_callback(pi) {

View file

@ -97,7 +97,7 @@ function after_channel_closed() {
function test_channel(createChanClosure) { function test_channel(createChanClosure) {
// First, synchronous reopening test // First, synchronous reopening test
chan = createChanClosure(); chan = createChanClosure();
var inputStream = chan.open(); chan.open();
check_open_throws(NS_ERROR_IN_PROGRESS); check_open_throws(NS_ERROR_IN_PROGRESS);
check_async_open_throws([NS_ERROR_IN_PROGRESS, NS_ERROR_ALREADY_OPENED]); check_async_open_throws([NS_ERROR_IN_PROGRESS, NS_ERROR_ALREADY_OPENED]);

View file

@ -333,7 +333,6 @@ function handleAuth(metadata, response) {
// btoa("guest:guest"), but that function is not available here // btoa("guest:guest"), but that function is not available here
var expectedHeader = "Basic Z3Vlc3Q6Z3Vlc3Q="; var expectedHeader = "Basic Z3Vlc3Q6Z3Vlc3Q=";
var body;
if ( if (
metadata.hasHeader("Authorization") && metadata.hasHeader("Authorization") &&
metadata.getHeader("Authorization") == expectedHeader metadata.getHeader("Authorization") == expectedHeader

View file

@ -162,7 +162,7 @@ add_task(async function test_signature() {
let completionPromise = promiseSaverComplete(saver); let completionPromise = promiseSaverComplete(saver);
try { try {
let signatureInfo = saver.signatureInfo; saver.signatureInfo;
do_throw("Can't get signature before saver is complete."); do_throw("Can't get signature before saver is complete.");
} catch (ex) { } catch (ex) {
if (ex.result != Cr.NS_ERROR_NOT_AVAILABLE) { if (ex.result != Cr.NS_ERROR_NOT_AVAILABLE) {

View file

@ -1165,7 +1165,7 @@ add_test(
function test_bug1517025() { function test_bug1517025() {
Assert.throws( Assert.throws(
() => { () => {
let other = stringToURL("https://b%9a/"); stringToURL("https://b%9a/");
}, },
/NS_ERROR_UNEXPECTED/, /NS_ERROR_UNEXPECTED/,
"bad URI" "bad URI"
@ -1173,7 +1173,7 @@ add_test(
Assert.throws( Assert.throws(
() => { () => {
let other = stringToURL("https://b%9ª/"); stringToURL("https://b%9ª/");
}, },
/NS_ERROR_MALFORMED_URI/, /NS_ERROR_MALFORMED_URI/,
"bad URI" "bad URI"
@ -1184,7 +1184,7 @@ add_test(
); );
Assert.throws( Assert.throws(
() => { () => {
let uri = Services.io.newURI("/\\b%9ª", "windows-1252", base); Services.io.newURI("/\\b%9ª", "windows-1252", base);
}, },
/NS_ERROR_MALFORMED_URI/, /NS_ERROR_MALFORMED_URI/,
"bad URI" "bad URI"

View file

@ -1420,7 +1420,7 @@ add_task(async function test_async_resolve_with_trr_server_5() {
// When dns is resolved in socket process, we can't set |expectEarlyFail| to true. // When dns is resolved in socket process, we can't set |expectEarlyFail| to true.
let inSocketProcess = mozinfo.socketprocess_networking; let inSocketProcess = mozinfo.socketprocess_networking;
let [_] = await new DNSListener( await new DNSListener(
"bar_with_trr3.example.com", "bar_with_trr3.example.com",
undefined, undefined,
false, false,
@ -1696,7 +1696,7 @@ add_task(async function test_resolve_not_confirmed() {
// because of the increased delay between the emulator and host. // because of the increased delay between the emulator and host.
await new Promise(resolve => do_timeout(100 * (100 / count), resolve)); await new Promise(resolve => do_timeout(100 * (100 / count), resolve));
} }
let [inRequest, inRecord, inStatus] = await new DNSListener( let [, inRecord] = await new DNSListener(
`ip${count}.example.org`, `ip${count}.example.org`,
undefined, undefined,
false false
@ -2080,7 +2080,6 @@ add_task(async function test_no_retry_without_doh() {
// Requests to 0.0.0.0 are usually directed to localhost, so let's use a port // Requests to 0.0.0.0 are usually directed to localhost, so let's use a port
// we know isn't being used - 666 (Doom) // we know isn't being used - 666 (Doom)
let chan = makeChan(url, Ci.nsIRequest.TRR_DEFAULT_MODE); let chan = makeChan(url, Ci.nsIRequest.TRR_DEFAULT_MODE);
let resolutions = 0;
let statusCounter = { let statusCounter = {
statusCount: {}, statusCount: {},
QueryInterface: ChromeUtils.generateQI([ QueryInterface: ChromeUtils.generateQI([
@ -2096,7 +2095,7 @@ add_task(async function test_no_retry_without_doh() {
}, },
}; };
chan.notificationCallbacks = statusCounter; chan.notificationCallbacks = statusCounter;
let req = await new Promise(resolve => await new Promise(resolve =>
chan.asyncOpen(new ChannelListener(resolve, null, CL_EXPECT_FAILURE)) chan.asyncOpen(new ChannelListener(resolve, null, CL_EXPECT_FAILURE))
); );
equal( equal(

View file

@ -40,7 +40,7 @@ add_task(async function setup_server() {
await trrServer.start(); await trrServer.start();
dump(`port = ${trrServer.port}\n`); dump(`port = ${trrServer.port}\n`);
let chan = makeChan(`https://localhost:${trrServer.port}/test?bla=some`); let chan = makeChan(`https://localhost:${trrServer.port}/test?bla=some`);
let [req, resp] = await channelOpenPromise(chan); let [, resp] = await channelOpenPromise(chan);
equal(resp, "<h1> 404 Path not found: /test?bla=some</h1>"); equal(resp, "<h1> 404 Path not found: /test?bla=some</h1>");
}); });
@ -249,10 +249,9 @@ add_task(async function test_parse_additional_section() {
] ]
); );
let [inRequest, inRecord, inStatus] = await new TRRDNSListener( let [, inRecord] = await new TRRDNSListener("multiple.foo", {
"multiple.foo", expectedAnswer: "9.9.9.9",
{ expectedAnswer: "9.9.9.9" } });
);
let IPs = []; let IPs = [];
inRecord.QueryInterface(Ci.nsIDNSAddrRecord); inRecord.QueryInterface(Ci.nsIDNSAddrRecord);
inRecord.rewind(); inRecord.rewind();
@ -262,7 +261,7 @@ add_task(async function test_parse_additional_section() {
equal(IPs.length, 1); equal(IPs.length, 1);
equal(IPs[0], "9.9.9.9"); equal(IPs[0], "9.9.9.9");
IPs = []; IPs = [];
[inRequest, inRecord, inStatus] = await new TRRDNSListener("yuiop.foo", { [, inRecord] = await new TRRDNSListener("yuiop.foo", {
expectedSuccess: false, expectedSuccess: false,
}); });
inRecord.QueryInterface(Ci.nsIDNSAddrRecord); inRecord.QueryInterface(Ci.nsIDNSAddrRecord);

View file

@ -40,7 +40,7 @@ add_task(async function test_trr_casing() {
await trrServer.start(); await trrServer.start();
dump(`port = ${trrServer.port}\n`); dump(`port = ${trrServer.port}\n`);
let chan = makeChan(`https://localhost:${trrServer.port}/test?bla=some`); let chan = makeChan(`https://localhost:${trrServer.port}/test?bla=some`);
let [req, resp] = await channelOpenPromise(chan); let [, resp] = await channelOpenPromise(chan);
equal(resp, "<h1> 404 Path not found: /test?bla=some</h1>"); equal(resp, "<h1> 404 Path not found: /test?bla=some</h1>");
dns.clearCache(true); dns.clearCache(true);

View file

@ -40,7 +40,7 @@ add_task(async function test_follow_cnames_same_response() {
await trrServer.start(); await trrServer.start();
dump(`port = ${trrServer.port}\n`); dump(`port = ${trrServer.port}\n`);
let chan = makeChan(`https://localhost:${trrServer.port}/test?bla=some`); let chan = makeChan(`https://localhost:${trrServer.port}/test?bla=some`);
let [req, resp] = await channelOpenPromise(chan); let [, resp] = await channelOpenPromise(chan);
equal(resp, "<h1> 404 Path not found: /test?bla=some</h1>"); equal(resp, "<h1> 404 Path not found: /test?bla=some</h1>");
dns.clearCache(true); dns.clearCache(true);
@ -80,13 +80,10 @@ add_task(async function test_follow_cnames_same_response() {
data: "1.2.3.4", data: "1.2.3.4",
}, },
]); ]);
let [inRequest, inRecord, inStatus] = await new TRRDNSListener( let [, inRecord] = await new TRRDNSListener("something.foo", {
"something.foo", expectedAnswer: "1.2.3.4",
{ flags: Ci.nsIDNSService.RESOLVE_CANONICAL_NAME,
expectedAnswer: "1.2.3.4", });
flags: Ci.nsIDNSService.RESOLVE_CANONICAL_NAME,
}
);
equal(inRecord.QueryInterface(Ci.nsIDNSAddrRecord).canonicalName, "xyz.foo"); equal(inRecord.QueryInterface(Ci.nsIDNSAddrRecord).canonicalName, "xyz.foo");
await trrServer.registerDoHAnswers("a.foo", "A", [ await trrServer.registerDoHAnswers("a.foo", "A", [

View file

@ -41,7 +41,7 @@ add_task(async function setup() {
await trrServer.start(); await trrServer.start();
dump(`port = ${trrServer.port}\n`); dump(`port = ${trrServer.port}\n`);
let chan = makeChan(`https://localhost:${trrServer.port}/test?bla=some`); let chan = makeChan(`https://localhost:${trrServer.port}/test?bla=some`);
let [req, resp] = await channelOpenPromise(chan); let [, resp] = await channelOpenPromise(chan);
equal(resp, "<h1> 404 Path not found: /test?bla=some</h1>"); equal(resp, "<h1> 404 Path not found: /test?bla=some</h1>");
dns.clearCache(true); dns.clearCache(true);

View file

@ -229,12 +229,12 @@ add_task(async function testFallbackToTheLastRecord() {
defaultOriginAttributes defaultOriginAttributes
); );
let [inRequest, inRecord, inStatus] = await listener; let [inRequest, , inStatus] = await listener;
Assert.equal(inRequest, request, "correct request was used"); Assert.equal(inRequest, request, "correct request was used");
Assert.equal(inStatus, Cr.NS_OK, "status OK"); Assert.equal(inStatus, Cr.NS_OK, "status OK");
let chan = makeChan(`https://test.fallback.com:${h2Port}/server-timing`); let chan = makeChan(`https://test.fallback.com:${h2Port}/server-timing`);
let [req, resp] = await channelOpenPromise(chan); let [req] = await channelOpenPromise(chan);
// Test if this request is done by h2. // Test if this request is done by h2.
Assert.equal(req.getResponseHeader("x-connection-http2"), "yes"); Assert.equal(req.getResponseHeader("x-connection-http2"), "yes");
@ -319,12 +319,12 @@ add_task(async function testFallbackToTheOrigin() {
defaultOriginAttributes defaultOriginAttributes
); );
let [inRequest, inRecord, inStatus] = await listener; let [inRequest, , inStatus] = await listener;
Assert.equal(inRequest, request, "correct request was used"); Assert.equal(inRequest, request, "correct request was used");
Assert.equal(inStatus, Cr.NS_OK, "status OK"); Assert.equal(inStatus, Cr.NS_OK, "status OK");
let chan = makeChan(`https://test.foo.com:${h2Port}/server-timing`); let chan = makeChan(`https://test.foo.com:${h2Port}/server-timing`);
let [req, resp] = await channelOpenPromise(chan); let [req] = await channelOpenPromise(chan);
// Test if this request is done by h2. // Test if this request is done by h2.
Assert.equal(req.getResponseHeader("x-connection-http2"), "yes"); Assert.equal(req.getResponseHeader("x-connection-http2"), "yes");
@ -400,7 +400,7 @@ add_task(async function testAllRecordsFailed() {
defaultOriginAttributes defaultOriginAttributes
); );
let [inRequest, inRecord, inStatus] = await listener; let [inRequest, , inStatus] = await listener;
Assert.equal(inRequest, request, "correct request was used"); Assert.equal(inRequest, request, "correct request was used");
Assert.equal(inStatus, Cr.NS_OK, "status OK"); Assert.equal(inStatus, Cr.NS_OK, "status OK");
@ -459,7 +459,7 @@ add_task(async function testFallbackToTheOrigin2() {
defaultOriginAttributes defaultOriginAttributes
); );
let [inRequest, inRecord, inStatus] = await listener; let [inRequest, , inStatus] = await listener;
Assert.equal(inRequest, request, "correct request was used"); Assert.equal(inRequest, request, "correct request was used");
Assert.equal(inStatus, Cr.NS_OK, "status OK"); Assert.equal(inStatus, Cr.NS_OK, "status OK");
@ -559,7 +559,7 @@ add_task(async function testFallbackToTheOrigin3() {
defaultOriginAttributes defaultOriginAttributes
); );
let [inRequest, inRecord, inStatus] = await listener; let [inRequest, , inStatus] = await listener;
Assert.equal(inRequest, request, "correct request was used"); Assert.equal(inRequest, request, "correct request was used");
Assert.equal(inStatus, Cr.NS_OK, "status OK"); Assert.equal(inStatus, Cr.NS_OK, "status OK");
@ -626,7 +626,7 @@ add_task(async function testResetExclusionList() {
defaultOriginAttributes defaultOriginAttributes
); );
let [inRequest, inRecord, inStatus] = await listener; let [inRequest, , inStatus] = await listener;
Assert.equal(inRequest, request, "correct request was used"); Assert.equal(inRequest, request, "correct request was used");
Assert.equal(inStatus, Cr.NS_OK, "status OK"); Assert.equal(inStatus, Cr.NS_OK, "status OK");
@ -713,12 +713,12 @@ add_task(async function testH3Connection() {
defaultOriginAttributes defaultOriginAttributes
); );
let [inRequest, inRecord, inStatus] = await listener; let [inRequest, , inStatus] = await listener;
Assert.equal(inRequest, request, "correct request was used"); Assert.equal(inRequest, request, "correct request was used");
Assert.equal(inStatus, Cr.NS_OK, "status OK"); Assert.equal(inStatus, Cr.NS_OK, "status OK");
let chan = makeChan(`https://test.h3.com`); let chan = makeChan(`https://test.h3.com`);
let [req, resp] = await channelOpenPromise(chan); let [req] = await channelOpenPromise(chan);
Assert.equal(req.protocolVersion, "h3"); Assert.equal(req.protocolVersion, "h3");
let internal = req.QueryInterface(Ci.nsIHttpChannelInternal); let internal = req.QueryInterface(Ci.nsIHttpChannelInternal);
Assert.equal(internal.remotePort, h3Port); Assert.equal(internal.remotePort, h3Port);
@ -796,12 +796,12 @@ add_task(async function testFastfallbackToH2() {
defaultOriginAttributes defaultOriginAttributes
); );
let [inRequest, inRecord, inStatus] = await listener; let [inRequest, , inStatus] = await listener;
Assert.equal(inRequest, request, "correct request was used"); Assert.equal(inRequest, request, "correct request was used");
Assert.equal(inStatus, Cr.NS_OK, "status OK"); Assert.equal(inStatus, Cr.NS_OK, "status OK");
let chan = makeChan(`https://test.fastfallback.com/server-timing`); let chan = makeChan(`https://test.fastfallback.com/server-timing`);
let [req, resp] = await channelOpenPromise(chan); let [req] = await channelOpenPromise(chan);
Assert.equal(req.protocolVersion, "h2"); Assert.equal(req.protocolVersion, "h2");
let internal = req.QueryInterface(Ci.nsIHttpChannelInternal); let internal = req.QueryInterface(Ci.nsIHttpChannelInternal);
Assert.equal(internal.remotePort, h2Port); Assert.equal(internal.remotePort, h2Port);
@ -813,7 +813,7 @@ add_task(async function testFastfallbackToH2() {
); );
chan = makeChan(`https://test.fastfallback.com/server-timing`); chan = makeChan(`https://test.fastfallback.com/server-timing`);
[req, resp] = await channelOpenPromise(chan); [req] = await channelOpenPromise(chan);
Assert.equal(req.protocolVersion, "h2"); Assert.equal(req.protocolVersion, "h2");
internal = req.QueryInterface(Ci.nsIHttpChannelInternal); internal = req.QueryInterface(Ci.nsIHttpChannelInternal);
Assert.equal(internal.remotePort, h2Port); Assert.equal(internal.remotePort, h2Port);
@ -867,7 +867,7 @@ add_task(async function testFailedH3Connection() {
defaultOriginAttributes defaultOriginAttributes
); );
let [inRequest, inRecord, inStatus] = await listener; let [inRequest, , inStatus] = await listener;
Assert.equal(inRequest, request, "correct request was used"); Assert.equal(inRequest, request, "correct request was used");
Assert.equal(inStatus, Cr.NS_OK, "status OK"); Assert.equal(inStatus, Cr.NS_OK, "status OK");
@ -948,12 +948,12 @@ add_task(async function testHttp3ExcludedList() {
defaultOriginAttributes defaultOriginAttributes
); );
let [inRequest, inRecord, inStatus] = await listener; let [inRequest, , inStatus] = await listener;
Assert.equal(inRequest, request, "correct request was used"); Assert.equal(inRequest, request, "correct request was used");
Assert.equal(inStatus, Cr.NS_OK, "status OK"); Assert.equal(inStatus, Cr.NS_OK, "status OK");
chan = makeChan(`https://test.h3_excluded.org`); chan = makeChan(`https://test.h3_excluded.org`);
let [req, resp] = await channelOpenPromise(chan); let [req] = await channelOpenPromise(chan);
Assert.equal(req.protocolVersion, "h3"); Assert.equal(req.protocolVersion, "h3");
let internal = req.QueryInterface(Ci.nsIHttpChannelInternal); let internal = req.QueryInterface(Ci.nsIHttpChannelInternal);
Assert.equal(internal.remotePort, h3Port); Assert.equal(internal.remotePort, h3Port);
@ -996,7 +996,7 @@ add_task(async function testAllRecordsInHttp3ExcludedList() {
`https://www.h3_all_excluded.org:${h2Port}/server-timing` `https://www.h3_all_excluded.org:${h2Port}/server-timing`
); );
let [req, resp] = await channelOpenPromise(chan); let [req] = await channelOpenPromise(chan);
// Test if this request is done by h2. // Test if this request is done by h2.
Assert.equal(req.getResponseHeader("x-connection-http2"), "yes"); Assert.equal(req.getResponseHeader("x-connection-http2"), "yes");
@ -1059,7 +1059,7 @@ add_task(async function testAllRecordsInHttp3ExcludedList() {
defaultOriginAttributes defaultOriginAttributes
); );
let [inRequest, inRecord, inStatus] = await listener; let [inRequest, , inStatus] = await listener;
Assert.equal(inRequest, request, "correct request was used"); Assert.equal(inRequest, request, "correct request was used");
Assert.equal(inStatus, Cr.NS_OK, "status OK"); Assert.equal(inStatus, Cr.NS_OK, "status OK");
@ -1081,7 +1081,7 @@ add_task(async function testAllRecordsInHttp3ExcludedList() {
// The the case that when all records are in http3 excluded list, we still // The the case that when all records are in http3 excluded list, we still
// give the first record one more shot. // give the first record one more shot.
chan = makeChan(`https://www.h3_all_excluded.org`); chan = makeChan(`https://www.h3_all_excluded.org`);
[req, resp] = await channelOpenPromise(chan); [req] = await channelOpenPromise(chan);
Assert.equal(req.protocolVersion, "h3"); Assert.equal(req.protocolVersion, "h3");
let internal = req.QueryInterface(Ci.nsIHttpChannelInternal); let internal = req.QueryInterface(Ci.nsIHttpChannelInternal);
Assert.equal(internal.remotePort, h3Port); Assert.equal(internal.remotePort, h3Port);

View file

@ -64,7 +64,7 @@ add_task(async function test_add_nat64_prefix_to_trr() {
await trrServer.start(); await trrServer.start();
dump(`port = ${trrServer.port}\n`); dump(`port = ${trrServer.port}\n`);
let chan = makeChan(`https://localhost:${trrServer.port}/test?bla=some`); let chan = makeChan(`https://localhost:${trrServer.port}/test?bla=some`);
let [req, resp] = await channelOpenPromise(chan); let [, resp] = await channelOpenPromise(chan);
equal(resp, "<h1> 404 Path not found: /test?bla=some</h1>"); equal(resp, "<h1> 404 Path not found: /test?bla=some</h1>");
dns.clearCache(true); dns.clearCache(true);
override.addIPOverride("ipv4only.arpa", "fe80::9b2b:c000:00aa"); override.addIPOverride("ipv4only.arpa", "fe80::9b2b:c000:00aa");

View file

@ -269,7 +269,7 @@ function test_address_in_use() {
socketName.append("socket-in-use"); socketName.append("socket-in-use");
// Create one server socket. // Create one server socket.
let server = new UnixServerSocket(socketName, allPermissions, -1); new UnixServerSocket(socketName, allPermissions, -1);
// Now try to create another with the same name. // Now try to create another with the same name.
do_check_throws_nsIException( do_check_throws_nsIException(

View file

@ -138,7 +138,7 @@ add_task(async function testUseHTTPSSVCForHttpsUpgrade() {
); );
let chan = makeChan(`https://test.httpssvc.com:8080/`); let chan = makeChan(`https://test.httpssvc.com:8080/`);
let [req, resp] = await channelOpenPromise(chan); let [req] = await channelOpenPromise(chan);
Assert.equal(req.getResponseHeader("x-connection-http2"), "yes"); Assert.equal(req.getResponseHeader("x-connection-http2"), "yes");
certOverrideService.setDisableAllSecurityChecksAndLetAttackersInterceptMyData( certOverrideService.setDisableAllSecurityChecksAndLetAttackersInterceptMyData(
@ -184,7 +184,7 @@ add_task(async function testUseHTTPSSVCAsHSTS() {
let listener = new EventSinkListener(); let listener = new EventSinkListener();
chan.notificationCallbacks = listener; chan.notificationCallbacks = listener;
let [req, resp] = await channelOpenPromise(chan); let [req] = await channelOpenPromise(chan);
req.QueryInterface(Ci.nsIHttpChannel); req.QueryInterface(Ci.nsIHttpChannel);
Assert.equal(req.getResponseHeader("x-connection-http2"), "yes"); Assert.equal(req.getResponseHeader("x-connection-http2"), "yes");
@ -195,7 +195,7 @@ add_task(async function testUseHTTPSSVCAsHSTS() {
listener = new EventSinkListener(); listener = new EventSinkListener();
chan.notificationCallbacks = listener; chan.notificationCallbacks = listener;
[req, resp] = await channelOpenPromise(chan); [req] = await channelOpenPromise(chan);
req.QueryInterface(Ci.nsIHttpChannel); req.QueryInterface(Ci.nsIHttpChannel);
Assert.equal(req.getResponseHeader("x-connection-http2"), "yes"); Assert.equal(req.getResponseHeader("x-connection-http2"), "yes");
@ -228,7 +228,7 @@ add_task(async function testUseHTTPSSVC() {
defaultOriginAttributes defaultOriginAttributes
); );
let [inRequest, inRecord, inStatus] = await listener; let [inRequest, , inStatus] = await listener;
Assert.equal(inRequest, request, "correct request was used"); Assert.equal(inRequest, request, "correct request was used");
Assert.equal(inStatus, Cr.NS_OK, "status OK"); Assert.equal(inStatus, Cr.NS_OK, "status OK");
@ -239,7 +239,7 @@ add_task(async function testUseHTTPSSVC() {
); );
let chan = makeChan(`https://test.httpssvc.com:8888`); let chan = makeChan(`https://test.httpssvc.com:8888`);
let [req, resp] = await channelOpenPromise(chan); let [req] = await channelOpenPromise(chan);
// Test if this request is done by h2. // Test if this request is done by h2.
Assert.equal(req.getResponseHeader("x-connection-http2"), "yes"); Assert.equal(req.getResponseHeader("x-connection-http2"), "yes");
@ -315,7 +315,7 @@ add_task(async function testFallback() {
// When the connection with port 8888 failed, the correct h2Port will be used // When the connection with port 8888 failed, the correct h2Port will be used
// to connect again. // to connect again.
let chan = makeChan(`https://test.fallback.com:${h2Port}`); let chan = makeChan(`https://test.fallback.com:${h2Port}`);
let [req, resp] = await channelOpenPromise(chan); let [req] = await channelOpenPromise(chan);
// Test if this request is done by h2. // Test if this request is done by h2.
Assert.equal(req.getResponseHeader("x-connection-http2"), "yes"); Assert.equal(req.getResponseHeader("x-connection-http2"), "yes");