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

Fix typeof for native classes with shared global scope #1173 #1211

Merged
merged 3 commits into from
May 3, 2022

Conversation

Schmidor
Copy link
Contributor

@Schmidor Schmidor commented Apr 26, 2022

Closes #1173

@Schmidor Schmidor force-pushed the #1173 branch 3 times, most recently from 22fc84e to 28e0ce2 Compare April 26, 2022 13:28
@gbrail
Copy link
Collaborator

gbrail commented Apr 30, 2022

This fix seems right to me. Anyone else have an opinion?

@rbri
Copy link
Collaborator

rbri commented Apr 30, 2022

+ 1

@p-bakker
Copy link
Collaborator

Does it make sense that this change is only applied to the .getBase(Scriptable, String) variant and not to the Scriptable , int/Symbol variants?

@Schmidor
Copy link
Contributor Author

Good point, I'm updating the other variants and checking

@p-bakker
Copy link
Collaborator

Just curious: your PR changes what gets send into the .has(key, start) method for the start parameter.

However, quickly looking I don't see any Scriptable.has(key, start) impl. in the Rhino codebase that actually uses the start parameter.

Any thoughts why the changes in your PR actually fix anything?

@Schmidor
Copy link
Contributor Author

For the perceived bug a change in getBase(Scriptable start, String name) would be enough, as it was in the previous commit.
There it is the ImporterTopLevel implementation of has(String name, Scriptable start) which uses the start-Parameter within getPackageProperty.

But as you mentioned the other getBase variants, it is probably better to correct them to also to use start as parameter instead of the current obj, as it is documented in the ScriptableObject.has methods. Even it is currently not used.

@p-bakker
Copy link
Collaborator

There it is the ImporterTopLevel implementation of has(String name, Scriptable start)

Ah, missed that one

But as you mentioned the other getBase variants, it is probably better to correct them to also to use start as parameter

Yeah, wasn't suggesting the fix was wrong in any way, was just wondering why the changes would fix anything, cause it looked to me that the start param was never used, but as you pointed out it is. Passing the start object (as you do now) instead of the current object is indeed the correct way, according to EcmaScript

So now, with the other variants adjusted as well, this PR looks good to me

@gbrail
Copy link
Collaborator

gbrail commented May 3, 2022

This looks good to me too -- just testing for a quick merge. Thanks!

@gbrail gbrail merged commit cfe2ac2 into mozilla:master May 3, 2022
@rPraml
Copy link
Contributor

rPraml commented May 5, 2022

Looks good to me also

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.

Rhino 1.7.14 breaks typeof for Java Classes
5 participants