New issue
Advanced search Search tips

Issue 698130 link

Starred by 6 users

Issue metadata

Status: Available
Owner: ----
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug

Blocking:
issue 651752



Sign in to add a comment

XML error page has a wrong structure

Project Member Reported by tkent@chromium.org, Mar 3 2017

Issue description

What steps will reproduce the problem?
(1) Open http://w3c-test.org/domparsing/DOMParser-parseFromString-xml.html

What is the expected result?
Less FAILs

What happens instead?
Everything fails.

Please use labels and text to provide additional information.

For example, the following URL shows an XML parse error page:

data:text/xml,<body xmlns="http://www.w3.org/1999/xhtml"><script>alert('foo')</script></

The page should be:
 - Use Document, not XMLDocument
 - The root element should be <parseerror xmlns="http://www.mozilla.org/newlayout/xml/parsererror.xml">

https://www.w3.org/TR/2016/WD-DOM-Parsing-20160517/#widl-DOMParser-parseFromString-Document-DOMString-str-SupportedType-type
> 3. Let document be a newly-created XML Document. The document will use the Document interface rather than the XMLDocument interface.
> 4. Let root be a new Element, with its local name set to "parsererror" and its namespace set to "http://www.mozilla.org/newlayout/xml/parsererror.xml".

See core/xml/parser/XMLErrors.cpp.

 

Comment 1 by tkent@chromium.org, Mar 3 2017

Description: Show this description
Hi, I am new to Chromium development
I am interested to work on this bug and currently investigating on this.
Currently I can fix and pass 8/16 test cases. But I dont know how to return Document (not XMLDocument) when XML parse error page. Could you please help me so that I can finish the first bug.

One more thing: in XMLErrors.createXHTMLParserErrorHeader currently it set parsererror value to xhtmlNamespaceURI (doc->createElement(QualifiedName(nullAtom, "parsererror", xhtmlNamespaceURI), CreatedByParser);
Is it ok if I set it to "http://www.mozilla.org/newlayout/xml/parsererror.xml" (using hard code) I mean (doc->createElement(QualifiedName(nullAtom, "parsererror", "http://www.mozilla.org/newlayout/xml/parsererror.xml"))

Hope to see your reply
Sorry for my bad English
Best regards,
Duong Dinh Huy

Comment 3 Deleted

Comment 4 by tkent@chromium.org, Mar 6 2017

Labels: -Hotlist-GoodFirstBug
Hmm, it seems this requires larger change than my expectation.  Yeah, replacing XMLDocument with Document isn't easy. Probably we should:
 - Make Document::setContent() return something to detect a parse error.
 - DOMParser::parseFromString() should check setContent() result, and create
  new Document for <parseerrorr>.

I withdraw GoodFirstBug label.  Sorry!

Hi
I think we can easy find out a parse error by using document's documentElement.
Because if the document parse error It will has the root with its local name is set to "parsererror" (we will do it in this issue). After calling setContent() method we can check the local name and can detect a parse error. 
Correct me if I'm wrong

Comment 6 by tkent@chromium.org, Mar 8 2017

> After calling setContent() method we can check the local name and can detect a parse error. 

It can't distinguish parse errors and real documents with <parseerror> elements.

Maybe it's possible that checking a parse error in parseFromString() by static_cast<XMLDocumentParser*>(doc->parser())->wellFormed().

I wrote:
> data:text/xml,<body xmlns="http://www.w3.org/1999/xhtml"><script>alert('foo')</script></
However, it is actually unrelated to parseFromString(). We don't need to change this user-visible XML error page.

Project Member

Comment 7 by sheriffbot@chromium.org, Mar 8 2018

Labels: Hotlist-Recharge-Cold
Status: Untriaged (was: Available)
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue.

Sorry for the inconvenience if the bug really should have been left as Available. If you change it back, also remove the "Hotlist-Recharge-Cold" label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot

Comment 8 by tkent@chromium.org, Mar 8 2018

Status: Available (was: Untriaged)

Comment 9 by tkent@chromium.org, May 17 2018

 Issue 843518  has been merged into this issue.
Since my issue was merged into this one: would it be possible to split this into two separate issues: (1) setting the correct namespace on <parsererror>, and (2) replacing XMLDocument with Document. On its own, (1) would already be helpful.

Sign in to add a comment