mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Wrap executions of Rust code called from JS in catch_unwind. Propagate the interrupted panic to the origin of the JS execution via TLS before resuming. Fix #6462.
This commit is contained in:
parent
a74ce64539
commit
b8853554db
4 changed files with 58 additions and 11 deletions
|
@ -61,7 +61,7 @@ use script_layout_interface::message::{Msg, Reflow, ReflowQueryType, ScriptReflo
|
|||
use script_layout_interface::reporter::CSSErrorReporter;
|
||||
use script_layout_interface::rpc::{ContentBoxResponse, ContentBoxesResponse, LayoutRPC};
|
||||
use script_layout_interface::rpc::{MarginStyleResponse, ResolvedStyleResponse};
|
||||
use script_runtime::{ScriptChan, ScriptPort};
|
||||
use script_runtime::{ScriptChan, ScriptPort, maybe_take_panic_result};
|
||||
use script_thread::SendableMainThreadScriptChan;
|
||||
use script_thread::{MainThreadScriptChan, MainThreadScriptMsg, RunnableWrapper};
|
||||
use script_traits::{ConstellationControlMsg, UntrustedNodeAddress};
|
||||
|
@ -74,6 +74,7 @@ use std::collections::{HashMap, HashSet};
|
|||
use std::default::Default;
|
||||
use std::ffi::CString;
|
||||
use std::io::{Write, stderr, stdout};
|
||||
use std::panic;
|
||||
use std::rc::Rc;
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use std::sync::mpsc::TryRecvError::{Disconnected, Empty};
|
||||
|
@ -914,6 +915,10 @@ impl<'a, T: Reflectable> ScriptHelpers for &'a T {
|
|||
report_pending_exception(cx, globalhandle.get());
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(error) = maybe_take_panic_result() {
|
||||
panic::resume_unwind(error);
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue