Closed Bug 313854 Opened 19 years ago Closed 8 years ago

[XMLHttpRequest] responseXML contains error document for invalid XML files

Categories

(Core :: XML, defect)

1.8 Branch
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 289714

People

(Reporter: pop2.bugzilla, Unassigned)

References

()

Details

(Keywords: regression)

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8b4) Gecko/20050910 SeaMonkey/1.0a
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8b4) Gecko/20050910 SeaMonkey/1.0a

XMLHttpRequest fails to load an invalid XML file >6kb. 
This happens when the server sends contentType=text/xml and the file is not valid XML.
All version before Gecko 1.8 work fine here and return responseXML=null and responseText with the contents.
One could argue that this is not a bug but a feature because the server sends the wrong header. But the problem is that sometimes we have no control about foreign servers.

Reproducible: Always

Steps to Reproduce:
If it's just failing without hanging the browser or crashing etc .. we should not be worried. Does it affect something else for you or this is not big deal ?
Why we shouldn't be worried?
a) That's a regression and 
b) we have no chance to load a document once the server sends text/xml by mistake
Assignee: nobody → xml
Component: General → XML
Product: Firefox → Core
QA Contact: general → ashshbhatt
Version: unspecified → 1.8 Branch
(In reply to comment #2)
> Why we shouldn't be worried?
> a) That's a regression and 
> b) we have no chance to load a document once the server sends text/xml by
> mistake
> 

oh I see now, didn't understood very well your bug description.
but the build you're using is more than a month old, did you verified with newer builds?
Could you attach / point to a testcase please? I couldn't reproduce the bug easily.
Keywords: regression
This is true for both 1.8 branch and trunk.
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Windows 2000 → All
Hardware: PC → All
Summary: XMLHttpRequest doesn't load invalid XML files → [XMLHttpRequest] responseXML contains error document for invalid XML files
Attached image sample responseXML
This is alert(r.responseXML.documentElement.textContent). r.responseXML should have been null.
Btw, responseText does not contain the error document but the real response.
Assignee: xml → nobody
Blocks: 289714
QA Contact: ashshbhatt → xml
Gecko has this old feature where XML parser outputs a document with error info if parsing fails. This is wrong per spec and other implementations

Test cases:
http://w3c-test.org/web-platform-tests/master/XMLHttpRequest/responsexml-media-type.htm
http://w3c-test.org/web-platform-tests/master/XMLHttpRequest/responsexml-non-well-formed.htm
This bug seems like a dupe of bug 289714, which was just fixed. The web platform tests in comment 8 are now passing, and XHRs made by web content for invalid XML documents will now give a null responseXML instead of a <parsererror> document (and the parsing failure will be logged to the web console).
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: