Issue #80 - De-unify dom/security

Exception: CSPUtils relies on something in CSPContext, but on
Windows it throws in an MSVC include which provides no hints.
This commit is contained in:
Moonchild 2020-04-23 14:13:58 +00:00 • committed by Roy Tam
commit b6d9a013c8
6 changed files with 47 additions and 3 deletions

View file

@ -9,6 +9,7 @@
#include "nsCOMPtr.h"
#include "nsICryptoHash.h"
#include "nsString.h"
class nsIChannel;
class nsIUnicharStreamLoader;

View file

@ -24,12 +24,15 @@ EXPORTS += [
]
UNIFIED_SOURCES += [
'nsCSPContext.cpp',
'nsCSPUtils.cpp',
]
SOURCES += [
'ContentVerifier.cpp',
'nsContentSecurityManager.cpp',
'nsCSPContext.cpp',
'nsCSPParser.cpp',
'nsCSPService.cpp',
'nsCSPUtils.cpp',
'nsMixedContentBlocker.cpp',
'SRICheck.cpp',
'SRIMetadata.cpp',

View file

@ -7,6 +7,7 @@
#ifndef nsCSPParser_h___
#define nsCSPParser_h___
#include "nsCSPContext.h"
#include "nsCSPUtils.h"
#include "nsIURI.h"
#include "nsString.h"

View file

@ -17,6 +17,10 @@
#include "nsIURL.h"
#include "nsReadableUtils.h"
#include "nsSandboxFlags.h"
#include "nsString.h"
#include "mozilla/Logging.h"
using namespace mozilla;
#define DEFAULT_PORT -1
@ -30,6 +34,29 @@ GetCspUtilsLog()
#define CSPUTILSLOG(args) MOZ_LOG(GetCspUtilsLog(), mozilla::LogLevel::Debug, args)
#define CSPUTILSLOGENABLED() MOZ_LOG_TEST(GetCspUtilsLog(), mozilla::LogLevel::Debug)
static const char16_t PERCENT_SIGN = '%';
static bool
isCharacterToken(char16_t aSymbol)
{
return (aSymbol >= 'a' && aSymbol <= 'z') ||
(aSymbol >= 'A' && aSymbol <= 'Z');
}
static bool
isNumberToken(char16_t aSymbol)
{
return (aSymbol >= '0' && aSymbol <= '9');
}
static bool
isValidHexDig(char16_t aHexDig)
{
return (isNumberToken(aHexDig) ||
(aHexDig >= 'A' && aHexDig <= 'F') ||
(aHexDig >= 'a' && aHexDig <= 'f'));
}
void
CSP_PercentDecodeStr(const nsAString& aEncStr, nsAString& outDecStr)
{

View file

@ -5,16 +5,26 @@
#include "nsIStreamListener.h"
#include "nsILoadInfo.h"
#include "nsIOService.h"
#include "nsIProtocolHandler.h"
#include "nsContentUtils.h"
#include "nsCORSListenerProxy.h"
#include "nsIStreamListener.h"
#include "nsIScriptError.h"
#include "nsCDefaultURIFixup.h"
#include "nsIURIFixup.h"
#include "nsIImageLoadingContent.h"
#include "nsNetUtil.h"
#include "mozilla/ArrayUtils.h"
#include "nsString.h"
#include "nsMimeTypes.h"
#include "nsContentPolicyUtils.h"
#include "nsCharSeparatedTokenizer.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/TabChild.h"
using namespace mozilla;
NS_IMPL_ISUPPORTS(nsContentSecurityManager,
nsIContentSecurityManager,
nsIChannelEventSink)

View file

@ -20,6 +20,8 @@
#include "nsIContentViewer.h"
#include "nsIChannel.h"
#include "nsIHttpChannel.h"
#include "nsIProtocolHandler.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsIParentChannel.h"
#include "mozilla/Preferences.h"
#include "nsIScriptObjectPrincipal.h"
@ -33,12 +35,12 @@
#include "nsAsyncRedirectVerifyHelper.h"
#include "mozilla/LoadInfo.h"
#include "nsISiteSecurityService.h"
#include "nsNetUtil.h"
#include "mozilla/Logging.h"
#include "mozilla/dom/ContentChild.h"
#include "mozilla/ipc/URIUtils.h"
using namespace mozilla;
enum nsMixedContentBlockerMessageType {