commit 15a6dc8a482e29f773471ddac102e18120e6043e Author: Alex Catarineu acat@torproject.org Date: Thu Jul 2 21:38:54 2020 +0200
fixup! Bug 21952: Implement Onion-Location --- dom/base/Document.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/dom/base/Document.cpp b/dom/base/Document.cpp index 994f52659265..1a565a48f6dd 100644 --- a/dom/base/Document.cpp +++ b/dom/base/Document.cpp @@ -3735,16 +3735,17 @@ void Document::GetHeaderData(nsAtom* aHeaderField, nsAString& aData) const { static bool IsValidOnionLocation(nsIURI* aDocumentURI, nsIURI* aOnionLocationURI) { bool isHttpish; - nsAutoCString onionHost; + nsAutoCString host; return aDocumentURI && aOnionLocationURI && NS_SUCCEEDED(aDocumentURI->SchemeIs("https", &isHttpish)) && - isHttpish && + isHttpish && NS_SUCCEEDED(aDocumentURI->GetAsciiHost(host)) && + !StringEndsWith(host, NS_LITERAL_CSTRING(".onion")) && ((NS_SUCCEEDED(aOnionLocationURI->SchemeIs("http", &isHttpish)) && isHttpish) || (NS_SUCCEEDED(aOnionLocationURI->SchemeIs("https", &isHttpish)) && isHttpish)) && - NS_SUCCEEDED(aOnionLocationURI->GetAsciiHost(onionHost)) && - StringEndsWith(onionHost, NS_LITERAL_CSTRING(".onion")); + NS_SUCCEEDED(aOnionLocationURI->GetAsciiHost(host)) && + StringEndsWith(host, NS_LITERAL_CSTRING(".onion")); }
void Document::SetHeaderData(nsAtom* aHeaderField, const nsAString& aData) {