diff options
Diffstat (limited to 'netwerk/test')
272 files changed, 1091 insertions, 826 deletions
diff --git a/netwerk/test/browser/browser_103_assets.js b/netwerk/test/browser/browser_103_assets.js index 4e32c8bf7c..0d2ad354f2 100644 --- a/netwerk/test/browser/browser_103_assets.js +++ b/netwerk/test/browser/browser_103_assets.js @@ -41,7 +41,7 @@ async function test_hint_asset(testName, asset, variant) { let observer = { QueryInterface: ChromeUtils.generateQI(["nsIObserver"]), - observe(aSubject, aTopic, aData) { + observe(aSubject, aTopic) { if (aTopic == "earlyhints-connectback") { numConnectBackRemaining -= 1; } diff --git a/netwerk/test/browser/browser_103_cleanup.js b/netwerk/test/browser/browser_103_cleanup.js index c823f5f01a..9609312e02 100644 --- a/netwerk/test/browser/browser_103_cleanup.js +++ b/netwerk/test/browser/browser_103_cleanup.js @@ -16,7 +16,7 @@ add_task(async function test_103_cancel_parent_connect() { let observed_cancel_reason = ""; let observer = { QueryInterface: ChromeUtils.generateQI(["nsIObserver"]), - observe(aSubject, aTopic, aData) { + observe(aSubject, aTopic) { aSubject = aSubject.QueryInterface(Ci.nsIRequest); if ( aTopic == "http-on-stop-request" && diff --git a/netwerk/test/browser/browser_103_private_window.js b/netwerk/test/browser/browser_103_private_window.js index 7d23ea4b28..909bec0143 100644 --- a/netwerk/test/browser/browser_103_private_window.js +++ b/netwerk/test/browser/browser_103_private_window.js @@ -35,7 +35,7 @@ async function test_early_hints_load_url(usePrivateWin) { let observed = {}; let observer = { QueryInterface: ChromeUtils.generateQI(["nsIObserver"]), - observe(aSubject, aTopic, aData) { + observe(aSubject, aTopic) { if (aTopic == "http-on-opening-request") { let channel = aSubject.QueryInterface(Ci.nsIHttpChannel); if (channel.URI.spec === expectedUrl) { diff --git a/netwerk/test/browser/browser_103_redirect_from_server.js b/netwerk/test/browser/browser_103_redirect_from_server.js index 0357d11516..2edf15ba97 100644 --- a/netwerk/test/browser/browser_103_redirect_from_server.js +++ b/netwerk/test/browser/browser_103_redirect_from_server.js @@ -111,7 +111,7 @@ async function test_hint_redirect( if (numRequestRemaining > 0) { let observer = { QueryInterface: ChromeUtils.generateQI(["nsIObserver"]), - observe(aSubject, aTopic, aData) { + observe(aSubject, aTopic) { aSubject.QueryInterface(Ci.nsIIdentChannel); let id = aSubject.channelId; if (observedChannelIds.includes(id)) { diff --git a/netwerk/test/browser/browser_NetUtil.js b/netwerk/test/browser/browser_NetUtil.js index 09875a5280..791498f031 100644 --- a/netwerk/test/browser/browser_NetUtil.js +++ b/netwerk/test/browser/browser_NetUtil.js @@ -107,5 +107,5 @@ WindowListener.prototype = { { once: true } ); }, - onCloseWindow(aXULWindow) {}, + onCloseWindow() {}, }; diff --git a/netwerk/test/browser/browser_cookie_filtering_basic.js b/netwerk/test/browser/browser_cookie_filtering_basic.js index e51bed5bc5..c5dfb622ab 100644 --- a/netwerk/test/browser/browser_cookie_filtering_basic.js +++ b/netwerk/test/browser/browser_cookie_filtering_basic.js @@ -104,15 +104,17 @@ async function test_basic_suite_org_duplicate() { let parentpid = Services.appinfo.processID; let pid1 = testStruct1.browser.frameLoader.remoteTab.osPid; let pid3 = testStruct3.browser.frameLoader.remoteTab.osPid; - ok( - parentpid != pid1, + Assert.notEqual( + parentpid, + pid1, "Parent pid should differ from content process for 1st example.org" ); - ok( - parentpid != pid3, + Assert.notEqual( + parentpid, + pid3, "Parent pid should differ from content process for 2nd example.org" ); - ok(pid1 != pid3, "Content pids should differ from each other"); + Assert.notEqual(pid1, pid3, "Content pids should differ from each other"); await SpecialPowers.spawn( testStruct1.browser, diff --git a/netwerk/test/browser/browser_cookie_filtering_oa.js b/netwerk/test/browser/browser_cookie_filtering_oa.js index f69ad09e81..13102a1954 100644 --- a/netwerk/test/browser/browser_cookie_filtering_oa.js +++ b/netwerk/test/browser/browser_cookie_filtering_oa.js @@ -119,9 +119,21 @@ async function test_private() { let parentpid = Services.appinfo.processID; let privatePid = testStruct5.browser.frameLoader.remoteTab.osPid; let pid = testStruct2.browser.frameLoader.remoteTab.osPid; - ok(parentpid != privatePid, "Parent and private processes are unique"); - ok(parentpid != pid, "Parent and non-private processes are unique"); - ok(privatePid != pid, "Private and non-private processes are unique"); + Assert.notEqual( + parentpid, + privatePid, + "Parent and private processes are unique" + ); + Assert.notEqual( + parentpid, + pid, + "Parent and non-private processes are unique" + ); + Assert.notEqual( + privatePid, + pid, + "Private and non-private processes are unique" + ); // example.com await SpecialPowers.spawn( diff --git a/netwerk/test/browser/browser_cookie_sync_across_tabs.js b/netwerk/test/browser/browser_cookie_sync_across_tabs.js index 127bb2555b..483169ed44 100644 --- a/netwerk/test/browser/browser_cookie_sync_across_tabs.js +++ b/netwerk/test/browser/browser_cookie_sync_across_tabs.js @@ -34,7 +34,7 @@ add_task(async function () { let pid2 = browser2.frameLoader.remoteTab.osPid; // Note, this might not be true once fission is implemented (Bug 1451850) - ok(pid1 != pid2, "We should have different processes here."); + Assert.notEqual(pid1, pid2, "We should have different processes here."); await SpecialPowers.spawn(browser1, [], async function () { is(content.document.cookie, "", "Expecting no cookies"); diff --git a/netwerk/test/browser/browser_nsIFormPOSTActionChannel.js b/netwerk/test/browser/browser_nsIFormPOSTActionChannel.js index e791794579..20ef3840f3 100644 --- a/netwerk/test/browser/browser_nsIFormPOSTActionChannel.js +++ b/netwerk/test/browser/browser_nsIFormPOSTActionChannel.js @@ -26,7 +26,7 @@ CustomProtocolHandler.prototype = { newChannel(aURI, aLoadInfo) { return new CustomChannel(aURI, aLoadInfo); }, - allowPort(port, scheme) { + allowPort(port) { return port != -1; }, @@ -56,7 +56,7 @@ CustomChannel.prototype = { set uploadStream(val) { throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED); }, - setUploadStream(aStream, aContentType, aContentLength) { + setUploadStream(aStream) { this._uploadStream = aStream; }, @@ -172,7 +172,7 @@ document.getElementById('form').submit(); get status() { return Cr.NS_OK; }, - cancel(status) {}, + cancel() {}, loadGroup: null, loadFlags: Ci.nsIRequest.LOAD_NORMAL | diff --git a/netwerk/test/browser/browser_test_io_activity.js b/netwerk/test/browser/browser_test_io_activity.js index 1e9cb29b6d..b6f498ed5f 100644 --- a/netwerk/test/browser/browser_test_io_activity.js +++ b/netwerk/test/browser/browser_test_io_activity.js @@ -35,8 +35,8 @@ add_task(async function testRequestIOActivity() { waitForExplicitFinish(); Services.obs.notifyObservers(null, "profile-initial-state"); - await BrowserTestUtils.withNewTab(TEST_URL, async function (browser) { - await BrowserTestUtils.withNewTab(TEST_URL2, async function (browser) { + await BrowserTestUtils.withNewTab(TEST_URL, async function () { + await BrowserTestUtils.withNewTab(TEST_URL2, async function () { let results = await ChromeUtils.requestIOActivity(); processResults(results); diff --git a/netwerk/test/gtest/TestCacheControlParser.cpp b/netwerk/test/gtest/TestCacheControlParser.cpp new file mode 100644 index 0000000000..df1cd9ec73 --- /dev/null +++ b/netwerk/test/gtest/TestCacheControlParser.cpp @@ -0,0 +1,64 @@ +#include "gtest/gtest.h" + +#include "CacheControlParser.h" + +using namespace mozilla; +using namespace mozilla::net; + +TEST(TestCacheControlParser, NegativeMaxAge) +{ + CacheControlParser cc( + "no-store,no-cache,max-age=-3600,max-stale=7,private"_ns); + ASSERT_TRUE(cc.NoStore()); + ASSERT_TRUE(cc.NoCache()); + uint32_t max_age{2}; + ASSERT_FALSE(cc.MaxAge(&max_age)); + ASSERT_EQ(max_age, 0U); + uint32_t max_stale; + ASSERT_TRUE(cc.MaxStale(&max_stale)); + ASSERT_EQ(max_stale, 7U); + ASSERT_TRUE(cc.Private()); +} + +TEST(TestCacheControlParser, EmptyMaxAge) +{ + CacheControlParser cc("no-store,no-cache,max-age,max-stale=77,private"_ns); + ASSERT_TRUE(cc.NoStore()); + ASSERT_TRUE(cc.NoCache()); + uint32_t max_age{5}; + ASSERT_FALSE(cc.MaxAge(&max_age)); + ASSERT_EQ(max_age, 0U); + uint32_t max_stale; + ASSERT_TRUE(cc.MaxStale(&max_stale)); + ASSERT_EQ(max_stale, 77U); + ASSERT_TRUE(cc.Private()); +} + +TEST(TestCacheControlParser, NegaTiveMaxStale) +{ + CacheControlParser cc( + "no-store,no-cache,max-age=3600,max-stale=-222,private"_ns); + ASSERT_TRUE(cc.NoStore()); + ASSERT_TRUE(cc.NoCache()); + uint32_t max_age; + ASSERT_TRUE(cc.MaxAge(&max_age)); + ASSERT_EQ(max_age, 3600U); + uint32_t max_stale; + ASSERT_TRUE(cc.MaxStale(&max_stale)); + ASSERT_EQ(max_stale, PR_UINT32_MAX); + ASSERT_TRUE(cc.Private()); +} + +TEST(TestCacheControlParser, EmptyMaxStale) +{ + CacheControlParser cc("no-store,no-cache,max-age=3600,max-stale,private"_ns); + ASSERT_TRUE(cc.NoStore()); + ASSERT_TRUE(cc.NoCache()); + uint32_t max_age; + ASSERT_TRUE(cc.MaxAge(&max_age)); + ASSERT_EQ(max_age, 3600U); + uint32_t max_stale; + ASSERT_TRUE(cc.MaxStale(&max_stale)); + ASSERT_EQ(max_stale, PR_UINT32_MAX); + ASSERT_TRUE(cc.Private()); +} diff --git a/netwerk/test/gtest/moz.build b/netwerk/test/gtest/moz.build index b6d82b41db..571c908707 100644 --- a/netwerk/test/gtest/moz.build +++ b/netwerk/test/gtest/moz.build @@ -8,6 +8,7 @@ UNIFIED_SOURCES += [ "TestBase64Stream.cpp", "TestBind.cpp", "TestBufferedInputStream.cpp", + "TestCacheControlParser.cpp", "TestCommon.cpp", "TestCookie.cpp", "TestDNSPacket.cpp", @@ -47,7 +48,7 @@ if CONFIG["OS_TARGET"] == "WINNT": UNIFIED_SOURCES += ["TestNetworkLinkIdHashingWindows.cpp"] # run the test on mac only -if CONFIG["OS_TARGET"] == "Darwin": +if CONFIG["TARGET_OS"] == "OSX": UNIFIED_SOURCES += ["TestNetworkLinkIdHashingDarwin.cpp"] TEST_HARNESS_FILES.gtest += [ @@ -61,6 +62,7 @@ USE_LIBS += [ LOCAL_INCLUDES += [ "/netwerk/base", "/netwerk/cookie", + "/netwerk/protocol/http", "/toolkit/components/jsoncpp/include", "/xpcom/tests/gtest", ] @@ -70,7 +72,7 @@ if CONFIG["OS_TARGET"] == "WINNT": LOCAL_INCLUDES += ["/netwerk/system/win32"] # mac includes only -if CONFIG["OS_TARGET"] == "Darwin": +if CONFIG["TARGET_OS"] == "OSX": LOCAL_INCLUDES += ["/netwerk/system/mac"] include("/ipc/chromium/chromium-config.mozbuild") diff --git a/netwerk/test/http3server/Cargo.toml b/netwerk/test/http3server/Cargo.toml index 24fdd28137..60ff22c530 100644 --- a/netwerk/test/http3server/Cargo.toml +++ b/netwerk/test/http3server/Cargo.toml @@ -6,10 +6,10 @@ edition = "2018" license = "MPL-2.0" [dependencies] -neqo-transport = { tag = "v0.7.0", git = "https://github.com/mozilla/neqo" } -neqo-common = { tag = "v0.7.0", git = "https://github.com/mozilla/neqo" } -neqo-http3 = { tag = "v0.7.0", git = "https://github.com/mozilla/neqo" } -neqo-qpack = { tag = "v0.7.0", git = "https://github.com/mozilla/neqo" } +neqo-transport = { tag = "v0.7.2", git = "https://github.com/mozilla/neqo" } +neqo-common = { tag = "v0.7.2", git = "https://github.com/mozilla/neqo" } +neqo-http3 = { tag = "v0.7.2", git = "https://github.com/mozilla/neqo" } +neqo-qpack = { tag = "v0.7.2", git = "https://github.com/mozilla/neqo" } mio = "0.6.17" mio-extras = "2.0.5" log = "0.4.0" @@ -21,7 +21,7 @@ tokio = { version = "1", features = ["rt-multi-thread"] } mozilla-central-workspace-hack = { version = "0.1", features = ["http3server"], optional = true } [dependencies.neqo-crypto] -tag = "v0.7.0" +tag = "v0.7.2" git = "https://github.com/mozilla/neqo" default-features = false features = ["gecko"] diff --git a/netwerk/test/httpserver/httpd.sys.mjs b/netwerk/test/httpserver/httpd.sys.mjs index 569e4d1489..b9d728d631 100644 --- a/netwerk/test/httpserver/httpd.sys.mjs +++ b/netwerk/test/httpserver/httpd.sys.mjs @@ -450,7 +450,7 @@ nsHttpServer.prototype = { * was stopped using nsIHttpServer.stop) * @see nsIServerSocketListener.onStopListening */ - onStopListening(socket, status) { + onStopListening(socket) { dumpn(">>> shutting down server on port " + socket.port); for (var n in this._connections) { if (!this._connections[n]._requestStarted) { @@ -4430,7 +4430,7 @@ Response.prototype = { var response = this; var copyObserver = { - onStartRequest(request) { + onStartRequest() { dumpn("*** preamble copying started"); }, @@ -4488,7 +4488,7 @@ Response.prototype = { var response = this; var copyObserver = { - onStartRequest(request) { + onStartRequest() { dumpn("*** onStartRequest"); }, diff --git a/netwerk/test/httpserver/test/data/sjs/range-checker.sjs b/netwerk/test/httpserver/test/data/sjs/range-checker.sjs index 4bc447f739..b73064a568 100644 --- a/netwerk/test/httpserver/test/data/sjs/range-checker.sjs +++ b/netwerk/test/httpserver/test/data/sjs/range-checker.sjs @@ -1 +1 @@ -function handleRequest(request, response) {} +function handleRequest() {} diff --git a/netwerk/test/httpserver/test/test_body_length.js b/netwerk/test/httpserver/test/test_body_length.js index 85f35d7441..80c548274f 100644 --- a/netwerk/test/httpserver/test/test_body_length.js +++ b/netwerk/test/httpserver/test/test_body_length.js @@ -22,7 +22,7 @@ function run_test() { const REQUEST_DATA = "12345678901234567"; -function contentLength(request, response) { +function contentLength(request) { Assert.equal(request.method, "POST"); Assert.equal(request.getHeader("Content-Length"), "017"); diff --git a/netwerk/test/httpserver/test/test_errorhandler_exception.js b/netwerk/test/httpserver/test/test_errorhandler_exception.js index e9cdb0bf4f..5167ed23a8 100644 --- a/netwerk/test/httpserver/test/test_errorhandler_exception.js +++ b/netwerk/test/httpserver/test/test_errorhandler_exception.js @@ -78,18 +78,18 @@ function start_multiple_exceptions_500(ch) { checkStatusLine(ch, 1, 1, 500, "Internal Server Error"); } -function succeeded(ch, status, data) { +function succeeded(ch, status) { Assert.ok(Components.isSuccessCode(status)); } -function register400Handler(ch) { +function register400Handler() { srv.registerErrorHandler(400, throwsException); } // PATH HANDLERS // /throws/exception (and also a 404 and 400 error handler) -function throwsException(metadata, response) { +function throwsException() { throw new Error("this shouldn't cause an exit..."); do_throw("Not reached!"); // eslint-disable-line no-unreachable } diff --git a/netwerk/test/httpserver/test/test_processasync.js b/netwerk/test/httpserver/test/test_processasync.js index 321c9b086f..d652860a25 100644 --- a/netwerk/test/httpserver/test/test_processasync.js +++ b/netwerk/test/httpserver/test/test_processasync.js @@ -181,7 +181,7 @@ handlers["/handleAsync2"] = handleAsync2; var startTime_handleAsync2; -function init_handleAsync2(ch) { +function init_handleAsync2() { var now = (startTime_handleAsync2 = Date.now()); dumpn("*** init_HandleAsync2: start time " + now); } diff --git a/netwerk/test/httpserver/test/test_setindexhandler.js b/netwerk/test/httpserver/test/test_setindexhandler.js index e65f565673..644edd404b 100644 --- a/netwerk/test/httpserver/test/test_setindexhandler.js +++ b/netwerk/test/httpserver/test/test_setindexhandler.js @@ -44,7 +44,7 @@ function stopCustomIndexHandler(ch, status, data) { function startDefaultIndexHandler(ch) { Assert.equal(ch.responseStatus, 200); } -function stopDefaultIndexHandler(ch, status, data) { +function stopDefaultIndexHandler(ch, status) { Assert.ok(Components.isSuccessCode(status)); } diff --git a/netwerk/test/httpserver/test/test_setstatusline.js b/netwerk/test/httpserver/test/test_setstatusline.js index f9cc189a68..b4749fd8e5 100644 --- a/netwerk/test/httpserver/test/test_setstatusline.js +++ b/netwerk/test/httpserver/test/test_setstatusline.js @@ -69,11 +69,11 @@ ChromeUtils.defineLazyGetter(this, "tests", function () { }); // /no/setstatusline -function noSetstatusline(metadata, response) {} +function noSetstatusline() {} function startNoSetStatusLine(ch) { checkStatusLine(ch, 1, 1, 200, "OK"); } -function stop(ch, status, data) { +function stop(ch, status) { Assert.ok(Components.isSuccessCode(status)); } diff --git a/netwerk/test/httpserver/test/test_sjs.js b/netwerk/test/httpserver/test/test_sjs.js index 51d92ec4e0..71d04f8727 100644 --- a/netwerk/test/httpserver/test/test_sjs.js +++ b/netwerk/test/httpserver/test/test_sjs.js @@ -210,7 +210,7 @@ tests.push(test); // extension of the file on the server, not by the extension of the requested // path. -function setupFileMapping(ch) { +function setupFileMapping() { srv.registerFile("/script.html", sjs); } diff --git a/netwerk/test/httpserver/test/test_sjs_object_state.js b/netwerk/test/httpserver/test/test_sjs_object_state.js index 30c1e5c064..42402a8716 100644 --- a/netwerk/test/httpserver/test/test_sjs_object_state.js +++ b/netwerk/test/httpserver/test/test_sjs_object_state.js @@ -56,7 +56,7 @@ function run_test() { */ var initialStarted = false; -function initialStart(ch) { +function initialStart() { dumpn("*** initialStart"); if (initialStarted) { @@ -106,7 +106,7 @@ function initialStop(ch, status, data) { } var intermediateStarted = false; -function intermediateStart(ch) { +function intermediateStart() { dumpn("*** intermediateStart"); Assert.notEqual(srv.getObjectState("object-state-test"), null); @@ -152,7 +152,7 @@ function intermediateStop(ch, status, data) { } var triggerStarted = false; -function triggerStart(ch) { +function triggerStart() { dumpn("*** triggerStart"); if (!initialStarted) { diff --git a/netwerk/test/mochitests/file_1331680.js b/netwerk/test/mochitests/file_1331680.js index 868d6991ae..c99e1d399d 100644 --- a/netwerk/test/mochitests/file_1331680.js +++ b/netwerk/test/mochitests/file_1331680.js @@ -13,12 +13,12 @@ var observer = { }, }; -addMessageListener("createObserver", function (e) { +addMessageListener("createObserver", function () { Services.obs.addObserver(observer, "cookie-changed"); sendAsyncMessage("createObserver:return"); }); -addMessageListener("removeObserver", function (e) { +addMessageListener("removeObserver", function () { Services.obs.removeObserver(observer, "cookie-changed"); sendAsyncMessage("removeObserver:return"); }); diff --git a/netwerk/test/mochitests/test_1396395.html b/netwerk/test/mochitests/test_1396395.html index dcfb952b3a..ecbd01da16 100644 --- a/netwerk/test/mochitests/test_1396395.html +++ b/netwerk/test/mochitests/test_1396395.html @@ -13,7 +13,7 @@ SimpleTest.waitForExplicitFinish(); var script = SpecialPowers.loadChromeScript(() => { /* eslint-env mozilla/chrome-script */ - Services.obs.addObserver(function onExamResp(subject, topic, data) { + Services.obs.addObserver(function onExamResp(subject) { let channel = subject.QueryInterface(Ci.nsIHttpChannel); if (!channel.URI.spec.startsWith("http://example.org")) { return; diff --git a/netwerk/test/mochitests/test_idn_redirect.html b/netwerk/test/mochitests/test_idn_redirect.html index cc920665b3..8445f440e8 100644 --- a/netwerk/test/mochitests/test_idn_redirect.html +++ b/netwerk/test/mochitests/test_idn_redirect.html @@ -24,7 +24,7 @@ iframe.addEventListener("load", finishTest); document.body.appendChild(iframe); iframe.src = "http://mochi.test:8888/tests/netwerk/test/mochitests/redirect_idn.html"; -function finishTest(e) { +function finishTest() { ok(true); SimpleTest.finish(); } diff --git a/netwerk/test/mochitests/test_origin_header.html b/netwerk/test/mochitests/test_origin_header.html index f90887ddf0..4d096e75c6 100644 --- a/netwerk/test/mochitests/test_origin_header.html +++ b/netwerk/test/mochitests/test_origin_header.html @@ -193,7 +193,7 @@ function frameLoaded(test, check) function submitForm(test, check) { - return new Promise((resolve, reject) => { + return new Promise((resolve) => { document.getElementById(check.frameID).onload = () => { frameLoaded(test, check); resolve(); @@ -204,7 +204,7 @@ function submitForm(test, check) function loadIframe(test, check) { - return new Promise((resolve, reject) => { + return new Promise((resolve) => { let frame = SpecialPowers.wrap(window.document.getElementById(check.frameID)); frame.onload = function () { // Ignore the first load and wait for the submitted form instead. @@ -220,7 +220,7 @@ function loadIframe(test, check) function loadSrcDocFrame(test, check) { - return new Promise((resolve, reject) => { + return new Promise((resolve) => { let frame = SpecialPowers.wrap(window.document.getElementById(check.frameID)); frame.onload = function () { // Ignore the first load and wait for the submitted form instead. @@ -240,7 +240,7 @@ function loadSrcDocFrame(test, check) function loadDataURIFrame(test, check) { - return new Promise((resolve, reject) => { + return new Promise((resolve) => { let frame = SpecialPowers.wrap(window.document.getElementById(check.frameID)); frame.onload = function () { // Ignore the first load and wait for the submitted form instead. @@ -262,7 +262,7 @@ async function resetFrames() { let checkPromises = []; for (let check of checksToRun) { - checkPromises.push(new Promise((resolve, reject) => { + checkPromises.push(new Promise((resolve) => { let frame = document.getElementById(check.frameID); frame.onload = () => resolve(); if (check.srcdoc) { diff --git a/netwerk/test/mochitests/test_partially_cached_content.html b/netwerk/test/mochitests/test_partially_cached_content.html index 8b6df555f8..8dc93e2c81 100644 --- a/netwerk/test/mochitests/test_partially_cached_content.html +++ b/netwerk/test/mochitests/test_partially_cached_content.html @@ -26,7 +26,7 @@ /* Check that the iframe has initial content only after the first load. */ -function expectInitialContent(e) { +function expectInitialContent() { info("expectInitialContent", "First response received: should have partial content"); var frameElement = document.getElementById('contentFrame'); @@ -57,7 +57,7 @@ function expectInitialContent(e) { /* Check that the iframe has all the content after the second load. */ -function expectFullContent(e) +function expectFullContent() { info("expectFullContent", "Second response received: should complete content from first load"); diff --git a/netwerk/test/mochitests/test_redirect_ref.html b/netwerk/test/mochitests/test_redirect_ref.html index 0b234695d4..33f4031d28 100644 --- a/netwerk/test/mochitests/test_redirect_ref.html +++ b/netwerk/test/mochitests/test_redirect_ref.html @@ -18,7 +18,7 @@ iframe.addEventListener("load", finishTest); document.body.appendChild(iframe); iframe.src = "redirect.sjs#start"; -function finishTest(e) { +function finishTest() { is(iframe.contentWindow.location.href, "http://mochi.test:8888/tests/netwerk/test/mochitests/empty.html#"); SimpleTest.finish(); } diff --git a/netwerk/test/mochitests/test_rel_preconnect.html b/netwerk/test/mochitests/test_rel_preconnect.html index c7e0bada07..a0c3309954 100644 --- a/netwerk/test/mochitests/test_rel_preconnect.html +++ b/netwerk/test/mochitests/test_rel_preconnect.html @@ -19,7 +19,7 @@ async function doTest() { await SpecialPowers.setBoolPref("network.http.debug-observations", true); - observer = SpecialPowers.wrapCallback(function(subject, topic, data) { + observer = SpecialPowers.wrapCallback(function() { remainder--; ok(true, "observed remainder = " + remainder); if (!remainder) { diff --git a/netwerk/test/unit/head_cache.js b/netwerk/test/unit/head_cache.js index 7ec0e11f97..bf86e5d186 100644 --- a/netwerk/test/unit/head_cache.js +++ b/netwerk/test/unit/head_cache.js @@ -84,7 +84,7 @@ function syncWithCacheIOThread(callback, force) { "disk", Ci.nsICacheStorage.OPEN_READONLY, null, - function (status, entry) { + function (status) { Assert.equal(status, Cr.NS_ERROR_CACHE_KEY_NOT_FOUND); callback(); } diff --git a/netwerk/test/unit/head_cache2.js b/netwerk/test/unit/head_cache2.js index f7c865872a..3c5871ccbb 100644 --- a/netwerk/test/unit/head_cache2.js +++ b/netwerk/test/unit/head_cache2.js @@ -71,8 +71,8 @@ function pumpReadStream(inputStream, goon) { pump.init(inputStream, 0, 0, true); let data = ""; pump.asyncRead({ - onStartRequest(aRequest) {}, - onDataAvailable(aRequest, aInputStream, aOffset, aCount) { + onStartRequest() {}, + onDataAvailable(aRequest, aInputStream) { var wrapper = Cc["@mozilla.org/scriptableinputstream;1"].createInstance( Ci.nsIScriptableInputStream ); @@ -422,7 +422,7 @@ function wait_for_cache_index(continue_func) { } function finish_cache2_test() { - callbacks.forEach(function (callback, index) { + callbacks.forEach(function (callback) { callback.selfCheck(); }); do_test_finished(); diff --git a/netwerk/test/unit/head_channels.js b/netwerk/test/unit/head_channels.js index 140135339a..ca16bd2835 100644 --- a/netwerk/test/unit/head_channels.js +++ b/netwerk/test/unit/head_channels.js @@ -274,12 +274,10 @@ ChannelEventSink.prototype = { /** * A helper class to construct origin attributes. */ -function OriginAttributes(inIsolatedMozBrowser, privateId) { - this.inIsolatedMozBrowser = inIsolatedMozBrowser; +function OriginAttributes(privateId) { this.privateBrowsingId = privateId; } OriginAttributes.prototype = { - inIsolatedMozBrowser: false, privateBrowsingId: 0, }; @@ -525,3 +523,27 @@ function makeHTTPChannel(url, with_proxy) { loadUsingSystemPrincipal: true, }).QueryInterface(Ci.nsIHttpChannel); } + +// Like ChannelListener but does not throw an exception if something +// goes wrong. Callback is supposed to do all the work. +class SimpleChannelListener { + constructor(callback) { + this._onStopCallback = callback; + this._buffer = ""; + } + get QueryInterface() { + return ChromeUtils.generateQI(["nsIStreamListener", "nsIRequestObserver"]); + } + + onStartRequest() {} + + onDataAvailable(request, stream, offset, count) { + this._buffer = this._buffer.concat(read_stream(stream, count)); + } + + onStopRequest(request) { + if (this._onStopCallback) { + this._onStopCallback(request, this._buffer); + } + } +} diff --git a/netwerk/test/unit/head_cookies.js b/netwerk/test/unit/head_cookies.js index 037068689f..9c7885fb66 100644 --- a/netwerk/test/unit/head_cookies.js +++ b/netwerk/test/unit/head_cookies.js @@ -59,7 +59,7 @@ function _observer(generator, topic) { } _observer.prototype = { - observe(subject, topic, data) { + observe(subject, topic) { Assert.equal(this.topic, topic); Services.obs.removeObserver(this, this.topic); @@ -93,7 +93,7 @@ function _promise_observer(topic) { } _promise_observer.prototype = { - observe(subject, topic, data) { + observe(subject, topic) { Assert.equal(this.topic, topic); Services.obs.removeObserver(this, this.topic); diff --git a/netwerk/test/unit/head_http3.js b/netwerk/test/unit/head_http3.js index 56bc04db14..fe1e908e01 100644 --- a/netwerk/test/unit/head_http3.js +++ b/netwerk/test/unit/head_http3.js @@ -44,13 +44,13 @@ CheckHttp3Listener.prototype = { expectedRoute: "", http3version: "", - onStartRequest: function testOnStartRequest(request) {}, + onStartRequest: function testOnStartRequest() {}, onDataAvailable: function testOnDataAvailable(request, stream, off, cnt) { read_stream(stream, cnt); }, - onStopRequest: function testOnStopRequest(request, status) { + onStopRequest: function testOnStopRequest(request) { let routed = "NA"; try { routed = request.getRequestHeader("Alt-Used"); diff --git a/netwerk/test/unit/head_servers.js b/netwerk/test/unit/head_servers.js index d2d449b482..b8087e496f 100644 --- a/netwerk/test/unit/head_servers.js +++ b/netwerk/test/unit/head_servers.js @@ -327,21 +327,31 @@ class BaseProxyCode { // Connect to an origin server const { port, hostname } = new URL(`https://${req.url}`); const serverSocket = net - .connect(port || 443, hostname, () => { - clientSocket.write( - "HTTP/1.1 200 Connection Established\r\n" + - "Proxy-agent: Node.js-Proxy\r\n" + - "\r\n" - ); - serverSocket.write(head); - serverSocket.pipe(clientSocket); - clientSocket.pipe(serverSocket); - }) + .connect( + { + port: port || 443, + host: hostname, + family: 4, // Specifies to use IPv4 + }, + () => { + clientSocket.write( + "HTTP/1.1 200 Connection Established\r\n" + + "Proxy-agent: Node.js-Proxy\r\n" + + "\r\n" + ); + serverSocket.write(head); + serverSocket.pipe(clientSocket); + clientSocket.pipe(serverSocket); + } + ) .on("error", e => { + console.log("error" + e); // The socket will error out when we kill the connection // just ignore it. }); + clientSocket.on("error", e => { + console.log("client error" + e); // Sometimes we got ECONNRESET error on windows platform. // Ignore it for now. }); @@ -848,22 +858,22 @@ class WebSocketConnection { ]); } - onAcknowledge(aContext, aSize) {} + onAcknowledge() {} onBinaryMessageAvailable(aContext, aMsg) { this._messages.push(aMsg); this._msgCallback(); } - onMessageAvailable(aContext, aMsg) {} - onServerClose(aContext, aCode, aReason) {} - onWebSocketListenerStart(aContext) {} - onStart(aContext) { + onMessageAvailable() {} + onServerClose() {} + onWebSocketListenerStart() {} + onStart() { this._openCallback(); } onStop(aContext, aStatusCode) { this._stopCallback({ status: aStatusCode }); this._ws = null; } - onProxyAvailable(req, chan, proxyInfo, status) { + onProxyAvailable(req, chan, proxyInfo) { if (proxyInfo) { this._proxyAvailCallback({ type: proxyInfo.type }); } else { diff --git a/netwerk/test/unit/head_trr.js b/netwerk/test/unit/head_trr.js index 8262c735de..00624e2c96 100644 --- a/netwerk/test/unit/head_trr.js +++ b/netwerk/test/unit/head_trr.js @@ -263,7 +263,7 @@ function answerHandler(req, resp) { answers: response.answers || [], additionals: response.additionals || [], }); - let writeResponse = (resp2, buf2, context) => { + let writeResponse = (resp2, buf2) => { try { let data = buf2.toString("hex"); resp2.setHeader("Content-Length", data.length); diff --git a/netwerk/test/unit/head_websocket.js b/netwerk/test/unit/head_websocket.js index 84c5987f38..1ac2e09ae5 100644 --- a/netwerk/test/unit/head_websocket.js +++ b/netwerk/test/unit/head_websocket.js @@ -17,16 +17,16 @@ WebSocketListener.prototype = { _received: null, QueryInterface: ChromeUtils.generateQI(["nsIWebSocketListener"]), - onAcknowledge(aContext, aSize) {}, + onAcknowledge() {}, onBinaryMessageAvailable(aContext, aMsg) { info("WsListener::onBinaryMessageAvailable"); this._received = aMsg; this._ws.close(0, null); }, - onMessageAvailable(aContext, aMsg) {}, - onServerClose(aContext, aCode, aReason) {}, - onWebSocketListenerStart(aContext) {}, - onStart(aContext) { + onMessageAvailable() {}, + onServerClose() {}, + onWebSocketListenerStart() {}, + onStart() { this._ws.sendMsg(this._sentMsg); }, onStop(aContext, aStatusCode) { diff --git a/netwerk/test/unit/http2_test_common.js b/netwerk/test/unit/http2_test_common.js index 341aa191da..1fa1df8ad2 100644 --- a/netwerk/test/unit/http2_test_common.js +++ b/netwerk/test/unit/http2_test_common.js @@ -123,7 +123,7 @@ Http2MultiplexListener.prototype.onDataAvailable = function ( this.buffer = this.buffer.concat(data); }; -Http2MultiplexListener.prototype.onStopRequest = function (request, status) { +Http2MultiplexListener.prototype.onStopRequest = function (request) { Assert.ok(this.onStartRequestFired); Assert.ok(this.onDataAvailableFired); Assert.ok(this.isHttp2Connection); @@ -290,7 +290,7 @@ Http2BigListener.prototype.onDataAvailable = function ( Assert.equal(bigListenerMD5, request.getResponseHeader("X-Expected-MD5")); }; -Http2BigListener.prototype.onStopRequest = function (request, status) { +Http2BigListener.prototype.onStopRequest = function (request) { Assert.ok(this.onStartRequestFired); Assert.ok(this.onDataAvailableFired); Assert.ok(this.isHttp2Connection); @@ -320,10 +320,7 @@ Http2HugeSuspendedListener.prototype.onDataAvailable = function ( read_stream(stream, cnt); }; -Http2HugeSuspendedListener.prototype.onStopRequest = function ( - request, - status -) { +Http2HugeSuspendedListener.prototype.onStopRequest = function (request) { Assert.ok(this.onStartRequestFired); Assert.ok(this.onDataAvailableFired); Assert.ok(this.isHttp2Connection); @@ -470,7 +467,7 @@ async function test_http2_xhr(serverPort) { return new Promise(resolve => { var req = new XMLHttpRequest(); req.open("GET", `https://localhost:${serverPort}/`, true); - req.addEventListener("readystatechange", function (evt) { + req.addEventListener("readystatechange", function () { checkXhr(req, resolve); }); req.send(null); @@ -485,7 +482,7 @@ Http2ConcurrentListener.prototype.target = 0; Http2ConcurrentListener.prototype.reset = 0; Http2ConcurrentListener.prototype.recvdHdr = 0; -Http2ConcurrentListener.prototype.onStopRequest = function (request, status) { +Http2ConcurrentListener.prototype.onStopRequest = function (request) { this.count++; Assert.ok(this.isHttp2Connection); if (this.recvdHdr > 0) { @@ -814,7 +811,7 @@ altsvcClientListener.prototype = { read_stream(stream, cnt); }, - onStopRequest: function test_onStopR(request, status) { + onStopRequest: function test_onStopR(request) { var isHttp2Connection = checkIsHttp2( request.QueryInterface(Ci.nsIHttpChannel) ); @@ -875,7 +872,7 @@ altsvcClientListener2.prototype = { read_stream(stream, cnt); }, - onStopRequest: function test_onStopR(request, status) { + onStopRequest: function test_onStopR(request) { var isHttp2Connection = checkIsHttp2( request.QueryInterface(Ci.nsIHttpChannel) ); @@ -959,7 +956,7 @@ Http2PushApiListener.prototype = { }, // normal Channel listeners - onStartRequest: function pushAPIOnStart(request) {}, + onStartRequest: function pushAPIOnStart() {}, onDataAvailable: function pushAPIOnDataAvailable( request, @@ -997,7 +994,7 @@ Http2PushApiListener.prototype = { } }, - onStopRequest: function test_onStopR(request, status) { + onStopRequest: function test_onStopR(request) { if ( request.originalURI.spec == `https://localhost:${this.serverPort}/pushapi1/2` @@ -1100,10 +1097,7 @@ function H11RequiredSessionListener() {} H11RequiredSessionListener.prototype = new Http2CheckListener(); -H11RequiredSessionListener.prototype.onStopRequest = function ( - request, - status -) { +H11RequiredSessionListener.prototype.onStopRequest = function (request) { var streamReused = request.getResponseHeader("X-H11Required-Stream-Ok"); Assert.equal(streamReused, "yes"); @@ -1151,14 +1145,29 @@ async function test_http2_continuations(loadGroup, serverPort) { }); } +async function test_http2_continuations_over_max_response_limit( + loadGroup, + serverPort +) { + var chan = makeHTTPChannel( + `https://localhost:${serverPort}/hugecontinuedheaders?size=385` + ); + chan.loadGroup = loadGroup; + return new Promise(resolve => { + var listener = new Http2CheckListener(); + listener.finish = resolve; + listener.shouldSucceed = false; + chan.asyncOpen(listener); + }); +} + function Http2IllegalHpackValidationListener() {} Http2IllegalHpackValidationListener.prototype = new Http2CheckListener(); Http2IllegalHpackValidationListener.prototype.shouldGoAway = false; Http2IllegalHpackValidationListener.prototype.onStopRequest = function ( - request, - status + request ) { var wentAway = request.getResponseHeader("X-Did-Goaway") === "yes"; Assert.equal(wentAway, this.shouldGoAway); @@ -1176,7 +1185,7 @@ function Http2IllegalHpackListener() {} Http2IllegalHpackListener.prototype = new Http2CheckListener(); Http2IllegalHpackListener.prototype.shouldGoAway = false; -Http2IllegalHpackListener.prototype.onStopRequest = function (request, status) { +Http2IllegalHpackListener.prototype.onStopRequest = function () { var chan = makeHTTPChannel( `https://localhost:${this.serverPort}/illegalhpack_validate` ); diff --git a/netwerk/test/unit/node_execute/test_node_execute_loop.js b/netwerk/test/unit/node_execute/test_node_execute_loop.js index 10400b8b54..44871c65c2 100644 --- a/netwerk/test/unit/node_execute/test_node_execute_loop.js +++ b/netwerk/test/unit/node_execute/test_node_execute_loop.js @@ -16,7 +16,7 @@ add_task(async function killOnEnd() { await NodeServer.execute(id, `console.log("hello");`); await NodeServer.execute(id, `console.error("hello");`); // Make the forked subprocess hang forever. - NodeServer.execute(id, "while (true) {}").catch(e => {}); + NodeServer.execute(id, "while (true) {}").catch(() => {}); await new Promise(resolve => do_timeout(10, resolve)); // Should get killed at the end of the test by the harness. }); diff --git a/netwerk/test/unit/test_304_headers.js b/netwerk/test/unit/test_304_headers.js index b3583663bf..edf0e4f38c 100644 --- a/netwerk/test/unit/test_304_headers.js +++ b/netwerk/test/unit/test_304_headers.js @@ -66,7 +66,7 @@ add_task(async function test() { ); resolve(); }, - onStartRequest(req) {}, + onStartRequest() {}, onDataAvailable() {}, }); }); @@ -84,7 +84,7 @@ add_task(async function test() { ); resolve(); }, - onStartRequest(req) {}, + onStartRequest() {}, onDataAvailable() {}, }); }); diff --git a/netwerk/test/unit/test_304_responses.js b/netwerk/test/unit/test_304_responses.js index a468eec191..c67e1d72ee 100644 --- a/netwerk/test/unit/test_304_responses.js +++ b/netwerk/test/unit/test_304_responses.js @@ -48,7 +48,7 @@ function run_test() { run_next_test(); } -function consume304(request, buffer) { +function consume304(request) { request.QueryInterface(Ci.nsIHttpChannel); Assert.equal(request.responseStatus, 304); Assert.equal(request.getResponseHeader("Returned-From-Handler"), "1"); diff --git a/netwerk/test/unit/test_421.js b/netwerk/test/unit/test_421.js index 680973384e..5125895d38 100644 --- a/netwerk/test/unit/test_421.js +++ b/netwerk/test/unit/test_421.js @@ -52,7 +52,7 @@ function serverHandler(metadata, response) { response.bodyOutputStream.write(httpbody, httpbody.length); } -function checkRequestResponse(request, data, context) { +function checkRequestResponse(request, data) { Assert.equal(channel.responseStatus, 200); Assert.equal(channel.responseStatusText, "OK"); Assert.ok(channel.requestSucceeded); diff --git a/netwerk/test/unit/test_SuperfluousAuth.js b/netwerk/test/unit/test_SuperfluousAuth.js index 2766b00c4c..f5a710e0d8 100644 --- a/netwerk/test/unit/test_SuperfluousAuth.js +++ b/netwerk/test/unit/test_SuperfluousAuth.js @@ -95,7 +95,7 @@ function firstTimeThrough(request, buffer) { Assert.ok(gMockPromptService.firstTimeCalled, "Prompt service invoked"); } -function secondTimeThrough(request, buffer) { +function secondTimeThrough(request) { Assert.equal(request.status, Cr.NS_ERROR_SUPERFLUOS_AUTH); httpServer.stop(do_test_finished); } diff --git a/netwerk/test/unit/test_URIs.js b/netwerk/test/unit/test_URIs.js index 548ecd5535..ae778ca6ef 100644 --- a/netwerk/test/unit/test_URIs.js +++ b/netwerk/test/unit/test_URIs.js @@ -618,7 +618,7 @@ function do_test_uri_with_hash_suffix(aTest, aSuffix) { do_check_property(aTest, testURI, "pathQueryRef", function (aStr) { return aStr + aSuffix; }); - do_check_property(aTest, testURI, "ref", function (aStr) { + do_check_property(aTest, testURI, "ref", function () { return aSuffix.substr(1); }); } diff --git a/netwerk/test/unit/test_URIs2.js b/netwerk/test/unit/test_URIs2.js index 3ca9706543..8101f95e8b 100644 --- a/netwerk/test/unit/test_URIs2.js +++ b/netwerk/test/unit/test_URIs2.js @@ -736,7 +736,7 @@ function do_test_uri_with_hash_suffix(aTest, aSuffix) { do_check_property(aTest, testURI, "pathQueryRef", function (aStr) { return aStr + aSuffix; }); - do_check_property(aTest, testURI, "ref", function (aStr) { + do_check_property(aTest, testURI, "ref", function () { return aSuffix.substr(1); }); } diff --git a/netwerk/test/unit/test_about_networking.js b/netwerk/test/unit/test_about_networking.js index 2cbae65058..b8b864c5a0 100644 --- a/netwerk/test/unit/test_about_networking.js +++ b/netwerk/test/unit/test_about_networking.js @@ -72,7 +72,7 @@ add_test(function test_sockets() { null ); let listener = { - onTransportStatus(aTransport, aStatus, aProgress, aProgressMax) { + onTransportStatus(aTransport, aStatus) { if (aStatus == Ci.nsISocketTransport.STATUS_CONNECTED_TO) { gDashboard.requestSockets(function (data) { gServerSocket.close(); diff --git a/netwerk/test/unit/test_about_protocol.js b/netwerk/test/unit/test_about_protocol.js index 7fc6d63c1e..972b1e3a43 100644 --- a/netwerk/test/unit/test_about_protocol.js +++ b/netwerk/test/unit/test_about_protocol.js @@ -12,7 +12,7 @@ var unsafeAboutModule = { chan.owner = Services.scriptSecurityManager.getSystemPrincipal(); return chan; }, - getURIFlags(aURI) { + getURIFlags() { return Ci.nsIAboutModule.URI_SAFE_FOR_UNTRUSTED_CONTENT; }, }; diff --git a/netwerk/test/unit/test_alt-data_closeWithStatus.js b/netwerk/test/unit/test_alt-data_closeWithStatus.js index df81419cc2..b0427f2e9a 100644 --- a/netwerk/test/unit/test_alt-data_closeWithStatus.js +++ b/netwerk/test/unit/test_alt-data_closeWithStatus.js @@ -32,7 +32,7 @@ var cacheFlushObserver = (cacheFlushObserver = { var currentThread = null; -function make_channel(url, callback, ctx) { +function make_channel(url) { return NetUtil.newChannel({ uri: url, loadUsingSystemPrincipal: true }); } diff --git a/netwerk/test/unit/test_alt-data_cross_process.js b/netwerk/test/unit/test_alt-data_cross_process.js index e46120f312..e3d825c7f1 100644 --- a/netwerk/test/unit/test_alt-data_cross_process.js +++ b/netwerk/test/unit/test_alt-data_cross_process.js @@ -21,7 +21,7 @@ ChromeUtils.defineLazyGetter(this, "URL", function () { var httpServer = null; -function make_channel(url, callback, ctx) { +function make_channel(url) { return NetUtil.newChannel({ uri: url, loadUsingSystemPrincipal: true }); } diff --git a/netwerk/test/unit/test_alt-data_simple.js b/netwerk/test/unit/test_alt-data_simple.js index d648884e7a..7fa175db28 100644 --- a/netwerk/test/unit/test_alt-data_simple.js +++ b/netwerk/test/unit/test_alt-data_simple.js @@ -21,7 +21,7 @@ ChromeUtils.defineLazyGetter(this, "URL", function () { var httpServer = null; -function make_channel(url, callback, ctx) { +function make_channel(url) { return NetUtil.newChannel({ uri: url, loadUsingSystemPrincipal: true }); } diff --git a/netwerk/test/unit/test_alt-data_stream.js b/netwerk/test/unit/test_alt-data_stream.js index 9b6bfd050a..02fe8803b1 100644 --- a/netwerk/test/unit/test_alt-data_stream.js +++ b/netwerk/test/unit/test_alt-data_stream.js @@ -103,7 +103,7 @@ function openAltChannel() { var altDataListener = { buffer: "", - onStartRequest(request) {}, + onStartRequest() {}, onDataAvailable(request, stream, offset, count) { let string = NetUtil.readInputStreamToString(stream, count); this.buffer += string; @@ -120,7 +120,7 @@ var altDataListener = { os.close(); } }, - onStopRequest(request, status) { + onStopRequest(request) { var cc = request.QueryInterface(Ci.nsICacheInfoChannel); Assert.equal(cc.alternativeDataType, altContentType); Assert.equal(this.buffer.length, altContent.length); @@ -143,12 +143,12 @@ function openAltChannelWithOriginalContent() { var originalListener = { buffer: "", - onStartRequest(request) {}, + onStartRequest() {}, onDataAvailable(request, stream, offset, count) { let string = NetUtil.readInputStreamToString(stream, count); this.buffer += string; }, - onStopRequest(request, status) { + onStopRequest(request) { var cc = request.QueryInterface(Ci.nsICacheInfoChannel); Assert.equal(cc.alternativeDataType, altContentType); Assert.equal(this.buffer.length, responseContent.length); diff --git a/netwerk/test/unit/test_auth_dialog_permission.js b/netwerk/test/unit/test_auth_dialog_permission.js index a45b651588..76e92e72f5 100644 --- a/netwerk/test/unit/test_auth_dialog_permission.js +++ b/netwerk/test/unit/test_auth_dialog_permission.js @@ -63,7 +63,7 @@ AuthPrompt.prototype = { QueryInterface: ChromeUtils.generateQI(["nsIAuthPrompt"]), - prompt(title, text, realm, save, defaultText, result) { + prompt() { do_throw("unexpected prompt call"); }, @@ -75,7 +75,7 @@ AuthPrompt.prototype = { return true; }, - promptPassword(title, text, realm, save, pwd) { + promptPassword() { do_throw("unexpected promptPassword call"); }, }; @@ -159,7 +159,7 @@ Test.prototype = { throw Components.Exception("", Cr.NS_ERROR_ABORT); }, - onDataAvailable(request, stream, offset, count) { + onDataAvailable() { do_throw("Should not get any data!"); }, diff --git a/netwerk/test/unit/test_auth_jar.js b/netwerk/test/unit/test_auth_jar.js deleted file mode 100644 index a6f1ea257c..0000000000 --- a/netwerk/test/unit/test_auth_jar.js +++ /dev/null @@ -1,92 +0,0 @@ -"use strict"; - -function createURI(s) { - return Services.io.newURI(s); -} - -function run_test() { - // Set up a profile. - do_get_profile(); - - var secMan = Services.scriptSecurityManager; - const kURI1 = "http://example.com"; - var app = secMan.createContentPrincipal(createURI(kURI1), {}); - var appbrowser = secMan.createContentPrincipal(createURI(kURI1), { - inIsolatedMozBrowser: true, - }); - - var am = Cc["@mozilla.org/network/http-auth-manager;1"].getService( - Ci.nsIHttpAuthManager - ); - am.setAuthIdentity( - "http", - "a.example.com", - -1, - "basic", - "realm", - "", - "example.com", - "user", - "pass", - false, - app - ); - am.setAuthIdentity( - "http", - "a.example.com", - -1, - "basic", - "realm", - "", - "example.com", - "user3", - "pass3", - false, - appbrowser - ); - - Services.clearData.deleteDataFromOriginAttributesPattern({ - inIsolatedMozBrowser: true, - }); - - var domain = { value: "" }, - user = { value: "" }, - pass = { value: "" }; - try { - am.getAuthIdentity( - "http", - "a.example.com", - -1, - "basic", - "realm", - "", - domain, - user, - pass, - false, - appbrowser - ); - Assert.equal(false, true); // no identity should be present - } catch (x) { - Assert.equal(domain.value, ""); - Assert.equal(user.value, ""); - Assert.equal(pass.value, ""); - } - - am.getAuthIdentity( - "http", - "a.example.com", - -1, - "basic", - "realm", - "", - domain, - user, - pass, - false, - app - ); - Assert.equal(domain.value, "example.com"); - Assert.equal(user.value, "user"); - Assert.equal(pass.value, "pass"); -} diff --git a/netwerk/test/unit/test_auth_multiple.js b/netwerk/test/unit/test_auth_multiple.js index 3cf039ea7d..9574c39b9b 100644 --- a/netwerk/test/unit/test_auth_multiple.js +++ b/netwerk/test/unit/test_auth_multiple.js @@ -42,7 +42,7 @@ AuthPrompt1.prototype = { QueryInterface: ChromeUtils.generateQI(["nsIAuthPrompt"]), - prompt: function ap1_prompt(title, text, realm, save, defaultText, result) { + prompt: function ap1_prompt() { do_throw("unexpected prompt call"); }, @@ -94,7 +94,7 @@ AuthPrompt1.prototype = { return true; }, - promptPassword: function ap1_promptPW(title, text, realm, save, pwd) { + promptPassword: function ap1_promptPW() { do_throw("unexpected promptPassword call"); }, }; @@ -117,7 +117,7 @@ AuthPrompt2.prototype = { return true; }, - asyncPromptAuth: function ap2_async(chan, cb, ctx, lvl, info) { + asyncPromptAuth: function ap2_async() { throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED); }, }; @@ -175,7 +175,7 @@ RealmTestRequestor.prototype = { return false; }, - asyncPromptAuth: function realmtest_async(chan, cb, ctx, lvl, info) { + asyncPromptAuth: function realmtest_async() { throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED); }, }; diff --git a/netwerk/test/unit/test_authentication.js b/netwerk/test/unit/test_authentication.js index 823e2cb36b..f21e0fd4ff 100644 --- a/netwerk/test/unit/test_authentication.js +++ b/netwerk/test/unit/test_authentication.js @@ -43,7 +43,7 @@ AuthPrompt1.prototype = { QueryInterface: ChromeUtils.generateQI(["nsIAuthPrompt"]), - prompt: function ap1_prompt(title, text, realm, save, defaultText, result) { + prompt: function ap1_prompt() { do_throw("unexpected prompt call"); }, @@ -99,7 +99,7 @@ AuthPrompt1.prototype = { return true; }, - promptPassword: function ap1_promptPW(title, text, realm, save, pwd) { + promptPassword: function ap1_promptPW() { do_throw("unexpected promptPassword call"); }, }; @@ -252,7 +252,7 @@ RealmTestRequestor.prototype = { return false; }, - asyncPromptAuth: function realmtest_async(chan, cb, ctx, lvl, info) { + asyncPromptAuth: function realmtest_async() { throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED); }, }; @@ -377,7 +377,7 @@ function makeChan( var ChannelCreationObserver = { QueryInterface: ChromeUtils.generateQI(["nsIObserver"]), - observe(aSubject, aTopic, aData) { + observe(aSubject, aTopic) { if (aTopic == "http-on-opening-request") { initialChannelId = aSubject.QueryInterface(Ci.nsIIdentChannel).channelId; } @@ -666,7 +666,7 @@ async function test_nonascii_xhr() { await new Promise(resolve => { let xhr = new XMLHttpRequest(); xhr.open("GET", URL + "/auth/non_ascii", true, "é", "é"); - xhr.onreadystatechange = function (event) { + xhr.onreadystatechange = function () { if (xhr.readyState == 4) { Assert.equal(xhr.status, 200); resolve(); diff --git a/netwerk/test/unit/test_authpromptwrapper.js b/netwerk/test/unit/test_authpromptwrapper.js index 69680354ab..85bf690bca 100644 --- a/netwerk/test/unit/test_authpromptwrapper.js +++ b/netwerk/test/unit/test_authpromptwrapper.js @@ -51,7 +51,7 @@ function run_test() { QueryInterface: ChromeUtils.generateQI(["nsIAuthPrompt"]), - prompt: function ap1_prompt(title, text, realm, save, defaultText, result) { + prompt: function ap1_prompt(title, text, realm) { this.called |= CALLED_PROMPT; this.doChecks(text, realm); return this.rv; diff --git a/netwerk/test/unit/test_backgroundfilesaver.js b/netwerk/test/unit/test_backgroundfilesaver.js index eeceab9bf8..58382fa98b 100644 --- a/netwerk/test/unit/test_backgroundfilesaver.js +++ b/netwerk/test/unit/test_backgroundfilesaver.js @@ -213,11 +213,7 @@ function promiseCopyToSaver(aSourceString, aSaverOutputStream, aCloseWhenDone) { * @resolves When the operation completes with a success code. * @rejects With an exception, if the operation fails. */ -function promisePumpToSaver( - aSourceString, - aSaverStreamListener, - aCloseWhenDone -) { +function promisePumpToSaver(aSourceString, aSaverStreamListener) { return new Promise((resolve, reject) => { aSaverStreamListener.QueryInterface(Ci.nsIStreamListener); let inputStream = new StringInputStream( @@ -603,7 +599,7 @@ add_task(async function test_enableAppend_hash() { add_task(async function test_finish_only() { // This test checks creating the object and doing nothing. let saver = new BackgroundFileSaverOutputStream(); - function onTargetChange(aTarget) { + function onTargetChange() { do_throw("Should not receive the onTargetChange notification."); } let completionPromise = promiseSaverComplete(saver, onTargetChange); diff --git a/netwerk/test/unit/test_be_conservative.js b/netwerk/test/unit/test_be_conservative.js index af8cf23976..8998420c9e 100644 --- a/netwerk/test/unit/test_be_conservative.js +++ b/netwerk/test/unit/test_be_conservative.js @@ -169,7 +169,7 @@ function startClient(port, beConservative, expectSuccess) { req.open("GET", `https://${hostname}:${port}`); let internalChannel = req.channel.QueryInterface(Ci.nsIHttpChannelInternal); internalChannel.beConservative = beConservative; - return new Promise((resolve, reject) => { + return new Promise(resolve => { req.onload = () => { ok( expectSuccess, diff --git a/netwerk/test/unit/test_be_conservative_error_handling.js b/netwerk/test/unit/test_be_conservative_error_handling.js index eae3042592..b1d1e58e10 100644 --- a/netwerk/test/unit/test_be_conservative_error_handling.js +++ b/netwerk/test/unit/test_be_conservative_error_handling.js @@ -151,7 +151,7 @@ function startClient(port, beConservative, expectSuccess) { req.open("GET", `https://${hostname}:${port}`); let internalChannel = req.channel.QueryInterface(Ci.nsIHttpChannelInternal); internalChannel.beConservative = beConservative; - return new Promise((resolve, reject) => { + return new Promise(resolve => { req.onload = () => { ok( expectSuccess, diff --git a/netwerk/test/unit/test_brotli_decoding.js b/netwerk/test/unit/test_brotli_decoding.js index 55e2869401..bb5229cf73 100644 --- a/netwerk/test/unit/test_brotli_decoding.js +++ b/netwerk/test/unit/test_brotli_decoding.js @@ -26,7 +26,7 @@ let channelListener = function (closure) { }; channelListener.prototype = { - onStartRequest: function testOnStartRequest(request) {}, + onStartRequest: function testOnStartRequest() {}, onDataAvailable: function testOnDataAvailable(request, stream, off, cnt) { let data = read_stream(stream, cnt); @@ -39,7 +39,7 @@ channelListener.prototype = { } }, - onStopRequest: function testOnStopRequest(request, status) { + onStopRequest: function testOnStopRequest() { this._closure(); }, }; diff --git a/netwerk/test/unit/test_bug1064258.js b/netwerk/test/unit/test_bug1064258.js index 9be44254b5..9cf59287be 100644 --- a/netwerk/test/unit/test_bug1064258.js +++ b/netwerk/test/unit/test_bug1064258.js @@ -22,7 +22,7 @@ ChromeUtils.defineLazyGetter(this, "URL", function () { var httpServer = null; -function make_channel(url, callback, ctx) { +function make_channel(url) { return NetUtil.newChannel({ uri: url, loadUsingSystemPrincipal: true }); } diff --git a/netwerk/test/unit/test_bug1177909.js b/netwerk/test/unit/test_bug1177909.js index 0fc94f8a2c..5b4e23fd0a 100644 --- a/netwerk/test/unit/test_bug1177909.js +++ b/netwerk/test/unit/test_bug1177909.js @@ -55,9 +55,9 @@ async function TestProxyType(chan, flags) { Ci.nsIProtocolProxyService.PROXYCONFIG_SYSTEM ); - return new Promise((resolve, reject) => { + return new Promise(resolve => { gProxyService.asyncResolve(chan, flags, { - onProxyAvailable(req, uri, pi, status) { + onProxyAvailable(req, uri, pi) { resolve(pi); }, }); diff --git a/netwerk/test/unit/test_bug1218029.js b/netwerk/test/unit/test_bug1218029.js index 48165807bf..c3eaa201a4 100644 --- a/netwerk/test/unit/test_bug1218029.js +++ b/netwerk/test/unit/test_bug1218029.js @@ -84,7 +84,7 @@ function execute_test(test) { equal(status, test.status); }, onIncrementalData(loader, context, length, data, consumed) { - ok(chunkIndex < test.dataChunks.length - 1); + Assert.less(chunkIndex, test.dataChunks.length - 1); var expectedChunk = test.dataChunks[chunkIndex]; equal(length, expectedChunk.length); equal(String.fromCharCode.apply(null, data), expectedChunk); diff --git a/netwerk/test/unit/test_bug1279246.js b/netwerk/test/unit/test_bug1279246.js index be73dbee14..8f904eb7eb 100644 --- a/netwerk/test/unit/test_bug1279246.js +++ b/netwerk/test/unit/test_bug1279246.js @@ -45,7 +45,7 @@ Listener.prototype = { } }, - onStopRequest(request, status) { + onStopRequest() { if (pass == 0) { Assert.equal(this._buffer.length, responseLen); pass++; diff --git a/netwerk/test/unit/test_bug1312774_http1.js b/netwerk/test/unit/test_bug1312774_http1.js index 6f100295ae..9232e0042b 100644 --- a/netwerk/test/unit/test_bug1312774_http1.js +++ b/netwerk/test/unit/test_bug1312774_http1.js @@ -90,11 +90,11 @@ function HttpResponseListener(id) { } HttpResponseListener.prototype = { - onStartRequest(request) {}, + onStartRequest() {}, - onDataAvailable(request, stream, off, cnt) {}, + onDataAvailable() {}, - onStopRequest(request, status) { + onStopRequest() { log("STOP id=" + this.id); do_test_finished(); }, diff --git a/netwerk/test/unit/test_bug1312782_http1.js b/netwerk/test/unit/test_bug1312782_http1.js index cf820a4f56..15af4da76e 100644 --- a/netwerk/test/unit/test_bug1312782_http1.js +++ b/netwerk/test/unit/test_bug1312782_http1.js @@ -99,11 +99,11 @@ function HttpResponseListener(id) { } HttpResponseListener.prototype = { - onStartRequest(request) {}, + onStartRequest() {}, - onDataAvailable(request, stream, off, cnt) {}, + onDataAvailable() {}, - onStopRequest(request, status) { + onStopRequest() { log("STOP id=" + this.id); do_test_finished(); }, diff --git a/netwerk/test/unit/test_bug1355539_http1.js b/netwerk/test/unit/test_bug1355539_http1.js index 17b2930388..50c1114fd5 100644 --- a/netwerk/test/unit/test_bug1355539_http1.js +++ b/netwerk/test/unit/test_bug1355539_http1.js @@ -134,11 +134,11 @@ function HttpResponseListener(id, onStopCallback) { } HttpResponseListener.prototype = { - onStartRequest(request) {}, + onStartRequest() {}, - onDataAvailable(request, stream, off, cnt) {}, + onDataAvailable() {}, - onStopRequest(request, status) { + onStopRequest() { log("STOP id=" + this.id); do_test_finished(); if (this.stopCallback) { diff --git a/netwerk/test/unit/test_bug1378385_http1.js b/netwerk/test/unit/test_bug1378385_http1.js index 0e21db3478..3ca4432cdf 100644 --- a/netwerk/test/unit/test_bug1378385_http1.js +++ b/netwerk/test/unit/test_bug1378385_http1.js @@ -113,11 +113,11 @@ function HttpResponseListener(id) { } HttpResponseListener.prototype = { - onStartRequest(request) {}, + onStartRequest() {}, - onDataAvailable(request, stream, off, cnt) {}, + onDataAvailable() {}, - onStopRequest(request, status) { + onStopRequest() { log("STOP id=" + this.id); do_test_finished(); }, diff --git a/netwerk/test/unit/test_bug1411316_http1.js b/netwerk/test/unit/test_bug1411316_http1.js index d1df42afdc..529fbead9a 100644 --- a/netwerk/test/unit/test_bug1411316_http1.js +++ b/netwerk/test/unit/test_bug1411316_http1.js @@ -72,9 +72,9 @@ function HttpResponseListener(id, onStopRequestStatus) { } HttpResponseListener.prototype = { - onStartRequest(request) {}, + onStartRequest() {}, - onDataAvailable(request, stream, off, cnt) {}, + onDataAvailable() {}, onStopRequest(request, status) { log("STOP id=" + this.id + " status=" + status); diff --git a/netwerk/test/unit/test_bug1527293.js b/netwerk/test/unit/test_bug1527293.js index bed2bddec6..5a86243495 100644 --- a/netwerk/test/unit/test_bug1527293.js +++ b/netwerk/test/unit/test_bug1527293.js @@ -25,7 +25,7 @@ ChromeUtils.defineLazyGetter(this, "URL", function () { var httpServer = null; -function make_channel(url, callback, ctx) { +function make_channel(url) { return NetUtil.newChannel({ uri: url, loadUsingSystemPrincipal: true }); } diff --git a/netwerk/test/unit/test_bug1683176.js b/netwerk/test/unit/test_bug1683176.js index 9b0fddf7bd..f7b30e80f1 100644 --- a/netwerk/test/unit/test_bug1683176.js +++ b/netwerk/test/unit/test_bug1683176.js @@ -66,7 +66,7 @@ function channelOpenPromise(chan) { let topic = "http-on-transaction-suspended-authentication"; let observer = { QueryInterface: ChromeUtils.generateQI(["nsIObserver"]), - observe(aSubject, aTopic, aData) { + observe(aSubject, aTopic) { if (aTopic == topic) { Services.obs.removeObserver(observer, topic); let channel = aSubject.QueryInterface(Ci.nsIChannel); diff --git a/netwerk/test/unit/test_bug282432.js b/netwerk/test/unit/test_bug282432.js index 5e6e7a19b6..1dc8d890fa 100644 --- a/netwerk/test/unit/test_bug282432.js +++ b/netwerk/test/unit/test_bug282432.js @@ -11,7 +11,7 @@ function run_test() { "nsIRequestObserver", ]), - onStartRequest(aRequest) {}, + onStartRequest() {}, onStopRequest(aRequest, aStatusCode) { // Make sure we can catch the error NS_ERROR_FILE_NOT_FOUND here. @@ -19,7 +19,7 @@ function run_test() { do_test_finished(); }, - onDataAvailable(aRequest, aStream, aOffset, aCount) { + onDataAvailable() { do_throw("The channel must not call onDataAvailable()."); }, }; diff --git a/netwerk/test/unit/test_bug331825.js b/netwerk/test/unit/test_bug331825.js index 5a389c74a4..15a5d36053 100644 --- a/netwerk/test/unit/test_bug331825.js +++ b/netwerk/test/unit/test_bug331825.js @@ -8,8 +8,8 @@ var server; const BUGID = "331825"; function TestListener() {} -TestListener.prototype.onStartRequest = function (request) {}; -TestListener.prototype.onStopRequest = function (request, status) { +TestListener.prototype.onStartRequest = function () {}; +TestListener.prototype.onStopRequest = function (request) { var channel = request.QueryInterface(Ci.nsIHttpChannel); Assert.equal(channel.responseStatus, 304); diff --git a/netwerk/test/unit/test_bug369787.js b/netwerk/test/unit/test_bug369787.js index 36cf2472e1..3254bdf568 100644 --- a/netwerk/test/unit/test_bug369787.js +++ b/netwerk/test/unit/test_bug369787.js @@ -29,7 +29,7 @@ TestListener.prototype.onStartRequest = function (request) { throw ex; } }; -TestListener.prototype.onStopRequest = function (request, status) { +TestListener.prototype.onStopRequest = function () { try { change_content_type(); } catch (ex) { @@ -68,6 +68,6 @@ function run_test() { } // PATH HANDLER FOR /bug369787 -function bug369787(metadata, response) { +function bug369787() { /* do nothing */ } diff --git a/netwerk/test/unit/test_bug401564.js b/netwerk/test/unit/test_bug401564.js index 7cc52f3965..9b92272410 100644 --- a/netwerk/test/unit/test_bug401564.js +++ b/netwerk/test/unit/test_bug401564.js @@ -14,12 +14,12 @@ function redirectHandler(metadata, response) { response.setHeader("Location", noRedirectURI, false); } -function contentHandler(metadata, response) { +function contentHandler(metadata) { Assert.equal(metadata.getHeader("Accept"), acceptType); httpserver.stop(do_test_finished); } -function dummyHandler(request, buffer) {} +function dummyHandler() {} function run_test() { httpserver = new HttpServer(); diff --git a/netwerk/test/unit/test_bug412945.js b/netwerk/test/unit/test_bug412945.js index 78c48bbf22..c44aa48795 100644 --- a/netwerk/test/unit/test_bug412945.js +++ b/netwerk/test/unit/test_bug412945.js @@ -8,9 +8,9 @@ var httpserv; function TestListener() {} -TestListener.prototype.onStartRequest = function (request) {}; +TestListener.prototype.onStartRequest = function () {}; -TestListener.prototype.onStopRequest = function (request, status) { +TestListener.prototype.onStopRequest = function () { httpserv.stop(do_test_finished); }; @@ -34,7 +34,7 @@ function run_test() { do_test_pending(); } -function bug412945(metadata, response) { +function bug412945(metadata) { if ( !metadata.hasHeader("Content-Length") || metadata.getHeader("Content-Length") != "0" diff --git a/netwerk/test/unit/test_bug455311.js b/netwerk/test/unit/test_bug455311.js index 36e000a174..284fcf0ac7 100644 --- a/netwerk/test/unit/test_bug455311.js +++ b/netwerk/test/unit/test_bug455311.js @@ -25,7 +25,7 @@ NotificationCallbacks.prototype = { getInterface(iid) { return this.QueryInterface(iid); }, - asyncOnChannelRedirect(oldChan, newChan, flags, callback) { + asyncOnChannelRedirect(oldChan, newChan) { Assert.equal(oldChan.URI.spec, this._origURI.spec); Assert.equal(oldChan.URI, this._origURI); Assert.equal(oldChan.originalURI.spec, this._origURI.spec); @@ -54,7 +54,7 @@ RequestObserver.prototype = { Assert.equal(chan.originalURI.spec, this._origURI.spec); Assert.equal(chan.originalURI, this._origURI); }, - onDataAvailable(req, stream, offset, count) { + onDataAvailable() { do_throw("Unexpected call to onDataAvailable"); }, onStopRequest(req, status) { diff --git a/netwerk/test/unit/test_bug468426.js b/netwerk/test/unit/test_bug468426.js index def7041ad8..e2598721d3 100644 --- a/netwerk/test/unit/test_bug468426.js +++ b/netwerk/test/unit/test_bug468426.js @@ -58,7 +58,7 @@ function triggerNextTest() { channel.asyncOpen(new ChannelListener(checkValueAndTrigger, null)); } -function checkValueAndTrigger(request, data, ctx) { +function checkValueAndTrigger(request, data) { Assert.equal(tests[index].expected, data); if (index < tests.length - 1) { diff --git a/netwerk/test/unit/test_bug468594.js b/netwerk/test/unit/test_bug468594.js index abab980f48..de7ed84f6f 100644 --- a/netwerk/test/unit/test_bug468594.js +++ b/netwerk/test/unit/test_bug468594.js @@ -101,7 +101,7 @@ function triggerNextTest() { channel.asyncOpen(new ChannelListener(checkValueAndTrigger, null)); } -function checkValueAndTrigger(request, data, ctx) { +function checkValueAndTrigger(request, data) { logit(index, data); Assert.equal(tests[index].expected, data); diff --git a/netwerk/test/unit/test_bug470716.js b/netwerk/test/unit/test_bug470716.js index 009e7eee11..f359aa9c1e 100644 --- a/netwerk/test/unit/test_bug470716.js +++ b/netwerk/test/unit/test_bug470716.js @@ -26,7 +26,7 @@ var test_sink_closed; var test_nr; var copyObserver = { - onStartRequest(request) {}, + onStartRequest() {}, onStopRequest(request, statusCode) { // check status code diff --git a/netwerk/test/unit/test_bug482601.js b/netwerk/test/unit/test_bug482601.js index ae4e848dbf..04ee143cdb 100644 --- a/netwerk/test/unit/test_bug482601.js +++ b/netwerk/test/unit/test_bug482601.js @@ -13,7 +13,7 @@ var buffer = ""; var observer = { QueryInterface: ChromeUtils.generateQI(["nsIObserver"]), - observe(subject, topic, data) { + observe(subject, topic) { if (observers_called.length) { observers_called += ","; } @@ -23,7 +23,7 @@ var observer = { }; var listener = { - onStartRequest(request) { + onStartRequest() { buffer = ""; }, @@ -259,6 +259,6 @@ function bug482601_cached(metadata, response) { } // /bug482601/only_from_cache -function bug482601_only_from_cache(metadata, response) { +function bug482601_only_from_cache() { do_throw("This should not be reached"); } diff --git a/netwerk/test/unit/test_bug482934.js b/netwerk/test/unit/test_bug482934.js index ee2579b1bb..8388c35d2b 100644 --- a/netwerk/test/unit/test_bug482934.js +++ b/netwerk/test/unit/test_bug482934.js @@ -91,7 +91,7 @@ add_test(() => { var ch = make_channel(resource_url); ch.asyncOpen( - new ChannelListener(function (aRequest, aData) { + new ChannelListener(function (aRequest) { syncWithCacheIOThread(() => { Assert.ok(hit_server); Assert.equal( @@ -117,7 +117,7 @@ add_test(() => { var ch = make_channel(resource_url); ch.asyncOpen( - new ChannelListener(function (aRequest, aData) { + new ChannelListener(function (aRequest) { syncWithCacheIOThread(() => { Assert.ok(hit_server); Assert.equal( @@ -170,7 +170,7 @@ add_test(() => { response_time = "Sat, 3 Jan 2009 00:00:00 GMT"; var ch = make_channel(resource_url); ch.asyncOpen( - new ChannelListener(function (aRequest, aData) { + new ChannelListener(function (aRequest) { syncWithCacheIOThread(() => { Assert.ok(hit_server); Assert.equal( diff --git a/netwerk/test/unit/test_bug490095.js b/netwerk/test/unit/test_bug490095.js index 4e0a37e450..261632b4c7 100644 --- a/netwerk/test/unit/test_bug490095.js +++ b/netwerk/test/unit/test_bug490095.js @@ -79,7 +79,7 @@ function triggerNextTest() { channel.asyncOpen(new ChannelListener(checkValueAndTrigger, null)); } -function checkValueAndTrigger(request, data, ctx) { +function checkValueAndTrigger(request, data) { logit(index, data); Assert.equal(tests[index].expected, data); diff --git a/netwerk/test/unit/test_bug510359.js b/netwerk/test/unit/test_bug510359.js index a273cc4710..2262e0a2e6 100644 --- a/netwerk/test/unit/test_bug510359.js +++ b/netwerk/test/unit/test_bug510359.js @@ -28,7 +28,7 @@ function triggerNextTest() { channel.asyncOpen(new ChannelListener(checkValueAndTrigger, null)); } -function checkValueAndTrigger(request, data, ctx) { +function checkValueAndTrigger(request, data) { Assert.equal(tests[index].expected, data); if (index < tests.length - 1) { diff --git a/netwerk/test/unit/test_bug536324_64bit_content_length.js b/netwerk/test/unit/test_bug536324_64bit_content_length.js index 7ed8ceca6f..c81c619f31 100644 --- a/netwerk/test/unit/test_bug536324_64bit_content_length.js +++ b/netwerk/test/unit/test_bug536324_64bit_content_length.js @@ -14,16 +14,16 @@ const CONTENT_LENGTH = "1152921504606846975"; var httpServer = null; var listener = { - onStartRequest(req) {}, + onStartRequest() {}, - onDataAvailable(req, stream, off, count) { + onDataAvailable(req) { Assert.equal(req.getResponseHeader("Content-Length"), CONTENT_LENGTH); // We're done here, cancel the channel req.cancel(Cr.NS_BINDING_ABORTED); }, - onStopRequest(req, stat) { + onStopRequest() { httpServer.stop(do_test_finished); }, }; diff --git a/netwerk/test/unit/test_bug540566.js b/netwerk/test/unit/test_bug540566.js index 24260421ad..354b5c509f 100644 --- a/netwerk/test/unit/test_bug540566.js +++ b/netwerk/test/unit/test_bug540566.js @@ -4,7 +4,7 @@ "use strict"; -function continue_test(status, entry) { +function continue_test(status) { Assert.equal(status, Cr.NS_OK); // TODO - mayhemer: remove this tests completely // entry.deviceID; diff --git a/netwerk/test/unit/test_bug561042.js b/netwerk/test/unit/test_bug561042.js index 6bdf4d59a6..63696f2ae7 100644 --- a/netwerk/test/unit/test_bug561042.js +++ b/netwerk/test/unit/test_bug561042.js @@ -17,9 +17,9 @@ for (let i = 0; i < 10000; i++) { } var listener = { - onStartRequest(request) {}, + onStartRequest() {}, - onDataAvailable(request, stream) {}, + onDataAvailable() {}, onStopRequest(request, status) { Assert.equal(status, Cr.NS_OK); diff --git a/netwerk/test/unit/test_bug561276.js b/netwerk/test/unit/test_bug561276.js index 9176b7c702..532ef056e6 100644 --- a/netwerk/test/unit/test_bug561276.js +++ b/netwerk/test/unit/test_bug561276.js @@ -22,7 +22,7 @@ function setupChannel(suffix) { return httpChan; } -function checkValueAndTrigger(request, data, ctx) { +function checkValueAndTrigger(request, data) { Assert.equal("Ok", data); httpserver.stop(do_test_finished); } diff --git a/netwerk/test/unit/test_bug586908.js b/netwerk/test/unit/test_bug586908.js index 1d3ab20347..1491729f19 100644 --- a/netwerk/test/unit/test_bug586908.js +++ b/netwerk/test/unit/test_bug586908.js @@ -15,13 +15,13 @@ ChromeUtils.defineLazyGetter(this, "systemSettings", function () { mainThreadOnly: true, PACURI: "http://localhost:" + httpserv.identity.primaryPort + "/redirect", - getProxyForURI(aURI) { + getProxyForURI() { throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED); }, }; }); -function checkValue(request, data, ctx) { +function checkValue(request, data) { Assert.ok(called); Assert.equal("ok", data); httpserv.stop(do_test_finished); diff --git a/netwerk/test/unit/test_bug596443.js b/netwerk/test/unit/test_bug596443.js index 55f9922e07..156bf33d29 100644 --- a/netwerk/test/unit/test_bug596443.js +++ b/netwerk/test/unit/test_bug596443.js @@ -39,13 +39,13 @@ Listener.prototype = { "nsIRequestObserver", ]), - onStartRequest(request) { + onStartRequest() { this._buffer = ""; }, onDataAvailable(request, stream, offset, count) { this._buffer = this._buffer.concat(read_stream(stream, count)); }, - onStopRequest(request, status) { + onStopRequest() { Assert.equal(this._buffer, this._response); if (--expectedOnStopRequests == 0) { do_timeout(10, function () { diff --git a/netwerk/test/unit/test_bug618835.js b/netwerk/test/unit/test_bug618835.js index 4f4ea8b776..61946209e5 100644 --- a/netwerk/test/unit/test_bug618835.js +++ b/netwerk/test/unit/test_bug618835.js @@ -29,8 +29,8 @@ function setupChannel(path) { // Verify that Content-Location-URI has been loaded once, load post_target function InitialListener() {} InitialListener.prototype = { - onStartRequest(request) {}, - onStopRequest(request, status) { + onStartRequest() {}, + onStopRequest() { Assert.equal(1, numberOfCLHandlerCalls); executeSoon(function () { var channel = setupChannel( @@ -45,8 +45,8 @@ InitialListener.prototype = { // Verify that Location-URI has been loaded once, reload post_target function RedirectingListener() {} RedirectingListener.prototype = { - onStartRequest(request) {}, - onStopRequest(request, status) { + onStartRequest() {}, + onStopRequest() { Assert.equal(1, numberOfHandlerCalls); executeSoon(function () { var channel = setupChannel( @@ -62,8 +62,8 @@ RedirectingListener.prototype = { // reload Content-Location-URI function VerifyingListener() {} VerifyingListener.prototype = { - onStartRequest(request) {}, - onStopRequest(request, status) { + onStartRequest() {}, + onStopRequest() { Assert.equal(2, numberOfHandlerCalls); var channel = setupChannel( "http://localhost:" + httpserv.identity.primaryPort + "/cl" @@ -76,8 +76,8 @@ VerifyingListener.prototype = { // stop test function FinalListener() {} FinalListener.prototype = { - onStartRequest(request) {}, - onStopRequest(request, status) { + onStartRequest() {}, + onStopRequest() { Assert.equal(2, numberOfCLHandlerCalls); httpserv.stop(do_test_finished); }, diff --git a/netwerk/test/unit/test_bug633743.js b/netwerk/test/unit/test_bug633743.js index 6e49751c78..d6be50b7c2 100644 --- a/netwerk/test/unit/test_bug633743.js +++ b/netwerk/test/unit/test_bug633743.js @@ -10,7 +10,7 @@ const CACHECTRL_HDR_NAME = "X-CACHE-CONTROL-HEADER"; var httpserver = null; -function make_channel(flags, vary, value) { +function make_channel() { var chan = NetUtil.newChannel({ uri: "http://localhost:" + httpserver.identity.primaryPort + "/bug633743", loadUsingSystemPrincipal: true, @@ -39,13 +39,13 @@ Test.prototype = { "nsIRequestObserver", ]), - onStartRequest(request) {}, + onStartRequest() {}, onDataAvailable(request, stream, offset, count) { this._buffer = this._buffer.concat(read_stream(stream, count)); }, - onStopRequest(request, status) { + onStopRequest() { Assert.equal(this._buffer, this._expectVal); do_timeout(0, run_next_test); }, diff --git a/netwerk/test/unit/test_bug650995.js b/netwerk/test/unit/test_bug650995.js index d9ccab6540..e7032b09e2 100644 --- a/netwerk/test/unit/test_bug650995.js +++ b/netwerk/test/unit/test_bug650995.js @@ -158,7 +158,7 @@ function TestCacheEntrySize( channel.asyncOpen(new ChannelListener(ctx.testAndTriggerNext, ctx)); }); }; - this.testAndTriggerNext = function (request, data, ctx) { + this.testAndTriggerNext = function (request, data) { Assert.equal(secondExpectedReply, data); executeSoon(nextTest); }; diff --git a/netwerk/test/unit/test_bug659569.js b/netwerk/test/unit/test_bug659569.js index 1bdc61b618..4235c742e0 100644 --- a/netwerk/test/unit/test_bug659569.js +++ b/netwerk/test/unit/test_bug659569.js @@ -13,7 +13,7 @@ function setupChannel(suffix) { }); } -function checkValueAndTrigger(request, data, ctx) { +function checkValueAndTrigger(request, data) { Assert.equal("Ok", data); httpserver.stop(do_test_finished); } diff --git a/netwerk/test/unit/test_bug667907.js b/netwerk/test/unit/test_bug667907.js index 5c6b13d538..b407a4777b 100644 --- a/netwerk/test/unit/test_bug667907.js +++ b/netwerk/test/unit/test_bug667907.js @@ -35,7 +35,7 @@ var listener_proto = { request.cancel(Cr.NS_BINDING_ABORTED); }, - onDataAvailable(request, stream, offset, count) { + onDataAvailable() { do_throw("Unexpected onDataAvailable"); }, diff --git a/netwerk/test/unit/test_bug669001.js b/netwerk/test/unit/test_bug669001.js index ebd5998cf1..c402a6e975 100644 --- a/netwerk/test/unit/test_bug669001.js +++ b/netwerk/test/unit/test_bug669001.js @@ -28,13 +28,13 @@ var fetched; var tests = [ { prepare() {}, - test(response) { + test() { Assert.ok(fetched); }, }, { prepare() {}, - test(response) { + test() { Assert.ok(!fetched); }, }, @@ -42,13 +42,13 @@ var tests = [ prepare() { setUA("A different User Agent"); }, - test(response) { + test() { Assert.ok(fetched); }, }, { prepare() {}, - test(response) { + test() { Assert.ok(!fetched); }, }, @@ -56,13 +56,13 @@ var tests = [ prepare() { setUA("And another User Agent"); }, - test(response) { + test() { Assert.ok(fetched); }, }, { prepare() {}, - test(response) { + test() { Assert.ok(!fetched); }, }, diff --git a/netwerk/test/unit/test_bug812167.js b/netwerk/test/unit/test_bug812167.js index 8f4d1310a0..1773a733c2 100644 --- a/netwerk/test/unit/test_bug812167.js +++ b/netwerk/test/unit/test_bug812167.js @@ -25,7 +25,7 @@ ChromeUtils.defineLazyGetter(this, "randomURI2", function () { return "http://localhost:" + httpserver.identity.primaryPort + randomPath2; }); -function make_channel(url, callback, ctx) { +function make_channel(url) { return NetUtil.newChannel({ uri: url, loadUsingSystemPrincipal: true }); } diff --git a/netwerk/test/unit/test_bug856978.js b/netwerk/test/unit/test_bug856978.js index 607b392473..5152abb764 100644 --- a/netwerk/test/unit/test_bug856978.js +++ b/netwerk/test/unit/test_bug856978.js @@ -55,7 +55,7 @@ RequestObserver.prototype = { "nsISupportsWeakReference", ]), - observe(subject, topic, data) { + observe(subject, topic) { if (topic == notification) { if (!(subject instanceof Ci.nsIHttpChannel)) { do_throw(notification + " observed a non-HTTP channel."); @@ -76,13 +76,13 @@ RequestObserver.prototype = { }; var listener = { - onStartRequest: function test_onStartR(request) {}, + onStartRequest: function test_onStartR() {}, onDataAvailable: function test_ODA() { do_throw("Should not get any data!"); }, - onStopRequest: function test_onStopR(request, status) { + onStopRequest: function test_onStopR() { if (current_test < tests.length - 1) { current_test++; tests[current_test](); diff --git a/netwerk/test/unit/test_bug894586.js b/netwerk/test/unit/test_bug894586.js index bc25731d36..ecce039790 100644 --- a/netwerk/test/unit/test_bug894586.js +++ b/netwerk/test/unit/test_bug894586.js @@ -25,7 +25,7 @@ ProtocolHandler.prototype = { this.loadInfo = aLoadInfo; return this; }, - allowPort(port, scheme) { + allowPort(port) { return port != -1; }, @@ -67,7 +67,7 @@ ProtocolHandler.prototype = { loadUsingSystemPrincipal: true, }).open(); }, - asyncOpen(aListener, aContext) { + asyncOpen() { throw Components.Exception("Not implemented", Cr.NS_ERROR_NOT_IMPLEMENTED); }, contentDisposition: Ci.nsIChannel.DISPOSITION_INLINE, @@ -86,7 +86,7 @@ ProtocolHandler.prototype = { get status() { return Cr.NS_OK; }, - cancel(status) {}, + cancel() {}, loadGroup: null, loadFlags: Ci.nsIRequest.LOAD_NORMAL | diff --git a/netwerk/test/unit/test_cache-control_request.js b/netwerk/test/unit/test_cache-control_request.js index f0873cba24..25ca26f40b 100644 --- a/netwerk/test/unit/test_cache-control_request.js +++ b/netwerk/test/unit/test_cache-control_request.js @@ -106,7 +106,7 @@ add_test(() => { // Must not create a cache entry var ch = make_channel(resource_age_100_url, "no-store"); ch.asyncOpen( - new ChannelListener(function (request, data) { + new ChannelListener(function () { Assert.ok(hit_server); Assert.ok(!cache.exists(make_uri(resource_age_100_url), "")); @@ -119,7 +119,7 @@ add_test(() => { // Prepare state only, cache the entry var ch = make_channel(resource_age_100_url); ch.asyncOpen( - new ChannelListener(function (request, data) { + new ChannelListener(function () { Assert.ok(hit_server); Assert.ok(cache.exists(make_uri(resource_age_100_url), "")); @@ -132,7 +132,7 @@ add_test(() => { // Check the prepared cache entry is used when no special directives are added var ch = make_channel(resource_age_100_url); ch.asyncOpen( - new ChannelListener(function (request, data) { + new ChannelListener(function () { Assert.ok(!hit_server); Assert.ok(cache.exists(make_uri(resource_age_100_url), "")); @@ -146,7 +146,7 @@ add_test(() => { // the channel must not use it, entry should stay in the cache var ch = make_channel(resource_age_100_url, "no-store"); ch.asyncOpen( - new ChannelListener(function (request, data) { + new ChannelListener(function () { Assert.ok(hit_server); Assert.ok(cache.exists(make_uri(resource_age_100_url), "")); @@ -162,7 +162,7 @@ add_test(() => { // Check the prepared cache entry is used when no special directives are added var ch = make_channel(resource_age_100_url); ch.asyncOpen( - new ChannelListener(function (request, data) { + new ChannelListener(function () { Assert.ok(!hit_server); Assert.ok(cache.exists(make_uri(resource_age_100_url), "")); @@ -175,7 +175,7 @@ add_test(() => { // The existing entry should be revalidated (we expect a server hit) var ch = make_channel(resource_age_100_url, "no-cache"); ch.asyncOpen( - new ChannelListener(function (request, data) { + new ChannelListener(function () { Assert.ok(hit_server); Assert.ok(cache.exists(make_uri(resource_age_100_url), "")); @@ -191,7 +191,7 @@ add_test(() => { // Check the prepared cache entry is used when no special directives are added var ch = make_channel(resource_age_100_url); ch.asyncOpen( - new ChannelListener(function (request, data) { + new ChannelListener(function () { Assert.ok(!hit_server); Assert.ok(cache.exists(make_uri(resource_age_100_url), "")); @@ -205,7 +205,7 @@ add_test(() => { // should hit server var ch = make_channel(resource_age_100_url, "max-age=10"); ch.asyncOpen( - new ChannelListener(function (request, data) { + new ChannelListener(function () { Assert.ok(hit_server); Assert.ok(cache.exists(make_uri(resource_age_100_url), "")); @@ -219,7 +219,7 @@ add_test(() => { // but the max-stale directive says to use it when it's fresh enough var ch = make_channel(resource_age_100_url, "max-age=10, max-stale=99999"); ch.asyncOpen( - new ChannelListener(function (request, data) { + new ChannelListener(function () { Assert.ok(!hit_server); Assert.ok(cache.exists(make_uri(resource_age_100_url), "")); @@ -233,7 +233,7 @@ add_test(() => { // should go from cache var ch = make_channel(resource_age_100_url, "max-age=1000"); ch.asyncOpen( - new ChannelListener(function (request, data) { + new ChannelListener(function () { Assert.ok(!hit_server); Assert.ok(cache.exists(make_uri(resource_age_100_url), "")); @@ -249,7 +249,7 @@ add_test(() => { // Preprate the entry first var ch = make_channel(resource_stale_100_url); ch.asyncOpen( - new ChannelListener(function (request, data) { + new ChannelListener(function () { Assert.ok(hit_server); Assert.ok(cache.exists(make_uri(resource_stale_100_url), "")); @@ -264,7 +264,7 @@ add_test(() => { // are provided var ch = make_channel(resource_stale_100_url); ch.asyncOpen( - new ChannelListener(function (request, data) { + new ChannelListener(function () { Assert.ok(hit_server); Assert.ok(cache.exists(make_uri(resource_stale_100_url), "")); @@ -277,7 +277,7 @@ add_test(() => { // Accept cached responses of any stale time var ch = make_channel(resource_stale_100_url, "max-stale"); ch.asyncOpen( - new ChannelListener(function (request, data) { + new ChannelListener(function () { Assert.ok(!hit_server); Assert.ok(cache.exists(make_uri(resource_stale_100_url), "")); @@ -290,7 +290,7 @@ add_test(() => { // The entry is stale only by 100 seconds, accept it var ch = make_channel(resource_stale_100_url, "max-stale=1000"); ch.asyncOpen( - new ChannelListener(function (request, data) { + new ChannelListener(function () { Assert.ok(!hit_server); Assert.ok(cache.exists(make_uri(resource_stale_100_url), "")); @@ -304,7 +304,7 @@ add_test(() => { // entry, go from server var ch = make_channel(resource_stale_100_url, "max-stale=10"); ch.asyncOpen( - new ChannelListener(function (request, data) { + new ChannelListener(function () { Assert.ok(hit_server); Assert.ok(cache.exists(make_uri(resource_stale_100_url), "")); @@ -320,7 +320,7 @@ add_test(() => { // Preprate the entry first var ch = make_channel(resource_fresh_100_url); ch.asyncOpen( - new ChannelListener(function (request, data) { + new ChannelListener(function () { Assert.ok(hit_server); Assert.ok(cache.exists(make_uri(resource_fresh_100_url), "")); @@ -333,7 +333,7 @@ add_test(() => { // Check it's reused when no special directives are provided var ch = make_channel(resource_fresh_100_url); ch.asyncOpen( - new ChannelListener(function (request, data) { + new ChannelListener(function () { Assert.ok(!hit_server); Assert.ok(cache.exists(make_uri(resource_fresh_100_url), "")); @@ -346,7 +346,7 @@ add_test(() => { // Entry fresh enough to be served from the cache var ch = make_channel(resource_fresh_100_url, "min-fresh=10"); ch.asyncOpen( - new ChannelListener(function (request, data) { + new ChannelListener(function () { Assert.ok(!hit_server); Assert.ok(cache.exists(make_uri(resource_fresh_100_url), "")); @@ -359,7 +359,7 @@ add_test(() => { // The entry is not fresh enough var ch = make_channel(resource_fresh_100_url, "min-fresh=1000"); ch.asyncOpen( - new ChannelListener(function (request, data) { + new ChannelListener(function () { Assert.ok(hit_server); Assert.ok(cache.exists(make_uri(resource_fresh_100_url), "")); @@ -378,7 +378,7 @@ add_test(() => { 'unknown1,unknown2 = "a,b", min-fresh = 1000 ' ); ch.asyncOpen( - new ChannelListener(function (request, data) { + new ChannelListener(function () { Assert.ok(hit_server); Assert.ok(cache.exists(make_uri(resource_fresh_100_url), "")); @@ -390,7 +390,7 @@ add_test(() => { add_test(() => { var ch = make_channel(resource_fresh_100_url, "no-cache = , min-fresh = 10"); ch.asyncOpen( - new ChannelListener(function (request, data) { + new ChannelListener(function () { Assert.ok(hit_server); Assert.ok(cache.exists(make_uri(resource_fresh_100_url), "")); diff --git a/netwerk/test/unit/test_cache2-02b-open-non-existing-and-doom.js b/netwerk/test/unit/test_cache2-02b-open-non-existing-and-doom.js index d54aeeb9eb..67c5d14c54 100644 --- a/netwerk/test/unit/test_cache2-02b-open-non-existing-and-doom.js +++ b/netwerk/test/unit/test_cache2-02b-open-non-existing-and-doom.js @@ -126,7 +126,7 @@ add_task(async function test() { onCacheEntryCheck() { return Ci.nsICacheEntryOpenCallback.ENTRY_WANTED; }, - onCacheEntryAvailable(entry, isnew, status) { + onCacheEntryAvailable() { info("opened"); r2(); }, @@ -154,17 +154,7 @@ add_task(async function test() { let entryCount = 0; let visitor = { onCacheStorageInfo() {}, - async onCacheEntryInfo( - aURI, - aIdEnhance, - aDataSize, - aAltDataSize, - aFetchCount, - aLastModifiedTime, - aExpirationTime, - aPinned, - aInfo - ) { + async onCacheEntryInfo() { entryCount++; }, onCacheEntryVisitCompleted() { diff --git a/netwerk/test/unit/test_cache2-08-evict-disk-by-memory-storage.js b/netwerk/test/unit/test_cache2-08-evict-disk-by-memory-storage.js index 395c41dd7c..a0602d80e6 100644 --- a/netwerk/test/unit/test_cache2-08-evict-disk-by-memory-storage.js +++ b/netwerk/test/unit/test_cache2-08-evict-disk-by-memory-storage.js @@ -8,7 +8,7 @@ function run_test() { "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null, - new OpenCallback(NEW, "a1m", "a1d", function (entry) { + new OpenCallback(NEW, "a1m", "a1d", function () { var storage = getCacheStorage("memory"); // Have to fail storage.asyncDoomURI( diff --git a/netwerk/test/unit/test_cache2-14-concurent-readers.js b/netwerk/test/unit/test_cache2-14-concurent-readers.js index d2e80582dc..2696790f1b 100644 --- a/netwerk/test/unit/test_cache2-14-concurent-readers.js +++ b/netwerk/test/unit/test_cache2-14-concurent-readers.js @@ -8,7 +8,7 @@ function run_test() { "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null, - new OpenCallback(NEW, "x1m", "x1d", function (entry) { + new OpenCallback(NEW, "x1m", "x1d", function () { // nothing to do here, we expect concurent callbacks to get // all notified, then the test finishes }) @@ -21,7 +21,7 @@ function run_test() { "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null, - new OpenCallback(NORMAL, "x1m", "x1d", function (entry) { + new OpenCallback(NORMAL, "x1m", "x1d", function () { mc.fired(); }) ); @@ -30,7 +30,7 @@ function run_test() { "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null, - new OpenCallback(NORMAL, "x1m", "x1d", function (entry) { + new OpenCallback(NORMAL, "x1m", "x1d", function () { mc.fired(); }) ); @@ -39,7 +39,7 @@ function run_test() { "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null, - new OpenCallback(NORMAL, "x1m", "x1d", function (entry) { + new OpenCallback(NORMAL, "x1m", "x1d", function () { mc.fired(); }) ); diff --git a/netwerk/test/unit/test_cache2-14b-concurent-readers-complete.js b/netwerk/test/unit/test_cache2-14b-concurent-readers-complete.js index 244dca9a3b..5da0937836 100644 --- a/netwerk/test/unit/test_cache2-14b-concurent-readers-complete.js +++ b/netwerk/test/unit/test_cache2-14b-concurent-readers-complete.js @@ -8,7 +8,7 @@ function run_test() { "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null, - new OpenCallback(NEW, "x1m", "x1d", function (entry) { + new OpenCallback(NEW, "x1m", "x1d", function () { // nothing to do here, we expect concurent callbacks to get // all notified, then the test finishes }) diff --git a/netwerk/test/unit/test_cache2-15-conditional-304.js b/netwerk/test/unit/test_cache2-15-conditional-304.js index 7b672e69a2..5133b4cd96 100644 --- a/netwerk/test/unit/test_cache2-15-conditional-304.js +++ b/netwerk/test/unit/test_cache2-15-conditional-304.js @@ -31,7 +31,7 @@ function run_test() { "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null, - new OpenCallback(NORMAL, "31m", "31d", function (entry) { + new OpenCallback(NORMAL, "31m", "31d", function () { mc.fired(); }) ); @@ -40,7 +40,7 @@ function run_test() { "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null, - new OpenCallback(NORMAL, "31m", "31d", function (entry) { + new OpenCallback(NORMAL, "31m", "31d", function () { mc.fired(); }) ); @@ -49,7 +49,7 @@ function run_test() { "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null, - new OpenCallback(NORMAL, "31m", "31d", function (entry) { + new OpenCallback(NORMAL, "31m", "31d", function () { mc.fired(); }) ); diff --git a/netwerk/test/unit/test_cache2-16-conditional-200.js b/netwerk/test/unit/test_cache2-16-conditional-200.js index beaa3f0dae..6c8b3f0728 100644 --- a/netwerk/test/unit/test_cache2-16-conditional-200.js +++ b/netwerk/test/unit/test_cache2-16-conditional-200.js @@ -45,7 +45,7 @@ function run_test() { "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null, - new OpenCallback(NORMAL, "22m", "22d", function (entry) { + new OpenCallback(NORMAL, "22m", "22d", function () { mc.fired(); }) ); @@ -54,7 +54,7 @@ function run_test() { "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null, - new OpenCallback(NORMAL, "22m", "22d", function (entry) { + new OpenCallback(NORMAL, "22m", "22d", function () { mc.fired(); }) ); @@ -63,7 +63,7 @@ function run_test() { "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null, - new OpenCallback(NORMAL, "22m", "22d", function (entry) { + new OpenCallback(NORMAL, "22m", "22d", function () { mc.fired(); }) ); diff --git a/netwerk/test/unit/test_cache2-19-range-206.js b/netwerk/test/unit/test_cache2-19-range-206.js index f3f9491932..b29b4b27f0 100644 --- a/netwerk/test/unit/test_cache2-19-range-206.js +++ b/netwerk/test/unit/test_cache2-19-range-206.js @@ -36,7 +36,7 @@ function run_test() { "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null, - new OpenCallback(NORMAL, "206m", "206part1--part2", function (entry) { + new OpenCallback(NORMAL, "206m", "206part1--part2", function () { mc.fired(); }) ); @@ -45,7 +45,7 @@ function run_test() { "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null, - new OpenCallback(NORMAL, "206m", "206part1--part2", function (entry) { + new OpenCallback(NORMAL, "206m", "206part1--part2", function () { mc.fired(); }) ); @@ -54,7 +54,7 @@ function run_test() { "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null, - new OpenCallback(NORMAL, "206m", "206part1--part2", function (entry) { + new OpenCallback(NORMAL, "206m", "206part1--part2", function () { mc.fired(); }) ); diff --git a/netwerk/test/unit/test_cache2-20-range-200.js b/netwerk/test/unit/test_cache2-20-range-200.js index 31b8223c35..a3f2dc379e 100644 --- a/netwerk/test/unit/test_cache2-20-range-200.js +++ b/netwerk/test/unit/test_cache2-20-range-200.js @@ -37,9 +37,7 @@ function run_test() { "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null, - new OpenCallback(NORMAL, "200m2", "200part1b--part2b", function ( - entry - ) { + new OpenCallback(NORMAL, "200m2", "200part1b--part2b", function () { mc.fired(); }) ); @@ -48,9 +46,7 @@ function run_test() { "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null, - new OpenCallback(NORMAL, "200m2", "200part1b--part2b", function ( - entry - ) { + new OpenCallback(NORMAL, "200m2", "200part1b--part2b", function () { mc.fired(); }) ); @@ -59,9 +55,7 @@ function run_test() { "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null, - new OpenCallback(NORMAL, "200m2", "200part1b--part2b", function ( - entry - ) { + new OpenCallback(NORMAL, "200m2", "200part1b--part2b", function () { mc.fired(); }) ); diff --git a/netwerk/test/unit/test_cache2-22-anon-visit.js b/netwerk/test/unit/test_cache2-22-anon-visit.js index 1768f142bd..6ceaa26c9f 100644 --- a/netwerk/test/unit/test_cache2-22-anon-visit.js +++ b/netwerk/test/unit/test_cache2-22-anon-visit.js @@ -24,7 +24,7 @@ function run_test() { "disk", Ci.nsICacheStorage.OPEN_NORMALLY, Services.loadContextInfo.default, - new OpenCallback(NEW | WAITFORWRITE, "an2", "an2", function (entry) { + new OpenCallback(NEW | WAITFORWRITE, "an2", "an2", function () { mc.fired(); }) ); @@ -34,7 +34,7 @@ function run_test() { "disk", Ci.nsICacheStorage.OPEN_NORMALLY, Services.loadContextInfo.anonymous, - new OpenCallback(NEW | WAITFORWRITE, "an2", "an2", function (entry) { + new OpenCallback(NEW | WAITFORWRITE, "an2", "an2", function () { mc.fired(); }) ); diff --git a/netwerk/test/unit/test_cache2-24-exists.js b/netwerk/test/unit/test_cache2-24-exists.js index 7f7c50e9f0..662a9b5139 100644 --- a/netwerk/test/unit/test_cache2-24-exists.js +++ b/netwerk/test/unit/test_cache2-24-exists.js @@ -24,7 +24,7 @@ function run_test() { "disk", Ci.nsICacheStorage.OPEN_NORMALLY, Services.loadContextInfo.default, - new OpenCallback(NEW | WAITFORWRITE, "meta", "data", function (entry) { + new OpenCallback(NEW | WAITFORWRITE, "meta", "data", function () { mc.fired(); }) ); @@ -34,7 +34,7 @@ function run_test() { "memory", Ci.nsICacheStorage.OPEN_NORMALLY, Services.loadContextInfo.default, - new OpenCallback(NEW | WAITFORWRITE, "meta", "data", function (entry) { + new OpenCallback(NEW | WAITFORWRITE, "meta", "data", function () { mc.fired(); }) ); diff --git a/netwerk/test/unit/test_cache2-29a-concurrent_read_resumable_entry_size_zero.js b/netwerk/test/unit/test_cache2-29a-concurrent_read_resumable_entry_size_zero.js index b97c4b113c..da95e63754 100644 --- a/netwerk/test/unit/test_cache2-29a-concurrent_read_resumable_entry_size_zero.js +++ b/netwerk/test/unit/test_cache2-29a-concurrent_read_resumable_entry_size_zero.js @@ -27,7 +27,7 @@ ChromeUtils.defineLazyGetter(this, "URL", function () { var httpServer = null; -function make_channel(url, callback, ctx) { +function make_channel(url) { return NetUtil.newChannel({ uri: url, loadUsingSystemPrincipal: true }); } diff --git a/netwerk/test/unit/test_cache2-29b-concurrent_read_non-resumable_entry_size_zero.js b/netwerk/test/unit/test_cache2-29b-concurrent_read_non-resumable_entry_size_zero.js index e221be7661..fb7111659c 100644 --- a/netwerk/test/unit/test_cache2-29b-concurrent_read_non-resumable_entry_size_zero.js +++ b/netwerk/test/unit/test_cache2-29b-concurrent_read_non-resumable_entry_size_zero.js @@ -29,7 +29,7 @@ ChromeUtils.defineLazyGetter(this, "URL", function () { var httpServer = null; -function make_channel(url, callback, ctx) { +function make_channel(url) { return NetUtil.newChannel({ uri: url, loadUsingSystemPrincipal: true }); } diff --git a/netwerk/test/unit/test_cache2-29c-concurrent_read_half-interrupted.js b/netwerk/test/unit/test_cache2-29c-concurrent_read_half-interrupted.js index 706ad894ca..3a5b22eea8 100644 --- a/netwerk/test/unit/test_cache2-29c-concurrent_read_half-interrupted.js +++ b/netwerk/test/unit/test_cache2-29c-concurrent_read_half-interrupted.js @@ -29,7 +29,7 @@ ChromeUtils.defineLazyGetter(this, "URL", function () { var httpServer = null; -function make_channel(url, callback, ctx) { +function make_channel(url) { return NetUtil.newChannel({ uri: url, loadUsingSystemPrincipal: true }); } diff --git a/netwerk/test/unit/test_cache2-29d-concurrent_read_half-corrupted-206.js b/netwerk/test/unit/test_cache2-29d-concurrent_read_half-corrupted-206.js index d9886a6fbf..e59286ee33 100644 --- a/netwerk/test/unit/test_cache2-29d-concurrent_read_half-corrupted-206.js +++ b/netwerk/test/unit/test_cache2-29d-concurrent_read_half-corrupted-206.js @@ -29,7 +29,7 @@ ChromeUtils.defineLazyGetter(this, "URL", function () { var httpServer = null; -function make_channel(url, callback, ctx) { +function make_channel(url) { return NetUtil.newChannel({ uri: url, loadUsingSystemPrincipal: true }); } @@ -90,6 +90,6 @@ function firstTimeThrough(request, buffer) { Assert.equal(buffer, responseBody); } -function secondTimeThrough(request, buffer) { +function secondTimeThrough() { httpServer.stop(do_test_finished); } diff --git a/netwerk/test/unit/test_cache2-29e-concurrent_read_half-non-206-response.js b/netwerk/test/unit/test_cache2-29e-concurrent_read_half-non-206-response.js index 7d517d518d..a491c9925e 100644 --- a/netwerk/test/unit/test_cache2-29e-concurrent_read_half-non-206-response.js +++ b/netwerk/test/unit/test_cache2-29e-concurrent_read_half-non-206-response.js @@ -29,7 +29,7 @@ ChromeUtils.defineLazyGetter(this, "URL", function () { var httpServer = null; -function make_channel(url, callback, ctx) { +function make_channel(url) { return NetUtil.newChannel({ uri: url, loadUsingSystemPrincipal: true }); } @@ -85,6 +85,6 @@ function firstTimeThrough(request, buffer) { Assert.equal(buffer, responseBody); } -function secondTimeThrough(request, buffer) { +function secondTimeThrough() { httpServer.stop(do_test_finished); } diff --git a/netwerk/test/unit/test_cache2-30c-pinning-deferred-doom.js b/netwerk/test/unit/test_cache2-30c-pinning-deferred-doom.js index 73dfee0f6b..f70926ebd0 100644 --- a/netwerk/test/unit/test_cache2-30c-pinning-deferred-doom.js +++ b/netwerk/test/unit/test_cache2-30c-pinning-deferred-doom.js @@ -74,7 +74,7 @@ function run_test() { "pin", Ci.nsICacheStorage.OPEN_TRUNCATE, lci, - new OpenCallback(NEW | WAITFORWRITE, "m" + i, "p" + i, function (entry) { + new OpenCallback(NEW | WAITFORWRITE, "m" + i, "p" + i, function () { mc.fired(); }) ); @@ -85,7 +85,7 @@ function run_test() { "disk", Ci.nsICacheStorage.OPEN_TRUNCATE, lci, - new OpenCallback(NEW | WAITFORWRITE, "m" + i, "d" + i, function (entry) { + new OpenCallback(NEW | WAITFORWRITE, "m" + i, "d" + i, function () { mc.fired(); }) ); @@ -95,7 +95,7 @@ function run_test() { Services.obs.addObserver( { - observe(subject, topic, data) { + observe() { // (3) log_("after purge, second set of opens"); @@ -112,7 +112,7 @@ function run_test() { "disk", Ci.nsICacheStorage.OPEN_NORMALLY, lci, - new OpenCallback(NORMAL, "m" + i, "p" + i, function (entry) { + new OpenCallback(NORMAL, "m" + i, "p" + i, function () { mc.fired(); }) ); @@ -131,9 +131,7 @@ function run_test() { "disk", Ci.nsICacheStorage.OPEN_NORMALLY, lci, - new OpenCallback(MAYBE_NEW | DOOMED, "m" + i, "d" + i, function ( - entry - ) { + new OpenCallback(MAYBE_NEW | DOOMED, "m" + i, "d" + i, function () { mc.fired(); }) ); @@ -158,7 +156,7 @@ function run_test() { "disk", Ci.nsICacheStorage.OPEN_NORMALLY, lci, - new OpenCallback(NORMAL, "m" + i, "p" + i, function (entry) { + new OpenCallback(NORMAL, "m" + i, "p" + i, function () { mc.fired(); }) ); @@ -169,7 +167,7 @@ function run_test() { "disk", Ci.nsICacheStorage.OPEN_NORMALLY, lci, - new OpenCallback(NEW, "m2" + i, "d2" + i, function (entry) { + new OpenCallback(NEW, "m2" + i, "d2" + i, function () { mc.fired(); }) ); diff --git a/netwerk/test/unit/test_cache2-30d-pinning-WasEvicted-API.js b/netwerk/test/unit/test_cache2-30d-pinning-WasEvicted-API.js index fd4622f3f4..aafe911235 100644 --- a/netwerk/test/unit/test_cache2-30d-pinning-WasEvicted-API.js +++ b/netwerk/test/unit/test_cache2-30d-pinning-WasEvicted-API.js @@ -69,7 +69,7 @@ function run_test() { "pin", Ci.nsICacheStorage.OPEN_TRUNCATE, lci, - new OpenCallback(NEW | WAITFORWRITE, "m" + i, "p" + i, function (entry) { + new OpenCallback(NEW | WAITFORWRITE, "m" + i, "p" + i, function () { mc.fired(); }) ); @@ -80,7 +80,7 @@ function run_test() { "disk", Ci.nsICacheStorage.OPEN_TRUNCATE, lci, - new OpenCallback(NEW | WAITFORWRITE, "m" + i, "d" + i, function (entry) { + new OpenCallback(NEW | WAITFORWRITE, "m" + i, "d" + i, function () { mc.fired(); }) ); @@ -90,7 +90,7 @@ function run_test() { Services.obs.addObserver( { - observe(subject, topic, data) { + observe() { // (3) log_("after purge"); @@ -113,7 +113,7 @@ function run_test() { "disk", Ci.nsICacheStorage.OPEN_NORMALLY, lci, - new OpenCallback(NORMAL, "m" + i, "p" + i, function (entry) { + new OpenCallback(NORMAL, "m" + i, "p" + i, function () { mc.fired(); }) ); @@ -124,7 +124,7 @@ function run_test() { "disk", Ci.nsICacheStorage.OPEN_NORMALLY, lci, - new OpenCallback(NEW, "m2" + i, "d2" + i, function (entry) { + new OpenCallback(NEW, "m2" + i, "d2" + i, function () { mc.fired(); }) ); diff --git a/netwerk/test/unit/test_cache_204_response.js b/netwerk/test/unit/test_cache_204_response.js index 3038b7ed71..4c02e1c60d 100644 --- a/netwerk/test/unit/test_cache_204_response.js +++ b/netwerk/test/unit/test_cache_204_response.js @@ -35,7 +35,11 @@ async function get_response(channel, fromCache) { return new Promise(resolve => { channel.asyncOpen( new ChannelListener((request, buffer, ctx, isFromCache) => { - ok(fromCache == isFromCache, `got response from cache = ${fromCache}`); + Assert.equal( + fromCache, + isFromCache, + `got response from cache = ${fromCache}` + ); resolve(); }) ); diff --git a/netwerk/test/unit/test_cache_jar.js b/netwerk/test/unit/test_cache_jar.js index bedde668b4..1ab93980a6 100644 --- a/netwerk/test/unit/test_cache_jar.js +++ b/netwerk/test/unit/test_cache_jar.js @@ -20,27 +20,24 @@ function cached_handler(metadata, response) { handlers_called++; } -function makeChan(url, inIsolatedMozBrowser, userContextId) { +function makeChan(url, userContextId) { var chan = NetUtil.newChannel({ uri: url, loadUsingSystemPrincipal: true, }).QueryInterface(Ci.nsIHttpChannel); - chan.loadInfo.originAttributes = { inIsolatedMozBrowser, userContextId }; + chan.loadInfo.originAttributes = { userContextId }; return chan; } -// [inIsolatedMozBrowser, userContextId, expected_handlers_called] +// [userContextId, expected_handlers_called] var firstTests = [ - [false, 0, 1], - [true, 0, 1], - [false, 1, 1], - [true, 1, 1], + [0, 1], + [1, 1], ]; var secondTests = [ - [false, 0, 0], - [true, 0, 0], - [false, 1, 1], - [true, 1, 0], + [0, 0], + [1, 1], + [1, 0], ]; async function run_all_tests() { @@ -81,9 +78,9 @@ function run_test() { }); } -function test_channel(inIsolatedMozBrowser, userContextId, expected) { +function test_channel(userContextId, expected) { return new Promise(resolve => { - var chan = makeChan(URL, inIsolatedMozBrowser, userContextId); + var chan = makeChan(URL, userContextId); chan.asyncOpen( new ChannelListener(doneFirstLoad.bind(null, resolve), expected) ); @@ -93,7 +90,7 @@ function test_channel(inIsolatedMozBrowser, userContextId, expected) { function doneFirstLoad(resolve, req, buffer, expected) { // Load it again, make sure it hits the cache var oa = req.loadInfo.originAttributes; - var chan = makeChan(URL, oa.isInIsolatedMozBrowserElement, oa.userContextId); + var chan = makeChan(URL, oa.userContextId); chan.asyncOpen( new ChannelListener(doneSecondLoad.bind(null, resolve), expected) ); diff --git a/netwerk/test/unit/test_captive_portal_service.js b/netwerk/test/unit/test_captive_portal_service.js index d5c951d16c..86e0db3b83 100644 --- a/netwerk/test/unit/test_captive_portal_service.js +++ b/netwerk/test/unit/test_captive_portal_service.js @@ -274,7 +274,7 @@ add_task(async function test_changed_notification() { let changedNotificationCount = 0; let observer = { QueryInterface: ChromeUtils.generateQI(["nsIObserver"]), - observe(aSubject, aTopic, aData) { + observe() { changedNotificationCount += 1; }, }; diff --git a/netwerk/test/unit/test_channel_close.js b/netwerk/test/unit/test_channel_close.js index f8f78fd211..a143f4c495 100644 --- a/netwerk/test/unit/test_channel_close.js +++ b/netwerk/test/unit/test_channel_close.js @@ -18,32 +18,41 @@ var httpbody = "0123456789"; var live_channels = []; -function run_test() { +add_task(async function test() { httpserver.registerPathHandler(testpath, serverHandler); httpserver.start(-1); + registerCleanupFunction(async () => { + if (httpserver) { + await httpserver.stop(); + } + }); - httpProtocolHandler.EnsureHSTSDataReady().then(function () { - var local_channel; + await httpProtocolHandler.EnsureHSTSDataReady(); - // Opened channel that has no remaining references on shutdown - local_channel = setupChannel(testpath); - local_channel.asyncOpen(new ChannelListener(checkRequest, local_channel)); + // Opened channel that has no remaining references on shutdown + let local_channel = setupChannel(testpath); + local_channel.asyncOpen(new SimpleChannelListener()); - // Opened channel that has no remaining references after being opened - setupChannel(testpath).asyncOpen(new ChannelListener(function () {}, null)); + // Opened channel that has no remaining references after being opened + setupChannel(testpath).asyncOpen(new SimpleChannelListener()); - // Unopened channel that has remaining references on shutdown - live_channels.push(setupChannel(testpath)); + // Unopened channel that has remaining references on shutdown + live_channels.push(setupChannel(testpath)); - // Opened channel that has remaining references on shutdown - live_channels.push(setupChannel(testpath)); + // Opened channel that has remaining references on shutdown + live_channels.push(setupChannel(testpath)); + await new Promise(resolve => { live_channels[1].asyncOpen( - new ChannelListener(checkRequestFinish, live_channels[1]) + new SimpleChannelListener((req, data) => { + Assert.equal(data, httpbody); + resolve(); + }) ); }); - do_test_pending(); -} + await httpserver.stop(); + httpserver = null; +}); function setupChannel(path) { var chan = NetUtil.newChannel({ @@ -59,12 +68,3 @@ function serverHandler(metadata, response) { response.setHeader("Content-Type", "text/plain", false); response.bodyOutputStream.write(httpbody, httpbody.length); } - -function checkRequest(request, data, context) { - Assert.equal(data, httpbody); -} - -function checkRequestFinish(request, data, context) { - checkRequest(request, data, context); - httpserver.stop(do_test_finished); -} diff --git a/netwerk/test/unit/test_chunked_responses.js b/netwerk/test/unit/test_chunked_responses.js index c8dee14efe..3a2f11a802 100644 --- a/netwerk/test/unit/test_chunked_responses.js +++ b/netwerk/test/unit/test_chunked_responses.js @@ -75,7 +75,7 @@ function handler1(metadata, response) { } // eslint-disable-next-line no-unused-vars -function completeTest1(request, data, ctx) { +function completeTest1(request) { Assert.equal(request.status, Cr.NS_ERROR_UNEXPECTED); run_test_number(2); @@ -100,7 +100,7 @@ function handler2(metadata, response) { } // eslint-disable-next-line no-unused-vars -function completeTest2(request, data, ctx) { +function completeTest2(request) { Assert.equal(request.status, Cr.NS_ERROR_UNEXPECTED); run_test_number(3); } @@ -124,7 +124,7 @@ function handler3(metadata, response) { } // eslint-disable-next-line no-unused-vars -function completeTest3(request, data, ctx) { +function completeTest3(request) { Assert.equal(request.status, 0); run_test_number(4); } @@ -148,7 +148,7 @@ function handler4(metadata, response) { } // eslint-disable-next-line no-unused-vars -function completeTest4(request, data, ctx) { +function completeTest4(request) { Assert.equal(request.status, 0); run_test_number(5); } @@ -173,7 +173,7 @@ function handler5(metadata, response) { } // eslint-disable-next-line no-unused-vars -function completeTest5(request, data, ctx) { +function completeTest5(request) { Assert.equal(request.status, Cr.NS_ERROR_UNEXPECTED); endTests(); // run_test_number(6); diff --git a/netwerk/test/unit/test_client_auth_with_proxy.js b/netwerk/test/unit/test_client_auth_with_proxy.js index 5a205f4db1..11f0ebdafe 100644 --- a/netwerk/test/unit/test_client_auth_with_proxy.js +++ b/netwerk/test/unit/test_client_auth_with_proxy.js @@ -41,7 +41,7 @@ class SecurityObserver { this.output = output; } - onHandshakeDone(socket, status) { + onHandshakeDone() { info("TLS handshake done"); let output = this.output; diff --git a/netwerk/test/unit/test_connection_based_auth.js b/netwerk/test/unit/test_connection_based_auth.js index 3a21ffcb77..049478aeba 100644 --- a/netwerk/test/unit/test_connection_based_auth.js +++ b/netwerk/test/unit/test_connection_based_auth.js @@ -37,7 +37,7 @@ add_task(async function test_connection_based_auth() { let proxy = new NodeHTTPSProxyServer(); await proxy.start(); - await proxy.registerConnectHandler((req, clientSocket, head) => { + await proxy.registerConnectHandler((req, clientSocket) => { if (!req.headers["proxy-authorization"]) { clientSocket.write( "HTTP/1.1 407 Unauthorized\r\n" + diff --git a/netwerk/test/unit/test_content_encoding_gzip.js b/netwerk/test/unit/test_content_encoding_gzip.js index 48479034b8..1137a306e5 100644 --- a/netwerk/test/unit/test_content_encoding_gzip.js +++ b/netwerk/test/unit/test_content_encoding_gzip.js @@ -113,7 +113,7 @@ function startIter() { ); } -function completeIter(request, data, ctx) { +function completeIter(request, data) { if (!(tests[index].flags & CL_EXPECT_FAILURE)) { Assert.equal(data.length, tests[index].datalen, "test " + index); } diff --git a/netwerk/test/unit/test_content_length_underrun.js b/netwerk/test/unit/test_content_length_underrun.js index f5f8e40a8a..2a01b98110 100644 --- a/netwerk/test/unit/test_content_length_underrun.js +++ b/netwerk/test/unit/test_content_length_underrun.js @@ -73,7 +73,7 @@ function run_gzip_test(num) { "nsIRequestObserver", ]), - onStartRequest(aRequest) {}, + onStartRequest() {}, onStopRequest(aRequest, aStatusCode) { // Make sure we catch the error NS_ERROR_NET_PARTIAL_TRANSFER here. @@ -82,7 +82,7 @@ function run_gzip_test(num) { endTests(); }, - onDataAvailable(request, stream, offset, count) {}, + onDataAvailable() {}, }; let listener = new StreamListener(); @@ -128,7 +128,7 @@ function handler1(metadata, response) { } // eslint-disable-next-line no-unused-vars -function completeTest1(request, data, ctx) { +function completeTest1(request) { Assert.equal(request.status, Cr.NS_ERROR_NET_PARTIAL_TRANSFER); run_test_number(11); @@ -152,7 +152,7 @@ function handler11(metadata, response) { } // eslint-disable-next-line no-unused-vars -function completeTest11(request, data, ctx) { +function completeTest11(request) { Assert.equal(request.status, Cr.NS_OK); run_test_number(2); } @@ -176,7 +176,7 @@ function handler2(metadata, response) { } // eslint-disable-next-line no-unused-vars -function completeTest2(request, data, ctx) { +function completeTest2(request) { Assert.equal(request.status, Cr.NS_OK); // test 3 requires the enforce-framing prefs to be false @@ -207,7 +207,7 @@ function handler3(metadata, response) { } // eslint-disable-next-line no-unused-vars -function completeTest3(request, data, ctx) { +function completeTest3(request) { Assert.equal(request.status, Cr.NS_OK); prefs.setBoolPref("network.http.enforce-framing.soft", true); run_test_number(4); @@ -249,7 +249,7 @@ function handler4(metadata, response) { } // eslint-disable-next-line no-unused-vars -function completeTest4(request, data, ctx) { +function completeTest4(request) { Assert.equal(request.status, Cr.NS_OK); prefs.setBoolPref("network.http.enforce-framing.http1", true); diff --git a/netwerk/test/unit/test_content_sniffer.js b/netwerk/test/unit/test_content_sniffer.js index 26fb55cece..7b109019cd 100644 --- a/netwerk/test/unit/test_content_sniffer.js +++ b/netwerk/test/unit/test_content_sniffer.js @@ -27,7 +27,7 @@ var sniffer = { return this.QueryInterface(iid); }, - getMIMETypeFromContent(request, data, length) { + getMIMETypeFromContent() { return sniffedType; }, }; @@ -72,7 +72,7 @@ var listener = { throw Components.Exception("", Cr.NS_ERROR_UNEXPECTED); }, - onStopRequest: function test_onStopR(request, status) { + onStopRequest: function test_onStopR() { run_test_iteration(this._iteration); do_test_finished(); }, diff --git a/netwerk/test/unit/test_cookie_header.js b/netwerk/test/unit/test_cookie_header.js index a5326ef25c..15f384c5cf 100644 --- a/netwerk/test/unit/test_cookie_header.js +++ b/netwerk/test/unit/test_cookie_header.js @@ -48,7 +48,7 @@ var listener = { throw Components.Exception("", Cr.NS_ERROR_UNEXPECTED); }, - onStopRequest: async function test_onStopR(request, status) { + onStopRequest: async function test_onStopR() { if (this._iteration == 1) { await run_test_continued(); } else { diff --git a/netwerk/test/unit/test_cookiejars.js b/netwerk/test/unit/test_cookiejars.js index 1d78893f8c..aaf8832f62 100644 --- a/netwerk/test/unit/test_cookiejars.js +++ b/netwerk/test/unit/test_cookiejars.js @@ -36,19 +36,11 @@ function inChildProcess() { var tests = [ { cookieName: "LCC_App0_BrowF_PrivF", - originAttributes: new OriginAttributes(0, false, 0), - }, - { - cookieName: "LCC_App0_BrowT_PrivF", - originAttributes: new OriginAttributes(0, true, 0), + originAttributes: new OriginAttributes(0), }, { cookieName: "LCC_App1_BrowF_PrivF", - originAttributes: new OriginAttributes(1, false, 0), - }, - { - cookieName: "LCC_App1_BrowT_PrivF", - originAttributes: new OriginAttributes(1, true, 0), + originAttributes: new OriginAttributes(1), }, ]; @@ -88,7 +80,7 @@ function setCookie() { channel.asyncOpen(new ChannelListener(setNextCookie, null)); } -function setNextCookie(request, data, context) { +function setNextCookie() { if (++i == tests.length) { // all cookies set: switch to checking them i = 0; @@ -106,7 +98,7 @@ function checkCookie() { channel.asyncOpen(new ChannelListener(completeCheckCookie, null)); } -function completeCheckCookie(request, data, context) { +function completeCheckCookie(request) { // Look for all cookies in what the server saw: fail if we see any besides the // one expected cookie for each namespace; var expectedCookie = tests[i].cookieName; diff --git a/netwerk/test/unit/test_cookiejars_safebrowsing.js b/netwerk/test/unit/test_cookiejars_safebrowsing.js index 855bacef42..8cb9d03c37 100644 --- a/netwerk/test/unit/test_cookiejars_safebrowsing.js +++ b/netwerk/test/unit/test_cookiejars_safebrowsing.js @@ -154,7 +154,7 @@ add_test(function test_safebrowsing_gethash() { URL + safebrowsingGethashPath, "test-phish-simple", { - completionV2(hash, table, chunkId) {}, + completionV2() {}, completionFinished(status) { Assert.equal(status, Cr.NS_OK); @@ -181,7 +181,7 @@ add_test(function test_non_safebrowsing_cookie() { ); } - function completeCheckNonSafeBrowsingCookie(request, data, context) { + function completeCheckNonSafeBrowsingCookie(request) { // Confirm that only the >> ONE << cookie is sent over the channel. var expectedCookie = cookieName + "=1"; request.QueryInterface(Ci.nsIHttpChannel); @@ -212,7 +212,7 @@ add_test(function test_safebrowsing_cookie() { ); } - function completeCheckSafeBrowsingCookie(request, data, context) { + function completeCheckSafeBrowsingCookie(request) { // Confirm that all >> THREE << cookies are sent back over the channel: // a) the safebrowsing cookie set when updating // b) the safebrowsing cookie set when sending gethash diff --git a/netwerk/test/unit/test_cookies_async_failure.js b/netwerk/test/unit/test_cookies_async_failure.js index c61da23f99..9aaad03982 100644 --- a/netwerk/test/unit/test_cookies_async_failure.js +++ b/netwerk/test/unit/test_cookies_async_failure.js @@ -158,7 +158,7 @@ async function run_test_1() { Assert.equal(Services.cookies.countCookiesFromHost(cookie.host), 1); let isRebuildingDone = false; - let rebuildingObserve = function (subject, topic, data) { + let rebuildingObserve = function () { isRebuildingDone = true; Services.obs.removeObserver(rebuildingObserve, "cookie-db-rebuilding"); }; diff --git a/netwerk/test/unit/test_dns_localredirect.js b/netwerk/test/unit/test_dns_localredirect.js index 3ca432f477..5907f15b06 100644 --- a/netwerk/test/unit/test_dns_localredirect.js +++ b/netwerk/test/unit/test_dns_localredirect.js @@ -5,7 +5,7 @@ var prefs = Services.prefs; var nextTest; var listener = { - onLookupComplete(inRequest, inRecord, inStatus) { + onLookupComplete(inRequest, inRecord) { inRecord.QueryInterface(Ci.nsIDNSAddrRecord); var answer = inRecord.getNextAddrAsString(); Assert.ok(answer == "127.0.0.1" || answer == "::1"); diff --git a/netwerk/test/unit/test_dns_onion.js b/netwerk/test/unit/test_dns_onion.js index 928753f71f..e13974a39e 100644 --- a/netwerk/test/unit/test_dns_onion.js +++ b/netwerk/test/unit/test_dns_onion.js @@ -17,7 +17,7 @@ var listenerBlock = { // check that we do lookup .onion (via pref) var listenerDontBlock = { - onLookupComplete(inRequest, inRecord, inStatus) { + onLookupComplete(inRequest, inRecord) { inRecord.QueryInterface(Ci.nsIDNSAddrRecord); var answer = inRecord.getNextAddrAsString(); Assert.ok(answer == "127.0.0.1" || answer == "::1"); diff --git a/netwerk/test/unit/test_dns_proxy_bypass.js b/netwerk/test/unit/test_dns_proxy_bypass.js index d53efc3dd3..6951b5cd1f 100644 --- a/netwerk/test/unit/test_dns_proxy_bypass.js +++ b/netwerk/test/unit/test_dns_proxy_bypass.js @@ -48,12 +48,12 @@ function WSListener(closure) { this._closure = closure; } WSListener.prototype = { - onAcknowledge(aContext, aSize) {}, - onBinaryMessageAvailable(aContext, aMsg) {}, - onMessageAvailable(aContext, aMsg) {}, - onServerClose(aContext, aCode, aReason) {}, - onStart(aContext) {}, - onStop(aContext, aStatusCode) { + onAcknowledge() {}, + onBinaryMessageAvailable() {}, + onMessageAvailable() {}, + onServerClose() {}, + onStart() {}, + onStop() { dnsRequestObserver.unregister(); this._closure(); }, diff --git a/netwerk/test/unit/test_dns_retry.js b/netwerk/test/unit/test_dns_retry.js index 24688417fa..477586126e 100644 --- a/netwerk/test/unit/test_dns_retry.js +++ b/netwerk/test/unit/test_dns_retry.js @@ -142,8 +142,8 @@ StatusCounter.prototype = { return this.QueryInterface(iid); }, - onProgress(request, progress, progressMax) {}, - onStatus(request, status, statusArg) { + onProgress() {}, + onStatus(request, status) { this._statusCount[status] = 1 + (this._statusCount[status] || 0); }, }; @@ -154,7 +154,7 @@ let HttpListener = function (finish, succeeded) { }; HttpListener.prototype = { - onStartRequest: function testOnStartRequest(request) {}, + onStartRequest: function testOnStartRequest() {}, onDataAvailable: function testOnDataAvailable(request, stream, off, cnt) { read_stream(stream, cnt); @@ -167,7 +167,7 @@ HttpListener.prototype = { }; function promiseObserverNotification(aTopic, matchFunc) { - return new Promise((resolve, reject) => { + return new Promise(resolve => { Services.obs.addObserver(function observe(subject, topic, data) { let matches = typeof matchFunc != "function" || matchFunc(subject, data); if (!matches) { diff --git a/netwerk/test/unit/test_dooh.js b/netwerk/test/unit/test_dooh.js index cab4b3bb02..d422bac5e9 100644 --- a/netwerk/test/unit/test_dooh.js +++ b/netwerk/test/unit/test_dooh.js @@ -127,7 +127,7 @@ add_setup(async function setup() { Services.prefs.clearUserPref("network.trr.ohttp.relay_uri"); Services.prefs.clearUserPref("network.trr.ohttp.uri"); Services.prefs.clearUserPref("network.dns.get-ttl"); - await new Promise((resolve, reject) => { + await new Promise(resolve => { httpServer.stop(resolve); }); }); diff --git a/netwerk/test/unit/test_duplicate_headers.js b/netwerk/test/unit/test_duplicate_headers.js index 78d2355d1e..12e8e8d0d3 100644 --- a/netwerk/test/unit/test_duplicate_headers.js +++ b/netwerk/test/unit/test_duplicate_headers.js @@ -73,7 +73,7 @@ function handler1(metadata, response) { response.finish(); } -function completeTest1(request, data, ctx) { +function completeTest1(request) { Assert.equal(request.status, Cr.NS_ERROR_CORRUPTED_CONTENT); run_test_number(2); @@ -94,7 +94,7 @@ function handler2(metadata, response) { response.finish(); } -function completeTest2(request, data, ctx) { +function completeTest2(request) { Assert.equal(request.status, 0); run_test_number(3); } @@ -115,7 +115,7 @@ function handler3(metadata, response) { response.finish(); } -function completeTest3(request, data, ctx) { +function completeTest3(request) { Assert.equal(request.status, Cr.NS_ERROR_CORRUPTED_CONTENT); run_test_number(4); @@ -143,7 +143,7 @@ function handler4(metadata, response) { response.finish(); } -function completeTest4(request, data, ctx) { +function completeTest4(request) { Assert.equal(request.status, Cr.NS_ERROR_CORRUPTED_CONTENT); run_test_number(5); @@ -166,7 +166,7 @@ function handler5(metadata, response) { response.finish(); } -function completeTest5(request, data, ctx) { +function completeTest5(request) { try { let referer = request.getResponseHeader("Referer"); Assert.equal(referer, "naive.org"); @@ -196,7 +196,7 @@ function handler6(metadata, response) { response.finish(); } -function completeTest6(request, data, ctx) { +function completeTest6(request) { Assert.equal(request.status, Cr.NS_ERROR_CORRUPTED_CONTENT); // run_test_number(7); // Test 7 leaking under e10s: unrelated bug? @@ -221,7 +221,7 @@ function handler7(metadata, response) { response.finish(); } -function completeTest7(request, data, ctx) { +function completeTest7(request) { // for some reason need this here request.QueryInterface(Ci.nsIHttpChannel); @@ -254,7 +254,7 @@ function handler8(metadata, response) { response.finish(); } -function completeTest8(request, data, ctx) { +function completeTest8(request) { Assert.equal(request.status, Cr.NS_ERROR_CORRUPTED_CONTENT); run_test_number(9); @@ -282,7 +282,7 @@ function handler9(metadata, response) { response.finish(); } -function completeTest9(request, data, ctx) { +function completeTest9(request) { // All redirection should fail: Assert.equal(request.status, Cr.NS_ERROR_CORRUPTED_CONTENT); @@ -307,7 +307,7 @@ function handler10(metadata, response) { response.finish(); } -function completeTest10(request, data, ctx) { +function completeTest10(request) { Assert.equal(request.status, Cr.NS_ERROR_CORRUPTED_CONTENT); run_test_number(11); @@ -329,7 +329,7 @@ function handler11(metadata, response) { response.finish(); } -function completeTest11(request, data, ctx) { +function completeTest11(request) { Assert.equal(request.status, 0); try { @@ -360,7 +360,7 @@ function handler12(metadata, response) { response.finish(); } -function completeTest12(request, data, ctx) { +function completeTest12(request, data) { Assert.equal(request.status, Cr.NS_OK); Assert.equal(30, data.length); @@ -383,7 +383,7 @@ function handler13(metadata, response) { response.finish(); } -function completeTest13(request, data, ctx) { +function completeTest13(request, data) { Assert.equal(request.status, Cr.NS_OK); Assert.equal(30, data.length); @@ -408,7 +408,7 @@ function handler14(metadata, response) { response.finish(); } -function completeTest14(request, data, ctx) { +function completeTest14(request) { Assert.equal(request.status, Cr.NS_ERROR_CORRUPTED_CONTENT); run_test_number(15); @@ -432,7 +432,7 @@ function handler15(metadata, response) { response.finish(); } -function completeTest15(request, data, ctx) { +function completeTest15(request) { Assert.equal(request.status, Cr.NS_ERROR_CORRUPTED_CONTENT); run_test_number(16); @@ -456,7 +456,7 @@ function handler16(metadata, response) { response.finish(); } -function completeTest16(request, data, ctx) { +function completeTest16(request, data) { Assert.equal(request.status, Cr.NS_OK); Assert.equal(30, data.length); @@ -485,7 +485,7 @@ function handler17(metadata, response) { response.finish(); } -function completeTest17(request, data, ctx) { +function completeTest17(request) { Assert.equal(request.status, Cr.NS_ERROR_CORRUPTED_CONTENT); run_test_number(18); @@ -507,7 +507,7 @@ function handler18(metadata, response) { response.finish(); } -function completeTest18(request, data, ctx) { +function completeTest18(request, data) { Assert.equal(request.status, Cr.NS_OK); Assert.equal(30, data.length); @@ -530,7 +530,7 @@ function handler19(metadata, response) { response.finish(); } -function completeTest19(request, data, ctx) { +function completeTest19(request, data) { Assert.equal(request.status, Cr.NS_OK); Assert.equal(30, data.length); @@ -556,7 +556,7 @@ function handler20(metadata, response) { response.finish(); } -function completeTest20(request, data, ctx) { +function completeTest20(request) { Assert.equal(request.status, Cr.NS_ERROR_CORRUPTED_CONTENT); endTests(); diff --git a/netwerk/test/unit/test_ech_grease.js b/netwerk/test/unit/test_ech_grease.js index bbe9c027b5..7505985ef8 100644 --- a/netwerk/test/unit/test_ech_grease.js +++ b/netwerk/test/unit/test_ech_grease.js @@ -182,7 +182,7 @@ function startClient(port, useGREASE, beConservative) { nonflavors.push("_ECH_GREASE"); } - return new Promise((resolve, reject) => { + return new Promise(resolve => { req.onload = () => { equal(req.responseText, "OK", "response text should be 'OK'"); diff --git a/netwerk/test/unit/test_event_sink.js b/netwerk/test/unit/test_event_sink.js index e49080c88c..d89c905cd2 100644 --- a/netwerk/test/unit/test_event_sink.js +++ b/netwerk/test/unit/test_event_sink.js @@ -26,12 +26,7 @@ var eventsink = { return this.QueryInterface(iid); }, - asyncOnChannelRedirect: function eventsink_onredir( - oldChan, - newChan, - flags, - callback - ) { + asyncOnChannelRedirect: function eventsink_onredir() { // veto this.called = true; throw Components.Exception("", Cr.NS_BINDING_ABORTED); @@ -89,7 +84,7 @@ var listener = { do_throw("Should not get any data!"); }, - onStopRequest: function test_onStopR(request, status) { + onStopRequest: function test_onStopR() { if (this._iteration <= 2) { run_test_continued(); } else { diff --git a/netwerk/test/unit/test_file_protocol.js b/netwerk/test/unit/test_file_protocol.js index 707bddef24..4cb6b32b9e 100644 --- a/netwerk/test/unit/test_file_protocol.js +++ b/netwerk/test/unit/test_file_protocol.js @@ -163,7 +163,7 @@ function do_test_read_dir(set_type, expected_type) { var file = do_get_tempdir(); var chan = new_file_channel(file); - function on_read_complete(data) { + function on_read_complete() { dump( "*** test_read_dir.on_read_complete(" + set_type + diff --git a/netwerk/test/unit/test_freshconnection.js b/netwerk/test/unit/test_freshconnection.js index 5d0f5bc5b7..796111e87b 100644 --- a/netwerk/test/unit/test_freshconnection.js +++ b/netwerk/test/unit/test_freshconnection.js @@ -5,13 +5,13 @@ "use strict"; var listener = { - onStartRequest: function test_onStartR(request) {}, + onStartRequest: function test_onStartR() {}, onDataAvailable: function test_ODA() { do_throw("Should not get any data!"); }, - onStopRequest: function test_onStopR(request, status) { + onStopRequest: function test_onStopR() { do_test_finished(); }, }; diff --git a/netwerk/test/unit/test_getHost.js b/netwerk/test/unit/test_getHost.js index c27fc0c028..98bbab9dfc 100644 --- a/netwerk/test/unit/test_getHost.js +++ b/netwerk/test/unit/test_getHost.js @@ -32,7 +32,7 @@ CheckGetHostListener.prototype = { } }, - onStopRequest(request, statusCode) { + onStopRequest() { dump("*** listener onStopRequest\n"); Assert.equal(gotOnStartRequest, true); diff --git a/netwerk/test/unit/test_gio_protocol.js b/netwerk/test/unit/test_gio_protocol.js index 37ce37abab..2d3250c203 100644 --- a/netwerk/test/unit/test_gio_protocol.js +++ b/netwerk/test/unit/test_gio_protocol.js @@ -82,7 +82,7 @@ FileStreamListener.prototype = { "nsIRequestObserver", ]), - onStartRequest(request) { + onStartRequest() { if (this._got_onstartrequest) { do_throw("Got second onStartRequest event!"); } diff --git a/netwerk/test/unit/test_head.js b/netwerk/test/unit/test_head.js index 8a6b2a5cd7..fba5e95736 100644 --- a/netwerk/test/unit/test_head.js +++ b/netwerk/test/unit/test_head.js @@ -141,7 +141,7 @@ function serverHandler(metadata, response) { } } -function checkRequestResponse(request, data, context) { +function checkRequestResponse(request, data) { if (dbg) { print("============== checkRequestResponse: in"); } diff --git a/netwerk/test/unit/test_head_request_no_response_body.js b/netwerk/test/unit/test_head_request_no_response_body.js index 852a03040f..7f33850217 100644 --- a/netwerk/test/unit/test_head_request_no_response_body.js +++ b/netwerk/test/unit/test_head_request_no_response_body.js @@ -43,7 +43,11 @@ async function get_response(channel, fromCache) { return new Promise(resolve => { channel.asyncOpen( new ChannelListener((request, buffer, ctx, isFromCache) => { - ok(fromCache == isFromCache, `got response from cache = ${fromCache}`); + Assert.equal( + fromCache, + isFromCache, + `got response from cache = ${fromCache}` + ); resolve(buffer); }) ); @@ -66,13 +70,13 @@ add_task(async function () { let response; response = await get_response(make_channel(URI, "GET"), false); - ok(response === responseContent, "got response body"); + Assert.strictEqual(response, responseContent, "got response body"); response = await get_response(make_channel(URI, "GET"), true); - ok(response === responseContent, "got response body from cache"); + Assert.strictEqual(response, responseContent, "got response body from cache"); response = await get_response(make_channel(URI, "HEAD"), false); - ok(response === "", "should have empty body"); + Assert.strictEqual(response, "", "should have empty body"); await stop_server(httpserver); }); diff --git a/netwerk/test/unit/test_header_Server_Timing.js b/netwerk/test/unit/test_header_Server_Timing.js index 0e65cf3ccf..dbf05177e2 100644 --- a/netwerk/test/unit/test_header_Server_Timing.js +++ b/netwerk/test/unit/test_header_Server_Timing.js @@ -56,7 +56,7 @@ function checkServerTimingContent(headers) { } } -function readServerContent(request, buffer) { +function readServerContent(request) { let channel = request.QueryInterface(Ci.nsITimedChannel); let headers = channel.serverTiming.QueryInterface(Ci.nsIArray); checkServerTimingContent(headers); diff --git a/netwerk/test/unit/test_headers.js b/netwerk/test/unit/test_headers.js index e1439c6c43..352ea6b3aa 100644 --- a/netwerk/test/unit/test_headers.js +++ b/netwerk/test/unit/test_headers.js @@ -94,7 +94,7 @@ function handler1(metadata, response) { } // eslint-disable-next-line no-unused-vars -function completeTest1(request, data, ctx) { +function completeTest1(request) { try { var chan = request.QueryInterface(Ci.nsIChannel); Assert.equal(chan.contentDisposition, chan.DISPOSITION_ATTACHMENT); @@ -118,7 +118,7 @@ function handler2(metadata, response) { } // eslint-disable-next-line no-unused-vars -function completeTest2(request, data, ctx) { +function completeTest2(request) { try { var chan = request.QueryInterface(Ci.nsIChannel); Assert.equal(chan.contentDisposition, chan.DISPOSITION_ATTACHMENT); @@ -143,7 +143,7 @@ function handler3(metadata, response) { } // eslint-disable-next-line no-unused-vars -function completeTest3(request, data, ctx) { +function completeTest3(request) { try { var chan = request.QueryInterface(Ci.nsIChannel); Assert.equal(chan.contentDisposition, chan.DISPOSITION_ATTACHMENT); @@ -169,7 +169,7 @@ function handler4(metadata, response) { } // eslint-disable-next-line no-unused-vars -function completeTest4(request, data, ctx) { +function completeTest4(request) { try { var chan = request.QueryInterface(Ci.nsIChannel); Assert.equal(chan.contentDisposition, chan.DISPOSITION_INLINE); diff --git a/netwerk/test/unit/test_http2.js b/netwerk/test/unit/test_http2.js index 0b80e99dcc..3fef56a14c 100644 --- a/netwerk/test/unit/test_http2.js +++ b/netwerk/test/unit/test_http2.js @@ -479,3 +479,12 @@ add_task(async function do_test_http2_push_userContext3() { ); Assert.equal(httpProxyConnectResponseCode, -1); }); + +add_task(async function do_test_http2_continuations_over_max_response_limit() { + const { httpProxyConnectResponseCode } = + await test_http2_continuations_over_max_response_limit( + loadGroup, + serverPort + ); + Assert.equal(httpProxyConnectResponseCode, -1); +}); diff --git a/netwerk/test/unit/test_http2_with_proxy.js b/netwerk/test/unit/test_http2_with_proxy.js index 858a0da570..dcc913f039 100644 --- a/netwerk/test/unit/test_http2_with_proxy.js +++ b/netwerk/test/unit/test_http2_with_proxy.js @@ -423,3 +423,12 @@ add_task(async function do_test_http2_push_userContext3() { ); Assert.equal(httpProxyConnectResponseCode, 200); }); + +add_task(async function do_test_http2_continuations_over_max_response_limit() { + const { httpProxyConnectResponseCode } = + await test_http2_continuations_over_max_response_limit( + loadGroup, + serverPort + ); + Assert.equal(httpProxyConnectResponseCode, 200); +}); diff --git a/netwerk/test/unit/test_http3.js b/netwerk/test/unit/test_http3.js index 7f3f5b118d..4f202e7fe4 100644 --- a/netwerk/test/unit/test_http3.js +++ b/netwerk/test/unit/test_http3.js @@ -283,7 +283,7 @@ MultipleListener.prototype = { read_stream(stream, cnt); }, - onStopRequest: function testOnStopRequest(request, status) { + onStopRequest: function testOnStopRequest(request) { let routed = ""; try { routed = request.getRequestHeader("Alt-Used"); diff --git a/netwerk/test/unit/test_http3_0rtt.js b/netwerk/test/unit/test_http3_0rtt.js index 1002263ed5..efb6e3539f 100644 --- a/netwerk/test/unit/test_http3_0rtt.js +++ b/netwerk/test/unit/test_http3_0rtt.js @@ -32,7 +32,7 @@ Http3Listener.prototype = { read_stream(stream, cnt); }, - onStopRequest: function testOnStopRequest(request, status) { + onStopRequest: function testOnStopRequest(request) { let httpVersion = ""; try { httpVersion = request.protocolVersion; diff --git a/netwerk/test/unit/test_http3_alt_svc.js b/netwerk/test/unit/test_http3_alt_svc.js index 201101eb19..46488525ae 100644 --- a/netwerk/test/unit/test_http3_alt_svc.js +++ b/netwerk/test/unit/test_http3_alt_svc.js @@ -5,7 +5,7 @@ let h3AltSvc; let h3Route; let prefs; -let tests = [test_https_alt_svc, testsDone]; +let tests = [test_https_alt_svc, test_https_alt_svc_1, testsDone]; let current_test = 0; @@ -68,7 +68,9 @@ function makeChan(uri) { return chan; } -let WaitForHttp3Listener = function () {}; +let WaitForHttp3Listener = function (expectedH3Version) { + this._expectedH3Version = expectedH3Version; +}; WaitForHttp3Listener.prototype = { onDataAvailableFired: false, @@ -84,7 +86,7 @@ WaitForHttp3Listener.prototype = { read_stream(stream, cnt); }, - onStopRequest: function testOnStopRequest(request, status) { + onStopRequest: function testOnStopRequest(request) { let routed = "NA"; try { routed = request.getRequestHeader("Alt-Used"); @@ -96,13 +98,18 @@ WaitForHttp3Listener.prototype = { try { httpVersion = request.protocolVersion; } catch (e) {} - Assert.equal(httpVersion, "h3-29"); + Assert.equal(httpVersion, this._expectedH3Version); run_next_test(); } else { dump("poll later for alt svc mapping\n"); do_test_pending(); do_timeout(500, () => { - doTest(this.uri, this.expectedRoute, this.h3AltSvc); + doTest( + this.uri, + this.expectedRoute, + this.h3AltSvc, + this._expectedH3Version + ); }); } @@ -110,9 +117,9 @@ WaitForHttp3Listener.prototype = { }, }; -function doTest(uri, expectedRoute, altSvc) { +function doTest(uri, expectedRoute, altSvc, expectedH3Version) { let chan = makeChan(uri); - let listener = new WaitForHttp3Listener(); + let listener = new WaitForHttp3Listener(expectedH3Version); listener.uri = uri; listener.expectedRoute = expectedRoute; listener.h3AltSvc = altSvc; @@ -121,11 +128,23 @@ function doTest(uri, expectedRoute, altSvc) { } // Test Alt-Svc for http3. -// H2 server returns alt-svc=h2=foo2.example.com:8000,h3-29=:h3port,h3-30=foo2.example.com:8443 +// H2 server returns alt-svc=h2=foo2.example.com:8000,h3-29=:h3port function test_https_alt_svc() { dump("test_https_alt_svc()\n"); do_test_pending(); - doTest(httpsOrigin + "http3-test2", h3Route, h3AltSvc); + doTest(httpsOrigin + "http3-test2", h3Route, h3AltSvc, "h3-29"); +} + +// Test if we use the latest version of HTTP/3. +// H2 server returns alt-svc=h3-29=:h3port,h3=:h3port +function test_https_alt_svc_1() { + // Close the previous connection and clear alt-svc mappings. + Services.obs.notifyObservers(null, "last-pb-context-exited"); + Services.obs.notifyObservers(null, "net:cancel-all-connections"); + do_test_pending(); + do_timeout(1000, () => { + doTest(httpsOrigin + "http3-test3", h3Route, h3AltSvc, "h3"); + }); } function testsDone() { diff --git a/netwerk/test/unit/test_http3_error_before_connect.js b/netwerk/test/unit/test_http3_error_before_connect.js index 72f8d61182..6cfab99d7e 100644 --- a/netwerk/test/unit/test_http3_error_before_connect.js +++ b/netwerk/test/unit/test_http3_error_before_connect.js @@ -70,7 +70,7 @@ add_task(async function test_fatal_stream_error() { let CheckOnlyHttp2Listener = function () {}; CheckOnlyHttp2Listener.prototype = { - onStartRequest: function testOnStartRequest(request) {}, + onStartRequest: function testOnStartRequest() {}, onDataAvailable: function testOnDataAvailable(request, stream, off, cnt) { read_stream(stream, cnt); diff --git a/netwerk/test/unit/test_http3_fast_fallback.js b/netwerk/test/unit/test_http3_fast_fallback.js index ab2b6b7044..94a3268702 100644 --- a/netwerk/test/unit/test_http3_fast_fallback.js +++ b/netwerk/test/unit/test_http3_fast_fallback.js @@ -102,7 +102,7 @@ function channelOpenPromise(chan, flags, delay) { let CheckOnlyHttp2Listener = function () {}; CheckOnlyHttp2Listener.prototype = { - onStartRequest: function testOnStartRequest(request) {}, + onStartRequest: function testOnStartRequest() {}, onDataAvailable: function testOnDataAvailable(request, stream, off, cnt) { read_stream(stream, cnt); diff --git a/netwerk/test/unit/test_http3_fatal_stream_error.js b/netwerk/test/unit/test_http3_fatal_stream_error.js index 4c0b41089a..13b2411df0 100644 --- a/netwerk/test/unit/test_http3_fatal_stream_error.js +++ b/netwerk/test/unit/test_http3_fatal_stream_error.js @@ -19,7 +19,7 @@ registerCleanupFunction(async () => { let Http3FailedListener = function () {}; Http3FailedListener.prototype = { - onStartRequest: function testOnStartRequest(request) {}, + onStartRequest: function testOnStartRequest() {}, onDataAvailable: function testOnDataAvailable(request, stream, off, cnt) { this.amount += cnt; @@ -103,7 +103,7 @@ add_task(async function test_fatal_stream_error() { let CheckOnlyHttp2Listener = function () {}; CheckOnlyHttp2Listener.prototype = { - onStartRequest: function testOnStartRequest(request) {}, + onStartRequest: function testOnStartRequest() {}, onDataAvailable: function testOnDataAvailable(request, stream, off, cnt) { read_stream(stream, cnt); diff --git a/netwerk/test/unit/test_http3_large_post.js b/netwerk/test/unit/test_http3_large_post.js index 2ed8e51bb4..50ad3ef37a 100644 --- a/netwerk/test/unit/test_http3_large_post.js +++ b/netwerk/test/unit/test_http3_large_post.js @@ -38,7 +38,7 @@ Http3Listener.prototype = { this.onProgressNotificationCount += 1; }, - onStatus(request, status, statusArg) {}, + onStatus() {}, onStartRequest: function testOnStartRequest(request) { Assert.equal(request.status, this.expectedStatus); @@ -55,7 +55,7 @@ Http3Listener.prototype = { read_stream(stream, cnt); }, - onStopRequest: function testOnStopRequest(request, status) { + onStopRequest: function testOnStopRequest(request) { let httpVersion = ""; try { httpVersion = request.protocolVersion; diff --git a/netwerk/test/unit/test_http3_large_post_telemetry.js b/netwerk/test/unit/test_http3_large_post_telemetry.js index 33ad4b7d21..a473dd5442 100644 --- a/netwerk/test/unit/test_http3_large_post_telemetry.js +++ b/netwerk/test/unit/test_http3_large_post_telemetry.js @@ -59,7 +59,7 @@ Http3Listener.prototype = { read_stream(stream, cnt); }, - onStopRequest: function testOnStopRequest(request, status) { + onStopRequest: function testOnStopRequest(request) { let httpVersion = ""; try { httpVersion = request.protocolVersion; diff --git a/netwerk/test/unit/test_http3_prio_helpers.js b/netwerk/test/unit/test_http3_prio_helpers.js index c1f6d06bcb..416a968746 100644 --- a/netwerk/test/unit/test_http3_prio_helpers.js +++ b/netwerk/test/unit/test_http3_prio_helpers.js @@ -64,7 +64,7 @@ Http3Listener.prototype = { read_stream(stream, cnt); }, - onStopRequest: function testOnStopRequest(request, status) { + onStopRequest: function testOnStopRequest(request) { let httpVersion = ""; try { httpVersion = request.protocolVersion; diff --git a/netwerk/test/unit/test_http3_server_not_existing.js b/netwerk/test/unit/test_http3_server_not_existing.js index b2b5518974..cdaebc1412 100644 --- a/netwerk/test/unit/test_http3_server_not_existing.js +++ b/netwerk/test/unit/test_http3_server_not_existing.js @@ -77,7 +77,7 @@ add_task(async function test_fatal_stream_error() { let CheckOnlyHttp2Listener = function () {}; CheckOnlyHttp2Listener.prototype = { - onStartRequest: function testOnStartRequest(request) {}, + onStartRequest: function testOnStartRequest() {}, onDataAvailable: function testOnDataAvailable(request, stream, off, cnt) { read_stream(stream, cnt); diff --git a/netwerk/test/unit/test_http3_trans_close.js b/netwerk/test/unit/test_http3_trans_close.js index 0bbb183aab..7fc57873cf 100644 --- a/netwerk/test/unit/test_http3_trans_close.js +++ b/netwerk/test/unit/test_http3_trans_close.js @@ -29,7 +29,7 @@ Http3Listener.prototype = { read_stream(stream, cnt); }, - onStopRequest: function testOnStopRequest(request, status) { + onStopRequest: function testOnStopRequest(request) { let httpVersion = ""; try { httpVersion = request.protocolVersion; diff --git a/netwerk/test/unit/test_http3_version1.js b/netwerk/test/unit/test_http3_version1.js index 65f4eef906..6c41a29ed7 100644 --- a/netwerk/test/unit/test_http3_version1.js +++ b/netwerk/test/unit/test_http3_version1.js @@ -45,13 +45,13 @@ let Http3Listener = function () {}; Http3Listener.prototype = { version1enabled: "", - onStartRequest: function testOnStartRequest(request) {}, + onStartRequest: function testOnStartRequest() {}, onDataAvailable: function testOnDataAvailable(request, stream, off, cnt) { read_stream(stream, cnt); }, - onStopRequest: function testOnStopRequest(request, status) { + onStopRequest: function testOnStopRequest(request) { let httpVersion = ""; try { httpVersion = request.protocolVersion; diff --git a/netwerk/test/unit/test_httpResponseTimeout.js b/netwerk/test/unit/test_httpResponseTimeout.js index c689abc2b5..267b3aa5f4 100644 --- a/netwerk/test/unit/test_httpResponseTimeout.js +++ b/netwerk/test/unit/test_httpResponseTimeout.js @@ -27,9 +27,9 @@ function TimeoutListener(expectResponse) { } TimeoutListener.prototype = { - onStartRequest(request) {}, + onStartRequest() {}, - onDataAvailable(request, stream) {}, + onDataAvailable() {}, onStopRequest(request, status) { if (this.expectResponse) { diff --git a/netwerk/test/unit/test_http_server_timing.js b/netwerk/test/unit/test_http_server_timing.js index c9d46797f3..7ade62edef 100644 --- a/netwerk/test/unit/test_http_server_timing.js +++ b/netwerk/test/unit/test_http_server_timing.js @@ -53,7 +53,7 @@ add_task(async function test_localhost_origin() { }); await new Promise(resolve => { chan.asyncOpen( - new ChannelListener((request, buffer) => { + new ChannelListener(request => { let channel = request.QueryInterface(Ci.nsITimedChannel); let headers = channel.serverTiming.QueryInterface(Ci.nsIArray); ok(headers.length); @@ -86,7 +86,7 @@ add_task(async function test_http_non_localhost() { }); await new Promise(resolve => { chan.asyncOpen( - new ChannelListener((request, buffer) => { + new ChannelListener(request => { let channel = request.QueryInterface(Ci.nsITimedChannel); let headers = channel.serverTiming.QueryInterface(Ci.nsIArray); Assert.equal(headers.length, 0); diff --git a/netwerk/test/unit/test_httpcancel.js b/netwerk/test/unit/test_httpcancel.js index 04958ffd2b..9ed17235cd 100644 --- a/netwerk/test/unit/test_httpcancel.js +++ b/netwerk/test/unit/test_httpcancel.js @@ -27,7 +27,7 @@ var ReferrerInfo = Components.Constructor( var observer = { QueryInterface: ChromeUtils.generateQI(["nsIObserver"]), - observe(subject, topic, data) { + observe(subject) { subject = subject.QueryInterface(Ci.nsIRequest); subject.cancelWithReason(Cr.NS_BINDING_ABORTED, reason); @@ -83,7 +83,7 @@ let cancelDuringOnStartListener = { do_throw("Should not get any data!"); }, - onStopRequest: function test_onStopR(request, status) { + onStopRequest: function test_onStopR() { this.resolved(); }, }; @@ -92,7 +92,7 @@ var cancelDuringOnDataListener = { data: "", channel: null, receivedSomeData: null, - onStartRequest: function test_onStartR(request, ctx) { + onStartRequest: function test_onStartR(request) { Assert.equal(request.status, Cr.NS_OK); }, @@ -106,7 +106,7 @@ var cancelDuringOnDataListener = { } }, - onStopRequest: function test_onStopR(request, ctx, status) { + onStopRequest: function test_onStopR(request) { Assert.ok(this.data.includes("a"), `data: ${this.data}`); Assert.equal(request.status, Cr.NS_BINDING_ABORTED); this.resolved(); @@ -195,7 +195,7 @@ add_task(async function test_cancel_during_onData() { var cancelAfterOnStopListener = { data: "", channel: null, - onStartRequest: function test_onStartR(request, ctx) { + onStartRequest: function test_onStartR(request) { Assert.equal(request.status, Cr.NS_OK); }, @@ -204,7 +204,7 @@ var cancelAfterOnStopListener = { this.data += string; }, - onStopRequest: function test_onStopR(request, status) { + onStopRequest: function test_onStopR(request) { info("onStopRequest"); Assert.equal(request.status, Cr.NS_OK); this.resolved(); @@ -233,7 +233,7 @@ add_task(async function test_cancel_after_onStop() { // PATHS // /failtest -function failtest(metadata, response) { +function failtest() { do_throw("This should not be reached"); } diff --git a/netwerk/test/unit/test_httpssvc_https_upgrade.js b/netwerk/test/unit/test_httpssvc_https_upgrade.js index 837006767c..08f95d987c 100644 --- a/netwerk/test/unit/test_httpssvc_https_upgrade.js +++ b/netwerk/test/unit/test_httpssvc_https_upgrade.js @@ -192,7 +192,7 @@ add_task(async function testInvalidDNSResult1() { let topic = "http-on-modify-request"; let observer = { QueryInterface: ChromeUtils.generateQI(["nsIObserver"]), - observe(aSubject, aTopic, aData) { + observe(aSubject, aTopic) { if (aTopic == topic) { Services.obs.removeObserver(observer, topic); let channel = aSubject.QueryInterface(Ci.nsIChannel); @@ -266,7 +266,7 @@ add_task(async function testHttpRequestBlocked() { this.obs.removeObserver(this, "dns-resolution-request"); } }, - observe(subject, topic, data) { + observe(subject, topic) { if (topic == "dns-resolution-request") { Assert.ok(false, "unreachable"); } @@ -278,7 +278,7 @@ add_task(async function testHttpRequestBlocked() { Services.prefs.setBoolPref("network.dns.disablePrefetch", true); let httpserv = new HttpServer(); - httpserv.registerPathHandler("/", function handler(metadata, response) { + httpserv.registerPathHandler("/", function handler() { Assert.ok(false, "unreachable"); }); httpserv.start(-1); @@ -295,7 +295,7 @@ add_task(async function testHttpRequestBlocked() { let topic = "http-on-modify-request"; let observer = { QueryInterface: ChromeUtils.generateQI(["nsIObserver"]), - observe(aSubject, aTopic, aData) { + observe(aSubject, aTopic) { if (aTopic == topic) { Services.obs.removeObserver(observer, topic); let channel = aSubject.QueryInterface(Ci.nsIChannel); diff --git a/netwerk/test/unit/test_httpsuspend.js b/netwerk/test/unit/test_httpsuspend.js index 581caf906e..ecbb648f4e 100644 --- a/netwerk/test/unit/test_httpsuspend.js +++ b/netwerk/test/unit/test_httpsuspend.js @@ -52,7 +52,7 @@ var listener = { this._gotData = true; }, - onStopRequest(request, status) { + onStopRequest() { Assert.ok(this._gotData); httpserv.stop(do_test_finished); }, diff --git a/netwerk/test/unit/test_idn_spoof.js b/netwerk/test/unit/test_idn_spoof.js index 8512d3272e..5710b3b778 100644 --- a/netwerk/test/unit/test_idn_spoof.js +++ b/netwerk/test/unit/test_idn_spoof.js @@ -243,9 +243,9 @@ let testCases = [ // Han + U+30FB + Han ["xn--vek160nb2ay85atj0b.jp", "\u65e5\u672c\u30fb\u91ce\u7403.jp", kSafe], // Latin + U+30FB + Latin - ["xn--abcdef-k64e.jp", "abc\u30fbdef.jp", kUnsafe, "DISABLED"], + ["xn--abcdef-k64e.jp", "abc\u30fbdef.jp", kUnsafe], // U+30FB + Latin - ["xn--abc-os4b.jp", "\u30fbabc.jp", kUnsafe, "DISABLED"], + ["xn--abc-os4b.jp", "\u30fbabc.jp", kUnsafe], // U+30FD (ヽ) is allowed only after Katakana. // Katakana + U+30FD @@ -416,7 +416,7 @@ let testCases = [ // þħĸŧƅ.com ["xn--vda6f3b2kpf.com", "\u00fe\u0127\u0138\u0167\u0185.com", kUnsafe], // þhktb.com - ["xn--hktb-9ra.com", "\u00fehktb.com", kUnsafe, "DISABLED"], + ["xn--hktb-9ra.com", "\u00fehktb.com", kUnsafe], // pħktb.com ["xn--pktb-5xa.com", "p\u0127ktb.com", kUnsafe, "DISABLED"], // phĸtb.com @@ -708,9 +708,9 @@ let testCases = [ // Block single/double-quote-like characters. // U+02BB (ʻ) - ["xn--ab-8nb.com", "a\u02bbb.com", kUnsafe, "DISABLED"], + ["xn--ab-8nb.com", "a\u02bbb.com", kUnsafe], // U+02BC (ʼ) - ["xn--ab-cob.com", "a\u02bcb.com", kUnsafe, "DISABLED"], + ["xn--ab-cob.com", "a\u02bcb.com", kUnsafe], // U+144A: Not allowed to mix with scripts other than Canadian Syllabics. ["xn--ab-jom.com", "a\u144ab.com", kUnsafe], ["xn--xcec9s.com", "\u1401\u144a\u1402.com", kUnsafe], @@ -876,8 +876,8 @@ let testCases = [ ["xn--ceba.com", "\u05d7\u05d7.com", kUnsafe, "DISABLED"], // U+00FE (þ) and U+00F0 (ð) are only allowed under the .is TLD. - ["xn--acdef-wva.com", "a\u00fecdef.com", kUnsafe, "DISABLED"], - ["xn--mnpqr-jta.com", "mn\u00f0pqr.com", kUnsafe, "DISABLED"], + ["xn--acdef-wva.com", "a\u00fecdef.com", kUnsafe], + ["xn--mnpqr-jta.com", "mn\u00f0pqr.com", kUnsafe], ["xn--acdef-wva.is", "a\u00fecdef.is", kSafe], ["xn--mnpqr-jta.is", "mn\u00f0pqr.is", kSafe], @@ -886,13 +886,13 @@ let testCases = [ ["xn--xample-vyc.az", "\u0259xample.az", kSafe], // U+00B7 is only allowed on Catalan domains between two l's. - ["xn--googlecom-5pa.com", "google\u00b7com.com", kUnsafe, "DISABLED"], - ["xn--ll-0ea.com", "l\u00b7l.com", kUnsafe, "DISABLED"], + ["xn--googlecom-5pa.com", "google\u00b7com.com", kUnsafe], + ["xn--ll-0ea.com", "l\u00b7l.com", kUnsafe], ["xn--ll-0ea.cat", "l\u00b7l.cat", kSafe], - ["xn--al-0ea.cat", "a\u00b7l.cat", kUnsafe, "DISABLED"], - ["xn--la-0ea.cat", "l\u00b7a.cat", kUnsafe, "DISABLED"], - ["xn--l-fda.cat", "\u00b7l.cat", kUnsafe, "DISABLED"], - ["xn--l-gda.cat", "l\u00b7.cat", kUnsafe, "DISABLED"], + ["xn--al-0ea.cat", "a\u00b7l.cat", kUnsafe], + ["xn--la-0ea.cat", "l\u00b7a.cat", kUnsafe], + ["xn--l-fda.cat", "\u00b7l.cat", kUnsafe], + ["xn--l-gda.cat", "l\u00b7.cat", kUnsafe], ["xn--googlecom-gk6n.com", "google\u4e28com.com", kUnsafe, "DISABLED"], ["xn--googlecom-0y6n.com", "google\u4e5bcom.com", kUnsafe, "DISABLED"], @@ -1050,3 +1050,9 @@ add_task(async function test_chrome_spoofs() { } } }); + +add_task(async function test_interpuncts_fqdn() { + let isAscii = {}; + let result = idnService.convertToDisplayIDN("xn--ll-0ea.cat.", isAscii); + Assert.equal(result, "l\u00b7l.cat."); +}); diff --git a/netwerk/test/unit/test_immutable.js b/netwerk/test/unit/test_immutable.js index f2b07c7114..2cd8d8a721 100644 --- a/netwerk/test/unit/test_immutable.js +++ b/netwerk/test/unit/test_immutable.js @@ -75,7 +75,7 @@ Listener.prototype = { read_stream(stream, cnt); }, - onStopRequest: function testOnStopRequest(request, status) { + onStopRequest: function testOnStopRequest(request) { if (expectConditional) { Assert.equal(request.getResponseHeader("x-conditional"), "true"); } else { diff --git a/netwerk/test/unit/test_loadgroup_cancel.js b/netwerk/test/unit/test_loadgroup_cancel.js index 9d5779437f..d63fb4a841 100644 --- a/netwerk/test/unit/test_loadgroup_cancel.js +++ b/netwerk/test/unit/test_loadgroup_cancel.js @@ -43,7 +43,7 @@ add_task(async function test_cancelledInOnStop() { ); let loadListener = { - onStartRequest: aRequest => { + onStartRequest: () => { info("onStartRequest"); }, onStopRequest: (aRequest, aStatusCode) => { diff --git a/netwerk/test/unit/test_mismatch_last-modified.js b/netwerk/test/unit/test_mismatch_last-modified.js index 010d5d1178..1f96c5170a 100644 --- a/netwerk/test/unit/test_mismatch_last-modified.js +++ b/netwerk/test/unit/test_mismatch_last-modified.js @@ -32,7 +32,7 @@ var listener_3 = { "nsIRequestObserver", ]), - onStartRequest: function test_onStartR(request) {}, + onStartRequest: function test_onStartR() {}, onDataAvailable: function test_ODA(request, inputStream, offset, count) { var data = new BinaryInputStream(inputStream).readByteArray(count); @@ -40,7 +40,7 @@ var listener_3 = { Assert.equal(data[0], "B".charCodeAt(0)); }, - onStopRequest: function test_onStopR(request, status) { + onStopRequest: function test_onStopR() { httpserver.stop(do_test_finished); }, }; @@ -55,7 +55,7 @@ ChromeUtils.defineLazyGetter(this, "listener_2", function () { "nsIRequestObserver", ]), - onStartRequest: function test_onStartR(request) {}, + onStartRequest: function test_onStartR() {}, onDataAvailable: function test_ODA(request, inputStream, offset, count) { var data = new BinaryInputStream(inputStream).readByteArray(count); @@ -66,7 +66,7 @@ ChromeUtils.defineLazyGetter(this, "listener_2", function () { Assert.equal(data[0], "A".charCodeAt(0)); }, - onStopRequest: function test_onStopR(request, status) { + onStopRequest: function test_onStopR(request) { request.QueryInterface(Ci.nsIHttpChannel); var chan = NetUtil.newChannel({ uri: "http://localhost:" + httpserver.identity.primaryPort + "/test1", @@ -87,14 +87,14 @@ ChromeUtils.defineLazyGetter(this, "listener_1", function () { "nsIRequestObserver", ]), - onStartRequest: function test_onStartR(request) {}, + onStartRequest: function test_onStartR() {}, onDataAvailable: function test_ODA(request, inputStream, offset, count) { var data = new BinaryInputStream(inputStream).readByteArray(count); Assert.equal(data[0], "A".charCodeAt(0)); }, - onStopRequest: function test_onStopR(request, status) { + onStopRequest: function test_onStopR(request) { request.QueryInterface(Ci.nsIHttpChannel); var chan = NetUtil.newChannel({ uri: "http://localhost:" + httpserver.identity.primaryPort + "/test1", diff --git a/netwerk/test/unit/test_multipart_byteranges.js b/netwerk/test/unit/test_multipart_byteranges.js index 475aced456..014e040395 100644 --- a/netwerk/test/unit/test_multipart_byteranges.js +++ b/netwerk/test/unit/test_multipart_byteranges.js @@ -100,7 +100,7 @@ var multipartListener = { "nsIRequestObserver", ]), - onStartRequest(request) { + onStartRequest() { this._buffer = ""; }, @@ -113,7 +113,7 @@ var multipartListener = { } }, - onStopRequest(request, status) { + onStopRequest(request) { try { responseHandler(request, this._buffer); } catch (ex) { diff --git a/netwerk/test/unit/test_multipart_set_cookie.js b/netwerk/test/unit/test_multipart_set_cookie.js new file mode 100644 index 0000000000..c8943cf3cc --- /dev/null +++ b/netwerk/test/unit/test_multipart_set_cookie.js @@ -0,0 +1,116 @@ +"use strict"; + +const { HttpServer } = ChromeUtils.importESModule( + "resource://testing-common/httpd.sys.mjs" +); + +var httpserver = null; + +ChromeUtils.defineLazyGetter(this, "uri", function () { + return "http://localhost:" + httpserver.identity.primaryPort + "/multipart"; +}); + +function make_channel(url) { + return NetUtil.newChannel({ uri: url, loadUsingSystemPrincipal: true }); +} + +var multipartBody = + "--boundary\r\nSet-Cookie: foo=bar\r\n\r\nSome text\r\n--boundary--"; + +function contentHandler(metadata, response) { + response.setHeader( + "Content-Type", + 'multipart/x-mixed-replace; boundary="boundary"' + ); + response.bodyOutputStream.write(multipartBody, multipartBody.length); +} + +let first = true; + +function responseHandler(request, buffer) { + let channel = request.QueryInterface(Ci.nsIChannel); + Assert.equal(buffer, "Some text"); + Assert.equal(channel.contentType, "text/plain"); + + // two runs: pref on and off + if (first) { + // foo=bar should not be visible here + Assert.equal( + Services.cookies.getCookieStringFromHttp(channel.URI, channel), + "" + ); + first = false; + Services.prefs.setBoolPref( + "network.cookie.prevent_set_cookie_from_multipart", + false + ); + createConverterAndRequest(); + } else { + // validate that the pref is working + Assert.equal( + Services.cookies.getCookieStringFromHttp(channel.URI, channel), + "foo=bar" + ); + httpserver.stop(do_test_finished); + } +} + +var multipartListener = { + _buffer: "", + + QueryInterface: ChromeUtils.generateQI([ + "nsIStreamListener", + "nsIRequestObserver", + ]), + + onStartRequest(request) { + this._buffer = ""; + }, + + onDataAvailable(request, stream, offset, count) { + try { + this._buffer = this._buffer.concat(read_stream(stream, count)); + dump("BUFFEEE: " + this._buffer + "\n\n"); + } catch (ex) { + do_throw("Error in onDataAvailable: " + ex); + } + }, + + onStopRequest(request, status) { + try { + responseHandler(request, this._buffer); + } catch (ex) { + do_throw("Error in closure function: " + ex); + } + }, +}; + +function createConverterAndRequest() { + var streamConv = Cc["@mozilla.org/streamConverters;1"].getService( + Ci.nsIStreamConverterService + ); + var conv = streamConv.asyncConvertData( + "multipart/x-mixed-replace", + "*/*", + multipartListener, + null + ); + + var chan = make_channel(uri); + chan.asyncOpen(conv); +} + +function run_test() { + Services.prefs.setBoolPref( + "network.cookieJarSettings.unblocked_for_testing", + true + ); + + httpserver = new HttpServer(); + httpserver.registerPathHandler("/multipart", contentHandler); + httpserver.start(-1); + + createConverterAndRequest(); + + do_test_pending(); +} diff --git a/netwerk/test/unit/test_multipart_streamconv-byte-by-byte.js b/netwerk/test/unit/test_multipart_streamconv-byte-by-byte.js index c1865f5668..c4e0db0ff5 100644 --- a/netwerk/test/unit/test_multipart_streamconv-byte-by-byte.js +++ b/netwerk/test/unit/test_multipart_streamconv-byte-by-byte.js @@ -66,7 +66,7 @@ var multipartListener = { "nsIRequestObserver", ]), - onStartRequest(request) { + onStartRequest() { this._buffer = ""; }, @@ -79,7 +79,7 @@ var multipartListener = { } }, - onStopRequest(request, status) { + onStopRequest(request) { this._index++; // Second part should be last part Assert.equal( diff --git a/netwerk/test/unit/test_multipart_streamconv.js b/netwerk/test/unit/test_multipart_streamconv.js index c1503e4d8c..159b11f802 100644 --- a/netwerk/test/unit/test_multipart_streamconv.js +++ b/netwerk/test/unit/test_multipart_streamconv.js @@ -51,7 +51,7 @@ var multipartListener = { "nsIRequestObserver", ]), - onStartRequest(request) { + onStartRequest() { this._buffer = ""; }, @@ -64,7 +64,7 @@ var multipartListener = { } }, - onStopRequest(request, status) { + onStopRequest(request) { this._index++; // Second part should be last part Assert.equal( diff --git a/netwerk/test/unit/test_multipart_streamconv_empty.js b/netwerk/test/unit/test_multipart_streamconv_empty.js index 3d3f9dc859..82b7f7000c 100644 --- a/netwerk/test/unit/test_multipart_streamconv_empty.js +++ b/netwerk/test/unit/test_multipart_streamconv_empty.js @@ -34,7 +34,7 @@ add_task(async function test_empty() { "nsIRequestObserver", ]), - onStartRequest(request) {}, + onStartRequest() {}, onDataAvailable(request, stream, offset, count) { try { this._buffer = this._buffer.concat(read_stream(stream, count)); diff --git a/netwerk/test/unit/test_multipart_streamconv_missing_boundary_lead_dashes.js b/netwerk/test/unit/test_multipart_streamconv_missing_boundary_lead_dashes.js index 3ed2bd39c6..6829c14158 100644 --- a/netwerk/test/unit/test_multipart_streamconv_missing_boundary_lead_dashes.js +++ b/netwerk/test/unit/test_multipart_streamconv_missing_boundary_lead_dashes.js @@ -49,7 +49,7 @@ var multipartListener = { "nsIRequestObserver", ]), - onStartRequest(request) { + onStartRequest() { this._buffer = ""; }, @@ -62,7 +62,7 @@ var multipartListener = { } }, - onStopRequest(request, status) { + onStopRequest(request) { try { responseHandler(request, this._buffer); } catch (ex) { diff --git a/netwerk/test/unit/test_multipart_streamconv_missing_lead_boundary.js b/netwerk/test/unit/test_multipart_streamconv_missing_lead_boundary.js index 1df4311b90..c57223a1b0 100644 --- a/netwerk/test/unit/test_multipart_streamconv_missing_lead_boundary.js +++ b/netwerk/test/unit/test_multipart_streamconv_missing_lead_boundary.js @@ -49,7 +49,7 @@ var multipartListener = { "nsIRequestObserver", ]), - onStartRequest(request) { + onStartRequest() { this._buffer = ""; }, @@ -62,7 +62,7 @@ var multipartListener = { } }, - onStopRequest(request, status) { + onStopRequest(request) { try { responseHandler(request, this._buffer); } catch (ex) { diff --git a/netwerk/test/unit/test_net_addr.js b/netwerk/test/unit/test_net_addr.js index 331fa9bc74..49f00ce639 100644 --- a/netwerk/test/unit/test_net_addr.js +++ b/netwerk/test/unit/test_net_addr.js @@ -62,7 +62,7 @@ TestServer.prototype = { this.reset(); }, - onStopListening(socket) {}, + onStopListening() {}, /** * Called to close a connection and clean up properties. diff --git a/netwerk/test/unit/test_network_connectivity_service.js b/netwerk/test/unit/test_network_connectivity_service.js index 6774e79e34..7604c263c6 100644 --- a/netwerk/test/unit/test_network_connectivity_service.js +++ b/netwerk/test/unit/test_network_connectivity_service.js @@ -15,7 +15,7 @@ const { HttpServer } = ChromeUtils.importESModule( * @returns {Promise} A promise that fulfills when the notification is fired. */ function promiseObserverNotification(topicName, matchFunc) { - return new Promise((resolve, reject) => { + return new Promise(resolve => { Services.obs.addObserver(function observe(subject, topic, data) { let matches = typeof matchFunc != "function" || matchFunc(subject, data); if (!matches) { diff --git a/netwerk/test/unit/test_networking_over_socket_process.js b/netwerk/test/unit/test_networking_over_socket_process.js index 79e17140e1..7d879b20c5 100644 --- a/netwerk/test/unit/test_networking_over_socket_process.js +++ b/netwerk/test/unit/test_networking_over_socket_process.js @@ -157,7 +157,7 @@ add_task(async function testTooManyCrashes() { Assert.ok(socketProcessId != 0); let socketProcessCrashed = false; - Services.obs.addObserver(function observe(subject, topic, data) { + Services.obs.addObserver(function observe(subject, topic) { Services.obs.removeObserver(observe, topic); socketProcessCrashed = true; }, "network:socket-process-crashed"); diff --git a/netwerk/test/unit/test_nojsredir.js b/netwerk/test/unit/test_nojsredir.js index 6b6831a222..227cb04608 100644 --- a/netwerk/test/unit/test_nojsredir.js +++ b/netwerk/test/unit/test_nojsredir.js @@ -33,7 +33,7 @@ function startIter() { ); } -function completeIter(request, data, ctx) { +function completeIter(request, data) { Assert.ok(data.length == tests[index].datalen); if (++index < tests.length) { startIter(); diff --git a/netwerk/test/unit/test_ntlm_authentication.js b/netwerk/test/unit/test_ntlm_authentication.js index f17f7ebf7d..1517a65df6 100644 --- a/netwerk/test/unit/test_ntlm_authentication.js +++ b/netwerk/test/unit/test_ntlm_authentication.js @@ -39,7 +39,7 @@ AuthPrompt1.prototype = { QueryInterface: ChromeUtils.generateQI(["nsIAuthPrompt"]), - prompt: function ap1_prompt(title, text, realm, save, defaultText, result) { + prompt: function ap1_prompt() { do_throw("unexpected prompt call"); }, @@ -95,7 +95,7 @@ AuthPrompt1.prototype = { return true; }, - promptPassword: function ap1_promptPW(title, text, realm, save, pwd) { + promptPassword: function ap1_promptPW() { do_throw("unexpected promptPassword call"); }, }; @@ -118,7 +118,7 @@ AuthPrompt2.prototype = { return true; }, - asyncPromptAuth: function ap2_async(chan, cb, ctx, lvl, info) { + asyncPromptAuth: function ap2_async() { throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED); }, }; @@ -176,7 +176,7 @@ RealmTestRequestor.prototype = { return false; }, - asyncPromptAuth: function realmtest_async(chan, cb, ctx, lvl, info) { + asyncPromptAuth: function realmtest_async() { throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED); }, }; diff --git a/netwerk/test/unit/test_ntlm_proxy_and_web_auth.js b/netwerk/test/unit/test_ntlm_proxy_and_web_auth.js index 3435839275..eb3396770e 100644 --- a/netwerk/test/unit/test_ntlm_proxy_and_web_auth.js +++ b/netwerk/test/unit/test_ntlm_proxy_and_web_auth.js @@ -30,7 +30,7 @@ AuthPrompt.prototype = { return true; }, - asyncPromptAuth: function ap_async(chan, cb, ctx, lvl, info) { + asyncPromptAuth: function ap_async() { throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED); }, }; @@ -71,7 +71,7 @@ function makeChan(url, loadingUrl) { function TestListener(resolve) { this.resolve = resolve; } -TestListener.prototype.onStartRequest = function (request, context) { +TestListener.prototype.onStartRequest = function (request) { // Need to do the instanceof to allow request.responseStatus // to be read. if (!(request instanceof Ci.nsIHttpChannel)) { @@ -80,7 +80,7 @@ TestListener.prototype.onStartRequest = function (request, context) { Assert.equal(expectedResponse, request.responseStatus, "HTTP Status code"); }; -TestListener.prototype.onStopRequest = function (request, context, status) { +TestListener.prototype.onStopRequest = function () { Assert.equal(expectedRequests, requestsMade, "Number of requests made "); this.resolve(); diff --git a/netwerk/test/unit/test_ntlm_proxy_auth.js b/netwerk/test/unit/test_ntlm_proxy_auth.js index b6cb27890b..194050c027 100644 --- a/netwerk/test/unit/test_ntlm_proxy_auth.js +++ b/netwerk/test/unit/test_ntlm_proxy_auth.js @@ -29,7 +29,7 @@ AuthPrompt.prototype = { return true; }, - asyncPromptAuth: function ap_async(chan, cb, ctx, lvl, info) { + asyncPromptAuth: function ap_async() { throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED); }, }; @@ -70,7 +70,7 @@ function makeChan(url, loadingUrl) { function TestListener(resolve) { this.resolve = resolve; } -TestListener.prototype.onStartRequest = function (request, context) { +TestListener.prototype.onStartRequest = function (request) { // Need to do the instanceof to allow request.responseStatus // to be read. if (!(request instanceof Ci.nsIHttpChannel)) { @@ -79,7 +79,7 @@ TestListener.prototype.onStartRequest = function (request, context) { Assert.equal(expectedResponse, request.responseStatus, "HTTP Status code"); }; -TestListener.prototype.onStopRequest = function (request, context, status) { +TestListener.prototype.onStopRequest = function () { Assert.equal(expectedRequests, requestsMade, "Number of requests made "); Assert.equal( exptTypeOneCount, diff --git a/netwerk/test/unit/test_ntlm_web_auth.js b/netwerk/test/unit/test_ntlm_web_auth.js index 1325477bc6..9a61e91445 100644 --- a/netwerk/test/unit/test_ntlm_web_auth.js +++ b/netwerk/test/unit/test_ntlm_web_auth.js @@ -29,7 +29,7 @@ AuthPrompt.prototype = { return true; }, - asyncPromptAuth: function ap_async(chan, cb, ctx, lvl, info) { + asyncPromptAuth: function ap_async() { throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED); }, }; @@ -68,7 +68,7 @@ function makeChan(url, loadingUrl) { } function TestListener() {} -TestListener.prototype.onStartRequest = function (request, context) { +TestListener.prototype.onStartRequest = function (request) { // Need to do the instanceof to allow request.responseStatus // to be read. if (!(request instanceof Ci.nsIHttpChannel)) { @@ -77,7 +77,7 @@ TestListener.prototype.onStartRequest = function (request, context) { Assert.equal(expectedResponse, request.responseStatus, "HTTP Status code"); }; -TestListener.prototype.onStopRequest = function (request, context, status) { +TestListener.prototype.onStopRequest = function () { Assert.equal(expectedRequests, requestsMade, "Number of requests made "); if (current_test < tests.length - 1) { diff --git a/netwerk/test/unit/test_oblivious_http.js b/netwerk/test/unit/test_oblivious_http.js index 027426038d..14b3dc7f81 100644 --- a/netwerk/test/unit/test_oblivious_http.js +++ b/netwerk/test/unit/test_oblivious_http.js @@ -167,8 +167,8 @@ async function run_one_testcase(testcase) { false ); } - let response = await new Promise((resolve, reject) => { - NetUtil.asyncFetch(obliviousHttpChannel, function (inputStream, result) { + let response = await new Promise(resolve => { + NetUtil.asyncFetch(obliviousHttpChannel, function (inputStream) { let scriptableInputStream = Cc[ "@mozilla.org/scriptableinputstream;1" ].createInstance(Ci.nsIScriptableInputStream); @@ -200,7 +200,7 @@ async function run_one_testcase(testcase) { ).relayChannel; equal(relayChannel.responseStatus, 404); } - await new Promise((resolve, reject) => { + await new Promise(resolve => { httpServer.stop(resolve); }); } diff --git a/netwerk/test/unit/test_origin.js b/netwerk/test/unit/test_origin.js index 9ef86e8885..d97a6cc0ef 100644 --- a/netwerk/test/unit/test_origin.js +++ b/netwerk/test/unit/test_origin.js @@ -94,7 +94,7 @@ FailListener.prototype = { onDataAvailable: function testOnDataAvailable(request, stream, off, cnt) { read_stream(stream, cnt); }, - onStopRequest: function testOnStopRequest(request, status) { + onStopRequest: function testOnStopRequest(request) { Assert.ok(!Components.isSuccessCode(request.status)); nextTest(); do_test_finished(); @@ -293,7 +293,7 @@ Http2PushApiListener.prototype = { read_stream(stream, cnt); }, - onStopRequest: function test_onStopR(request, status) { + onStopRequest: function test_onStopR(request) { dump("push api onstop " + request.originalURI.spec + "\n"); Assert.ok(this.fooOK); Assert.ok(this.alt1OK); diff --git a/netwerk/test/unit/test_original_sent_received_head.js b/netwerk/test/unit/test_original_sent_received_head.js index 744528b832..fa06234386 100644 --- a/netwerk/test/unit/test_original_sent_received_head.js +++ b/netwerk/test/unit/test_original_sent_received_head.js @@ -122,7 +122,7 @@ function serverHandler(metadata, response) { } } -function checkResponse(request, data, context) { +function checkResponse(request) { if (dbg) { print("============== checkResponse: in"); } @@ -184,7 +184,7 @@ function checkResponse(request, data, context) { var linkHeaderFound2 = false; var locationHeaderFound2 = 0; request.visitResponseHeaders({ - visitHeader: function visit(aName, aValue) { + visitHeader: function visit(aName) { if (aName == "Link") { linkHeaderFound2 = true; } diff --git a/netwerk/test/unit/test_pac_reload_after_network_change.js b/netwerk/test/unit/test_pac_reload_after_network_change.js index 1b236473ab..dcd082d373 100644 --- a/netwerk/test/unit/test_pac_reload_after_network_change.js +++ b/netwerk/test/unit/test_pac_reload_after_network_change.js @@ -36,7 +36,7 @@ registerCleanupFunction(async () => { }); async function getProxyInfo() { - return new Promise((resolve, reject) => { + return new Promise(resolve => { let uri = Services.io.newURI("http://www.mozilla.org/"); gProxyService.asyncResolve(uri, 0, { onProxyAvailable(_req, _uri, pi, _status) { diff --git a/netwerk/test/unit/test_partial_response_entry_size_smart_shrink.js b/netwerk/test/unit/test_partial_response_entry_size_smart_shrink.js index 0dd5482708..c2a16cc8eb 100644 --- a/netwerk/test/unit/test_partial_response_entry_size_smart_shrink.js +++ b/netwerk/test/unit/test_partial_response_entry_size_smart_shrink.js @@ -19,7 +19,7 @@ ChromeUtils.defineLazyGetter(this, "URL", function () { var httpServer = null; -function make_channel(url, callback, ctx) { +function make_channel(url) { return NetUtil.newChannel({ uri: url, loadUsingSystemPrincipal: true }); } @@ -84,7 +84,7 @@ function run_test() { do_test_pending(); } -function firstTimeThrough(request, buffer) { +function firstTimeThrough() { // Change single cache entry limit to 1 kb. This emulates smart size change. Services.prefs.setIntPref("browser.cache.disk.max_entry_size", 1); diff --git a/netwerk/test/unit/test_plaintext_sniff.js b/netwerk/test/unit/test_plaintext_sniff.js index 896e458165..5983e4599a 100644 --- a/netwerk/test/unit/test_plaintext_sniff.js +++ b/netwerk/test/unit/test_plaintext_sniff.js @@ -137,7 +137,7 @@ function makeListener(headerIdx, bodyIdx) { do_throw("Should not get any data!"); }, - onStopRequest: function test_onStopR(request, status) { + onStopRequest: function test_onStopR() { // Advance to next test ++headerIdx; if (headerIdx == contentTypeHeaderList.length) { diff --git a/netwerk/test/unit/test_port_remapping.js b/netwerk/test/unit/test_port_remapping.js index 274a1117ec..7a333a7af7 100644 --- a/netwerk/test/unit/test_port_remapping.js +++ b/netwerk/test/unit/test_port_remapping.js @@ -7,7 +7,7 @@ const { HttpServer } = ChromeUtils.importESModule( "resource://testing-common/httpd.sys.mjs" ); -function make_channel(url, callback, ctx) { +function make_channel(url) { return NetUtil.newChannel({ uri: url, loadUsingSystemPrincipal: true }); } diff --git a/netwerk/test/unit/test_post.js b/netwerk/test/unit/test_post.js index f57a149920..dbbe96825f 100644 --- a/netwerk/test/unit/test_post.js +++ b/netwerk/test/unit/test_post.js @@ -56,7 +56,7 @@ var listenerCallback = { } }, - onStatus(request, status, statusArg) {}, + onStatus() {}, }; function run_test() { @@ -114,7 +114,7 @@ function setupChannel(path) { }).QueryInterface(Ci.nsIHttpChannel); } -function serverHandler(metadata, response) { +function serverHandler(metadata) { Assert.equal(metadata.method, "POST"); var data = read_stream( @@ -135,7 +135,7 @@ function serverHandler(metadata, response) { ); } -function checkRequest(request, data, context) { +function checkRequest() { Assert.ok(correctOnProgress); httpserver.stop(do_test_finished); } diff --git a/netwerk/test/unit/test_predictor.js b/netwerk/test/unit/test_predictor.js index dce86ce5e0..021a0a6cac 100644 --- a/netwerk/test/unit/test_predictor.js +++ b/netwerk/test/unit/test_predictor.js @@ -38,11 +38,11 @@ ValidityChecker.prototype = { QueryInterface: ChromeUtils.generateQI(["nsICacheEntryOpenCallback"]), - onCacheEntryCheck(entry) { + onCacheEntryCheck() { return Ci.nsICacheEntryOpenCallback.ENTRY_WANTED; }, - onCacheEntryAvailable(entry, isnew, status) { + onCacheEntryAvailable(entry) { // Check if forced valid Assert.equal(entry.isForcedValid, this.httpStatus === 200); this.verifier.maybe_run_next_test(); @@ -155,7 +155,7 @@ var prepListener = { this.continueCallback = cb; }, - onCacheEntryCheck(entry) { + onCacheEntryCheck() { return Ci.nsICacheEntryOpenCallback.ENTRY_WANTED; }, @@ -555,7 +555,7 @@ var prefetchListener = { read_stream(stream, cnt); }, - onStopRequest(request, status) { + onStopRequest() { run_next_test(); }, }; @@ -736,17 +736,7 @@ function test_visitor_doom() { let entryCount = 0; let visitor = { onCacheStorageInfo() {}, - async onCacheEntryInfo( - aURI, - aIdEnhance, - aDataSize, - aAltDataSize, - aFetchCount, - aLastModifiedTime, - aExpirationTime, - aPinned, - aInfo - ) { + async onCacheEntryInfo() { entryCount++; }, onCacheEntryVisitCompleted() { @@ -797,7 +787,7 @@ var observer = { QueryInterface: ChromeUtils.generateQI(["nsIObserver"]), - observe(subject, topic, data) { + observe(subject, topic) { if (topic != "predictor-reset-complete") { return; } diff --git a/netwerk/test/unit/test_private_necko_channel.js b/netwerk/test/unit/test_private_necko_channel.js index dc6a73e145..90f4e72629 100644 --- a/netwerk/test/unit/test_private_necko_channel.js +++ b/netwerk/test/unit/test_private_necko_channel.js @@ -45,7 +45,7 @@ function serverHandler(metadata, response) { response.bodyOutputStream.write(httpbody, httpbody.length); } -function checkRequest(request, data, context) { +function checkRequest() { get_device_entry_count("disk", null, function (count) { Assert.equal(count, 0); get_device_entry_count( diff --git a/netwerk/test/unit/test_progress.js b/netwerk/test/unit/test_progress.js index 8363f0e337..552e2549f7 100644 --- a/netwerk/test/unit/test_progress.js +++ b/netwerk/test/unit/test_progress.js @@ -139,7 +139,7 @@ function serverHandler(metadata, response) { } } -function checkRequest(request, data, context) { +function checkRequest() { Assert.equal(last, httpbody.length * LOOPS); Assert.equal(max, httpbody.length * LOOPS); } diff --git a/netwerk/test/unit/test_progress_no_proxy_and_proxy.js b/netwerk/test/unit/test_progress_no_proxy_and_proxy.js index cb132360c8..edaf9b389d 100644 --- a/netwerk/test/unit/test_progress_no_proxy_and_proxy.js +++ b/netwerk/test/unit/test_progress_no_proxy_and_proxy.js @@ -117,7 +117,7 @@ function chanPromise(uri, statusArg, version) { }); } -function checkRequest(request, data, context) { +function checkRequest() { Assert.equal(last, RESPONSE_LENGTH); Assert.equal(max, RESPONSE_LENGTH); } diff --git a/netwerk/test/unit/test_protocolproxyservice-async-filters.js b/netwerk/test/unit/test_protocolproxyservice-async-filters.js index fcf43d63ef..e7898dbb59 100644 --- a/netwerk/test/unit/test_protocolproxyservice-async-filters.js +++ b/netwerk/test/unit/test_protocolproxyservice-async-filters.js @@ -25,10 +25,10 @@ TestProtocolHandler.prototype = { Ci.nsIProtocolHandler.URI_NORELATIVE | Ci.nsIProtocolHandler.ALLOWS_PROXY | Ci.nsIProtocolHandler.URI_DANGEROUS_TO_LOAD, - newChannel(uri, aLoadInfo) { + newChannel() { throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED); }, - allowPort(port, scheme) { + allowPort() { return true; }, }; @@ -128,7 +128,7 @@ resolveCallback.prototype = { QueryInterface: ChromeUtils.generateQI(["nsIProtocolProxyCallback"]), - onProxyAvailable(req, channel, pi, status) { + onProxyAvailable(req, channel, pi) { this.nextFunction(pi); }, }; diff --git a/netwerk/test/unit/test_protocolproxyservice.js b/netwerk/test/unit/test_protocolproxyservice.js index 64472651f6..74493db08c 100644 --- a/netwerk/test/unit/test_protocolproxyservice.js +++ b/netwerk/test/unit/test_protocolproxyservice.js @@ -39,10 +39,10 @@ TestProtocolHandler.prototype = { Ci.nsIProtocolHandler.URI_NORELATIVE | Ci.nsIProtocolHandler.ALLOWS_PROXY | Ci.nsIProtocolHandler.URI_DANGEROUS_TO_LOAD, - newChannel(uri, aLoadInfo) { + newChannel() { throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED); }, - allowPort(port, scheme) { + allowPort() { return true; }, }; @@ -160,7 +160,7 @@ resolveCallback.prototype = { QueryInterface: ChromeUtils.generateQI(["nsIProtocolProxyCallback"]), - onProxyAvailable(req, channel, pi, status) { + onProxyAvailable(req, channel, pi) { this.nextFunction(pi); }, }; @@ -943,10 +943,10 @@ function failed_script_callback(pi) { var directFilterListener = { onModifyRequestCalled: false, - onStartRequest: function test_onStart(request) {}, + onStartRequest: function test_onStart() {}, onDataAvailable: function test_OnData() {}, - onStopRequest: function test_onStop(request, status) { + onStopRequest: function test_onStop(request) { // check on the PI from the channel itself request.QueryInterface(Ci.nsIProxiedChannel); check_proxy(request.proxyInfo, "http", "127.0.0.1", 7246, 0, 0, false); @@ -961,7 +961,7 @@ var directFilterListener = { run_isresolvable_test(); }, - observe(subject, topic, data) { + observe(subject, topic) { if ( topic === "http-on-modify-request" && subject instanceof Ci.nsIHttpChannel && diff --git a/netwerk/test/unit/test_proxy-failover_canceled.js b/netwerk/test/unit/test_proxy-failover_canceled.js index e594c497cc..a40a0c3316 100644 --- a/netwerk/test/unit/test_proxy-failover_canceled.js +++ b/netwerk/test/unit/test_proxy-failover_canceled.js @@ -6,7 +6,7 @@ const { HttpServer } = ChromeUtils.importESModule( var httpServer = null; -function make_channel(url, callback, ctx) { +function make_channel(url) { return NetUtil.newChannel({ uri: url, loadUsingSystemPrincipal: true, diff --git a/netwerk/test/unit/test_proxy-failover_passing.js b/netwerk/test/unit/test_proxy-failover_passing.js index a6fab56690..dc0cba58b1 100644 --- a/netwerk/test/unit/test_proxy-failover_passing.js +++ b/netwerk/test/unit/test_proxy-failover_passing.js @@ -6,7 +6,7 @@ const { HttpServer } = ChromeUtils.importESModule( var httpServer = null; -function make_channel(url, callback, ctx) { +function make_channel(url) { return NetUtil.newChannel({ uri: url, loadUsingSystemPrincipal: true }); } diff --git a/netwerk/test/unit/test_proxy-replace_canceled.js b/netwerk/test/unit/test_proxy-replace_canceled.js index b39d5e97f6..c2efa50c5b 100644 --- a/netwerk/test/unit/test_proxy-replace_canceled.js +++ b/netwerk/test/unit/test_proxy-replace_canceled.js @@ -6,7 +6,7 @@ const { HttpServer } = ChromeUtils.importESModule( var httpServer = null; -function make_channel(url, callback, ctx) { +function make_channel(url) { return NetUtil.newChannel({ uri: url, loadUsingSystemPrincipal: true, diff --git a/netwerk/test/unit/test_proxy-replace_passing.js b/netwerk/test/unit/test_proxy-replace_passing.js index 9c843c001e..b04a52c51d 100644 --- a/netwerk/test/unit/test_proxy-replace_passing.js +++ b/netwerk/test/unit/test_proxy-replace_passing.js @@ -6,7 +6,7 @@ const { HttpServer } = ChromeUtils.importESModule( var httpServer = null; -function make_channel(url, callback, ctx) { +function make_channel(url) { return NetUtil.newChannel({ uri: url, loadUsingSystemPrincipal: true }); } diff --git a/netwerk/test/unit/test_proxy-slow-upload.js b/netwerk/test/unit/test_proxy-slow-upload.js index 1a406890e1..bef006e1e0 100644 --- a/netwerk/test/unit/test_proxy-slow-upload.js +++ b/netwerk/test/unit/test_proxy-slow-upload.js @@ -91,7 +91,7 @@ add_task(async function test_slow_upload() { }); equal(req.status, Cr.NS_OK); equal(req.QueryInterface(Ci.nsIHttpChannel).responseStatus, 200); - ok(buff == CONTENT, "Content must match"); + Assert.equal(buff, CONTENT, "Content must match"); ok(!!req.QueryInterface(Ci.nsIProxiedChannel).proxyInfo); greater( await server.execute(`global.data_count`), diff --git a/netwerk/test/unit/test_proxy_cancel.js b/netwerk/test/unit/test_proxy_cancel.js index d891f3147c..6374a162c9 100644 --- a/netwerk/test/unit/test_proxy_cancel.js +++ b/netwerk/test/unit/test_proxy_cancel.js @@ -19,6 +19,14 @@ function makeChan(uri) { return chan; } +add_setup(async function setup() { + // See Bug 1878505 + Services.prefs.setIntPref("network.http.speculative-parallel-limit", 0); + registerCleanupFunction(async () => { + Services.prefs.clearUserPref("network.http.speculative-parallel-limit"); + }); +}); + add_task(async function test_cancel_after_asyncOpen() { let certdb = Cc["@mozilla.org/security/x509certdb;1"].getService( Ci.nsIX509CertDB @@ -123,8 +131,8 @@ add_task(async function test_cancel_after_connect_http2proxy() { return this.QueryInterface(iid); }, - onProgress(request, progress, progressMax) {}, - onStatus(request, status, statusArg) { + onProgress() {}, + onStatus(request, status) { info(`status = ${status}`); // XXX(valentin): Is this the best status to be cancelling? if (status == NS_NET_STATUS_WAITING_FOR) { @@ -347,7 +355,7 @@ add_task(async function test_cancel_during_response() { // Check that we never get more than 1000 bytes. Assert.equal(progress, 1000); }, - onStatus(request, status, statusArg) { + onStatus(request, status) { if (status == NS_NET_STATUS_RECEIVING_FROM) { info("cancelling when receiving request"); chan.cancel(Cr.NS_ERROR_ABORT); diff --git a/netwerk/test/unit/test_proxyconnect.js b/netwerk/test/unit/test_proxyconnect.js index 7015b3bffb..7de1fb39d4 100644 --- a/netwerk/test/unit/test_proxyconnect.js +++ b/netwerk/test/unit/test_proxyconnect.js @@ -72,7 +72,7 @@ var proxiedChannel; var listener = { expectedCode: -1, // uninitialized - onStartRequest: function test_onStartR(request) {}, + onStartRequest: function test_onStartR() {}, onDataAvailable: function test_ODA() { do_throw("Should not get any data!"); diff --git a/netwerk/test/unit/test_range_requests.js b/netwerk/test/unit/test_range_requests.js index cb7a1e7a72..dd2483407c 100644 --- a/netwerk/test/unit/test_range_requests.js +++ b/netwerk/test/unit/test_range_requests.js @@ -38,7 +38,7 @@ const encodedBody = [ const partial_data_length = 4; var port = null; // set in run_test -function make_channel(url, callback, ctx) { +function make_channel(url) { return NetUtil.newChannel({ uri: url, loadUsingSystemPrincipal: true, @@ -54,7 +54,7 @@ Canceler.prototype = { "nsIStreamListener", "nsIRequestObserver", ]), - onStartRequest(request) {}, + onStartRequest() {}, onDataAvailable(request, stream, offset, count) { // Read stream so we don't assert for not reading from the stream @@ -78,14 +78,14 @@ MyListener.prototype = { "nsIStreamListener", "nsIRequestObserver", ]), - onStartRequest(request) { + onStartRequest() { this._buffer = ""; }, onDataAvailable(request, stream, offset, count) { this._buffer = this._buffer.concat(read_stream(stream, count)); }, - onStopRequest(request, status) { + onStopRequest(request) { this.continueFn(request, this._buffer); }, }; @@ -99,7 +99,7 @@ FailedChannelListener.prototype = { "nsIStreamListener", "nsIRequestObserver", ]), - onStartRequest(request) {}, + onStartRequest() {}, onDataAvailable(request, stream, offset, count) { read_stream(stream, count); @@ -192,7 +192,7 @@ function handler_4(metadata, response) { } case_4_request_no++; } -function received_partial_4(request, data) { +function received_partial_4() { // checking length does not work with encoded data // do_check_eq(partial_data_length, data.length); var chan = make_channel("http://localhost:" + port + "/test_4"); diff --git a/netwerk/test/unit/test_rcwn_interrupted.js b/netwerk/test/unit/test_rcwn_interrupted.js index 5f3d059999..3c640df5f7 100644 --- a/netwerk/test/unit/test_rcwn_interrupted.js +++ b/netwerk/test/unit/test_rcwn_interrupted.js @@ -29,7 +29,7 @@ ChromeUtils.defineLazyGetter(this, "URL", function () { var httpServer = null; -function make_channel(url, callback, ctx) { +function make_channel(url) { return NetUtil.newChannel({ uri: url, loadUsingSystemPrincipal: true }); } diff --git a/netwerk/test/unit/test_redirect-caching_canceled.js b/netwerk/test/unit/test_redirect-caching_canceled.js index 0ecf2f74b7..847e054d07 100644 --- a/netwerk/test/unit/test_redirect-caching_canceled.js +++ b/netwerk/test/unit/test_redirect-caching_canceled.js @@ -16,7 +16,7 @@ ChromeUtils.defineLazyGetter(this, "randomURI", function () { return URL + randomPath; }); -function make_channel(url, callback, ctx) { +function make_channel(url) { return NetUtil.newChannel({ uri: url, loadUsingSystemPrincipal: true }); } diff --git a/netwerk/test/unit/test_redirect-caching_failure.js b/netwerk/test/unit/test_redirect-caching_failure.js index 2f8105dd94..343d3bfe13 100644 --- a/netwerk/test/unit/test_redirect-caching_failure.js +++ b/netwerk/test/unit/test_redirect-caching_failure.js @@ -28,7 +28,7 @@ ChromeUtils.defineLazyGetter(this, "randomURI", function () { return URL + randomPath; }); -function make_channel(url, callback, ctx) { +function make_channel(url) { return NetUtil.newChannel({ uri: url, loadUsingSystemPrincipal: true }); } diff --git a/netwerk/test/unit/test_redirect-caching_passing.js b/netwerk/test/unit/test_redirect-caching_passing.js index 0e6616f493..17fbb62744 100644 --- a/netwerk/test/unit/test_redirect-caching_passing.js +++ b/netwerk/test/unit/test_redirect-caching_passing.js @@ -16,7 +16,7 @@ ChromeUtils.defineLazyGetter(this, "randomURI", function () { return URL + randomPath; }); -function make_channel(url, callback, ctx) { +function make_channel(url) { return NetUtil.newChannel({ uri: url, loadUsingSystemPrincipal: true }); } diff --git a/netwerk/test/unit/test_redirect_baduri.js b/netwerk/test/unit/test_redirect_baduri.js index f83c9a264f..3806d02e9a 100644 --- a/netwerk/test/unit/test_redirect_baduri.js +++ b/netwerk/test/unit/test_redirect_baduri.js @@ -17,7 +17,7 @@ ChromeUtils.defineLazyGetter(this, "BadRedirectURI", function () { ); }); -function make_channel(url, callback, ctx) { +function make_channel(url) { return NetUtil.newChannel({ uri: url, loadUsingSystemPrincipal: true }); } @@ -27,7 +27,7 @@ function BadRedirectHandler(metadata, response) { response.setHeader("Location", "http://localhost:4444>BadRedirect", false); } -function checkFailed(request, buffer) { +function checkFailed(request) { Assert.equal(request.status, Cr.NS_ERROR_CORRUPTED_CONTENT); httpServer.stop(do_test_finished); diff --git a/netwerk/test/unit/test_redirect_canceled.js b/netwerk/test/unit/test_redirect_canceled.js index 9eb9d8b33a..8ada84efe4 100644 --- a/netwerk/test/unit/test_redirect_canceled.js +++ b/netwerk/test/unit/test_redirect_canceled.js @@ -16,7 +16,7 @@ ChromeUtils.defineLazyGetter(this, "randomURI", function () { return URL + randomPath; }); -function make_channel(url, callback, ctx) { +function make_channel(url) { return NetUtil.newChannel({ uri: url, loadUsingSystemPrincipal: true }); } diff --git a/netwerk/test/unit/test_redirect_different-protocol.js b/netwerk/test/unit/test_redirect_different-protocol.js index 78b305c84e..16c89eede7 100644 --- a/netwerk/test/unit/test_redirect_different-protocol.js +++ b/netwerk/test/unit/test_redirect_different-protocol.js @@ -16,7 +16,7 @@ ChromeUtils.defineLazyGetter(this, "randomURI", function () { return URL + randomPath; }); -function make_channel(url, callback, ctx) { +function make_channel(url) { return NetUtil.newChannel({ uri: url, loadUsingSystemPrincipal: true }); } diff --git a/netwerk/test/unit/test_redirect_failure.js b/netwerk/test/unit/test_redirect_failure.js index 28b4668580..b361c66d00 100644 --- a/netwerk/test/unit/test_redirect_failure.js +++ b/netwerk/test/unit/test_redirect_failure.js @@ -27,7 +27,7 @@ ChromeUtils.defineLazyGetter(this, "randomURI", function () { return URL + randomPath; }); -function make_channel(url, callback, ctx) { +function make_channel(url) { return NetUtil.newChannel({ uri: url, loadUsingSystemPrincipal: true }); } diff --git a/netwerk/test/unit/test_redirect_from_script.js b/netwerk/test/unit/test_redirect_from_script.js index 0c42d66b64..6ca2e4ff65 100644 --- a/netwerk/test/unit/test_redirect_from_script.js +++ b/netwerk/test/unit/test_redirect_from_script.js @@ -86,7 +86,7 @@ var testHeaderName = "X-Redirected-By-Script"; var testHeaderVal = "Success"; var testHeaderVal2 = "Success on server 2"; -function make_channel(url, callback, ctx) { +function make_channel(url) { return NetUtil.newChannel({ uri: url, loadUsingSystemPrincipal: true }); } @@ -130,7 +130,7 @@ Redirector.prototype = { "nsISupportsWeakReference", ]), - observe(subject, topic, data) { + observe(subject, topic) { if (topic == redirectHook) { if (!(subject instanceof Ci.nsIHttpChannel)) { do_throw(redirectHook + " observed a non-HTTP channel"); diff --git a/netwerk/test/unit/test_redirect_from_script_after-open_passing.js b/netwerk/test/unit/test_redirect_from_script_after-open_passing.js index 315f888f64..49fe4e9ec7 100644 --- a/netwerk/test/unit/test_redirect_from_script_after-open_passing.js +++ b/netwerk/test/unit/test_redirect_from_script_after-open_passing.js @@ -86,7 +86,7 @@ var testHeaderName = "X-Redirected-By-Script"; var testHeaderVal = "Success"; var testHeaderVal2 = "Success on server 2"; -function make_channel(url, callback, ctx) { +function make_channel(url) { return NetUtil.newChannel({ uri: url, loadUsingSystemPrincipal: true }); } @@ -130,7 +130,7 @@ Redirector.prototype = { "nsISupportsWeakReference", ]), - observe(subject, topic, data) { + observe(subject, topic) { if (topic == redirectHook) { if (!(subject instanceof Ci.nsIHttpChannel)) { do_throw(redirectHook + " observed a non-HTTP channel"); diff --git a/netwerk/test/unit/test_redirect_history.js b/netwerk/test/unit/test_redirect_history.js index 124f976881..bb1a00260f 100644 --- a/netwerk/test/unit/test_redirect_history.js +++ b/netwerk/test/unit/test_redirect_history.js @@ -17,7 +17,7 @@ var httpServer = null; var redirects = []; const numRedirects = 10; -function make_channel(url, callback, ctx) { +function make_channel(url) { return NetUtil.newChannel({ uri: url, loadUsingSystemPrincipal: true }); } diff --git a/netwerk/test/unit/test_redirect_loop.js b/netwerk/test/unit/test_redirect_loop.js index f25bee18c5..f599f2014e 100644 --- a/netwerk/test/unit/test_redirect_loop.js +++ b/netwerk/test/unit/test_redirect_loop.js @@ -25,7 +25,7 @@ var relativeLoopURI = "http://localhost:" + PORT + relativeLoopPath; var emptyLoopPath = "/empty/"; var emptyLoopURI = "http://localhost:" + PORT + emptyLoopPath; -function make_channel(url, callback, ctx) { +function make_channel(url) { return NetUtil.newChannel({ uri: url, loadUsingSystemPrincipal: true }); } @@ -55,7 +55,7 @@ function emptyLoopHandler(metadata, response) { response.finish(); } -function testFullLoop(request, buffer) { +function testFullLoop(request) { Assert.equal(request.status, Cr.NS_ERROR_REDIRECT_LOOP); var chan = make_channel(relativeLoopURI); @@ -64,14 +64,14 @@ function testFullLoop(request, buffer) { ); } -function testRelativeLoop(request, buffer) { +function testRelativeLoop(request) { Assert.equal(request.status, Cr.NS_ERROR_REDIRECT_LOOP); var chan = make_channel(emptyLoopURI); chan.asyncOpen(new ChannelListener(testEmptyLoop, null, CL_EXPECT_FAILURE)); } -function testEmptyLoop(request, buffer) { +function testEmptyLoop(request) { Assert.equal(request.status, Cr.NS_ERROR_REDIRECT_LOOP); httpServer.stop(do_test_finished); diff --git a/netwerk/test/unit/test_redirect_passing.js b/netwerk/test/unit/test_redirect_passing.js index b712e4d819..bbd3aa54e7 100644 --- a/netwerk/test/unit/test_redirect_passing.js +++ b/netwerk/test/unit/test_redirect_passing.js @@ -16,7 +16,7 @@ ChromeUtils.defineLazyGetter(this, "randomURI", function () { return URL + randomPath; }); -function make_channel(url, callback, ctx) { +function make_channel(url) { return NetUtil.newChannel({ uri: url, loadUsingSystemPrincipal: true }); } diff --git a/netwerk/test/unit/test_redirect_protocol_telemetry.js b/netwerk/test/unit/test_redirect_protocol_telemetry.js index 526ba440ec..022e166fc1 100644 --- a/netwerk/test/unit/test_redirect_protocol_telemetry.js +++ b/netwerk/test/unit/test_redirect_protocol_telemetry.js @@ -4,7 +4,7 @@ const { HttpServer } = ChromeUtils.importESModule( "resource://testing-common/httpd.sys.mjs" ); -function make_channel(url, callback, ctx) { +function make_channel(url) { return NetUtil.newChannel({ uri: url, loadUsingSystemPrincipal: true }); } @@ -51,7 +51,7 @@ add_task(async function check_protocols() { let p = new Promise(resolve1 => channel.asyncOpen(new ChannelListener(resolve1)) ); - p.then((request, buffer) => { + p.then(() => { TelemetryTestUtils.assertKeyedHistogramSum(redirect_hist, protocol, 1); resolve(); }); diff --git a/netwerk/test/unit/test_redirect_veto.js b/netwerk/test/unit/test_redirect_veto.js index bcc9ddb625..d73635ca90 100644 --- a/netwerk/test/unit/test_redirect_veto.js +++ b/netwerk/test/unit/test_redirect_veto.js @@ -16,7 +16,7 @@ ChromeUtils.defineLazyGetter(this, "randomURI", function () { return URL + randomPath; }); -function make_channel(url, callback, ctx) { +function make_channel(url) { return NetUtil.newChannel({ uri: url, loadUsingSystemPrincipal: true }); } diff --git a/netwerk/test/unit/test_reentrancy.js b/netwerk/test/unit/test_reentrancy.js index 3bd7f54f79..0259ced338 100644 --- a/netwerk/test/unit/test_reentrancy.js +++ b/netwerk/test/unit/test_reentrancy.js @@ -64,7 +64,7 @@ var listener = { this._done_onData = true; }, - onStopRequest(request, status) { + onStopRequest() { Assert.ok(this._done_onData); this._reset(); if (this._test <= MAX_TESTS) { diff --git a/netwerk/test/unit/test_reopen.js b/netwerk/test/unit/test_reopen.js index 6bae0e71cf..271a7f3e9a 100644 --- a/netwerk/test/unit/test_reopen.js +++ b/netwerk/test/unit/test_reopen.js @@ -67,7 +67,7 @@ function check_async_open_throws(error) { } var listener = { - onStartRequest: function test_onStartR(request) { + onStartRequest: function test_onStartR() { check_async_open_throws(NS_ERROR_IN_PROGRESS); }, @@ -76,7 +76,7 @@ var listener = { check_async_open_throws(NS_ERROR_IN_PROGRESS); }, - onStopRequest: function test_onStopR(request, status) { + onStopRequest: function test_onStopR() { // Once onStopRequest is reached, the channel is marked as having been // opened check_async_open_throws(NS_ERROR_ALREADY_OPENED); diff --git a/netwerk/test/unit/test_reply_without_content_type.js b/netwerk/test/unit/test_reply_without_content_type.js index f32ad81d84..439ffb64ac 100644 --- a/netwerk/test/unit/test_reply_without_content_type.js +++ b/netwerk/test/unit/test_reply_without_content_type.js @@ -137,7 +137,7 @@ function serverHandler_GZip(metadata, response) { } } -function checkRequest(request, data, context) { +function checkRequest(request, data) { if (dbg) { print("============== checkRequest: in"); } diff --git a/netwerk/test/unit/test_resumable_channel.js b/netwerk/test/unit/test_resumable_channel.js index 0407aa4983..8c7aca9e0a 100644 --- a/netwerk/test/unit/test_resumable_channel.js +++ b/netwerk/test/unit/test_resumable_channel.js @@ -16,7 +16,7 @@ const NS_ERROR_NOT_RESUMABLE = 0x804b0019; const rangeBody = "Body of the range request handler.\r\n"; -function make_channel(url, callback, ctx) { +function make_channel(url) { return NetUtil.newChannel({ uri: url, loadUsingSystemPrincipal: true }); } @@ -34,7 +34,7 @@ AuthPrompt2.prototype = { return true; }, - asyncPromptAuth: function ap2_async(chan, cb, ctx, lvl, info) { + asyncPromptAuth: function ap2_async() { throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED); }, }; @@ -69,7 +69,7 @@ function run_test() { var entityID; - function get_entity_id(request, data, ctx) { + function get_entity_id(request) { dump("*** get_entity_id()\n"); Assert.ok( request instanceof Ci.nsIResumableChannel, @@ -84,7 +84,7 @@ function run_test() { chan.asyncOpen(new ChannelListener(try_resume, null, CL_EXPECT_FAILURE)); } - function try_resume(request, data, ctx) { + function try_resume(request) { dump("*** try_resume()\n"); Assert.equal(request.status, NS_ERROR_NOT_RESUMABLE); @@ -94,7 +94,7 @@ function run_test() { chan.asyncOpen(new ChannelListener(try_resume_zero, null)); } - function try_resume_zero(request, data, ctx) { + function try_resume_zero(request, data) { dump("*** try_resume_zero()\n"); Assert.ok(request.nsIHttpChannel.requestSucceeded); Assert.equal(data, rangeBody.substring(1)); @@ -106,7 +106,7 @@ function run_test() { chan.asyncOpen(new ChannelListener(try_no_range, null, CL_EXPECT_FAILURE)); } - function try_no_range(request, data, ctx) { + function try_no_range(request) { dump("*** try_no_range()\n"); Assert.ok(request.nsIHttpChannel.requestSucceeded); Assert.equal(request.status, NS_ERROR_NOT_RESUMABLE); @@ -118,7 +118,7 @@ function run_test() { chan.asyncOpen(new ChannelListener(try_bytes_range, null)); } - function try_bytes_range(request, data, ctx) { + function try_bytes_range(request, data) { dump("*** try_bytes_range()\n"); Assert.ok(request.nsIHttpChannel.requestSucceeded); Assert.equal(data, rangeBody); @@ -132,7 +132,7 @@ function run_test() { ); } - function try_foo_bar_range(request, data, ctx) { + function try_foo_bar_range(request) { dump("*** try_foo_bar_range()\n"); Assert.ok(request.nsIHttpChannel.requestSucceeded); Assert.equal(request.status, NS_ERROR_NOT_RESUMABLE); @@ -146,7 +146,7 @@ function run_test() { ); } - function try_foobar_range(request, data, ctx) { + function try_foobar_range(request) { dump("*** try_foobar_range()\n"); Assert.ok(request.nsIHttpChannel.requestSucceeded); Assert.equal(request.status, NS_ERROR_NOT_RESUMABLE); @@ -162,7 +162,7 @@ function run_test() { chan.asyncOpen(new ChannelListener(try_bytes_foobar_range, null)); } - function try_bytes_foobar_range(request, data, ctx) { + function try_bytes_foobar_range(request, data) { dump("*** try_bytes_foobar_range()\n"); Assert.ok(request.nsIHttpChannel.requestSucceeded); Assert.equal(data, rangeBody); @@ -180,7 +180,7 @@ function run_test() { ); } - function try_bytesfoo_bar_range(request, data, ctx) { + function try_bytesfoo_bar_range(request) { dump("*** try_bytesfoo_bar_range()\n"); Assert.ok(request.nsIHttpChannel.requestSucceeded); Assert.equal(request.status, NS_ERROR_NOT_RESUMABLE); @@ -191,7 +191,7 @@ function run_test() { chan.asyncOpen(new ChannelListener(try_no_accept_ranges, null)); } - function try_no_accept_ranges(request, data, ctx) { + function try_no_accept_ranges(request, data) { dump("*** try_no_accept_ranges()\n"); Assert.ok(request.nsIHttpChannel.requestSucceeded); Assert.equal(data, rangeBody); @@ -208,7 +208,7 @@ function run_test() { ); } - function try_suspend_resume(request, data, ctx) { + function try_suspend_resume(request, data) { dump("*** try_suspend_resume()\n"); Assert.ok(request.nsIHttpChannel.requestSucceeded); Assert.equal(data, rangeBody); @@ -219,7 +219,7 @@ function run_test() { chan.asyncOpen(new ChannelListener(success, null)); } - function success(request, data, ctx) { + function success(request, data) { dump("*** success()\n"); Assert.ok(request.nsIHttpChannel.requestSucceeded); Assert.equal(data, rangeBody); @@ -234,7 +234,7 @@ function run_test() { ); } - function test_auth_nopw(request, data, ctx) { + function test_auth_nopw(request) { dump("*** test_auth_nopw()\n"); Assert.ok(!request.nsIHttpChannel.requestSucceeded); Assert.equal(request.status, NS_ERROR_ENTITY_CHANGED); @@ -249,7 +249,7 @@ function run_test() { chan.notificationCallbacks = new Requestor(); chan.asyncOpen(new ChannelListener(test_auth, null, CL_EXPECT_FAILURE)); } - function test_auth(request, data, ctx) { + function test_auth(request) { dump("*** test_auth()\n"); Assert.equal(request.status, NS_ERROR_NOT_RESUMABLE); Assert.ok(request.nsIHttpChannel.responseStatus < 300); @@ -266,7 +266,7 @@ function run_test() { chan.asyncOpen(new ChannelListener(test_auth_resume, null)); } - function test_auth_resume(request, data, ctx) { + function test_auth_resume(request, data) { dump("*** test_auth_resume()\n"); Assert.equal(data, rangeBody.substring(1)); Assert.ok(request.nsIHttpChannel.requestSucceeded); @@ -278,7 +278,7 @@ function run_test() { chan.asyncOpen(new ChannelListener(test_404, null, CL_EXPECT_FAILURE)); } - function test_404(request, data, ctx) { + function test_404(request) { dump("*** test_404()\n"); Assert.equal(request.status, NS_ERROR_ENTITY_CHANGED); Assert.equal(request.nsIHttpChannel.responseStatus, 404); @@ -289,7 +289,7 @@ function run_test() { chan.asyncOpen(new ChannelListener(test_416, null, CL_EXPECT_FAILURE)); } - function test_416(request, data, ctx) { + function test_416(request) { dump("*** test_416()\n"); Assert.equal(request.status, NS_ERROR_ENTITY_CHANGED); Assert.equal(request.nsIHttpChannel.responseStatus, 416); @@ -301,7 +301,7 @@ function run_test() { chan.asyncOpen(new ChannelListener(test_redir_resume, null)); } - function test_redir_resume(request, data, ctx) { + function test_redir_resume(request, data) { dump("*** test_redir_resume()\n"); Assert.ok(request.nsIHttpChannel.requestSucceeded); Assert.equal(data, rangeBody.substring(1)); @@ -316,7 +316,7 @@ function run_test() { ); } - function test_redir_noresume(request, data, ctx) { + function test_redir_noresume(request) { dump("*** test_redir_noresume()\n"); Assert.equal(request.status, NS_ERROR_NOT_RESUMABLE); diff --git a/netwerk/test/unit/test_resumable_truncate.js b/netwerk/test/unit/test_resumable_truncate.js index cdcab591c2..c0da631e08 100644 --- a/netwerk/test/unit/test_resumable_truncate.js +++ b/netwerk/test/unit/test_resumable_truncate.js @@ -6,7 +6,7 @@ const { HttpServer } = ChromeUtils.importESModule( var httpserver = null; -function make_channel(url, callback, ctx) { +function make_channel(url) { return NetUtil.newChannel({ uri: url, loadUsingSystemPrincipal: true }); } @@ -52,9 +52,9 @@ Canceler.prototype = { "nsIRequestObserver", ]), - onStartRequest(request) {}, + onStartRequest() {}, - onDataAvailable(request, stream, offset, count) { + onDataAvailable(request) { request.QueryInterface(Ci.nsIChannel).cancel(Cr.NS_BINDING_ABORTED); }, diff --git a/netwerk/test/unit/test_retry_0rtt.js b/netwerk/test/unit/test_retry_0rtt.js index e1770ab8a1..661d7d2ab4 100644 --- a/netwerk/test/unit/test_retry_0rtt.js +++ b/netwerk/test/unit/test_retry_0rtt.js @@ -11,7 +11,7 @@ var httpServer = null; let handlerCallbacks = {}; -function listenHandler(metadata, response) { +function listenHandler(metadata) { info(metadata.path); handlerCallbacks[metadata.path] = (handlerCallbacks[metadata.path] || 0) + 1; } @@ -48,6 +48,12 @@ add_setup( ); let nssComponent = Cc["@mozilla.org/psm;1"].getService(Ci.nsINSSComponent); await nssComponent.asyncClearSSLExternalAndInternalSessionCache(); + + // See Bug 1878505 + Services.prefs.setIntPref("network.http.speculative-parallel-limit", 0); + registerCleanupFunction(async () => { + Services.prefs.clearUserPref("network.http.speculative-parallel-limit"); + }); } ); @@ -83,7 +89,7 @@ add_task( var retryDomains = [ "0rtt-alert-bad-mac.example.com", "0rtt-alert-protocol-version.example.com", - //"0rtt-alert-unexpected.example.com", // TODO(bug 1753204): uncomment this + "0rtt-alert-unexpected.example.com", ]; Services.prefs.setCharPref("network.dns.localDomains", retryDomains); diff --git a/netwerk/test/unit/test_simple.js b/netwerk/test/unit/test_simple.js index 52c068f517..98f1d3ee3e 100644 --- a/netwerk/test/unit/test_simple.js +++ b/netwerk/test/unit/test_simple.js @@ -58,7 +58,7 @@ function serverHandler(metadata, response) { } } -function checkRequest(request, data, context) { +function checkRequest(request, data) { if (dbg) { print("============== checkRequest: in"); } diff --git a/netwerk/test/unit/test_socks.js b/netwerk/test/unit/test_socks.js index 6ce9f4895e..7588857f78 100644 --- a/netwerk/test/unit/test_socks.js +++ b/netwerk/test/unit/test_socks.js @@ -461,7 +461,7 @@ SocksTestServer.prototype = { this.client_connections.push(client); }, - onStopListening(socket) {}, + onStopListening() {}, close() { if (this.client_subprocess) { diff --git a/netwerk/test/unit/test_speculative_connect.js b/netwerk/test/unit/test_speculative_connect.js index f99ace0d71..776273b8f2 100644 --- a/netwerk/test/unit/test_speculative_connect.js +++ b/netwerk/test/unit/test_speculative_connect.js @@ -81,7 +81,7 @@ function TestServer() { TestServer.prototype = { QueryInterface: ChromeUtils.generateQI(["nsIServerSocket"]), - onSocketAccepted(socket, trans) { + onSocketAccepted() { try { this.listener.close(); } catch (e) {} @@ -89,7 +89,7 @@ TestServer.prototype = { next_test(); }, - onStopListening(socket) {}, + onStopListening() {}, }; /** TestFailedStreamCallback diff --git a/netwerk/test/unit/test_stale-while-revalidate_loop.js b/netwerk/test/unit/test_stale-while-revalidate_loop.js index dc28815119..5b6d47fd5b 100644 --- a/netwerk/test/unit/test_stale-while-revalidate_loop.js +++ b/netwerk/test/unit/test_stale-while-revalidate_loop.js @@ -16,10 +16,10 @@ function make_channel(url) { }).QueryInterface(Ci.nsIHttpChannel); } -async function get_response(channel, fromCache) { +async function get_response(channel) { return new Promise(resolve => { channel.asyncOpen( - new ChannelListener((request, buffer, ctx, isFromCache) => { + new ChannelListener((request, buffer) => { resolve(buffer); }) ); @@ -37,7 +37,7 @@ add_task(async function () { addCertFromFile(certdb, "http2-ca.pem", "CTu,u,u"); let response = await get_response(make_channel(URI), false); - ok(response == "1", "got response ver 1"); + Assert.equal(response, "1", "got response ver 1"); response = await get_response(make_channel(URI), false); - ok(response == "1", "got response ver 1"); + Assert.equal(response, "1", "got response ver 1"); }); diff --git a/netwerk/test/unit/test_stale-while-revalidate_max-age-0.js b/netwerk/test/unit/test_stale-while-revalidate_max-age-0.js index 01bb6639bc..c2b7809f07 100644 --- a/netwerk/test/unit/test_stale-while-revalidate_max-age-0.js +++ b/netwerk/test/unit/test_stale-while-revalidate_max-age-0.js @@ -54,7 +54,11 @@ async function get_response(channel, fromCache) { return new Promise(resolve => { channel.asyncOpen( new ChannelListener((request, buffer, ctx, isFromCache) => { - ok(fromCache == isFromCache, `got response from cache = ${fromCache}`); + Assert.equal( + fromCache, + isFromCache, + `got response from cache = ${fromCache}` + ); resolve(buffer); }) ); @@ -91,7 +95,7 @@ add_task(async function () { version = 1; max_age = 0; response = await get_response(make_channel(URI), false); - ok(response == generate_response(1), "got response ver 1"); + Assert.equal(response, generate_response(1), "got response ver 1"); await sleep(2); @@ -102,12 +106,12 @@ add_task(async function () { version = 2; max_age = 100; response = await get_response(make_channel(URI), true); - ok(response == generate_response(1), "got response ver 1"); + Assert.equal(response, generate_response(1), "got response ver 1"); await reval_done; response = await get_response(make_channel(URI), true); - ok(response == generate_response(2), "got response ver 2"); + Assert.equal(response, generate_response(2), "got response ver 2"); await stop_server(httpserver); }); diff --git a/netwerk/test/unit/test_stale-while-revalidate_negative.js b/netwerk/test/unit/test_stale-while-revalidate_negative.js index c9ef87e2dd..1715cdbc1a 100644 --- a/netwerk/test/unit/test_stale-while-revalidate_negative.js +++ b/netwerk/test/unit/test_stale-while-revalidate_negative.js @@ -49,7 +49,11 @@ async function get_response(channel, fromCache) { return new Promise(resolve => { channel.asyncOpen( new ChannelListener((request, buffer, ctx, isFromCache) => { - ok(fromCache == isFromCache, `got response from cache = ${fromCache}`); + Assert.equal( + fromCache, + isFromCache, + `got response from cache = ${fromCache}` + ); resolve(buffer); }) ); @@ -80,13 +84,13 @@ add_task(async function () { version = 1; max_age = 1; response = await get_response(make_channel(URI), false); - ok(response == generate_response(1), "got response ver 1"); + Assert.equal(response, generate_response(1), "got response ver 1"); await sleep(max_age + 1 /* stale window */ + 1 /* to expire the window */); version = 2; response = await get_response(make_channel(URI), false); - ok(response == generate_response(2), "got response ver 2"); + Assert.equal(response, generate_response(2), "got response ver 2"); await stop_server(httpserver); }); diff --git a/netwerk/test/unit/test_stale-while-revalidate_positive.js b/netwerk/test/unit/test_stale-while-revalidate_positive.js index 51ce6bdd83..45dc0d305a 100644 --- a/netwerk/test/unit/test_stale-while-revalidate_positive.js +++ b/netwerk/test/unit/test_stale-while-revalidate_positive.js @@ -54,7 +54,11 @@ async function get_response(channel, fromCache) { return new Promise(resolve => { channel.asyncOpen( new ChannelListener((request, buffer, ctx, isFromCache) => { - ok(fromCache == isFromCache, `got response from cache = ${fromCache}`); + Assert.equal( + fromCache, + isFromCache, + `got response from cache = ${fromCache}` + ); resolve(buffer); }) ); @@ -91,7 +95,7 @@ add_task(async function () { version = 1; max_age = 1; response = await get_response(make_channel(URI), false); - ok(response == generate_response(1), "got response ver 1"); + Assert.equal(response, generate_response(1), "got response ver 1"); await sleep(max_age + 1); @@ -102,12 +106,12 @@ add_task(async function () { version = 2; max_age = 100; response = await get_response(make_channel(URI), true); - ok(response == generate_response(1), "got response ver 1"); + Assert.equal(response, generate_response(1), "got response ver 1"); await reval_done; response = await get_response(make_channel(URI), true); - ok(response == generate_response(2), "got response ver 2"); + Assert.equal(response, generate_response(2), "got response ver 2"); await stop_server(httpserver); }); diff --git a/netwerk/test/unit/test_streamcopier.js b/netwerk/test/unit/test_streamcopier.js index f550923546..536a9d5689 100644 --- a/netwerk/test/unit/test_streamcopier.js +++ b/netwerk/test/unit/test_streamcopier.js @@ -36,7 +36,7 @@ function run_test() { ctx.wrappedJSObject = ctx; var observer = { - onStartRequest(aRequest) {}, + onStartRequest() {}, onStopRequest(aRequest, aStatusCode) { Assert.equal(aStatusCode, 0); var sis = Cc["@mozilla.org/scriptableinputstream;1"].createInstance( diff --git a/netwerk/test/unit/test_suspend_channel_before_connect.js b/netwerk/test/unit/test_suspend_channel_before_connect.js index 79a0c43236..2b0da8ac88 100644 --- a/netwerk/test/unit/test_suspend_channel_before_connect.js +++ b/netwerk/test/unit/test_suspend_channel_before_connect.js @@ -20,11 +20,11 @@ function TestServer() { } TestServer.prototype = { - onSocketAccepted(socket, trans) { + onSocketAccepted() { Assert.ok(false, "Socket should not have tried to connect!"); }, - onStopListening(socket) {}, + onStopListening() {}, stop() { try { @@ -36,7 +36,7 @@ TestServer.prototype = { var requestListenerObserver = { QueryInterface: ChromeUtils.generateQI(["nsIObserver"]), - observe(subject, topic, data) { + observe(subject, topic) { if ( topic === "http-on-modify-request" && subject instanceof Ci.nsIHttpChannel @@ -62,13 +62,13 @@ var requestListenerObserver = { }; var listener = { - onStartRequest: function test_onStartR(request) {}, + onStartRequest: function test_onStartR() {}, onDataAvailable: function test_ODA() { do_throw("Should not get any data!"); }, - onStopRequest: function test_onStopR(request, status) { + onStopRequest: function test_onStopR() { executeSoon(run_next_test); }, }; diff --git a/netwerk/test/unit/test_suspend_channel_on_authRetry.js b/netwerk/test/unit/test_suspend_channel_on_authRetry.js index ad0b728b68..ef242b65e5 100644 --- a/netwerk/test/unit/test_suspend_channel_on_authRetry.js +++ b/netwerk/test/unit/test_suspend_channel_on_authRetry.js @@ -22,7 +22,7 @@ AuthPrompt.prototype = { QueryInterface: ChromeUtils.generateQI(["nsIAuthPrompt"]), - prompt: function ap1_prompt(title, text, realm, save, defaultText, result) { + prompt: function ap1_prompt() { do_throw("unexpected prompt call"); }, @@ -42,7 +42,7 @@ AuthPrompt.prototype = { return true; }, - promptPassword: function promptPW(title, text, realm, save, pwd) { + promptPassword: function promptPW() { do_throw("unexpected promptPassword call"); }, }; @@ -64,7 +64,7 @@ requestListenerObserver.prototype = { resumeOnModifyRequest: false, QueryInterface: ChromeUtils.generateQI(["nsIObserver"]), - observe(subject, topic, data) { + observe(subject, topic) { if ( topic === "http-on-before-connect" && subject instanceof Ci.nsIHttpChannel diff --git a/netwerk/test/unit/test_suspend_channel_on_examine.js b/netwerk/test/unit/test_suspend_channel_on_examine.js index 7667026a56..0dd36be28f 100644 --- a/netwerk/test/unit/test_suspend_channel_on_examine.js +++ b/netwerk/test/unit/test_suspend_channel_on_examine.js @@ -19,7 +19,7 @@ function responseHandler(metadata, response) { function onExamineListener(callback) { obs.addObserver( { - observe(subject, topic, data) { + observe(subject) { obs.removeObserver(this, "http-on-examine-response"); callback(subject.QueryInterface(Ci.nsIHttpChannel)); }, @@ -48,7 +48,7 @@ add_test(function testAsyncCancel() { chan.resume(); }); }); - startChannelRequest(baseUrl, CL_EXPECT_FAILURE, (request, data, context) => { + startChannelRequest(baseUrl, CL_EXPECT_FAILURE, (request, data) => { Assert.ok(!data, "no response"); Assert.equal( diff --git a/netwerk/test/unit/test_suspend_channel_on_examine_merged_response.js b/netwerk/test/unit/test_suspend_channel_on_examine_merged_response.js index 7496796500..eb26f9d9db 100644 --- a/netwerk/test/unit/test_suspend_channel_on_examine_merged_response.js +++ b/netwerk/test/unit/test_suspend_channel_on_examine_merged_response.js @@ -20,7 +20,7 @@ var channelResumed = false; var observer = { QueryInterface: ChromeUtils.generateQI(["nsIObserver"]), - observe(subject, topic, data) { + observe(subject, topic) { if ( topic === "http-on-examine-merged-response" && subject instanceof Ci.nsIHttpChannel @@ -39,7 +39,7 @@ var observer = { }; var listener = { - onStartRequest(request) { + onStartRequest() { buffer = ""; }, diff --git a/netwerk/test/unit/test_suspend_channel_on_modified.js b/netwerk/test/unit/test_suspend_channel_on_modified.js index 397ffae881..20b52ba817 100644 --- a/netwerk/test/unit/test_suspend_channel_on_modified.js +++ b/netwerk/test/unit/test_suspend_channel_on_modified.js @@ -31,7 +31,7 @@ function successResponseHandler(metadata, response) { function onModifyListener(callback) { obs.addObserver( { - observe(subject, topic, data) { + observe(subject) { obs.removeObserver(this, "http-on-modify-request"); callback(subject.QueryInterface(Ci.nsIHttpChannel)); }, @@ -47,7 +47,7 @@ function startChannelRequest(uri, flags, expectedResponse = null) { }); chan.asyncOpen( new ChannelListener( - (request, data, context) => { + (request, data) => { if (expectedResponse) { Assert.equal(data, expectedResponse); } else { diff --git a/netwerk/test/unit/test_synthesized_response.js b/netwerk/test/unit/test_synthesized_response.js index a598e649c4..e5a82405f2 100644 --- a/netwerk/test/unit/test_synthesized_response.js +++ b/netwerk/test/unit/test_synthesized_response.js @@ -45,10 +45,10 @@ function make_channel(url, body, cb) { getInterface(iid) { return this.QueryInterface(iid); }, - onProgress(request, progress, progressMax) { + onProgress() { gotOnProgress = true; }, - onStatus(request, status, statusArg) { + onStatus() { gotOnStatus = true; }, shouldPrepareForIntercept() { @@ -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 (channel) { + var chan = make_channel(URL + "/body", null, function () { throw new Error("boom"); }); chan.asyncOpen(new ChannelListener(handle_remote_response, null)); diff --git a/netwerk/test/unit/test_throttlechannel.js b/netwerk/test/unit/test_throttlechannel.js index 5a0cfd1151..af5604ff36 100644 --- a/netwerk/test/unit/test_throttlechannel.js +++ b/netwerk/test/unit/test_throttlechannel.js @@ -38,7 +38,11 @@ function run_test() { channel.asyncOpen( new ChannelListener(() => { - ok(tq.bytesProcessed() > 0, "throttled queue processed some bytes"); + Assert.greater( + tq.bytesProcessed(), + 0, + "throttled queue processed some bytes" + ); httpserver.stop(do_test_finished); }) diff --git a/netwerk/test/unit/test_throttling.js b/netwerk/test/unit/test_throttling.js index 7627684dce..c51bc62e95 100644 --- a/netwerk/test/unit/test_throttling.js +++ b/netwerk/test/unit/test_throttling.js @@ -56,7 +56,11 @@ function run_test() { let startTime = Date.now(); channel.asyncOpen( new ChannelListener(() => { - ok(Date.now() - startTime > 1000, "request took more than one second"); + Assert.greater( + Date.now() - startTime, + 1000, + "request took more than one second" + ); httpserver.stop(do_test_finished); }) diff --git a/netwerk/test/unit/test_tls13_disabled.js b/netwerk/test/unit/test_tls13_disabled.js index 3bcb6333aa..4a86cf452c 100644 --- a/netwerk/test/unit/test_tls13_disabled.js +++ b/netwerk/test/unit/test_tls13_disabled.js @@ -32,7 +32,7 @@ Listener.prototype = { read_stream(stream, cnt); }, - onStopRequest: function testOnStopRequest(request, status) { + onStopRequest: function testOnStopRequest(request) { let httpVersion = ""; try { httpVersion = request.protocolVersion; diff --git a/netwerk/test/unit/test_tls_flags.js b/netwerk/test/unit/test_tls_flags.js index 876cd0ccea..5d803c48a2 100644 --- a/netwerk/test/unit/test_tls_flags.js +++ b/netwerk/test/unit/test_tls_flags.js @@ -166,7 +166,7 @@ function startClient(port, tlsFlags, expectSuccess) { req.open("GET", `https://${hostname}:${port}`); let internalChannel = req.channel.QueryInterface(Ci.nsIHttpChannelInternal); internalChannel.tlsFlags = tlsFlags; - return new Promise((resolve, reject) => { + return new Promise(resolve => { req.onload = () => { ok( expectSuccess, diff --git a/netwerk/test/unit/test_tls_server_multiple_clients.js b/netwerk/test/unit/test_tls_server_multiple_clients.js index fdafd9744d..8054d7746c 100644 --- a/netwerk/test/unit/test_tls_server_multiple_clients.js +++ b/netwerk/test/unit/test_tls_server_multiple_clients.js @@ -34,7 +34,7 @@ function startServer(cert) { input = transport.openInputStream(0, 0, 0); output = transport.openOutputStream(0, 0, 0); }, - onHandshakeDone(socket, status) { + onHandshakeDone() { info("TLS handshake done"); input.asyncWait( diff --git a/netwerk/test/unit/test_traceable_channel.js b/netwerk/test/unit/test_traceable_channel.js index 3390682bcf..d4086763cd 100644 --- a/netwerk/test/unit/test_traceable_channel.js +++ b/netwerk/test/unit/test_traceable_channel.js @@ -48,7 +48,7 @@ TracingListener.prototype = { do_throw("replaced channel's listener during onStartRequest."); }, - onStopRequest(request, statusCode) { + onStopRequest() { dump("*** tracing listener onStopRequest\n"); Assert.equal(gotOnStartRequest, true); @@ -88,7 +88,7 @@ HttpResponseExaminer.prototype = { }, // Replace channel's listener. - observe(subject, topic, data) { + observe(subject) { dump("In HttpResponseExaminer.observe\n"); try { subject.QueryInterface(Ci.nsITraceableChannel); @@ -129,7 +129,7 @@ function make_channel(url) { } // Check if received body is correctly modified. -function channel_finished(request, input, ctx) { +function channel_finished() { httpserver.stop(do_test_finished); } diff --git a/netwerk/test/unit/test_trackingProtection_annotateChannels.js b/netwerk/test/unit/test_trackingProtection_annotateChannels.js index a54005b8e2..2fb086bc1f 100644 --- a/netwerk/test/unit/test_trackingProtection_annotateChannels.js +++ b/netwerk/test/unit/test_trackingProtection_annotateChannels.js @@ -63,8 +63,8 @@ listener.prototype = { request.cancel(Cr.NS_ERROR_ABORT); this._nextTest(); }, - onDataAvailable: (request, stream, offset, count) => {}, - onStopRequest: (request, status) => {}, + onDataAvailable: () => {}, + onStopRequest: () => {}, }; var httpServer; diff --git a/netwerk/test/unit/test_trr.js b/netwerk/test/unit/test_trr.js index 52b36620b1..1d5d9cd971 100644 --- a/netwerk/test/unit/test_trr.js +++ b/netwerk/test/unit/test_trr.js @@ -57,7 +57,7 @@ function setModeAndURI(mode, path) { ); } -function makeChan(url, mode, bypassCache) { +function makeChan(url, mode) { let chan = NetUtil.newChannel({ uri: url, loadUsingSystemPrincipal: true, diff --git a/netwerk/test/unit/test_trr_blocklist.js b/netwerk/test/unit/test_trr_blocklist.js index 8f9d3ffbc5..3c72e4e0a7 100644 --- a/netwerk/test/unit/test_trr_blocklist.js +++ b/netwerk/test/unit/test_trr_blocklist.js @@ -14,6 +14,21 @@ function setup() { } setup(); +// Waits until a predicate returns true or re-tries the predicate calls +// |retry| times, we wait for 100ms between each calls. +async function waitUntil(predicate, retry = 20) { + let count = 0; + while (count++ < retry) { + if (await predicate()) { + return true; + } + // Wait for 100 milliseconds. + await new Promise(resolve => do_timeout(100, resolve)); + } + // Timed out after trying too many times. + return false; +} + add_task(async function checkBlocklisting() { let trrServer = new TRRServer(); registerCleanupFunction(async () => { @@ -76,3 +91,52 @@ add_task(async function checkBlocklisting() { "We should do another TRR request because the bloclist expired" ); }); + +add_task(async function test_blocklist_cname() { + let trrServer = new TRRServer(); + registerCleanupFunction(async () => { + await trrServer.stop(); + }); + await trrServer.start(); + info(`port = ${trrServer.port()}\n`); + + Services.dns.clearCache(true); + Services.prefs.setCharPref( + "network.trr.uri", + `https://foo.example.com:${trrServer.port()}/dns-query` + ); + Services.prefs.setIntPref("network.trr.mode", Ci.nsIDNSService.MODE_TRRFIRST); + + await trrServer.registerDoHAnswers(`top.test.com`, "NS", { + answers: [ + { + name: "top.test.com", + ttl: 55, + type: "CNAME", + flush: false, + data: "other.foo", + }, + ], + }); + + await trrServer.registerDoHAnswers(`other.foo`, "NS", { + answers: [ + { + name: "other.foo", + ttl: 55, + type: "NS", + flush: false, + data: "ns.other.foo", + }, + ], + }); + + override.addIPOverride("sub.top.test.com", "2.2.2.2"); + await new TRRDNSListener("sub.top.test.com", { + expectedAnswer: "2.2.2.2", + }); + + await waitUntil(async () => { + return (await trrServer.requestCount("top.test.com", "NS")) == 1; + }); +}); diff --git a/netwerk/test/unit/test_trr_confirmation.js b/netwerk/test/unit/test_trr_confirmation.js index 6635f71377..354e50eb35 100644 --- a/netwerk/test/unit/test_trr_confirmation.js +++ b/netwerk/test/unit/test_trr_confirmation.js @@ -246,7 +246,7 @@ add_task(async function multiple_failures() { CONFIRM_TRYING_OK, "Should be CONFIRM_TRYING_OK" ); - await waitForConfirmationState(CONFIRM_OK, 4500); + await waitForConfirmationState(CONFIRM_OK, 6000); }); add_task(async function test_connectivity_change() { diff --git a/netwerk/test/unit/test_trr_https_fallback.js b/netwerk/test/unit/test_trr_https_fallback.js index 23c5adedaa..dde8e16086 100644 --- a/netwerk/test/unit/test_trr_https_fallback.js +++ b/netwerk/test/unit/test_trr_https_fallback.js @@ -963,14 +963,14 @@ add_task(async function testAllRecordsInHttp3ExcludedList() { }); WebSocketListener.prototype = { - onAcknowledge(aContext, aSize) {}, - onBinaryMessageAvailable(aContext, aMsg) {}, - onMessageAvailable(aContext, aMsg) {}, - onServerClose(aContext, aCode, aReason) {}, - onStart(aContext) { + onAcknowledge() {}, + onBinaryMessageAvailable() {}, + onMessageAvailable() {}, + onServerClose() {}, + onStart() { this.finish(); }, - onStop(aContext, aStatusCode) {}, + onStop() {}, }; add_task(async function testUpgradeNotUsingHTTPSRR() { diff --git a/netwerk/test/unit/test_trr_nat64.js b/netwerk/test/unit/test_trr_nat64.js index aa41f2a611..296035884b 100644 --- a/netwerk/test/unit/test_trr_nat64.js +++ b/netwerk/test/unit/test_trr_nat64.js @@ -22,7 +22,7 @@ registerCleanupFunction(async () => { * @returns {Promise} A promise that fulfills when the notification is fired. */ function promiseObserverNotification(topic, matchFunc) { - return new Promise((resolve, reject) => { + return new Promise(resolve => { Services.obs.addObserver(function observe(subject, topic1, data) { let matches = typeof matchFunc != "function" || matchFunc(subject, data); if (!matches) { diff --git a/netwerk/test/unit/test_trr_proxy.js b/netwerk/test/unit/test_trr_proxy.js index 962971d103..9c1154d7a7 100644 --- a/netwerk/test/unit/test_trr_proxy.js +++ b/netwerk/test/unit/test_trr_proxy.js @@ -38,7 +38,7 @@ ChromeUtils.defineLazyGetter(this, "systemSettings", function () { PACURI: `data:application/x-ns-proxy-autoconfig;charset=utf-8,${encodeURIComponent( FindProxyForURL.toString() )}`, - getProxyForURI(aURI) { + getProxyForURI() { throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED); }, }; diff --git a/netwerk/test/unit/test_trr_proxy_auth.js b/netwerk/test/unit/test_trr_proxy_auth.js index f339d82dea..afd2043d32 100644 --- a/netwerk/test/unit/test_trr_proxy_auth.js +++ b/netwerk/test/unit/test_trr_proxy_auth.js @@ -34,7 +34,7 @@ AuthPrompt.prototype = { return true; }, - asyncPromptAuth: function ap_async(chan, cb, ctx, lvl, info) { + asyncPromptAuth: function ap_async() { throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED); }, }; @@ -99,7 +99,7 @@ add_task(async function test_trr_proxy_auth() { let authTriggered = false; let observer = { QueryInterface: ChromeUtils.generateQI(["nsIObserver"]), - observe(aSubject, aTopic, aData) { + observe(aSubject, aTopic) { if (aTopic == "http-on-examine-response") { Services.obs.removeObserver(observer, "http-on-examine-response"); let channel = aSubject.QueryInterface(Ci.nsIChannel); diff --git a/netwerk/test/unit/test_trr_with_proxy.js b/netwerk/test/unit/test_trr_with_proxy.js index 7d238adb98..d7f520595c 100644 --- a/netwerk/test/unit/test_trr_with_proxy.js +++ b/netwerk/test/unit/test_trr_with_proxy.js @@ -156,7 +156,7 @@ add_task(async function test_trr_proxy() { QueryInterface: ChromeUtils.generateQI(["nsISystemProxySettings"]), mainThreadOnly: true, PACURI: null, - getProxyForURI: (aSpec, aScheme, aHost, aPort) => { + getProxyForURI: () => { return `HTTPS foo.example.com:${proxyPort}`; }, }; diff --git a/netwerk/test/unit/test_udp_multicast.js b/netwerk/test/unit/test_udp_multicast.js index 202a4a1d99..a2022f5bf1 100644 --- a/netwerk/test/unit/test_udp_multicast.js +++ b/netwerk/test/unit/test_udp_multicast.js @@ -37,7 +37,7 @@ function sendPing(socket, addr) { socket.close(); resolve(message.data); }, - onStopListening(sock, status) {}, + onStopListening() {}, }); info("Multicast send to port " + socket.port); diff --git a/netwerk/test/unit/test_udpsocket.js b/netwerk/test/unit/test_udpsocket.js index 340fe6aa13..54170489e3 100644 --- a/netwerk/test/unit/test_udpsocket.js +++ b/netwerk/test/unit/test_udpsocket.js @@ -25,7 +25,7 @@ add_test(function test_udp_message_raw_data() { socket.close(); run_next_test(); }, - onStopListening(aSocket, aStatus) {}, + onStopListening() {}, }); let rawData = new Uint8Array(HELLO_WORLD.length); @@ -52,7 +52,7 @@ add_test(function test_udp_send_stream() { socket.close(); run_next_test(); }, - onStopListening(aSocket, aStatus) {}, + onStopListening() {}, }); let stream = Cc["@mozilla.org/io/string-input-stream;1"].createInstance( @@ -80,7 +80,7 @@ add_test(function test_udp_message_zero_length() { socket.close(); run_next_test(); }, - onStopListening(aSocket, aStatus) {}, + onStopListening() {}, }); let rawData = new Uint8Array(EMPTY_MESSAGE.length); diff --git a/netwerk/test/unit/test_unix_domain.js b/netwerk/test/unit/test_unix_domain.js index 221721dc38..25a98b9aae 100644 --- a/netwerk/test/unit/test_unix_domain.js +++ b/netwerk/test/unit/test_unix_domain.js @@ -131,7 +131,7 @@ function test_echo() { ); }, - onStopListening(aServ, aStatus) { + onStopListening(aServ) { info("called test_echo's onStopListening"); log += "s"; @@ -456,7 +456,7 @@ function test_connect_permission() { let serverOutput = aTransport.openOutputStream(0, 0, 0); serverInput.asyncWait( - function (aStream) { + function () { info( "called test_connect_permission's socketAccepted's onInputStreamReady" ); @@ -485,7 +485,7 @@ function test_connect_permission() { server.close(); } - function stopListening(aServ, aStatus) { + function stopListening() { info("called test_connect_permission's server's stopListening"); log += "s"; @@ -650,7 +650,7 @@ function test_abstract_address_socket() { let serverOutput = aTransport.openOutputStream(0, 0, 0); serverInput.asyncWait( - aStream => { + () => { info( "called test_abstract_address_socket's onSocketAccepted's onInputStreamReady" ); @@ -665,7 +665,7 @@ function test_abstract_address_socket() { threadManager.currentThread ); }, - onStopListening: (aServ, aTransport) => {}, + onStopListening: () => {}, }); let client = @@ -680,7 +680,7 @@ function test_abstract_address_socket() { clientOutput.write("ping ping", 9); clientInput.asyncWait( - aStream => { + () => { let clientScriptInput = new ScriptableInputStream(clientInput); let available = clientScriptInput.available(); if (available) { diff --git a/netwerk/test/unit/test_websocket_offline.js b/netwerk/test/unit/test_websocket_offline.js index 1f13879dbc..ef8fe0e8dc 100644 --- a/netwerk/test/unit/test_websocket_offline.js +++ b/netwerk/test/unit/test_websocket_offline.js @@ -10,11 +10,11 @@ var chan; var offlineStatus; var listener = { - onAcknowledge(aContext, aSize) {}, - onBinaryMessageAvailable(aContext, aMsg) {}, - onMessageAvailable(aContext, aMsg) {}, - onServerClose(aContext, aCode, aReason) {}, - onStart(aContext) { + onAcknowledge() {}, + onBinaryMessageAvailable() {}, + onMessageAvailable() {}, + onServerClose() {}, + onStart() { // onStart is not called when a connection fails Assert.ok(false); }, diff --git a/netwerk/test/unit/test_websocket_with_h3_active.js b/netwerk/test/unit/test_websocket_with_h3_active.js index f9ed2b08a0..7aa7ffc6da 100644 --- a/netwerk/test/unit/test_websocket_with_h3_active.js +++ b/netwerk/test/unit/test_websocket_with_h3_active.js @@ -25,14 +25,14 @@ add_task(async function setup() { }); WebSocketListener.prototype = { - onAcknowledge(aContext, aSize) {}, - onBinaryMessageAvailable(aContext, aMsg) {}, - onMessageAvailable(aContext, aMsg) {}, - onServerClose(aContext, aCode, aReason) {}, - onStart(aContext) { + onAcknowledge() {}, + onBinaryMessageAvailable() {}, + onMessageAvailable() {}, + onServerClose() {}, + onStart() { this.finish(); }, - onStop(aContext, aStatusCode) {}, + onStop() {}, }; function makeH2Chan() { diff --git a/netwerk/test/unit/test_webtransport_simple.js b/netwerk/test/unit/test_webtransport_simple.js index bd99654bc3..4b64ef840e 100644 --- a/netwerk/test/unit/test_webtransport_simple.js +++ b/netwerk/test/unit/test_webtransport_simple.js @@ -77,6 +77,7 @@ add_task(async function test_wt_datagram() { webTransport.asyncConnect( NetUtil.newURI(`https://${host}/success`), + true, [], Services.scriptSecurityManager.getSystemPrincipal(), Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_SEC_CONTEXT_IS_NULL, @@ -134,6 +135,7 @@ add_task(async function test_connect_wt() { webTransport.asyncConnect( NetUtil.newURI(`https://${host}/success`), + true, [], Services.scriptSecurityManager.getSystemPrincipal(), Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_SEC_CONTEXT_IS_NULL, @@ -156,6 +158,7 @@ add_task(async function test_redirect_wt() { webTransport.asyncConnect( NetUtil.newURI(`https://${host}/redirect`), + true, [], Services.scriptSecurityManager.getSystemPrincipal(), Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_SEC_CONTEXT_IS_NULL, @@ -175,6 +178,7 @@ add_task(async function test_reject() { webTransport.asyncConnect( NetUtil.newURI(`https://${host}/reject`), + true, [], Services.scriptSecurityManager.getSystemPrincipal(), Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_SEC_CONTEXT_IS_NULL, @@ -198,6 +202,7 @@ async function test_closed(path) { }); webTransport.asyncConnect( NetUtil.newURI(`https://${host}${path}`), + true, [], Services.scriptSecurityManager.getSystemPrincipal(), Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_SEC_CONTEXT_IS_NULL, @@ -229,6 +234,7 @@ add_task(async function test_wt_stream_create() { webTransport.asyncConnect( NetUtil.newURI(`https://${host}/success`), + true, [], Services.scriptSecurityManager.getSystemPrincipal(), Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_SEC_CONTEXT_IS_NULL, @@ -255,6 +261,7 @@ add_task(async function test_wt_stream_send_and_stats() { webTransport.asyncConnect( NetUtil.newURI(`https://${host}/success`), + true, [], Services.scriptSecurityManager.getSystemPrincipal(), Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_SEC_CONTEXT_IS_NULL, @@ -295,6 +302,7 @@ add_task(async function test_wt_receive_stream_and_stats() { }); webTransport.asyncConnect( NetUtil.newURI(`https://${host}/create_unidi_stream_and_hello`), + true, [], Services.scriptSecurityManager.getSystemPrincipal(), Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_SEC_CONTEXT_IS_NULL, @@ -337,6 +345,7 @@ add_task(async function test_wt_outgoing_bidi_stream() { webTransport.asyncConnect( NetUtil.newURI(`https://${host}/success`), + true, [], Services.scriptSecurityManager.getSystemPrincipal(), Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_SEC_CONTEXT_IS_NULL, @@ -388,6 +397,7 @@ add_task(async function test_wt_incoming_bidi_stream() { }); webTransport.asyncConnect( NetUtil.newURI(`https://${host}/create_bidi_stream`), + true, [], Services.scriptSecurityManager.getSystemPrincipal(), Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_SEC_CONTEXT_IS_NULL, @@ -434,6 +444,7 @@ async function createWebTransportAndConnect() { webTransport.asyncConnect( NetUtil.newURI(`https://${host}/success`), + true, [], Services.scriptSecurityManager.getSystemPrincipal(), Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_SEC_CONTEXT_IS_NULL, diff --git a/netwerk/test/unit/test_xmlhttprequest.js b/netwerk/test/unit/test_xmlhttprequest.js index 7363a54cfd..457e24d80c 100644 --- a/netwerk/test/unit/test_xmlhttprequest.js +++ b/netwerk/test/unit/test_xmlhttprequest.js @@ -42,7 +42,7 @@ function run_test() { // Test async XHR sending let async = createXHR(true); - async.addEventListener("readystatechange", function (event) { + async.addEventListener("readystatechange", function () { if (checkResults(async)) { httpserver.stop(do_test_finished); } diff --git a/netwerk/test/unit/trr_common.js b/netwerk/test/unit/trr_common.js index 2ddd556983..d65157edee 100644 --- a/netwerk/test/unit/trr_common.js +++ b/netwerk/test/unit/trr_common.js @@ -1043,8 +1043,8 @@ async function test_no_retry_without_doh() { getInterface(iid) { return this.QueryInterface(iid); }, - onProgress(request, progress, progressMax) {}, - onStatus(request, status, statusArg) { + onProgress() {}, + onStatus(request, status) { this.statusCount[status] = 1 + (this.statusCount[status] || 0); }, }; diff --git a/netwerk/test/unit/xpcshell.toml b/netwerk/test/unit/xpcshell.toml index dd5957abdb..fb3791963d 100644 --- a/netwerk/test/unit/xpcshell.toml +++ b/netwerk/test/unit/xpcshell.toml @@ -35,9 +35,11 @@ support-files = [ # https://bugzilla.mozilla.org/show_bug.cgi?id=1816325 # Several tests rely on redirecting to data: URIs, which was allowed for a long # time but now forbidden. So we enable it just for these tests. +# Native HTTPS query changes timings for some tests. Disable it for now. prefs = [ "dom.serviceWorkers.enabled=true", - "network.allow_redirect_to_data=true", + "network.allow_redirect_to_data=true", + "network.dns.native_https_query=false", ] ["test_1073747.js"] @@ -106,8 +108,6 @@ skip-if = [ ["test_auth_dialog_permission.js"] -["test_auth_jar.js"] - ["test_auth_multiple.js"] ["test_auth_proxy.js"] @@ -434,7 +434,6 @@ run-sequentially = "node server exceptions dont replay well" run-sequentially = "node server exceptions dont replay well" ["test_channel_close.js"] -skip-if = ["os == 'win' && socketprocess_networking && !debug"] ["test_channel_long_domain.js"] @@ -444,7 +443,9 @@ skip-if = ["os == 'win' && socketprocess_networking && !debug"] prefs = ["security.allow_eval_with_system_principal=true"] ["test_client_auth_with_proxy.js"] -skip-if = ["os == 'android'"] +skip-if = [ + "os == 'android'", +] ["test_coaleasing_h2_and_h3_connection.js"] skip-if = [ @@ -606,6 +607,9 @@ skip-if = ["!nightly_build"] # OHTTP Config manager not currently shipped to rel ["test_http2-proxy-failing.js"] run-sequentially = "node server exceptions dont replay well" +skip-if = [ + "os == 'win'" # https://bugzilla.mozilla.org/show_bug.cgi?id=1881334 +] ["test_http2-proxy.js"] run-sequentially = "one http2 node proxy is used for all tests, this test is using global session counter" @@ -731,6 +735,7 @@ run-sequentially = "http3server" skip-if = [ "os == 'android'", "os == 'win' && msix", # https://bugzilla.mozilla.org/show_bug.cgi?id=1807931 + "true", # Will be reenabled in bug 1865394 ] run-sequentially = "http3server" @@ -856,6 +861,8 @@ run-sequentially = "node server exceptions dont replay well" ["test_multipart_streamconv_missing_lead_boundary.js"] +["test_multipart_set_cookie.js"] + ["test_nestedabout_serialize.js"] ["test_net_addr.js"] diff --git a/netwerk/test/unit_ipc/child_veto_in_parent.js b/netwerk/test/unit_ipc/child_veto_in_parent.js index 8f922a254e..f1bc0a4f50 100644 --- a/netwerk/test/unit_ipc/child_veto_in_parent.js +++ b/netwerk/test/unit_ipc/child_veto_in_parent.js @@ -18,7 +18,7 @@ ChromeUtils.defineLazyGetter(this, "randomURI", function () { return URL + randomPath; }); -function make_channel(url, callback, ctx) { +function make_channel(url) { return NetUtil.newChannel({ uri: url, loadUsingSystemPrincipal: true }); } diff --git a/netwerk/test/unit_ipc/test_alt-data_cross_process_wrap.js b/netwerk/test/unit_ipc/test_alt-data_cross_process_wrap.js index 336b9e3129..07c3e8398a 100644 --- a/netwerk/test/unit_ipc/test_alt-data_cross_process_wrap.js +++ b/netwerk/test/unit_ipc/test_alt-data_cross_process_wrap.js @@ -41,7 +41,7 @@ function load_channel(channelUrl) { chan.asyncOpen(new ChannelListener(readTextData, null)); } -function make_channel(channelUrl, callback, ctx) { +function make_channel(channelUrl) { return NetUtil.newChannel({ uri: channelUrl, loadUsingSystemPrincipal: true, diff --git a/netwerk/test/unit_ipc/test_channel_id.js b/netwerk/test/unit_ipc/test_channel_id.js index fc37651249..1031dba4e2 100644 --- a/netwerk/test/unit_ipc/test_channel_id.js +++ b/netwerk/test/unit_ipc/test_channel_id.js @@ -47,7 +47,7 @@ let parentChannelsDone = new Promise(resolve => { }; }); -function observer(subject, topic, data) { +function observer(subject) { let channel = subject.QueryInterface(Ci.nsIHttpChannel); let uri = channel.URI.spec; diff --git a/netwerk/test/unit_ipc/test_gio_protocol_wrap.js b/netwerk/test/unit_ipc/test_gio_protocol_wrap.js index f6aa6b83e8..e6e2c42bc2 100644 --- a/netwerk/test/unit_ipc/test_gio_protocol_wrap.js +++ b/netwerk/test/unit_ipc/test_gio_protocol_wrap.js @@ -9,7 +9,7 @@ function run_test() { "localtest:,recent:" ); - do_await_remote_message("gio-allow-test-protocols").then(port => { + do_await_remote_message("gio-allow-test-protocols").then(() => { do_send_remote_message("gio-allow-test-protocols-done"); }); diff --git a/netwerk/test/unit_ipc/test_httpcancel_wrap.js b/netwerk/test/unit_ipc/test_httpcancel_wrap.js index f56d0e198b..3e54171ede 100644 --- a/netwerk/test/unit_ipc/test_httpcancel_wrap.js +++ b/netwerk/test/unit_ipc/test_httpcancel_wrap.js @@ -13,7 +13,7 @@ function run_test() { observer = { QueryInterface: ChromeUtils.generateQI(["nsIObserver"]), - observe(subject, topic, data) { + observe(subject) { subject = subject.QueryInterface(Ci.nsIRequest); subject.cancel(Cr.NS_BINDING_ABORTED); diff --git a/netwerk/test/unit_ipc/xpcshell.toml b/netwerk/test/unit_ipc/xpcshell.toml index 569bcda751..24c84d745d 100644 --- a/netwerk/test/unit_ipc/xpcshell.toml +++ b/netwerk/test/unit_ipc/xpcshell.toml @@ -153,6 +153,7 @@ run-sequentially = "http3server" skip-if = [ "os == 'android'", "os == 'win' && msix", + "true", # Will be reenabled in bug 1865394 ] # https://bugzilla.mozilla.org/show_bug.cgi?id=1807925 run-sequentially = "http3server" |