Closed Bug 329264 Opened 18 years ago Closed 2 years ago

Use of XMLHttpRequest object does not work inside onUnload JS event

Categories

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

x86
Linux
defect

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: adrianob, Unassigned)

References

()

Details

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.
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
Component: DOM → DOM: Core & HTML
QA Whiteboard: qa-not-actionable

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 → --

Unsurprisingly, the test case from 2006 is no longer reachable. I'm sure our implementation of XHR has changed a lot since then, so I'm just going to mark this incomplete.

Status: NEW → RESOLVED
Closed: 2 years ago
Component: DOM: Core & HTML → DOM: Networking
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.