Closed Bug 10609 Opened 20 years ago Closed 20 years ago
Can't declare html markups with attribute values in entity value
Bill's comments ---------------- Note that markup can go in entities, just as long as the markup doesn't contain ". Here's a small testcase: http://law.mcom.com/entity.xul. My web server won't serve this up as text/xul (or whatever) so you have to save it to your local machine (using 4.x) and enter a file url. Here's the content: <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/xul.css" type="text/css"?> <!DOCTYPE window [ <!ENTITY e1 "foobar"> <!ENTITY e2 ""foobar""> <!ENTITY e3 "<div>foobar</div>"> <!ENTITY e4 "<div>foobar</div>"> <!ENTITY e5 "<div id="foobar">foobar</div>"> ]> <xul:window xmlns="http://www.w3.org/TR/REC-html40" xmlns.xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> e1: &e1; <br/> e2: &e2; <br/> e3: &e3; <br/> e4: &e4; <!-- Uncomment this to cause crash <br/> e5: &e5; --> </xul:window>
Accepting bug and setting milestone to M9...
Bill, <!ENTITY foo "<html:div id="foo">Hello</html:div>"> is a malformed XML entity because its replacement text equals: <html:div id="foo">Hello</html:div> which is malformed because the id attribute's value is unquoted. See http://www.w3.org/TR/REC-xml#intern-replacement for more information. You need to use the following entity declaration: <!ENTITY foo "<html:div id= foo >Hello</html:div>"> for which the replacement text will be the intended <html:div id="foo">Hello</html:div> Your test case has uncovered a bug with the way we report errors. On viewer, the above test case ends up displaying a black background and nothing else. On apprunner, according to the bug report, it crashes. Harish, I looked into the problem more and here's what's happening. Expat reports the error to nsExpatTokenizer, which pushes an error token and returns the NS_ERROR_HTMLPARSER_STOPPARSING error code to the parser. The parser assigns the error code to its mInternalState flag and calls BuildModel() expecting that method to process all the tokens in the token queue. However, the first token processed (the stylesheet PI) returns NS_ERROR_HTMLPARSER_BLOCK so, all subsequent tokens remain unprocessed. We need to add logic to the parser to catch this case and process all the tokens once the parser becomes unblocked even when mInternalState is set to NS_ERROR_HTMLPARSER_STOPPARSING. You implemented the stop parser logic so I'm assigning this bug to you.
setting to M10.
Setting priority to P1.
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Checked in a fix to handle malformed XML/XUL documents. Marking bug FIXED.
Whiteboard: 1/3: Clarification requested from assigned engineer prior to verification
Harish: I need to verify this bug as fixed. You stated that you had a fix to handle malformed XML/XUL documents. When I load the malformed doc referred to in 7/27 comments, what should the expected behavior be? Using 1/3 build, the document doesn't hang the application but it doesn't load it. Please advise. Thanks
Verified Windows (NT):2000-07-13-09-M17 Linux :2000-07-13-08-M17 The test file that is used is "entity.xml", the testcase provided by Bill on 07/27/99.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.