Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: baf3eae87da202e1ab9d7ccb2dff883fe503e2bc
      
https://github.com/WebKit/WebKit/commit/baf3eae87da202e1ab9d7ccb2dff883fe503e2bc
  Author: Brian Weinstein <bweinst...@apple.com>
  Date:   2023-12-19 (Tue, 19 Dec 2023)

  Changed paths:
    M Source/WebCore/loader/FrameLoader.cpp
    M Source/WebCore/loader/FrameLoader.h
    M Source/WebKit/Shared/FrameInfoData.h
    M Source/WebKit/Shared/FrameInfoData.serialization.in
    M Source/WebKit/UIProcess/API/APIFrameInfo.h
    M Source/WebKit/UIProcess/API/Cocoa/WKFrameInfo.mm
    M Source/WebKit/UIProcess/API/Cocoa/WKFrameInfoPrivate.h
    M 
Source/WebKit/UIProcess/Extensions/Cocoa/API/WebExtensionContextAPIWebNavigationCocoa.mm
    M Source/WebKit/WebProcess/WebPage/WebFrame.cpp
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/Navigation.mm
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPIWebNavigation.mm

  Log Message:
  -----------
  Implement errorOccured in webNavigation.getFrame/getAllFrames
https://bugs.webkit.org/show_bug.cgi?id=266499
rdar://118340990

Reviewed by Alex Christensen and Timothy Hatcher.

Before this change, there was no way to determine if an error occurred in the 
load of a frame given a WKFrameInfo.

This patch pipes that information from the FrameLoader -> WebFrame -> 
WKFrameInfo, and exposes it as SPI on the WKFrameInfo.

This patch also adds some tests for both the new WKFrameInfo SPI and how it is 
exposed to extensions.

* Source/WebCore/loader/FrameLoader.cpp: Clear m_errorOccurredInLoading in all 
of the places that load start.
(WebCore::FrameLoader::dispatchDidFailProvisionalLoad): Set 
m_errorOccurredInLoading to true.
(WebCore::FrameLoader::checkLoadCompleteForThisFrame): Set 
m_errorOccurredInLoading to true if necessary.
* Source/WebCore/loader/FrameLoader.h:
* Source/WebKit/Shared/FrameInfoData.h: Add the new parameter.
* Source/WebKit/Shared/FrameInfoData.serialization.in: Ditto.
* Source/WebKit/UIProcess/API/APIFrameInfo.h:
* Source/WebKit/UIProcess/API/Cocoa/WKFrameInfo.mm:
(-[WKFrameInfo _errorOccurred]):
* Source/WebKit/UIProcess/API/Cocoa/WKFrameInfoPrivate.h:
* 
Source/WebKit/UIProcess/Extensions/Cocoa/API/WebExtensionContextAPIWebNavigationCocoa.mm:
(WebKit::frameParametersForFrame): Include whether or not an error occurred.
* Source/WebKit/WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::info const): Include whether or not an error occurred.
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPIWebNavigation.mm:
(TestWebKitAPI::TEST): Add a test that when a frame load fails with an error, 
errorOccurred is set in the getFrame call. There
are two flavors of this test, one with a failed provisional load, the other 
with a failed load after it had been committed.
* Tools/TestWebKitAPI/Tests/WebKitCocoa/Navigation.mm: Enhance the Frames test 
to:
1) Make sure the WKFrameInfo _errorOccurred SPI value is correct when loads 
fail and complete.
2) Perform an additional load after the failed load to make sure the error 
occurred state is reset.

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


_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to