8000 script: Add support for creating globals in isolated compartments by delan · Pull Request #38236 · servo/servo · GitHub
[go: up one dir, main page]

Skip to content

Conversation

delan
Copy link
Member
@delan delan commented Jul 23, 2025

to use the SpiderMonkey Debugger API, we need to call it from an internal debugger script that we will supply. this script must run in the same runtime as the debuggee(s), but in a separate compartment (more details).

when creating two globals in the same runtime, Servo will generally try to reuse an existing compartment for the second global, and there are other places in script where we rely on this reuse. but for the debugger script, we can’t do this.

this patch adds a use_system_compartment flag to global object descriptors, which isolates the global in its own compartment in both possible directions:

  • it forces the global to create a new compartment, preventing the reuse of any debuggee’s compartment
  • it fails the check in select_compartment(), preventing future debuggees from reusing the global’s compartment

Testing: manually tested working in devtools debugger patch (#37667), where it will undergo automated tests

@delan delan force-pushed the system-principals-and-compartments branch from 5ea52ec to ede86f3 Compare July 23, 2025 10:52
Co-authored-by: atbrakhi <atbrakhi@igalia.com>
Signed-off-by: Delan Azabani <dazabani@igalia.com>
@delan delan force-pushed the system-principals-and-compartments branch from ede86f3 to 06a7b10 Compare July 23, 2025 10:57
Co-authored-by: atbrakhi <atbrakhi@igalia.com>
Signed-off-by: Delan Azabani <dazabani@igalia.com>
@delan delan marked this pull request as ready for review July 23, 2025 11:29
@delan delan requested a review from jdm July 23, 2025 11:29
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.

Thanks for the comments!

@jdm jdm added this pull request to the merge queue Jul 23, 2025
Merged via the queue into main with commit 52f53f6 Jul 23, 2025
23 checks passed
@jdm jdm deleted the system-principals-and-compartments branch July 23, 2025 12:02
@delan delan mentioned this pull request Jul 28, 2025
81 tasks
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.

2 participants
0