Auto merge of #6415 - jgraham:dom_load, r=jdm

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



<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6415)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2015-08-07 11:30:33 -06:00
commit 361d94d23e
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);