New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.
Starred by 2 users

Issue metadata

Status: Fixed
Email to this user bounced
Closed: Apr 2017
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 3
Type: Launch-OWP
Launch-Accessibility: ----
Launch-Exp-Leadership: ----
Launch-Leadership: ----
Launch-Legal: ----
Launch-M-Approved: ----
Launch-M-Target: ----
Launch-Privacy: ----
Launch-Security: ----
Launch-Test: ----
Launch-UI: ----

issue 674593

Participants' hotlists:

Sign in to add a comment

Issue 659074: Extend MessageEvent to supplant ServiceWorkerMessageEvent

Reported by, Oct 25 2016

Issue description

HTML extends MessageEvent to allow ServiceWorker as the type of source attribute:

Service worker will replace ServiceWorkerMessageEvent with this extended MessageEvent.

Related discussion:

Comment 1 by, Oct 28 2016

Looking at the code, MessageEvent needs some work apart from the changes proposed in the OP.

Currently, the type of |source| attribute is EventTarget instead of the union. I'm not sure whether it'd be OK to use EventTarget for ServiceWorker too like by adding source->toServiceWorker() in isValidSource(EventTarget* source) function. That'd be the easiest way to tackle this change, but I guess service worker folks might not be happy to do so as ServiceWorkerMessageEvent was implementing the union.

So, I'd like to hear comments on how to tackle the issues:
 - Just use EventTarget as-is and improve MessageEvent in a separate issue/patch
 - Improve MessageEvent first and then tackle the issue in the OP.

/cc nhiroki@, jinho.bang@, foolip@, rbyers@

Comment 2 by, Oct 28 2016


Comment 3 by, Oct 28 2016

Components: Blink>Messaging
From SW's point of view, I'd prefer to improve MessageEvent first if it's not a tough job so that we can simply transplant code from ServiceWorkerMessageEvent to MessageEvent.

Comment 4 by, Oct 28 2016

I'll try to do it using WindowOrMessagePortOrServiceWorker idl-gen-union'd type. If you have any better idea, please let me know.

Comment 5 by, Oct 31 2016

It'd be the optimal way for now. There is an issue to refine the idl-generator to avoid such a verbose union type, but it's not fixed yet:

Comment 6 by, Oct 31 2016

I encountered some errors while trying this with WindowOrMessagePortOrServiceWorker class generated from MessageEvent.idl. Please see (WIP) CL: Comments would be appreciated.

Comment 7 by, Nov 16 2016

Labels: -Type-Bug Type-Launch-OWP

Comment 8 by, Dec 14 2016

Project Member
The following revision refers to this bug:

commit faa6203e513b171743c9d9fd7121501e681186af
Author: <>
Date: Wed Dec 14 18:38:17 2016

Deprecate ServiceWorkerMessageEvent in favor of MessageEvent

This extends MessageEvent to allow ServiceWorker as a type of source
attribute according to the changes in HTML and replaces the existing
ServiceWorkerMessageEvent code usage with this extended MessageEvent.

Related spec issue:
Related spec change:
 - HTML:
 - SW:
Related WPT:

Intent to Deprecate and Remove:!topic/blink-dev/Xp9hmKyuOrI

BUG= 659074 

