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:
Josh Matthews 2024-08-20 12:06:24 -04:00 committed by GitHub
parent c00cd1326a
commit bc5235827f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 16 additions and 12 deletions

View file

@ -175,6 +175,8 @@ impl FormDataMethods for FormData {
#[allow(crown::unrooted_must_root)]
// https://xhr.spec.whatwg.org/#dom-formdata-set
fn Set_(&self, name: USVString, blob: &Blob, filename: Option<USVString>) {
let file = self.create_an_entry(blob, filename);
let mut data = self.data.borrow_mut();
let local_name = LocalName::from(name.0.clone());
@ -185,9 +187,7 @@ impl FormDataMethods for FormData {
FormDatum {
ty: DOMString::from("file"),
name: DOMString::from(name.0),
value: FormDatumValue::File(DomRoot::from_ref(
&*self.create_an_entry(blob, filename),
)),
value: FormDatumValue::File(file),
},
));
}