Re: [whatwg/dom] Nerfing all events on all event targets in a serviceworker after initial script evaluation seems odd (#371)

 > Basically this: w3c/ServiceWorker#718. 

That has precisely 0 discussion about the throwing behavior.

> And we added the condition to addEventListener() that checks has ever been evaluated flag.

Right, but why?  This isn't how the precedent in the platform for this (XHR upload events) works....

> This is w3c/ServiceWorker#1004. 

Yes, I'm well aware.  My discussion about this stuff with @catalinb is what led to this issue being filed.

For what it's worth, I expect that the behavior for `onfetch` will be crazy no matter what.  For example, say the worker script does:

    self.onfetch = ()=>{};
    self.onfetch = null;

during initial script execution and then after initial execution does:

    self.onfetch = ()=>{};

Should that last set throw?  Why would it?  It doesn't add an event listener, note.

> Synthetic events do not spin off SW.

I have no idea what "spin off" means here.

> Note that only SW lifecycle events and functional events run SW. 

Again, no idea what "run" means here. 

As @annevk notes, scripts can create and dispatch arbitrary events at a ServiceWorkerGlobalScope.  And I mean _arbitrary_.  With arbitrary data on them, for their own use.  `CustomEvent` is exposed in SW.  I don't see why we should prevent scripts from doing this.  And we shouldn't prevent them.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/371#issuecomment-259701021

Received on Thursday, 10 November 2016 14:19:28 UTC