[webkit-changes] [WebKit/WebKit] 9bd720: Generate everything needed regarding a WebKit Secu...

Brady Eidson noreply at github.com
Tue Dec 5 08:16:14 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 9bd720b73a8f1fea62d0e743755d4a9bda8fffb8
      https://github.com/WebKit/WebKit/commit/9bd720b73a8f1fea62d0e743755d4a9bda8fffb8
  Author: Brady Eidson <beidson at apple.com>
  Date:   2023-12-05 (Tue, 05 Dec 2023)

  Changed paths:
    M Source/WebKit/DerivedSources-output.xcfilelist
    M Source/WebKit/DerivedSources.make
    M Source/WebKit/Scripts/generate-serializers.py
    M Source/WebKit/Scripts/webkit/tests/GeneratedSerializers.cpp
    M Source/WebKit/Scripts/webkit/tests/GeneratedSerializers.h
    A Source/WebKit/Scripts/webkit/tests/GeneratedWebKitSecureCoding.cpp
    A Source/WebKit/Scripts/webkit/tests/GeneratedWebKitSecureCoding.h
    M Source/WebKit/Scripts/webkit/tests/SerializedTypeInfo.cpp
    M Source/WebKit/Scripts/webkit/tests/TestSerializedType.serialization.in
    M Source/WebKit/Scripts/webkit/tests/WebKitPlatformGeneratedSerializers.cpp
    R Source/WebKit/Shared/Cocoa/CoreIPCDDScannerResult.h
    R Source/WebKit/Shared/Cocoa/CoreIPCDDScannerResult.mm
    M Source/WebKit/Shared/Cocoa/CoreIPCDDScannerResult.serialization.in
    M Source/WebKit/Shared/Cocoa/CoreIPCDictionary.h
    M Source/WebKit/Shared/Cocoa/CoreIPCDictionary.mm
    M Source/WebKit/Shared/Cocoa/CoreIPCDictionary.serialization.in
    M Source/WebKit/Shared/Cocoa/CoreIPCNSCFObject.mm
    M Source/WebKit/Shared/Cocoa/CoreIPCSecureCoding.h
    M Source/WebKit/Shared/Cocoa/CoreIPCSecureCoding.mm
    M Source/WebKit/Shared/Cocoa/CoreIPCTypes.h
    M Source/WebKit/WebKit.xcodeproj/project.pbxproj

  Log Message:
  -----------
  Generate everything needed regarding a WebKit Secure Coding type (and move DDScannerResult over to the generated format)
https://bugs.webkit.org/show_bug.cgi?id=265728
rdar://119079477

Reviewed by Alex Christensen.

All WebKit Secure Coding types will follow the identical pattern of:
1 - Get property list dictionary
2 - Encode it
3 - Decode it
4 - Verify the decoded dictionary contents match the type
5 - Recreate the object with the property list

Instead of writing all of that code over time after time, let's generate it.

Given an Objective-C type and a description of its expected dictionary format, the generator now:
1 - Generates a CoreIPC wrapper for that type
2 - Generates the ArgumentCoders for that CoreIPC wrapper (including code that validates the dictionary format)
3 - Generates a description of the dictionary in SerializedTypeInfo
4 - Generates a description of the CoreIPC wrapper in SerializedTypeInfo

All of the above was enough to move DDScannerResult over to this new format, and will greatly
accelerate how quickly we can add new types.

