Skip to content

Implement MessagePort and MessageChannel - #16622

Closed
KiChjang wants to merge 15 commits into
servo:masterfrom
KiChjang:message-port
Closed

KiChjang wants to merge 15 commits into
servo:masterfrom
KiChjang:message-port

Conversation

@KiChjang

@KiChjang KiChjang commented Apr 26, 2017 •

Copy link
Copy Markdown
Contributor

Chances are that I'm still missing some JSAutoCompartments here and there, and that the thread-sharing part of Trusted structs need to be handled more carefully.

Fixes #7457.
Fixes #12715.
Fixes #12717.
Fixes #16095.
Fixes #18969.


This change is Reviewable

@highfive

Copy link
Copy Markdown

Heads up! This PR modifies the following files:

  • @fitzgen: components/script/lib.rs, components/script/task_source/port_message.rs, components/script/dom/bindings/mod.rs, components/profile/time.rs, components/script/dom/globalscope.rs and 14 more
  • @KiChjang: components/script/lib.rs, components/script/task_source/port_message.rs, components/script/dom/bindings/mod.rs, components/script/dom/globalscope.rs, components/script/network_listener.rs and 11 more

@highfive

Copy link
Copy Markdown

warning Warning warning

  • These commits modify unsafe code. Please review it carefully!
  • These commits modify script code, but no tests are modified. Please consider adding a test!

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Apr 26, 2017
@KiChjang

Copy link
Copy Markdown
Contributor Author

@bors-servo try

@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Trying commit db454aa with merge 7155889...

bors-servo pushed a commit that referenced this pull request Apr 26, 2017
Implement MessagePort

Chances are that I'm still missing some `JSAutoCompartment`s here and there, and that the thread-sharing part of `Trusted` structs need to be handled more carefully.

<!-- 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/16622)
<!-- Reviewable:end -->
@bors-servo

Copy link
Copy Markdown
Contributor

💔 Test failed - mac-rel-wpt1

@highfive highfive added S-tests-failed The changes caused existing tests to fail. and removed S-tests-failed The changes caused existing tests to fail. labels Apr 26, 2017
@KiChjang

Copy link
Copy Markdown
Contributor Author

@bors-servo try

@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Trying commit f93a257 with merge 03b3361...

bors-servo pushed a commit that referenced this pull request Apr 26, 2017
Implement MessagePort

Chances are that I'm still missing some `JSAutoCompartment`s here and there, and that the thread-sharing part of `Trusted` structs need to be handled more carefully.

<!-- 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/16622)
<!-- Reviewable:end -->
@bors-servo

Copy link
Copy Markdown
Contributor

💔 Test failed - mac-rel-wpt1

@highfive highfive added the S-tests-failed The changes caused existing tests to fail. label Apr 27, 2017
Comment thread components/script/dom/messagechannel.rs Outdated
impl MessageChannel {
// https://html.spec.whatwg.org/multipage/#dom-messagechannel
pub fn Constructor(global: &GlobalScope) -> Fallible<Root<MessageChannel>> {
let incumbent = match GlobalScope::incumbent() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: foo.ok_or(Error)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried that, it said something like convertFrom is not implemented for Result<_, dom::bindings::Error>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, nvm, I found my error before.

@ghost

ghost commented Apr 27, 2017

Copy link
Copy Markdown

Passing tests!!! 😄

@cbrewster

Copy link
Copy Markdown
Contributor

r? @jdm or someone else

@highfive highfive assigned jdm and unassigned cbrewster Apr 27, 2017
@highfive highfive removed the S-tests-failed The changes caused existing tests to fail. label Apr 27, 2017
@KiChjang

Copy link
Copy Markdown
Contributor Author

@bors-servo try

@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Trying commit 9acf0bf with merge 7869d24...

bors-servo pushed a commit that referenced this pull request Apr 27, 2017
Implement MessagePort

Chances are that I'm still missing some `JSAutoCompartment`s here and there, and that the thread-sharing part of `Trusted` structs need to be handled more carefully.

<!-- 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/16622)
<!-- Reviewable:end -->
@bors-servo bors-servo mentioned this pull request Apr 27, 2017
3 tasks done
@bors-servo

Copy link
Copy Markdown
Contributor

💔 Test failed - linux-rel-wpt

@highfive highfive added the S-tests-failed The changes caused existing tests to fail. label Apr 27, 2017
@KiChjang

Copy link
Copy Markdown
Contributor Author

Running locally on the webmessaging directory gives me the following:

Ran 94 tests finished in 110.0 seconds.
  • 41 ran as expected. 0 tests skipped.
  • 21 tests timed out unexpectedly
  • 49 tests had unexpected subtest results

@bors-servo

Copy link
Copy Markdown
Contributor

☔ The latest upstream changes (presumably #21170) made this pull request unmergeable. Please resolve the merge conflicts.

@gterzian

gterzian commented Jul 22, 2018 •

Copy link
Copy Markdown
Member

This one could be relevant by the way: #21218 (Although I have no idea whether the change actually makes sense, see the related issue for that)

Actually, it looks like you are approaching that problem through the message_port_internal

And I am guessing my solution might still 'good enough' for a Blob, which I think isn't transferable?

@KiChjang

Copy link
Copy Markdown
Contributor Author

@gterzian Hmm, your linked PR would be perfect for the temporary storage of the cloned MessagePorts on the new realm. I've struggled with who should actually own this, but somehow it never struck me that I should let GlobalScope own them.

@KiChjang

KiChjang commented Jul 22, 2018 •

Copy link
Copy Markdown
Contributor Author

@gterzian As for Blob, you're correct in that they're not transferable objects, but they are the closely-related serializable objects. In my PR, perhaps I would instead change your StructuredCloneDataHolder to have a list of DomRoot<Transferable> instead of DomRoot<Blob>.

@gterzian

gterzian commented Jul 23, 2018 •

Copy link
Copy Markdown
Member

@KiChjang Ok, thanks for the info.

Would you be interested in reviewing the other one, and then later rebase yours off of it (since your PR introduces Transferable)?

@bors-servo

Copy link
Copy Markdown
Contributor

☔ The latest upstream changes (presumably #21218) made this pull request unmergeable. Please resolve the merge conflicts.

@bors-servo

Copy link
Copy Markdown
Contributor

☔ The latest upstream changes (presumably #21737) made this pull request unmergeable. Please resolve the merge conflicts.

@bors-servo

Copy link
Copy Markdown
Contributor

☔ The latest upstream changes (presumably #22086) made this pull request unmergeable. Please resolve the merge conflicts.

@bors-servo

Copy link
Copy Markdown
Contributor

☔ The latest upstream changes (presumably #21804) made this pull request unmergeable. Please resolve the merge conflicts.

@bors-servo

Copy link
Copy Markdown
Contributor

☔ The latest upstream changes (presumably #23483) made this pull request unmergeable. Please resolve the merge conflicts.

@atouchet

atouchet commented Nov 6, 2019

Copy link
Copy Markdown
Contributor

Was this finished in #23637? Should this be closed?

@jdm

jdm commented Nov 6, 2019

Copy link
Copy Markdown
Member

Indeed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-needs-rebase There are merge conflict errors.

Projects

None yet

8 participants