[webkit-changes] [WebKit/WebKit] dabbc7: Pass parent frame ID and timestamp to webNavigatio...

Brian Weinstein noreply at github.com
Tue Nov 7 12:56:17 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: dabbc74d29e07c7a33ceb0373d72e7ea107f178a
      https://github.com/WebKit/WebKit/commit/dabbc74d29e07c7a33ceb0373d72e7ea107f178a
  Author: Brian Weinstein <bweinstein at apple.com>
  Date:   2023-11-07 (Tue, 07 Nov 2023)

  Changed paths:
    M Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionControllerCocoa.mm
    M Source/WebKit/UIProcess/Extensions/WebExtensionController.h
    M Source/WebKit/UIProcess/Extensions/WebExtensionController.messages.in
    M Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIWebNavigationCocoa.mm
    M Source/WebKit/WebProcess/Extensions/Cocoa/WebExtensionControllerProxyCocoa.mm
    M Source/WebKit/WebProcess/Extensions/WebExtensionContextProxy.h
    M Source/WebKit/WebProcess/Extensions/WebExtensionContextProxy.messages.in
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPIWebNavigation.mm

  Log Message:
  -----------
  Pass parent frame ID and timestamp to webNavigation handlers
https://bugs.webkit.org/show_bug.cgi?id=264345
rdar://102820594

Reviewed by Timothy Hatcher.

When firing the webNavigation events - make sure that we include additional information for parity with Safari. This includes:
- The parent frame ID (or none if the event is being fired for a main frame)
- The timestamp of the event

This information is all sent from WebExtensionControllerProxyCocoa -> WebExtensionControllerCocoa -> WebExtensionAPIWebNavigationCocoa.

This PR also fixes a bug where we were firing the wrong event (completed instead of committed in didCommitLoadForFrame).

It also fixes an issue with the web navigation tests (where we weren't spinning the run loop after loading a URL), and adding a test
verifying that all web navigation events are fired in a page load.

* Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionControllerCocoa.mm:
(WebKit::WebExtensionController::didStartProvisionalLoadForFrame): Pass the parent frame ID and timestamp along.
(WebKit::WebExtensionController::didCommitLoadForFrame): Ditto (and make sure we send the correct event!)
(WebKit::WebExtensionController::didFinishLoadForFrame): Ditto.
(WebKit::WebExtensionController::didFailLoadForFrame): Ditto.
* Source/WebKit/UIProcess/Extensions/WebExtensionController.h:
* Source/WebKit/UIProcess/Extensions/WebExtensionController.messages.in:
* Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIWebNavigationCocoa.mm:
(WebKit::WebExtensionContextProxy::dispatchWebNavigationEvent): Include the parent frame ID and timestamp in the details dictionary.
* Source/WebKit/WebProcess/Extensions/Cocoa/WebExtensionControllerProxyCocoa.mm:
(WebKit::WebExtensionControllerProxy::didStartProvisionalLoadForFrame): Pass the parent frame ID and timestamp along.
(WebKit::WebExtensionControllerProxy::didCommitLoadForFrame): Ditto.
(WebKit::WebExtensionControllerProxy::didFinishLoadForFrame): Ditto.
(WebKit::WebExtensionControllerProxy::didFailLoadForFrame): Ditto.
* Source/WebKit/WebProcess/Extensions/WebExtensionContextProxy.h:
* Source/WebKit/WebProcess/Extensions/WebExtensionContextProxy.messages.in:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPIWebNavigation.mm:
(TestWebKitAPI::TEST): Fix the tests by spinning the run loop, and add some new tests.

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




More information about the webkit-changes mailing list