Closed Bug 1317395 Opened 8 years ago Closed 3 years ago

ArrayBuffer.prototype.byteLength should throw when the buffer is detached

Categories

(Core :: JavaScript: Standard Library, defect, P3)

defect

Tracking

()

RESOLVED INVALID
Tracking Status
firefox53 --- affected

People

(Reporter: anba, Unassigned)

References

(Blocks 1 open bug)

Details

Test case:
---
var ab = new ArrayBuffer(10);
detachArrayBuffer(ab);
ab.byteLength;
---

Expected: Throws TypeError
Actual: No exception thrown


Also see bug 1079853.
Priority: -- → P3

https://github.com/tc39/ecma262/issues/678 has now been resolved in favor of not throwing and returning +0.

would this work?

In the line after JS_FRIEND_API uint32_t JS::GetArrayBufferByteLength(JSObject* obj)
https://searchfox.org/mozilla-central/source/js/src/vm/ArrayBufferObject.cpp#1672

if (IsDetachedArrayBufferObject(JSObject* obj); return 0; ?
https://searchfox.org/mozilla-central/source/js/public/ArrayBuffer.h#167

This is actually no longer a valid bug, ArrayBuffer.prototype.byteLength has been changed to match our implementation. I'll close this bug.

Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.