Last Comment Bug 309078 - XMLHttpRequest fails to load local binary files (regression of Bug 305243)
: XMLHttpRequest fails to load local binary files (regression of Bug 305243)
Status: RESOLVED FIXED
: fixed1.8, regression
Product: Core
Classification: Components
Component: XML (show other bugs)
: 1.8 Branch
: All All
: -- normal (vote)
: ---
Assigned To: xml
: Ashish Bhatt
: Andrew Overholt [:overholt]
Mentors:
http://www.haslo.ch/zeniko/software/c...
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2005-09-18 14:00 PDT by Simon Bünzli
Modified: 2006-03-12 18:55 PST (History)
4 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments

Description Simon Bünzli 2005-09-18 14:00:14 PDT
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
Comment 1 Christian :Biesinger (don't email me, ping me on IRC) 2005-09-18 15:26:30 PDT
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
Comment 2 Boris Zbarsky [:bz] (still a bit busy) 2005-09-18 15:42:16 PDT
Wladimir, is bug 293046 something to consider for branch?
Comment 3 Wladimir Palant 2005-09-18 16:07:46 PDT
Yes, this patch is pretty trivial, it should be safe.

Note You need to log in before you can comment on or make changes to this bug.