Closed Bug 10593 Opened 25 years ago Closed 25 years ago

incorrect javascript line numbers in HTML/XML files

Categories

(Core :: XML, defect, P4)

x86
Linux
defect

Tracking

()

VERIFIED FIXED

People

(Reporter: dbaron, Assigned: nisheeth_mozilla)

References

Details

Attachments

(2 files)

I will attach to this bug some examples of JavaScript errors giving the wrong
line numbers in HTML/XML files.  Bug 8045 already covers line number problems
for linked JavaScript.

In the HTML example, the problems are only caused by comments.  The error is
being reported as line 9 when it should be line 24.

In the XML example, the problems are caused by comments, processing
instructions, and whitespace outside of the root element (I think).  The error
is being reported as line 5 when it should be line 30.

(In both cases, the error should be "this_is_an_error is not defined".)
cc'ing nisheeth, rickg, rogerl.

Who parses xml and html?  JavaScript has long had support for gleaning correct
line numbers when given source that's interspersed with another file.  My guess
is that the xml and html parsers aren't providing the correct line number
information to the JavaScript parser when passing code snippets.
CCing harishd, the owner of the parser.  I know that the XML tokenizer is not
passing up line number information to the XML DTD.  Harish and me should work
together to fix that.  Harish can shed more light on whether the HTML tokenizer
and DTD are calculating the line numbers properly for HTML files.
Assignee: mccabe → harishd
Harish has agreed to take this one.  Reassigning...
QA Contact: cbegle → chrisd
great.  reassigning to xml qa contact.
Depends on: 10703
Component: Javascript Engine → XML
reassigining to the (i think) correct component.  sorry if this is wrong.
Target Milestone: M9
Setting to M9.
Status: NEW → ASSIGNED
Problem:  New lines in comments were not taken into account.

Checked in a fix for HTML files.  Will look into XML example after bug# 10703
gets resolved.
Since 10703 is not resolved yet moving milestone to M10.
Target Milestone: M9 → M10
Priority: P3 → P2
Depends on: 11992
Counting new lines in comments in XML documents too.  This bug will be
completely fixed once bug# 11992 is resolved.
I fixed this for XUL documents.
Target Milestone: M10 → M14
Priority: P2 → P4
Moving to M14. [ NOTE: This bug might get fixed once 11992 is fixed ].
Assignee: harishd → nisheeth
Status: ASSIGNED → NEW
Giving away the bug to nisheeth..because all that's left is related to XML.

Nisheeth, have fun :)
Status: NEW → ASSIGNED
Accepting bug...
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
Target Milestone: M14 → M11
Changing milestone to M11.

I've checked in a fix for this bug.  I added the default handler to the XML
tokenizer which looks for newlines and creates newline tokens.  Earlier, the no
default handler was registered with expat, so newlines in the document prolog
were not getting reported.

Also, the XML DTD was wrongly initializing the line number count to 0 instead of
1.  The was causing an off by one error in the line number reported by JS.
Fixed the error in the XML DTD also.
Status: RESOLVED → VERIFIED
Verified fixed, Linux mozilla 1999-11-13-08-M12.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: