<!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>[187361] branches/safari-600.1.4.17-branch</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/187361">187361</a></dd>
<dt>Author</dt> <dd>bshafiei@apple.com</dd>
<dt>Date</dt> <dd>2015-07-24 14:08:16 -0700 (Fri, 24 Jul 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Merged <a href="http://trac.webkit.org/projects/webkit/changeset/187359">r187359</a>. rdar://problem/21708243</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari6001417branchLayoutTestsChangeLog">branches/safari-600.1.4.17-branch/LayoutTests/ChangeLog</a></li>
<li><a href="#branchessafari6001417branchLayoutTestshttptestssecuritycontentSecurityPolicyresourcestrackvtt">branches/safari-600.1.4.17-branch/LayoutTests/http/tests/security/contentSecurityPolicy/resources/track.vtt</a></li>
<li><a href="#branchessafari6001417branchLayoutTestshttptestssecuritycontentSecurityPolicyuserAgentShadowDOMallowobjecthtml">branches/safari-600.1.4.17-branch/LayoutTests/http/tests/security/contentSecurityPolicy/userAgentShadowDOM/allow-object.html</a></li>
<li><a href="#branchessafari6001417branchLayoutTestshttptestssecurityisolatedWorldimageloadshouldnotbypassmainworldcspexpectedtxt">branches/safari-600.1.4.17-branch/LayoutTests/http/tests/security/isolatedWorld/image-load-should-not-bypass-main-world-csp-expected.txt</a></li>
<li><a href="#branchessafari6001417branchLayoutTestshttptestssecurityisolatedWorldimageloadshouldnotbypassmainworldcsphtml">branches/safari-600.1.4.17-branch/LayoutTests/http/tests/security/isolatedWorld/image-load-should-not-bypass-main-world-csp.html</a></li>
<li><a href="#branchessafari6001417branchSourceWebCoreChangeLog">branches/safari-600.1.4.17-branch/Source/WebCore/ChangeLog</a></li>
<li><a href="#branchessafari6001417branchSourceWebCorebindingsjsScriptControllercpp">branches/safari-600.1.4.17-branch/Source/WebCore/bindings/js/ScriptController.cpp</a></li>
<li><a href="#branchessafari6001417branchSourceWebCoreloadercacheCachedResourceLoadercpp">branches/safari-600.1.4.17-branch/Source/WebCore/loader/cache/CachedResourceLoader.cpp</a></li>
<li><a href="#branchessafari6001417branchSourceWebCorepageDOMSecurityPolicycpp">branches/safari-600.1.4.17-branch/Source/WebCore/page/DOMSecurityPolicy.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari6001417branchLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1.4.17-branch/LayoutTests/ChangeLog (187360 => 187361)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1.4.17-branch/LayoutTests/ChangeLog        2015-07-24 21:03:09 UTC (rev 187360)
+++ branches/safari-600.1.4.17-branch/LayoutTests/ChangeLog        2015-07-24 21:08:16 UTC (rev 187361)
</span><span class="lines">@@ -1,3 +1,27 @@
</span><ins>+2015-07-24 Babak Shafiei <bshafiei@apple.com>
+
+ Merge r187359.
+
+ 2015-07-24 Anders Carlsson <andersca@apple.com>
+
+ Fix fallout from merging changes for
+ <rdar://problem/21707887> CSP doesn't prevent image loading of <object> when page contains <video controls> and ENABLE(MEDIA_CONTROLS_SCRIPT) is enabled
+
+ Reviewed by Alexey Proskuryakov.
+
+ * http/tests/security/contentSecurityPolicy/resources/track.vtt:
+ Replace this with a track.vtt from ToT which is actually a valid .vtt file that will parse properly.
+
+ * http/tests/security/contentSecurityPolicy/userAgentShadowDOM/allow-object.html:
+ Tweak this test so it will work on the branch - setting object.data in order to force an object's URL to be loaded
+ when it's already got a renderer only works on ToT, so do it before appending the object element.
+
+ * http/tests/security/isolatedWorld/image-load-should-not-bypass-main-world-csp-expected.txt:
+ Copy the test result from ToT and get rid of the merge conflict.
+
+ * http/tests/security/isolatedWorld/image-load-should-not-bypass-main-world-csp.html:
+ Copy the test from ToT which also gives us a test for allowing eval in non-main script worlds.
+
</ins><span class="cx"> 2015-07-23 Babak Shafiei <bshafiei@apple.com>
</span><span class="cx">
</span><span class="cx"> Merge r187248.
</span></span></pre></div>
<a id="branchessafari6001417branchLayoutTestshttptestssecuritycontentSecurityPolicyresourcestrackvtt"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1.4.17-branch/LayoutTests/http/tests/security/contentSecurityPolicy/resources/track.vtt (187360 => 187361)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1.4.17-branch/LayoutTests/http/tests/security/contentSecurityPolicy/resources/track.vtt        2015-07-24 21:03:09 UTC (rev 187360)
+++ branches/safari-600.1.4.17-branch/LayoutTests/http/tests/security/contentSecurityPolicy/resources/track.vtt        2015-07-24 21:08:16 UTC (rev 187361)
</span><span class="lines">@@ -1 +1,5 @@
</span><del>-Subtitles!
</del><ins>+WEBVTT
+
+1
+00:00:00.000 --> 00:00:01.000
+Sample
</ins></span></pre></div>
<a id="branchessafari6001417branchLayoutTestshttptestssecuritycontentSecurityPolicyuserAgentShadowDOMallowobjecthtml"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1.4.17-branch/LayoutTests/http/tests/security/contentSecurityPolicy/userAgentShadowDOM/allow-object.html (187360 => 187361)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1.4.17-branch/LayoutTests/http/tests/security/contentSecurityPolicy/userAgentShadowDOM/allow-object.html        2015-07-24 21:03:09 UTC (rev 187360)
+++ branches/safari-600.1.4.17-branch/LayoutTests/http/tests/security/contentSecurityPolicy/userAgentShadowDOM/allow-object.html        2015-07-24 21:08:16 UTC (rev 187361)
</span><span class="lines">@@ -20,7 +20,6 @@
</span><span class="cx">
</span><span class="cx"> var userAgentShadowRoot = internals.ensureUserAgentShadowRoot(document.getElementById("shadow-host"));
</span><span class="cx"> var object = document.createElement("object");
</span><del>- userAgentShadowRoot.appendChild(object);
</del><span class="cx">
</span><span class="cx"> object.type = "text/html";
</span><span class="cx"> object.onload = function () {
</span><span class="lines">@@ -28,6 +27,8 @@
</span><span class="cx"> // The content document of the HTML object will call testRunner.notifyDone().
</span><span class="cx"> }
</span><span class="cx"> object.data = "http://localhost:8000/resources/notify-done.html";
</span><ins>+
+ userAgentShadowRoot.appendChild(object);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> runTest();
</span></span></pre></div>
<a id="branchessafari6001417branchLayoutTestshttptestssecurityisolatedWorldimageloadshouldnotbypassmainworldcspexpectedtxt"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1.4.17-branch/LayoutTests/http/tests/security/isolatedWorld/image-load-should-not-bypass-main-world-csp-expected.txt (187360 => 187361)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1.4.17-branch/LayoutTests/http/tests/security/isolatedWorld/image-load-should-not-bypass-main-world-csp-expected.txt        2015-07-24 21:03:09 UTC (rev 187360)
+++ branches/safari-600.1.4.17-branch/LayoutTests/http/tests/security/isolatedWorld/image-load-should-not-bypass-main-world-csp-expected.txt        2015-07-24 21:08:16 UTC (rev 187361)
</span><span class="lines">@@ -1,10 +1,6 @@
</span><span class="cx"> CONSOLE MESSAGE: Refused to load the image 'http://127.0.0.1:8000/security/resources/abe.png' because it violates the following Content Security Policy directive: "img-src 'none'".
</span><span class="cx">
</span><span class="cx"> ALERT: BLOCKED in main world
</span><del>-<<<<<<< HEAD:LayoutTests/http/tests/security/isolatedWorld/bypass-main-world-csp-expected.txt
-ALERT: LOADED in isolated world
-This test ensures that scripts run in isolated worlds aren't affected by the page's content security policy. Extensions, for example, should be able to load any resource they like.
-=======
</del><span class="cx"> CONSOLE MESSAGE: Refused to load the image 'http://127.0.0.1:8000/security/resources/abe.png' because it violates the following Content Security Policy directive: "img-src 'none'".
</span><span class="cx">
</span><span class="cx"> ALERT: BLOCKED in isolated world
</span><span class="lines">@@ -13,6 +9,5 @@
</span><span class="cx"> ALERT: BLOCKED eval() in main world
</span><span class="cx"> ALERT: Called eval() in isolated world
</span><span class="cx"> This test ensures that scripts run in isolated worlds are affected by the page's content security policy. Extensions, for example, should not be able to load any resource they like.
</span><del>->>>>>>> 264add7... Isolated worlds should respect Content Security Policy; User Agent Shadow DOM:LayoutTests/http/tests/security/isolatedWorld/image-load-should-not-bypass-main-world-csp-expected.txt
</del><span class="cx">
</span><span class="cx">
</span></span></pre></div>
<a id="branchessafari6001417branchLayoutTestshttptestssecurityisolatedWorldimageloadshouldnotbypassmainworldcsphtml"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1.4.17-branch/LayoutTests/http/tests/security/isolatedWorld/image-load-should-not-bypass-main-world-csp.html (187360 => 187361)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1.4.17-branch/LayoutTests/http/tests/security/isolatedWorld/image-load-should-not-bypass-main-world-csp.html        2015-07-24 21:03:09 UTC (rev 187360)
+++ branches/safari-600.1.4.17-branch/LayoutTests/http/tests/security/isolatedWorld/image-load-should-not-bypass-main-world-csp.html        2015-07-24 21:08:16 UTC (rev 187361)
</span><span class="lines">@@ -1,14 +1,14 @@
</span><span class="cx"> <!DOCTYPE html>
</span><span class="cx"> <html>
</span><span class="cx"> <head>
</span><del>-<meta http-equiv="Content-Security-Policy" content="img-src 'none'">
</del><ins>+<meta http-equiv="Content-Security-Policy" content="img-src 'none'; script-src 'unsafe-inline'">
</ins><span class="cx"> <script>
</span><span class="cx"> if (window.testRunner) {
</span><span class="cx"> testRunner.dumpAsText();
</span><span class="cx"> testRunner.waitUntilDone();
</span><span class="cx"> }
</span><span class="cx">
</span><del>- tests = 2;
</del><ins>+ tests = 4;
</ins><span class="cx"> window.addEventListener("message", function(message) {
</span><span class="cx"> tests -= 1;
</span><span class="cx"> test();
</span><span class="lines">@@ -29,12 +29,30 @@
</span><span class="cx"> img.src = "../resources/abe.png";
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ function callEval(isolated) {
+ try {
+ eval("true");
+ alert('Called eval() in ' + (isolated ? "isolated world" : "main world"));
+ window.postMessage("next", "*");
+ } catch (error) {
+ console.log(error);
+ alert('BLOCKED eval() in ' + (isolated ? "isolated world" : "main world"));
+ window.postMessage("next", "*");
+ }
+ }
+
</ins><span class="cx"> switch (tests) {
</span><del>- case 2:
</del><ins>+ case 4:
</ins><span class="cx"> setImgSrc(false);
</span><span class="cx"> break;
</span><ins>+ case 3:
+ testRunner.evaluateScriptInIsolatedWorld(1, String(setImgSrc) + "\nsetImgSrc(true);");
+ break;
+ case 2:
+ callEval(false);
+ break;
</ins><span class="cx"> case 1:
</span><del>- testRunner.evaluateScriptInIsolatedWorld(1, String(eval("setImgSrc")) + "\nsetImgSrc(true);");
</del><ins>+ testRunner.evaluateScriptInIsolatedWorld(1, String(callEval) + "\ncallEval(true);");
</ins><span class="cx"> break;
</span><span class="cx"> case 0:
</span><span class="cx"> testRunner.notifyDone();
</span></span></pre></div>
<a id="branchessafari6001417branchSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1.4.17-branch/Source/WebCore/ChangeLog (187360 => 187361)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1.4.17-branch/Source/WebCore/ChangeLog        2015-07-24 21:03:09 UTC (rev 187360)
+++ branches/safari-600.1.4.17-branch/Source/WebCore/ChangeLog        2015-07-24 21:08:16 UTC (rev 187361)
</span><span class="lines">@@ -1,3 +1,33 @@
</span><ins>+2015-07-24 Babak Shafiei <bshafiei@apple.com>
+
+ Merge r187359.
+
+ 2015-07-24 Anders Carlsson <andersca@apple.com>
+
+ Fix fallout from merging changes for
+ <rdar://problem/21707887> CSP doesn't prevent image loading of <object> when page contains <video controls> and ENABLE(MEDIA_CONTROLS_SCRIPT) is enabled
+
+ Reviewed by Alexey Proskuryakov.
+
+ Tweaked http/tests/security/isolatedWorld/image-load-should-not-bypass-main-world-csp.html so that
+ it will test allowing evals in non-main worlds.
+
+ * bindings/js/ScriptController.cpp:
+ (WebCore::ScriptController::initScript):
+ Due to ContentSecurityPolicy::allowEval being modified on ToT, we'd always end up passing true for
+ the overrideContentSecurityPolicy parameter (since the ContentSecurityPolicy::SuppressReport parameter
+ was incorrectly treated as a boolean).
+ Fix this by merging part of the fix for bug 141316.
+
+ * loader/cache/CachedResourceLoader.cpp:
+ (WebCore::CachedResourceLoader::defaultCachedResourceOptions):
+ The correct ContentSecurityPolicyImposition should be DoPolicyCheck. This was the case on ToT but for
+ some reason it was changed to SkipPolicyCheck when the patch was merged.
+
+ * page/DOMSecurityPolicy.cpp:
+ (WebCore::DOMSecurityPolicy::allowsEval):
+ Pass false for overrideContentSecurityPolicy.
+
</ins><span class="cx"> 2015-07-23 Babak Shafiei <bshafiei@apple.com>
</span><span class="cx">
</span><span class="cx"> Roll out r185838.
</span></span></pre></div>
<a id="branchessafari6001417branchSourceWebCorebindingsjsScriptControllercpp"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1.4.17-branch/Source/WebCore/bindings/js/ScriptController.cpp (187360 => 187361)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1.4.17-branch/Source/WebCore/bindings/js/ScriptController.cpp        2015-07-24 21:03:09 UTC (rev 187360)
+++ branches/safari-600.1.4.17-branch/Source/WebCore/bindings/js/ScriptController.cpp        2015-07-24 21:08:16 UTC (rev 187361)
</span><span class="lines">@@ -241,9 +241,14 @@
</span><span class="cx">
</span><span class="cx"> windowShell->window()->updateDocument();
</span><span class="cx">
</span><del>- if (m_frame.document())
- windowShell->window()->setEvalEnabled(m_frame.document()->contentSecurityPolicy()->allowEval(0, ContentSecurityPolicy::SuppressReport), m_frame.document()->contentSecurityPolicy()->evalDisabledErrorMessage());
-
</del><ins>+ 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::SuppressReport), m_frame.document()->contentSecurityPolicy()->evalDisabledErrorMessage());
+ }
+
</ins><span class="cx"> if (Page* page = m_frame.page()) {
</span><span class="cx"> attachDebugger(windowShell, page->debugger());
</span><span class="cx"> windowShell->window()->setProfileGroup(page->group().identifier());
</span></span></pre></div>
<a id="branchessafari6001417branchSourceWebCoreloadercacheCachedResourceLoadercpp"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1.4.17-branch/Source/WebCore/loader/cache/CachedResourceLoader.cpp (187360 => 187361)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1.4.17-branch/Source/WebCore/loader/cache/CachedResourceLoader.cpp        2015-07-24 21:03:09 UTC (rev 187360)
+++ branches/safari-600.1.4.17-branch/Source/WebCore/loader/cache/CachedResourceLoader.cpp        2015-07-24 21:08:16 UTC (rev 187361)
</span><span class="lines">@@ -999,7 +999,7 @@
</span><span class="cx">
</span><span class="cx"> const ResourceLoaderOptions& CachedResourceLoader::defaultCachedResourceOptions()
</span><span class="cx"> {
</span><del>- static ResourceLoaderOptions options(SendCallbacks, SniffContent, BufferData, AllowStoredCredentials, AskClientForAllCredentials, DoSecurityCheck, UseDefaultOriginRestrictionsForType, ContentSecurityPolicyImposition::SkipPolicyCheck);
</del><ins>+ static ResourceLoaderOptions options(SendCallbacks, SniffContent, BufferData, AllowStoredCredentials, AskClientForAllCredentials, DoSecurityCheck, UseDefaultOriginRestrictionsForType, ContentSecurityPolicyImposition::DoPolicyCheck);
</ins><span class="cx"> return options;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="branchessafari6001417branchSourceWebCorepageDOMSecurityPolicycpp"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1.4.17-branch/Source/WebCore/page/DOMSecurityPolicy.cpp (187360 => 187361)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1.4.17-branch/Source/WebCore/page/DOMSecurityPolicy.cpp        2015-07-24 21:03:09 UTC (rev 187360)
+++ branches/safari-600.1.4.17-branch/Source/WebCore/page/DOMSecurityPolicy.cpp        2015-07-24 21:08:16 UTC (rev 187361)
</span><span class="lines">@@ -122,7 +122,7 @@
</span><span class="cx"> if (!isActive())
</span><span class="cx"> return true;
</span><span class="cx">
</span><del>- return scriptExecutionContext()->contentSecurityPolicy()->allowEval(0, ContentSecurityPolicy::SuppressReport);
</del><ins>+ return scriptExecutionContext()->contentSecurityPolicy()->allowEval(0, false, ContentSecurityPolicy::SuppressReport);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>