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 beta] add inspect and constructor to list of descriptor exceptions #16050

Merged
merged 3 commits into from
Jan 5, 2018
Merged

[BUGFIX beta] add inspect and constructor to list of descriptor exceptions #16050

merged 3 commits into from
Jan 5, 2018

Conversation

Dhaulagiri
Copy link
Contributor

In addition to inspect I ended up needing to add constructor as well to get things working (confirmed locally). Let me know if there is anything else I can do here.

Fixes #16049

@rwjblue
Copy link
Member

rwjblue commented Jan 4, 2018

@Dhaulagiri - I pushed some additional commits here, can you review?

@rwjblue
Copy link
Member

rwjblue commented Jan 4, 2018

Also, FWIW, with these changes your demo repo no longer fails due to the descriptor trap (though it does have a failing tests, but I think that is intentional).

@Dhaulagiri
Copy link
Contributor Author

Dhaulagiri commented Jan 4, 2018

@rwjblue correct that test failure was intentional.

These changes do fix the initial issue I reported but there are additional errors that this does not address:

You attempted to access the isFree._dependentKeys property (of <(unknown mixin):ember420>)

In this case isFree is a computed property on the object in question. This seems possibly more specific to our app so I can try to dig in and figure things out a little more.

And then

You attempted to access the firstObject.nodeType property (of [object Object],[object Object]).

This one is more puzzling to me as it happens when I initiate a jQuery plugin and it gets to a line of code like this within jQuery (2.1.4):

if ( jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {

Dhaulagiri and others added 3 commits January 4, 2018 16:29
Allow `constructor`, `prototype`, and `nodeType` accesses to return
`undefined`, and add `Symbol.toStringTag` when Symbol is defined.

Also, cleanup formatting to make it easier to see all the possible
branches.
@rwjblue
Copy link
Member

rwjblue commented Jan 4, 2018

@Dhaulagiri - I added nodeType to the list of items that return undefined (jQuery is checking to see if it is an element there).

Also, it seems like the first one is more app specific and might actually be a correct assertion (e.g. something in the app is doing this.isFree._dependentKeys).

@Dhaulagiri
Copy link
Contributor Author

Dhaulagiri commented Jan 4, 2018

Also, it seems like the first one is more app specific and might actually be a correct assertion

I'll take a closer look. It may end up being another Chai thing though as this works fine in our app but fails trying to do a deep equal comparison between two arrays with Chai. I wonder if it's trying to iterate through the keys somehow to do the comparison? It may take me a bit to find time to dig into that but the other stuff that is here will be a big help for us.

@rwjblue
Copy link
Member

rwjblue commented Jan 5, 2018

I'll take a closer look. It may end up being another Chai thing though as this works fine in our app but fails trying to do a deep equal comparison between two arrays with Chai.

Thanks for digging into it! We can definitely iterate on what we have here....

It may take me a bit to find time to dig into that but the other stuff that is here will be a big help for us.

No problem! I'm going to land this now then, so it makes it into the next beta (making it easier to test for others also)...

} else if (
property === 'prototype' ||
property === 'constructor' ||
property === 'nodeType'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these not needed for the other branch (no native Proxy) as well?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything returns undefined by default in that branch, we only add assertions for the specific properties that we know about...

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 participants