summaryrefslogtreecommitdiff
path: root/js/src/jit-test/tests/basic/testNestedEscapingLambdas.js
blob: 8b896f19363397409e711ecf1d4bd335c3756977 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
function testNestedEscapingLambdas()
{
    try {
        return (function() {
            var a = [], r = [];
            function setTimeout(f, t) {
                a.push(f);
            }

            function runTimeouts() {
                for (var i = 0; i < a.length; i++)
                    a[i]();
            }

            var $foo = "#nothiddendiv";
            setTimeout(function(){
                r.push($foo);
                setTimeout(function(){
                    r.push($foo);
                }, 100);
            }, 100);

            runTimeouts();

            return r.join("");
        })();
    } catch (e) {
        return e;
    }
}
assertEq(testNestedEscapingLambdas(), "#nothiddendiv#nothiddendiv");