Fix /custom-elements/when-defined-reentry-crash.html (#30121)

The problem is a double-borrow of the `when_defined` member. The fix is
to let go of the borrow before resolving the promise which will
eventually try to borrow `when_defined` again.

Fixes #30120.
This commit is contained in:
Martin Robinson 2023-08-18 06:00:44 +02:00 committed by GitHub
parent 0fb2dc70ff
commit 218ad8f574
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -397,7 +397,8 @@ impl CustomElementRegistryMethods for CustomElementRegistry {
} }
// Step 16, 16.3 // Step 16, 16.3
if let Some(promise) = self.when_defined.borrow_mut().remove(&name) { let promise = self.when_defined.borrow_mut().remove(&name);
if let Some(promise) = promise {
unsafe { unsafe {
rooted!(in(*cx) let mut constructor = UndefinedValue()); rooted!(in(*cx) let mut constructor = UndefinedValue());
definition definition