summaryrefslogtreecommitdiff
path: root/test/built-ins/TypedArrays/internals/HasProperty
diff options
context:
space:
mode:
authorjugglinmike <mike@mikepennisi.com>2016-10-24 13:43:17 -0400
committerTom Care <tcare@microsoft.com>2016-10-24 10:43:17 -0700
commit71e573f7da56d6ce36481abdd7a986267c650970 (patch)
tree1a32d0e78937c4a8756d93b946825479f0c6825b /test/built-ins/TypedArrays/internals/HasProperty
parentf39b7cfb7a7c5efbfc3757326ed043bed6ff0c98 (diff)
downloadqtdeclarative-testsuites-71e573f7da56d6ce36481abdd7a986267c650970.tar.gz
Add tests for realm interactions (#688)
* Add tests for prototype realm inference * Add tests for miscellaneous realm concerns * Add tests for realm of spec-created Errors In some cases, Error objects produced by the specification are observable from ECMAScript code. Among these cases, some are further differentiated in that they occur outside of any built-in function and may be triggered through syntactic production directly. The current realm record is commonly interpreted incorrectly under these circumstances. Add tests asserting that the expected realm record is used when constructing such Error objects. * Add tests for realm use in ArraySpeciesCreate * Add tests for function realm retrieval * Add tests for cross-realm behaviors of Symbols * Add tests for GetValue and PutValue * Add tests for realm of spec-created Arrays In some cases, Arrays produced by CreateArrayFromList are observable from ECMAScript code. Among these cases, two occur outside of any built-in function and may be triggered through syntactic production directly. The current realm record is commonly interpreted incorrectly under these circumstances. Add tests asserting that the expected realm record is used when constructing arrays. * Add test for spec-created object * fixup! Add tests for realm of spec-created Errors * fixup! Add tests for realm of spec-created Errors * fixup! Add tests for prototype realm inference * fixup! Add tests for miscellaneous realm concerns
Diffstat (limited to 'test/built-ins/TypedArrays/internals/HasProperty')
-rw-r--r--test/built-ins/TypedArrays/internals/HasProperty/detached-buffer-realm.js33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/built-ins/TypedArrays/internals/HasProperty/detached-buffer-realm.js b/test/built-ins/TypedArrays/internals/HasProperty/detached-buffer-realm.js
new file mode 100644
index 000000000..9b1b5eb3c
--- /dev/null
+++ b/test/built-ins/TypedArrays/internals/HasProperty/detached-buffer-realm.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-integer-indexed-exotic-objects-hasproperty-p
+description: >
+ Throws a TypeError if this has a detached buffer (honoring the Realm of the
+ current execution context)
+info: >
+ 9.4.5.2 [[HasProperty]](P)
+
+ ...
+ 3. If Type(P) is String, then
+ a. Let numericIndex be ! CanonicalNumericIndexString(P).
+ b. If numericIndex is not undefined, then
+ i. Let buffer be the value of O's [[ViewedArrayBuffer]] internal slot.
+ ii. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
+ ...
+features: [Reflect]
+includes: [testTypedArray.js, detachArrayBuffer.js]
+---*/
+
+var other = $.createRealm().global;
+
+testWithTypedArrayConstructors(function(TA) {
+ var OtherTA = other[TA.name];
+ var sample = new OtherTA(1);
+
+ $DETACHBUFFER(sample.buffer);
+
+ assert.throws(TypeError, function() {
+ Reflect.has(sample, '0');
+ }, '0');
+});