Bug 537120 part 2: be more conservative as far as application of converters goes. r=jst

This commit is contained in:
Boris Zbarsky 2010-04-10 09:10:21 -07:00
Родитель cd5d74649f
Коммит 016d3b7b09
1 изменённых файлов: 28 добавлений и 32 удалений

Просмотреть файл

@ -437,7 +437,8 @@ nsresult nsDocumentOpenInfo::DispatchContent(nsIRequest *request, nsISupports *
return NS_OK;
}
// If we aren't allowed to try other listeners, we're done here.
// If we aren't allowed to try other listeners, just skip through to
// trying to convert the data.
if (!(mFlags & nsIURILoader::DONT_RETARGET)) {
//
@ -516,26 +517,16 @@ nsresult nsDocumentOpenInfo::DispatchContent(nsIRequest *request, nsISupports *
return rv;
}
}
} else {
LOG((" DONT_RETARGET flag set, so skipped over random other content "
"listeners and content handlers"));
}
} else if (mFlags & nsIURILoader::DONT_RETARGET) {
// External handling was forced, but we must not retarget
// -> abort
LOG((" External handling forced, but not allowed to retarget -> aborting"));
return NS_ERROR_WONT_HANDLE_CONTENT;
}
NS_ASSERTION(!m_targetStreamListener,
"If we found a listener, why are we not using it?");
//
// Fifth step: If no listener prefers this type, see if any stream
// converters exist to transform this content type into
// some other.
//
// We always want to do this, since even content being forced to
// be handled externally may need decoding (eg via the unknown
// content decoder).
// Don't do this if the server sent us a MIME type of "*/*" because they saw
// it in our Accept header and got confused.
// XXXbz have to be careful here; may end up in some sort of bizarre infinite
@ -551,9 +542,14 @@ nsresult nsDocumentOpenInfo::DispatchContent(nsIRequest *request, nsISupports *
return NS_OK;
}
}
}
NS_ASSERTION(!m_targetStreamListener,
"If we found a listener, why are we not using it?");
if (mFlags & nsIURILoader::DONT_RETARGET) {
LOG((" Listener not interested and no stream converter exists, and retargeting disallowed -> aborting"));
LOG((" External handling forced or (listener not interested and no "
"stream converter exists), and retargeting disallowed -> aborting"));
return NS_ERROR_WONT_HANDLE_CONTENT;
}