servo: Merge #13774 - Finish up the implementation of EventSource (from KiChjang:event-source-constructor); r=jdm

Full implementation of EventSource, complete with closing and reopening streams.

Fixes #8925.

Source-Repo: https://github.com/servo/servo
Source-Revision: 579ab2d99cd8c07a31c3b68a4659c484d5189ada
This commit is contained in:
Keith Yeung
2016-11-12 08:08:38 -06:00
parent 42e197d2ed
commit 8f0a576ca4
20 changed files with 569 additions and 95 deletions

View File

@@ -148,14 +148,14 @@ pub fn response_async<T: AsyncBluetoothListener + Reflectable + 'static>(
promise: &Rc<Promise>,
receiver: &T) -> IpcSender<BluetoothResponseResult> {
let (action_sender, action_receiver) = ipc::channel().unwrap();
let chan = receiver.global().networking_task_source();
let task_source = receiver.global().networking_task_source();
let context = Arc::new(Mutex::new(BluetoothContext {
promise: Some(TrustedPromise::new(promise.clone())),
receiver: Trusted::new(receiver),
}));
let listener = NetworkListener {
context: context,
script_chan: chan,
task_source: task_source,
wrapper: None,
};
ROUTER.add_route(action_receiver.to_opaque(), box move |message| {