Closed Bug 1017988 Opened 11 years ago Closed 10 years ago

Implement [Exposed] in WebIDL

Categories

(Core :: DOM: Core & HTML, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla34

People

(Reporter: bzbarsky, Assigned: bzbarsky)

References

Details

Attachments

(11 files, 4 obsolete files)

4.09 KB, patch
khuey
: review+
Details | Diff | Splinter Review
2.44 KB, patch
khuey
: review+
Details | Diff | Splinter Review
4.58 KB, patch
khuey
: review+
Details | Diff | Splinter Review
2.41 KB, patch
khuey
: review+
Details | Diff | Splinter Review
12.83 KB, patch
khuey
: review+
Details | Diff | Splinter Review
31.51 KB, patch
khuey
: review+
Details | Diff | Splinter Review
7.55 KB, patch
khuey
: review+
Details | Diff | Splinter Review
12.24 KB, patch
khuey
: review+
Details | Diff | Splinter Review
14.62 KB, patch
khuey
: review+
Details | Diff | Splinter Review
32.18 KB, patch
khuey
: review+
Details | Diff | Splinter Review
15.05 KB, patch
khuey
: review+
Details | Diff | Splinter Review
Oh, there's another issue with the spec as it stands, that the Google folks raised. The parsing is ambiguous, because the same separator is used for the values of Exposed and between different extended attributes. Consider: [Exposed=Window,ChromeOnly] and compare to: [Exposed=Window,Worker] My gut feeling is that we should just make the value a string for now, so basically have [Exposed="Window"] or [Exposed="Worker"] or [Exposed="Window,Worker"] or [Exposed="Worker,Window"] and then post-process the value by splitting on ',' to convert it to a set of names. Any brighter ideas?
Alternately, we could support the values Window, Worker, All for now. Note to self: technically per spec we need to support things like [Global=Worker,DedicatedWorker] for this stuff to work. That has the same parsing issue, though...
To be clear, there's also: https://www.w3.org/Bugs/Public/show_bug.cgi?id=24417 https://www.w3.org/Bugs/Public/show_bug.cgi?id=22646#c23 https://www.w3.org/Bugs/Public/show_bug.cgi?id=24959 In the last of those bugs the suggestion is made to use & rather than , to separate values.
(In reply to comment #2) > Alternately, we could support the values Window, Worker, All for now. > > Note to self: technically per spec we need to support things like > [Global=Worker,DedicatedWorker] for this stuff to work. That has the same > parsing issue, though... We can hardcode the values when parsing both [Global] and [Exposed], right?
> https://www.w3.org/Bugs/Public/show_bug.cgi?id=24417 I think the current spec text covers this already, fwiw. > https://www.w3.org/Bugs/Public/show_bug.cgi?id=22646#c23 Not going to worry about that for now. > https://www.w3.org/Bugs/Public/show_bug.cgi?id=24959 Yes, that's comment 1. > We can hardcode the values when parsing both [Global] and [Exposed], right? So far we only seem to have things that are exposed on window, worker, or both, so we could. But once people start doing stuff with exposing stuff only on dedicated workers or whatnot, that will get more complicated...
With shared workers I definitely expect that to be the case. There will likely be new workers going forward too.
Depends on: 1045561
Depends on: 1045743
Assignee: nobody → bzbarsky
Status: NEW → ASSIGNED
Attachment #8464538 - Flags: review?(khuey)
Note that this is NOT implementing automatic checks for [Exposed] on interface members before actually exposing them. I'd like to get the basic infrastructure for tracking exposure sets in place first; then we can figure out how to sanely do that part.
Whiteboard: [need review]
I filed bug 1046107 on the Exposed mess for ServiceWorker.
Blocks: 1007135
Attachment #8464534 - Attachment is obsolete: true
Attachment #8464534 - Flags: review?(khuey)
Attachment #8464538 - Attachment is obsolete: true
Attachment #8464538 - Flags: review?(khuey)
Attachment #8464541 - Attachment is obsolete: true
Attachment #8464541 - Flags: review?(khuey)
Attachment #8466184 - Attachment is obsolete: true
Attachment #8466184 - Flags: review?(khuey)
Blocks: 1047777
Comment on attachment 8464531 [details] [diff] [review] part 1. Make our Web IDL parser fail on warnings from the underlying ply code Review of attachment 8464531 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/bindings/parser/WebIDL.py @@ +5218,5 @@ > # becomes a speedup again. > # , picklefile='WebIDLGrammar.pkl' > ) > + logger.reportGrammarErrors() > + nit: extra whitespace on empty line
Attachment #8464531 - Flags: review?(khuey) → review+
Comment on attachment 8464537 [details] [diff] [review] part 7. Add support for parsing the Exposed Web IDL attribute and determining whether a given interface member should be exposed in a particular global Review of attachment 8464537 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/bindings/parser/WebIDL.py @@ +525,5 @@ > > def finish(self, scope): > if self._finished: > return > + self._finished = True nit: extra whitespace at EOL @@ +757,5 @@ > + for member in self.members: > + if not member.exposureSet.issubset(self.exposureSet): > + raise WebIDLError("Interface member has larger exposure set " > + "than the interface itself", > + [member.location, self.location]) here too
Attachment #8464537 - Flags: review?(khuey) → review+
Comment on attachment 8464540 [details] [diff] [review] part 10. Disallow Pref annotations on things that are exposed in workers Review of attachment 8464540 [details] [diff] [review]: ----------------------------------------------------------------- I assume you've tested that we do the right thing here inside hte workers now?
Attachment #8464540 - Flags: review?(khuey) → review+
Comment on attachment 8466183 [details] [diff] [review] Part 8 updated to not expose the random event stuff hixie wants to expose; that can happen in a followup if we want it Review of attachment 8466183 [details] [diff] [review]: ----------------------------------------------------------------- r=me with these fixed ::: dom/webidl/Console.webidl @@ +9,1 @@ > interface Console { How is this ChromeOnly? ::: dom/webidl/InstallEvent.webidl @@ +18,1 @@ > interface InstallEvent : InstallPhaseEvent { How is it possible that something that is [Exposed] on Window inherits from something that is [Exposed] on ServiceWorker. Why don't we catch that? ::: dom/webidl/Navigator.webidl @@ +54,1 @@ > interface NavigatorLanguage { NavigatorLanguage is not hooked up on workers yet, AFAICT. ::: dom/webidl/XMLHttpRequest.webidl @@ +134,1 @@ > readonly attribute Document? responseXML; Can this just be Throws now?
Attachment #8466183 - Flags: review?(khuey) → review+
Fixed the whitespace bits. > I assume you've tested that we do the right thing here inside hte workers now? As far as I can tell, yes. I did some manual testing, code inspection, and we have an automated test for the set of interfaces exposed in DedicatedWorker instances. > How is this ChromeOnly? The interface object is. So window.console is exposed, but window.Console is only visible in chrome scopes for now, until there's an actual spec or something. > How is it possible that something that is [Exposed] on Window inherits from something > that is [Exposed] on ServiceWorker. Why don't we catch that? Because I didn't implement that. I'll add a check for this to part 7 and make InstallPhaseEvent exposed in (Window,ServiceWorkers). Good catch. > NavigatorLanguage is not hooked up on workers yet, AFAICT. Also good catch. Fixed. > Can this just be Throws now? Yes, in part 9. Fixed.
Blocks: 1048695
I filed bug 1048695 on controlling interface member visibility with [Exposed]. I filed bug 1048698 on being able to expose things on all XPConnect globals via Exposed. I filed bug 1048699 on improving support for things like Exposed=SharedWorker.
Blocks: 1048698, 1048699
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: