Bug 1849873 - Fix some ESLint no-shadow issues in netwerk/test. r=necko-reviewers,valentin

Differential Revision: https://phabricator.services.mozilla.com/D186717
This commit is contained in:
Mark Banner 2023-08-24 15:38:23 +00:00
Родитель 66db05b547
Коммит 4cd7999022
22 изменённых файлов: 125 добавлений и 138 удалений

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

@ -16,10 +16,10 @@ var gHeaders = 0;
var gLoads = 0;
// setupTest() is run from 'onload='.
function setupTest(uri, domain, cookies, loads, headers) {
function setupTest(iframeUri, domain, cookies, loads, headers) {
info(
"setupTest uri: " +
uri +
iframeUri +
" domain: " +
domain +
" cookies: " +
@ -71,7 +71,7 @@ function setupTest(uri, domain, cookies, loads, headers) {
Promise.all([prefSet, scriptReady]).then(() => {
// load a window which contains an iframe; each will attempt to set
// cookies from their respective domains.
gPopup = window.open(uri, "hai", "width=100,height=100");
gPopup = window.open(iframeUri, "hai", "width=100,height=100");
});
}

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

@ -25,14 +25,7 @@ function waitForStream(stream, streamType) {
}
let currentThread =
Cc["@mozilla.org/thread-manager;1"].getService().currentThread;
stream.asyncWait(
stream => {
resolve(stream);
},
0,
0,
currentThread
);
stream.asyncWait(resolve, 0, 0, currentThread);
});
}

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

@ -719,7 +719,7 @@ function do_tests(whichRFC) {
// Allow following tests to run by catching exception from do_check_eq()
try {
Assert.equal(e.result, expectedDt);
} catch (e) {}
} catch (e1) {}
}
continue;
}
@ -756,7 +756,7 @@ function do_tests(whichRFC) {
// Allow following tests to run by catching exception from do_check_eq()
try {
Assert.equal(e.result, expectedFn);
} catch (e) {}
} catch (e1) {}
}
continue;
}

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

