]> git.saurik.com Git - apple/javascriptcore.git/blame - 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
CommitLineData
81345200
A
1function foo(o) {
2 return o.f;
3}
4
5noInline(foo);
6
7function makeWithGetter() {
8 var o = {};
9 o.__defineGetter__("f", function() {
10 throw "hello";
11 });
12 return o;
13}
14
15for (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
27var didThrow;
28try {
29 foo(makeWithGetter());
30} catch (e) {
31 didThrow = e;
32}
33
34if (didThrow != "hello")
35 throw "Error: didn't throw or threw wrong exception: " + didThrow;