Re: Determining what prototype should be used for an object

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