Closed Bug 396568 Opened 17 years ago Closed 17 years ago

[jsd] one way the line numbers can be incorrect in javascript debugging.

Categories

(Core :: DOM: HTML Parser, defect)

1.8 Branch
x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: johnjbarton, Unassigned)

References

Details

Attachments

(1 file)

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.7) Gecko/20070914 Firefox/2.0.0.7 Build Identifier: A user filed issue 246 with Firebug including an example that explains at least some of the problems I have had with line numbers from JSD. Script tags like: <script language="javascript" type="text/javascript" src="foo.js"></script> <script language="javascript" type="text/javascript" src="bar.js"></script> cause the line numbers from JSD to be off by 4 lines. I guess (6 - 2) = 4, 6 original lines and 2 compressed lines. If I use 12 lines in 4 script inclusions I get 8 line offset: (12-4)= 8. But I can't figure out the direction: JSD gets larger line numbers, not smaller as I would guess. Also a workaround will need some work... Affects both Venkman and Firebug. Test case: http://fireclipse.svn.sourceforge.net/viewvc/*checkout*/fireclipse/trunk/FireclipseTests/WebContent/issue246badForDebugging.html John. Reproducible: Always Steps to Reproduce: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <script language="javascript" type="text/javascript" src="foo.js"></script> <script language="javascript" type="text/javascript" src="bar.js"></script> <script language="javascript" type="text/javascript" src="bax.js"></script> <script language="javascript" type="text/javascript" src="baz.js"></script> </head> <body> <pre> Reported by adam.n.gordon, Aug 02, 2007 What steps will reproduce the problem? 1. Create an HTML web page with head/body sections. 2. In the head section include a J/S file but make sure the attributes of the script element appear on multiple lines. E.g make this element span 3 lines. 3. Add some content to the body including a script element that defines some J/S functions. 4. Place a breakpoint in the J/S code and you'll see that in order to this the breakpoint on the line you want, you actually have to set the breakpoint two lines below (using the example above) because the FireBug parser thinks the input spans only one line. What is the expected output? What do you see instead? The expected result is that FireBug detects multiple lines for one element in the head element and accounts for this. FireBug appears to treat multiple lines for the contents of an element in the head element as one and thus the debugger is off by the number of extra lines beyond 1. What version of the product are you using? On what operating system? 1.05, Kubuntu Feisty. Please provide any additional information below. Please see the attached sample files. </pre> <p> <input type="button" value="Click Me!" onclick="popAlert();"/> </p> <script type="text/javascript"> <!-- function popAlert() { var someText = "Hello World"; alert(someText); } //--> </script> </body> </html> Actual Results: With 4 script inclusions using 12 lines, the line numbers reported out of JSD and shown by either Venkman or Firebug will be off by 8 which happens to be 12 - 4. Oddly JSD reports them 8 too big, I would have expected 8 too small. Expected Results: The correct line numbers ;-)
Status: UNCONFIRMED → NEW
Ever confirmed: true
Is this a problem on trunk? I can reproduce a line number problem here on branch (just using the error console), but on trunk I get the right numbers. For history, the number is too big on branch, then becomes too small with the fix for bug 307797 and bug 272702, and is fixed to be just right by revision 3.480 of parser/htmlparser/src/CNavDTD.cpp (no bug for that change; it's a typo fix where an if condition was not negated as it should have been).
as far as i'm concerned, the JavaScript and JavaScript Debugger APIs are all behaving properly. Incorrect numbering of the Garbage In, Garbage Out variety is a bug in the source of the Garbage In, which for a testcase like this would be parser (conveniently implicated by bz). for the future, please attach html testcases instead of inlining them. (In order to make this easier, i've granted you editbugs..., there are instructions on guided indicating you should attach things later, however the instruction text is buggy, but that's another bug...)
Assignee: general → nobody
Component: JavaScript Engine → HTML: Parser
QA Contact: general → parser
Version: unspecified → 1.8 Branch
CNavDTD.cpp revision 3.480 was really a typo fix for bug 307797. I'm going to preemptively mark this as fixed based on comment 1. Please reopen if that's incorrect.
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
I checked in the regression test. Marking fixed, since as far as I can tell it is.
Depends on: 272702, 307797
Yay. Looks fixed in FF3, our testcase works fine, Thanks!
Resolution: FIXED → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: