Skip to content

Commit 36aefe4

Browse files
iamstoliswoess
authored andcommitted
ArrayBufferView with a detached buffer does not have indices.
1 parent 64e5b6a commit 36aefe4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

graal-js/src/com.oracle.truffle.js/src/com/oracle/truffle/js/runtime/builtins/JSArrayBufferView.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,8 +441,11 @@ public List<Object> getOwnPropertyKeys(JSDynamicObject thisObj, boolean strings,
441441
if (!strings) {
442442
return super.getOwnPropertyKeys(thisObj, strings, symbols);
443443
}
444-
List<Object> indices = typedArrayGetArrayType(thisObj).ownPropertyKeys(thisObj);
445444
List<Object> keys = ordinaryOwnPropertyKeys(thisObj, strings, symbols);
445+
if (hasDetachedBuffer(thisObj)) {
446+
return keys;
447+
}
448+
List<Object> indices = typedArrayGetArrayType(thisObj).ownPropertyKeys(thisObj);
446449
return IteratorUtil.concatLists(indices, keys);
447450
}
448451

0 commit comments

Comments
 (0)