Closed Bug 353808 Opened 18 years ago Closed 18 years ago

XML HTTP Requests never reach any readyState in FF 1.5.0.7

Categories

(Firefox :: General, defect)

x86
Windows XP
defect
Not set
major

Tracking

()

RESOLVED DUPLICATE of bug 313646

People

(Reporter: galvao, Unassigned)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.7) Gecko/20060909 Firefox/1.5.0.7
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.7) Gecko/20060909 Firefox/1.5.0.7

After firing a XML HTTP Request, FireFox 1.5.0.7 can't see the readyState property of it. This is an "expanded" version of bug #343769: FF can't even detect the readyState code 1.

Reproducible: Always

Steps to Reproduce:
1. Given this AJAX function:

function retrieveDate()
{
    http_request = false;
    
    if (window.XMLHttpRequest)
    {
        http_request = new XMLHttpRequest();
       
        if (http_request.overrideMimeType)
        {
            http_request.overrideMimeType('text/xml');
        }
    }
    
    if (!http_request)
    {
        alert("Can't handle XHR's.");
    }
    
    http_request.onreadystatechange = function ()
                                      {
                                        alert('Function called. Actual state: ' + http_request.readyState);
                                        if (http_request.readystate == 4)
                                        {
                                            if (http_request.status == 200)
                                            {
                                                alert(http_request.responseXML);
                                            }
                                            else
                                            {
                                                alert('Server Error!');
                                            }
                                        }
                                        else
                                        {
                                            alert(http_request.readyState);
                                        }
                                      }
    
    http_request.open('GET', 'http://localhost/foo/bar.php', false);
    http_request.send(null);
}

2. And calling it in any fashion (onClick on a button, onLoad on the body tag, etc...)
Actual Results:  
FF shows the first alert of the onreadystatechange function, thus never showing the responseXML property of the request.

Expected Results:  
Two alerts for each state change until 4 (0, 1, 2 and 3) containing "Function called. Actual state: ' + http_request.readyState" and a final alert containing the XML returned by the server.

This happens with both async and sync XHR's. Tested with safe-mode. Works on different browsers. Works on FF 1.5.0.6.
Correction:

Actual results: FF *doesn't* show the first alert of the onreadystatechange function, thus never showing the responseXML property of the request.

Expected results: Two alerts for each state change until 4 (0, 1, 2 and 3), one containing "Function called. Actual state: ' + http_request.readyState" and the other containing just the readyState code. A final alert containing the XML returned by the server.

*** This bug has been marked as a duplicate of 313646 ***
Status: UNCONFIRMED → RESOLVED
Closed: 18 years ago
Resolution: --- → DUPLICATE
confirm on FF 3.0.1


<script>

  r=new XMLHttpRequest()
  r.onreadystatechange=function(){if(r.readyState==4)alert(r.responseText)}
  r.open('GET','1.txt',false)
  r.send(null)

</script>
You need to log in before you can comment on or make changes to this bug.