Skip to content

Conversation

@sagudev
Copy link
Member

@sagudev sagudev commented Nov 12, 2025

Companion to servo/mozjs#650

We added 3 new options to bindings.conf, each more powerful then the previous one, so one should use the least powerful as possible to keep things flexible:
1 cx_no_gc prepends argument &JSContext, which allows creating NoGC tokens and using functions that do not trigger GC.
2. cx prepends argument &mut JSContext, which allows everything that previous one allows, but it also allows calling GC triggering functions.
3. realm prepends argument &mut CurrentRealm, which can be deref_mut to &mut JSContext (so it can do everything that previous can), but it also ensures that there is current entered realm, which can be used for creation of InRealm.

next steps: #40600

reviewable per commit

Testing: It's just refactoring
try run: https://github.com/sagudev/servo/actions/runs/19287700927

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
@sagudev sagudev changed the title script: Add realm codegen option and demostrate safe realm/jscontext script: Add cx_no_gc/cx/realm codegen option and demostrate them Nov 12, 2025
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
@sagudev sagudev marked this pull request as ready for review November 12, 2025 18:46
@sagudev sagudev requested a review from gterzian as a code owner November 12, 2025 18:46
@servo-highfive servo-highfive added the S-awaiting-review There is new code that needs to be reviewed. label Nov 12, 2025
@sagudev sagudev requested a review from jdm November 12, 2025 18:46
@sagudev sagudev mentioned this pull request Nov 12, 2025
1 task
Copy link
Member

@jdm jdm left a comment

Choose a reason for hiding this comment

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

Really nice work making this possible to integrate incrementally!

@servo-highfive servo-highfive removed the S-awaiting-review There is new code that needs to be reviewed. label Nov 16, 2025
@sagudev sagudev added this pull request to the merge queue Nov 16, 2025
@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 Nov 16, 2025
Merged via the queue into servo:main with commit fa12f7a Nov 16, 2025
40 checks passed
@sagudev sagudev deleted the wrapper2 branch November 16, 2025 06:07
@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 Nov 16, 2025
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.

3 participants