Cr-Commit-Position: refs/heads/master@{#438545}


Comment 9 by, Dec 19 2016

Labels: M-57
Status: Started (was: Assigned)
This landed and will ship in M57. Who tracks Launch-OWP? Should I leave this in Status: Starting?

Comment 11 by, Dec 19 2016

jmedley@ should be able to advise on how to handle Launch-OWP.

Comment 12 by, Feb 24 2017

Any updates on this? Can I mark this as Fixed?

Comment 13 by, Feb 24 2017

Status: Fixed (was: Started)
I guess so.

Comment 14 by, Feb 24 2017

Status: Assigned (was: Fixed)
ServiceWorkerMessageEvent.idl and related files still exist, and it looks like a script could still call new ServiceWorkerMessageEvent(). The interface itself should also be removed, per

Comment 15 by, Feb 24 2017

Oh I think I missed the IDL files. I'll fix them. Thanks for the notice.

Comment 16 by, Feb 24 2017

Labels: M-58
Status: Started (was: Assigned)
Good catch foolip@.

So for milestone-based platform change tracking purposes:
- In 57, onmessage takes a MessageEvent instead of ServiceWorkerMessageEvent
- In 58, ServiceWorkerMessageEvent interface will be removed

Comment 17 by, Feb 24 2017

foolip@, falken@,

> it looks like a script could still call new ServiceWorkerMessageEvent()

I checked and tested again. ServiceWorkerMessageEvent.idl and ServiceWorkerMessageEventInit.idl were excluded from the build. Accessing the constructor raises uncaught ReferenceError. (self.ServiceWorkerMessageEvent returns undefined.) If you encountered any particular case where you could access the constructor, please share it with me. Otherwise, I think I can just remove those idl files.

Additionally, I found this reference:
third_party/WebKit/Source/devtools/devtools-node-modules/third_party/node_modules/eslint/node_modules/globals/globals.json:1221:	"ServiceWorkerMessageEvent": false,

I guess this should also be removed?

Comment 18 by, Feb 24 2017

That looks like third-party imported code. Probably it could be removed but likely can't be part of a Chromium commit.

I notice references in bindings/. These could probably be removed as well:
$ git gs ServiceWorkerMessageEvent
third_party/WebKit/Source/bindings/core/v8/V8PrivateProperty.h:120:    friend class V8ServiceWorkerMessageEventInternal;
third_party/WebKit/Source/bindings/modules/v8/V8ServiceWorkerMessageEventInternal.h:5:#ifndef V8ServiceWorkerMessageEventInternal_h
third_party/WebKit/Source/bindings/modules/v8/V8ServiceWorkerMessageEventInternal.h:6:#define V8ServiceWorkerMessageEventInternal_h
third_party/WebKit/Source/bindings/modules/v8/V8ServiceWorkerMessageEventInternal.h:14:class V8ServiceWorkerMessageEventInternal {
third_party/WebKit/Source/bindings/modules/v8/V8ServiceWorkerMessageEventInternal.h:25:void V8ServiceWorkerMessageEventInternal::constructorCustom(
third_party/WebKit/Source/bindings/modules/v8/V8ServiceWorkerMessageEventInternal.h:73:void V8ServiceWorkerMessageEventInternal::dataAttributeGetterCustom(
third_party/WebKit/Source/bindings/modules/v8/V8ServiceWorkerMessageEventInternal.h:111:#endif  // V8ServiceWorkerMessageEventInternal_h
third_party/WebKit/Source/bindings/modules/v8/custom/V8ExtendableMessageEventCustom.cpp:8:#include "bindings/modules/v8/V8ServiceWorkerMessageEventInternal.h"
third_party/WebKit/Source/bindings/modules/v8/custom/V8ExtendableMessageEventCustom.cpp:14:  V8ServiceWorkerMessageEventInternal::constructorCustom<
third_party/WebKit/Source/bindings/modules/v8/custom/V8ExtendableMessageEventCustom.cpp:20:  V8ServiceWorkerMessageEventInternal::dataAttributeGetterCustom<
third_party/WebKit/Source/bindings/modules/v8/v8.gni:24:                    "V8ServiceWorkerMessageEventInternal.h",
third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerMessageEvent.idl:11:    // Constructor(DOMString type, optional ServiceWorkerMessageEventInit eventInitDict),
third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerMessageEvent.idl:14:] interface ServiceWorkerMessageEvent : Event {
third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerMessageEventInit.idl:7:dictionary ServiceWorkerMessageEventInit : EventInit {

Comment 19 by, Feb 24 2017

OK, I was just guessing based on the existence of the IDL file, turns out it was already removed from third_party/WebKit/Source/bindings/modules/ and is now just a stray file in the repo.

I'm not sure what the devtools file is, I'd git blame to find someone who knows.

Comment 20 by, Feb 24 2017

V8ExtendableMessageEventCustom.cpp is referencing definitions in V8ServiceWorkerMessageEventInternal.h. Removing the dependency there and remove V8ServiceWorkerMessageEventInternal.h would be great. Let me look at it.

Comment 21 by, Mar 31 2017

Blocking: 674593
Is there any plan to standardize ServiceWorkerMessageEvent and ServiceWorkerMessageEventInit?

Comment 22 by, Mar 31 2017

as far as I know, the plan (as described in this bug) is the opposite; to get rid of ServiceWorkerMessageEvent and replace them with regular MessageEvent. Reading back through these comments it seems like that even already happened, and just for some reason the actual IDL files haven't been removed yet? Not sure what happened between February and now.

Comment 23 by, Apr 25 2017

I was about to send an email on the same question. Does anyone know what's going on?

Comment 24 by, Apr 25 2017 is an attempt to finish and close this issue.

Comment 25 by, Apr 26 2017

Labels: -M-58
The actual removal was in which landed in M-57, so removing the M-58 label.

Comment 26 by, Apr 26 2017

Project Member
The following revision refers to this bug:

commit 2369b7f3dec2f78a760ed52bf64badb2240a1968
Author: foolip <>
Date: Wed Apr 26 10:34:04 2017

Remove remaining traces of ServiceWorkerMessageEvent

The ServiceWorkerMessageEvent.* files were already removed from

This inlines the templatized helpers in V8ServiceWorkerMessageEventInternal.h
into non-templated code in V8ExtendableMessageEventCustom.cpp, which is now the
only place the helpers are used.

BUG= 659074 

Cr-Commit-Position: refs/heads/master@{#467291}


Comment 27 by, Apr 26 2017

Status: Fixed (was: Started)

Sign in to add a comment