diff options
author | wolfbeast <mcwerewolf@gmail.com> | 2018-02-11 13:01:08 +0100 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-02-11 13:01:08 +0100 |
commit | e45706ca3acbb6530419433212becc61d5953a2d (patch) | |
tree | 09839ca2d524b28c1cdab2349bcdbd938668f139 /browser/components/feeds | |
parent | 154d68048274383cbbff5412942ada5f88c152ca (diff) | |
download | UXP-e45706ca3acbb6530419433212becc61d5953a2d.tar UXP-e45706ca3acbb6530419433212becc61d5953a2d.tar.gz UXP-e45706ca3acbb6530419433212becc61d5953a2d.tar.lz UXP-e45706ca3acbb6530419433212becc61d5953a2d.tar.xz UXP-e45706ca3acbb6530419433212becc61d5953a2d.zip |
Un-fold browsercomps.* from libxul
This resolves #16.
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, |