diff options
Diffstat (limited to 'browser/components/feeds')
-rw-r--r-- | browser/components/feeds/nsFeedSniffer.cpp | 15 | ||||
-rw-r--r-- | browser/components/feeds/nsFeedSniffer.h | 2 |
2 files changed, 5 insertions, 12 deletions
diff --git a/browser/components/feeds/nsFeedSniffer.cpp b/browser/components/feeds/nsFeedSniffer.cpp index f2d0da776..f314d3d3b 100644 --- a/browser/components/feeds/nsFeedSniffer.cpp +++ b/browser/components/feeds/nsFeedSniffer.cpp @@ -185,15 +185,9 @@ IsDocumentElement(const char *start, const char* end) static bool ContainsTopLevelSubstring(nsACString& dataString, const char *substring) { - nsACString::const_iterator start, end; - dataString.BeginReading(start); - dataString.EndReading(end); - - if (!FindInReadable(nsCString(substring), start, end)){ + int32_t offset = dataString.Find(substring); + if (offset == -1) return false; - } - - auto offset = start.get() - dataString.Data(); const char *begin = dataString.BeginReading(); @@ -318,10 +312,9 @@ nsFeedSniffer::GetMIMETypeFromContent(nsIRequest* request, // RSS 1.0 if (!isFeed) { - bool foundNS_RDF = FindInReadable(NS_LITERAL_CSTRING(NS_RDF), dataString); - bool foundNS_RSS = FindInReadable(NS_LITERAL_CSTRING(NS_RSS), dataString); isFeed = ContainsTopLevelSubstring(dataString, "<rdf:RDF") && - foundNS_RDF && foundNS_RSS; + dataString.Find(NS_RDF) != -1 && + dataString.Find(NS_RSS) != -1; } // If we sniffed a feed, coerce our internal type diff --git a/browser/components/feeds/nsFeedSniffer.h b/browser/components/feeds/nsFeedSniffer.h index b7ac002bd..a0eb9862c 100644 --- a/browser/components/feeds/nsFeedSniffer.h +++ b/browser/components/feeds/nsFeedSniffer.h @@ -6,7 +6,7 @@ #include "nsIContentSniffer.h" #include "nsIStreamListener.h" -#include "nsString.h" +#include "nsStringAPI.h" #include "mozilla/Attributes.h" class nsFeedSniffer final : public nsIContentSniffer, |