Auto merge of #7921 - glennw:subpage-fixes-2, r=jdm

Update RemoveIFrame to use pipeline id rather than subpage.



<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7921)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2015-10-12 07:49:26 -06:00
commit 5ffeb3b95b
3 changed files with 17 additions and 36 deletions

View file

@ -135,10 +135,6 @@ pub struct Constellation<LTF, STF> {
/// A list of in-process senders to `WebGLPaintTask`s.
webgl_paint_tasks: Vec<Sender<CanvasMsg>>,
/// A list of senders that are waiting to be notified whenever a pipeline or subpage ID comes
/// in.
subpage_id_senders: HashMap<(PipelineId, SubpageId), Vec<IpcSender<PipelineId>>>,
}
/// State needed to construct a constellation.
@ -284,7 +280,6 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
webdriver: WebDriverData::new(),
canvas_paint_tasks: Vec::new(),
webgl_paint_tasks: Vec::new(),
subpage_id_senders: HashMap::new(),
};
let namespace_id = constellation.next_pipeline_namespace_id();
PipelineNamespace::install(namespace_id);
@ -517,9 +512,9 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
let is_ready = self.handle_is_ready_to_save_image(pipeline_states);
self.compositor_proxy.send(CompositorMsg::IsReadyToSaveImageReply(is_ready));
}
ConstellationMsg::RemoveIFrame(containing_pipeline_id, subpage_id) => {
ConstellationMsg::RemoveIFrame(pipeline_id) => {
debug!("constellation got remove iframe message");
self.handle_remove_iframe_msg(containing_pipeline_id, subpage_id);
self.handle_remove_iframe_msg(pipeline_id);
}
ConstellationMsg::NewFavicon(url) => {
debug!("constellation got new favicon message");
@ -679,14 +674,6 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
self.subpage_map.insert((load_info.containing_pipeline_id, load_info.new_subpage_id),
load_info.new_pipeline_id);
// If anyone is waiting to know the pipeline ID, send that information now.
if let Some(subpage_id_senders) = self.subpage_id_senders.remove(&(load_info.containing_pipeline_id,
load_info.new_subpage_id)) {
for subpage_id_sender in subpage_id_senders.into_iter() {
subpage_id_sender.send(load_info.new_pipeline_id).unwrap();
}
}
self.push_pending_frame(load_info.new_pipeline_id, old_pipeline_id);
}
@ -960,10 +947,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
self.focus_parent_pipeline(pipeline_id);
}
fn handle_remove_iframe_msg(&mut self,
containing_pipeline_id: PipelineId,
subpage_id: SubpageId) {
let pipeline_id = self.find_subpage(containing_pipeline_id, subpage_id).id;
fn handle_remove_iframe_msg(&mut self, pipeline_id: PipelineId) {
let frame_id = self.pipeline_to_frame_map.get(&pipeline_id).map(|id| *id);
match frame_id {
Some(frame_id) => {

View file

@ -276,7 +276,7 @@ pub enum Msg {
/// Query the constellation to see if the current compositor output is stable
IsReadyToSaveImage(HashMap<PipelineId, Epoch>),
/// Notification that this iframe should be removed.
RemoveIFrame(PipelineId, SubpageId),
RemoveIFrame(PipelineId),
/// Favicon detected
NewFavicon(Url),
/// <head> tag finished parsing

View file

@ -431,24 +431,21 @@ impl VirtualMethods for HTMLIFrameElement {
}
// https://html.spec.whatwg.org/multipage/#a-browsing-context-is-discarded
match (self.containing_page_pipeline_id(), self.subpage_id()) {
(Some(containing_pipeline_id), Some(subpage_id)) => {
let window = window_from_node(self);
let window = window.r();
if let Some(pipeline_id) = self.pipeline_id.get() {
let window = window_from_node(self);
let window = window.r();
let ConstellationChan(ref chan) = window.constellation_chan();
let msg = ConstellationMsg::RemoveIFrame(containing_pipeline_id,
subpage_id);
chan.send(msg).unwrap();
let ConstellationChan(ref chan) = window.constellation_chan();
let msg = ConstellationMsg::RemoveIFrame(pipeline_id);
chan.send(msg).unwrap();
// Resetting the subpage id to None is required here so that
// if this iframe is subsequently re-added to the document
// the load doesn't think that it's a navigation, but instead
// a new iframe. Without this, the constellation gets very
// confused.
self.subpage_id.set(None);
}
_ => {}
// Resetting the subpage id to None is required here so that
// if this iframe is subsequently re-added to the document
// the load doesn't think that it's a navigation, but instead
// a new iframe. Without this, the constellation gets very
// confused.
self.subpage_id.set(None);
self.pipeline_id.set(None);
}
}
}