LibJS: Prefer Value::to_string() over to_byte_string() in more places

We should always prefer working with String, and Value::to_string() may
even return a cached String if the Value refers to a primitive string,
but no caching occurs for ByteString.
This commit is contained in:
Andreas Kling 2025-03-16 17:44:29 -05:00 committed by Andreas Kling
parent 8155377b5f
commit e83a2c2369
Notes: github-actions[bot] 2025-03-24 22:28:59 +00:00
6 changed files with 15 additions and 17 deletions

View file

@ -21,7 +21,7 @@ TESTJS_GLOBAL_FUNCTION(read_binary_wasm_file, readBinaryWasmFile)
return StringView { error_string, strlen(error_string) };
};
auto filename = TRY(vm.argument(0).to_byte_string(vm));
auto filename = TRY(vm.argument(0).to_string(vm));
auto file = Core::File::open(filename, Core::File::OpenMode::Read);
if (file.is_error())
return vm.throw_completion<JS::TypeError>(error_code_to_string(file.error().code()));