Bug 1317394 - Make DataView getters throw for detached array buffers in Nightly. r=anba

This commit is contained in:
Tom Schuster 2017-09-11 18:35:00 +02:00
parent a322b42abf
commit 8468764895
2 changed files with 22 additions and 2 deletions

View File

@ -887,6 +887,16 @@ bool
DataViewObject::byteLengthGetterImpl(JSContext* cx, const CallArgs& args)
{
Rooted<DataViewObject*> thisView(cx, &args.thisv().toObject().as<DataViewObject>());
#ifdef NIGHTLY_BUILD
// Step 6,
if (thisView->arrayBufferEither().isDetached()) {
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_TYPED_ARRAY_DETACHED);
return false;
}
#endif
// Step 7.
args.rval().set(DataViewObject::byteLengthValue(thisView));
return true;
}
@ -902,6 +912,16 @@ bool
DataViewObject::byteOffsetGetterImpl(JSContext* cx, const CallArgs& args)
{
Rooted<DataViewObject*> thisView(cx, &args.thisv().toObject().as<DataViewObject>());
#ifdef NIGHTLY_BUILD
// Step 6,
if (thisView->arrayBufferEither().isDetached()) {
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_TYPED_ARRAY_DETACHED);
return false;
}
#endif
// Step 7.
args.rval().set(DataViewObject::byteOffsetValue(thisView));
return true;
}

View File

@ -296,8 +296,8 @@ skip script test262/built-ins/WeakSet/proto-from-ctor-realm.js
skip script test262/built-ins/ArrayBuffer/prototype/byteLength/detached-buffer.js
# https://bugzilla.mozilla.org/show_bug.cgi?id=1317394
skip script test262/built-ins/DataView/prototype/byteOffset/detached-buffer.js
skip script test262/built-ins/DataView/prototype/byteLength/detached-buffer.js
skip-if(release_or_beta) script test262/built-ins/DataView/prototype/byteOffset/detached-buffer.js
skip-if(release_or_beta) script test262/built-ins/DataView/prototype/byteLength/detached-buffer.js
# We're still waiting for a final decision on https://github.com/tc39/ecma402/pull/84.
skip script test262/intl402/Collator/10.1.1_1.js