Closed Bug 647725 Opened 13 years ago Closed 13 years ago

Escape key cancels XmlHttpRequests too

Categories

(Core :: Networking, defect)

x86_64
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 614304

People

(Reporter: manish3177, Unassigned)

Details

User-Agent:       Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0) Gecko/20100101 Firefox/4.0
Build Identifier: FF 4.0 (and FF 3.6)

Pressing escape while an AJAX request is in progress or if an AJAX request is made in response to a keydown event for escape key, triggers onReadyStateChange right away with readyState === 4. Since this happens before the response is received from the server, the request is considered failed. Escape key should NOT cancel AJAX requests or form submits (haven't tried it) as it causes AJAX applications to misbehave. It should only cancel browser navigations via the address bar. FWIW, other browsers don't have this bug and I think this bug showed up in the last month or so in Firefox.

Reproducible: Always

Steps to Reproduce:
1. From the keydown event of an input element of type text, trigger an AJAX request when event.keyCode === 27 (escape). I'm invoking a web service using MS AJAX framework so I'm not providing sample code as it would mostly be noise.
2. Show a "failed!" alert in the failure delegate of the AJAX request.
3. Press escape in that input element.
Actual Results:  
You will see an alert with ("failed!"). If you set a breakpoint in server code, you will see that the alert fires right away before the call even returned from the server.

Expected Results:  
Success delegate should've been invoked.

Firefox should've waited for the server request to actually finish before triggering onReadyStateCache with readyState of 4.
Status: UNCONFIRMED → RESOLVED
Closed: 13 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.