<!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>[199538] trunk</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/199538">199538</a></dd>
<dt>Author</dt> <dd>dbates@webkit.org</dd>
<dt>Date</dt> <dd>2016-04-14 09:48:05 -0700 (Thu, 14 Apr 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>CSP: Ignore report-only policy delivered via meta element
https://bugs.webkit.org/show_bug.cgi?id=156565
&lt;rdar://problem/25718167&gt;

Reviewed by Brent Fulgham.

Source/WebCore:

Only honor a report-only policy delivered via the HTTP header Content-Security-Policy-Report-Only
or X-WebKit-CSP-Report-Only as per section Content-Security-Policy-Report-Only Header Field of
the Content Security Policy Level 2 spec., &lt;https://w3c.github.io/webappsec-csp/2/&gt; (Editor's Draft, 29 August 2015).

Currently we honor a report-only policy delivered via a meta element or an HTTP header. Instead
we should only honor such a policy when delivered via an HTTP header.

Tests: http/tests/security/contentSecurityPolicy/1.1/reportonly-in-meta-ignored2.html
       http/tests/security/contentSecurityPolicy/eval-allowed-in-report-only-mode-and-sends-report.php
       http/tests/security/contentSecurityPolicy/eval-allowed-in-report-only-mode.php
       http/tests/security/contentSecurityPolicy/report-multiple-violations-01.php
       http/tests/security/contentSecurityPolicy/report-multiple-violations-02.php
       http/tests/security/contentSecurityPolicy/report-only-report-uri-missing.php

* dom/Document.cpp:
(WebCore::Document::processHttpEquiv): Do not process policy for HTTP equivalent header
Content-Security-Policy-Report-Only and X-WebKit-CSP-Report-Only.

LayoutTests:

Add new test LayoutTests/http/tests/security/contentSecurityPolicy/1.1/reportonly-in-meta-ignored2.html
to ensure that we ignore X-WebKit-CSP-Report-Only when delivered via a meta element.

Rename test report-multiple-violations-0{1, 2}.html and eval-allowed-in-report-only-mode-and-sends-report.html
to report-multiple-violations-0{1, 2}.php and eval-allowed-in-report-only-mode-and-sends-report.php, respectively,
so that we can make use of PHP to deliver the report-only policy via an HTTP header instead of via a meta element
as the latter is no longer supported. Additionally, fix up code style in some tests to make them more
consistent with the code style we use for tests.

* TestExpectations: Update some entries due to renaming and mark tests reportonly-in-meta-ignored.html
and reportonly-in-meta-ignored2.html as PASS so that we run them.
* http/tests/security/contentSecurityPolicy/1.1/reportonly-in-meta-ignored-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/reportonly-in-meta-ignored.html:
* http/tests/security/contentSecurityPolicy/1.1/reportonly-in-meta-ignored2-expected.txt: Added.
* http/tests/security/contentSecurityPolicy/1.1/reportonly-in-meta-ignored2.html: Added.
* http/tests/security/contentSecurityPolicy/eval-allowed-in-report-only-mode-and-sends-report.php: Renamed from LayoutTests/http/tests/security/contentSecurityPolicy/eval-allowed-in-report-only-mode-and-sends-report.html.
* http/tests/security/contentSecurityPolicy/eval-allowed-in-report-only-mode-expected.txt:
* http/tests/security/contentSecurityPolicy/eval-allowed-in-report-only-mode.php: Renamed from LayoutTests/http/tests/security/contentSecurityPolicy/eval-allowed-in-report-only-mode.html.
* http/tests/security/contentSecurityPolicy/report-multiple-violations-01.php: Renamed from LayoutTests/http/tests/security/contentSecurityPolicy/report-multiple-violations-01.html.
* http/tests/security/contentSecurityPolicy/report-multiple-violations-02.php: Renamed from LayoutTests/http/tests/security/contentSecurityPolicy/report-multiple-violations-02.html.
* http/tests/security/contentSecurityPolicy/report-only-report-uri-missing.html: Removed.
* http/tests/security/contentSecurityPolicy/report-only-report-uri-missing.php: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsTestExpectations">trunk/LayoutTests/TestExpectations</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritycontentSecurityPolicy11reportonlyinmetaignoredexpectedtxt">trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/reportonly-in-meta-ignored-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritycontentSecurityPolicy11reportonlyinmetaignoredhtml">trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/reportonly-in-meta-ignored.html</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritycontentSecurityPolicyevalallowedinreportonlymodeexpectedtxt">trunk/LayoutTests/http/tests/security/contentSecurityPolicy/eval-allowed-in-report-only-mode-expected.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoredomDocumentcpp">trunk/Source/WebCore/dom/Document.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestshttptestssecuritycontentSecurityPolicy11reportonlyinmetaignored2expectedtxt">trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/reportonly-in-meta-ignored2-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritycontentSecurityPolicy11reportonlyinmetaignored2html">trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/reportonly-in-meta-ignored2.html</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritycontentSecurityPolicyevalallowedinreportonlymodeandsendsreportphp">trunk/LayoutTests/http/tests/security/contentSecurityPolicy/eval-allowed-in-report-only-mode-and-sends-report.php</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritycontentSecurityPolicyevalallowedinreportonlymodephp">trunk/LayoutTests/http/tests/security/contentSecurityPolicy/eval-allowed-in-report-only-mode.php</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritycontentSecurityPolicyreportmultipleviolations01php">trunk/LayoutTests/http/tests/security/contentSecurityPolicy/report-multiple-violations-01.php</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritycontentSecurityPolicyreportmultipleviolations02php">trunk/LayoutTests/http/tests/security/contentSecurityPolicy/report-multiple-violations-02.php</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritycontentSecurityPolicyreportonlyreporturimissingphp">trunk/LayoutTests/http/tests/security/contentSecurityPolicy/report-only-report-uri-missing.php</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkLayoutTestshttptestssecuritycontentSecurityPolicyevalallowedinreportonlymodeandsendsreporthtml">trunk/LayoutTests/http/tests/security/contentSecurityPolicy/eval-allowed-in-report-only-mode-and-sends-report.html</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritycontentSecurityPolicyevalallowedinreportonlymodehtml">trunk/LayoutTests/http/tests/security/contentSecurityPolicy/eval-allowed-in-report-only-mode.html</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritycontentSecurityPolicyreportmultipleviolations01html">trunk/LayoutTests/http/tests/security/contentSecurityPolicy/report-multiple-violations-01.html</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritycontentSecurityPolicyreportmultipleviolations02html">trunk/LayoutTests/http/tests/security/contentSecurityPolicy/report-multiple-violations-02.html</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritycontentSecurityPolicyreportonlyreporturimissinghtml">trunk/LayoutTests/http/tests/security/contentSecurityPolicy/report-only-report-uri-missing.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (199537 => 199538)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-04-14 14:08:33 UTC (rev 199537)
+++ trunk/LayoutTests/ChangeLog        2016-04-14 16:48:05 UTC (rev 199538)
</span><span class="lines">@@ -1,3 +1,34 @@
</span><ins>+2016-04-14  Daniel Bates  &lt;dabates@apple.com&gt;
+
+        CSP: Ignore report-only policy delivered via meta element
+        https://bugs.webkit.org/show_bug.cgi?id=156565
+        &lt;rdar://problem/25718167&gt;
+
+        Reviewed by Brent Fulgham.
+
+        Add new test LayoutTests/http/tests/security/contentSecurityPolicy/1.1/reportonly-in-meta-ignored2.html
+        to ensure that we ignore X-WebKit-CSP-Report-Only when delivered via a meta element.
+
+        Rename test report-multiple-violations-0{1, 2}.html and eval-allowed-in-report-only-mode-and-sends-report.html
+        to report-multiple-violations-0{1, 2}.php and eval-allowed-in-report-only-mode-and-sends-report.php, respectively,
+        so that we can make use of PHP to deliver the report-only policy via an HTTP header instead of via a meta element
+        as the latter is no longer supported. Additionally, fix up code style in some tests to make them more
+        consistent with the code style we use for tests.
+
+        * TestExpectations: Update some entries due to renaming and mark tests reportonly-in-meta-ignored.html
+        and reportonly-in-meta-ignored2.html as PASS so that we run them.
+        * http/tests/security/contentSecurityPolicy/1.1/reportonly-in-meta-ignored-expected.txt:
+        * http/tests/security/contentSecurityPolicy/1.1/reportonly-in-meta-ignored.html:
+        * http/tests/security/contentSecurityPolicy/1.1/reportonly-in-meta-ignored2-expected.txt: Added.
+        * http/tests/security/contentSecurityPolicy/1.1/reportonly-in-meta-ignored2.html: Added.
+        * http/tests/security/contentSecurityPolicy/eval-allowed-in-report-only-mode-and-sends-report.php: Renamed from LayoutTests/http/tests/security/contentSecurityPolicy/eval-allowed-in-report-only-mode-and-sends-report.html.
+        * http/tests/security/contentSecurityPolicy/eval-allowed-in-report-only-mode-expected.txt:
+        * http/tests/security/contentSecurityPolicy/eval-allowed-in-report-only-mode.php: Renamed from LayoutTests/http/tests/security/contentSecurityPolicy/eval-allowed-in-report-only-mode.html.
+        * http/tests/security/contentSecurityPolicy/report-multiple-violations-01.php: Renamed from LayoutTests/http/tests/security/contentSecurityPolicy/report-multiple-violations-01.html.
+        * http/tests/security/contentSecurityPolicy/report-multiple-violations-02.php: Renamed from LayoutTests/http/tests/security/contentSecurityPolicy/report-multiple-violations-02.html.
+        * http/tests/security/contentSecurityPolicy/report-only-report-uri-missing.html: Removed.
+        * http/tests/security/contentSecurityPolicy/report-only-report-uri-missing.php: Added.
+
</ins><span class="cx"> 2016-04-14  Antoine Quint  &lt;graouts@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         WebGL based canvases composite incorrectly after changing size
</span></span></pre></div>
<a id="trunkLayoutTestsTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/TestExpectations (199537 => 199538)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/TestExpectations        2016-04-14 14:08:33 UTC (rev 199537)
+++ trunk/LayoutTests/TestExpectations        2016-04-14 16:48:05 UTC (rev 199538)
</span><span class="lines">@@ -819,6 +819,8 @@
</span><span class="cx"> http/tests/security/contentSecurityPolicy/1.1/base-uri-default-ignored.html [ Pass ]
</span><span class="cx"> http/tests/security/contentSecurityPolicy/1.1/base-uri-deny.html [ Pass ]
</span><span class="cx"> http/tests/security/contentSecurityPolicy/1.1/report-uri-effective-directive.php [ Pass ]
</span><ins>+http/tests/security/contentSecurityPolicy/1.1/reportonly-in-meta-ignored.html [ Pass ]
+http/tests/security/contentSecurityPolicy/1.1/reportonly-in-meta-ignored2.html [ Pass ]
</ins><span class="cx"> http/tests/security/contentSecurityPolicy/1.1/scripthash-allowed.html [ Pass ]
</span><span class="cx"> http/tests/security/contentSecurityPolicy/1.1/scripthash-basic-blocked.html [ Pass ]
</span><span class="cx"> http/tests/security/contentSecurityPolicy/1.1/scripthash-default-src.html [ Pass ]
</span><span class="lines">@@ -860,7 +862,7 @@
</span><span class="cx"> http/tests/security/contentSecurityPolicy/1.1/plugintypes-url-02.html [ Pass ]
</span><span class="cx"> webkit.org/b/154203 http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-overrides-xfo.html
</span><span class="cx"> webkit.org/b/111869 http/tests/security/contentSecurityPolicy/eval-blocked-and-sends-report.html
</span><del>-webkit.org/b/153148 http/tests/security/contentSecurityPolicy/eval-allowed-in-report-only-mode-and-sends-report.html
</del><ins>+webkit.org/b/153148 http/tests/security/contentSecurityPolicy/eval-allowed-in-report-only-mode-and-sends-report.php
</ins><span class="cx"> webkit.org/b/153150 http/tests/security/contentSecurityPolicy/frame-src-cross-origin-load.html
</span><span class="cx"> webkit.org/b/153150 http/tests/security/contentSecurityPolicy/1.1/child-src/frame-fires-load-event-when-blocked.html
</span><span class="cx"> webkit.org/b/153150 http/tests/security/contentSecurityPolicy/1.1/child-src/frame-fires-load-event-when-redirect-blocked.html
</span><span class="lines">@@ -879,8 +881,8 @@
</span><span class="cx"> webkit.org/b/153160 http/tests/security/contentSecurityPolicy/object-src-does-not-affect-child.html [ Failure ]
</span><span class="cx"> webkit.org/b/153160 http/tests/security/contentSecurityPolicy/plugin-in-iframe-with-csp.html [ Failure ]
</span><span class="cx"> webkit.org/b/153161 http/tests/security/contentSecurityPolicy/register-bypassing-scheme-partial.html [ Failure ]
</span><del>-webkit.org/b/153162 http/tests/security/contentSecurityPolicy/report-multiple-violations-01.html [ Failure ]
-webkit.org/b/153162 http/tests/security/contentSecurityPolicy/report-multiple-violations-02.html [ Failure ]
</del><ins>+webkit.org/b/153162 http/tests/security/contentSecurityPolicy/report-multiple-violations-01.php [ Failure ]
+webkit.org/b/153162 http/tests/security/contentSecurityPolicy/report-multiple-violations-02.php [ Failure ]
</ins><span class="cx"> webkit.org/b/154522 http/tests/security/contentSecurityPolicy/1.1/securitypolicyviolation-base-uri-deny.html
</span><span class="cx"> webkit.org/b/155132 http/tests/security/contentSecurityPolicy/video-with-https-url-allowed-by-csp-media-src-star.html [ Failure ]
</span><span class="cx"> http/tests/security/contentSecurityPolicy/script-src-blocked-error-event.html [ Pass Failure ]
</span></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritycontentSecurityPolicy11reportonlyinmetaignoredexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/reportonly-in-meta-ignored-expected.txt (199537 => 199538)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/reportonly-in-meta-ignored-expected.txt        2016-04-14 14:08:33 UTC (rev 199537)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/reportonly-in-meta-ignored-expected.txt        2016-04-14 16:48:05 UTC (rev 199538)
</span><span class="lines">@@ -1,2 +1 @@
</span><del>-CONSOLE MESSAGE: line 4: The report-only Content Security Policy 'this-should-be-ignored' was delivered via a &lt;meta&gt; element, which is disallowed. The policy has been ignored.
-This tests that report-only Content Security Policy headers are ignored if contained in meta elements.
</del><ins>+This tests that a Content-Security-Policy-Report-Only header is ignored if delivered in a meta element. This test PASSED if there are no console warnings.
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritycontentSecurityPolicy11reportonlyinmetaignoredhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/reportonly-in-meta-ignored.html (199537 => 199538)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/reportonly-in-meta-ignored.html        2016-04-14 14:08:33 UTC (rev 199537)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/reportonly-in-meta-ignored.html        2016-04-14 16:48:05 UTC (rev 199538)
</span><span class="lines">@@ -1,13 +1,13 @@
</span><span class="cx"> &lt;!DOCTYPE html&gt;
</span><span class="cx"> &lt;html&gt;
</span><span class="cx"> &lt;head&gt;
</span><del>-    &lt;meta http-equiv=&quot;Content-Security-Policy-Report-Only&quot; content=&quot;this-should-be-ignored&quot;&gt;
-    &lt;script&gt;
-        if (window.testRunner)
-            testRunner.dumpAsText();
-    &lt;/script&gt;
</del><ins>+&lt;meta http-equiv=&quot;Content-Security-Policy-Report-Only&quot; content=&quot;script-src 'none'&quot;&gt;
+&lt;script&gt;
+if (window.testRunner)
+    testRunner.dumpAsText();
+&lt;/script&gt;
</ins><span class="cx"> &lt;/head&gt;
</span><span class="cx"> &lt;body&gt;
</span><del>-    &lt;p&gt;This tests that report-only Content Security Policy headers are ignored if contained in meta elements.&lt;/p&gt;
</del><ins>+&lt;p&gt;This tests that a Content-Security-Policy-Report-Only header is ignored if delivered in a meta element. This test PASSED if there are no console warnings.&lt;/p&gt;
</ins><span class="cx"> &lt;/body&gt;
</span><span class="cx"> &lt;/html&gt;
</span></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritycontentSecurityPolicy11reportonlyinmetaignored2expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/reportonly-in-meta-ignored2-expected.txt (0 => 199538)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/reportonly-in-meta-ignored2-expected.txt                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/reportonly-in-meta-ignored2-expected.txt        2016-04-14 16:48:05 UTC (rev 199538)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+This tests that an X-WebKit-CSP-Report-Only header is ignored if delivered in a meta element. This test PASSED if there are no console warnings.
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritycontentSecurityPolicy11reportonlyinmetaignored2html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/reportonly-in-meta-ignored2.html (0 => 199538)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/reportonly-in-meta-ignored2.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/reportonly-in-meta-ignored2.html        2016-04-14 16:48:05 UTC (rev 199538)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;meta http-equiv=&quot;X-WebKit-CSP-Report-Only&quot; content=&quot;script-src 'none'&quot;&gt;
+&lt;script&gt;
+if (window.testRunner)
+    testRunner.dumpAsText();
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;p&gt;This tests that an X-WebKit-CSP-Report-Only header is ignored if delivered in a meta element. This test PASSED if there are no console warnings.&lt;/p&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritycontentSecurityPolicyevalallowedinreportonlymodeandsendsreporthtml"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/eval-allowed-in-report-only-mode-and-sends-report.html (199537 => 199538)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/eval-allowed-in-report-only-mode-and-sends-report.html        2016-04-14 14:08:33 UTC (rev 199537)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/eval-allowed-in-report-only-mode-and-sends-report.html        2016-04-14 16:48:05 UTC (rev 199538)
</span><span class="lines">@@ -1,16 +0,0 @@
</span><del>-&lt;!DOCTYPE html&gt;
-&lt;html&gt;
-&lt;head&gt;
-    &lt;meta http-equiv=&quot;Content-Security-Policy-Report-Only&quot; content=&quot;script-src 'self' 'unsafe-inline'; report-uri resources/save-report.php&quot;&gt;
-&lt;/head&gt;
-&lt;body&gt;
-    &lt;script&gt;
-        try {
-            eval(&quot;alert('PASS: eval() allowed!')&quot;);
-        } catch (e) {
-            console.log('FAIL: eval() blocked!');
-        }
-    &lt;/script&gt;
-    &lt;script src=&quot;resources/go-to-echo-report.js&quot;&gt;&lt;/script&gt;
-&lt;/body&gt;
-&lt;/html&gt;
</del></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritycontentSecurityPolicyevalallowedinreportonlymodeandsendsreportphp"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/eval-allowed-in-report-only-mode-and-sends-report.php (0 => 199538)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/eval-allowed-in-report-only-mode-and-sends-report.php                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/eval-allowed-in-report-only-mode-and-sends-report.php        2016-04-14 16:48:05 UTC (rev 199538)
</span><span class="lines">@@ -0,0 +1,16 @@
</span><ins>+&lt;?php
+header(&quot;Content-Security-Policy-Report-Only: script-src 'self' 'unsafe-inline'; report-uri resources/save-report.php&quot;);
+?&gt;
+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;body&gt;
+&lt;script&gt;
+try {
+    eval(&quot;alert('PASS: eval() allowed!')&quot;);
+} catch (e) {
+    console.log(&quot;FAIL: eval() blocked!&quot;);
+}
+&lt;/script&gt;
+&lt;script src=&quot;resources/go-to-echo-report.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritycontentSecurityPolicyevalallowedinreportonlymodeexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/eval-allowed-in-report-only-mode-expected.txt (199537 => 199538)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/eval-allowed-in-report-only-mode-expected.txt        2016-04-14 14:08:33 UTC (rev 199537)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/eval-allowed-in-report-only-mode-expected.txt        2016-04-14 16:48:05 UTC (rev 199538)
</span><span class="lines">@@ -1,4 +1,4 @@
</span><span class="cx"> CONSOLE MESSAGE: The Content Security Policy 'script-src 'self'' was delivered in report-only mode, but does not specify a 'report-uri'; the policy will have no effect. Please either add a 'report-uri' directive, or deliver the policy via the 'Content-Security-Policy' header.
</span><del>-CONSOLE MESSAGE: line 7: [Report Only] Refused to execute a script because its hash, its nonce, or 'unsafe-inline' does not appear in the script-src directive of the Content Security Policy.
</del><ins>+CONSOLE MESSAGE: line 4: [Report Only] Refused to execute a script because its hash, its nonce, or 'unsafe-inline' does not appear in the script-src directive of the Content Security Policy.
</ins><span class="cx"> ALERT: PASS: eval() executed as expected.
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritycontentSecurityPolicyevalallowedinreportonlymodehtml"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/eval-allowed-in-report-only-mode.html (199537 => 199538)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/eval-allowed-in-report-only-mode.html        2016-04-14 14:08:33 UTC (rev 199537)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/eval-allowed-in-report-only-mode.html        2016-04-14 16:48:05 UTC (rev 199538)
</span><span class="lines">@@ -1,14 +0,0 @@
</span><del>-&lt;!DOCTYPE html&gt;
-&lt;html&gt;
-&lt;head&gt;
-    &lt;meta http-equiv=&quot;Content-Security-Policy-Report-Only&quot; content=&quot;script-src 'self'&quot;&gt;
-&lt;/head&gt;
-&lt;body&gt;
-    &lt;script&gt;
-        if (window.testRunner)
-            testRunner.dumpAsText();
-
-        eval(&quot;alert('PASS: eval() executed as expected.');&quot;);
-    &lt;/script&gt;
-&lt;/body&gt;
-&lt;/html&gt;
</del></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritycontentSecurityPolicyevalallowedinreportonlymodephp"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/eval-allowed-in-report-only-mode.php (0 => 199538)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/eval-allowed-in-report-only-mode.php                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/eval-allowed-in-report-only-mode.php        2016-04-14 16:48:05 UTC (rev 199538)
</span><span class="lines">@@ -0,0 +1,14 @@
</span><ins>+&lt;?php
+header(&quot;Content-Security-Policy-Report-Only: script-src 'self'&quot;);
+?&gt;
+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;body&gt;
+&lt;script&gt;
+if (window.testRunner)
+    testRunner.dumpAsText();
+
+eval(&quot;alert('PASS: eval() executed as expected.');&quot;);
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritycontentSecurityPolicyreportmultipleviolations01html"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/report-multiple-violations-01.html (199537 => 199538)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/report-multiple-violations-01.html        2016-04-14 14:08:33 UTC (rev 199537)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/report-multiple-violations-01.html        2016-04-14 16:48:05 UTC (rev 199538)
</span><span class="lines">@@ -1,12 +0,0 @@
</span><del>-&lt;!DOCTYPE html&gt;
-&lt;html&gt;
-&lt;head&gt;
-    &lt;meta http-equiv=&quot;Content-Security-Policy-Report-Only&quot; content=&quot;img-src 'none'; report-uri resources/does-not-exist&quot;&gt;
-&lt;/head&gt;
-&lt;body&gt;
-    &lt;p&gt;This tests that multiple violations on a page trigger multiple reports.
-    The test passes if two PingLoader callbacks are visible in the output.&lt;/p&gt;
-    &lt;img src=&quot;../resources/abe.png&quot;&gt;
-    &lt;img src=&quot;../resources/eba.png&quot;&gt;
-&lt;/body&gt;
-&lt;/html&gt;
</del></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritycontentSecurityPolicyreportmultipleviolations01php"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/report-multiple-violations-01.php (0 => 199538)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/report-multiple-violations-01.php                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/report-multiple-violations-01.php        2016-04-14 16:48:05 UTC (rev 199538)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+&lt;?php
+header(&quot;Content-Security-Policy-Report-Only: img-src 'none'; report-uri resources/does-not-exist&quot;);
+?&gt;
+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;body&gt;
+&lt;p&gt;This tests that multiple violations on a page trigger multiple reports.
+The test passes if two PingLoader callbacks are visible in the output.&lt;/p&gt;
+&lt;img src=&quot;../resources/abe.png&quot;&gt;
+&lt;img src=&quot;../resources/eba.png&quot;&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritycontentSecurityPolicyreportmultipleviolations02html"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/report-multiple-violations-02.html (199537 => 199538)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/report-multiple-violations-02.html        2016-04-14 14:08:33 UTC (rev 199537)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/report-multiple-violations-02.html        2016-04-14 16:48:05 UTC (rev 199538)
</span><span class="lines">@@ -1,15 +0,0 @@
</span><del>-&lt;!DOCTYPE html&gt;
-&lt;html&gt;
-&lt;head&gt;
-    &lt;meta http-equiv=&quot;Content-Security-Policy-Report-Only&quot; content=&quot;script-src 'unsafe-inline' 'self'; report-uri resources/does-not-exist&quot;&gt;
-&lt;/head&gt;
-&lt;body&gt;
-    &lt;p&gt;This tests that multiple violations on a page trigger multiple reports
-    if and only if the violations are distinct. This test passes if only one.
-    PingLoader callback is visible in the output.&lt;/p&gt;
-    &lt;script&gt;
-        for (var i = 0; i&lt;5; i++)
-            setTimeout(&quot;alert('PASS: setTimeout #&quot; + i + &quot; executed.');&quot;, 0);
-    &lt;/script&gt;
-&lt;/body&gt;
-&lt;/html&gt;
</del></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritycontentSecurityPolicyreportmultipleviolations02php"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/report-multiple-violations-02.php (0 => 199538)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/report-multiple-violations-02.php                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/report-multiple-violations-02.php        2016-04-14 16:48:05 UTC (rev 199538)
</span><span class="lines">@@ -0,0 +1,15 @@
</span><ins>+&lt;?php
+header(&quot;Content-Security-Policy-Report-Only: script-src 'unsafe-inline' 'self'; report-uri resources/does-not-exist&quot;);
+?&gt;
+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;body&gt;
+&lt;p&gt;This tests that multiple violations on a page trigger multiple reports
+if and only if the violations are distinct. This test passes if only one.
+PingLoader callback is visible in the output.&lt;/p&gt;
+&lt;script&gt;
+for (var i = 0; i&lt; 5; i++)
+    setTimeout(&quot;alert('PASS: setTimeout #&quot; + i + &quot; executed.');&quot;, 0);
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritycontentSecurityPolicyreportonlyreporturimissinghtml"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/report-only-report-uri-missing.html (199537 => 199538)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/report-only-report-uri-missing.html        2016-04-14 14:08:33 UTC (rev 199537)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/report-only-report-uri-missing.html        2016-04-14 16:48:05 UTC (rev 199538)
</span><span class="lines">@@ -1,13 +0,0 @@
</span><del>-&lt;!DOCTYPE html&gt;
-&lt;html&gt;
-&lt;head&gt;
-    &lt;meta http-equiv=&quot;Content-Security-Policy-Report-Only&quot; content=&quot;script-src 'unsafe-inline';&quot;&gt;
-    &lt;script&gt;
-        if (window.testRunner)
-            testRunner.dumpAsText();
-    &lt;/script&gt;
-&lt;/head&gt;
-&lt;body&gt;
-    &lt;p&gt;This test passes if a console message is present, warning about the missing 'report-uri' directive.&lt;/p&gt;
-&lt;/body&gt;
-&lt;/html&gt;
</del></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritycontentSecurityPolicyreportonlyreporturimissingphp"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/report-only-report-uri-missing.php (0 => 199538)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/report-only-report-uri-missing.php                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/report-only-report-uri-missing.php        2016-04-14 16:48:05 UTC (rev 199538)
</span><span class="lines">@@ -0,0 +1,15 @@
</span><ins>+&lt;?php
+header(&quot;Content-Security-Policy-Report-Only: script-src 'unsafe-inline';&quot;);
+?&gt;
+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script&gt;
+if (window.testRunner)
+    testRunner.dumpAsText();
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;p&gt;This test passes if a console message is present, warning about the missing 'report-uri' directive.&lt;/p&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (199537 => 199538)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-04-14 14:08:33 UTC (rev 199537)
+++ trunk/Source/WebCore/ChangeLog        2016-04-14 16:48:05 UTC (rev 199538)
</span><span class="lines">@@ -1,3 +1,29 @@
</span><ins>+2016-04-14  Daniel Bates  &lt;dabates@apple.com&gt;
+
+        CSP: Ignore report-only policy delivered via meta element
+        https://bugs.webkit.org/show_bug.cgi?id=156565
+        &lt;rdar://problem/25718167&gt;
+
+        Reviewed by Brent Fulgham.
+
+        Only honor a report-only policy delivered via the HTTP header Content-Security-Policy-Report-Only
+        or X-WebKit-CSP-Report-Only as per section Content-Security-Policy-Report-Only Header Field of 
+        the Content Security Policy Level 2 spec., &lt;https://w3c.github.io/webappsec-csp/2/&gt; (Editor's Draft, 29 August 2015).
+
+        Currently we honor a report-only policy delivered via a meta element or an HTTP header. Instead
+        we should only honor such a policy when delivered via an HTTP header.
+
+        Tests: http/tests/security/contentSecurityPolicy/1.1/reportonly-in-meta-ignored2.html
+               http/tests/security/contentSecurityPolicy/eval-allowed-in-report-only-mode-and-sends-report.php
+               http/tests/security/contentSecurityPolicy/eval-allowed-in-report-only-mode.php
+               http/tests/security/contentSecurityPolicy/report-multiple-violations-01.php
+               http/tests/security/contentSecurityPolicy/report-multiple-violations-02.php
+               http/tests/security/contentSecurityPolicy/report-only-report-uri-missing.php
+
+        * dom/Document.cpp:
+        (WebCore::Document::processHttpEquiv): Do not process policy for HTTP equivalent header
+        Content-Security-Policy-Report-Only and X-WebKit-CSP-Report-Only.
+
</ins><span class="cx"> 2016-04-14  Antoine Quint  &lt;graouts@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Dashboard is spelled as Dashbard in several source files
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.cpp (199537 => 199538)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.cpp        2016-04-14 14:08:33 UTC (rev 199537)
+++ trunk/Source/WebCore/dom/Document.cpp        2016-04-14 16:48:05 UTC (rev 199538)
</span><span class="lines">@@ -3321,21 +3321,11 @@
</span><span class="cx">             contentSecurityPolicy()-&gt;processHTTPEquiv(content, ContentSecurityPolicyHeaderType::Enforce);
</span><span class="cx">         break;
</span><span class="cx"> 
</span><del>-    case HTTPHeaderName::ContentSecurityPolicyReportOnly:
-        if (isInDocumentHead)
-            contentSecurityPolicy()-&gt;processHTTPEquiv(content, ContentSecurityPolicyHeaderType::Report);
-        break;
-
</del><span class="cx">     case HTTPHeaderName::XWebKitCSP:
</span><span class="cx">         if (isInDocumentHead)
</span><span class="cx">             contentSecurityPolicy()-&gt;processHTTPEquiv(content, ContentSecurityPolicyHeaderType::PrefixedEnforce);
</span><span class="cx">         break;
</span><span class="cx"> 
</span><del>-    case HTTPHeaderName::XWebKitCSPReportOnly:
-        if (isInDocumentHead)
-            contentSecurityPolicy()-&gt;processHTTPEquiv(content, ContentSecurityPolicyHeaderType::PrefixedReport);
-        break;
-
</del><span class="cx">     default:
</span><span class="cx">         break;
</span><span class="cx">     }
</span></span></pre>
</div>
</div>

</body>
</html>