-
Notifications
You must be signed in to change notification settings - Fork 59
Description
Hello,
The most recent commit (91afd10) to cdproto library broke some commands when communicating with Chrome. The reason for them being broken is the seemingly inconsequential change to the models that removed ,omitempty,omitzero from optional fields.
After debugging this locally I found that the Target.createTarget returns
{
"code": -32000,
"message": "Failed to open new tab - no browser is open"
}when the optional field newWindow is set as false. Previously this field was only ever sent to chrome when set to true, but now it will be sent regardless.
It's strange that Chrome behaves this way, but I've been able to reproduce it locally by manually re-adding ,omitempty,omitzero to newWindow and then things started working again.
Snippets:
Before:
"[chrome comms] -> [{\"id\":1,\"method\":\"Target.createTarget\",\"params\":{\"url\":\"about:blank\"}}\n]"
"[chrome comms] <- [{\"id\":1,\"result\":{\"targetId\":\"5CCE5EFCF7F8D5113EEAAF94EB41FEE7\"}}]"
Now:
"[chrome comms] -> [{\"id\":1,\"method\":\"Target.createTarget\",\"params\":{\"url\":\"about:blank\",\"enableBeginFrameControl\":false,\"newWindow\":false,\"background\":false,\"forTab\":false}}\n]"
"[chrome comms] <- [{\"id\":1,\"error\":{\"code\":-32000,\"message\":\"Failed to open new tab - no browser is open\"}}]"
I have at the time of writing only found this to be a problem for Target.createTarget but wouldn't be surprised if there's more strange undefined behaviors in chrome that result in similar issues.
Problematic change:
91afd10#diff-4a863240ed8fc01708523a79f3c4ba046b61bd186bddc2d794d23e55bb2d17e1R309
Let me know if you need any additional information.