mirror of
https://github.com/electron/electron.git
synced 2026-01-09 15:38:08 -05:00
refactor: avoid deprecated v8::Context::GetIsolate() calls pt 3 context get isolate pt 3 (#47901)
* 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() * refactor: add a v8::Isolate* arg to electron::util::CompileAndCall() * refactor: add a v8::Isolate* arg to OnCreatePreloadableV8Context() * refactor: add a v8::Isolate* arg to InvokeEmitProcessEvent() * refactor: add a v8::Isolate* arg to ServiceWorkerData's constructor * refactor: add a v8::Isolate* arg to RendererClientBase::SetupMainWorldOverrides() * refactor: add a v8::Isolate* arg to RendererClientBase::WilLReleaseScriptContext() * docs: update docs to avoid v8::Context::GetIsolate() * refactor: add a v8::Isolate* arg to ElectronSandboxedRendererClient::InitializeBindings() * refactor: avoid v8::Context::GetIsolate() call in PromiseBase::SettleScope::~SettleScope()
This commit is contained in:
@@ -196,6 +196,7 @@ void RendererClientBase::BindProcess(v8::Isolate* isolate,
|
||||
}
|
||||
|
||||
bool RendererClientBase::ShouldLoadPreload(
|
||||
v8::Isolate* const isolate,
|
||||
v8::Local<v8::Context> context,
|
||||
content::RenderFrame* render_frame) const {
|
||||
auto prefs = render_frame->GetBlinkPreferences();
|
||||
@@ -205,7 +206,7 @@ bool RendererClientBase::ShouldLoadPreload(
|
||||
bool allow_node_in_sub_frames = prefs.node_integration_in_sub_frames;
|
||||
|
||||
return (is_main_frame || is_devtools || allow_node_in_sub_frames) &&
|
||||
!IsWebViewFrame(context, render_frame);
|
||||
!IsWebViewFrame(isolate, context, render_frame);
|
||||
}
|
||||
|
||||
void RendererClientBase::RenderThreadStarted() {
|
||||
@@ -545,10 +546,9 @@ v8::Local<v8::Context> RendererClientBase::GetContext(
|
||||
}
|
||||
|
||||
bool RendererClientBase::IsWebViewFrame(
|
||||
v8::Isolate* const isolate,
|
||||
v8::Local<v8::Context> context,
|
||||
content::RenderFrame* render_frame) const {
|
||||
auto* isolate = context->GetIsolate();
|
||||
|
||||
if (render_frame->IsMainFrame())
|
||||
return false;
|
||||
|
||||
@@ -566,6 +566,7 @@ bool RendererClientBase::IsWebViewFrame(
|
||||
}
|
||||
|
||||
void RendererClientBase::SetupMainWorldOverrides(
|
||||
v8::Isolate* const isolate,
|
||||
v8::Local<v8::Context> context,
|
||||
content::RenderFrame* render_frame) {
|
||||
auto prefs = render_frame->GetBlinkPreferences();
|
||||
@@ -576,9 +577,8 @@ void RendererClientBase::SetupMainWorldOverrides(
|
||||
// Setup window overrides in the main world context
|
||||
// Wrap the bundle into a function that receives the isolatedApi as
|
||||
// an argument.
|
||||
auto* isolate = context->GetIsolate();
|
||||
v8::HandleScope handle_scope(isolate);
|
||||
v8::Context::Scope context_scope(context);
|
||||
v8::HandleScope handle_scope{isolate};
|
||||
v8::Context::Scope context_scope{context};
|
||||
|
||||
auto isolated_api = gin_helper::Dictionary::CreateEmpty(isolate);
|
||||
isolated_api.SetMethod("allowGuestViewElementDefinition",
|
||||
@@ -604,7 +604,7 @@ void RendererClientBase::SetupMainWorldOverrides(
|
||||
v8::LocalVector<v8::Value> isolated_bundle_args(isolate,
|
||||
{isolated_api.GetHandle()});
|
||||
|
||||
util::CompileAndCall(context, "electron/js2c/isolated_bundle",
|
||||
util::CompileAndCall(isolate, context, "electron/js2c/isolated_bundle",
|
||||
&isolated_bundle_params, &isolated_bundle_args);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user