Changeset 210546 in webkit
- Timestamp:
- Jan 10, 2017 7:07:46 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r210538 r210546 1 2017-01-10 Youenn Fablet <youenn@apple.com> 2 3 CachedScript cloning does not clone encodedSize 4 https://bugs.webkit.org/show_bug.cgi?id=166865 5 6 Reviewed by Darin Adler. 7 8 * http/tests/security/cross-origin-cached-scripts-expected.txt: 9 * http/tests/security/cross-origin-cached-scripts.html: 10 * http/tests/security/resources/notify-loaded.js: 11 1 12 2017-01-09 Ryosuke Niwa <rniwa@webkit.org> 2 13 -
trunk/LayoutTests/http/tests/security/cross-origin-cached-scripts-expected.txt
r205854 r210546 10 10 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 11 11 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) 12 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) 13 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) 12 14 13 15 16 -
trunk/LayoutTests/http/tests/security/cross-origin-cached-scripts.html
r205854 r210546 11 11 <iframe id="iframe3"></iframe> 12 12 <iframe id="iframe4"></iframe> 13 </div> 14 <div> 15 <iframe id="iframe5"></iframe> 16 <iframe id="iframe6"></iframe> 13 17 </div> 14 18 <script> … … 28 32 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"; 29 33 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"; 34 var allow8000Script3 = "http://127.0.0.1:8080/security/resources/allow-if-origin.php?allowCache&origin=*&name=notify-loaded.js"; 30 35 31 36 var counter = 0; … … 33 38 { 34 39 counter++; 35 // Four first tests try to load an image with a given origin and then the same image(in cache) with a different origin.40 // Two first tests try to load a script with a given origin and then the same script (in cache) with a different origin. 36 41 if (counter == 1) 37 42 document.getElementById('iframe1').src = iframeURL8000 + "#" + 38 43 encodeURIComponent(JSON.stringify({node: "script", url: allow8000Script1, shouldPass: true, crossOrigin: "anonymous", id: 1})); 39 // Fourth image load should fail since requesting imagefrom localhost:8080 while only allowed from localhost:8000.44 // Load should fail since requesting script from localhost:8080 while only allowed from localhost:8000. 40 45 else if (counter == 2) 41 46 document.getElementById('iframe2').src = iframeURL8080 + "#" + 42 47 encodeURIComponent(JSON.stringify({node: "script", url: allow8000Script1, shouldPass: false, crossOrigin: "anonymous", id: 2})); 43 48 44 // Four next tests try to load a cross-origin imagewithout cors and then with cors.49 // Next two tests try to load a cross-origin script without cors and then with cors. 45 50 else if (counter == 3) 46 51 document.getElementById('iframe3').src = iframeURL8080 + "#" + … … 49 54 document.getElementById('iframe4').src = iframeURL8080 + "#" + 50 55 encodeURIComponent(JSON.stringify({node: "script", url: allow8000Script2, shouldPass:false, crossOrigin: "anonymous", id: 4})); 56 57 // Next two tests try to load a script with a given origin and then the same script (in cache) with a different origin. 58 else if (counter == 5) 59 document.getElementById('iframe5').src = iframeURL8000 + "#" + 60 encodeURIComponent(JSON.stringify({node: "script", url: allow8000Script3, shouldPass: true, crossOrigin: "anonymous", id: 5})); 61 // Load should succeed since cached script is allowed for all origins. 62 else if (counter == 6) 63 document.getElementById('iframe6').src = iframeURL8080 + "#" + 64 encodeURIComponent(JSON.stringify({node: "script", url: allow8000Script3, shouldPass: true, crossOrigin: "anonymous", id: 6})); 65 51 66 else if (window.testRunner) 52 67 testRunner.notifyDone(); -
trunk/LayoutTests/http/tests/security/resources/notify-loaded.js
r205854 r210546 1 document.body.innerHTML += "LOADED ";1 document.body.innerHTML += "LOADED with UTF-8 content ¢"; -
trunk/Source/WebCore/ChangeLog
r210544 r210546 1 2017-01-10 Youenn Fablet <youenn@apple.com> 2 3 CachedScript cloning does not clone encodedSize 4 https://bugs.webkit.org/show_bug.cgi?id=166865 5 6 Reviewed by Darin Adler. 7 8 Covered by updated test. 9 10 * loader/cache/CachedResource.cpp: 11 (WebCore::CachedResource::setBodyDataFrom): set encoded size based on being cloned resource. 12 * loader/cache/CachedScript.cpp: 13 (WebCore::CachedScript::script): 14 (WebCore::CachedScript::setBodyDataFrom): Making use of CachedResource::setBodyDataFrom for complete cloning. 15 1 16 2017-01-10 Zan Dobersek <zdobersek@igalia.com> 2 17 -
trunk/Source/WebCore/loader/cache/CachedResource.cpp
r209961 r210546 300 300 m_response = resource.m_response; 301 301 setDecodedSize(resource.decodedSize()); 302 setEncodedSize(resource.encodedSize()); 302 303 } 303 304 -
trunk/Source/WebCore/loader/cache/CachedScript.cpp
r206206 r210546 126 126 auto& script = static_cast<const CachedScript&>(resource); 127 127 128 m_data = script.m_data; 128 CachedResource::setBodyDataFrom(resource); 129 129 130 m_script = script.m_script; 130 131 m_scriptHash = script.m_scriptHash;
Note: See TracChangeset
for help on using the changeset viewer.