summaryrefslogtreecommitdiffstats
path: root/netwerk/test/unit
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:35:37 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:35:37 +0000
commita90a5cba08fdf6c0ceb95101c275108a152a3aed (patch)
tree532507288f3defd7f4dcf1af49698bcb76034855 /netwerk/test/unit
parentAdding debian version 126.0.1-1. (diff)
downloadfirefox-a90a5cba08fdf6c0ceb95101c275108a152a3aed.tar.xz
firefox-a90a5cba08fdf6c0ceb95101c275108a152a3aed.zip
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'netwerk/test/unit')
-rw-r--r--netwerk/test/unit/head_channels.js2
-rw-r--r--netwerk/test/unit/test_cookies_privatebrowsing.js13
-rw-r--r--netwerk/test/unit/test_dns_override.js25
-rw-r--r--netwerk/test/unit/test_httpssvc_iphint.js4
-rw-r--r--netwerk/test/unit/test_verify_traffic.js39
-rw-r--r--netwerk/test/unit/xpcshell.toml2
6 files changed, 79 insertions, 6 deletions
diff --git a/netwerk/test/unit/head_channels.js b/netwerk/test/unit/head_channels.js
index ca16bd2835..94a20b0a3d 100644
--- a/netwerk/test/unit/head_channels.js
+++ b/netwerk/test/unit/head_channels.js
@@ -480,7 +480,7 @@ function bytesToString(bytes) {
function check_http_info(request, expected_httpVersion, expected_proxy) {
let httpVersion = "";
try {
- httpVersion = request.protocolVersion;
+ httpVersion = request.QueryInterface(Ci.nsIHttpChannel).protocolVersion;
} catch (e) {}
request.QueryInterface(Ci.nsIProxiedChannel);
diff --git a/netwerk/test/unit/test_cookies_privatebrowsing.js b/netwerk/test/unit/test_cookies_privatebrowsing.js
index 9d3528440a..dab719954e 100644
--- a/netwerk/test/unit/test_cookies_privatebrowsing.js
+++ b/netwerk/test/unit/test_cookies_privatebrowsing.js
@@ -96,10 +96,21 @@ add_task(async () => {
Services.cookies.setCookieStringFromHttp(uri2, "oh=hai; max-age=1000", chan2);
Assert.equal(await getCookieStringFromPrivateDocument(uri2.spec), "oh=hai");
+ // on android fission the privateBrowsingHolder prevents
+ // the cookies on the content process from being updated
+ // Let's release the last PB window.
+ await privateBrowsingHolder.close();
+
// Fake a profile change.
await promise_close_profile();
do_load_profile();
+ // keep the private browsing window open again
+ const privateBrowsingHolder2 = await CookieXPCShellUtils.loadContentPage(
+ "http://bar.com/",
+ { privateBrowsing: true }
+ );
+
// We're still in private browsing mode, but should have a new session.
// Check counts.
Assert.equal(await getCookieStringFromPrivateDocument(uri1.spec), "");
@@ -127,6 +138,6 @@ add_task(async () => {
Assert.equal(Services.cookies.countCookiesFromHost(uri2.host), 0);
// Let's release the last PB window.
- privateBrowsingHolder.close();
+ await privateBrowsingHolder2.close();
Services.prefs.clearUserPref("dom.security.https_first");
});
diff --git a/netwerk/test/unit/test_dns_override.js b/netwerk/test/unit/test_dns_override.js
index f092dd531c..75fc69c289 100644
--- a/netwerk/test/unit/test_dns_override.js
+++ b/netwerk/test/unit/test_dns_override.js
@@ -353,7 +353,10 @@ function hexToUint8Array(hex) {
add_task(
{
- skip_if: () => mozinfo.os == "win" || mozinfo.os == "android",
+ skip_if: () =>
+ mozinfo.os == "win" ||
+ mozinfo.os == "android" ||
+ mozinfo.socketprocess_networking,
},
async function test_https_record_override() {
let trrServer = new TRRServer();
@@ -414,6 +417,7 @@ add_task(
Services.prefs.setBoolPref("network.dns.native_https_query", true);
registerCleanupFunction(async () => {
Services.prefs.clearUserPref("network.dns.native_https_query");
+ Services.prefs.clearUserPref("network.trr.excluded-domains");
});
let listener = new Listener();
@@ -511,5 +515,24 @@ add_task(
"def...",
"got correct answer"
);
+
+ // Adding "service.com" into excluded-domains should fail
+ // native HTTPS query.
+ Services.prefs.setCharPref("network.trr.excluded-domains", "service.com");
+ listener = new Listener();
+ try {
+ Services.dns.asyncResolve(
+ "service.com",
+ Ci.nsIDNSService.RESOLVE_TYPE_HTTPSSVC,
+ 0,
+ null,
+ listener,
+ mainThread,
+ defaultOriginAttributes
+ );
+ Assert.ok(false, "asyncResolve should fail");
+ } catch (e) {
+ Assert.equal(e.result, Cr.NS_ERROR_UNKNOWN_HOST);
+ }
}
);
diff --git a/netwerk/test/unit/test_httpssvc_iphint.js b/netwerk/test/unit/test_httpssvc_iphint.js
index 13d9a7e648..40f6727e08 100644
--- a/netwerk/test/unit/test_httpssvc_iphint.js
+++ b/netwerk/test/unit/test_httpssvc_iphint.js
@@ -316,7 +316,7 @@ add_task(async function testIPHintWithFreshDNS() {
);
let chan = makeChan(`https://test.iphint.org/server-timing`);
- chan.loadFlags |= Ci.nsIRequest.LOAD_BYPASS_CACHE;
+ chan.loadFlags |= Ci.nsIRequest.LOAD_FRESH_CONNECTION;
let [req] = await channelOpenPromise(
chan,
CL_EXPECT_FAILURE | CL_ALLOW_UNKNOWN_CL
@@ -337,7 +337,7 @@ add_task(async function testIPHintWithFreshDNS() {
});
chan = makeChan(`https://test.iphint.org/server-timing`);
- chan.loadFlags |= Ci.nsIRequest.LOAD_BYPASS_CACHE;
+ chan.loadFlags |= Ci.nsIRequest.LOAD_FRESH_CONNECTION;
[req] = await channelOpenPromise(chan);
Assert.equal(req.protocolVersion, "h2");
let internal = req.QueryInterface(Ci.nsIHttpChannelInternal);
diff --git a/netwerk/test/unit/test_verify_traffic.js b/netwerk/test/unit/test_verify_traffic.js
index be41223642..2b806332c9 100644
--- a/netwerk/test/unit/test_verify_traffic.js
+++ b/netwerk/test/unit/test_verify_traffic.js
@@ -9,6 +9,14 @@
/* import-globals-from head_channels.js */
/* import-globals-from head_servers.js */
+const gDashboard = Cc["@mozilla.org/network/dashboard;1"].getService(
+ Ci.nsIDashboard
+);
+
+const { TestUtils } = ChromeUtils.importESModule(
+ "resource://testing-common/TestUtils.sys.mjs"
+);
+
function makeChan(uri) {
let chan = NetUtil.newChannel({
uri,
@@ -106,5 +114,36 @@ add_task(async function test_verify_traffic_for_http2() {
sessionCount = await server.sessionCount();
Assert.equal(sessionCount, 2);
+ // Create another request and trigger the network change event again.
+ // The second network change event is to put the second connection into the
+ // pending list.
+ res = await new Promise(resolve => {
+ // Create a request that takes 8s to finish.
+ let chan = makeChan(`https://localhost:${server.port()}/longDelay`);
+ chan.asyncOpen(new ChannelListener(resolve, null, CL_ALLOW_UNKNOWN_CL));
+
+ Services.obs.notifyObservers(
+ null,
+ "network:link-status-changed",
+ "changed"
+ );
+ });
+
+ Assert.equal(res.status, Cr.NS_OK);
+ Assert.equal(res.QueryInterface(Ci.nsIHttpChannel).responseStatus, 200);
+
+ async function getSocketCount() {
+ return new Promise(resolve => {
+ gDashboard.requestSockets(function (data) {
+ resolve(data.sockets.length);
+ });
+ });
+ }
+
+ await TestUtils.waitForCondition(async () => {
+ const socketCount = await getSocketCount();
+ return socketCount === 0;
+ }, "Socket count should be 0");
+
await server.stop();
});
diff --git a/netwerk/test/unit/xpcshell.toml b/netwerk/test/unit/xpcshell.toml
index c86a1759e7..a2c09da498 100644
--- a/netwerk/test/unit/xpcshell.toml
+++ b/netwerk/test/unit/xpcshell.toml
@@ -113,6 +113,7 @@ skip-if = [
["test_auth_proxy.js"]
["test_authentication.js"]
+requesttimeoutfactor = 2
["test_authpromptwrapper.js"]
@@ -484,7 +485,6 @@ skip-if = ["os == 'linux' && bits == 64 && !debug"] #Bug 1553353
["test_cookies_partition_counting.js"]
["test_cookies_privatebrowsing.js"]
-skip-if = ["os == 'android' && fission"] # Bug 1888227
["test_cookies_profile_close.js"]
skip-if = ["os == 'android'"] # Bug 1700483