fix test-buffer-indexof.js

This commit is contained in:
Meghan Denny
2024-12-13 02:35:49 -08:00
parent 1cf31b8488
commit e49cc4dcbf
4 changed files with 772 additions and 87 deletions

View File

@@ -459,6 +459,13 @@ JSC_DEFINE_HOST_FUNCTION(jsFunction_validateBuffer, (JSC::JSGlobalObject * globa
auto buffer = callFrame->argument(0);
auto name = callFrame->argument(1);
return V::validateBuffer(scope, globalObject, buffer, name);
}
JSC::EncodedJSValue V::validateBuffer(JSC::ThrowScope& scope, JSC::JSGlobalObject* globalObject, JSValue buffer, JSValue name)
{
JSC::VM& vm = globalObject->vm();
if (name.isUndefined()) name = jsString(vm, String("buffer"_s));
if (!buffer.isCell()) return JSValue::encode(jsUndefined());
auto ty = buffer.asCell()->type();