Open Bug 369939 Opened 14 years ago Updated 12 years ago

NS_ERROR_NOT_AVAILABLE if scope starting the XMLHTTP request is removed


(Core :: XML, defect)

Windows XP
Not set





(Reporter: jdperlow, Unassigned)


(Keywords: testcase)


(1 file)

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

If an iframe calls back to a function in its parent page which then makes an XMLHTTP request and then the iframe is subsequently removed before the request finishes, the request fails. Specifically, it throws the exception NS_ERROR_NOT_AVAILABLE when trying to access the status or status text of the property. 

I attached a repro case for the problem. The repro case is slightly different from the actual code I was developing. In the repro case, for simplicity, I document.write into the iframe. In the actual code I was developing, the iframe was doing a GET to the server. 

It throws the exception in both FF 2.0 and also in trunk builds. In the trunk build, I also hit a debug assert when testing with the code I was developing. The assert at DEBUG_CheckForComponentInScope. I could not reproduce that problem with my test code.

Reproducible: Always

Steps to Reproduce:
1. Put attached bug.html file on an HTTP server.
2. Load it.
3. Click "Doesn't remove iframe" button. Note everything is okay.
4. Click "Removes iframe and shows bug" button. The error should be displayed.
Actual Results:  
Step 4 causes exception:

[Exception... "Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [nsIXMLHttpRequest.status]" nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame :: :: onReadyStateChange :: line 27" data: no]

Expected Results:  
Steps 3 and 4 should yield identical results.

There are bugs with similar issues. I wasn't sure if they overlap with this issue.  At minimum, a small repro case will help the person investigating.
Attached file Repro case
Keywords: testcase
Assignee: xml → nobody
QA Contact: ashshbhatt → xml
You need to log in before you can comment on or make changes to this bug.