Side navigation
#6498 closed bug (fixed)
Opened April 28, 2010 01:10PM UTC
Closed January 08, 2011 09:39PM UTC
Last modified March 13, 2012 09:14PM UTC
XHR abort() method not working in IE7.
Reported by: | laurensonyourscreen | Owned by: | laurensonyourscreen |
---|---|---|---|
Priority: | high | Milestone: | 1.4.3 |
Component: | ajax | Version: | 1.4.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
When you call the abort() method on a jQuery XHR object. IE7 will raise an error. The error IE7 (version 7.0.6001.18000 to be exact) is giving is:
"Object doesn't support this property or method (line 5233)"
Looking into the jQuery source, it seems to fail on this peace of code:
"
Override the abort handler, if we can (IE doesn't allow it, but that's OK)
Opera doesn't fire onreadystatechange at all on abort
try {
var oldAbort = xhr.abort;
xhr.abort = function() {
if ( xhr ) {
oldAbort.call( xhr ); <-- here!
}
onreadystatechange( "abort" );
};
} catch(e) {console.log(e) }
"
To reproduce this in IE7, I used this:
"
var xhr = $.ajax({
url: 'http:samedomain.com/',
dataType: 'json'
});
xhr.abort();
"
I know the issue does not raise in Firefox 3.6.3. But I haven't tested it in other browsers.
Attachments (1)
Change History (12)
Changed June 14, 2010 07:41PM UTC by comment:1
Changed September 13, 2010 11:25PM UTC by comment:2
Possibly the same issue as ticket #6314.
So, this portion of jQuery is written with the assumption that xhr.abort() cannot be reassigned in IE. However, it turns out that under some circumstances xhr.abort() can be reassigned in IE - but the xhr methods in IE do not support a call() method so IE crashes when it hits that method call.
This can be fixed by borrowing the call() method from Function.prototype:
try { var oldAbort = xhr.abort; xhr.abort = function() { if ( xhr ) { if (oldAbort.call) { oldAbort.call( xhr ); } else { Function.prototype.call.call(oldAbort, oldAbort, xhr); } } onreadystatechange( "abort" ); }; } catch(e) { }
Changed September 13, 2010 11:44PM UTC by comment:3
Sorry, there was a mistake in the code in my last comment. The code is corrected in the attached patch. Here is what that code should have looked like:
try { var oldAbort = xhr.abort; xhr.abort = function() { if ( xhr ) { if (oldAbort.call) { oldAbort.call( xhr ); } else { Function.prototype.call.call(oldAbort, xhr); } } onreadystatechange( "abort" ); }; } catch( abortError ) {}
Changed October 14, 2010 11:08PM UTC by comment:4
Confirmed that the above patch fixes this issue for me.
Changed October 15, 2010 04:40AM UTC by comment:5
_comment0: | Can you confirm the patch at [9b655a176b0d045c3773357761acf2fa93cd9650] resolves this issue or is this still malfunctioning? → 1291923421564602 |
---|---|
milestone: | 1.4.2 |
owner: | → laurensonyourscreen |
priority: | → high |
status: | new → pending |
Can you confirm the patch at 9b655a176b0d045c3773357761acf2fa93cd9650 resolves this issue or is this still malfunctioning?
Changed November 11, 2010 11:09PM UTC by comment:6
status: | pending → closed |
---|
Automatically closed due to 14 days of inactivity.
Changed December 09, 2010 12:43AM UTC by comment:7
Hi,
I think I am running into this bug with jQuery 1.4.2. How can I tell in which version the fix will be included?
Thx,
-Mark
Changed December 09, 2010 07:41PM UTC by comment:8
Replying to [comment:7 mleden@…]:
Hi, I think I am running into this bug with jQuery 1.4.2. How can I tell in which version the fix will be included? Thx, -Mark
The commit snover linked to is included in 1.4.3. But you should try with the latest stable jQuery and maybe also the jQuery development version. Check http://docs.jquery.com/Downloading_jQuery for the links.
Can you then please report back here if the problem is fixed or if the issue remains request reopening and additionally provide a test case on http://jsfiddle.net showing the bug.
Changed January 04, 2011 02:06PM UTC by comment:9
I can confirm jQuery 1.4.4 solves the problem
Changed January 07, 2011 12:16AM UTC by comment:10
keywords: | ajax xht dataType abort() → ajaxrewrite |
---|---|
status: | closed → reopened |
Changed January 08, 2011 09:39PM UTC by comment:11
resolution: | → fixed |
---|---|
status: | reopened → closed |
Changed January 10, 2011 01:56AM UTC by comment:12
keywords: | ajaxrewrite |
---|---|
milestone: | → 1.4.3 |
Discussion here http://forum.jquery.com/topic/object-doesn-t-support-this-property-or-method-from-jquery-1-4-1-in-ie7-only