mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
GC hazard fix in customelementregistry.rs (#34019)
* GC hazard fix in customelement.registry.rs Signed-off-by: L Ashwin B <lashwinib@gmail.com> * removed redundant borrow Signed-off-by: L Ashwin B <lashwinib@gmail.com> --------- Signed-off-by: L Ashwin B <lashwinib@gmail.com>
This commit is contained in:
parent
82c9d41330
commit
53911f4e5a
1 changed files with 4 additions and 6 deletions
|
@ -598,13 +598,11 @@ impl CustomElementRegistryMethods for CustomElementRegistry {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Step 3
|
// Steps 3, 4, 5
|
||||||
let mut map = self.when_defined.borrow_mut();
|
let existing_promise = self.when_defined.borrow().get(&name).cloned();
|
||||||
|
let promise = existing_promise.unwrap_or_else(|| {
|
||||||
// Steps 4, 5
|
|
||||||
let promise = map.get(&name).cloned().unwrap_or_else(|| {
|
|
||||||
let promise = Promise::new_in_current_realm(comp, can_gc);
|
let promise = Promise::new_in_current_realm(comp, can_gc);
|
||||||
map.insert(name, promise.clone());
|
self.when_defined.borrow_mut().insert(name, promise.clone());
|
||||||
promise
|
promise
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue