mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Auto merge of #21988 - CYBAI:drop-promises, r=jdm
Clear refcounted promise before dropping JSRuntime Not sure if this is the right solution? I also tried to `impl Drop for LiveDOMReferences` but it's still executed after dropping JSRuntime. So, maybe we should clear it before dropping the JSRuntime? cc @jdm @asajeffrey --- - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #21331 . - [x] There are tests for these changes; the status of `fetch/cross-origin-resource-policy/fetch-in-iframe.html` will be `OK` <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/21988) <!-- Reviewable:end -->
This commit is contained in:
commit
e580250d5d
2 changed files with 10 additions and 1 deletions
|
@ -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();
|
||||
|
|
|
@ -271,7 +271,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);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue