[webkit-changes] [WebKit/WebKit] 766629: Fire open and closed events when a tab is replaced.
Timothy Hatcher
noreply at github.com
Sun Jun 2 18:09:48 PDT 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 766629a0386fda276dd5d0db256a440056efd16c
https://github.com/WebKit/WebKit/commit/766629a0386fda276dd5d0db256a440056efd16c
Author: Timothy Hatcher <timothy at apple.com>
Date: 2024-06-02 (Sun, 02 Jun 2024)
Changed paths:
M Source/WebKit/UIProcess/Extensions/Cocoa/API/WebExtensionContextAPIRuntimeCocoa.mm
M Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionContextCocoa.mm
M Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionTabCocoa.mm
M Source/WebKit/UIProcess/Extensions/WebExtensionContext.h
M Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPITabsCocoa.mm
M Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPITabs.mm
M Tools/TestWebKitAPI/cocoa/WebExtensionUtilities.mm
Log Message:
-----------
Fire open and closed events when a tab is replaced.
https://webkit.org/b/274794
rdar://123344546
Reviewed by Brian Weinstein.
Fire the onCreated and onRemoved events when tabs are replaced. Also return errors
where an extension messages a tab that does not exist to prevent more confusing errors
later when tab properties are missing, etc. Also make sure to always include the windowId
and index properties on the tab object, even if they are -1 and NaN.
* Source/WebKit/UIProcess/Extensions/Cocoa/API/WebExtensionContextAPIRuntimeCocoa.mm:
(WebKit::WebExtensionContext::runtimeSendMessage): Added error if tab is not found.
(WebKit::WebExtensionContext::runtimeConnect): Ditto.
* Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionContextCocoa.mm:
(WebKit::WebExtensionContext::didCloseTab): Call forgetTab if the tab is already closed.
(WebKit::WebExtensionContext::didReplaceTab): Fire open and closed events.
* Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionTabCocoa.mm:
(WebKit::WebExtensionTab::parameters const): Always include window and index.
* Source/WebKit/UIProcess/Extensions/WebExtensionContext.h:
* Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPITabsCocoa.mm:
(WebKit::toWebAPI): Use toWebAPI for the index of notFound is returned as NaN.
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPITabs.mm:
(TestWebKitAPI::TEST(WKWebExtensionAPITabs, ReplacedEvent)): Added.
* Tools/TestWebKitAPI/cocoa/WebExtensionUtilities.mm:
(-[TestWebExtensionWindow replaceTab:withTab:]): Swap activeTab if it was active.
Canonical link: https://commits.webkit.org/279629@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