зеркало из https://github.com/mozilla/gecko-dev.git
336755 - revert earlier change I made on darin's suggestion because end_iter is moved after all. allows proper detection of rdf-rss feeds. also ensure that the rdf-rss switch is triggered after all three conditions are met, not any one
This commit is contained in:
Родитель
e6d74957f8
Коммит
797e7bacc1
|
@ -177,28 +177,29 @@ nsFeedSniffer::GetMIMETypeFromContent(nsIRequest* request,
|
|||
dataString.BeginReading(start_iter);
|
||||
dataString.EndReading(end_iter);
|
||||
|
||||
// Only start iter moves, and we don't need to reinitialize it every time
|
||||
// if we use a temporary iterator:
|
||||
nsACString::const_iterator iter = start_iter;
|
||||
isFeed = FindInReadable(NS_LITERAL_CSTRING("<rss"), iter, end_iter);
|
||||
isFeed = FindInReadable(NS_LITERAL_CSTRING("<rss"), start_iter, end_iter);
|
||||
|
||||
// Atom 1.0
|
||||
if (!isFeed) {
|
||||
iter = start_iter;
|
||||
isFeed = FindInReadable(NS_LITERAL_CSTRING("<feed"), iter, end_iter);
|
||||
dataString.BeginReading(start_iter);
|
||||
dataString.EndReading(end_iter);
|
||||
isFeed = FindInReadable(NS_LITERAL_CSTRING("<feed"), start_iter, end_iter);
|
||||
}
|
||||
|
||||
// RSS 1.0
|
||||
if (!isFeed) {
|
||||
iter = start_iter;
|
||||
isFeed = FindInReadable(NS_LITERAL_CSTRING("<rdf:RDF"), iter, end_iter);
|
||||
if (!isFeed) {
|
||||
iter = start_iter;
|
||||
isFeed = FindInReadable(NS_LITERAL_CSTRING(NS_RDF), iter, end_iter);
|
||||
if (!isFeed) {
|
||||
iter = start_iter;
|
||||
isFeed = FindInReadable(NS_LITERAL_CSTRING(NS_RSS), iter, end_iter);
|
||||
}
|
||||
dataString.BeginReading(start_iter);
|
||||
dataString.EndReading(end_iter);
|
||||
isFeed = FindInReadable(NS_LITERAL_CSTRING("<rdf:RDF"), start_iter, end_iter);
|
||||
if (isFeed) {
|
||||
dataString.BeginReading(start_iter);
|
||||
dataString.EndReading(end_iter);
|
||||
isFeed = FindInReadable(NS_LITERAL_CSTRING(NS_RDF), start_iter, end_iter);
|
||||
if (isFeed) {
|
||||
dataString.BeginReading(start_iter);
|
||||
dataString.EndReading(end_iter);
|
||||
isFeed = FindInReadable(NS_LITERAL_CSTRING(NS_RSS), start_iter, end_iter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче