fix($httpBackend): don't delete xhr.onreadystatechange otherwise Safari :-O

This commit is contained in:
Igor Minar
2014-01-03 09:23:51 -08:00
parent bc492c0fc1
commit 3d38fff8b4
2 changed files with 12 additions and 10 deletions

View File

@@ -93,14 +93,16 @@ describe('$httpBackend', function() {
// onreadystatechange might by called multiple times
// with readyState === 4 on mobile webkit caused by
// xhrs that are resolved while the app is in the background (see #5426).
it('should remove onreadystatechange when it is called with readyState=4 to ignore multiple calls', function() {
it('should not process onreadystatechange callback with readyState == 4 more than once', function() {
$backend('GET', 'URL', null, callback);
xhr = MockXhr.$$lastInstance;
xhr.status = 200;
xhr.readyState = 4;
xhr.onreadystatechange();
expect(xhr.onreadystatechange).toBeUndefined();
xhr.onreadystatechange();
expect(callback).toHaveBeenCalledOnce();
});
it('should set only the requested headers', function() {