<!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>[210657] branches/safari-603-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/210657">210657</a></dd>
<dt>Author</dt> <dd>matthew_hanson@apple.com</dd>
<dt>Date</dt> <dd>2017-01-12 08:45:59 -0800 (Thu, 12 Jan 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/210546">r210546</a>. rdar://problem/29491188</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari603branchLayoutTestsChangeLog">branches/safari-603-branch/LayoutTests/ChangeLog</a></li>
<li><a href="#branchessafari603branchLayoutTestshttptestssecuritycrossorigincachedscriptsexpectedtxt">branches/safari-603-branch/LayoutTests/http/tests/security/cross-origin-cached-scripts-expected.txt</a></li>
<li><a href="#branchessafari603branchLayoutTestshttptestssecuritycrossorigincachedscriptshtml">branches/safari-603-branch/LayoutTests/http/tests/security/cross-origin-cached-scripts.html</a></li>
<li><a href="#branchessafari603branchLayoutTestshttptestssecurityresourcesnotifyloadedjs">branches/safari-603-branch/LayoutTests/http/tests/security/resources/notify-loaded.js</a></li>
<li><a href="#branchessafari603branchSourceWebCoreChangeLog">branches/safari-603-branch/Source/WebCore/ChangeLog</a></li>
<li><a href="#branchessafari603branchSourceWebCoreloadercacheCachedResourcecpp">branches/safari-603-branch/Source/WebCore/loader/cache/CachedResource.cpp</a></li>
<li><a href="#branchessafari603branchSourceWebCoreloadercacheCachedScriptcpp">branches/safari-603-branch/Source/WebCore/loader/cache/CachedScript.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari603branchLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/LayoutTests/ChangeLog (210656 => 210657)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/LayoutTests/ChangeLog        2017-01-12 16:45:56 UTC (rev 210656)
+++ branches/safari-603-branch/LayoutTests/ChangeLog        2017-01-12 16:45:59 UTC (rev 210657)
</span><span class="lines">@@ -1,5 +1,20 @@
</span><span class="cx"> 2017-01-12  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Merge r210546. rdar://problem/29491188
+
+    2017-01-10  Youenn Fablet  &lt;youenn@apple.com&gt;
+
+            CachedScript cloning does not clone encodedSize
+            https://bugs.webkit.org/show_bug.cgi?id=166865
+
+            Reviewed by Darin Adler.
+
+            * http/tests/security/cross-origin-cached-scripts-expected.txt:
+            * http/tests/security/cross-origin-cached-scripts.html:
+            * http/tests/security/resources/notify-loaded.js:
+
+2017-01-12  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
+
</ins><span class="cx">         Merge r210538. rdar://problem/29941747
</span><span class="cx"> 
</span><span class="cx">     2017-01-09  Ryosuke Niwa  &lt;rniwa@webkit.org&gt;
</span></span></pre></div>
<a id="branchessafari603branchLayoutTestshttptestssecuritycrossorigincachedscriptsexpectedtxt"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/LayoutTests/http/tests/security/cross-origin-cached-scripts-expected.txt (210656 => 210657)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/LayoutTests/http/tests/security/cross-origin-cached-scripts-expected.txt        2017-01-12 16:45:56 UTC (rev 210656)
+++ branches/safari-603-branch/LayoutTests/http/tests/security/cross-origin-cached-scripts-expected.txt        2017-01-12 16:45:59 UTC (rev 210657)
</span><span class="lines">@@ -9,5 +9,8 @@
</span><span class="cx"> Test 2 PASS: Did not load script http://127.0.0.1:8000/security/resources/allow-if-origin.php?allowCache&amp;origin=http%3A%2F%2Flocalhost%3A8000&amp;name=notify-loaded.js from localhost:8080 (crossOrigin=anonymous)
</span><span class="cx"> Test 3 PASS: Loaded script http://127.0.0.1:8080/security/resources/allow-if-origin.php?allowCache&amp;origin=http%3A%2F%2Flocalhost%3A8000&amp;name=notify-loaded.js from localhost:8080
</span><span class="cx"> Test 4 PASS: Did not load script http://127.0.0.1:8080/security/resources/allow-if-origin.php?allowCache&amp;origin=http%3A%2F%2Flocalhost%3A8000&amp;name=notify-loaded.js from localhost:8080 (crossOrigin=anonymous)
</span><ins>+Test 5 PASS: Loaded script http://127.0.0.1:8080/security/resources/allow-if-origin.php?allowCache&amp;origin=*&amp;name=notify-loaded.js from localhost:8000 (crossOrigin=anonymous)
+Test 6 PASS: Loaded script http://127.0.0.1:8080/security/resources/allow-if-origin.php?allowCache&amp;origin=*&amp;name=notify-loaded.js from localhost:8080 (crossOrigin=anonymous)
</ins><span class="cx">   
</span><span class="cx">   
</span><ins>+  
</ins></span></pre></div>
<a id="branchessafari603branchLayoutTestshttptestssecuritycrossorigincachedscriptshtml"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/LayoutTests/http/tests/security/cross-origin-cached-scripts.html (210656 => 210657)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/LayoutTests/http/tests/security/cross-origin-cached-scripts.html        2017-01-12 16:45:56 UTC (rev 210656)
+++ branches/safari-603-branch/LayoutTests/http/tests/security/cross-origin-cached-scripts.html        2017-01-12 16:45:59 UTC (rev 210657)
</span><span class="lines">@@ -11,6 +11,10 @@
</span><span class="cx">     &lt;iframe id=&quot;iframe3&quot;&gt;&lt;/iframe&gt;
</span><span class="cx">     &lt;iframe id=&quot;iframe4&quot;&gt;&lt;/iframe&gt;
</span><span class="cx"> &lt;/div&gt;
</span><ins>+&lt;div&gt;
+    &lt;iframe id=&quot;iframe5&quot;&gt;&lt;/iframe&gt;
+    &lt;iframe id=&quot;iframe6&quot;&gt;&lt;/iframe&gt;
+&lt;/div&gt;
</ins><span class="cx"> &lt;script&gt;
</span><span class="cx"> if (window.testRunner) {
</span><span class="cx">    testRunner.dumpAsText();
</span><span class="lines">@@ -27,21 +31,22 @@
</span><span class="cx"> 
</span><span class="cx"> var allow8000Script1 = &quot;http://127.0.0.1:8000/security/resources/allow-if-origin.php?allowCache&amp;origin=http%3A%2F%2Flocalhost%3A8000&amp;name=notify-loaded.js&quot;;
</span><span class="cx"> var allow8000Script2 = &quot;http://127.0.0.1:8080/security/resources/allow-if-origin.php?allowCache&amp;origin=http%3A%2F%2Flocalhost%3A8000&amp;name=notify-loaded.js&quot;;
</span><ins>+var allow8000Script3 = &quot;http://127.0.0.1:8080/security/resources/allow-if-origin.php?allowCache&amp;origin=*&amp;name=notify-loaded.js&quot;;
</ins><span class="cx"> 
</span><span class="cx"> var counter = 0;
</span><span class="cx"> function loadNextFrame()
</span><span class="cx"> {
</span><span class="cx">     counter++;
</span><del>-    // Four first tests try to load an image with a given origin and then the same image (in cache) with a different origin.
</del><ins>+    // Two first tests try to load a script with a given origin and then the same script (in cache) with a different origin.
</ins><span class="cx">     if (counter == 1)
</span><span class="cx">         document.getElementById('iframe1').src = iframeURL8000 + &quot;#&quot; +
</span><span class="cx">             encodeURIComponent(JSON.stringify({node: &quot;script&quot;, url: allow8000Script1, shouldPass: true, crossOrigin: &quot;anonymous&quot;, id: 1}));
</span><del>-    // Fourth image load should fail since requesting image from localhost:8080 while only allowed from localhost:8000.
</del><ins>+    // Load should fail since requesting script from localhost:8080 while only allowed from localhost:8000.
</ins><span class="cx">     else if (counter == 2)
</span><span class="cx">         document.getElementById('iframe2').src = iframeURL8080 + &quot;#&quot; +
</span><span class="cx">             encodeURIComponent(JSON.stringify({node: &quot;script&quot;, url: allow8000Script1, shouldPass: false, crossOrigin: &quot;anonymous&quot;, id: 2}));
</span><span class="cx"> 
</span><del>-    // Four next tests try to load a cross-origin image without cors and then with cors.
</del><ins>+    // Next two tests try to load a cross-origin script without cors and then with cors.
</ins><span class="cx">     else if (counter == 3)
</span><span class="cx">         document.getElementById('iframe3').src = iframeURL8080 + &quot;#&quot; +
</span><span class="cx">             encodeURIComponent(JSON.stringify({node: &quot;script&quot;, url: allow8000Script2, shouldPass:true, id: 3}));
</span><span class="lines">@@ -48,6 +53,16 @@
</span><span class="cx">     else if (counter == 4)
</span><span class="cx">         document.getElementById('iframe4').src = iframeURL8080 + &quot;#&quot; +
</span><span class="cx">             encodeURIComponent(JSON.stringify({node: &quot;script&quot;, url: allow8000Script2, shouldPass:false, crossOrigin: &quot;anonymous&quot;, id: 4}));
</span><ins>+
+    // Next two tests try to load a script with a given origin and then the same script (in cache) with a different origin.
+    else if (counter == 5)
+        document.getElementById('iframe5').src = iframeURL8000 + &quot;#&quot; +
+            encodeURIComponent(JSON.stringify({node: &quot;script&quot;, url: allow8000Script3, shouldPass: true, crossOrigin: &quot;anonymous&quot;, id: 5}));
+    // Load should succeed since cached script is allowed for all origins.
+    else if (counter == 6)
+        document.getElementById('iframe6').src = iframeURL8080 + &quot;#&quot; +
+            encodeURIComponent(JSON.stringify({node: &quot;script&quot;, url: allow8000Script3, shouldPass: true, crossOrigin: &quot;anonymous&quot;, id: 6}));
+
</ins><span class="cx">     else if (window.testRunner)
</span><span class="cx">         testRunner.notifyDone();
</span><span class="cx"> }
</span></span></pre></div>
<a id="branchessafari603branchLayoutTestshttptestssecurityresourcesnotifyloadedjs"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/LayoutTests/http/tests/security/resources/notify-loaded.js (210656 => 210657)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/LayoutTests/http/tests/security/resources/notify-loaded.js        2017-01-12 16:45:56 UTC (rev 210656)
+++ branches/safari-603-branch/LayoutTests/http/tests/security/resources/notify-loaded.js        2017-01-12 16:45:59 UTC (rev 210657)
</span><span class="lines">@@ -1 +1 @@
</span><del>-document.body.innerHTML += &quot;LOADED&quot;;
</del><ins>+document.body.innerHTML += &quot;LOADED with UTF-8 content ยข&quot;;
</ins></span></pre></div>
<a id="branchessafari603branchSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/WebCore/ChangeLog (210656 => 210657)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/WebCore/ChangeLog        2017-01-12 16:45:56 UTC (rev 210656)
+++ branches/safari-603-branch/Source/WebCore/ChangeLog        2017-01-12 16:45:59 UTC (rev 210657)
</span><span class="lines">@@ -1,5 +1,24 @@
</span><span class="cx"> 2017-01-12  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Merge r210546. rdar://problem/29491188
+
+    2017-01-10  Youenn Fablet  &lt;youenn@apple.com&gt;
+
+            CachedScript cloning does not clone encodedSize
+            https://bugs.webkit.org/show_bug.cgi?id=166865
+
+            Reviewed by Darin Adler.
+
+            Covered by updated test.
+
+            * loader/cache/CachedResource.cpp:
+            (WebCore::CachedResource::setBodyDataFrom): set encoded size based on being cloned resource.
+            * loader/cache/CachedScript.cpp:
+            (WebCore::CachedScript::script):
+            (WebCore::CachedScript::setBodyDataFrom): Making use of CachedResource::setBodyDataFrom for complete cloning.
+
+2017-01-12  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
+
</ins><span class="cx">         Merge r210508. rdar://problem/29801059
</span><span class="cx"> 
</span><span class="cx">     2017-01-09  Daniel Bates  &lt;dabates@apple.com&gt;
</span></span></pre></div>
<a id="branchessafari603branchSourceWebCoreloadercacheCachedResourcecpp"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/WebCore/loader/cache/CachedResource.cpp (210656 => 210657)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/WebCore/loader/cache/CachedResource.cpp        2017-01-12 16:45:56 UTC (rev 210656)
+++ branches/safari-603-branch/Source/WebCore/loader/cache/CachedResource.cpp        2017-01-12 16:45:59 UTC (rev 210657)
</span><span class="lines">@@ -299,6 +299,7 @@
</span><span class="cx">     m_data = resource.m_data;
</span><span class="cx">     m_response = resource.m_response;
</span><span class="cx">     setDecodedSize(resource.decodedSize());
</span><ins>+    setEncodedSize(resource.encodedSize());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void CachedResource::checkNotify()
</span></span></pre></div>
<a id="branchessafari603branchSourceWebCoreloadercacheCachedScriptcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/WebCore/loader/cache/CachedScript.cpp (210656 => 210657)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/WebCore/loader/cache/CachedScript.cpp        2017-01-12 16:45:56 UTC (rev 210656)
+++ branches/safari-603-branch/Source/WebCore/loader/cache/CachedScript.cpp        2017-01-12 16:45:59 UTC (rev 210657)
</span><span class="lines">@@ -125,7 +125,8 @@
</span><span class="cx">     ASSERT(resource.type() == type());
</span><span class="cx">     auto&amp; script = static_cast&lt;const CachedScript&amp;&gt;(resource);
</span><span class="cx"> 
</span><del>-    m_data = script.m_data;
</del><ins>+    CachedResource::setBodyDataFrom(resource);
+
</ins><span class="cx">     m_script = script.m_script;
</span><span class="cx">     m_scriptHash = script.m_scriptHash;
</span><span class="cx">     m_decodingState = script.m_decodingState;
</span></span></pre>
</div>
</div>

</body>
</html>