This repository was archived by the owner on Apr 12, 2024. It is now read-only.
fix($injector): add workaround for class stringification in Chrome v50/51#14531
Closed
gkalpak wants to merge 1 commit into
Closed
fix($injector): add workaround for class stringification in Chrome v50/51#14531gkalpak wants to merge 1 commit into
gkalpak wants to merge 1 commit into
Conversation
…0/51 Partially fixes angular#14240.
| expect(annotate(eval('a => b => b'))).toEqual(['a']); | ||
| }); | ||
|
|
||
| // Support: Chrome 50-51 only |
Contributor
|
Assuming the CI build passes this LGTM |
| // Workaround for MS Edge. | ||
| // Check https://connect.microsoft.com/IE/Feedback/Details/2211653 | ||
| result = func.$$ngIsClass = /^(?:class\s|constructor\()/.test(Function.prototype.toString.call(func)); | ||
| result = func.$$ngIsClass = /^(?:class\s|constructor\()/.test(stringifyFn(func)); |
Contributor
There was a problem hiding this comment.
In the regex, let's replace \s with \b. Otherwise it doesn't work in the situations like following:
class{ ... }class/* foo */ Bar { ... }
Member
Author
There was a problem hiding this comment.
I meant to do it as part of this PR, but forgot.
I will submit a new one.
| @@ -849,7 +853,7 @@ function createInjector(modulesToLoad, strictDi) { | |||
| if (!isBoolean(result)) { | |||
| // Workaround for MS Edge. | |||
| // Check https://connect.microsoft.com/IE/Feedback/Details/2211653 | |||
Member
There was a problem hiding this comment.
Maybe you could change the comment at the same time to:
// Support: Edge 12-13 only
// See https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/6156135/
It's fixed in the Edge preview and the bug has moved.
Member
Author
There was a problem hiding this comment.
Too late 😛
Will do in a follow-up PR.
gkalpak
added a commit
to gkalpak/angular.js
that referenced
this pull request
Apr 28, 2016
3 tasks
Member
Author
|
Follow-up: #14533 |
gkalpak
added a commit
to gkalpak/angular.js
that referenced
this pull request
Apr 28, 2016
gkalpak
added a commit
to gkalpak/angular.js
that referenced
this pull request
Apr 29, 2016
gkalpak
added a commit
that referenced
this pull request
Jun 27, 2016
Mentioned in #14531 (comment). Closes #14533
gkalpak
added a commit
that referenced
this pull request
Jun 27, 2016
Mentioned in #14531 (comment). Closes #14533
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
Bug fix.
What is the current behavior? (You can also link to an open issue here)
In Chrome v50, the
$injectorfails to properly detect classes and throws when trying toinvokea class.See #14240 (especially #14240 (comment) and #14240 (comment)).
What is the new behavior (if this is a feature change)?
Classes are detected and
$injetor.invoked correctly.Does this PR introduce a breaking change?
No
Please check if the PR fulfills these requirements
Tests for the changes have been added (for bug fixes / features)Docs have been added / updated (for bug fixes / features)Other information:
Everything works correctly on v52 without the fix. Not sure about v51.
We can't run the tests on CI, because the problem appears only when creating a class directly (not through
eval()). I added a couple of commented out tests, so it is easy to test once Chrome v52 is released (as stable). (I left a TODO note to remove them.)Partially fixes #14240.