-
Notifications
You must be signed in to change notification settings - Fork 27.4k
fix($q): correctly set constructor on prototypes #10697
Conversation
This patch will correctly set `Promise.prototype.constructor` and `Deferred.prototype.constructor`. When prototype is set in the form `Foo.prototype = {x: y};`, the constructor will not be set correctly (as opposed to in the form `Foo.prototype.x = y;`. As such, it is necessary to manually add the constructor to the prototype in these cases.
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project, in which case you'll need to sign a Contributor License Agreement (CLA) at https://cla.developers.google.com/. If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check the information on your CLA or see this help article on setting the email on your git commits. Once you've done that, please reply here to let us know. If you signed the CLA as a corporation, please let us know the company's name. |
I've signed the cla, please let me know if any other steps need to be completed for this PR to be approved. Thanks! |
CLAs look good, thanks! |
Why not just
? |
Good suggestion! Done |
@bluepnume can you look into the Travis failure, it looks like a valid failure |
I reset the previous commit. It looks like |
@bluepnume look at |
Add `setHashKey` and `extend` methods, to allow `$q` to use `extend` to extend its prototype.
Use `extend` on `Promise.prototype` and `Deferred.prototype`, to avoid having to manually set `constructor` on the overwritten prototypes.
Hi,
Thanks! |
Use `extend` on `Promise.prototype` and `Deferred.prototype`, to avoid having to manually set `constructor` on the overwritten prototypes. Closes angular#10697
Use `extend` on `Promise.prototype` and `Deferred.prototype`, to avoid having to manually set `constructor` on the overwritten prototypes. Closes angular#10697
This patch will correctly set
Promise.prototype.constructor
andDeferred.prototype.constructor
.When prototype is set in the form
Foo.prototype = {x: y};
, the constructor will not be set correctly (as opposed to in the formFoo.prototype.x = y;
.As such, it is necessary to manually add the constructor to the prototype in these cases.