forked from rubycdp/ferrum
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Broken escaped unicode crashes JSON parser (rubycdp#452)
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.
- Loading branch information
Showing
4 changed files
with
56 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<body> | ||
<p> | ||
<span id="valid"></span> | ||
</p> | ||
<p> | ||
<span id="invalid"></span> | ||
</p> | ||
<p> | ||
<span id="curly"></span> | ||
</p> | ||
<script> | ||
document.getElementById('invalid').innerHTML = "Havregrynskake med marengs og n\u00f8tter \ud83d" | ||
document.getElementById('valid').innerHTML = "Havregrynskake med marengs og nøtter \ud83d\ude0d såå god!" | ||
document.getElementById('curly').innerHTML = "\u{1F600} and \u{2600}" | ||
</script> | ||
</body> | ||
</html> |