Title: [210657] branches/safari-603-branch

Diff

Modified: branches/safari-603-branch/LayoutTests/ChangeLog (210656 => 210657)


--- 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)
@@ -1,5 +1,20 @@
 2017-01-12  Matthew Hanson  <[email protected]>
 
+        Merge r210546. rdar://problem/29491188
+
+    2017-01-10  Youenn Fablet  <[email protected]>
+
+            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  <[email protected]>
+
         Merge r210538. rdar://problem/29941747
 
     2017-01-09  Ryosuke Niwa  <[email protected]>

Modified: branches/safari-603-branch/LayoutTests/http/tests/security/cross-origin-cached-scripts-expected.txt (210656 => 210657)


--- 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)
@@ -9,5 +9,8 @@
 Test 2 PASS: Did not load script http://127.0.0.1:8000/security/resources/allow-if-origin.php?allowCache&origin=http%3A%2F%2Flocalhost%3A8000&name=notify-loaded.js from localhost:8080 (crossOrigin=anonymous)
 Test 3 PASS: Loaded script http://127.0.0.1:8080/security/resources/allow-if-origin.php?allowCache&origin=http%3A%2F%2Flocalhost%3A8000&name=notify-loaded.js from localhost:8080
 Test 4 PASS: Did not load script http://127.0.0.1:8080/security/resources/allow-if-origin.php?allowCache&origin=http%3A%2F%2Flocalhost%3A8000&name=notify-loaded.js from localhost:8080 (crossOrigin=anonymous)
+Test 5 PASS: Loaded script http://127.0.0.1:8080/security/resources/allow-if-origin.php?allowCache&origin=*&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&origin=*&name=notify-loaded.js from localhost:8080 (crossOrigin=anonymous)
   
   
+  

Modified: branches/safari-603-branch/LayoutTests/http/tests/security/cross-origin-cached-scripts.html (210656 => 210657)


--- 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)
@@ -11,6 +11,10 @@
     <iframe id="iframe3"></iframe>
     <iframe id="iframe4"></iframe>
 </div>
+<div>
+    <iframe id="iframe5"></iframe>
+    <iframe id="iframe6"></iframe>
+</div>
 <script>
 if (window.testRunner) {
    testRunner.dumpAsText();
@@ -27,21 +31,22 @@
 
 var allow8000Script1 = "http://127.0.0.1:8000/security/resources/allow-if-origin.php?allowCache&origin=http%3A%2F%2Flocalhost%3A8000&name=notify-loaded.js";
 var allow8000Script2 = "http://127.0.0.1:8080/security/resources/allow-if-origin.php?allowCache&origin=http%3A%2F%2Flocalhost%3A8000&name=notify-loaded.js";
+var allow8000Script3 = "http://127.0.0.1:8080/security/resources/allow-if-origin.php?allowCache&origin=*&name=notify-loaded.js";
 
 var counter = 0;
 function loadNextFrame()
 {
     counter++;
-    // Four first tests try to load an image with a given origin and then the same image (in cache) with a different origin.
+    // Two first tests try to load a script with a given origin and then the same script (in cache) with a different origin.
     if (counter == 1)
         document.getElementById('iframe1').src = "" + "#" +
             encodeURIComponent(JSON.stringify({node: "script", url: allow8000Script1, shouldPass: true, crossOrigin: "anonymous", id: 1}));
-    // Fourth image load should fail since requesting image from localhost:8080 while only allowed from localhost:8000.
+    // Load should fail since requesting script from localhost:8080 while only allowed from localhost:8000.
     else if (counter == 2)
         document.getElementById('iframe2').src = "" + "#" +
             encodeURIComponent(JSON.stringify({node: "script", url: allow8000Script1, shouldPass: false, crossOrigin: "anonymous", id: 2}));
 
-    // Four next tests try to load a cross-origin image without cors and then with cors.
+    // Next two tests try to load a cross-origin script without cors and then with cors.
     else if (counter == 3)
         document.getElementById('iframe3').src = "" + "#" +
             encodeURIComponent(JSON.stringify({node: "script", url: allow8000Script2, shouldPass:true, id: 3}));
@@ -48,6 +53,16 @@
     else if (counter == 4)
         document.getElementById('iframe4').src = "" + "#" +
             encodeURIComponent(JSON.stringify({node: "script", url: allow8000Script2, shouldPass:false, crossOrigin: "anonymous", id: 4}));
+
+    // 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 = "" + "#" +
+            encodeURIComponent(JSON.stringify({node: "script", url: allow8000Script3, shouldPass: true, crossOrigin: "anonymous", id: 5}));
+    // Load should succeed since cached script is allowed for all origins.
+    else if (counter == 6)
+        document.getElementById('iframe6').src = "" + "#" +
+            encodeURIComponent(JSON.stringify({node: "script", url: allow8000Script3, shouldPass: true, crossOrigin: "anonymous", id: 6}));
+
     else if (window.testRunner)
         testRunner.notifyDone();
 }

Modified: branches/safari-603-branch/LayoutTests/http/tests/security/resources/notify-loaded.js (210656 => 210657)


--- 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)
@@ -1 +1 @@
-document.body.innerHTML += "LOADED";
+document.body.innerHTML += "LOADED with UTF-8 content ยข";

Modified: branches/safari-603-branch/Source/WebCore/ChangeLog (210656 => 210657)


--- 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)
@@ -1,5 +1,24 @@
 2017-01-12  Matthew Hanson  <[email protected]>
 
+        Merge r210546. rdar://problem/29491188
+
+    2017-01-10  Youenn Fablet  <[email protected]>
+
+            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  <[email protected]>
+
         Merge r210508. rdar://problem/29801059
 
     2017-01-09  Daniel Bates  <[email protected]>

Modified: branches/safari-603-branch/Source/WebCore/loader/cache/CachedResource.cpp (210656 => 210657)


--- 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)
@@ -299,6 +299,7 @@
     m_data = resource.m_data;
     m_response = resource.m_response;
     setDecodedSize(resource.decodedSize());
+    setEncodedSize(resource.encodedSize());
 }
 
 void CachedResource::checkNotify()

Modified: branches/safari-603-branch/Source/WebCore/loader/cache/CachedScript.cpp (210656 => 210657)


--- 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)
@@ -125,7 +125,8 @@
     ASSERT(resource.type() == type());
     auto& script = static_cast<const CachedScript&>(resource);
 
-    m_data = script.m_data;
+    CachedResource::setBodyDataFrom(resource);
+
     m_script = script.m_script;
     m_scriptHash = script.m_scriptHash;
     m_decodingState = script.m_decodingState;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to