[webkit-changes] [WebKit/WebKit] 996faa: RedirectSOAuthorizationSession should support all ...

youennf noreply at github.com
Mon Jul 3 00:47:43 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 996faadd2f4f22a27bb80545a14a36d5007ae466
      https://github.com/WebKit/WebKit/commit/996faadd2f4f22a27bb80545a14a36d5007ae466
  Author: Youenn Fablet <youennf at gmail.com>
  Date:   2023-07-03 (Mon, 03 Jul 2023)

  Changed paths:
    M Source/WebCore/loader/DocumentLoader.cpp
    M Source/WebCore/loader/DocumentLoader.h
    M Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp
    M Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h
    M Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in
    M Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp
    M Source/WebKit/NetworkProcess/NetworkResourceLoader.h
    M Source/WebKit/UIProcess/Cocoa/SOAuthorization/RedirectSOAuthorizationSession.mm
    M Source/WebKit/UIProcess/WebPageProxy.cpp
    M Source/WebKit/UIProcess/WebPageProxy.h
    M Source/WebKit/WebProcess/WebPage/WebPage.cpp
    M Source/WebKit/WebProcess/WebPage/WebPage.h
    M Source/WebKit/WebProcess/WebPage/WebPage.messages.in
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/SOAuthorizationTests.mm

  Log Message:
  -----------
  RedirectSOAuthorizationSession should support all redirections
https://bugs.webkit.org/show_bug.cgi?id=254263
rdar://106379935

Reviewed by Alex Christensen.

Handle SSO redirections in the loader code path.
This has the benefit of supporting all redirections, including 307 redirections.
This also simplifies the UIProcess code path.

We need to handle redirections in two ways:
- Either the SSO redirection happens while the load has not started.
  We handle it at DocumentLoader level by enabling to use substitute data for redirections.
- Or the SSO redirection happens while the load already started (redirection case).
  In that case, we register the redirection in network process so that NetworkResourceLoader handles it.

We add some tests and need to update some tests as redirections from file URLs to HTTP is not allowed.

This new code path is only enabled for 307 redirections on a POST request for now.
This patch should not change behavior for other interceptions.
In the future, we will probably move all redirections to follow that new code path.

Coverd by existing and added API tests.

* Source/WebCore/loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::handleSubstituteDataLoadNow):
(WebCore::DocumentLoader::redirectReceived):
(WebCore::DocumentLoader::setRedirectionAsSubstituteData):
* Source/WebCore/loader/DocumentLoader.h:
* Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::useRedirectionForCurrentNavigation):
* Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h:
* Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in:
* Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::continueWillSendRequest):
(WebKit::NetworkResourceLoader::useRedirectionForCurrentNavigation):
* Source/WebKit/NetworkProcess/NetworkResourceLoader.h:
* Source/WebKit/UIProcess/Cocoa/SOAuthorization/RedirectSOAuthorizationSession.mm:
(WebKit::RedirectSOAuthorizationSession::completeInternal):
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::useRedirectionForCurrentNavigation):
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::useRedirectionForCurrentNavigation):
* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Source/WebKit/WebProcess/WebPage/WebPage.messages.in:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/SOAuthorizationTests.mm:
(-[TestSOAuthorizationBasicDelegate webView:didFinishNavigation:]):
(-[TestSOAuthorizationDelegate webView:didFinishNavigation:]):
(-[TestSOAuthorizationDelegate webView:decidePolicyForNavigationAction:decisionHandler:]):
(overrideBeginAuthorizationWithURL):
(TestWebKitAPI::TEST):

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




More information about the webkit-changes mailing list