aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/htmliframeelement.rs
diff options
context:
space:
mode:
authorMichael Howell <michael@notriddle.com>2016-01-01 17:11:10 -0700
committerMichael Howell <michael@notriddle.com>2016-03-24 11:18:54 -0700
commitc9cb4839e42a63120f4fc165b8e569f62fb4be44 (patch)
treeb0fbb76e5e546acb736a7c8df33f7361c5919299 /components/script/dom/htmliframeelement.rs
parentf2f05869d6ccd445df9b73e2e8d038c6cfa9e687 (diff)
downloadservo-c9cb4839e42a63120f4fc165b8e569f62fb4be44.tar.gz
servo-c9cb4839e42a63120f4fc165b8e569f62fb4be44.zip
No more headless compositor. Just the normal one.
This changes headless operation to strictly be a runtime option, rather than a compile-time one. Note that the old headless version still relied on a display server to support WebGL, while it now requires one all the time. Fixes #8573
Diffstat (limited to 'components/script/dom/htmliframeelement.rs')
-rw-r--r--components/script/dom/htmliframeelement.rs24
1 files changed, 23 insertions, 1 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