Bug 178940 - [Service Worker] Support passing MessagePort objects to postMessage()
Summary: [Service Worker] Support passing MessagePort objects to postMessage()
Status: RESOLVED DUPLICATE of bug 181178
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords: InRadar
: 181648 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-10-27 09:22 PDT by Chris Dumez
Modified: 2018-02-01 09:12 PST (History)
7 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2017-10-27 09:22:11 PDT
Support passing transferables (such as MessagePort objects) to postMessage().
Comment 1 Radar WebKit Bug Importer 2017-10-27 09:22:44 PDT
<rdar://problem/35222245>
Comment 2 youenn fablet 2018-01-16 01:21:02 PST
*** Bug 181648 has been marked as a duplicate of this bug. ***
Comment 3 Thiago Soares 2018-01-31 14:53:41 PST
We have a product that uses the Service Worker Api and also need to pass MessagePort objects to postMessage().
It is a feature that will block us from using our solution on Safari.
Comment 4 Chris Dumez 2018-01-31 14:59:54 PST
Oh, this has actually been implemented.

*** This bug has been marked as a duplicate of bug 181178 ***
Comment 5 youenn fablet 2018-01-31 15:48:22 PST
(In reply to Thiago Soares from comment #3)
> We have a product that uses the Service Worker Api and also need to pass
> MessagePort objects to postMessage().
> It is a feature that will block us from using our solution on Safari.

Thiago, do you have a public endpoint for your solution that we could use for our testing? Can you detail your usage of MessageChannel? Do you have any other requirement in terms of service worker features that Safari Tech Preview 47 would not fulfill?
Comment 6 Stephan Coertzen 2018-01-31 21:21:55 PST
https://mdmobile.co.za, you'll need a username and password for the update to start though. Can't you test it yourself? The issue is passing information through postMessage to the Service Worker.
Comment 7 youenn fablet 2018-02-01 08:34:25 PST
(In reply to Stephan Coertzen from comment #6)
> https://mdmobile.co.za, you'll need a username and password for the update
> to start though. Can't you test it yourself? The issue is passing
> information through postMessage to the Service Worker.

Sure, we are testing this particular feature. It is always good to do some field testing as well :)

Also, it is a different matter if what is blocking your web site from supporting WebKit is just postMessage or if you need other stuff like pushManager, openWindow(), focus()...
Comment 8 Stephan Coertzen 2018-02-01 08:51:12 PST
I would think that you are implementing the service worker for all scenarios according to standard. Our App has been built to conform to standard to be supported by all browsers. https://www.w3.org/TR/service-workers-1/#dom-serviceworker-postmessage

So no, this would not be the only thing that our PWA would need.
Comment 9 Thiago Soares 2018-02-01 08:59:14 PST
(In reply to youenn fablet from comment #5)
> (In reply to Thiago Soares from comment #3)
> > We have a product that uses the Service Worker Api and also need to pass
> > MessagePort objects to postMessage().
> > It is a feature that will block us from using our solution on Safari.
> 
> Thiago, do you have a public endpoint for your solution that we could use
> for our testing? Can you detail your usage of MessageChannel? Do you have
> any other requirement in terms of service worker features that Safari Tech
> Preview 47 would not fulfill?

Hi Youenn,

We have a beta environment that I can give you access if you want. I will contact you on your email.
We use the MessageChannel to enable the service worker to directly respond to a message sent by the application:

Application code:
var messageChannel = new MessageChannel();
messageChannel.port1.onmessage = handleCommandResponse
swReg.active.postMessage(message, [messageChannel.port2]);

SW Code:
onMessage: function(event) {

}
Comment 10 youenn fablet 2018-02-01 09:11:34 PST
(In reply to Stephan Coertzen from comment #8)
> I would think that you are implementing the service worker for all scenarios
> according to standard. Our App has been built to conform to standard to be
> supported by all browsers.
> https://www.w3.org/TR/service-workers-1/#dom-serviceworker-postmessage
> 
> So no, this would not be the only thing that our PWA would need.

I am also interested in having a fully compliant service worker implementation. WebKit is not there yet. Current focus is on making sure fetch event, offline mode, network proxy use cases will work fine.
Comment 11 youenn fablet 2018-02-01 09:12:07 PST
(In reply to Thiago Soares from comment #9)
> (In reply to youenn fablet from comment #5)
> > (In reply to Thiago Soares from comment #3)
> > > We have a product that uses the Service Worker Api and also need to pass
> > > MessagePort objects to postMessage().
> > > It is a feature that will block us from using our solution on Safari.
> > 
> > Thiago, do you have a public endpoint for your solution that we could use
> > for our testing? Can you detail your usage of MessageChannel? Do you have
> > any other requirement in terms of service worker features that Safari Tech
> > Preview 47 would not fulfill?
> 
> Hi Youenn,
> 
> We have a beta environment that I can give you access if you want. I will
> contact you on your email.

Thanks Thiago, that would be helpful.