From d8bbc7858622b6d9c278469aab701ca0b609cddf Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 15 May 2024 05:35:49 +0200 Subject: Merging upstream version 126.0. Signed-off-by: Daniel Baumann --- netwerk/base/nsNetUtil.h | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'netwerk/base/nsNetUtil.h') diff --git a/netwerk/base/nsNetUtil.h b/netwerk/base/nsNetUtil.h index c1f30a56ed..8058ae89d9 100644 --- a/netwerk/base/nsNetUtil.h +++ b/netwerk/base/nsNetUtil.h @@ -294,10 +294,28 @@ int32_t NS_GetDefaultPort(const char* scheme, nsIIOService* ioService = nullptr); /** - * This function is a helper function to apply the ToAscii conversion - * to a string + * The UTS #46 ToASCII operation as parametrized by the WHATWG URL Standard. + * + * Use this function to prepare a host name for network protocols. + */ +nsresult NS_DomainToASCII(const nsACString& aHost, nsACString& aASCII); + +/** + * The UTS #46 ToUnicode operation as parametrized by the WHATWG URL Standard, + * except potentially misleading labels are treated according to ToASCII + * instead. + * + * Use this function to prepare a host name for display to the user. */ -bool NS_StringToACE(const nsACString& idn, nsACString& result); +nsresult NS_DomainToDisplay(const nsACString& aHost, nsACString& aDisplay); + +/** + * The UTS #46 ToUnicode operation as parametrized by the WHATWG URL Standard. + * + * It's most likely incorrect to call this function, and `NS_DomainToDisplay` + * should typically be called instead. + */ +nsresult NS_DomainToUnicode(const nsACString& aHost, nsACString& aUnicode); /** * This function is a helper function to get a protocol's default port if the @@ -1020,7 +1038,7 @@ bool SchemeIsFTP(nsIURI* aURI); // step 2.1 in https://url.spec.whatwg.org/#scheme-state bool SchemeIsSpecial(const nsACString&); bool IsSchemeChangePermitted(nsIURI*, const nsACString&); -already_AddRefed TryChangeProtocol(nsIURI*, const nsAString&); +already_AddRefed TryChangeProtocol(nsIURI*, const nsACString&); struct LinkHeader { nsString mHref; @@ -1099,6 +1117,8 @@ void CheckForBrokenChromeURL(nsILoadInfo* aLoadInfo, nsIURI* aURI); bool IsCoepCredentiallessEnabled(bool aIsOriginTrialCoepCredentiallessEnabled); +void ParseSimpleURISchemes(const nsACString& schemeList); + } // namespace net } // namespace mozilla -- cgit v1.2.3