chore: disable JS impl when //extensions support is on (#19512)
This commit is contained in:
parent
a5f87cee6b
commit
c71cdce0b7
9 changed files with 50 additions and 9 deletions
|
@ -13,6 +13,7 @@
|
|||
#include "base/trace_event/trace_event.h"
|
||||
#include "content/public/renderer/render_frame.h"
|
||||
#include "content/public/renderer/render_view.h"
|
||||
#include "electron/buildflags/buildflags.h"
|
||||
#include "electron/shell/common/api/api.mojom.h"
|
||||
#include "ipc/ipc_message_macros.h"
|
||||
#include "native_mate/dictionary.h"
|
||||
|
@ -85,11 +86,13 @@ void AtomRenderFrameObserver::DidCreateScriptContext(
|
|||
renderer_client_->SetupMainWorldOverrides(context, render_frame_);
|
||||
}
|
||||
|
||||
#if !BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
||||
if (world_id >= World::ISOLATED_WORLD_EXTENSIONS &&
|
||||
world_id <= World::ISOLATED_WORLD_EXTENSIONS_END) {
|
||||
renderer_client_->SetupExtensionWorldOverrides(context, render_frame_,
|
||||
world_id);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void AtomRenderFrameObserver::DraggableRegionsChanged() {
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include "base/command_line.h"
|
||||
#include "content/public/renderer/render_frame.h"
|
||||
#include "electron/buildflags/buildflags.h"
|
||||
#include "native_mate/dictionary.h"
|
||||
#include "shell/common/api/electron_bindings.h"
|
||||
#include "shell/common/api/event_emitter_caller.h"
|
||||
|
@ -225,6 +226,9 @@ void AtomRendererClient::SetupExtensionWorldOverrides(
|
|||
v8::Handle<v8::Context> context,
|
||||
content::RenderFrame* render_frame,
|
||||
int world_id) {
|
||||
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
||||
NOTREACHED();
|
||||
#else
|
||||
auto* isolate = context->GetIsolate();
|
||||
|
||||
std::vector<v8::Local<v8::String>> isolated_bundle_params = {
|
||||
|
@ -244,6 +248,7 @@ void AtomRendererClient::SetupExtensionWorldOverrides(
|
|||
node::native_module::NativeModuleEnv::CompileAndCall(
|
||||
context, "electron/js2c/content_script_bundle", &isolated_bundle_params,
|
||||
&isolated_bundle_args, nullptr);
|
||||
#endif
|
||||
}
|
||||
|
||||
node::Environment* AtomRendererClient::GetEnvironment(
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "base/path_service.h"
|
||||
#include "base/process/process_handle.h"
|
||||
#include "content/public/renderer/render_frame.h"
|
||||
#include "electron/buildflags/buildflags.h"
|
||||
#include "gin/converter.h"
|
||||
#include "native_mate/dictionary.h"
|
||||
#include "shell/common/api/electron_bindings.h"
|
||||
|
@ -266,6 +267,9 @@ void AtomSandboxedRendererClient::SetupExtensionWorldOverrides(
|
|||
v8::Handle<v8::Context> context,
|
||||
content::RenderFrame* render_frame,
|
||||
int world_id) {
|
||||
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
||||
NOTREACHED();
|
||||
#else
|
||||
auto* isolate = context->GetIsolate();
|
||||
|
||||
mate::Dictionary process = mate::Dictionary::CreateEmpty(isolate);
|
||||
|
@ -284,6 +288,7 @@ void AtomSandboxedRendererClient::SetupExtensionWorldOverrides(
|
|||
node::native_module::NativeModuleEnv::CompileAndCall(
|
||||
context, "electron/js2c/content_script_bundle", &isolated_bundle_params,
|
||||
&isolated_bundle_args, nullptr);
|
||||
#endif
|
||||
}
|
||||
|
||||
void AtomSandboxedRendererClient::WillReleaseScriptContext(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue