mirror of
https://github.com/denoland/deno.git
synced 2024-10-29 08:58:01 -04:00
perf: don't double convert to USVString for TextEncoder (#11297)
This works since both core.encode and the ops bindings to a Rust String will already replace any lone surrogates with the replacement character.
This commit is contained in:
parent
570309d795
commit
f139a0cc11
1 changed files with 6 additions and 2 deletions
|
@ -141,7 +141,9 @@
|
|||
encode(input = "") {
|
||||
webidl.assertBranded(this, TextEncoder);
|
||||
const prefix = "Failed to execute 'encode' on 'TextEncoder'";
|
||||
input = webidl.converters.USVString(input, {
|
||||
// The WebIDL type of `input` is `USVString`, but `core.encode` already
|
||||
// converts lone surrogates to the replacement character.
|
||||
input = webidl.converters.DOMString(input, {
|
||||
prefix,
|
||||
context: "Argument 1",
|
||||
});
|
||||
|
@ -156,7 +158,9 @@
|
|||
encodeInto(source, destination) {
|
||||
webidl.assertBranded(this, TextEncoder);
|
||||
const prefix = "Failed to execute 'encodeInto' on 'TextEncoder'";
|
||||
source = webidl.converters.USVString(source, {
|
||||
// The WebIDL type of `source` is `USVString`, but the ops bindings
|
||||
// already convert lone surrogates to the replacement character.
|
||||
source = webidl.converters.DOMString(source, {
|
||||
prefix,
|
||||
context: "Argument 1",
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue