<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[198379] trunk/Source/WebCore</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/198379">198379</a></dd>
<dt>Author</dt> <dd>dbates@webkit.org</dd>
<dt>Date</dt> <dd>2016-03-17 23:32:24 -0700 (Thu, 17 Mar 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Cleanup: Remove the need to pass reporting status to ContentSecurityPolicy functions
https://bugs.webkit.org/show_bug.cgi?id=155623
Reviewed by Andy Estes and Alex Christensen.
ScriptController::initScript() is the only function that passes ContentSecurityPolicy::ReportingStatus::SuppressReport
following the removal of the SecurityPolicy script interface in <http://trac.webkit.org/changeset/197142>. It
passes this reporting status to prevent sending a violation report when determining whether the CSP policy allows
use of the JavaScript eval()/operator eval so that it enable or disable this capability as appropriate. We
should teach ScriptController::initScript() to delegate the responsibility of enabling/disabling this capability
to the ContentSecurityPolicy. Then we can remove the need to expose ContentSecurityPolicy::ReportingStatus as
part of the ContentSecurityPolicy interface.
No functionality changed. So, no new tests.
* bindings/js/ScriptController.cpp:
(WebCore::ScriptController::createWindowShell): Return a reference to a JSDOMWindowShell object
instead of a pointer as the pointer is always non-null.
(WebCore::ScriptController::initScript): Updated as needed now that ScriptController::createWindowShell()
returns a reference. Moved logic to enable/disable JavaScript eval() and operator eval from here into
ContentSecurityPolicy::didCreateWindowShell() and make use of this member function.
* bindings/js/ScriptController.h:
* page/csp/ContentSecurityPolicy.cpp:
(WebCore::ContentSecurityPolicy::didCreateWindowShell): Added. Moved logic from to enable/disable JavaScript
eval() and operator eval from ScriptController::initScript() to here.
(WebCore::ContentSecurityPolicy::didReceiveHeader): Substitute ContentSecurityPolicyDirectiveList::ReportingStatus::SuppressReport
for ContentSecurityPolicy::ReportingStatus::SuppressReport as the enum has moved from class ContentSecurityPolicy
to ContentSecurityPolicyDirectiveList. Fix minor code style nit; substitute nullptr for 0 in the first argument
to ContentSecurityPolicyDirectiveList::allowEval().
(WebCore::isAllowedByAllWithFrame): Substitute ContentSecurityPolicyDirectiveList::ReportingStatus::SuppressReport
for ContentSecurityPolicy::ReportingStatus::SuppressReport as the enum has moved from class ContentSecurityPolicy
to ContentSecurityPolicyDirectiveList.
(WebCore::isAllowedByAll): Substitute ContentSecurityPolicyDirectiveList::ReportingStatus::SuppressReport
for ContentSecurityPolicy::ReportingStatus::SuppressReport as the enum has moved from class ContentSecurityPolicy
to ContentSecurityPolicyDirectiveList. Also make this function static so that it has internal linkage.
(WebCore::isAllowedByAllWithState): Ditto.
(WebCore::isAllowedByAllWithContext): Ditto.
(WebCore::isAllowedByAllWithHashFromContent): Ditto.
(WebCore::isAllowedByAllWithURL): Ditto.
(WebCore::ContentSecurityPolicy::allowJavaScriptURLs): Remove argument reportingStatus and always pass
ContentSecurityPolicyDirectiveList::ReportingStatus::SendReport to the directive list member function. In a
subsequent patch we will remove the need to pass the reporting status to the directive list member function.
(WebCore::ContentSecurityPolicy::allowInlineEventHandlers): Ditto.
(WebCore::ContentSecurityPolicy::allowInlineScript): Ditto.
(WebCore::ContentSecurityPolicy::allowInlineStyle): Ditto.
(WebCore::ContentSecurityPolicy::allowEval): Ditto.
(WebCore::ContentSecurityPolicy::allowFrameAncestors): Ditto.
(WebCore::ContentSecurityPolicy::allowPluginType): Ditto.
(WebCore::ContentSecurityPolicy::allowScriptFromSource): Ditto.
(WebCore::ContentSecurityPolicy::allowObjectFromSource): Ditto.
(WebCore::ContentSecurityPolicy::allowChildFrameFromSource): Ditto.
(WebCore::ContentSecurityPolicy::allowChildContextFromSource): Ditto.
(WebCore::ContentSecurityPolicy::allowImageFromSource): Ditto.
(WebCore::ContentSecurityPolicy::allowStyleFromSource): Ditto.
(WebCore::ContentSecurityPolicy::allowFontFromSource): Ditto.
(WebCore::ContentSecurityPolicy::allowMediaFromSource): Ditto.
(WebCore::ContentSecurityPolicy::allowConnectToSource): Ditto.
(WebCore::ContentSecurityPolicy::allowFormAction): Ditto.
(WebCore::ContentSecurityPolicy::allowBaseURI): Ditto.
(WebCore::ContentSecurityPolicy::evalDisabledErrorMessage): Deleted.
* page/csp/ContentSecurityPolicy.h:
* page/csp/ContentSecurityPolicyDirectiveList.cpp:
(WebCore::ContentSecurityPolicyDirectiveList::allowJavaScriptURLs): Substitute ReportingStatus for
ContentSecurityPolicy::ReportingStatus as the enum has moved from class ContentSecurityPolicy to this class.
(WebCore::ContentSecurityPolicyDirectiveList::allowInlineEventHandlers): Ditto.
(WebCore::ContentSecurityPolicyDirectiveList::allowInlineScript): Ditto.
(WebCore::ContentSecurityPolicyDirectiveList::allowInlineStyle): Ditto.
(WebCore::ContentSecurityPolicyDirectiveList::allowEval): Ditto.
(WebCore::ContentSecurityPolicyDirectiveList::allowPluginType): Ditto.
(WebCore::ContentSecurityPolicyDirectiveList::allowScriptFromSource): Ditto.
(WebCore::ContentSecurityPolicyDirectiveList::allowObjectFromSource): Ditto.
(WebCore::ContentSecurityPolicyDirectiveList::allowChildContextFromSource): Ditto.
(WebCore::ContentSecurityPolicyDirectiveList::allowChildFrameFromSource): Ditto.
(WebCore::ContentSecurityPolicyDirectiveList::allowImageFromSource): Ditto.
(WebCore::ContentSecurityPolicyDirectiveList::allowStyleFromSource): Ditto.
(WebCore::ContentSecurityPolicyDirectiveList::allowFontFromSource): Ditto.
(WebCore::ContentSecurityPolicyDirectiveList::allowMediaFromSource): Ditto.
(WebCore::ContentSecurityPolicyDirectiveList::allowConnectToSource): Ditto.
(WebCore::ContentSecurityPolicyDirectiveList::allowFormAction): Ditto.
(WebCore::ContentSecurityPolicyDirectiveList::allowBaseURI): Ditto.
(WebCore::ContentSecurityPolicyDirectiveList::allowFrameAncestors): Ditto.
* page/csp/ContentSecurityPolicyDirectiveList.h:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorebindingsjsScriptControllercpp">trunk/Source/WebCore/bindings/js/ScriptController.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsScriptControllerh">trunk/Source/WebCore/bindings/js/ScriptController.h</a></li>
<li><a href="#trunkSourceWebCorepagecspContentSecurityPolicycpp">trunk/Source/WebCore/page/csp/ContentSecurityPolicy.cpp</a></li>
<li><a href="#trunkSourceWebCorepagecspContentSecurityPolicyh">trunk/Source/WebCore/page/csp/ContentSecurityPolicy.h</a></li>
<li><a href="#trunkSourceWebCorepagecspContentSecurityPolicyDirectiveListcpp">trunk/Source/WebCore/page/csp/ContentSecurityPolicyDirectiveList.cpp</a></li>
<li><a href="#trunkSourceWebCorepagecspContentSecurityPolicyDirectiveListh">trunk/Source/WebCore/page/csp/ContentSecurityPolicyDirectiveList.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (198378 => 198379)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-03-18 06:12:42 UTC (rev 198378)
+++ trunk/Source/WebCore/ChangeLog        2016-03-18 06:32:24 UTC (rev 198379)
</span><span class="lines">@@ -1,3 +1,88 @@
</span><ins>+2016-03-17 Daniel Bates <dabates@apple.com>
+
+ Cleanup: Remove the need to pass reporting status to ContentSecurityPolicy functions
+ https://bugs.webkit.org/show_bug.cgi?id=155623
+
+ Reviewed by Andy Estes and Alex Christensen.
+
+ ScriptController::initScript() is the only function that passes ContentSecurityPolicy::ReportingStatus::SuppressReport
+ following the removal of the SecurityPolicy script interface in <http://trac.webkit.org/changeset/197142>. It
+ passes this reporting status to prevent sending a violation report when determining whether the CSP policy allows
+ use of the JavaScript eval()/operator eval so that it enable or disable this capability as appropriate. We
+ should teach ScriptController::initScript() to delegate the responsibility of enabling/disabling this capability
+ to the ContentSecurityPolicy. Then we can remove the need to expose ContentSecurityPolicy::ReportingStatus as
+ part of the ContentSecurityPolicy interface.
+
+ No functionality changed. So, no new tests.
+
+ * bindings/js/ScriptController.cpp:
+ (WebCore::ScriptController::createWindowShell): Return a reference to a JSDOMWindowShell object
+ instead of a pointer as the pointer is always non-null.
+ (WebCore::ScriptController::initScript): Updated as needed now that ScriptController::createWindowShell()
+ returns a reference. Moved logic to enable/disable JavaScript eval() and operator eval from here into
+ ContentSecurityPolicy::didCreateWindowShell() and make use of this member function.
+ * bindings/js/ScriptController.h:
+ * page/csp/ContentSecurityPolicy.cpp:
+ (WebCore::ContentSecurityPolicy::didCreateWindowShell): Added. Moved logic from to enable/disable JavaScript
+ eval() and operator eval from ScriptController::initScript() to here.
+ (WebCore::ContentSecurityPolicy::didReceiveHeader): Substitute ContentSecurityPolicyDirectiveList::ReportingStatus::SuppressReport
+ for ContentSecurityPolicy::ReportingStatus::SuppressReport as the enum has moved from class ContentSecurityPolicy
+ to ContentSecurityPolicyDirectiveList. Fix minor code style nit; substitute nullptr for 0 in the first argument
+ to ContentSecurityPolicyDirectiveList::allowEval().
+ (WebCore::isAllowedByAllWithFrame): Substitute ContentSecurityPolicyDirectiveList::ReportingStatus::SuppressReport
+ for ContentSecurityPolicy::ReportingStatus::SuppressReport as the enum has moved from class ContentSecurityPolicy
+ to ContentSecurityPolicyDirectiveList.
+ (WebCore::isAllowedByAll): Substitute ContentSecurityPolicyDirectiveList::ReportingStatus::SuppressReport
+ for ContentSecurityPolicy::ReportingStatus::SuppressReport as the enum has moved from class ContentSecurityPolicy
+ to ContentSecurityPolicyDirectiveList. Also make this function static so that it has internal linkage.
+ (WebCore::isAllowedByAllWithState): Ditto.
+ (WebCore::isAllowedByAllWithContext): Ditto.
+ (WebCore::isAllowedByAllWithHashFromContent): Ditto.
+ (WebCore::isAllowedByAllWithURL): Ditto.
+ (WebCore::ContentSecurityPolicy::allowJavaScriptURLs): Remove argument reportingStatus and always pass
+ ContentSecurityPolicyDirectiveList::ReportingStatus::SendReport to the directive list member function. In a
+ subsequent patch we will remove the need to pass the reporting status to the directive list member function.
+ (WebCore::ContentSecurityPolicy::allowInlineEventHandlers): Ditto.
+ (WebCore::ContentSecurityPolicy::allowInlineScript): Ditto.
+ (WebCore::ContentSecurityPolicy::allowInlineStyle): Ditto.
+ (WebCore::ContentSecurityPolicy::allowEval): Ditto.
+ (WebCore::ContentSecurityPolicy::allowFrameAncestors): Ditto.
+ (WebCore::ContentSecurityPolicy::allowPluginType): Ditto.
+ (WebCore::ContentSecurityPolicy::allowScriptFromSource): Ditto.
+ (WebCore::ContentSecurityPolicy::allowObjectFromSource): Ditto.
+ (WebCore::ContentSecurityPolicy::allowChildFrameFromSource): Ditto.
+ (WebCore::ContentSecurityPolicy::allowChildContextFromSource): Ditto.
+ (WebCore::ContentSecurityPolicy::allowImageFromSource): Ditto.
+ (WebCore::ContentSecurityPolicy::allowStyleFromSource): Ditto.
+ (WebCore::ContentSecurityPolicy::allowFontFromSource): Ditto.
+ (WebCore::ContentSecurityPolicy::allowMediaFromSource): Ditto.
+ (WebCore::ContentSecurityPolicy::allowConnectToSource): Ditto.
+ (WebCore::ContentSecurityPolicy::allowFormAction): Ditto.
+ (WebCore::ContentSecurityPolicy::allowBaseURI): Ditto.
+ (WebCore::ContentSecurityPolicy::evalDisabledErrorMessage): Deleted.
+ * page/csp/ContentSecurityPolicy.h:
+ * page/csp/ContentSecurityPolicyDirectiveList.cpp:
+ (WebCore::ContentSecurityPolicyDirectiveList::allowJavaScriptURLs): Substitute ReportingStatus for
+ ContentSecurityPolicy::ReportingStatus as the enum has moved from class ContentSecurityPolicy to this class.
+ (WebCore::ContentSecurityPolicyDirectiveList::allowInlineEventHandlers): Ditto.
+ (WebCore::ContentSecurityPolicyDirectiveList::allowInlineScript): Ditto.
+ (WebCore::ContentSecurityPolicyDirectiveList::allowInlineStyle): Ditto.
+ (WebCore::ContentSecurityPolicyDirectiveList::allowEval): Ditto.
+ (WebCore::ContentSecurityPolicyDirectiveList::allowPluginType): Ditto.
+ (WebCore::ContentSecurityPolicyDirectiveList::allowScriptFromSource): Ditto.
+ (WebCore::ContentSecurityPolicyDirectiveList::allowObjectFromSource): Ditto.
+ (WebCore::ContentSecurityPolicyDirectiveList::allowChildContextFromSource): Ditto.
+ (WebCore::ContentSecurityPolicyDirectiveList::allowChildFrameFromSource): Ditto.
+ (WebCore::ContentSecurityPolicyDirectiveList::allowImageFromSource): Ditto.
+ (WebCore::ContentSecurityPolicyDirectiveList::allowStyleFromSource): Ditto.
+ (WebCore::ContentSecurityPolicyDirectiveList::allowFontFromSource): Ditto.
+ (WebCore::ContentSecurityPolicyDirectiveList::allowMediaFromSource): Ditto.
+ (WebCore::ContentSecurityPolicyDirectiveList::allowConnectToSource): Ditto.
+ (WebCore::ContentSecurityPolicyDirectiveList::allowFormAction): Ditto.
+ (WebCore::ContentSecurityPolicyDirectiveList::allowBaseURI): Ditto.
+ (WebCore::ContentSecurityPolicyDirectiveList::allowFrameAncestors): Ditto.
+ * page/csp/ContentSecurityPolicyDirectiveList.h:
+
</ins><span class="cx"> 2016-03-17 Brent Fulgham <bfulgham@apple.com>
</span><span class="cx">
</span><span class="cx"> [XSS Auditor] Off by one in XSSAuditor::canonicalizedSnippetForJavaScript()
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsScriptControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/ScriptController.cpp (198378 => 198379)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/ScriptController.cpp        2016-03-18 06:12:42 UTC (rev 198378)
+++ trunk/Source/WebCore/bindings/js/ScriptController.cpp        2016-03-18 06:32:24 UTC (rev 198379)
</span><span class="lines">@@ -123,7 +123,7 @@
</span><span class="cx"> world.didDestroyWindowShell(this);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-JSDOMWindowShell* ScriptController::createWindowShell(DOMWrapperWorld& world)
</del><ins>+JSDOMWindowShell& ScriptController::createWindowShell(DOMWrapperWorld& world)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(!m_windowShells.contains(&world));
</span><span class="cx">
</span><span class="lines">@@ -134,7 +134,7 @@
</span><span class="cx"> Strong<JSDOMWindowShell> windowShell2(windowShell);
</span><span class="cx"> m_windowShells.add(&world, windowShell);
</span><span class="cx"> world.didCreateWindowShell(this);
</span><del>- return windowShell.get();
</del><ins>+ return *windowShell.get();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Deprecated::ScriptValue ScriptController::evaluateInWorld(const ScriptSourceCode& sourceCode, DOMWrapperWorld& world, ExceptionDetails* exceptionDetails)
</span><span class="lines">@@ -249,27 +249,22 @@
</span><span class="cx">
</span><span class="cx"> JSLockHolder lock(world.vm());
</span><span class="cx">
</span><del>- JSDOMWindowShell* windowShell = createWindowShell(world);
</del><ins>+ JSDOMWindowShell& windowShell = createWindowShell(world);
</ins><span class="cx">
</span><del>- windowShell->window()->updateDocument();
</del><ins>+ windowShell.window()->updateDocument();
</ins><span class="cx">
</span><del>- if (m_frame.document()) {
- bool shouldBypassMainWorldContentSecurityPolicy = !world.isNormal();
- if (shouldBypassMainWorldContentSecurityPolicy)
- windowShell->window()->setEvalEnabled(true);
- else
- windowShell->window()->setEvalEnabled(m_frame.document()->contentSecurityPolicy()->allowEval(0, shouldBypassMainWorldContentSecurityPolicy, ContentSecurityPolicy::ReportingStatus::SuppressReport), m_frame.document()->contentSecurityPolicy()->evalDisabledErrorMessage());
- }
</del><ins>+ if (Document* document = m_frame.document())
+ document->contentSecurityPolicy()->didCreateWindowShell(windowShell);
</ins><span class="cx">
</span><span class="cx"> if (Page* page = m_frame.page()) {
</span><del>- attachDebugger(windowShell, page->debugger());
- windowShell->window()->setProfileGroup(page->group().identifier());
- windowShell->window()->setConsoleClient(&page->console());
</del><ins>+ attachDebugger(&windowShell, page->debugger());
+ windowShell.window()->setProfileGroup(page->group().identifier());
+ windowShell.window()->setConsoleClient(&page->console());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> m_frame.loader().dispatchDidClearWindowObjectInWorld(world);
</span><span class="cx">
</span><del>- return windowShell;
</del><ins>+ return &windowShell;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> TextPosition ScriptController::eventHandlerPosition() const
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsScriptControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/ScriptController.h (198378 => 198379)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/ScriptController.h        2016-03-18 06:12:42 UTC (rev 198378)
+++ trunk/Source/WebCore/bindings/js/ScriptController.h        2016-03-18 06:32:24 UTC (rev 198379)
</span><span class="lines">@@ -79,7 +79,7 @@
</span><span class="cx">
</span><span class="cx"> WEBCORE_EXPORT static Ref<DOMWrapperWorld> createWorld();
</span><span class="cx">
</span><del>- JSDOMWindowShell* createWindowShell(DOMWrapperWorld&);
</del><ins>+ JSDOMWindowShell& createWindowShell(DOMWrapperWorld&);
</ins><span class="cx"> void destroyWindowShell(DOMWrapperWorld&);
</span><span class="cx">
</span><span class="cx"> Vector<JSC::Strong<JSDOMWindowShell>> windowShells();
</span></span></pre></div>
<a id="trunkSourceWebCorepagecspContentSecurityPolicycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/csp/ContentSecurityPolicy.cpp (198378 => 198379)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/csp/ContentSecurityPolicy.cpp        2016-03-18 06:12:42 UTC (rev 198378)
+++ trunk/Source/WebCore/page/csp/ContentSecurityPolicy.cpp        2016-03-18 06:32:24 UTC (rev 198379)
</span><span class="lines">@@ -41,6 +41,7 @@
</span><span class="cx"> #include "Frame.h"
</span><span class="cx"> #include "HTMLParserIdioms.h"
</span><span class="cx"> #include "InspectorInstrumentation.h"
</span><ins>+#include "JSDOMWindowShell.h"
</ins><span class="cx"> #include "JSMainThreadExecState.h"
</span><span class="cx"> #include "ParsingUtilities.h"
</span><span class="cx"> #include "PingLoader.h"
</span><span class="lines">@@ -88,6 +89,19 @@
</span><span class="cx"> didReceiveHeader(policy->header(), policy->headerType(), ContentSecurityPolicy::PolicyFrom::Inherited);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void ContentSecurityPolicy::didCreateWindowShell(JSDOMWindowShell& windowShell) const
+{
+ JSDOMWindow* window = windowShell.window();
+ ASSERT(window);
+ ASSERT(window->scriptExecutionContext());
+ ASSERT(window->scriptExecutionContext()->contentSecurityPolicy() == this);
+ if (!windowShell.world().isNormal()) {
+ window->setEvalEnabled(true);
+ return;
+ }
+ window->setEvalEnabled(m_lastPolicyEvalDisabledErrorMessage.isNull(), m_lastPolicyEvalDisabledErrorMessage);
+}
+
</ins><span class="cx"> ContentSecurityPolicyResponseHeaders ContentSecurityPolicy::responseHeaders() const
</span><span class="cx"> {
</span><span class="cx"> ContentSecurityPolicyResponseHeaders result;
</span><span class="lines">@@ -119,7 +133,7 @@
</span><span class="cx"> // header1,header2 OR header1
</span><span class="cx"> // ^ ^
</span><span class="cx"> std::unique_ptr<ContentSecurityPolicyDirectiveList> policy = ContentSecurityPolicyDirectiveList::create(*this, String(begin, position - begin), type, policyFrom);
</span><del>- if (!policy->allowEval(0, ContentSecurityPolicy::ReportingStatus::SuppressReport))
</del><ins>+ if (!policy->allowEval(nullptr, ContentSecurityPolicyDirectiveList::ReportingStatus::SuppressReport))
</ins><span class="cx"> m_lastPolicyEvalDisabledErrorMessage = policy->evalDisabledErrorMessage();
</span><span class="cx">
</span><span class="cx"> m_policies.append(policy.release());
</span><span class="lines">@@ -160,8 +174,8 @@
</span><span class="cx"> return equalIgnoringASCIICase(url.protocol(), m_selfSourceProtocol);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-template<bool (ContentSecurityPolicyDirectiveList::*allowed)(const Frame&, const URL&, ContentSecurityPolicy::ReportingStatus) const>
-static bool isAllowedByAllWithFrame(const CSPDirectiveListVector& policies, const Frame& frame, const URL& url, ContentSecurityPolicy::ReportingStatus reportingStatus)
</del><ins>+template<bool (ContentSecurityPolicyDirectiveList::*allowed)(const Frame&, const URL&, ContentSecurityPolicyDirectiveList::ReportingStatus) const>
+static bool isAllowedByAllWithFrame(const CSPDirectiveListVector& policies, const Frame& frame, const URL& url, ContentSecurityPolicyDirectiveList::ReportingStatus reportingStatus)
</ins><span class="cx"> {
</span><span class="cx"> for (auto& policy : policies) {
</span><span class="cx"> if (!(policy.get()->*allowed)(frame, url, reportingStatus))
</span><span class="lines">@@ -170,8 +184,8 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-template<bool (ContentSecurityPolicyDirectiveList::*allowed)(ContentSecurityPolicy::ReportingStatus) const>
-bool isAllowedByAll(const CSPDirectiveListVector& policies, ContentSecurityPolicy::ReportingStatus reportingStatus)
</del><ins>+template<bool (ContentSecurityPolicyDirectiveList::*allowed)(ContentSecurityPolicyDirectiveList::ReportingStatus) const>
+static bool isAllowedByAll(const CSPDirectiveListVector& policies, ContentSecurityPolicyDirectiveList::ReportingStatus reportingStatus)
</ins><span class="cx"> {
</span><span class="cx"> for (auto& policy : policies) {
</span><span class="cx"> if (!(policy.get()->*allowed)(reportingStatus))
</span><span class="lines">@@ -180,8 +194,8 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-template<bool (ContentSecurityPolicyDirectiveList::*allowed)(JSC::ExecState* state, ContentSecurityPolicy::ReportingStatus) const>
-bool isAllowedByAllWithState(const CSPDirectiveListVector& policies, JSC::ExecState* state, ContentSecurityPolicy::ReportingStatus reportingStatus)
</del><ins>+template<bool (ContentSecurityPolicyDirectiveList::*allowed)(JSC::ExecState* state, ContentSecurityPolicyDirectiveList::ReportingStatus) const>
+static bool isAllowedByAllWithState(const CSPDirectiveListVector& policies, JSC::ExecState* state, ContentSecurityPolicyDirectiveList::ReportingStatus reportingStatus)
</ins><span class="cx"> {
</span><span class="cx"> for (auto& policy : policies) {
</span><span class="cx"> if (!(policy.get()->*allowed)(state, reportingStatus))
</span><span class="lines">@@ -190,8 +204,8 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-template<bool (ContentSecurityPolicyDirectiveList::*allowed)(const String&, const WTF::OrdinalNumber&, ContentSecurityPolicy::ReportingStatus) const>
-bool isAllowedByAllWithContext(const CSPDirectiveListVector& policies, const String& contextURL, const WTF::OrdinalNumber& contextLine, ContentSecurityPolicy::ReportingStatus reportingStatus)
</del><ins>+template<bool (ContentSecurityPolicyDirectiveList::*allowed)(const String&, const WTF::OrdinalNumber&, ContentSecurityPolicyDirectiveList::ReportingStatus) const>
+static bool isAllowedByAllWithContext(const CSPDirectiveListVector& policies, const String& contextURL, const WTF::OrdinalNumber& contextLine, ContentSecurityPolicyDirectiveList::ReportingStatus reportingStatus)
</ins><span class="cx"> {
</span><span class="cx"> for (auto& policy : policies) {
</span><span class="cx"> if (!(policy.get()->*allowed)(contextURL, contextLine, reportingStatus))
</span><span class="lines">@@ -225,7 +239,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> template<bool (ContentSecurityPolicyDirectiveList::*allowed)(const ContentSecurityPolicyHash&) const>
</span><del>-bool isAllowedByAllWithHashFromContent(const CSPDirectiveListVector& policies, const String& content, const TextEncoding& encoding, OptionSet<ContentSecurityPolicyHashAlgorithm> algorithms)
</del><ins>+static bool isAllowedByAllWithHashFromContent(const CSPDirectiveListVector& policies, const String& content, const TextEncoding& encoding, OptionSet<ContentSecurityPolicyHashAlgorithm> algorithms)
</ins><span class="cx"> {
</span><span class="cx"> // FIXME: Compute the digest with respect to the raw bytes received from the page.
</span><span class="cx"> // See <https://bugs.webkit.org/show_bug.cgi?id=155184>.
</span><span class="lines">@@ -242,8 +256,8 @@
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-template<bool (ContentSecurityPolicyDirectiveList::*allowFromURL)(const URL&, ContentSecurityPolicy::ReportingStatus) const>
-bool isAllowedByAllWithURL(const CSPDirectiveListVector& policies, const URL& url, ContentSecurityPolicy::ReportingStatus reportingStatus)
</del><ins>+template<bool (ContentSecurityPolicyDirectiveList::*allowFromURL)(const URL&, ContentSecurityPolicyDirectiveList::ReportingStatus) const>
+static bool isAllowedByAllWithURL(const CSPDirectiveListVector& policies, const URL& url, ContentSecurityPolicyDirectiveList::ReportingStatus reportingStatus)
</ins><span class="cx"> {
</span><span class="cx"> if (SchemeRegistry::schemeShouldBypassContentSecurityPolicy(url.protocol()))
</span><span class="cx"> return true;
</span><span class="lines">@@ -255,14 +269,14 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool ContentSecurityPolicy::allowJavaScriptURLs(const String& contextURL, const WTF::OrdinalNumber& contextLine, bool overrideContentSecurityPolicy, ContentSecurityPolicy::ReportingStatus reportingStatus) const
</del><ins>+bool ContentSecurityPolicy::allowJavaScriptURLs(const String& contextURL, const WTF::OrdinalNumber& contextLine, bool overrideContentSecurityPolicy) const
</ins><span class="cx"> {
</span><del>- return overrideContentSecurityPolicy || isAllowedByAllWithContext<&ContentSecurityPolicyDirectiveList::allowJavaScriptURLs>(m_policies, contextURL, contextLine, reportingStatus);
</del><ins>+ return overrideContentSecurityPolicy || isAllowedByAllWithContext<&ContentSecurityPolicyDirectiveList::allowJavaScriptURLs>(m_policies, contextURL, contextLine, ContentSecurityPolicyDirectiveList::ReportingStatus::SendReport);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-bool ContentSecurityPolicy::allowInlineEventHandlers(const String& contextURL, const WTF::OrdinalNumber& contextLine, bool overrideContentSecurityPolicy, ContentSecurityPolicy::ReportingStatus reportingStatus) const
</del><ins>+bool ContentSecurityPolicy::allowInlineEventHandlers(const String& contextURL, const WTF::OrdinalNumber& contextLine, bool overrideContentSecurityPolicy) const
</ins><span class="cx"> {
</span><del>- return overrideContentSecurityPolicy || isAllowedByAllWithContext<&ContentSecurityPolicyDirectiveList::allowInlineEventHandlers>(m_policies, contextURL, contextLine, reportingStatus);
</del><ins>+ return overrideContentSecurityPolicy || isAllowedByAllWithContext<&ContentSecurityPolicyDirectiveList::allowInlineEventHandlers>(m_policies, contextURL, contextLine, ContentSecurityPolicyDirectiveList::ReportingStatus::SendReport);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // FIXME: We should compute the document encoding once and cache it instead of computing it on each invocation.
</span><span class="lines">@@ -300,17 +314,17 @@
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool ContentSecurityPolicy::allowInlineScript(const String& contextURL, const WTF::OrdinalNumber& contextLine, const String& scriptContent, bool overrideContentSecurityPolicy, ContentSecurityPolicy::ReportingStatus reportingStatus) const
</del><ins>+bool ContentSecurityPolicy::allowInlineScript(const String& contextURL, const WTF::OrdinalNumber& contextLine, const String& scriptContent, bool overrideContentSecurityPolicy) const
</ins><span class="cx"> {
</span><span class="cx"> if (overrideContentSecurityPolicy)
</span><span class="cx"> return true;
</span><span class="cx"> if (!m_hashAlgorithmsForInlineScripts.isEmpty() && !scriptContent.isEmpty()
</span><span class="cx"> && isAllowedByAllWithHashFromContent<&ContentSecurityPolicyDirectiveList::allowInlineScriptWithHash>(m_policies, scriptContent, documentEncoding(), m_hashAlgorithmsForInlineScripts))
</span><span class="cx"> return true;
</span><del>- return isAllowedByAllWithContext<&ContentSecurityPolicyDirectiveList::allowInlineScript>(m_policies, contextURL, contextLine, reportingStatus);
</del><ins>+ return isAllowedByAllWithContext<&ContentSecurityPolicyDirectiveList::allowInlineScript>(m_policies, contextURL, contextLine, ContentSecurityPolicyDirectiveList::ReportingStatus::SendReport);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-bool ContentSecurityPolicy::allowInlineStyle(const String& contextURL, const WTF::OrdinalNumber& contextLine, const String& styleContent, bool overrideContentSecurityPolicy, ContentSecurityPolicy::ReportingStatus reportingStatus) const
</del><ins>+bool ContentSecurityPolicy::allowInlineStyle(const String& contextURL, const WTF::OrdinalNumber& contextLine, const String& styleContent, bool overrideContentSecurityPolicy) const
</ins><span class="cx"> {
</span><span class="cx"> if (overrideContentSecurityPolicy)
</span><span class="cx"> return true;
</span><span class="lines">@@ -319,97 +333,88 @@
</span><span class="cx"> if (!m_hashAlgorithmsForInlineStylesheets.isEmpty() && !styleContent.isEmpty()
</span><span class="cx"> && isAllowedByAllWithHashFromContent<&ContentSecurityPolicyDirectiveList::allowInlineStyleWithHash>(m_policies, styleContent, documentEncoding(), m_hashAlgorithmsForInlineStylesheets))
</span><span class="cx"> return true;
</span><del>- return isAllowedByAllWithContext<&ContentSecurityPolicyDirectiveList::allowInlineStyle>(m_policies, contextURL, contextLine, reportingStatus);
</del><ins>+ return isAllowedByAllWithContext<&ContentSecurityPolicyDirectiveList::allowInlineStyle>(m_policies, contextURL, contextLine, ContentSecurityPolicyDirectiveList::ReportingStatus::SendReport);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-bool ContentSecurityPolicy::allowEval(JSC::ExecState* state, bool overrideContentSecurityPolicy, ContentSecurityPolicy::ReportingStatus reportingStatus) const
</del><ins>+bool ContentSecurityPolicy::allowEval(JSC::ExecState* state, bool overrideContentSecurityPolicy) const
</ins><span class="cx"> {
</span><del>- return overrideContentSecurityPolicy || isAllowedByAllWithState<&ContentSecurityPolicyDirectiveList::allowEval>(m_policies, state, reportingStatus);
</del><ins>+ return overrideContentSecurityPolicy || isAllowedByAllWithState<&ContentSecurityPolicyDirectiveList::allowEval>(m_policies, state, ContentSecurityPolicyDirectiveList::ReportingStatus::SendReport);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-bool ContentSecurityPolicy::allowFrameAncestors(const Frame& frame, const URL& url, bool overrideContentSecurityPolicy, ContentSecurityPolicy::ReportingStatus reportingStatus) const
</del><ins>+bool ContentSecurityPolicy::allowFrameAncestors(const Frame& frame, const URL& url, bool overrideContentSecurityPolicy) const
</ins><span class="cx"> {
</span><span class="cx"> if (overrideContentSecurityPolicy)
</span><span class="cx"> return true;
</span><span class="cx"> Frame& topFrame = frame.tree().top();
</span><span class="cx"> if (&frame == &topFrame)
</span><span class="cx"> return true;
</span><del>- return isAllowedByAllWithFrame<&ContentSecurityPolicyDirectiveList::allowFrameAncestors>(m_policies, frame, url, reportingStatus);
</del><ins>+ return isAllowedByAllWithFrame<&ContentSecurityPolicyDirectiveList::allowFrameAncestors>(m_policies, frame, url, ContentSecurityPolicyDirectiveList::ReportingStatus::SendReport);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-String ContentSecurityPolicy::evalDisabledErrorMessage() const
</del><ins>+bool ContentSecurityPolicy::allowPluginType(const String& type, const String& typeAttribute, const URL& url, bool overrideContentSecurityPolicy) const
</ins><span class="cx"> {
</span><del>- for (auto& policy : m_policies) {
- if (!policy->allowEval(0, ContentSecurityPolicy::ReportingStatus::SuppressReport))
- return policy->evalDisabledErrorMessage();
- }
- return String();
-}
-
-bool ContentSecurityPolicy::allowPluginType(const String& type, const String& typeAttribute, const URL& url, bool overrideContentSecurityPolicy, ContentSecurityPolicy::ReportingStatus reportingStatus) const
-{
</del><span class="cx"> if (overrideContentSecurityPolicy)
</span><span class="cx"> return true;
</span><span class="cx"> for (auto& policy : m_policies) {
</span><del>- if (!policy->allowPluginType(type, typeAttribute, url, reportingStatus))
</del><ins>+ if (!policy->allowPluginType(type, typeAttribute, url, ContentSecurityPolicyDirectiveList::ReportingStatus::SendReport))
</ins><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool ContentSecurityPolicy::allowScriptFromSource(const URL& url, bool overrideContentSecurityPolicy, ContentSecurityPolicy::ReportingStatus reportingStatus) const
</del><ins>+bool ContentSecurityPolicy::allowScriptFromSource(const URL& url, bool overrideContentSecurityPolicy) const
</ins><span class="cx"> {
</span><del>- return overrideContentSecurityPolicy || isAllowedByAllWithURL<&ContentSecurityPolicyDirectiveList::allowScriptFromSource>(m_policies, url, reportingStatus);
</del><ins>+ return overrideContentSecurityPolicy || isAllowedByAllWithURL<&ContentSecurityPolicyDirectiveList::allowScriptFromSource>(m_policies, url, ContentSecurityPolicyDirectiveList::ReportingStatus::SendReport);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-bool ContentSecurityPolicy::allowObjectFromSource(const URL& url, bool overrideContentSecurityPolicy, ContentSecurityPolicy::ReportingStatus reportingStatus) const
</del><ins>+bool ContentSecurityPolicy::allowObjectFromSource(const URL& url, bool overrideContentSecurityPolicy) const
</ins><span class="cx"> {
</span><del>- return overrideContentSecurityPolicy || isAllowedByAllWithURL<&ContentSecurityPolicyDirectiveList::allowObjectFromSource>(m_policies, url, reportingStatus);
</del><ins>+ return overrideContentSecurityPolicy || isAllowedByAllWithURL<&ContentSecurityPolicyDirectiveList::allowObjectFromSource>(m_policies, url, ContentSecurityPolicyDirectiveList::ReportingStatus::SendReport);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-bool ContentSecurityPolicy::allowChildFrameFromSource(const URL& url, bool overrideContentSecurityPolicy, ContentSecurityPolicy::ReportingStatus reportingStatus) const
</del><ins>+bool ContentSecurityPolicy::allowChildFrameFromSource(const URL& url, bool overrideContentSecurityPolicy) const
</ins><span class="cx"> {
</span><del>- return overrideContentSecurityPolicy || isAllowedByAllWithURL<&ContentSecurityPolicyDirectiveList::allowChildFrameFromSource>(m_policies, url, reportingStatus);
</del><ins>+ return overrideContentSecurityPolicy || isAllowedByAllWithURL<&ContentSecurityPolicyDirectiveList::allowChildFrameFromSource>(m_policies, url, ContentSecurityPolicyDirectiveList::ReportingStatus::SendReport);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-bool ContentSecurityPolicy::allowChildContextFromSource(const URL& url, bool overrideContentSecurityPolicy, ContentSecurityPolicy::ReportingStatus reportingStatus) const
</del><ins>+bool ContentSecurityPolicy::allowChildContextFromSource(const URL& url, bool overrideContentSecurityPolicy) const
</ins><span class="cx"> {
</span><del>- return overrideContentSecurityPolicy || isAllowedByAllWithURL<&ContentSecurityPolicyDirectiveList::allowChildContextFromSource>(m_policies, url, reportingStatus);
</del><ins>+ return overrideContentSecurityPolicy || isAllowedByAllWithURL<&ContentSecurityPolicyDirectiveList::allowChildContextFromSource>(m_policies, url, ContentSecurityPolicyDirectiveList::ReportingStatus::SendReport);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-bool ContentSecurityPolicy::allowImageFromSource(const URL& url, bool overrideContentSecurityPolicy, ContentSecurityPolicy::ReportingStatus reportingStatus) const
</del><ins>+bool ContentSecurityPolicy::allowImageFromSource(const URL& url, bool overrideContentSecurityPolicy) const
</ins><span class="cx"> {
</span><del>- return overrideContentSecurityPolicy || isAllowedByAllWithURL<&ContentSecurityPolicyDirectiveList::allowImageFromSource>(m_policies, url, reportingStatus);
</del><ins>+ return overrideContentSecurityPolicy || isAllowedByAllWithURL<&ContentSecurityPolicyDirectiveList::allowImageFromSource>(m_policies, url, ContentSecurityPolicyDirectiveList::ReportingStatus::SendReport);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-bool ContentSecurityPolicy::allowStyleFromSource(const URL& url, bool overrideContentSecurityPolicy, ContentSecurityPolicy::ReportingStatus reportingStatus) const
</del><ins>+bool ContentSecurityPolicy::allowStyleFromSource(const URL& url, bool overrideContentSecurityPolicy) const
</ins><span class="cx"> {
</span><del>- return overrideContentSecurityPolicy || isAllowedByAllWithURL<&ContentSecurityPolicyDirectiveList::allowStyleFromSource>(m_policies, url, reportingStatus);
</del><ins>+ return overrideContentSecurityPolicy || isAllowedByAllWithURL<&ContentSecurityPolicyDirectiveList::allowStyleFromSource>(m_policies, url, ContentSecurityPolicyDirectiveList::ReportingStatus::SendReport);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-bool ContentSecurityPolicy::allowFontFromSource(const URL& url, bool overrideContentSecurityPolicy, ContentSecurityPolicy::ReportingStatus reportingStatus) const
</del><ins>+bool ContentSecurityPolicy::allowFontFromSource(const URL& url, bool overrideContentSecurityPolicy) const
</ins><span class="cx"> {
</span><del>- return overrideContentSecurityPolicy || isAllowedByAllWithURL<&ContentSecurityPolicyDirectiveList::allowFontFromSource>(m_policies, url, reportingStatus);
</del><ins>+ return overrideContentSecurityPolicy || isAllowedByAllWithURL<&ContentSecurityPolicyDirectiveList::allowFontFromSource>(m_policies, url, ContentSecurityPolicyDirectiveList::ReportingStatus::SendReport);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-bool ContentSecurityPolicy::allowMediaFromSource(const URL& url, bool overrideContentSecurityPolicy, ContentSecurityPolicy::ReportingStatus reportingStatus) const
</del><ins>+bool ContentSecurityPolicy::allowMediaFromSource(const URL& url, bool overrideContentSecurityPolicy) const
</ins><span class="cx"> {
</span><del>- return overrideContentSecurityPolicy || isAllowedByAllWithURL<&ContentSecurityPolicyDirectiveList::allowMediaFromSource>(m_policies, url, reportingStatus);
</del><ins>+ return overrideContentSecurityPolicy || isAllowedByAllWithURL<&ContentSecurityPolicyDirectiveList::allowMediaFromSource>(m_policies, url, ContentSecurityPolicyDirectiveList::ReportingStatus::SendReport);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-bool ContentSecurityPolicy::allowConnectToSource(const URL& url, bool overrideContentSecurityPolicy, ContentSecurityPolicy::ReportingStatus reportingStatus) const
</del><ins>+bool ContentSecurityPolicy::allowConnectToSource(const URL& url, bool overrideContentSecurityPolicy) const
</ins><span class="cx"> {
</span><del>- return overrideContentSecurityPolicy || isAllowedByAllWithURL<&ContentSecurityPolicyDirectiveList::allowConnectToSource>(m_policies, url, reportingStatus);
</del><ins>+ return overrideContentSecurityPolicy || isAllowedByAllWithURL<&ContentSecurityPolicyDirectiveList::allowConnectToSource>(m_policies, url, ContentSecurityPolicyDirectiveList::ReportingStatus::SendReport);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-bool ContentSecurityPolicy::allowFormAction(const URL& url, bool overrideContentSecurityPolicy, ContentSecurityPolicy::ReportingStatus reportingStatus) const
</del><ins>+bool ContentSecurityPolicy::allowFormAction(const URL& url, bool overrideContentSecurityPolicy) const
</ins><span class="cx"> {
</span><del>- return overrideContentSecurityPolicy || isAllowedByAllWithURL<&ContentSecurityPolicyDirectiveList::allowFormAction>(m_policies, url, reportingStatus);
</del><ins>+ return overrideContentSecurityPolicy || isAllowedByAllWithURL<&ContentSecurityPolicyDirectiveList::allowFormAction>(m_policies, url, ContentSecurityPolicyDirectiveList::ReportingStatus::SendReport);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-bool ContentSecurityPolicy::allowBaseURI(const URL& url, bool overrideContentSecurityPolicy, ContentSecurityPolicy::ReportingStatus reportingStatus) const
</del><ins>+bool ContentSecurityPolicy::allowBaseURI(const URL& url, bool overrideContentSecurityPolicy) const
</ins><span class="cx"> {
</span><del>- return overrideContentSecurityPolicy || isAllowedByAllWithURL<&ContentSecurityPolicyDirectiveList::allowBaseURI>(m_policies, url, reportingStatus);
</del><ins>+ return overrideContentSecurityPolicy || isAllowedByAllWithURL<&ContentSecurityPolicyDirectiveList::allowBaseURI>(m_policies, url, ContentSecurityPolicyDirectiveList::ReportingStatus::SendReport);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool ContentSecurityPolicy::isActive() const
</span></span></pre></div>
<a id="trunkSourceWebCorepagecspContentSecurityPolicyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/csp/ContentSecurityPolicy.h (198378 => 198379)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/csp/ContentSecurityPolicy.h        2016-03-18 06:12:42 UTC (rev 198378)
+++ trunk/Source/WebCore/page/csp/ContentSecurityPolicy.h        2016-03-18 06:32:24 UTC (rev 198379)
</span><span class="lines">@@ -42,6 +42,7 @@
</span><span class="cx"> class ContentSecurityPolicyDirectiveList;
</span><span class="cx"> class ContentSecurityPolicySource;
</span><span class="cx"> class DOMStringList;
</span><ins>+class JSDOMWindowShell;
</ins><span class="cx"> class ScriptExecutionContext;
</span><span class="cx"> class SecurityOrigin;
</span><span class="cx"> class TextEncoding;
</span><span class="lines">@@ -61,6 +62,8 @@
</span><span class="cx">
</span><span class="cx"> void copyStateFrom(const ContentSecurityPolicy*);
</span><span class="cx">
</span><ins>+ void didCreateWindowShell(JSDOMWindowShell&) const;
+
</ins><span class="cx"> // Be sure to update the behavior of XSSAuditor::combineXSSProtectionHeaderAndCSP whenever you change this enum's content or ordering.
</span><span class="cx"> enum ReflectedXSSDisposition {
</span><span class="cx"> ReflectedXSSUnset = 0,
</span><span class="lines">@@ -81,30 +84,26 @@
</span><span class="cx"> void didReceiveHeaders(const ContentSecurityPolicyResponseHeaders&, ReportParsingErrors = ReportParsingErrors::Yes);
</span><span class="cx"> void processHTTPEquiv(const String& content, ContentSecurityPolicyHeaderType type) { didReceiveHeader(content, type, ContentSecurityPolicy::PolicyFrom::HTTPEquivMeta); }
</span><span class="cx">
</span><del>- enum class ReportingStatus {
- SendReport,
- SuppressReport
- };
- bool allowJavaScriptURLs(const String& contextURL, const WTF::OrdinalNumber& contextLine, bool overrideContentSecurityPolicy = false, ContentSecurityPolicy::ReportingStatus = ContentSecurityPolicy::ReportingStatus::SendReport) const;
- bool allowInlineEventHandlers(const String& contextURL, const WTF::OrdinalNumber& contextLine, bool overrideContentSecurityPolicy = false, ContentSecurityPolicy::ReportingStatus = ContentSecurityPolicy::ReportingStatus::SendReport) const;
</del><ins>+ bool allowJavaScriptURLs(const String& contextURL, const WTF::OrdinalNumber& contextLine, bool overrideContentSecurityPolicy = false) const;
+ bool allowInlineEventHandlers(const String& contextURL, const WTF::OrdinalNumber& contextLine, bool overrideContentSecurityPolicy = false) const;
</ins><span class="cx"> bool allowScriptWithNonce(const String& nonce, bool overrideContentSecurityPolicy = false) const;
</span><del>- bool allowInlineScript(const String& contextURL, const WTF::OrdinalNumber& contextLine, const String& scriptContent, bool overrideContentSecurityPolicy = false, ContentSecurityPolicy::ReportingStatus = ContentSecurityPolicy::ReportingStatus::SendReport) const;
</del><ins>+ bool allowInlineScript(const String& contextURL, const WTF::OrdinalNumber& contextLine, const String& scriptContent, bool overrideContentSecurityPolicy = false) const;
</ins><span class="cx"> bool allowStyleWithNonce(const String& nonce, bool overrideContentSecurityPolicy = false) const;
</span><del>- bool allowInlineStyle(const String& contextURL, const WTF::OrdinalNumber& contextLine, const String& styleContent, bool overrideContentSecurityPolicy = false, ContentSecurityPolicy::ReportingStatus = ContentSecurityPolicy::ReportingStatus::SendReport) const;
- bool allowEval(JSC::ExecState* = nullptr, bool overrideContentSecurityPolicy = false, ContentSecurityPolicy::ReportingStatus = ContentSecurityPolicy::ReportingStatus::SendReport) const;
- bool allowPluginType(const String& type, const String& typeAttribute, const URL&, bool overrideContentSecurityPolicy = false, ContentSecurityPolicy::ReportingStatus = ContentSecurityPolicy::ReportingStatus::SendReport) const;
- bool allowScriptFromSource(const URL&, bool overrideContentSecurityPolicy = false, ContentSecurityPolicy::ReportingStatus = ContentSecurityPolicy::ReportingStatus::SendReport) const;
- bool allowObjectFromSource(const URL&, bool overrideContentSecurityPolicy = false, ContentSecurityPolicy::ReportingStatus = ContentSecurityPolicy::ReportingStatus::SendReport) const;
- bool allowChildFrameFromSource(const URL&, bool overrideContentSecurityPolicy = false, ContentSecurityPolicy::ReportingStatus = ContentSecurityPolicy::ReportingStatus::SendReport) const;
- bool allowChildContextFromSource(const URL&, bool overrideContentSecurityPolicy = false, ContentSecurityPolicy::ReportingStatus = ContentSecurityPolicy::ReportingStatus::SendReport) const;
- bool allowImageFromSource(const URL&, bool overrideContentSecurityPolicy = false, ContentSecurityPolicy::ReportingStatus = ContentSecurityPolicy::ReportingStatus::SendReport) const;
- bool allowStyleFromSource(const URL&, bool overrideContentSecurityPolicy = false, ContentSecurityPolicy::ReportingStatus = ContentSecurityPolicy::ReportingStatus::SendReport) const;
- bool allowFontFromSource(const URL&, bool overrideContentSecurityPolicy = false, ContentSecurityPolicy::ReportingStatus = ContentSecurityPolicy::ReportingStatus::SendReport) const;
- bool allowMediaFromSource(const URL&, bool overrideContentSecurityPolicy = false, ContentSecurityPolicy::ReportingStatus = ContentSecurityPolicy::ReportingStatus::SendReport) const;
- bool allowConnectToSource(const URL&, bool overrideContentSecurityPolicy = false, ContentSecurityPolicy::ReportingStatus = ContentSecurityPolicy::ReportingStatus::SendReport) const;
- bool allowFormAction(const URL&, bool overrideContentSecurityPolicy = false, ContentSecurityPolicy::ReportingStatus = ContentSecurityPolicy::ReportingStatus::SendReport) const;
- bool allowBaseURI(const URL&, bool overrideContentSecurityPolicy = false, ContentSecurityPolicy::ReportingStatus = ContentSecurityPolicy::ReportingStatus::SendReport) const;
- bool allowFrameAncestors(const Frame&, const URL&, bool overrideContentSecurityPolicy = false, ContentSecurityPolicy::ReportingStatus = ContentSecurityPolicy::ReportingStatus::SendReport) const;
</del><ins>+ bool allowInlineStyle(const String& contextURL, const WTF::OrdinalNumber& contextLine, const String& styleContent, bool overrideContentSecurityPolicy = false) const;
+ bool allowEval(JSC::ExecState*, bool overrideContentSecurityPolicy = false) const;
+ bool allowPluginType(const String& type, const String& typeAttribute, const URL&, bool overrideContentSecurityPolicy = false) const;
+ bool allowScriptFromSource(const URL&, bool overrideContentSecurityPolicy = false) const;
+ bool allowObjectFromSource(const URL&, bool overrideContentSecurityPolicy = false) const;
+ bool allowChildFrameFromSource(const URL&, bool overrideContentSecurityPolicy = false) const;
+ bool allowChildContextFromSource(const URL&, bool overrideContentSecurityPolicy = false) const;
+ bool allowImageFromSource(const URL&, bool overrideContentSecurityPolicy = false) const;
+ bool allowStyleFromSource(const URL&, bool overrideContentSecurityPolicy = false) const;
+ bool allowFontFromSource(const URL&, bool overrideContentSecurityPolicy = false) const;
+ bool allowMediaFromSource(const URL&, bool overrideContentSecurityPolicy = false) const;
+ bool allowConnectToSource(const URL&, bool overrideContentSecurityPolicy = false) const;
+ bool allowFormAction(const URL&, bool overrideContentSecurityPolicy = false) const;
+ bool allowBaseURI(const URL&, bool overrideContentSecurityPolicy = false) const;
+ bool allowFrameAncestors(const Frame&, const URL&, bool overrideContentSecurityPolicy = false) const;
</ins><span class="cx">
</span><span class="cx"> void setOverrideAllowInlineStyle(bool);
</span><span class="cx">
</span><span class="lines">@@ -112,8 +111,6 @@
</span><span class="cx">
</span><span class="cx"> void gatherReportURIs(DOMStringList&) const;
</span><span class="cx">
</span><del>- String evalDisabledErrorMessage() const;
-
</del><span class="cx"> bool experimentalFeaturesEnabled() const;
</span><span class="cx">
</span><span class="cx"> // The following functions are used by internal data structures to call back into this object when parsing, validating,
</span></span></pre></div>
<a id="trunkSourceWebCorepagecspContentSecurityPolicyDirectiveListcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/csp/ContentSecurityPolicyDirectiveList.cpp (198378 => 198379)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/csp/ContentSecurityPolicyDirectiveList.cpp        2016-03-18 06:12:42 UTC (rev 198378)
+++ trunk/Source/WebCore/page/csp/ContentSecurityPolicyDirectiveList.cpp        2016-03-18 06:32:24 UTC (rev 198379)
</span><span class="lines">@@ -286,26 +286,26 @@
</span><span class="cx"> return denyIfEnforcingPolicy();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool ContentSecurityPolicyDirectiveList::allowJavaScriptURLs(const String& contextURL, const WTF::OrdinalNumber& contextLine, ContentSecurityPolicy::ReportingStatus reportingStatus) const
</del><ins>+bool ContentSecurityPolicyDirectiveList::allowJavaScriptURLs(const String& contextURL, const WTF::OrdinalNumber& contextLine, ReportingStatus reportingStatus) const
</ins><span class="cx"> {
</span><span class="cx"> static NeverDestroyed<String> consoleMessage(ASCIILiteral("Refused to execute JavaScript URL because it violates the following Content Security Policy directive: "));
</span><del>- if (reportingStatus == ContentSecurityPolicy::ReportingStatus::SendReport)
</del><ins>+ if (reportingStatus == ReportingStatus::SendReport)
</ins><span class="cx"> return checkInlineAndReportViolation(operativeDirective(m_scriptSrc.get()), consoleMessage, contextURL, contextLine, true);
</span><span class="cx"> return m_reportOnly || checkInline(operativeDirective(m_scriptSrc.get()));
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool ContentSecurityPolicyDirectiveList::allowInlineEventHandlers(const String& contextURL, const WTF::OrdinalNumber& contextLine, ContentSecurityPolicy::ReportingStatus reportingStatus) const
</del><ins>+bool ContentSecurityPolicyDirectiveList::allowInlineEventHandlers(const String& contextURL, const WTF::OrdinalNumber& contextLine, ReportingStatus reportingStatus) const
</ins><span class="cx"> {
</span><span class="cx"> static NeverDestroyed<String> consoleMessage(ASCIILiteral("Refused to execute inline event handler because it violates the following Content Security Policy directive: "));
</span><del>- if (reportingStatus == ContentSecurityPolicy::ReportingStatus::SendReport)
</del><ins>+ if (reportingStatus == ReportingStatus::SendReport)
</ins><span class="cx"> return checkInlineAndReportViolation(operativeDirective(m_scriptSrc.get()), consoleMessage, contextURL, contextLine, true);
</span><span class="cx"> return m_reportOnly || checkInline(operativeDirective(m_scriptSrc.get()));
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool ContentSecurityPolicyDirectiveList::allowInlineScript(const String& contextURL, const WTF::OrdinalNumber& contextLine, ContentSecurityPolicy::ReportingStatus reportingStatus) const
</del><ins>+bool ContentSecurityPolicyDirectiveList::allowInlineScript(const String& contextURL, const WTF::OrdinalNumber& contextLine, ReportingStatus reportingStatus) const
</ins><span class="cx"> {
</span><span class="cx"> static NeverDestroyed<String> consoleMessage(ASCIILiteral("Refused to execute inline script because it violates the following Content Security Policy directive: "));
</span><del>- if (reportingStatus == ContentSecurityPolicy::ReportingStatus::SendReport)
</del><ins>+ if (reportingStatus == ReportingStatus::SendReport)
</ins><span class="cx"> return checkInlineAndReportViolation(operativeDirective(m_scriptSrc.get()), consoleMessage, contextURL, contextLine, true);
</span><span class="cx"> return m_reportOnly || checkInline(operativeDirective(m_scriptSrc.get()));
</span><span class="cx"> }
</span><span class="lines">@@ -320,10 +320,10 @@
</span><span class="cx"> return checkNonce(operativeDirective(m_scriptSrc.get()), nonce);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool ContentSecurityPolicyDirectiveList::allowInlineStyle(const String& contextURL, const WTF::OrdinalNumber& contextLine, ContentSecurityPolicy::ReportingStatus reportingStatus) const
</del><ins>+bool ContentSecurityPolicyDirectiveList::allowInlineStyle(const String& contextURL, const WTF::OrdinalNumber& contextLine, ReportingStatus reportingStatus) const
</ins><span class="cx"> {
</span><span class="cx"> static NeverDestroyed<String> consoleMessage(ASCIILiteral("Refused to apply inline style because it violates the following Content Security Policy directive: "));
</span><del>- if (reportingStatus == ContentSecurityPolicy::ReportingStatus::SendReport)
</del><ins>+ if (reportingStatus == ReportingStatus::SendReport)
</ins><span class="cx"> return checkInlineAndReportViolation(operativeDirective(m_styleSrc.get()), consoleMessage, contextURL, contextLine, false);
</span><span class="cx"> return m_reportOnly || checkInline(operativeDirective(m_styleSrc.get()));
</span><span class="cx"> }
</span><span class="lines">@@ -338,45 +338,45 @@
</span><span class="cx"> return checkNonce(operativeDirective(m_styleSrc.get()), nonce);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool ContentSecurityPolicyDirectiveList::allowEval(JSC::ExecState* state, ContentSecurityPolicy::ReportingStatus reportingStatus) const
</del><ins>+bool ContentSecurityPolicyDirectiveList::allowEval(JSC::ExecState* state, ReportingStatus reportingStatus) const
</ins><span class="cx"> {
</span><span class="cx"> static NeverDestroyed<String> consoleMessage(ASCIILiteral("Refused to evaluate script because it violates the following Content Security Policy directive: "));
</span><del>- if (reportingStatus == ContentSecurityPolicy::ReportingStatus::SendReport)
</del><ins>+ if (reportingStatus == ReportingStatus::SendReport)
</ins><span class="cx"> return checkEvalAndReportViolation(operativeDirective(m_scriptSrc.get()), consoleMessage, String(), WTF::OrdinalNumber::beforeFirst(), state);
</span><span class="cx"> return m_reportOnly || checkEval(operativeDirective(m_scriptSrc.get()));
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool ContentSecurityPolicyDirectiveList::allowPluginType(const String& type, const String& typeAttribute, const URL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const
</del><ins>+bool ContentSecurityPolicyDirectiveList::allowPluginType(const String& type, const String& typeAttribute, const URL& url, ReportingStatus reportingStatus) const
</ins><span class="cx"> {
</span><del>- if (reportingStatus == ContentSecurityPolicy::ReportingStatus::SendReport)
</del><ins>+ if (reportingStatus == ReportingStatus::SendReport)
</ins><span class="cx"> return checkMediaTypeAndReportViolation(m_pluginTypes.get(), type, typeAttribute, "Refused to load '" + url.stringCenterEllipsizedToLength() + "' (MIME type '" + typeAttribute + "') because it violates the following Content Security Policy Directive: ");
</span><span class="cx"> return m_reportOnly || checkMediaType(m_pluginTypes.get(), type, typeAttribute);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool ContentSecurityPolicyDirectiveList::allowScriptFromSource(const URL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const
</del><ins>+bool ContentSecurityPolicyDirectiveList::allowScriptFromSource(const URL& url, ReportingStatus reportingStatus) const
</ins><span class="cx"> {
</span><del>- if (reportingStatus == ContentSecurityPolicy::ReportingStatus::SendReport)
</del><ins>+ if (reportingStatus == ReportingStatus::SendReport)
</ins><span class="cx"> return checkSourceAndReportViolation(operativeDirective(m_scriptSrc.get()), url, scriptSrc);
</span><span class="cx"> return m_reportOnly || checkSource(operativeDirective(m_scriptSrc.get()), url);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool ContentSecurityPolicyDirectiveList::allowObjectFromSource(const URL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const
</del><ins>+bool ContentSecurityPolicyDirectiveList::allowObjectFromSource(const URL& url, ReportingStatus reportingStatus) const
</ins><span class="cx"> {
</span><span class="cx"> if (url.isBlankURL())
</span><span class="cx"> return true;
</span><del>- if (reportingStatus == ContentSecurityPolicy::ReportingStatus::SendReport)
</del><ins>+ if (reportingStatus == ReportingStatus::SendReport)
</ins><span class="cx"> return checkSourceAndReportViolation(operativeDirective(m_objectSrc.get()), url, objectSrc);
</span><span class="cx"> return m_reportOnly || checkSource(operativeDirective(m_objectSrc.get()), url);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool ContentSecurityPolicyDirectiveList::allowChildContextFromSource(const URL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const
</del><ins>+bool ContentSecurityPolicyDirectiveList::allowChildContextFromSource(const URL& url, ReportingStatus reportingStatus) const
</ins><span class="cx"> {
</span><del>- if (reportingStatus == ContentSecurityPolicy::ReportingStatus::SendReport)
</del><ins>+ if (reportingStatus == ReportingStatus::SendReport)
</ins><span class="cx"> return checkSourceAndReportViolation(operativeDirective(m_childSrc.get()), url, childSrc);
</span><span class="cx"> return m_reportOnly || checkSource(operativeDirective(m_childSrc.get()), url);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool ContentSecurityPolicyDirectiveList::allowChildFrameFromSource(const URL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const
</del><ins>+bool ContentSecurityPolicyDirectiveList::allowChildFrameFromSource(const URL& url, ReportingStatus reportingStatus) const
</ins><span class="cx"> {
</span><span class="cx"> if (url.isBlankURL())
</span><span class="cx"> return true;
</span><span class="lines">@@ -384,63 +384,63 @@
</span><span class="cx"> // We must enforce the frame-src directive (if specified) before enforcing the child-src directive for a nested browsing
</span><span class="cx"> // context by <https://w3c.github.io/webappsec-csp/2/#directive-child-src-nested> (29 August 2015).
</span><span class="cx"> ContentSecurityPolicySourceListDirective* directiveToEnforce = operativeDirective(m_frameSrc ? m_frameSrc.get() : m_childSrc.get());
</span><del>- if (reportingStatus == ContentSecurityPolicy::ReportingStatus::SendReport)
</del><ins>+ if (reportingStatus == ReportingStatus::SendReport)
</ins><span class="cx"> return checkSourceAndReportViolation(directiveToEnforce, url, frameSrc);
</span><span class="cx"> return m_reportOnly || checkSource(directiveToEnforce, url);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool ContentSecurityPolicyDirectiveList::allowImageFromSource(const URL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const
</del><ins>+bool ContentSecurityPolicyDirectiveList::allowImageFromSource(const URL& url, ReportingStatus reportingStatus) const
</ins><span class="cx"> {
</span><del>- if (reportingStatus == ContentSecurityPolicy::ReportingStatus::SendReport)
</del><ins>+ if (reportingStatus == ReportingStatus::SendReport)
</ins><span class="cx"> return checkSourceAndReportViolation(operativeDirective(m_imgSrc.get()), url, imgSrc);
</span><span class="cx"> return m_reportOnly || checkSource(operativeDirective(m_imgSrc.get()), url);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool ContentSecurityPolicyDirectiveList::allowStyleFromSource(const URL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const
</del><ins>+bool ContentSecurityPolicyDirectiveList::allowStyleFromSource(const URL& url, ReportingStatus reportingStatus) const
</ins><span class="cx"> {
</span><del>- if (reportingStatus == ContentSecurityPolicy::ReportingStatus::SendReport)
</del><ins>+ if (reportingStatus == ReportingStatus::SendReport)
</ins><span class="cx"> return checkSourceAndReportViolation(operativeDirective(m_styleSrc.get()), url, styleSrc);
</span><span class="cx"> return m_reportOnly || checkSource(operativeDirective(m_styleSrc.get()), url);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool ContentSecurityPolicyDirectiveList::allowFontFromSource(const URL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const
</del><ins>+bool ContentSecurityPolicyDirectiveList::allowFontFromSource(const URL& url, ReportingStatus reportingStatus) const
</ins><span class="cx"> {
</span><del>- if (reportingStatus == ContentSecurityPolicy::ReportingStatus::SendReport)
</del><ins>+ if (reportingStatus == ReportingStatus::SendReport)
</ins><span class="cx"> return checkSourceAndReportViolation(operativeDirective(m_fontSrc.get()), url, fontSrc);
</span><span class="cx"> return m_reportOnly || checkSource(operativeDirective(m_fontSrc.get()), url);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool ContentSecurityPolicyDirectiveList::allowMediaFromSource(const URL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const
</del><ins>+bool ContentSecurityPolicyDirectiveList::allowMediaFromSource(const URL& url, ReportingStatus reportingStatus) const
</ins><span class="cx"> {
</span><del>- if (reportingStatus == ContentSecurityPolicy::ReportingStatus::SendReport)
</del><ins>+ if (reportingStatus == ReportingStatus::SendReport)
</ins><span class="cx"> return checkSourceAndReportViolation(operativeDirective(m_mediaSrc.get()), url, mediaSrc);
</span><span class="cx"> return m_reportOnly || checkSource(operativeDirective(m_mediaSrc.get()), url);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool ContentSecurityPolicyDirectiveList::allowConnectToSource(const URL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const
</del><ins>+bool ContentSecurityPolicyDirectiveList::allowConnectToSource(const URL& url, ReportingStatus reportingStatus) const
</ins><span class="cx"> {
</span><del>- if (reportingStatus == ContentSecurityPolicy::ReportingStatus::SendReport)
</del><ins>+ if (reportingStatus == ReportingStatus::SendReport)
</ins><span class="cx"> return checkSourceAndReportViolation(operativeDirective(m_connectSrc.get()), url, connectSrc);
</span><span class="cx"> return m_reportOnly || checkSource(operativeDirective(m_connectSrc.get()), url);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool ContentSecurityPolicyDirectiveList::allowFormAction(const URL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const
</del><ins>+bool ContentSecurityPolicyDirectiveList::allowFormAction(const URL& url, ReportingStatus reportingStatus) const
</ins><span class="cx"> {
</span><del>- if (reportingStatus == ContentSecurityPolicy::ReportingStatus::SendReport)
</del><ins>+ if (reportingStatus == ReportingStatus::SendReport)
</ins><span class="cx"> return checkSourceAndReportViolation(m_formAction.get(), url, formAction);
</span><span class="cx"> return m_reportOnly || checkSource(m_formAction.get(), url);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool ContentSecurityPolicyDirectiveList::allowBaseURI(const URL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const
</del><ins>+bool ContentSecurityPolicyDirectiveList::allowBaseURI(const URL& url, ReportingStatus reportingStatus) const
</ins><span class="cx"> {
</span><del>- if (reportingStatus == ContentSecurityPolicy::ReportingStatus::SendReport)
</del><ins>+ if (reportingStatus == ReportingStatus::SendReport)
</ins><span class="cx"> return checkSourceAndReportViolation(m_baseURI.get(), url, baseURI);
</span><span class="cx"> return m_reportOnly || checkSource(m_baseURI.get(), url);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool ContentSecurityPolicyDirectiveList::allowFrameAncestors(const Frame& frame, const URL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const
</del><ins>+bool ContentSecurityPolicyDirectiveList::allowFrameAncestors(const Frame& frame, const URL& url, ReportingStatus reportingStatus) const
</ins><span class="cx"> {
</span><del>- if (reportingStatus == ContentSecurityPolicy::ReportingStatus::SendReport)
</del><ins>+ if (reportingStatus == ReportingStatus::SendReport)
</ins><span class="cx"> return checkFrameAncestorsAndReportViolation(m_frameAncestors.get(), frame, url, frameAncestors);
</span><span class="cx"> return m_reportOnly || checkFrameAncestors(m_frameAncestors.get(), frame);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorepagecspContentSecurityPolicyDirectiveListh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/csp/ContentSecurityPolicyDirectiveList.h (198378 => 198379)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/csp/ContentSecurityPolicyDirectiveList.h        2016-03-18 06:12:42 UTC (rev 198378)
+++ trunk/Source/WebCore/page/csp/ContentSecurityPolicyDirectiveList.h        2016-03-18 06:32:24 UTC (rev 198379)
</span><span class="lines">@@ -48,30 +48,34 @@
</span><span class="cx"> const String& header() const { return m_header; }
</span><span class="cx"> ContentSecurityPolicyHeaderType headerType() const { return m_headerType; }
</span><span class="cx">
</span><del>- bool allowJavaScriptURLs(const String& contextURL, const WTF::OrdinalNumber& contextLine, ContentSecurityPolicy::ReportingStatus) const;
- bool allowInlineEventHandlers(const String& contextURL, const WTF::OrdinalNumber& contextLine, ContentSecurityPolicy::ReportingStatus) const;
- bool allowInlineScript(const String& contextURL, const WTF::OrdinalNumber& contextLine, ContentSecurityPolicy::ReportingStatus) const;
</del><ins>+ enum class ReportingStatus {
+ SendReport,
+ SuppressReport
+ };
+ bool allowJavaScriptURLs(const String& contextURL, const WTF::OrdinalNumber& contextLine, ReportingStatus) const;
+ bool allowInlineEventHandlers(const String& contextURL, const WTF::OrdinalNumber& contextLine, ReportingStatus) const;
+ bool allowInlineScript(const String& contextURL, const WTF::OrdinalNumber& contextLine, ReportingStatus) const;
</ins><span class="cx"> bool allowInlineScriptWithHash(const ContentSecurityPolicyHash&) const;
</span><span class="cx"> bool allowScriptWithNonce(const String& nonce) const;
</span><del>- bool allowInlineStyle(const String& contextURL, const WTF::OrdinalNumber& contextLine, ContentSecurityPolicy::ReportingStatus) const;
</del><ins>+ bool allowInlineStyle(const String& contextURL, const WTF::OrdinalNumber& contextLine, ReportingStatus) const;
</ins><span class="cx"> bool allowInlineStyleWithHash(const ContentSecurityPolicyHash&) const;
</span><span class="cx"> bool allowStyleWithNonce(const String& nonce) const;
</span><del>- bool allowEval(JSC::ExecState*, ContentSecurityPolicy::ReportingStatus) const;
- bool allowPluginType(const String& type, const String& typeAttribute, const URL&, ContentSecurityPolicy::ReportingStatus) const;
</del><ins>+ bool allowEval(JSC::ExecState*, ReportingStatus) const;
+ bool allowPluginType(const String& type, const String& typeAttribute, const URL&, ReportingStatus) const;
</ins><span class="cx">
</span><del>- bool allowScriptFromSource(const URL&, ContentSecurityPolicy::ReportingStatus) const;
- bool allowObjectFromSource(const URL&, ContentSecurityPolicy::ReportingStatus) const;
- bool allowChildFrameFromSource(const URL&, ContentSecurityPolicy::ReportingStatus) const;
- bool allowChildContextFromSource(const URL&, ContentSecurityPolicy::ReportingStatus) const;
- bool allowImageFromSource(const URL&, ContentSecurityPolicy::ReportingStatus) const;
- bool allowStyleFromSource(const URL&, ContentSecurityPolicy::ReportingStatus) const;
- bool allowFontFromSource(const URL&, ContentSecurityPolicy::ReportingStatus) const;
- bool allowMediaFromSource(const URL&, ContentSecurityPolicy::ReportingStatus) const;
- bool allowConnectToSource(const URL&, ContentSecurityPolicy::ReportingStatus) const;
- bool allowFormAction(const URL&, ContentSecurityPolicy::ReportingStatus) const;
- bool allowBaseURI(const URL&, ContentSecurityPolicy::ReportingStatus) const;
</del><ins>+ bool allowScriptFromSource(const URL&, ReportingStatus) const;
+ bool allowObjectFromSource(const URL&, ReportingStatus) const;
+ bool allowChildFrameFromSource(const URL&, ReportingStatus) const;
+ bool allowChildContextFromSource(const URL&, ReportingStatus) const;
+ bool allowImageFromSource(const URL&, ReportingStatus) const;
+ bool allowStyleFromSource(const URL&, ReportingStatus) const;
+ bool allowFontFromSource(const URL&, ReportingStatus) const;
+ bool allowMediaFromSource(const URL&, ReportingStatus) const;
+ bool allowConnectToSource(const URL&, ReportingStatus) const;
+ bool allowFormAction(const URL&, ReportingStatus) const;
+ bool allowBaseURI(const URL&, ReportingStatus) const;
</ins><span class="cx">
</span><del>- bool allowFrameAncestors(const Frame&, const URL&, ContentSecurityPolicy::ReportingStatus) const;
</del><ins>+ bool allowFrameAncestors(const Frame&, const URL&, ReportingStatus) const;
</ins><span class="cx">
</span><span class="cx"> const String& evalDisabledErrorMessage() const { return m_evalDisabledErrorMessage; }
</span><span class="cx"> ContentSecurityPolicy::ReflectedXSSDisposition reflectedXSSDisposition() const { return m_reflectedXSSDisposition; }
</span></span></pre>
</div>
</div>
</body>
</html>