[webkit-changes] [WebKit/WebKit] 589a9d: Add support for Web Extension windows APIs.

Timothy Hatcher noreply at github.com
Thu Aug 31 14:43:02 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 589a9da68d4ea19dffeee69c65375b872cca7c1b
      https://github.com/WebKit/WebKit/commit/589a9da68d4ea19dffeee69c65375b872cca7c1b
  Author: Timothy Hatcher <timothy at apple.com>
  Date:   2023-08-31 (Thu, 31 Aug 2023)

  Changed paths:
    M Source/WebKit/DerivedSources-input.xcfilelist
    M Source/WebKit/DerivedSources.make
    M Source/WebKit/Scripts/webkit/messages.py
    M Source/WebKit/Scripts/webkit/tests/MessageArgumentDescriptions.cpp
    M Source/WebKit/Shared/Extensions/WebExtensionEventListenerType.serialization.in
    A Source/WebKit/Shared/Extensions/WebExtensionTab.serialization.in
    M Source/WebKit/Shared/Extensions/WebExtensionTabIdentifier.h
    A Source/WebKit/Shared/Extensions/WebExtensionTabParameters.h
    A Source/WebKit/Shared/Extensions/WebExtensionWindow.serialization.in
    M Source/WebKit/Shared/Extensions/WebExtensionWindowIdentifier.h
    A Source/WebKit/Shared/Extensions/WebExtensionWindowParameters.h
    M Source/WebKit/Shared/Extensions/_WKWebExtensionUtilities.mm
    M Source/WebKit/UIProcess/API/Cocoa/_WKWebExtensionTabCreationOptionsInternal.h
    M Source/WebKit/UIProcess/API/Cocoa/_WKWebExtensionWindow.h
    M Source/WebKit/UIProcess/API/Cocoa/_WKWebExtensionWindowCreationOptions.h
    M Source/WebKit/UIProcess/API/Cocoa/_WKWebExtensionWindowCreationOptionsInternal.h
    A Source/WebKit/UIProcess/Extensions/Cocoa/API/WebExtensionContextAPIWindowsCocoa.mm
    M Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionContextCocoa.mm
    M Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionTabCocoa.mm
    M Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionWindowCocoa.mm
    M Source/WebKit/UIProcess/Extensions/WebExtensionContext.h
    M Source/WebKit/UIProcess/Extensions/WebExtensionContext.messages.in
    M Source/WebKit/UIProcess/Extensions/WebExtensionTab.h
    M Source/WebKit/UIProcess/Extensions/WebExtensionWindow.h
    M Source/WebKit/WebKit.xcodeproj/project.pbxproj
    M Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPITabsCocoa.mm
    M Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIWindowsCocoa.mm
    M Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIWindowsEventCocoa.mm
    M Source/WebKit/WebProcess/Extensions/API/WebExtensionAPITabs.h
    M Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIWindows.h
    M Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIWindowsEvent.h
    M Source/WebKit/WebProcess/Extensions/Interfaces/WebExtensionAPIWindows.idl
    M Tools/TestWebKitAPI/SourcesCocoa.txt
    M Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
    A Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPIWindows.mm
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionTab.mm
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionWindow.mm
    M Tools/TestWebKitAPI/cocoa/TestWebExtensionsDelegate.h
    M Tools/TestWebKitAPI/cocoa/TestWebExtensionsDelegate.mm
    M Tools/TestWebKitAPI/cocoa/WebExtensionUtilities.h
    M Tools/TestWebKitAPI/cocoa/WebExtensionUtilities.mm

  Log Message:
  -----------
  Add support for Web Extension windows APIs.
https://bugs.webkit.org/show_bug.cgi?id=260155
rdar://problem/114736173

Reviewed by Brian Weinstein.

Fully plumbs the windows API from JavaScript up to the Objective-C API.

