Drop TrustedPromise before dropping JSRuntime

This commit is contained in:
CYBAI 2018-10-21 21:30:19 +08:00
parent 2304f02123
commit bca951d79e
2 changed files with 10 additions and 1 deletions

View file

@ -224,6 +224,12 @@ impl LiveDOMReferences {
});
}
pub fn destruct() {
LIVE_REFERENCES.with(|ref r| {
*r.borrow_mut() = None;
});
}
#[allow(unrooted_must_root)]
fn addref_promise(&self, promise: Rc<Promise>) {
let mut table = self.promise_table.borrow_mut();

View file

@ -145,7 +145,10 @@ pub struct Runtime(RustRuntime);
impl Drop for Runtime {
fn drop(&mut self) {
THREAD_ACTIVE.with(|t| t.set(false));
THREAD_ACTIVE.with(|t| {
LiveDOMReferences::destruct();
t.set(false);
});
}
}