fix($browser.xhr): properly delete jsonp callbacks

This commit is contained in:
Igor Minar 2011-07-11 21:52:27 -07:00
parent 4ab3596295
commit c52e749a6e
2 changed files with 2 additions and 2 deletions

View file

@ -92,7 +92,7 @@ function Browser(window, document, body, XHR, $log) {
var script = jqLite(rawDocument.createElement('script'))
.attr({type: 'text/javascript', src: url.replace('JSON_CALLBACK', callbackId)});
window[callbackId] = function(data){
window[callbackId] = undefined;
delete window[callbackId];
script.remove();
completeOutstandingRequest(callback, 200, data);
};

View file

@ -96,7 +96,7 @@ describe('browser', function(){
fakeWindow[url[1]]('data');
expect(callback).toHaveBeenCalled();
expect(log).toEqual('remove();200:data;');
expect(typeof fakeWindow[url[1]]).toEqual('undefined');
expect(fakeWindow[url[1]]).toBeUndefined();
});
});