[webkit-changes] [WebKit/WebKit] 944eaf: Ghostery throws exception trying to use storageAre...
Timothy Hatcher
noreply at github.com
Thu Feb 1 15:38:02 PST 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 944eaf18a9d63ee99bcbb6ad1fb93f8b3d210cae
https://github.com/WebKit/WebKit/commit/944eaf18a9d63ee99bcbb6ad1fb93f8b3d210cae
Author: Timothy Hatcher <timothy at apple.com>
Date: 2024-02-01 (Thu, 01 Feb 2024)
Changed paths:
M Source/WebKit/Platform/cocoa/CocoaHelpers.mm
M Source/WebKit/Shared/Extensions/WebExtensionUtilities.h
M Source/WebKit/Shared/Extensions/WebExtensionUtilities.mm
M Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIStorageAreaCocoa.mm
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:
-----------
Ghostery throws exception trying to use storageArea.set().
https://webkit.org/b/268565
rdar://problem/122118152
Reviewed by Jeff Miller.
We need to use JavaScript's native JSON encoder for storage, since extensions like Ghostery
use toJSON() functions on custom objects to set data in storage.
Teach the code generator how to convert only the top-level keys of a dictionary while
having all the values be JSValue. This allows for the convenience of a dictionary for
the keys, and true values for conversion with JavaScript's JSON stringifier.
* Source/WebKit/Platform/cocoa/CocoaHelpers.mm:
(WebKit::encodeJSONString): Use JSValue's _toJSONString when it is a JSValue.
(WebKit::encodeJSONData): Ditto.
* Source/WebKit/Shared/Extensions/WebExtensionUtilities.h:
* Source/WebKit/Shared/Extensions/WebExtensionUtilities.mm:
(WebKit::anyItemsExceedQuota): Added keyWithError out param for better error logging.
* Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIStorageAreaCocoa.mm:
(WebKit::WebExtensionAPIStorageArea::set): Record JSON/quota errors per key for debugging ease.
* Source/WebKit/WebProcess/Extensions/Bindings/Cocoa/JSWebExtensionWrapperCocoa.mm:
(WebKit::toNSDictionary): Added ValuePolicy key to stop at top-level.
* Source/WebKit/WebProcess/Extensions/Bindings/JSWebExtensionWrapper.h:
* Source/WebKit/WebProcess/Extensions/Bindings/Scripts/CodeGeneratorExtensions.pm:
(_platformTypeConstructor): Added support for NSDictionary=StopAtTopLevel attribute.
* Source/WebKit/WebProcess/Extensions/Interfaces/WebExtensionAPIStorageArea.idl:
(set): Use NSDictionary=StopAtTopLevel for items.
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPIStorage.mm:
(TestWebKitAPI::TEST): Added new test, and also test quota and null.
Canonical link: https://commits.webkit.org/273949@main
More information about the webkit-changes
mailing list