[webkit-changes] [WebKit/WebKit] fbebac: Refactor preconnect upon top-level navigation pass...

Wenson Hsieh noreply at github.com
Wed Apr 26 12:06:49 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: fbebacb6a7cdd03a62ae5c3636c9296935a92046
      https://github.com/WebKit/WebKit/commit/fbebacb6a7cdd03a62ae5c3636c9296935a92046
  Author: Wenson Hsieh <wenson_hsieh at apple.com>
  Date:   2023-04-26 (Wed, 26 Apr 2023)

  Changed paths:
    M Source/WebKit/NetworkProcess/NetworkProcess.cpp
    M Source/WebKit/NetworkProcess/NetworkProcess.h
    M Source/WebKit/NetworkProcess/NetworkProcess.messages.in
    M Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
    M Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp
    M Source/WebKit/UIProcess/Network/NetworkProcessProxy.h
    M Source/WebKit/UIProcess/WebPageProxy.cpp
    M Source/WebKit/UIProcess/WebPageProxy.h
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/Preconnect.mm

  Log Message:
  -----------
  Refactor preconnect upon top-level navigation pass a WebCore::ResourceRequest to the network process
https://bugs.webkit.org/show_bug.cgi?id=255948
rdar://105895713

Reviewed by Tim Horton.

Refactor logic that preflights a preconnect request when using `-[WKWebView loadRequest:]`, such
that we plumb a `ResourceRequest` created from the original `NSURLRequest` over to the network
process, and use that for the preconnect. This ensures that a subset of platform (CFNetwork) policy
flags that are on the original `NSURLRequest` when calling `-loadRequest:` will be preserved when
performing the preconnect.

See below for more details.

Test: Preconnect.PrivacyProxyRequestFlags

* Source/WebKit/NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::preconnectTo):

Replace the request URL, user agent string, and whether or not the request attribution state with a
single `ResourceRequest` instead. Roll the attribution flag by using `setIsAppInitiated`.

* Source/WebKit/NetworkProcess/NetworkProcess.h:
* Source/WebKit/NetworkProcess/NetworkProcess.messages.in:
* Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _preconnectToServer:]):
* Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::preconnectTo):
* Source/WebKit/UIProcess/Network/NetworkProcessProxy.h:
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::loadRequestWithNavigationShared):
(WebKit::WebPageProxy::preconnectTo):

Relocate the comment in `NetworkProcess::preconnectTo` here, since we now set the predicted user
agent string on the request in the UI process.

* Source/WebKit/UIProcess/WebPageProxy.h:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/Preconnect.mm:

Canonical link: https://commits.webkit.org/263424@main




More information about the webkit-changes mailing list