aboutsummaryrefslogtreecommitdiffstats
path: root/components/script
diff options
context:
space:
mode:
Diffstat (limited to 'components/script')
-rw-r--r--components/script/Cargo.toml2
-rw-r--r--components/script/dom/document.rs2
-rw-r--r--components/script/dom/window.rs21
-rw-r--r--components/script/script_thread.rs13
4 files changed, 26 insertions, 12 deletions
diff --git a/components/script/Cargo.toml b/components/script/Cargo.toml
index b947fe330a3..056bb6f72bb 100644
--- a/components/script/Cargo.toml
+++ b/components/script/Cargo.toml
@@ -29,7 +29,7 @@ encoding = "0.2"
euclid = {version = "0.6.4", features = ["plugins"]}
fnv = "1.0"
gfx_traits = {path = "../gfx_traits"}
-heapsize = "0.3.0"
+heapsize = "0.3.6"
heapsize_plugin = "0.1.2"
html5ever = {version = "0.5.1", features = ["heap_size", "unstable"]}
hyper = {version = "0.9", features = ["serde-serialization"]}
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs
index 0897ccc24ae..ea0affa9132 100644
--- a/components/script/dom/document.rs
+++ b/components/script/dom/document.rs
@@ -1259,7 +1259,7 @@ impl Document {
pub fn trigger_mozbrowser_event(&self, event: MozBrowserEvent) {
if mozbrowser_enabled() {
- if let Some((containing_pipeline_id, subpage_id)) = self.window.parent_info() {
+ if let Some((containing_pipeline_id, subpage_id, _)) = self.window.parent_info() {
let event = ConstellationMsg::MozBrowserEvent(containing_pipeline_id,
subpage_id,
event);
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs
index 90c1ee1bdba..c8d327897d2 100644
--- a/components/script/dom/window.rs
+++ b/components/script/dom/window.rs
@@ -45,7 +45,7 @@ use js::rust::Runtime;
use layout_interface::{ContentBoxResponse, ContentBoxesResponse, ResolvedStyleResponse, ScriptReflow};
use layout_interface::{LayoutRPC, Msg, Reflow, ReflowQueryType, MarginStyleResponse};
use libc;
-use msg::constellation_msg::{LoadData, PanicMsg, PipelineId, SubpageId};
+use msg::constellation_msg::{FrameType, LoadData, PanicMsg, PipelineId, SubpageId};
use msg::constellation_msg::{WindowSizeData, WindowSizeType};
use msg::webdriver_msg::{WebDriverJSError, WebDriverJSResult};
use net_traits::bluetooth_thread::BluetoothMethodMsg;
@@ -202,7 +202,7 @@ pub struct Window {
id: PipelineId,
/// Subpage id associated with this page, if any.
- parent_info: Option<(PipelineId, SubpageId)>,
+ parent_info: Option<(PipelineId, SubpageId, FrameType)>,
/// Global static data related to the DOM.
dom_static: GlobalStaticData,
@@ -330,7 +330,7 @@ impl Window {
self.parent_info.map(|p| p.1)
}
- pub fn parent_info(&self) -> Option<(PipelineId, SubpageId)> {
+ pub fn parent_info(&self) -> Option<(PipelineId, SubpageId, FrameType)> {
self.parent_info
}
@@ -1510,7 +1510,20 @@ impl Window {
self.current_state.get() == WindowState::Alive
}
+ // https://html.spec.whatwg.org/multipage/#top-level-browsing-context
+ pub fn is_top_level(&self) -> bool {
+ match self.parent_info {
+ Some((_, _, FrameType::IFrame)) => false,
+ _ => true,
+ }
+ }
+
+ // https://html.spec.whatwg.org/multipage/#parent-browsing-context
pub fn parent(&self) -> Option<Root<Window>> {
+ if self.is_top_level() {
+ return None;
+ }
+
let browsing_context = self.browsing_context();
browsing_context.frame_element().map(|frame_element| {
@@ -1559,7 +1572,7 @@ impl Window {
timer_event_chan: IpcSender<TimerEvent>,
layout_chan: Sender<Msg>,
id: PipelineId,
- parent_info: Option<(PipelineId, SubpageId)>,
+ parent_info: Option<(PipelineId, SubpageId, FrameType)>,
window_size: Option<WindowSizeData>)
-> Root<Window> {
let layout_rpc: Box<LayoutRPC> = {
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs
index d32a10bb1a6..63fed6cf115 100644
--- a/components/script/script_thread.rs
+++ b/components/script/script_thread.rs
@@ -63,7 +63,7 @@ use js::jsval::UndefinedValue;
use js::rust::Runtime;
use layout_interface::{self, NewLayoutThreadInfo, ReflowQueryType};
use mem::heap_size_of_self_and_children;
-use msg::constellation_msg::{LoadData, PanicMsg, PipelineId, PipelineNamespace};
+use msg::constellation_msg::{FrameType, LoadData, PanicMsg, PipelineId, PipelineNamespace};
use msg::constellation_msg::{SubpageId, WindowSizeData, WindowSizeType};
use msg::webdriver_msg::WebDriverScriptCommand;
use net_traits::LoadData as NetLoadData;
@@ -130,7 +130,7 @@ struct InProgressLoad {
/// The pipeline which requested this load.
pipeline_id: PipelineId,
/// The parent pipeline and child subpage associated with this load, if any.
- parent_info: Option<(PipelineId, SubpageId)>,
+ parent_info: Option<(PipelineId, SubpageId, FrameType)>,
/// The current window size associated with this pipeline.
window_size: Option<WindowSizeData>,
/// Channel to the layout thread associated with this pipeline.
@@ -146,7 +146,7 @@ struct InProgressLoad {
impl InProgressLoad {
/// Create a new InProgressLoad object.
fn new(id: PipelineId,
- parent_info: Option<(PipelineId, SubpageId)>,
+ parent_info: Option<(PipelineId, SubpageId, FrameType)>,
layout_chan: Sender<layout_interface::Msg>,
window_size: Option<WindowSizeData>,
url: Url) -> InProgressLoad {
@@ -1126,6 +1126,7 @@ impl ScriptThread {
containing_pipeline_id,
new_pipeline_id,
subpage_id,
+ frame_type,
load_data,
paint_chan,
panic_chan,
@@ -1163,7 +1164,7 @@ impl ScriptThread {
.unwrap();
// Kick off the fetch for the new resource.
- let new_load = InProgressLoad::new(new_pipeline_id, Some((containing_pipeline_id, subpage_id)),
+ let new_load = InProgressLoad::new(new_pipeline_id, Some((containing_pipeline_id, subpage_id, frame_type)),
layout_chan, parent_window.window_size(),
load_data.url.clone());
self.start_page_load(new_load, load_data);
@@ -1459,7 +1460,7 @@ impl ScriptThread {
}
debug!("ScriptThread: loading {} on pipeline {:?}", incomplete.url, incomplete.pipeline_id);
- let frame_element = incomplete.parent_info.and_then(|(parent_id, subpage_id)| {
+ let frame_element = incomplete.parent_info.and_then(|(parent_id, subpage_id, _)| {
// The root context may not exist yet, if the parent of this frame
// exists in a different script thread.
let root_context = self.browsing_context.get();
@@ -1565,7 +1566,7 @@ impl ScriptThread {
// We have a new root frame tree.
self.browsing_context.set(Some(&new_context));
(new_context, ContextToRemove::Root)
- } else if let Some((parent, _)) = incomplete.parent_info {
+ } else if let Some((parent, _, _)) = incomplete.parent_info {
// Create a new context tree entry. This will be a child context.
let new_context = BrowsingContext::new(&window, frame_element, incomplete.pipeline_id);