@@ -221,7 +221,7 @@ void BindingData::CreatePerIsolateProperties(IsolateData* isolate_data,
221221 SetMethodNoSideEffect (isolate, target, " decodeUTF8" , DecodeUTF8);
222222 SetMethodNoSideEffect (isolate, target, " toASCII" , ToASCII);
223223 SetMethodNoSideEffect (isolate, target, " toUnicode" , ToUnicode);
224- SetMethodNoSideEffect (isolate, target, " decodeLatin1" , DecodeLatin1);
224+ // decodeLatin1 binding removed
225225 SetMethodNoSideEffect (
226226 isolate, target, " decodeWindows1252" , DecodeWindows1252);
227227}
@@ -241,55 +241,11 @@ void BindingData::RegisterTimerExternalReferences(
241241 registry->Register (DecodeUTF8);
242242 registry->Register (ToASCII);
243243 registry->Register (ToUnicode);
244- registry-> Register ( DecodeLatin1);
244+ // DecodeLatin1 registration removed
245245 registry->Register (DecodeWindows1252);
246246}
247247
248- void BindingData::DecodeLatin1 (const FunctionCallbackInfo<Value>& args) {
249- Environment* env = Environment::GetCurrent (args);
250-
251- CHECK_GE (args.Length (), 1 );
252- if (!(args[0 ]->IsArrayBuffer () || args[0 ]->IsSharedArrayBuffer () ||
253- args[0 ]->IsArrayBufferView ())) {
254- return node::THROW_ERR_INVALID_ARG_TYPE (
255- env->isolate (),
256- " The \" input\" argument must be an instance of ArrayBuffer, "
257- " SharedArrayBuffer, or ArrayBufferView." );
258- }
259-
260- bool ignore_bom = args[1 ]->IsTrue ();
261- bool has_fatal = args[2 ]->IsTrue ();
262-
263- ArrayBufferViewContents<uint8_t > buffer (args[0 ]);
264- const uint8_t * data = buffer.data ();
265- size_t length = buffer.length ();
266-
267- if (ignore_bom && length > 0 && data[0 ] == 0xFF ) {
268- data++;
269- length--;
270- }
271-
272- if (length == 0 ) {
273- return args.GetReturnValue ().SetEmptyString ();
274- }
275-
276- std::string result (length * 2 , ' \0 ' );
277-
278- size_t written = simdutf::convert_latin1_to_utf8 (
279- reinterpret_cast <const char *>(data), length, result.data ());
280-
281- if (has_fatal && written == 0 ) {
282- return node::THROW_ERR_ENCODING_INVALID_ENCODED_DATA (
283- env->isolate (), " The encoded data was not valid for encoding latin1" );
284- }
285-
286- std::string_view view (result.c_str (), written);
287-
288- Local<Value> ret;
289- if (ToV8Value (env->context (), view, env->isolate ()).ToLocal (&ret)) {
290- args.GetReturnValue ().Set (ret);
291- }
292- }
248+ // DecodeLatin1 implementation removed
293249
294250void BindingData::DecodeWindows1252 (const FunctionCallbackInfo<Value>& args) {
295251 Environment* env = Environment::GetCurrent (args);
0 commit comments