Use of XMLHttpRequest object does not work inside onUnload JS event

NEW
Unassigned

Status

()

Core
DOM
P5
major
13 years ago
19 days ago

People

(Reporter: Adriano Bonat, Unassigned)

Tracking

Trunk
x86
Linux
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

(Reporter)

Description

13 years ago
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.1) Gecko/20060209 Debian/1.5.dfsg+1.5.0.1-2 Firefox/1.5.0.1
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.1) Gecko/20060209 Debian/1.5.dfsg+1.5.0.1-2 Firefox/1.5.0.1

If you look the URL that demonstrates the problem, you could test two ways to tell the server that the client closed the window, this process of tell the server are using XMLHttpRequest object (other way could be open a new window).

The first way in the tests, is use XMLHttpRequest on the popup's unload event, this way produces an exception on the Javascript Console:

Error: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMWindowInternal.alert]"  nsresult: "0x80004005 (NS_ERROR_FAILURE)"  location: "JS frame :: http://localhost/~adriano/testes/unload.xtr/popup.html :: anonymous :: line 43"  data: no]
Source File: http://localhost/~adriano/testes/unload.xtr/popup.html
Line: 43

and the async request to the server does not happen.

The second way is call an opener's function that does the async call to the server. This way almost work, the responseText of the object results empty.

Reproducible: Always

Steps to Reproduce:
1. On the unload event, do an async call to the server; or call an opener's function to do this work.


Actual Results:  
The first way produces an exception in Javascript console; and the second gets the responseText empty, the request isn't executed.

Expected Results:  
The async call be executed and the responseText returned ok.

Updated

13 years ago
Assignee: nobody → general
Component: General → DOM
Product: Firefox → Core
QA Contact: general → ian
Version: unspecified → 1.8 Branch
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9a1) Gecko/20060324 Firefox/1.6a1 - Build ID: 0000000000
Confirmed.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Version: 1.8 Branch → Trunk
Assignee: general → nobody
QA Contact: ian → general
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
You need to log in before you can comment on or make changes to this bug.