[webkit-changes] [WebKit/WebKit] 72c223: Generate serializers for DDScannerResult and NSValue
Brady Eidson
noreply at github.com
Thu Nov 16 11:38:39 PST 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 72c2238b339fd7c807bb5f0d7f5534cb9cfc8f4f
https://github.com/WebKit/WebKit/commit/72c2238b339fd7c807bb5f0d7f5534cb9cfc8f4f
Author: Brady Eidson <beidson at apple.com>
Date: 2023-11-16 (Thu, 16 Nov 2023)
Changed paths:
M Source/WebCore/testing/Internals.h
M Source/WebKit/DerivedSources-input.xcfilelist
M Source/WebKit/DerivedSources.make
M Source/WebKit/Shared/Cocoa/ArgumentCodersCocoa.h
M Source/WebKit/Shared/Cocoa/ArgumentCodersCocoa.mm
A Source/WebKit/Shared/Cocoa/CoreIPCDDScannerResult.h
A Source/WebKit/Shared/Cocoa/CoreIPCDDScannerResult.mm
A Source/WebKit/Shared/Cocoa/CoreIPCDDScannerResult.serialization.in
M Source/WebKit/Shared/Cocoa/CoreIPCDictionary.h
M Source/WebKit/Shared/Cocoa/CoreIPCNSCFObject.h
M Source/WebKit/Shared/Cocoa/CoreIPCNSCFObject.mm
A Source/WebKit/Shared/Cocoa/CoreIPCNSValue.h
A Source/WebKit/Shared/Cocoa/CoreIPCNSValue.mm
A Source/WebKit/Shared/Cocoa/CoreIPCNSValue.serialization.in
M Source/WebKit/Shared/Cocoa/CoreIPCSecureCoding.h
M Source/WebKit/Shared/Cocoa/CoreIPCSecureCoding.mm
M Source/WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm
M Source/WebKit/WebKit.xcodeproj/project.pbxproj
M Tools/TestWebKitAPI/Tests/IPC/IPCSerialization.mm
Log Message:
-----------
Generate serializers for DDScannerResult and NSValue
https://bugs.webkit.org/show_bug.cgi?id=264915
rdar://118486039
Reviewed by Alex Christensen.
This patch starts the process of breaking out specific secure coding types into their own wrappers.
Starting with DDScannerResult, it optionally uses SPI on the object if it exists to grab a directly
serializable NSDictionary, or it falls back to just wrapping the object itself like any secure coding type.
That NSDictionary is known to contain NSValues that wrap an NSRange, so this patch also adds an NSValue wrapper.
Currently, any NSValues that are serialized would go through the secure coding path.
For this one wrapped type we're known to need (NSRange), we go through a directly serialized code path.
Headed down this road, the goal is to identify all specific types we need to serialize, have a direct wrapper
for each, and reduce our reliance on the secure coding code path to zero.
* Source/WebKit/DerivedSources-input.xcfilelist:
* Source/WebKit/DerivedSources.make:
* Source/WebKit/Shared/Cocoa/ArgumentCodersCocoa.h:
* Source/WebKit/Shared/Cocoa/ArgumentCodersCocoa.mm:
(IPC::getClass<DDScannerResult>):
(IPC::typeFromObject):
* Source/WebKit/Shared/Cocoa/CoreIPCDDScannerResult.h: Copied from Source/WebKit/Shared/Cocoa/CoreIPCDictionary.h.
(WebKit::CoreIPCDDScannerResult::CoreIPCDDScannerResult):
* Source/WebKit/Shared/Cocoa/CoreIPCDDScannerResult.mm: Copied from Source/WebKit/Shared/Cocoa/CoreIPCSecureCoding.mm.
(WebKit::shouldWrapDDScannerResult):
(WebKit::CoreIPCDDScannerResult::CoreIPCDDScannerResult):
(WebKit::CoreIPCDDScannerResult::toID const):
* Source/WebKit/Shared/Cocoa/CoreIPCDDScannerResult.serialization.in: Added.
* Source/WebKit/Shared/Cocoa/CoreIPCDictionary.h:
* Source/WebKit/Shared/Cocoa/CoreIPCNSCFObject.h:
* Source/WebKit/Shared/Cocoa/CoreIPCNSCFObject.mm:
(WebKit::valueFromID):
* Source/WebKit/Shared/Cocoa/CoreIPCNSValue.h: Copied from Source/WebKit/Shared/Cocoa/CoreIPCDictionary.h.
(WebKit::CoreIPCNSValue::CoreIPCNSValue):
* Source/WebKit/Shared/Cocoa/CoreIPCNSValue.mm: Copied from Source/WebKit/Shared/Cocoa/CoreIPCSecureCoding.mm.
(WebKit::CoreIPCNSValue::CoreIPCNSValue):
(WebKit::CoreIPCNSValue::toID const):
(WebKit::CoreIPCNSValue::shouldWrapValue):
* Source/WebKit/Shared/Cocoa/CoreIPCNSValue.serialization.in: Added.
* Source/WebKit/Shared/Cocoa/CoreIPCSecureCoding.h:
(WebKit::CoreIPCSecureCoding::CoreIPCSecureCoding):
* Source/WebKit/Shared/Cocoa/CoreIPCSecureCoding.mm:
(WebKit::CoreIPCSecureCoding::CoreIPCSecureCoding):
* Source/WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
(IPC::getClass<DDScannerResult>): Deleted.
* Source/WebKit/WebKit.xcodeproj/project.pbxproj:
Since NSNumber is itself an NSValue, refactor these tests to explicitly emplace into the testing variant:
* Tools/TestWebKitAPI/Tests/IPC/IPCSerialization.mm:
(TEST):
(fakeDataDetectorResultForTesting):
Canonical link: https://commits.webkit.org/270840@main
More information about the webkit-changes
mailing list