url: enforce valid UTF-8 in WHATWG parser · nodejs/node@7c9ca0f · GitHub
Skip to content

Commit 7c9ca0f

Browse files
TimothyGuevanlucas
authored andcommitted
url: enforce valid UTF-8 in WHATWG parser
This commit implements the Web IDL USVString conversion, which mandates all unpaired Unicode surrogates be turned into U+FFFD REPLACEMENT CHARACTER. It also disallows Symbols to be used as USVString per spec. Certain functions call into C++ methods in the binding that use the Utf8Value class to access string arguments. Utf8Value already does the normalization using V8's String::Write, so in those cases, instead of doing the full USVString normalization, only a symbol check is done (`'' + val`, which uses ES's ToString, versus `String()` which has special provisions for symbols). PR-URL: #12507 Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent e48e00b commit 7c9ca0f

13 files changed

Lines changed: 509 additions & 44 deletions

lib/internal/url.js

Lines changed: 65 additions & 33 deletions

src/node_url.cc

Lines changed: 53 additions & 0 deletions

0 commit comments

Comments
 (0)