mirror of
https://github.com/servo/servo.git
synced 2025-06-08 08:33:26 +00:00
Fix GC borrow hazards triggered by LoadBlocker::terminate (#34122)
* Fix GC borrow hazards triggered by LoadBlocker::terminate Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com> * Fix clippy warnings Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com> * Use borrow_mut() Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com> * Revert to previous code due to crown unrooted error Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com> * Update test expectations Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com> --------- Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com>
This commit is contained in:
parent
072ff302d2
commit
cc6163dcdd
10 changed files with 34 additions and 40 deletions
|
@ -11,6 +11,7 @@ use net_traits::request::RequestBuilder;
|
|||
use net_traits::{fetch_async, BoxedFetchCallback, ResourceThreads};
|
||||
use servo_url::ServoUrl;
|
||||
|
||||
use crate::dom::bindings::cell::DomRefCell;
|
||||
use crate::dom::bindings::root::Dom;
|
||||
use crate::dom::document::Document;
|
||||
use crate::fetch::FetchCanceller;
|
||||
|
@ -49,11 +50,12 @@ impl LoadBlocker {
|
|||
}
|
||||
|
||||
/// Remove this load from the associated document's list of blocking loads.
|
||||
pub fn terminate(blocker: &mut Option<LoadBlocker>, can_gc: CanGc) {
|
||||
if let Some(this) = blocker.as_mut() {
|
||||
this.doc.finish_load(this.load.take().unwrap(), can_gc);
|
||||
pub fn terminate(blocker: &DomRefCell<Option<LoadBlocker>>, can_gc: CanGc) {
|
||||
if let Some(this) = blocker.borrow().as_ref() {
|
||||
let load_data = this.load.clone().unwrap();
|
||||
this.doc.finish_load(load_data, can_gc);
|
||||
}
|
||||
*blocker = None;
|
||||
*blocker.borrow_mut() = None;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue