[whatwg/webidl] Named properties object [[GetOwnProperty]] conflicts with class string (Issue #1365)

The spec section for the named properties object (with no direct anchor to link to :( ) says:

https://webidl.spec.whatwg.org/#named-properties-object

> The [class string](https://webidl.spec.whatwg.org/#dfn-class-string) of a [named properties object](https://webidl.spec.whatwg.org/#dfn-named-properties-object) is the concatenation of the [interface](https://webidl.spec.whatwg.org/#dfn-interface)'s [identifier](https://webidl.spec.whatwg.org/#dfn-identifier) and the string "Properties".

Reading the text for `class string` this tells us that the WindowProperties object needs a direct property defined like so:

> If an object has a [class string](https://webidl.spec.whatwg.org/#dfn-class-string) classString, then the object must, at the time it is created, have a property whose name is the [@@toStringTag](https://tc39.es/ecma262/multipage/ecmascript-data-types-and-values.html#sec-well-known-symbols) symbol with PropertyDescriptor{[[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true, [[Value]]: classString}.

However, in the algorithm for the named properties object's [[GetOwnProperty]] internal slot, there is no provision for making sure that calls to `[[Get]](window.__proto__.__proto__, @@toStringTag)` actually retrieve the toStringTag from the Named properties object rather than redirecting to the window.

https://webidl.spec.whatwg.org/#named-properties-object-getownproperty

With my reading of the spec, it seems like a call to https://tc39.es/ecma262/#sec-ordinaryget on the WindowProperties object will always direct the call over to the Window to do its getter steps, rather than reserving @@toStringTag for itself.

Every browser seems to implement this with the exception, where `window.__proto__.__proto__.toString()` gives `[object WindowProperties]` rather than  the `[object Window]` you would get with a naive reading of the algorithm in [[GetOwnProperty]].

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/webidl/issues/1365
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/webidl/issues/1365@github.com>

Received on Wednesday, 20 September 2023 01:01:26 UTC