* Source/WebKit/DerivedSources-input.xcfilelist: Addeed new files.
* Source/WebKit/DerivedSources.make: Added new files.
* Source/WebKit/Scripts/webkit/messages.py: Added new extension types.
(serialized_identifiers):
(types_that_cannot_be_forward_declared):
* Source/WebKit/Scripts/webkit/tests/MessageArgumentDescriptions.cpp: Updated with make command mentioned in messages.py comment.
(IPC::serializedIdentifiers):
* Source/WebKit/Shared/Extensions/WebExtensionEventListenerType.serialization.in:
* Source/WebKit/Shared/Extensions/WebExtensionTab.serialization.in: Added.
* Source/WebKit/Shared/Extensions/WebExtensionTabIdentifier.h:
(WebKit::isNone): Added.
(WebKit::isValid): Added.
(WebKit::toWebExtensionTabIdentifier): Added.
(WebKit::toWebAPI): Added.
* Source/WebKit/Shared/Extensions/WebExtensionTabParameters.h: Copied from Source/WebKit/UIProcess/API/Cocoa/_WKWebExtensionWindowCreationOptionsInternal.h.
* Source/WebKit/Shared/Extensions/WebExtensionWindow.serialization.in: Added.
* Source/WebKit/Shared/Extensions/WebExtensionWindowIdentifier.h:
(WebKit::isNone): Added.
(WebKit::isCurrent): Added.
(WebKit::isValid): Added.
(WebKit::toWebExtensionWindowIdentifier): Added.
(WebKit::toWebAPI): Added.
* Source/WebKit/Shared/Extensions/WebExtensionWindowParameters.h: Copied from Source/WebKit/Shared/Extensions/WebExtensionTabIdentifier.h.
* Source/WebKit/Shared/Extensions/_WKWebExtensionUtilities.mm:
(classToClassString): Use dot-syntax.
(+[_WKWebExtensionUtilities validateContentsOfDictionary:requiredKeys:optionalKeys:keyToExpectedValueType:outExceptionString:]):
Added support for NSSet input, where any class or array in the set can match. This is needed for the windows API that allows a single
URL or array of URLs. Also removed error logging, since this can be used for partial validation and it was causing log noise.
* Source/WebKit/UIProcess/API/Cocoa/_WKWebExtensionTabCreationOptionsInternal.h:
* Source/WebKit/UIProcess/API/Cocoa/_WKWebExtensionWindow.h:
* Source/WebKit/UIProcess/API/Cocoa/_WKWebExtensionWindowCreationOptions.h:
* Source/WebKit/UIProcess/API/Cocoa/_WKWebExtensionWindowCreationOptionsInternal.h:
* Source/WebKit/UIProcess/Extensions/Cocoa/API/WebExtensionContextAPIWindowsCocoa.mm: Added.
(WebKit::matchesFilter): Added.
(WebKit::WebExtensionContext::windowsCreate): Added.
(WebKit::WebExtensionContext::windowsGet): Added.
(WebKit::WebExtensionContext::windowsGetLastFocused): Added.
(WebKit::WebExtensionContext::windowsGetAll): Added.
(WebKit::WebExtensionContext::windowsUpdate): Added.
(WebKit::WebExtensionContext::windowsRemove): Added.
* Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionContextCocoa.mm:
(WebKit::WebExtensionContext::getOrCreateWindow): Tweaked logging.
(WebKit::WebExtensionContext::getWindow): Added current window support with FIXME.
(WebKit::WebExtensionContext::getOrCreateTab): Tweaked logging.
(WebKit::WebExtensionContext::getTab): Ditto.
(WebKit::WebExtensionContext::frontmostWindow): Added.
(WebKit::WebExtensionContext::didOpenWindow): Added logging.
(WebKit::WebExtensionContext::didCloseWindow): Ditto.
(WebKit::WebExtensionContext::didFocusWindow): Ditto.
(WebKit::WebExtensionContext::didOpenTab): Ditto.
(WebKit::WebExtensionContext::didCloseTab): Ditto.
(WebKit::WebExtensionContext::didActivateTab): Ditto.
(WebKit::WebExtensionContext::didSelectTabs): Ditto.
(WebKit::WebExtensionContext::didMoveTab): Ditto.
(WebKit::WebExtensionContext::didReplaceTab): Ditto.
(WebKit::WebExtensionContext::didChangeTabProperties): Ditto.
* Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionTabCocoa.mm:
(WebKit::WebExtensionTab::extensionContext const): Added here to fix build.
(WebKit::WebExtensionTab::parameters const): Added.
(WebKit::WebExtensionTab::toggleReaderMode): Call completion handler.
(WebKit::WebExtensionTab::mute): Ditto.
(WebKit::WebExtensionTab::unmute): Ditto.
(WebKit::WebExtensionTab::setZoomFactor): Ditto.
(WebKit::WebExtensionTab::loadURL): Ditto.
(WebKit::WebExtensionTab::reload): Ditto.
(WebKit::WebExtensionTab::reloadFromOrigin): Ditto.
(WebKit::WebExtensionTab::goBack): Ditto.
(WebKit::WebExtensionTab::goForward): Ditto.
(WebKit::WebExtensionTab::activate): Ditto.
(WebKit::WebExtensionTab::select): Ditto.
(WebKit::WebExtensionTab::duplicate): Ditto.
(WebKit::WebExtensionTab::close): Ditto.
* Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionWindowCocoa.mm:
(WebKit::WebExtensionWindow::WebExtensionWindow):
(WebKit::WebExtensionWindow::extensionContext const): Added here to fix build.
(WebKit::WebExtensionWindow::parameters const): Added.
(WebKit::toAPI): Added.
(WebKit::WebExtensionWindow::setState): Call completion handler.
(WebKit::WebExtensionWindow::focus):
(WebKit::WebExtensionWindow::normalizedFrame const): Added.
(WebKit::WebExtensionWindow::frame const): Added rect standardization.
(WebKit::WebExtensionWindow::setFrame): Call completion handler.
(WebKit::WebExtensionWindow::screenFrame const): Added.
(WebKit::WebExtensionWindow::close): Call completion handler.
* Source/WebKit/UIProcess/Extensions/WebExtensionContext.h:
* Source/WebKit/UIProcess/Extensions/WebExtensionContext.messages.in:
* Source/WebKit/UIProcess/Extensions/WebExtensionTab.h:
(WebKit::WebExtensionTab::extensionContext const): Deleted.
* Source/WebKit/UIProcess/Extensions/WebExtensionWindow.h:
(WebKit::WebExtensionWindow::extensionContext const): Deleted.
* Source/WebKit/WebKit.xcodeproj/project.pbxproj:
* Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPITabsCocoa.mm:
(WebKit::toWebAPI): Added stub.
* Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIWindowsCocoa.mm:
(WebKit::toWebAPI): Added.
(WebKit::toTypeImpl): Added.
(WebKit::toStateImpl): Added.
(WebKit::WebExtensionAPIWindows::parsePopulateTabs): Added.
(WebKit::WebExtensionAPIWindows::parseWindowTypesFilter): Added.
(WebKit::WebExtensionAPIWindows::parseWindowGetOptions): Added.
(WebKit::WebExtensionAPIWindows::parseWindowCreateOptions): Added.
(WebKit::WebExtensionAPIWindows::parseWindowUpdateOptions): Added.
(WebKit::WebExtensionAPIWindows::isPropertyAllowed): Added implementation.
(WebKit::WebExtensionAPIWindows::createWindow): Added implementation.
(WebKit::WebExtensionAPIWindows::get): Added implementation.
(WebKit::WebExtensionAPIWindows::getCurrent): Added implementation.
(WebKit::WebExtensionAPIWindows::getLastFocused): Added implementation.
(WebKit::WebExtensionAPIWindows::getAll): Added implementation.
(WebKit::WebExtensionAPIWindows::update): Added implementation.
(WebKit::WebExtensionAPIWindows::remove): Added implementation.
* Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIWindowsEventCocoa.mm:
(WebKit::WebExtensionAPIWindowsEvent::invokeListenersWithArgument): Use WebExtensionAPIWindows filter.
(WebKit::WebExtensionAPIWindowsEvent::addListener): Ditto.
* Source/WebKit/WebProcess/Extensions/API/WebExtensionAPITabs.h:
* Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIWindows.h:
(WebKit::WebExtensionAPIWindows::windowIdentifierNone const): Added.
(WebKit::WebExtensionAPIWindows::windowIdentifierCurrent const): Added.
* Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIWindowsEvent.h:
* Source/WebKit/WebProcess/Extensions/Interfaces/WebExtensionAPIWindows.idl: Added NeedsPage on a couple methods.
* Tools/TestWebKitAPI/SourcesCocoa.txt: Added new files.
* Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPIWindows.mm: Added.
(TestWebKitAPI::TEST):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionTab.mm:
(TestWebKitAPI::TEST): Use new TestWebExtensionWindow object.
(-[TestWindowForTabs tabsForWebExtensionContext:]): Deleted.
(-[TestWindowForTabs activeTabForWebExtensionContext:]): Deleted.
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionWindow.mm:
(TestWebKitAPI::TEST): Use new TestWebExtensionWindow object.
* Tools/TestWebKitAPI/cocoa/TestWebExtensionsDelegate.h:
* Tools/TestWebKitAPI/cocoa/TestWebExtensionsDelegate.mm:
(-[TestWebExtensionsDelegate webExtensionController:openNewWindowWithOptions:forExtensionContext:completionHandler:]): Added.
(-[TestWebExtensionsDelegate webExtensionController:openNewTabWithOptions:forExtensionContext:completionHandler:]): Added.
* Tools/TestWebKitAPI/cocoa/WebExtensionUtilities.h:
* Tools/TestWebKitAPI/cocoa/WebExtensionUtilities.mm:
(-[TestWebExtensionWindow init]): Added.
(-[TestWebExtensionWindow tabsForWebExtensionContext:]): Added.
(-[TestWebExtensionWindow activeTabForWebExtensionContext:]): Added.
(-[TestWebExtensionWindow windowTypeForWebExtensionContext:]): Added.
(-[TestWebExtensionWindow windowStateForWebExtensionContext:]): Added.
(-[TestWebExtensionWindow setWindowState:forWebExtensionContext:completionHandler:]): Added.
(-[TestWebExtensionWindow isUsingPrivateBrowsingForWebExtensionContext:]): Added.
(-[TestWebExtensionWindow screenFrameForWebExtensionContext:]): Added.
(-[TestWebExtensionWindow frameForWebExtensionContext:]): Added.
(-[TestWebExtensionWindow setFrame:forWebExtensionContext:completionHandler:]): Added.
(-[TestWebExtensionWindow focusForWebExtensionContext:completionHandler:]): Added.
(-[TestWebExtensionWindow closeForWebExtensionContext:completionHandler:]): Added.

Canonical link: https://commits.webkit.org/267522@main




More information about the webkit-changes mailing list