Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(587)

Unified Diff: Source/core/frame/csp/ContentSecurityPolicy.cpp

Issue 332993002: Replace ContentSecurityPolicy::client() with a method returning an ExecutionContext (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/frame/csp/ContentSecurityPolicy.h ('k') | Source/modules/indexeddb/IDBRequestTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/frame/csp/ContentSecurityPolicy.cpp
diff --git a/Source/core/frame/csp/ContentSecurityPolicy.cpp b/Source/core/frame/csp/ContentSecurityPolicy.cpp
index cf0439f92d8d375bc86f3817ea0eee14841d7f6f..b46b501018583a1f112b9899673baaa7290a1068 100644
--- a/Source/core/frame/csp/ContentSecurityPolicy.cpp
+++ b/Source/core/frame/csp/ContentSecurityPolicy.cpp
@@ -130,8 +130,8 @@ static ReferrerPolicy mergeReferrerPolicies(ReferrerPolicy a, ReferrerPolicy b)
return a;
}
-ContentSecurityPolicy::ContentSecurityPolicy(ExecutionContextClient* client)
- : m_client(client)
+ContentSecurityPolicy::ContentSecurityPolicy(ExecutionContext* executionContext)
+ : m_executionContext(executionContext)
, m_overrideInlineStyleAllowed(false)
, m_scriptHashAlgorithmsUsed(ContentSecurityPolicyHashAlgorithmNone)
, m_styleHashAlgorithmsUsed(ContentSecurityPolicyHashAlgorithmNone)
@@ -198,7 +198,7 @@ void ContentSecurityPolicy::addPolicyFromHeaderValue(const String& header, Conte
// We disable 'eval()' even in the case of report-only policies, and rely on the check in the V8Initializer::codeGenerationCheckCallbackInMainThread callback to determine whether the call should execute or not.
if (!policy->allowEval(0, SuppressReport))
- m_client->disableEval(policy->evalDisabledErrorMessage());
+ m_executionContext->disableEval(policy->evalDisabledErrorMessage());
m_policies.append(policy.release());
@@ -474,8 +474,8 @@ bool ContentSecurityPolicy::allowChildContextFromSource(const KURL& url, Content
bool ContentSecurityPolicy::allowWorkerContextFromSource(const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const
{
// CSP 1.1 moves workers from 'script-src' to the new 'child-src'. Measure the impact of this backwards-incompatible change.
- if (m_client->isDocument()) {
- Document* document = static_cast<Document*>(m_client);
+ if (m_executionContext->isDocument()) {
+ Document* document = static_cast<Document*>(m_executionContext);
UseCounter::count(*document, UseCounter::WorkerSubjectToCSP);
if (isAllowedByAllWithURL<&CSPDirectiveList::allowChildContextFromSource>(m_policies, url, SuppressReport) && !isAllowedByAllWithURL<&CSPDirectiveList::allowScriptFromSource>(m_policies, url, SuppressReport))
UseCounter::count(*document, UseCounter::WorkerAllowedByChildBlockedByScript);
@@ -527,17 +527,17 @@ bool ContentSecurityPolicy::didSetReferrerPolicy() const
SecurityOrigin* ContentSecurityPolicy::securityOrigin() const
{
- return m_client->securityContext().securityOrigin();
+ return m_executionContext->securityContext().securityOrigin();
}
const KURL ContentSecurityPolicy::url() const
{
- return m_client->contextURL();
+ return m_executionContext->contextURL();
}
KURL ContentSecurityPolicy::completeURL(const String& url) const
{
- return m_client->contextCompleteURL(url);
+ return m_executionContext->contextCompleteURL(url);
}
void ContentSecurityPolicy::enforceSandboxFlags(SandboxFlags mask) const
@@ -588,7 +588,7 @@ static void gatherSecurityPolicyViolationEventData(SecurityPolicyViolationEventI
void ContentSecurityPolicy::reportViolation(const String& directiveText, const String& effectiveDirective, const String& consoleMessage, const KURL& blockedURL, const Vector<KURL>& reportURIs, const String& header)
{
// FIXME: Support sending reports from worker.
- if (!m_client->isDocument())
+ if (!m_executionContext->isDocument())
return;
Document* document = this->document();
@@ -749,12 +749,12 @@ void ContentSecurityPolicy::reportMissingReportURI(const String& policy) const
void ContentSecurityPolicy::logToConsole(const String& message) const
{
- m_client->addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, message);
+ m_executionContext->addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, message);
}
void ContentSecurityPolicy::reportBlockedScriptExecutionToInspector(const String& directiveText) const
{
- m_client->reportBlockedScriptExecutionToInspector(directiveText);
+ m_executionContext->reportBlockedScriptExecutionToInspector(directiveText);
}
bool ContentSecurityPolicy::experimentalFeaturesEnabled() const
« no previous file with comments | « Source/core/frame/csp/ContentSecurityPolicy.h ('k') | Source/modules/indexeddb/IDBRequestTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698