aboutsummaryrefslogtreecommitdiffstats
path: root/components/script
diff options
context:
space:
mode:
authorAneesh Agrawal <aneeshusa@gmail.com>2016-06-09 08:17:30 -0400
committerAneesh Agrawal <aneeshusa@gmail.com>2016-09-13 15:37:38 -0400
commit56fbfd46a4e1e31bf9cde59cffdffbb1b05f97bf (patch)
treefdfd2b2e51d840b451ef01a65a4398e1030bb596 /components/script
parentb9b25b6f82d838c7bb6f87b71d7726f7a58847d9 (diff)
downloadservo-56fbfd46a4e1e31bf9cde59cffdffbb1b05f97bf.tar.gz
servo-56fbfd46a4e1e31bf9cde59cffdffbb1b05f97bf.zip
Excise SubpageId and use only PipelineIds
SubpageId was originally introduced in 2013 to help iframes keep track of their associated (children) pipelines. However, since each pipeline already has a PipelineId, and those are unique, those are sufficient to keep track of children.
Diffstat (limited to 'components/script')
-rw-r--r--components/script/dom/bindings/trace.rs4
-rw-r--r--components/script/dom/browsingcontext.rs6
-rw-r--r--components/script/dom/document.rs16
-rw-r--r--components/script/dom/htmliframeelement.rs38
-rw-r--r--components/script/dom/servohtmlparser.rs8
-rw-r--r--components/script/dom/window.rs26
-rw-r--r--components/script/script_thread.rs97
7 files changed, 74 insertions, 121 deletions
diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs
index fae24096bac..8125013a960 100644
--- a/components/script/dom/bindings/trace.rs
+++ b/components/script/dom/bindings/trace.rs
@@ -57,7 +57,7 @@ use js::jsapi::{GCTraceKindToAscii, Heap, JSObject, JSTracer, TraceKind};
use js::jsval::JSVal;
use js::rust::Runtime;
use libc;
-use msg::constellation_msg::{FrameType, PipelineId, ReferrerPolicy, SubpageId, WindowSizeType};
+use msg::constellation_msg::{FrameType, PipelineId, ReferrerPolicy, WindowSizeType};
use net_traits::{Metadata, NetworkError, ResourceThreads};
use net_traits::filemanager_thread::RelativePos;
use net_traits::image::base::{Image, ImageMetadata};
@@ -308,7 +308,7 @@ no_jsmanaged_fields!(PropertyDeclarationBlock);
no_jsmanaged_fields!(HashSet<T>);
// These three are interdependent, if you plan to put jsmanaged data
// in one of these make sure it is propagated properly to containing structs
-no_jsmanaged_fields!(FrameType, SubpageId, WindowSizeData, WindowSizeType, PipelineId);
+no_jsmanaged_fields!(FrameType, WindowSizeData, WindowSizeType, PipelineId);
no_jsmanaged_fields!(TimerEventId, TimerSource);
no_jsmanaged_fields!(WorkerId);
no_jsmanaged_fields!(QuirksMode);
diff --git a/components/script/dom/browsingcontext.rs b/components/script/dom/browsingcontext.rs
index dad7dfa3b91..02d153296ae 100644
--- a/components/script/dom/browsingcontext.rs
+++ b/components/script/dom/browsingcontext.rs
@@ -26,7 +26,7 @@ use js::jsapi::{JS_GetOwnPropertyDescriptorById, JS_HasPropertyById};
use js::jsapi::{MutableHandle, MutableHandleObject, MutableHandleValue};
use js::jsapi::{ObjectOpResult, PropertyDescriptor};
use js::jsval::{UndefinedValue, PrivateValue};
-use msg::constellation_msg::{PipelineId, SubpageId};
+use msg::constellation_msg::PipelineId;
use std::cell::Cell;
use url::Url;
@@ -160,10 +160,10 @@ impl BrowsingContext {
self.children.borrow_mut().push(JS::from_ref(&context));
}
- pub fn find_child_by_subpage(&self, subpage_id: SubpageId) -> Option<Root<Window>> {
+ pub fn find_child_by_id(&self, pipeline_id: PipelineId) -> Option<Root<Window>> {
self.children.borrow().iter().find(|context| {
let window = context.active_window();
- window.subpage() == Some(subpage_id)
+ window.pipeline_id() == pipeline_id
}).map(|context| context.active_window())
}
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs
index a43194783a0..3436a4aaa0b 100644
--- a/components/script/dom/document.rs
+++ b/components/script/dom/document.rs
@@ -94,7 +94,7 @@ use js::jsapi::{JSContext, JSObject, JSRuntime};
use js::jsapi::JS_GetRuntime;
use msg::constellation_msg::{ALT, CONTROL, SHIFT, SUPER};
use msg::constellation_msg::{Key, KeyModifiers, KeyState};
-use msg::constellation_msg::{PipelineId, ReferrerPolicy, SubpageId};
+use msg::constellation_msg::{PipelineId, ReferrerPolicy};
use net_traits::{AsyncResponseTarget, IpcSend, PendingAsyncLoad};
use net_traits::CookieSource::NonHTTP;
use net_traits::CoreResourceMsg::{GetCookiesForUrl, SetCookiesForUrl};
@@ -1342,9 +1342,9 @@ impl Document {
pub fn trigger_mozbrowser_event(&self, event: MozBrowserEvent) {
if PREFS.is_mozbrowser_enabled() {
- if let Some((parent_pipeline_id, subpage_id, _)) = self.window.parent_info() {
+ if let Some((parent_pipeline_id, _)) = self.window.parent_info() {
let event = ConstellationMsg::MozBrowserEvent(parent_pipeline_id,
- Some(subpage_id),
+ Some(self.window.pipeline_id()),
event);
self.window.constellation_chan().send(event).unwrap();
}
@@ -1581,15 +1581,7 @@ impl Document {
}
/// Find an iframe element in the document.
- pub fn find_iframe(&self, subpage_id: SubpageId) -> Option<Root<HTMLIFrameElement>> {
- self.upcast::<Node>()
- .traverse_preorder()
- .filter_map(Root::downcast::<HTMLIFrameElement>)
- .find(|node| node.subpage_id() == Some(subpage_id))
- }
-
- /// Find an iframe element in the document.
- pub fn find_iframe_by_pipeline(&self, pipeline: PipelineId) -> Option<Root<HTMLIFrameElement>> {
+ pub fn find_iframe(&self, pipeline: PipelineId) -> Option<Root<HTMLIFrameElement>> {
self.upcast::<Node>()
.traverse_preorder()
.filter_map(Root::downcast::<HTMLIFrameElement>)
diff --git a/components/script/dom/htmliframeelement.rs b/components/script/dom/htmliframeelement.rs
index 051f7588687..220eb7d1c7c 100644
--- a/components/script/dom/htmliframeelement.rs
+++ b/components/script/dom/htmliframeelement.rs
@@ -38,7 +38,7 @@ use dom::window::{ReflowReason, Window};
use ipc_channel::ipc;
use js::jsapi::{JSAutoCompartment, JSContext, MutableHandleValue};
use js::jsval::{NullValue, UndefinedValue};
-use msg::constellation_msg::{FrameType, LoadData, PipelineId, SubpageId, TraversalDirection};
+use msg::constellation_msg::{FrameType, LoadData, PipelineId, TraversalDirection};
use net_traits::response::HttpsState;
use script_layout_interface::message::ReflowQueryType;
use script_traits::{IFrameLoadInfo, MozBrowserEvent, ScriptMsg as ConstellationMsg};
@@ -68,7 +68,6 @@ bitflags! {
pub struct HTMLIFrameElement {
htmlelement: HTMLElement,
pipeline_id: Cell<Option<PipelineId>>,
- subpage_id: Cell<Option<SubpageId>>,
sandbox: MutNullableHeap<JS<DOMTokenList>>,
sandbox_allowance: Cell<Option<SandboxAllowance>>,
load_blocker: DOMRefCell<Option<LoadBlocker>>,
@@ -94,14 +93,11 @@ impl HTMLIFrameElement {
}).unwrap_or_else(|| Url::parse("about:blank").unwrap())
}
- pub fn generate_new_subpage_id(&self) -> (SubpageId, Option<SubpageId>) {
- self.pipeline_id.set(Some(PipelineId::new()));
-
- let old_subpage_id = self.subpage_id.get();
- let win = window_from_node(self);
- let subpage_id = win.get_next_subpage_id();
- self.subpage_id.set(Some(subpage_id));
- (subpage_id, old_subpage_id)
+ pub fn generate_new_pipeline_id(&self) -> (Option<PipelineId>, PipelineId) {
+ let old_pipeline_id = self.pipeline_id.get();
+ let new_pipeline_id = PipelineId::new();
+ self.pipeline_id.set(Some(new_pipeline_id));
+ (old_pipeline_id, new_pipeline_id)
}
pub fn navigate_or_reload_child_browsing_context(&self, load_data: Option<LoadData>) {
@@ -126,16 +122,14 @@ impl HTMLIFrameElement {
}
let window = window_from_node(self);
- let (new_subpage_id, old_subpage_id) = self.generate_new_subpage_id();
- let new_pipeline_id = self.pipeline_id.get().unwrap();
+ let (old_pipeline_id, new_pipeline_id) = self.generate_new_pipeline_id();
let private_iframe = self.privatebrowsing();
let frame_type = if self.Mozbrowser() { FrameType::MozBrowserIFrame } else { FrameType::IFrame };
let load_info = IFrameLoadInfo {
load_data: load_data,
parent_pipeline_id: window.pipeline_id(),
- new_subpage_id: new_subpage_id,
- old_subpage_id: old_subpage_id,
+ old_pipeline_id: old_pipeline_id,
new_pipeline_id: new_pipeline_id,
sandbox: sandboxed,
is_private: private_iframe,
@@ -170,8 +164,7 @@ impl HTMLIFrameElement {
}
}
- pub fn update_subpage_id(&self, new_subpage_id: SubpageId, new_pipeline_id: PipelineId) {
- self.subpage_id.set(Some(new_subpage_id));
+ pub fn update_pipeline_id(&self, new_pipeline_id: PipelineId) {
self.pipeline_id.set(Some(new_pipeline_id));
let mut blocker = self.load_blocker.borrow_mut();
@@ -186,7 +179,6 @@ impl HTMLIFrameElement {
HTMLIFrameElement {
htmlelement: HTMLElement::new_inherited(localName, prefix, document),
pipeline_id: Cell::new(None),
- subpage_id: Cell::new(None),
sandbox: Default::default(),
sandbox_allowance: Cell::new(None),
load_blocker: DOMRefCell::new(None),
@@ -208,11 +200,6 @@ impl HTMLIFrameElement {
self.pipeline_id.get()
}
- #[inline]
- pub fn subpage_id(&self) -> Option<SubpageId> {
- self.subpage_id.get()
- }
-
pub fn change_visibility_status(&self, visibility: bool) {
if self.visibility.get() != visibility {
self.visibility.set(visibility);
@@ -270,11 +257,11 @@ impl HTMLIFrameElement {
}
pub fn get_content_window(&self) -> Option<Root<Window>> {
- self.subpage_id.get().and_then(|subpage_id| {
+ self.pipeline_id.get().and_then(|pipeline_id| {
let window = window_from_node(self);
let window = window.r();
let browsing_context = window.browsing_context();
- browsing_context.find_child_by_subpage(subpage_id)
+ browsing_context.find_child_by_id(pipeline_id)
})
}
@@ -659,12 +646,11 @@ impl VirtualMethods for HTMLIFrameElement {
receiver.recv().unwrap()
}
- // Resetting the subpage id to None is required here so that
+ // Resetting the pipeline_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);
}
}
diff --git a/components/script/dom/servohtmlparser.rs b/components/script/dom/servohtmlparser.rs
index 548dad24dae..24a22be75dd 100644
--- a/components/script/dom/servohtmlparser.rs
+++ b/components/script/dom/servohtmlparser.rs
@@ -30,7 +30,7 @@ use hyper::header::ContentType;
use hyper::mime::{Mime, SubLevel, TopLevel};
use hyper_serde::Serde;
use js::jsapi::JSTracer;
-use msg::constellation_msg::{PipelineId, SubpageId};
+use msg::constellation_msg::PipelineId;
use net_traits::{AsyncResponseListener, Metadata, NetworkError};
use network_listener::PreInvoke;
use parse::{Parser, ParserRef, TrustedParser};
@@ -67,19 +67,16 @@ pub struct ParserContext {
is_synthesized_document: bool,
/// The pipeline associated with this document.
id: PipelineId,
- /// The subpage associated with this document.
- subpage: Option<SubpageId>,
/// The URL for this document.
url: Url,
}
impl ParserContext {
- pub fn new(id: PipelineId, subpage: Option<SubpageId>, url: Url) -> ParserContext {
+ pub fn new(id: PipelineId, url: Url) -> ParserContext {
ParserContext {
parser: None,
is_synthesized_document: false,
id: id,
- subpage: subpage,
url: url,
}
}
@@ -102,7 +99,6 @@ impl AsyncResponseListener for ParserContext {
let content_type =
metadata.clone().and_then(|meta| meta.content_type).map(Serde::into_inner);
let parser = match ScriptThread::page_headers_available(&self.id,
- self.subpage.as_ref(),
metadata) {
Some(parser) => parser,
None => return,
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs
index da8d9be0ead..f4efcd8dd76 100644
--- a/components/script/dom/window.rs
+++ b/components/script/dom/window.rs
@@ -51,7 +51,7 @@ use js::jsval::UndefinedValue;
use js::rust::CompileOptionsWrapper;
use js::rust::Runtime;
use libc;
-use msg::constellation_msg::{FrameType, LoadData, PipelineId, SubpageId, WindowSizeType};
+use msg::constellation_msg::{FrameType, LoadData, PipelineId, WindowSizeType};
use net_traits::ResourceThreads;
use net_traits::bluetooth_thread::BluetoothMethodMsg;
use net_traits::image_cache_thread::{ImageCacheChan, ImageCacheThread};
@@ -200,16 +200,14 @@ pub struct Window {
/// page changes.
devtools_wants_updates: Cell<bool>,
- next_subpage_id: Cell<SubpageId>,
-
/// Pending resize event, if any.
resize_event: Cell<Option<(WindowSizeData, WindowSizeType)>>,
/// Pipeline id associated with this page.
id: PipelineId,
- /// Subpage id associated with this page, if any.
- parent_info: Option<(PipelineId, SubpageId, FrameType)>,
+ /// Parent id associated with this page, if any.
+ parent_info: Option<(PipelineId, FrameType)>,
/// Global static data related to the DOM.
dom_static: GlobalStaticData,
@@ -335,11 +333,7 @@ impl Window {
self.id
}
- pub fn subpage(&self) -> Option<SubpageId> {
- self.parent_info.map(|p| p.1)
- }
-
- pub fn parent_info(&self) -> Option<(PipelineId, SubpageId, FrameType)> {
+ pub fn parent_info(&self) -> Option<(PipelineId, FrameType)> {
self.parent_info
}
@@ -1492,13 +1486,6 @@ impl Window {
WindowProxyHandler(self.dom_static.windowproxy_handler.0)
}
- pub fn get_next_subpage_id(&self) -> SubpageId {
- let subpage_id = self.next_subpage_id.get();
- let SubpageId(id_num) = subpage_id;
- self.next_subpage_id.set(SubpageId(id_num + 1));
- subpage_id
- }
-
pub fn get_pending_reflow_count(&self) -> u32 {
self.pending_reflow_count.get()
}
@@ -1612,7 +1599,7 @@ impl Window {
// 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,
+ Some((_, FrameType::IFrame)) => false,
_ => true,
}
}
@@ -1676,7 +1663,7 @@ impl Window {
timer_event_chan: IpcSender<TimerEvent>,
layout_chan: Sender<Msg>,
id: PipelineId,
- parent_info: Option<(PipelineId, SubpageId, FrameType)>,
+ parent_info: Option<(PipelineId, FrameType)>,
window_size: Option<WindowSizeData>)
-> Root<Window> {
let layout_rpc: Box<LayoutRPC> = {
@@ -1726,7 +1713,6 @@ impl Window {
page_clip_rect: Cell::new(max_rect()),
fragment_name: DOMRefCell::new(None),
resize_event: Cell::new(None),
- next_subpage_id: Cell::new(SubpageId(0)),
layout_chan: layout_chan,
layout_rpc: layout_rpc,
window_size: Cell::new(window_size),
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs
index 41f72d909cf..2e9bbf617f3 100644
--- a/components/script/script_thread.rs
+++ b/components/script/script_thread.rs
@@ -65,7 +65,7 @@ use js::jsval::UndefinedValue;
use js::rust::Runtime;
use mem::heap_size_of_self_and_children;
use msg::constellation_msg::{FrameType, LoadData, PipelineId, PipelineNamespace};
-use msg::constellation_msg::{ReferrerPolicy, SubpageId, WindowSizeType};
+use msg::constellation_msg::{ReferrerPolicy, WindowSizeType};
use net_traits::{AsyncResponseTarget, CoreResourceMsg, LoadConsumer, LoadContext, Metadata, ResourceThreads};
use net_traits::{IpcSend, LoadData as NetLoadData};
use net_traits::bluetooth_thread::BluetoothMethodMsg;
@@ -131,8 +131,8 @@ pub unsafe fn trace_thread(tr: *mut JSTracer) {
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, FrameType)>,
+ /// The parent pipeline and frame type associated with this load, if any.
+ parent_info: Option<(PipelineId, FrameType)>,
/// The current window size associated with this pipeline.
window_size: Option<WindowSizeData>,
/// Channel to the layout thread associated with this pipeline.
@@ -150,7 +150,7 @@ struct InProgressLoad {
impl InProgressLoad {
/// Create a new InProgressLoad object.
fn new(id: PipelineId,
- parent_info: Option<(PipelineId, SubpageId, FrameType)>,
+ parent_info: Option<(PipelineId, FrameType)>,
layout_chan: Sender<message::Msg>,
window_size: Option<WindowSizeData>,
url: Url) -> InProgressLoad {
@@ -484,11 +484,11 @@ impl ScriptThreadFactory for ScriptThread {
}
impl ScriptThread {
- pub fn page_headers_available(id: &PipelineId, subpage: Option<&SubpageId>, metadata: Option<Metadata>)
+ pub fn page_headers_available(id: &PipelineId, metadata: Option<Metadata>)
-> Option<ParserRoot> {
SCRIPT_THREAD_ROOT.with(|root| {
let script_thread = unsafe { &*root.get().unwrap() };
- script_thread.handle_page_headers_available(id, subpage, metadata)
+ script_thread.handle_page_headers_available(id, metadata)
})
}
@@ -877,8 +877,8 @@ impl ScriptThread {
fn handle_msg_from_constellation(&self, msg: ConstellationControlMsg) {
match msg {
- ConstellationControlMsg::Navigate(parent_pipeline_id, subpage_id, load_data) =>
- self.handle_navigate(parent_pipeline_id, Some(subpage_id), load_data),
+ ConstellationControlMsg::Navigate(parent_pipeline_id, pipeline_id, load_data) =>
+ self.handle_navigate(parent_pipeline_id, Some(pipeline_id), load_data),
ConstellationControlMsg::SendEvent(id, event) =>
self.handle_event(id, event),
ConstellationControlMsg::ResizeInactive(id, new_size) =>
@@ -894,21 +894,19 @@ impl ScriptThread {
ConstellationControlMsg::NotifyVisibilityChange(parent_pipeline_id, pipeline_id, visible) =>
self.handle_visibility_change_complete_msg(parent_pipeline_id, pipeline_id, visible),
ConstellationControlMsg::MozBrowserEvent(parent_pipeline_id,
- subpage_id,
+ pipeline_id,
event) =>
self.handle_mozbrowser_event_msg(parent_pipeline_id,
- subpage_id,
+ pipeline_id,
event),
- ConstellationControlMsg::UpdateSubpageId(parent_pipeline_id,
- old_subpage_id,
- new_subpage_id,
- new_pipeline_id) =>
- self.handle_update_subpage_id(parent_pipeline_id,
- old_subpage_id,
- new_subpage_id,
- new_pipeline_id),
- ConstellationControlMsg::FocusIFrame(parent_pipeline_id, subpage_id) =>
- self.handle_focus_iframe_msg(parent_pipeline_id, subpage_id),
+ ConstellationControlMsg::UpdatePipelineId(parent_pipeline_id,
+ old_pipeline_id,
+ new_pipeline_id) =>
+ self.handle_update_pipeline_id(parent_pipeline_id,
+ old_pipeline_id,
+ new_pipeline_id),
+ ConstellationControlMsg::FocusIFrame(parent_pipeline_id, pipeline_id) =>
+ self.handle_focus_iframe_msg(parent_pipeline_id, pipeline_id),
ConstellationControlMsg::WebDriverScriptCommand(pipeline_id, msg) =>
self.handle_webdriver_msg(pipeline_id, msg),
ConstellationControlMsg::TickAllAnimations(pipeline_id) =>
@@ -1130,7 +1128,6 @@ impl ScriptThread {
let NewLayoutInfo {
parent_pipeline_id,
new_pipeline_id,
- subpage_id,
frame_type,
load_data,
paint_chan,
@@ -1169,7 +1166,7 @@ impl ScriptThread {
.unwrap();
// Kick off the fetch for the new resource.
- let new_load = InProgressLoad::new(new_pipeline_id, Some((parent_pipeline_id, subpage_id, frame_type)),
+ let new_load = InProgressLoad::new(new_pipeline_id, Some((parent_pipeline_id, frame_type)),
layout_chan, parent_window.window_size(),
load_data.url.clone());
self.start_page_load(new_load, load_data);
@@ -1257,7 +1254,7 @@ impl ScriptThread {
fn handle_visibility_change_complete_msg(&self, parent_pipeline_id: PipelineId, id: PipelineId, visible: bool) {
if let Some(root_context) = self.browsing_context.get() {
if let Some(ref inner_context) = root_context.find(parent_pipeline_id) {
- if let Some(iframe) = inner_context.active_document().find_iframe_by_pipeline(id) {
+ if let Some(iframe) = inner_context.active_document().find_iframe(id) {
iframe.change_visibility_status(visible);
}
}
@@ -1323,12 +1320,12 @@ impl ScriptThread {
fn handle_focus_iframe_msg(&self,
parent_pipeline_id: PipelineId,
- subpage_id: SubpageId) {
+ pipeline_id: PipelineId) {
let borrowed_context = self.root_browsing_context();
let context = borrowed_context.find(parent_pipeline_id).unwrap();
let doc = context.active_document();
- let frame_element = doc.find_iframe(subpage_id);
+ let frame_element = doc.find_iframe(pipeline_id);
if let Some(ref frame_element) = frame_element {
doc.begin_focus_transaction();
@@ -1339,11 +1336,11 @@ impl ScriptThread {
fn handle_framed_content_changed(&self,
parent_pipeline_id: PipelineId,
- subpage_id: SubpageId) {
+ pipeline_id: PipelineId) {
let root_context = self.root_browsing_context();
let context = root_context.find(parent_pipeline_id).unwrap();
let doc = context.active_document();
- let frame_element = doc.find_iframe(subpage_id);
+ let frame_element = doc.find_iframe(pipeline_id);
if let Some(ref frame_element) = frame_element {
frame_element.upcast::<Node>().dirty(NodeDamage::OtherNodeDamage);
let window = context.active_window();
@@ -1357,33 +1354,32 @@ impl ScriptThread {
/// https://developer.mozilla.org/en-US/docs/Web/Events/mozbrowserloadstart
fn handle_mozbrowser_event_msg(&self,
parent_pipeline_id: PipelineId,
- subpage_id: Option<SubpageId>,
+ pipeline_id: Option<PipelineId>,
event: MozBrowserEvent) {
match self.root_browsing_context().find(parent_pipeline_id) {
None => warn!("Mozbrowser event after pipeline {:?} closed.", parent_pipeline_id),
- Some(context) => match subpage_id {
+ Some(context) => match pipeline_id {
None => context.active_window().dispatch_mozbrowser_event(event),
- Some(subpage_id) => match context.active_document().find_iframe(subpage_id) {
- None => warn!("Mozbrowser event after iframe {:?}/{:?} closed.", parent_pipeline_id, subpage_id),
+ Some(pipeline_id) => match context.active_document().find_iframe(pipeline_id) {
+ None => warn!("Mozbrowser event after iframe {:?}/{:?} closed.", parent_pipeline_id, pipeline_id),
Some(frame_element) => frame_element.dispatch_mozbrowser_event(event),
},
},
}
}
- fn handle_update_subpage_id(&self,
- parent_pipeline_id: PipelineId,
- old_subpage_id: SubpageId,
- new_subpage_id: SubpageId,
- new_pipeline_id: PipelineId) {
+ fn handle_update_pipeline_id(&self,
+ parent_pipeline_id: PipelineId,
+ old_pipeline_id: PipelineId,
+ new_pipeline_id: PipelineId) {
let borrowed_context = self.root_browsing_context();
let frame_element = borrowed_context.find(parent_pipeline_id).and_then(|context| {
let doc = context.active_document();
- doc.find_iframe(old_subpage_id)
+ doc.find_iframe(old_pipeline_id)
});
- frame_element.unwrap().update_subpage_id(new_subpage_id, new_pipeline_id);
+ frame_element.unwrap().update_pipeline_id(new_pipeline_id);
}
/// Window was resized, but this script was not active, so don't reflow yet
@@ -1412,11 +1408,9 @@ impl ScriptThread {
/// We have received notification that the response associated with a load has completed.
/// Kick off the document and frame tree creation process using the result.
- fn handle_page_headers_available(&self, id: &PipelineId, subpage: Option<&SubpageId>,
+ fn handle_page_headers_available(&self, id: &PipelineId,
metadata: Option<Metadata>) -> Option<ParserRoot> {
- let idx = self.incomplete_loads.borrow().iter().position(|load| {
- load.pipeline_id == *id && load.parent_info.as_ref().map(|info| &info.1) == subpage
- });
+ let idx = self.incomplete_loads.borrow().iter().position(|load| { load.pipeline_id == *id });
// The matching in progress load structure may not exist if
// the pipeline exited before the page load completed.
match idx {
@@ -1539,7 +1533,7 @@ impl ScriptThread {
Some(browsing_context) => browsing_context.active_document(),
None => return warn!("Message sent to closed pipeline {}.", parent_pipeline_id),
};
- if let Some(iframe) = document.find_iframe_by_pipeline(id) {
+ if let Some(iframe) = document.find_iframe(id) {
iframe.iframe_load_event_steps(id);
}
}
@@ -1561,7 +1555,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, _)| {
// 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();
@@ -1576,7 +1570,7 @@ impl ScriptThread {
root_context.and_then(|root_context| {
root_context.find(parent_id).and_then(|context| {
let doc = context.active_document();
- doc.find_iframe(subpage_id)
+ doc.find_iframe(incomplete.pipeline_id)
})
})
});
@@ -1664,7 +1658,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);
@@ -2006,7 +2000,7 @@ impl ScriptThread {
/// https://html.spec.whatwg.org/multipage/#navigating-across-documents
/// The entry point for content to notify that a new load has been requested
/// for the given pipeline (specifically the "navigate" algorithm).
- fn handle_navigate(&self, parent_pipeline_id: PipelineId, subpage_id: Option<SubpageId>, load_data: LoadData) {
+ fn handle_navigate(&self, parent_pipeline_id: PipelineId, pipeline_id: Option<PipelineId>, load_data: LoadData) {
// Step 7.
{
let nurl = &load_data.url;
@@ -2024,12 +2018,12 @@ impl ScriptThread {
}
}
- match subpage_id {
- Some(subpage_id) => {
+ match pipeline_id {
+ Some(pipeline_id) => {
let root_context = self.root_browsing_context();
let iframe = root_context.find(parent_pipeline_id).and_then(|context| {
let doc = context.active_document();
- doc.find_iframe(subpage_id)
+ doc.find_iframe(pipeline_id)
});
if let Some(iframe) = iframe.r() {
iframe.navigate_or_reload_child_browsing_context(Some(load_data));
@@ -2076,9 +2070,8 @@ impl ScriptThread {
/// argument until a notification is received that the fetch is complete.
fn start_page_load(&self, incomplete: InProgressLoad, mut load_data: LoadData) {
let id = incomplete.pipeline_id.clone();
- let subpage = incomplete.parent_info.clone().map(|p| p.1);
- let context = Arc::new(Mutex::new(ParserContext::new(id, subpage, load_data.url.clone())));
+ let context = Arc::new(Mutex::new(ParserContext::new(id, load_data.url.clone())));
let (action_sender, action_receiver) = ipc::channel().unwrap();
let listener = NetworkListener {
context: context,