LiTiang / js-test-driver

Automatically exported from code.google.com/p/js-test-driver
0 stars 0 forks source link

Two asynchronous XMLHttpRequests, 1 fails to send but reports success #251

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Setup a servlet that just responds with an increasing count each time it 
receives a request.
2. Setup an asynchronous test case and queue in two of the exact same function 
calls that construct an XMLHttpRequest and sends it. On response, print the 
response object.
3. Launch the test with Firefox + firebug

What is the expected output? What do you see instead?
Both requests should be fired, and different numbers should be reported. 
However, firebug reports that the objects are the same, and that the second 
request only took <10 ms to complete, whereas the first took 200 ms. There 
seems to be some kind of caching done in the test framework. Adding a queued 
empty function between them causes things to behave correctly. Tested on an 
html page, two side by side constructed requests respond properly. The server 
never sees the second request when using the test framework.

What version of the product are you using? On what operating system?
1.3.2 - Win32

Please provide any additional information below.
Example:

//Broken test
test.prototype.testQuery = function(queue){
  queue.call(function(callbacks){
        //XML query here. Print response.
    });
  queue.call(function(callbacks){
        //XML query here. Print response
    });
}

//Success test
test.prototype.testQuery2 = function(queue){
  queue.call(function(callbacks){
        //XML query here. Print response.
    });
  queue.call(function(callbacks){});

  queue.call(function(callbacks){
        //XML query here. Print response
    });
}

Original issue reported on code.google.com by sachs.paul on 5 Jul 2011 at 2:33