-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
Showing
9 changed files
with
113 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters