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

Improve the named property visibility algorithm for Window. #626

Closed
wants to merge 2 commits into from
Closed

Improve the named property visibility algorithm for Window. #626

wants to merge 2 commits into from

Conversation

Ms2ger
Copy link
Member

@Ms2ger Ms2ger commented Jan 18, 2019

In particular, if a string is a supported property name as well as an own
property of the window or Window.prototype object, we don't need to block
that property from existing on the named properties object, since it will
be shadowed automatically.

Fixes #607.


Preview | Diff

@Ms2ger
Copy link
Member Author

Ms2ger commented Jan 18, 2019

Copy link
Member

@domenic domenic left a comment

Choose a reason for hiding this comment

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

I'm having a hard time getting my head around the correct thing to do in this space, but I hope this is helpful...

index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
1. While |prototype| is not null:
1. If |prototype| is not a [=named properties object=],
and |prototype| has an own property named |P|, then return false.
Copy link
Member

Choose a reason for hiding this comment

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

Are we sure that removing this clause is safe for the other 3 or so call sites of "named property visiblity algorithm"?

Copy link
Member Author

Choose a reason for hiding this comment

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

It'll only affect the other call sites if someone takes an object that supports named properties and sticks the named properties object into its proto chain. I don't think we need to care particularly about that scenario.

Copy link
Member

Choose a reason for hiding this comment

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

Well, it's observable, right? If so, what do implementations do?

Copy link
Member Author

Choose a reason for hiding this comment

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

IIRC, it's only observable in Gecko, and Gecko matches the new spec text.

In particular, if a string is a supported property name as well as an own
property of the window or Window.prototype object, we don't need to block
that property from existing on the named properties object, since it will
be shadowed automatically.

Fixes #607.
@Ms2ger
Copy link
Member Author

Ms2ger commented Feb 26, 2019

Any more thoughts?

Copy link
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

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

Apologies for the lack of follow-up, I was hoping someone else would have picked this up.

@EdgarChen could you also take a look?

@@ -12636,21 +12636,22 @@ internal method as follows.
is used to determine if a given named property is exposed on an object.
Some named properties are not exposed on an object depending on whether
the [{{OverrideBuiltins}}] [=extended attribute=] was used.
The algorithm operates as follows, with property name |P| and object |O|:
The algorithm operates as follows, with property name |P|, object |O|, and
optionally object |propertyHolder|:
Copy link
Member

Choose a reason for hiding this comment

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

Where is this invoked with propertyHolder?

@domenic
Copy link
Member

domenic commented Aug 2, 2021

@shvaikalesh this looks like it's in the same area as other stuff you've been doing. Would you be interested in picking this up (if it's still applicable)?

@annevk annevk deleted the branch whatwg:master October 5, 2021 06:44
@annevk annevk closed this Oct 5, 2021
@shvaikalesh
Copy link
Contributor

@domenic Yes, it's still applicable and the change around https://github.com/whatwg/webidl/pull/626/files#r251604914 is a very nice simplification that matches WebKit implementation. Hopefully, I will pick up this PR in a few weeks or so. Thanks!

@annevk
Copy link
Member

annevk commented Oct 14, 2021

That's great! (I didn't mean to close this by the way, it seems that somehow the branch rename didn't affect this PR and then when the master branch was removed it got automatically closed.)

@ExE-Boss
Copy link
Contributor

it seems that somehow the branch rename didn't affect this PR and then when the master branch was removed it got automatically closed.

That happens when the fork repository or branch was deleted, leaving behind a dangling PR.

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

Successfully merging this pull request may close these issues.

Named properties object / named property visibility algorithm with property on Window.prototype
5 participants