Opened 8 years ago

Closed 4 years ago

#14208 closed defect (patchwelcome)

ContentPane: firebug shows a correct line number and incorrect (parent) file name in reporting a JavaScript error when a script is loaded dynamically with Dojo Toolkit

Reported by: nsharrok Owned by:
Priority: low Milestone: 1.13
Component: DojoX Layout Version: 1.6.1
Keywords: Cc:
Blocked By: Blocking:

Description

Steps to reproduce:

I used the Dojo Toolkit to develop a tab based tool for project management. The site dynamically loaded the content for each tab on demand and executed any script found. I found issues with error reporting.

I reported the issue to Fiebug http://code.google.com/p/fbug/issues/detail?id=4145 but they refereed it back to Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=699179

Actual results: When JavaScript? Errors were reported they showed the correct line number and type of error. However the line of script displayed in Firebug was from the parent file also the file name was the parent file name.

A test case is attached.

Expected results: I would have expected that the correct source was identified or if that was not possible then not displaying incorrect source information.

Attachments (1)

console_bug.zip (17.0 KB) - added by nsharrok 8 years ago.

Download all attachments as: .zip

Change History (6)

Changed 8 years ago by nsharrok

Attachment: console_bug.zip added

comment:1 Changed 8 years ago by nsharrok

It seems that I need to get a three way conversation going between Bugzilla, yourselves and the folk at Firebug to help resolve this one.

Boris Zbarsky (:bz) form Bugzilla said

"What Dojo does in this case is to grab the text contents of contentPane.html and then parse it or something, extract the contents of the <script> and then createElement("script") in the main page, stick that text inside it, and put it in the DOM.

So from our point of view, the script is in fact running in issue4145.html and we have no way to tell where the text came from.

In any case, the file name is correct: it's an inline script in issue4145.html.

The line number is somewhat bogus: it's the offset of the line in that <script> tag, because we don't have a line number for the script tag. We could just display no line number at all, but it seems like displaying _something_ that can help debug is better than just being completely silent.

The ideal thing here would be if dojo added source notes indicating where it got the script text, of course."

comment:2 Changed 8 years ago by bill

Milestone: tbd

comment:3 Changed 7 years ago by bill

Component: CoreDojoX Layout
Summary: Firebug shows a correct line number and incorrect (parent) file name in reporting a JavaScript error when a script is loaded dynamically with Dojo ToolkitContentPane: firebug shows a correct line number and incorrect (parent) file name in reporting a JavaScript error when a script is loaded dynamically with Dojo Toolkit

So this is an issue where dojox/layout/ContentPane extracts and executes scripts. Updating component.

comment:4 Changed 7 years ago by bill

Priority: highlow

comment:5 Changed 4 years ago by dylan

Milestone: tbd1.12
Resolution: patchwelcome
Status: newclosed

The ideal situation here would be if the dojox code added source map info dynamically. That said, we really consider this approach to script parsing to be an anti-pattern so we're not likely to fix it unless someone wants to contribute a patch.

Note: See TracTickets for help on using tickets.