-
Notifications
You must be signed in to change notification settings - Fork 164
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
The [SecureContext] text is unclear on exposure for interfaces #119
Comments
It's both.
The relevant normative text is http://heycam.github.io/webidl/#dfn-exposed (which explicitly references the "available only in secure contexts" state) and http://heycam.github.io/webidl/#es-interfaces which says that things that are not "exposed" in the
The normative text here is http://heycam.github.io/webidl/#SecureContext where it says that for an interface member that doesn't have
and then back to |
It seems like the word "exposed" in the text I originally quoted should really be linking to And regarding:
I, uh, managed to read the text leading into that section as "Whether a constructor..." instead of "Whether a construct..." which unsurprisingly threw me off there. :-/ One other thing that's unclear to me is what the exposure of partial interface members is if [SecureContext] is specified on the non-partial interface but not on the partial interface. Probably if the non-partial interface is [SecureContext] then we want any non-partial interfaces to be [SecureContext] too. In that case it would be good to require that to be explicit in any WebIDL, similar to the way interfaces that inherit from a [SecureContext] interface are also required to be explicitly [SecureContext]. |
http://heycam.github.io/webidl/#SecureContext says:
So if the non-partial interface is [SecureContext], then so are all its partial interfaces, whether they claim to be [SecureContext] or not. We could make this explicit, sure, by making it a parse failure if an interface is annotated [SecureContext] but one of its partial interfaces is not... |
Ah, right, thanks. Requiring partial interfaces to be annotated with [SecureContext] if their non-partial interface is would be a bit inconvenient for WebIDL authors but would have the advantage of being clearer to anyone reading the WebIDL. I expect more than a few content authors will end up asking themselves "why isn't this thing visible" when the answer is "because it requires a Secure Context", so requiring WebIDL authors to be explicit about this would be good I think. |
It seems adding a [SecureContext] extended attribute on a partial interface has no effects whatsoever. If so, shouldn't we prevent that altogether, much like we prevent adding [Constructor] to partial interfaces? |
Okay, so @jyasskin tells me on irc that so [SecureContext] on a partial interface whose's non partial interface doesn't have [SecureContext] is shorthand for marking each members of that partial interface with [SecureContext]. I think that shorthand notation makes things more complicated. I think it's simpler if you limit [SecureContext] to non partial interfaces and members. If [SecureContext] is on a non partial interface, then the whole interface is concerned. If it's on a member, it's just that member. searchfox.org tells me there's no case of [SecureContext] on anything but members and interfaces. Can we simplify things already? |
It's no different from how [Exposed] works. It's pretty helpful in making sure you don't miss members that you're adding, if you just flag your entire partial interface and are done with it. |
Oh, well, if [Exposed] already works that way… I guess we can just close this. |
Well the whole interface will be hidden and will throw with a SecurityError, so that should be pretty explicit. |
Even if we don't want to forbid [[SecureContext]] on partial interfaces, I think @tobie's confusion is evidence that the existing spec is unclear, and that it'd be worth some of his time to try to clarify it. |
@tobie this may be fixed with your recent overhaul; can you check? |
The [SecureContext] text currently says:
What does "the interface...is exposed only within a secure context" mean? Does it mean that [SecureContext] implies [NoInterfaceObject] in non-Secure Contexts? Or does it mean that all of an interface's members are only exposed within a secure context? Or both? If the former, that should be explicitly called out. If the latter, the text should be clearer and only talk about member exposure, not interface exposure.
CC @mikewest @bzbarsky
The text was updated successfully, but these errors were encountered: