Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Issue 185643009: Implement ServiceWorker::postMessage() [Blink] (Closed)

Created:
6 years, 9 months ago by jsbell
Modified:
6 years, 9 months ago
CC:
blink-reviews, Nils Barth (inactive), jsbell+serviceworker_chromium.org, kojih, arv+blink, jsbell+bindings_chromium.org, tzik, sof, serviceworker-reviews, nhiroki, abarth-chromium, marja+watch_chromium.org, dglazkov+blink, jamesr, adamk+blink_chromium.org, falken, haraken, horo+watch_chromium.org, Nate Chapin, alecflett+watch_chromium.org, Inactive
Visibility:
Public.

Description

Implement ServiceWorker::postMessage() This allows the registering page, or pages loaded via the worker, to send arbitrary messages to the worker script. BUG=350103 R=abarth@chromium.org, adamk@chromium.org, kinuko@chromium.org, marja@chromium.org Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=169668

Patch Set 1 #

Patch Set 2 : Rebased #

Patch Set 3 : Rebased #

Patch Set 4 : Fix port entangling #

Patch Set 5 : Add layout test #

Total comments: 9

Patch Set 6 : Remove poke, add virtual/passing test result #

Patch Set 7 : Add test to verify IndexedDB in ServiceWorker, via postMessage #

Total comments: 3

Patch Set 8 : Added FIXMEs for blob ref counting #

Total comments: 2

Patch Set 9 : Remove dead FIXME #

Total comments: 2

Patch Set 10 : Prep for landing w/o Chromium side #

Patch Set 11 : rebased #

Total comments: 4

Patch Set 12 : Factor out leaky loops #

Total comments: 2

Patch Set 13 : Pass raw pointer -> PassOwnPtr #

Unified diffs Side-by-side diffs Delta from patch set Stats (+348 lines, -17 lines) Patch
M LayoutTests/TestExpectations View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +4 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/serviceworker/indexeddb.html View 1 2 3 4 5 6 1 chunk +57 lines, -0 lines 0 comments Download
A + LayoutTests/http/tests/serviceworker/indexeddb-expected.txt View 1 2 3 4 5 6 1 chunk +6 lines, -5 lines 0 comments Download
A LayoutTests/http/tests/serviceworker/indexeddb-worker.js View 1 2 3 4 5 6 1 chunk +46 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/serviceworker/postmessage.html View 1 2 3 4 1 chunk +34 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/serviceworker/postmessage-expected.txt View 1 2 3 4 1 chunk +14 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/serviceworker/postmessage-worker.js View 1 2 3 4 1 chunk +13 lines, -0 lines 0 comments Download
A LayoutTests/virtual/serviceworker/http/tests/serviceworker/indexeddb-expected.txt View 1 2 3 4 5 6 1 chunk +30 lines, -0 lines 0 comments Download
A LayoutTests/virtual/serviceworker/http/tests/serviceworker/postmessage-expected.txt View 1 2 3 4 5 1 chunk +23 lines, -0 lines 0 comments Download
M Source/bindings/bindings.gypi View 1 2 3 4 5 6 7 8 9 1 chunk +3 lines, -2 lines 0 comments Download
A Source/bindings/v8/custom/V8ServiceWorkerCustom.cpp View 1 2 3 1 chunk +38 lines, -0 lines 0 comments Download
M Source/core/dom/MessagePort.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +3 lines, -0 lines 0 comments Download
M Source/core/dom/MessagePort.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +23 lines, -3 lines 0 comments Download
M Source/modules/serviceworkers/ServiceWorker.h View 2 chunks +3 lines, -0 lines 0 comments Download
M Source/modules/serviceworkers/ServiceWorker.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +16 lines, -0 lines 0 comments Download
M Source/modules/serviceworkers/ServiceWorker.idl View 1 chunk +3 lines, -0 lines 0 comments Download
M Source/modules/serviceworkers/ServiceWorkerGlobalScope.idl View 1 2 3 4 5 1 chunk +0 lines, -1 line 0 comments Download
M Source/web/ServiceWorkerGlobalScopeProxy.h View 1 chunk +1 line, -0 lines 0 comments Download
M Source/web/ServiceWorkerGlobalScopeProxy.cpp View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +12 lines, -0 lines 0 comments Download
M Source/web/WebDOMMessageEvent.cpp View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +2 lines, -6 lines 0 comments Download
M public/platform/WebMessagePortChannel.h View 1 2 3 4 5 6 7 1 chunk +1 line, -0 lines 0 comments Download
M public/platform/WebServiceWorker.h View 1 2 3 4 5 6 7 8 9 1 chunk +12 lines, -0 lines 0 comments Download
M public/web/WebServiceWorkerContextProxy.h View 2 chunks +4 lines, -0 lines 0 comments Download

