Closed Bug 503095 Opened 16 years ago Closed 8 years ago

XMLHttpRequest returns 0 (not 200) for local files, making local testing impractical.

Categories

(Core :: DOM: Core & HTML, defect)

x86
Linux
defect
Not set
minor

Tracking

()

RESOLVED WONTFIX

People

(Reporter: bryce2, Unassigned)

References

()

Details

Attachments

(2 files)

User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.19) Gecko/20081213 SUSE/1.1.14-1.1 SeaMonkey/1.1.14 Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.19) Gecko/20081213 SUSE/1.1.14-1.1 SeaMonkey/1.1.14 Bug #424875 refers to a desire to use http:// urls from locally loaded scripts. Bug #465397 refers to files one level up getting NS_ERROR_DOM_BAD_URI This is different. Place a script at file:///tmp/test.html. Load a URL of "test.xml". The file will load with a status of 0 rather that 200. This breaks most scripts. It can be coded around (by allowing "0" as a status code). But that's a hack. True on Seamonkey and Firefox at least on Linux. Reproducible: Always Steps to Reproduce: See attached sample script. Actual Results: The local filesystem should fake up a 200 or 404 error to better emulate what a server does.
Keywords: xmlhttp.status , xmlhttp.statusText, Seamonkey, Firefox, XMLHttpRequest, locally stored files, local filesystem, file://
Component: General → XML
Product: Firefox → Core
QA Contact: general → xml
Note that the current XMLHttpRequest spec draft talks about raising an exception here. See http://www.w3.org/TR/XMLHttpRequest/#status See also bug 304980. Fundamentally, though, we're doing the same thing as IE last I checked, are we not? And since IE is basically what defines XMLHttpRequest behavior...
I should also note that making local filesystem testing look just like the web page is an explicit non-goal for many reasons (including the security ones you cited). If you want to test sites that use XHR locally, you really need to be running a local web server to get sane behavior in all sorts of ways, not just .status.
Failing to load the file at all (rather than, sort of, loading it) might be a good goal.
Making file URLs better is not something we should invest time in.
Status: UNCONFIRMED → RESOLVED
Closed: 8 years ago
Component: XML → DOM
Resolution: --- → WONTFIX
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: