W3C home > Mailing lists > Public > public-script-coord@w3.org > October to December 2014

Re: Determining what prototype should be used for an object

From: Boris Zbarsky <bzbarsky@mit.edu>
Date: Mon, 17 Nov 2014 09:41:08 -0500
Message-ID: <546A0904.5040303@mit.edu>
To: Anne van Kesteren <annevk@annevk.nl>
CC: Allen Wirfs-Brock <allen@wirfs-brock.com>, "public-script-coord@w3.org" <public-script-coord@w3.org>, Ian Hickson <ian@hixie.ch>
On 11/17/14, 9:32 AM, Anne van Kesteren wrote:
> Yeah something like that was the idea. We would of course have to
> define what it means to create a NodeList and other objects and if IDL
> is to start that creation process we would have to formalize the
> parameters. I think this is all doable though obviously it also means
> there will be quite some refactoring work. I'm happy to help out with
> that though.

This is the hard part.  How exactly do we phrase this?

Right now, creation of things is almost "declarative" in Web IDL in the 
sense that there are no specific steps associated with it.  This is the 
part we'll need to change...

The way I see it, we want to associate a Realm/global with every IDL 
object and then say that the JS reflection of the object starts out with 
the relevant standard prototype from that Realm.  All fine so far.

And maybe we should say that creation of an IDL object associates it 
with the current Realm unless specified otherwise.

So let's try this specific example of Node and .childNodes.  It seems to 
me that the process of creation here should go something like this:

1)  Go to create a Node.
2)  Discover that it wants to be in a particular Realm, make that Realm
     current.
3)  Create the Node.  This triggers creation of the .childNodes
     NodeList somehow.  It's very important that this creation happen
     here, while our desired Realm is current.
4)  Restore the old current Realm.

Does that seem sane?

-Boris
Received on Monday, 17 November 2014 14:41:39 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:23 UTC