Open Bug 621836 Opened 14 years ago Updated 2 years ago

XMLHttpRequest.open() has no effect--file is never transferred and readyStatus=1

Categories

(Core :: DOM: Networking, defect, P5)

1.9.2 Branch
x86
Windows XP
defect

Tracking

()

UNCONFIRMED

People

(Reporter: ols6000, Unassigned)

Details

(Whiteboard: [necko-triaged])

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13

The following pgm works as expected under IE8, but not under FF3.6.13. Searching Bugzilla, I see a lot of similar bugs from 2006-7 (unresolved), suggesting that XMLHttpRequest is quite buggy.

An unusual feature is that I am executing this code from a file on my local machine, with the data file being transferred on a remote Apache server. It also fails when the data file is in the same local directory as the HTML.

It fails the same whether the XMLHttpRequest is synchronous (as in the code below), or asynchronous (with an added event handler).

Running almost identical code on a remote server, as in XMLHttpRequest tutorials, seems to work OK.

<html>
<head>
<script type="text/javascript">

var clientQ = new XMLHttpRequest();
var URL="http://chessclub.org/games/TNM2010-5.pgn";
clientQ.open("GET", URL, false); // synchronous
clientQ.send(null);
alert("String length="+clientQ.responseText.length+"\n\n"+clientQ.responseText);

</script>
</head>
<body>
This is the body
</body>
</html>


Reproducible: Always

Steps to Reproduce:
1. Load an HTML file containing the above code.
2.
3.
Actual Results:  
Only "This is the body" appears on the screen.

Expected Results:  
An alert containing the length of the response (~152KB) and the initial part of the string should appear. This is how it behaves in IE8.

Using Firebug to get more info about this problem seems to show the headers are transferred correctly, with the correct file length in the response. However, the http status word remains 0 (which is illegal).
You are doing cross domain xmlhttprequests. You need to follow the rules outlined at https://developer.mozilla.org/En/HTTP_access_control
(In reply to comment #1)
> You are doing cross domain xmlhttprequests. You need to follow the rules
> outlined at https://developer.mozilla.org/En/HTTP_access_control

I understand the cross-domain principle, after reading the rules you cited. But I don't understand why having a data file and an HTML file in the same directory on the local machine (for testing) is considered cross-domain. Maybe I had some other error in my JavaScript?
Version: unspecified → 3.6 Branch
Reporter -> Are you still experiencing this issue with the latest version of Firefox 5? Does the issue occur with the latest nightly? http://nightly.mozilla.org/
> Reporter -> Are you still experiencing this issue with the latest version of
> Firefox 5? Does the issue occur with the latest nightly?
Not working on this project now, so I haven't tested it w/FF 5
(In reply to comment #3)
If you can, please provide a public URL or reduced test case the exhibits this issue, or should we close this bug for now?
(In reply to comment #5)
> If you can, please provide a public URL or reduced test case the exhibits
> this issue, or should we close this bug for now?

I provided both in the original bug report. If this is sufficient, please use it. Otherwise, it will have to wait, as I don't have time right now to work on this issue.
Component: General → DOM: Mozilla Extensions
Product: Firefox → Core
QA Contact: general → general
Version: 3.6 Branch → 1.9.2 Branch
Component: DOM: Mozilla Extensions → DOM
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046

Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5.

If you have questions, please contact :mdaly.
Priority: -- → P5
Component: DOM → DOM: Core & HTML

In the process of migrating remaining bugs to the new severity system, the severity for this bug cannot be automatically determined. Please retriage this bug using the new severity system.

Severity: major → --
Component: DOM: Core & HTML → DOM: Networking
Severity: -- → S4
Whiteboard: [necko-triaged]
You need to log in before you can comment on or make changes to this bug.