Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add discussion of unexposed interfaces? #1236

Open
RByers opened this issue Nov 23, 2022 · 6 comments
Open

Add discussion of unexposed interfaces? #1236

RByers opened this issue Nov 23, 2022 · 6 comments

Comments

@RByers
Copy link

RByers commented Nov 23, 2022

Reading over the definition of Exposed, LegacyNoInterfaceObject and the history in #365 and #350 I'm left quite confused on what WebIDL's position is on interfaces without an ES interface object.

Does WebIDL take the position that all new interfaces should be exposed on at least one global interface? Why? If not, then what's the "non-legacy" way to mark an interface as not being exposed? To what extent should this be discussed somewhere in the WebIDL spec vs. maybe the TAG design principals?

Given that the platform and applications share a global namespace, it seems that there's a tension here. As we add new APIs to the platform we often can't expose new generic property names on window because doing so often leads to breaking some websites, such as those which conditionally set global properties they depend on only when its previously undefined. So do we need to use non-generic names for all new interfaces? Or can we avoid worrying about this for interfaces without constructors by just not exposing them?

This is coming up now because in blink we're trying to expose the Report interface and needing to do a bunch of web compat analysis to figure out whether or not we can do so safely. What is the cost/benefit tradeoff of exposing interfaces like this one?

@bathos
Copy link
Contributor

bathos commented Nov 23, 2022

This is coming up now because in blink we're trying to expose the Report interface and needing to do a bunch of web compat analysis to figure out whether or not we can do so safely. What is the cost/benefit tradeoff of exposing interfaces like this one?

Report is already exposed in gecko, which was a relief because at one point there was a bug with its toJSON that we needed to patch. It was lucky that we didn’t have this issue in Blink, where it wouldn’t have been similarly addressable.

@annevk
Copy link
Member

annevk commented Nov 24, 2022

Does WebIDL take the position that all new interfaces should be exposed on at least one global interface?

Yes.

Why?

Because that's the platform convention and matches idiomatic JS.

So do we need to use non-generic names for all new interfaces?

Either that or do some measurements, yes. This is often needed anyway due to the large variety of existing APIs you might end up clashing with.

@RByers
Copy link
Author

RByers commented Nov 24, 2022

Report is already exposed in gecko

When was that added? MDN BCD doesn't have it and I definitely don't see it in Firefox 107. Maybe Firefox will hit the web compat issues before Chrome?

Because that's the platform convention and matches idiomatic JS.

Ok. Should there perhaps be a non-normative note saying that while in the past it was common to use [NoInterfaceObject], this is discouraged in order to match idiomatic JS?

@annevk
Copy link
Member

annevk commented Nov 24, 2022

Yeah, I think that's reasonable. https://webidl.spec.whatwg.org/#LegacyNoInterfaceObject seems to defer to https://webidl.spec.whatwg.org/#es-interfaces for requirements, but it's only really talking about implementation requirements and not recommendations for specification editors.

Perhaps a warning similar to what we have for [LegacyNamespace] is appropriate.

@EdgarChen
Copy link
Member

Report is already exposed in gecko

We exposed Report only on Nightly before, but now it has been disabled as our implementation is out dated.

@bathos
Copy link
Contributor

bathos commented Nov 24, 2022

We exposed Report only on Nightly before, ...

Apologies, was remembering the particulars of that issue wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants