This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 28601 - Converting an ECMAScript value to a dictionary; use [[GetOwnProperty]] or [[Get]]?
Summary: Converting an ECMAScript value to a dictionary; use [[GetOwnProperty]] or [[G...
Status: RESOLVED WORKSFORME
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: WebIDL (show other bugs)
Version: unspecified
Hardware: PC Windows NT
: P2 normal
Target Milestone: ---
Assignee: Cameron McCormack
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-05-04 20:57 UTC by Travis Leithead [MSFT]
Modified: 2015-05-04 21:59 UTC (History)
5 users (show)

See Also:


Attachments

Description Travis Leithead [MSFT] 2015-05-04 20:57:46 UTC
Should we use [[GetOwnProperty]] or [[Get]] for checking the dictionary for a member?


Asking because with accessors on prototypes of Event objects, can I pass an event object instance in the dictionary parameter for an event constructor and have it work?

In http://heycam.github.io/webidl/#es-dictionary, is ambiguously says:

"For each dictionary member member declared on dictionary, in order"

It reads (to me) like "on" is a [[GetOwnProperty]], but perhaps it should be [[Get]]??
Comment 1 Travis Leithead [MSFT] 2015-05-04 21:23:00 UTC
Chrome [Canary 44] and Firefox both allow this to work.
Comment 2 Olli Pettay 2015-05-04 21:35:23 UTC
"value is the result of calling the [[Get]] internal method on V with property name key."

The dictionary is the thing being created, and
" every dictionary member is initially considered to be not present."

So, "on" doesn't refer to the JS object (V), but to the dictionary.
Comment 3 Boris Zbarsky 2015-05-04 21:57:36 UTC
> "For each dictionary member member declared on dictionary, in order"

If you look at how "dictionary" is defined, it comes from "For each dictionary dictionary in dictionaries" and "dictionaries" is "a list consisting of D and all of D’s inherited dictionaries" where D is an IDL dictionary type.

So "dictionary" in the above phrase is an IDL dictionary type, not a JS value or IDL value, and "declared on dictionary" means as a member of the relevant dictionary type.

There is not checking for a member going on at all, in other words.  You just take all the members listed in your IDL, and for each one you do a [[Get]] on the JS object.

And to answer your question in comment 0, for the typical way events are defined, you can in fact pass an event instance to that event's constructor and it will work.
Comment 4 Travis Leithead [MSFT] 2015-05-04 21:59:14 UTC
(In reply to Olli Pettay from comment #2)
> "value is the result of calling the [[Get]] internal method on V with
> property name key."
> 
> The dictionary is the thing being created, and
> " every dictionary member is initially considered to be not present."
> 
> So, "on" doesn't refer to the JS object (V), but to the dictionary.

Oops. You are right on. Thanks!