incorrect javascript line numbers in HTML/XML files

VERIFIED FIXED in M11

Status

()

P4
normal
VERIFIED FIXED
19 years ago
19 years ago

People

(Reporter: dbaron, Assigned: nisheeth_mozilla)

Tracking

Trunk
x86
Linux
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

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".)

Comment 3

19 years ago
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.
(Assignee)

Comment 4

19 years ago
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.

Updated

19 years ago
Assignee: mccabe → harishd

Comment 5

19 years ago
Harish has agreed to take this one.  Reassigning...

Updated

19 years ago
QA Contact: cbegle → chrisd

Comment 6

19 years ago
great.  reassigning to xml qa contact.

Updated

19 years ago
Depends on: 10703

Updated

19 years ago
Component: Javascript Engine → XML

Comment 7

19 years ago
reassigining to the (i think) correct component.  sorry if this is wrong.

Updated

19 years ago
Target Milestone: M9

Comment 8

19 years ago
Setting to M9.

Updated

19 years ago
Status: NEW → ASSIGNED

Comment 9

19 years ago
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.

Comment 10

19 years ago
Since 10703 is not resolved yet moving milestone to M10.

Updated

19 years ago
Target Milestone: M9 → M10

Updated

19 years ago
Priority: P3 → P2

Updated

19 years ago
Depends on: 11992

Comment 11

19 years ago
Counting new lines in comments in XML documents too.  This bug will be
completely fixed once bug# 11992 is resolved.

Comment 12

19 years ago
I fixed this for XUL documents.

Updated

19 years ago
Target Milestone: M10 → M14

Updated

19 years ago
Priority: P2 → P4

Comment 13

19 years ago
Moving to M14. [ NOTE: This bug might get fixed once 11992 is fixed ].

Updated

19 years ago
Assignee: harishd → nisheeth
Status: ASSIGNED → NEW

Comment 14

19 years ago
Giving away the bug to nisheeth..because all that's left is related to XML.

Nisheeth, have fun :)
(Assignee)

Updated

19 years ago
Status: NEW → ASSIGNED
(Assignee)

Comment 15

19 years ago
Accepting bug...
(Assignee)

Updated

19 years ago
Status: ASSIGNED → RESOLVED
Last Resolved: 19 years ago
Resolution: --- → FIXED
Target Milestone: M14 → M11
(Assignee)

Comment 16

19 years ago
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.