Bug 181648 - Service worker postMessage
Summary: Service worker postMessage
Status: RESOLVED DUPLICATE of bug 178940
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: Safari Technology Preview
Hardware: Mac macOS 10.13
: P2 Blocker
Assignee: Nobody
Depends on:
Reported: 2018-01-15 06:55 PST by Stephan Coertzen
Modified: 2018-01-16 01:29 PST (History)
3 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
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.