Closed Bug 707256 Opened 13 years ago Closed 12 years ago

abort event listener no longer called on nsIXMLHttpRequest

Categories

(Add-on SDK Graveyard :: General, defect, P2)

x86
macOS
defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: irakli, Unassigned)

References

Details

In jetpack we observe regression on nightlies with nsIXMLHttpRequest, abort event listeners are no longer called when requests are aborted. Here is a simple test case:

var aborted = false;
var xhr = Components.classes['@mozilla.org/xmlextras/xmlhttprequest;1'].
          createInstance(Ci.nsIXMLHttpRequest);
xhr.addEventListener('abort', function() { aborted = true }, false);
aborted // is false (on nightly) while expected to be true
Regression range?
Component: Networking: HTTP → DOM
QA Contact: networking.http → general
I don't know when regression has been introduced, but it seems to work as expected on aurora.
> I don't know when regression has been introduced,

Are you willing to figure that out using http://harthur.github.com/mozregression/ ?
We had a recent change to abort event dispatch in bug 703380.  That bug was about abort events firing after a load or error event fired, which is incorrect behavior.  Could this be related to that?
Yeah, I think it's definitely related.  The XHR2 spec states that if the request is in an UNSENT state, then the event should not be fired:

http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#the-abort-method

The testcase in comment 3 does not reflect that:  it checks the event count before and after the abort call, but send is never called.
Yeah, it's intentional and expected that "abort" event will not be fired in UNSENT state. The test should be fixed.
Component: DOM → General
Product: Core → Add-on SDK
QA Contact: general → general
Version: Trunk → unspecified
Commit pushed to https://github.com/mozilla/addon-sdk

https://github.com/mozilla/addon-sdk/commit/604069d1d7277025b062372682da5e02a8be04fd
Disable failing XHR test until platform bug 707256 is fixed.(cherry picked from commit 8a927261d7fd06bf0c5a1ae62f2b236ca8305bad)
Commit pushed to https://github.com/mozilla/addon-sdk

https://github.com/mozilla/addon-sdk/commit/604069d1d7277025b062372682da5e02a8be04fd
Disable failing XHR test until platform bug 707256 is fixed.(cherry picked from commit 8a927261d7fd06bf0c5a1ae62f2b236ca8305bad)
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.