[Webkit-unassigned] [Bug 21262] New: JavaScript Debugger doesn't play nice with functions created with eval/(new Function())

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Sep 30 18:19:46 PDT 2008


https://bugs.webkit.org/show_bug.cgi?id=21262

           Summary: JavaScript Debugger doesn't play nice with functions
                    created with eval/(new Function())
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: Macintosh
               URL: http://280slides.com
        OS/Version: Mac OS X 10.5
            Status: UNCONFIRMED
          Severity: Normal
          Priority: P2
         Component: Web Inspector
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: rboucher at gmail.com


In Objective-J, we load all your code using XMLHTTPRequests.  This has the
advantage of letting us do import statements asynchronously, and not having to
worry about <script> tag placements.

In a desire to work well with the inspector, we specify a function name for
each function that we create, in the style of:

$ClassName__methodName_withUnderscores_forColons_

These are correctly displayed in stack traces in the web inspector debugger. 
Unfortunately, finding code, either to set a breakpoint on it, or to examine
the various methods in a stack trace, is difficult.

When we get the result of the import XHR, we evaluate it with new
Function(theCode) (see line 156 of evaluate.js if you're interested). In the
inspector, this results in a "(program)" entry in the source list.  Needless to
say, a hundred or so of these isn't very useful. Thankfully, the code search
mechanism will search and find inside these files, so we can set breakpoints
where we need to.  

When we encounter a stack trace, though, clicking on one of these methods in
the stack does not bring up the corresponding code.  The line numbers are
correct, but it just doesn't jump.  This means manually searching to find the
function, and then scanning for the right line, an annoying process. Clicking
on more traditionally imported code, like objj_msgSend, does the right thing
and jumps to that definition.

So, in summary, I'm talking about two issues,

1) eval'd code has no associated name in the file list

2) functions defined in eval'd code don't jump to their definitions when
clicked in the stack trace

The second one seems like something that should be relatively easy to fix, the
first is more interesting.  What I'd like is a mechanism for specifying the
name associated with this block of code. For example, some special api in eval
and new Function that would allow us to attach a name manually, since we know
the name of the file the code was imported from.

I'm open to other suggestions, but there doesn't seem to be any reasonable way
to try to automatically determine the information, and I know we're not the
only ones who would appreciate some functionality like this.


-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the webkit-unassigned mailing list