|
1 // Binary: cache/js-dbg-64-d066929dd830-linux |
|
2 // Flags: -m |
|
3 // |
|
4 function fnSupportsArrayIndexGettersOnObjects() { |
|
5 if (fnExists(Object.defineProperty)) { |
|
6 var obj = {}; |
|
7 Object.defineProperty(obj, "0", { |
|
8 get: function () { |
|
9 supportsArrayIndexGettersOnObjects = true; |
|
10 } |
|
11 }); |
|
12 var res = obj[0]; |
|
13 } |
|
14 return supportsArrayIndexGettersOnObjects; |
|
15 } |
|
16 function fnExists( /*arguments*/ ) { |
|
17 return true; |
|
18 } |
|
19 var ES5Harness = (function () { |
|
20 var $this = this; |
|
21 function registerTest(test) { |
|
22 if (!(test.precondition && !test.precondition())) { |
|
23 try { |
|
24 var res = test.test.call($this); |
|
25 } catch (e) {} |
|
26 } |
|
27 } |
|
28 return { |
|
29 registerTest: registerTest |
|
30 } |
|
31 })(); |
|
32 ES5Harness.registerTest({ |
|
33 test: function testcase() { |
|
34 function callbackfn(accum, val, idx, obj) { |
|
35 if (idx === 1 && val === 1) {} |
|
36 } |
|
37 var obj = { |
|
38 length: 10 |
|
39 }; |
|
40 Object.defineProperty(obj, "0", { |
|
41 get: function () { |
|
42 defineProperty(idx, idx, registerTest + ": }}}}}"); |
|
43 }, |
|
44 }); |
|
45 try { |
|
46 Array.prototype.reduce.call(obj, callbackfn, "initialValue"); |
|
47 } finally {} |
|
48 }, |
|
49 precondition: function prereq() { |
|
50 return fnExists(Array.prototype.reduce) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnObjects(); |
|
51 } |
|
52 }); |
|
53 ES5Harness.registerTest({ |
|
54 test: function testcase() { |
|
55 var obj = {}; |
|
56 Object.defineProperty(obj, "property", { |
|
57 configurable: new Date() |
|
58 }); |
|
59 }, |
|
60 precondition: function prereq() { |
|
61 return fnExists(gczeal(2)); |
|
62 } |
|
63 }); |