Closed Bug 1046107 Opened 10 years ago Closed 9 years ago

Sort out the exposure situation for ServiceWorker and InstallEvent

Categories

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

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1113621

People

(Reporter: bzbarsky, Unassigned)

References

Details

In bug 1017988 I'm making these both Window-only, since ServiceWorker is controlled by a [Pref].

This will presumably need to be fixed to do the right thing.
Can we codegen something which makes the pref's used for annotations such as this available on the worker side automatically?
Possibly, but I think that's overkill for this case.

_If_ the right behavior here is to only expose in Window and ServiceWorker, we can just use a Func that returns the pref thing on mainthread and true on worker threads, right?  Plus beefing up the RegisterWorkerBindings support for [Exposed=ServiceWorker] to actually do something, I guess.

Right now we don't expose ServiceWorker on the global in service workers at all, afaict.
Fair enough.  At any rate, ServiceWorker should only be exposed on Window, but InstallEvent needs to be exposed both on Window and ServiceWorker.
That totally doesn't make sense, since InstallEvent has a member that returns a ServiceWorker.  So ServiceWorker should be exposed on a superset of the things InstallEvent is exposed on, no?
Note also the spec issue I raised at https://github.com/slightlyoff/ServiceWorker/issues/395 which has gone a bit afield, but has a maybe sane-ish proposal for the Exposed values at https://github.com/slightlyoff/ServiceWorker/issues/395#issuecomment-50585941
(In reply to comment #4)
> That totally doesn't make sense, since InstallEvent has a member that returns a
> ServiceWorker.  So ServiceWorker should be exposed on a superset of the things
> InstallEvent is exposed on, no?

Ah, yes, the current spec is just buggy.  You're right.
Fixed in Bug 1113621 as described in comment 5.
Note that Bug 1113522 tracks actually exposing valid instances of ServiceWorker in workers (such as InstallEvent.activeWorker), which is going to need some work in Gecko (to avoid postMessage insanity I believe).
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → DUPLICATE
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.