Closed Bug 1456986 Opened 4 years ago Closed 4 years ago

Remove binding details from ServiceWorker::Inner::PostMessage()

Categories

(Core :: DOM: Service Workers, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
mozilla62
Tracking Status
firefox62 --- fixed

People

(Reporter: bkelly, Assigned: bkelly)

References

Details

Attachments

(1 file, 2 obsolete files)

Currently we pass the global and jscontext down into ServiceWorker::Inner::PostMessage().  We need to keep these up in the binding layer and only pass portable types down into the Inner.  This probably means doing an IPC serialization of the structured cloneable transferable.
Priority: -- → P2
I wrote bug 1458936 to make structured clone utilities easier here.
See Also: → 1458936
Comment on attachment 8972920 [details] [diff] [review]
Make ServiceWorker::Inner::PostMessage() use StructuredCloneData. r=baku

Andrea, in preparation of remoting the ServiceWorker binding layer across IPC to the parent process this patch makes PostMessage() immediately convert to StructuredCloneData instead of passing the js pointers down into the guts of SWM.

Note, there is some ugly code in ServiceWorkerPrivate to convert from the StructuredCloneData to a StructuredCloneHolder.  This is necessary because SCD uses non-threadsafe ref-counting internally.  I filed bug 1458936 to make this better in the future.
Attachment #8972920 - Flags: review?(amarchesini)
Comment on attachment 8972920 [details] [diff] [review]
Make ServiceWorker::Inner::PostMessage() use StructuredCloneData. r=baku

Review of attachment 8972920 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/serviceworkers/ServiceWorker.cpp
@@ +16,5 @@
>  #include "mozilla/dom/ClientState.h"
>  #include "mozilla/dom/Promise.h"
>  #include "mozilla/dom/ServiceWorkerGlobalScopeBinding.h"
>  #include "mozilla/dom/WorkerPrivate.h"
> +#include "mozilla/dom/ipc/StructuredCloneData.h"

Ok, I still don't understand how sort 'subdir' headers in alphabetic order...
Attachment #8972920 - Flags: review?(amarchesini) → review+
Pushed by bkelly@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/509957c7a9f9
Make ServiceWorker::Inner::PostMessage() use StructuredCloneData. r=baku
https://hg.mozilla.org/mozilla-central/rev/509957c7a9f9
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla61
Merge of backout:
https://hg.mozilla.org/mozilla-central/rev/7cd5006f1365
Status: REOPENED → ASSIGNED
Blocks: 1460635
Depends on: 1459443
Pushed by bkelly@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/ee57d9bde7cb
Make ServiceWorker::Inner::PostMessage() use StructuredCloneData. r=baku
https://hg.mozilla.org/mozilla-central/rev/ee57d9bde7cb
Status: ASSIGNED → RESOLVED
Closed: 4 years ago4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla62
Depends on: 1461667
You need to log in before you can comment on or make changes to this bug.