This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 254018

Summary: use 'sourceURL' feature to improve debugging of eval blocks
Product: javascript Reporter: David Konecny <dkonecny>
Component: DebuggerAssignee: Martin Entlicher <mentlicher>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P3    
Version: 8.1   
Hardware: PC   
OS: Linux   
Issue Type: DEFECT Exception Reporter:

Description David Konecny 2015-07-30 21:34:21 UTC
Run following code in CDT and make exception happen:

<!DOCTYPE html>
<html>
    <head>
        <script>
            function runme() {
                eval("//# sourceURL=some/path/magic.js\n alert('Ha! Take a look at CDT\\'s sources view (no domain node)');\n\n throw 'give me some error'; \n\n console.log('finished');");
            }
        </script>
    </head>
    <body>
        <h1 onclick="runme()">click me to reveal the magic</h1>
    </body>
</html>

Notice that in CDT when the exception line from some/path/magic.js is clicked then CDT opens a new editor window just with the code from the eval block.

Could we have the same in NetBeans please? Thanks.
Comment 1 David Konecny 2015-07-30 21:35:13 UTC
I should have said that "sourceURL=" comment is the key to enable this feature.
Comment 2 Martin Entlicher 2015-08-27 17:06:12 UTC
This is more like a defect. Because the sourceURL is interpreted by Chrome and a message with the appropriate file is send. We just need to recognize files that do not have absolute paths in the console logger.
Comment 3 Martin Entlicher 2015-08-28 07:58:21 UTC
Fixed by changeset:   291167:5beee90d9438
http://hg.netbeans.org/core-main/rev/5beee90d9438
Comment 4 Quality Engineering 2015-08-30 01:37:27 UTC
Integrated into 'main-silver', will be available in build *201508300002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/5beee90d9438
User: mentlicher@netbeans.org
Log: #254018: Find a Line reference for files with relative paths in stack trace.