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

2 participants