-
Notifications
You must be signed in to change notification settings - Fork 312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MessageEvent within the SW global should have waitUntil() #669
Comments
If we don't do a global, can we maybe have a mix-in interface that all SW events implement? Seems things like background sync, push, etc would want this to. |
We already have that - ExtendableEvent if memory serves On Wed, 1 Apr 2015 17:06 Ben Kelly [email protected] wrote:
|
Ah, true. I guess it just has the install event extra logic embedded in there, though. https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#extendable-event |
|
So we don't want it on the global because that encourages global reasoning rather than event-based reasoning, right? I think that's still applicable. Perhaps we should just bite the bullet and introduce |
It would be nice if we could do something about MessageEvent soon. The web-platform-tests use MessageEvent and I think some of our intermittent failures are due to the ServiceWorker shutting down before the test completes. We really need a .waitUntil() to keep the worker alive. |
Addressed: cc117a0. I tried to name it |
Naming sounds fine to me. Cheers! |
Should |
I replied to the codereview discussion: https://codereview.chromium.org/1130113006/diff/60001/Source/modules/serviceworkers/ServiceWorkerMessageEventInit.idl#newcode7 Also, |
OK Blink is likely going ahead with the current spec and we'll be preparing an Intent to Ship. @wanderview is Mozilla ok with the spec? |
We haven't started implementing it yet, as far as I know. I believe we are ok with the current spec, though. |
Is there a point to "lastEventId"? I guess it's only for backwards compatibility with MessageEvent, and it will always be the empty string unless you've manually constructed a ServiceWorkerMessageEvent, right? |
Right. |
For that matter is |origin| useful? It would always be your origin as SW must be same-origin. |
navigator.connect wants to use |
That shouldn't use the same event though. |
Could you explain why? Those interfaces are defined for the message events dispatched during service worker communications in general. Using the same interfaces seems fine. |
Oops, this should be v1 since Chrome already implements it. Can we get resolution here? |
I believe @annevk's comment was in regard to:
That's certainly not a v1 issue. In regards to:
I think it could be useful for library code that may not know exactly what SW it was invoked in. If we want to remove it for now, though, we can always add it later. @matto, did you end up implementing the origin attribute? |
@wanderview @mattto yes Blink's ServiceWorkerMessageEvent implements/exposes the origin attribute. |
I think we can close this then as the current spec is whats implemented. I don't see a strong reason to change now. |
…rker to match spec. [email protected] is the original author of this patch. Spec discussion: w3c/ServiceWorker#669 BUG=508796 Review URL: https://codereview.chromium.org/1232363002 (cherry picked from commit c52c580) [email protected], [email protected], Review URL: https://codereview.chromium.org/1251763004 . git-svn-id: svn://svn.chromium.org/blink/branches/chromium/2454@199335 bbb929c8-8fbe-4397-9dbb-9b2b20218538
I'm pretty confused what the current state of this is. I cannot figure out how to respond to a message event in a service-worker with async work, and make sure the work actually stays alive. Both this and #400 were closed as "will not do anything" IIUC. Doesn't this make every onmessage event handler for service-workers vulnerable to bugs due to dying before completion? |
We do now have a message event that included waitUntil(): https://w3c.github.io/ServiceWorker/#extendablemessageevent-interface Which extends: |
Not sure how to easily mix this in, but the SW should be able to signal it's doing work after a
postMessage
Or we could revisit a global waitUntil #400. We'd need to call it something different though, I'm worried devs may use
waitUntil()
instead ofevent.waitUntil()
and get different behaviour because success/failure doesn't reach the event dispatcher.The text was updated successfully, but these errors were encountered: