mirror of
https://github.com/denoland/deno.git
synced 2025-09-26 12:19:12 +00:00
refactor(web): use encoding_rs for text encoding (#10844)
This commit removes all JS based text encoding / text decoding. Instead encoding now happens in Rust via encoding_rs (already in tree). This implementation retains stream support, but adds the last missing encodings. We are incredibly close to 100% WPT on text encoding now. This should reduce our baseline heap by quite a bit.
This commit is contained in:
parent
bb0c90cadb
commit
c73ef5fa14
27 changed files with 641 additions and 4705 deletions
|
@ -16,6 +16,8 @@ delete Object.prototype.__proto__;
|
|||
const errorStack = window.__bootstrap.errorStack;
|
||||
const os = window.__bootstrap.os;
|
||||
const timers = window.__bootstrap.timers;
|
||||
const base64 = window.__bootstrap.base64;
|
||||
const encoding = window.__bootstrap.encoding;
|
||||
const Console = window.__bootstrap.console.Console;
|
||||
const worker = window.__bootstrap.worker;
|
||||
const signals = window.__bootstrap.signals;
|
||||
|
@ -198,6 +200,12 @@ delete Object.prototype.__proto__;
|
|||
return new DOMException(msg, "NotSupported");
|
||||
},
|
||||
);
|
||||
core.registerErrorBuilder(
|
||||
"DOMExceptionInvalidCharacterError",
|
||||
function DOMExceptionInvalidCharacterError(msg) {
|
||||
return new DOMException(msg, "InvalidCharacterError");
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
class Navigator {
|
||||
|
@ -277,8 +285,8 @@ delete Object.prototype.__proto__;
|
|||
),
|
||||
Request: util.nonEnumerable(fetch.Request),
|
||||
Response: util.nonEnumerable(fetch.Response),
|
||||
TextDecoder: util.nonEnumerable(TextDecoder),
|
||||
TextEncoder: util.nonEnumerable(TextEncoder),
|
||||
TextDecoder: util.nonEnumerable(encoding.TextDecoder),
|
||||
TextEncoder: util.nonEnumerable(encoding.TextEncoder),
|
||||
TransformStream: util.nonEnumerable(streams.TransformStream),
|
||||
URL: util.nonEnumerable(url.URL),
|
||||
URLSearchParams: util.nonEnumerable(url.URLSearchParams),
|
||||
|
@ -295,8 +303,8 @@ delete Object.prototype.__proto__;
|
|||
TransformStreamDefaultController: util.nonEnumerable(
|
||||
streams.TransformStreamDefaultController,
|
||||
),
|
||||
atob: util.writable(atob),
|
||||
btoa: util.writable(btoa),
|
||||
atob: util.writable(base64.atob),
|
||||
btoa: util.writable(base64.btoa),
|
||||
clearInterval: util.writable(timers.clearInterval),
|
||||
clearTimeout: util.writable(timers.clearTimeout),
|
||||
console: util.writable(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue