Re: [w3c/ServiceWorker] Safety versus simplicity in specification tests (#1087)

For the current execution model of ServiceWorkers, I still think this is overkill that will complicate and slow down the tests given that the testing environment is controlled by the test authors.  There is arguably a bug in any SW implementation that kills SW's so aggressively that they can't progress to activation or service multiple requests in rapid succession.

The caveat is https://github.com/w3c/ServiceWorker/issues/756 on supporting multiple SW instances which will potentially change the de facto execution model.  At the July 2016 face-to-face, the Apple team seemed very interested in giving every event a fresh global, and in that case, global state is indeed impossible.  I expect this issue to be discussed again at the Apr 3-4 face-to-face.

If multiple instances or fresh globals become a reality, SharedWorkers may also see adoption and they would be a great option as a place to post results to when the test involves multiple pages or otherwise does not want to be disturbed by direct results gathering and processing.  They are ideal because of their [lifetime that's tied to documents](https://html.spec.whatwg.org/multipage/workers.html#the-worker%27s-lifetime) so they won't be arbitrarily terminated, and messages can be dispatched to them from all same-origin contexts in a single turn of the event loop.  ex: `(new SharedWorker('test.js', 'test-foo')).postMessage(data);`.  (BroadcastChannels can be using in a single turn too, but they don't support transferrables and are barely more available than SharedWorkers.)

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/ServiceWorker/issues/1087#issuecomment-287177036

Received on Thursday, 16 March 2017 20:12:41 UTC