BaristaLabs/chrome-dev-tools-generator

Unmapped data type: binary - Google Chrome 72/73

Closed this issue · 4 comments

$ git clone https://github.com/BaristaLabs/chrome-dev-tools
$ cd chrome-dev-tools\src\ChromeDevToolsGeneratorCLI
$ dotnet run ChromeDevToolsGeneratorCLI -o "C:\temp\ChromeDevToolsRuntime"

does not seem to work with Chrome 72 and 73, it returns:

dotnet run ChromeDevToolsGeneratorCLI -o "C:\temp\ChromeDevToolsRuntime"
Loading protocol definition...
Using previously obtained protocol definition...
Validating protocol definition...
Generating protocol definition from current generator interface...
Generating protocol definition code files...

Unhandled Exception: System.InvalidOperationException: Unmapped data type: binary
at BaristaLabs.ChromeDevTools.RemoteInterface.CodeGen.Utility.GetTypeMappingForType(TypeDefinition typeDefinition, DomainDefinition domainDefinition, IDictionary2 knownTypes, Boolean isArray) in chrome-dev-tools\src\BaristaLabs.ChromeDevTools.RemoteInterface\CodeGen\Utility.cs:line 105 at BaristaLabs.ChromeDevTools.RemoteInterface.CodeGen.TemplatesManager.<>c.<GetGeneratorForTemplate>b__5_2(TextWriter writer, Object context, Object[] arguments) in chrome-dev-tools\src\BaristaLabs.ChromeDevTools.RemoteInterface\CodeGen\TemplatesManager.cs:line 126 at lambda_method(Closure , TextWriter , Object ) at HandlebarsDotNet.Compiler.IteratorBinder.Iterate(IteratorBindingContext context, IEnumerable sequence, Action2 template, Action2 ifEmpty) at lambda_method(Closure , TextWriter , Object ) at HandlebarsDotNet.Handlebars.HandlebarsEnvironment.<>c__DisplayClass7_0.<Compile>b__0(Object context) at BaristaLabs.ChromeDevTools.RemoteInterface.CodeGen.CommandGenerator.GenerateCode(CommandDefinition commandDefinition, CodeGeneratorContext context) in chrome-dev-tools\src\BaristaLabs.ChromeDevTools.RemoteInterface\CodeGen\CommandGenerator.cs:line 28 at BaristaLabs.ChromeDevTools.RemoteInterface.CodeGen.DomainGenerator.GenerateCode(DomainDefinition domainDefinition, CodeGeneratorContext context) in blab\chrome-dev-tools\src\BaristaLabs.ChromeDevTools.RemoteInterface\CodeGen\DomainGenerator.cs:line 43 at BaristaLabs.ChromeDevTools.RemoteInterface.CodeGen.ProtocolGenerator.GenerateCode(ICollection1 domains, Dictionary`2 knownTypes) in chrome-dev-tools\src\BaristaLabs.ChromeDevTools.RemoteInterface\CodeGen\ProtocolGenerator.cs:line 208
at BaristaLabs.ChromeDevTools.RemoteInterface.CodeGen.ProtocolGenerator.GenerateCode(ProtocolDefinition protocolDefinition, CodeGeneratorContext context) in chrome-dev-tools\src\BaristaLabs.ChromeDevTools.RemoteInterface\CodeGen\ProtocolGenerator.cs:line 92
at ChromeDevToolsGeneratorCLI.Program.Main(String[] args) in chrome-dev-tools\src\ChromeDevToolsGeneratorCLI\Program.cs:line 51

you can clear this error by adding 'binary' as an option to the switch statement in the RemoteInterface.CodeGen.Utility.GetTypeMappingForType method.

Don't know what the correct mapping should be yet, I would imagine a byte array but mapping to an object allows chrome protocol 74 to generate.

Yes, that was the solution that I had adopted to compile it (I added 'binary' to the switch and mapped it to 'object'), but I opened this ticket mainly to make the Dev team aware of this breaking change. :-)

TL;DR byte[] is the correct type to use.

Currently Chrome ships version 1.3 of the protocol but if you check the documentation there is no reference to Audit domain. All methods the accept or return binary values are flagged as experimental.

Anyway, version latest shows that all binary types are represented as string (base64 encoded, example Audits.getEncodedResponse or Browser.setDockTile) and byte[] will be automatically encoded as base64 string.

Thanks for the PR! Closing