Closed
Bug 44564
Opened 25 years ago
Closed 24 years ago
XML DOCTYPE content not rendered correctly in page source window.
Categories
(Core :: XML, defect, P3)
Core
XML
Tracking
()
VERIFIED
FIXED
mozilla0.8
People
(Reporter: chrispetersen, Assigned: hjtoi-bugzilla)
References
Details
(Keywords: testcase, Whiteboard: [fixinhand?])
Attachments
(6 files)
|
131 bytes,
text/xml
|
Details | |
|
487 bytes,
text/xml
|
Details | |
|
371 bytes,
text/html
|
Details | |
|
12.95 KB,
patch
|
Details | Diff | Splinter Review | |
|
18.26 KB,
patch
|
Details | Diff | Splinter Review | |
|
22.33 KB,
patch
|
Details | Diff | Splinter Review |
Build: 2000070311
Platforms: All
Expected results: Page source window should display entire content of !DOCTYPE
including element and entity declarations.
What I got: The first character of ELEMENT and ENTITY declaration are not
appearing in page source window.
Instead of this:
<!DOCTYPE TEST [
<!ELEMENT TEST (#PCDATA)>
<!ENTITY CP "Chris Petersen">
]>
I get:
<!DOCTYPE TEST [
<!- LEMENT TEST (#PCDATA)>
<!- NTITY CP "Chris Petersen">
]>
Steps to reproduce:
1) Open attached test case.
2) The well-form xml is rendered.
3) Choose Page Source from the View menu.
4) The first character in ELEMENT and ENTITY declarations are missing.
| Reporter | ||
Comment 1•25 years ago
|
||
Comment 2•25 years ago
|
||
This bug has been marked "future" because the original netscape engineer working
on this is over-burdened. If you feel this is an error, that you or another
known resource will be working on this bug,or if it blocks your work in some way
-- please attach your concern to the bug for reconsideration.
Status: NEW → ASSIGNED
Target Milestone: --- → Future
| Assignee | ||
Updated•25 years ago
|
Target Milestone: Future → mozilla0.9
| Assignee | ||
Comment 5•24 years ago
|
||
I hate this, taking.
Assignee: nisheeth → heikki
Status: ASSIGNED → NEW
| Assignee | ||
Comment 6•24 years ago
|
||
| Assignee | ||
Comment 7•24 years ago
|
||
| Assignee | ||
Comment 8•24 years ago
|
||
Here is how testcase 2 looks like in view source.
* incorrect markup declaration open
* incorrect cdata section close
<?xml version="1.0"?>
<!DOCTYPE x PUBLIC "-//Heikki Toivonen//DTD Foobar//EN" "foo" [
<!- LEMENT x ANY>
<!- TTLIST x id ID #IMPLIED foo CDATA "ab>oo">
<!-- A comment -->
<!- OTATION hep PUBLIC "-//Heikki Toivonen//NOTATION hep//EN">
<!- NTITY nop "no op">
<!- NTITY % param "foo">
]>
<x>
<![CDATA[
foobar
]]]]>
<foo>&nop;</foo>
<html:script xmlns:html="http://www.w3.org/1999/xhtml">
setTimeout("dump(new XMLSerializer().serializeToString(document))",1000);
</html:script>
</x>
This is how it looks like serialized:
* no <?xml ... (this is another bug)
* comment moved from internal DTD subset to the beginning (empty line where it
used to be)... this is what the DOM looks like
<!-- A comment --><!DOCTYPE x PUBLIC "-//Heikki Toivonen//DTD Foobar//EN" "foo" [
<!ELEMENT x ANY>
<!ATTLIST x id ID #IMPLIED foo CDATA "ab>oo">
<!NOTATION hep PUBLIC "-//Heikki Toivonen//NOTATION hep//EN">
<!ENTITY nop "no op">
<!ENTITY % param "foo">
]>
<x foo="ab>oo">
<![CDATA[
foobar
]]>
<foo>no op</foo>
<html:script xmlns:html="http://www.w3.org/1999/xhtml">
setTimeout("dump(new XMLSerializer().serializeToString(document))",1000);
</html:script>
</x>
You can test with testcase 3 as well and it will give similar results, even
though the serialializer outputs funny stuff because it is an HTML document and
an XML serializer.
Status: NEW → ASSIGNED
Keywords: testcase
| Assignee | ||
Comment 9•24 years ago
|
||
| Assignee | ||
Comment 10•24 years ago
|
||
Proposed fix 1 is my first cut at fixing this. I introduced a new token,
(markup) declaration, so that we will no longer treat them as comments and eat
the beginnings of the declarations. I also fixed a couple of static global
variables, and removed the virtual destructor from nsIDTD interface (interfaces
must not have virtual destructors, see bug 31750).
Now view source looks like:
<?xml version="1.0"?>
<!DOCTYPE x PUBLIC "-//Heikki Toivonen//DTD Foobar//EN" "foo" [
<!ELEMENT x ANY>
<!ATTLIST x id ID #IMPLIED foo CDATA "ab>oo">
<!-- A comment -->
<!NOTATION hep PUBLIC "-//Heikki Toivonen//NOTATION hep//EN">
<!ENTITY nop "no op">
<!ENTITY % param "foo">
]>
<x>
<![CDATA[
foobar
]]>
<foo>&nop;</foo>
<html:script xmlns:html="http://www.w3.org/1999/xhtml">
setTimeout("dump(new XMLSerializer().serializeToString(document))",1000);
</html:script>
</x>
And serialized view has not changed.
Whiteboard: [fixinhand?]
| Assignee | ||
Comment 11•24 years ago
|
||
I opened bug 64448 to track the issue of comments moving out of the internal subset.
| Assignee | ||
Comment 12•24 years ago
|
||
| Assignee | ||
Comment 13•24 years ago
|
||
Poposed fix 2 contains also the proposed fix to bug 64448. Additional
improvements from the first patch are:
- better handling of > embedded in quotes in markup declarations
- add handling of the eToken_declaration to the various DTDs, without this the
HTML DOM (when we have an HTML document with internal subset) is missing these
items... with the patch they appear as comment nodes
- faster recognition of the markup declaration tokens
| Assignee | ||
Comment 14•24 years ago
|
||
harishd did some reviewing, here are his comments:
- avoid assigning to mText in token creation, only do this on demand
(GetStringValue())... it looks like the assignment in constructor is not
normally used, but I will test this
- do not use eHTMLTag_markupDecl, create a new one for these eToken_declarations
- do not strip \r in Consume and remember line number... fix it to use sliding
strings etc. to avoid copying
- try to enable syntax colored view source (make it a pref)
| Assignee | ||
Updated•24 years ago
|
Target Milestone: mozilla0.9 → mozilla0.8
| Assignee | ||
Comment 15•24 years ago
|
||
| Assignee | ||
Comment 16•24 years ago
|
||
Harish, I have fixed all the things you noted. Precheckin tests pass (well, I
haven't been able to use mail in Mozilla in a long time and I believe somebody
broke FTP). Because I touched normal HTML code I would feel much better if we
could run the regression tests. Provided they pass, could you give an r?
Comment 17•24 years ago
|
||
Patch looks good to me. r=harishd
| Assignee | ||
Comment 18•24 years ago
|
||
And parser regression tests pass.
Comment 19•24 years ago
|
||
sr=vidur.
| Assignee | ||
Comment 20•24 years ago
|
||
Fix checked in.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
| Reporter | ||
Comment 21•24 years ago
|
||
Verified fixed in the Feb 05 build (2001020513).
Status: RESOLVED → VERIFIED
You need to log in
before you can comment on or make changes to this bug.
Description
•