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

[BUGFIX release] Ensure proxies have access to getOwner(this). #16493

Merged
merged 1 commit into from
Apr 11, 2018

Conversation

rwjblue
Copy link
Member

@rwjblue rwjblue commented Apr 11, 2018

Prior to this change, when in debug builds, any "proxy" (i.e. something with unknownProperty) would not have access to an owner object via getOwner(this). This is because of our association with the FACTORY_FOR weakmap is only setup for the actual CoreObject instance being created, but when unknownProperty exists we never expose the "real" CoreObject instance and instead expose a native JS Proxy (so that we can trap usage of instance.foo and properly error).

This fix ensures that the native proxy that is returned is also associated with the factory, and can properly access getOwner(this) / ._debugContainerKey / etc.

Fixes #16484

Prior to this change, when in debug builds, any "proxy" (i.e. something
with `unknownProperty`) would _not_ have access to an `owner` object
via `getOwner(this)`. This is because of our association with the
`FACTORY_FOR` weakmap is only setup for the actual `CoreObject` instance
being created, but when `unknownProperty` exists we never expose the
"real" `CoreObject` instance and instead expose a native JS `Proxy` (so
that we can trap usage of `instance.foo` and properly error).

This fix ensures that the native proxy that is returned is also
associated with the factory, and can properly access `getOwner(this)` /
`._debugContainerKey` / etc.
@rwjblue rwjblue merged commit d2ff36c into emberjs:master Apr 11, 2018
@rwjblue rwjblue deleted the ensure-proxy-has-factory branch April 11, 2018 19:33
@rwjblue
Copy link
Member Author

rwjblue commented Apr 11, 2018

I've pulled these changes into the beta and release branches, you should be able to use the latest release / beta builds once CI is completed and the changes should be included in the next release of each branch...

@niranjan94
Copy link

Hi @rwjblue ! Thanks was the quick fix 😄

you should be able to use the latest release / beta builds once CI is completed

I'm unable to find the latest 3.1.x release which has this fix (3.1.1 - the latest release, does not). Am I missing something ? 🤔

@Dhaulagiri
Copy link
Contributor

@niranjan94 I had the same question yesterday, the answer can be found here

@niranjan94
Copy link

Thanks a lot @Dhaulagiri ! That works.

niranjan94 added a commit to fossasia/open-event-frontend that referenced this pull request Apr 16, 2018
Using a direct link to ember-source release until emberjs/ember.js#16493 gets tagged into an npm release
niranjan94 added a commit to fossasia/open-event-frontend that referenced this pull request Apr 17, 2018
Using a direct link to ember-source release until emberjs/ember.js#16493 gets tagged into an npm release
SaptakS pushed a commit to fossasia/open-event-frontend that referenced this pull request May 29, 2018
Using a direct link to ember-source release until emberjs/ember.js#16493 gets tagged into an npm release
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[3.1.0] getOwner returning false in ObjectProxy.init
3 participants