Skip to content

script: Use AtomicRefCell for Document::url and Document::default_language - #49136

Merged
jdm merged 3 commits into
servo:mainfrom
Siddhi-sahu:issue-49053-atomicrefcell
Oct 23, 2026
Merged

jdm merged 3 commits into
servo:mainfrom
Siddhi-sahu:issue-49053-atomicrefcell

Conversation

@Siddhi-sahu

@Siddhi-sahu Siddhi-sahu commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Chnaged both fields Document::url and Document::default_language to use AtomicRefCell from DomRefCell(which is for single threaded script use), so that borrow tracking is safe among threads.

layout now reads these two fields with a safe borrow, so the two unsafe borrow_for_layout calls are removed.

In default_language_for_layout, previously returned a &str, it now returns the AtomicRef, like #46758 ,(a reference can't outlive borrow), and its caller in element.rs, calls .as_deref() itself, while holding the guard.

a full WPT try run had no unexpected results, try run

Testing: Existing tests suffice.
Fixes: #49053

@Siddhi-sahu
Siddhi-sahu requested a review from gterzian as a code owner October 21, 2026 14:12
@servo-highfive servo-highfive added the S-awaiting-review There is new code that needs to be reviewed. label Oct 21, 2026

@jdm jdm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@servo-highfive servo-highfive removed the S-awaiting-review There is new code that needs to be reviewed. label Oct 23, 2026
@jdm
jdm added this pull request to the merge queue Oct 23, 2026
@servo-highfive servo-highfive added the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Oct 23, 2026
Merged via the queue into servo:main with commit dc0de93 Oct 23, 2026
37 checks passed
@servo-highfive servo-highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Oct 23, 2026
@Siddhi-sahu

Copy link
Copy Markdown
Contributor Author

Thank you!

thank you for reviewing.

@Siddhi-sahu
Siddhi-sahu deleted the issue-49053-atomicrefcell branch October 26, 2026 08:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace Document::url and Document::default_language with AtomicRefCell

3 participants