mirror of
https://github.com/servo/servo.git
synced 2025-09-18 19:08:22 +01:00
Add Websocket task source
According to the doc: https://html.spec.whatwg.org/multipage/web-sockets.html#network The task source for all tasks queued in the websocket section are the websocket task source, so this commit also updates those references to use the appropriate one.
This commit is contained in:
parent
f7630dad87
commit
5dd6e21c2e
7 changed files with 82 additions and 13 deletions
|
@ -59,6 +59,7 @@ use task_source::file_reading::FileReadingTaskSource;
|
|||
use task_source::networking::NetworkingTaskSource;
|
||||
use task_source::performance_timeline::PerformanceTimelineTaskSource;
|
||||
use task_source::remote_event::RemoteEventTaskSource;
|
||||
use task_source::websocket::WebsocketTaskSource;
|
||||
use time::{Timespec, get_time};
|
||||
use timers::{IsInterval, OneshotTimerCallback, OneshotTimerHandle};
|
||||
use timers::{OneshotTimers, TimerCallback};
|
||||
|
@ -430,6 +431,18 @@ impl GlobalScope {
|
|||
unreachable!();
|
||||
}
|
||||
|
||||
/// `ScriptChan` to send messages to the websocket task source of
|
||||
/// this global scope.
|
||||
pub fn websocket_task_source(&self) -> WebsocketTaskSource {
|
||||
if let Some(window) = self.downcast::<Window>() {
|
||||
return window.websocket_task_source();
|
||||
}
|
||||
if let Some(worker) = self.downcast::<WorkerGlobalScope>() {
|
||||
return worker.websocket_task_source();
|
||||
}
|
||||
unreachable!();
|
||||
}
|
||||
|
||||
/// Evaluate JS code on this global scope.
|
||||
pub fn evaluate_js_on_global_with_result(
|
||||
&self, code: &str, rval: MutableHandleValue) -> bool {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue