Bug 203197

Summary: Web Inspector: make ObjC protocol dispatcher commands optional and add `respondsToSelector` checks to allow other inspector clients to choose what they implement
Product: WebKit Reporter: Devin Rousso <drousso>
Component: Web InspectorAssignee: Devin Rousso <drousso>
Status: RESOLVED FIXED    
Severity: Normal CC: bburg, commit-queue, drousso, ews-watchlist, inspector-bugzilla-changes, joepeck, keith_miller, mark.lam, msaboff, sbarati, tzagallo, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Bug Depends on: 200384    
Bug Blocks: 203300    
Attachments:
Description Flags
Patch none

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 EWS Watchlist 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 BJ 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>