Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upImplement postMessage for ServiceWorkers #12910
Conversation
highfive
commented
Aug 17, 2016
|
Heads up! This PR modifies the following files:
|
highfive
commented
Aug 17, 2016
310c4dd
to
1f5b94e
|
Great work! Note that the specification has steps for postMessage that include using a different interface than the MessageEvent one, but I'm happy to leave that as a followup. -S-awaiting-review +S-needs-code-changes Reviewed 12 of 13 files at r1. components/script/dom/serviceworker.rs, line 35 [r1] (raw file):
Defined in ipc-channel. now. components/script/dom/serviceworker.rs, line 118 [r1] (raw file):
We should consider buffering messages here and sending them when the sender is received. components/script/dom/serviceworkerglobalscope.rs, line 55 [r1] (raw file):
I'm not sure what this is referring to. components/script/dom/serviceworkerglobalscope.rs, line 89 [r1] (raw file):
This should be removed. components/script/dom/serviceworkerglobalscope.rs, line 242 [r1] (raw file):
I'm tempted to call components/script/dom/workerglobalscope.rs, line 401 [r1] (raw file):
The components/script/dom/bindings/structuredclone.rs, line 50 [r1] (raw file):
This should be a components/script/dom/bindings/structuredclone.rs, line 57 [r1] (raw file):
Let's make this accept the tuple struct mentioned previously, rather than raw pointers and numbers, so that we can't create StructureCloneData values out of arbitrary data buffers. components/script_traits/script_msg.rs, line 163 [r1] (raw file):
This should hold a tests/html/service-worker/index.html, line 29 [r1] (raw file):
My buffering proposal avoids this requirement. Comments from Reviewable |
|
My mistake, those are steps for Client.postMessage - I meant these steps instead, which uses ExtendableMessageEvent. Reviewed 1 of 13 files at r1. Comments from Reviewable |
|
Yep, i will be swapping Review status: all files reviewed at latest revision, 10 unresolved discussions. components/script/dom/serviceworker.rs, line 118 [r1] (raw file):
|
|
Review status: all files reviewed at latest revision, 10 unresolved discussions. components/script/dom/serviceworker.rs, line 118 [r1] (raw file):
|
|
So @jdm i gave a re-thought on this PR, and now that i know that StructuredCloneData can be destructured and we can pass |
851826d
to
fec8bca
|
-S-awaiting-review +S-needs-code-changes Reviewed 10 of 10 files at r2. components/script/serviceworker_manager.rs, line 114 [r2] (raw file):
components/script/serviceworker_manager.rs, line 115 [r2] (raw file):
This clone shouldn't be necessary with the above change. components/script/serviceworker_manager.rs, line 120 [r2] (raw file):
Isn't this a perfectly normal situation if there are no buffered messages? components/script/serviceworker_manager.rs, line 165 [r2] (raw file):
Traditionally one would use the entry API for this instead. components/script/dom/serviceworker.rs, line 114 [r2] (raw file):
components/script/dom/serviceworker.rs, line 115 [r2] (raw file):
Hmm, so we always bounce postMessage through the constellation now? BackupMessage isn't a good description, in that case. Comments from Reviewable |
|
Review status: 12 of 13 files reviewed at latest revision, 6 unresolved discussions, some commit checks failed. components/script/serviceworker_manager.rs, line 120 [r2] (raw file):
|
|
-S-awaiting-review +S-needs-code-changes Reviewed 5 of 5 files at r3. components/constellation/constellation.rs, line 988 [r3] (raw file):
This is still an odd name here. components/script/dom/serviceworker.rs, line 115 [r2] (raw file):
|
| script_url.as_str(), | ||
| scope_url, | ||
| skip_waiting) | ||
| } |
This comment has been minimized.
This comment has been minimized.
creativcoder
Sep 7, 2016
Author
Contributor
Refactored this into a single method as this was just an unneccessary indirection.
35f33d1
to
ca255f2
|
-S-needs-rebase -S-awaiting-review +S-needs-code-changes Reviewed 17 of 17 files at r6, 17 of 17 files at r7, 5 of 5 files at r8. components/script/dom/serviceworkerregistration.rs, line 42 at r8 (raw file):
Let's make scope a Url, and change ServiceWorkerContainer::Register to not turn its url into a string quite so soon. components/script/dom/bindings/structuredclone.rs, line 70 at r7 (raw file):
This documentation should be reinstated. components/script/dom/bindings/structuredclone.rs, line 61 at r8 (raw file):
nit: extra space after (. Also, does this need to be public? Comments from Reviewable |
|
Review status: 16 of 19 files reviewed at latest revision, 5 unresolved discussions. components/script/dom/bindings/structuredclone.rs, line 61 at r8 (raw file):
|
|
@bors-servo: r+ Reviewed 3 of 3 files at r9. Comments from Reviewable |
|
|
Implement postMessage for ServiceWorkers <!-- Please describe your changes on the following line: --> Fixes #12773 r? @jdm Changes: * Implements `postMessage` on `ServiceWorker` object. * Removes unused channels from sw and their scopes. * Fixes a crash when calling `scope.script_chan()` in sw-scopes event handling. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #12773 <!-- Either: --> - [X] There are tests for these changes at `tests/html/service-worker` <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12910) <!-- Reviewable:end -->
|
|
|
@bors-servo: retry |
Possibly #12654 |
|
|
|
|
creativcoder commentedAug 17, 2016
•
edited
Fixes #12773
r? @jdm
Changes:
postMessageonServiceWorkerobject.scope.script_chan()in sw-scopes event handling../mach build -ddoes not report any errors./mach test-tidydoes not report any errorstests/html/service-workerThis change is