-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update this reference to self #3137
Conversation
Hi there, In `this._execCommand` at line 73 the `this` keyword is use instead of `self`. In case of _execCommand override or external call, `this` will be undefined. This proposal just fix that.
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here (e.g. What to do if you already signed the CLAIndividual signers
Corporate signers
|
|
CLAs look good, thanks! |
@Itee thanks for pull request. Would you mind to update commit message ? Karma use validate-commit-msg style for that. My proposition is:
|
@@ -70,7 +70,7 @@ function ProcessLauncher (spawn, tempDir, timer, processKillTimeout) { | |||
return self._clearTempDirAndReportDone('no binary') | |||
} | |||
|
|||
cmd = this._normalizeCommand(cmd) | |||
cmd = self._normalizeCommand(cmd) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@devoto13, @johnjbarton
What do you thinks about that ? I did something opposite here:
#3157
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider this example: https://jsfiddle.net/devoto13/1ptvhgxn/
Apparently the only case, where it has incorrect this
is when method is passed as callback by reference (i.e. .then(myClass.myMethod)
) or similar, which is ultimately shooting yourself in the foot. So I think your (@lusarz's) way is good as long as we (and consumers) avoid this pattern.
But maybe I'm missing something. @Itee can you provide a more complete example of when this breaks?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But note that changes from self to this can potentially be breaking to the third-party code, which uses the mentioned pattern, so should probably go into a major version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @devoto13 for great input - I'll analyze your example more precisely tomorrow, but I think I know what you mean.
That's true - it would be better to release major version with these changes
Sorry this did not work out. I'm going to close a lot of older pull requests as the source code has changed a lot over the last year. |
Hi there,
In
this._execCommand
at line 73 thethis
keyword is use instead ofself
. In case of _execCommand override or external call,this
will be undefined.This proposal just fix that.
Check that your description matches the automatic change-log format:
http://karma-runner.github.io/2.0/dev/git-commit-msg.html
then delete this reminder.