mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Various borrow hazard fixes (#33133)
* Reduce the scope of the document tag map borrow. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Reduce scope of borrow when finishing a Response. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Avoid creating a File object while borrowing FormData's data. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Prevent the GC from seeing an uninitialized window proxy slot. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
parent
c00cd1326a
commit
bc5235827f
4 changed files with 16 additions and 12 deletions
|
@ -4287,15 +4287,15 @@ impl DocumentMethods for Document {
|
|||
// https://dom.spec.whatwg.org/#dom-document-getelementsbytagname
|
||||
fn GetElementsByTagName(&self, qualified_name: DOMString) -> DomRoot<HTMLCollection> {
|
||||
let qualified_name = LocalName::from(&*qualified_name);
|
||||
match self.tag_map.borrow_mut().entry(qualified_name.clone()) {
|
||||
Occupied(entry) => DomRoot::from_ref(entry.get()),
|
||||
Vacant(entry) => {
|
||||
let result =
|
||||
HTMLCollection::by_qualified_name(&self.window, self.upcast(), qualified_name);
|
||||
entry.insert(Dom::from_ref(&*result));
|
||||
result
|
||||
},
|
||||
if let Some(entry) = self.tag_map.borrow_mut().get(&qualified_name) {
|
||||
return DomRoot::from_ref(entry);
|
||||
}
|
||||
let result =
|
||||
HTMLCollection::by_qualified_name(&self.window, self.upcast(), qualified_name.clone());
|
||||
self.tag_map
|
||||
.borrow_mut()
|
||||
.insert(qualified_name, Dom::from_ref(&*result));
|
||||
result
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-document-getelementsbytagnamens
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue