@@ -162,7 +162,7 @@ uint64_t js::WasmReservedBytes() { return wasmReservedBytes; }
162
162
[[nodiscard]] static bool CheckArrayBufferTooLarge(JSContext* cx,
163
163
uint64_t nbytes) {
164
164
// Refuse to allocate too large buffers.
165
- if (MOZ_UNLIKELY(nbytes > ArrayBufferObject::MaxByteLength )) {
165
+ if (MOZ_UNLIKELY(nbytes > ArrayBufferObject::ByteLengthLimit )) {
166
166
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr,
167
167
JSMSG_BAD_ARRAY_LENGTH);
168
168
return false;
@@ -1488,7 +1488,7 @@ inline size_t ArrayBufferObject::associatedBytes() const {
1488
1488
}
1489
1489
1490
1490
void ArrayBufferObject::setByteLength(size_t length) {
1491
- MOZ_ASSERT(length <= ArrayBufferObject::MaxByteLength );
1491
+ MOZ_ASSERT(length <= ArrayBufferObject::ByteLengthLimit );
1492
1492
setFixedSlot(BYTE_LENGTH_SLOT, PrivateValue(length));
1493
1493
}
1494
1494
@@ -1594,7 +1594,7 @@ ArrayBufferObject* ArrayBufferObject::wasmGrowToPagesInPlace(
1594
1594
return nullptr;
1595
1595
}
1596
1596
MOZ_ASSERT(newPages <= wasm::MaxMemoryPages(t) &&
1597
- newPages.byteLength() <= ArrayBufferObject::MaxByteLength );
1597
+ newPages.byteLength() <= ArrayBufferObject::ByteLengthLimit );
1598
1598
1599
1599
// We have checked against the clamped maximum and so we know we can convert
1600
1600
// to byte lengths now.
@@ -1652,7 +1652,7 @@ ArrayBufferObject* ArrayBufferObject::wasmMovingGrowToPages(
1652
1652
return nullptr;
1653
1653
}
1654
1654
MOZ_ASSERT(newPages <= wasm::MaxMemoryPages(t) &&
1655
- newPages.byteLength() < ArrayBufferObject::MaxByteLength );
1655
+ newPages.byteLength() < ArrayBufferObject::ByteLengthLimit );
1656
1656
1657
1657
// We have checked against the clamped maximum and so we know we can convert
1658
1658
// to byte lengths now.
@@ -1847,7 +1847,7 @@ template <class ArrayBufferType, ArrayBufferObject::FillContents FillType>
1847
1847
ArrayBufferObject::createUninitializedBufferAndData(
1848
1848
JSContext* cx, size_t nbytes, AutoSetNewObjectMetadata&,
1849
1849
JS::Handle<JSObject*> proto) {
1850
- MOZ_ASSERT(nbytes <= ArrayBufferObject::MaxByteLength ,
1850
+ MOZ_ASSERT(nbytes <= ArrayBufferObject::ByteLengthLimit ,
1851
1851
"caller must validate the byte count it passes");
1852
1852
1853
1853
static_assert(std::is_same_v<ArrayBufferType, FixedLengthArrayBufferObject> ||
@@ -1898,7 +1898,7 @@ template <ArrayBufferObject::FillContents FillType>
1898
1898
ArrayBufferObject::createBufferAndData(
1899
1899
JSContext* cx, size_t nbytes, AutoSetNewObjectMetadata& metadata,
1900
1900
JS::Handle<JSObject*> proto /* = nullptr */) {
1901
- MOZ_ASSERT(nbytes <= ArrayBufferObject::MaxByteLength ,
1901
+ MOZ_ASSERT(nbytes <= ArrayBufferObject::ByteLengthLimit ,
1902
1902
"caller must validate the byte count it passes");
1903
1903
1904
1904
auto [buffer, data] =
@@ -1925,7 +1925,7 @@ ResizableArrayBufferObject::createBufferAndData(
1925
1925
JSContext* cx, size_t byteLength, size_t maxByteLength,
1926
1926
AutoSetNewObjectMetadata& metadata, Handle<JSObject*> proto) {
1927
1927
MOZ_ASSERT(byteLength <= maxByteLength);
1928
- MOZ_ASSERT(maxByteLength <= ArrayBufferObject::MaxByteLength ,
1928
+ MOZ_ASSERT(maxByteLength <= ArrayBufferObject::ByteLengthLimit ,
1929
1929
"caller must validate the byte count it passes");
1930
1930
1931
1931
// NOTE: The spec proposal for resizable ArrayBuffers suggests to use a
@@ -1958,7 +1958,7 @@ ResizableArrayBufferObject::createBufferAndData(
1958
1958
JSContext* cx, size_t newByteLength,
1959
1959
JS::Handle<ArrayBufferObject*> source) {
1960
1960
MOZ_ASSERT(!source->isDetached());
1961
- MOZ_ASSERT(newByteLength <= ArrayBufferObject::MaxByteLength ,
1961
+ MOZ_ASSERT(newByteLength <= ArrayBufferObject::ByteLengthLimit ,
1962
1962
"caller must validate the byte count it passes");
1963
1963
1964
1964
size_t sourceByteLength = source->byteLength();
@@ -2037,7 +2037,7 @@ ResizableArrayBufferObject::createBufferAndData(
2037
2037
JSContext* cx, size_t newByteLength,
2038
2038
JS::Handle<ArrayBufferObject*> source) {
2039
2039
MOZ_ASSERT(!source->isDetached());
2040
- MOZ_ASSERT(newByteLength <= ArrayBufferObject::MaxByteLength ,
2040
+ MOZ_ASSERT(newByteLength <= ArrayBufferObject::ByteLengthLimit ,
2041
2041
"caller must validate the byte count it passes");
2042
2042
2043
2043
if (newByteLength > FixedLengthArrayBufferObject::MaxInlineBytes &&
@@ -2103,7 +2103,7 @@ ResizableArrayBufferObject::createBufferAndData(
2103
2103
MOZ_ASSERT(source->bufferKind() == MALLOCED_ARRAYBUFFER_CONTENTS_ARENA);
2104
2104
MOZ_ASSERT(newByteLength > FixedLengthArrayBufferObject::MaxInlineBytes,
2105
2105
"prefer copying small buffers");
2106
- MOZ_ASSERT(newByteLength <= ArrayBufferObject::MaxByteLength ,
2106
+ MOZ_ASSERT(newByteLength <= ArrayBufferObject::ByteLengthLimit ,
2107
2107
"caller must validate the byte count it passes");
2108
2108
2109
2109
size_t oldByteLength = source->associatedBytes();
0 commit comments