[webkit-changes] [WebKit/WebKit] 5e245a: Allow tabs.update to be called without a tabID
Brian Weinstein
noreply at github.com
Thu Feb 22 15:13:47 PST 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 5e245ad06c697f9fd4b06a7592744ebb51a67d2d
https://github.com/WebKit/WebKit/commit/5e245ad06c697f9fd4b06a7592744ebb51a67d2d
Author: Brian Weinstein <bweinstein at apple.com>
Date: 2024-02-22 (Thu, 22 Feb 2024)
Changed paths:
M Source/WebKit/UIProcess/Extensions/Cocoa/API/WebExtensionContextAPITabsCocoa.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 Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPITabsCocoa.mm
M Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPIAction.mm
M Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPITabs.mm
Log Message:
-----------
Allow tabs.update to be called without a tabID
https://bugs.webkit.org/show_bug.cgi?id=269934
rdar://123407828
Reviewed by Timothy Hatcher.
The tabID is an optional argument to tabs.update. We were always attempting to get the value of the optional.
If it isn't passed, then it is meant to fall back to the active tab of the current context, which means:
- If this was called from a popup, then the active tab of the popup's window
- If this was called from the background page, then the active tab of the active window
This required some refactoring to WebExtensionContext::getTab and WebExtensionContext::getCurrentTab to support this,
and some tests were added calling this method without a tab ID from both contexts.
* Source/WebKit/UIProcess/Extensions/Cocoa/API/WebExtensionContextAPITabsCocoa.mm:
(WebKit::WebExtensionContext::tabsUpdate):
(WebKit::WebExtensionContext::tabsReload):
(WebKit::WebExtensionContext::tabsGoBack):
(WebKit::WebExtensionContext::tabsGoForward):
(WebKit::WebExtensionContext::tabsDetectLanguage):
(WebKit::WebExtensionContext::tabsToggleReaderMode):
(WebKit::WebExtensionContext::tabsGetZoom):
(WebKit::WebExtensionContext::tabsSetZoom):
(WebKit::WebExtensionContext::tabsExecuteScript):
(WebKit::WebExtensionContext::tabsInsertCSS):
(WebKit::WebExtensionContext::tabsRemoveCSS):
* Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionContextCocoa.mm:
(WebKit::WebExtensionContext::getWindow const):
(WebKit::WebExtensionContext::getTab const):
(WebKit::WebExtensionContext::getCurrentTab const):
* Source/WebKit/UIProcess/Extensions/WebExtensionContext.h:
* Source/WebKit/UIProcess/Extensions/WebExtensionContext.messages.in:
* Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPITabsCocoa.mm:
(WebKit::WebExtensionAPITabs::update):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPIAction.mm:
(TestWebKitAPI::TEST):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPITabs.mm:
(TestWebKitAPI::TEST):
Canonical link: https://commits.webkit.org/275204@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