Web Inspector: replace `featureGuard` and `availability` with a combined `condition...
authordrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 27 May 2020 18:09:46 +0000 (18:09 +0000)
committerdrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 27 May 2020 18:09:46 +0000 (18:09 +0000)
https://bugs.webkit.org/show_bug.cgi?id=210014

Reviewed by Brian Burg.

Previously, the generated InspectorBackendCommands.js would include code for things that the
backend doesn't actually support. By using actual macros and preprocessing that file, we can
ensure that the frontend doesn't incorrectly think that something is supported by the page
being inspected:
 - the `Canvas` commands and events related to shader programs/pipelines should only exist
   when the corresponding context type exists, namely `ENABLE(WEBGL)` and `ENABLE(WEBGPU)`.
 - iOS doesn't support showing rulers, so create a variant of `DOM.setInspectModeEnabled`
   that only exists for `PLATFORM(IOS_FAMILY)` that doesn't have the `showRulers` optional
   parameter, as well as removing `Page.setShowRulers` entirely.
 - setting the forced appearance should only be possible if dark mode is supported.
 - web archives only exist if CF is used.

Source/JavaScriptCore:

* inspector/protocol/CPUProfiler.json:
* inspector/protocol/Canvas.json:
* inspector/protocol/DOM.json:
* inspector/protocol/IndexedDB.json:
* inspector/protocol/Inspector.json:
* inspector/protocol/Memory.json:
* inspector/protocol/Page.json:
* inspector/protocol/ServiceWorker.json:

* Scripts/generate-derived-sources.sh:
Set `CC` if it hasn't already been set.

* DerivedSources.make:
* DerivedSources-input.xcfilelist:
Preprocess `InspectorBackendCommands.js.in` to get an accurate `InspectorBackendCommands.js`
that follows the logic/description above.

* CMakeLists.txt:
Create a new `InspectorBackendCommands` target now that `InspectorBackendCommands.js` is
generated seprately from the rest of the protocol files.

* Configurations/FeatureDefines.xcconfig:
Add `ENABLE_WEB_ARCHIVE` since it's always enabled in wtf/PlatformEnableCocoa.h.

* inspector/scripts/generate-inspector-protocol-bindings.py:
(generate_from_specification):
(generate_from_specification.load_specification):
* inspector/scripts/codegen/generator.py:
(Generator.__init__):
(Generator.model):
(Generator.set_generator_setting):
(Generator.type_declarations_for_domain):
(Generator.commands_for_domain):
(Generator.events_for_domain):
(Generator.wrap_with_guard_for_condition): Added.
(Generator.platform): Deleted.
(Generator.can_generate_platform): Deleted.
(Generator.wrap_with_guard_for_domain): Deleted.
(Generator.wrap_with_guard): Deleted.
* inspector/scripts/codegen/models.py:
(Frameworks):
(Protocol.parse_domain):
(Protocol.parse_type_declaration):
(Protocol.parse_command):
(Protocol.parse_event):
(Domain.__init__):
(TypeDeclaration.__init__):
(Command.__init__):
(Event.__init__):
(Platform): Deleted.
(Platform.__init__): Deleted.
(Platform.fromString): Deleted.
(Platforms): Deleted.
(Platforms.__metaclass__): Deleted.
(Platforms.__metaclass__.__iter__): Deleted.
* inspector/scripts/codegen/generator_templates.py:
Remove `platform` as it is handled by `condition`.

* inspector/scripts/codegen/preprocess.pl: Copied from Source/WebCore/bindings/scripts/preprocessor.pm.

* inspector/scripts/codegen/generate_js_backend_commands.py:
(JSBackendCommandsGenerator.output_filename):
(JSBackendCommandsGenerator.generate_domain):
Output to `InspectorBackendCommands.js.in` that includes `#if` for preprocessing.

* inspector/scripts/codegen/cpp_generator_templates.py:
* inspector/scripts/codegen/generate_cpp_alternate_backend_dispatcher_header.py:
(CppAlternateBackendDispatcherHeaderGenerator.generate_output):
(CppAlternateBackendDispatcherHeaderGenerator._generate_handler_declarations_for_domain):
(CppAlternateBackendDispatcherHeaderGenerator._generate_handler_declaration_for_command):
* inspector/scripts/codegen/generate_cpp_backend_dispatcher_header.py:
(CppBackendDispatcherHeaderGenerator._generate_alternate_handler_forward_declarations_for_domains.Alternate):
(CppBackendDispatcherHeaderGenerator._generate_handler_declarations_for_domain):
(CppBackendDispatcherHeaderGenerator._generate_handler_declaration_for_command):
(CppBackendDispatcherHeaderGenerator._generate_async_handler_declaration_for_command):
(CppBackendDispatcherHeaderGenerator._generate_dispatcher_declarations_for_domain):
(CppBackendDispatcherHeaderGenerator._generate_dispatcher_declaration_for_command):
* inspector/scripts/codegen/generate_cpp_backend_dispatcher_implementation.py:
(CppBackendDispatcherImplementationGenerator.generate_output):
(CppBackendDispatcherImplementationGenerator._generate_handler_class_destructor_for_domain):
(CppBackendDispatcherImplementationGenerator._generate_dispatcher_implementations_for_domain):
(CppBackendDispatcherImplementationGenerator._generate_small_dispatcher_switch_implementation_for_domain):
(CppBackendDispatcherImplementationGenerator._generate_large_dispatcher_switch_implementation_for_domain):
(CppBackendDispatcherImplementationGenerator._generate_async_dispatcher_class_for_domain):
(CppBackendDispatcherImplementationGenerator._generate_dispatcher_implementation_for_command):
* inspector/scripts/codegen/generate_cpp_frontend_dispatcher_header.py:
(CppFrontendDispatcherHeaderGenerator._generate_dispatcher_declarations_for_domain):
(CppFrontendDispatcherHeaderGenerator._generate_dispatcher_declaration_for_event):
* inspector/scripts/codegen/generate_cpp_frontend_dispatcher_implementation.py:
(CppFrontendDispatcherImplementationGenerator._generate_dispatcher_implementations_for_domain):
(CppFrontendDispatcherImplementationGenerator._generate_dispatcher_implementation_for_event):
* inspector/scripts/codegen/generate_cpp_protocol_types_header.py:
(CppProtocolTypesHeaderGenerator._generate_versions):
* inspector/scripts/codegen/generate_cpp_protocol_types_implementation.py:
(CppProtocolTypesImplementationGenerator._generate_enum_conversion_methods_for_domain.generate_conversion_method_body):
(CppProtocolTypesImplementationGenerator._generate_enum_conversion_methods_for_domain):
(CppProtocolTypesImplementationGenerator._generate_open_field_names):
(CppProtocolTypesImplementationGenerator._generate_builders_for_domain):
* inspector/scripts/codegen/objc_generator_templates.py:
* inspector/scripts/codegen/generate_objc_backend_dispatcher_header.py:
(ObjCBackendDispatcherHeaderGenerator._generate_objc_handler_declarations_for_domain):
(ObjCBackendDispatcherHeaderGenerator._generate_objc_handler_declaration_for_command):
* inspector/scripts/codegen/generate_objc_backend_dispatcher_implementation.py:
(ObjCBackendDispatcherImplementationGenerator._generate_handler_implementation_for_domain):
(ObjCBackendDispatcherImplementationGenerator._generate_handler_implementation_for_command):
* inspector/scripts/codegen/generate_objc_header.py:
(add_newline):
(ObjCHeaderGenerator.generate_output):
(ObjCHeaderGenerator._generate_forward_declarations):
(ObjCHeaderGenerator._generate_enums):
(ObjCHeaderGenerator._generate_types):
(ObjCHeaderGenerator._generate_type_interface):
(ObjCHeaderGenerator._generate_command_protocols):
(ObjCHeaderGenerator._generate_single_command_protocol):
(ObjCHeaderGenerator._generate_event_interfaces):
(ObjCHeaderGenerator._generate_single_event_interface):
(ObjCHeaderGenerator._generate_enum_for_platforms): Deleted.
* inspector/scripts/codegen/generate_objc_protocol_type_conversions_header.py:
(add_newline):
(ObjCProtocolTypeConversionsHeaderGenerator.generate_output):
(ObjCProtocolTypeConversionsHeaderGenerator._generate_enum_conversion_functions):
(ObjCProtocolTypeConversionsHeaderGenerator._generate_enum_conversion_for_platforms): Deleted.
* inspector/scripts/codegen/generate_objc_protocol_type_conversions_implementation.py:
(add_newline):
(ObjCProtocolTypeConversionsImplementationGenerator._generate_type_factory_category_interface):
(ObjCProtocolTypeConversionsImplementationGenerator._generate_type_factory_method_declaration):
(ObjCProtocolTypeConversionsImplementationGenerator._generate_type_factory_category_implementation):
(ObjCProtocolTypeConversionsImplementationGenerator._generate_type_factory_method_implementation):
* inspector/scripts/codegen/generate_objc_protocol_types_implementation.py:
(add_newline):
(ObjCProtocolTypesImplementationGenerator.generate_type_implementations):
(ObjCProtocolTypesImplementationGenerator.generate_type_implementation):
Wrap each domain, type, command, and event with the associated `condition` (if it exists).

* inspector/scripts/tests/command-targetType-matching-domain-debuggableType.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/command-targetType-matching-domain-debuggableType.json.
* inspector/scripts/tests/commands-with-async-attribute.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/commands-with-async-attribute.json.
* inspector/scripts/tests/commands-with-optional-call-return-parameters.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/commands-with-optional-call-return-parameters.json.
* inspector/scripts/tests/definitions-with-mac-platform.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/mac/definitions-with-mac-platform.json.
* inspector/scripts/tests/domain-debuggableTypes.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/domain-debuggableTypes.json.
* inspector/scripts/tests/domain-targetType-matching-domain-debuggableType.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/domain-targetType-matching-domain-debuggableType.json.
* inspector/scripts/tests/domain-targetTypes.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/domain-targetTypes.json.
* inspector/scripts/tests/domains-with-varying-command-sizes.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/domains-with-varying-command-sizes.json.
* inspector/scripts/tests/enum-values.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/enum-values.json.
* inspector/scripts/tests/event-targetType-matching-domain-debuggableType.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/event-targetType-matching-domain-debuggableType.json.
* inspector/scripts/tests/events-with-optional-parameters.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/events-with-optional-parameters.json.
* inspector/scripts/tests/expected/command-targetType-matching-domain-debuggableType.json-result: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/command-targetType-matching-domain-debuggableType.json-result.
* inspector/scripts/tests/expected/commands-with-async-attribute.json-result: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/commands-with-async-attribute.json-result.
* inspector/scripts/tests/expected/commands-with-optional-call-return-parameters.json-result: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/commands-with-optional-call-return-parameters.json-result.
* inspector/scripts/tests/expected/definitions-with-mac-platform.json-result: Renamed from Source/JavaScriptCore/inspector/scripts/tests/mac/expected/definitions-with-mac-platform.json-result.
* inspector/scripts/tests/expected/domain-debuggableTypes.json-result: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/domain-debuggableTypes.json-result.
* inspector/scripts/tests/expected/domain-targetType-matching-domain-debuggableType.json-result: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/domain-targetType-matching-domain-debuggableType.json-result.
* inspector/scripts/tests/expected/domain-targetTypes.json-result: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/domain-targetTypes.json-result.
* inspector/scripts/tests/expected/domains-with-varying-command-sizes.json-result: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/domains-with-varying-command-sizes.json-result.
* inspector/scripts/tests/expected/enum-values.json-result: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/enum-values.json-result.
* inspector/scripts/tests/expected/event-targetType-matching-domain-debuggableType.json-result: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/event-targetType-matching-domain-debuggableType.json-result.
* inspector/scripts/tests/expected/events-with-optional-parameters.json-result: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/events-with-optional-parameters.json-result.
* inspector/scripts/tests/expected/fail-on-command-targetType-matching-domain-debuggableType.json-error: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-command-targetType-matching-domain-debuggableType.json-error.
* inspector/scripts/tests/expected/fail-on-command-targetTypes-type.json-error: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-command-targetTypes-type.json-error.
* inspector/scripts/tests/expected/fail-on-command-targetTypes-value.json-error: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-command-targetTypes-value.json-error.
* inspector/scripts/tests/expected/fail-on-domain-debuggableTypes-type.json-error: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-domain-debuggableTypes-type.json-error.
* inspector/scripts/tests/expected/fail-on-domain-debuggableTypes-value.json-error: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-domain-debuggableTypes-value.json-error.
* inspector/scripts/tests/expected/fail-on-domain-targetType-matching-domain-debuggableType.json-error: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-domain-targetType-matching-domain-debuggableType.json-error.
* inspector/scripts/tests/expected/fail-on-domain-targetTypes-type.json-error: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-domain-targetTypes-type.json-error.
* inspector/scripts/tests/expected/fail-on-domain-targetTypes-value.json-error: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-domain-targetTypes-value.json-error.
* inspector/scripts/tests/expected/fail-on-duplicate-command-call-parameter-names.json-error: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-duplicate-command-call-parameter-names.json-error.
* inspector/scripts/tests/expected/fail-on-duplicate-command-return-parameter-names.json-error: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-duplicate-command-return-parameter-names.json-error.
* inspector/scripts/tests/expected/fail-on-duplicate-event-parameter-names.json-error: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-duplicate-event-parameter-names.json-error.
* inspector/scripts/tests/expected/fail-on-duplicate-type-declarations.json-error: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-duplicate-type-declarations.json-error.
* inspector/scripts/tests/expected/fail-on-duplicate-type-member-names.json-error: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-duplicate-type-member-names.json-error.
* inspector/scripts/tests/expected/fail-on-enum-with-no-values.json-error: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-enum-with-no-values.json-error.
* inspector/scripts/tests/expected/fail-on-event-targetType-matching-domain-debuggableType.json-error: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-event-targetType-matching-domain-debuggableType.json-error.
* inspector/scripts/tests/expected/fail-on-event-targetTypes-type.json-error: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-event-targetTypes-type.json-error.
* inspector/scripts/tests/expected/fail-on-event-targetTypes-value.json-error: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-event-targetTypes-value.json-error.
* inspector/scripts/tests/expected/fail-on-number-typed-optional-parameter-flag.json-error: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-number-typed-optional-parameter-flag.json-error.
* inspector/scripts/tests/expected/fail-on-number-typed-optional-type-member.json-error: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-number-typed-optional-type-member.json-error.
* inspector/scripts/tests/expected/fail-on-string-typed-optional-parameter-flag.json-error: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-string-typed-optional-parameter-flag.json-error.
* inspector/scripts/tests/expected/fail-on-string-typed-optional-type-member.json-error: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-string-typed-optional-type-member.json-error.
* inspector/scripts/tests/expected/fail-on-type-declaration-using-type-reference.json-error: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-type-declaration-using-type-reference.json-error.
* inspector/scripts/tests/expected/fail-on-type-reference-as-primitive-type.json-error: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-type-reference-as-primitive-type.json-error.
* inspector/scripts/tests/expected/fail-on-type-with-lowercase-name.json-error: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-type-with-lowercase-name.json-error.
* inspector/scripts/tests/expected/fail-on-unknown-type-reference-in-type-declaration.json-error: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-unknown-type-reference-in-type-declaration.json-error.
* inspector/scripts/tests/expected/fail-on-unknown-type-reference-in-type-member.json-error: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-unknown-type-reference-in-type-member.json-error.
* inspector/scripts/tests/expected/generate-domains-with-feature-guards.json-result: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/generate-domains-with-feature-guards.json-result.
* inspector/scripts/tests/expected/same-type-id-different-domain.json-result: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/same-type-id-different-domain.json-result.
* inspector/scripts/tests/expected/shadowed-optional-type-setters.json-result: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/shadowed-optional-type-setters.json-result.
* inspector/scripts/tests/expected/should-strip-comments.json-result: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/should-strip-comments.json-result.
* inspector/scripts/tests/expected/type-declaration-aliased-primitive-type.json-result: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/type-declaration-aliased-primitive-type.json-result.
* inspector/scripts/tests/expected/type-declaration-array-type.json-result: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/type-declaration-array-type.json-result.
* inspector/scripts/tests/expected/type-declaration-enum-type.json-result: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/type-declaration-enum-type.json-result.
* inspector/scripts/tests/expected/type-declaration-object-type.json-result: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/type-declaration-object-type.json-result.
* inspector/scripts/tests/expected/type-requiring-runtime-casts.json-result: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/type-requiring-runtime-casts.json-result.
* inspector/scripts/tests/expected/type-with-open-parameters.json-result: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/type-with-open-parameters.json-result.
* inspector/scripts/tests/expected/version.json-result: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/version.json-result.
* inspector/scripts/tests/fail-on-command-targetType-matching-domain-debuggableType.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-command-targetType-matching-domain-debuggableType.json.
* inspector/scripts/tests/fail-on-command-targetTypes-type.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-command-targetTypes-type.json.
* inspector/scripts/tests/fail-on-command-targetTypes-value.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-command-targetTypes-value.json.
* inspector/scripts/tests/fail-on-domain-debuggableTypes-type.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-domain-debuggableTypes-type.json.
* inspector/scripts/tests/fail-on-domain-debuggableTypes-value.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-domain-debuggableTypes-value.json.
* inspector/scripts/tests/fail-on-domain-targetType-matching-domain-debuggableType.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-domain-targetType-matching-domain-debuggableType.json.
* inspector/scripts/tests/fail-on-domain-targetTypes-type.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-domain-targetTypes-type.json.
* inspector/scripts/tests/fail-on-domain-targetTypes-value.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-domain-targetTypes-value.json.
* inspector/scripts/tests/fail-on-duplicate-command-call-parameter-names.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-duplicate-command-call-parameter-names.json.
* inspector/scripts/tests/fail-on-duplicate-command-return-parameter-names.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-duplicate-command-return-parameter-names.json.
* inspector/scripts/tests/fail-on-duplicate-event-parameter-names.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-duplicate-event-parameter-names.json.
* inspector/scripts/tests/fail-on-duplicate-type-declarations.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-duplicate-type-declarations.json.
* inspector/scripts/tests/fail-on-duplicate-type-member-names.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-duplicate-type-member-names.json.
* inspector/scripts/tests/fail-on-enum-with-no-values.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-enum-with-no-values.json.
* inspector/scripts/tests/fail-on-event-targetType-matching-domain-debuggableType.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-event-targetType-matching-domain-debuggableType.json.
* inspector/scripts/tests/fail-on-event-targetTypes-type.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-event-targetTypes-type.json.
* inspector/scripts/tests/fail-on-event-targetTypes-value.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-event-targetTypes-value.json.
* inspector/scripts/tests/fail-on-number-typed-optional-parameter-flag.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-number-typed-optional-parameter-flag.json.
* inspector/scripts/tests/fail-on-number-typed-optional-type-member.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-number-typed-optional-type-member.json.
* inspector/scripts/tests/fail-on-string-typed-optional-parameter-flag.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-string-typed-optional-parameter-flag.json.
* inspector/scripts/tests/fail-on-string-typed-optional-type-member.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-string-typed-optional-type-member.json.
* inspector/scripts/tests/fail-on-type-declaration-using-type-reference.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-type-declaration-using-type-reference.json.
* inspector/scripts/tests/fail-on-type-reference-as-primitive-type.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-type-reference-as-primitive-type.json.
* inspector/scripts/tests/fail-on-type-with-lowercase-name.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-type-with-lowercase-name.json.
* inspector/scripts/tests/fail-on-unknown-type-reference-in-type-declaration.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-unknown-type-reference-in-type-declaration.json.
* inspector/scripts/tests/fail-on-unknown-type-reference-in-type-member.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-unknown-type-reference-in-type-member.json.
* inspector/scripts/tests/generate-domains-with-feature-guards.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/generate-domains-with-feature-guards.json.
* inspector/scripts/tests/same-type-id-different-domain.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/same-type-id-different-domain.json.
* inspector/scripts/tests/shadowed-optional-type-setters.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/shadowed-optional-type-setters.json.
* inspector/scripts/tests/should-strip-comments.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/should-strip-comments.json.
* inspector/scripts/tests/type-declaration-aliased-primitive-type.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/type-declaration-aliased-primitive-type.json.
* inspector/scripts/tests/type-declaration-array-type.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/type-declaration-array-type.json.
* inspector/scripts/tests/type-declaration-enum-type.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/type-declaration-enum-type.json.
* inspector/scripts/tests/type-declaration-object-type.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/type-declaration-object-type.json.
* inspector/scripts/tests/type-requiring-runtime-casts.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/type-requiring-runtime-casts.json.
* inspector/scripts/tests/type-with-open-parameters.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/type-with-open-parameters.json.
* inspector/scripts/tests/version.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/version.json.
* inspector/scripts/tests/generic/definitions-with-mac-platform.json: Removed.
* inspector/scripts/tests/generic/expected/definitions-with-mac-platform.json-result: Removed.
* inspector/scripts/tests/generic/fail-on-command-with-invalid-platform.json: Removed.
* inspector/scripts/tests/generic/expected/fail-on-command-with-invalid-platform.json-error: Removed.
* inspector/scripts/tests/generic/fail-on-type-with-invalid-platform.json: Removed.
* inspector/scripts/tests/generic/expected/fail-on-type-with-invalid-platform.json-error: Removed.
* inspector/scripts/tests/ios/definitions-with-mac-platform.json: Removed.
* inspector/scripts/tests/ios/expected/definitions-with-mac-platform.json-result: Removed.
* inspector/scripts/tests/all/definitions-with-mac-platform.json: Removed.
* inspector/scripts/tests/all/expected/definitions-with-mac-platform.json-result: Removed.
Don't separate the inspector generator tests by platform.

Source/WebCore:

* inspector/InspectorInstrumentation.h:
* inspector/InspectorInstrumentation.cpp:
* inspector/agents/InspectorCanvasAgent.h:
* inspector/agents/InspectorCanvasAgent.cpp:
(WebCore::InspectorCanvasAgent::InspectorCanvasAgent):
(WebCore::InspectorCanvasAgent::enable):
(WebCore::InspectorCanvasAgent::startRecording):
(WebCore::InspectorCanvasAgent::reset):
(WebCore::InspectorCanvasAgent::unbindCanvas):
* inspector/InspectorShaderProgram.h:
* inspector/InspectorShaderProgram.cpp:
(WebCore::InspectorShaderProgram::requestShaderSource):
(WebCore::InspectorShaderProgram::updateShader):
* inspector/agents/InspectorDOMAgent.h:
* inspector/agents/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::setInspectModeEnabled):
* inspector/agents/InspectorPageAgent.h:
* inspector/agents/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::enable):
(WebCore::InspectorPageAgent::disable):
(WebCore::InspectorPageAgent::setForcedAppearance):
(WebCore::InspectorPageAgent::archive):

* Configurations/FeatureDefines.xcconfig:
Add `ENABLE_WEB_ARCHIVE` since it's always enabled in wtf/PlatformEnableCocoa.h.

* inspector/InspectorFrontendHost.idl:
Drive-by: replace the `#if` with the IDL `[Conditional=]`.
Source/WebCore/PAL:

* Configurations/FeatureDefines.xcconfig:
Add `ENABLE_WEB_ARCHIVE` since it's always enabled in wtf/PlatformEnableCocoa.h.

Source/WebInspectorUI:

* CMakeLists.txt:
Add a dependency on the new `InspectorBackendCommands` target.

* UserInterface/Base/Main.js:
(WI._updateDownloadTabBarButton):

Source/WebKit:

* Configurations/FeatureDefines.xcconfig:
Add `ENABLE_WEB_ARCHIVE` since it's always enabled in wtf/PlatformEnableCocoa.h.

* DerivedSources.make:
* PlatformMac.cmake:
Remove `platform` as it is handled by `condition`.

* UIProcess/Automation/Automation.json:

Source/WebKitLegacy/mac:

* Configurations/FeatureDefines.xcconfig:
Add `ENABLE_WEB_ARCHIVE` since it's always enabled in wtf/PlatformEnableCocoa.h.

Tools:

* Configurations/FeatureDefines.xcconfig:
Add `ENABLE_WEB_ARCHIVE` since it's always enabled in wtf/PlatformEnableCocoa.h.

* Scripts/webkitpy/inspector/main.py:
(InspectorGeneratorTests.generate_from_json):
(InspectorGeneratorTests.run_tests):
(InspectorGeneratorTests.main):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@262203 268f45cc-cd09-0410-ab3c-d52691b4dbfc

