GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — src: bootstrap Web [Exposed=*] APIs in the shadow realm by legendecas · Pull Request #46809 · nodejs/node

Conversation

@legendecas

@legendecas legendecas commented Feb 24, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

This is the initial work to bootstrap Web interfaces that are defined
with extended attributes [Exposed=*].

The ShadowRealm instances are garbage-collected once it is
unreachable. However, V8 can not infer the reference cycles between
the per-realm strong persistent function handles and the realm's
context handle. To allow the context to be gc-ed once it is not
reachable, the per-realm persistent handles are attached to the
context's global object and the persistent handles are set as weak.

Refs: #42528

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

bricss, lin72h, and MomenNano reacted with thumbs up emoji
All reactions
  • 👍 3 reactions
@nodejs-github-bot

nodejs-github-bot commented Feb 24, 2023 •
edited by legendecas
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/startup
  • @nodejs/realm
ikhtearalamshawonmollah54321 reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot nodejs-github-bot added lib / src Issues and PRs involving general changes in the lib/ or src/ directories. needs-ci PRs that need a full CI run. labels Feb 24, 2023
@legendecas legendecas added the realm Issues and PRs related to the ShadowRealm API and node::Realm. label Feb 24, 2023
@legendecas
legendecas force-pushed the shadowrealm/builtin branch from 9801507 to b5bf1ac Compare February 24, 2023 08:26
mcollina
mcollina approved these changes Feb 24, 2023
View reviewed changes

@mcollina mcollina left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

lgtm

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
joyeecheung
joyeecheung reviewed Feb 24, 2023
View reviewed changes
Comment thread src/api/environment.cc Outdated

@joyeecheung joyeecheung Feb 24, 2023

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Actually, why do we need different security tokens? Can we just set the non-principal realm's security token to be the same as the one of the principal realm, like what we do for vm contexts? IIUC security tokens in browsers are generally intended for cross-origin global proxies, which isn't really a thing for Node.js. For shadow realms, the cross-realm access is guarded with wrapped functions and callable boundaries. For Node.js realms, do we care about cross-realm object access?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

ikhtearalamshawonmollah54321 reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

@legendecas legendecas Feb 28, 2023

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

It is true that object exchange across the ShadowRealm boundary is limited with wrapped functions. However, it is still possible for host hooks like the prepareStackTrace callback here to leak objects to the principal realm's userland Error.prepareStackTrace override.

It doesn't hurt to set the security token to be the principal realm's. But I don't see the reason to allow the access either.

I've updated the comment to point out that this branch is intended to avoid calling the principal realm's Error.prepareStackTrace override instead of the security token mismatches.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
jasnell
jasnell approved these changes Feb 24, 2023
View reviewed changes
cjihrig
cjihrig approved these changes Feb 26, 2023
View reviewed changes
Comment thread test/parallel/test-shadow-realm-globals.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread test/common/globals.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

@legendecas
legendecas force-pushed the shadowrealm/builtin branch from b5bf1ac to dee17ae Compare February 28, 2023 06:49
@mcollina mcollina added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Feb 28, 2023
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Feb 28, 2023
@nodejs-github-bot

nodejs-github-bot commented Feb 28, 2023

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/50087/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot mentioned this pull request Mar 1, 2023
CI Reliability 2023-03-01 nodejs/reliability#510
Open
15 tasks
@nodejs-github-bot

nodejs-github-bot commented Mar 1, 2023

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/50124/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot

nodejs-github-bot commented Mar 1, 2023

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/50132/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot mentioned this pull request Mar 2, 2023
CI Reliability 2023-03-02 nodejs/reliability#511
Open
15 tasks
joyeecheung
joyeecheung reviewed Mar 2, 2023
View reviewed changes
Comment thread src/node_realm.cc Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/node_realm-inl.h Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/node_realm-inl.h Resolved

Uh oh!

There was an error while loading. Please reload this page.

joyeecheung
joyeecheung reviewed Mar 2, 2023
View reviewed changes
Comment thread src/node_realm-inl.h Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/node_realm-inl.h Resolved

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot

nodejs-github-bot commented Mar 2, 2023

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/50165/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This was referenced Mar 3, 2023
CI Reliability 2023-03-03 nodejs/reliability#512
Open
CI Reliability 2023-03-04 nodejs/reliability#513
Open
CI Reliability 2023-03-05 nodejs/reliability#514
Open
CI Reliability 2023-03-06 nodejs/reliability#515
Open
@mcollina

mcollina commented Mar 6, 2023

Copy link
Copy Markdown
Member

CI is has a relevant test failure:

node:assert:125
  throw new AssertionError(obj);
  ^

AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal:
+ actual - expected

+ [
+   'BroadcastChannel'
+ ]
- []
    at Object.<anonymous> (/home/iojs/build/workspace/node-test-commit-linux/test/parallel/test-shadow-realm-globals.js:27:8)
    at Module._compile (node:internal/modules/cjs/loader:1287:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1341:10)
    at Module.load (node:internal/modules/cjs/loader:1145:32)
    at Module._load (node:internal/modules/cjs/loader:984:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12)
    at node:internal/main/run_main_module:23:47 {
  generatedMessage: true,
  code: 'ERR_ASSERTION',
  actual: [ 'BroadcastChannel' ],
  expected: [],
  operator: 'deepStrictEqual'
}

Node.js v20.0.0-pre
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

cjihrig
cjihrig reviewed Mar 6, 2023
View reviewed changes
Comment thread test/parallel/test-shadow-realm-globals.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot mentioned this pull request Mar 7, 2023
CI Reliability 2023-03-07 nodejs/reliability#516
Open
19 tasks
@legendecas
legendecas force-pushed the shadowrealm/builtin branch from dee17ae to b204e2f Compare March 7, 2023 18:27
@legendecas legendecas added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Mar 8, 2023
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Mar 8, 2023
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Mar 13, 2023
@nodejs-github-bot

