Skip to content

refactor: avoid deprecated v8::Context::GetIsolate() calls (pt 1) #47760

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

ckerr
Copy link
Member

@ckerr ckerr commented Jul 15, 2025

Description of Change

Part 1 of a very short series to remove calls to v8::Context::GetIsolate() which is being deprecated.

Even though the individual changes are pretty straightforward, the overall diff is pretty heavy due to the number of places where we are using that method. So I'm breaking into a couple of smaller PRs to make review easier.

This PR:

  1. Stops using GetIsolate() in NodeBindings::CreateEnvironment() by adding a v8::Isolate* arg to that method.
  2. Stops using GetIsolate() in the Node.js module Initialize() methods by using v8::Isolate::GetCurrent() instead.

Checklist

Release Notes

Notes: none.

@ckerr ckerr added semver/patch backwards-compatible bug fixes target/38-x-y PR should also be added to the "38-x-y" branch. labels Jul 15, 2025
@electron-cation electron-cation bot added the new-pr 🌱 PR opened recently label Jul 15, 2025
@@ -1856,8 +1856,8 @@ void Initialize(v8::Local<v8::Object> exports,
v8::Local<v8::Value> unused,
v8::Local<v8::Context> context,
void* priv) {
v8::Isolate* isolate = context->GetIsolate();
gin_helper::Dictionary dict(isolate, exports);
v8::Isolate* const isolate = v8::Isolate::GetCurrent();
Copy link
Member

Choose a reason for hiding this comment

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

For browser layer usages it would be better to replace with JavascriptEnvironment::GetIsolate

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed in 4c442a4

Copy link
Member

Choose a reason for hiding this comment

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

Thanks! can you also adopt it for other shell/browser files that have been touched in this PR.

@electron-cation electron-cation bot removed the new-pr 🌱 PR opened recently label Jul 16, 2025
@ckerr ckerr force-pushed the refactor/avoid-deprecated-v8-Context-GetIsolate-pt-1 branch from 7c9ee3f to ba655bc Compare July 18, 2025 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver/patch backwards-compatible bug fixes target/38-x-y PR should also be added to the "38-x-y" branch.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy