Repository navigation
Implement MessagePort and MessageChannel #16622
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
9edd4ec
Add PortMessageQueue
KiChjang 74bcb9d
Accept transfer argument for StructuredCloneData::write
KiChjang ea481b7
Allow structured clone reads to return a boolean
KiChjang 055bdd1
Add Transferable trait
KiChjang 5ddcdb5
Add basic skeletons to MessagePort
KiChjang e99eb47
Implement transfer and transfer-receiving steps on MessagePort
KiChjang f023385
Use transfer and transfer_receive in StructuredClone callbacks
KiChjang 99842e4
Implement MessageChannel
KiChjang c20ed6a
Freeze the array object for the MessageEvent ports attribute
KiChjang e4d075b
Implement transfer argument on window.postMessage
KiChjang 25fa53a
Use ReentrantMutex instead for MessagePortInternal
KiChjang 4da8a00
Accept origin as a parameter in dispatch_jsval
KiChjang 5bc41b5
Fix BorrowMut crash with pending_port_message
KiChjang 498fbef
Detach port on closure and check for detached during transfer
KiChjang 5693b81
Enable webmessaging tests
KiChjang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| /* This Source Code Form is subject to the terms of the Mozilla Public | ||
| * License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
|
||
| //! Trait representing the concept of [transferable objects] | ||
| //! (https://html.spec.whatwg.org/multipage/#transferable-objects). | ||
| use crate::dom::bindings::reflector::DomObject; | ||
| use js::jsapi::{JSContext, JSStructuredCloneReader, MutableHandleObject}; | ||
| use std::os::raw; | ||
|
|
||
| pub trait Transferable : DomObject { | ||
| fn transfer( | ||
| &self, | ||
| closure: *mut raw::c_void, | ||
| content: *mut *mut raw::c_void, | ||
| extra_data: *mut u64, | ||
| ) -> bool; | ||
| fn transfer_receive( | ||
| cx: *mut JSContext, | ||
| r: *mut JSStructuredCloneReader, | ||
| closure: *mut raw::c_void, | ||
| content: *mut raw::c_void, | ||
| extra_data: u64, | ||
| return_object: MutableHandleObject, | ||
| ) -> bool; | ||
| fn detached(&self) -> Option<bool> { None } | ||
| fn set_detached(&self, _value: bool) { } | ||
| fn transferable(&self) -> bool { false } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could the TODO on line 160 now be removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so, because the transfer argument is undefined. The proper way to do this would be to actually obtain them from the arguments passed to
window.postMessage.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I see