mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Delay stylesheet load in test to increase confidence.
This commit is contained in:
parent
f3cdba6b8b
commit
a1ae53a230
12 changed files with 82 additions and 116 deletions
|
@ -56,10 +56,7 @@ impl DocumentLoader {
|
|||
data: Option<NotifierData>,
|
||||
initial_load: Option<Url>,)
|
||||
-> DocumentLoader {
|
||||
let mut initial_loads = vec!();
|
||||
if let Some(load) = initial_load {
|
||||
initial_loads.push(LoadType::PageSource(load));
|
||||
}
|
||||
let initial_loads = initial_load.into_iter().map(LoadType::PageSource).collect();
|
||||
|
||||
DocumentLoader {
|
||||
resource_task: resource_task,
|
||||
|
@ -70,15 +67,16 @@ impl DocumentLoader {
|
|||
|
||||
/// Create a new pending network request, which can be initiated at some point in
|
||||
/// the future.
|
||||
pub fn prep_async_load(&mut self, load: LoadType) -> PendingAsyncLoad {
|
||||
self.blocking_loads.push(load.clone());
|
||||
pub fn prepare_async_load(&mut self, load: LoadType) -> PendingAsyncLoad {
|
||||
let url = load.url().clone();
|
||||
self.blocking_loads.push(load);
|
||||
let pipeline = self.notifier_data.as_ref().map(|data| data.pipeline);
|
||||
PendingAsyncLoad::new(self.resource_task.clone(), load.url().clone(), pipeline)
|
||||
PendingAsyncLoad::new(self.resource_task.clone(), url, pipeline)
|
||||
}
|
||||
|
||||
/// Create and initiate a new network request.
|
||||
pub fn load_async(&mut self, load: LoadType) -> Receiver<LoadResponse> {
|
||||
let pending = self.prep_async_load(load);
|
||||
let pending = self.prepare_async_load(load);
|
||||
pending.load()
|
||||
}
|
||||
|
||||
|
|
|
@ -260,7 +260,7 @@ pub trait DocumentHelpers<'a> {
|
|||
fn cancel_animation_frame(self, ident: i32);
|
||||
/// http://w3c.github.io/animation-timing/#dfn-invoke-callbacks-algorithm
|
||||
fn invoke_animation_callbacks(self);
|
||||
fn prep_async_load(self, load: LoadType) -> PendingAsyncLoad;
|
||||
fn prepare_async_load(self, load: LoadType) -> PendingAsyncLoad;
|
||||
fn load_async(self, load: LoadType) -> Receiver<LoadResponse>;
|
||||
fn load_sync(self, load: LoadType) -> Result<(Metadata, Vec<u8>), String>;
|
||||
fn finish_load(self, load: LoadType);
|
||||
|
@ -885,9 +885,9 @@ impl<'a> DocumentHelpers<'a> for JSRef<'a, Document> {
|
|||
}
|
||||
}
|
||||
|
||||
fn prep_async_load(self, load: LoadType) -> PendingAsyncLoad {
|
||||
fn prepare_async_load(self, load: LoadType) -> PendingAsyncLoad {
|
||||
let mut loader = self.loader.borrow_mut();
|
||||
loader.prep_async_load(load)
|
||||
loader.prepare_async_load(load)
|
||||
}
|
||||
|
||||
fn load_async(self, load: LoadType) -> Receiver<LoadResponse> {
|
||||
|
|
|
@ -159,7 +159,7 @@ impl<'a> PrivateHTMLLinkElementHelpers for JSRef<'a, HTMLLinkElement> {
|
|||
let link_element = Trusted::new(window.get_cx(), self, window.script_chan().clone());
|
||||
let load_dispatcher = StylesheetLoadDispatcher::new(link_element);
|
||||
|
||||
let pending = doc.r().prep_async_load(LoadType::Stylesheet(url.clone()));
|
||||
let pending = doc.r().prepare_async_load(LoadType::Stylesheet(url.clone()));
|
||||
let LayoutChan(ref layout_chan) = window.layout_chan();
|
||||
layout_chan.send(Msg::LoadStylesheet(url, media, pending, box load_dispatcher)).unwrap();
|
||||
}
|
||||
|
|
|
@ -732,8 +732,8 @@ impl ScriptTask {
|
|||
ConstellationControlMsg::TickAllAnimations(pipeline_id) =>
|
||||
self.handle_tick_all_animations(pipeline_id),
|
||||
ConstellationControlMsg::StylesheetLoadComplete(id, url, responder) => {
|
||||
self.handle_resource_loaded(id, LoadType::Stylesheet(url));
|
||||
responder.respond();
|
||||
self.handle_resource_loaded(id, LoadType::Stylesheet(url));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue