Bug 1892041 - Part 2: Update test262. r=spidermonkey-reviewers,dminor
[gecko.git] / js / src / tests / test262 / built-ins / TypedArrayConstructors / ctors / length-arg / custom-proto-access-throws.js
blobd8808efd52b50ac729cbc39f4e3f9875f9506334
1 // Copyright (C) 2016 the V8 project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 esid: sec-typedarray-length
5 description: >
6   Return abrupt completion getting newTarget's prototype
7 info: |
8   22.2.4.2 TypedArray ( length )
10   This description applies only if the TypedArray function is called with at
11   least one argument and the Type of the first argument is not Object.
13   ...
14   8. Return ? AllocateTypedArray(constructorName, NewTarget,
15   %TypedArrayPrototype%, elementLength).
17   22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget,
18   defaultProto [ , length ])
20   1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto).
21   ...
23   9.1.15 GetPrototypeFromConstructor ( constructor, intrinsicDefaultProto )
25   ...
26   3. Let proto be ? Get(constructor, "prototype").
27   ...
28 includes: [testTypedArray.js]
29 features: [Reflect, TypedArray]
30 ---*/
32 var newTarget = function() {}.bind(null);
33 Object.defineProperty(newTarget, "prototype", {
34   get() {
35     throw new Test262Error();
36   }
37 });
39 testWithTypedArrayConstructors(function(TA) {
40   assert.throws(Test262Error, function() {
41     Reflect.construct(TA, [1], newTarget);
42   });
43 });
45 reportCompare(0, 0);