171 files changed:
Source/JavaScriptCore/CMakeLists.txt
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig
Source/JavaScriptCore/DerivedSources-input.xcfilelist
Source/JavaScriptCore/DerivedSources.make
Source/JavaScriptCore/Scripts/generate-derived-sources.sh
Source/JavaScriptCore/inspector/protocol/CPUProfiler.json
Source/JavaScriptCore/inspector/protocol/Canvas.json
Source/JavaScriptCore/inspector/protocol/DOM.json
Source/JavaScriptCore/inspector/protocol/IndexedDB.json
Source/JavaScriptCore/inspector/protocol/Inspector.json
Source/JavaScriptCore/inspector/protocol/Memory.json
Source/JavaScriptCore/inspector/protocol/Page.json
Source/JavaScriptCore/inspector/protocol/ServiceWorker.json
Source/JavaScriptCore/inspector/scripts/codegen/cpp_generator_templates.py
Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_alternate_backend_dispatcher_header.py
Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_backend_dispatcher_header.py
Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_backend_dispatcher_implementation.py
Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_frontend_dispatcher_header.py
Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_frontend_dispatcher_implementation.py
Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_protocol_types_header.py
Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_protocol_types_implementation.py
Source/JavaScriptCore/inspector/scripts/codegen/generate_js_backend_commands.py
Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_backend_dispatcher_header.py
Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_backend_dispatcher_implementation.py
Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_header.py
Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_protocol_type_conversions_header.py
Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_protocol_type_conversions_implementation.py
Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_protocol_types_implementation.py
Source/JavaScriptCore/inspector/scripts/codegen/generator.py
Source/JavaScriptCore/inspector/scripts/codegen/generator_templates.py
Source/JavaScriptCore/inspector/scripts/codegen/models.py
Source/JavaScriptCore/inspector/scripts/codegen/objc_generator_templates.py
Source/JavaScriptCore/inspector/scripts/codegen/preprocess.pl [new file with mode: 0644]
Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
Source/JavaScriptCore/inspector/scripts/tests/command-targetType-matching-domain-debuggableType.json [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/command-targetType-matching-domain-debuggableType.json with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/commands-with-async-attribute.json [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/commands-with-async-attribute.json with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/commands-with-optional-call-return-parameters.json [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/commands-with-optional-call-return-parameters.json with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/definitions-with-mac-platform.json [moved from Source/JavaScriptCore/inspector/scripts/tests/all/definitions-with-mac-platform.json with 84% similarity]
Source/JavaScriptCore/inspector/scripts/tests/domain-debuggableTypes.json [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/domain-debuggableTypes.json with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/domain-targetType-matching-domain-debuggableType.json [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/domain-targetType-matching-domain-debuggableType.json with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/domain-targetTypes.json [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/domain-targetTypes.json with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/domains-with-varying-command-sizes.json [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/domains-with-varying-command-sizes.json with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/enum-values.json [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/enum-values.json with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/event-targetType-matching-domain-debuggableType.json [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/event-targetType-matching-domain-debuggableType.json with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/events-with-optional-parameters.json [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/events-with-optional-parameters.json with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/expected/command-targetType-matching-domain-debuggableType.json-result [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/command-targetType-matching-domain-debuggableType.json-result with 91% similarity]
Source/JavaScriptCore/inspector/scripts/tests/expected/commands-with-async-attribute.json-result [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/commands-with-async-attribute.json-result with 95% similarity]
Source/JavaScriptCore/inspector/scripts/tests/expected/commands-with-optional-call-return-parameters.json-result [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/commands-with-optional-call-return-parameters.json-result with 95% similarity]
Source/JavaScriptCore/inspector/scripts/tests/expected/definitions-with-mac-platform.json-result [moved from Source/JavaScriptCore/inspector/scripts/tests/all/expected/definitions-with-mac-platform.json-result with 92% similarity]
Source/JavaScriptCore/inspector/scripts/tests/expected/domain-debuggableTypes.json-result [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/domain-debuggableTypes.json-result with 92% similarity]
Source/JavaScriptCore/inspector/scripts/tests/expected/domain-targetType-matching-domain-debuggableType.json-result [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/domain-targetType-matching-domain-debuggableType.json-result with 91% similarity]
Source/JavaScriptCore/inspector/scripts/tests/expected/domain-targetTypes.json-result [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/domain-targetTypes.json-result with 92% similarity]
Source/JavaScriptCore/inspector/scripts/tests/expected/domains-with-varying-command-sizes.json-result [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/domains-with-varying-command-sizes.json-result with 93% similarity]
Source/JavaScriptCore/inspector/scripts/tests/expected/enum-values.json-result [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/enum-values.json-result with 93% similarity]
Source/JavaScriptCore/inspector/scripts/tests/expected/event-targetType-matching-domain-debuggableType.json-result [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/event-targetType-matching-domain-debuggableType.json-result with 91% similarity]
Source/JavaScriptCore/inspector/scripts/tests/expected/events-with-optional-parameters.json-result [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/events-with-optional-parameters.json-result with 93% similarity]
Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-command-targetType-matching-domain-debuggableType.json-error [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-command-targetType-matching-domain-debuggableType.json-error with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-command-targetTypes-type.json-error [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-command-targetTypes-type.json-error with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-command-targetTypes-value.json-error [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-command-targetTypes-value.json-error with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-domain-debuggableTypes-type.json-error [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-domain-debuggableTypes-type.json-error with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-domain-debuggableTypes-value.json-error [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-domain-debuggableTypes-value.json-error with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-domain-targetType-matching-domain-debuggableType.json-error [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-domain-targetType-matching-domain-debuggableType.json-error with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-domain-targetTypes-type.json-error [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-domain-targetTypes-type.json-error with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-domain-targetTypes-value.json-error [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-domain-targetTypes-value.json-error with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-duplicate-command-call-parameter-names.json-error [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-duplicate-command-call-parameter-names.json-error with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-duplicate-command-return-parameter-names.json-error [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-duplicate-command-return-parameter-names.json-error with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-duplicate-event-parameter-names.json-error [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-duplicate-event-parameter-names.json-error with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-duplicate-type-declarations.json-error [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-duplicate-type-declarations.json-error with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-duplicate-type-member-names.json-error [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-duplicate-type-member-names.json-error with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-enum-with-no-values.json-error [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-enum-with-no-values.json-error with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-event-targetType-matching-domain-debuggableType.json-error [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-event-targetType-matching-domain-debuggableType.json-error with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-event-targetTypes-type.json-error [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-event-targetTypes-type.json-error with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-event-targetTypes-value.json-error [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-event-targetTypes-value.json-error with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-number-typed-optional-parameter-flag.json-error [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-number-typed-optional-parameter-flag.json-error with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-number-typed-optional-type-member.json-error [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-number-typed-optional-type-member.json-error with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-string-typed-optional-parameter-flag.json-error [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-string-typed-optional-parameter-flag.json-error with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-string-typed-optional-type-member.json-error [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-string-typed-optional-type-member.json-error with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-type-declaration-using-type-reference.json-error [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-type-declaration-using-type-reference.json-error with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-type-reference-as-primitive-type.json-error [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-type-reference-as-primitive-type.json-error with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-type-with-lowercase-name.json-error [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-type-with-lowercase-name.json-error with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-unknown-type-reference-in-type-declaration.json-error [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-unknown-type-reference-in-type-declaration.json-error with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-unknown-type-reference-in-type-member.json-error [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-unknown-type-reference-in-type-member.json-error with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/expected/generate-domains-with-feature-guards.json-result [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/generate-domains-with-feature-guards.json-result with 91% similarity]
Source/JavaScriptCore/inspector/scripts/tests/expected/same-type-id-different-domain.json-result [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/same-type-id-different-domain.json-result with 91% similarity]
Source/JavaScriptCore/inspector/scripts/tests/expected/shadowed-optional-type-setters.json-result [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/shadowed-optional-type-setters.json-result with 92% similarity]
Source/JavaScriptCore/inspector/scripts/tests/expected/should-strip-comments.json-result [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/should-strip-comments.json-result with 91% similarity]
Source/JavaScriptCore/inspector/scripts/tests/expected/type-declaration-aliased-primitive-type.json-result [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/type-declaration-aliased-primitive-type.json-result with 90% similarity]
Source/JavaScriptCore/inspector/scripts/tests/expected/type-declaration-array-type.json-result [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/type-declaration-array-type.json-result with 92% similarity]
Source/JavaScriptCore/inspector/scripts/tests/expected/type-declaration-enum-type.json-result [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/type-declaration-enum-type.json-result with 92% similarity]
Source/JavaScriptCore/inspector/scripts/tests/expected/type-declaration-object-type.json-result [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/type-declaration-object-type.json-result with 96% similarity]
Source/JavaScriptCore/inspector/scripts/tests/expected/type-requiring-runtime-casts.json-result [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/type-requiring-runtime-casts.json-result with 94% similarity]
Source/JavaScriptCore/inspector/scripts/tests/expected/type-with-open-parameters.json-result [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/type-with-open-parameters.json-result with 92% similarity]
Source/JavaScriptCore/inspector/scripts/tests/expected/version.json-result [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/version.json-result with 92% similarity]
Source/JavaScriptCore/inspector/scripts/tests/fail-on-command-targetType-matching-domain-debuggableType.json [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-command-targetType-matching-domain-debuggableType.json with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/fail-on-command-targetTypes-type.json [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-command-targetTypes-type.json with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/fail-on-command-targetTypes-value.json [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-command-targetTypes-value.json with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/fail-on-domain-debuggableTypes-type.json [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-domain-debuggableTypes-type.json with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/fail-on-domain-debuggableTypes-value.json [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-domain-debuggableTypes-value.json with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/fail-on-domain-targetType-matching-domain-debuggableType.json [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-domain-targetType-matching-domain-debuggableType.json with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/fail-on-domain-targetTypes-type.json [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-domain-targetTypes-type.json with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/fail-on-domain-targetTypes-value.json [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-domain-targetTypes-value.json with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/fail-on-duplicate-command-call-parameter-names.json [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-duplicate-command-call-parameter-names.json with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/fail-on-duplicate-command-return-parameter-names.json [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-duplicate-command-return-parameter-names.json with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/fail-on-duplicate-event-parameter-names.json [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-duplicate-event-parameter-names.json with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/fail-on-duplicate-type-declarations.json [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-duplicate-type-declarations.json with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/fail-on-duplicate-type-member-names.json [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-duplicate-type-member-names.json with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/fail-on-enum-with-no-values.json [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-enum-with-no-values.json with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/fail-on-event-targetType-matching-domain-debuggableType.json [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-event-targetType-matching-domain-debuggableType.json with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/fail-on-event-targetTypes-type.json [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-event-targetTypes-type.json with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/fail-on-event-targetTypes-value.json [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-event-targetTypes-value.json with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/fail-on-number-typed-optional-parameter-flag.json [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-number-typed-optional-parameter-flag.json with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/fail-on-number-typed-optional-type-member.json [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-number-typed-optional-type-member.json with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/fail-on-string-typed-optional-parameter-flag.json [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-string-typed-optional-parameter-flag.json with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/fail-on-string-typed-optional-type-member.json [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-string-typed-optional-type-member.json with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/fail-on-type-declaration-using-type-reference.json [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-type-declaration-using-type-reference.json with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/fail-on-type-reference-as-primitive-type.json [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-type-reference-as-primitive-type.json with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/fail-on-type-with-lowercase-name.json [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-type-with-lowercase-name.json with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/fail-on-unknown-type-reference-in-type-declaration.json [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-unknown-type-reference-in-type-declaration.json with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/fail-on-unknown-type-reference-in-type-member.json [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-unknown-type-reference-in-type-member.json with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/generate-domains-with-feature-guards.json [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/generate-domains-with-feature-guards.json with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/generic/definitions-with-mac-platform.json [deleted file]
Source/JavaScriptCore/inspector/scripts/tests/generic/expected/definitions-with-mac-platform.json-result [deleted file]
Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-command-with-invalid-platform.json-error [deleted file]
Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-type-with-invalid-platform.json-error [deleted file]
Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-command-with-invalid-platform.json [deleted file]
Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-type-with-invalid-platform.json [deleted file]
Source/JavaScriptCore/inspector/scripts/tests/ios/definitions-with-mac-platform.json [deleted file]
Source/JavaScriptCore/inspector/scripts/tests/ios/expected/definitions-with-mac-platform.json-result [deleted file]
Source/JavaScriptCore/inspector/scripts/tests/mac/definitions-with-mac-platform.json [deleted file]
Source/JavaScriptCore/inspector/scripts/tests/mac/expected/definitions-with-mac-platform.json-result [deleted file]
Source/JavaScriptCore/inspector/scripts/tests/same-type-id-different-domain.json [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/same-type-id-different-domain.json with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/shadowed-optional-type-setters.json [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/shadowed-optional-type-setters.json with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/should-strip-comments.json [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/should-strip-comments.json with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/type-declaration-aliased-primitive-type.json [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/type-declaration-aliased-primitive-type.json with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/type-declaration-array-type.json [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/type-declaration-array-type.json with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/type-declaration-enum-type.json [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/type-declaration-enum-type.json with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/type-declaration-object-type.json [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/type-declaration-object-type.json with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/type-requiring-runtime-casts.json [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/type-requiring-runtime-casts.json with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/type-with-open-parameters.json [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/type-with-open-parameters.json with 100% similarity]
Source/JavaScriptCore/inspector/scripts/tests/version.json [moved from Source/JavaScriptCore/inspector/scripts/tests/generic/version.json with 100% similarity]
Source/WebCore/ChangeLog
Source/WebCore/Configurations/FeatureDefines.xcconfig
Source/WebCore/PAL/ChangeLog
Source/WebCore/PAL/Configurations/FeatureDefines.xcconfig
Source/WebCore/inspector/InspectorFrontendHost.idl
Source/WebCore/inspector/InspectorInstrumentation.cpp
Source/WebCore/inspector/InspectorInstrumentation.h
Source/WebCore/inspector/InspectorShaderProgram.cpp
Source/WebCore/inspector/InspectorShaderProgram.h
Source/WebCore/inspector/agents/InspectorCanvasAgent.cpp
Source/WebCore/inspector/agents/InspectorCanvasAgent.h
Source/WebCore/inspector/agents/InspectorDOMAgent.cpp
Source/WebCore/inspector/agents/InspectorDOMAgent.h
Source/WebCore/inspector/agents/InspectorPageAgent.cpp
Source/WebCore/inspector/agents/InspectorPageAgent.h
Source/WebInspectorUI/CMakeLists.txt
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Base/Main.js
Source/WebKit/ChangeLog
Source/WebKit/Configurations/FeatureDefines.xcconfig
Source/WebKit/DerivedSources.make
Source/WebKit/PlatformMac.cmake
Source/WebKit/UIProcess/Automation/Automation.json
Source/WebKit/UIProcess/Automation/WebAutomationSession.h
Source/WebKit/UIProcess/Automation/mac/WebAutomationSessionMac.mm
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/Configurations/FeatureDefines.xcconfig
Tools/ChangeLog
Tools/Scripts/webkitpy/inspector/main.py
Tools/TestWebKitAPI/Configurations/FeatureDefines.xcconfig

index 6498b5b..91a6e3a 100644 (file)
@@ -1150,12 +1150,15 @@ set(JavaScriptCore_INSPECTOR_PROTOCOL_SCRIPTS
     ${JavaScriptCore_INSPECTOR_SCRIPTS_DIR}/codegen/generator_templates.py
     ${JavaScriptCore_INSPECTOR_SCRIPTS_DIR}/codegen/__init__.py
     ${JavaScriptCore_INSPECTOR_SCRIPTS_DIR}/codegen/models.py
+    ${JavaScriptCore_INSPECTOR_SCRIPTS_DIR}/codegen/preprocess.pl
 )
 
 set(JavaScriptCore_INSPECTOR_DOMAINS
     ${JAVASCRIPTCORE_DIR}/inspector/protocol/Animation.json
     ${JAVASCRIPTCORE_DIR}/inspector/protocol/ApplicationCache.json
     ${JAVASCRIPTCORE_DIR}/inspector/protocol/Audit.json
+    ${JAVASCRIPTCORE_DIR}/inspector/protocol/Browser.json
+    ${JAVASCRIPTCORE_DIR}/inspector/protocol/CPUProfiler.json
     ${JAVASCRIPTCORE_DIR}/inspector/protocol/CSS.json
     ${JAVASCRIPTCORE_DIR}/inspector/protocol/Canvas.json
     ${JAVASCRIPTCORE_DIR}/inspector/protocol/Console.json
@@ -1164,41 +1167,24 @@ set(JavaScriptCore_INSPECTOR_DOMAINS
     ${JAVASCRIPTCORE_DIR}/inspector/protocol/DOMStorage.json
     ${JAVASCRIPTCORE_DIR}/inspector/protocol/Database.json
     ${JAVASCRIPTCORE_DIR}/inspector/protocol/Debugger.json
-    ${JAVASCRIPTCORE_DIR}/inspector/protocol/Browser.json
     ${JAVASCRIPTCORE_DIR}/inspector/protocol/GenericTypes.json
     ${JAVASCRIPTCORE_DIR}/inspector/protocol/Heap.json
+    ${JAVASCRIPTCORE_DIR}/inspector/protocol/IndexedDB.json
     ${JAVASCRIPTCORE_DIR}/inspector/protocol/Inspector.json
     ${JAVASCRIPTCORE_DIR}/inspector/protocol/LayerTree.json
+    ${JAVASCRIPTCORE_DIR}/inspector/protocol/Memory.json
     ${JAVASCRIPTCORE_DIR}/inspector/protocol/Network.json
     ${JAVASCRIPTCORE_DIR}/inspector/protocol/Page.json
     ${JAVASCRIPTCORE_DIR}/inspector/protocol/Recording.json
     ${JAVASCRIPTCORE_DIR}/inspector/protocol/Runtime.json
     ${JAVASCRIPTCORE_DIR}/inspector/protocol/ScriptProfiler.json
     ${JAVASCRIPTCORE_DIR}/inspector/protocol/Security.json
+    ${JAVASCRIPTCORE_DIR}/inspector/protocol/ServiceWorker.json
     ${JAVASCRIPTCORE_DIR}/inspector/protocol/Target.json
     ${JAVASCRIPTCORE_DIR}/inspector/protocol/Timeline.json
     ${JAVASCRIPTCORE_DIR}/inspector/protocol/Worker.json
 )
 
-if (ENABLE_INDEXED_DATABASE)
-    list(APPEND JavaScriptCore_INSPECTOR_DOMAINS
-        ${JAVASCRIPTCORE_DIR}/inspector/protocol/IndexedDB.json
-    )
-endif ()
-
-if (ENABLE_RESOURCE_USAGE)
-    list(APPEND JavaScriptCore_INSPECTOR_DOMAINS
-        ${JAVASCRIPTCORE_DIR}/inspector/protocol/CPUProfiler.json
-        ${JAVASCRIPTCORE_DIR}/inspector/protocol/Memory.json
-    )
-endif ()
-
-if (ENABLE_SERVICE_WORKER)
-    list(APPEND JavaScriptCore_INSPECTOR_DOMAINS
-        ${JAVASCRIPTCORE_DIR}/inspector/protocol/ServiceWorker.json
-    )
-endif ()
-
 add_custom_command(
     OUTPUT ${JavaScriptCore_DERIVED_SOURCES_DIR}/CombinedDomains.json
     MAIN_DEPENDENCY ${JavaScriptCore_SCRIPTS_DIR}/generate-combined-inspector-json.py
@@ -1216,11 +1202,19 @@ add_custom_command(
            ${JavaScriptCore_DERIVED_SOURCES_DIR}/inspector/InspectorFrontendDispatchers.h
            ${JavaScriptCore_DERIVED_SOURCES_DIR}/inspector/InspectorProtocolObjects.cpp
            ${JavaScriptCore_DERIVED_SOURCES_DIR}/inspector/InspectorProtocolObjects.h
-           ${JavaScriptCore_DERIVED_SOURCES_DIR}/inspector/InspectorBackendCommands.js
     MAIN_DEPENDENCY ${JavaScriptCore_DERIVED_SOURCES_DIR}/CombinedDomains.json
     DEPENDS ${JavaScriptCore_INSPECTOR_PROTOCOL_SCRIPTS}
     COMMAND ${PYTHON_EXECUTABLE} ${JavaScriptCore_INSPECTOR_SCRIPTS_DIR}/generate-inspector-protocol-bindings.py --outputDir "${JavaScriptCore_DERIVED_SOURCES_DIR}/inspector" --framework JavaScriptCore ${JavaScriptCore_DERIVED_SOURCES_DIR}/CombinedDomains.json
     VERBATIM)
+add_custom_command(
+    OUTPUT ${JavaScriptCore_DERIVED_SOURCES_DIR}/inspector/InspectorBackendCommands.js
+           ${JavaScriptCore_DERIVED_SOURCES_DIR}/inspector/InspectorBackendCommands.js.in
+    MAIN_DEPENDENCY ${JavaScriptCore_DERIVED_SOURCES_DIR}/CombinedDomains.json
+    DEPENDS ${JavaScriptCore_INSPECTOR_PROTOCOL_SCRIPTS}
+    COMMAND ${PYTHON_EXECUTABLE} ${JavaScriptCore_INSPECTOR_SCRIPTS_DIR}/generate-inspector-protocol-bindings.py --outputDir ${JavaScriptCore_DERIVED_SOURCES_DIR}/inspector --framework WebInspectorUI ${JavaScriptCore_DERIVED_SOURCES_DIR}/CombinedDomains.json
+    COMMAND ${PERL_EXECUTABLE} ${JavaScriptCore_INSPECTOR_SCRIPTS_DIR}/codegen/preprocess.pl --input ${JavaScriptCore_DERIVED_SOURCES_DIR}/inspector/InspectorBackendCommands.js.in --defines "${FEATURE_DEFINES_WITH_SPACE_SEPARATOR}" --preprocessor "${CODE_GENERATOR_PREPROCESSOR}" --output ${JavaScriptCore_DERIVED_SOURCES_DIR}/inspector/InspectorBackendCommands.js
+    VERBATIM)
+add_custom_target(InspectorBackendCommands DEPENDS "${JavaScriptCore_DERIVED_SOURCES_DIR}/inspector/InspectorBackendCommands.js")
 
 # JSCBuiltins
 
index fc11d73..8465be5 100644 (file)
@@ -1,3 +1,264 @@
+2020-05-27  Devin Rousso  <drousso@apple.com>
+
+        Web Inspector: replace `featureGuard` and `availability` with a combined `condition` that accepts any macro
+        https://bugs.webkit.org/show_bug.cgi?id=210014
+
+        Reviewed by Brian Burg.
+
+        Previously, the generated InspectorBackendCommands.js would include code for things that the
+        backend doesn't actually support. By using actual macros and preprocessing that file, we can
+        ensure that the frontend doesn't incorrectly think that something is supported by the page
+        being inspected:
+         - the `Canvas` commands and events related to shader programs/pipelines should only exist
+           when the corresponding context type exists, namely `ENABLE(WEBGL)` and `ENABLE(WEBGPU)`.
+         - iOS doesn't support showing rulers, so create a variant of `DOM.setInspectModeEnabled`
+           that only exists for `PLATFORM(IOS_FAMILY)` that doesn't have the `showRulers` optional
+           parameter, as well as removing `Page.setShowRulers` entirely.
+         - setting the forced appearance should only be possible if dark mode is supported.
+         - web archives only exist if CF is used.
+
+        * inspector/protocol/CPUProfiler.json:
+        * inspector/protocol/Canvas.json:
+        * inspector/protocol/DOM.json:
+        * inspector/protocol/IndexedDB.json:
+        * inspector/protocol/Inspector.json:
+        * inspector/protocol/Memory.json:
+        * inspector/protocol/Page.json:
+        * inspector/protocol/ServiceWorker.json:
+
+        * Scripts/generate-derived-sources.sh:
+        Set `CC` if it hasn't already been set.
+
+        * DerivedSources.make:
+        * DerivedSources-input.xcfilelist:
+        Preprocess `InspectorBackendCommands.js.in` to get an accurate `InspectorBackendCommands.js`
+        that follows the logic/description above.
+
+        * CMakeLists.txt:
+        Create a new `InspectorBackendCommands` target now that `InspectorBackendCommands.js` is
+        generated seprately from the rest of the protocol files.
+
+        * Configurations/FeatureDefines.xcconfig:
+        Add `ENABLE_WEB_ARCHIVE` since it's always enabled in wtf/PlatformEnableCocoa.h.
+
+        * inspector/scripts/generate-inspector-protocol-bindings.py:
+        (generate_from_specification):
+        (generate_from_specification.load_specification):
+        * inspector/scripts/codegen/generator.py:
+        (Generator.__init__):
+        (Generator.model):
+        (Generator.set_generator_setting):
+        (Generator.type_declarations_for_domain):
+        (Generator.commands_for_domain):
+        (Generator.events_for_domain):
+        (Generator.wrap_with_guard_for_condition): Added.
+        (Generator.platform): Deleted.
+        (Generator.can_generate_platform): Deleted.
+        (Generator.wrap_with_guard_for_domain): Deleted.
+        (Generator.wrap_with_guard): Deleted.
+        * inspector/scripts/codegen/models.py:
+        (Frameworks):
+        (Protocol.parse_domain):
+        (Protocol.parse_type_declaration):
+        (Protocol.parse_command):
+        (Protocol.parse_event):
+        (Domain.__init__):
+        (TypeDeclaration.__init__):
+        (Command.__init__):
+        (Event.__init__):
+        (Platform): Deleted.
+        (Platform.__init__): Deleted.
+        (Platform.fromString): Deleted.
+        (Platforms): Deleted.
+        (Platforms.__metaclass__): Deleted.
+        (Platforms.__metaclass__.__iter__): Deleted.
+        * inspector/scripts/codegen/generator_templates.py:
+        Remove `platform` as it is handled by `condition`.
+
+        * inspector/scripts/codegen/preprocess.pl: Copied from Source/WebCore/bindings/scripts/preprocessor.pm.
+
+        * inspector/scripts/codegen/generate_js_backend_commands.py:
+        (JSBackendCommandsGenerator.output_filename):
+        (JSBackendCommandsGenerator.generate_domain):
+        Output to `InspectorBackendCommands.js.in` that includes `#if` for preprocessing.
+
+        * inspector/scripts/codegen/cpp_generator_templates.py:
+        * inspector/scripts/codegen/generate_cpp_alternate_backend_dispatcher_header.py:
+        (CppAlternateBackendDispatcherHeaderGenerator.generate_output):
+        (CppAlternateBackendDispatcherHeaderGenerator._generate_handler_declarations_for_domain):
+        (CppAlternateBackendDispatcherHeaderGenerator._generate_handler_declaration_for_command):
+        * inspector/scripts/codegen/generate_cpp_backend_dispatcher_header.py:
+        (CppBackendDispatcherHeaderGenerator._generate_alternate_handler_forward_declarations_for_domains.Alternate):
+        (CppBackendDispatcherHeaderGenerator._generate_handler_declarations_for_domain):
+        (CppBackendDispatcherHeaderGenerator._generate_handler_declaration_for_command):
+        (CppBackendDispatcherHeaderGenerator._generate_async_handler_declaration_for_command):
+        (CppBackendDispatcherHeaderGenerator._generate_dispatcher_declarations_for_domain):
+        (CppBackendDispatcherHeaderGenerator._generate_dispatcher_declaration_for_command):
+        * inspector/scripts/codegen/generate_cpp_backend_dispatcher_implementation.py:
+        (CppBackendDispatcherImplementationGenerator.generate_output):
+        (CppBackendDispatcherImplementationGenerator._generate_handler_class_destructor_for_domain):
+        (CppBackendDispatcherImplementationGenerator._generate_dispatcher_implementations_for_domain):
+        (CppBackendDispatcherImplementationGenerator._generate_small_dispatcher_switch_implementation_for_domain):
+        (CppBackendDispatcherImplementationGenerator._generate_large_dispatcher_switch_implementation_for_domain):
+        (CppBackendDispatcherImplementationGenerator._generate_async_dispatcher_class_for_domain):
+        (CppBackendDispatcherImplementationGenerator._generate_dispatcher_implementation_for_command):
+        * inspector/scripts/codegen/generate_cpp_frontend_dispatcher_header.py:
+        (CppFrontendDispatcherHeaderGenerator._generate_dispatcher_declarations_for_domain):
+        (CppFrontendDispatcherHeaderGenerator._generate_dispatcher_declaration_for_event):
+        * inspector/scripts/codegen/generate_cpp_frontend_dispatcher_implementation.py:
+        (CppFrontendDispatcherImplementationGenerator._generate_dispatcher_implementations_for_domain):
+        (CppFrontendDispatcherImplementationGenerator._generate_dispatcher_implementation_for_event):
+        * inspector/scripts/codegen/generate_cpp_protocol_types_header.py:
+        (CppProtocolTypesHeaderGenerator._generate_versions):
+        * inspector/scripts/codegen/generate_cpp_protocol_types_implementation.py:
+        (CppProtocolTypesImplementationGenerator._generate_enum_conversion_methods_for_domain.generate_conversion_method_body):
+        (CppProtocolTypesImplementationGenerator._generate_enum_conversion_methods_for_domain):
+        (CppProtocolTypesImplementationGenerator._generate_open_field_names):
+        (CppProtocolTypesImplementationGenerator._generate_builders_for_domain):
+        * inspector/scripts/codegen/objc_generator_templates.py:
+        * inspector/scripts/codegen/generate_objc_backend_dispatcher_header.py:
+        (ObjCBackendDispatcherHeaderGenerator._generate_objc_handler_declarations_for_domain):
+        (ObjCBackendDispatcherHeaderGenerator._generate_objc_handler_declaration_for_command):
+        * inspector/scripts/codegen/generate_objc_backend_dispatcher_implementation.py:
+        (ObjCBackendDispatcherImplementationGenerator._generate_handler_implementation_for_domain):
+        (ObjCBackendDispatcherImplementationGenerator._generate_handler_implementation_for_command):
+        * inspector/scripts/codegen/generate_objc_header.py:
+        (add_newline):
+        (ObjCHeaderGenerator.generate_output):
+        (ObjCHeaderGenerator._generate_forward_declarations):
+        (ObjCHeaderGenerator._generate_enums):
+        (ObjCHeaderGenerator._generate_types):
+        (ObjCHeaderGenerator._generate_type_interface):
+        (ObjCHeaderGenerator._generate_command_protocols):
+        (ObjCHeaderGenerator._generate_single_command_protocol):
+        (ObjCHeaderGenerator._generate_event_interfaces):
+        (ObjCHeaderGenerator._generate_single_event_interface):
+        (ObjCHeaderGenerator._generate_enum_for_platforms): Deleted.
+        * inspector/scripts/codegen/generate_objc_protocol_type_conversions_header.py:
+        (add_newline):
+        (ObjCProtocolTypeConversionsHeaderGenerator.generate_output):
+        (ObjCProtocolTypeConversionsHeaderGenerator._generate_enum_conversion_functions):
+        (ObjCProtocolTypeConversionsHeaderGenerator._generate_enum_conversion_for_platforms): Deleted.
+        * inspector/scripts/codegen/generate_objc_protocol_type_conversions_implementation.py:
+        (add_newline):
+        (ObjCProtocolTypeConversionsImplementationGenerator._generate_type_factory_category_interface):
+        (ObjCProtocolTypeConversionsImplementationGenerator._generate_type_factory_method_declaration):
+        (ObjCProtocolTypeConversionsImplementationGenerator._generate_type_factory_category_implementation):
+        (ObjCProtocolTypeConversionsImplementationGenerator._generate_type_factory_method_implementation):
+        * inspector/scripts/codegen/generate_objc_protocol_types_implementation.py:
+        (add_newline):
+        (ObjCProtocolTypesImplementationGenerator.generate_type_implementations):
+        (ObjCProtocolTypesImplementationGenerator.generate_type_implementation):
+        Wrap each domain, type, command, and event with the associated `condition` (if it exists).
+
+        * inspector/scripts/tests/command-targetType-matching-domain-debuggableType.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/command-targetType-matching-domain-debuggableType.json.
+        * inspector/scripts/tests/commands-with-async-attribute.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/commands-with-async-attribute.json.
+        * inspector/scripts/tests/commands-with-optional-call-return-parameters.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/commands-with-optional-call-return-parameters.json.
+        * inspector/scripts/tests/definitions-with-mac-platform.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/mac/definitions-with-mac-platform.json.
+        * inspector/scripts/tests/domain-debuggableTypes.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/domain-debuggableTypes.json.
+        * inspector/scripts/tests/domain-targetType-matching-domain-debuggableType.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/domain-targetType-matching-domain-debuggableType.json.
+        * inspector/scripts/tests/domain-targetTypes.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/domain-targetTypes.json.
+        * inspector/scripts/tests/domains-with-varying-command-sizes.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/domains-with-varying-command-sizes.json.
+        * inspector/scripts/tests/enum-values.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/enum-values.json.
+        * inspector/scripts/tests/event-targetType-matching-domain-debuggableType.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/event-targetType-matching-domain-debuggableType.json.
+        * inspector/scripts/tests/events-with-optional-parameters.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/events-with-optional-parameters.json.
+        * inspector/scripts/tests/expected/command-targetType-matching-domain-debuggableType.json-result: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/command-targetType-matching-domain-debuggableType.json-result.
+        * inspector/scripts/tests/expected/commands-with-async-attribute.json-result: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/commands-with-async-attribute.json-result.
+        * inspector/scripts/tests/expected/commands-with-optional-call-return-parameters.json-result: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/commands-with-optional-call-return-parameters.json-result.
+        * inspector/scripts/tests/expected/definitions-with-mac-platform.json-result: Renamed from Source/JavaScriptCore/inspector/scripts/tests/mac/expected/definitions-with-mac-platform.json-result.
+        * inspector/scripts/tests/expected/domain-debuggableTypes.json-result: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/domain-debuggableTypes.json-result.
+        * inspector/scripts/tests/expected/domain-targetType-matching-domain-debuggableType.json-result: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/domain-targetType-matching-domain-debuggableType.json-result.
+        * inspector/scripts/tests/expected/domain-targetTypes.json-result: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/domain-targetTypes.json-result.
+        * inspector/scripts/tests/expected/domains-with-varying-command-sizes.json-result: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/domains-with-varying-command-sizes.json-result.
+        * inspector/scripts/tests/expected/enum-values.json-result: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/enum-values.json-result.
+        * inspector/scripts/tests/expected/event-targetType-matching-domain-debuggableType.json-result: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/event-targetType-matching-domain-debuggableType.json-result.
+        * inspector/scripts/tests/expected/events-with-optional-parameters.json-result: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/events-with-optional-parameters.json-result.
+        * inspector/scripts/tests/expected/fail-on-command-targetType-matching-domain-debuggableType.json-error: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-command-targetType-matching-domain-debuggableType.json-error.
+        * inspector/scripts/tests/expected/fail-on-command-targetTypes-type.json-error: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-command-targetTypes-type.json-error.
+        * inspector/scripts/tests/expected/fail-on-command-targetTypes-value.json-error: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-command-targetTypes-value.json-error.
+        * inspector/scripts/tests/expected/fail-on-domain-debuggableTypes-type.json-error: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-domain-debuggableTypes-type.json-error.
+        * inspector/scripts/tests/expected/fail-on-domain-debuggableTypes-value.json-error: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-domain-debuggableTypes-value.json-error.
+        * inspector/scripts/tests/expected/fail-on-domain-targetType-matching-domain-debuggableType.json-error: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-domain-targetType-matching-domain-debuggableType.json-error.
+        * inspector/scripts/tests/expected/fail-on-domain-targetTypes-type.json-error: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-domain-targetTypes-type.json-error.
+        * inspector/scripts/tests/expected/fail-on-domain-targetTypes-value.json-error: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-domain-targetTypes-value.json-error.
+        * inspector/scripts/tests/expected/fail-on-duplicate-command-call-parameter-names.json-error: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-duplicate-command-call-parameter-names.json-error.
+        * inspector/scripts/tests/expected/fail-on-duplicate-command-return-parameter-names.json-error: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-duplicate-command-return-parameter-names.json-error.
+        * inspector/scripts/tests/expected/fail-on-duplicate-event-parameter-names.json-error: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-duplicate-event-parameter-names.json-error.
+        * inspector/scripts/tests/expected/fail-on-duplicate-type-declarations.json-error: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-duplicate-type-declarations.json-error.
+        * inspector/scripts/tests/expected/fail-on-duplicate-type-member-names.json-error: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-duplicate-type-member-names.json-error.
+        * inspector/scripts/tests/expected/fail-on-enum-with-no-values.json-error: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-enum-with-no-values.json-error.
+        * inspector/scripts/tests/expected/fail-on-event-targetType-matching-domain-debuggableType.json-error: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-event-targetType-matching-domain-debuggableType.json-error.
+        * inspector/scripts/tests/expected/fail-on-event-targetTypes-type.json-error: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-event-targetTypes-type.json-error.
+        * inspector/scripts/tests/expected/fail-on-event-targetTypes-value.json-error: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-event-targetTypes-value.json-error.
+        * inspector/scripts/tests/expected/fail-on-number-typed-optional-parameter-flag.json-error: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-number-typed-optional-parameter-flag.json-error.
+        * inspector/scripts/tests/expected/fail-on-number-typed-optional-type-member.json-error: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-number-typed-optional-type-member.json-error.
+        * inspector/scripts/tests/expected/fail-on-string-typed-optional-parameter-flag.json-error: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-string-typed-optional-parameter-flag.json-error.
+        * inspector/scripts/tests/expected/fail-on-string-typed-optional-type-member.json-error: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-string-typed-optional-type-member.json-error.
+        * inspector/scripts/tests/expected/fail-on-type-declaration-using-type-reference.json-error: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-type-declaration-using-type-reference.json-error.
+        * inspector/scripts/tests/expected/fail-on-type-reference-as-primitive-type.json-error: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-type-reference-as-primitive-type.json-error.
+        * inspector/scripts/tests/expected/fail-on-type-with-lowercase-name.json-error: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-type-with-lowercase-name.json-error.
+        * inspector/scripts/tests/expected/fail-on-unknown-type-reference-in-type-declaration.json-error: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-unknown-type-reference-in-type-declaration.json-error.
+        * inspector/scripts/tests/expected/fail-on-unknown-type-reference-in-type-member.json-error: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/fail-on-unknown-type-reference-in-type-member.json-error.
+        * inspector/scripts/tests/expected/generate-domains-with-feature-guards.json-result: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/generate-domains-with-feature-guards.json-result.
+        * inspector/scripts/tests/expected/same-type-id-different-domain.json-result: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/same-type-id-different-domain.json-result.
+        * inspector/scripts/tests/expected/shadowed-optional-type-setters.json-result: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/shadowed-optional-type-setters.json-result.
+        * inspector/scripts/tests/expected/should-strip-comments.json-result: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/should-strip-comments.json-result.
+        * inspector/scripts/tests/expected/type-declaration-aliased-primitive-type.json-result: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/type-declaration-aliased-primitive-type.json-result.
+        * inspector/scripts/tests/expected/type-declaration-array-type.json-result: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/type-declaration-array-type.json-result.
+        * inspector/scripts/tests/expected/type-declaration-enum-type.json-result: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/type-declaration-enum-type.json-result.
+        * inspector/scripts/tests/expected/type-declaration-object-type.json-result: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/type-declaration-object-type.json-result.
+        * inspector/scripts/tests/expected/type-requiring-runtime-casts.json-result: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/type-requiring-runtime-casts.json-result.
+        * inspector/scripts/tests/expected/type-with-open-parameters.json-result: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/type-with-open-parameters.json-result.
+        * inspector/scripts/tests/expected/version.json-result: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/expected/version.json-result.
+        * inspector/scripts/tests/fail-on-command-targetType-matching-domain-debuggableType.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-command-targetType-matching-domain-debuggableType.json.
+        * inspector/scripts/tests/fail-on-command-targetTypes-type.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-command-targetTypes-type.json.
+        * inspector/scripts/tests/fail-on-command-targetTypes-value.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-command-targetTypes-value.json.
+        * inspector/scripts/tests/fail-on-domain-debuggableTypes-type.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-domain-debuggableTypes-type.json.
+        * inspector/scripts/tests/fail-on-domain-debuggableTypes-value.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-domain-debuggableTypes-value.json.
+        * inspector/scripts/tests/fail-on-domain-targetType-matching-domain-debuggableType.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-domain-targetType-matching-domain-debuggableType.json.
+        * inspector/scripts/tests/fail-on-domain-targetTypes-type.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-domain-targetTypes-type.json.
+        * inspector/scripts/tests/fail-on-domain-targetTypes-value.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-domain-targetTypes-value.json.
+        * inspector/scripts/tests/fail-on-duplicate-command-call-parameter-names.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-duplicate-command-call-parameter-names.json.
+        * inspector/scripts/tests/fail-on-duplicate-command-return-parameter-names.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-duplicate-command-return-parameter-names.json.
+        * inspector/scripts/tests/fail-on-duplicate-event-parameter-names.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-duplicate-event-parameter-names.json.
+        * inspector/scripts/tests/fail-on-duplicate-type-declarations.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-duplicate-type-declarations.json.
+        * inspector/scripts/tests/fail-on-duplicate-type-member-names.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-duplicate-type-member-names.json.
+        * inspector/scripts/tests/fail-on-enum-with-no-values.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-enum-with-no-values.json.
+        * inspector/scripts/tests/fail-on-event-targetType-matching-domain-debuggableType.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-event-targetType-matching-domain-debuggableType.json.
+        * inspector/scripts/tests/fail-on-event-targetTypes-type.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-event-targetTypes-type.json.
+        * inspector/scripts/tests/fail-on-event-targetTypes-value.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-event-targetTypes-value.json.
+        * inspector/scripts/tests/fail-on-number-typed-optional-parameter-flag.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-number-typed-optional-parameter-flag.json.
+        * inspector/scripts/tests/fail-on-number-typed-optional-type-member.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-number-typed-optional-type-member.json.
+        * inspector/scripts/tests/fail-on-string-typed-optional-parameter-flag.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-string-typed-optional-parameter-flag.json.
+        * inspector/scripts/tests/fail-on-string-typed-optional-type-member.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-string-typed-optional-type-member.json.
+        * inspector/scripts/tests/fail-on-type-declaration-using-type-reference.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-type-declaration-using-type-reference.json.
+        * inspector/scripts/tests/fail-on-type-reference-as-primitive-type.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-type-reference-as-primitive-type.json.
+        * inspector/scripts/tests/fail-on-type-with-lowercase-name.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-type-with-lowercase-name.json.
+        * inspector/scripts/tests/fail-on-unknown-type-reference-in-type-declaration.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-unknown-type-reference-in-type-declaration.json.
+        * inspector/scripts/tests/fail-on-unknown-type-reference-in-type-member.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-unknown-type-reference-in-type-member.json.
+        * inspector/scripts/tests/generate-domains-with-feature-guards.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/generate-domains-with-feature-guards.json.
+        * inspector/scripts/tests/same-type-id-different-domain.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/same-type-id-different-domain.json.
+        * inspector/scripts/tests/shadowed-optional-type-setters.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/shadowed-optional-type-setters.json.
+        * inspector/scripts/tests/should-strip-comments.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/should-strip-comments.json.
+        * inspector/scripts/tests/type-declaration-aliased-primitive-type.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/type-declaration-aliased-primitive-type.json.
+        * inspector/scripts/tests/type-declaration-array-type.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/type-declaration-array-type.json.
+        * inspector/scripts/tests/type-declaration-enum-type.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/type-declaration-enum-type.json.
+        * inspector/scripts/tests/type-declaration-object-type.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/type-declaration-object-type.json.
+        * inspector/scripts/tests/type-requiring-runtime-casts.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/type-requiring-runtime-casts.json.
+        * inspector/scripts/tests/type-with-open-parameters.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/type-with-open-parameters.json.
+        * inspector/scripts/tests/version.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/version.json.
+        * inspector/scripts/tests/generic/definitions-with-mac-platform.json: Removed.
+        * inspector/scripts/tests/generic/expected/definitions-with-mac-platform.json-result: Removed.
+        * inspector/scripts/tests/generic/fail-on-command-with-invalid-platform.json: Removed.
+        * inspector/scripts/tests/generic/expected/fail-on-command-with-invalid-platform.json-error: Removed.
+        * inspector/scripts/tests/generic/fail-on-type-with-invalid-platform.json: Removed.
+        * inspector/scripts/tests/generic/expected/fail-on-type-with-invalid-platform.json-error: Removed.
+        * inspector/scripts/tests/ios/definitions-with-mac-platform.json: Removed.
+        * inspector/scripts/tests/ios/expected/definitions-with-mac-platform.json-result: Removed.
+        * inspector/scripts/tests/all/definitions-with-mac-platform.json: Removed.
+        * inspector/scripts/tests/all/expected/definitions-with-mac-platform.json-result: Removed.
+        Don't separate the inspector generator tests by platform.
+
 2020-05-27  Keith Miller  <keith_miller@apple.com>
 
         in_structure_property needs to handle constants on the RHS of the "in"
index 0be4207..3e6978e 100644 (file)
@@ -377,6 +377,8 @@ ENABLE_VIDEO_TRACK = ENABLE_VIDEO_TRACK;
 ENABLE_VIDEO_USES_ELEMENT_FULLSCREEN = $(ENABLE_VIDEO_USES_ELEMENT_FULLSCREEN_$(WK_PLATFORM_NAME));
 ENABLE_VIDEO_USES_ELEMENT_FULLSCREEN_macosx = ENABLE_VIDEO_USES_ELEMENT_FULLSCREEN;
 
+ENABLE_WEB_ARCHIVE = ENABLE_WEB_ARCHIVE;
+
 ENABLE_WEBDRIVER_MOUSE_INTERACTIONS = $(ENABLE_WEBDRIVER_MOUSE_INTERACTIONS_$(WK_PLATFORM_NAME));
 ENABLE_WEBDRIVER_MOUSE_INTERACTIONS_macosx = ENABLE_WEBDRIVER_MOUSE_INTERACTIONS;
 
@@ -419,4 +421,4 @@ ENABLE_WIRELESS_PLAYBACK_TARGET = ENABLE_WIRELESS_PLAYBACK_TARGET;
 
 ENABLE_XSLT = ENABLE_XSLT;
 
-FEATURE_DEFINES = $(ENABLE_3D_TRANSFORMS) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ACCESSIBILITY_ISOLATED_TREE) $(ENABLE_APPLE_PAY) $(ENABLE_APPLE_PAY_SESSION_V3) $(ENABLE_APPLE_PAY_SESSION_V4) $(ENABLE_APPLICATION_MANIFEST) $(ENABLE_ATTACHMENT_ELEMENT) $(ENABLE_AVF_CAPTIONS) $(ENABLE_CACHE_PARTITIONING) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CONTENT_FILTERING) $(ENABLE_CSS3_TEXT) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_CONIC_GRADIENTS) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_PAINTING_API) $(ENABLE_CSS_SCROLL_SNAP) $(ENABLE_CSS_SELECTORS_LEVEL4) $(ENABLE_CSS_TRAILING_WORD) $(ENABLE_CSS_TYPED_OM) $(ENABLE_CURSOR_VISIBILITY) $(ENABLE_C_LOOP) $(ENABLE_DARK_MODE_CSS) $(ENABLE_DATACUE_VALUE) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DATA_INTERACTION) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DRAG_SUPPORT) $(ENABLE_EDITABLE_REGION) $(ENABLE_ENCRYPTED_MEDIA) $(ENABLE_EXPERIMENTAL_FEATURES) $(ENABLE_FILTERS_LEVEL_2) $(ENABLE_FULLSCREEN_API) $(ENABLE_PICTURE_IN_PICTURE_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_GPU_PROCESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INDEXED_DATABASE_IN_WORKERS) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_DATETIME_INCOMPLETE) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_INSPECTOR_ALTERNATE_DISPATCHERS) $(ENABLE_INSPECTOR_TELEMETRY) $(ENABLE_INTERSECTION_OBSERVER) $(ENABLE_IOS_GESTURE_EVENTS) $(ENABLE_IOS_TOUCH_EVENTS) $(ENABLE_LAYOUT_FORMATTING_CONTEXT) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_CUSTOM_PROTOCOL_MANAGER) $(ENABLE_LEGACY_ENCRYPTED_MEDIA) $(ENABLE_LETTERPRESS) $(ENABLE_MAC_GESTURE_EVENTS) $(ENABLE_MATHML) $(ENABLE_MEDIA_CAPTURE) $(ENABLE_MEDIA_CONTROLS_SCRIPT) $(ENABLE_MEDIA_SESSION) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_MEDIA_STREAM) $(ENABLE_MEMORY_SAMPLER) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MOUSE_CURSOR_SCALE) $(ENABLE_NAVIGATOR_STANDALONE) $(ENABLE_NETWORK_CACHE_SPECULATIVE_REVALIDATION) $(ENABLE_NETWORK_CACHE_STALE_WHILE_REVALIDATE) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFSCREEN_CANVAS) $(ENABLE_OVERFLOW_SCROLLING_TOUCH) $(ENABLE_PAYMENT_REQUEST) $(ENABLE_PDFKIT_PLUGIN) $(ENABLE_POINTER_LOCK) $(ENABLE_PUBLIC_SUFFIX_LIST) $(ENABLE_QUOTA) $(ENABLE_REMOTE_INSPECTOR) $(ENABLE_RESIZE_OBSERVER) $(ENABLE_RESOLUTION_MEDIA_QUERY) $(ENABLE_RESOURCE_LOAD_STATISTICS) $(ENABLE_RESOURCE_USAGE) $(ENABLE_RUBBER_BANDING) $(ENABLE_SANDBOX_EXTENSIONS) $(ENABLE_SERVER_PRECONNECT) $(ENABLE_SERVICE_CONTROLS) $(ENABLE_SERVICE_WORKER) $(ENABLE_SHAREABLE_RESOURCE) $(ENABLE_SPEECH_SYNTHESIS) $(ENABLE_STREAMS_API) $(ENABLE_SVG_FONTS) $(ENABLE_TELEPHONE_NUMBER_DETECTION) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TOUCH_EVENTS) $(ENABLE_USERSELECT_ALL) $(ENABLE_USER_MESSAGE_HANDLERS) $(ENABLE_VARIATION_FONTS) $(ENABLE_VIDEO) $(ENABLE_VIDEO_PRESENTATION_MODE) $(ENABLE_VIDEO_TRACK) $(ENABLE_VIDEO_USES_ELEMENT_FULLSCREEN) $(ENABLE_WEBDRIVER_MOUSE_INTERACTIONS) $(ENABLE_WEBDRIVER_KEYBOARD_INTERACTIONS) $(ENABLE_WEBDRIVER_TOUCH_INTERACTIONS) $(ENABLE_WEBGL) $(ENABLE_WEBGL2) $(ENABLE_WEBGPU) $(ENABLE_WEBXR) $(ENABLE_WEB_API_STATISTICS) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_AUTHN) $(ENABLE_WEB_CRYPTO) $(ENABLE_WEB_RTC) $(ENABLE_WIRELESS_PLAYBACK_TARGET) $(ENABLE_XSLT);
+FEATURE_DEFINES = $(ENABLE_3D_TRANSFORMS) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ACCESSIBILITY_ISOLATED_TREE) $(ENABLE_APPLE_PAY) $(ENABLE_APPLE_PAY_SESSION_V3) $(ENABLE_APPLE_PAY_SESSION_V4) $(ENABLE_APPLICATION_MANIFEST) $(ENABLE_ATTACHMENT_ELEMENT) $(ENABLE_AVF_CAPTIONS) $(ENABLE_CACHE_PARTITIONING) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CONTENT_FILTERING) $(ENABLE_CSS3_TEXT) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_CONIC_GRADIENTS) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_PAINTING_API) $(ENABLE_CSS_SCROLL_SNAP) $(ENABLE_CSS_SELECTORS_LEVEL4) $(ENABLE_CSS_TRAILING_WORD) $(ENABLE_CSS_TYPED_OM) $(ENABLE_CURSOR_VISIBILITY) $(ENABLE_C_LOOP) $(ENABLE_DARK_MODE_CSS) $(ENABLE_DATACUE_VALUE) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DATA_INTERACTION) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DRAG_SUPPORT) $(ENABLE_EDITABLE_REGION) $(ENABLE_ENCRYPTED_MEDIA) $(ENABLE_EXPERIMENTAL_FEATURES) $(ENABLE_FILTERS_LEVEL_2) $(ENABLE_FULLSCREEN_API) $(ENABLE_PICTURE_IN_PICTURE_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_GPU_PROCESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INDEXED_DATABASE_IN_WORKERS) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_DATETIME_INCOMPLETE) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_INSPECTOR_ALTERNATE_DISPATCHERS) $(ENABLE_INSPECTOR_TELEMETRY) $(ENABLE_INTERSECTION_OBSERVER) $(ENABLE_IOS_GESTURE_EVENTS) $(ENABLE_IOS_TOUCH_EVENTS) $(ENABLE_LAYOUT_FORMATTING_CONTEXT) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_CUSTOM_PROTOCOL_MANAGER) $(ENABLE_LEGACY_ENCRYPTED_MEDIA) $(ENABLE_LETTERPRESS) $(ENABLE_MAC_GESTURE_EVENTS) $(ENABLE_MATHML) $(ENABLE_MEDIA_CAPTURE) $(ENABLE_MEDIA_CONTROLS_SCRIPT) $(ENABLE_MEDIA_SESSION) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_MEDIA_STREAM) $(ENABLE_MEMORY_SAMPLER) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MOUSE_CURSOR_SCALE) $(ENABLE_NAVIGATOR_STANDALONE) $(ENABLE_NETWORK_CACHE_SPECULATIVE_REVALIDATION) $(ENABLE_NETWORK_CACHE_STALE_WHILE_REVALIDATE) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFSCREEN_CANVAS) $(ENABLE_OVERFLOW_SCROLLING_TOUCH) $(ENABLE_PAYMENT_REQUEST) $(ENABLE_PDFKIT_PLUGIN) $(ENABLE_POINTER_LOCK) $(ENABLE_PUBLIC_SUFFIX_LIST) $(ENABLE_QUOTA) $(ENABLE_REMOTE_INSPECTOR) $(ENABLE_RESIZE_OBSERVER) $(ENABLE_RESOLUTION_MEDIA_QUERY) $(ENABLE_RESOURCE_LOAD_STATISTICS) $(ENABLE_RESOURCE_USAGE) $(ENABLE_RUBBER_BANDING) $(ENABLE_SANDBOX_EXTENSIONS) $(ENABLE_SERVER_PRECONNECT) $(ENABLE_SERVICE_CONTROLS) $(ENABLE_SERVICE_WORKER) $(ENABLE_SHAREABLE_RESOURCE) $(ENABLE_SPEECH_SYNTHESIS) $(ENABLE_STREAMS_API) $(ENABLE_SVG_FONTS) $(ENABLE_TELEPHONE_NUMBER_DETECTION) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TOUCH_EVENTS) $(ENABLE_USERSELECT_ALL) $(ENABLE_USER_MESSAGE_HANDLERS) $(ENABLE_VARIATION_FONTS) $(ENABLE_VIDEO) $(ENABLE_VIDEO_PRESENTATION_MODE) $(ENABLE_VIDEO_TRACK) $(ENABLE_VIDEO_USES_ELEMENT_FULLSCREEN) $(ENABLE_WEB_ARCHIVE) $(ENABLE_WEBDRIVER_MOUSE_INTERACTIONS) $(ENABLE_WEBDRIVER_KEYBOARD_INTERACTIONS) $(ENABLE_WEBDRIVER_TOUCH_INTERACTIONS) $(ENABLE_WEBGL) $(ENABLE_WEBGL2) $(ENABLE_WEBGPU) $(ENABLE_WEBXR) $(ENABLE_WEB_API_STATISTICS) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_AUTHN) $(ENABLE_WEB_CRYPTO) $(ENABLE_WEB_RTC) $(ENABLE_WIRELESS_PLAYBACK_TARGET) $(ENABLE_XSLT);
index fea4045..a65cfd5 100644 (file)
@@ -1,4 +1,5 @@
 # This file is generated by the generate-xcfilelists script.
+$(PROJECT_DIR)/Configurations/FeatureDefines.xcconfig
 $(PROJECT_DIR)/DerivedSources.make
 $(PROJECT_DIR)/KeywordLookupGenerator.py
 $(PROJECT_DIR)/Scripts/UpdateContents.py
@@ -80,6 +81,7 @@ $(PROJECT_DIR)/inspector/InjectedScriptSource.js
 $(PROJECT_DIR)/inspector/protocol/Animation.json
 $(PROJECT_DIR)/inspector/protocol/ApplicationCache.json
 $(PROJECT_DIR)/inspector/protocol/Audit.json
+$(PROJECT_DIR)/inspector/protocol/Browser.json
 $(PROJECT_DIR)/inspector/protocol/CPUProfiler.json
 $(PROJECT_DIR)/inspector/protocol/CSS.json
 $(PROJECT_DIR)/inspector/protocol/Canvas.json
@@ -89,7 +91,6 @@ $(PROJECT_DIR)/inspector/protocol/DOMDebugger.json
 $(PROJECT_DIR)/inspector/protocol/DOMStorage.json
 $(PROJECT_DIR)/inspector/protocol/Database.json
 $(PROJECT_DIR)/inspector/protocol/Debugger.json
-$(PROJECT_DIR)/inspector/protocol/Browser.json
 $(PROJECT_DIR)/inspector/protocol/GenericTypes.json
 $(PROJECT_DIR)/inspector/protocol/Heap.json
 $(PROJECT_DIR)/inspector/protocol/IndexedDB.json
@@ -119,6 +120,7 @@ $(PROJECT_DIR)/inspector/scripts/codegen/generate_js_backend_commands.py
 $(PROJECT_DIR)/inspector/scripts/codegen/generator.py
 $(PROJECT_DIR)/inspector/scripts/codegen/generator_templates.py
 $(PROJECT_DIR)/inspector/scripts/codegen/models.py
+$(PROJECT_DIR)/inspector/scripts/codegen/preprocess.pl
 $(PROJECT_DIR)/inspector/scripts/generate-inspector-protocol-bindings.py
 $(PROJECT_DIR)/parser/Keywords.table
 $(PROJECT_DIR)/runtime/ArrayConstructor.cpp
index 00d2a57..224aadf 100644 (file)
@@ -46,6 +46,45 @@ else
     DELETE = rm -f
 endif
 
+PREPROCESSOR_DEFINES = $(FEATURE_DEFINES)
+
+FRAMEWORK_FLAGS = $(shell echo $(BUILT_PRODUCTS_DIR) $(FRAMEWORK_SEARCH_PATHS) $(SYSTEM_FRAMEWORK_SEARCH_PATHS) | perl -e 'print "-F " . join(" -F ", split(" ", <>));')
+HEADER_FLAGS = $(shell echo $(BUILT_PRODUCTS_DIR) $(HEADER_SEARCH_PATHS) $(SYSTEM_HEADER_SEARCH_PATHS) | perl -e 'print "-I" . join(" -I", split(" ", <>));')
+
+ifneq ($(SDKROOT),)
+    SDK_FLAGS=-isysroot $(SDKROOT)
+endif
+
+ifeq ($(USE_LLVM_TARGET_TRIPLES_FOR_CLANG),YES)
+    WK_CURRENT_ARCH=$(word 1, $(ARCHS))
+    TARGET_TRIPLE_FLAGS=-target $(WK_CURRENT_ARCH)-$(LLVM_TARGET_TRIPLE_VENDOR)-$(LLVM_TARGET_TRIPLE_OS_VERSION)$(LLVM_TARGET_TRIPLE_SUFFIX)
+endif
+
+ifeq ($(shell $(CC) -std=gnu++1z -x c++ -E -P -dM $(SDK_FLAGS) $(TARGET_TRIPLE_FLAGS) $(FRAMEWORK_FLAGS) $(HEADER_FLAGS) -include "wtf/Platform.h" /dev/null | grep ' WTF_PLATFORM_MAC ' | cut -d' ' -f3), 1)
+    PREPROCESSOR_DEFINES += WTF_PLATFORM_MAC
+endif
+
+ifeq ($(shell $(CC) -std=gnu++1z -x c++ -E -P -dM $(SDK_FLAGS) $(TARGET_TRIPLE_FLAGS) $(FRAMEWORK_FLAGS) $(HEADER_FLAGS) -include "wtf/Platform.h" /dev/null | grep ' WTF_PLATFORM_IOS_FAMILY ' | cut -d' ' -f3), 1)
+    PREPROCESSOR_DEFINES += WTF_PLATFORM_IOS_FAMILY
+endif
+
+ifeq ($(shell $(CC) -std=gnu++1z -x c++ -E -P -dM $(SDK_FLAGS) $(TARGET_TRIPLE_FLAGS) $(FRAMEWORK_FLAGS) $(HEADER_FLAGS) -include "wtf/Platform.h" /dev/null | grep ' USE_CF ' | cut -d' ' -f3), 1)
+    PREPROCESSOR_DEFINES += USE_CF
+endif
+
+ifeq ($(shell $(CC) -std=gnu++1z -x c++ -E -P -dM $(SDK_FLAGS) $(TARGET_TRIPLE_FLAGS) $(FRAMEWORK_FLAGS) $(HEADER_FLAGS) -include "wtf/Platform.h" /dev/null | grep HAVE_OS_DARK_MODE_SUPPORT | cut -d' ' -f3), 1)
+    PREPROCESSOR_DEFINES += HAVE_OS_DARK_MODE_SUPPORT
+else
+endif
+
+ifeq ($(PLATFORM_FEATURE_DEFINES),)
+ifeq ($(OS), Windows_NT)
+PLATFORM_FEATURE_DEFINES = $(WEBKIT_LIBRARIES)/tools/vsprops/FeatureDefines.props
+else
+PLATFORM_FEATURE_DEFINES = Configurations/FeatureDefines.xcconfig
+endif
+endif
+
 # --------
 
 .PHONY : all
@@ -243,6 +282,8 @@ INSPECTOR_DOMAINS := \
     $(JavaScriptCore)/inspector/protocol/Animation.json \
     $(JavaScriptCore)/inspector/protocol/ApplicationCache.json \
     $(JavaScriptCore)/inspector/protocol/Audit.json \
+    $(JavaScriptCore)/inspector/protocol/Browser.json \
+    $(JavaScriptCore)/inspector/protocol/CPUProfiler.json \
     $(JavaScriptCore)/inspector/protocol/CSS.json \
     $(JavaScriptCore)/inspector/protocol/Canvas.json \
     $(JavaScriptCore)/inspector/protocol/Console.json \
@@ -251,35 +292,24 @@ INSPECTOR_DOMAINS := \
     $(JavaScriptCore)/inspector/protocol/DOMStorage.json \
     $(JavaScriptCore)/inspector/protocol/Database.json \
     $(JavaScriptCore)/inspector/protocol/Debugger.json \
-    $(JavaScriptCore)/inspector/protocol/Browser.json \
     $(JavaScriptCore)/inspector/protocol/GenericTypes.json \
     $(JavaScriptCore)/inspector/protocol/Heap.json \
+    $(JavaScriptCore)/inspector/protocol/IndexedDB.json \
     $(JavaScriptCore)/inspector/protocol/Inspector.json \
     $(JavaScriptCore)/inspector/protocol/LayerTree.json \
+    $(JavaScriptCore)/inspector/protocol/Memory.json \
     $(JavaScriptCore)/inspector/protocol/Network.json \
     $(JavaScriptCore)/inspector/protocol/Page.json \
     $(JavaScriptCore)/inspector/protocol/Recording.json \
     $(JavaScriptCore)/inspector/protocol/Runtime.json \
     $(JavaScriptCore)/inspector/protocol/ScriptProfiler.json \
     $(JavaScriptCore)/inspector/protocol/Security.json \
+    $(JavaScriptCore)/inspector/protocol/ServiceWorker.json \
     $(JavaScriptCore)/inspector/protocol/Target.json \
     $(JavaScriptCore)/inspector/protocol/Timeline.json \
     $(JavaScriptCore)/inspector/protocol/Worker.json \
 #
 
-ifeq ($(findstring ENABLE_INDEXED_DATABASE,$(FEATURE_DEFINES)), ENABLE_INDEXED_DATABASE)
-    INSPECTOR_DOMAINS := $(INSPECTOR_DOMAINS) $(JavaScriptCore)/inspector/protocol/IndexedDB.json
-endif
-
-ifeq ($(findstring ENABLE_RESOURCE_USAGE,$(FEATURE_DEFINES)), ENABLE_RESOURCE_USAGE)
-    INSPECTOR_DOMAINS := $(INSPECTOR_DOMAINS) $(JavaScriptCore)/inspector/protocol/CPUProfiler.json
-    INSPECTOR_DOMAINS := $(INSPECTOR_DOMAINS) $(JavaScriptCore)/inspector/protocol/Memory.json
-endif
-
-ifeq ($(findstring ENABLE_SERVICE_WORKER,$(FEATURE_DEFINES)), ENABLE_SERVICE_WORKER)
-    INSPECTOR_DOMAINS := $(INSPECTOR_DOMAINS) $(JavaScriptCore)/inspector/protocol/ServiceWorker.json
-endif
-
 INSPECTOR_GENERATOR_SCRIPTS = \
        $(JavaScriptCore)/inspector/scripts/codegen/__init__.py \
        $(JavaScriptCore)/inspector/scripts/codegen/cpp_generator_templates.py \
@@ -294,6 +324,7 @@ INSPECTOR_GENERATOR_SCRIPTS = \
        $(JavaScriptCore)/inspector/scripts/codegen/generator_templates.py \
        $(JavaScriptCore)/inspector/scripts/codegen/generator.py \
        $(JavaScriptCore)/inspector/scripts/codegen/models.py \
+       $(JavaScriptCore)/inspector/scripts/codegen/preprocess.pl \
        $(JavaScriptCore)/inspector/scripts/generate-inspector-protocol-bindings.py \
        $(JavaScriptCore_SCRIPTS_DIR)/generate-combined-inspector-json.py \
 #
@@ -302,7 +333,6 @@ INSPECTOR_GENERATOR_SCRIPTS = \
 # generate-inspector-protocol-bindings.py and ./CombinedDomains.json?
 INSPECTOR_DISPATCHER_FILES = \
     inspector/InspectorAlternateBackendDispatchers.h \
-    inspector/InspectorBackendCommands.js \
     inspector/InspectorBackendDispatchers.cpp \
     inspector/InspectorBackendDispatchers.h \
     inspector/InspectorFrontendDispatchers.cpp \
@@ -312,7 +342,7 @@ INSPECTOR_DISPATCHER_FILES = \
 #
 INSPECTOR_DISPATCHER_FILES_PATTERNS = $(subst .,%,$(INSPECTOR_DISPATCHER_FILES))
 
-all : $(INSPECTOR_DISPATCHER_FILES)
+all : $(INSPECTOR_DISPATCHER_FILES) inspector/InspectorBackendCommands.js
 
 # The combined JSON file depends on the actual set of domains and their file contents, so that
 # adding, modifying, or removing domains will trigger regeneration of inspector files.
@@ -328,6 +358,12 @@ CombinedDomains.json : $(JavaScriptCore_SCRIPTS_DIR)/generate-combined-inspector
 $(INSPECTOR_DISPATCHER_FILES_PATTERNS) : CombinedDomains.json $(INSPECTOR_GENERATOR_SCRIPTS)
        $(PYTHON) $(JavaScriptCore)/inspector/scripts/generate-inspector-protocol-bindings.py --framework JavaScriptCore --outputDir inspector ./CombinedDomains.json
 
+inspector/InspectorBackendCommands.js : CombinedDomains.json $(INSPECTOR_GENERATOR_SCRIPTS) $(PLATFORM_FEATURE_DEFINES)
+       $(PYTHON) $(JavaScriptCore)/inspector/scripts/generate-inspector-protocol-bindings.py --framework WebInspectorUI --outputDir inspector ./CombinedDomains.json
+       @echo Pre-processing InspectorBackendCommands...
+       $(PERL) $(JavaScriptCore)/inspector/scripts/codegen/preprocess.pl --input inspector/InspectorBackendCommands.js.in --defines "$(PREPROCESSOR_DEFINES)" --output inspector/InspectorBackendCommands.js
+       $(DELETE) inspector/InspectorBackendCommands.js.in
+
 InjectedScriptSource.h : inspector/InjectedScriptSource.js $(JavaScriptCore_SCRIPTS_DIR)/jsmin.py $(JavaScriptCore_SCRIPTS_DIR)/xxd.pl
        echo "//# sourceURL=__InjectedScript_InjectedScriptSource.js" > ./InjectedScriptSource.min.js
        $(PYTHON) $(JavaScriptCore_SCRIPTS_DIR)/jsmin.py < $(JavaScriptCore)/inspector/InjectedScriptSource.js >> ./InjectedScriptSource.min.js
index 9361f58..2414765 100755 (executable)
@@ -11,4 +11,8 @@ cd "${BUILT_PRODUCTS_DIR}/DerivedSources/JavaScriptCore"
 export JavaScriptCore="JavaScriptCore"
 export BUILT_PRODUCTS_DIR="../.."
 
+if [ ! $CC ]; then
+    export CC="`xcrun -find clang`"
+fi
+
 make --no-builtin-rules -f "JavaScriptCore/DerivedSources.make" -j `/usr/sbin/sysctl -n hw.ncpu` "${ARGS[@]}"
index cfacd01..adc6c6a 100644 (file)
@@ -1,7 +1,7 @@
 {
     "domain": "CPUProfiler",
     "description": "CPUProfiler domain exposes cpu usage tracking.",
-    "featureGuard": "ENABLE(RESOURCE_USAGE)",
+    "condition": "defined(ENABLE_RESOURCE_USAGE) && ENABLE_RESOURCE_USAGE",
     "debuggableTypes": ["page", "web-page"],
     "targetTypes": ["page"],
     "types": [
index ab54440..08c1005 100644 (file)
@@ -11,6 +11,7 @@
         },
         {
             "id": "ProgramId",
+            "condition": "(defined(ENABLE_WEBGL) && ENABLE_WEBGL) || (defined(ENABLE_WEBGPU) && ENABLE_WEBGPU)",
             "type": "string",
             "description": "Unique shader program identifier."
         },
         },
         {
             "id": "ProgramType",
+            "condition": "(defined(ENABLE_WEBGL) && ENABLE_WEBGL) || (defined(ENABLE_WEBGPU) && ENABLE_WEBGPU)",
             "type": "string",
             "enum": ["compute", "render"]
         },
         {
             "id": "ShaderType",
+            "condition": "(defined(ENABLE_WEBGL) && ENABLE_WEBGL) || (defined(ENABLE_WEBGPU) && ENABLE_WEBGPU)",
             "type": "string",
             "enum": ["compute", "fragment", "vertex"]
         },
@@ -61,8 +64,9 @@
         },
         {
             "id": "ShaderProgram",
-            "type": "object",
             "description": "Information about a WebGL/WebGL2 shader program or WebGPU shader pipeline.",
+            "condition": "(defined(ENABLE_WEBGL) && ENABLE_WEBGL) || (defined(ENABLE_WEBGPU) && ENABLE_WEBGPU)",
+            "type": "object",
             "properties": [
                 { "name": "programId", "$ref": "ProgramId" },
                 { "name": "programType", "$ref": "ProgramType" },
         {
             "name": "requestShaderSource",
             "description": "Requests the source of the shader of the given type from the program with the given id.",
+            "condition": "(defined(ENABLE_WEBGL) && ENABLE_WEBGL) || (defined(ENABLE_WEBGPU) && ENABLE_WEBGPU)",
             "parameters": [
                 { "name": "programId", "$ref": "ProgramId" },
                 { "name": "shaderType", "$ref": "ShaderType" }
         {
             "name": "updateShader",
             "description": "Compiles and links the shader with identifier and type with the given source code.",
+            "condition": "(defined(ENABLE_WEBGL) && ENABLE_WEBGL) || (defined(ENABLE_WEBGPU) && ENABLE_WEBGPU)",
             "parameters": [
                 { "name": "programId", "$ref": "ProgramId" },
                 { "name": "shaderType", "$ref": "ShaderType" },
         {
             "name": "setShaderProgramDisabled",
             "description": "Enable/disable the visibility of the given shader program.",
+            "condition": "defined(ENABLE_WEBGL) && ENABLE_WEBGL",
             "parameters": [
                 { "name": "programId", "$ref": "ProgramId" },
                 { "name": "disabled", "type": "boolean" }
         {
             "name": "setShaderProgramHighlighted",
             "description": "Enable/disable highlighting of the given shader program.",
+            "condition": "defined(ENABLE_WEBGL) && ENABLE_WEBGL",
             "parameters": [
                 { "name": "programId", "$ref": "ProgramId" },
                 { "name": "highlighted", "type": "boolean" }
         },
         {
             "name": "programCreated",
+            "condition": "(defined(ENABLE_WEBGL) && ENABLE_WEBGL) || (defined(ENABLE_WEBGPU) && ENABLE_WEBGPU)",
             "parameters": [
                 { "name": "shaderProgram", "$ref": "ShaderProgram" }
             ]
         },
         {
             "name": "programDeleted",
+            "condition": "(defined(ENABLE_WEBGL) && ENABLE_WEBGL) || (defined(ENABLE_WEBGPU) && ENABLE_WEBGPU)",
             "parameters": [
                 { "name": "programId", "$ref": "ProgramId" }
             ]
index 38cb48b..329b325 100644 (file)
         {
             "name": "setInspectModeEnabled",
             "description": "Enters the 'inspect' mode. In this mode, elements that user is hovering over are highlighted. Backend then generates 'inspect' command upon element selection.",
+            "condition": "defined(WTF_PLATFORM_IOS_FAMILY) && WTF_PLATFORM_IOS_FAMILY",
+            "parameters": [
+                { "name": "enabled", "type": "boolean", "description": "True to enable inspection mode, false to disable it." },
+                { "name": "highlightConfig", "$ref": "HighlightConfig", "optional": true, "description": "A descriptor for the highlight appearance of hovered-over nodes. May be omitted if <code>enabled == false</code>." }
+            ]
+        },
+        {
+            "name": "setInspectModeEnabled",
+            "description": "Enters the 'inspect' mode. In this mode, elements that user is hovering over are highlighted. Backend then generates 'inspect' command upon element selection.",
+            "condition": "!(defined(WTF_PLATFORM_IOS_FAMILY) && WTF_PLATFORM_IOS_FAMILY)",
             "parameters": [
                 { "name": "enabled", "type": "boolean", "description": "True to enable inspection mode, false to disable it." },
                 { "name": "highlightConfig", "$ref": "HighlightConfig", "optional": true, "description": "A descriptor for the highlight appearance of hovered-over nodes. May be omitted if <code>enabled == false</code>." },
         {
             "name": "powerEfficientPlaybackStateChanged",
             "description": "Called when an element enters/exits a power efficient playback state.",
+            "condition": "defined(ENABLE_VIDEO) && ENABLE_VIDEO",
             "parameters": [
                 { "name": "nodeId", "$ref": "NodeId" },
                 { "name": "timestamp", "$ref": "Network.Timestamp" },
index 9d23008..971e702 100644 (file)
@@ -1,6 +1,6 @@
 {
     "domain": "IndexedDB",
-    "featureGuard": "ENABLE(INDEXED_DATABASE)",
+    "condition": "defined(ENABLE_INDEXED_DATABASE) && ENABLE_INDEXED_DATABASE",
     "debuggableTypes": ["page", "web-page"],
     "targetTypes": ["page"],
     "types": [
index 2bb8d62..7ae2e99 100644 (file)
@@ -33,6 +33,7 @@
         {
             "name": "activateExtraDomains",
             "description": "Fired when the backend has alternate domains that need to be activated.",
+            "condition": "defined(ENABLE_INSPECTOR_ALTERNATE_DISPATCHERS) && ENABLE_INSPECTOR_ALTERNATE_DISPATCHERS",
             "parameters": [
                 { "name": "domains", "type": "array", "items": { "type": "string" }, "description": "Domain names that need activation" }
             ]
index 0c3d914..8beaa40 100644 (file)
@@ -1,7 +1,7 @@
 {
     "domain": "Memory",
     "description": "Memory domain exposes page memory tracking.",
-    "featureGuard": "ENABLE(RESOURCE_USAGE)",
+    "condition": "defined(ENABLE_RESOURCE_USAGE) && ENABLE_RESOURCE_USAGE",
     "debuggableTypes": ["page", "web-page"],
     "targetTypes": ["page"],
     "types": [
index d27512a..4f70977 100644 (file)
@@ -45,6 +45,7 @@
         {
             "id": "Appearance",
             "type": "string",
+            "condition": "(defined(ENABLE_DARK_MODE_CSS) && ENABLE_DARK_MODE_CSS) || (defined(HAVE_OS_DARK_MODE_SUPPORT) && HAVE_OS_DARK_MODE_SUPPORT)",
             "enum": ["Light", "Dark"],
             "description": "Page appearance name."
         },
         {
             "name": "setShowRulers",
             "description": "Requests that backend draw rulers in the inspector overlay",
+            "condition": "!(defined(WTF_PLATFORM_IOS_FAMILY) && WTF_PLATFORM_IOS_FAMILY)",
             "parameters": [
                 { "name": "result", "type": "boolean", "description": "True for showing rulers" }
             ]
         {
             "name": "setForcedAppearance",
             "description": "Forces the given appearance for the page.",
+            "condition": "(defined(ENABLE_DARK_MODE_CSS) && ENABLE_DARK_MODE_CSS) || (defined(HAVE_OS_DARK_MODE_SUPPORT) && HAVE_OS_DARK_MODE_SUPPORT)",
             "parameters": [
                 { "name": "appearance", "$ref": "Appearance", "description": "Appearance name to force. Empty string disables the override." }
             ]
         {
             "name": "archive",
             "description": "Grab an archive of the page.",
+            "condition": "(defined(ENABLE_WEB_ARCHIVE) && ENABLE_WEB_ARCHIVE) && (defined(USE_CF) && USE_CF)",
             "returns": [
                 { "name": "data", "type": "string", "description": "Base64-encoded web archive." }
             ]
         {
             "name": "defaultAppearanceDidChange",
             "description": "Fired when page's default appearance changes, even if there is a forced appearance.",
+            "condition": "(defined(ENABLE_DARK_MODE_CSS) && ENABLE_DARK_MODE_CSS) || (defined(HAVE_OS_DARK_MODE_SUPPORT) && HAVE_OS_DARK_MODE_SUPPORT)",
             "parameters": [
                 { "name": "appearance", "$ref": "Appearance", "description": "Name of the appearance that is active (not considering any forced appearance.)" }
             ]
index 8ac3d4f..d0331be 100644 (file)
@@ -1,6 +1,7 @@
 {
     "domain": "ServiceWorker",
     "description": "Actions and events related to the inspected service worker.",
+    "condition": "defined(ENABLE_SERVICE_WORKER) && ENABLE_SERVICE_WORKER",
     "debuggableTypes": ["service-worker"],
     "targetTypes": ["service-worker"],
     "types": [
index 96b55e4..d0c7be6 100755 (executable)
@@ -108,7 +108,7 @@ public:
     void setAlternateDispatcher(Alternate${domainName}BackendDispatcher* alternateDispatcher) { m_alternateDispatcher = alternateDispatcher; }
 private:
     Alternate${domainName}BackendDispatcher* m_alternateDispatcher { nullptr };
-#endif""")
+#endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)""")
 
     BackendDispatcherHeaderAsyncCommandDeclaration = (
     """    ${classAndExportMacro} ${callbackName} : public BackendDispatcher::CallbackBase {
@@ -127,8 +127,8 @@ private:
     message->getObject("params"_s, parameters);
 
 ${dispatchCases}
-    else
-        m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, "'${domainName}." + method + "' was not found");
+
+    m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, "'${domainName}." + method + "' was not found");
 }""")
 
     BackendDispatcherImplementationLargeSwitch = (
index e627880..e1a661b 100755 (executable)
@@ -56,7 +56,7 @@ class CppAlternateBackendDispatcherHeaderGenerator(CppGenerator):
         sections = []
         sections.append(self.generate_license())
         sections.append(Template(CppTemplates.AlternateDispatchersHeaderPrelude).substitute(None, **template_args))
-        sections.append('\n'.join([_f for _f in map(self._generate_handler_declarations_for_domain, domains) if _f]))
+        sections.append('\n\n'.join([_f for _f in map(self._generate_handler_declarations_for_domain, domains) if _f]))
         sections.append(Template(CppTemplates.AlternateDispatchersHeaderPostlude).substitute(None, **template_args))
         return '\n\n'.join(sections)
 
@@ -87,7 +87,7 @@ class CppAlternateBackendDispatcherHeaderGenerator(CppGenerator):
             'commandDeclarations': '\n'.join(command_declarations),
         }
 
-        return self.wrap_with_guard_for_domain(domain, Template(CppTemplates.AlternateBackendDispatcherHeaderDomainHandlerInterfaceDeclaration).substitute(None, **handler_args))
+        return self.wrap_with_guard_for_condition(domain.condition, Template(CppTemplates.AlternateBackendDispatcherHeaderDomainHandlerInterfaceDeclaration).substitute(None, **handler_args))
 
     def _generate_handler_declaration_for_command(self, command):
         lines = []
@@ -100,4 +100,4 @@ class CppAlternateBackendDispatcherHeaderGenerator(CppGenerator):
             'parameters': ', '.join(parameters),
         }
         lines.append('    virtual void %(commandName)s(%(parameters)s) = 0;' % command_args)
-        return '\n'.join(lines)
+        return self.wrap_with_guard_for_condition(command.condition, '\n'.join(lines))
index e3fe4e1..10d8f14 100755 (executable)
@@ -91,7 +91,7 @@ class CppBackendDispatcherHeaderGenerator(CppGenerator):
         lines = []
         lines.append('#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)')
         for domain in domains:
-            lines.append(self.wrap_with_guard_for_domain(domain, 'class Alternate%sBackendDispatcher;' % domain.domain_name))
+            lines.append(self.wrap_with_guard_for_condition(domain.condition, 'class Alternate%sBackendDispatcher;' % domain.domain_name))
         lines.append('#endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)')
         return '\n'.join(lines)
 
@@ -113,7 +113,7 @@ class CppBackendDispatcherHeaderGenerator(CppGenerator):
             'commandDeclarations': "\n".join(command_declarations)
         }
 
-        return self.wrap_with_guard_for_domain(domain, Template(CppTemplates.BackendDispatcherHeaderDomainHandlerDeclaration).substitute(None, **handler_args))
+        return self.wrap_with_guard_for_condition(domain.condition, Template(CppTemplates.BackendDispatcherHeaderDomainHandlerDeclaration).substitute(None, **handler_args))
 
     def _generate_anonymous_enum_for_parameter(self, parameter, command):
         enum_args = {
@@ -161,7 +161,7 @@ class CppBackendDispatcherHeaderGenerator(CppGenerator):
             'parameters': ", ".join(parameters)
         }
         lines.append('    virtual void %(commandName)s(%(parameters)s) = 0;' % command_args)
-        return '\n'.join(lines)
+        return self.wrap_with_guard_for_condition(command.condition, '\n'.join(lines))
 
     def _generate_async_handler_declaration_for_command(self, command):
         callbackName = "%sCallback" % ucfirst(command.command_name)
@@ -192,7 +192,7 @@ class CppBackendDispatcherHeaderGenerator(CppGenerator):
             'outParameters': ", ".join(out_parameters),
         }
 
-        return Template(CppTemplates.BackendDispatcherHeaderAsyncCommandDeclaration).substitute(None, **command_args)
+        return self.wrap_with_guard_for_condition(command.condition, Template(CppTemplates.BackendDispatcherHeaderAsyncCommandDeclaration).substitute(None, **command_args))
 
     def _generate_dispatcher_declarations_for_domain(self, domain):
         classComponents = ['class']
@@ -220,7 +220,7 @@ class CppBackendDispatcherHeaderGenerator(CppGenerator):
             'commandDeclarations': "\n".join(declarations)
         }
 
-        return self.wrap_with_guard_for_domain(domain, Template(CppTemplates.BackendDispatcherHeaderDomainDispatcherDeclaration).substitute(None, **handler_args))
+        return self.wrap_with_guard_for_condition(domain.condition, Template(CppTemplates.BackendDispatcherHeaderDomainDispatcherDeclaration).substitute(None, **handler_args))
 
     def _generate_dispatcher_declaration_for_command(self, command):
-        return "    void %s(long requestId, RefPtr<JSON::Object>&& parameters);" % command.command_name
+        return self.wrap_with_guard_for_condition(command.condition, "    void %s(long requestId, RefPtr<JSON::Object>&& parameters);" % command.command_name)
index a15961a..daf19c9 100755 (executable)
@@ -60,7 +60,7 @@ class CppBackendDispatcherImplementationGenerator(CppGenerator):
             secondary_includes.append('')
             secondary_includes.append('#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)')
             secondary_includes.append('#include "%sAlternateBackendDispatchers.h"' % self.protocol_name())
-            secondary_includes.append('#endif')
+            secondary_includes.append('#endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)')
 
         header_args = {
             'primaryInclude': '"%sBackendDispatchers.h"' % self.protocol_name(),
@@ -93,7 +93,7 @@ class CppBackendDispatcherImplementationGenerator(CppGenerator):
             'domainName': domain.domain_name
         }
         destructor = '%(domainName)sBackendDispatcherHandler::~%(domainName)sBackendDispatcherHandler() { }' % destructor_args
-        return self.wrap_with_guard_for_domain(domain, destructor)
+        return self.wrap_with_guard_for_condition(domain.condition, destructor)
 
     def _generate_dispatcher_implementations_for_domain(self, domain):
         implementations = []
@@ -115,17 +115,29 @@ class CppBackendDispatcherImplementationGenerator(CppGenerator):
                 implementations.append(self._generate_async_dispatcher_class_for_domain(command, domain))
             implementations.append(self._generate_dispatcher_implementation_for_command(command, domain))
 
-        return self.wrap_with_guard_for_domain(domain, '\n\n'.join(implementations))
+        return self.wrap_with_guard_for_condition(domain.condition, '\n\n'.join(implementations))
 
     def _generate_small_dispatcher_switch_implementation_for_domain(self, domain):
         commands = self.commands_for_domain(domain)
 
         cases = []
-        cases.append('    if (method == "%s")' % commands[0].command_name)
-        cases.append('        %s(requestId, WTFMove(parameters));' % commands[0].command_name)
+
+        first_command_string = "\n".join([
+            '    if (method == "%s") {' % commands[0].command_name,
+            '        %s(requestId, WTFMove(parameters));' % commands[0].command_name,
+            '        return;',
+            '    }',
+        ])
+        cases.append(self.wrap_with_guard_for_condition(commands[0].condition, first_command_string))
+
         for command in commands[1:]:
-            cases.append('    else if (method == "%s")' % command.command_name)
-            cases.append('        %s(requestId, WTFMove(parameters));' % command.command_name)
+            additional_command_string = "\n".join([
+                '    if (method == "%s") {' % command.command_name,
+                '        %s(requestId, WTFMove(parameters));' % command.command_name,
+                '        return;',
+                '    }',
+            ])
+            cases.append(self.wrap_with_guard_for_condition(command.condition, additional_command_string))
 
         switch_args = {
             'domainName': domain.domain_name,
@@ -143,7 +155,7 @@ class CppBackendDispatcherImplementationGenerator(CppGenerator):
                 'domainName': domain.domain_name,
                 'commandName': command.command_name
             }
-            cases.append('            { "%(commandName)s", &%(domainName)sBackendDispatcher::%(commandName)s },' % args)
+            cases.append(self.wrap_with_guard_for_condition(command.condition, '            { "%(commandName)s", &%(domainName)sBackendDispatcher::%(commandName)s },' % args))
 
         switch_args = {
             'domainName': domain.domain_name,
@@ -185,7 +197,7 @@ class CppBackendDispatcherImplementationGenerator(CppGenerator):
             'formalParameters': ", ".join(formal_parameters),
             'outParameterAssignments': "\n".join(out_parameter_assignments)
         }
-        return Template(CppTemplates.BackendDispatcherImplementationAsyncCommand).substitute(None, **async_args)
+        return self.wrap_with_guard_for_condition(command.condition, Template(CppTemplates.BackendDispatcherImplementationAsyncCommand).substitute(None, **async_args))
 
     def _generate_dispatcher_implementation_for_command(self, command, domain):
         in_parameter_declarations = []
@@ -304,7 +316,7 @@ class CppBackendDispatcherImplementationGenerator(CppGenerator):
             lines.append('        m_alternateDispatcher->%(commandName)s(%(alternateInvocationParameters)s);' % command_args)
             lines.append('        return;')
             lines.append('    }')
-            lines.append('#endif')
+            lines.append('#endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)')
             lines.append('')
 
         if command.is_async:
@@ -334,4 +346,4 @@ class CppBackendDispatcherImplementationGenerator(CppGenerator):
             lines.append('        m_backendDispatcher->reportProtocolError(BackendDispatcher::ServerError, WTFMove(error));')
 
         lines.append('}')
-        return "\n".join(lines)
+        return self.wrap_with_guard_for_condition(command.condition, "\n".join(lines))
index 5cf7478..119d23c 100755 (executable)
@@ -111,7 +111,7 @@ class CppFrontendDispatcherHeaderGenerator(CppGenerator):
             'eventDeclarations': "\n".join(event_declarations)
         }
 
-        return self.wrap_with_guard_for_domain(domain, Template(CppTemplates.FrontendDispatcherDomainDispatcherDeclaration).substitute(None, **handler_args))
+        return self.wrap_with_guard_for_condition(domain.condition, Template(CppTemplates.FrontendDispatcherDomainDispatcherDeclaration).substitute(None, **handler_args))
 
     def _generate_dispatcher_declaration_for_event(self, event, domain, used_enum_names):
         formal_parameters = []
@@ -123,4 +123,4 @@ class CppFrontendDispatcherHeaderGenerator(CppGenerator):
                 used_enum_names.add(parameter.parameter_name)
 
         lines.append("    void %s(%s);" % (event.event_name, ", ".join(formal_parameters)))
-        return "\n".join(lines)
+        return self.wrap_with_guard_for_condition(event.condition, "\n".join(lines))
index 904d227..66dc6e1 100755 (executable)
@@ -82,7 +82,7 @@ class CppFrontendDispatcherImplementationGenerator(CppGenerator):
         for event in events:
             implementations.append(self._generate_dispatcher_implementation_for_event(event, domain))
 
-        return self.wrap_with_guard_for_domain(domain, '\n\n'.join(implementations))
+        return self.wrap_with_guard_for_condition(domain.condition, '\n\n'.join(implementations))
 
     def _generate_dispatcher_implementation_for_event(self, event, domain):
         lines = []
@@ -131,4 +131,4 @@ class CppFrontendDispatcherImplementationGenerator(CppGenerator):
         lines.append('')
         lines.append('    m_frontendRouter.sendEvent(jsonMessage->toJSONString());')
         lines.append('}')
-        return "\n".join(lines)
+        return self.wrap_with_guard_for_condition(event.condition, "\n".join(lines))
index 423d7a2..99f601a 100755 (executable)
@@ -105,7 +105,7 @@ class CppProtocolTypesHeaderGenerator(CppGenerator):
                 domain_lines.append('static constexpr unsigned VERSION = %s;' % version)
 
             domain_lines.append('} // %s' % domain.domain_name)
-            sections.append(self.wrap_with_guard_for_domain(domain, '\n'.join(domain_lines)))
+            sections.append(self.wrap_with_guard_for_condition(domain.condition, '\n'.join(domain_lines)))
 
         if len(sections) == 0:
             return ''
@@ -132,10 +132,10 @@ class CppProtocolTypesHeaderGenerator(CppGenerator):
             domain_lines.append('namespace %s {' % domain.domain_name)
 
             # Forward-declare all classes so the type builders won't break if rearranged.
-            domain_lines.extend('class %s;' % object_type.raw_name() for object_type in object_types)
-            domain_lines.extend('enum class %s;' % enum_type.raw_name() for enum_type in enum_types)
+            domain_lines.extend(self.wrap_with_guard_for_condition(object_type.declaration().condition, 'class %s;' % object_type.raw_name()) for object_type in object_types)
+            domain_lines.extend(self.wrap_with_guard_for_condition(enum_type.declaration().condition, 'enum class %s;' % enum_type.raw_name()) for enum_type in enum_types)
             domain_lines.append('} // %s' % domain.domain_name)
-            sections.append(self.wrap_with_guard_for_domain(domain, '\n'.join(domain_lines)))
+            sections.append(self.wrap_with_guard_for_condition(domain.condition, '\n'.join(domain_lines)))
 
         if len(sections) == 0:
             return ''
@@ -170,7 +170,7 @@ class CppProtocolTypesHeaderGenerator(CppGenerator):
             if len(declaration.description) > 0:
                 typedef_lines.append('/* %s */' % declaration.description)
             typedef_lines.append('typedef %s %s;' % (primitive_name, declaration.type_name))
-            sections.append('\n'.join(typedef_lines))
+            sections.append(self.wrap_with_guard_for_condition(declaration.condition, '\n'.join(typedef_lines)))
 
         for declaration in array_declarations:
             element_type = CppGenerator.cpp_protocol_type_for_type(declaration.type.element_type)
@@ -178,13 +178,13 @@ class CppProtocolTypesHeaderGenerator(CppGenerator):
             if len(declaration.description) > 0:
                 typedef_lines.append('/* %s */' % declaration.description)
             typedef_lines.append('typedef JSON::ArrayOf<%s> %s;' % (element_type, declaration.type_name))
-            sections.append('\n'.join(typedef_lines))
+            sections.append(self.wrap_with_guard_for_condition(declaration.condition, '\n'.join(typedef_lines)))
 
         lines = []
         lines.append('namespace %s {' % domain.domain_name)
         lines.append('\n'.join(sections))
         lines.append('} // %s' % domain.domain_name)
-        return self.wrap_with_guard_for_domain(domain, '\n'.join(lines))
+        return self.wrap_with_guard_for_condition(domain.condition, '\n'.join(lines))
 
     def _generate_enum_constant_value_conversion_methods(self):
         if not self.assigned_enum_values():
@@ -225,9 +225,11 @@ class CppProtocolTypesHeaderGenerator(CppGenerator):
 
         lines = []
         lines.append('namespace %s {' % domain.domain_name)
-        lines.append('\n'.join(sections))
+        lines.append('')
+        lines.append('\n\n'.join(sections))
+        lines.append('')
         lines.append('} // %s' % domain.domain_name)
-        return self.wrap_with_guard_for_domain(domain, '\n'.join(lines))
+        return self.wrap_with_guard_for_condition(domain.condition, '\n'.join(lines))
 
     def _generate_class_for_object_declaration(self, type_declaration, domain):
         if len(type_declaration.type_members) == 0:
@@ -278,14 +280,14 @@ class CppProtocolTypesHeaderGenerator(CppGenerator):
                 lines.append('    %s static const char* %s;' % (export_macro, ucfirst(type_member.member_name)))
 
         lines.append('};')
-        lines.append('')
-        return '\n'.join(lines)
+        return self.wrap_with_guard_for_condition(type_declaration.condition, '\n'.join(lines))
 
     def _generate_struct_for_enum_declaration(self, enum_declaration):
         lines = []
-        lines.append('/* %s */' % enum_declaration.description)
+        if len(enum_declaration.description):
+            lines.append('/* %s */' % enum_declaration.description)
         lines.extend(self._generate_struct_for_enum_type(enum_declaration.type_name, enum_declaration.type))
-        return '\n'.join(lines)
+        return self.wrap_with_guard_for_condition(enum_declaration.condition, '\n'.join(lines))
 
     def _generate_struct_for_anonymous_enum_member(self, enum_member):
         def apply_indentation(line):
@@ -381,10 +383,10 @@ class CppProtocolTypesHeaderGenerator(CppGenerator):
             for type_declaration in declarations_to_generate:
                 for type_member in type_declaration.type_members:
                     if isinstance(type_member.type, EnumType):
-                        type_arguments.append((CppGenerator.cpp_protocol_type_for_type_member(type_member, type_declaration), False))
+                        type_arguments.append((self.wrap_with_guard_for_condition(type_declaration.condition, CppGenerator.cpp_protocol_type_for_type_member(type_member, type_declaration)), False))
 
                 if isinstance(type_declaration.type, ObjectType):
-                    type_arguments.append((CppGenerator.cpp_protocol_type_for_type(type_declaration.type), Generator.type_needs_runtime_casts(type_declaration.type)))
+                    type_arguments.append((self.wrap_with_guard_for_condition(type_declaration.condition, CppGenerator.cpp_protocol_type_for_type(type_declaration.type)), Generator.type_needs_runtime_casts(type_declaration.type)))
 
         struct_keywords = ['struct']
         function_keywords = ['static void']
@@ -437,19 +439,20 @@ class CppProtocolTypesHeaderGenerator(CppGenerator):
             domain_lines.append("// Enums in the '%s' Domain" % domain.domain_name)
             for enum_type in enum_types:
                 cpp_protocol_type = CppGenerator.cpp_protocol_type_for_type(enum_type)
-                domain_lines.append('template<>')
-                domain_lines.append('%s parseEnumValueFromString<%s>(const String&);' % (return_type_with_export_macro(cpp_protocol_type), cpp_protocol_type))
+                domain_lines.append(self.wrap_with_guard_for_condition(enum_type.declaration().condition, 'template<>\n%s parseEnumValueFromString<%s>(const String&);' % (return_type_with_export_macro(cpp_protocol_type), cpp_protocol_type)))
 
             for object_type in object_types:
+                object_lines = []
                 for enum_member in filter(type_member_is_anonymous_enum_type, object_type.members):
                     cpp_protocol_type = CppGenerator.cpp_protocol_type_for_type_member(enum_member, object_type.declaration())
-                    domain_lines.append('template<>')
-                    domain_lines.append('%s parseEnumValueFromString<%s>(const String&);' % (return_type_with_export_macro(cpp_protocol_type), cpp_protocol_type))
+                    object_lines.append('template<>\n%s parseEnumValueFromString<%s>(const String&);' % (return_type_with_export_macro(cpp_protocol_type), cpp_protocol_type))
+                if len(object_lines):
+                    domain_lines.append(self.wrap_with_guard_for_condition(object_type.declaration().condition, '\n'.join(object_lines)))
 
             if len(domain_lines) == 1:
                 continue  # No real declarations to emit, just the domain comment. Skip.
 
-            sections.append(self.wrap_with_guard_for_domain(domain, '\n'.join(domain_lines)))
+            sections.append(self.wrap_with_guard_for_condition(domain.condition, '\n'.join(domain_lines)))
 
         if len(sections) == 1:
             return [] # No real sections to emit, just the namespace and template declaration. Skip.
@@ -474,14 +477,20 @@ class CppProtocolTypesHeaderGenerator(CppGenerator):
                 lines.append('')
                 lines.append('template<typename T> struct DefaultHash;')
 
-            lines.append('')
-            lines.append("// Hash declarations in the '%s' Domain" % domain.domain_name)
+            domain_lines = []
+
+            domain_lines.append('')
+            domain_lines.append("// Hash declarations in the '%s' Domain" % domain.domain_name)
 
             for enum_type in enum_types:
-                lines.append('template<>')
-                lines.append('struct DefaultHash<Inspector::Protocol::%s::%s> {' % (domain.domain_name, enum_type.raw_name()))
-                lines.append('    typedef IntHash<Inspector::Protocol::%s::%s> Hash;' % (domain.domain_name, enum_type.raw_name()))
-                lines.append('};')
+                enum_lines = []
+                enum_lines.append('template<>')
+                enum_lines.append('struct DefaultHash<Inspector::Protocol::%s::%s> {' % (domain.domain_name, enum_type.raw_name()))
+                enum_lines.append('    typedef IntHash<Inspector::Protocol::%s::%s> Hash;' % (domain.domain_name, enum_type.raw_name()))
+                enum_lines.append('};')
+                domain_lines.append(self.wrap_with_guard_for_condition(enum_type.declaration().condition, '\n'.join(enum_lines)))
+
+            lines.append(self.wrap_with_guard_for_condition(domain.condition, '\n'.join(domain_lines)))
 
         if len(lines) == 0:
             return []
index 65cebf5..5dd5346 100755 (executable)
@@ -128,9 +128,8 @@ class CppProtocolTypesImplementationGenerator(CppGenerator):
                 '',
                 '    return WTF::nullopt;',
                 '}',
-                '',
             ])
-            return body_lines
+            return '\n'.join(body_lines)
 
         type_declarations = self.type_declarations_for_domain(domain)
         declaration_types = [decl.type for decl in type_declarations]
@@ -146,17 +145,23 @@ class CppProtocolTypesImplementationGenerator(CppGenerator):
         lines.append("// Enums in the '%s' Domain" % domain.domain_name)
         for enum_type in enum_types:
             cpp_protocol_type = CppGenerator.cpp_protocol_type_for_type(enum_type)
-            lines.extend(generate_conversion_method_body(enum_type, cpp_protocol_type))
+            lines.append('')
+            lines.append(self.wrap_with_guard_for_condition(enum_type.declaration().condition, generate_conversion_method_body(enum_type, cpp_protocol_type)))
 
         for object_type in object_types:
+            object_lines = []
             for enum_member in filter(type_member_is_anonymous_enum_type, object_type.members):
                 cpp_protocol_type = CppGenerator.cpp_protocol_type_for_type_member(enum_member, object_type.declaration())
-                lines.extend(generate_conversion_method_body(enum_member.type, cpp_protocol_type))
+                object_lines.append(generate_conversion_method_body(enum_member.type, cpp_protocol_type))
+            if len(object_lines):
+                if len(lines):
+                    lines.append('')
+                lines.append(self.wrap_with_guard_for_condition(object_type.declaration().condition, '\n'.join(object_lines)))
 
         if len(lines) == 1:
             return ''  # No real declarations to emit, just the domain comment.
 
-        return self.wrap_with_guard_for_domain(domain, '\n'.join(lines))
+        return self.wrap_with_guard_for_condition(domain.condition, '\n'.join(lines))
 
     def _generate_enum_mapping_and_conversion_methods(self, domains):
         sections = []
@@ -173,12 +178,15 @@ class CppProtocolTypesImplementationGenerator(CppGenerator):
     def _generate_open_field_names(self):
         lines = []
         for domain in self.domains_to_generate():
+            domain_lines = []
             type_declarations = self.type_declarations_for_domain(domain)
             for type_declaration in [decl for decl in type_declarations if Generator.type_has_open_fields(decl.type)]:
                 open_members = Generator.open_fields(type_declaration)
                 for type_member in sorted(open_members, key=lambda member: member.member_name):
                     field_name = '::'.join(['Inspector', 'Protocol', domain.domain_name, ucfirst(type_declaration.type_name), ucfirst(type_member.member_name)])
-                    lines.append('const char* %s = "%s";' % (field_name, type_member.member_name))
+                    domain_lines.append('const char* %s = "%s";' % (field_name, type_member.member_name))
+            if len(domain_lines):
+                lines.append(self.wrap_with_guard_for_condition(domain.condition, '\n'.join(domain_lines)))
 
         return '\n'.join(lines)
 
@@ -188,16 +196,22 @@ class CppProtocolTypesImplementationGenerator(CppGenerator):
         declarations_to_generate = [decl for decl in type_declarations if self.type_needs_shape_assertions(decl.type)]
 
         for type_declaration in declarations_to_generate:
+            type_lines = []
             for type_member in type_declaration.type_members:
                 if isinstance(type_member.type, EnumType):
-                    sections.append(self._generate_assertion_for_enum(type_member, type_declaration))
+                    type_lines.append(self._generate_assertion_for_enum(type_member, type_declaration))
 
             if isinstance(type_declaration.type, ObjectType):
-                sections.append(self._generate_assertion_for_object_declaration(type_declaration))
+                type_lines.append(self._generate_assertion_for_object_declaration(type_declaration))
                 if Generator.type_needs_runtime_casts(type_declaration.type):
-                    sections.append(self._generate_runtime_cast_for_object_declaration(type_declaration))
+                    type_lines.append(self._generate_runtime_cast_for_object_declaration(type_declaration))
+            if len(type_lines):
+                sections.append(self.wrap_with_guard_for_condition(type_declaration.condition, '\n\n'.join(type_lines)))
+
+        if not len(sections):
+            return ''
 
-        return '\n\n'.join(sections)
+        return self.wrap_with_guard_for_condition(domain.condition, '\n\n'.join(sections))
 
     def _generate_runtime_cast_for_object_declaration(self, object_declaration):
         args = {
index bbf76f9..ea6fffb 100755 (executable)
@@ -47,7 +47,7 @@ class JSBackendCommandsGenerator(Generator):
         Generator.__init__(self, *args, **kwargs)
 
     def output_filename(self):
-        return "InspectorBackendCommands.js"
+        return "InspectorBackendCommands.js.in"
 
     def should_generate_domain(self, domain):
         type_declarations = self.type_declarations_for_domain(domain)
@@ -96,7 +96,7 @@ class JSBackendCommandsGenerator(Generator):
                     'enumName': declaration.type_name,
                     'enumMap': ", ".join(['%s: "%s"' % (Generator.stylized_name_for_enum_value(enum_value), enum_value) for enum_value in declaration.type.enum_values()])
                 }
-                lines.append('InspectorBackend.registerEnum("%(domainName)s.%(enumName)s", {%(enumMap)s});' % enum_args)
+                lines.append(self.wrap_with_guard_for_condition(declaration.condition, 'InspectorBackend.registerEnum("%(domainName)s.%(enumName)s", {%(enumMap)s});' % enum_args))
 
             def is_anonymous_enum_member(type_member):
                 return isinstance(type_member.type, EnumType) and type_member.type.is_anonymous
@@ -128,16 +128,18 @@ class JSBackendCommandsGenerator(Generator):
                 'callParams': ", ".join([generate_parameter_object(parameter) for parameter in command.call_parameters]),
                 'returnParams': ", ".join(['"%s"' % parameter.parameter_name for parameter in command.return_parameters]),
             }
-            lines.append('InspectorBackend.registerCommand("%(domainName)s.%(commandName)s", %(targetTypes)s, [%(callParams)s], [%(returnParams)s]);' % command_args)
+            lines.append(self.wrap_with_guard_for_condition(command.condition, 'InspectorBackend.registerCommand("%(domainName)s.%(commandName)s", %(targetTypes)s, [%(callParams)s], [%(returnParams)s]);' % command_args))
 
         for event in events:
+            event_lines = []
+
             for param in filter(is_anonymous_enum_param, event.event_parameters):
                 enum_args = {
                     'domainName': domain.domain_name,
                     'enumName': '%s%s' % (ucfirst(event.event_name), ucfirst(param.parameter_name)),
                     'enumMap': ", ".join(['%s: "%s"' % (Generator.stylized_name_for_enum_value(enum_value), enum_value) for enum_value in param.type.enum_values()]),
                 }
-                lines.append('InspectorBackend.registerEnum("%(domainName)s.%(enumName)s", {%(enumMap)s});' % enum_args)
+                event_lines.append('InspectorBackend.registerEnum("%(domainName)s.%(enumName)s", {%(enumMap)s});' % enum_args)
 
             event_args = {
                 'domainName': domain.domain_name,
@@ -145,7 +147,9 @@ class JSBackendCommandsGenerator(Generator):
                 'targetTypes': json.dumps(event.target_types),
                 'params': ", ".join(['"%s"' % parameter.parameter_name for parameter in event.event_parameters]),
             }
-            lines.append('InspectorBackend.registerEvent("%(domainName)s.%(eventName)s", %(targetTypes)s, [%(params)s]);' % event_args)
+            event_lines.append('InspectorBackend.registerEvent("%(domainName)s.%(eventName)s", %(targetTypes)s, [%(params)s]);' % event_args)
+
+            lines.append(self.wrap_with_guard_for_condition(event.condition, '\n'.join(event_lines)))
 
         has_async_commands = any([command.is_async for command in commands])
         if len(events) > 0 or has_async_commands:
@@ -160,4 +164,4 @@ class JSBackendCommandsGenerator(Generator):
         }
         lines.append('InspectorBackend.activateDomain("%(domainName)s", %(debuggableTypes)s);' % activate_args)
 
-        return "\n".join(lines)
+        return self.wrap_with_guard_for_condition(domain.condition, "\n".join(lines))
index ed8cc59..ea2fc11 100755 (executable)
@@ -99,7 +99,7 @@ class ObjCBackendDispatcherHeaderGenerator(ObjCGenerator):
             'objcPrefix': self.objc_prefix(),
         }
 
-        return self.wrap_with_guard_for_domain(domain, Template(ObjCTemplates.BackendDispatcherHeaderDomainHandlerObjCDeclaration).substitute(None, **handler_args))
+        return self.wrap_with_guard_for_condition(domain.condition, Template(ObjCTemplates.BackendDispatcherHeaderDomainHandlerObjCDeclaration).substitute(None, **handler_args))
 
     def _generate_objc_handler_declaration_for_command(self, command):
         lines = []
@@ -112,4 +112,4 @@ class ObjCBackendDispatcherHeaderGenerator(ObjCGenerator):
             'parameters': ', '.join(parameters),
         }
         lines.append('    void %(commandName)s(%(parameters)s) final;' % command_args)
-        return '\n'.join(lines)
+        return self.wrap_with_guard_for_condition(command.condition, '\n'.join(lines))
index a1b9e17..f5ee8e5 100755 (executable)
@@ -86,7 +86,7 @@ class ObjCBackendDispatcherImplementationGenerator(ObjCGenerator):
         for command in commands:
             command_declarations.append(self._generate_handler_implementation_for_command(domain, command))
 
-        return '\n'.join(command_declarations)
+        return self.wrap_with_guard_for_condition(domain.condition, '\n\n'.join(command_declarations))
 
     def _generate_handler_implementation_for_command(self, domain, command):
         lines = []
@@ -104,7 +104,7 @@ class ObjCBackendDispatcherImplementationGenerator(ObjCGenerator):
             'invocation': self._generate_invocation_for_command(domain, command),
         }
 
-        return self.wrap_with_guard_for_domain(domain, Template(ObjCTemplates.BackendDispatcherHeaderDomainHandlerImplementation).substitute(None, **command_args))
+        return self.wrap_with_guard_for_condition(command.condition, Template(ObjCTemplates.BackendDispatcherHeaderDomainHandlerImplementation).substitute(None, **command_args))
 
     def _generate_responds_to_selector_for_command(self, domain, command):
         return '[m_delegate respondsToSelector:@selector(%sWithErrorCallback:successCallback:%s)]' % (command.command_name, ''.join(map(lambda parameter: '%s:' % parameter.parameter_name, command.call_parameters)))
index 15fb74b..15bf61d 100755 (executable)
@@ -31,12 +31,12 @@ from string import Template
 
 try:
     from .generator import Generator, ucfirst
-    from .models import ObjectType, EnumType, Platforms
+    from .models import ObjectType, EnumType
     from .objc_generator import ObjCGenerator, join_type_and_name
     from .objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates
 except ValueError:
     from generator import Generator, ucfirst
-    from models import ObjectType, EnumType, Platforms
+    from models import ObjectType, EnumType
     from objc_generator import ObjCGenerator, join_type_and_name
     from objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates
 
@@ -44,7 +44,7 @@ log = logging.getLogger('global')
 
 
 def add_newline(lines):
-    if lines and lines[-1] == '':
+    if not len(lines) or lines[-1] == '':
         return
     lines.append('')
 
@@ -87,7 +87,6 @@ class ObjCHeaderGenerator(ObjCGenerator):
         sections.append(self.generate_license())
         sections.append(Template(ObjCTemplates.HeaderPrelude).substitute(None, **headerPrelude_args))
         sections.append('\n'.join([_f for _f in map(self._generate_forward_declarations, type_domains) if _f]))
-        sections.append(self._generate_enum_for_platforms())
         sections.append('\n'.join([_f for _f in map(self._generate_enums, type_domains) if _f]))
         sections.append('\n'.join([_f for _f in map(self._generate_types, type_domains) if _f]))
 
@@ -103,42 +102,51 @@ class ObjCHeaderGenerator(ObjCGenerator):
         for declaration in self.type_declarations_for_domain(domain):
             if (isinstance(declaration.type, ObjectType)):
                 objc_name = self.objc_name_for_type(declaration.type)
-                lines.append('@class %s;' % objc_name)
-        return '\n'.join(lines)
+                lines.append(self.wrap_with_guard_for_condition(declaration.condition, '@class %s;' % objc_name))
+        return self.wrap_with_guard_for_condition(domain.condition, '\n'.join(lines))
 
     def _generate_enums(self, domain):
         lines = []
 
         # Type enums and member enums.
         for declaration in self.type_declarations_for_domain(domain):
+            declaration_lines = []
             if isinstance(declaration.type, EnumType):
-                add_newline(lines)
-                lines.append(self._generate_anonymous_enum_for_declaration(domain, declaration))
+                add_newline(declaration_lines)
+                declaration_lines.append(self._generate_anonymous_enum_for_declaration(domain, declaration))
             else:
                 for member in declaration.type_members:
                     if isinstance(member.type, EnumType) and member.type.is_anonymous:
-                        add_newline(lines)
-                        lines.append(self._generate_anonymous_enum_for_member(domain, declaration, member))
+                        add_newline(declaration_lines)
+                        declaration_lines.append(self._generate_anonymous_enum_for_member(domain, declaration, member))
+            if len(declaration_lines):
+                lines.append(self.wrap_with_guard_for_condition(declaration.condition, '\n\n'.join(declaration_lines)))
 
         # Anonymous command enums.
         for command in self.commands_for_domain(domain):
+            command_lines = []
             for parameter in command.call_parameters:
                 if isinstance(parameter.type, EnumType) and parameter.type.is_anonymous:
-                    add_newline(lines)
-                    lines.append(self._generate_anonymous_enum_for_parameter(domain, command.command_name, parameter))
+                    add_newline(command_lines)
+                    command_lines.append(self._generate_anonymous_enum_for_parameter(domain, command.command_name, parameter))
             for parameter in command.return_parameters:
                 if isinstance(parameter.type, EnumType) and parameter.type.is_anonymous:
-                    add_newline(lines)
-                    lines.append(self._generate_anonymous_enum_for_parameter(domain, command.command_name, parameter))
+                    add_newline(command_lines)
+                    command_lines.append(self._generate_anonymous_enum_for_parameter(domain, command.command_name, parameter))
+            if len(command_lines):
+                lines.append(self.wrap_with_guard_for_condition(command.condition, '\n\n'.join(command_lines)))
 
         # Anonymous event enums.
         for event in self.events_for_domain(domain):
+            event_lines = []
             for parameter in event.event_parameters:
                 if isinstance(parameter.type, EnumType) and parameter.type.is_anonymous:
-                    add_newline(lines)
-                    lines.append(self._generate_anonymous_enum_for_parameter(domain, event.event_name, parameter))
+                    add_newline(event_lines)
+                    event_lines.append(self._generate_anonymous_enum_for_parameter(domain, event.event_name, parameter))
+            if len(event_lines):
+                lines.append(self.wrap_with_guard_for_condition(event.condition, '\n\n'.join(event_lines)))
 
-        return '\n'.join(lines)
+        return self.wrap_with_guard_for_condition(domain.condition, '\n\n'.join(lines))
 
     def _generate_types(self, domain):
         lines = []
@@ -147,12 +155,7 @@ class ObjCHeaderGenerator(ObjCGenerator):
             if isinstance(declaration.type, ObjectType):
                 add_newline(lines)
                 lines.append(self._generate_type_interface(domain, declaration))
-        return '\n'.join(lines)
-
-    def _generate_enum_for_platforms(self):
-        objc_enum_name = '%sPlatform' % self.objc_prefix()
-        enum_values = [platform.name for platform in Platforms]
-        return self._generate_enum(objc_enum_name, enum_values)
+        return self.wrap_with_guard_for_condition(domain.condition, '\n'.join(lines))
 
     def _generate_anonymous_enum_for_declaration(self, domain, declaration):
         objc_enum_name = self.objc_enum_name_for_anonymous_enum_declaration(declaration)
@@ -194,7 +197,7 @@ class ObjCHeaderGenerator(ObjCGenerator):
         for member in optional_members:
             lines.append('/* optional */ ' + self._generate_member_property(declaration, member))
         lines.append('@end')
-        return '\n'.join(lines)
+        return self.wrap_with_guard_for_condition(declaration.condition, '\n'.join(lines))
 
     def _generate_init_method_for_required_members(self, domain, declaration, required_members):
         pairs = []
@@ -219,7 +222,7 @@ class ObjCHeaderGenerator(ObjCGenerator):
             for command in self.commands_for_domain(domain):
                 lines.append(self._generate_single_command_protocol(domain, command))
             lines.append('@end')
-        return '\n'.join(lines)
+        return self.wrap_with_guard_for_condition(domain.condition, '\n'.join(lines))
 
     def _generate_single_command_protocol(self, domain, command):
         pairs = []
@@ -228,7 +231,7 @@ class ObjCHeaderGenerator(ObjCGenerator):
         for parameter in command.call_parameters:
             param_name = parameter.parameter_name
             pairs.append('%s:(%s)%s' % (param_name, self.objc_type_for_param(domain, command.command_name, parameter), param_name))
-        return '- (void)%sWith%s;' % (command.command_name, ' '.join(pairs))
+        return self.wrap_with_guard_for_condition(command.condition, '- (void)%sWith%s;' % (command.command_name, ' '.join(pairs)))
 
     def _callback_block_for_command(self, domain, command):
         pairs = []
@@ -249,7 +252,7 @@ class ObjCHeaderGenerator(ObjCGenerator):
             for event in events:
                 lines.append(self._generate_single_event_interface(domain, event))
             lines.append('@end')
-        return '\n'.join(lines)
+        return self.wrap_with_guard_for_condition(domain.condition, '\n'.join(lines))
 
     def _generate_single_event_interface(self, domain, event):
         if not event.event_parameters:
@@ -259,4 +262,4 @@ class ObjCHeaderGenerator(ObjCGenerator):
             param_name = parameter.parameter_name
             pairs.append('%s:(%s)%s' % (param_name, self.objc_type_for_param(domain, event.event_name, parameter), param_name))
         pairs[0] = ucfirst(pairs[0])
-        return '- (void)%sWith%s;' % (event.event_name, ' '.join(pairs))
+        return self.wrap_with_guard_for_condition(event.condition, '- (void)%sWith%s;' % (event.event_name, ' '.join(pairs)))
index 2571f4b..5c52cde 100755 (executable)
@@ -31,12 +31,12 @@ from string import Template
 
 try:
     from .generator import Generator
-    from .models import EnumType, Frameworks, Platforms
+    from .models import EnumType, Frameworks
     from .objc_generator import ObjCGenerator
     from .objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates
 except ValueError:
     from generator import Generator
-    from models import EnumType, Frameworks, Platforms
+    from models import EnumType, Frameworks
     from objc_generator import ObjCGenerator
     from objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates
 
@@ -44,7 +44,7 @@ log = logging.getLogger('global')
 
 
 def add_newline(lines):
-    if lines and lines[-1] == '':
+    if not len(lines) or lines[-1] == '':
         return
     lines.append('')
 
@@ -75,7 +75,6 @@ class ObjCProtocolTypeConversionsHeaderGenerator(ObjCGenerator):
         sections.append(self.generate_license())
         sections.append(Template(ObjCTemplates.TypeConversionsHeaderPrelude).substitute(None, **header_args))
         sections.append(Template(ObjCTemplates.TypeConversionsHeaderStandard).substitute(None))
-        sections.append(self._generate_enum_conversion_for_platforms())
         sections.extend(list(map(self._generate_enum_conversion_functions, domains)))
         sections.append(Template(ObjCTemplates.TypeConversionsHeaderPostlude).substitute(None, **header_args))
         return '\n\n'.join(sections)
@@ -85,42 +84,43 @@ class ObjCProtocolTypeConversionsHeaderGenerator(ObjCGenerator):
 
         # Type enums and member enums.
         for declaration in self.type_declarations_for_domain(domain):
+            declaration_lines = []
             if isinstance(declaration.type, EnumType):
-                add_newline(lines)
-                lines.append(self._generate_anonymous_enum_conversion_for_declaration(domain, declaration))
+                add_newline(declaration_lines)
+                declaration_lines.append(self._generate_anonymous_enum_conversion_for_declaration(domain, declaration))
             else:
                 for member in declaration.type_members:
                     if (isinstance(member.type, EnumType) and member.type.is_anonymous):
-                        add_newline(lines)
-                        lines.append(self._generate_anonymous_enum_conversion_for_member(domain, declaration, member))
+                        add_newline(declaration_lines)
+                        declaration_lines.append(self._generate_anonymous_enum_conversion_for_member(domain, declaration, member))
+            if len(declaration_lines):
+                lines.append(self.wrap_with_guard_for_condition(declaration.condition, '\n\n'.join(declaration_lines)))
 
         # Anonymous command enums.
         for command in self.commands_for_domain(domain):
+            command_lines = []
             for parameter in command.call_parameters:
                 if (isinstance(parameter.type, EnumType) and parameter.type.is_anonymous):
-                    add_newline(lines)
-                    lines.append(self._generate_anonymous_enum_conversion_for_parameter(domain, command.command_name, parameter))
+                    add_newline(command_lines)
+                    command_lines.append(self._generate_anonymous_enum_conversion_for_parameter(domain, command.command_name, parameter))
             for parameter in command.return_parameters:
                 if (isinstance(parameter.type, EnumType) and parameter.type.is_anonymous):
-                    add_newline(lines)
-                    lines.append(self._generate_anonymous_enum_conversion_for_parameter(domain, command.command_name, parameter))
+                    add_newline(command_lines)
+                    command_lines.append(self._generate_anonymous_enum_conversion_for_parameter(domain, command.command_name, parameter))
+            if len(command_lines):
+                lines.append(self.wrap_with_guard_for_condition(command.condition, '\n\n'.join(command_lines)))
 
         # Anonymous event enums.
         for event in self.events_for_domain(domain):
+            event_lines = []
             for parameter in event.event_parameters:
                 if (isinstance(parameter.type, EnumType) and parameter.type.is_anonymous):
-                    add_newline(lines)
-                    lines.append(self._generate_anonymous_enum_conversion_for_parameter(domain, event.event_name, parameter))
+                    add_newline(event_lines)
+                    event_lines.append(self._generate_anonymous_enum_conversion_for_parameter(domain, event.event_name, parameter))
+            if len(event_lines):
+                lines.append(self.wrap_with_guard_for_condition(event.condition, '\n\n'.join(event_lines)))
 
-        return '\n'.join(lines)
-
-    def _generate_enum_conversion_for_platforms(self):
-        objc_enum_name = '%sPlatform' % self.objc_prefix()
-        enum_values = [platform.name for platform in Platforms]
-        lines = []
-        lines.append(self._generate_enum_objc_to_protocol_string(objc_enum_name, enum_values))
-        lines.append(self._generate_enum_from_protocol_string(objc_enum_name, enum_values))
-        return '\n\n'.join(lines)
+        return self.wrap_with_guard_for_condition(domain.condition, '\n\n'.join(lines))
 
     def _generate_anonymous_enum_conversion_for_declaration(self, domain, declaration):
         objc_enum_name = self.objc_enum_name_for_anonymous_enum_declaration(declaration)
index a36d813..8c10770 100644 (file)
@@ -43,7 +43,7 @@ log = logging.getLogger('global')
 
 
 def add_newline(lines):
-    if lines and lines[-1] == '':
+    if not len(lines) or lines[-1] == '':
         return
     lines.append('')
 
@@ -83,15 +83,16 @@ class ObjCProtocolTypeConversionsImplementationGenerator(ObjCGenerator):
     def _generate_type_factory_category_interface(self, domains):
         lines = []
         for domain in domains:
-            lines.append('@interface %sTypeConversions (%sDomain)' % (self.protocol_name(), domain.domain_name))
-            lines.append('')
+            domain_lines = []
+            domain_lines.append('@interface %sTypeConversions (%sDomain)' % (self.protocol_name(), domain.domain_name))
+            add_newline(domain_lines)
 
             for declaration in self.type_declarations_for_domain(domain):
-                lines.append(self._generate_type_factory_method_declaration(domain, declaration))
-
-            add_newline(lines)
-            lines.append('@end')
+                domain_lines.append(self._generate_type_factory_method_declaration(domain, declaration))
 
+            add_newline(domain_lines)
+            domain_lines.append('@end')
+            lines.append(self.wrap_with_guard_for_condition(domain.condition, '\n'.join(domain_lines)))
         return '\n'.join(lines)
 
     def _generate_type_factory_method_declaration(self, domain, declaration):
@@ -100,20 +101,23 @@ class ObjCProtocolTypeConversionsImplementationGenerator(ObjCGenerator):
             resolved_type = resolved_type.aliased_type
         if isinstance(resolved_type, (ObjectType, ArrayType, PrimitiveType)):
             objc_type = self.objc_class_for_type(resolved_type)
-            return '+ (void)_parse%s:(%s **)outValue fromPayload:(id)payload;' % (declaration.type.raw_name(), objc_type)
+            return self.wrap_with_guard_for_condition(declaration.condition, '+ (void)_parse%s:(%s **)outValue fromPayload:(id)payload;' % (declaration.type.raw_name(), objc_type))
         if isinstance(resolved_type, EnumType):
-            return '+ (void)_parse%s:(NSNumber **)outValue fromPayload:(id)payload;' % declaration.type.raw_name()
+            return self.wrap_with_guard_for_condition(declaration.condition, '+ (void)_parse%s:(NSNumber **)outValue fromPayload:(id)payload;' % declaration.type.raw_name())
 
     def _generate_type_factory_category_implementation(self, domains):
         lines = []
         for domain in domains:
-            lines.append('@implementation %sTypeConversions (%sDomain)' % (self.protocol_name(), domain.domain_name))
-            lines.append('')
+            domain_lines = []
+            domain_lines.append('@implementation %sTypeConversions (%sDomain)' % (self.protocol_name(), domain.domain_name))
+            add_newline(domain_lines)
 
             for declaration in self.type_declarations_for_domain(domain):
-                lines.append(self._generate_type_factory_method_implementation(domain, declaration))
-                add_newline(lines)
-            lines.append('@end')
+                domain_lines.append(self._generate_type_factory_method_implementation(domain, declaration))
+                add_newline(domain_lines)
+
+            domain_lines.append('@end')
+            lines.append(self.wrap_with_guard_for_condition(domain.condition, '\n'.join(domain_lines)))
         return '\n'.join(lines)
 
     def _generate_type_factory_method_implementation(self, domain, declaration):
@@ -141,4 +145,4 @@ class ObjCProtocolTypeConversionsImplementationGenerator(ObjCGenerator):
             lines.append('    THROW_EXCEPTION_FOR_BAD_TYPE(payload, [NSDictionary class]);')
             lines.append('    *outValue = [[%s alloc] initWithPayload:payload];' % (objc_class))
         lines.append('}')
-        return '\n'.join(lines)
+        return self.wrap_with_guard_for_condition(declaration.condition, '\n'.join(lines))
index c870881..a0e7b90 100755 (executable)
@@ -44,7 +44,7 @@ log = logging.getLogger('global')
 
 
 def add_newline(lines):
-    if lines and lines[-1] == '':
+    if not len(lines) or lines[-1] == '':
         return
     lines.append('')
 
@@ -91,7 +91,7 @@ class ObjCProtocolTypesImplementationGenerator(ObjCGenerator):
             if (isinstance(declaration.type, ObjectType)):
                 add_newline(lines)
                 lines.append(self.generate_type_implementation(domain, declaration))
-        return '\n'.join(lines)
+        return self.wrap_with_guard_for_condition(domain.condition, '\n'.join(lines))
 
     def generate_type_implementation(self, domain, declaration):
         lines = []
@@ -112,7 +112,7 @@ class ObjCProtocolTypesImplementationGenerator(ObjCGenerator):
             lines.append(self._generate_getter_for_member(domain, declaration, member))
         lines.append('')
         lines.append('@end')
-        return '\n'.join(lines)
+        return self.wrap_with_guard_for_condition(declaration.condition, '\n'.join(lines))
 
     def _generate_init_method_for_protocol_object(self, domain, declaration):
         lines = []
index 8c2fbb8..94d18d9 100755 (executable)
@@ -31,10 +31,10 @@ from string import Template
 
 try:
     from .generator_templates import GeneratorTemplates as Templates
-    from .models import PrimitiveType, ObjectType, ArrayType, EnumType, AliasedType, Frameworks, Platforms
+    from .models import PrimitiveType, ObjectType, ArrayType, EnumType, AliasedType, Frameworks
 except ValueError:
     from generator_templates import GeneratorTemplates as Templates
-    from models import PrimitiveType, ObjectType, ArrayType, EnumType, AliasedType, Frameworks, Platforms
+    from models import PrimitiveType, ObjectType, ArrayType, EnumType, AliasedType, Frameworks
 
 log = logging.getLogger('global')
 
@@ -94,35 +94,28 @@ _TYPES_WITH_OPEN_FIELDS = {
 }
 
 class Generator:
-    def __init__(self, model, platform, input_filepath):
+    def __init__(self, model, input_filepath):
         self._model = model
-        self._platform = platform
         self._input_filepath = input_filepath
         self._settings = {}
 
     def model(self):
         return self._model
 
-    def platform(self):
-        return self._platform
-
     def set_generator_setting(self, key, value):
         self._settings[key] = value
 
-    def can_generate_platform(self, model_platform):
-        return model_platform is Platforms.Generic or self._platform is Platforms.All or model_platform is self._platform
-
     def version_for_domain(self, domain):
         return domain.version()
 
     def type_declarations_for_domain(self, domain):
-        return [type_declaration for type_declaration in domain.all_type_declarations() if self.can_generate_platform(type_declaration.platform)]
+        return domain.all_type_declarations()
 
     def commands_for_domain(self, domain):
-        return [command for command in domain.all_commands() if self.can_generate_platform(command.platform)]
+        return domain.all_commands()
 
     def events_for_domain(self, domain):
-        return [event for event in domain.all_events() if self.can_generate_platform(event.platform)]
+        return domain.all_events()
 
     # The goofy name is to disambiguate generator settings from framework settings.
     def get_generator_setting(self, key, default=None):
@@ -267,23 +260,16 @@ class Generator:
         self._assigned_enum_values.append(enum_value)
 
     # Miscellaneous text manipulation routines.
-    def wrap_with_guard_for_domain(self, domain, text):
-        if self.model().framework is Frameworks.WebInspector:
-            return text
-        guard = domain.feature_guard
-        if guard:
-            return Generator.wrap_with_guard(guard, text)
+    def wrap_with_guard_for_condition(self, condition, text):
+        if condition:
+            return '\n'.join([
+                '#if %s' % condition,
+                text,
+                '#endif // %s' % condition,
+            ])
         return text
 
     @staticmethod
-    def wrap_with_guard(guard, text):
-        return '\n'.join([
-            '#if %s' % guard,
-            text,
-            '#endif // %s' % guard,
-        ])
-
-    @staticmethod
     def stylized_name_for_enum_value(enum_value):
         regex = '(%s)' % "|".join(_ALWAYS_SPECIALCASED_ENUM_VALUE_SUBSTRINGS)
 
index 891681f..847a92d 100644 (file)
@@ -57,5 +57,4 @@ class GeneratorTemplates:
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from ${inputFilename}
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py""")
+// DO NOT EDIT THIS FILE. It is automatically generated from ${inputFilename} by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py""")
index 6d97a09..1df2bdf 100755 (executable)
@@ -136,41 +136,6 @@ class Frameworks:
     Test = Framework("Test")
 
 
-class Platform:
-    def __init__(self, name):
-        self.name = name
-
-    @staticmethod
-    def fromString(platformString):
-        platformString = platformString.lower()
-        if platformString == "ios":
-            return Platforms.iOS
-
-        if platformString == "macos":
-            return Platforms.macOS
-
-        if platformString == "all":
-            return Platforms.All
-
-        if platformString == "generic" or not platformString:
-            return Platforms.Generic
-
-        raise ParseException("Unknown platform: %s" % platformString)
-
-
-class Platforms:
-    All = Platform("all")
-    Generic = Platform("generic")
-    iOS = Platform("ios")
-    macOS = Platform("macos")
-
-    # Allow iteration over all platforms. See <http://stackoverflow.com/questions/5434400/>.
-    class __metaclass__(type):
-        def __iter__(self):
-            for attr in dir(Platforms):
-                if not attr.startswith("__"):
-                    yield getattr(Platforms, attr)
-
 class TypeReference:
     def __init__(self, type_kind, referenced_type_name, enum_values, array_items):
         self.type_kind = type_kind
@@ -439,7 +404,7 @@ class Protocol:
                 raise ParseException("Malformed domain specification: events is not an array")
             events.extend([self.parse_event(event, debuggable_types) for event in json['events']])
 
-        self.domains.append(Domain(json['domain'], json.get('description', ''), json.get('featureGuard'), debuggable_types, target_types, isSupplemental, version, types, commands, events))
+        self.domains.append(Domain(json['domain'], json.get('description', ''), json.get('condition'), debuggable_types, target_types, isSupplemental, version, types, commands, events))
 
     def parse_type_declaration(self, json):
         check_for_required_properties(['id', 'type'], json, "type")
@@ -457,8 +422,7 @@ class Protocol:
             raise ParseException("Malformed domain specification: type declaration for %s has duplicate member names" % json['id'])
 
         type_ref = TypeReference(json['type'], json.get('$ref'), json.get('enum'), json.get('items'))
-        platform = Platform.fromString(json.get('platform', 'generic'))
-        return TypeDeclaration(json['id'], type_ref, json.get("description", ""), platform, type_members)
+        return TypeDeclaration(json['id'], type_ref, json.get("description", ""), json.get('condition'), type_members)
 
     def parse_type_member(self, json):
         check_for_required_properties(['name'], json, "type member")
@@ -509,8 +473,7 @@ class Protocol:
             if len(duplicate_names) > 0:
                 raise ParseException("Malformed domain specification: return parameter list for command %s has duplicate parameter names" % json['name'])
 
-        platform = Platform.fromString(json.get('platform', 'generic'))
-        return Command(json['name'], target_types, call_parameters, return_parameters, json.get('description', ""), platform, json.get('async', False))
+        return Command(json['name'], target_types, call_parameters, return_parameters, json.get('description', ""), json.get('condition'), json.get('async', False))
 
     def parse_event(self, json, debuggable_types):
         check_for_required_properties(['name'], json, "event")
@@ -544,8 +507,7 @@ class Protocol:
             if len(duplicate_names) > 0:
                 raise ParseException("Malformed domain specification: parameter list for event %s has duplicate parameter names" % json['name'])
 
-        platform = Platform.fromString(json.get('platform', 'generic'))
-        return Event(json['name'], target_types, event_parameters, json.get('description', ""), platform)
+        return Event(json['name'], target_types, event_parameters, json.get('description', ""), json.get('condition'))
 
     def parse_call_or_return_parameter(self, json):
         check_for_required_properties(['name'], json, "parameter")
@@ -643,10 +605,10 @@ class Protocol:
 
 
 class Domain:
-    def __init__(self, domain_name, description, feature_guard, debuggable_types, target_types, isSupplemental, version, type_declarations, commands, events):
+    def __init__(self, domain_name, description, condition, debuggable_types, target_types, isSupplemental, version, type_declarations, commands, events):
         self.domain_name = domain_name
         self.description = description
-        self.feature_guard = feature_guard
+        self.condition = condition
         self.debuggable_types = debuggable_types
         self.target_types = target_types
         self.is_supplemental = isSupplemental
@@ -686,11 +648,11 @@ class Domains:
 
 
 class TypeDeclaration:
-    def __init__(self, type_name, type_ref, description, platform, type_members):
+    def __init__(self, type_name, type_ref, description, condition, type_members):
         self.type_name = type_name
         self.type_ref = type_ref
         self.description = description
-        self.platform = platform
+        self.condition = condition
         self.type_members = type_members
 
         if self.type_name != ucfirst(self.type_name):
@@ -734,13 +696,13 @@ class Parameter:
 
 
 class Command:
-    def __init__(self, command_name, target_types, call_parameters, return_parameters, description, platform, is_async):
+    def __init__(self, command_name, target_types, call_parameters, return_parameters, description, condition, is_async):
         self.command_name = command_name
         self.target_types = target_types
         self.call_parameters = call_parameters
         self.return_parameters = return_parameters
         self.description = description
-        self.platform = platform
+        self.condition = condition
         self.is_async = is_async
 
     def resolve_type_references(self, protocol, domain):
@@ -754,12 +716,12 @@ class Command:
 
 
 class Event:
-    def __init__(self, event_name, target_types, event_parameters, description, platform):
+    def __init__(self, event_name, target_types, event_parameters, description, condition):
         self.event_name = event_name
         self.target_types = target_types
         self.event_parameters = event_parameters
         self.description = description
-        self.platform = platform
+        self.condition = condition
 
     def resolve_type_references(self, protocol, domain):
         log.debug(">> Resolving type references for parameters in event: %s" % self.event_name)
index 2274215..421cb1b 100755 (executable)
@@ -127,8 +127,7 @@ private:
 ${successCallback}
 ${conversions}
 ${invocation}
-}
-""")
+}""")
 
     ConfigurationCommandProperty = (
     """@property (nonatomic, retain, setter=set${domainName}Handler:) id<${objcPrefix}${domainName}DomainHandler> ${variableNamePrefix}Handler;""")
diff --git a/Source/JavaScriptCore/inspector/scripts/codegen/preprocess.pl b/Source/JavaScriptCore/inspector/scripts/codegen/preprocess.pl
new file mode 100644 (file)
index 0000000..0b08d2a
--- /dev/null
@@ -0,0 +1,115 @@
+#! /usr/bin/env perl
+#
+#   This file is part of the WebKit project
+#
+#   Copyright (C) 2020 Apple Inc. All rights reserved.
+#
+#   This library is free software; you can redistribute it and/or
+#   modify it under the terms of the GNU Library General Public
+#   License as published by the Free Software Foundation; either
+#   version 2 of the License, or (at your option) any later version.
+#
+#   This library is distributed in the hope that it will be useful,
+#   but WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#   Library General Public License for more details.
+#
+#   You should have received a copy of the GNU Library General Public License
+#   along with this library; see the file COPYING.LIB.  If not, write to
+#   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+#   Boston, MA 02110-1301, USA.
+
+use strict;
+use warnings;
+
+use Config;
+use Getopt::Long;
+use IPC::Open2;
+use IPC::Open3;
+use Text::ParseWords;
+
+my $inputPath;
+my $defines;
+my $preprocessor;
+my $outputPath;
+GetOptions('input=s' => \$inputPath,
+           'defines=s' => \$defines,
+           'preprocessor=s' => \$preprocessor,
+           'output=s' => \$outputPath);
+
+my @args = ();
+if (!$preprocessor) {
+    if ($Config::Config{"osname"} eq "MSWin32") {
+        $preprocessor = $ENV{CC} || "cl";
+        push(@args, qw(/nologo /EP /TP /C));
+    } else {
+        $preprocessor = $ENV{CC} || (-x "/usr/bin/clang" ? "/usr/bin/clang" : "/usr/bin/gcc");
+        push(@args, qw(-E -P -x c++ -C));
+    }
+}
+
+if ($Config::Config{"osname"} eq "darwin") {
+    push(@args, "-I" . $ENV{BUILT_PRODUCTS_DIR} . "/usr/local/include") if $ENV{BUILT_PRODUCTS_DIR};
+    push(@args, "-isysroot", $ENV{SDKROOT}) if $ENV{SDKROOT};
+}
+
+# Remove double quotations from $defines and extract macros.
+# For example, if $defines is ' "A=1" "B=1" C=1 ""    D  ',
+# then it is converted into four macros -DA=1, -DB=1, -DC=1 and -DD.
+$defines =~ s/\"//g;
+my @macros = grep { $_ } split(/\s+/, $defines); # grep skips empty macros.
+@macros = map { "-D$_" } @macros;
+
+my $pid = 0;
+if ($Config{osname} eq "cygwin") {
+    $ENV{PATH} = "$ENV{PATH}:/cygdrive/c/cygwin/bin";
+    my @preprocessorAndFlags;
+    if ($preprocessor eq "/usr/bin/gcc") {
+        @preprocessorAndFlags = split(' ', $preprocessor);
+    } else {
+        $preprocessor =~ /"(.*)"/;
+        chomp(my $preprocessor = `cygpath -u '$1'`) if (defined $1);
+        chomp($inputPath = `cygpath -w '$inputPath'`);
+        @preprocessorAndFlags = ($preprocessor, "/nologo", "/EP", "/TP", "/C");
+    }
+
+    # This call can fail if Windows rebases cygwin, so retry a few times until it succeeds.
+    for (my $tries = 0; !$pid && ($tries < 20); $tries++) {
+        eval {
+            # Suppress STDERR so that if we're using cl.exe, the output
+            # name isn't needlessly echoed.
+            use Symbol 'gensym'; my $err = gensym;
+            $pid = open3(\*PP_IN, \*PP_OUT, $err, @preprocessorAndFlags, @args, @macros, $inputPath);
+            1;
+        } or do {
+            sleep 1;
+        }
+    }
+} elsif ($Config::Config{"osname"} eq "MSWin32") {
+    # Suppress STDERR so that if we're using cl.exe, the output
+    # name isn't needlessly echoed.
+    use Symbol 'gensym'; my $err = gensym;
+    $pid = open3(\*PP_IN, \*PP_OUT, $err, $preprocessor, @args, @macros, $inputPath);
+} else {
+    $pid = open2(\*PP_OUT, \*PP_IN, shellwords($preprocessor), @args, @macros, $inputPath);
+}
+close PP_IN;
+my @lines = <PP_OUT>;
+close PP_OUT;
+waitpid($pid, 0);
+
+open OUTPUT, ">$outputPath" || die "Could not open $outputPath for writing";
+foreach my $line (@lines) {
+    # Ignore whitespace lines.
+    if ($line =~ /^\s*$/) {
+        next;
+    }
+
+    # Add newlines before comments.
+    if ($line =~ /^\/\//) {
+        print OUTPUT "\n";
+    }
+
+    print OUTPUT $line;
+}
+close OUTPUT;
index 2b1d878..8cef009 100755 (executable)
@@ -117,7 +117,6 @@ def generate_from_specification(primary_specification_filepath=None,
                                 output_dirpath=None,
                                 force_output=False,
                                 framework_name="",
-                                platform_name="",
                                 generate_frontend=True,
                                 generate_backend=True):
 
@@ -130,7 +129,6 @@ def generate_from_specification(primary_specification_filepath=None,
         except ValueError as e:
             raise Exception("Error parsing valid JSON in file: " + filepath + "\nParse error: " + str(e))
 
-    platform = Platform.fromString(platform_name)
     protocol = models.Protocol(framework_name)
     for specification in supplemental_specification_filepaths:
         load_specification(protocol, specification, isSupplemental=True)
@@ -138,7 +136,7 @@ def generate_from_specification(primary_specification_filepath=None,
 
     protocol.resolve_types()
 
-    generator_arguments = [protocol, platform, primary_specification_filepath]
+    generator_arguments = [protocol, primary_specification_filepath]
     generators = []
 
     if protocol.framework is Frameworks.Test:
@@ -162,7 +160,6 @@ def generate_from_specification(primary_specification_filepath=None,
         generators.append(ObjCProtocolTypesImplementationGenerator(*generator_arguments))
 
     elif protocol.framework is Frameworks.JavaScriptCore:
-        generators.append(JSBackendCommandsGenerator(*generator_arguments))
         generators.append(CppAlternateBackendDispatcherHeaderGenerator(*generator_arguments))
         generators.append(CppBackendDispatcherHeaderGenerator(*generator_arguments))
         generators.append(CppBackendDispatcherImplementationGenerator(*generator_arguments))
@@ -229,7 +226,6 @@ def generate_from_specification(primary_specification_filepath=None,
 
 if __name__ == '__main__':
     allowed_framework_names = ['JavaScriptCore', 'WebInspector', 'WebInspectorUI', 'WebKit', 'Test']
-    allowed_platform_names = ['iOS', 'macOS', 'all', 'generic']
     cli_parser = optparse.OptionParser(usage="usage: %prog [options] PrimaryProtocol.json [SupplementalProtocol.json ...]")
     cli_parser.add_option("-o", "--outputDir", help="Directory where generated files should be written.")
     cli_parser.add_option("--framework", type="choice", choices=allowed_framework_names, help="The framework that the primary specification belongs to.")
@@ -238,7 +234,6 @@ if __name__ == '__main__':
     cli_parser.add_option("-t", "--test", action="store_true", help="Enable test mode. Use unique output filenames created by prepending the input filename.")
     cli_parser.add_option("--frontend", action="store_true", help="Generate code for the frontend-side of the protocol only.")
     cli_parser.add_option("--backend", action="store_true", help="Generate code for the backend-side of the protocol only.")
-    cli_parser.add_option("--platform", default="generic", help="The platform of the backend being generated. For example, we compile WebKit2 for either macOS or iOS. This value is case-insensitive. Allowed values: %s" % ", ".join(allowed_platform_names))
     options = None
 
     arg_options, arg_values = cli_parser.parse_args()
@@ -264,7 +259,6 @@ if __name__ == '__main__':
         'output_dirpath': arg_options.outputDir,
         'concatenate_output': arg_options.test,
         'framework_name': arg_options.framework,
-        'platform_name': arg_options.platform,
         'force_output': arg_options.force,
         'generate_backend': generate_backend,
         'generate_frontend': generate_frontend,
@@ -4,7 +4,7 @@
         {
             "id": "NetworkError",
             "type": "object",
-            "platform": "macos",
+            "condition": "PLATFORM(MAC)",
             "properties": [
                 { "name": "message", "type": "string", "description": "Error message." },
                 { "name": "code", "type": "integer", "description": "Error code." }
     "commands": [
         {
             "name": "loadResource",
-            "platform": "macos",
+            "condition": "PLATFORM(MAC)",
             "description": "Loads a resource in the context of a frame on the inspected page without cross origin checks."
         }
     ],
     "events": [
         {
             "name": "resourceLoaded",
-            "platform": "macos",
+            "condition": "PLATFORM(MAC)",
             "description": "A resource was loaded."
         }
     ]
@@ -1,4 +1,4 @@
-### Begin File: InspectorBackendCommands.js
+### Begin File: InspectorBackendCommands.js.in
 /*
  * Copyright (C) 2013 Google Inc. All rights reserved.
  * Copyright (C) 2013-2016 Apple Inc. All rights reserved.
@@ -26,8 +26,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from command-targetType-matching-domain-debuggableType.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from command-targetType-matching-domain-debuggableType.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 // Domain
 InspectorBackend.registerDomain("Domain", ["page", "worker"]);
@@ -35,7 +34,7 @@ InspectorBackend.registerCommand("Domain.Command", null, [], []);
 InspectorBackend.registerEvent("Domain.Event", null, []);
 InspectorBackend.registerDomainDispatcher = InspectorBackend.registerDispatcher.bind(InspectorBackend, "Domain");
 InspectorBackend.activateDomain("Domain", ["page"]);
-### End File: InspectorBackendCommands.js
+### End File: InspectorBackendCommands.js.in
 
 ### Begin File: TestAlternateBackendDispatchers.h
 /*
@@ -65,8 +64,7 @@ InspectorBackend.activateDomain("Domain", ["page"]);
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from command-targetType-matching-domain-debuggableType.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from command-targetType-matching-domain-debuggableType.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #pragma once
 
@@ -126,8 +124,7 @@ public:
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from command-targetType-matching-domain-debuggableType.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from command-targetType-matching-domain-debuggableType.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #pragma once
 
@@ -161,7 +158,7 @@ public:
     void setAlternateDispatcher(AlternateDomainBackendDispatcher* alternateDispatcher) { m_alternateDispatcher = alternateDispatcher; }
 private:
     AlternateDomainBackendDispatcher* m_alternateDispatcher { nullptr };
-#endif
+#endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
 private:
     DomainBackendDispatcher(BackendDispatcher&, DomainBackendDispatcherHandler*);
     DomainBackendDispatcherHandler* m_agent { nullptr };
@@ -198,8 +195,7 @@ private:
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from command-targetType-matching-domain-debuggableType.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from command-targetType-matching-domain-debuggableType.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #include "config.h"
 #include "TestBackendDispatchers.h"
@@ -211,7 +207,7 @@ private:
 
 #if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
 #include "TestAlternateBackendDispatchers.h"
-#endif
+#endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
 
 namespace Inspector {
 
@@ -236,10 +232,12 @@ void DomainBackendDispatcher::dispatch(long requestId, const String& method, Ref
     RefPtr<JSON::Object> parameters;
     message->getObject("params"_s, parameters);
 
-    if (method == "Command")
+    if (method == "Command") {
         Command(requestId, WTFMove(parameters));
-    else
-        m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, "'Domain." + method + "' was not found");
+        return;
+    }
+
+    m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, "'Domain." + method + "' was not found");
 }
 
 void DomainBackendDispatcher::Command(long requestId, RefPtr<JSON::Object>&&)
@@ -249,7 +247,7 @@ void DomainBackendDispatcher::Command(long requestId, RefPtr<JSON::Object>&&)
         m_alternateDispatcher->Command(requestId);
         return;
     }
-#endif
+#endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
 
     ErrorString error;
     Ref<JSON::Object> result = JSON::Object::create();
@@ -293,8 +291,7 @@ void DomainBackendDispatcher::Command(long requestId, RefPtr<JSON::Object>&&)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from command-targetType-matching-domain-debuggableType.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from command-targetType-matching-domain-debuggableType.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #pragma once
 
@@ -346,8 +343,7 @@ private:
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from command-targetType-matching-domain-debuggableType.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from command-targetType-matching-domain-debuggableType.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #include "config.h"
 #include "TestFrontendDispatchers.h"
@@ -397,8 +393,7 @@ void DomainFrontendDispatcher::Event()
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from command-targetType-matching-domain-debuggableType.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from command-targetType-matching-domain-debuggableType.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #pragma once
 
@@ -452,8 +447,7 @@ namespace Protocol {
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from command-targetType-matching-domain-debuggableType.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from command-targetType-matching-domain-debuggableType.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #include "config.h"
 #include "TestProtocolObjects.h"
@@ -501,8 +495,7 @@ namespace Protocol {
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from command-targetType-matching-domain-debuggableType.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from command-targetType-matching-domain-debuggableType.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #include <JavaScriptCore/InspectorAlternateBackendDispatchers.h>
 #include <wtf/RetainPtr.h>
@@ -553,8 +546,7 @@ private:
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from command-targetType-matching-domain-debuggableType.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from command-targetType-matching-domain-debuggableType.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import "config.h"
 #import "TestProtocolBackendDispatchers.h"
@@ -585,7 +577,6 @@ void ObjCInspectorDomainBackendDispatcher::Command(long requestId)
     [m_delegate CommandWithErrorCallback:errorCallback successCallback:successCallback];
 }
 
-
 } // namespace Inspector
 
 ### End File: TestProtocolBackendDispatchers.mm
@@ -618,8 +609,7 @@ void ObjCInspectorDomainBackendDispatcher::Command(long requestId)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from command-targetType-matching-domain-debuggableType.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from command-targetType-matching-domain-debuggableType.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import <WebInspector/TestProtocol.h>
 
@@ -660,8 +650,7 @@ __attribute__((visibility ("default")))
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from command-targetType-matching-domain-debuggableType.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from command-targetType-matching-domain-debuggableType.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import "TestProtocolConfiguration.h"
 
@@ -756,8 +745,7 @@ using namespace Inspector;
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from command-targetType-matching-domain-debuggableType.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from command-targetType-matching-domain-debuggableType.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import "TestProtocolInternal.h"
 
@@ -823,8 +811,7 @@ using namespace Inspector;
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from command-targetType-matching-domain-debuggableType.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from command-targetType-matching-domain-debuggableType.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import <Foundation/Foundation.h>
 
@@ -833,13 +820,6 @@ using namespace Inspector;
 
 
 
-typedef NS_ENUM(NSInteger, TestProtocolPlatform) {
-    TestProtocolPlatformAll,
-    TestProtocolPlatformGeneric,
-    TestProtocolPlatformIOS,
-    TestProtocolPlatformMacOS,
-};
-
 
 
 
@@ -887,8 +867,7 @@ __attribute__((visibility ("default")))
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from command-targetType-matching-domain-debuggableType.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from command-targetType-matching-domain-debuggableType.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import "TestProtocol.h"
 #import "TestProtocolJSONObjectPrivate.h"
@@ -930,8 +909,7 @@ __attribute__((visibility ("default")))
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from command-targetType-matching-domain-debuggableType.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from command-targetType-matching-domain-debuggableType.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import "TestProtocol.h"
 #import <WebInspector/RWIProtocolArrayConversions.h>
@@ -941,34 +919,6 @@ namespace Inspector {
 template<typename ObjCEnumType>
 Optional<ObjCEnumType> fromProtocolString(const String& value);
 
-inline String toProtocolString(TestProtocolPlatform value)
-{
-    switch(value) {
-    case TestProtocolPlatformAll:
-        return "all"_s;
-    case TestProtocolPlatformGeneric:
-        return "generic"_s;
-    case TestProtocolPlatformIOS:
-        return "ios"_s;
-    case TestProtocolPlatformMacOS:
-        return "macos"_s;
-    }
-}
-
-template<>
-inline Optional<TestProtocolPlatform> fromProtocolString(const String& value)
-{
-    if (value == "all")
-        return TestProtocolPlatformAll;
-    if (value == "generic")
-        return TestProtocolPlatformGeneric;
-    if (value == "ios")
-        return TestProtocolPlatformIOS;
-    if (value == "macos")
-        return TestProtocolPlatformMacOS;
-    return WTF::nullopt;
-}
-
 } // namespace Inspector
 
 ### End File: TestProtocolTypeConversions.h
@@ -1001,8 +951,7 @@ inline Optional<TestProtocolPlatform> fromProtocolString(const String& value)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from command-targetType-matching-domain-debuggableType.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from command-targetType-matching-domain-debuggableType.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import "TestProtocolTypeConversions.h"
 
@@ -1047,8 +996,7 @@ using namespace Inspector;
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from command-targetType-matching-domain-debuggableType.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from command-targetType-matching-domain-debuggableType.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import "TestProtocolInternal.h"
 
@@ -1,4 +1,4 @@
-### Begin File: InspectorBackendCommands.js
+### Begin File: InspectorBackendCommands.js.in
 /*
  * Copyright (C) 2013 Google Inc. All rights reserved.
  * Copyright (C) 2013-2016 Apple Inc. All rights reserved.
@@ -26,8 +26,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 // Database
 InspectorBackend.registerDomain("Database", null);
@@ -38,7 +37,7 @@ InspectorBackend.registerCommand("Database.executeSQLSync", null, [{"name": "dat
 InspectorBackend.registerCommand("Database.executeSQLAsync", null, [{"name": "databaseId", "type": "number"}, {"name": "query", "type": "string"}], ["columnNames", "notes", "timestamp", "values", "payload", "databaseId", "sqlError", "screenColor", "alternateColors", "printColor"]);
 InspectorBackend.registerDatabaseDispatcher = InspectorBackend.registerDispatcher.bind(InspectorBackend, "Database");
 InspectorBackend.activateDomain("Database", null);
-### End File: InspectorBackendCommands.js
+### End File: InspectorBackendCommands.js.in
 
 ### Begin File: TestAlternateBackendDispatchers.h
 /*
@@ -68,8 +67,7 @@ InspectorBackend.activateDomain("Database", null);
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #pragma once
 
@@ -132,8 +130,7 @@ public:
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #pragma once
 
@@ -190,7 +187,7 @@ public:
     void setAlternateDispatcher(AlternateDatabaseBackendDispatcher* alternateDispatcher) { m_alternateDispatcher = alternateDispatcher; }
 private:
     AlternateDatabaseBackendDispatcher* m_alternateDispatcher { nullptr };
-#endif
+#endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
 private:
     DatabaseBackendDispatcher(BackendDispatcher&, DatabaseBackendDispatcherHandler*);
     DatabaseBackendDispatcherHandler* m_agent { nullptr };
@@ -227,8 +224,7 @@ private:
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #include "config.h"
 #include "TestBackendDispatchers.h"
@@ -240,7 +236,7 @@ private:
 
 #if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
 #include "TestAlternateBackendDispatchers.h"
-#endif
+#endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
 
 namespace Inspector {
 
@@ -265,16 +261,24 @@ void DatabaseBackendDispatcher::dispatch(long requestId, const String& method, R
     RefPtr<JSON::Object> parameters;
     message->getObject("params"_s, parameters);
 
-    if (method == "executeSQLSyncOptionalReturnValues")
+    if (method == "executeSQLSyncOptionalReturnValues") {
         executeSQLSyncOptionalReturnValues(requestId, WTFMove(parameters));
-    else if (method == "executeSQLAsyncOptionalReturnValues")
+        return;
+    }
+    if (method == "executeSQLAsyncOptionalReturnValues") {
         executeSQLAsyncOptionalReturnValues(requestId, WTFMove(parameters));
-    else if (method == "executeSQLSync")
+        return;
+    }
+    if (method == "executeSQLSync") {
         executeSQLSync(requestId, WTFMove(parameters));
-    else if (method == "executeSQLAsync")
+        return;
+    }
+    if (method == "executeSQLAsync") {
         executeSQLAsync(requestId, WTFMove(parameters));
-    else
-        m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, "'Database." + method + "' was not found");
+        return;
+    }
+
+    m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, "'Database." + method + "' was not found");
 }
 
 void DatabaseBackendDispatcher::executeSQLSyncOptionalReturnValues(long requestId, RefPtr<JSON::Object>&& parameters)
@@ -291,7 +295,7 @@ void DatabaseBackendDispatcher::executeSQLSyncOptionalReturnValues(long requestI
         m_alternateDispatcher->executeSQLSyncOptionalReturnValues(requestId, in_databaseId, in_query);
         return;
     }
-#endif
+#endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
 
     ErrorString error;
     Ref<JSON::Object> result = JSON::Object::create();
@@ -377,7 +381,7 @@ void DatabaseBackendDispatcher::executeSQLAsyncOptionalReturnValues(long request
         m_alternateDispatcher->executeSQLAsyncOptionalReturnValues(requestId, in_databaseId, in_query);
         return;
     }
-#endif
+#endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
 
     Ref<DatabaseBackendDispatcherHandler::ExecuteSQLAsyncOptionalReturnValuesCallback> callback = adoptRef(*new DatabaseBackendDispatcherHandler::ExecuteSQLAsyncOptionalReturnValuesCallback(m_backendDispatcher.copyRef(), requestId));
     m_agent->executeSQLAsyncOptionalReturnValues(in_databaseId, in_query, callback.copyRef());
@@ -398,7 +402,7 @@ void DatabaseBackendDispatcher::executeSQLSync(long requestId, RefPtr<JSON::Obje
         m_alternateDispatcher->executeSQLSync(requestId, in_databaseId, in_query);
         return;
     }
-#endif
+#endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
 
     ErrorString error;
     Ref<JSON::Object> result = JSON::Object::create();
@@ -464,7 +468,7 @@ void DatabaseBackendDispatcher::executeSQLAsync(long requestId, RefPtr<JSON::Obj
         m_alternateDispatcher->executeSQLAsync(requestId, in_databaseId, in_query);
         return;
     }
-#endif
+#endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
 
     Ref<DatabaseBackendDispatcherHandler::ExecuteSQLAsyncCallback> callback = adoptRef(*new DatabaseBackendDispatcherHandler::ExecuteSQLAsyncCallback(m_backendDispatcher.copyRef(), requestId));
     m_agent->executeSQLAsync(in_databaseId, in_query, callback.copyRef());
@@ -503,8 +507,7 @@ void DatabaseBackendDispatcher::executeSQLAsync(long requestId, RefPtr<JSON::Obj
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #pragma once
 
@@ -547,8 +550,7 @@ class FrontendRouter;
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #include "config.h"
 #include "TestFrontendDispatchers.h"
@@ -590,8 +592,7 @@ namespace Inspector {
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #pragma once
 
@@ -634,12 +635,13 @@ template<typename T> String getEnumConstantValue(T enumValue)
 } // namespace TestHelpers
 
 namespace Database {
-/*  */
+
 enum class PrimaryColors {
     Red = 0,
     Green = 1,
     Blue = 2,
 }; // enum class PrimaryColors
+
 /* Database error. */
 class Error : public JSON::ObjectBase {
 public:
@@ -766,8 +768,7 @@ struct DefaultHash<Inspector::Protocol::Database::PrimaryColors> {
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #include "config.h"
 #include "TestProtocolObjects.h"
@@ -796,6 +797,7 @@ String getEnumConstantValue(int code) {
 }
 
 // Enums in the 'Database' Domain
+
 template<>
 Optional<Inspector::Protocol::Database::PrimaryColors> parseEnumValueFromString<Inspector::Protocol::Database::PrimaryColors>(const String& protocolString)
 {
@@ -811,7 +813,6 @@ Optional<Inspector::Protocol::Database::PrimaryColors> parseEnumValueFromString<
     return WTF::nullopt;
 }
 
-
 } // namespace TestHelpers
 
 
@@ -850,8 +851,7 @@ Optional<Inspector::Protocol::Database::PrimaryColors> parseEnumValueFromString<
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #include <JavaScriptCore/InspectorAlternateBackendDispatchers.h>
 #include <wtf/RetainPtr.h>
@@ -905,8 +905,7 @@ private:
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import "config.h"
 #import "TestProtocolBackendDispatchers.h"
@@ -1097,7 +1096,6 @@ void ObjCInspectorDatabaseBackendDispatcher::executeSQLAsync(long requestId, int
     [m_delegate executeSQLAsyncWithErrorCallback:errorCallback successCallback:successCallback databaseId:o_in_databaseId query:o_in_query];
 }
 
-
 } // namespace Inspector
 
 ### End File: TestProtocolBackendDispatchers.mm
@@ -1130,8 +1128,7 @@ void ObjCInspectorDatabaseBackendDispatcher::executeSQLAsync(long requestId, int
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import <WebInspector/TestProtocol.h>
 
@@ -1171,8 +1168,7 @@ __attribute__((visibility ("default")))
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import "TestProtocolConfiguration.h"
 
@@ -1258,8 +1254,7 @@ using namespace Inspector;
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import "TestProtocolInternal.h"
 
@@ -1299,8 +1294,7 @@ using namespace Inspector;
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import <Foundation/Foundation.h>
 
@@ -1309,14 +1303,6 @@ using namespace Inspector;
 
 @class TestProtocolDatabaseError;
 
-typedef NS_ENUM(NSInteger, TestProtocolPlatform) {
-    TestProtocolPlatformAll,
-    TestProtocolPlatformGeneric,
-    TestProtocolPlatformIOS,
-    TestProtocolPlatformMacOS,
-};
-
-
 typedef NS_ENUM(NSInteger, TestProtocolDatabasePrimaryColors) {
     TestProtocolDatabasePrimaryColorsRed,
     TestProtocolDatabasePrimaryColorsGreen,
@@ -1351,7 +1337,6 @@ typedef NS_ENUM(NSInteger, TestProtocolDatabaseExecuteSQLAsyncPrintColor) {
     TestProtocolDatabaseExecuteSQLAsyncPrintColorBlack,
 };
 
-
 __attribute__((visibility ("default")))
 @interface TestProtocolDatabaseError : RWIProtocolJSONObject
 - (instancetype)initWithPayload:(NSDictionary<NSString *, id> *)payload;
@@ -1404,8 +1389,7 @@ __attribute__((visibility ("default")))
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import "TestProtocol.h"
 #import "TestProtocolJSONObjectPrivate.h"
@@ -1445,8 +1429,7 @@ __attribute__((visibility ("default")))
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import "TestProtocol.h"
 #import <WebInspector/RWIProtocolArrayConversions.h>
@@ -1456,35 +1439,6 @@ namespace Inspector {
 template<typename ObjCEnumType>
 Optional<ObjCEnumType> fromProtocolString(const String& value);
 
-inline String toProtocolString(TestProtocolPlatform value)
-{
-    switch(value) {
-    case TestProtocolPlatformAll:
-        return "all"_s;
-    case TestProtocolPlatformGeneric:
-        return "generic"_s;
-    case TestProtocolPlatformIOS:
-        return "ios"_s;
-    case TestProtocolPlatformMacOS:
-        return "macos"_s;
-    }
-}
-
-template<>
-inline Optional<TestProtocolPlatform> fromProtocolString(const String& value)
-{
-    if (value == "all")
-        return TestProtocolPlatformAll;
-    if (value == "generic")
-        return TestProtocolPlatformGeneric;
-    if (value == "ios")
-        return TestProtocolPlatformIOS;
-    if (value == "macos")
-        return TestProtocolPlatformMacOS;
-    return WTF::nullopt;
-}
-
-
 inline String toProtocolString(TestProtocolDatabasePrimaryColors value)
 {
     switch(value) {
@@ -1653,8 +1607,7 @@ inline Optional<TestProtocolDatabaseExecuteSQLAsyncPrintColor> fromProtocolStrin
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import "TestProtocolTypeConversions.h"
 
@@ -1734,8 +1687,7 @@ using namespace Inspector;
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import "TestProtocolInternal.h"
 
@@ -1746,7 +1698,6 @@ using namespace Inspector;
 
 using namespace Inspector;
 
-
 @implementation TestProtocolDatabaseError
 
 - (instancetype)initWithPayload:(nonnull NSDictionary<NSString *, id> *)payload
@@ -1,4 +1,4 @@
-### Begin File: InspectorBackendCommands.js
+### Begin File: InspectorBackendCommands.js.in
 /*
  * Copyright (C) 2013 Google Inc. All rights reserved.
  * Copyright (C) 2013-2016 Apple Inc. All rights reserved.
@@ -26,8 +26,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-optional-call-return-parameters.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-optional-call-return-parameters.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 // Database
 InspectorBackend.registerDomain("Database", null);
@@ -35,7 +34,7 @@ InspectorBackend.registerEnum("Database.PrimaryColors", {Red: "red", Green: "gre
 InspectorBackend.registerCommand("Database.executeAllOptionalParameters", null, [{"name": "columnNames", "type": "object", "optional": true}, {"name": "notes", "type": "string", "optional": true}, {"name": "timestamp", "type": "number", "optional": true}, {"name": "values", "type": "object", "optional": true}, {"name": "payload", "type": "object", "optional": true}, {"name": "databaseId", "type": "number", "optional": true}, {"name": "sqlError", "type": "object", "optional": true}, {"name": "screenColor", "type": "string", "optional": true}, {"name": "alternateColors", "type": "object", "optional": true}, {"name": "printColor", "type": "string", "optional": true}], ["columnNames", "notes", "timestamp", "values", "payload", "databaseId", "sqlError", "screenColor", "alternateColors", "printColor"]);
 InspectorBackend.registerCommand("Database.executeNoOptionalParameters", null, [{"name": "columnNames", "type": "object"}, {"name": "notes", "type": "string"}, {"name": "timestamp", "type": "number"}, {"name": "values", "type": "object"}, {"name": "payload", "type": "object"}, {"name": "databaseId", "type": "number"}, {"name": "sqlError", "type": "object"}, {"name": "screenColor", "type": "string"}, {"name": "alternateColors", "type": "object"}, {"name": "printColor", "type": "string"}], ["columnNames", "notes", "timestamp", "values", "payload", "databaseId", "sqlError", "screenColor", "alternateColors", "printColor"]);
 InspectorBackend.activateDomain("Database", null);
-### End File: InspectorBackendCommands.js
+### End File: InspectorBackendCommands.js.in
 
 ### Begin File: TestAlternateBackendDispatchers.h
 /*
@@ -65,8 +64,7 @@ InspectorBackend.activateDomain("Database", null);
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-optional-call-return-parameters.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-optional-call-return-parameters.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #pragma once
 
@@ -127,8 +125,7 @@ public:
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-optional-call-return-parameters.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-optional-call-return-parameters.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #pragma once
 
@@ -171,7 +168,7 @@ public:
     void setAlternateDispatcher(AlternateDatabaseBackendDispatcher* alternateDispatcher) { m_alternateDispatcher = alternateDispatcher; }
 private:
     AlternateDatabaseBackendDispatcher* m_alternateDispatcher { nullptr };
-#endif
+#endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
 private:
     DatabaseBackendDispatcher(BackendDispatcher&, DatabaseBackendDispatcherHandler*);
     DatabaseBackendDispatcherHandler* m_agent { nullptr };
@@ -208,8 +205,7 @@ private:
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-optional-call-return-parameters.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-optional-call-return-parameters.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #include "config.h"
 #include "TestBackendDispatchers.h"
@@ -221,7 +217,7 @@ private:
 
 #if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
 #include "TestAlternateBackendDispatchers.h"
-#endif
+#endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
 
 namespace Inspector {
 
@@ -246,12 +242,16 @@ void DatabaseBackendDispatcher::dispatch(long requestId, const String& method, R
     RefPtr<JSON::Object> parameters;
     message->getObject("params"_s, parameters);
 
-    if (method == "executeAllOptionalParameters")
+    if (method == "executeAllOptionalParameters") {
         executeAllOptionalParameters(requestId, WTFMove(parameters));
-    else if (method == "executeNoOptionalParameters")
+        return;
+    }
+    if (method == "executeNoOptionalParameters") {
         executeNoOptionalParameters(requestId, WTFMove(parameters));
-    else
-        m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, "'Database." + method + "' was not found");
+        return;
+    }
+
+    m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, "'Database." + method + "' was not found");
 }
 
 void DatabaseBackendDispatcher::executeAllOptionalParameters(long requestId, RefPtr<JSON::Object>&& parameters)
@@ -286,7 +286,7 @@ void DatabaseBackendDispatcher::executeAllOptionalParameters(long requestId, Ref
         m_alternateDispatcher->executeAllOptionalParameters(requestId, opt_in_columnNames_valueFound ? opt_in_columnNames.get() : nullptr, opt_in_notes_valueFound ? &opt_in_notes : nullptr, opt_in_timestamp_valueFound ? &opt_in_timestamp : nullptr, opt_in_values_valueFound ? opt_in_values.get() : nullptr, opt_in_payload_valueFound ? opt_in_payload.get() : nullptr, opt_in_databaseId_valueFound ? &opt_in_databaseId : nullptr, opt_in_sqlError_valueFound ? opt_in_sqlError.get() : nullptr, opt_in_screenColor_valueFound ? &opt_in_screenColor : nullptr, opt_in_alternateColors_valueFound ? opt_in_alternateColors.get() : nullptr, opt_in_printColor_valueFound ? &opt_in_printColor : nullptr);
         return;
     }
-#endif
+#endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
 
     ErrorString error;
     Ref<JSON::Object> result = JSON::Object::create();
@@ -352,7 +352,7 @@ void DatabaseBackendDispatcher::executeNoOptionalParameters(long requestId, RefP
         m_alternateDispatcher->executeNoOptionalParameters(requestId, *in_columnNames, in_notes, in_timestamp, *in_values, *in_payload, in_databaseId, *in_sqlError, in_screenColor, *in_alternateColors, in_printColor);
         return;
     }
-#endif
+#endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
 
     ErrorString error;
     Ref<JSON::Object> result = JSON::Object::create();
@@ -418,8 +418,7 @@ void DatabaseBackendDispatcher::executeNoOptionalParameters(long requestId, RefP
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-optional-call-return-parameters.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-optional-call-return-parameters.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #pragma once
 
@@ -462,8 +461,7 @@ class FrontendRouter;
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-optional-call-return-parameters.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-optional-call-return-parameters.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #include "config.h"
 #include "TestFrontendDispatchers.h"
@@ -505,8 +503,7 @@ namespace Inspector {
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-optional-call-return-parameters.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-optional-call-return-parameters.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #pragma once
 
@@ -549,12 +546,13 @@ template<typename T> String getEnumConstantValue(T enumValue)
 } // namespace TestHelpers
 
 namespace Database {
-/*  */
+
 enum class PrimaryColors {
     Red = 0,
     Green = 1,
     Blue = 2,
 }; // enum class PrimaryColors
+
 /* Database error. */
 class Error : public JSON::ObjectBase {
 public:
@@ -681,8 +679,7 @@ struct DefaultHash<Inspector::Protocol::Database::PrimaryColors> {
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-optional-call-return-parameters.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-optional-call-return-parameters.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #include "config.h"
 #include "TestProtocolObjects.h"
@@ -711,6 +708,7 @@ String getEnumConstantValue(int code) {
 }
 
 // Enums in the 'Database' Domain
+
 template<>
 Optional<Inspector::Protocol::Database::PrimaryColors> parseEnumValueFromString<Inspector::Protocol::Database::PrimaryColors>(const String& protocolString)
 {
@@ -726,7 +724,6 @@ Optional<Inspector::Protocol::Database::PrimaryColors> parseEnumValueFromString<
     return WTF::nullopt;
 }
 
-
 } // namespace TestHelpers
 
 
@@ -765,8 +762,7 @@ Optional<Inspector::Protocol::Database::PrimaryColors> parseEnumValueFromString<
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-optional-call-return-parameters.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-optional-call-return-parameters.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #include <JavaScriptCore/InspectorAlternateBackendDispatchers.h>
 #include <wtf/RetainPtr.h>
@@ -818,8 +814,7 @@ private:
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-optional-call-return-parameters.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-optional-call-return-parameters.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import "config.h"
 #import "TestProtocolBackendDispatchers.h"
@@ -964,7 +959,6 @@ void ObjCInspectorDatabaseBackendDispatcher::executeNoOptionalParameters(long re
     [m_delegate executeNoOptionalParametersWithErrorCallback:errorCallback successCallback:successCallback columnNames:o_in_columnNames notes:o_in_notes timestamp:o_in_timestamp values:o_in_values payload:o_in_payload databaseId:o_in_databaseId sqlError:o_in_sqlError screenColor:o_in_screenColor.value() alternateColors:o_in_alternateColors printColor:o_in_printColor.value()];
 }
 
-
 } // namespace Inspector
 
 ### End File: TestProtocolBackendDispatchers.mm
@@ -997,8 +991,7 @@ void ObjCInspectorDatabaseBackendDispatcher::executeNoOptionalParameters(long re
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-optional-call-return-parameters.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-optional-call-return-parameters.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import <WebInspector/TestProtocol.h>
 
@@ -1038,8 +1031,7 @@ __attribute__((visibility ("default")))
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-optional-call-return-parameters.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-optional-call-return-parameters.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import "TestProtocolConfiguration.h"
 
@@ -1125,8 +1117,7 @@ using namespace Inspector;
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-optional-call-return-parameters.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-optional-call-return-parameters.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import "TestProtocolInternal.h"
 
@@ -1166,8 +1157,7 @@ using namespace Inspector;
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-optional-call-return-parameters.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-optional-call-return-parameters.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import <Foundation/Foundation.h>
 
@@ -1176,14 +1166,6 @@ using namespace Inspector;
 
 @class TestProtocolDatabaseError;
 
-typedef NS_ENUM(NSInteger, TestProtocolPlatform) {
-    TestProtocolPlatformAll,
-    TestProtocolPlatformGeneric,
-    TestProtocolPlatformIOS,
-    TestProtocolPlatformMacOS,
-};
-
-
 typedef NS_ENUM(NSInteger, TestProtocolDatabasePrimaryColors) {
     TestProtocolDatabasePrimaryColorsRed,
     TestProtocolDatabasePrimaryColorsGreen,
@@ -1197,6 +1179,8 @@ typedef NS_ENUM(NSInteger, TestProtocolDatabaseExecuteAllOptionalParametersPrint
     TestProtocolDatabaseExecuteAllOptionalParametersPrintColorBlack,
 };
 
+
+
 typedef NS_ENUM(NSInteger, TestProtocolDatabaseExecuteAllOptionalParametersPrintColor) {
     TestProtocolDatabaseExecuteAllOptionalParametersPrintColorCyan,
     TestProtocolDatabaseExecuteAllOptionalParametersPrintColorMagenta,
@@ -1211,6 +1195,8 @@ typedef NS_ENUM(NSInteger, TestProtocolDatabaseExecuteNoOptionalParametersPrintC
     TestProtocolDatabaseExecuteNoOptionalParametersPrintColorBlack,
 };
 
+
+
 typedef NS_ENUM(NSInteger, TestProtocolDatabaseExecuteNoOptionalParametersPrintColor) {
     TestProtocolDatabaseExecuteNoOptionalParametersPrintColorCyan,
     TestProtocolDatabaseExecuteNoOptionalParametersPrintColorMagenta,
@@ -1218,7 +1204,6 @@ typedef NS_ENUM(NSInteger, TestProtocolDatabaseExecuteNoOptionalParametersPrintC
     TestProtocolDatabaseExecuteNoOptionalParametersPrintColorBlack,
 };
 
-
 __attribute__((visibility ("default")))
 @interface TestProtocolDatabaseError : RWIProtocolJSONObject
 - (instancetype)initWithPayload:(NSDictionary<NSString *, id> *)payload;
@@ -1269,8 +1254,7 @@ __attribute__((visibility ("default")))
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-optional-call-return-parameters.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-optional-call-return-parameters.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import "TestProtocol.h"
 #import "TestProtocolJSONObjectPrivate.h"
@@ -1310,8 +1294,7 @@ __attribute__((visibility ("default")))
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-optional-call-return-parameters.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-optional-call-return-parameters.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import "TestProtocol.h"
 #import <WebInspector/RWIProtocolArrayConversions.h>
@@ -1321,35 +1304,6 @@ namespace Inspector {
 template<typename ObjCEnumType>
 Optional<ObjCEnumType> fromProtocolString(const String& value);
 
-inline String toProtocolString(TestProtocolPlatform value)
-{
-    switch(value) {
-    case TestProtocolPlatformAll:
-        return "all"_s;
-    case TestProtocolPlatformGeneric:
-        return "generic"_s;
-    case TestProtocolPlatformIOS:
-        return "ios"_s;
-    case TestProtocolPlatformMacOS:
-        return "macos"_s;
-    }
-}
-
-template<>
-inline Optional<TestProtocolPlatform> fromProtocolString(const String& value)
-{
-    if (value == "all")
-        return TestProtocolPlatformAll;
-    if (value == "generic")
-        return TestProtocolPlatformGeneric;
-    if (value == "ios")
-        return TestProtocolPlatformIOS;
-    if (value == "macos")
-        return TestProtocolPlatformMacOS;
-    return WTF::nullopt;
-}
-
-
 inline String toProtocolString(TestProtocolDatabasePrimaryColors value)
 {
     switch(value) {
@@ -1402,6 +1356,8 @@ inline Optional<TestProtocolDatabaseExecuteAllOptionalParametersPrintColor> from
     return WTF::nullopt;
 }
 
+
+
 inline String toProtocolString(TestProtocolDatabaseExecuteAllOptionalParametersPrintColor value)
 {
     switch(value) {
@@ -1458,6 +1414,8 @@ inline Optional<TestProtocolDatabaseExecuteNoOptionalParametersPrintColor> fromP
     return WTF::nullopt;
 }
 
+
+
 inline String toProtocolString(TestProtocolDatabaseExecuteNoOptionalParametersPrintColor value)
 {
     switch(value) {
@@ -1518,8 +1476,7 @@ inline Optional<TestProtocolDatabaseExecuteNoOptionalParametersPrintColor> fromP
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-optional-call-return-parameters.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-optional-call-return-parameters.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import "TestProtocolTypeConversions.h"
 
@@ -1599,8 +1556,7 @@ using namespace Inspector;
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-optional-call-return-parameters.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-optional-call-return-parameters.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import "TestProtocolInternal.h"
 
@@ -1611,7 +1567,6 @@ using namespace Inspector;
 
 using namespace Inspector;
 
-
 @implementation TestProtocolDatabaseError
 
 - (instancetype)initWithPayload:(nonnull NSDictionary<NSString *, id> *)payload
@@ -1,4 +1,4 @@
-### Begin File: InspectorBackendCommands.js
+### Begin File: InspectorBackendCommands.js.in
 /*
  * Copyright (C) 2013 Google Inc. All rights reserved.
  * Copyright (C) 2013-2016 Apple Inc. All rights reserved.
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from definitions-with-mac-platform.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from definitions-with-mac-platform.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 // Network
 InspectorBackend.registerDomain("Network", null);
+#if PLATFORM(MAC)
 InspectorBackend.registerCommand("Network.loadResource", null, [], []);
+#endif // PLATFORM(MAC)
+#if PLATFORM(MAC)
 InspectorBackend.registerEvent("Network.resourceLoaded", null, []);
+#endif // PLATFORM(MAC)
 InspectorBackend.registerNetworkDispatcher = InspectorBackend.registerDispatcher.bind(InspectorBackend, "Network");
 InspectorBackend.activateDomain("Network", null);
-### End File: InspectorBackendCommands.js
+### End File: InspectorBackendCommands.js.in
 
 ### Begin File: TestAlternateBackendDispatchers.h
 /*
@@ -65,8 +68,7 @@ InspectorBackend.activateDomain("Network", null);
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from definitions-with-mac-platform.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from definitions-with-mac-platform.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #pragma once
 
@@ -90,7 +92,9 @@ private:
 class AlternateNetworkBackendDispatcher : public AlternateBackendDispatcher {
 public:
     virtual ~AlternateNetworkBackendDispatcher() { }
+#if PLATFORM(MAC)
     virtual void loadResource(long callId) = 0;
+#endif // PLATFORM(MAC)
 };
 
 } // namespace Inspector
@@ -126,8 +130,7 @@ public:
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from definitions-with-mac-platform.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from definitions-with-mac-platform.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #pragma once
 
@@ -145,7 +148,9 @@ class AlternateNetworkBackendDispatcher;
 
 class NetworkBackendDispatcherHandler {
 public:
+#if PLATFORM(MAC)
     virtual void loadResource(ErrorString&) = 0;
+#endif // PLATFORM(MAC)
 protected:
     virtual ~NetworkBackendDispatcherHandler();
 };
@@ -155,13 +160,15 @@ public:
     static Ref<NetworkBackendDispatcher> create(BackendDispatcher&, NetworkBackendDispatcherHandler*);
     void dispatch(long requestId, const String& method, Ref<JSON::Object>&& message) final;
 private:
+#if PLATFORM(MAC)
     void loadResource(long requestId, RefPtr<JSON::Object>&& parameters);
+#endif // PLATFORM(MAC)
 #if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
 public:
     void setAlternateDispatcher(AlternateNetworkBackendDispatcher* alternateDispatcher) { m_alternateDispatcher = alternateDispatcher; }
 private:
     AlternateNetworkBackendDispatcher* m_alternateDispatcher { nullptr };
-#endif
+#endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
 private:
     NetworkBackendDispatcher(BackendDispatcher&, NetworkBackendDispatcherHandler*);
     NetworkBackendDispatcherHandler* m_agent { nullptr };
@@ -198,8 +205,7 @@ private:
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from definitions-with-mac-platform.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from definitions-with-mac-platform.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #include "config.h"
 #include "TestBackendDispatchers.h"
@@ -211,7 +217,7 @@ private:
 
 #if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
 #include "TestAlternateBackendDispatchers.h"
-#endif
+#endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
 
 namespace Inspector {
 
@@ -236,12 +242,17 @@ void NetworkBackendDispatcher::dispatch(long requestId, const String& method, Re
     RefPtr<JSON::Object> parameters;
     message->getObject("params"_s, parameters);
 
-    if (method == "loadResource")
+#if PLATFORM(MAC)
+    if (method == "loadResource") {
         loadResource(requestId, WTFMove(parameters));
-    else
-        m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, "'Network." + method + "' was not found");
+        return;
+    }
+#endif // PLATFORM(MAC)
+
+    m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, "'Network." + method + "' was not found");
 }
 
+#if PLATFORM(MAC)
 void NetworkBackendDispatcher::loadResource(long requestId, RefPtr<JSON::Object>&&)
 {
 #if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
@@ -249,7 +260,7 @@ void NetworkBackendDispatcher::loadResource(long requestId, RefPtr<JSON::Object>
         m_alternateDispatcher->loadResource(requestId);
         return;
     }
-#endif
+#endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
 
     ErrorString error;
     Ref<JSON::Object> result = JSON::Object::create();
@@ -260,6 +271,7 @@ void NetworkBackendDispatcher::loadResource(long requestId, RefPtr<JSON::Object>
     else
         m_backendDispatcher->reportProtocolError(BackendDispatcher::ServerError, WTFMove(error));
 }
+#endif // PLATFORM(MAC)
 
 } // namespace Inspector
 
@@ -293,8 +305,7 @@ void NetworkBackendDispatcher::loadResource(long requestId, RefPtr<JSON::Object>
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from definitions-with-mac-platform.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from definitions-with-mac-platform.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #pragma once
 
@@ -310,7 +321,9 @@ class NetworkFrontendDispatcher {
     WTF_MAKE_FAST_ALLOCATED;
 public:
     NetworkFrontendDispatcher(FrontendRouter& frontendRouter) : m_frontendRouter(frontendRouter) { }
+#if PLATFORM(MAC)
     void resourceLoaded();
+#endif // PLATFORM(MAC)
 private:
     FrontendRouter& m_frontendRouter;
 };
@@ -346,8 +359,7 @@ private:
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from definitions-with-mac-platform.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from definitions-with-mac-platform.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #include "config.h"
 #include "TestFrontendDispatchers.h"
@@ -357,6 +369,7 @@ private:
 
 namespace Inspector {
 
+#if PLATFORM(MAC)
 void NetworkFrontendDispatcher::resourceLoaded()
 {
     Ref<JSON::Object> jsonMessage = JSON::Object::create();
@@ -364,6 +377,7 @@ void NetworkFrontendDispatcher::resourceLoaded()
 
     m_frontendRouter.sendEvent(jsonMessage->toJSONString());
 }
+#endif // PLATFORM(MAC)
 
 } // namespace Inspector
 
@@ -397,8 +411,7 @@ void NetworkFrontendDispatcher::resourceLoaded()
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from definitions-with-mac-platform.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from definitions-with-mac-platform.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #pragma once
 
@@ -415,7 +428,9 @@ namespace Protocol {
 
 // Forward declarations.
 namespace Network {
+#if PLATFORM(MAC)
 class NetworkError;
+#endif // PLATFORM(MAC)
 } // Network
 // End of forward declarations.
 
@@ -423,6 +438,8 @@ class NetworkError;
 
 
 namespace Network {
+
+#if PLATFORM(MAC)
 class NetworkError : public JSON::ObjectBase {
 public:
     enum {
@@ -487,6 +504,7 @@ public:
         return Builder<NoFieldsSet>(JSON::Object::create());
     }
 };
+#endif // PLATFORM(MAC)
 
 } // Network
 
@@ -525,8 +543,7 @@ public:
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from definitions-with-mac-platform.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from definitions-with-mac-platform.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #include "config.h"
 #include "TestProtocolObjects.h"
@@ -574,8 +591,7 @@ namespace Protocol {
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from definitions-with-mac-platform.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from definitions-with-mac-platform.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #include <JavaScriptCore/InspectorAlternateBackendDispatchers.h>
 #include <wtf/RetainPtr.h>
@@ -589,7 +605,9 @@ class ObjCInspectorNetworkBackendDispatcher final : public AlternateNetworkBacke
     WTF_MAKE_FAST_ALLOCATED;
 public:
     ObjCInspectorNetworkBackendDispatcher(id<TestProtocolNetworkDomainHandler> handler) { m_delegate = handler; }
+#if PLATFORM(MAC)
     void loadResource(long requestId) final;
+#endif // PLATFORM(MAC)
 private:
     RetainPtr<id<TestProtocolNetworkDomainHandler>> m_delegate;
 };
@@ -626,8 +644,7 @@ private:
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from definitions-with-mac-platform.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from definitions-with-mac-platform.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import "config.h"
 #import "TestProtocolBackendDispatchers.h"
@@ -638,6 +655,7 @@ private:
 
 namespace Inspector {
 
+#if PLATFORM(MAC)
 void ObjCInspectorNetworkBackendDispatcher::loadResource(long requestId)
 {
     if (![m_delegate respondsToSelector:@selector(loadResourceWithErrorCallback:successCallback:)]) {
@@ -657,7 +675,7 @@ void ObjCInspectorNetworkBackendDispatcher::loadResource(long requestId)
 
     [m_delegate loadResourceWithErrorCallback:errorCallback successCallback:successCallback];
 }
-
+#endif // PLATFORM(MAC)
 
 } // namespace Inspector
 
@@ -691,8 +709,7 @@ void ObjCInspectorNetworkBackendDispatcher::loadResource(long requestId)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from definitions-with-mac-platform.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from definitions-with-mac-platform.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import <WebInspector/TestProtocol.h>
 
@@ -733,8 +750,7 @@ __attribute__((visibility ("default")))
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from definitions-with-mac-platform.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from definitions-with-mac-platform.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import "TestProtocolConfiguration.h"
 
@@ -829,8 +845,7 @@ using namespace Inspector;
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from definitions-with-mac-platform.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from definitions-with-mac-platform.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import "TestProtocolInternal.h"
 
@@ -896,26 +911,20 @@ using namespace Inspector;
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from definitions-with-mac-platform.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from definitions-with-mac-platform.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import <Foundation/Foundation.h>
 
 #import <WebInspector/RWIProtocolJSONObject.h>
 
 
+#if PLATFORM(MAC)
 @class TestProtocolNetworkError;
-
-typedef NS_ENUM(NSInteger, TestProtocolPlatform) {
-    TestProtocolPlatformAll,
-    TestProtocolPlatformGeneric,
-    TestProtocolPlatformIOS,
-    TestProtocolPlatformMacOS,
-};
-
+#endif // PLATFORM(MAC)
 
 
 
+#if PLATFORM(MAC)
 __attribute__((visibility ("default")))
 @interface TestProtocolNetworkError : RWIProtocolJSONObject
 - (instancetype)initWithPayload:(NSDictionary<NSString *, id> *)payload;
@@ -924,10 +933,13 @@ __attribute__((visibility ("default")))
 /* required */ @property (nonatomic, copy) NSString *message;
 /* required */ @property (nonatomic, assign) int code;
 @end
+#endif // PLATFORM(MAC)
 
 @protocol TestProtocolNetworkDomainHandler <NSObject>
 @optional
+#if PLATFORM(MAC)
 - (void)loadResourceWithErrorCallback:(void(^)(NSString *error))errorCallback successCallback:(void(^)(void))successCallback;
+#endif // PLATFORM(MAC)
 @end
 
 __attribute__((visibility ("default")))
@@ -968,8 +980,7 @@ __attribute__((visibility ("default")))
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from definitions-with-mac-platform.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from definitions-with-mac-platform.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import "TestProtocol.h"
 #import "TestProtocolJSONObjectPrivate.h"
@@ -1011,8 +1022,7 @@ __attribute__((visibility ("default")))
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from definitions-with-mac-platform.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from definitions-with-mac-platform.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import "TestProtocol.h"
 #import <WebInspector/RWIProtocolArrayConversions.h>
@@ -1022,34 +1032,6 @@ namespace Inspector {
 template<typename ObjCEnumType>
 Optional<ObjCEnumType> fromProtocolString(const String& value);
 
-inline String toProtocolString(TestProtocolPlatform value)
-{
-    switch(value) {
-    case TestProtocolPlatformAll:
-        return "all"_s;
-    case TestProtocolPlatformGeneric:
-        return "generic"_s;
-    case TestProtocolPlatformIOS:
-        return "ios"_s;
-    case TestProtocolPlatformMacOS:
-        return "macos"_s;
-    }
-}
-
-template<>
-inline Optional<TestProtocolPlatform> fromProtocolString(const String& value)
-{
-    if (value == "all")
-        return TestProtocolPlatformAll;
-    if (value == "generic")
-        return TestProtocolPlatformGeneric;
-    if (value == "ios")
-        return TestProtocolPlatformIOS;
-    if (value == "macos")
-        return TestProtocolPlatformMacOS;
-    return WTF::nullopt;
-}
-
 
 
 } // namespace Inspector
@@ -1084,8 +1066,7 @@ inline Optional<TestProtocolPlatform> fromProtocolString(const String& value)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from definitions-with-mac-platform.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from definitions-with-mac-platform.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import "TestProtocolTypeConversions.h"
 
@@ -1097,17 +1078,21 @@ using namespace Inspector;
 
 @interface TestProtocolTypeConversions (NetworkDomain)
 
+#if PLATFORM(MAC)
 + (void)_parseNetworkError:(TestProtocolNetworkError **)outValue fromPayload:(id)payload;
+#endif // PLATFORM(MAC)
 
 @end
 
 @implementation TestProtocolTypeConversions (NetworkDomain)
 
+#if PLATFORM(MAC)
 + (void)_parseNetworkError:(TestProtocolNetworkError **)outValue fromPayload:(id)payload
 {
     THROW_EXCEPTION_FOR_BAD_TYPE(payload, [NSDictionary class]);
     *outValue = [[TestProtocolNetworkError alloc] initWithPayload:payload];
 }
+#endif // PLATFORM(MAC)
 
 @end
 
@@ -1142,8 +1127,7 @@ using namespace Inspector;
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from definitions-with-mac-platform.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from definitions-with-mac-platform.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import "TestProtocolInternal.h"
 
@@ -1154,7 +1138,7 @@ using namespace Inspector;
 
 using namespace Inspector;
 
-
+#if PLATFORM(MAC)
 @implementation TestProtocolNetworkError
 
 - (instancetype)initWithPayload:(nonnull NSDictionary<NSString *, id> *)payload
@@ -1212,6 +1196,7 @@ using namespace Inspector;
 }
 
 @end
+#endif // PLATFORM(MAC)
 
 
 ### End File: TestProtocolTypes.mm
@@ -1,4 +1,4 @@
-### Begin File: InspectorBackendCommands.js
+### Begin File: InspectorBackendCommands.js.in
 /*
  * Copyright (C) 2013 Google Inc. All rights reserved.
  * Copyright (C) 2013-2016 Apple Inc. All rights reserved.
@@ -26,8 +26,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from domain-debuggableTypes.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from domain-debuggableTypes.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 // Domain
 InspectorBackend.registerDomain("Domain", null);
@@ -35,7 +34,7 @@ InspectorBackend.registerCommand("Domain.Command", null, [], []);
 InspectorBackend.registerEvent("Domain.Event", null, []);
 InspectorBackend.registerDomainDispatcher = InspectorBackend.registerDispatcher.bind(InspectorBackend, "Domain");
 InspectorBackend.activateDomain("Domain", ["web-page"]);
-### End File: InspectorBackendCommands.js
+### End File: InspectorBackendCommands.js.in
 
 ### Begin File: TestAlternateBackendDispatchers.h
 /*
@@ -65,8 +64,7 @@ InspectorBackend.activateDomain("Domain", ["web-page"]);
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from domain-debuggableTypes.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from domain-debuggableTypes.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #pragma once
 
@@ -126,8 +124,7 @@ public:
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from domain-debuggableTypes.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from domain-debuggableTypes.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #pragma once
 
@@ -161,7 +158,7 @@ public:
     void setAlternateDispatcher(AlternateDomainBackendDispatcher* alternateDispatcher) { m_alternateDispatcher = alternateDispatcher; }
 private:
     AlternateDomainBackendDispatcher* m_alternateDispatcher { nullptr };
-#endif
+#endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
 private:
     DomainBackendDispatcher(BackendDispatcher&, DomainBackendDispatcherHandler*);
     DomainBackendDispatcherHandler* m_agent { nullptr };
@@ -198,8 +195,7 @@ private:
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from domain-debuggableTypes.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from domain-debuggableTypes.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #include "config.h"
 #include "TestBackendDispatchers.h"
@@ -211,7 +207,7 @@ private:
 
 #if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
 #include "TestAlternateBackendDispatchers.h"
-#endif
+#endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
 
 namespace Inspector {
 
@@ -236,10 +232,12 @@ void DomainBackendDispatcher::dispatch(long requestId, const String& method, Ref
     RefPtr<JSON::Object> parameters;
     message->getObject("params"_s, parameters);
 
-    if (method == "Command")
+    if (method == "Command") {
         Command(requestId, WTFMove(parameters));
-    else
-        m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, "'Domain." + method + "' was not found");
+        return;
+    }
+
+    m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, "'Domain." + method + "' was not found");
 }
 
 void DomainBackendDispatcher::Command(long requestId, RefPtr<JSON::Object>&&)
@@ -249,7 +247,7 @@ void DomainBackendDispatcher::Command(long requestId, RefPtr<JSON::Object>&&)
         m_alternateDispatcher->Command(requestId);
         return;
     }
-#endif
+#endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
 
     ErrorString error;
     Ref<JSON::Object> result = JSON::Object::create();
@@ -293,8 +291,7 @@ void DomainBackendDispatcher::Command(long requestId, RefPtr<JSON::Object>&&)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from domain-debuggableTypes.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from domain-debuggableTypes.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #pragma once
 
@@ -346,8 +343,7 @@ private:
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from domain-debuggableTypes.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from domain-debuggableTypes.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #include "config.h"
 #include "TestFrontendDispatchers.h"
@@ -397,8 +393,7 @@ void DomainFrontendDispatcher::Event()
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from domain-debuggableTypes.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from domain-debuggableTypes.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #pragma once
 
@@ -452,8 +447,7 @@ namespace Protocol {
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from domain-debuggableTypes.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from domain-debuggableTypes.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #include "config.h"
 #include "TestProtocolObjects.h"
@@ -501,8 +495,7 @@ namespace Protocol {
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from domain-debuggableTypes.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from domain-debuggableTypes.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #include <JavaScriptCore/InspectorAlternateBackendDispatchers.h>
 #include <wtf/RetainPtr.h>
@@ -553,8 +546,7 @@ private:
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from domain-debuggableTypes.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from domain-debuggableTypes.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import "config.h"
 #import "TestProtocolBackendDispatchers.h"
@@ -585,7 +577,6 @@ void ObjCInspectorDomainBackendDispatcher::Command(long requestId)
     [m_delegate CommandWithErrorCallback:errorCallback successCallback:successCallback];
 }
 
-
 } // namespace Inspector
 
 ### End File: TestProtocolBackendDispatchers.mm
@@ -618,8 +609,7 @@ void ObjCInspectorDomainBackendDispatcher::Command(long requestId)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from domain-debuggableTypes.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from domain-debuggableTypes.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import <WebInspector/TestProtocol.h>
 
@@ -660,8 +650,7 @@ __attribute__((visibility ("default")))
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from domain-debuggableTypes.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from domain-debuggableTypes.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import "TestProtocolConfiguration.h"
 
@@ -756,8 +745,7 @@ using namespace Inspector;
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from domain-debuggableTypes.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from domain-debuggableTypes.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import "TestProtocolInternal.h"
 
@@ -823,8 +811,7 @@ using namespace Inspector;
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from domain-debuggableTypes.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from domain-debuggableTypes.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import <Foundation/Foundation.h>
 
@@ -833,13 +820,6 @@ using namespace Inspector;
 
 
 
-typedef NS_ENUM(NSInteger, TestProtocolPlatform) {
-    TestProtocolPlatformAll,
-    TestProtocolPlatformGeneric,
-    TestProtocolPlatformIOS,
-    TestProtocolPlatformMacOS,
-};
-
 
 
 
@@ -887,8 +867,7 @@ __attribute__((visibility ("default")))
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from domain-debuggableTypes.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from domain-debuggableTypes.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import "TestProtocol.h"
 #import "TestProtocolJSONObjectPrivate.h"
@@ -930,8 +909,7 @@ __attribute__((visibility ("default")))
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from domain-debuggableTypes.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from domain-debuggableTypes.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import "TestProtocol.h"
 #import <WebInspector/RWIProtocolArrayConversions.h>
@@ -941,34 +919,6 @@ namespace Inspector {
 template<typename ObjCEnumType>
 Optional<ObjCEnumType> fromProtocolString(const String& value);
 
-inline String toProtocolString(TestProtocolPlatform value)
-{
-    switch(value) {
-    case TestProtocolPlatformAll:
-        return "all"_s;
-    case TestProtocolPlatformGeneric:
-        return "generic"_s;
-    case TestProtocolPlatformIOS:
-        return "ios"_s;
-    case TestProtocolPlatformMacOS:
-        return "macos"_s;
-    }
-}
-
-template<>
-inline Optional<TestProtocolPlatform> fromProtocolString(const String& value)
-{
-    if (value == "all")
-        return TestProtocolPlatformAll;
-    if (value == "generic")
-        return TestProtocolPlatformGeneric;
-    if (value == "ios")
-        return TestProtocolPlatformIOS;
-    if (value == "macos")
-        return TestProtocolPlatformMacOS;
-    return WTF::nullopt;
-}
-
 } // namespace Inspector
 
 ### End File: TestProtocolTypeConversions.h
@@ -1001,8 +951,7 @@ inline Optional<TestProtocolPlatform> fromProtocolString(const String& value)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from domain-debuggableTypes.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from domain-debuggableTypes.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import "TestProtocolTypeConversions.h"
 
@@ -1047,8 +996,7 @@ using namespace Inspector;
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from domain-debuggableTypes.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from domain-debuggableTypes.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import "TestProtocolInternal.h"
 
@@ -1,4 +1,4 @@
-### Begin File: InspectorBackendCommands.js
+### Begin File: InspectorBackendCommands.js.in
 /*
  * Copyright (C) 2013 Google Inc. All rights reserved.
  * Copyright (C) 2013-2016 Apple Inc. All rights reserved.
@@ -26,8 +26,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetType-matching-domain-debuggableType.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetType-matching-domain-debuggableType.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 // Domain
 InspectorBackend.registerDomain("Domain", null);
@@ -35,7 +34,7 @@ InspectorBackend.registerCommand("Domain.Command", ["page", "worker"], [], []);
 InspectorBackend.registerEvent("Domain.Event", null, []);
 InspectorBackend.registerDomainDispatcher = InspectorBackend.registerDispatcher.bind(InspectorBackend, "Domain");
 InspectorBackend.activateDomain("Domain", ["page"]);
-### End File: InspectorBackendCommands.js
+### End File: InspectorBackendCommands.js.in
 
 ### Begin File: TestAlternateBackendDispatchers.h
 /*
@@ -65,8 +64,7 @@ InspectorBackend.activateDomain("Domain", ["page"]);
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetType-matching-domain-debuggableType.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetType-matching-domain-debuggableType.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #pragma once
 
@@ -126,8 +124,7 @@ public:
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetType-matching-domain-debuggableType.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetType-matching-domain-debuggableType.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #pragma once
 
@@ -161,7 +158,7 @@ public:
     void setAlternateDispatcher(AlternateDomainBackendDispatcher* alternateDispatcher) { m_alternateDispatcher = alternateDispatcher; }
 private:
     AlternateDomainBackendDispatcher* m_alternateDispatcher { nullptr };
-#endif
+#endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
 private:
     DomainBackendDispatcher(BackendDispatcher&, DomainBackendDispatcherHandler*);
     DomainBackendDispatcherHandler* m_agent { nullptr };
@@ -198,8 +195,7 @@ private:
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetType-matching-domain-debuggableType.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetType-matching-domain-debuggableType.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #include "config.h"
 #include "TestBackendDispatchers.h"
@@ -211,7 +207,7 @@ private:
 
 #if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
 #include "TestAlternateBackendDispatchers.h"
-#endif
+#endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
 
 namespace Inspector {
 
@@ -236,10 +232,12 @@ void DomainBackendDispatcher::dispatch(long requestId, const String& method, Ref
     RefPtr<JSON::Object> parameters;
     message->getObject("params"_s, parameters);
 
-    if (method == "Command")
+    if (method == "Command") {
         Command(requestId, WTFMove(parameters));
-    else
-        m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, "'Domain." + method + "' was not found");
+        return;
+    }
+
+    m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, "'Domain." + method + "' was not found");
 }
 
 void DomainBackendDispatcher::Command(long requestId, RefPtr<JSON::Object>&&)
@@ -249,7 +247,7 @@ void DomainBackendDispatcher::Command(long requestId, RefPtr<JSON::Object>&&)
         m_alternateDispatcher->Command(requestId);
         return;
     }
-#endif
+#endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
 
     ErrorString error;
     Ref<JSON::Object> result = JSON::Object::create();
@@ -293,8 +291,7 @@ void DomainBackendDispatcher::Command(long requestId, RefPtr<JSON::Object>&&)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetType-matching-domain-debuggableType.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetType-matching-domain-debuggableType.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #pragma once
 
@@ -346,8 +343,7 @@ private:
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetType-matching-domain-debuggableType.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetType-matching-domain-debuggableType.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #include "config.h"
 #include "TestFrontendDispatchers.h"
@@ -397,8 +393,7 @@ void DomainFrontendDispatcher::Event()
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetType-matching-domain-debuggableType.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetType-matching-domain-debuggableType.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #pragma once
 
@@ -452,8 +447,7 @@ namespace Protocol {
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetType-matching-domain-debuggableType.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetType-matching-domain-debuggableType.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #include "config.h"
 #include "TestProtocolObjects.h"
@@ -501,8 +495,7 @@ namespace Protocol {
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetType-matching-domain-debuggableType.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetType-matching-domain-debuggableType.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #include <JavaScriptCore/InspectorAlternateBackendDispatchers.h>
 #include <wtf/RetainPtr.h>
@@ -553,8 +546,7 @@ private:
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetType-matching-domain-debuggableType.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetType-matching-domain-debuggableType.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import "config.h"
 #import "TestProtocolBackendDispatchers.h"
@@ -585,7 +577,6 @@ void ObjCInspectorDomainBackendDispatcher::Command(long requestId)
     [m_delegate CommandWithErrorCallback:errorCallback successCallback:successCallback];
 }
 
-
 } // namespace Inspector
 
 ### End File: TestProtocolBackendDispatchers.mm
@@ -618,8 +609,7 @@ void ObjCInspectorDomainBackendDispatcher::Command(long requestId)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetType-matching-domain-debuggableType.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetType-matching-domain-debuggableType.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import <WebInspector/TestProtocol.h>
 
@@ -660,8 +650,7 @@ __attribute__((visibility ("default")))
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetType-matching-domain-debuggableType.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetType-matching-domain-debuggableType.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import "TestProtocolConfiguration.h"
 
@@ -756,8 +745,7 @@ using namespace Inspector;
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetType-matching-domain-debuggableType.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetType-matching-domain-debuggableType.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import "TestProtocolInternal.h"
 
@@ -823,8 +811,7 @@ using namespace Inspector;
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetType-matching-domain-debuggableType.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetType-matching-domain-debuggableType.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import <Foundation/Foundation.h>
 
@@ -833,13 +820,6 @@ using namespace Inspector;
 
 
 
-typedef NS_ENUM(NSInteger, TestProtocolPlatform) {
-    TestProtocolPlatformAll,
-    TestProtocolPlatformGeneric,
-    TestProtocolPlatformIOS,
-    TestProtocolPlatformMacOS,
-};
-
 
 
 
@@ -887,8 +867,7 @@ __attribute__((visibility ("default")))
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetType-matching-domain-debuggableType.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetType-matching-domain-debuggableType.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import "TestProtocol.h"
 #import "TestProtocolJSONObjectPrivate.h"
@@ -930,8 +909,7 @@ __attribute__((visibility ("default")))
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetType-matching-domain-debuggableType.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetType-matching-domain-debuggableType.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import "TestProtocol.h"
 #import <WebInspector/RWIProtocolArrayConversions.h>
@@ -941,34 +919,6 @@ namespace Inspector {
 template<typename ObjCEnumType>
 Optional<ObjCEnumType> fromProtocolString(const String& value);
 
-inline String toProtocolString(TestProtocolPlatform value)
-{
-    switch(value) {
-    case TestProtocolPlatformAll:
-        return "all"_s;
-    case TestProtocolPlatformGeneric:
-        return "generic"_s;
-    case TestProtocolPlatformIOS:
-        return "ios"_s;
-    case TestProtocolPlatformMacOS:
-        return "macos"_s;
-    }
-}
-
-template<>
-inline Optional<TestProtocolPlatform> fromProtocolString(const String& value)
-{
-    if (value == "all")
-        return TestProtocolPlatformAll;
-    if (value == "generic")
-        return TestProtocolPlatformGeneric;
-    if (value == "ios")
-        return TestProtocolPlatformIOS;
-    if (value == "macos")
-        return TestProtocolPlatformMacOS;
-    return WTF::nullopt;
-}
-
 } // namespace Inspector
 
 ### End File: TestProtocolTypeConversions.h
@@ -1001,8 +951,7 @@ inline Optional<TestProtocolPlatform> fromProtocolString(const String& value)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetType-matching-domain-debuggableType.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetType-matching-domain-debuggableType.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import "TestProtocolTypeConversions.h"
 
@@ -1047,8 +996,7 @@ using namespace Inspector;
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetType-matching-domain-debuggableType.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetType-matching-domain-debuggableType.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import "TestProtocolInternal.h"
 
@@ -1,4 +1,4 @@
-### Begin File: InspectorBackendCommands.js
+### Begin File: InspectorBackendCommands.js.in
 /*
  * Copyright (C) 2013 Google Inc. All rights reserved.
  * Copyright (C) 2013-2016 Apple Inc. All rights reserved.
@@ -26,8 +26,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetTypes.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetTypes.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 // Domain
 InspectorBackend.registerDomain("Domain", ["page"]);
@@ -35,7 +34,7 @@ InspectorBackend.registerCommand("Domain.Command", ["page"], [], []);
 InspectorBackend.registerEvent("Domain.Event", ["page"], []);
 InspectorBackend.registerDomainDispatcher = InspectorBackend.registerDispatcher.bind(InspectorBackend, "Domain");
 InspectorBackend.activateDomain("Domain", null);
-### End File: InspectorBackendCommands.js
+### End File: InspectorBackendCommands.js.in
 
 ### Begin File: TestAlternateBackendDispatchers.h
 /*
@@ -65,8 +64,7 @@ InspectorBackend.activateDomain("Domain", null);
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetTypes.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetTypes.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #pragma once
 
@@ -126,8 +124,7 @@ public:
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetTypes.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetTypes.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #pragma once
 
@@ -161,7 +158,7 @@ public:
     void setAlternateDispatcher(AlternateDomainBackendDispatcher* alternateDispatcher) { m_alternateDispatcher = alternateDispatcher; }
 private:
     AlternateDomainBackendDispatcher* m_alternateDispatcher { nullptr };
-#endif
+#endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
 private:
     DomainBackendDispatcher(BackendDispatcher&, DomainBackendDispatcherHandler*);
     DomainBackendDispatcherHandler* m_agent { nullptr };
@@ -198,8 +195,7 @@ private:
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetTypes.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetTypes.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #include "config.h"
 #include "TestBackendDispatchers.h"
@@ -211,7 +207,7 @@ private:
 
 #if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
 #include "TestAlternateBackendDispatchers.h"
-#endif
+#endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
 
 namespace Inspector {
 
@@ -236,10 +232,12 @@ void DomainBackendDispatcher::dispatch(long requestId, const String& method, Ref
     RefPtr<JSON::Object> parameters;
     message->getObject("params"_s, parameters);
 
-    if (method == "Command")
+    if (method == "Command") {
         Command(requestId, WTFMove(parameters));
-    else
-        m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, "'Domain." + method + "' was not found");
+        return;
+    }
+
+    m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, "'Domain." + method + "' was not found");
 }
 
 void DomainBackendDispatcher::Command(long requestId, RefPtr<JSON::Object>&&)
@@ -249,7 +247,7 @@ void DomainBackendDispatcher::Command(long requestId, RefPtr<JSON::Object>&&)
         m_alternateDispatcher->Command(requestId);
         return;
     }
-#endif
+#endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
 
     ErrorString error;
     Ref<JSON::Object> result = JSON::Object::create();
@@ -293,8 +291,7 @@ void DomainBackendDispatcher::Command(long requestId, RefPtr<JSON::Object>&&)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetTypes.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetTypes.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #pragma once
 
@@ -346,8 +343,7 @@ private:
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetTypes.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetTypes.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #include "config.h"
 #include "TestFrontendDispatchers.h"
@@ -397,8 +393,7 @@ void DomainFrontendDispatcher::Event()
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetTypes.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetTypes.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #pragma once
 
@@ -452,8 +447,7 @@ namespace Protocol {
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetTypes.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetTypes.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #include "config.h"
 #include "TestProtocolObjects.h"
@@ -501,8 +495,7 @@ namespace Protocol {
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetTypes.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetTypes.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #include <JavaScriptCore/InspectorAlternateBackendDispatchers.h>
 #include <wtf/RetainPtr.h>
@@ -553,8 +546,7 @@ private:
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetTypes.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetTypes.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import "config.h"
 #import "TestProtocolBackendDispatchers.h"
@@ -585,7 +577,6 @@ void ObjCInspectorDomainBackendDispatcher::Command(long requestId)
     [m_delegate CommandWithErrorCallback:errorCallback successCallback:successCallback];
 }
 
-
 } // namespace Inspector
 
 ### End File: TestProtocolBackendDispatchers.mm
@@ -618,8 +609,7 @@ void ObjCInspectorDomainBackendDispatcher::Command(long requestId)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetTypes.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetTypes.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import <WebInspector/TestProtocol.h>
 
@@ -660,8 +650,7 @@ __attribute__((visibility ("default")))
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetTypes.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetTypes.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import "TestProtocolConfiguration.h"
 
@@ -756,8 +745,7 @@ using namespace Inspector;
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetTypes.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetTypes.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import "TestProtocolInternal.h"
 
@@ -823,8 +811,7 @@ using namespace Inspector;
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetTypes.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetTypes.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import <Foundation/Foundation.h>
 
@@ -833,13 +820,6 @@ using namespace Inspector;
 
 
 
-typedef NS_ENUM(NSInteger, TestProtocolPlatform) {
-    TestProtocolPlatformAll,
-    TestProtocolPlatformGeneric,
-    TestProtocolPlatformIOS,
-    TestProtocolPlatformMacOS,
-};
-
 
 
 
@@ -887,8 +867,7 @@ __attribute__((visibility ("default")))
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetTypes.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetTypes.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import "TestProtocol.h"
 #import "TestProtocolJSONObjectPrivate.h"
@@ -930,8 +909,7 @@ __attribute__((visibility ("default")))
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetTypes.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetTypes.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import "TestProtocol.h"
 #import <WebInspector/RWIProtocolArrayConversions.h>
@@ -941,34 +919,6 @@ namespace Inspector {
 template<typename ObjCEnumType>
 Optional<ObjCEnumType> fromProtocolString(const String& value);
 
-inline String toProtocolString(TestProtocolPlatform value)
-{
-    switch(value) {
-    case TestProtocolPlatformAll:
-        return "all"_s;
-    case TestProtocolPlatformGeneric:
-        return "generic"_s;
-    case TestProtocolPlatformIOS:
-        return "ios"_s;
-    case TestProtocolPlatformMacOS:
-        return "macos"_s;
-    }
-}
-
-template<>
-inline Optional<TestProtocolPlatform> fromProtocolString(const String& value)
-{
-    if (value == "all")
-        return TestProtocolPlatformAll;
-    if (value == "generic")
-        return TestProtocolPlatformGeneric;
-    if (value == "ios")
-        return TestProtocolPlatformIOS;
-    if (value == "macos")
-        return TestProtocolPlatformMacOS;
-    return WTF::nullopt;
-}
-
 } // namespace Inspector
 
 ### End File: TestProtocolTypeConversions.h
@@ -1001,8 +951,7 @@ inline Optional<TestProtocolPlatform> fromProtocolString(const String& value)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetTypes.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetTypes.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import "TestProtocolTypeConversions.h"
 
@@ -1047,8 +996,7 @@ using namespace Inspector;
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetTypes.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from domain-targetTypes.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #import "TestProtocolInternal.h"
 
@@ -1,4 +1,4 @@
-### Begin File: InspectorBackendCommands.js
+### Begin File: InspectorBackendCommands.js.in
 /*
  * Copyright (C) 2013 Google Inc. All rights reserved.
  * Copyright (C) 2013-2016 Apple Inc. All rights reserved.
@@ -26,8 +26,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from domains-with-varying-command-sizes.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from domains-with-varying-command-sizes.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 // Network1
 InspectorBackend.registerDomain("Network1", null);
@@ -44,7 +43,7 @@ InspectorBackend.registerCommand("Network3.loadResource5", null, [], []);
 InspectorBackend.registerCommand("Network3.loadResource6", null, [], []);
 InspectorBackend.registerCommand("Network3.loadResource7", null, [], []);
 InspectorBackend.activateDomain("Network3", null);
-### End File: InspectorBackendCommands.js
+### End File: InspectorBackendCommands.js.in
 
 ### Begin File: TestAlternateBackendDispatchers.h
 /*
@@ -74,8 +73,7 @@ InspectorBackend.activateDomain("Network3", null);
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from domains-with-varying-command-sizes.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from domains-with-varying-command-sizes.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #pragma once
 
@@ -101,6 +99,7 @@ public:
     virtual ~AlternateNetwork1BackendDispatcher() { }
     virtual void loadResource1(long callId) = 0;
 };
+
 class AlternateNetwork3BackendDispatcher : public AlternateBackendDispatcher {
 public:
     virtual ~AlternateNetwork3BackendDispatcher() { }
@@ -146,8 +145,7 @@ public:
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from domains-with-varying-command-sizes.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from domains-with-varying-command-sizes.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #pragma once
 
@@ -195,7 +193,7 @@ public:
     void setAlternateDispatcher(AlternateNetwork1BackendDispatcher* alternateDispatcher) { m_alternateDispatcher = alternateDispatcher; }
 private:
     AlternateNetwork1BackendDispatcher* m_alternateDispatcher { nullptr };
-#endif
+#endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
 private:
     Network1BackendDispatcher(BackendDispatcher&, Network1BackendDispatcherHandler*);
     Network1BackendDispatcherHandler* m_agent { nullptr };
@@ -218,7 +216,7 @@ public:
     void setAlternateDispatcher(AlternateNetwork3BackendDispatcher* alternateDispatcher) { m_alternateDispatcher = alternateDispatcher; }
 private:
     AlternateNetwork3BackendDispatcher* m_alternateDispatcher { nullptr };
-#endif
+#endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
 private:
     Network3BackendDispatcher(BackendDispatcher&, Network3BackendDispatcherHandler*);
     Network3BackendDispatcherHandler* m_agent { nullptr };
@@ -255,8 +253,7 @@ private:
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// DO NOT EDIT THIS FILE. It is automatically generated from domains-with-varying-command-sizes.json
-// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+// DO NOT EDIT THIS FILE. It is automatically generated from domains-with-varying-command-sizes.json by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
 
 #include "config.h"
 #include "TestBackendDispatchers.h"
@@ -268,7 +265,7 @@ private:
 
 #if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
 #include "TestAlternateBackendDispatchers.h"
-#endif
+#endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
 
 namespace Inspector {
 
@@ -294,10 +291,12 @@ void Network1BackendDispatcher::dispatch(long requestId, const String& method, R
     RefPtr<JSON::Object> parameters;
     message->getObject("params"_s, parameters);
 
-    if (method == "loadResource1")
+    if (method == "loadResource1") {
         loadResource1(requestId, WTFMove(parameters));
-    else
-    &nb