Skip to content

script: Always pass &mut JSContext to Constructor - #46040

Merged
TimvdLippe merged 3 commits into
servo:mainfrom
TimvdLippe:cx-constructor
Jun 27, 2026
Merged

script: Always pass &mut JSContext to Constructor#46040
TimvdLippe merged 3 commits into
servo:mainfrom
TimvdLippe:cx-constructor

Conversation

@TimvdLippe

Copy link
Copy Markdown
Contributor

Ports all relevant constructors that are generated bindings to pass a &mut JSContext rather than can_gc. It got a bit out of hand as I underestimated the amount of affected constructors. However, all of it is purely mechanical, so should be straightforward to review.

It also updates some of the ordering of determining which argument type to pass. Since realms have higher priority than just JSContext, these are also now checked first. This is required since 1 Constructor is marked as realm and otherwise it would have always taken a JSContext since that would be checked first.

Part of #40600

Testing: it compiles

Ports all relevant constructors that are generated bindings
to pass a `&mut JSContext` rather than `can_gc`. It got
a bit out of hand as I underestimated the amount of affected
constructors. However, all of it is purely mechanical, so
should be straightforward to review.

Part of servo#40600

Testing: it compiles

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
@servo-highfive servo-highfive added the S-awaiting-review There is new code that needs to be reviewed. label Jun 27, 2026

@sagudev sagudev 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.

Otherwise LGTM

Comment thread components/script_bindings/codegen/codegen.py Outdated
@servo-highfive servo-highfive removed the S-awaiting-review There is new code that needs to be reviewed. label Jun 27, 2026
Signed-off-by: Tim van der Lippe <TimvdLippe@users.noreply.github.com>
@servo-highfive servo-highfive added the S-awaiting-review There is new code that needs to be reviewed. label Jun 27, 2026
@TimvdLippe
TimvdLippe enabled auto-merge June 27, 2026 21:10
Signed-off-by: Tim van der Lippe <TimvdLippe@users.noreply.github.com>
@TimvdLippe
TimvdLippe added this pull request to the merge queue Jun 27, 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 Jun 27, 2026
Merged via the queue into servo:main with commit 3d959c0 Jun 27, 2026
31 checks passed
@TimvdLippe
TimvdLippe deleted the cx-constructor branch June 27, 2026 22:17
@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 Jun 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-awaiting-review There is new code that needs to be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants