blob: 1d2a6bc3a098a532e00d6cf510c7c14c715e9b8d (
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
34
35
36
37
|
// Copyright (c) 2012 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 15.4.4.21-8-c-6
description: >
Array.prototype.reduce - if exception occurs, it occurs after any
side-effects that might be produced by step 3
includes: [runTestCase.js]
---*/
function testcase() {
var obj = {};
var accessed = false;
Object.defineProperty(obj, "length", {
get: function () {
return {
toString: function () {
accessed = true;
return "2";
}
};
},
configurable: true
});
try {
Array.prototype.reduce.call(obj, function () { });
return false;
} catch (ex) {
return (ex instanceof TypeError) && accessed;
}
}
runTestCase(testcase);
|