Implement sync XHR by creating and spinning on-demand event loops.

This commit is contained in:
Josh Matthews 2015-03-05 09:22:58 -05:00
parent 2ee21ddbe7
commit 01e66035ff
6 changed files with 269 additions and 156 deletions

View file

@ -29,7 +29,7 @@ use dom::storage::Storage;
use layout_interface::{ReflowGoal, ReflowQueryType, LayoutRPC, LayoutChan, Reflow, Msg};
use layout_interface::{ContentBoxResponse, ContentBoxesResponse, ScriptReflow};
use page::Page;
use script_task::{TimerSource, ScriptChan};
use script_task::{TimerSource, ScriptChan, ScriptPort, NonWorkerScriptChan};
use script_task::ScriptMsg;
use script_traits::ScriptControlChan;
use timers::{IsInterval, TimerId, TimerManager, TimerCallback};
@ -198,6 +198,11 @@ impl Window {
self.parent_info
}
pub fn new_script_pair(&self) -> (Box<ScriptChan+Send>, Box<ScriptPort+Send>) {
let (tx, rx) = channel();
(box NonWorkerScriptChan(tx), box rx)
}
pub fn control_chan<'a>(&'a self) -> &'a ScriptControlChan {
&self.control_chan
}