diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2019-11-18 11:35:25 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-18 11:35:25 -0500 |
commit | 0d2c2045ccdce005eb6fc9235f3e7ca78da0db08 (patch) | |
tree | 002fe0bbee15b87c92f6df5af02762580843cb9a /components/script_traits | |
parent | 49ec49f637d0c5c39227425b2f29b7366dc90939 (diff) | |
parent | a256f2fccefb0618e36550350224e2b07ebb5337 (diff) | |
download | servo-0d2c2045ccdce005eb6fc9235f3e7ca78da0db08.tar.gz servo-0d2c2045ccdce005eb6fc9235f3e7ca78da0db08.zip |
Auto merge of #24664 - gterzian:fix_port_transfer, r=jdm
Fix loophole in messageport transfer
<!-- Please describe your changes on the following line: -->
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [ ] `./mach build -d` does not report any errors
- [ ] `./mach test-tidy` does not report any errors
- [ ] These changes fix #24600 (GitHub issue number if applicable)
<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because ___
<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->
<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
Diffstat (limited to 'components/script_traits')
-rw-r--r-- | components/script_traits/lib.rs | 8 | ||||
-rw-r--r-- | components/script_traits/script_msg.rs | 14 |
2 files changed, 20 insertions, 2 deletions
diff --git a/components/script_traits/lib.rs b/components/script_traits/lib.rs index 1b1a0e80e65..0212ae021b6 100644 --- a/components/script_traits/lib.rs +++ b/components/script_traits/lib.rs @@ -1042,8 +1042,12 @@ pub struct PortMessageTask { /// Messages for communication between the constellation and a global managing ports. #[derive(Debug, Deserialize, Serialize)] pub enum MessagePortMsg { - /// Enables a port to catch-up on messages that were sent while the transfer was ongoing. - CompleteTransfer(MessagePortId, VecDeque<PortMessageTask>), + /// Complete the transfer for a batch of ports. + CompleteTransfer(HashMap<MessagePortId, VecDeque<PortMessageTask>>), + /// Complete the transfer of a single port, + /// whose transfer was pending because it had been requested + /// while a previous failed transfer was being rolled-back. + CompletePendingTransfer(MessagePortId, VecDeque<PortMessageTask>), /// Remove a port, the entangled one doesn't exists anymore. RemoveMessagePort(MessagePortId), /// Handle a new port-message-task. diff --git a/components/script_traits/script_msg.rs b/components/script_traits/script_msg.rs index 7258e2f48cc..a12101380c9 100644 --- a/components/script_traits/script_msg.rs +++ b/components/script_traits/script_msg.rs @@ -30,6 +30,7 @@ use net_traits::storage_thread::StorageType; use net_traits::CoreResourceMsg; use servo_url::ImmutableOrigin; use servo_url::ServoUrl; +use std::collections::{HashMap, VecDeque}; use std::fmt; use style_traits::viewport::ViewportConstraints; use style_traits::CSSPixel; @@ -114,6 +115,17 @@ pub enum HistoryEntryReplacement { /// Messages from the script to the constellation. #[derive(Deserialize, Serialize)] pub enum ScriptMsg { + /// Request to complete the transfer of a set of ports to a router. + CompleteMessagePortTransfer(MessagePortRouterId, Vec<MessagePortId>), + /// The results of attempting to complete the transfer of a batch of ports. + MessagePortTransferResult( + /* The router whose transfer of ports succeeded, if any */ + Option<MessagePortRouterId>, + /* The ids of ports transferred successfully */ + Vec<MessagePortId>, + /* The ids, and buffers, of ports whose transfer failed */ + HashMap<MessagePortId, VecDeque<PortMessageTask>>, + ), /// A new message-port was created or transferred, with corresponding control-sender. NewMessagePort(MessagePortRouterId, MessagePortId), /// A global has started managing message-ports @@ -248,6 +260,8 @@ impl fmt::Debug for ScriptMsg { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { use self::ScriptMsg::*; let variant = match *self { + CompleteMessagePortTransfer(..) => "CompleteMessagePortTransfer", + MessagePortTransferResult(..) => "MessagePortTransferResult", NewMessagePortRouter(..) => "NewMessagePortRouter", RemoveMessagePortRouter(..) => "RemoveMessagePortRouter", NewMessagePort(..) => "NewMessagePort", |