-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for simple Web Extension tabs APIs.
https://bugs.webkit.org/show_bug.cgi?id=261412 rdar://problem/115291352 Reviewed by Brian Weinstein. Support for tabs.reload(), goBack(), goForward(), detectLanguage(), toggleReaderMode(), setZoom(), getZoom(), and remove(). * Source/WebKit/Platform/cocoa/CocoaHelpers.h: * Source/WebKit/Platform/cocoa/CocoaHelpers.mm: (WebKit::localeStringInWebExtensionFormat): Deleted. * Source/WebKit/Shared/Extensions/WebExtensionTab.serialization.in: * Source/WebKit/Shared/Extensions/WebExtensionTabIdentifier.h: * Source/WebKit/Shared/Extensions/WebExtensionUtilities.h: * Source/WebKit/Shared/Extensions/WebExtensionUtilities.mm: (WebKit::toWebAPI): Added. Moved localeStringInWebExtensionFormat from CocoaHelpers. Since this is a Web Extension specific function it makes more since here. * Source/WebKit/Shared/Extensions/WebExtensionWindowIdentifier.h: * Source/WebKit/UIProcess/API/Cocoa/_WKWebExtensionContext.mm: (toAPI): Use WindowVector and TabMapValueIterator from WebExtensionContext. * Source/WebKit/UIProcess/Extensions/Cocoa/API/WebExtensionContextAPITabsCocoa.mm: (WebKit::WebExtensionContext::tabsReload): Added. (WebKit::WebExtensionContext::tabsGoBack): Added. (WebKit::WebExtensionContext::tabsGoForward): Added. (WebKit::WebExtensionContext::tabsDetectLanguage): Added. (WebKit::WebExtensionContext::tabsToggleReaderMode): Added. (WebKit::WebExtensionContext::tabsGetZoom): Added. (WebKit::WebExtensionContext::tabsSetZoom): Added. (WebKit::WebExtensionContext::tabsRemove): Added. * Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionContextCocoa.mm: (WebKit::WebExtensionContext::getWindow): Use page identifier to find the tab. (WebKit::WebExtensionContext::getTab): Added. Use page identifier to lookup active tab in window if a tab identifier isn't specified. (WebKit::WebExtensionContext::openWindows const): Made const and fixed a typo. (WebKit::WebExtensionContext::openWindows): Deleted. (WebKit::WebExtensionContext::openTabs): Deleted. Made inline in the header. * Source/WebKit/UIProcess/Extensions/WebExtensionContext.h: (WebKit::WebExtensionContext::openTabs const): * Source/WebKit/UIProcess/Extensions/WebExtensionContext.messages.in: * Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPILocalizationCocoa.mm: (WebKit::WebExtensionAPILocalization::getUILanguage): * Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPITabsCocoa.mm: (WebKit::WebExtensionAPITabs::remove): Implemented. Send message to the UIProcess. (WebKit::WebExtensionAPITabs::reload): Implemented. Ditto. (WebKit::WebExtensionAPITabs::goBack): Implemented. Ditto. (WebKit::WebExtensionAPITabs::goForward): Implemented. Ditto. (WebKit::WebExtensionAPITabs::getZoom): Implemented. Ditto. (WebKit::WebExtensionAPITabs::setZoom): Implemented. Ditto. (WebKit::WebExtensionAPITabs::detectLanguage): Implemented. Ditto. (WebKit::WebExtensionAPITabs::toggleReaderMode): Implemented. Ditto. * Source/WebKit/WebProcess/Extensions/API/WebExtensionAPITabs.h: * Source/WebKit/WebProcess/Extensions/Interfaces/WebExtensionAPITabs.idl: Added NeedsPage for more functions. * Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPITabs.mm: (TestWebKitAPI::TEST): Added tests for all added APIs. * Tools/TestWebKitAPI/cocoa/WebExtensionUtilities.h: * Tools/TestWebKitAPI/cocoa/WebExtensionUtilities.mm: (-[TestWebExtensionTab initWithWindow:extensionController:]): Store the extensions controller for later. (-[TestWebExtensionTab isShowingReaderModeForWebExtensionContext:]): Added. (-[TestWebExtensionTab toggleReaderModeForWebExtensionContext:completionHandler:]): Added. (-[TestWebExtensionTab detectWebpageLocaleForWebExtensionContext:completionHandler:]): Added. (-[TestWebExtensionTab reloadForWebExtensionContext:completionHandler:]): Added. (-[TestWebExtensionTab reloadFromOriginForWebExtensionContext:completionHandler:]): Added. (-[TestWebExtensionTab goBackForWebExtensionContext:completionHandler:]): Added. (-[TestWebExtensionTab goForwardForWebExtensionContext:completionHandler:]): Added. (-[TestWebExtensionTab closeForWebExtensionContext:completionHandler:]): (-[TestWebExtensionWindow init]): Make _tabs mutable. (-[TestWebExtensionWindow tabs]): Added. (-[TestWebExtensionWindow setTabs:]): Mutable copy. (-[TestWebExtensionWindow closeTab:]): Added. Canonical link: https://commits.webkit.org/267880@main
- Loading branch information
Showing
19 changed files
with
745 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.