mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-02 04:27:12 +02:00
LibJS: Handle possible allocation failure in ArrayBuffer(size_t)
...by replacing it with a ctor that takes the buffer instead, and handling the allocation failure in ArrayBuffer::create(size_t) by throwing a RangeError as specified by the spec.
This commit is contained in:
committed by
Andreas Kling
parent
d20fc922c5
commit
7589cc2494
Notes:
sideshowbarker
2024-07-18 04:39:32 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/7589cc2494c Pull-request: https://github.com/SerenityOS/serenity/pull/9832 Reviewed-by: https://github.com/IdanHo
@@ -60,7 +60,11 @@ Value ArrayBufferConstructor::construct(FunctionObject&)
|
||||
}
|
||||
return {};
|
||||
}
|
||||
return ArrayBuffer::create(global_object(), byte_length);
|
||||
auto array_buffer = ArrayBuffer::create(global_object(), byte_length);
|
||||
if (!array_buffer)
|
||||
return {};
|
||||
|
||||
return array_buffer;
|
||||
}
|
||||
|
||||
// 25.1.4.1 ArrayBuffer.isView ( arg ), https://tc39.es/ecma262/#sec-arraybuffer.isview
|
||||
|
||||
Reference in New Issue
Block a user