mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Miscellaneous fixes to harden the constellation.
This commit is contained in:
parent
e148571812
commit
f9f15876cd
1 changed files with 21 additions and 5 deletions
|
@ -441,6 +441,9 @@ impl<LTF: LayoutThreadFactory, STF: ScriptThreadFactory> Constellation<LTF, STF>
|
|||
pipeline_id: PipelineId,
|
||||
unprivileged_pipeline_content: UnprivilegedPipelineContent)
|
||||
{
|
||||
// Note that this function can panic, due to process creation,
|
||||
// avoiding this panic would require a mechanism for dealing
|
||||
// with low-resource scenarios.
|
||||
let (server, token) =
|
||||
IpcOneShotServer::<IpcSender<UnprivilegedPipelineContent>>::new().unwrap();
|
||||
|
||||
|
@ -708,7 +711,7 @@ impl<LTF: LayoutThreadFactory, STF: ScriptThreadFactory> Constellation<LTF, STF>
|
|||
debug!("constellation got remove iframe message");
|
||||
self.handle_remove_iframe_msg(pipeline_id);
|
||||
if let Some(sender) = sender {
|
||||
sender.send(()).unwrap();
|
||||
sender.send(()).unwrap_or_else(|e| debug!("Error replying to remove iframe ({})", e));
|
||||
}
|
||||
}
|
||||
Request::Script(FromScriptMsg::NewFavicon(url)) => {
|
||||
|
@ -1458,6 +1461,10 @@ impl<LTF: LayoutThreadFactory, STF: ScriptThreadFactory> Constellation<LTF, STF>
|
|||
/// Since this function is only used in reftests, we do not harden it against panic.
|
||||
fn handle_is_ready_to_save_image(&mut self,
|
||||
pipeline_states: HashMap<PipelineId, Epoch>) -> ReadyToSave {
|
||||
// Note that this function can panic, due to ipc-channel creation failure.
|
||||
// avoiding this panic would require a mechanism for dealing
|
||||
// with low-resource scenarios.
|
||||
//
|
||||
// If there is no root frame yet, the initial page has
|
||||
// not loaded, so there is nothing to save yet.
|
||||
if self.root_frame_id.is_none() {
|
||||
|
@ -1487,8 +1494,9 @@ impl<LTF: LayoutThreadFactory, STF: ScriptThreadFactory> Constellation<LTF, STF>
|
|||
// but hasn't yet notified the document.
|
||||
let (sender, receiver) = ipc::channel().unwrap();
|
||||
let msg = LayoutControlMsg::GetWebFontLoadState(sender);
|
||||
pipeline.layout_chan.0.send(msg).unwrap();
|
||||
if receiver.recv().unwrap() {
|
||||
pipeline.layout_chan.0.send(msg)
|
||||
.unwrap_or_else(|e| debug!("Get web font failed ({})", e));
|
||||
if receiver.recv().unwrap_or(true) {
|
||||
return ReadyToSave::WebFontNotLoaded;
|
||||
}
|
||||
|
||||
|
@ -1563,7 +1571,9 @@ impl<LTF: LayoutThreadFactory, STF: ScriptThreadFactory> Constellation<LTF, STF>
|
|||
self.close_pipeline(*pipeline_id, exit_mode);
|
||||
}
|
||||
|
||||
self.frames.remove(&frame_id).unwrap();
|
||||
if let None = self.frames.remove(&frame_id) {
|
||||
debug!("Closing frame {:?} twice.", frame_id);
|
||||
}
|
||||
|
||||
if let Some((parent_pipeline_id, _)) = parent_info {
|
||||
let parent_pipeline = self.mut_pipeline(parent_pipeline_id);
|
||||
|
@ -1591,7 +1601,10 @@ impl<LTF: LayoutThreadFactory, STF: ScriptThreadFactory> Constellation<LTF, STF>
|
|||
self.close_frame(*child_frame, exit_mode);
|
||||
}
|
||||
|
||||
let pipeline = self.pipelines.remove(&pipeline_id).unwrap();
|
||||
let pipeline = match self.pipelines.remove(&pipeline_id) {
|
||||
Some(pipeline) => pipeline,
|
||||
None => return debug!("Closing pipeline {:?} twice.", pipeline_id),
|
||||
};
|
||||
|
||||
// If a child pipeline, remove from subpage map
|
||||
if let Some(info) = pipeline.parent_info {
|
||||
|
@ -1665,6 +1678,9 @@ impl<LTF: LayoutThreadFactory, STF: ScriptThreadFactory> Constellation<LTF, STF>
|
|||
// Send the current frame tree to compositor, and grant paint
|
||||
// permission to each pipeline in the current frame tree.
|
||||
fn send_frame_tree_and_grant_paint_permission(&mut self) {
|
||||
// Note that this function can panic, due to ipc-channel creation failure.
|
||||
// avoiding this panic would require a mechanism for dealing
|
||||
// with low-resource scenarios.
|
||||
if let Some(root_frame_id) = self.root_frame_id {
|
||||
let frame_tree = self.frame_to_sendable(root_frame_id);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue