Bug 1423878: Remove check for detached ArrayBuffer before CloneArrayBuffer per ES2018. r=jandem

This commit is contained in:
André Bargull 2017-12-07 05:25:20 -08:00
parent d59edfc08b
commit ca93312f36

View File

@ -1206,16 +1206,10 @@ TypedArrayObjectTemplate<T>::fromTypedArray(JSContext* cx, HandleObject other, b
// Steps 8, 18-19.
Rooted<ArrayBufferObject*> buffer(cx);
if (ArrayTypeID() == srcType) {
// Step 18.a.
if (srcArray->hasDetachedBuffer()) {
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_TYPED_ARRAY_DETACHED);
return nullptr;
}
// Step 15.
uint32_t byteLength = srcArray->byteLength();
// Step 18.b.
// Step 18.a.
// 24.1.1.4 CloneArrayBuffer(...), steps 1-3.
if (!AllocateArrayBuffer(cx, bufferCtor, byteLength, 1, &buffer))
return nullptr;