mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
constellation: crash to a new “sad tab” error page (#30290)
* constellation: crash to a new “sad tab” page * check in resources/crash.html * use a separate enum variant instead of keying on reason * fmt + tidy * rename Resource::Crash to Resource::CrashHTML * clean up crash page and add details (reason + backtrace) * avoid repeating crash errors in script::script_thread warn log * make new LoadData init more idiomatic * clarify comments and new fields * fix doc comment style
This commit is contained in:
parent
1b6351486c
commit
c3c6c95a9b
13 changed files with 102 additions and 46 deletions
|
@ -2782,7 +2782,7 @@ where
|
|||
|
||||
self.embedder_proxy.send((
|
||||
Some(top_level_browsing_context_id),
|
||||
EmbedderMsg::Panic(reason, backtrace),
|
||||
EmbedderMsg::Panic(reason.clone(), backtrace.clone()),
|
||||
));
|
||||
|
||||
let browsing_context = match self.browsing_contexts.get(&browsing_context_id) {
|
||||
|
@ -2797,7 +2797,6 @@ where
|
|||
Some(p) => p,
|
||||
None => return warn!("failed pipeline is missing"),
|
||||
};
|
||||
let pipeline_url = pipeline.url.clone();
|
||||
let opener = pipeline.opener;
|
||||
|
||||
self.close_browsing_context_children(
|
||||
|
@ -2806,23 +2805,27 @@ where
|
|||
ExitPipelineMode::Force,
|
||||
);
|
||||
|
||||
let failure_url = ServoUrl::parse("about:failure").expect("infallible");
|
||||
|
||||
if pipeline_url == failure_url {
|
||||
return error!("about:failure failed");
|
||||
let old_pipeline_id = pipeline_id;
|
||||
let old_load_data = match self.pipelines.get(&pipeline_id) {
|
||||
Some(pipeline) => pipeline.load_data.clone(),
|
||||
None => return warn!("failed pipeline is missing"),
|
||||
};
|
||||
if old_load_data.crash.is_some() {
|
||||
return error!("crash page crashed");
|
||||
}
|
||||
|
||||
warn!("creating replacement pipeline for about:failure");
|
||||
warn!("creating replacement pipeline for crash page");
|
||||
|
||||
let new_pipeline_id = PipelineId::new();
|
||||
let load_data = LoadData::new(
|
||||
LoadOrigin::Constellation,
|
||||
failure_url,
|
||||
None,
|
||||
Referrer::NoReferrer,
|
||||
None,
|
||||
None,
|
||||
);
|
||||
let new_load_data = LoadData {
|
||||
crash: Some(
|
||||
backtrace
|
||||
.map(|b| format!("{}\n{}", reason, b))
|
||||
.unwrap_or(reason),
|
||||
),
|
||||
..old_load_data.clone()
|
||||
};
|
||||
|
||||
let sandbox = IFrameSandboxState::IFrameSandboxed;
|
||||
let is_private = false;
|
||||
self.new_pipeline(
|
||||
|
@ -2832,7 +2835,7 @@ where
|
|||
None,
|
||||
opener,
|
||||
window_size,
|
||||
load_data,
|
||||
new_load_data,
|
||||
sandbox,
|
||||
is_private,
|
||||
is_visible,
|
||||
|
@ -2841,7 +2844,9 @@ where
|
|||
top_level_browsing_context_id,
|
||||
browsing_context_id,
|
||||
new_pipeline_id,
|
||||
replace: None,
|
||||
// Pipeline already closed by close_browsing_context_children, so we can pass Yes here
|
||||
// to avoid closing again in handle_activate_document_msg (though it would be harmless)
|
||||
replace: Some(NeedsToReload::Yes(old_pipeline_id, old_load_data)),
|
||||
new_browsing_context_info: None,
|
||||
window_size,
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue