[webkit-changes] [WebKit/WebKit] fac656: Getting a storage key with a default value of null...
Timothy Hatcher
noreply at github.com
Tue Oct 1 17:05:14 PDT 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: fac656126566d0436ace95cfe2bffcfe32e4a3a2
https://github.com/WebKit/WebKit/commit/fac656126566d0436ace95cfe2bffcfe32e4a3a2
Author: Timothy Hatcher <timothy at apple.com>
Date: 2024-10-01 (Tue, 01 Oct 2024)
Changed paths:
M Source/WebKit/WebProcess/Extensions/Bindings/Cocoa/JSWebExtensionWrapperCocoa.mm
M Source/WebKit/WebProcess/Extensions/Bindings/JSWebExtensionWrapper.h
M Source/WebKit/WebProcess/Extensions/Bindings/Scripts/CodeGeneratorExtensions.pm
M Source/WebKit/WebProcess/Extensions/Interfaces/WebExtensionAPIStorageArea.idl
M Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPIStorage.mm
Log Message:
-----------
Getting a storage key with a default value of null returns undefined.
https://webkit.org/b/280687
rdar://problem/137056816
Reviewed by Brian Weinstein.
The web extension code generator was stripping the `null` values from the dictionary, since that is
the default behavior for objects in the web extension API. However, we need to allow them in the `get()`
function for storage to allow `null` to be a default value. This is allowed and tested for `set()`
already with `NSDictionary=StopAtTopLevel`, we just didn't support it for the broader `NSObject`
attribute in the IDL. Safari 17 handled this manually, that was missed when we moved to WebKit.
* Source/WebKit/WebProcess/Extensions/Bindings/Cocoa/JSWebExtensionWrapperCocoa.mm:
(WebKit::toNSObject): Added `NullPolicy` and `ValuePolicy` params to match `toNSDictionary`.
* Source/WebKit/WebProcess/Extensions/Bindings/JSWebExtensionWrapper.h:
* Source/WebKit/WebProcess/Extensions/Bindings/Scripts/CodeGeneratorExtensions.pm:
(_platformTypeConstructor): Add support for `NullAllowed` and `StopAtTopLevel` to `NSObject` attribute.
* Source/WebKit/WebProcess/Extensions/Interfaces/WebExtensionAPIStorageArea.idl:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPIStorage.mm:
(TestWebKitAPI::TEST(WKWebExtensionAPIStorage, GetWithDefaultValue)): Added.
Canonical link: https://commits.webkit.org/284528@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