refactor: avoid deprecated v8::Context::GetIsolate()
calls (pt 1) (#47843)
* refactor: avoid redundant GetIsolate() calls in NodeBindings::CreateEnvironment() Xref: https://chromium-review.googlesource.com/c/v8/v8/+/6563615 Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: use v8::Isolate::GetCurrent() in Initialize() methods Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: add v8::Isolate* arg to NodeBindings::CreateEnvironment() Co-authored-by: Charles Kerr <charles@charleskerr.com> * fixup! refactor: use v8::Isolate::GetCurrent() in Initialize() methods Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: add v8::Isolate* arg to RendererClientBase::DidCreateScriptContext() Co-authored-by: Charles Kerr <charles@charleskerr.com> * fixup! refactor: add v8::Isolate* arg to NodeBindings::CreateEnvironment() Co-authored-by: Charles Kerr <charles@charleskerr.com> * fixup! fixup! refactor: use v8::Isolate::GetCurrent() in Initialize() methods refactor: prefer JavascriptEnvironment::GetIsolate() in the browser layer 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:
parent
673ec5d39e
commit
d426b92326
61 changed files with 136 additions and 110 deletions
|
@ -90,6 +90,7 @@ void ElectronRendererClient::UndeferLoad(content::RenderFrame* render_frame) {
|
|||
}
|
||||
|
||||
void ElectronRendererClient::DidCreateScriptContext(
|
||||
v8::Isolate* const isolate,
|
||||
v8::Local<v8::Context> renderer_context,
|
||||
content::RenderFrame* render_frame) {
|
||||
// TODO(zcbenz): Do not create Node environment if node integration is not
|
||||
|
@ -126,7 +127,7 @@ void ElectronRendererClient::DidCreateScriptContext(
|
|||
blink::LoaderFreezeMode::kStrict);
|
||||
|
||||
std::shared_ptr<node::Environment> env = node_bindings_->CreateEnvironment(
|
||||
renderer_context, nullptr, 0,
|
||||
isolate, renderer_context, nullptr, 0,
|
||||
base::BindRepeating(&ElectronRendererClient::UndeferLoad,
|
||||
base::Unretained(this), render_frame));
|
||||
|
||||
|
@ -134,7 +135,6 @@ void ElectronRendererClient::DidCreateScriptContext(
|
|||
// Node.js deletes the global fetch function when their fetch implementation
|
||||
// is disabled, so we need to save and re-add it after the Node.js environment
|
||||
// is loaded. See corresponding change in node/init.ts.
|
||||
v8::Isolate* isolate = env->isolate();
|
||||
v8::Local<v8::Object> global = renderer_context->Global();
|
||||
|
||||
std::vector<std::string> keys = {"fetch", "Response", "FormData",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue