diff options
Diffstat (limited to 'components/script/dom')
-rw-r--r-- | components/script/dom/htmliframeelement.rs | 24 | ||||
-rw-r--r-- | components/script/dom/window.rs | 2 |
2 files changed, 24 insertions, 2 deletions
diff --git a/components/script/dom/htmliframeelement.rs b/components/script/dom/htmliframeelement.rs index a4ccafd2d4c..4e7e6108785 100644 --- a/components/script/dom/htmliframeelement.rs +++ b/components/script/dom/htmliframeelement.rs @@ -28,6 +28,7 @@ use dom::node::{Node, UnbindContext, window_from_node, document_from_node}; use dom::urlhelper::UrlHelper; use dom::virtualmethods::VirtualMethods; use dom::window::{ReflowReason, Window}; +use ipc_channel::ipc; use js::jsapi::{JSAutoCompartment, JSAutoRequest, RootedValue, JSContext, MutableHandleValue}; use js::jsval::{UndefinedValue, NullValue}; use layout_interface::ReflowQueryType; @@ -559,9 +560,30 @@ impl VirtualMethods for HTMLIFrameElement { let window = window_from_node(self); let window = window.r(); + // The only reason we're waiting for the iframe to be totally + // removed is to ensure the script thread can't add iframes faster + // than the compositor can remove them. + // + // Since most of this cleanup doesn't happen on same-origin + // iframes, and since that would cause a deadlock, don't do it. let ConstellationChan(ref chan) = window.constellation_chan(); - let msg = ConstellationMsg::RemoveIFrame(pipeline_id); + let same_origin = if let Some(self_url) = self.get_url() { + let win_url = window_from_node(self).get_url(); + UrlHelper::SameOrigin(&self_url, &win_url) + } else { + false + }; + let (sender, receiver) = if same_origin { + (None, None) + } else { + let (sender, receiver) = ipc::channel().unwrap(); + (Some(sender), Some(receiver)) + }; + let msg = ConstellationMsg::RemoveIFrame(pipeline_id, sender); chan.send(msg).unwrap(); + if let Some(receiver) = receiver { + receiver.recv().unwrap() + } // Resetting the subpage id to None is required here so that // if this iframe is subsequently re-added to the document diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index 9ee7fd81160..1e79620fb29 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -1060,7 +1060,7 @@ impl Window { // When all these conditions are met, notify the constellation // that this pipeline is ready to write the image (from the script thread // perspective at least). - if opts::get().output_file.is_some() && for_display { + if (opts::get().output_file.is_some() || opts::get().exit_after_load) && for_display { let document = self.Document(); // Checks if the html element has reftest-wait attribute present. |