mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-28 07:23:59 +00:00
fix($browser.xhr): properly delete jsonp callbacks
This commit is contained in:
parent
4ab3596295
commit
c52e749a6e
2 changed files with 2 additions and 2 deletions
|
|
@ -92,7 +92,7 @@ function Browser(window, document, body, XHR, $log) {
|
||||||
var script = jqLite(rawDocument.createElement('script'))
|
var script = jqLite(rawDocument.createElement('script'))
|
||||||
.attr({type: 'text/javascript', src: url.replace('JSON_CALLBACK', callbackId)});
|
.attr({type: 'text/javascript', src: url.replace('JSON_CALLBACK', callbackId)});
|
||||||
window[callbackId] = function(data){
|
window[callbackId] = function(data){
|
||||||
window[callbackId] = undefined;
|
delete window[callbackId];
|
||||||
script.remove();
|
script.remove();
|
||||||
completeOutstandingRequest(callback, 200, data);
|
completeOutstandingRequest(callback, 200, data);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@ describe('browser', function(){
|
||||||
fakeWindow[url[1]]('data');
|
fakeWindow[url[1]]('data');
|
||||||
expect(callback).toHaveBeenCalled();
|
expect(callback).toHaveBeenCalled();
|
||||||
expect(log).toEqual('remove();200:data;');
|
expect(log).toEqual('remove();200:data;');
|
||||||
expect(typeof fakeWindow[url[1]]).toEqual('undefined');
|
expect(fakeWindow[url[1]]).toBeUndefined();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue