refactor: avoid deprecated v8::Context::GetIsolate() calls pt 3 context get isolate pt 3 (#47910)

* refactor: add a v8::Isolate* arg to RendererClientBase::IsWebViewFrame()

Needed for creating gin dictionaries

refactor: add a v8::Isolate* arg to ShouldLoadPreload()

Needed for calling IsWebViewFrame()

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* refactor: add a v8::Isolate* arg to electron::util::CompileAndCall()

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* refactor: add a v8::Isolate* arg to OnCreatePreloadableV8Context()

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* refactor: add a v8::Isolate* arg to InvokeEmitProcessEvent()

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* refactor: add a v8::Isolate* arg to ServiceWorkerData's constructor

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* refactor: add a v8::Isolate* arg to RendererClientBase::SetupMainWorldOverrides()

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* refactor: add a v8::Isolate* arg to RendererClientBase::WilLReleaseScriptContext()

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* docs: update docs to avoid v8::Context::GetIsolate()

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* refactor: add a v8::Isolate* arg to ElectronSandboxedRendererClient::InitializeBindings()

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* refactor: avoid v8::Context::GetIsolate() call in PromiseBase::SettleScope::~SettleScope()

Co-authored-by: Charles Kerr <charles@charleskerr.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
This commit is contained in:
trop[bot] 2025-07-31 14:19:10 -05:00 committed by GitHub
commit f2d14ca29d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 73 additions and 55 deletions

View file

@ -98,7 +98,7 @@ void ElectronRendererClient::DidCreateScriptContext(
// Only load Node.js if we are a main frame or a devtools extension
// unless Node.js support has been explicitly enabled for subframes.
if (!ShouldLoadPreload(renderer_context, render_frame))
if (!ShouldLoadPreload(isolate, renderer_context, render_frame))
return;
injected_frames_.insert(render_frame);
@ -178,6 +178,7 @@ void ElectronRendererClient::DidCreateScriptContext(
}
void ElectronRendererClient::WillReleaseScriptContext(
v8::Isolate* const isolate,
v8::Local<v8::Context> context,
content::RenderFrame* render_frame) {
if (injected_frames_.erase(render_frame) == 0)
@ -189,7 +190,7 @@ void ElectronRendererClient::WillReleaseScriptContext(
if (iter == environments_.end())
return;
gin_helper::EmitEvent(env->isolate(), env->process_object(), "exit");
gin_helper::EmitEvent(isolate, env->process_object(), "exit");
// The main frame may be replaced.
if (env == node_bindings_->uv_env())