Skip to content

Commit

Permalink
Replace initial about:blank loads
Browse files Browse the repository at this point in the history
  • Loading branch information
cbrewster committed Apr 11, 2018
1 parent 004549d commit 5f85824
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
11 changes: 10 additions & 1 deletion components/script/dom/htmliframeelement.rs
Expand Up @@ -71,6 +71,7 @@ pub struct HTMLIFrameElement {
browsing_context_id: Cell<Option<BrowsingContextId>>,
pipeline_id: Cell<Option<PipelineId>>,
pending_pipeline_id: Cell<Option<PipelineId>>,
about_blank_pipeline_id: Cell<Option<PipelineId>>,
sandbox: MutNullableDom<DOMTokenList>,
sandbox_allowance: Cell<Option<SandboxAllowance>>,
load_blocker: DomRefCell<Option<LoadBlocker>>,
Expand Down Expand Up @@ -164,6 +165,8 @@ impl HTMLIFrameElement {
NavigationType::InitialAboutBlank => {
let (pipeline_sender, pipeline_receiver) = ipc::channel().unwrap();

self.about_blank_pipeline_id.set(Some(new_pipeline_id));

global_scope
.script_to_constellation_chan()
.send(ScriptMsg::ScriptNewIFrame(load_info, pipeline_sender))
Expand Down Expand Up @@ -231,7 +234,11 @@ impl HTMLIFrameElement {

let document = document_from_node(self);
let load_data = LoadData::new(url, creator_pipeline_id, document.get_referrer_policy(), Some(document.url()));
self.navigate_or_reload_child_browsing_context(Some(load_data), NavigationType::Regular, false);

let pipeline_id = self.pipeline_id();
// If the initial `about:blank` page is the current page, load with replacement enabled.
let replace = pipeline_id.is_some() && pipeline_id == self.about_blank_pipeline_id.get();
self.navigate_or_reload_child_browsing_context(Some(load_data), NavigationType::Regular, replace);
}

fn create_nested_browsing_context(&self) {
Expand All @@ -253,6 +260,7 @@ impl HTMLIFrameElement {
fn destroy_nested_browsing_context(&self) {
self.pipeline_id.set(None);
self.pending_pipeline_id.set(None);
self.about_blank_pipeline_id.set(None);
self.top_level_browsing_context_id.set(None);
self.browsing_context_id.set(None);
}
Expand Down Expand Up @@ -285,6 +293,7 @@ impl HTMLIFrameElement {
top_level_browsing_context_id: Cell::new(None),
pipeline_id: Cell::new(None),
pending_pipeline_id: Cell::new(None),
about_blank_pipeline_id: Cell::new(None),
sandbox: Default::default(),
sandbox_allowance: Cell::new(None),
load_blocker: DomRefCell::new(None),
Expand Down

This file was deleted.

This file was deleted.

0 comments on commit 5f85824

Please sign in to comment.