mirror of
https://github.com/HeyPuter/firefox.git
synced 2026-11-28 04:39:07 -10:00
Bug 578182. CSP causing leaks due to repeated AddBoolPrefVarCache call from nsDocument constructor. r=dveditz
This commit is contained in:
1 parent
2919e0460a
commit
ea00a66a62
3 files changed
+8
-11
No files matched your search
@@ -55,7 +55,7 @@
|
||||
#include "nsChannelProperties.h"
|
||||
|
||||
/* Keeps track of whether or not CSP is enabled */
|
||||
static PRBool gCSPEnabled = PR_TRUE;
|
||||
PRBool CSPService::sCSPEnabled = PR_TRUE;
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
static PRLogModuleInfo* gCspPRLog;
|
||||
@@ -63,7 +63,7 @@ static PRLogModuleInfo* gCspPRLog;
|
||||
|
||||
CSPService::CSPService()
|
||||
{
|
||||
nsContentUtils::AddBoolPrefVarCache("security.csp.enable", &gCSPEnabled);
|
||||
nsContentUtils::AddBoolPrefVarCache("security.csp.enable", &sCSPEnabled);
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
if (!gCspPRLog)
|
||||
@@ -102,7 +102,7 @@ CSPService::ShouldLoad(PRUint32 aContentType,
|
||||
*aDecision = nsIContentPolicy::ACCEPT;
|
||||
|
||||
// No need to continue processing if CSP is disabled
|
||||
if (!gCSPEnabled)
|
||||
if (!sCSPEnabled)
|
||||
return NS_OK;
|
||||
|
||||
// find the principal of the document that initiated this request and see
|
||||
@@ -160,7 +160,7 @@ CSPService::ShouldProcess(PRUint32 aContentType,
|
||||
*aDecision = nsIContentPolicy::ACCEPT;
|
||||
|
||||
// No need to continue processing if CSP is disabled
|
||||
if (!gCSPEnabled)
|
||||
if (!sCSPEnabled)
|
||||
return NS_OK;
|
||||
|
||||
// find the nsDocument that initiated this request and see if it has a
|
||||
|
||||
@@ -52,7 +52,8 @@ public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSICONTENTPOLICY
|
||||
NS_DECL_NSICHANNELEVENTSINK
|
||||
|
||||
|
||||
CSPService();
|
||||
virtual ~CSPService();
|
||||
static PRBool sCSPEnabled;
|
||||
};
|
||||
@@ -195,6 +195,7 @@ static NS_DEFINE_CID(kDOMEventGroupCID, NS_DOMEVENTGROUP_CID);
|
||||
|
||||
// FOR CSP (autogenerated by xpidl)
|
||||
#include "nsIContentSecurityPolicy.h"
|
||||
#include "nsCSPService.h"
|
||||
#include "nsHTMLStyleSheet.h"
|
||||
#include "nsHTMLCSSStyleSheet.h"
|
||||
|
||||
@@ -202,9 +203,6 @@ static NS_DEFINE_CID(kDOMEventGroupCID, NS_DOMEVENTGROUP_CID);
|
||||
using namespace mozilla::dom;
|
||||
|
||||
|
||||
/* Keeps track of whether or not CSP is enabled */
|
||||
static PRBool gCSPEnabled = PR_TRUE;
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
static PRLogModuleInfo* gDocumentLeakPRLog;
|
||||
static PRLogModuleInfo* gCspPRLog;
|
||||
@@ -1409,8 +1407,6 @@ nsDocument::nsDocument(const char* aContentType)
|
||||
gCspPRLog = PR_NewLogModule("CSP");
|
||||
#endif
|
||||
|
||||
nsContentUtils::AddBoolPrefVarCache("security.csp.enable", &gCSPEnabled);
|
||||
|
||||
// Start out mLastStyleSheetSet as null, per spec
|
||||
SetDOMStringToNull(mLastStyleSheetSet);
|
||||
}
|
||||
@@ -2175,7 +2171,7 @@ nsDocument::StartDocumentLoad(const char* aCommand, nsIChannel* aChannel,
|
||||
nsresult
|
||||
nsDocument::InitCSP()
|
||||
{
|
||||
if (gCSPEnabled) {
|
||||
if (CSPService::sCSPEnabled) {
|
||||
nsAutoString cspHeaderValue;
|
||||
nsAutoString cspROHeaderValue;
|
||||
|
||||
|
||||
Reference in new issue
Block a user