implement windowproxy "delay-load-event-mode", and partially document "completely-loaded"

This commit is contained in:
Gregory Terzian 2018-12-12 21:16:07 +08:00
parent 483bf245df
commit eb82e781a3
10 changed files with 156 additions and 19 deletions

View file

@ -1071,6 +1071,32 @@ where
load_data,
replace,
);
} else {
let pipeline_is_top_level_pipeline = self
.browsing_contexts
.get(&BrowsingContextId::from(top_level_browsing_context_id))
.map(|ctx| ctx.pipeline_id == pipeline_id)
.unwrap_or(false);
// If the navigation is refused, and this concerns an iframe,
// we need to take it out of it's "delaying-load-events-mode".
// https://html.spec.whatwg.org/multipage/#delaying-load-events-mode
if !pipeline_is_top_level_pipeline {
let msg = ConstellationControlMsg::StopDelayingLoadEventsMode(
pipeline_id,
);
let result = match self.pipelines.get(&pipeline_id) {
Some(pipeline) => pipeline.event_loop.send(msg),
None => {
return warn!(
"Attempted to navigate {} after closure.",
pipeline_id
)
},
};
if let Err(e) = result {
self.handle_send_error(pipeline_id, e);
}
}
}
},
None => {
@ -1838,6 +1864,9 @@ where
Some(parent_pipeline_id) => parent_pipeline_id,
None => return warn!("Subframe {} has no parent.", pipeline_id),
};
// https://html.spec.whatwg.org/multipage/#the-iframe-element:completely-loaded
// When a Document in an iframe is marked as completely loaded,
// the user agent must run the iframe load event steps.
let msg = ConstellationControlMsg::DispatchIFrameLoadEvent {
target: browsing_context_id,
parent: parent_pipeline_id,