Title: [284730] trunk/Source
- Revision
- 284730
- Author
- [email protected]
- Date
- 2021-10-22 17:19:28 -0700 (Fri, 22 Oct 2021)
Log Message
Preconnect to link's target on click
https://bugs.webkit.org/show_bug.cgi?id=232147
Reviewed by Alex Christensen.
Preconnect to link's target on click, for reduced page load time. This is a confirmed
progression on some of our page load time benchmarks.
* html/HTMLAnchorElement.cpp:
(WebCore::HTMLAnchorElement::handleClick):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (284729 => 284730)
--- trunk/Source/WebCore/ChangeLog 2021-10-23 00:04:56 UTC (rev 284729)
+++ trunk/Source/WebCore/ChangeLog 2021-10-23 00:19:28 UTC (rev 284730)
@@ -1,3 +1,16 @@
+2021-10-22 Chris Dumez <[email protected]>
+
+ Preconnect to link's target on click
+ https://bugs.webkit.org/show_bug.cgi?id=232147
+
+ Reviewed by Alex Christensen.
+
+ Preconnect to link's target on click, for reduced page load time. This is a confirmed
+ progression on some of our page load time benchmarks.
+
+ * html/HTMLAnchorElement.cpp:
+ (WebCore::HTMLAnchorElement::handleClick):
+
2021-10-22 Commit Queue <[email protected]>
Unreviewed, reverting r284713.
Modified: trunk/Source/WebCore/html/HTMLAnchorElement.cpp (284729 => 284730)
--- trunk/Source/WebCore/html/HTMLAnchorElement.cpp 2021-10-23 00:04:56 UTC (rev 284729)
+++ trunk/Source/WebCore/html/HTMLAnchorElement.cpp 2021-10-23 00:19:28 UTC (rev 284730)
@@ -40,9 +40,11 @@
#include "HTMLParserIdioms.h"
#include "HTMLPictureElement.h"
#include "KeyboardEvent.h"
+#include "LoaderStrategy.h"
#include "MouseEvent.h"
#include "PingLoader.h"
#include "PlatformMouseEvent.h"
+#include "PlatformStrategies.h"
#include "PrivateClickMeasurement.h"
#include "RegistrableDomain.h"
#include "RenderImage.h"
@@ -537,6 +539,12 @@
frame->loader().changeLocation(completedURL, effectiveTarget, &event, referrerPolicy, document().shouldOpenExternalURLsPolicyToPropagate(), newFrameOpenerPolicy, downloadAttribute, systemPreviewInfo, WTFMove(privateClickMeasurement));
sendPings(completedURL);
+
+ // Preconnect to the link's target for improved page load time.
+ if (completedURL.protocolIsInHTTPFamily()) {
+ auto storageCredentialsPolicy = frame->page() && frame->page()->canUseCredentialStorage() ? StoredCredentialsPolicy::Use : StoredCredentialsPolicy::DoNotUse;
+ platformStrategies()->loaderStrategy()->preconnectTo(frame->loader(), completedURL, storageCredentialsPolicy, nullptr);
+ }
}
// Falls back to using <base> element's target if the anchor does not have one.
Modified: trunk/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp (284729 => 284730)
--- trunk/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp 2021-10-23 00:04:56 UTC (rev 284729)
+++ trunk/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp 2021-10-23 00:19:28 UTC (rev 284730)
@@ -768,16 +768,17 @@
void WebLoaderStrategy::preconnectTo(FrameLoader& frameLoader, const URL& url, StoredCredentialsPolicy storedCredentialsPolicy, PreconnectCompletionHandler&& completionHandler)
{
- ASSERT(completionHandler);
auto* webFrameLoaderClient = toWebFrameLoaderClient(frameLoader.client());
if (!webFrameLoaderClient) {
- completionHandler(internalError(url));
+ if (completionHandler)
+ completionHandler(internalError(url));
return;
}
auto& webFrame = webFrameLoaderClient->webFrame();
auto* webPage = webFrame.page();
if (!webPage) {
- completionHandler(internalError(url));
+ if (completionHandler)
+ completionHandler(internalError(url));
return;
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes