mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Properly set the origin on websocket messages
This commit is contained in:
parent
89ab110357
commit
a1925aab52
6 changed files with 17 additions and 17 deletions
|
@ -33,7 +33,7 @@ use net_traits::request::{RequestInit, RequestMode};
|
|||
use profile_traits::ipc as ProfiledIpc;
|
||||
use script_runtime::CommonScriptMsg;
|
||||
use script_runtime::ScriptThreadEventCategory::WebSocketEvent;
|
||||
use servo_url::ServoUrl;
|
||||
use servo_url::{ImmutableOrigin, ServoUrl};
|
||||
use std::borrow::ToOwned;
|
||||
use std::cell::Cell;
|
||||
use std::ptr;
|
||||
|
@ -274,6 +274,10 @@ impl WebSocket {
|
|||
|
||||
Ok(true)
|
||||
}
|
||||
|
||||
pub fn origin(&self) -> ImmutableOrigin {
|
||||
self.url.origin()
|
||||
}
|
||||
}
|
||||
|
||||
impl WebSocketMethods for WebSocket {
|
||||
|
@ -549,7 +553,12 @@ impl TaskOnce for MessageReceivedTask {
|
|||
}
|
||||
},
|
||||
}
|
||||
MessageEvent::dispatch_jsval(ws.upcast(), &global, message.handle());
|
||||
MessageEvent::dispatch_jsval(
|
||||
ws.upcast(),
|
||||
&global,
|
||||
message.handle(),
|
||||
Some(&ws.origin().ascii_serialization())
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue