LibJS+LibWeb: Allow instantiating DataBlock with an external buffer

This requires the minimal API exposed by ByteBuffer, allowing external
users to implement them as needed instead of being forced to use a
ByteBuffer.
This commit is contained in:
Ali Mohammad Pur
2026-04-04 19:25:48 +02:00
committed by Ali Mohammad Pur
parent 0a7bef349d
commit 0bb987e809
Notes: github-actions[bot] 2026-05-10 14:43:40 +00:00
22 changed files with 163 additions and 68 deletions

View File

@@ -92,9 +92,9 @@ static ::Crypto::UnsignedBigInteger big_integer_from_api_big_integer(GC::Ptr<JS:
// (that is, at most 7 leading zero bits, except the value 0 which shall have length 8 bits).
// The API SHALL accept values with any number of leading zero bits, including the empty array, which represents zero.
auto const& buffer = big_integer->viewed_array_buffer()->buffer();
auto buffer = big_integer->viewed_array_buffer()->bytes();
if (buffer.size() > 0)
if (!buffer.is_empty())
return ::Crypto::UnsignedBigInteger::import_data(buffer);
return ::Crypto::UnsignedBigInteger(0);
}