Auto merge of #25842 - servo-wpt-sync:wpt_update_25-02-2020, r=jdm

Sync WPT with upstream (25-02-2020)

Automated downstream sync of changes from upstream as of 25-02-2020.
[no-wpt-sync]
r? @servo-wpt-sync
This commit is contained in:
bors-servo 2020-02-25 19:01:26 -05:00 committed by GitHub
commit 0f9b04680a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
374 changed files with 9959 additions and 15957 deletions

View file

@ -268,21 +268,31 @@ pub fn init(
let dom_action = message.to().expect("Ws dom_action message to deserialize");
match dom_action {
WebSocketDomAction::SendMessage(MessageData::Text(data)) => {
ws_sender.send(Message::text(data)).unwrap();
if let Err(e) = ws_sender.send(Message::text(data)) {
warn!("Error sending websocket message: {:?}", e);
}
},
WebSocketDomAction::SendMessage(MessageData::Binary(data)) => {
ws_sender.send(Message::binary(data)).unwrap();
if let Err(e) = ws_sender.send(Message::binary(data)) {
warn!("Error sending websocket message: {:?}", e);
}
},
WebSocketDomAction::Close(code, reason) => {
if !initiated_close.fetch_or(true, Ordering::SeqCst) {
match code {
Some(code) => ws_sender
.close_with_reason(
Some(code) => {
if let Err(e) = ws_sender.close_with_reason(
code.into(),
reason.unwrap_or("".to_owned()),
)
.unwrap(),
None => ws_sender.close(CloseCode::Status).unwrap(),
) {
warn!("Error closing websocket: {:?}", e);
}
},
None => {
if let Err(e) = ws_sender.close(CloseCode::Status) {
warn!("Error closing websocket: {:?}", e);
}
},
};
}
},