Changeset 227235 in webkit
- Timestamp:
- Jan 19, 2018 2:16:21 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r227225 r227235 1 2018-01-19 Yoav Weiss <yoav@yoav.ws> 2 3 Support for preconnect Link headers 4 https://bugs.webkit.org/show_bug.cgi?id=181657 5 6 Reviewed by Darin Adler. 7 8 Add test to see Link preconnect headers trigger a connection. 9 10 * http/tests/preconnect/link-header-rel-preconnect-http-expected.txt: Added. 11 * http/tests/preconnect/link-header-rel-preconnect-http.html: Added. 12 * http/tests/preconnect/resources/header-preconnect.php: Added. 13 * platform/ios-simulator/TestExpectations: Skipped the test, as ios-simulator doesn't process Link headers for subresources. 14 * platform/win/TestExpectations: Skipped the preconnect test directory, as it doesn't work on Windows. 15 1 16 2018-01-19 Joseph Pecoraro <pecoraro@apple.com> 2 17 -
trunk/LayoutTests/platform/ios-simulator/TestExpectations
r226322 r227235 60 60 webgl/1.0.2/conformance/uniforms/uniform-default-values.html [ Failure ] 61 61 62 # ios-simulator does not process link headers for subresources 63 webkit.org/b/181789 http/tests/preconnect/link-header-rel-preconnect-http.html [ Skip ] 64 62 65 # This test requires Skia, which isn't available on iOS. 63 66 webkit.org/b/174079 fast/text/variations/skia-postscript-name.html [ ImageOnlyFailure ] -
trunk/LayoutTests/platform/win/TestExpectations
r227200 r227235 3787 3787 # preconnect tests are failing on Windows. 3788 3788 webkit.org/b/177626 fast/dom/HTMLLinkElement/preconnect-support.html [ Skip ] 3789 webkit.org/b/177626 http/tests/preconnect/link-rel-preconnect-http.html [ Skip ] 3790 webkit.org/b/177626 http/tests/preconnect/link-rel-preconnect-https.html [ Skip ] 3789 webkit.org/b/177626 http/tests/preconnect/ [ Skip ] 3791 3790 3792 3791 webkit.org/b/177964 fast/text/font-display/block-nofinish.html [ Pass ImageOnlyFailure ] -
trunk/Source/WebCore/ChangeLog
r227225 r227235 1 2018-01-19 Yoav Weiss <yoav@yoav.ws> 2 3 Support for preconnect Link headers 4 https://bugs.webkit.org/show_bug.cgi?id=181657 5 6 Reviewed by Darin Adler. 7 8 Move the preconnect functionality into its own function, and 9 also call this function when Link headers are processed. 10 11 Test: http/tests/preconnect/link-header-rel-preconnect-http.php 12 13 * loader/LinkLoader.cpp: 14 (WebCore::LinkLoader::loadLinksFromHeader): Call preconnectIfNeeded. 15 (WebCore::LinkLoader::preconnectIfNeeded): Preconnect to a host functionality moved here. 16 (WebCore::LinkLoader::loadLink): Call preconnectIfNeeded. 17 * loader/LinkLoader.h: 18 1 19 2018-01-19 Joseph Pecoraro <pecoraro@apple.com> 2 20 -
trunk/Source/WebCore/loader/LinkLoader.cpp
r227005 r227235 111 111 if (equalIgnoringFragmentIdentifier(url, baseURL)) 112 112 continue; 113 preconnectIfNeeded(relAttribute, url, document, header.crossOrigin()); 113 114 preloadIfNeeded(relAttribute, url, document, header.as(), header.media(), header.mimeType(), header.crossOrigin(), nullptr); 114 115 } … … 212 213 } 213 214 215 void LinkLoader::preconnectIfNeeded(const LinkRelAttribute& relAttribute, const URL& href, Document& document, const String& crossOrigin) 216 { 217 if (!relAttribute.isLinkPreconnect || !href.isValid() || !href.protocolIsInHTTPFamily() || !document.frame()) 218 return; 219 ASSERT(document.settings().linkPreconnectEnabled()); 220 StoredCredentialsPolicy storageCredentialsPolicy = StoredCredentialsPolicy::Use; 221 if (equalIgnoringASCIICase(crossOrigin, "anonymous") && document.securityOrigin().canAccess(SecurityOrigin::create(href))) 222 storageCredentialsPolicy = StoredCredentialsPolicy::DoNotUse; 223 ASSERT(document.frame()->loader().networkingContext()); 224 platformStrategies()->loaderStrategy()->preconnectTo(*document.frame()->loader().networkingContext(), href, storageCredentialsPolicy, [weakDocument = document.createWeakPtr(), href](ResourceError error) { 225 if (!weakDocument) 226 return; 227 228 if (!error.isNull()) 229 weakDocument->addConsoleMessage(MessageSource::Network, MessageLevel::Error, makeString(ASCIILiteral("Failed to preconnect to "), href.string(), ASCIILiteral(". Error: "), error.localizedDescription())); 230 else 231 weakDocument->addConsoleMessage(MessageSource::Network, MessageLevel::Info, makeString(ASCIILiteral("Successfuly preconnected to "), href.string())); 232 }); 233 } 234 214 235 std::unique_ptr<LinkPreloadResourceClient> LinkLoader::preloadIfNeeded(const LinkRelAttribute& relAttribute, const URL& href, Document& document, const String& as, const String& media, const String& mimeType, const String& crossOriginMode, LinkLoader* loader) 215 236 { … … 260 281 } 261 282 262 if (relAttribute.isLinkPreconnect && href.isValid() && href.protocolIsInHTTPFamily() && document.frame()) { 263 ASSERT(document.settings().linkPreconnectEnabled()); 264 StoredCredentialsPolicy storageCredentialsPolicy = StoredCredentialsPolicy::Use; 265 if (equalIgnoringASCIICase(crossOrigin, "anonymous") && document.securityOrigin().canAccess(SecurityOrigin::create(href))) 266 storageCredentialsPolicy = StoredCredentialsPolicy::DoNotUse; 267 ASSERT(document.frame()->loader().networkingContext()); 268 platformStrategies()->loaderStrategy()->preconnectTo(*document.frame()->loader().networkingContext(), href, storageCredentialsPolicy, [weakDocument = document.createWeakPtr(), href](ResourceError error) { 269 if (!weakDocument) 270 return; 271 272 if (!error.isNull()) 273 weakDocument->addConsoleMessage(MessageSource::Network, MessageLevel::Error, makeString(ASCIILiteral("Failed to preconnect to "), href.string(), ASCIILiteral(". Error: "), error.localizedDescription())); 274 else 275 weakDocument->addConsoleMessage(MessageSource::Network, MessageLevel::Info, makeString(ASCIILiteral("Successfuly preconnected to "), href.string())); 276 }); 277 } 283 preconnectIfNeeded(relAttribute, href, document, crossOrigin); 278 284 279 285 if (m_client.shouldLoadLink()) { -
trunk/Source/WebCore/loader/LinkLoader.h
r227005 r227235 65 65 private: 66 66 void notifyFinished(CachedResource&) override; 67 static void preconnectIfNeeded(const LinkRelAttribute&, const URL& href, Document&, const String& crossOrigin); 67 68 static std::unique_ptr<LinkPreloadResourceClient> preloadIfNeeded(const LinkRelAttribute&, const URL& href, Document&, const String& as, const String& media, const String& type, const String& crossOriginMode, LinkLoader*); 68 69
Note: See TracChangeset
for help on using the changeset viewer.