[webkit-changes] [WebKit/WebKit] f756fa: Add initial support for the browser.i18n Web Exten...
kiaraarose
noreply at github.com
Fri Aug 25 20:40:46 PDT 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: f756fa5b5b9132fec9add4ec28cb6f91c1d70409
https://github.com/WebKit/WebKit/commit/f756fa5b5b9132fec9add4ec28cb6f91c1d70409
Author: Kiara Rose <kiara_rose at apple.com>
Date: 2023-08-25 (Fri, 25 Aug 2023)
Changed paths:
M Source/WebKit/DerivedSources-input.xcfilelist
M Source/WebKit/DerivedSources-output.xcfilelist
M Source/WebKit/DerivedSources.make
M Source/WebKit/Modules/OSX_Private.modulemap
M Source/WebKit/Modules/iOS_Private.modulemap
M Source/WebKit/Platform/cocoa/CocoaHelpers.h
M Source/WebKit/Platform/cocoa/CocoaHelpers.mm
M Source/WebKit/Shared/Extensions/WebExtensionContextParameters.h
A Source/WebKit/Shared/Extensions/_WKWebExtensionLocalization.h
A Source/WebKit/Shared/Extensions/_WKWebExtensionLocalization.mm
M Source/WebKit/Shared/Extensions/_WKWebExtensionUtilities.mm
M Source/WebKit/UIProcess/API/Cocoa/_WKWebExtension.mm
M Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm
M Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionCocoa.mm
M Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionContextCocoa.mm
M Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionURLSchemeHandlerCocoa.mm
M Source/WebKit/UIProcess/Extensions/WebExtension.h
M Source/WebKit/UIProcess/Extensions/WebExtensionContext.cpp
M Source/WebKit/WebKit.xcodeproj/project.pbxproj
M Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIEventCocoa.mm
M Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIExtensionCocoa.mm
A Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPILocalizationCocoa.mm
M Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPINamespaceCocoa.mm
M Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIPermissionsCocoa.mm
M Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIWebNavigationCocoa.mm
A Source/WebKit/WebProcess/Extensions/API/WebExtensionAPILocalization.h
M Source/WebKit/WebProcess/Extensions/API/WebExtensionAPINamespace.h
A Source/WebKit/WebProcess/Extensions/Interfaces/WebExtensionAPILocalization.idl
M Source/WebKit/WebProcess/Extensions/Interfaces/WebExtensionAPINamespace.idl
Log Message:
-----------
Add initial support for the browser.i18n Web Extension API.
https://webkit.org/b/246488
rdar://102720462 (Web Extensions in WebKit: Add support for i18n(Localization) in WebKit)
Reviewed by Timothy Hatcher.
This patch exposes the i18n API to the browser namespace. In addition, it add support for the methods:
- i18n.getAcceptLanguages()
- i18n.getUILanguage()
To do:
- Add support for i18n.getMessage().
Testing:
- Localized names for extensions show up in UI.
* Source/WebKit/DerivedSources-input.xcfilelist:
* Source/WebKit/DerivedSources-output.xcfilelist:
* Source/WebKit/DerivedSources.make:
* Source/WebKit/Modules/OSX_Private.modulemap:
* Source/WebKit/Modules/iOS_Private.modulemap:
* Source/WebKit/Platform/cocoa/CocoaHelpers.h:
* Source/WebKit/Platform/cocoa/CocoaHelpers.mm:
(WebKit::dictionaryWithLowercaseKeys):
(WebKit::mergeDictionaries): Helper method that merges two dictionaries together.
(WebKit::mergeDictionariesAndSetValues): Helper method that merges two dictionaries together,
overwriting existing values.
(WebKit::localeStringInWebExtensionFormat):
(WebKit::privacyPreservingDescription):
(WebKit::toImpl):
(WebKit::toImplSet):
* Source/WebKit/Shared/Extensions/WebExtensionContextParameters.h:
* Source/WebKit/Shared/Extensions/_WKWebExtensionLocalization.h: Added.
* Source/WebKit/Shared/Extensions/_WKWebExtensionLocalization.mm: Added.
(localizationDictionaryAtURL):
(+[_WKWebExtensionLocalization supportsSecureCoding]):
(-[_WKWebExtensionLocalization initWithBundleURL:defaultLocale:uniqueIdentifier:]):
(-[_WKWebExtensionLocalization initWithRegionalLocalization:languageLocalization:defaultLocalization:withBestLocale:uniqueIdentifier:]):
(-[_WKWebExtensionLocalization localizedDictionaryForDictionary:]):
(-[_WKWebExtensionLocalization localizedStringForKey:withPlaceholders:]):
(-[_WKWebExtensionLocalization _localizedArrayForArray:]):
(-[_WKWebExtensionLocalization localizedStringForString:]):
(-[_WKWebExtensionLocalization _predefinedMessagesForLocale:]):
(-[_WKWebExtensionLocalization _stringByReplacingNamedPlaceholdersInString:withNamedPlaceholders:]):
(-[_WKWebExtensionLocalization _stringByReplacingPositionalPlaceholdersInString:withValues:]):
(-[_WKWebExtensionLocalization encodeWithCoder:]):
(-[_WKWebExtensionLocalization initWithCoder:]):
* Source/WebKit/Shared/Extensions/_WKWebExtensionUtilities.mm:
(+[_WKWebExtensionUtilities validateContentsOfDictionary:requiredKeys:optionalKeys:keyToExpectedValueType:outExceptionString:]):
Add error message.
* Source/WebKit/UIProcess/API/Cocoa/_WKWebExtension.mm:
(-[_WKWebExtension defaultLocale]):
* Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::WebProcessPool::registerNotificationObservers):
Update FIXME with appropriate bug URL.
* Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionCocoa.mm:
(WebKit::WebExtension::WebExtension):
(WebKit::WebExtension::manifest):
(WebKit::WebExtension::localization):
(WebKit::WebExtension::defaultLocale):
* Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionContextCocoa.mm:
* Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionURLSchemeHandlerCocoa.mm:
(WebKit::WebExtensionURLSchemeHandler::platformStartTask):
* Source/WebKit/UIProcess/Extensions/WebExtension.h:
* Source/WebKit/UIProcess/Extensions/WebExtensionContext.cpp:
(WebKit::WebExtensionContext::parameters const):
FIXME to add localization dictionary to parameters struct.
* Source/WebKit/WebKit.xcodeproj/project.pbxproj:
* Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIEventCocoa.mm:
* Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIExtensionCocoa.mm:
(WebKit::WebExtensionAPIExtension::getURL):
* Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPILocalizationCocoa.mm: Added.
(WebKit::WebExtensionAPILocalization::getMessage):
(WebKit::WebExtensionAPILocalization::getUILanguage):
(WebKit::WebExtensionAPILocalization::getAcceptLanguages):
* Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPINamespaceCocoa.mm:
(WebKit::WebExtensionAPINamespace::i18n):
Add i18n to the browser namespace.
* Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIPermissionsCocoa.mm:
Add links to documentation for Permissions APIs.
(WebKit::WebExtensionAPIPermissions::getAll):
(WebKit::WebExtensionAPIPermissions::contains):
(WebKit::WebExtensionAPIPermissions::request):
(WebKit::WebExtensionAPIPermissions::remove):
(WebKit::WebExtensionAPIPermissions::onAdded):
(WebKit::WebExtensionAPIPermissions::onRemoved):
* Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIWebNavigationCocoa.mm:
Add links to documentation for Web Navigation APIs.
(WebKit::WebExtensionAPIWebNavigation::onBeforeNavigate):
(WebKit::WebExtensionAPIWebNavigation::onCommitted):
(WebKit::WebExtensionAPIWebNavigation::onDOMContentLoaded):
(WebKit::WebExtensionAPIWebNavigation::onCompleted):
(WebKit::WebExtensionAPIWebNavigation::onErrorOccurred):
(WebKit::WebExtensionAPIWebNavigation::getAllFrames):
(WebKit::WebExtensionAPIWebNavigation::getFrame):
* Source/WebKit/WebProcess/Extensions/API/WebExtensionAPILocalization.h: Copied from Source/WebKit/Shared/Extensions/WebExtensionContextParameters.h.
* Source/WebKit/WebProcess/Extensions/API/WebExtensionAPINamespace.h:
* Source/WebKit/WebProcess/Extensions/Interfaces/WebExtensionAPILocalization.idl: Copied from Source/WebKit/WebProcess/Extensions/Interfaces/WebExtensionAPINamespace.idl.
* Source/WebKit/WebProcess/Extensions/Interfaces/WebExtensionAPINamespace.idl:
Add i18n to the browser namespace.
Canonical link: https://commits.webkit.org/267316@main
More information about the webkit-changes
mailing list