mirror of
https://github.com/servo/servo.git
synced 2025-08-16 19:05:33 +01:00
Auto merge of #22376 - cbrewster:constellation_nll_cleanup, r=jdm
Cleanup constellation after nll <!-- Please describe your changes on the following line: --> This cleans up a couple cases where we had to add extra scopes to appease the borrowck, now that nll has landed, this cleans these up. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [X] These changes do not require tests because cleanup <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22376) <!-- Reviewable:end -->
This commit is contained in:
commit
5346f74215
1 changed files with 110 additions and 135 deletions
|
@ -1599,20 +1599,14 @@ where
|
||||||
EmbedderMsg::Panic(reason, backtrace),
|
EmbedderMsg::Panic(reason, backtrace),
|
||||||
));
|
));
|
||||||
|
|
||||||
let (window_size, pipeline_id, is_visible) = {
|
|
||||||
let browsing_context = self.browsing_contexts.get(&browsing_context_id);
|
let browsing_context = self.browsing_contexts.get(&browsing_context_id);
|
||||||
let window_size = browsing_context.and_then(|ctx| ctx.size);
|
let window_size = browsing_context.and_then(|ctx| ctx.size);
|
||||||
let pipeline_id = browsing_context.map(|ctx| ctx.pipeline_id);
|
let pipeline_id = browsing_context.map(|ctx| ctx.pipeline_id);
|
||||||
let is_visible = browsing_context.map(|ctx| ctx.is_visible);
|
let is_visible = browsing_context.map(|ctx| ctx.is_visible);
|
||||||
(window_size, pipeline_id, is_visible)
|
|
||||||
};
|
|
||||||
|
|
||||||
let (pipeline_url, opener) = {
|
|
||||||
let pipeline = pipeline_id.and_then(|id| self.pipelines.get(&id));
|
let pipeline = pipeline_id.and_then(|id| self.pipelines.get(&id));
|
||||||
let pipeline_url = pipeline.map(|pipeline| pipeline.url.clone());
|
let pipeline_url = pipeline.map(|pipeline| pipeline.url.clone());
|
||||||
let opener = pipeline.and_then(|pipeline| pipeline.opener);
|
let opener = pipeline.and_then(|pipeline| pipeline.opener);
|
||||||
(pipeline_url, opener)
|
|
||||||
};
|
|
||||||
|
|
||||||
self.close_browsing_context_children(
|
self.close_browsing_context_children(
|
||||||
browsing_context_id,
|
browsing_context_id,
|
||||||
|
@ -1855,7 +1849,6 @@ where
|
||||||
replace,
|
replace,
|
||||||
} = load_info.info;
|
} = load_info.info;
|
||||||
|
|
||||||
let (load_data, is_private) = {
|
|
||||||
// If no url is specified, reload.
|
// If no url is specified, reload.
|
||||||
let old_pipeline = load_info
|
let old_pipeline = load_info
|
||||||
.old_pipeline_id
|
.old_pipeline_id
|
||||||
|
@ -1880,14 +1873,12 @@ where
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
let is_parent_private =
|
let is_parent_private = match self.browsing_contexts.get(&parent_browsing_context_id) {
|
||||||
match self.browsing_contexts.get(&parent_browsing_context_id) {
|
|
||||||
Some(ctx) => ctx.is_private,
|
Some(ctx) => ctx.is_private,
|
||||||
None => {
|
None => {
|
||||||
return warn!(
|
return warn!(
|
||||||
"Script loaded url in iframe {} in closed parent browsing context {}.",
|
"Script loaded url in iframe {} in closed parent browsing context {}.",
|
||||||
browsing_context_id,
|
browsing_context_id, parent_browsing_context_id,
|
||||||
parent_browsing_context_id,
|
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -1895,10 +1886,6 @@ where
|
||||||
};
|
};
|
||||||
let is_private = is_private || is_parent_private;
|
let is_private = is_private || is_parent_private;
|
||||||
|
|
||||||
(load_data, is_private)
|
|
||||||
};
|
|
||||||
|
|
||||||
let (replace, window_size, is_visible) = {
|
|
||||||
let browsing_context = match self.browsing_contexts.get(&browsing_context_id) {
|
let browsing_context = match self.browsing_contexts.get(&browsing_context_id) {
|
||||||
Some(ctx) => ctx,
|
Some(ctx) => ctx,
|
||||||
None => {
|
None => {
|
||||||
|
@ -1913,8 +1900,6 @@ where
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
(replace, browsing_context.size, browsing_context.is_visible)
|
|
||||||
};
|
|
||||||
|
|
||||||
// Create the new pipeline, attached to the parent and push to pending changes
|
// Create the new pipeline, attached to the parent and push to pending changes
|
||||||
self.new_pipeline(
|
self.new_pipeline(
|
||||||
|
@ -1923,11 +1908,11 @@ where
|
||||||
top_level_browsing_context_id,
|
top_level_browsing_context_id,
|
||||||
Some(parent_pipeline_id),
|
Some(parent_pipeline_id),
|
||||||
None,
|
None,
|
||||||
window_size,
|
browsing_context.size,
|
||||||
load_data.clone(),
|
load_data.clone(),
|
||||||
load_info.sandbox,
|
load_info.sandbox,
|
||||||
is_private,
|
is_private,
|
||||||
is_visible,
|
browsing_context.is_visible,
|
||||||
);
|
);
|
||||||
self.add_pending_change(SessionHistoryChange {
|
self.add_pending_change(SessionHistoryChange {
|
||||||
top_level_browsing_context_id: top_level_browsing_context_id,
|
top_level_browsing_context_id: top_level_browsing_context_id,
|
||||||
|
@ -1958,11 +1943,8 @@ where
|
||||||
// TODO: Referrer?
|
// TODO: Referrer?
|
||||||
let load_data = LoadData::new(url.clone(), Some(parent_pipeline_id), None, None);
|
let load_data = LoadData::new(url.clone(), Some(parent_pipeline_id), None, None);
|
||||||
|
|
||||||
let (pipeline, is_private, is_visible) = {
|
let (script_sender, parent_browsing_context_id) =
|
||||||
let (script_sender, parent_browsing_context_id) = match self
|
match self.pipelines.get(&parent_pipeline_id) {
|
||||||
.pipelines
|
|
||||||
.get(&parent_pipeline_id)
|
|
||||||
{
|
|
||||||
Some(pipeline) => (pipeline.event_loop.clone(), pipeline.browsing_context_id),
|
Some(pipeline) => (pipeline.event_loop.clone(), pipeline.browsing_context_id),
|
||||||
None => return warn!("Script loaded url in closed iframe {}.", parent_pipeline_id),
|
None => return warn!("Script loaded url in closed iframe {}.", parent_pipeline_id),
|
||||||
};
|
};
|
||||||
|
@ -1990,9 +1972,6 @@ where
|
||||||
load_data,
|
load_data,
|
||||||
);
|
);
|
||||||
|
|
||||||
(pipeline, is_private, is_parent_visible)
|
|
||||||
};
|
|
||||||
|
|
||||||
assert!(!self.pipelines.contains_key(&new_pipeline_id));
|
assert!(!self.pipelines.contains_key(&new_pipeline_id));
|
||||||
self.pipelines.insert(new_pipeline_id, pipeline);
|
self.pipelines.insert(new_pipeline_id, pipeline);
|
||||||
self.add_pending_change(SessionHistoryChange {
|
self.add_pending_change(SessionHistoryChange {
|
||||||
|
@ -2004,7 +1983,7 @@ where
|
||||||
new_browsing_context_info: Some(NewBrowsingContextInfo {
|
new_browsing_context_info: Some(NewBrowsingContextInfo {
|
||||||
parent_pipeline_id: Some(parent_pipeline_id),
|
parent_pipeline_id: Some(parent_pipeline_id),
|
||||||
is_private: is_private,
|
is_private: is_private,
|
||||||
is_visible: is_visible,
|
is_visible: is_parent_visible,
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -2026,7 +2005,6 @@ where
|
||||||
// TODO: Referrer?
|
// TODO: Referrer?
|
||||||
let load_data = LoadData::new(url.clone(), None, None, None);
|
let load_data = LoadData::new(url.clone(), None, None, None);
|
||||||
|
|
||||||
let (pipeline, is_private, is_visible) = {
|
|
||||||
let (script_sender, opener_browsing_context_id) =
|
let (script_sender, opener_browsing_context_id) =
|
||||||
match self.pipelines.get(&opener_pipeline_id) {
|
match self.pipelines.get(&opener_pipeline_id) {
|
||||||
Some(pipeline) => (pipeline.event_loop.clone(), pipeline.browsing_context_id),
|
Some(pipeline) => (pipeline.event_loop.clone(), pipeline.browsing_context_id),
|
||||||
|
@ -2060,9 +2038,6 @@ where
|
||||||
load_data,
|
load_data,
|
||||||
);
|
);
|
||||||
|
|
||||||
(pipeline, is_opener_private, is_opener_visible)
|
|
||||||
};
|
|
||||||
|
|
||||||
assert!(!self.pipelines.contains_key(&new_pipeline_id));
|
assert!(!self.pipelines.contains_key(&new_pipeline_id));
|
||||||
self.pipelines.insert(new_pipeline_id, pipeline);
|
self.pipelines.insert(new_pipeline_id, pipeline);
|
||||||
self.browsers.insert(
|
self.browsers.insert(
|
||||||
|
@ -2080,8 +2055,8 @@ where
|
||||||
new_browsing_context_info: Some(NewBrowsingContextInfo {
|
new_browsing_context_info: Some(NewBrowsingContextInfo {
|
||||||
// Auxiliary browsing contexts are always top-level.
|
// Auxiliary browsing contexts are always top-level.
|
||||||
parent_pipeline_id: None,
|
parent_pipeline_id: None,
|
||||||
is_private: is_private,
|
is_private: is_opener_private,
|
||||||
is_visible: is_visible,
|
is_visible: is_opener_visible,
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue