tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 8893737b3a4b7a1c8b19da19a6042a863303a67d
parent 38a33a7912aa17446b9778d43943130b3d451d83
Author: Valentin Gosu <valentin.gosu@gmail.com>
Date:   Sun,  9 Nov 2025 22:28:38 +0000

Bug 1998894 - Rename pathTemplate to masqueTemplate r=robwu,necko-reviewers,kershaw

Differential Revision: https://phabricator.services.mozilla.com/D271748

Diffstat:
Mnetwerk/base/nsIProtocolProxyService.idl | 2+-
Mnetwerk/base/nsIProxyInfo.idl | 4++--
Mnetwerk/base/nsProtocolProxyService.cpp | 8++++----
Mnetwerk/base/nsProtocolProxyService.h | 6+++---
Mnetwerk/base/nsProxyInfo.cpp | 16++++++++--------
Mnetwerk/base/nsProxyInfo.h | 4++--
Mnetwerk/ipc/NeckoChannelParams.ipdlh | 2+-
Mnetwerk/protocol/http/Http3ConnectUDPStream.cpp | 12++++++------
Mnetwerk/protocol/http/Http3Session.cpp | 12++++++------
Mnetwerk/test/gtest/TestHttp3ConnectUDPStream.cpp | 6+++---
Mnetwerk/test/httpserver/NodeServer.sys.mjs | 6+++---
Mtoolkit/components/extensions/ProxyChannelFilter.sys.mjs | 18+++++++++---------
Mtoolkit/components/extensions/test/xpcshell/test_ext_proxy_http3.js | 2+-
Mtoolkit/components/extensions/test/xpcshell/test_proxy_info_results.js | 25++++++++++++++++---------
14 files changed, 65 insertions(+), 58 deletions(-)

