mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Fix double-panic when the script task panics.
This commit is contained in:
parent
b1a35f549b
commit
48b151948f
3 changed files with 18 additions and 12 deletions
|
@ -155,6 +155,14 @@ pub struct Window {
|
|||
}
|
||||
|
||||
impl Window {
|
||||
#[allow(unsafe_code)]
|
||||
pub fn clear_js_context_for_script_deallocation(&self) {
|
||||
unsafe {
|
||||
*self.js_context.borrow_for_script_deallocation() = None;
|
||||
*self.browser_context.borrow_for_script_deallocation() = None;
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_cx(&self) -> *mut JSContext {
|
||||
self.js_context.borrow().as_ref().unwrap().ptr
|
||||
}
|
||||
|
@ -425,7 +433,6 @@ impl<'a> WindowMethods for JSRef<'a, Window> {
|
|||
|
||||
pub trait WindowHelpers {
|
||||
fn clear_js_context(self);
|
||||
fn clear_js_context_for_script_deallocation(self);
|
||||
fn init_browser_context(self, doc: JSRef<Document>, frame_element: Option<JSRef<Element>>);
|
||||
fn load_url(self, href: DOMString);
|
||||
fn handle_fire_timer(self, timer_id: TimerId);
|
||||
|
@ -499,14 +506,6 @@ impl<'a> WindowHelpers for JSRef<'a, Window> {
|
|||
*self.browser_context.borrow_mut() = None;
|
||||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
fn clear_js_context_for_script_deallocation(self) {
|
||||
unsafe {
|
||||
*self.js_context.borrow_for_script_deallocation() = None;
|
||||
*self.browser_context.borrow_for_script_deallocation() = None;
|
||||
}
|
||||
}
|
||||
|
||||
/// Reflows the page if it's possible to do so and the page is dirty. This method will wait
|
||||
/// for the layout thread to complete (but see the `TODO` below). If there is no window size
|
||||
/// yet, the page is presumed invisible and no reflow is performed.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue