mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 22:37:34 +00:00
test-js: Define detachArrayBuffer global function
This commit is contained in:
parent
13d05403ff
commit
d04a683f85
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
Add a link
Reference in a new issue