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.
1 function testAddInconvertibleObjectAny()
2 {
3 var count = 0;
4 function toString()
5 {
6 ++count;
7 if (count == 95)
8 return {};
9 return "" + count;
10 }
11 var o = {valueOf: undefined, toString: toString};
13 var threw = false;
14 try
15 {
16 for (var i = 0; i < 100; i++)
17 var q = o + 5;
18 }
19 catch (e)
20 {
21 threw = true;
22 if (i !== 94)
23 return "expected i === 94, got " + i;
24 if (q !== "945")
25 return "expected q === '945', got " + q + " (type " + typeof q + ")";
26 if (count !== 95)
27 return "expected count === 95, got " + count;
28 }
29 if (!threw)
30 return "expected throw with o + 5";
32 return "pass";
33 }
34 assertEq(testAddInconvertibleObjectAny(), "pass");