зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1583869 - Call Sniffers for application/* mime Types r=ckerschb
Differential Revision: https://phabricator.services.mozilla.com/D47258 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
f907c1d2f7
Коммит
653894ec31
|
@ -2720,22 +2720,21 @@ void NS_SniffContent(const char* aSnifferType, nsIRequest* aRequest,
|
|||
nsCOMPtr<nsIChannel> channel = do_QueryInterface(aRequest);
|
||||
if (channel) {
|
||||
nsCOMPtr<nsILoadInfo> loadInfo = channel->LoadInfo();
|
||||
if (loadInfo->GetSkipContentSniffing()) {
|
||||
/* Bug 1571742
|
||||
* We cannot skip snffing if the current MIME-Type might be a JSON.
|
||||
* The JSON-Viewer relies on its own sniffer to determine, if it can
|
||||
* render the page, so we need to make an exception if the Server provides
|
||||
* a application/ mime, as it might be json.
|
||||
*/
|
||||
nsAutoCString currentContentType;
|
||||
channel->GetContentType(currentContentType);
|
||||
/* Bug 1571742
|
||||
* We cannot skip snffing if the current MIME-Type is a JSON file.
|
||||
* The JSON-Viewer relies on its own sniffer to determine, if it can render
|
||||
* the page, so we need to make an exception if the Server provides a valid
|
||||
* JSON-MIME.
|
||||
*/
|
||||
if (loadInfo->GetSkipContentSniffing() &&
|
||||
!currentContentType.Equals(APPLICATION_JSON) &&
|
||||
!currentContentType.Equals(APPLICATION_WEB_MANIFEST) &&
|
||||
!currentContentType.Equals(TEXT_JSON)) {
|
||||
aSniffedType.Truncate();
|
||||
if (!StringBeginsWith(currentContentType,
|
||||
NS_LITERAL_CSTRING("application/"))) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
nsCOMArray<nsIContentSniffer> sniffers;
|
||||
cache->GetEntries(sniffers);
|
||||
for (int32_t i = 0; i < sniffers.Count(); ++i) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче