script: Make a Layout-safe version of Element::each_custom_state#40743
Merged
jdm merged 1 commit intoservo:mainfrom Dec 1, 2025
Merged
script: Make a Layout-safe version of Element::each_custom_state#40743jdm merged 1 commit intoservo:mainfrom
Element::each_custom_state#40743jdm merged 1 commit intoservo:mainfrom
Conversation
b1edd5d to
e711d84
Compare
each_custom_stateElement::each_custom_state
|
🔨 Triggering try run (#19510341024) for Linux (WPT) |
|
|
Member
Author
|
The failure here looks like an infrastructure issue. |
|
🔨 Triggering try run (#19512422264) for Linux (WPT) |
e711d84 to
63730cc
Compare
|
Test results for linux-wpt from try job (#19512422264): Flaky unexpected result (50)
Stable unexpected results that are known to be intermittent (16)
|
|
✨ Try run (#19512422264) succeeded. |
63730cc to
cbd5a2a
Compare
|
🔨 Triggering try run (#19513363598) for Linux (WPT) |
|
Test results for linux-wpt from try job (#19513363598): Flaky unexpected result (43)
Stable unexpected results that are known to be intermittent (26)
|
|
✨ Try run (#19513363598) succeeded. |
jdm
approved these changes
Nov 28, 2025
|
|
||
| pub(crate) fn custom_states(&self) -> Option<DomRoot<CustomStateSet>> { | ||
| self.states.get() | ||
| pub(crate) fn custom_states(&self) -> &MutNullableDom<CustomStateSet> { |
Member
There was a problem hiding this comment.
I prefer not to return types that callers can mutate, when possible. I think I would prefer to leave this method and add a custom_states_for_layout that calls .get_inner_as_layout() instead.
Member
Author
There was a problem hiding this comment.
That makes total sense. I've done that.
cbd5a2a to
868965f
Compare
`Element::each_custom_state` is called from Layout, but it creates `DomRef` types on the stack, which can only be done on the main script thread. Since layout might be doing styling and element consultation on workers threads, expose a Layout-safe version of this change, which doesn't have this issue. Signed-off-by: Martin Robinson <[email protected]>
868965f to
6a36d38
Compare
github-merge-queue bot
pushed a commit
that referenced
this pull request
Dec 1, 2025
…40743) `Element::each_custom_state` is called from Layout, but it creates `DomRef` types on the stack, which can only be done on the main script thread. Since layout might be doing styling and element consultation on workers threads, expose a Layout-safe version of this change, which doesn't have this issue. Testing: This fixes two panics encountered during WPT tests. Signed-off-by: Martin Robinson <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Element::each_custom_stateis called from Layout, but it createsDomReftypes on the stack, which can only be done on the main scriptthread. Since layout might be doing styling and element consultation on
workers threads, expose a Layout-safe version of this change, which
doesn't have this issue.
Testing: This fixes two panics encountered during WPT tests.