Skip to content

Commit ea7cc54

Browse files
committed
ArrayBuffer.prototype.byteLength should handle detached interop array buffer.
1 parent c709030 commit ea7cc54

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

graal-js/src/com.oracle.truffle.js/src/com/oracle/truffle/js/builtins/ArrayBufferPrototypeBuiltins.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,9 @@ protected int directArrayBuffer(Object thisObj) {
140140
protected int interopArrayBuffer(Object thisObj,
141141
@CachedLibrary(limit = "InteropLibraryLimit") InteropLibrary interop) {
142142
Object buffer = JSArrayBuffer.getInteropBuffer(thisObj);
143+
if (!getContext().getTypedArrayNotDetachedAssumption().isValid() && buffer == null) {
144+
return handleDetachedBuffer();
145+
}
143146
try {
144147
long bufferSize = interop.getBufferSize(buffer);
145148
// Buffer size was already checked in the ArrayBuffer constructor.

0 commit comments

Comments
 (0)