[webkit-changes] [WebKit/WebKit] 30e54a: Open links to external URLs in an action popup in ...

Timothy Hatcher noreply at github.com
Thu Feb 8 19:12:50 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 30e54aa959476ab18f558e3f5c6cf8ea8aaef965
      https://github.com/WebKit/WebKit/commit/30e54aa959476ab18f558e3f5c6cf8ea8aaef965
  Author: Timothy Hatcher <timothy at apple.com>
  Date:   2024-02-08 (Thu, 08 Feb 2024)

  Changed paths:
    M Source/WebKit/UIProcess/Extensions/Cocoa/API/WebExtensionContextAPITabsCocoa.mm
    M Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionActionCocoa.mm
    M Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionContextCocoa.mm
    M Source/WebKit/UIProcess/Extensions/WebExtensionContext.h
    M Source/WebKit/UIProcess/Extensions/WebExtensionContext.messages.in
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPIAction.mm

  Log Message:
  -----------
  Open links to external URLs in an action popup in a new tab.
https://webkit.org/b/269020
rdar://122110236

Reviewed by Brian Weinstein.

When a link is targeting a new widow or trying to navigate to a non-extension URL in the main
frame, use the tabs delegate to open a new tab at the index after the current tab.

* Source/WebKit/UIProcess/Extensions/Cocoa/API/WebExtensionContextAPITabsCocoa.mm:
(WebKit::WebExtensionContext::tabsCreate): Make the WebPageProxyIdentifier optional, since it isn't
always needed and will default to the current window if it is missing.
* Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionActionCocoa.mm:
(-[_WKWebExtensionActionWebViewDelegate webView:decidePolicyForNavigationAction:decisionHandler:]):
Use openNewTab() to open the target URL in a tab.
(-[_WKWebExtensionActionWebViewDelegate webViewWebContentProcessDidTerminate:]): Null check.
(-[_WKWebExtensionActionWebViewDelegate webViewDidClose:]): Ditto.
* Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionContextCocoa.mm:
(WebKit::WebExtensionContext::openNewTab): Added. Simple wrapper around tabsCreate().
* Source/WebKit/UIProcess/Extensions/WebExtensionContext.h:
* Source/WebKit/UIProcess/Extensions/WebExtensionContext.messages.in:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPIAction.mm:
(TEST(WKWebExtensionAPIAction, NavigationOpensInNewTab)): Added new test.

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




More information about the webkit-changes mailing list