[webkit-changes] [WebKit/WebKit] fd7774: Add initial support for _WKWebExtensionWindow and ...
Timothy Hatcher
noreply at github.com
Mon Aug 21 13:43:19 PDT 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: fd7774b7dda952470cd5dfed81eb97f08ca8cdbb
https://github.com/WebKit/WebKit/commit/fd7774b7dda952470cd5dfed81eb97f08ca8cdbb
Author: Timothy Hatcher <timothy at apple.com>
Date: 2023-08-21 (Mon, 21 Aug 2023)
Changed paths:
M Source/WTF/wtf/WeakObjCPtr.h
M Source/WebKit/Platform/cocoa/CocoaHelpers.h
A Source/WebKit/Shared/Extensions/WebExtensionTabIdentifier.h
A Source/WebKit/Shared/Extensions/WebExtensionWindowIdentifier.h
M Source/WebKit/UIProcess/API/Cocoa/_WKWebExtensionContext.h
M Source/WebKit/UIProcess/API/Cocoa/_WKWebExtensionContext.mm
M Source/WebKit/UIProcess/API/Cocoa/_WKWebExtensionController.h
M Source/WebKit/UIProcess/API/Cocoa/_WKWebExtensionController.mm
M Source/WebKit/UIProcess/API/Cocoa/_WKWebExtensionControllerDelegate.h
M Source/WebKit/UIProcess/API/Cocoa/_WKWebExtensionTab.h
M Source/WebKit/UIProcess/API/Cocoa/_WKWebExtensionWindow.h
M Source/WebKit/UIProcess/Extensions/Cocoa/API/WebExtensionContextAPITestCocoa.mm
M Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionContextCocoa.mm
A Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionTabCocoa.mm
A Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionWindowCocoa.mm
M Source/WebKit/UIProcess/Extensions/WebExtensionContext.h
M Source/WebKit/UIProcess/Extensions/WebExtensionController.h
A Source/WebKit/UIProcess/Extensions/WebExtensionTab.h
A Source/WebKit/UIProcess/Extensions/WebExtensionWindow.h
M Source/WebKit/WebKit.xcodeproj/project.pbxproj
M Tools/TestWebKitAPI/SourcesCocoa.txt
M Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
A Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionTab.mm
A Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionWindow.mm
M Tools/TestWebKitAPI/Tests/WebKitCocoa/WebsitePolicies.mm
M Tools/TestWebKitAPI/cocoa/TestWebExtensionsDelegate.h
M Tools/TestWebKitAPI/cocoa/TestWebExtensionsDelegate.mm
Log Message:
-----------
Add initial support for _WKWebExtensionWindow and _WKWebExtensionTab APIs to _WKWebExtensionController and _WkWebExtensionContext.
https://bugs.webkit.org/show_bug.cgi?id=260156
Reviewed by Brian Weinstein.
Implements the main window and tab management APIs on _WKWebExtensionController and _WkWebExtensionContext for tracking open windows,
tabs and the focused window. Also corrects some missing nullability attributes on some methods and properties.
Added new WKWebExtensionWindow and WKWebExtensionTab tests for some of these APIs.
* Source/WTF/wtf/WeakObjCPtr.h:
(WTF::WeakObjCPtr::operator! const): Made one line.
(WTF::WeakObjCPtr::operator bool const): Added.
* Source/WebKit/Platform/cocoa/CocoaHelpers.h: Added THROW_UNLESS macro.
* Source/WebKit/Shared/Extensions/WebExtensionTabIdentifier.h: Added.
* Source/WebKit/Shared/Extensions/WebExtensionWindowIdentifier.h: Added.
* Source/WebKit/UIProcess/API/Cocoa/_WKWebExtensionContext.h:
* Source/WebKit/UIProcess/API/Cocoa/_WKWebExtensionContext.mm:
(-[_WKWebExtensionContext openWindows]): Added.
(-[_WKWebExtensionContext focusedWindow]): Added.
(-[_WKWebExtensionContext openTabs]): Added.
(-[_WKWebExtensionContext didOpenWindow:]): Added.
(-[_WKWebExtensionContext didCloseWindow:]): Added.
(-[_WKWebExtensionContext didFocusWindow:]): Added.
(-[_WKWebExtensionContext didOpenTab:]): Added.
(-[_WKWebExtensionContext didCloseTab:windowIsClosing:]): Added.
(-[_WKWebExtensionContext didSelectTabs:]): Added.
(-[_WKWebExtensionContext didMoveTab:fromIndex:inWindow:]): Added.
(-[_WKWebExtensionContext didReplaceTab:withTab:]): Added.
(-[_WKWebExtensionContext didChangeTabProperties:forTab:]): Added.
* Source/WebKit/UIProcess/API/Cocoa/_WKWebExtensionController.h:
* Source/WebKit/UIProcess/API/Cocoa/_WKWebExtensionController.mm:
(-[_WKWebExtensionController extensions]): Stop using a variable here.
(-[_WKWebExtensionController didOpenWindow:]): Added.
(-[_WKWebExtensionController didCloseWindow:]): Added.
(-[_WKWebExtensionController didFocusWindow:]): Added.
(-[_WKWebExtensionController didOpenTab:]): Added.
(-[_WKWebExtensionController didCloseTab:windowIsClosing:]): Added.
(-[_WKWebExtensionController didSelectTabs:]): Added.
(-[_WKWebExtensionController didMoveTab:fromIndex:inWindow:]): Added.
(-[_WKWebExtensionController didReplaceTab:withTab:]): Added.
(-[_WKWebExtensionController didChangeTabProperties:forTab:]): Added.
* Source/WebKit/UIProcess/API/Cocoa/_WKWebExtensionControllerDelegate.h:
* Source/WebKit/UIProcess/API/Cocoa/_WKWebExtensionTab.h:
* Source/WebKit/UIProcess/API/Cocoa/_WKWebExtensionWindow.h:
* Source/WebKit/UIProcess/Extensions/Cocoa/API/WebExtensionContextAPITestCocoa.mm:
(WebKit::WebExtensionContext::testResult): Use new delegate getter for cleaner approch.
(WebKit::WebExtensionContext::testEqual): Ditto.
(WebKit::WebExtensionContext::testMessage): Ditto.
(WebKit::WebExtensionContext::testYielded): Ditto.
(WebKit::WebExtensionContext::testFinished): Ditto.
* Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionContextCocoa.mm:
(WebKit::WebExtensionContext::load): Call populateWindowsAndTabs().
(WebKit::WebExtensionContext::getOrCreateWindow): Added.
(WebKit::WebExtensionContext::getWindow): Added.
(WebKit::WebExtensionContext::getOrCreateTab): Added.
(WebKit::WebExtensionContext::getTab): Added.
(WebKit::WebExtensionContext::populateWindowsAndTabs): Added.
(WebKit::WebExtensionContext::openWindows): Added.
(WebKit::WebExtensionContext::openTabs): Added.
(WebKit::WebExtensionContext::focusedWindow): Added.
(WebKit::WebExtensionContext::didOpenWindow): Added.
(WebKit::WebExtensionContext::didCloseWindow): Added.
(WebKit::WebExtensionContext::didFocusWindow): Added.
(WebKit::WebExtensionContext::didOpenTab): Added.
(WebKit::WebExtensionContext::didCloseTab): Added.
(WebKit::WebExtensionContext::didSelectTab): Added.
(WebKit::WebExtensionContext::didMoveTab): Added.
(WebKit::WebExtensionContext::didReplaceTab): Added.
(WebKit::WebExtensionContext::didChangeTabProperties): Added.
(WebKit::WebExtensionContext::webViewConfiguration):
* Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionTabCocoa.mm: Added.
(WebKit::WebExtensionTab::WebExtensionTab):
(WebKit::WebExtensionTab::window const):
(WebKit::WebExtensionTab::parentTab const):
(WebKit::WebExtensionTab::mainWebView const):
(WebKit::WebExtensionTab::webViews const):
(WebKit::WebExtensionTab::title const):
(WebKit::WebExtensionTab::isSelected const):
(WebKit::WebExtensionTab::isPinned const):
(WebKit::WebExtensionTab::toggleReaderMode):
(WebKit::WebExtensionTab::isReaderModeAvailable const):
(WebKit::WebExtensionTab::isShowingReaderMode const):
(WebKit::WebExtensionTab::mute):
(WebKit::WebExtensionTab::unmute):
(WebKit::WebExtensionTab::isAudible const):
(WebKit::WebExtensionTab::isMuted const):
(WebKit::WebExtensionTab::size const):
(WebKit::WebExtensionTab::zoomFactor const):
(WebKit::WebExtensionTab::url const):
(WebKit::WebExtensionTab::pendingURL const):
(WebKit::WebExtensionTab::isLoadingComplete const):
(WebKit::WebExtensionTab::detectWebpageLocale):
(WebKit::WebExtensionTab::loadURL):
(WebKit::WebExtensionTab::reload):
(WebKit::WebExtensionTab::reloadFromOrigin):
(WebKit::WebExtensionTab::goBack):
(WebKit::WebExtensionTab::goForward):
(WebKit::WebExtensionTab::close):
(WebKit::WebExtensionTab::select):
* Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionWindowCocoa.mm: Added.
(WebKit::WebExtensionWindow::WebExtensionWindow):
(WebKit::WebExtensionWindow::operator== const):
(WebKit::WebExtensionWindow::tabs const):
(WebKit::WebExtensionWindow::activeTab const):
(WebKit::toImpl):
(WebKit::WebExtensionWindow::type const):
(WebKit::WebExtensionWindow::state const):
(WebKit::WebExtensionWindow::isFocused const):
(WebKit::WebExtensionWindow::isEphemeral const):
(WebKit::WebExtensionWindow::frame const):
* Source/WebKit/UIProcess/Extensions/WebExtensionContext.h:
(WebKit::WebExtensionContext::didChangeTabProperties):
* Source/WebKit/UIProcess/Extensions/WebExtensionController.h:
(WebKit::WebExtensionController::delegate const):
* Source/WebKit/UIProcess/Extensions/WebExtensionTab.h: Added.
(WebKit::WebExtensionTab::create):
(WebKit::WebExtensionTab::identifier const):
(WebKit::WebExtensionTab::extensionContext const):
(WebKit::WebExtensionTab::delegate const):
(WebKit::WebExtensionTab::isValid const):
* Source/WebKit/UIProcess/Extensions/WebExtensionWindow.h: Added.
(WebKit::WebExtensionWindow::create):
(WebKit::WebExtensionWindow::identifier const):
(WebKit::WebExtensionWindow::extensionContext const):
(WebKit::WebExtensionWindow::delegate const):
(WebKit::WebExtensionWindow::isValid const):
* Source/WebKit/WebKit.xcodeproj/project.pbxproj:
* Tools/TestWebKitAPI/SourcesCocoa.txt:
* Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionTab.mm: Added.
(-[TestWindowForTabs tabsForWebExtensionContext:]):
(-[TestWindowForTabs activeTabForWebExtensionContext:]):
(TestWebKitAPI::TEST):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionWindow.mm: Added.
(TestWebKitAPI::TEST):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WebsitePolicies.mm: Fix build by including missing headers.
* Tools/TestWebKitAPI/cocoa/TestWebExtensionsDelegate.h:
* Tools/TestWebKitAPI/cocoa/TestWebExtensionsDelegate.mm:
(-[TestWebExtensionsDelegate webExtensionController:openWindowsForExtensionContext:]):
(-[TestWebExtensionsDelegate webExtensionController:focusedWindowForExtensionContext:]):
Canonical link: https://commits.webkit.org/267104@main
More information about the webkit-changes
mailing list