[webkit-changes] [WebKit/WebKit] d2610d: Route the rest of the WebNavigation events from We...

Brian Weinstein noreply at github.com
Fri Jan 6 19:06:49 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: d2610dc0dedb035d810463243743ee6c12136d2e
      https://github.com/WebKit/WebKit/commit/d2610dc0dedb035d810463243743ee6c12136d2e
  Author: Brian Weinstein <bweinstein at apple.com>
  Date:   2023-01-06 (Fri, 06 Jan 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/Cocoa/WebExtensionContextProxyCocoa.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 Source/WebKit/WebProcess/Extensions/WebExtensionControllerProxy.h
    M Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp

  Log Message:
  -----------
  Route the rest of the WebNavigation events from WebFrameLoaderClient to the extension event listeners.
https://bugs.webkit.org/show_bug.cgi?id=249683
rdar://102820594

Reviewed by Timothy Hatcher.

This patch allows WebFrameLoaderClient to tell web extensions code about the various stages of frame loading.

The flow is:
- WebFrameLoaderClient sends a message to the WebExtensionController using IPC.
- WebExtensionController iterates over all the WebExtensionContexts and:
        - Sends a message to their WebExtensionContextProxy using IPC.

WebFrameLoaderClient::dispatchDidCommitLoad -> onCommitted and onDOMContentLoaded
WebFrameLoaderClient::dispatchDidFinishLoad -> onCompleted
WebFrameLoaderClient::dispatchDidFailLoad -> onErrorOccurred

And then the WebExtensionContextProxy will fire the event on the extension pages that listen to it.

* Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionControllerCocoa.mm:
(WebKit::WebExtensionController::didCommitLoadForFrame): Call into the WebExtensionContextProxy.
(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/Cocoa/WebExtensionContextProxyCocoa.mm:
(WebKit::WebExtensionContextProxy::dispatchWebNavigationOnCommittedEvent): Iterate the namespace objects and call the
relevant listeners.
(WebKit::WebExtensionContextProxy::dispatchWebNavigationOnDOMContentLoadedEvent): Ditto.
(WebKit::WebExtensionContextProxy::dispatchWebNavigationOnCompletedEvent): Ditto.
(WebKit::WebExtensionContextProxy::dispatchWebNavigationOnErrorOccurredEvent): Ditto.
* Source/WebKit/WebProcess/Extensions/Cocoa/WebExtensionControllerProxyCocoa.mm:
(WebKit::WebExtensionControllerProxy::didCommitLoadForFrame): Send a message to the WebExtensionController in the UI process.
(WebKit::WebExtensionControllerProxy::didFinishLoadForFrame): Ditto.
(WebKit::WebExtensionControllerProxy::didFailLoadForFrame): Ditto.
* Source/WebKit/WebProcess/Extensions/WebExtensionContextProxy.h:
* Source/WebKit/WebProcess/Extensions/WebExtensionContextProxy.messages.in:
* Source/WebKit/WebProcess/Extensions/WebExtensionControllerProxy.h:
* Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchDidCommitLoad): Call into WebExtensionControllerProxy.
(WebKit::WebFrameLoaderClient::dispatchDidFailLoad): Ditto.
(WebKit::WebFrameLoaderClient::dispatchDidFinishLoad): Ditto.

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




More information about the webkit-changes mailing list