Skip to content
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

RegExp.prototype.flags cannot be read in Chrome Canary #370

Closed
fizker opened this issue Nov 9, 2015 · 12 comments
Closed

RegExp.prototype.flags cannot be read in Chrome Canary #370

fizker opened this issue Nov 9, 2015 · 12 comments

Comments

@fizker
Copy link

fizker commented Nov 9, 2015

One of the shims adds a getter for RegExp.prototype.flags, and guards against overriding the native by reading the current value.

But reading RegExp.prototype.flags throws an error in Chrome Canary (48.0.2559.0): Uncaught TypeError: RegExp.prototype.global getter called on non-RegExp object.

Note: Chrome Canary requires the Experimental JavaScript flag to be enabled before exposing RegExp.prototype.flags.

@mathiasbynens
Copy link
Contributor

That matches the spec. The error message summarizes it well.

@fizker
Copy link
Author

fizker commented Nov 9, 2015

The problem is that our webapp breaks in es6-shim because it tries to test whether or not to shim the feature

@ljharb
Copy link
Collaborator

ljharb commented Nov 9, 2015

@fizker this is indeed part of the spec - you'll need to use typeof Object.getOwnPropertyDescriptor(RegExp.prototype, 'flags').get !== 'function' to detect it.

@fizker
Copy link
Author

fizker commented Nov 9, 2015

@ljharb No, technically you need to use that :P. I have made a PR with it

@ljharb
Copy link
Collaborator

ljharb commented Nov 9, 2015

ha, touché. i haven't yet updated things to pass in Chrome Canary. Thanks for the PR.

@ljharb
Copy link
Collaborator

ljharb commented Nov 10, 2015

Fixed in c563abf

@fizker
Copy link
Author

fizker commented Nov 10, 2015

Perfect :). Do you know when this will get released? I would prefer to get it into production as soon as possible, as the crash was rather nasty.

@ljharb
Copy link
Collaborator

ljharb commented Nov 10, 2015

I will release it shortly, but it's Chrome Canary - nobody using a canary build should have any expectation of any site working. Chrome Stable won't release with it for many weeks.

@fizker
Copy link
Author

fizker commented Nov 10, 2015

Still, I would prefer having more time for testing, as we are not on the newest es6-shim. If I am not mistaken, we are still on a version that uses String#contains rather than String#includes, so a lot of other things could also be breaking changes. Anyway, thanks for the quick turn-around on this issue :)

@ljharb
Copy link
Collaborator

ljharb commented Nov 10, 2015

aha, that's a very very old version indeed - you will want to upgrade soon. I'll have v0.33.11 out today.

@ljharb
Copy link
Collaborator

ljharb commented Nov 10, 2015

@fizker
Copy link
Author

fizker commented Nov 10, 2015

Nice! Thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants