Closed Bug 309078 Opened 20 years ago Closed 20 years ago

XMLHttpRequest fails to load local binary files (regression of Bug 305243)

Categories

(Core :: XML, defect)

1.8 Branch
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: zeniko, Unassigned)

References

()

Details

(Keywords: fixed1.8, regression)

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b4) Gecko/20050917 Firefox/1.4 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b4) Gecko/20050917 Firefox/1.4 Since the checkin of Bug 305243, XMLHttpRequest throws the following errors when trying to load a local binary file: Error: not well-formed Source File: file:///C:/console2.xpi Line: 1, Column: 3 Source Code: PK ---------- Error: uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIXMLHttpRequest.send]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: javascript:var r=new XMLHttpRequest(); r.open("GET", "file:///C:/console2.xpi", false); r.send(null); r.responseText :: <TOP_LEVEL> :: line 1" data: no] ---------- The first one is a non lethal malformed-xml error which is thrown for every non-XML file. The second one is somewhat of a hindrance for my Mass Installer extension. Reproducible: Always Steps to Reproduce: 1. Open the JavaScript Console 2. Evaluate the following line: var r=new XMLHttpRequest(); r.open("GET", "http://www.haslo.ch/zeniko/software/console2.xpi", false); r.send(null); r.responseText 3. Download this file (see URL) 4. Evaluate the following line (you'll have to adapt the file path): var r=new XMLHttpRequest(); r.open("GET", "file:///C:/console2.xpi", false); r.send(null); r.responseText Actual Results: The first evaluation succeeds without error, the second one results in the mentioned messages. Expected Results: Both calls have the same result. The malformed-xml error is thrown for each local non-XML file. The second error is restricted to binary files. To complete the testcase, evaluate thus the following line which correctly displays the file's content (change the path to a non-empty text file): var r=new XMLHttpRequest(); r.open("GET", "file:///C:/debug.txt", false); r.send(null); r.responseText Finally, loading non-local text content throws no error at all (as does loading non-local binary content): var r=new XMLHttpRequest(); r.open("GET", "http://www.google.com/", false); r.send(null); r.responseText
OS: Windows XP → All
Hardware: PC → All
Version: Trunk → 1.8 Branch
damn. the 1.8 branch doesn't have bug 293046's patch. (this should work on trunk) I backed out the patch for Bug 305243 - this regression isn't worth that feature. also, I'm not sure about the risk of bug 293046's patch. Checking in extensions/xmlextras/base/src/nsXMLHttpRequest.cpp; /cvsroot/mozilla/extensions/xmlextras/base/src/nsXMLHttpRequest.cpp,v <-- nsXMLHttpRequest.cpp new revision: 1.134.2.2; previous revision: 1.134.2.1 done Checking in extensions/xmlextras/tests/TestXMLExtras.cpp; /cvsroot/mozilla/extensions/xmlextras/tests/TestXMLExtras.cpp,v <-- TestXMLExtras.cpp new revision: 1.23.4.2; previous revision: 1.23.4.1 done
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Keywords: fixed1.8, regression
Resolution: --- → FIXED
Wladimir, is bug 293046 something to consider for branch?
Yes, this patch is pretty trivial, it should be safe.
You need to log in before you can comment on or make changes to this bug.