summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Runtime/ArrayBuffer.h
diff options
context:
space:
mode:
authorForLoveOfCats <floc@unpromptedtirade.com>2022-02-19 23:31:59 -0500
committerLinus Groh <mail@linusgroh.de>2022-03-02 20:53:18 +0100
commite01ee4e30b71e490743d7d67477c294c7e7fab02 (patch)
treeef97cf8c940daffcac29dce965d04f2edc405ced /Userland/Libraries/LibJS/Runtime/ArrayBuffer.h
parente8416b603fafa59caf87c5b73ceda54a33d2bb7b (diff)
downloadserenity-e01ee4e30b71e490743d7d67477c294c7e7fab02.zip
LibJS: Construct ArrayBuffer with max byte length when provided
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime/ArrayBuffer.h')
-rw-r--r--Userland/Libraries/LibJS/Runtime/ArrayBuffer.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/ArrayBuffer.h b/Userland/Libraries/LibJS/Runtime/ArrayBuffer.h
index 642eb900d3..3ef6c8df53 100644
--- a/Userland/Libraries/LibJS/Runtime/ArrayBuffer.h
+++ b/Userland/Libraries/LibJS/Runtime/ArrayBuffer.h
@@ -39,6 +39,7 @@ public:
// Used by allocate_array_buffer() to attach the data block after construction
void set_buffer(ByteBuffer buffer) { m_buffer = move(buffer); }
+ void set_max_byte_length(size_t max_byte_length) { m_max_byte_length = max_byte_length; }
Value detach_key() const { return m_detach_key; }
void set_detach_key(Value detach_key) { m_detach_key = detach_key; }
@@ -73,6 +74,7 @@ private:
// The various detach related members of ArrayBuffer are not used by any ECMA262 functionality,
// but are required to be available for the use of various harnesses like the Test262 test runner.
Value m_detach_key;
+ Optional<size_t> m_max_byte_length;
};
ThrowCompletionOr<ArrayBuffer*> allocate_array_buffer(GlobalObject&, FunctionObject& constructor, size_t byte_length, Optional<size_t> max_byte_length = {});