Bug 181648

Summary: Service worker postMessage
Product: WebKit Reporter: Stephan Coertzen <coertzen.jfs>
Component: New BugsAssignee: Nobody <webkit-unassigned>
Severity: Blocker CC: beidson, cdumez, youennf
Priority: P2    
Version: Safari Technology Preview   
Hardware: Mac   
OS: macOS 10.13   

Description Stephan Coertzen 2018-01-15 06:55:05 PST
Still getting Error: Passing MessagePort objects to postMessage is not yet supported
postMessage@[native code]

                                var msg_chan = new MessageChannel();
                                msg_chan.port1.onmessage = function(event) {
                                    if (event.data.error) {
                                        console.log(event.data.error, true);
                                    } else {

                                if (navigator.serviceWorker.controller)
                                    navigator.serviceWorker.controller.postMessage({ 'action': 'ClearCache' }, [msg_chan.port2]);
                                if (Web.ServiceWorkerReg.active)
                                    Web.ServiceWorkerReg.active.postMessage({ 'action': 'ClearCache' }, [msg_chan.port2]);
Comment 1 youenn fablet 2018-01-16 01:21:02 PST
Thanks Stephan, this is a known limitation.
I will dupe it with https://bugs.webkit.org/show_bug.cgi?id=178940.
Do not hesitate to give feedback on how important it is for you.

*** This bug has been marked as a duplicate of bug 178940 ***
Comment 2 Stephan Coertzen 2018-01-16 01:29:14 PST
Thank you. It's important for our application because we need it to be compatible with all browsers (cross platform) regarding offline support. We used applicationCache before but in future browser releases the Service Worker will replace it. Thanks for indicating that you guys are looking at supporting MessageChannel parameter passing.