diff --git a/netwerk/base/nsIProtocolProxyService.idl b/netwerk/base/nsIProtocolProxyService.idl @@ -206,7 +206,7 @@ interface nsIProtocolProxyService : nsISupports */ nsIProxyInfo newMASQUEProxyInfo(in AUTF8String aHost, in long aPort, - in AUTF8String aPathTemplate, + in AUTF8String aMasqueTemplate, in ACString aProxyAuthorizationHeader, in ACString aConnectionIsolationKey, in unsigned long aFlags, diff --git a/netwerk/base/nsIProxyInfo.idl b/netwerk/base/nsIProxyInfo.idl @@ -31,7 +31,7 @@ interface nsIProxyInfo : nsISupports * "socks" SOCKS v5 proxy * "socks4" SOCKS v4 proxy * "masque" Similar to an HTTPS proxy, but supports - * "connect-udp" and/or "connect-tcp" with pathTemplate + * "connect-udp" and/or "connect-tcp" with masqueTemplate * "direct" no proxy * "unknown" unknown proxy (see nsIProtocolProxyService::resolve) * @@ -96,7 +96,7 @@ interface nsIProxyInfo : nsISupports /** * Used when the type is "masque" */ - attribute AUTF8String pathTemplate; + attribute AUTF8String masqueTemplate; /** * The following two constants can be used to compare against diff --git a/netwerk/base/nsProtocolProxyService.cpp b/netwerk/base/nsProtocolProxyService.cpp @@ -1707,12 +1707,12 @@ nsProtocolProxyService::NewProxyInfoWithAuth( NS_IMETHODIMP nsProtocolProxyService::NewMASQUEProxyInfo( - const nsACString& aHost, int32_t aPort, const nsACString& aPathTemplate, + const nsACString& aHost, int32_t aPort, const nsACString& aMasqueTemplate, const nsACString& aProxyAuthorizationHeader, const nsACString& aConnectionIsolationKey, uint32_t aFlags, uint32_t aFailoverTimeout, nsIProxyInfo* aFailoverProxy, nsIProxyInfo** aResult) { - return NewProxyInfo_Internal(kProxyType_MASQUE, aHost, aPort, aPathTemplate, + return NewProxyInfo_Internal(kProxyType_MASQUE, aHost, aPort, aMasqueTemplate, ""_ns, ""_ns, aProxyAuthorizationHeader, aConnectionIsolationKey, aFlags, aFailoverTimeout, aFailoverProxy, 0, aResult); @@ -2085,7 +2085,7 @@ nsresult nsProtocolProxyService::GetProtocolInfo(nsIURI* uri, nsresult nsProtocolProxyService::NewProxyInfo_Internal( const char* aType, const nsACString& aHost, int32_t aPort, - const nsACString& aPathTemplate, const nsACString& aUsername, + const nsACString& aMasqueTemplate, const nsACString& aUsername, const nsACString& aPassword, const nsACString& aProxyAuthorizationHeader, const nsACString& aConnectionIsolationKey, uint32_t aFlags, uint32_t aFailoverTimeout, nsIProxyInfo* aFailoverProxy, @@ -2103,7 +2103,7 @@ nsresult nsProtocolProxyService::NewProxyInfo_Internal( proxyInfo->mType = aType; proxyInfo->mHost = aHost; proxyInfo->mPort = aPort; - proxyInfo->mPathTemplate = aPathTemplate; + proxyInfo->mMasqueTemplate = aMasqueTemplate; proxyInfo->mUsername = aUsername; proxyInfo->mPassword = aPassword; proxyInfo->mFlags = aFlags; diff --git a/netwerk/base/nsProtocolProxyService.h b/netwerk/base/nsProtocolProxyService.h @@ -197,8 +197,8 @@ class nsProtocolProxyService final : public nsIProtocolProxyService2, * The proxy host name (UTF-8 ok). * @param port * The proxy port number. - * @param pathTemplate - * The PathTemplate. + * @param masqueTemplate + * The MasqueTemplate. * @param username * The username for the proxy (ASCII). May be "", but not null. * @param password @@ -215,7 +215,7 @@ class nsProtocolProxyService final : public nsIProtocolProxyService2, * The resulting nsIProxyInfo object. */ nsresult NewProxyInfo_Internal(const char* type, const nsACString& host, - int32_t port, const nsACString& pathTemplate, + int32_t port, const nsACString& masqueTemplate, const nsACString& username, const nsACString& password, const nsACString& aProxyAuthorizationHeader, diff --git a/netwerk/base/nsProxyInfo.cpp b/netwerk/base/nsProxyInfo.cpp @@ -32,13 +32,13 @@ nsProxyInfo::nsProxyInfo(const nsACString& aType, const nsACString& aHost, uint32_t aTimeout, uint32_t aResolveFlags, const nsACString& aProxyAuthorizationHeader, const nsACString& aConnectionIsolationKey, - const nsACString& aPathTemplate) + const nsACString& aMasqueTemplate) : mHost(aHost), mUsername(aUsername), mPassword(aPassword), mProxyAuthorizationHeader(aProxyAuthorizationHeader), mConnectionIsolationKey(aConnectionIsolationKey), - mPathTemplate(aPathTemplate), + mMasqueTemplate(aMasqueTemplate), mPort(aPort), mFlags(aFlags), mResolveFlags(aResolveFlags), @@ -151,14 +151,14 @@ nsProxyInfo::SetSourceId(const nsACString& sourceId) { } NS_IMETHODIMP -nsProxyInfo::SetPathTemplate(const nsACString& aPathTemplate) { - mPathTemplate = aPathTemplate; +nsProxyInfo::SetMasqueTemplate(const nsACString& aMasqueTemplate) { + mMasqueTemplate = aMasqueTemplate; return NS_OK; } NS_IMETHODIMP -nsProxyInfo::GetPathTemplate(nsACString& aPathTemplate) { - aPathTemplate = mPathTemplate; +nsProxyInfo::GetMasqueTemplate(nsACString& aMasqueTemplate) { + aMasqueTemplate = mMasqueTemplate; return NS_OK; } @@ -188,7 +188,7 @@ void nsProxyInfo::SerializeProxyInfo(nsProxyInfo* aProxyInfo, arg->type() = nsCString(iter->Type()); arg->host() = iter->Host(); arg->port() = iter->Port(); - arg->pathTemplate() = iter->PathTemplate(); + arg->masqueTemplate() = iter->MasqueTemplate(); arg->username() = iter->Username(); arg->password() = iter->Password(); arg->proxyAuthorizationHeader() = iter->ProxyAuthorizationHeader(); @@ -207,7 +207,7 @@ nsProxyInfo* nsProxyInfo::DeserializeProxyInfo( pi = new nsProxyInfo(info.type(), info.host(), info.port(), info.username(), info.password(), info.flags(), info.timeout(), info.resolveFlags(), info.proxyAuthorizationHeader(), - info.connectionIsolationKey(), info.pathTemplate()); + info.connectionIsolationKey(), info.masqueTemplate()); if (last) { last->mNext = pi; // |mNext| will be released in |last|'s destructor. diff --git a/netwerk/base/nsProxyInfo.h b/netwerk/base/nsProxyInfo.h @@ -36,7 +36,7 @@ class nsProxyInfo final : public nsIProxyInfo { // Cheap accessors for use within Necko const nsCString& Host() const { return mHost; } int32_t Port() const { return mPort; } - const nsCString& PathTemplate() const { return mPathTemplate; } + const nsCString& MasqueTemplate() const { return mMasqueTemplate; } const char* Type() const { return mType; } uint32_t Flags() const { return mFlags; } const nsCString& Username() const { return mUsername; } @@ -87,7 +87,7 @@ class nsProxyInfo final : public nsIProxyInfo { nsCString mProxyAuthorizationHeader; nsCString mConnectionIsolationKey; nsCString mSourceId; - nsCString mPathTemplate; + nsCString mMasqueTemplate; int32_t mPort{-1}; uint32_t mFlags{0}; // We need to read on multiple threads, but don't need to sync on anything diff --git a/netwerk/ipc/NeckoChannelParams.ipdlh b/netwerk/ipc/NeckoChannelParams.ipdlh @@ -435,7 +435,7 @@ struct ProxyInfoCloneArgs nsCString type; nsCString host; int32_t port; - nsCString pathTemplate; + nsCString masqueTemplate; nsCString alpn; nsCString username; nsCString password; diff --git a/netwerk/protocol/http/Http3ConnectUDPStream.cpp b/netwerk/protocol/http/Http3ConnectUDPStream.cpp @@ -96,7 +96,7 @@ nsresult Http3ConnectUDPStream::TryActivating() { } RefPtr<UriTemplateWrapper> builder; - UriTemplateWrapper::Init(info->PathTemplate(), getter_AddRefs(builder)); + UriTemplateWrapper::Init(info->MasqueTemplate(), getter_AddRefs(builder)); if (!builder) { return NS_ERROR_UNEXPECTED; } @@ -118,11 +118,11 @@ nsresult Http3ConnectUDPStream::TryActivating() { return rv; } - nsCString path; - builder->Build(&path); - LOG(("Http3ConnectUDPStream::TryActivating [host=%s path=%s]", - info->Host().get(), path.get())); - return mSession->TryActivating(""_ns, ""_ns, info->Host(), path, + nsCString pathQuery; + builder->Build(&pathQuery); + LOG(("Http3ConnectUDPStream::TryActivating [host=%s pathQuery=%s]", + info->Host().get(), pathQuery.get())); + return mSession->TryActivating(""_ns, ""_ns, info->Host(), pathQuery, mFlatHttpRequestHeaders, &mStreamId, this); } diff --git a/netwerk/protocol/http/Http3Session.cpp b/netwerk/protocol/http/Http3Session.cpp @@ -1428,7 +1428,7 @@ void Http3Session::RemoveStreamFromQueues(Http3StreamBase* aStream) { // calls Http3Stream::OnReadSegment. nsresult Http3Session::TryActivating( const nsACString& aMethod, const nsACString& aScheme, - const nsACString& aAuthorityHeader, const nsACString& aPath, + const nsACString& aAuthorityHeader, const nsACString& aPathQuery, const nsACString& aHeaders, uint64_t* aStreamId, Http3StreamBase* aStream) { MOZ_ASSERT(OnSocketThread(), "not on socket thread"); MOZ_ASSERT(*aStreamId == UINT64_MAX); @@ -1466,15 +1466,15 @@ nsresult Http3Session::TryActivating( false); } else if (RefPtr<Http3Stream> httpStream = aStream->GetHttp3Stream()) { rv = mHttp3Connection->Fetch( - aMethod, aScheme, aAuthorityHeader, aPath, aHeaders, aStreamId, + aMethod, aScheme, aAuthorityHeader, aPathQuery, aHeaders, aStreamId, httpStream->PriorityUrgency(), httpStream->PriorityIncremental()); } else if (RefPtr<Http3ConnectUDPStream> udpStream = aStream->GetHttp3ConnectUDPStream()) { if (DeferIfNegotiating(ExtendedConnectKind::ConnectUDP, aStream)) { return NS_BASE_STREAM_WOULD_BLOCK; } - rv = mHttp3Connection->CreateConnectUdp(aAuthorityHeader, aPath, aHeaders, - aStreamId); + rv = mHttp3Connection->CreateConnectUdp(aAuthorityHeader, aPathQuery, + aHeaders, aStreamId); } else { MOZ_RELEASE_ASSERT(aStream->GetHttp3WebTransportSession(), "It must be a WebTransport session"); @@ -1483,8 +1483,8 @@ nsresult Http3Session::TryActivating( if (DeferIfNegotiating(ExtendedConnectKind::WebTransport, aStream)) { return NS_BASE_STREAM_WOULD_BLOCK; } - rv = mHttp3Connection->CreateWebTransport(aAuthorityHeader, aPath, aHeaders, - aStreamId); + rv = mHttp3Connection->CreateWebTransport(aAuthorityHeader, aPathQuery, + aHeaders, aStreamId); } if (NS_FAILED(rv)) { diff --git a/netwerk/test/gtest/TestHttp3ConnectUDPStream.cpp b/netwerk/test/gtest/TestHttp3ConnectUDPStream.cpp @@ -25,7 +25,7 @@ using namespace mozilla::net; static const char* kProxyHost = "proxy.org"; static const char* kHost = "example.com"; static const int32_t kPort = 4433; -static const char* kPathTemplate = +static const char* kMasqueTemplate = "/.well-known/masque/udp/{target_host}/{target_port}/"; static const char* kPathHeader = "/.well-known/masque/udp/example.com/4433/"; @@ -142,8 +142,8 @@ class DummyHttpTransaction : public nsAHttpTransaction { if (pps) { nsCOMPtr<nsIProxyInfo> info; nsresult rv = pps->NewMASQUEProxyInfo( - nsCString(kProxyHost), -1, nsCString(kPathTemplate), ""_ns, ""_ns, 0, - 0, nullptr, getter_AddRefs(info)); + nsCString(kProxyHost), -1, nsCString(kMasqueTemplate), ""_ns, ""_ns, + 0, 0, nullptr, getter_AddRefs(info)); if (NS_FAILED(rv)) { return; } diff --git a/netwerk/test/httpserver/NodeServer.sys.mjs b/netwerk/test/httpserver/NodeServer.sys.mjs @@ -489,11 +489,11 @@ export class NodeProxyFilter { } export class Http3ProxyFilter { - constructor(host, port, flags, pathTemplate, auth) { + constructor(host, port, flags, masqueTemplate, auth) { this._host = host; this._port = port; this._flags = flags; - this._pathTemplate = pathTemplate; + this._masqueTemplate = masqueTemplate; this._auth = auth; this.QueryInterface = ChromeUtils.generateQI(["nsIProtocolProxyFilter"]); } @@ -504,7 +504,7 @@ export class Http3ProxyFilter { pps.newMASQUEProxyInfo( this._host, this._port, - this._pathTemplate, + this._masqueTemplate, this._auth, "", this._flags, diff --git a/toolkit/components/extensions/ProxyChannelFilter.sys.mjs b/toolkit/components/extensions/ProxyChannelFilter.sys.mjs @@ -47,7 +47,7 @@ const ProxyInfoData = { "type", "host", "port", - "pathTemplate", + "masqueTemplate", "username", "password", "proxyDNS", @@ -104,19 +104,19 @@ const ProxyInfoData = { proxyData.port = port; }, - pathTemplate(proxyData) { - let { pathTemplate } = proxyData; + masqueTemplate(proxyData) { + let { masqueTemplate } = proxyData; if (proxyData.type !== PROXY_TYPES.MASQUE) { - if (pathTemplate !== undefined) { + if (masqueTemplate !== undefined) { throw new ExtensionError( - `ProxyInfoData: pathTemplate can only be used for "masque" proxies` + `ProxyInfoData: masqueTemplate can only be used for "masque" proxies` ); } return; } - if (typeof pathTemplate !== "string" || !pathTemplate) { + if (typeof masqueTemplate !== "string" || !masqueTemplate) { throw new ExtensionError( - `ProxyInfoData: Invalid proxy path template: "${pathTemplate}"` + `ProxyInfoData: Invalid proxy masque template: "${masqueTemplate}"` ); } }, @@ -227,7 +227,7 @@ const ProxyInfoData = { type, host, port, - pathTemplate, + masqueTemplate, username, password, proxyDNS, @@ -263,7 +263,7 @@ const ProxyInfoData = { proxyInfo = lazy.ProxyService.newMASQUEProxyInfo( host, port, - pathTemplate, + masqueTemplate, proxyAuthorizationHeader, connectionIsolationKey, proxyDNS ? TRANSPARENT_PROXY_RESOLVES_HOST : 0, diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_proxy_http3.js b/toolkit/components/extensions/test/xpcshell/test_ext_proxy_http3.js @@ -97,7 +97,7 @@ add_task(async function test_connect_udp() { host: proxyHost, port: proxyPort, type: "masque", - pathTemplate: "/.well-known/masque/udp/{target_host}/{target_port}/", + masqueTemplate: "/.well-known/masque/udp/{target_host}/{target_port}/", connectionIsolationKey: "masque-udp", }; diff --git a/toolkit/components/extensions/test/xpcshell/test_proxy_info_results.js b/toolkit/components/extensions/test/xpcshell/test_proxy_info_results.js @@ -478,11 +478,12 @@ add_task(async function test_proxyInfo_results() { password: "pass123", proxyDNS: true, failoverTimeout: 3, - pathTemplate: "/.well-known/masque/udp/{target_host}/{target_port}/", + masqueTemplate: + "/.well-known/masque/udp/{target_host}/{target_port}/", }, ], expected: { - error: `ProxyInfoData: pathTemplate can only be used for "masque" proxies`, + error: `ProxyInfoData: masqueTemplate can only be used for "masque" proxies`, }, }, { @@ -490,7 +491,8 @@ add_task(async function test_proxyInfo_results() { { host: "foo.bar", port: 3128, - pathTemplate: "/.well-known/masque/udp/{target_host}/{target_port}/", + masqueTemplate: + "/.well-known/masque/udp/{target_host}/{target_port}/", type: "masque", }, ], @@ -499,7 +501,8 @@ add_task(async function test_proxyInfo_results() { host: "foo.bar", port: 3128, type: "masque", - pathTemplate: "/.well-known/masque/udp/{target_host}/{target_port}/", + masqueTemplate: + "/.well-known/masque/udp/{target_host}/{target_port}/", }, }, }, @@ -510,7 +513,8 @@ add_task(async function test_proxyInfo_results() { port: 3128, proxyAuthorizationHeader: "test", connectionIsolationKey: "key", - pathTemplate: "/.well-known/masque/udp/{target_host}/{target_port}/", + masqueTemplate: + "/.well-known/masque/udp/{target_host}/{target_port}/", type: "masque", }, ], @@ -521,7 +525,8 @@ add_task(async function test_proxyInfo_results() { type: "masque", proxyAuthorizationHeader: "test", connectionIsolationKey: "key", - pathTemplate: "/.well-known/masque/udp/{target_host}/{target_port}/", + masqueTemplate: + "/.well-known/masque/udp/{target_host}/{target_port}/", }, }, }, @@ -536,7 +541,7 @@ add_task(async function test_proxyInfo_results() { }, ], expected: { - error: `ProxyInfoData: Invalid proxy path template: "undefined"`, + error: `ProxyInfoData: Invalid proxy masque template: "undefined"`, }, }, { @@ -547,7 +552,8 @@ add_task(async function test_proxyInfo_results() { port: 3128, proxyAuthorizationHeader: "test", connectionIsolationKey: "key", - pathTemplate: "/.well-known/masque/udp/{target_host}/{target_port}/", + masqueTemplate: + "/.well-known/masque/udp/{target_host}/{target_port}/", username: "mungosantamaria", }, ], @@ -562,7 +568,8 @@ add_task(async function test_proxyInfo_results() { port: 3128, proxyAuthorizationHeader: "test", connectionIsolationKey: "key", - pathTemplate: "/.well-known/masque/udp/{target_host}/{target_port}/", + masqueTemplate: + "/.well-known/masque/udp/{target_host}/{target_port}/", type: "masque", password: "pass123", },