Get the Rc to the custom_reaction_stack outside the loop instead of using the thread_local inside. (#39310)

This uses the ScriptThread::custom_element_reaction_stack to call the
enqueue_callback_reaction on the Rc instead of in the loop.
Potentially saving access to thread_local variables.


Testing: Should not change functionality and should be covered by wpt
tests.

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
This commit is contained in:
Narfinger 2025-09-16 03:51:13 +02:00 committed by GitHub
parent 8c3acaaec9
commit 22dcc8a49d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 5 deletions

View file

@ -816,11 +816,12 @@ pub(crate) fn upgrade_element(
// Step 4. For each attribute in element's attribute list, in order, enqueue a custom element callback reaction
// with element, callback name "attributeChangedCallback", and « attribute's local name, null, attribute's value,
// attribute's namespace ».
let custom_element_reaction_stack = ScriptThread::custom_element_reaction_stack();
for attr in element.attrs().iter() {
let local_name = attr.local_name().clone();
let value = DOMString::from(&**attr.value());
let namespace = attr.namespace().clone();
ScriptThread::enqueue_callback_reaction(
custom_element_reaction_stack.enqueue_callback_reaction(
element,
CallbackReaction::AttributeChanged(local_name, None, Some(value), namespace),
Some(definition.clone()),