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