Bug 203197 - Web Inspector: make ObjC protocol dispatcher commands optional and add `respondsToSelector` checks to allow other inspector clients to choose what they implement
Summary: Web Inspector: make ObjC protocol dispatcher commands optional and add `respo...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Devin Rousso
URL:
Keywords: InRadar
Depends on: 200384
Blocks: 203300
  Show dependency treegraph
 
Reported: 2019-10-21 11:00 PDT by Devin Rousso
Modified: 2019-10-23 10:11 PDT (History)
12 users (show)

See Also:


Attachments
Patch (36.10 KB, patch)
2019-10-21 13:31 PDT, Devin Rousso
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Devin Rousso 2019-10-21 11:00:06 PDT
This will help eliminate internal build failures, and will also slim down on commands that simply error with "unsupported"
Comment 1 Devin Rousso 2019-10-21 13:31:46 PDT
Created attachment 381438 [details]
Patch
Comment 2 Build Bot 2019-10-21 13:32:22 PDT
This patch modifies the inspector protocol generator. Please ensure that you have rebaselined any generator test results (i.e., by running `Tools/Scripts/run-inspector-generator-tests --reset-results`)
Comment 3 Joseph Pecoraro 2019-10-21 13:37:53 PDT
Comment on attachment 381438 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=381438&action=review

r=me!

> Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_backend_dispatcher_implementation.py:110
> +    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)))

You can probably just simplify this to join parameters with a colon, and add the trailing colon to the respondsToSelector part of the format string.
Comment 4 Devin Rousso 2019-10-21 13:40:48 PDT
Comment on attachment 381438 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=381438&action=review

>> Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_backend_dispatcher_implementation.py:110
>> +        return '[m_delegate respondsToSelector:@selector(%sWithErrorCallback:successCallback:%s)]' % (command.command_name, ''.join(map(lambda parameter: '%s:' % parameter.parameter_name, command.call_parameters)))
> 
> You can probably just simplify this to join parameters with a colon, and add the trailing colon to the respondsToSelector part of the format string.

As we just discussed, we actually don't want to do that because if `command.call_parameters` is empty, we don't want a second trailing colon.
Comment 5 Brian Burg 2019-10-21 14:19:30 PDT
Comment on attachment 381438 [details]
Patch

r=me !!
Comment 6 WebKit Commit Bot 2019-10-21 16:30:20 PDT
Comment on attachment 381438 [details]
Patch

Clearing flags on attachment: 381438

Committed r251395: <https://trac.webkit.org/changeset/251395>
Comment 7 WebKit Commit Bot 2019-10-21 16:30:22 PDT
All reviewed patches have been landed.  Closing bug.
Comment 8 Radar WebKit Bug Importer 2019-10-21 16:31:16 PDT
<rdar://problem/56481634>