mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-13 22:39:59 +08:00
fix($httpBackend): don't delete xhr.onreadystatechange otherwise Safari :-O
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user