[whatwg/webidl] Can a platform object’s associated Realm really change? (Issue #1189)

I’m not sure if the following passage is accurate:

> The [Realm](https://tc39.es/ecma262/#realm) that a given [platform object](https://webidl.spec.whatwg.org/#dfn-platform-object) is associated with can change after it has been created. When the [Realm](https://tc39.es/ecma262/#realm) associated with a platform object is changed, its [[Prototype]] [internal slot](https://tc39.es/ecma262/#sec-object-internal-methods-and-internal-slots) must be immediately updated to be the [interface prototype object](https://webidl.spec.whatwg.org/#dfn-interface-prototype-object) of the [primary interface](https://webidl.spec.whatwg.org/#dfn-primary-interface) from the [platform object](https://webidl.spec.whatwg.org/#dfn-platform-object)'s newly associated [Realm](https://tc39.es/ecma262/#realm).

(Links: [bikeshed source](https://github.com/whatwg/webidl/blob/b03aa9e0ceba067f2310431a4ac06f74b3f549c2/index.bs#L13470-L13476); [rendered spec](https://webidl.spec.whatwg.org/#dfn-change-global-environment)).

Supposedly the [associated realm](https://webidl.spec.whatwg.org/#dfn-associated-realm) of a [platform object](https://webidl.spec.whatwg.org/#dfn-platform-object) is, via [relevant realm](https://html.spec.whatwg.org/multipage/webappapis.html#concept-relevant-realm) from HTML, the values of their [[Realm]] slots. Their [[Realm]] slots are allocated and set in steps 4 and 5 of [_internally create a new object implementing the interface_](https://webidl.spec.whatwg.org/#internally-create-a-new-object-implementing-the-interface).

Nothing in Web IDL appears to reassign those values. There’s an exported definition (`dfn-change-global-environment`), but it [doesn’t seem to be referenced](https://github.com/w3c/webref/search?q=dfn-change-global-environment) in other specs, either.

It looks like this was written [9 years ago](https://github.com/whatwg/webidl/commit/2a2ed06099aa5738a07b734276d78e96289d1f94) and hasn’t changed apart from markup/formatting and replacement of “global environment” with “Realm”. Is it still accurate?

My best guess is that it might have been intended to explain the behavior of (what we now call) WindowProxy, which I think [hadn’t yet been formalized](https://blog.whatwg.org/windowproxy-window-and-location). A WindowProxy isn’t itself a platform object and the hypothetical Window objects that they proxy have static [[Realm]] values, as far as I know, so it could just be text that became outdated when that more complete explanation of “windowness” was specified.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/webidl/issues/1189

You are receiving this because you are subscribed to this thread.

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

Received on Tuesday, 13 September 2022 03:01:04 UTC