diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:35:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:35:29 +0000 |
commit | 59203c63bb777a3bacec32fb8830fba33540e809 (patch) | |
tree | 58298e711c0ff0575818c30485b44a2f21bf28a0 /netwerk/protocol/res | |
parent | Adding upstream version 126.0.1. (diff) | |
download | firefox-59203c63bb777a3bacec32fb8830fba33540e809.tar.xz firefox-59203c63bb777a3bacec32fb8830fba33540e809.zip |
Adding upstream version 127.0.upstream/127.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'netwerk/protocol/res')
-rw-r--r-- | netwerk/protocol/res/SubstitutingProtocolHandler.cpp | 8 | ||||
-rw-r--r-- | netwerk/protocol/res/SubstitutingProtocolHandler.h | 12 | ||||
-rw-r--r-- | netwerk/protocol/res/nsResProtocolHandler.cpp | 17 | ||||
-rw-r--r-- | netwerk/protocol/res/nsResProtocolHandler.h | 8 |
4 files changed, 22 insertions, 23 deletions
diff --git a/netwerk/protocol/res/SubstitutingProtocolHandler.cpp b/netwerk/protocol/res/SubstitutingProtocolHandler.cpp index 523aaa435d..a7d87b9fb2 100644 --- a/netwerk/protocol/res/SubstitutingProtocolHandler.cpp +++ b/netwerk/protocol/res/SubstitutingProtocolHandler.cpp @@ -437,7 +437,7 @@ nsresult SubstitutingProtocolHandler::NewURI(const nsACString& aSpec, // "android" is the only root that would return the RESOLVE_JAR_URI flag // see nsResProtocolHandler::GetSubstitutionInternal - if (MustResolveJAR(host)) { + if (GetJARFlags(host) & nsISubstitutingProtocolHandler::RESOLVE_JAR_URI) { return ResolveJARURI(uri, aResult); } @@ -599,8 +599,7 @@ nsresult SubstitutingProtocolHandler::GetSubstitution( } } - uint32_t flags; - return GetSubstitutionInternal(root, result, &flags); + return GetSubstitutionInternal(root, result); } nsresult SubstitutingProtocolHandler::GetSubstitutionFlags( @@ -625,7 +624,8 @@ nsresult SubstitutingProtocolHandler::GetSubstitutionFlags( } nsCOMPtr<nsIURI> baseURI; - return GetSubstitutionInternal(root, getter_AddRefs(baseURI), flags); + *flags = GetJARFlags(root); + return GetSubstitutionInternal(root, getter_AddRefs(baseURI)); } nsresult SubstitutingProtocolHandler::HasSubstitution( diff --git a/netwerk/protocol/res/SubstitutingProtocolHandler.h b/netwerk/protocol/res/SubstitutingProtocolHandler.h index 6bdb27f38a..1d3033a5a0 100644 --- a/netwerk/protocol/res/SubstitutingProtocolHandler.h +++ b/netwerk/protocol/res/SubstitutingProtocolHandler.h @@ -58,9 +58,8 @@ class SubstitutingProtocolHandler { // Override this in the subclass to try additional lookups after checking // mSubstitutions. [[nodiscard]] virtual nsresult GetSubstitutionInternal( - const nsACString& aRoot, nsIURI** aResult, uint32_t* aFlags) { + const nsACString& aRoot, nsIURI** aResult) { *aResult = nullptr; - *aFlags = 0; return NS_ERROR_NOT_AVAILABLE; } @@ -73,10 +72,11 @@ class SubstitutingProtocolHandler { return false; } - // This method should only return true if GetSubstitutionInternal would - // return the RESOLVE_JAR_URI flag. - [[nodiscard]] virtual bool MustResolveJAR(const nsACString& aRoot) { - return false; + // This method should only return RESOLVE_JAR_URI when + // GetSubstitutionalInternal will return nsIJARURI instead of a nsIFileURL. + // Currently, this only happens on Android. + [[nodiscard]] virtual uint32_t GetJARFlags(const nsACString& aRoot) { + return 0; } // Override this in the subclass to check for special case when opening diff --git a/netwerk/protocol/res/nsResProtocolHandler.cpp b/netwerk/protocol/res/nsResProtocolHandler.cpp index 208baedf2b..568f929f35 100644 --- a/netwerk/protocol/res/nsResProtocolHandler.cpp +++ b/netwerk/protocol/res/nsResProtocolHandler.cpp @@ -123,20 +123,23 @@ nsResProtocolHandler::AllowContentToAccess(nsIURI* aURI, bool* aResult) { return NS_OK; } +uint32_t nsResProtocolHandler::GetJARFlags(const nsACString& aRoot) { + if (aRoot.Equals(kAndroid)) { + return nsISubstitutingProtocolHandler::RESOLVE_JAR_URI; + } + + // 0 implies no content access. + return 0; +} + nsresult nsResProtocolHandler::GetSubstitutionInternal(const nsACString& aRoot, - nsIURI** aResult, - uint32_t* aFlags) { + nsIURI** aResult) { nsAutoCString uri; if (!ResolveSpecialCases(aRoot, "/"_ns, "/"_ns, uri)) { return NS_ERROR_NOT_AVAILABLE; } - if (aRoot.Equals(kAndroid)) { - *aFlags = nsISubstitutingProtocolHandler::RESOLVE_JAR_URI; - } else { - *aFlags = 0; // No content access. - } return NS_NewURI(aResult, uri); } diff --git a/netwerk/protocol/res/nsResProtocolHandler.h b/netwerk/protocol/res/nsResProtocolHandler.h index 50e790a53a..3c3781ac67 100644 --- a/netwerk/protocol/res/nsResProtocolHandler.h +++ b/netwerk/protocol/res/nsResProtocolHandler.h @@ -48,9 +48,9 @@ class nsResProtocolHandler final } protected: + [[nodiscard]] uint32_t GetJARFlags(const nsACString& aRoot) override; [[nodiscard]] nsresult GetSubstitutionInternal(const nsACString& aRoot, - nsIURI** aResult, - uint32_t* aFlags) override; + nsIURI** aResult) override; virtual ~nsResProtocolHandler() = default; [[nodiscard]] bool ResolveSpecialCases(const nsACString& aHost, @@ -58,10 +58,6 @@ class nsResProtocolHandler final const nsACString& aPathname, nsACString& aResult) override; - [[nodiscard]] virtual bool MustResolveJAR(const nsACString& aRoot) override { - return aRoot.EqualsLiteral("android"); - } - private: [[nodiscard]] nsresult Init(); static mozilla::StaticRefPtr<nsResProtocolHandler> sSingleton; |