W3C home > Mailing lists > Public > public-geolocation@w3.org > September 2014

Re: Geofencing alternative proposal

From: Marijn Kruisselbrink <mek@google.com>
Date: Fri, 19 Sep 2014 13:26:01 -0700
Message-ID: <CA+OSsVZ7aYqVpVH+3K8XSb+1pub9p+7X2V7uJ64c=a=ymuj7AQ@mail.gmail.com>
To: Martin Thomson <martin.thomson@gmail.com>, Alex Russell <slightlyoff@google.com>
Cc: public-geolocation@w3.org
On Fri, Sep 19, 2014 at 12:13 PM, Martin Thomson <martin.thomson@gmail.com>
wrote:

> On 19 September 2014 09:23, Marijn Kruisselbrink <mek@google.com> wrote:
> > Then maybe I'm misunderstanding how service workers work, but how I
> > understand it the "install" event is ran once, essentially the first
> time a
> > particular service worker version is loaded. Once a service worker is
> > installed and activated a browser is free to completely throw away all
> > javascript state associated with the service worker, and later
> reload/rerun
> > it from scratch when it has some event to deliver to the service worker
> (by
> > doing it this way a service worker that isn't currently processing any
> > events uses no resources at all). This means that even if somehow the
> > browser would keep track of which geofences have event handlers
> associated
> > to them by a particular service worker, this doesn't help since the event
> > handler itself would no longer exist when the service worker file gets
> > loaded again. Service workers and all the javascript objects/closures/...
> > generally only exist for the duration of handling an event.
>
> We can ask someone who knows better, but my understanding is that the
> "scope" and other determining attributes (the events that the SW is
> registered to handle) are maintained.  Fences would be one of those
> things.
>
Oh yes, I'm not saying that registered fences and other properties like
that won't be maintained. But the actual event handler itself is a closure
that can potentially hold references to any other bit of javascript state,
so to maintain event handler bindings in arbitrary objects would mean
maintaining the full javascript state, which wouldn't be practical.
+Alex: Is my understanding correct here?
Received on Friday, 19 September 2014 20:26:29 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:51:09 UTC