Issue #2258 - Part 1: Support XCTO:nosniff when navigating.

This commit is contained in:
Moonchild 2025-08-12 16:18:38 +02:00 committed by roytam1
commit e56e5d6cb1
10 changed files with 103 additions and 5 deletions

View file

@ -2129,6 +2129,16 @@ NS_SniffContent(const char *aSnifferType, nsIRequest *aRequest,
const uint8_t *aData, uint32_t aLength,
nsACString &aSniffedType)
{
// In case XCTO nosniff was present, we could just skip sniffing here
nsCOMPtr<nsIChannel> channel = do_QueryInterface(aRequest);
if (channel) {
nsCOMPtr<nsILoadInfo> loadInfo = channel->GetLoadInfo();
if (loadInfo->GetSkipContentSniffing()) {
aSniffedType.Truncate();
return;
}
}
typedef nsCategoryCache<nsIContentSniffer> ContentSnifferCache;
extern ContentSnifferCache* gNetSniffers;
extern ContentSnifferCache* gDataSniffers;