aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/script_thread.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/script_thread.rs')
-rw-r--r--components/script/script_thread.rs97
1 files changed, 45 insertions, 52 deletions
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,