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

TimothyGu commented on this pull request.



> +        1.  Set |instance|.\[[SetPrototypeOf]] as defined in [[#platform-object-setprototypeof]].
+    1.  Otherwise, if |interfaces| contains an [=interface=] which
+        [=support indexed properties|supports indexed properties=],
+        [=support named properties|named properties=], or both:
+        1.  Set |instance|.\[[GetOwnProperty]] as defined in
+            [[#legacy-platform-object-getownproperty]].
+        1.  Set |instance|.\[[Set]] as defined in
+            [[#legacy-platform-object-set]].
+        1.  Set |instance|.\[[DefineOwnProperty]] as defined in
+            [[#legacy-platform-object-defineownproperty]].
+        1.  Set |instance|.\[[Delete]] as defined in
+            [[#legacy-platform-object-delete]].
+        1.  Set |instance|.\[[PreventExtensions]] as defined in
+            [[#legacy-platform-object-preventextensions]].
+        1.  Set |instance|.\[[OwnPropertyKeys]] as defined in
+            [[#legacy-platform-object-ownpropertykeys]].

This is slightly problematic, as I think we shouldn't access any internal methods (which define algorithms do) before they are fully initialized – at least ES doesn't. However, it seems certainly correct that the define algorithms should not be visible to these overridden internal methods.

Could we do something like
- Initialize these internal methods right after "Set *instance*'s essential internal methods"
- Use ValidateAndApplyPropertyDescriptor directly (or otherwise directly access the property table) instead of DefinePropertyOrThrow

I feel like this also matches implementations better, as I don't think they would directly call the internal methods during bootstrapping.

This also applies to the [[SetPrototypeOf]] assignment for [[Global]].

-- 
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-203462026

Received on Wednesday, 13 February 2019 21:41:40 UTC