Re: [heycam/webidl] Add an algorithm to create a platform object. (#635)

annevk commented on this pull request.



> @@ -869,6 +870,18 @@ its inheritance hierarchy has a cycle.  That is, an interface
 |A| cannot inherit from itself, nor can it inherit from another
 interface |B| that inherits from |A|, and so on.
 
+<div algorithm>
+  The [=list=] of <dfn for=interface>inclusive inherited interfaces</dfn> of an [=interface=] |I|
+  is defined as follows:
+
+    1.  Let |result| be « ».
+    1.  Let |interface| be |I|.
+    1.  While |interface| exists:
+        1.  [=list/Append=] |interface| to |result|.
+        1.  Let |interface| be the [=interface=] that |I| [=interface/inherits=] from, if any.

Set ... to*

I'd use "and null otherwise" here and use an explicit null check in the while statement. Currently it could read as leading to an infinite loop where _interface_ is basically never updated, because "if any" is false.

> @@ -12349,6 +12362,48 @@ It is the responsibility of specifications using Web IDL to state
 which global environment (or, by proxy, which global object) each platform
 object is associated with.
 
+<div algorithm>
+  To <dfn export lt="new|create|create a new|create an object implementing|create an object
+  implementing the interface">create an object implementing the interface</dfn> |interface| in the

I'd prefer if we encouraged a single style. I suspect "new" is most common, but not sure.

> @@ -12370,25 +12425,6 @@ must be the [=qualified name=] of
 the [=primary interface=]
 of the platform object.
 
-[=Platform objects=] which implement an [=interface=] which has a [{{Global}}]
-[=extended attribute=] have an internal \[[SetPrototypeOf]] method
-as defined in [[#platform-object-setprototypeof]].
-
-Within a [=Realm=] |realm|,
-for each [=interface=] |interface| implemented by a [=platform object=] |obj|,
-the following steps must be run as part of |obj|'s creation:
-
-1.  [=Define the unforgeable regular operations=] of |interface| on |obj|, given |realm|.
-1.  [=Define the unforgeable regular attributes=] of |interface| on |obj|, given |realm|.
-
-If within a [=Realm=] |realm| a [=platform object=] |obj| implements
-an interface which is declared with the [{{Global}}] [=extended attribute=], then

It seems you could assert this somehow in the new algorithm? To "prevent" the attempt of creation of objects outside their intended realm?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/heycam/webidl/pull/635#pullrequestreview-198611704

Received on Thursday, 31 January 2019 14:29:23 UTC