Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a11141aec40e4c9852477bc6634d7a57f4a80b81
      
https://github.com/WebKit/WebKit/commit/a11141aec40e4c9852477bc6634d7a57f4a80b81
  Author: Sihui Liu <[email protected]>
  Date:   2024-10-22 (Tue, 22 Oct 2024)

  Changed paths:
    M Source/WebKit/UIProcess/API/APINavigationAction.h
    M Source/WebKit/UIProcess/WebPageProxy.cpp
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/Navigation.mm
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm

  Log Message:
  -----------
  Regression(284719@main): Message check in 
NetworkConnectionToWebProcess::cookiesEnabled failed
https://bugs.webkit.org/show_bug.cgi?id=281896
rdar://137986334

Reviewed by Alex Christensen.

284719@main added an early return in 
WebPageProxy::receivedNavigationActionPolicyDecision, so that process does not 
swap
when navigated frame is main frame but does not equal to the main frame of 
WebPageProxy. This is not right because a
navigated frame does not necessarily equal to the main frame of WebPageProxy, 
and we still need to swap process in that
case.

See the new API test for an example: on first redirection from site1.example to 
site2.example, a new main frame is
created and loaded in a new web process, and WebPageProxy still tracks the old 
main frame since the load is not
committed yet; on second redirection from site2.example to site1.example, the 
navigated frame is the new frame, which
does not match the main frame of WebPageProxy. With existing implementation, 
the load of site1.example will continue in
the process of site2.example (due to the early return), but that process is not 
prepared for the load, i.e.
AddAllowedFirstPartyForCookies for site1.example is not sent to that process, 
and that leads to message check failure
when site1.example (loaded in process of site2.example) performs cookie 
operations.

To fix this, this patch takes a different approach from 284719@main by only 
making early return in
receivedNavigationActionPolicyDecisionwhen main frame of WebPageProxy is 
changed after receving navigation request and
before decision is made.

Test: ProcessSwap.CookieAccessAfterMultipleRedirects

* Source/WebKit/UIProcess/API/APINavigationAction.h:
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::receivedNavigationActionPolicyDecision):
(WebKit::WebPageProxy::decidePolicyForNavigationAction):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/Navigation.mm:
(TEST(WKNavigation, HTTPSOnlyWithHTTPRedirect)):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:
((ProcessSwap, CookieAccessAfterMultipleRedirects)):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to