Putting a breakpoint in dynamically generated JS does not always break?

28 views
Skip to first unread message

Dhruva Ray

unread,
May 13, 2013, 5:01:46 AM5/13/13
to fir...@googlegroups.com
Hi

See this sample file

<!DOCTYPE html>
<html>
<head>
    <title></title>
    <script>
        var foo = Function("a","b","debugger;console.log(arguments);");
        foo(1,2);
    </script>
</head>
<body>

</body>
</html>

When the dynamically generated function foo is called, it does not break into the debugger. Am I missing something? 

Regards,
Dhruva Ray


Dhruva Ray

unread,
May 13, 2013, 5:03:53 AM5/13/13
to fir...@googlegroups.com
Interestingly, If I split it up between 2 script blocks, the debugger breaks. Can someone please explain why?

<!DOCTYPE html>
<html>
<head>
    <title></title>
    <script>
        var foo = Function("a","b","debugger;console.log(arguments);");
    </script>

    <script>
        foo(1,2);
    </script>

</head>
<body>

</body>
</html>

Regards,
Dhruva Ray

Sebastian Zartner

unread,
May 13, 2013, 6:26:12 AM5/13/13
to fir...@googlegroups.com
Thanks for the test cases.
Looks like this is related to issue 312.

Sebastian
Reply all
Reply to author
Forward
0 new messages