зеркало из https://github.com/electron/electron.git
refactor: remove unused extension content script code (#27570)
This code was leftover from the old JS extensions implementation.
This commit is contained in:
Родитель
a5e9af330f
Коммит
20a71be849
|
@ -715,9 +715,6 @@ v8::Local<v8::Promise> ExecuteJavaScriptInIsolatedWorld(
|
|||
|
||||
auto& prefs = render_frame->GetBlinkPreferences();
|
||||
|
||||
// Debugging tip: if you see a crash stack trace beginning from this call,
|
||||
// then it is very likely that some exception happened when executing the
|
||||
// "content_script/init.js" script.
|
||||
render_frame->GetWebFrame()->RequestExecuteScriptInIsolatedWorld(
|
||||
world_id, &sources.front(), sources.size(), has_user_gesture,
|
||||
scriptExecutionType,
|
||||
|
|
|
@ -88,14 +88,6 @@ void ElectronRenderFrameObserver::DidInstallConditionalFeatures(
|
|||
if (!renderer_client_->IsWebViewFrame(context, render_frame_))
|
||||
renderer_client_->SetupMainWorldOverrides(context, render_frame_);
|
||||
}
|
||||
|
||||
#if !BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
||||
if (world_id >= WorldIDs::ISOLATED_WORLD_ID_EXTENSIONS &&
|
||||
world_id <= WorldIDs::ISOLATED_WORLD_ID_EXTENSIONS_END) {
|
||||
renderer_client_->SetupExtensionWorldOverrides(context, render_frame_,
|
||||
world_id);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void ElectronRenderFrameObserver::DraggableRegionsChanged() {
|
||||
|
|
|
@ -254,34 +254,6 @@ void ElectronRendererClient::SetupMainWorldOverrides(
|
|||
&isolated_bundle_params, &isolated_bundle_args, nullptr);
|
||||
}
|
||||
|
||||
void ElectronRendererClient::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 = {
|
||||
node::FIXED_ONE_BYTE_STRING(isolate, "nodeProcess"),
|
||||
node::FIXED_ONE_BYTE_STRING(isolate, "isolatedWorld"),
|
||||
node::FIXED_ONE_BYTE_STRING(isolate, "worldId")};
|
||||
|
||||
auto* env = GetEnvironment(render_frame);
|
||||
if (!env)
|
||||
return;
|
||||
|
||||
std::vector<v8::Local<v8::Value>> isolated_bundle_args = {
|
||||
env->process_object(),
|
||||
GetContext(render_frame->GetWebFrame(), isolate)->Global(),
|
||||
v8::Integer::New(isolate, world_id)};
|
||||
|
||||
util::CompileAndCall(context, "electron/js2c/content_script_bundle",
|
||||
&isolated_bundle_params, &isolated_bundle_args, nullptr);
|
||||
#endif
|
||||
}
|
||||
|
||||
node::Environment* ElectronRendererClient::GetEnvironment(
|
||||
content::RenderFrame* render_frame) const {
|
||||
if (injected_frames_.find(render_frame) == injected_frames_.end())
|
||||
|
|
|
@ -35,9 +35,6 @@ class ElectronRendererClient : public RendererClientBase {
|
|||
content::RenderFrame* render_frame) override;
|
||||
void SetupMainWorldOverrides(v8::Handle<v8::Context> context,
|
||||
content::RenderFrame* render_frame) override;
|
||||
void SetupExtensionWorldOverrides(v8::Handle<v8::Context> context,
|
||||
content::RenderFrame* render_frame,
|
||||
int world_id) override;
|
||||
|
||||
private:
|
||||
// content::ContentRendererClient:
|
||||
|
|
|
@ -263,33 +263,6 @@ void ElectronSandboxedRendererClient::SetupMainWorldOverrides(
|
|||
&isolated_bundle_params, &isolated_bundle_args, nullptr);
|
||||
}
|
||||
|
||||
void ElectronSandboxedRendererClient::SetupExtensionWorldOverrides(
|
||||
v8::Handle<v8::Context> context,
|
||||
content::RenderFrame* render_frame,
|
||||
int world_id) {
|
||||
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
||||
NOTREACHED();
|
||||
#else
|
||||
auto* isolate = context->GetIsolate();
|
||||
|
||||
gin_helper::Dictionary process = gin::Dictionary::CreateEmpty(isolate);
|
||||
process.SetMethod("_linkedBinding", GetBinding);
|
||||
|
||||
std::vector<v8::Local<v8::String>> isolated_bundle_params = {
|
||||
node::FIXED_ONE_BYTE_STRING(isolate, "nodeProcess"),
|
||||
node::FIXED_ONE_BYTE_STRING(isolate, "isolatedWorld"),
|
||||
node::FIXED_ONE_BYTE_STRING(isolate, "worldId")};
|
||||
|
||||
std::vector<v8::Local<v8::Value>> isolated_bundle_args = {
|
||||
process.GetHandle(),
|
||||
GetContext(render_frame->GetWebFrame(), isolate)->Global(),
|
||||
v8::Integer::New(isolate, world_id)};
|
||||
|
||||
util::CompileAndCall(context, "electron/js2c/content_script_bundle",
|
||||
&isolated_bundle_params, &isolated_bundle_args, nullptr);
|
||||
#endif
|
||||
}
|
||||
|
||||
void ElectronSandboxedRendererClient::WillReleaseScriptContext(
|
||||
v8::Handle<v8::Context> context,
|
||||
content::RenderFrame* render_frame) {
|
||||
|
|
|
@ -29,9 +29,6 @@ class ElectronSandboxedRendererClient : public RendererClientBase {
|
|||
content::RenderFrame* render_frame) override;
|
||||
void SetupMainWorldOverrides(v8::Handle<v8::Context> context,
|
||||
content::RenderFrame* render_frame) override;
|
||||
void SetupExtensionWorldOverrides(v8::Handle<v8::Context> context,
|
||||
content::RenderFrame* render_frame,
|
||||
int world_id) override;
|
||||
// content::ContentRendererClient:
|
||||
void RenderFrameCreated(content::RenderFrame*) override;
|
||||
void RenderViewCreated(content::RenderView*) override;
|
||||
|
|
|
@ -73,9 +73,6 @@ class RendererClientBase : public content::ContentRendererClient
|
|||
virtual void DidClearWindowObject(content::RenderFrame* render_frame);
|
||||
virtual void SetupMainWorldOverrides(v8::Handle<v8::Context> context,
|
||||
content::RenderFrame* render_frame) = 0;
|
||||
virtual void SetupExtensionWorldOverrides(v8::Handle<v8::Context> context,
|
||||
content::RenderFrame* render_frame,
|
||||
int world_id) = 0;
|
||||
|
||||
std::unique_ptr<blink::WebPrescientNetworking> CreatePrescientNetworking(
|
||||
content::RenderFrame* render_frame) override;
|
||||
|
|
Загрузка…
Ссылка в новой задаче