rubycdp / ferrum

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

fix: Broken escaped unicode crashes JSON parser #452

Closed route closed 8 months ago

route commented 8 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.