diff options
author | Divy Srivastava <dj.srivastava23@gmail.com> | 2024-08-06 00:40:17 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-06 07:40:17 +0000 |
commit | 696d528641ed6e03cf64daaee48bcc7c3fc8b89f (patch) | |
tree | a4d41276bdbeca39027588a9ec8e2719487c28b5 /ext/web/08_text_encoding.js | |
parent | ba40347a35d10cffeae83ee95f69f7bc281096dd (diff) |
fix(ext/web): make TextDecoderResource use cppgc (#24888)
Fixes https://github.com/denoland/deno/issues/24878
Diffstat (limited to 'ext/web/08_text_encoding.js')
-rw-r--r-- | ext/web/08_text_encoding.js | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/ext/web/08_text_encoding.js b/ext/web/08_text_encoding.js index 9920a81f8..3163c9628 100644 --- a/ext/web/08_text_encoding.js +++ b/ext/web/08_text_encoding.js @@ -56,8 +56,8 @@ class TextDecoder { /** @type {boolean} */ #utf8SinglePass; - /** @type {number | null} */ - #rid = null; + /** @type {object | null} */ + #handle = null; /** * @param {string} label @@ -159,7 +159,7 @@ class TextDecoder { } // Fast path for single pass encoding. - if (!stream && this.#rid === null) { + if (!stream && this.#handle === null) { // Fast path for utf8 single pass encoding. if (this.#utf8SinglePass) { return op_encoding_decode_utf8(input, this.#ignoreBOM); @@ -173,18 +173,17 @@ class TextDecoder { ); } - if (this.#rid === null) { - this.#rid = op_encoding_new_decoder( + if (this.#handle === null) { + this.#handle = op_encoding_new_decoder( this.#encoding, this.#fatal, this.#ignoreBOM, ); } - return op_encoding_decode(input, this.#rid, stream); + return op_encoding_decode(input, this.#handle, stream); } finally { - if (!stream && this.#rid !== null) { - core.close(this.#rid); - this.#rid = null; + if (!stream && this.#handle !== null) { + this.#handle = null; } } } |