@ -396,7 +396,7 @@ add_task(async function test_ntlm_first() {
chan.notificationCallbacks = new Requestor(FLAG_RETURN_FALSE, 2);
let [req, buf] = await new Promise(resolve => {
chan.asyncOpen(
new ChannelListener((req, buf) => resolve([req, buf]), null)
new ChannelListener((request, buffer) => resolve([request, buffer]), null)
);
});
Assert.equal(buf, "OK");
@ -415,7 +415,7 @@ add_task(async function test_basic_first() {
chan.notificationCallbacks = new Requestor(FLAG_RETURN_FALSE, 2);
let [req, buf] = await new Promise(resolve => {
chan.asyncOpen(
new ChannelListener((req, buf) => resolve([req, buf]), null)
new ChannelListener((request, buffer) => resolve([request, buffer]), null)
);
});
Assert.equal(buf, "success");
@ -434,7 +434,7 @@ add_task(async function test_digest_first() {
chan.notificationCallbacks = new Requestor(FLAG_RETURN_FALSE, 2);
let [req, buf] = await new Promise(resolve => {
chan.asyncOpen(
new ChannelListener((req, buf) => resolve([req, buf]), null)
new ChannelListener((request, buffer) => resolve([request, buffer]), null)
);
});
Assert.equal(req.QueryInterface(Ci.nsIHttpChannel).responseStatus, 200);
@ -456,7 +456,7 @@ add_task(async function test_choose_most_secure() {
chan.notificationCallbacks = new Requestor(FLAG_RETURN_FALSE, 2);
let [req, buf] = await new Promise(resolve => {
chan.asyncOpen(
new ChannelListener((req, buf) => resolve([req, buf]), null)
new ChannelListener((request, buffer) => resolve([request, buffer]), null)
);
});
Assert.equal(req.QueryInterface(Ci.nsIHttpChannel).responseStatus, 200);

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

@ -61,7 +61,7 @@ add_task(async function test_http2() {
});
equal(req.status, Cr.NS_OK);
equal(req.QueryInterface(Ci.nsIHttpChannel).responseStatus, 404);
await server.registerPathHandler("/test", (req, resp) => {
await server.registerPathHandler("/test", (req1, resp) => {
resp.writeHead(200, {
"content-type": "text/html; charset=utf-8",
"content-encoding": "br",

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

@ -29,8 +29,8 @@ add_task(async function check_brotli() {
let [, buff] = await new Promise(resolve => {
chan.asyncOpen(
new ChannelListener(
(req, buff) => {
resolve([req, buff]);
(req, buff1) => {
resolve([req, buff1]);
},
null,
CL_IGNORE_CL
@ -109,7 +109,7 @@ add_task(
});
chan.asyncOpen(
new ChannelListener(
(req, buff) => resolve({ req, buff }),
(req1, buff1) => resolve({ req1, buff1 }),
null,
CL_ALLOW_UNKNOWN_CL
)

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

@ -85,8 +85,8 @@ function check_response(
// Do the request again and check the server handler is called appropriately
var chan = make_channel(path);
chan.asyncOpen(
new ChannelListener(function (request, buffer) {
Assert.equal(buffer, responseBody);
new ChannelListener(function (request1, buffer1) {
Assert.equal(buffer1, responseBody);
if (expectedExpiration) {
// Handler had to be called second time

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

@ -9,28 +9,28 @@ function run_test() {
"disk",
Ci.nsICacheStorage.OPEN_NORMALLY,
null,
new OpenCallback(NEW, "a1m", "a1d", function (entry) {
new OpenCallback(NEW, "a1m", "a1d", function () {
// Open for read and check
asyncOpenCacheEntry(
"http://a/",
"disk",
Ci.nsICacheStorage.OPEN_NORMALLY,
null,
new OpenCallback(NORMAL, "a1m", "a1d", function (entry) {
new OpenCallback(NORMAL, "a1m", "a1d", function () {
// Open for rewrite (truncate), write different meta and data
asyncOpenCacheEntry(
"http://a/",
"disk",
Ci.nsICacheStorage.OPEN_TRUNCATE,
null,
new OpenCallback(NEW, "a2m", "a2d", function (entry) {
new OpenCallback(NEW, "a2m", "a2d", function () {
// Open for read and check
asyncOpenCacheEntry(
"http://a/",
"disk",
Ci.nsICacheStorage.OPEN_NORMALLY,
null,
new OpenCallback(NORMAL, "a2m", "a2d", function (entry) {
new OpenCallback(NORMAL, "a2m", "a2d", function () {
finish_cache2_test();
})
);

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

@ -9,28 +9,28 @@ function run_test() {
"disk",
Ci.nsICacheStorage.OPEN_NORMALLY,
null,
new OpenCallback(NEW, "a1m", "a1d", function (entry) {
new OpenCallback(NEW, "a1m", "a1d", function () {
// Open for read and check
asyncOpenCacheEntry(
"http://ro/",
"disk",
Ci.nsICacheStorage.OPEN_READONLY,
null,
new OpenCallback(NORMAL, "a1m", "a1d", function (entry) {
new OpenCallback(NORMAL, "a1m", "a1d", function () {
// Open for rewrite (truncate), write different meta and data
asyncOpenCacheEntry(
"http://ro/",
"disk",
Ci.nsICacheStorage.OPEN_TRUNCATE,
null,
new OpenCallback(NEW, "a2m", "a2d", function (entry) {
new OpenCallback(NEW, "a2m", "a2d", function () {
// Open for read and check
asyncOpenCacheEntry(
"http://ro/",
"disk",
Ci.nsICacheStorage.OPEN_READONLY,
null,
new OpenCallback(NORMAL, "a2m", "a2d", function (entry) {
new OpenCallback(NORMAL, "a2m", "a2d", function () {
finish_cache2_test();
})
);

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

@ -9,34 +9,34 @@ function run_test() {
"disk",
Ci.nsICacheStorage.OPEN_NORMALLY,
null,
new OpenCallback(NEW | WAITFORWRITE, "a1m", "a1d", function (entry) {
new OpenCallback(NEW | WAITFORWRITE, "a1m", "a1d", function (entry1) {
// Open for read and check
Assert.equal(entry.dataSize, 3);
Assert.equal(entry1.dataSize, 3);
asyncOpenCacheEntry(
"http://a/",
"disk",
Ci.nsICacheStorage.OPEN_NORMALLY,
null,
new OpenCallback(NORMAL, "a1m", "a1d", function (entry) {
new OpenCallback(NORMAL, "a1m", "a1d", function (entry2) {
// Open for rewrite (truncate), write different meta and data
Assert.equal(entry.dataSize, 3);
Assert.equal(entry2.dataSize, 3);
asyncOpenCacheEntry(
"http://a/",
"disk",
Ci.nsICacheStorage.OPEN_TRUNCATE,
null,
new OpenCallback(NEW | WAITFORWRITE, "a2m", "a2d", function (
entry
entry3
) {
// Open for read and check
Assert.equal(entry.dataSize, 3);
Assert.equal(entry3.dataSize, 3);
asyncOpenCacheEntry(
"http://a/",
"disk",
Ci.nsICacheStorage.OPEN_NORMALLY,
null,
new OpenCallback(NORMAL, "a2m", "a2d", function (entry) {
Assert.equal(entry.dataSize, 3);
new OpenCallback(NORMAL, "a2m", "a2d", function (entry4) {
Assert.equal(entry4.dataSize, 3);
finish_cache2_test();
})
);

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

@ -9,28 +9,28 @@ function run_test() {
"disk",
Ci.nsICacheStorage.OPEN_NORMALLY,
null,
new OpenCallback(NEW | METAONLY, "a1m", "a1d", function (entry) {
new OpenCallback(NEW | METAONLY, "a1m", "a1d", function () {
// Open for read and check
asyncOpenCacheEntry(
"http://mt/",
"disk",
Ci.nsICacheStorage.OPEN_NORMALLY,
null,
new OpenCallback(NORMAL, "a1m", "", function (entry) {
new OpenCallback(NORMAL, "a1m", "", function () {
// Open for rewrite (truncate), write different meta and data
asyncOpenCacheEntry(
"http://mt/",
"disk",
Ci.nsICacheStorage.OPEN_TRUNCATE,
null,
new OpenCallback(NEW, "a2m", "a2d", function (entry) {
new OpenCallback(NEW, "a2m", "a2d", function () {
// Open for read and check
asyncOpenCacheEntry(
"http://mt/",
"disk",
Ci.nsICacheStorage.OPEN_NORMALLY,
null,
new OpenCallback(NORMAL, "a2m", "a2d", function (entry) {
new OpenCallback(NORMAL, "a2m", "a2d", function () {
finish_cache2_test();
})
);

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

@ -77,13 +77,13 @@ add_task(async function test() {
aInfo
) {
doomTasks.push(
new Promise(resolve => {
new Promise(resolve1 => {
Services.cache2
.diskCacheStorage(aInfo, false)
.asyncDoomURI(aURI, aIdEnhance, {
onCacheEntryDoomed() {
info("doomed");
resolve();
resolve1();
},
});
})

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

@ -47,7 +47,7 @@ add_task(async () => {
// Get the cookie file and the backup file.
Assert.ok(!do_get_cookie_file(profile).exists());
Assert.ok(!do_get_backup_file(profile).exists());
Assert.ok(!do_get_backup_file().exists());
// Create a cookie object for testing.
let now = Date.now() * 1000;
@ -74,13 +74,13 @@ add_task(async () => {
Services.prefs.clearUserPref("network.cookie.sameSite.laxByDefault");
});
function do_get_backup_file(profile) {
function do_get_backup_file() {
let file = profile.clone();
file.append("cookies.sqlite.bak");
return file;
}
function do_get_rebuild_backup_file(profile) {
function do_get_rebuild_backup_file() {
let file = profile.clone();
file.append("cookies.sqlite.bak-rebuild");
return file;
@ -191,8 +191,8 @@ async function run_test_1() {
// Check that the original database was renamed, and that it contains the
// original cookie.
Assert.ok(do_get_backup_file(profile).exists());
let backupdb = Services.storage.openDatabase(do_get_backup_file(profile));
Assert.ok(do_get_backup_file().exists());
let backupdb = Services.storage.openDatabase(do_get_backup_file());
Assert.equal(do_count_cookies_in_db(backupdb, "foo.com"), 1);
backupdb.close();
@ -210,9 +210,9 @@ async function run_test_1() {
// Clean up.
do_get_cookie_file(profile).remove(false);
do_get_backup_file(profile).remove(false);
do_get_backup_file().remove(false);
Assert.ok(!do_get_cookie_file(profile).exists());
Assert.ok(!do_get_backup_file(profile).exists());
Assert.ok(!do_get_backup_file().exists());
}
async function run_test_2() {
@ -228,7 +228,7 @@ async function run_test_2() {
});
for (let i = 0; i < 3000; ++i) {
let uri = NetUtil.newURI("http://" + i + ".com/");
uri = NetUtil.newURI("http://" + i + ".com/");
Services.cookies.setCookieStringFromHttp(
uri,
"oh=hai; max-age=1000",
@ -248,7 +248,7 @@ async function run_test_2() {
// At this point, the database connection should be open. Ensure that it
// succeeded.
Assert.ok(!do_get_backup_file(profile).exists());
Assert.ok(!do_get_backup_file().exists());
// Recreate a new database since it was corrupted
Assert.equal(Services.cookies.countCookiesFromHost("0.com"), 0);
@ -258,8 +258,8 @@ async function run_test_2() {
await promise_close_profile();
// Check that the original database was renamed.
Assert.ok(do_get_backup_file(profile).exists());
Assert.equal(do_get_backup_file(profile).fileSize, size);
Assert.ok(do_get_backup_file().exists());
Assert.equal(do_get_backup_file().fileSize, size);
let db = Services.storage.openDatabase(do_get_cookie_file(profile));
db.close();
@ -272,9 +272,9 @@ async function run_test_2() {
// Clean up.
do_get_cookie_file(profile).remove(false);
do_get_backup_file(profile).remove(false);
do_get_backup_file().remove(false);
Assert.ok(!do_get_cookie_file(profile).exists());
Assert.ok(!do_get_backup_file(profile).exists());
Assert.ok(!do_get_backup_file().exists());
}
async function run_test_3() {
@ -324,7 +324,7 @@ async function run_test_3() {
// At this point, the database connection should be open. Ensure that it
// succeeded.
Assert.ok(!do_get_backup_file(profile).exists());
Assert.ok(!do_get_backup_file().exists());
// Recreate a new database since it was corrupted
Assert.equal(Services.cookies.countCookiesFromHost("hither.com"), 0);
@ -339,16 +339,16 @@ async function run_test_3() {
db.close();
// Check that the original database was renamed.
Assert.ok(do_get_backup_file(profile).exists());
Assert.equal(do_get_backup_file(profile).fileSize, size);
Assert.ok(do_get_backup_file().exists());
Assert.equal(do_get_backup_file().fileSize, size);
// Rename it back, and try loading the entire database synchronously.
do_get_backup_file(profile).moveTo(null, "cookies.sqlite");
do_get_backup_file().moveTo(null, "cookies.sqlite");
do_load_profile();
// At this point, the database connection should be open. Ensure that it
// succeeded.
Assert.ok(!do_get_backup_file(profile).exists());
Assert.ok(!do_get_backup_file().exists());
// Synchronously read in everything.
Assert.equal(do_count_cookies(), 0);
@ -361,14 +361,14 @@ async function run_test_3() {
db.close();
// Check that the original database was renamed.
Assert.ok(do_get_backup_file(profile).exists());
Assert.equal(do_get_backup_file(profile).fileSize, size);
Assert.ok(do_get_backup_file().exists());
Assert.equal(do_get_backup_file().fileSize, size);
// Clean up.
do_get_cookie_file(profile).remove(false);
do_get_backup_file(profile).remove(false);
do_get_backup_file().remove(false);
Assert.ok(!do_get_cookie_file(profile).exists());
Assert.ok(!do_get_backup_file(profile).exists());
Assert.ok(!do_get_backup_file().exists());
}
async function run_test_4() {
@ -382,7 +382,7 @@ async function run_test_4() {
contentPolicyType: Ci.nsIContentPolicy.TYPE_DOCUMENT,
});
for (let i = 0; i < 3000; ++i) {
let uri = NetUtil.newURI("http://" + i + ".com/");
uri = NetUtil.newURI("http://" + i + ".com/");
Services.cookies.setCookieStringFromHttp(
uri,
"oh=hai; max-age=1000",
@ -402,7 +402,7 @@ async function run_test_4() {
// At this point, the database connection should be open. Ensure that it
// succeeded.
Assert.ok(!do_get_backup_file(profile).exists());
Assert.ok(!do_get_backup_file().exists());
// Recreate a new database since it was corrupted
Assert.equal(Services.cookies.countCookiesFromHost("0.com"), 0);
@ -422,8 +422,8 @@ async function run_test_4() {
await promise_close_profile();
// Check that the original database was renamed.
Assert.ok(do_get_backup_file(profile).exists());
Assert.equal(do_get_backup_file(profile).fileSize, size);
Assert.ok(do_get_backup_file().exists());
Assert.equal(do_get_backup_file().fileSize, size);
// Load the profile, and check that it contains the new cookie.
do_load_profile();
@ -435,9 +435,9 @@ async function run_test_4() {
// Clean up.
do_get_cookie_file(profile).remove(false);
do_get_backup_file(profile).remove(false);
do_get_backup_file().remove(false);
Assert.ok(!do_get_cookie_file(profile).exists());
Assert.ok(!do_get_backup_file(profile).exists());
Assert.ok(!do_get_backup_file().exists());
}
async function run_test_5() {
@ -456,7 +456,7 @@ async function run_test_5() {
channel
);
for (let i = 0; i < 3000; ++i) {
let uri = NetUtil.newURI("http://" + i + ".com/");
uri = NetUtil.newURI("http://" + i + ".com/");
Services.cookies.setCookieStringFromHttp(
uri,
"oh=hai; max-age=1000",
@ -476,15 +476,15 @@ async function run_test_5() {
// At this point, the database connection should be open. Ensure that it
// succeeded.
Assert.ok(!do_get_backup_file(profile).exists());
Assert.ok(!do_get_backup_file().exists());
// Recreate a new database since it was corrupted
Assert.equal(Services.cookies.countCookiesFromHost("bar.com"), 0);
Assert.equal(Services.cookies.countCookiesFromHost("0.com"), 0);
Assert.equal(do_count_cookies(), 0);
Assert.ok(do_get_backup_file(profile).exists());
Assert.equal(do_get_backup_file(profile).fileSize, size);
Assert.ok(!do_get_rebuild_backup_file(profile).exists());
Assert.ok(do_get_backup_file().exists());
Assert.equal(do_get_backup_file().fileSize, size);
Assert.ok(!do_get_rebuild_backup_file().exists());
// Open a database connection, and write a row that will trigger a constraint
// violation.
@ -495,8 +495,8 @@ async function run_test_5() {
db.close();
// Check that the original backup and the database itself are gone.
Assert.ok(do_get_backup_file(profile).exists());
Assert.equal(do_get_backup_file(profile).fileSize, size);
Assert.ok(do_get_backup_file().exists());
Assert.equal(do_get_backup_file().fileSize, size);
Assert.equal(Services.cookies.countCookiesFromHost("bar.com"), 0);
Assert.equal(Services.cookies.countCookiesFromHost("0.com"), 0);
@ -508,7 +508,7 @@ async function run_test_5() {
// Clean up.
do_get_cookie_file(profile).remove(false);
do_get_backup_file(profile).remove(false);
do_get_backup_file().remove(false);
Assert.ok(!do_get_cookie_file(profile).exists());
Assert.ok(!do_get_backup_file(profile).exists());
Assert.ok(!do_get_backup_file().exists());
}

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

@ -248,8 +248,8 @@ function cancel_middle(metadata, response) {
cancelDuringOnDataListener.receivedSomeData = resolve;
});
p.then(() => {
let str1 = "b".repeat(128 * 1024);
response.write(str1, str1.length);
let str2 = "b".repeat(128 * 1024);
response.write(str2, str2.length);
response.finish();
});
}

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

@ -54,7 +54,7 @@ function checkResult(inRecord, noHttp2, noHttp3, result) {
// There are two records: one has a echConfig and the other doesn't.
// We want to test if the record with echConfig is preferred.
add_task(async function testEchConfigEnabled() {
let trrServer = new TRRServer();
trrServer = new TRRServer();
await trrServer.start();
Services.prefs.setIntPref("network.trr.mode", 3);
@ -152,7 +152,7 @@ add_task(async function testEchConfigEnabled() {
add_task(async function testTwoRecordsHaveEchConfig() {
Services.dns.clearCache(true);
let trrServer = new TRRServer();
trrServer = new TRRServer();
await trrServer.start();
Services.prefs.setBoolPref("network.dns.echconfig.enabled", true);
@ -251,7 +251,7 @@ add_task(async function testTwoRecordsHaveEchConfig() {
add_task(async function testTwoRecordsHaveEchConfig1() {
Services.dns.clearCache(true);
let trrServer = new TRRServer();
trrServer = new TRRServer();
await trrServer.start();
Services.prefs.setBoolPref("network.dns.echconfig.enabled", true);
@ -357,7 +357,7 @@ add_task(async function testTwoRecordsHaveEchConfig1() {
add_task(async function testOneRecordsHasEchConfig() {
Services.dns.clearCache(true);
let trrServer = new TRRServer();
trrServer = new TRRServer();
await trrServer.start();
Services.prefs.setBoolPref("network.dns.echconfig.enabled", true);
@ -451,7 +451,7 @@ add_task(async function testOneRecordsHasEchConfig() {
add_task(async function testHttp3AndHttp2Pref() {
Services.dns.clearCache(true);
let trrServer = new TRRServer();
trrServer = new TRRServer();
await trrServer.start();
Services.prefs.setBoolPref("network.http.http3.enable", false);

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

@ -174,36 +174,36 @@ function* do_run_test() {
// Populate it with more cookies.
for (let i = 60; i < 80; ++i) {
let cookie = new Cookie(
"oh" + i,
"hai",
"foo.com",
"/",
futureExpiry,
now,
now + i,
false,
false,
false
schema2db.insertCookie(
new Cookie(
"oh" + i,
"hai",
"foo.com",
"/",
futureExpiry,
now,
now + i,
false,
false,
false
)
);
schema2db.insertCookie(cookie);
}
for (let i = 80; i < 100; ++i) {
let cookie = new Cookie(
"oh" + i,
"hai",
"cat.com",
"/",
futureExpiry,
now,
now + i,
false,
false,
false
schema2db.insertCookie(
new Cookie(
"oh" + i,
"hai",
"cat.com",
"/",
futureExpiry,
now,
now + i,
false,
false,
false
)
);
schema2db.insertCookie(cookie);
}
// Attempt to add a cookie with the same (name, host, path) values as another

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

@ -43,8 +43,6 @@ var requestListenerObserver = {
) {
var chan = subject.QueryInterface(Ci.nsIHttpChannel);
chan.suspend();
var obs = Cc["@mozilla.org/observer-service;1"].getService();
obs = obs.QueryInterface(Ci.nsIObserverService);
obs.removeObserver(this, "http-on-modify-request");
// Timers are bad, but we need to wait to see that we are not trying to

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

@ -20,8 +20,6 @@ function onExamineListener(callback) {
obs.addObserver(
{
observe(subject, topic, data) {
var obs = Cc["@mozilla.org/observer-service;1"].getService();
obs = obs.QueryInterface(Ci.nsIObserverService);
obs.removeObserver(this, "http-on-examine-response");
callback(subject.QueryInterface(Ci.nsIHttpChannel));
},
@ -30,9 +28,9 @@ function onExamineListener(callback) {
);
}
function startChannelRequest(baseUrl, flags, callback) {
function startChannelRequest(uri, flags, callback) {
var chan = NetUtil.newChannel({
uri: baseUrl,
uri,
loadUsingSystemPrincipal: true,
});
chan.asyncOpen(new ChannelListener(callback, null, flags));

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

@ -32,8 +32,6 @@ function onModifyListener(callback) {
obs.addObserver(
{
observe(subject, topic, data) {
var obs = Cc["@mozilla.org/observer-service;1"].getService();
obs = obs.QueryInterface(Ci.nsIObserverService);
obs.removeObserver(this, "http-on-modify-request");
callback(subject.QueryInterface(Ci.nsIHttpChannel));
},
@ -42,9 +40,9 @@ function onModifyListener(callback) {
);
}
function startChannelRequest(baseUrl, flags, expectedResponse = null) {
function startChannelRequest(uri, flags, expectedResponse = null) {
var chan = NetUtil.newChannel({
uri: baseUrl,
uri,
loadUsingSystemPrincipal: true,
});
chan.asyncOpen(

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

@ -118,8 +118,8 @@ function handle_remote_response(request, buffer) {
// hit the network instead of synthesizing
add_test(function () {
var chan = make_channel(URL + "/body", null, function (chan) {
chan.resetInterception(false);
var chan = make_channel(URL + "/body", null, function (channel) {
channel.resetInterception(false);
});
chan.asyncOpen(new ChannelListener(handle_remote_response, null));
});
@ -135,8 +135,8 @@ add_test(function () {
// hit the network instead of synthesizing, to test that no previous synthesized
// cache entry is used.
add_test(function () {
var chan = make_channel(URL + "/body", null, function (chan) {
chan.resetInterception(false);
var chan = make_channel(URL + "/body", null, function (channel) {
channel.resetInterception(false);
});
chan.asyncOpen(new ChannelListener(handle_remote_response, null));
});
@ -171,9 +171,9 @@ add_test(function () {
// ensure that the channel waits for a decision
add_test(function () {
var chan = make_channel(URL + "/body", null, function (chan) {
var chan = make_channel(URL + "/body", null, function (channel) {
do_timeout(100, function () {
chan.resetInterception(false);
channel.resetInterception(false);
});
});
chan.asyncOpen(new ChannelListener(handle_remote_response, null));
@ -212,12 +212,12 @@ add_test(function () {
// ensure that the channel can't be cancelled via nsIInterceptedChannel after making a decision
add_test(function () {
var chan = make_channel(URL + "/body", null, function (chan) {
chan.resetInterception(false);
var chan = make_channel(URL + "/body", null, function (channel) {
channel.resetInterception(false);
do_timeout(0, function () {
var gotexception = false;
try {
chan.cancelInterception();
channel.cancelInterception();
} catch (x) {
gotexception = true;
}
@ -277,7 +277,7 @@ add_test(function () {
// In this case we should automatically ResetInterception() and complete the
// network request.
add_test(function () {
var chan = make_channel(URL + "/body", null, function (chan) {
var chan = make_channel(URL + "/body", null, function (channel) {
throw new Error("boom");
});
chan.asyncOpen(new ChannelListener(handle_remote_response, null));

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

@ -23,7 +23,7 @@ registerCleanupFunction(async () => {
*/
function promiseObserverNotification(topic, matchFunc) {
return new Promise((resolve, reject) => {
Services.obs.addObserver(function observe(subject, topic, data) {
Services.obs.addObserver(function observe(subject, topic1, data) {
let matches = typeof matchFunc != "function" || matchFunc(subject, data);
if (!matches) {
return;

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

@ -381,7 +381,7 @@ function test_connect_permission() {
.openInputStream(0, 0, 0)
.QueryInterface(Ci.nsIAsyncInputStream);
client1AsyncInput.asyncWait(
function (aStream) {
function () {
info("called test_connect_permission's client1's onInputStreamReady");
log += "1";
@ -405,7 +405,7 @@ function test_connect_permission() {
.openInputStream(0, 0, 0)
.QueryInterface(Ci.nsIAsyncInputStream);
client2AsyncInput.asyncWait(
function (aStream) {
function () {
info("called test_connect_permission's client2's onInputStreamReady");
log += "2";