aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/htmliframeelement.rs
diff options
context:
space:
mode:
authoryvt <i@yvt.jp>2021-08-02 00:27:50 +0900
committeryvt <i@yvt.jp>2021-08-03 09:11:19 +0900
commit3090505fd484c661a30a3526c8f5ccb53a48fba9 (patch)
tree8f46056288373156bdba1cd858b8e6c45fc245d0 /components/script/dom/htmliframeelement.rs
parentbd92fad81a24d08208a5739cad4bde6eb58d6ce8 (diff)
downloadservo-3090505fd484c661a30a3526c8f5ccb53a48fba9.tar.gz
servo-3090505fd484c661a30a3526c8f5ccb53a48fba9.zip
refactor(script): `navigate_or_reload_child_browsing_context` should only handle cases involving navigation
The initial document creation does not involve navigation, and it would cause a confusion if this was done by a function which has `navigation` in its name. This commit renames `navigate_or_reload_child_browsing_ context` to `start_new_pipeline`, and introduces a new function which has the original name and is dedicated to handle navigation.
Diffstat (limited to 'components/script/dom/htmliframeelement.rs')
-rw-r--r--components/script/dom/htmliframeelement.rs34
1 files changed, 21 insertions, 13 deletions
diff --git a/components/script/dom/htmliframeelement.rs b/components/script/dom/htmliframeelement.rs
index 6f5264999be..b6f9948874b 100644
--- a/components/script/dom/htmliframeelement.rs
+++ b/components/script/dom/htmliframeelement.rs
@@ -57,9 +57,9 @@ bitflags! {
}
#[derive(PartialEq)]
-pub enum NavigationType {
+enum PipelineType {
InitialAboutBlank,
- Regular,
+ Navigation,
}
#[derive(PartialEq)]
@@ -106,8 +106,16 @@ impl HTMLIFrameElement {
pub fn navigate_or_reload_child_browsing_context(
&self,
+ load_data: LoadData,
+ replace: HistoryEntryReplacement,
+ ) {
+ self.start_new_pipeline(load_data, PipelineType::Navigation, replace);
+ }
+
+ fn start_new_pipeline(
+ &self,
mut load_data: LoadData,
- nav_type: NavigationType,
+ pipeline_type: PipelineType,
replace: HistoryEntryReplacement,
) {
let sandboxed = if self.is_sandboxed() {
@@ -117,12 +125,12 @@ impl HTMLIFrameElement {
};
let browsing_context_id = match self.browsing_context_id() {
- None => return warn!("Navigating unattached iframe."),
+ None => return warn!("Attempted to start a new pipeline on an unattached iframe."),
Some(id) => id,
};
let top_level_browsing_context_id = match self.top_level_browsing_context_id() {
- None => return warn!("Navigating unattached iframe."),
+ None => return warn!("Attempted to start a new pipeline on an unattached iframe."),
Some(id) => id,
};
@@ -181,8 +189,8 @@ impl HTMLIFrameElement {
device_pixel_ratio: window.device_pixel_ratio(),
};
- match nav_type {
- NavigationType::InitialAboutBlank => {
+ match pipeline_type {
+ PipelineType::InitialAboutBlank => {
let (pipeline_sender, pipeline_receiver) = ipc::channel().unwrap();
self.about_blank_pipeline_id.set(Some(new_pipeline_id));
@@ -213,7 +221,7 @@ impl HTMLIFrameElement {
self.pipeline_id.set(Some(new_pipeline_id));
ScriptThread::process_attach_layout(new_layout_info, document.origin().clone());
},
- NavigationType::Regular => {
+ PipelineType::Navigation => {
let load_info = IFrameLoadInfoWithData {
info: load_info,
load_data: load_data,
@@ -251,7 +259,6 @@ impl HTMLIFrameElement {
load_data.srcdoc = String::from(element.get_string_attribute(&local_name!("srcdoc")));
self.navigate_or_reload_child_browsing_context(
load_data,
- NavigationType::Regular,
HistoryEntryReplacement::Disabled,
);
return;
@@ -342,11 +349,12 @@ impl HTMLIFrameElement {
} else {
HistoryEntryReplacement::Disabled
};
- self.navigate_or_reload_child_browsing_context(load_data, NavigationType::Regular, replace);
+ self.navigate_or_reload_child_browsing_context(load_data, replace);
}
fn create_nested_browsing_context(&self) {
- // Synchronously create a new context and navigate it to about:blank.
+ // Synchronously create a new browsing context, which will present
+ // `about:blank`. (This is not a navigation.)
let url = ServoUrl::parse("about:blank").unwrap();
let document = document_from_node(self);
let window = window_from_node(self);
@@ -366,9 +374,9 @@ impl HTMLIFrameElement {
self.top_level_browsing_context_id
.set(Some(top_level_browsing_context_id));
self.browsing_context_id.set(Some(browsing_context_id));
- self.navigate_or_reload_child_browsing_context(
+ self.start_new_pipeline(
load_data,
- NavigationType::InitialAboutBlank,
+ PipelineType::InitialAboutBlank,
HistoryEntryReplacement::Disabled,
);
}