summaryrefslogtreecommitdiff
path: root/test/built-ins/Array/prototype/every/15.4.4.16-7-c-i-6.js
blob: a7dc6772abc90d9913400f29cbfcf7d1c555b607 (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 (c) 2012 Ecma International.  All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
es5id: 15.4.4.16-7-c-i-6
description: >
    Array.prototype.every - element to be retrieved is own data
    property that overrides an inherited accessor property on an Array
includes: [runTestCase.js]
---*/

function testcase() {

        var accessed = false;

        function callbackfn(val, idx, obj) {
            accessed = true;
            return val === 11;
        }

        try {
            Object.defineProperty(Array.prototype, "0", {
                get: function () {
                    return 9;
                },
                configurable: true
            });
            return [11].every(callbackfn) && accessed;
        } finally {
            delete Array.prototype[0];
        }
    }
runTestCase(testcase);