rubycdp / ferrum

Headless Chrome Ruby API
https://ferrum.rubycdp.com
MIT License
1.68k stars 119 forks source link

fix: Broken escaped unicode crashes JSON parser #452

Closed route closed 3 months ago

route commented 3 months ago

Assigning broken unicode to a node directly from JS can lead to JSON::ParserError: incomplete surrogate pair at ... error. We try to unescape unicode code points and replace invalid ones with ? char now. If still after that JSON cannot parse the string, we raise error. That's anyways the best we can do, we can't just skip CDP message.