Re: [heycam/webidl] Does WebIDL define whether or not the interface constructor should be exposed on the global? (#820)

> When I look up the WebIDLs of these interfaces, I don't see there are being defined differently

`Geolocation` used to be `[NoInterfaceObject]` in the Geolocation spec and in implementations. The spec got changed, but implementations have largely not followed (though Chrome dev _does_ have a `window.Geolocation`, fwiw; I'm not sure which version of Chrome you tested and whether their change is channel-limited or just recent: I don't see `window.Geolocation` in Chrome release 78, but do see it in Chrome beta 79).

> Isn't this what Exposed do — to make the constructor available on window?

Exposed says where things might be available, yes.  They won't be available where they are not exposed, but might be unavailable even in places where they are exposed (e.g. `[Exposed=Window,SecureContext]` is exposed only on some windows).

> In Chrome's case for navigator, `<instance>.constructor` seems to point to different version of that

I'm not sure what you mean.  `navigator.constructor` should be the same object as `window.Navigator`, and is in all browsers.  What are you really asking about here?

> In Safari & Firefox's case, Geolocation constructor is not exposed, and navigator.geolocation.constructor simply gives me the Object constructor.

This is correct behavior for a `[NoInterfaceObject]` interface.  See https://heycam.github.io/webidl/#interface-prototype-object step 12: since that step doesn't define anything, you get `Object.prototype.constructor`.

There's no Web IDL issue here, as far as I can tell.

-- 
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/issues/820#issuecomment-551996441

Received on Friday, 8 November 2019 21:29:32 UTC