<!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>[198936] 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/198936">198936</a></dd>
<dt>Author</dt> <dd>dbates@webkit.org</dd>
<dt>Date</dt> <dd>2016-03-31 18:54:47 -0700 (Thu, 31 Mar 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>REGRESSION (<a href="http://trac.webkit.org/projects/webkit/changeset/197724">r197724</a>): &lt;object&gt;/&lt;embed&gt; with no URL does not match source *
https://bugs.webkit.org/show_bug.cgi?id=156079
&lt;rdar://problem/25470805&gt;

Reviewed by Brent Fulgham.

Source/WebCore:

Fixes an issue where HTML object and embed elements that are not associated with a URL are
allowed to load when object-src/default-src contains source *. More generally, we allow
such elements to load so long as object-src/default-src is not 'none' per section object-src
of the Content Security Policy Level 3 spec., &lt;http://w3c.github.io/webappsec-csp&gt; (Editor's Draft, 29 February 2016).

Tests: http/tests/security/contentSecurityPolicy/embed-with-no-url-allowed-by-default-src-star.html
       http/tests/security/contentSecurityPolicy/embed-with-no-url-allowed-by-star.html
       http/tests/security/contentSecurityPolicy/object-with-no-url-allowed-by-default-src-star.html
       http/tests/security/contentSecurityPolicy/object-with-no-url-allowed-by-star.html

* page/csp/ContentSecurityPolicy.cpp:
(WebCore::ContentSecurityPolicy::allowObjectFromSource): Modified to call violatedDirectiveInAnyPolicy() passing
ContentSecurityPolicySourceListDirective::ShouldAllowEmptyURLIfSourceListIsNotNone::Yes.
* page/csp/ContentSecurityPolicyDirectiveList.cpp:
(WebCore::checkSource): Modified to take argument of type ContentSecurityPolicySourceListDirective::ShouldAllowEmptyURLIfSourceListIsNotNone (defaults to false)
and pass it through to ContentSecurityPolicySourceListDirective.
(WebCore::checkFrameAncestors): Explicitly pass ContentSecurityPolicySourceListDirective::ShouldAllowEmptyURLIfSourceListIsNotNone::No
to avoid URL from having the compiler implicitly convert it to a String and selecting override ContentSecurityPolicySourceListDirective::allows(const String&amp;),
which will lead to incorrect results. We will look to make this code less error prone in &lt;https://bugs.webkit.org/show_bug.cgi?id=156086&gt;.
(WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForObjectSource): Modified to take argument of type
ContentSecurityPolicySourceListDirective::ShouldAllowEmptyURLIfSourceListIsNotNone and pass it through.
* page/csp/ContentSecurityPolicyDirectiveList.h:
* page/csp/ContentSecurityPolicySourceList.cpp:
(WebCore::ContentSecurityPolicySourceList::parse): Set instance variable m_isNone to true so that we can differentiate
a source list with value 'none' from a source list that lists one or more sources or non-none keywords.
* page/csp/ContentSecurityPolicySourceList.h:
(WebCore::ContentSecurityPolicySourceList::isNone): Added.
* page/csp/ContentSecurityPolicySourceListDirective.cpp:
(WebCore::ContentSecurityPolicySourceListDirective::allows): Modified to take argument of type ContentSecurityPolicySourceListDirective::ShouldAllowEmptyURLIfSourceListIsNotNone
and updated code to return true for an empty URL only if this argument is ContentSecurityPolicySourceListDirective::ShouldAllowEmptyURLIfSourceListIsNotNone::Yes and
the source list does not have value 'none'.
* page/csp/ContentSecurityPolicySourceListDirective.h:

LayoutTests:

Add tests to ensure that HTML object and embed elements are allowed by source *.

* platform/ios-simulator/TestExpectations: Skip added tests as plugins are not supported on iOS.
* http/tests/security/contentSecurityPolicy/embed-with-no-url-allowed-by-default-src-star-expected.txt: Added.
* http/tests/security/contentSecurityPolicy/embed-with-no-url-allowed-by-default-src-star.html: Added.
* http/tests/security/contentSecurityPolicy/embed-with-no-url-allowed-by-star-expected.txt: Added.
* http/tests/security/contentSecurityPolicy/embed-with-no-url-allowed-by-star.html: Added.
* http/tests/security/contentSecurityPolicy/object-with-no-url-allowed-by-default-src-star-expected.txt: Added.
* http/tests/security/contentSecurityPolicy/object-with-no-url-allowed-by-default-src-star.html: Added.
* http/tests/security/contentSecurityPolicy/object-with-no-url-allowed-by-star-expected.txt: Added.
* http/tests/security/contentSecurityPolicy/object-with-no-url-allowed-by-star.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformiossimulatorTestExpectations">trunk/LayoutTests/platform/ios-simulator/TestExpectations</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorepagecspContentSecurityPolicycpp">trunk/Source/WebCore/page/csp/ContentSecurityPolicy.cpp</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>
<li><a href="#trunkSourceWebCorepagecspContentSecurityPolicySourceListcpp">trunk/Source/WebCore/page/csp/ContentSecurityPolicySourceList.cpp</a></li>
<li><a href="#trunkSourceWebCorepagecspContentSecurityPolicySourceListh">trunk/Source/WebCore/page/csp/ContentSecurityPolicySourceList.h</a></li>
<li><a href="#trunkSourceWebCorepagecspContentSecurityPolicySourceListDirectivecpp">trunk/Source/WebCore/page/csp/ContentSecurityPolicySourceListDirective.cpp</a></li>
<li><a href="#trunkSourceWebCorepagecspContentSecurityPolicySourceListDirectiveh">trunk/Source/WebCore/page/csp/ContentSecurityPolicySourceListDirective.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestshttptestssecuritycontentSecurityPolicyembedwithnourlallowedbydefaultsrcstarexpectedtxt">trunk/LayoutTests/http/tests/security/contentSecurityPolicy/embed-with-no-url-allowed-by-default-src-star-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritycontentSecurityPolicyembedwithnourlallowedbydefaultsrcstarhtml">trunk/LayoutTests/http/tests/security/contentSecurityPolicy/embed-with-no-url-allowed-by-default-src-star.html</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritycontentSecurityPolicyembedwithnourlallowedbystarexpectedtxt">trunk/LayoutTests/http/tests/security/contentSecurityPolicy/embed-with-no-url-allowed-by-star-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritycontentSecurityPolicyembedwithnourlallowedbystarhtml">trunk/LayoutTests/http/tests/security/contentSecurityPolicy/embed-with-no-url-allowed-by-star.html</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritycontentSecurityPolicyobjectwithnourlallowedbydefaultsrcstarexpectedtxt">trunk/LayoutTests/http/tests/security/contentSecurityPolicy/object-with-no-url-allowed-by-default-src-star-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritycontentSecurityPolicyobjectwithnourlallowedbydefaultsrcstarhtml">trunk/LayoutTests/http/tests/security/contentSecurityPolicy/object-with-no-url-allowed-by-default-src-star.html</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritycontentSecurityPolicyobjectwithnourlallowedbystarexpectedtxt">trunk/LayoutTests/http/tests/security/contentSecurityPolicy/object-with-no-url-allowed-by-star-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritycontentSecurityPolicyobjectwithnourlallowedbystarhtml">trunk/LayoutTests/http/tests/security/contentSecurityPolicy/object-with-no-url-allowed-by-star.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (198935 => 198936)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-04-01 01:48:34 UTC (rev 198935)
+++ trunk/LayoutTests/ChangeLog        2016-04-01 01:54:47 UTC (rev 198936)
</span><span class="lines">@@ -1,3 +1,23 @@
</span><ins>+2016-03-31  Daniel Bates  &lt;dabates@apple.com&gt;
+
+        REGRESSION (r197724): &lt;object&gt;/&lt;embed&gt; with no URL does not match source *
+        https://bugs.webkit.org/show_bug.cgi?id=156079
+        &lt;rdar://problem/25470805&gt;
+
+        Reviewed by Brent Fulgham.
+
+        Add tests to ensure that HTML object and embed elements are allowed by source *.
+
+        * platform/ios-simulator/TestExpectations: Skip added tests as plugins are not supported on iOS.
+        * http/tests/security/contentSecurityPolicy/embed-with-no-url-allowed-by-default-src-star-expected.txt: Added.
+        * http/tests/security/contentSecurityPolicy/embed-with-no-url-allowed-by-default-src-star.html: Added.
+        * http/tests/security/contentSecurityPolicy/embed-with-no-url-allowed-by-star-expected.txt: Added.
+        * http/tests/security/contentSecurityPolicy/embed-with-no-url-allowed-by-star.html: Added.
+        * http/tests/security/contentSecurityPolicy/object-with-no-url-allowed-by-default-src-star-expected.txt: Added.
+        * http/tests/security/contentSecurityPolicy/object-with-no-url-allowed-by-default-src-star.html: Added.
+        * http/tests/security/contentSecurityPolicy/object-with-no-url-allowed-by-star-expected.txt: Added.
+        * http/tests/security/contentSecurityPolicy/object-with-no-url-allowed-by-star.html: Added.
+
</ins><span class="cx"> 2016-03-31  Saam barati  &lt;sbarati@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [ES6] Disallow var assignments in for-in loops
</span></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritycontentSecurityPolicyembedwithnourlallowedbydefaultsrcstarexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/embed-with-no-url-allowed-by-default-src-star-expected.txt (0 => 198936)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/embed-with-no-url-allowed-by-default-src-star-expected.txt                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/embed-with-no-url-allowed-by-default-src-star-expected.txt        2016-04-01 01:54:47 UTC (rev 198936)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+PASS
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritycontentSecurityPolicyembedwithnourlallowedbydefaultsrcstarhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/embed-with-no-url-allowed-by-default-src-star.html (0 => 198936)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/embed-with-no-url-allowed-by-default-src-star.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/embed-with-no-url-allowed-by-default-src-star.html        2016-04-01 01:54:47 UTC (rev 198936)
</span><span class="lines">@@ -0,0 +1,21 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;/js-test-resources/plugin.js&quot;&gt;&lt;/script&gt;
+&lt;script&gt;
+if (window.testRunner)
+    testRunner.dumpAsText();
+
+function testPluginRemovedItself()
+{
+    document.body.appendChild(document.createTextNode(document.getElementById(&quot;plugin&quot;) ? &quot;FAIL&quot; : &quot;PASS&quot;));
+}
+
+runAfterPluginLoad(testPluginRemovedItself, NotifyDone);
+&lt;/script&gt;
+&lt;meta http-equiv=&quot;Content-Security-Policy&quot; content=&quot;default-src *&quot;&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;embed id=&quot;plugin&quot; type=&quot;application/x-webkit-test-netscape&quot; cleardocumentduringnew&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritycontentSecurityPolicyembedwithnourlallowedbystarexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/embed-with-no-url-allowed-by-star-expected.txt (0 => 198936)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/embed-with-no-url-allowed-by-star-expected.txt                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/embed-with-no-url-allowed-by-star-expected.txt        2016-04-01 01:54:47 UTC (rev 198936)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+PASS
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritycontentSecurityPolicyembedwithnourlallowedbystarhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/embed-with-no-url-allowed-by-star.html (0 => 198936)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/embed-with-no-url-allowed-by-star.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/embed-with-no-url-allowed-by-star.html        2016-04-01 01:54:47 UTC (rev 198936)
</span><span class="lines">@@ -0,0 +1,21 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;/js-test-resources/plugin.js&quot;&gt;&lt;/script&gt;
+&lt;script&gt;
+if (window.testRunner)
+    testRunner.dumpAsText();
+
+function testPluginRemovedItself()
+{
+    document.body.appendChild(document.createTextNode(document.getElementById(&quot;plugin&quot;) ? &quot;FAIL&quot; : &quot;PASS&quot;));
+}
+
+runAfterPluginLoad(testPluginRemovedItself, NotifyDone);
+&lt;/script&gt;
+&lt;meta http-equiv=&quot;Content-Security-Policy&quot; content=&quot;object-src *&quot;&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;embed id=&quot;plugin&quot; type=&quot;application/x-webkit-test-netscape&quot; cleardocumentduringnew&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritycontentSecurityPolicyobjectwithnourlallowedbydefaultsrcstarexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/object-with-no-url-allowed-by-default-src-star-expected.txt (0 => 198936)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/object-with-no-url-allowed-by-default-src-star-expected.txt                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/object-with-no-url-allowed-by-default-src-star-expected.txt        2016-04-01 01:54:47 UTC (rev 198936)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+PASS
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritycontentSecurityPolicyobjectwithnourlallowedbydefaultsrcstarhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/object-with-no-url-allowed-by-default-src-star.html (0 => 198936)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/object-with-no-url-allowed-by-default-src-star.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/object-with-no-url-allowed-by-default-src-star.html        2016-04-01 01:54:47 UTC (rev 198936)
</span><span class="lines">@@ -0,0 +1,21 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;/js-test-resources/plugin.js&quot;&gt;&lt;/script&gt;
+&lt;script&gt;
+if (window.testRunner)
+    testRunner.dumpAsText();
+
+function testPluginRemovedItself()
+{
+    document.body.appendChild(document.createTextNode(document.getElementById(&quot;plugin&quot;) ? &quot;FAIL&quot; : &quot;PASS&quot;));
+}
+
+runAfterPluginLoad(testPluginRemovedItself, NotifyDone);
+&lt;/script&gt;
+&lt;meta http-equiv=&quot;Content-Security-Policy&quot; content=&quot;default-src *&quot;&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;object id=&quot;plugin&quot; type=&quot;application/x-webkit-test-netscape&quot; cleardocumentduringnew&gt;&lt;/object&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritycontentSecurityPolicyobjectwithnourlallowedbystarexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/object-with-no-url-allowed-by-star-expected.txt (0 => 198936)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/object-with-no-url-allowed-by-star-expected.txt                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/object-with-no-url-allowed-by-star-expected.txt        2016-04-01 01:54:47 UTC (rev 198936)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+PASS
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritycontentSecurityPolicyobjectwithnourlallowedbystarhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/object-with-no-url-allowed-by-star.html (0 => 198936)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/object-with-no-url-allowed-by-star.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/object-with-no-url-allowed-by-star.html        2016-04-01 01:54:47 UTC (rev 198936)
</span><span class="lines">@@ -0,0 +1,21 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;/js-test-resources/plugin.js&quot;&gt;&lt;/script&gt;
+&lt;script&gt;
+if (window.testRunner)
+    testRunner.dumpAsText();
+
+function testPluginRemovedItself()
+{
+    document.body.appendChild(document.createTextNode(document.getElementById(&quot;plugin&quot;) ? &quot;FAIL&quot; : &quot;PASS&quot;));
+}
+
+runAfterPluginLoad(testPluginRemovedItself, NotifyDone);
+&lt;/script&gt;
+&lt;meta http-equiv=&quot;Content-Security-Policy&quot; content=&quot;object-src *&quot;&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;object id=&quot;plugin&quot; type=&quot;application/x-webkit-test-netscape&quot; cleardocumentduringnew&gt;&lt;/object&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformiossimulatorTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/ios-simulator/TestExpectations (198935 => 198936)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/ios-simulator/TestExpectations        2016-04-01 01:48:34 UTC (rev 198935)
+++ trunk/LayoutTests/platform/ios-simulator/TestExpectations        2016-04-01 01:54:47 UTC (rev 198936)
</span><span class="lines">@@ -87,10 +87,14 @@
</span><span class="cx"> http/tests/security/contentSecurityPolicy/1.1/plugintypes-nourl-blocked.html
</span><span class="cx"> http/tests/security/contentSecurityPolicy/1.1/plugintypes-url-01.html
</span><span class="cx"> http/tests/security/contentSecurityPolicy/1.1/plugintypes-url-02.html
</span><ins>+http/tests/security/contentSecurityPolicy/embed-with-no-url-allowed-by-default-src-star.html
+http/tests/security/contentSecurityPolicy/embed-with-no-url-allowed-by-star.html
</ins><span class="cx"> http/tests/security/contentSecurityPolicy/object-src-param-code-blocked.html
</span><span class="cx"> http/tests/security/contentSecurityPolicy/object-src-param-movie-blocked.html
</span><span class="cx"> http/tests/security/contentSecurityPolicy/object-src-param-src-blocked.html
</span><span class="cx"> http/tests/security/contentSecurityPolicy/object-src-param-url-blocked.html
</span><ins>+http/tests/security/contentSecurityPolicy/object-with-no-url-allowed-by-default-src-star.html
+http/tests/security/contentSecurityPolicy/object-with-no-url-allowed-by-star.html
</ins><span class="cx"> 
</span><span class="cx"> # Pointer-lock not supported on iOS
</span><span class="cx"> pointer-lock
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (198935 => 198936)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-04-01 01:48:34 UTC (rev 198935)
+++ trunk/Source/WebCore/ChangeLog        2016-04-01 01:54:47 UTC (rev 198936)
</span><span class="lines">@@ -1,3 +1,44 @@
</span><ins>+2016-03-31  Daniel Bates  &lt;dabates@apple.com&gt;
+
+        REGRESSION (r197724): &lt;object&gt;/&lt;embed&gt; with no URL does not match source *
+        https://bugs.webkit.org/show_bug.cgi?id=156079
+        &lt;rdar://problem/25470805&gt;
+
+        Reviewed by Brent Fulgham.
+
+        Fixes an issue where HTML object and embed elements that are not associated with a URL are
+        allowed to load when object-src/default-src contains source *. More generally, we allow
+        such elements to load so long as object-src/default-src is not 'none' per section object-src
+        of the Content Security Policy Level 3 spec., &lt;http://w3c.github.io/webappsec-csp&gt; (Editor's Draft, 29 February 2016).
+
+        Tests: http/tests/security/contentSecurityPolicy/embed-with-no-url-allowed-by-default-src-star.html
+               http/tests/security/contentSecurityPolicy/embed-with-no-url-allowed-by-star.html
+               http/tests/security/contentSecurityPolicy/object-with-no-url-allowed-by-default-src-star.html
+               http/tests/security/contentSecurityPolicy/object-with-no-url-allowed-by-star.html
+
+        * page/csp/ContentSecurityPolicy.cpp:
+        (WebCore::ContentSecurityPolicy::allowObjectFromSource): Modified to call violatedDirectiveInAnyPolicy() passing
+        ContentSecurityPolicySourceListDirective::ShouldAllowEmptyURLIfSourceListIsNotNone::Yes.
+        * page/csp/ContentSecurityPolicyDirectiveList.cpp:
+        (WebCore::checkSource): Modified to take argument of type ContentSecurityPolicySourceListDirective::ShouldAllowEmptyURLIfSourceListIsNotNone (defaults to false)
+        and pass it through to ContentSecurityPolicySourceListDirective.
+        (WebCore::checkFrameAncestors): Explicitly pass ContentSecurityPolicySourceListDirective::ShouldAllowEmptyURLIfSourceListIsNotNone::No
+        to avoid URL from having the compiler implicitly convert it to a String and selecting override ContentSecurityPolicySourceListDirective::allows(const String&amp;),
+        which will lead to incorrect results. We will look to make this code less error prone in &lt;https://bugs.webkit.org/show_bug.cgi?id=156086&gt;.
+        (WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForObjectSource): Modified to take argument of type
+        ContentSecurityPolicySourceListDirective::ShouldAllowEmptyURLIfSourceListIsNotNone and pass it through.
+        * page/csp/ContentSecurityPolicyDirectiveList.h:
+        * page/csp/ContentSecurityPolicySourceList.cpp:
+        (WebCore::ContentSecurityPolicySourceList::parse): Set instance variable m_isNone to true so that we can differentiate
+        a source list with value 'none' from a source list that lists one or more sources or non-none keywords.
+        * page/csp/ContentSecurityPolicySourceList.h:
+        (WebCore::ContentSecurityPolicySourceList::isNone): Added.
+        * page/csp/ContentSecurityPolicySourceListDirective.cpp:
+        (WebCore::ContentSecurityPolicySourceListDirective::allows): Modified to take argument of type ContentSecurityPolicySourceListDirective::ShouldAllowEmptyURLIfSourceListIsNotNone
+        and updated code to return true for an empty URL only if this argument is ContentSecurityPolicySourceListDirective::ShouldAllowEmptyURLIfSourceListIsNotNone::Yes and
+        the source list does not have value 'none'.
+        * page/csp/ContentSecurityPolicySourceListDirective.h:
+
</ins><span class="cx"> 2016-03-31  Saam barati  &lt;sbarati@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Revert rewrite const as var workaround
</span></span></pre></div>
<a id="trunkSourceWebCorepagecspContentSecurityPolicycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/csp/ContentSecurityPolicy.cpp (198935 => 198936)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/csp/ContentSecurityPolicy.cpp        2016-04-01 01:48:34 UTC (rev 198935)
+++ trunk/Source/WebCore/page/csp/ContentSecurityPolicy.cpp        2016-04-01 01:54:47 UTC (rev 198936)
</span><span class="lines">@@ -385,7 +385,10 @@
</span><span class="cx">         return true;
</span><span class="cx">     if (SchemeRegistry::schemeShouldBypassContentSecurityPolicy(url.protocol()))
</span><span class="cx">         return true;
</span><del>-    const ContentSecurityPolicyDirective* violatedDirective = violatedDirectiveInAnyPolicy(&amp;ContentSecurityPolicyDirectiveList::violatedDirectiveForObjectSource, url);
</del><ins>+    // As per section object-src of the Content Security Policy Level 3 spec., &lt;http://w3c.github.io/webappsec-csp&gt; (Editor's Draft, 29 February 2016),
+    // &quot;If plugin content is loaded without an associated URL (perhaps an object element lacks a data attribute, but loads some default plugin based
+    // on the specified type), it MUST be blocked if object-src's value is 'none', but will otherwise be allowed&quot;.
+    const ContentSecurityPolicyDirective* violatedDirective = violatedDirectiveInAnyPolicy(&amp;ContentSecurityPolicyDirectiveList::violatedDirectiveForObjectSource, url, ContentSecurityPolicySourceListDirective::ShouldAllowEmptyURLIfSourceListIsNotNone::Yes);
</ins><span class="cx">     if (!violatedDirective)
</span><span class="cx">         return true;
</span><span class="cx">     String consoleMessage = consoleMessageForViolation(ContentSecurityPolicyDirectiveNames::objectSrc, *violatedDirective, url, &quot;Refused to load&quot;);
</span></span></pre></div>
<a id="trunkSourceWebCorepagecspContentSecurityPolicyDirectiveListcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/csp/ContentSecurityPolicyDirectiveList.cpp (198935 => 198936)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/csp/ContentSecurityPolicyDirectiveList.cpp        2016-04-01 01:48:34 UTC (rev 198935)
+++ trunk/Source/WebCore/page/csp/ContentSecurityPolicyDirectiveList.cpp        2016-04-01 01:54:47 UTC (rev 198936)
</span><span class="lines">@@ -61,9 +61,9 @@
</span><span class="cx">     return !directive || directive-&gt;allowInline();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static inline bool checkSource(ContentSecurityPolicySourceListDirective* directive, const URL&amp; url)
</del><ins>+static inline bool checkSource(ContentSecurityPolicySourceListDirective* directive, const URL&amp; url, ContentSecurityPolicySourceListDirective::ShouldAllowEmptyURLIfSourceListIsNotNone shouldAllowEmptyURLIfSourceListEmpty = ContentSecurityPolicySourceListDirective::ShouldAllowEmptyURLIfSourceListIsNotNone::No)
</ins><span class="cx"> {
</span><del>-    return !directive || directive-&gt;allows(url);
</del><ins>+    return !directive || directive-&gt;allows(url, shouldAllowEmptyURLIfSourceListEmpty);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static inline bool checkHash(ContentSecurityPolicySourceListDirective* directive, const ContentSecurityPolicyHash&amp; hash)
</span><span class="lines">@@ -81,7 +81,7 @@
</span><span class="cx">     if (!directive)
</span><span class="cx">         return true;
</span><span class="cx">     for (Frame* current = frame.tree().parent(); current; current = current-&gt;tree().parent()) {
</span><del>-        if (!directive-&gt;allows(current-&gt;document()-&gt;url()))
</del><ins>+        if (!directive-&gt;allows(current-&gt;document()-&gt;url(), ContentSecurityPolicySourceListDirective::ShouldAllowEmptyURLIfSourceListIsNotNone::No))
</ins><span class="cx">             return false;
</span><span class="cx">     }
</span><span class="cx">     return true;
</span><span class="lines">@@ -257,12 +257,12 @@
</span><span class="cx">     return operativeDirective;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-const ContentSecurityPolicyDirective* ContentSecurityPolicyDirectiveList::violatedDirectiveForObjectSource(const URL&amp; url) const
</del><ins>+const ContentSecurityPolicyDirective* ContentSecurityPolicyDirectiveList::violatedDirectiveForObjectSource(const URL&amp; url, ContentSecurityPolicySourceListDirective::ShouldAllowEmptyURLIfSourceListIsNotNone shouldAllowEmptyURLIfSourceListEmpty) const
</ins><span class="cx"> {
</span><span class="cx">     if (url.isBlankURL())
</span><span class="cx">         return nullptr;
</span><span class="cx">     ContentSecurityPolicySourceListDirective* operativeDirective = this-&gt;operativeDirective(m_objectSrc.get());
</span><del>-    if (checkSource(operativeDirective, url))
</del><ins>+    if (checkSource(operativeDirective, url, shouldAllowEmptyURLIfSourceListEmpty))
</ins><span class="cx">         return nullptr;
</span><span class="cx">     return operativeDirective;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorepagecspContentSecurityPolicyDirectiveListh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/csp/ContentSecurityPolicyDirectiveList.h (198935 => 198936)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/csp/ContentSecurityPolicyDirectiveList.h        2016-04-01 01:48:34 UTC (rev 198935)
+++ trunk/Source/WebCore/page/csp/ContentSecurityPolicyDirectiveList.h        2016-04-01 01:54:47 UTC (rev 198936)
</span><span class="lines">@@ -65,7 +65,7 @@
</span><span class="cx">     const ContentSecurityPolicyDirective* violatedDirectiveForFrameAncestor(const Frame&amp;) const;
</span><span class="cx">     const ContentSecurityPolicyDirective* violatedDirectiveForImage(const URL&amp;) const;
</span><span class="cx">     const ContentSecurityPolicyDirective* violatedDirectiveForMedia(const URL&amp;) const;
</span><del>-    const ContentSecurityPolicyDirective* violatedDirectiveForObjectSource(const URL&amp;) const;
</del><ins>+    const ContentSecurityPolicyDirective* violatedDirectiveForObjectSource(const URL&amp;, ContentSecurityPolicySourceListDirective::ShouldAllowEmptyURLIfSourceListIsNotNone) const;
</ins><span class="cx">     const ContentSecurityPolicyDirective* violatedDirectiveForPluginType(const String&amp; type, const String&amp; typeAttribute) const;
</span><span class="cx">     const ContentSecurityPolicyDirective* violatedDirectiveForScript(const URL&amp;) const;
</span><span class="cx">     const ContentSecurityPolicyDirective* violatedDirectiveForStyle(const URL&amp;) const;
</span></span></pre></div>
<a id="trunkSourceWebCorepagecspContentSecurityPolicySourceListcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/csp/ContentSecurityPolicySourceList.cpp (198935 => 198936)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/csp/ContentSecurityPolicySourceList.cpp        2016-04-01 01:48:34 UTC (rev 198935)
+++ trunk/Source/WebCore/page/csp/ContentSecurityPolicySourceList.cpp        2016-04-01 01:54:47 UTC (rev 198936)
</span><span class="lines">@@ -119,9 +119,10 @@
</span><span class="cx"> 
</span><span class="cx"> void ContentSecurityPolicySourceList::parse(const String&amp; value)
</span><span class="cx"> {
</span><del>-    // We represent 'none' as an empty m_list.
-    if (isSourceListNone(value))
</del><ins>+    if (isSourceListNone(value)) {
+        m_isNone = true;
</ins><span class="cx">         return;
</span><ins>+    }
</ins><span class="cx">     auto characters = StringView(value).upconvertedCharacters();
</span><span class="cx">     parse(characters, characters + value.length());
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorepagecspContentSecurityPolicySourceListh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/csp/ContentSecurityPolicySourceList.h (198935 => 198936)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/csp/ContentSecurityPolicySourceList.h        2016-04-01 01:48:34 UTC (rev 198935)
+++ trunk/Source/WebCore/page/csp/ContentSecurityPolicySourceList.h        2016-04-01 01:54:47 UTC (rev 198936)
</span><span class="lines">@@ -54,6 +54,7 @@
</span><span class="cx">     bool allowInline() const { return m_allowInline &amp;&amp; m_hashes.isEmpty() &amp;&amp; m_nonces.isEmpty(); }
</span><span class="cx">     bool allowEval() const { return m_allowEval; }
</span><span class="cx">     bool allowSelf() const { return m_allowSelf; }
</span><ins>+    bool isNone() const { return m_isNone; }
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     void parse(const UChar* begin, const UChar* end);
</span><span class="lines">@@ -80,6 +81,7 @@
</span><span class="cx">     bool m_allowStar { false };
</span><span class="cx">     bool m_allowInline { false };
</span><span class="cx">     bool m_allowEval { false };
</span><ins>+    bool m_isNone { false };
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorepagecspContentSecurityPolicySourceListDirectivecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/csp/ContentSecurityPolicySourceListDirective.cpp (198935 => 198936)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/csp/ContentSecurityPolicySourceListDirective.cpp        2016-04-01 01:48:34 UTC (rev 198935)
+++ trunk/Source/WebCore/page/csp/ContentSecurityPolicySourceListDirective.cpp        2016-04-01 01:54:47 UTC (rev 198936)
</span><span class="lines">@@ -40,11 +40,10 @@
</span><span class="cx">     m_sourceList.parse(value);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool ContentSecurityPolicySourceListDirective::allows(const URL&amp; url)
</del><ins>+bool ContentSecurityPolicySourceListDirective::allows(const URL&amp; url, ShouldAllowEmptyURLIfSourceListIsNotNone shouldAllowEmptyURLIfSourceListEmpty)
</ins><span class="cx"> {
</span><del>-    // FIXME: We should investigate returning false for an empty URL.
</del><span class="cx">     if (url.isEmpty())
</span><del>-        return m_sourceList.allowSelf();
</del><ins>+        return shouldAllowEmptyURLIfSourceListEmpty == ShouldAllowEmptyURLIfSourceListIsNotNone::Yes &amp;&amp; !m_sourceList.isNone();
</ins><span class="cx">     return m_sourceList.matches(url);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorepagecspContentSecurityPolicySourceListDirectiveh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/csp/ContentSecurityPolicySourceListDirective.h (198935 => 198936)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/csp/ContentSecurityPolicySourceListDirective.h        2016-04-01 01:48:34 UTC (rev 198935)
+++ trunk/Source/WebCore/page/csp/ContentSecurityPolicySourceListDirective.h        2016-04-01 01:54:47 UTC (rev 198936)
</span><span class="lines">@@ -38,7 +38,8 @@
</span><span class="cx"> public:
</span><span class="cx">     ContentSecurityPolicySourceListDirective(const ContentSecurityPolicyDirectiveList&amp;, const String&amp; name, const String&amp; value);
</span><span class="cx"> 
</span><del>-    bool allows(const URL&amp;);
</del><ins>+    enum class ShouldAllowEmptyURLIfSourceListIsNotNone { No, Yes };
+    bool allows(const URL&amp;, ShouldAllowEmptyURLIfSourceListIsNotNone);
</ins><span class="cx">     bool allows(const ContentSecurityPolicyHash&amp;) const;
</span><span class="cx">     bool allows(const String&amp; nonce) const;
</span><span class="cx">     bool allowInline() const { return m_sourceList.allowInline(); }
</span></span></pre>
</div>
</div>

</body>
</html>