Skip to content

Conversation

Ms2ger
Copy link
Member

@Ms2ger Ms2ger commented Feb 25, 2019

  • Update the steps for instantiating a platform object, which everything
    theoretically calls into, and which sets the primary interface into a new
    internal slot [[PrimaryInterface]].
  • Define the "implements" algorithm as checking the [[PrimaryInterface]]
    internal slot.

The algorithm here is roughly in correspondence with the V8 implementation,
where operation functions are allocated with a reference to a
FunctionTemplate object (which is in corresondence with WebIDL interfaces).
When checking the receiver of a method that came from WebIDL, the original
prototype chain is traversed by looking at the FunctionTemplate's parent.
The same FunctionTemplate is used in multiple JavaScript realms.

Fixes #97.


Preview | Diff

@Ms2ger
Copy link
Member Author

Ms2ger commented Feb 25, 2019

This was #595.

index.bs Outdated
@@ -12364,6 +12359,20 @@ The value of the [=function object=]’s <code class="idl">name</code> property

<h3 id="es-platform-objects">Platform objects implementing interfaces</h3>

<div algorithm>
An ECMAScript value |value| <dfn id="es-is-platform-object">is a platform object</dfn>
if [$Type$](|value|) is Object and if |value| has a \[[PrimaryInterface]] internal slot.
Copy link
Collaborator

Choose a reason for hiding this comment

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

So here is an interesting question: How should WindowProxy interact with all this? Probably followup fodder...

index.bs Outdated
@@ -12364,6 +12359,20 @@ The value of the [=function object=]’s <code class="idl">name</code> property

<h3 id="es-platform-objects">Platform objects implementing interfaces</h3>

<div algorithm>
An ECMAScript value |value| <dfn id="es-is-platform-object">is a platform object</dfn>
Copy link
Member

Choose a reason for hiding this comment

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

Just curious, why add a custom ID for this?

- Update the steps for instantiating a platform object, which everything
  theoretically calls into, and which sets the primary interface into a new
  internal slot [[PrimaryInterface]].
- Define the "implements" algorithm as checking the [[PrimaryInterface]]
  internal slot.

The algorithm here is roughly in correspondence with the V8 implementation,
where operation functions are allocated with a reference to a
FunctionTemplate object (which is in corresondence with WebIDL interfaces).
When checking the receiver of a method that came from WebIDL, the original
prototype chain is traversed by looking at the FunctionTemplate's parent.
The same FunctionTemplate is used in multiple JavaScript realms.

Fixes #97.
@Ms2ger Ms2ger merged commit d534bbe into whatwg:master Feb 25, 2019
@Ms2ger Ms2ger deleted the platform-brand branch February 25, 2019 16:27
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.

4 participants