]> git.saurik.com Git - apple/javascriptcore.git/blob - tests/stress/get-by-id-throw-from-unexpected-getter-through-optimized-code-that-does-not-exit.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / get-by-id-throw-from-unexpected-getter-through-optimized-code-that-does-not-exit.js
1 function foo(o) {
2 return o.f;
3 }
4
5 noInline(foo);
6
7 function makeWithGetter() {
8 var o = {};
9 o.__defineGetter__("f", function() {
10 throw "hello";
11 });
12 return o;
13 }
14
15 for (var i = 0; i < 100000; ++i) {
16 var result = foo({f:23});
17 if (result != 23)
18 throw "Error: bad result: " + result;
19 result = foo({g:12, f:13});
20 if (result != 13)
21 throw "Error: bad result: " + result;
22 result = foo({g:12, h:13, f:14});
23 if (result != 14)
24 throw "Error: bad result: " + result;
25 }
26
27 var didThrow;
28 try {
29 foo(makeWithGetter());
30 } catch (e) {
31 didThrow = e;
32 }
33
34 if (didThrow != "hello")
35 throw "Error: didn't throw or threw wrong exception: " + didThrow;