The default bug view has changed. See this FAQ.

jsdIScript baseLineNumber incorrect

NEW
Unassigned

Status

()

Core
HTML: Parser
8 years ago
6 years ago

People

(Reporter: John J. Barton, Unassigned)

Tracking

1.9.1 Branch
x86
Windows XP
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [firebug-p2])

(Reporter)

Description

8 years ago
Here is a new case where the base line numbers in jsdIScript are incorrect:
http://code.google.com/p/fbug/source/browse/tests/issues/2046/issue2046.htm

I think you can get a copy this way:
svn checkout http://fbug.googlecode.com/svn/tests/issues/2046/issue2046.htm

The original report was on 3.0.10, but I confirmed it on
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1) Gecko/20090624 Firefox/3.5
(Reporter)

Comment 1

8 years ago
Bug 488730 fixed seemingly similar issues, so it may be a good one to read.
Whiteboard: [firebug-p1]
Assignee: general → nobody
Component: JavaScript Engine → HTML: Parser
QA Contact: general → parser

Comment 2

8 years ago
This took me a while to reproduce, but I can (using JSD/Venkman) confirm I get baseLineNumber=25 with the exact file in SVN.

The issue (and why it was hard for me to reproduce initially) seems to be related to the inconsistent line endings in the file (a mixture of Windows and Unix), as I cannot reproduce the problem when I force them all to be Windows or all Unix.

Asssuming the file has Windows line ends generally, there are exactly 14 Unix line ends before the <script> tag, which is the error in line number (39 is the correct baseLineNumber). I don't like coincidences like that.

Comment 3

8 years ago
I did the tests on Venkman 0.9.87.4 on Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.1) Gecko/20090624 Firefox/3.5.
This is a bug in CTextToken::ConsumeParsedCharacterData. It simply counts the number of newlines in the text or style node, which ignores stray carriage returns. Unlike bug 488730, there isn't a really simple fix here without rewriting the way that we scan for </script>. I know that this is nice to have, but honestly, we might have to wait for the HTML5 parser to fix this.
(Reporter)

Comment 5

8 years ago
Do you think we could rationally 'fix' the lines on Firebug side? I already have code to shift the line offsets. If I have an algorithm that works and more important doe not break on normal sources, it could be a working solution until the new parser.
  1) only HTML files?
  2) delete CR in what cases?
The HTML5 parser bug for line numbers is bug 483015. However, while implementing line numbers, I noticed that the expectations on how line numbers work for document.written content weren't documented anywhere.
Depends on: 483015
Here is another test case (all line endings set to Windows)
http://code.google.com/p/fbug/source/browse/tests/issues/2046/issue2046-2.html

Online version is here:
http://getfirebug.com/tests/issues/2046/issue2046-2.html

The break in the file happens on line 7 instead of line 13.

If the try-catch block is inserted into another block like as follows:

{ try-catch }

it works.

Is this related to this report?
Honza
(Reporter)

Updated

6 years ago
Whiteboard: [firebug-p1] → [firebug-p2]
You need to log in before you can comment on or make changes to this bug.