Closed tidoust closed 2 years ago
Thank you for the report. Fixed in commit https://github.com/WICG/digital-goods/commit/e712065dd43a1cc273753171e27e54df2499a7b7.
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.
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.
That is very interesting. Do you know what is the reasoning for this?
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 https://github.com/KhronosGroup/WebGL/issues/3366
Great! Thank you for the link 😆
The Web IDL definition of the
DigitalGoodsService
interface is currently invalid because interfaces must have an[Exposed]
extended attribute. Something like: