Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(jstz_engine): add support for creating, entering and exiting Realms #659

Merged
merged 1 commit into from
Dec 11, 2024

Conversation

johnyob
Copy link
Collaborator

@johnyob johnyob commented Nov 14, 2024

Context

Adds an interface for Realms. A realm represents a distinct execution environment for JavaScript code,
encapsulating global objects, intrinsic objects, and a separate environment for executing scripts and modules.

Description

This PR adds the ability to:

  • Create new realms (which currently, by default, creates a new compartment),
  • Enter new realms using Context::enter_realm
  • Leave the realm once the Context is dropped.

Manually testing the PR

cargo nextest run --package jstz_engine

@johnyob johnyob self-assigned this Nov 14, 2024
@johnyob johnyob force-pushed the ajob410@jstz-191-add-context-and-compartment branch 4 times, most recently from f81b82c to 9c26683 Compare November 27, 2024 16:48
@johnyob johnyob force-pushed the ajob410@jstz-192-add-realm branch 2 times, most recently from 9044d32 to 44c2372 Compare November 27, 2024 17:11
@johnyob johnyob requested a review from zcabter November 27, 2024 17:12
@johnyob johnyob marked this pull request as ready for review November 27, 2024 17:12
@johnyob johnyob force-pushed the ajob410@jstz-192-add-realm branch 2 times, most recently from 370d8b4 to 4d1d373 Compare November 27, 2024 17:33
Copy link

codecov bot commented Nov 27, 2024

Codecov Report

Attention: Patch coverage is 76.19048% with 25 lines in your changes missing coverage. Please review.

Project coverage is 47.21%. Comparing base (312043f) to head (cff69fb).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
crates/jstz_engine/src/realm.rs 66.66% 13 Missing and 1 partial ⚠️
crates/jstz_engine/src/context.rs 82.53% 10 Missing and 1 partial ⚠️
Files with missing lines Coverage Δ
crates/jstz_engine/src/lib.rs 100.00% <ø> (ø)
crates/jstz_engine/src/context.rs 73.21% <82.53%> (+34.57%) ⬆️
crates/jstz_engine/src/realm.rs 66.66% <66.66%> (ø)

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 312043f...cff69fb. Read the comment docs.

@johnyob johnyob assigned zcabter and unassigned johnyob Nov 27, 2024
@zcabter zcabter assigned johnyob and unassigned zcabter Dec 11, 2024
@johnyob johnyob force-pushed the ajob410@jstz-191-add-context-and-compartment branch from 9c26683 to 93baf27 Compare December 11, 2024 10:43
Base automatically changed from ajob410@jstz-191-add-context-and-compartment to main December 11, 2024 11:02
@johnyob johnyob force-pushed the ajob410@jstz-192-add-realm branch 2 times, most recently from 2641961 to d0a08d1 Compare December 11, 2024 11:08
@johnyob johnyob requested a review from zcabter December 11, 2024 11:08
@johnyob johnyob assigned zcabter and unassigned johnyob Dec 11, 2024
@zcabter zcabter assigned johnyob and unassigned zcabter Dec 11, 2024
@johnyob johnyob force-pushed the ajob410@jstz-192-add-realm branch from d0a08d1 to cff69fb Compare December 11, 2024 11:17
@johnyob johnyob merged commit 4fd7190 into main Dec 11, 2024
5 checks passed
@johnyob johnyob deleted the ajob410@jstz-192-add-realm branch December 11, 2024 11:38
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