Add a LoadComplete message so that script informs the constellation,

which can then inform the compositor (and anyone else, later) about
the completion of loading a page. This is important for ref tests,
which should not emit a PNG until load has completed, even if we
perform a composite before then.
This commit is contained in:
Lars Bergstrom 2014-01-30 13:03:58 -06:00
parent 572959c3e6
commit f41c39b3dd
6 changed files with 43 additions and 12 deletions

View file

@ -38,8 +38,8 @@ use js::rust::{Compartment, Cx};
use js;
use servo_msg::compositor_msg::{FinishedLoading, Loading, PerformingLayout, ScriptListener};
use servo_msg::constellation_msg::{ConstellationChan, IFrameSandboxed, IFrameUnsandboxed};
use servo_msg::constellation_msg::{LoadIframeUrlMsg, LoadUrlMsg, NavigationDirection, PipelineId};
use servo_msg::constellation_msg::{SubpageId};
use servo_msg::constellation_msg::{LoadIframeUrlMsg, LoadCompleteMsg, LoadUrlMsg, NavigationDirection};
use servo_msg::constellation_msg::{PipelineId, SubpageId};
use servo_msg::constellation_msg;
use servo_net::image_cache_task::ImageCacheTask;
use servo_net::resource_task::ResourceTask;
@ -745,7 +745,7 @@ impl ScriptTask {
let fragment = url.fragment.as_ref().map(|ref fragment| fragment.to_owned());
// No more reflow required
page.url = Some((url, false));
page.url = Some((url.clone(), false));
// Receive the JavaScript scripts.
assert!(js_scripts.is_some());
@ -775,6 +775,8 @@ impl ScriptTask {
window.eventtarget.dispatch_event_with_target(wintarget, Some(doctarget), event);
page.fragment_node = fragment.map_default(None, |fragid| self.find_fragment_node(page, fragid));
self.constellation_chan.send(LoadCompleteMsg(page.id, url));
}
fn find_fragment_node(&self, page: &mut Page, fragid: ~str) -> Option<AbstractNode> {