-
Notifications
You must be signed in to change notification settings - Fork 27.5k
fix($httpBackend): cancelled JSONP requests should not throw error #5616
Conversation
…he console When you cancel a JSONP request, angular deletes the callback for it. However the script still executes, and since the callback is now deleted and undefined, the script throws an exception visible in the console. The quick fix for this is not to delete the callback, but replace it with `angular.noop`. Closes angular#5615
I'm sorry, but I wasn't able to verify your CLA signature. CLA signature is required for any code contributions to AngularJS. Please sign our CLA and ensure that the CLA signature email address and the email address in this PR's commits match. If you signed the CLA as a corporation, please let me know the company's name. Thanks a bunch! PS: If you signed the CLA in the past then most likely the email addresses don't match. Please sign the CLA again or update the email address in the commit of this PR. |
Hi Igor. I've signed Google CLA on 2008-02-29 as Artemy Tregubenko or Artemy Tregoubenko. I suppose the email was atregoubenko@gmail.com, but it could have been me@arty.name as well. Should I change it to me@arty.name? |
you can just sign again with the same email address as you used in this commit |
please change the first line of the commit message to:
|
instead of using angular.noop, just set it to a simple fn that will remove the callback from the array when called. that way we are not leaving callbacks in that callbacks object. |
otherwise LGTM |
Regarding the usage of angular.noop, I believe we have choice of two options here. One is currently committed, and its downside is that the number of keys in the callbacks object grows, but all of them have the same object as value. Another option is to have self-removing functions as values, but each function would be different, because each of them needs to create a closure to store the key in. I believe the second options would be much more memory-inefficient because of all these closures and the fact that the callbacks will not necessarily be called. However I do not have a strong opinion here and just want to bring this up. What do you think? |
I have signed the CLA with the same email address atregoubenko@gmail.com which I have used for this commit. Regarding the commit message, I honestly do not know how to update it after it have been pushed to GitHub. I can close this pull request and create a new one with correct data. |
CLA signature verified! Thank you! Someone from the team will now triage your PR and it will be processed based on the determined priority (doc updates and fixes with tests are prioritized over other changes). |
alright. I'm fine with the change as is. thanks! |
…he console When you cancel a JSONP request, angular deletes the callback for it. However the script still executes, and since the callback is now deleted and undefined, the script throws an exception visible in the console. The quick fix for this is not to delete the callback, but replace it with `angular.noop`. Closes angular#5615 Closes angular#5616
…he console When you cancel a JSONP request, angular deletes the callback for it. However the script still executes, and since the callback is now deleted and undefined, the script throws an exception visible in the console. The quick fix for this is not to delete the callback, but replace it with `angular.noop`. Closes angular#5615 Closes angular#5616
When you cancel a JSONP request, angular deletes the callback for it. However the script still executes, and since the callback is now deleted and undefined, the script throws an exception visible in the console. The quick fix for this is not to delete the callback, but replace it with
angular.noop
.Closes #5615