Closed
Bug 483015
Opened 16 years ago
Closed 16 years ago
[HTML5] Expose HTML line number to JS and CSS parsers
Categories
(Core :: DOM: HTML Parser, defect, P1)
Tracking
()
RESOLVED
FIXED
People
(Reporter: hsivonen, Assigned: hsivonen)
References
(Blocks 1 open bug)
Details
Attachments
(3 files, 3 obsolete files)
95 bytes,
text/html
|
Details | |
23.23 KB,
patch
|
mozilla+ben
:
review+
|
Details | Diff | Splinter Review |
5.77 KB,
patch
|
mozilla+ben
:
review+
|
Details | Diff | Splinter Review |
The tokenizer needs to keep count of the line number in order to avoid regressing CSS and JS error reporting.
Assignee | ||
Comment 1•16 years ago
|
||
Avoid regressing bug 190576.
Summary: Expose HTML line number to JS and CSS parsers → [HTML5] Expose HTML line number to JS and CSS parsers
Assignee | ||
Updated•16 years ago
|
Priority: -- → P1
Assignee | ||
Comment 2•16 years ago
|
||
Fixed in rev cbd95aa84038 in the HTML5 repo.
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 3•16 years ago
|
||
Forgot the case where doc.write leaves data in the input stream when returning.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
![]() |
||
Comment 4•16 years ago
|
||
This doesn't seem to work at all for <script> or <style>, in my testing. Testcase attached
![]() |
||
Updated•16 years ago
|
Blocks: html5-parsing
Assignee | ||
Comment 5•16 years ago
|
||
This patch should give sensible line numbers for content in the network stream and for content in the root context of document.open()ed documents.
Line numbers in other document.written content won't necessarily match the line numbers reported by the old HTML parser.
Assignee | ||
Updated•16 years ago
|
Attachment #411180 -
Attachment is obsolete: true
Assignee | ||
Comment 6•16 years ago
|
||
Assignee | ||
Comment 7•16 years ago
|
||
Per Boris' comments in .platform, I've retained approximate line numbers even when they are know to be bogus.
Moving the line number in and out of the tokenizer in nsHtml5Parser is quite ugly, but I didn't want the tokenizer to know about all this.
Attachment #411666 -
Flags: review?(bnewman)
Assignee | ||
Comment 8•16 years ago
|
||
Attachment #411400 -
Attachment is obsolete: true
Attachment #411667 -
Flags: review?(bnewman)
Comment 9•16 years ago
|
||
Comment on attachment 411666 [details] [diff] [review]
Right line numbers for network and document.opened root context, approximate for other document.writes
Looks good, and playing around with the testcase produced all the right behaviors, as far as I can see.
Attachment #411666 -
Flags: review?(bnewman) → review+
Comment 10•16 years ago
|
||
Comment on attachment 411667 [details] [diff] [review]
Refreshed mochitest
I'd love to see a few more tests here. What happens with multiple unknown properties? Multiple <style> tags?
Assignee | ||
Comment 11•16 years ago
|
||
(In reply to comment #9)
> (From update of attachment 411666 [details] [diff] [review])
> Looks good, and playing around with the testcase produced all the right
> behaviors, as far as I can see.
Thanks.
(In reply to comment #10)
> (From update of attachment 411667 [details] [diff] [review])
> I'd love to see a few more tests here. What happens with multiple unknown
> properties? Multiple <style> tags?
Attached mochitests that have two <style> tags each and also test cases where the error isn't on the first line of the <style> element.
Attachment #411667 -
Attachment is obsolete: true
Attachment #414031 -
Flags: review?(bnewman)
Attachment #411667 -
Flags: review?(bnewman)
Comment 12•16 years ago
|
||
Comment on attachment 414031 [details] [diff] [review]
Test two <style> tags, two bogus properties
r=me provided you add the code to set/reset the html5.enable pref
Attachment #414031 -
Flags: review?(bnewman) → review+
Assignee | ||
Comment 13•16 years ago
|
||
(In reply to comment #12)
> (From update of attachment 414031 [details] [diff] [review])
> r=me provided you add the code to set/reset the html5.enable pref
Thanks.
(I haven't toggled the pref on test cases that are supposed to pass with both parsers, but I'll change it here. To get good test coverage anyway, it's necessary to push to try with html5.enable set to true.)
Comment 14•16 years ago
|
||
a=beltzner to land on mozilla-central as this is pref'd off by default and so I'm happy to consider it NPOTB for now.
Assignee | ||
Comment 15•16 years ago
|
||
Thanks for the a. Pushed:
http://hg.mozilla.org/mozilla-central/rev/60fea11d79cd
(I didn't push the test yet, since it depends on bug 529544.)
Status: REOPENED → RESOLVED
Closed: 16 years ago → 16 years ago
Depends on: 529544
Flags: in-testsuite?
Resolution: --- → FIXED
Comment 16•16 years ago
|
||
Comment on attachment 414031 [details] [diff] [review]
Test two <style> tags, two bogus properties
Random nits:
>+ ok(this.lineNumbers.length > 0, "Seen too many errors!");
Maybe this was copied from another test, but s/Seen/Saw/ for better English, or just "Too many errors!".
>+
>+ var scriptErr = message.QueryInterface(Ci.nsIScriptError);
>+
>+ is(scriptErr.lineNumber, this.lineNumbers.shift(),
>+ "Wrong line");
>+ },
>+
>+ finish: function() {
>+ ok(this.lineNumbers.length == 0 , "Didn't the right number of messages.");
Missing "get"? Same error later.
Great to have these line numbering bugs fixed!
/be
Assignee | ||
Comment 17•16 years ago
|
||
(In reply to comment #16)
> (From update of attachment 414031 [details] [diff] [review])
> Random nits:
Nits fixed locally. Thanks.
I haven't pushed this fix, because flipping the html5.enable pref here makes some document that lives across tests (the harness itself presumably) cache a fragment parser and then the innerHTML setting fails in a subsequent test because the pref and the cached fragment parser are out of sync.
bnewman, is it OK if I make this test not flip the pref? sicking says making the document remember what kind of fragment parser it has is a waste of time.
(I don't have an explanation why this is a problem with this test case but not with other test cases that flip the pref.)
You need to log in
before you can comment on or make changes to this bug.
Description
•