summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Function/prototype/apply/get-index-abrupt.js
blob: 56c9c95d895f58451ae2eeac88b284917aa4c0a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Copyright 2019 Aleksey Shvayka. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-function.prototype.apply
description: >
  Return abrupt completion from Get(obj, indexName)
info: |
  Function.prototype.apply ( thisArg, argArray )

  [...]
  4. Let argList be ? CreateListFromArrayLike(argArray).

  CreateListFromArrayLike ( obj [ , elementTypes ] )

  [...]
  6. Repeat, while index < len
    a. Let indexName be ! ToString(index).
    b. Let next be ? Get(obj, indexName).
---*/

var arrayLike = {
  length: 2,
  0: 0,
  get 1() {
    throw new Test262Error();
  },
};

assert.throws(Test262Error, function() {
  (function() {}).apply(null, arrayLike);
});

reportCompare(0, 0);