On Fri, May 20, 2016 at 3:12 PM, Jonas Sicking <[email protected]> wrote:

> On Fri, May 20, 2016 at 8:04 AM, Ben Kelly <[email protected]> wrote:
> > On Fri, May 20, 2016 at 10:56 AM, Boris Zbarsky <[email protected]>
> wrote:
> >
> >> Thoughts?  Any obvious problems with this plan?
> >
> > We have the concept of network requests made from workers not associated
> > with a single document.  For example, SharedWorker attached to multiple
> > documents or a ServiceWorker servicing a push event.  In theory we want
> the
> > same load grouping behavior to abort requests if those workers terminate,
> > etc.
> >
> > If we are refactoring things, can we include that concept as well?
>
> I *think* the current setup that we have dedicated workers is that
> each worker gets its own loadgroup, and that all
> XHR/fetch()/importScripts() loads are added to that loadgroup. Ideally
> that loadgroup should be added as a child loadgroup of the owning
> document, or the owning worker. But I'm not sure that is the case.
>
> For SharedWorkers/ServiceWorkers, we should just skip the last step.
> I.e. we should not make the loadgroup be a child of any other
> loadgroup.
>

We don't use "child" load groups at all AFAIK.  We inherit the document
LoadGroup for dedicated workers:

https://dxr.mozilla.org/mozilla-central/source/dom/workers/WorkerPrivate.cpp#4356

I thought we also inherited the load group from a parent worker, but I
don't see the code that does it.

For SharedWorkers or workers that don't get a LoadGroup (service workers)
we override with a new load group:

https://dxr.mozilla.org/mozilla-central/source/dom/workers/WorkerPrivate.cpp#4461

We then add the tab child when a document attaches to the SharedWorker:

https://dxr.mozilla.org/mozilla-central/source/dom/workers/WorkerPrivate.cpp#3603

We then do special logic to get the first live tab child we see for the
SharedWorker out:

https://dxr.mozilla.org/mozilla-central/source/dom/workers/WorkerPrivate.cpp#2071

This tab child stuff was to support security checking on b2g I think.  I'm
not sure we strictly need it any more.

Maybe all of this is fine.  The behavior of SharedWorker and ServiceWorker
seem a bit fragile, though.  And it seems we get broken network stuff on
workers periodically for things that assume a document.  So I just wanted
to avoid any more document specific behavior if we can.  Maybe thats not a
concern here.
_______________________________________________
dev-platform mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to