Changeset 206010 in webkit
- Timestamp:
- Sep 16, 2016 12:41:49 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r206009 r206010 1 2016-09-16 Youenn Fablet <youenn@apple.com> 2 3 Link loader should use FetchOptions::mode according its crossOrigin attribute 4 https://bugs.webkit.org/show_bug.cgi?id=161859 5 6 Reviewed by Sam Weinig. 7 8 * http/tests/security/cached-cross-origin-preloaded-css-stylesheet-expected.txt: Added. 9 * http/tests/security/cached-cross-origin-preloaded-css-stylesheet.html: Added. 10 * http/tests/security/cached-cross-origin-preloading-css-stylesheet-expected.txt: Added. 11 * http/tests/security/cached-cross-origin-preloading-css-stylesheet.html: Added. 12 * http/tests/security/resources/allow-if-origin.php: Adding support for allowing credentials and setting contentType. 13 1 14 2016-09-16 Youenn Fablet <youenn@apple.com> 2 15 -
trunk/LayoutTests/http/tests/security/resources/allow-if-origin.php
r205473 r206010 13 13 } 14 14 15 $allowCredentials = $_GET['allowCredentials']; 16 if (isset($allowCredentials)) 17 header("Access-Control-Allow-Credentials: true"); 18 15 19 $allowCache = $_GET['allowCache']; 16 20 if (isset($allowCache)) … … 23 27 $fp = fopen($name, 'rb'); 24 28 25 header("Content-Type: image/png"); 29 $contentType = $_GET['contentType']; 30 if (!isset($contentType)) 31 $contentType = 'image/png'; 32 33 header("Content-Type: " . $contentType); 34 26 35 header("Content-Length: " . filesize($name)); 27 36 -
trunk/Source/WebCore/ChangeLog
r206009 r206010 1 2016-09-16 Youenn Fablet <youenn@apple.com> 2 3 Link loader should use FetchOptions::mode according its crossOrigin attribute 4 https://bugs.webkit.org/show_bug.cgi?id=161859 5 6 Reviewed by Sam Weinig. 7 8 Tests: http/tests/security/cached-cross-origin-preloaded-css-stylesheet.html 9 http/tests/security/cached-cross-origin-preloading-css-stylesheet.html 10 11 Setting fetch mode according crossorigin attribute for link preload elements. 12 This allows calling onerror callback for CORS failures, which was not the case before the patch. 13 14 Making cached CSS stylesheet reusable accross origins and fetch modes. 15 16 * loader/LinkLoader.cpp: 17 (WebCore::LinkLoader::preloadIfNeeded): Using CachedResourceRequest::setAsPotentiallyCrossOrigin to set fetch mode. 18 * loader/cache/CachedCSSStyleSheet.cpp: 19 (WebCore::CachedCSSStyleSheet::sheetText): clean-up. 20 (WebCore::CachedCSSStyleSheet::setBodyDataFrom): Implementing data init for cached css stylesheets. 21 * loader/cache/CachedCSSStyleSheet.h: 22 * loader/cache/CachedResourceLoader.cpp: 23 (WebCore::CachedResourceLoader::updateCachedResourceWithCurrentRequest): Activating update support for stylesheets. 24 (WebCore::CachedResourceLoader::requestResource): Fixing for matching cached resources that need being reloaded due to different origin/fetch mode. 25 1 26 2016-09-16 Youenn Fablet <youenn@apple.com> 2 27 -
trunk/Source/WebCore/loader/LinkLoader.cpp
r205287 r206010 162 162 linkRequest.setInitiator("link"); 163 163 164 if (!crossOriginMode.isNull()) { 165 ASSERT(document.securityOrigin()); 166 StoredCredentials allowCredentials = equalLettersIgnoringASCIICase(crossOriginMode, "use-credentials") ? AllowStoredCredentials : DoNotAllowStoredCredentials; 167 updateRequestForAccessControl(linkRequest.mutableResourceRequest(), *document.securityOrigin(), allowCredentials); 168 } 164 linkRequest.setAsPotentiallyCrossOrigin(crossOriginMode, document); 169 165 linkRequest.setForPreload(true); 170 166 CachedResourceHandle<CachedResource> cachedLinkResource = document.cachedResourceLoader().preload(type.value(), linkRequest, emptyString(), CachedResourceLoader::ExplicitPreload); -
trunk/Source/WebCore/loader/cache/CachedCSSStyleSheet.cpp
r204466 r206010 77 77 return m_decoder->encoding().name(); 78 78 } 79 79 80 80 const String CachedCSSStyleSheet::sheetText(MIMETypeCheck mimeTypeCheck, bool* hasValidMIMEType) const 81 { 81 { 82 82 if (!m_data || m_data->isEmpty() || !canUseSheet(mimeTypeCheck, hasValidMIMEType)) 83 83 return String(); 84 84 85 85 if (!m_decodedSheetText.isNull()) 86 86 return m_decodedSheetText; 87 87 88 88 // Don't cache the decoded text, regenerating is cheap and it can use quite a bit of memory 89 89 return m_decoder->decodeAndFlush(m_data->data(), m_data->size()); 90 } 91 92 void CachedCSSStyleSheet::setBodyDataFrom(const CachedResource& resource) 93 { 94 ASSERT(resource.type() == type()); 95 const CachedCSSStyleSheet& sheet = static_cast<const CachedCSSStyleSheet&>(resource); 96 97 m_decoder = sheet.m_decoder; 98 m_decodedSheetText = sheet.m_decodedSheetText; 99 m_parsedStyleSheetCache = sheet.m_parsedStyleSheetCache; 90 100 } 91 101 -
trunk/Source/WebCore/loader/cache/CachedCSSStyleSheet.h
r204466 r206010 49 49 private: 50 50 bool canUseSheet(MIMETypeCheck, bool* hasValidMIMEType) const; 51 bool mayTryReplaceEncodedData() const override{ return true; }51 bool mayTryReplaceEncodedData() const final { return true; } 52 52 53 void didAddClient(CachedResourceClient*) override;53 void didAddClient(CachedResourceClient*) final; 54 54 55 void setEncoding(const String&) override; 56 String encoding() const override; 57 const TextResourceDecoder* textResourceDecoder() const override { return m_decoder.get(); } 58 void finishLoading(SharedBuffer*) override; 59 void destroyDecodedData() override; 55 void setEncoding(const String&) final; 56 String encoding() const final; 57 const TextResourceDecoder* textResourceDecoder() const final { return m_decoder.get(); } 58 void finishLoading(SharedBuffer*) final; 59 void destroyDecodedData() final; 60 61 void setBodyDataFrom(const CachedResource&) final; 60 62 61 63 protected: 62 void checkNotify() override;64 void checkNotify() final; 63 65 64 66 RefPtr<TextResourceDecoder> m_decoder; -
trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp
r205854 r206010 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::Script && resource.type() != CachedResource::Type::TextTrackResource )549 if (resource.type() != CachedResource::Type::ImageResource && resource.type() != CachedResource::Type::Script && resource.type() != CachedResource::Type::TextTrackResource && resource.type() != CachedResource::Type::CSSStyleSheet) 550 550 return false; 551 551
Note: See TracChangeset
for help on using the changeset viewer.