This repository has been archived by the owner on Apr 12, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix($httpBackend): prevent DOM err due to dereferencing .responseText
If responseType is defined and the request fails for one reason or another the .response property returned falsy value which caused dereferencing of .responseText. If the responseType was a blob or document then an error was thrown. To prevent this, I'm checking for responseType first and based on that dereferencing .response or .responseText. We need to keep on checking .responseText because that's the original XHR response api that is still needed for IE8 and 9. Closes #1922
- Loading branch information
509ec74
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm looking at a bug here.
On ie8 (ie8 standards) xhr looks like this for me:
{responseType:"json", responseText:'{"status": "success", ...}', response: undefined}
(maybe a better check would be 'response' in xhr)?? that will test for existence, instead of falsy...
in ie8 i'm seeing this:
'response' in xhr -> false
509ec74
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like xhr.responseType is being set manually on line 104:
angular.js/src/ng/httpBackend.js
Line 104 in 509ec74