mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-09 09:18:42 +09:00
parent
7161ba5ce9
commit
d07bf4bba2
13 changed files with 55 additions and 43 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue