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

Invalid Web IDL: DigitalGoodsService needs an "[Exposed]" extended attribute #46

Closed
tidoust opened this issue Mar 18, 2022 · 6 comments
Closed

Comments

@tidoust
Copy link

tidoust commented Mar 18, 2022

The Web IDL definition of the DigitalGoodsService interface is currently invalid because interfaces must have an [Exposed] extended attribute. Something like:

[Exposed=Window, SecureContext] interface DigitalGoodsService { ... }
@rsolomakhin
Copy link
Collaborator

Thank you for the report. Fixed in commit e712065.

@rsolomakhin
Copy link
Collaborator

Hi @tidoust , if we don't want to expose DigitalGoodsService as window.DigitalGoodsService, what is the valid Web IDL definition for that?

So far we have been asking web developers to use if (window.getDigitalGoodsService) for feature detection. Adding ability for if (window.DigitalGoodsService) seems redundant.

@rsolomakhin rsolomakhin reopened this Apr 26, 2022
@tidoust
Copy link
Author

tidoust commented Apr 26, 2022

That is essentially not possible. Or rather, Web IDL defines a [LegacyNoInterfaceObject] extended attribute for that but, as the name suggests, it only exists for legacy purpose and should not be used in specifications.

Without that legacy extended attribute, interfaces always create a property on the global object.

@rsolomakhin
Copy link
Collaborator

That is very interesting. Do you know what is the reasoning for this?

@tidoust
Copy link
Author

tidoust commented Apr 27, 2022

Sorry, I don't know the history of the why and how. One possible reason is that this allows developers to override prototype methods, which you cannot do if you don't have access to the interface object.

The only remaining users of [LegacyNoInterfaceObject] today are WebGL extensions, and I note an ongoing discussion thread on removing the extended attribute, which mentions feature detection considerations (and prototype method overrides) at KhronosGroup/WebGL#3366

@rsolomakhin
Copy link
Collaborator

Great! Thank you for the link 😆

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

No branches or pull requests

2 participants