mirror of
https://github.com/nodejs/node.git
synced 2026-11-21 12:59:16 -05:00
The ES addition operator calls the ToPrimitive() abstract operation
without hint String, leading a subsequent OrdinaryToPrimitive() to call
valueOf() first on an object rather than the desired toString().
Instead, use template literals which directly call ToString() abstract
operation, per Web IDL spec.
PR-URL: https://github.com/nodejs/node/pull/11737
Fixes: b610a4db1c "url: enforce valid UTF-8 in WHATWG parser"
Refs: https://github.com/nodejs/node/commit/b610a4db1c2919f88711962f5797f25ecb1cd36b#commitcomment-21200056
Refs: https://tc39.github.io/ecma262/#sec-addition-operator-plus-runtime-semantics-evaluation
Refs: https://tc39.github.io/ecma262/#sec-template-literals-runtime-semantics-evaluation
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Internal Modules
The modules in lib/internal are intended for internal use in Node.js core only, and are not accessible with require() from user modules.
These are subject to change at any time. Reliance on these modules outside of core is not supported in any way.