* Source/WebKit/DerivedSources-output.xcfilelist:
* Source/WebKit/DerivedSources.make:
* Source/WebKit/Scripts/generate-serializers.py:
(SerializedType.__init__):
(SerializedType.namespace_and_name):
(SerializedType.name_declaration_for_serialized_type_info):
(SerializedType.members_for_serialized_type_info):
(SerializedType.cpp_type_from_struct_or_class):
(SerializedType):
(SerializedType.cpp_struct_or_class_name):
(SerializedType.is_webkit_secure_coding_type):
(SerializedType.wrapper_for_webkit_secure_coding_type):
(generate_forward_declarations):
(generate_impl):
(generate_one_serialized_type_info):
(output_sorted_headers):
(generate_serialized_type_info):
(parse_serialized_types):
(generate_one_dictionary_member_validation):
(generate_webkit_secure_coding_impl):
(generate_webkit_secure_coding_impl.is):
(generate_webkit_secure_coding_header):
(main):
(SerializedType.namespace_unless_wtf_and_name): Deleted.
* Source/WebKit/Scripts/webkit/tests/GeneratedSerializers.cpp:
* Source/WebKit/Scripts/webkit/tests/GeneratedSerializers.h:
* Source/WebKit/Scripts/webkit/tests/GeneratedWebKitSecureCoding.cpp: Added.
(WebKit::CoreIPCNSSomeFoundationType::CoreIPCNSSomeFoundationType):
(WebKit::CoreIPCNSSomeFoundationType::isValidDictionary):
(WebKit::CoreIPCNSSomeFoundationType::toID const):
(WebKit::CoreIPCDDScannerResult::CoreIPCDDScannerResult):
(WebKit::CoreIPCDDScannerResult::isValidDictionary):
(WebKit::CoreIPCDDScannerResult::toID const):
* Source/WebKit/Scripts/webkit/tests/GeneratedWebKitSecureCoding.h: Added.
(WebKit::CoreIPCNSSomeFoundationType::CoreIPCNSSomeFoundationType):
(WebKit::CoreIPCDDScannerResult::CoreIPCDDScannerResult):
* Source/WebKit/Scripts/webkit/tests/SerializedTypeInfo.cpp:
(WebKit::allSerializedTypes):
* Source/WebKit/Scripts/webkit/tests/TestSerializedType.serialization.in:
* Source/WebKit/Scripts/webkit/tests/WebKitPlatformGeneratedSerializers.cpp:
(IPC::ArgumentCoder<WebKit::CoreIPCNSSomeFoundationType>::encode):
(IPC::ArgumentCoder<WebKit::CoreIPCNSSomeFoundationType>::decode):
(IPC::ArgumentCoder<WebKit::CoreIPCDDScannerResult>::encode):
(IPC::ArgumentCoder<WebKit::CoreIPCDDScannerResult>::decode):
* Source/WebKit/Shared/Cocoa/CoreIPCDDScannerResult.h: Removed.
* Source/WebKit/Shared/Cocoa/CoreIPCDDScannerResult.mm: Removed.
* Source/WebKit/Shared/Cocoa/CoreIPCDDScannerResult.serialization.in:
* Source/WebKit/Shared/Cocoa/CoreIPCDictionary.h:
* Source/WebKit/Shared/Cocoa/CoreIPCDictionary.mm:
(WebKit::CoreIPCDictionary::CoreIPCDictionary):
(WebKit::CoreIPCDictionary::keyHasValueOfType const):
(WebKit::CoreIPCDictionary::keyIsMissingOrHasValueOfType const):
(WebKit::CoreIPCDictionary::collectionValuesAreOfType const):
(WebKit::CoreIPCDictionary::createNSDictionaryIfNeeded const):
(WebKit::CoreIPCDictionary::toID const):
* Source/WebKit/Shared/Cocoa/CoreIPCDictionary.serialization.in:
* Source/WebKit/Shared/Cocoa/CoreIPCNSCFObject.mm:
(WebKit::secureCodingValueFromID):
(WebKit::valueFromID):
* Source/WebKit/Shared/Cocoa/CoreIPCSecureCoding.h:
* Source/WebKit/Shared/Cocoa/CoreIPCSecureCoding.mm:
(WebKit::CoreIPCSecureCoding::conformsToWebKitSecureCoding):
(WebKit::CoreIPCSecureCoding::conformsToSecureCoding):
(WebKit::CoreIPCSecureCoding::CoreIPCSecureCoding):
* Source/WebKit/Shared/Cocoa/CoreIPCTypes.h:
* Source/WebKit/WebKit.xcodeproj/project.pbxproj:

Canonical link: https://commits.webkit.org/271555@main




More information about the webkit-changes mailing list