Add DOMLoad message to constellation that is sent after the DOM Load event is dispatched.

This commit is contained in:
James Graham 2015-06-18 13:49:39 +01:00
parent 568bd92236
commit 36da7e2270
3 changed files with 28 additions and 2 deletions

View file

@ -289,6 +289,7 @@ pub trait DocumentHelpers<'a> {
fn load_async(self, load: LoadType, listener: AsyncResponseTarget);
fn load_sync(self, load: LoadType) -> Result<(Metadata, Vec<u8>), String>;
fn finish_load(self, load: LoadType);
fn notify_constellation_load(self);
fn set_current_parser(self, script: Option<&ServoHTMLParser>);
fn get_current_parser(self) -> Option<Root<ServoHTMLParser>>;
fn find_iframe(self, subpage_id: SubpageId) -> Option<Root<HTMLIFrameElement>>;
@ -986,6 +987,15 @@ impl<'a> DocumentHelpers<'a> for &'a Document {
loader.finish_load(load);
}
fn notify_constellation_load(self) {
let window = self.window.root();
let pipeline_id = window.r().pipeline();
let ConstellationChan(ref chan) = window.r().constellation_chan();
let event = ConstellationMsg::DOMLoad(pipeline_id);
chan.send(event).unwrap();
}
fn set_current_parser(self, script: Option<&ServoHTMLParser>) {
self.current_parser.set(script.map(JS::from_ref));
}
@ -1904,6 +1914,8 @@ impl DocumentProgressHandler {
event.r().fire(target);
});
document.r().notify_constellation_load();
// https://developer.mozilla.org/en-US/docs/Web/Events/mozbrowserloadend
document.r().trigger_mozbrowser_event(MozBrowserEvent::LoadEnd);