nodejs-github-bot commented Mar 13, 2023

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/50345/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot

nodejs-github-bot commented Mar 13, 2023

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/50349/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot mentioned this pull request Mar 14, 2023
CI Reliability 2023-03-14 nodejs/reliability#523
Open
24 tasks
@nodejs-github-bot

nodejs-github-bot commented Mar 14, 2023

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/50373/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot mentioned this pull request Mar 15, 2023
CI Reliability 2023-03-15 nodejs/reliability#524
Open
22 tasks
@legendecas

legendecas commented Mar 15, 2023

Copy link
Copy Markdown
Member Author

Landed in d0153ae...e6b4d30

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

legendecas added a commit that referenced this pull request Mar 15, 2023
@legendecas
lib: distinguish webidl interfaces with the extended property "Exposed"
41b1867
PR-URL: #46809
Refs: #42528
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
legendecas added a commit that referenced this pull request Mar 15, 2023
@legendecas
src: bootstrap Web [Exposed=*] APIs in the shadow realm
e6b4d30
This is the initial work to bootstrap Web interfaces that are defined
with extended attributes `[Exposed=*]`.

The ShadowRealm instances are garbage-collected once it is
unreachable. However, V8 can not infer the reference cycles between
the per-realm strong persistent function handles and the realm's
context handle. To allow the context to be gc-ed once it is not
reachable, the per-realm persistent handles are attached to the
context's global object and the persistent handles are set as weak.

PR-URL: #46809
Refs: #42528
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
@legendecas legendecas closed this Mar 15, 2023
@legendecas
legendecas deleted the shadowrealm/builtin branch March 15, 2023 16:32
This was referenced Mar 16, 2023
CI Reliability 2023-03-16 nodejs/reliability#525
Open
CI Reliability 2023-03-17 nodejs/reliability#526
Open
CI Reliability 2023-03-18 nodejs/reliability#527
Open
targos pushed a commit that referenced this pull request Mar 18, 2023
@legendecas @targos
lib: distinguish webidl interfaces with the extended property "Exposed"
b37ef83
PR-URL: #46809
Refs: #42528
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
targos pushed a commit that referenced this pull request Mar 18, 2023
@legendecas @targos
src: bootstrap Web [Exposed=*] APIs in the shadow realm
11e1ec7
This is the initial work to bootstrap Web interfaces that are defined
with extended attributes `[Exposed=*]`.

The ShadowRealm instances are garbage-collected once it is
unreachable. However, V8 can not infer the reference cycles between
the per-realm strong persistent function handles and the realm's
context handle. To allow the context to be gc-ed once it is not
reachable, the per-realm persistent handles are attached to the
context's global object and the persistent handles are set as weak.

PR-URL: #46809
Refs: #42528
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
@anonrig anonrig mentioned this pull request Mar 31, 2023
url: use ada::url_aggregator for parsing urls #47339
Merged
@joyeecheung joyeecheung mentioned this pull request Apr 1, 2023
memory leak in shadow realms #47353
Closed
This was referenced Apr 3, 2023
2023-04-18, Version 20.0.0 (Current) #47381
Merged
v19.9.0 proposal #47441
Merged
@richardlau richardlau mentioned this pull request Apr 7, 2023
[v19.x] deps: V8: cherry-pick f09dde9fbb54 #47239
Closed
@RafaelGSS RafaelGSS added the backport-requested-v19.x label Apr 7, 2023
This was referenced Apr 7, 2023
test: move test-shadow-realm-gc.js to known_issues #47355
Merged
src: bootstrap prepare stack trace callback in shadow realm #47107
Merged
bootstrap: store internal loaders in C++ via a binding #47215
Closed
@RafaelGSS

RafaelGSS commented Apr 7, 2023

Copy link
Copy Markdown
Member

This is breaking v19.x-staging. Could you please create a manual backport? See: #47441 (comment)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

legendecas added a commit to legendecas/node that referenced this pull request Apr 12, 2023
@legendecas
lib: distinguish webidl interfaces with the extended property "Exposed"
f4fb8da
PR-URL: nodejs#46809
Refs: nodejs#42528
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
legendecas added a commit to legendecas/node that referenced this pull request Apr 12, 2023
@legendecas
src: bootstrap Web [Exposed=*] APIs in the shadow realm
57956d6
This is the initial work to bootstrap Web interfaces that are defined
with extended attributes `[Exposed=*]`.

The ShadowRealm instances are garbage-collected once it is
unreachable. However, V8 can not infer the reference cycles between
the per-realm strong persistent function handles and the realm's
context handle. To allow the context to be gc-ed once it is not
reachable, the per-realm persistent handles are attached to the
context's global object and the persistent handles are set as weak.

PR-URL: nodejs#46809
Refs: nodejs#42528
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
@legendecas legendecas mentioned this pull request Apr 12, 2023
[v19.x] src: bootstrap Web [Exposed=*] APIs in the shadow realm #47530
Closed
@danielleadams danielleadams added the backport-requested-v18.x label Jun 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@cjihrig cjihrig cjihrig approved these changes
@mcollina mcollina mcollina approved these changes
@jasnell jasnell jasnell approved these changes
@joyeecheung joyeecheung joyeecheung approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

lib / src Issues and PRs involving general changes in the lib/ or src/ directories. needs-ci PRs that need a full CI run. realm Issues and PRs related to the ShadowRealm API and node::Realm.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

9 participants

@legendecas @nodejs-github-bot @mcollina @RafaelGSS @jasnell @cjihrig @joyeecheung @danielleadams @aduh95
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.