Re: [heycam/webidl] Editorial: Avoid changing internal methods of ordinary objects (#901)

@domenic requested changes on this pull request.

Looks good with some editorial issues.

> @@ -11288,7 +11288,16 @@ with the [{{LegacyNoInterfaceObject}}] [=extended attribute=].
         then set |proto| to |realm|.\[[Intrinsics]].[[{{%Error.prototype%}}]].
     1.  Otherwise, set |proto| to |realm|.\[[Intrinsics]].[[{{%Object.prototype%}}]].
     1.  Assert: <a abstract-op>Type</a>(|proto|) is Object.
-    1.  Let |interfaceProtoObj| be [=!=] [$OrdinaryObjectCreate$](|proto|).
+    1.  If |interface| is declared with the [{{Global}}] [=extended attribute=], or
+        |interface| is in the set of [=inherited interfaces=] of an interface
+        that is declared with the [{{Global}}] [=extended attribute=], then:
+        1.  Let |interfaceProtoObj| be [=!=] [$MakeBasicObject$](« \[[Prototype]], \[[Extensible]] »).

This declares a variable which immediately goes "out of scope". The "Let" needs to be earlier. (Perhaps by moving the "Let interfaceProtoObj be OrdinaryObjectCreate(proto)" before, and only overriding it when the if condition is true.)

> @@ -11288,7 +11288,16 @@ with the [{{LegacyNoInterfaceObject}}] [=extended attribute=].
         then set |proto| to |realm|.\[[Intrinsics]].[[{{%Error.prototype%}}]].
     1.  Otherwise, set |proto| to |realm|.\[[Intrinsics]].[[{{%Object.prototype%}}]].
     1.  Assert: <a abstract-op>Type</a>(|proto|) is Object.
-    1.  Let |interfaceProtoObj| be [=!=] [$OrdinaryObjectCreate$](|proto|).
+    1.  If |interface| is declared with the [{{Global}}] [=extended attribute=], or
+        |interface| is in the set of [=inherited interfaces=] of an interface
+        that is declared with the [{{Global}}] [=extended attribute=], then:
+        1.  Let |interfaceProtoObj| be [=!=] [$MakeBasicObject$](« \[[Prototype]], \[[Extensible]] »).
+        1.  Set |interfaceProtoObj|.\[[Prototype]] to |proto|.
+        1.  Set the internal methods of |interfaceProtoObj|
+            which are specific to [=immutable prototype exotic objects=]
+            to the definitions specified in
+            [=ECMA-262 Immutable prototype exotic objects=].
+    1.  Else, let |interfaceProtoObj| be [=!=] [$OrdinaryObjectCreate$](|proto|).

s/Else/Otherwise

-- 
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/901#pullrequestreview-443253060

Received on Monday, 6 July 2020 16:58:11 UTC