[webkit-changes] [WebKit/WebKit] 721d1e: tabs.getSelected does not work for MV2 extensions.
Timothy Hatcher
noreply at github.com
Fri Aug 9 11:44:32 PDT 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 721d1e7f60f07b37be24a5cc3dcbb12d95ee48b7
https://github.com/WebKit/WebKit/commit/721d1e7f60f07b37be24a5cc3dcbb12d95ee48b7
Author: Timothy Hatcher <timothy at apple.com>
Date: 2024-08-09 (Fri, 09 Aug 2024)
Changed paths:
M Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionWindowCocoa.mm
M Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPITabs.mm
Log Message:
-----------
tabs.getSelected does not work for MV2 extensions.
https://webkit.org/b/277863
rdar://133546874
Reviewed by Brian Weinstein.
The `tabs.query` API included an optimization where `windowId: browser.windows.WINDOW_ID_CURRENT`
was simplified to `currentWindow: true`. However, this optimization occurred only at the parsing
level of the options, not within the UI process. This had an unintended impact on `tabs.getSelected`,
which was only passing the `active` and `windowIdentifier` parameters without the `currentWindow`
flag. As a result, the window identifier match check failed, leading to no results being returned.
To address this, we need a similar check for the current window identifier within the UI process.
This will allow us to correctly follow the current window path when performing window match checks.
* Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionWindowCocoa.mm:
(WebKit::WebExtensionWindow::matches const): Check `isCurrent` when using the `windowIdentifier`.
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPITabs.mm:
(TestWebKitAPI::TEST(WKWebExtensionAPITabs, GetSelected)): Added.
(TestWebKitAPI::TEST(WKWebExtensionAPITabs, QueryWithCurrentWindow)): Added.
Canonical link: https://commits.webkit.org/282055@main
To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications
More information about the webkit-changes
mailing list