mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-23 13:05:12 +00:00
test-js: Define detachArrayBuffer global function
This commit is contained in:
parent
13d05403ff
commit
d04a683f85
Notes:
sideshowbarker
2024-07-18 01:43:16 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/d04a683f85 Pull-request: https://github.com/SerenityOS/serenity/pull/13559 Reviewed-by: https://github.com/linusg ✅
1 changed files with 11 additions and 0 deletions
|
@ -5,6 +5,7 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibJS/Runtime/ArrayBuffer.h>
|
||||
#include <LibTest/JavaScriptTestRunner.h>
|
||||
|
||||
TEST_ROOT("Userland/Libraries/LibJS/Tests");
|
||||
|
@ -76,6 +77,16 @@ TESTJS_GLOBAL_FUNCTION(mark_as_garbage, markAsGarbage)
|
|||
return JS::js_undefined();
|
||||
}
|
||||
|
||||
TESTJS_GLOBAL_FUNCTION(detach_array_buffer, detachArrayBuffer)
|
||||
{
|
||||
auto array_buffer = vm.argument(0);
|
||||
if (!array_buffer.is_object() || !is<JS::ArrayBuffer>(array_buffer.as_object()))
|
||||
return vm.throw_completion<JS::TypeError>(global_object, JS::ErrorType::NotAnObjectOfType, "ArrayBuffer");
|
||||
|
||||
auto& array_buffer_object = static_cast<JS::ArrayBuffer&>(array_buffer.as_object());
|
||||
return JS::detach_array_buffer(global_object, array_buffer_object, vm.argument(1));
|
||||
}
|
||||
|
||||
TESTJS_RUN_FILE_FUNCTION(String const& test_file, JS::Interpreter& interpreter, JS::ExecutionContext&)
|
||||
{
|
||||
if (!test262_parser_tests)
|
||||
|
|
Loading…
Add table
Reference in a new issue