Messages

Total messages: 35 (0 generated)
jsbell
This is ready for an initial look. Layout test demonstrates two-way communication. Chromium side is ...
6 years, 9 months ago (2014-03-10 21:53:04 UTC) #1
kinuko
The blink looks good to me, though I also want to take a look at ...
6 years, 9 months ago (2014-03-11 07:13:35 UTC) #2
jsbell
I'll re-upload the Chromium side https://codereview.chromium.org/185643009/diff/80001/LayoutTests/http/tests/serviceworker/postmessage-expected.txt File LayoutTests/http/tests/serviceworker/postmessage-expected.txt (right): https://codereview.chromium.org/185643009/diff/80001/LayoutTests/http/tests/serviceworker/postmessage-expected.txt#newcode11 LayoutTests/http/tests/serviceworker/postmessage-expected.txt:11: PASS successfullyParsed is true ...
6 years, 9 months ago (2014-03-11 15:56:40 UTC) #3
jsbell
New patch, minor tweaks. https://codereview.chromium.org/185643009/diff/80001/LayoutTests/http/tests/serviceworker/postmessage-expected.txt File LayoutTests/http/tests/serviceworker/postmessage-expected.txt (right): https://codereview.chromium.org/185643009/diff/80001/LayoutTests/http/tests/serviceworker/postmessage-expected.txt#newcode11 LayoutTests/http/tests/serviceworker/postmessage-expected.txt:11: PASS successfullyParsed is true On ...
6 years, 9 months ago (2014-03-11 20:10:51 UTC) #4
jsbell
Good news - Indexed DB "just works" from the ServiceWorker. I added a test to ...
6 years, 9 months ago (2014-03-11 20:56:52 UTC) #5
michaeln
https://codereview.chromium.org/185643009/diff/110001/Source/modules/serviceworkers/ServiceWorker.cpp File Source/modules/serviceworkers/ServiceWorker.cpp (right): https://codereview.chromium.org/185643009/diff/110001/Source/modules/serviceworkers/ServiceWorker.cpp#newcode53 Source/modules/serviceworkers/ServiceWorker.cpp:53: // FIXME: Any filtering of MessagePorts or other Transferrables? ...
6 years, 9 months ago (2014-03-11 23:29:19 UTC) #6
jsbell
https://codereview.chromium.org/185643009/diff/110001/public/platform/WebServiceWorker.h File public/platform/WebServiceWorker.h (right): https://codereview.chromium.org/185643009/diff/110001/public/platform/WebServiceWorker.h#newcode48 public/platform/WebServiceWorker.h:48: virtual void postMessage(const WebString&, WebMessagePortChannelArray*) = 0; Note to ...
6 years, 9 months ago (2014-03-11 23:47:09 UTC) #7
jsbell
On 2014/03/11 23:29:19, michaeln wrote: > If SerializedScriptValue refers to blobs, upon its unref on ...
6 years, 9 months ago (2014-03-12 16:49:22 UTC) #8
michaeln
> Since it's a pre-existing pattern w/ cross-process postMessage, I'd vote to fix > it ...
6 years, 9 months ago (2014-03-12 23:51:52 UTC) #9
michaeln
also, i was just making a drive-by-comment about that dead body, i'll pull myself from ...
6 years, 9 months ago (2014-03-12 23:56:29 UTC) #10
jsbell
https://codereview.chromium.org/185643009/diff/130001/Source/modules/serviceworkers/ServiceWorker.cpp File Source/modules/serviceworkers/ServiceWorker.cpp (right): https://codereview.chromium.org/185643009/diff/130001/Source/modules/serviceworkers/ServiceWorker.cpp#newcode53 Source/modules/serviceworkers/ServiceWorker.cpp:53: // FIXME: Any filtering of MessagePorts or other Transferrables? ...
6 years, 9 months ago (2014-03-13 00:06:22 UTC) #11
kinuko
I think this patch lgtm
6 years, 9 months ago (2014-03-13 10:44:04 UTC) #12
jsbell
marja@ - could you please take a look at the "message port" voodoo here and ...
6 years, 9 months ago (2014-03-14 18:13:30 UTC) #13
marja
https://codereview.chromium.org/185643009/diff/150001/LayoutTests/http/tests/serviceworker/indexeddb-expected.txt File LayoutTests/http/tests/serviceworker/indexeddb-expected.txt (right): https://codereview.chromium.org/185643009/diff/150001/LayoutTests/http/tests/serviceworker/indexeddb-expected.txt#newcode10 LayoutTests/http/tests/serviceworker/indexeddb-expected.txt:10: FAIL DisabledError Why DisabledError? (I don't really understand the ...
6 years, 9 months ago (2014-03-17 09:29:21 UTC) #14
kinuko
https://codereview.chromium.org/185643009/diff/150001/LayoutTests/http/tests/serviceworker/indexeddb-expected.txt File LayoutTests/http/tests/serviceworker/indexeddb-expected.txt (right): https://codereview.chromium.org/185643009/diff/150001/LayoutTests/http/tests/serviceworker/indexeddb-expected.txt#newcode10 LayoutTests/http/tests/serviceworker/indexeddb-expected.txt:10: FAIL DisabledError On 2014/03/17 09:29:22, marja wrote: > Why ...
6 years, 9 months ago (2014-03-17 09:32:54 UTC) #15
marja
Alright. The MessagePort passing bits LGTM. I'm not sure if there would be an opportunity ...
6 years, 9 months ago (2014-03-17 10:30:14 UTC) #16
jsbell
abarth@ - could you OWNERS review for public/, Source/web/ and Source/bindings ? (Do note comment ...
6 years, 9 months ago (2014-03-18 23:42:57 UTC) #17
abarth-chromium
LGTM but you might want adamk to look at the message port aspects.
6 years, 9 months ago (2014-03-19 17:04:09 UTC) #18
adamk
Suggested a few places where it might be nice to share code instead of copying ...
6 years, 9 months ago (2014-03-19 17:48:58 UTC) #19
jsbell
adamk@ - thanks for prompting. I factored out those loops, although the name and location ...
6 years, 9 months ago (2014-03-19 21:06:46 UTC) #20
adamk
lgtm with one more possibility Thanks for factoring those out, MessagePort seems as good a ...
6 years, 9 months ago (2014-03-19 21:16:52 UTC) #21
jsbell
The CQ bit was checked by jsbell@chromium.org
6 years, 9 months ago (2014-03-19 21:26:07 UTC) #22
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/jsbell@chromium.org/185643009/220001
6 years, 9 months ago (2014-03-19 21:26:15 UTC) #23
jsbell
https://codereview.chromium.org/185643009/diff/200001/Source/core/dom/MessagePort.h File Source/core/dom/MessagePort.h (right): https://codereview.chromium.org/185643009/diff/200001/Source/core/dom/MessagePort.h#newcode77 Source/core/dom/MessagePort.h:77: static PassOwnPtr<blink::WebMessagePortChannelArray> toWebMessagePortChannelArray(MessagePortChannelArray*); On 2014/03/19 21:16:53, adamk wrote: > ...
6 years, 9 months ago (2014-03-19 21:26:20 UTC) #24
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 9 months ago (2014-03-19 21:41:44 UTC) #25
commit-bot: I haz the power
Try jobs failed on following builders: tryserver.blink on linux_blink_dbg
6 years, 9 months ago (2014-03-19 21:41:45 UTC) #26
jsbell
The CQ bit was checked by jsbell@chromium.org
6 years, 9 months ago (2014-03-19 23:25:19 UTC) #27
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/jsbell@chromium.org/185643009/220001
6 years, 9 months ago (2014-03-19 23:25:23 UTC) #28
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 9 months ago (2014-03-20 00:43:14 UTC) #29
commit-bot: I haz the power
Try jobs failed on following builders: tryserver.blink on linux_blink_dbg
6 years, 9 months ago (2014-03-20 00:43:14 UTC) #30
jsbell
The CQ bit was checked by jsbell@chromium.org
6 years, 9 months ago (2014-03-20 16:01:20 UTC) #31
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/jsbell@chromium.org/185643009/220001
6 years, 9 months ago (2014-03-20 16:01:28 UTC) #32
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 9 months ago (2014-03-20 17:06:37 UTC) #33
commit-bot: I haz the power
Try jobs failed on following builders: tryserver.blink on linux_blink_dbg
6 years, 9 months ago (2014-03-20 17:06:38 UTC) #34
jsbell
6 years, 9 months ago (2014-03-20 17:15:52 UTC) #35
Message was sent while issue was closed.
Committed patchset #13 manually as r169668 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698