Changeset 205854 in webkit
- Timestamp:
- Sep 12, 2016 11:46:15 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 10 added
- 1 deleted
- 14 edited
- 1 copied
- 4 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r205849 r205854 1 2016-09-12 Youenn Fablet <youenn@apple.com> 2 3 ScriptElement should use FetchOptions::mode according its crossOrigin attribute 4 https://bugs.webkit.org/show_bug.cgi?id=161686 5 6 Reviewed by Darin Adler. 7 8 Added new tests. 9 Updated cookie test for robustness as the order of the cookie items when more than one may not be preserved. 10 11 Moved one of the blink test to http/tests as it requires HTTP to run properly. 12 Updated blink test expectation as it is run from file, while it should be run from http. 13 14 Copied a similar test to http/tests/local to ensure that script load fails when served from the filesystem , CORS check failing. 15 The test was previously passing in WebKit as the test file was served from filesystem and was granted universal access. 16 The CORS checks were done through SecurityOrigin::canRequest which was testing that first. 17 With the patch, CORS checks are done at a lower level and do not take in to account universal access. 18 This aligns with Chrome and Firefox behavior. 19 20 * http/tests/local/script-crossorigin-loads-fail-origin-expected.txt: Added. 21 * http/tests/local/script-crossorigin-loads-fail-origin.html: Copied from LayoutTests/imported/blink/http/tests/security/script-crossorigin-loads-correctly-credentials.html. 22 * http/tests/cookies/resources/third-party-cookie-relaxing-iframe.html: Sorting the cookie to make the test more resistant. 23 * http/tests/security/cross-origin-cached-images-expected.txt: Added. 24 * http/tests/security/cross-origin-cached-images-parallel-expected.txt: Added. 25 * http/tests/security/cross-origin-cached-images-parallel.html: Renamed from LayoutTests/http/tests/security/cross-origin-cached-resource-parallel.html. 26 * http/tests/security/cross-origin-cached-images.html: Renamed from LayoutTests/http/tests/security/cross-origin-cached-resource.html. 27 * http/tests/security/cross-origin-cached-resource-parallel-expected.txt: Removed. 28 * http/tests/security/cross-origin-cached-scripts-expected.txt: Added. 29 * http/tests/security/cross-origin-cached-scripts-parallel-expected.txt: Added. 30 * http/tests/security/cross-origin-cached-scripts-parallel.html: Added. 31 * http/tests/security/cross-origin-cached-scripts.html: Added. 32 * http/tests/security/resources/cors-script.php: Updated according chromium script to activate CORS credentials header if requested. 33 * http/tests/security/resources/cross-origin-cached-resource-iframe.html: 34 * http/tests/security/resources/notify-loaded.js: Added. 35 * http/tests/security/script-crossorigin-loads-correctly-credentials-expected.txt: Renamed from LayoutTests/imported/blink/http/tests/security/script-crossorigin-loads-correctly-credentials-expected.txt. 36 * http/tests/security/script-crossorigin-loads-correctly-credentials.html: Renamed from LayoutTests/imported/blink/http/tests/security/script-crossorigin-loads-correctly-credentials.html. 37 * http/tests/security/script-with-dataurl-expected.txt: Added. 38 * http/tests/security/script-with-dataurl.html: Added. 39 * http/tests/security/script-with-failed-cors-check-fails-to-load-expected.txt: 40 1 41 2016-09-12 Fujii Hironori <Hironori.Fujii@sony.com> 2 42 -
trunk/LayoutTests/http/tests/cookies/resources/third-party-cookie-relaxing-iframe.html
r120167 r205854 22 22 } 23 23 24 function sortCookie(cookie) 25 { 26 var items = cookie.split("; "); 27 items.sort(); 28 return items.join("; "); 29 } 30 24 31 var stage = 1; 25 32 function showCookies() 26 33 { 27 alert("Test stage " + stage++ + " document.cookie is: " + document.cookie);28 parent.window.postMessage("done", "*"); 34 alert("Test stage " + stage++ + " document.cookie is: " + sortCookie(document.cookie)); 35 parent.window.postMessage("done", "*"); 29 36 } 30 37 -
trunk/LayoutTests/http/tests/local/script-crossorigin-loads-fail-origin.html
r205853 r205854 1 1 <body> 2 <p>This test passes if the script loads correctly.</p>2 <p>This test fails if the script loads correctly.</p> 3 3 <pre></pre> 4 4 <script> … … 16 16 var script = document.createElement("script"); 17 17 script.crossOrigin = "use-credentials"; 18 // We are serving the test from the filesystem, so it should fail as authorized origin is 127.0.0.1:8000. 18 19 script.src = "http://localhost:8000/security/resources/cors-script.php?credentials=true"; 19 script.onload = function() { done(" PASS"); }20 script.onerror = function() { done(" FAIL");}20 script.onload = function() { done("FAIL"); } 21 script.onerror = function() { done("PASS");} 21 22 document.body.appendChild(script); 22 23 </script> -
trunk/LayoutTests/http/tests/security/cross-origin-cached-images-parallel.html
r205853 r205854 2 2 <body> 3 3 <p>Tests source origin difference for cached resources.</p 4 <p>Trying to load sequentially the same image from various origins.</p> 5 <p>All images should load.</p> 4 <p>Trying to load sequentially the same image from different origins.</p> 6 5 <div id="console"></div> 7 6 <div> … … 41 40 42 41 var allowAllImage1 = "http://127.0.0.1:8000/security/resources/abe-allow-star.php?allowCache"; 43 var allow8000Image1 = "http://127.0.0.1:8000/security/resources/allow-if-origin.php?allowCache&origin=http%3A%2F%2Flocalhost%3A8000 ";42 var allow8000Image1 = "http://127.0.0.1:8000/security/resources/allow-if-origin.php?allowCache&origin=http%3A%2F%2Flocalhost%3A8000&delay=200"; 44 43 45 44 var allowAllImage2 = "http://127.0.0.1:8080/security/resources/abe-allow-star.php?allowCache"; 46 var allow8000Image2 = "http://127.0.0.1:8080/security/resources/allow-if-origin.php?allowCache&origin=http%3A%2F%2Flocalhost%3A8000 ";45 var allow8000Image2 = "http://127.0.0.1:8080/security/resources/allow-if-origin.php?allowCache&origin=http%3A%2F%2Flocalhost%3A8000&delay=200"; 47 46 48 47 document.getElementById('iframe1').src = iframeURL8000 + "#" + 49 encodeURIComponent(JSON.stringify({ url: allowAllImage1, shouldPass:true, crossOrigin: "anonymous", id: 1}));48 encodeURIComponent(JSON.stringify({node: "img", url: allowAllImage1, shouldPass:true, crossOrigin: "anonymous", id: 1})); 50 49 document.getElementById('iframe2').src = iframeURL8080 + "#" + 51 encodeURIComponent(JSON.stringify({ url: allowAllImage1, shouldPass: true, crossOrigin: "anonymous", id: 2}));50 encodeURIComponent(JSON.stringify({node: "img", url: allowAllImage1, shouldPass: true, crossOrigin: "anonymous", id: 2})); 52 51 document.getElementById('iframe3').src = iframeURL8000 + "#" + 53 encodeURIComponent(JSON.stringify({ url: allow8000Image1, shouldPass: true, crossOrigin: "anonymous", id: 3}));52 encodeURIComponent(JSON.stringify({node: "img", url: allow8000Image1, shouldPass: true, crossOrigin: "anonymous", id: 3})); 54 53 document.getElementById('iframe4').src = iframeURL8080 + "#" + 55 encodeURIComponent(JSON.stringify({ url: allow8000Image1, shouldPass: false, crossOrigin: "anonymous", id: 4}));54 encodeURIComponent(JSON.stringify({node: "img", url: allow8000Image1, shouldPass: false, crossOrigin: "anonymous", id: 4})); 56 55 57 56 document.getElementById('iframe5').src = iframeURL8000 + "#" + 58 encodeURIComponent(JSON.stringify({ url: allowAllImage2, shouldPass:true, id: 5}));57 encodeURIComponent(JSON.stringify({node: "img", url: allowAllImage2, shouldPass:true, id: 5})); 59 58 document.getElementById('iframe6').src = iframeURL8000 + "#" + 60 encodeURIComponent(JSON.stringify({ url: allowAllImage2, shouldPass:true, crossOrigin: "anonymous", id: 6}));59 encodeURIComponent(JSON.stringify({node: "img", url: allowAllImage2, shouldPass:true, crossOrigin: "anonymous", id: 6})); 61 60 document.getElementById('iframe7').src = iframeURL8080 + "#" + 62 encodeURIComponent(JSON.stringify({ url: allow8000Image2, shouldPass:true, id: 7}));61 encodeURIComponent(JSON.stringify({node: "img", url: allow8000Image2, shouldPass:true, id: 7})); 63 62 document.getElementById('iframe8').src = iframeURL8080 + "#" + 64 encodeURIComponent(JSON.stringify({ url: allow8000Image2, shouldPass:false, crossOrigin: "anonymous", id: 8}));63 encodeURIComponent(JSON.stringify({node: "img", url: allow8000Image2, shouldPass:false, crossOrigin: "anonymous", id: 8})); 65 64 </script> 66 65 </body> -
trunk/LayoutTests/http/tests/security/cross-origin-cached-images.html
r205853 r205854 2 2 <body> 3 3 <p>Tests source origin difference for cached resources.</p 4 <p>Trying to load sequentially the same image from various origins.</p> 5 <p>All images should load.</p> 4 <p>Trying to load sequentially the same image from different origins.</p> 6 5 <div id="console"></div> 7 6 <div> … … 44 43 if (counter == 1) 45 44 document.getElementById('iframe1').src = iframeURL8000 + "#" + 46 encodeURIComponent(JSON.stringify({ url: allowAllImage1, shouldPass:true, crossOrigin: "anonymous", id: 1}));45 encodeURIComponent(JSON.stringify({node: "img", url: allowAllImage1, shouldPass:true, crossOrigin: "anonymous", id: 1})); 47 46 else if (counter == 2) 48 47 document.getElementById('iframe2').src = iframeURL8080 + "#" + 49 encodeURIComponent(JSON.stringify({ url: allowAllImage1, shouldPass: true, crossOrigin: "anonymous", id: 2}));48 encodeURIComponent(JSON.stringify({node: "img", url: allowAllImage1, shouldPass: true, crossOrigin: "anonymous", id: 2})); 50 49 else if (counter == 3) 51 50 document.getElementById('iframe3').src = iframeURL8000 + "#" + 52 encodeURIComponent(JSON.stringify({ url: allow8000Image1, shouldPass: true, crossOrigin: "anonymous", id: 3}));51 encodeURIComponent(JSON.stringify({node: "img", url: allow8000Image1, shouldPass: true, crossOrigin: "anonymous", id: 3})); 53 52 // Fourth image load should fail since requesting image from localhost:8080 while only allowed from localhost:8000. 54 53 else if (counter == 4) 55 54 document.getElementById('iframe4').src = iframeURL8080 + "#" + 56 encodeURIComponent(JSON.stringify({ url: allow8000Image1, shouldPass: false, crossOrigin: "anonymous", id: 4}));55 encodeURIComponent(JSON.stringify({node: "img", url: allow8000Image1, shouldPass: false, crossOrigin: "anonymous", id: 4})); 57 56 58 57 // Four next tests try to load a cross-origin image without cors and then with cors. 59 58 else if (counter == 5) 60 59 document.getElementById('iframe5').src = iframeURL8000 + "#" + 61 encodeURIComponent(JSON.stringify({ url: allowAllImage2, shouldPass:true, id: 5}));60 encodeURIComponent(JSON.stringify({node: "img", url: allowAllImage2, shouldPass:true, id: 5})); 62 61 else if (counter == 6) 63 62 document.getElementById('iframe6').src = iframeURL8000 + "#" + 64 encodeURIComponent(JSON.stringify({ url: allowAllImage2, shouldPass:true, crossOrigin: "anonymous", id: 6}));63 encodeURIComponent(JSON.stringify({node: "img", url: allowAllImage2, shouldPass:true, crossOrigin: "anonymous", id: 6})); 65 64 else if (counter == 7) 66 65 document.getElementById('iframe7').src = iframeURL8080 + "#" + 67 encodeURIComponent(JSON.stringify({ url: allow8000Image2, shouldPass:true, id: 7}));66 encodeURIComponent(JSON.stringify({node: "img", url: allow8000Image2, shouldPass:true, id: 7})); 68 67 else if (counter == 8) 69 68 document.getElementById('iframe8').src = iframeURL8080 + "#" + 70 encodeURIComponent(JSON.stringify({ url: allow8000Image2, shouldPass:false, crossOrigin: "anonymous", id: 8}));69 encodeURIComponent(JSON.stringify({node: "img", url: allow8000Image2, shouldPass:false, crossOrigin: "anonymous", id: 8})); 71 70 else if (window.testRunner) 72 71 testRunner.notifyDone(); -
trunk/LayoutTests/http/tests/security/resources/cors-script.php
r135009 r205854 2 2 header("Access-Control-Allow-Origin: http://127.0.0.1:8000"); 3 3 header("Content-Type: application/javascript"); 4 5 if (strtolower($_GET["credentials"]) == "true") { 6 header("Access-Control-Allow-Credentials: true"); 7 } 8 4 9 if (strtolower($_GET["fail"]) == "true") 5 10 echo "throw({toString: function(){ return 'SomeError' }});"; -
trunk/LayoutTests/http/tests/security/resources/cross-origin-cached-resource-iframe.html
r205473 r205854 2 2 <body> 3 3 4 <img id="img" onload="logStatus(true)" onerror="logStatus(false)"/> 4 <img id="img" onload="logStatus(true)" onerror="logStatus(false)"></img> 5 <script id="script" onload="logStatus(true)" onerror="logStatus(false)"></script> 5 6 <script> 6 7 var test = JSON.parse(decodeURIComponent(location.hash.substring(1))); … … 12 13 13 14 msg += status ? "Loaded" : "Did not load"; 14 msg += " image " + img.src + " from " + location.host;15 msg += " " + test.node + " " + node.src + " from " + location.host; 15 16 if (test.crossOrigin) 16 17 msg += " (crossOrigin=" + test.crossOrigin + ")"; … … 19 20 } 20 21 21 var image = document.getElementById('img');22 var node = document.getElementById(test.node); 22 23 if (test.crossOrigin !== undefined) 23 image.crossOrigin = test.crossOrigin;24 image.src = test.url;24 node.crossOrigin = test.crossOrigin; 25 node.src = test.url; 25 26 </script> 26 27 </body> -
trunk/LayoutTests/http/tests/security/script-with-failed-cors-check-fails-to-load-expected.txt
r111359 r205854 1 CONSOLE MESSAGE: Origin http://127.0.0.1:8000 is not allowed by Access-Control-Allow-Origin. 1 2 CONSOLE MESSAGE: Cross-origin script load denied by Cross-Origin Resource Sharing policy. 2 3 This test passes if the script does not load. -
trunk/Source/WebCore/ChangeLog
r205853 r205854 1 2016-09-12 Youenn Fablet <youenn@apple.com> 2 3 ScriptElement should use FetchOptions::mode according its crossOrigin attribute 4 https://bugs.webkit.org/show_bug.cgi?id=161686 5 6 Reviewed by Darin Adler. 7 8 Setting ScriptElement fetch mode according its crossOrigin attribute. 9 Removing LoadableClassicScriptchecking of CORS since this is now done at ResourceLoader/CachedResource level. 10 11 Updating CachedResourceLoader to ensure that a resource that matches an on-going resource load but with different fetch mode/origin, 12 always gets its loading started if the resource state is not Cached. 13 14 Tests: fast/dom/script-crossorigin-loads-fail-origin.html 15 http/tests/security/cross-origin-cached-images-parallel.html 16 http/tests/security/cross-origin-cached-images.html 17 http/tests/security/cross-origin-cached-scripts-parallel.html 18 http/tests/security/cross-origin-cached-scripts.html 19 http/tests/security/script-crossorigin-loads-correctly-credentials.html 20 http/tests/security/script-with-dataurl.html 21 22 * dom/LoadableClassicScript.cpp: 23 (WebCore::LoadableClassicScript::create): 24 (WebCore::LoadableClassicScript::notifyFinished): Checking CORS failures using the resource state. 25 (WebCore::LoadableClassicScript::~LoadableClassicScript): Deleted. 26 (WebCore::LoadableClassicScript::isLoaded): Deleted. 27 * dom/LoadableClassicScript.h: 28 * dom/ScriptElement.cpp: 29 (WebCore::ScriptElement::requestClassicScript): 30 (WebCore::ScriptElement::requestScriptWithCache): Using CachedResourceRequest::setAsPotentiallyCrossOrigin to set fetch mode according crossOrigin attribute. 31 * dom/ScriptElement.h: 32 * loader/cache/CachedImage.cpp: 33 (WebCore::CachedImage::setBodyDataFrom): 34 * loader/cache/CachedResourceLoader.cpp: 35 (WebCore::CachedResourceLoader::updateCachedResourceWithCurrentRequest): Adding support for script resources. 36 (WebCore::CachedResourceLoader::requestResource): Ensuring that 'updated' resources gets actually loaded. 37 * loader/cache/CachedScript.cpp: 38 (WebCore::CachedScript::setBodyDataFrom): Implementing specific data copy from another CachedScript. 39 * loader/cache/CachedScript.h: 40 1 41 2016-09-12 Carlos Garcia Campos <cgarcia@igalia.com> 2 42 -
trunk/Source/WebCore/dom/LoadableClassicScript.cpp
r205583 r205854 34 34 namespace WebCore { 35 35 36 Ref<LoadableClassicScript> LoadableClassicScript::create(CachedResourceHandle<CachedScript>&& cachedScript , const String& crossOriginMode, SecurityOrigin& securityOrigin)36 Ref<LoadableClassicScript> LoadableClassicScript::create(CachedResourceHandle<CachedScript>&& cachedScript) 37 37 { 38 38 ASSERT(cachedScript); 39 auto script = adoptRef(*new LoadableClassicScript(WTFMove(cachedScript) , crossOriginMode, securityOrigin));39 auto script = adoptRef(*new LoadableClassicScript(WTFMove(cachedScript))); 40 40 cachedScript->addClient(script.ptr()); 41 41 return script; 42 }43 44 LoadableClassicScript::LoadableClassicScript(CachedResourceHandle<CachedScript>&& cachedScript, const String& crossOriginMode, SecurityOrigin& securityOrigin)45 : m_cachedScript(cachedScript)46 , m_securityOrigin(securityOrigin)47 , m_requestUsesAccessControl(!crossOriginMode.isNull())48 {49 42 } 50 43 … … 75 68 } 76 69 77 void LoadableClassicScript::notifyFinished(CachedResource* )70 void LoadableClassicScript::notifyFinished(CachedResource* resource) 78 71 { 79 if (!m_error && m_requestUsesAccessControl && !m_cachedScript->passesSameOriginPolicyCheck(m_securityOrigin.get())) { 72 ASSERT(resource); 73 if (resource->resourceError().isAccessControl()) { 80 74 static NeverDestroyed<String> consoleMessage(ASCIILiteral("Cross-origin script load denied by Cross-Origin Resource Sharing policy.")); 81 75 m_error = Error { -
trunk/Source/WebCore/dom/LoadableClassicScript.h
r205581 r205854 43 43 ~LoadableClassicScript(); 44 44 45 static Ref<LoadableClassicScript> create(CachedResourceHandle<CachedScript>&& , const String& crossOriginMode, SecurityOrigin&);45 static Ref<LoadableClassicScript> create(CachedResourceHandle<CachedScript>&&); 46 46 bool isLoaded() const override; 47 47 Optional<Error> wasErrored() const override; … … 54 54 55 55 private: 56 LoadableClassicScript(CachedResourceHandle<CachedScript>&& , const String& crossOriginMode, SecurityOrigin&);56 LoadableClassicScript(CachedResourceHandle<CachedScript>&& cachedScript) : m_cachedScript(WTFMove(cachedScript)) { } 57 57 58 58 void notifyFinished(CachedResource*) override; 59 59 60 60 CachedResourceHandle<CachedScript> m_cachedScript; 61 Ref<SecurityOrigin> m_securityOrigin;62 61 Optional<Error> m_error { Nullopt }; 63 bool m_requestUsesAccessControl;64 62 }; 65 63 -
trunk/Source/WebCore/dom/ScriptElement.cpp
r205695 r205854 264 264 ASSERT(!m_loadableScript); 265 265 if (!stripLeadingAndTrailingHTMLSpaces(sourceURL).isEmpty()) { 266 String crossOriginMode = m_element.attributeWithoutSynchronization(HTMLNames::crossoriginAttr); 267 auto request = requestScriptWithCache(m_element.document().completeURL(sourceURL), m_element.attributeWithoutSynchronization(HTMLNames::nonceAttr), crossOriginMode); 266 auto request = requestScriptWithCache(m_element.document().completeURL(sourceURL), m_element.attributeWithoutSynchronization(HTMLNames::nonceAttr)); 268 267 if (request) { 269 m_loadableScript = LoadableClassicScript::create(WTFMove(request) , crossOriginMode, *m_element.document().securityOrigin());268 m_loadableScript = LoadableClassicScript::create(WTFMove(request)); 270 269 m_isExternalScript = true; 271 270 } … … 281 280 } 282 281 283 CachedResourceHandle<CachedScript> ScriptElement::requestScriptWithCache(const URL& sourceURL, const String& nonceAttribute , const String& crossOriginMode)282 CachedResourceHandle<CachedScript> ScriptElement::requestScriptWithCache(const URL& sourceURL, const String& nonceAttribute) 284 283 { 285 284 bool hasKnownNonce = m_element.document().contentSecurityPolicy()->allowScriptWithNonce(nonceAttribute, m_element.isInUserAgentShadowTree()); … … 288 287 289 288 CachedResourceRequest request(ResourceRequest(sourceURL), options); 289 request.setAsPotentiallyCrossOrigin(m_element.attributeWithoutSynchronization(HTMLNames::crossoriginAttr), m_element.document()); 290 290 291 291 m_element.document().contentSecurityPolicy()->upgradeInsecureRequestIfNeeded(request.mutableResourceRequest(), ContentSecurityPolicy::InsecureRequestType::Load); 292 293 if (!crossOriginMode.isNull()) {294 StoredCredentials allowCredentials = equalLettersIgnoringASCIICase(crossOriginMode, "use-credentials") ? AllowStoredCredentials : DoNotAllowStoredCredentials;295 ASSERT(m_element.document().securityOrigin());296 updateRequestForAccessControl(request.mutableResourceRequest(), *m_element.document().securityOrigin(), allowCredentials);297 }298 292 299 293 request.setCharset(scriptCharset()); -
trunk/Source/WebCore/dom/ScriptElement.h
r205695 r205854 90 90 bool isScriptForEventSupported() const; 91 91 92 CachedResourceHandle<CachedScript> requestScriptWithCache(const URL&, const String& nonceAttribute, const String& crossoriginAttribute);92 CachedResourceHandle<CachedScript> requestScriptWithCache(const URL&, const String&); 93 93 94 94 bool requestClassicScript(const String& sourceURL); -
trunk/Source/WebCore/loader/cache/CachedImage.cpp
r205473 r205854 120 120 const CachedImage& image = static_cast<const CachedImage&>(resource); 121 121 122 setLoading(false);123 122 m_image = image.m_image; 124 123 -
trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp
r205750 r205854 547 547 548 548 // FIXME: We should progressively extend this to other reusable resources 549 if (resource.type() != CachedResource::Type::ImageResource && resource.type() != CachedResource::Type:: TextTrackResource)549 if (resource.type() != CachedResource::Type::ImageResource && resource.type() != CachedResource::Type::Script && resource.type() != CachedResource::Type::TextTrackResource) 550 550 return false; 551 551 … … 648 648 logMemoryCacheResourceRequest(frame(), resource ? DiagnosticLoggingKeys::inMemoryCacheKey() : DiagnosticLoggingKeys::notInMemoryCacheKey()); 649 649 650 constRevalidationPolicy policy = determineRevalidationPolicy(type, request, resource.get());650 RevalidationPolicy policy = determineRevalidationPolicy(type, request, resource.get()); 651 651 switch (policy) { 652 652 case Reload: … … 664 664 break; 665 665 case Use: 666 if (!updateCachedResourceWithCurrentRequest(request, resource)) { 666 if (updateCachedResourceWithCurrentRequest(request, resource)) { 667 if (resource->status() != CachedResource::Status::Cached) 668 policy = Load; 669 } else { 670 ASSERT(policy == Use); 667 671 if (!shouldContinueAfterNotifyingLoadedFromMemoryCache(request, resource.get())) 668 672 return nullptr; -
trunk/Source/WebCore/loader/cache/CachedScript.cpp
r204466 r205854 124 124 } 125 125 126 void CachedScript::setBodyDataFrom(const CachedResource& resource) 127 { 128 ASSERT(resource.type() == type()); 129 auto& script = static_cast<const CachedScript&>(resource); 130 131 m_data = script.m_data; 132 m_script = script.m_script; 133 m_scriptHash = script.m_scriptHash; 134 m_decodingState = script.m_decodingState; 135 m_decoder = script.m_decoder; 136 } 137 126 138 #if ENABLE(NOSNIFF) 127 139 bool CachedScript::mimeTypeAllowedByNosniff() const -
trunk/Source/WebCore/loader/cache/CachedScript.h
r199881 r205854 48 48 49 49 private: 50 bool mayTryReplaceEncodedData() const override{ return true; }50 bool mayTryReplaceEncodedData() const final { return true; } 51 51 52 bool shouldIgnoreHTTPStatusCodeErrors() const override;52 bool shouldIgnoreHTTPStatusCodeErrors() const final; 53 53 54 void setEncoding(const String&) override;55 String encoding() const override;56 const TextResourceDecoder* textResourceDecoder() const override{ return m_decoder.get(); }57 void finishLoading(SharedBuffer*) override;54 void setEncoding(const String&) final; 55 String encoding() const final; 56 const TextResourceDecoder* textResourceDecoder() const final { return m_decoder.get(); } 57 void finishLoading(SharedBuffer*) final; 58 58 59 void destroyDecodedData() override; 59 void destroyDecodedData() final; 60 61 void setBodyDataFrom(const CachedResource&) final; 60 62 61 63 String m_script;
Note: See TracChangeset
for help on using the changeset viewer.