diff --git a/atom/app/node_main.cc b/atom/app/node_main.cc index 4c7527ed3415..9f3e1c8f9a03 100644 --- a/atom/app/node_main.cc +++ b/atom/app/node_main.cc @@ -10,7 +10,7 @@ #include "atom/app/uv_task_runner.h" #include "atom/browser/javascript_environment.h" #include "atom/browser/node_debugger.h" -#include "atom/common/api/atom_bindings.h" +#include "atom/common/api/electron_bindings.h" #include "atom/common/atom_version.h" #include "atom/common/crash_reporter/crash_reporter.h" #include "atom/common/native_mate_converters/string16_converter.h" @@ -70,9 +70,9 @@ int NodeMain(int argc, char* argv[]) { mate::Dictionary process(gin_env.isolate(), env->process_object()); #if defined(OS_WIN) - process.SetMethod("log", &AtomBindings::Log); + process.SetMethod("log", &ElectronBindings::Log); #endif - process.SetMethod("crash", &AtomBindings::Crash); + process.SetMethod("crash", &ElectronBindings::Crash); // Setup process.crashReporter.start in child node processes auto reporter = mate::Dictionary::CreateEmpty(gin_env.isolate()); diff --git a/atom/browser/atom_browser_main_parts.cc b/atom/browser/atom_browser_main_parts.cc index c6064a6d594b..7a618d5040fe 100644 --- a/atom/browser/atom_browser_main_parts.cc +++ b/atom/browser/atom_browser_main_parts.cc @@ -23,7 +23,7 @@ #include "atom/browser/media/media_capture_devices_dispatcher.h" #include "atom/browser/node_debugger.h" #include "atom/browser/ui/devtools_manager_delegate.h" -#include "atom/common/api/atom_bindings.h" +#include "atom/common/api/electron_bindings.h" #include "atom/common/application_info.h" #include "atom/common/asar/asar_util.h" #include "atom/common/node_bindings.h" @@ -234,7 +234,7 @@ AtomBrowserMainParts::AtomBrowserMainParts( : fake_browser_process_(new BrowserProcessImpl), browser_(new Browser), node_bindings_(NodeBindings::Create(NodeBindings::BROWSER)), - atom_bindings_(new AtomBindings(uv_default_loop())), + electron_bindings_(new ElectronBindings(uv_default_loop())), main_function_params_(params) { DCHECK(!self_) << "Cannot have two AtomBrowserMainParts"; self_ = this; @@ -323,7 +323,7 @@ void AtomBrowserMainParts::PostEarlyInitialization() { node_debugger_->Start(); // Add Electron extended APIs. - atom_bindings_->BindTo(js_env_->isolate(), env->process_object()); + electron_bindings_->BindTo(js_env_->isolate(), env->process_object()); // Load everything. node_bindings_->LoadEnvironment(env); diff --git a/atom/browser/atom_browser_main_parts.h b/atom/browser/atom_browser_main_parts.h index 98ab743020d8..8acf2da8152e 100644 --- a/atom/browser/atom_browser_main_parts.h +++ b/atom/browser/atom_browser_main_parts.h @@ -29,7 +29,7 @@ class WMState; namespace atom { -class AtomBindings; +class ElectronBindings; class Browser; class JavascriptEnvironment; class NodeBindings; @@ -123,7 +123,7 @@ class AtomBrowserMainParts : public content::BrowserMainParts { std::unique_ptr browser_; std::unique_ptr js_env_; std::unique_ptr node_bindings_; - std::unique_ptr atom_bindings_; + std::unique_ptr electron_bindings_; std::unique_ptr node_env_; std::unique_ptr node_debugger_; std::unique_ptr icon_manager_; diff --git a/atom/common/api/atom_bindings.cc b/atom/common/api/electron_bindings.cc similarity index 84% rename from atom/common/api/atom_bindings.cc rename to atom/common/api/electron_bindings.cc index 778e1e4d47c2..d6debde88a40 100644 --- a/atom/common/api/atom_bindings.cc +++ b/atom/common/api/electron_bindings.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by the MIT license that can be // found in the LICENSE file. -#include "atom/common/api/atom_bindings.h" +#include "atom/common/api/electron_bindings.h" #include #include @@ -43,25 +43,25 @@ struct DummyClass { // we can get the stack trace. void FatalErrorCallback(const char* location, const char* message) { LOG(ERROR) << "Fatal error in V8: " << location << " " << message; - AtomBindings::Crash(); + ElectronBindings::Crash(); } } // namespace -AtomBindings::AtomBindings(uv_loop_t* loop) { +ElectronBindings::ElectronBindings(uv_loop_t* loop) { uv_async_init(loop, &call_next_tick_async_, OnCallNextTick); call_next_tick_async_.data = this; metrics_ = base::ProcessMetrics::CreateCurrentProcessMetrics(); } -AtomBindings::~AtomBindings() { +ElectronBindings::~ElectronBindings() { uv_close(reinterpret_cast(&call_next_tick_async_), nullptr); } // static -void AtomBindings::BindProcess(v8::Isolate* isolate, - mate::Dictionary* process, - base::ProcessMetrics* metrics) { +void ElectronBindings::BindProcess(v8::Isolate* isolate, + mate::Dictionary* process, + base::ProcessMetrics* metrics) { // These bindings are shared between sandboxed & unsandboxed renderers process->SetMethod("crash", &Crash); process->SetMethod("hang", &Hang); @@ -73,7 +73,7 @@ void AtomBindings::BindProcess(v8::Isolate* isolate, process->SetMethod("getSystemVersion", &base::SysInfo::OperatingSystemVersion); process->SetMethod("getIOCounters", &GetIOCounters); - process->SetMethod("getCPUUsage", base::Bind(&AtomBindings::GetCPUUsage, + process->SetMethod("getCPUUsage", base::Bind(&ElectronBindings::GetCPUUsage, base::Unretained(metrics))); #if defined(MAS_BUILD) @@ -86,7 +86,8 @@ void AtomBindings::BindProcess(v8::Isolate* isolate, #endif } -void AtomBindings::BindTo(v8::Isolate* isolate, v8::Local process) { +void ElectronBindings::BindTo(v8::Isolate* isolate, + v8::Local process) { isolate->SetFatalErrorHandler(FatalErrorCallback); mate::Dictionary dict(isolate, process); @@ -96,7 +97,7 @@ void AtomBindings::BindTo(v8::Isolate* isolate, v8::Local process) { #if defined(OS_POSIX) dict.SetMethod("setFdLimit", &base::IncreaseFdLimitTo); #endif - dict.SetMethod("activateUvLoop", base::Bind(&AtomBindings::ActivateUVLoop, + dict.SetMethod("activateUvLoop", base::Bind(&ElectronBindings::ActivateUVLoop, base::Unretained(this))); mate::Dictionary versions; @@ -106,14 +107,14 @@ void AtomBindings::BindTo(v8::Isolate* isolate, v8::Local process) { } } -void AtomBindings::EnvironmentDestroyed(node::Environment* env) { +void ElectronBindings::EnvironmentDestroyed(node::Environment* env) { auto it = std::find(pending_next_ticks_.begin(), pending_next_ticks_.end(), env); if (it != pending_next_ticks_.end()) pending_next_ticks_.erase(it); } -void AtomBindings::ActivateUVLoop(v8::Isolate* isolate) { +void ElectronBindings::ActivateUVLoop(v8::Isolate* isolate) { node::Environment* env = node::Environment::GetCurrent(isolate); if (std::find(pending_next_ticks_.begin(), pending_next_ticks_.end(), env) != pending_next_ticks_.end()) @@ -124,8 +125,8 @@ void AtomBindings::ActivateUVLoop(v8::Isolate* isolate) { } // static -void AtomBindings::OnCallNextTick(uv_async_t* handle) { - AtomBindings* self = static_cast(handle->data); +void ElectronBindings::OnCallNextTick(uv_async_t* handle) { + ElectronBindings* self = static_cast(handle->data); for (std::list::const_iterator it = self->pending_next_ticks_.begin(); it != self->pending_next_ticks_.end(); ++it) { @@ -141,23 +142,23 @@ void AtomBindings::OnCallNextTick(uv_async_t* handle) { } // static -void AtomBindings::Log(const base::string16& message) { +void ElectronBindings::Log(const base::string16& message) { std::cout << message << std::flush; } // static -void AtomBindings::Crash() { +void ElectronBindings::Crash() { static_cast(nullptr)->crash = true; } // static -void AtomBindings::Hang() { +void ElectronBindings::Hang() { for (;;) base::PlatformThread::Sleep(base::TimeDelta::FromSeconds(1)); } // static -v8::Local AtomBindings::GetHeapStatistics(v8::Isolate* isolate) { +v8::Local ElectronBindings::GetHeapStatistics(v8::Isolate* isolate) { v8::HeapStatistics v8_heap_stats; isolate->GetHeapStatistics(&v8_heap_stats); @@ -187,7 +188,7 @@ v8::Local AtomBindings::GetHeapStatistics(v8::Isolate* isolate) { } // static -v8::Local AtomBindings::GetCreationTime(v8::Isolate* isolate) { +v8::Local ElectronBindings::GetCreationTime(v8::Isolate* isolate) { auto timeValue = base::Process::Current().CreationTime(); if (timeValue.is_null()) { return v8::Null(isolate); @@ -197,8 +198,9 @@ v8::Local AtomBindings::GetCreationTime(v8::Isolate* isolate) { } // static -v8::Local AtomBindings::GetSystemMemoryInfo(v8::Isolate* isolate, - mate::Arguments* args) { +v8::Local ElectronBindings::GetSystemMemoryInfo( + v8::Isolate* isolate, + mate::Arguments* args) { base::SystemMemoryInfoKB mem_info; if (!base::GetSystemMemoryInfo(&mem_info)) { args->ThrowError("Unable to retrieve system memory information"); @@ -228,7 +230,7 @@ v8::Local AtomBindings::GetSystemMemoryInfo(v8::Isolate* isolate, } // static -v8::Local AtomBindings::GetProcessMemoryInfo( +v8::Local ElectronBindings::GetProcessMemoryInfo( v8::Isolate* isolate) { util::Promise promise(isolate); v8::Local handle = promise.GetHandle(); @@ -243,13 +245,13 @@ v8::Local AtomBindings::GetProcessMemoryInfo( memory_instrumentation::MemoryInstrumentation::GetInstance() ->RequestGlobalDumpForPid( base::GetCurrentProcId(), std::vector(), - base::BindOnce(&AtomBindings::DidReceiveMemoryDump, + base::BindOnce(&ElectronBindings::DidReceiveMemoryDump, std::move(context), std::move(promise))); return handle; } // static -void AtomBindings::DidReceiveMemoryDump( +void ElectronBindings::DidReceiveMemoryDump( v8::Global context, util::Promise promise, bool success, @@ -290,8 +292,9 @@ void AtomBindings::DidReceiveMemoryDump( } // static -v8::Local AtomBindings::GetCPUUsage(base::ProcessMetrics* metrics, - v8::Isolate* isolate) { +v8::Local ElectronBindings::GetCPUUsage( + base::ProcessMetrics* metrics, + v8::Isolate* isolate) { mate::Dictionary dict = mate::Dictionary::CreateEmpty(isolate); dict.SetHidden("simple", true); int processor_count = base::SysInfo::NumberOfProcessors(); @@ -310,7 +313,7 @@ v8::Local AtomBindings::GetCPUUsage(base::ProcessMetrics* metrics, } // static -v8::Local AtomBindings::GetIOCounters(v8::Isolate* isolate) { +v8::Local ElectronBindings::GetIOCounters(v8::Isolate* isolate) { auto metrics = base::ProcessMetrics::CreateCurrentProcessMetrics(); base::IoCounters io_counters; mate::Dictionary dict = mate::Dictionary::CreateEmpty(isolate); @@ -329,8 +332,8 @@ v8::Local AtomBindings::GetIOCounters(v8::Isolate* isolate) { } // static -bool AtomBindings::TakeHeapSnapshot(v8::Isolate* isolate, - const base::FilePath& file_path) { +bool ElectronBindings::TakeHeapSnapshot(v8::Isolate* isolate, + const base::FilePath& file_path) { base::ThreadRestrictions::ScopedAllowIO allow_io; base::File file(file_path, diff --git a/atom/common/api/atom_bindings.h b/atom/common/api/electron_bindings.h similarity index 84% rename from atom/common/api/atom_bindings.h rename to atom/common/api/electron_bindings.h index 70b2382cd836..0c786dd79df3 100644 --- a/atom/common/api/atom_bindings.h +++ b/atom/common/api/electron_bindings.h @@ -2,8 +2,8 @@ // Use of this source code is governed by the MIT license that can be // found in the LICENSE file. -#ifndef ATOM_COMMON_API_ATOM_BINDINGS_H_ -#define ATOM_COMMON_API_ATOM_BINDINGS_H_ +#ifndef ATOM_COMMON_API_ELECTRON_BINDINGS_H_ +#define ATOM_COMMON_API_ELECTRON_BINDINGS_H_ #include #include @@ -32,13 +32,13 @@ class Environment; namespace atom { -class AtomBindings { +class ElectronBindings { public: - explicit AtomBindings(uv_loop_t* loop); - virtual ~AtomBindings(); + explicit ElectronBindings(uv_loop_t* loop); + virtual ~ElectronBindings(); - // Add process.atomBinding function, which behaves like process.binding but - // load native code from Electron instead. + // Add process.electronBinding function, which behaves like process.binding + // but load native code from Electron instead. void BindTo(v8::Isolate* isolate, v8::Local process); // Should be called when a node::Environment has been destroyed. @@ -78,9 +78,9 @@ class AtomBindings { std::list pending_next_ticks_; std::unique_ptr metrics_; - DISALLOW_COPY_AND_ASSIGN(AtomBindings); + DISALLOW_COPY_AND_ASSIGN(ElectronBindings); }; } // namespace atom -#endif // ATOM_COMMON_API_ATOM_BINDINGS_H_ +#endif // ATOM_COMMON_API_ELECTRON_BINDINGS_H_ diff --git a/atom/renderer/atom_renderer_client.cc b/atom/renderer/atom_renderer_client.cc index e0e5ac41914d..2495a9b48715 100644 --- a/atom/renderer/atom_renderer_client.cc +++ b/atom/renderer/atom_renderer_client.cc @@ -7,7 +7,7 @@ #include #include -#include "atom/common/api/atom_bindings.h" +#include "atom/common/api/electron_bindings.h" #include "atom/common/api/event_emitter_caller.h" #include "atom/common/asar/asar_util.h" #include "atom/common/node_bindings.h" @@ -35,7 +35,7 @@ bool IsDevToolsExtension(content::RenderFrame* render_frame) { AtomRendererClient::AtomRendererClient() : node_bindings_(NodeBindings::Create(NodeBindings::RENDERER)), - atom_bindings_(new AtomBindings(uv_default_loop())) {} + electron_bindings_(new ElectronBindings(uv_default_loop())) {} AtomRendererClient::~AtomRendererClient() { asar::ClearArchives(); @@ -114,7 +114,7 @@ void AtomRendererClient::DidCreateScriptContext( environments_.insert(env); // Add Electron extended APIs. - atom_bindings_->BindTo(env->isolate(), env->process_object()); + electron_bindings_->BindTo(env->isolate(), env->process_object()); AddRenderBindings(env->isolate(), env->process_object()); mate::Dictionary process_dict(env->isolate(), env->process_object()); process_dict.SetReadOnly("isMainFrame", render_frame->IsMainFrame()); @@ -157,8 +157,8 @@ void AtomRendererClient::WillReleaseScriptContext( switches::kNodeIntegrationInSubFrames)) node::FreeEnvironment(env); - // AtomBindings is tracking node environments. - atom_bindings_->EnvironmentDestroyed(env); + // ElectronBindings is tracking node environments. + electron_bindings_->EnvironmentDestroyed(env); } bool AtomRendererClient::ShouldFork(blink::WebLocalFrame* frame, diff --git a/atom/renderer/atom_renderer_client.h b/atom/renderer/atom_renderer_client.h index 23d426f18406..181f26935d3a 100644 --- a/atom/renderer/atom_renderer_client.h +++ b/atom/renderer/atom_renderer_client.h @@ -18,7 +18,7 @@ class Environment; namespace atom { -class AtomBindings; +class ElectronBindings; class NodeBindings; class AtomRendererClient : public RendererClientBase { @@ -60,7 +60,7 @@ class AtomRendererClient : public RendererClientBase { bool node_integration_initialized_ = false; std::unique_ptr node_bindings_; - std::unique_ptr atom_bindings_; + std::unique_ptr electron_bindings_; // The node::Environment::GetCurrent API does not return nullptr when it // is called for a context without node::Environment, so we have to keep diff --git a/atom/renderer/atom_sandboxed_renderer_client.cc b/atom/renderer/atom_sandboxed_renderer_client.cc index 272c7352df61..a64102d1772a 100644 --- a/atom/renderer/atom_sandboxed_renderer_client.cc +++ b/atom/renderer/atom_sandboxed_renderer_client.cc @@ -5,7 +5,7 @@ #include "atom/renderer/atom_sandboxed_renderer_client.h" #include "atom/common/api/api_messages.h" -#include "atom/common/api/atom_bindings.h" +#include "atom/common/api/electron_bindings.h" #include "atom/common/application_info.h" #include "atom/common/native_mate_converters/string16_converter.h" #include "atom/common/native_mate_converters/value_converter.h" @@ -149,7 +149,7 @@ void AtomSandboxedRendererClient::InitializeBindings( mate::Dictionary process = mate::Dictionary::CreateEmpty(isolate); b.Set("process", process); - AtomBindings::BindProcess(isolate, &process, metrics_.get()); + ElectronBindings::BindProcess(isolate, &process, metrics_.get()); process.Set("argv", base::CommandLine::ForCurrentProcess()->argv()); process.SetReadOnly("pid", base::GetCurrentProcId()); diff --git a/atom/renderer/web_worker_observer.cc b/atom/renderer/web_worker_observer.cc index 4e7a8a33f1a6..37fca76a36a1 100644 --- a/atom/renderer/web_worker_observer.cc +++ b/atom/renderer/web_worker_observer.cc @@ -4,7 +4,7 @@ #include "atom/renderer/web_worker_observer.h" -#include "atom/common/api/atom_bindings.h" +#include "atom/common/api/electron_bindings.h" #include "atom/common/api/event_emitter_caller.h" #include "atom/common/asar/asar_util.h" #include "atom/common/node_bindings.h" @@ -30,7 +30,7 @@ WebWorkerObserver* WebWorkerObserver::GetCurrent() { WebWorkerObserver::WebWorkerObserver() : node_bindings_(NodeBindings::Create(NodeBindings::WORKER)), - atom_bindings_(new AtomBindings(node_bindings_->uv_loop())) { + electron_bindings_(new ElectronBindings(node_bindings_->uv_loop())) { lazy_tls.Pointer()->Set(this); } @@ -50,7 +50,7 @@ void WebWorkerObserver::ContextCreated(v8::Local context) { node::Environment* env = node_bindings_->CreateEnvironment(context); // Add Electron extended APIs. - atom_bindings_->BindTo(env->isolate(), env->process_object()); + electron_bindings_->BindTo(env->isolate(), env->process_object()); // Load everything. node_bindings_->LoadEnvironment(env); diff --git a/atom/renderer/web_worker_observer.h b/atom/renderer/web_worker_observer.h index 3b83a46e2ae3..c33a2fdbafe1 100644 --- a/atom/renderer/web_worker_observer.h +++ b/atom/renderer/web_worker_observer.h @@ -12,7 +12,7 @@ namespace atom { -class AtomBindings; +class ElectronBindings; class NodeBindings; // Watches for WebWorker and insert node integration to it. @@ -29,7 +29,7 @@ class WebWorkerObserver { ~WebWorkerObserver(); std::unique_ptr node_bindings_; - std::unique_ptr atom_bindings_; + std::unique_ptr electron_bindings_; DISALLOW_COPY_AND_ASSIGN(WebWorkerObserver); }; diff --git a/filenames.gni b/filenames.gni index 71b26d3f8721..0ff0374a0524 100644 --- a/filenames.gni +++ b/filenames.gni @@ -541,8 +541,8 @@ filenames = { "atom/common/api/atom_api_native_image_mac.mm", "atom/common/api/atom_api_shell.cc", "atom/common/api/atom_api_v8_util.cc", - "atom/common/api/atom_bindings.cc", - "atom/common/api/atom_bindings.h", + "atom/common/api/electron_bindings.cc", + "atom/common/api/electron_bindings.h", "atom/common/api/constructor.h", "atom/common/api/event_emitter_caller.cc", "atom/common/api/event_emitter_caller.h", diff --git a/lib/browser/api/app.ts b/lib/browser/api/app.ts index 2069bf893948..687420e37fdc 100644 --- a/lib/browser/api/app.ts +++ b/lib/browser/api/app.ts @@ -3,8 +3,8 @@ import * as path from 'path' import * as electron from 'electron' import { EventEmitter } from 'events' -const bindings = process.atomBinding('app') -const commandLine = process.atomBinding('command_line') +const bindings = process.electronBinding('app') +const commandLine = process.electronBinding('command_line') const { app, App } = bindings // Only one app object permitted. @@ -64,5 +64,5 @@ for (const name of events) { } // Wrappers for native classes. -const { DownloadItem } = process.atomBinding('download_item') +const { DownloadItem } = process.electronBinding('download_item') Object.setPrototypeOf(DownloadItem.prototype, EventEmitter.prototype) diff --git a/lib/browser/api/auto-updater/auto-updater-native.js b/lib/browser/api/auto-updater/auto-updater-native.js index d15a3c2e4a48..666cd758c887 100644 --- a/lib/browser/api/auto-updater/auto-updater-native.js +++ b/lib/browser/api/auto-updater/auto-updater-native.js @@ -1,7 +1,7 @@ 'use strict' const EventEmitter = require('events').EventEmitter -const { autoUpdater, AutoUpdater } = process.atomBinding('auto_updater') +const { autoUpdater, AutoUpdater } = process.electronBinding('auto_updater') // AutoUpdater is an EventEmitter. Object.setPrototypeOf(AutoUpdater.prototype, EventEmitter.prototype) diff --git a/lib/browser/api/browser-view.js b/lib/browser/api/browser-view.js index 0779f5f4e3f6..5471b6359313 100644 --- a/lib/browser/api/browser-view.js +++ b/lib/browser/api/browser-view.js @@ -1,7 +1,7 @@ 'use strict' const { EventEmitter } = require('events') -const { BrowserView } = process.atomBinding('browser_view') +const { BrowserView } = process.electronBinding('browser_view') Object.setPrototypeOf(BrowserView.prototype, EventEmitter.prototype) diff --git a/lib/browser/api/browser-window.js b/lib/browser/api/browser-window.js index d58827ed4602..56e2b50b2f21 100644 --- a/lib/browser/api/browser-window.js +++ b/lib/browser/api/browser-window.js @@ -2,7 +2,7 @@ const electron = require('electron') const { WebContentsView, TopLevelWindow } = electron -const { BrowserWindow } = process.atomBinding('window') +const { BrowserWindow } = process.electronBinding('window') Object.setPrototypeOf(BrowserWindow.prototype, TopLevelWindow.prototype) diff --git a/lib/browser/api/content-tracing.js b/lib/browser/api/content-tracing.js index c915ec346336..8b69735556b4 100644 --- a/lib/browser/api/content-tracing.js +++ b/lib/browser/api/content-tracing.js @@ -1,6 +1,6 @@ 'use strict' const { deprecate } = require('electron') -const contentTracing = process.atomBinding('content_tracing') +const contentTracing = process.electronBinding('content_tracing') contentTracing.getCategories = deprecate.promisify(contentTracing.getCategories) contentTracing.startRecording = deprecate.promisify(contentTracing.startRecording) diff --git a/lib/browser/api/dialog.js b/lib/browser/api/dialog.js index c9f713a28736..79d54813127c 100644 --- a/lib/browser/api/dialog.js +++ b/lib/browser/api/dialog.js @@ -1,8 +1,8 @@ 'use strict' const { app, BrowserWindow, deprecate } = require('electron') -const binding = process.atomBinding('dialog') -const v8Util = process.atomBinding('v8_util') +const binding = process.electronBinding('dialog') +const v8Util = process.electronBinding('v8_util') const fileDialogProperties = { openFile: 1 << 0, diff --git a/lib/browser/api/global-shortcut.js b/lib/browser/api/global-shortcut.js index ec9878ee43e2..f1c6e21a3402 100644 --- a/lib/browser/api/global-shortcut.js +++ b/lib/browser/api/global-shortcut.js @@ -1,3 +1,3 @@ 'use strict' -module.exports = process.atomBinding('global_shortcut').globalShortcut +module.exports = process.electronBinding('global_shortcut').globalShortcut diff --git a/lib/browser/api/in-app-purchase.js b/lib/browser/api/in-app-purchase.js index 6cbecfd21a3d..634cca29f271 100644 --- a/lib/browser/api/in-app-purchase.js +++ b/lib/browser/api/in-app-purchase.js @@ -4,7 +4,7 @@ const { deprecate } = require('electron') if (process.platform === 'darwin') { const { EventEmitter } = require('events') - const { inAppPurchase, InAppPurchase } = process.atomBinding('in_app_purchase') + const { inAppPurchase, InAppPurchase } = process.electronBinding('in_app_purchase') // inAppPurchase is an EventEmitter. Object.setPrototypeOf(InAppPurchase.prototype, EventEmitter.prototype) diff --git a/lib/browser/api/menu.js b/lib/browser/api/menu.js index e8c1a7fdf15d..a091e3314001 100644 --- a/lib/browser/api/menu.js +++ b/lib/browser/api/menu.js @@ -3,8 +3,8 @@ const { TopLevelWindow, MenuItem, webContents } = require('electron') const { sortMenuItems } = require('@electron/internal/browser/api/menu-utils') const EventEmitter = require('events').EventEmitter -const v8Util = process.atomBinding('v8_util') -const bindings = process.atomBinding('menu') +const v8Util = process.electronBinding('v8_util') +const bindings = process.electronBinding('menu') const { Menu } = bindings let applicationMenu = null diff --git a/lib/browser/api/module-list.js b/lib/browser/api/module-list.js index 85471663f128..43fa1fb1943e 100644 --- a/lib/browser/api/module-list.js +++ b/lib/browser/api/module-list.js @@ -1,6 +1,6 @@ 'use strict' -const features = process.atomBinding('features') +const features = process.electronBinding('features') // Browser side modules, please sort alphabetically. module.exports = [ diff --git a/lib/browser/api/net.js b/lib/browser/api/net.js index 0d8cb71653d0..beb3e4f75550 100644 --- a/lib/browser/api/net.js +++ b/lib/browser/api/net.js @@ -4,8 +4,8 @@ const url = require('url') const { EventEmitter } = require('events') const { Readable } = require('stream') const { app } = require('electron') -const { Session } = process.atomBinding('session') -const { net, Net } = process.atomBinding('net') +const { Session } = process.electronBinding('session') +const { net, Net } = process.electronBinding('net') const { URLRequest } = net // Net is an EventEmitter. diff --git a/lib/browser/api/notification.js b/lib/browser/api/notification.js index cc2374c11c77..b835278b0bfa 100644 --- a/lib/browser/api/notification.js +++ b/lib/browser/api/notification.js @@ -1,7 +1,7 @@ 'use strict' const { EventEmitter } = require('events') -const { Notification, isSupported } = process.atomBinding('notification') +const { Notification, isSupported } = process.electronBinding('notification') Object.setPrototypeOf(Notification.prototype, EventEmitter.prototype) diff --git a/lib/browser/api/power-monitor.js b/lib/browser/api/power-monitor.js index c6700a12b9d3..a7e9cbcb8fe1 100644 --- a/lib/browser/api/power-monitor.js +++ b/lib/browser/api/power-monitor.js @@ -1,7 +1,7 @@ 'use strict' const { EventEmitter } = require('events') -const { powerMonitor, PowerMonitor } = process.atomBinding('power_monitor') +const { powerMonitor, PowerMonitor } = process.electronBinding('power_monitor') const { deprecate } = require('electron') // PowerMonitor is an EventEmitter. diff --git a/lib/browser/api/power-save-blocker.js b/lib/browser/api/power-save-blocker.js index 964ead8a261d..010b934c1101 100644 --- a/lib/browser/api/power-save-blocker.js +++ b/lib/browser/api/power-save-blocker.js @@ -1,3 +1,3 @@ 'use strict' -module.exports = process.atomBinding('power_save_blocker').powerSaveBlocker +module.exports = process.electronBinding('power_save_blocker').powerSaveBlocker diff --git a/lib/browser/api/protocol.ts b/lib/browser/api/protocol.ts index 8045cd3f73fb..18387d172f47 100644 --- a/lib/browser/api/protocol.ts +++ b/lib/browser/api/protocol.ts @@ -1,7 +1,7 @@ import { app, session } from 'electron' // Global protocol APIs. -const protocol = process.atomBinding('protocol') +const protocol = process.electronBinding('protocol') // Fallback protocol APIs of default session. Object.setPrototypeOf(protocol, new Proxy({}, { diff --git a/lib/browser/api/screen.js b/lib/browser/api/screen.js index a91df7dda273..ff21caef150a 100644 --- a/lib/browser/api/screen.js +++ b/lib/browser/api/screen.js @@ -1,7 +1,7 @@ 'use strict' const { EventEmitter } = require('events') -const { screen, Screen } = process.atomBinding('screen') +const { screen, Screen } = process.electronBinding('screen') // Screen is an EventEmitter. Object.setPrototypeOf(Screen.prototype, EventEmitter.prototype) diff --git a/lib/browser/api/session.js b/lib/browser/api/session.js index a09ed0c6b092..b0a766d537f8 100644 --- a/lib/browser/api/session.js +++ b/lib/browser/api/session.js @@ -2,7 +2,7 @@ const { EventEmitter } = require('events') const { app, deprecate } = require('electron') -const { fromPartition, Session, Cookies, NetLog, Protocol } = process.atomBinding('session') +const { fromPartition, Session, Cookies, NetLog, Protocol } = process.electronBinding('session') // Public API. Object.defineProperties(exports, { diff --git a/lib/browser/api/system-preferences.js b/lib/browser/api/system-preferences.js index bb663e886fd3..290d73c92c6d 100644 --- a/lib/browser/api/system-preferences.js +++ b/lib/browser/api/system-preferences.js @@ -1,7 +1,7 @@ 'use strict' const { EventEmitter } = require('events') -const { systemPreferences, SystemPreferences } = process.atomBinding('system_preferences') +const { systemPreferences, SystemPreferences } = process.electronBinding('system_preferences') // SystemPreferences is an EventEmitter. Object.setPrototypeOf(SystemPreferences.prototype, EventEmitter.prototype) diff --git a/lib/browser/api/top-level-window.js b/lib/browser/api/top-level-window.js index c7770ad27c5f..36b0453319d6 100644 --- a/lib/browser/api/top-level-window.js +++ b/lib/browser/api/top-level-window.js @@ -2,7 +2,7 @@ const electron = require('electron') const { EventEmitter } = require('events') -const { TopLevelWindow } = process.atomBinding('top_level_window') +const { TopLevelWindow } = process.electronBinding('top_level_window') Object.setPrototypeOf(TopLevelWindow.prototype, EventEmitter.prototype) diff --git a/lib/browser/api/tray.js b/lib/browser/api/tray.js index 1c6c108ec67b..e86ace77aeae 100644 --- a/lib/browser/api/tray.js +++ b/lib/browser/api/tray.js @@ -1,7 +1,7 @@ 'use strict' const { EventEmitter } = require('events') -const { Tray } = process.atomBinding('tray') +const { Tray } = process.electronBinding('tray') Object.setPrototypeOf(Tray.prototype, EventEmitter.prototype) diff --git a/lib/browser/api/view.js b/lib/browser/api/view.js index cf39f8bb86e4..578a2306a185 100644 --- a/lib/browser/api/view.js +++ b/lib/browser/api/view.js @@ -1,7 +1,7 @@ 'use strict' const { EventEmitter } = require('events') -const { View } = process.atomBinding('view') +const { View } = process.electronBinding('view') Object.setPrototypeOf(View.prototype, EventEmitter.prototype) diff --git a/lib/browser/api/views/box-layout.js b/lib/browser/api/views/box-layout.js index e2876af980eb..5c4d98fd5600 100644 --- a/lib/browser/api/views/box-layout.js +++ b/lib/browser/api/views/box-layout.js @@ -3,7 +3,7 @@ const electron = require('electron') const { LayoutManager } = electron -const { BoxLayout } = process.atomBinding('box_layout') +const { BoxLayout } = process.electronBinding('box_layout') Object.setPrototypeOf(BoxLayout.prototype, LayoutManager.prototype) diff --git a/lib/browser/api/views/button.js b/lib/browser/api/views/button.js index 5fa353ca0856..cb4cbc82962c 100644 --- a/lib/browser/api/views/button.js +++ b/lib/browser/api/views/button.js @@ -3,7 +3,7 @@ const electron = require('electron') const { View } = electron -const { Button } = process.atomBinding('button') +const { Button } = process.electronBinding('button') Object.setPrototypeOf(Button.prototype, View.prototype) diff --git a/lib/browser/api/views/label-button.js b/lib/browser/api/views/label-button.js index 1e83ffeffbbf..ff2f990e0d0e 100644 --- a/lib/browser/api/views/label-button.js +++ b/lib/browser/api/views/label-button.js @@ -3,7 +3,7 @@ const electron = require('electron') const { Button } = electron -const { LabelButton } = process.atomBinding('label_button') +const { LabelButton } = process.electronBinding('label_button') Object.setPrototypeOf(LabelButton.prototype, Button.prototype) diff --git a/lib/browser/api/views/layout-manager.js b/lib/browser/api/views/layout-manager.js index df635834820a..b9da420ad698 100644 --- a/lib/browser/api/views/layout-manager.js +++ b/lib/browser/api/views/layout-manager.js @@ -1,6 +1,6 @@ 'use strict' -const { LayoutManager } = process.atomBinding('layout_manager') +const { LayoutManager } = process.electronBinding('layout_manager') LayoutManager.prototype._init = function () { } diff --git a/lib/browser/api/views/md-text-button.js b/lib/browser/api/views/md-text-button.js index e20c658e8e00..8671a80dbc37 100644 --- a/lib/browser/api/views/md-text-button.js +++ b/lib/browser/api/views/md-text-button.js @@ -3,7 +3,7 @@ const electron = require('electron') const { LabelButton } = electron -const { MdTextButton } = process.atomBinding('md_text_button') +const { MdTextButton } = process.electronBinding('md_text_button') Object.setPrototypeOf(MdTextButton.prototype, LabelButton.prototype) diff --git a/lib/browser/api/views/resize-area.js b/lib/browser/api/views/resize-area.js index 5be9d282395b..e8067aa42546 100644 --- a/lib/browser/api/views/resize-area.js +++ b/lib/browser/api/views/resize-area.js @@ -3,7 +3,7 @@ const electron = require('electron') const { View } = electron -const { ResizeArea } = process.atomBinding('resize_area') +const { ResizeArea } = process.electronBinding('resize_area') Object.setPrototypeOf(ResizeArea.prototype, View.prototype) diff --git a/lib/browser/api/views/text-field.js b/lib/browser/api/views/text-field.js index 908d967a48bb..fafd5bccd01d 100644 --- a/lib/browser/api/views/text-field.js +++ b/lib/browser/api/views/text-field.js @@ -3,7 +3,7 @@ const electron = require('electron') const { View } = electron -const { TextField } = process.atomBinding('text_field') +const { TextField } = process.electronBinding('text_field') Object.setPrototypeOf(TextField.prototype, View.prototype) diff --git a/lib/browser/api/web-contents-view.js b/lib/browser/api/web-contents-view.js index 89f36e84f765..eb028bb0908f 100644 --- a/lib/browser/api/web-contents-view.js +++ b/lib/browser/api/web-contents-view.js @@ -3,7 +3,7 @@ const electron = require('electron') const { View } = electron -const { WebContentsView } = process.atomBinding('web_contents_view') +const { WebContentsView } = process.electronBinding('web_contents_view') Object.setPrototypeOf(WebContentsView.prototype, View.prototype) diff --git a/lib/browser/api/web-contents.js b/lib/browser/api/web-contents.js index eaa4f7429a59..4a435a98b011 100644 --- a/lib/browser/api/web-contents.js +++ b/lib/browser/api/web-contents.js @@ -1,6 +1,6 @@ 'use strict' -const features = process.atomBinding('features') +const features = process.electronBinding('features') const { EventEmitter } = require('events') const electron = require('electron') const path = require('path') @@ -95,7 +95,7 @@ const defaultPrintingSetting = { } // JavaScript implementations of WebContents. -const binding = process.atomBinding('web_contents') +const binding = process.electronBinding('web_contents') const { WebContents } = binding Object.setPrototypeOf(NavigationController.prototype, EventEmitter.prototype) @@ -467,7 +467,7 @@ WebContents.prototype._init = function () { } // JavaScript wrapper of Debugger. -const { Debugger } = process.atomBinding('debugger') +const { Debugger } = process.electronBinding('debugger') Debugger.prototype.sendCommand = deprecate.promisify(Debugger.prototype.sendCommand) diff --git a/lib/browser/chrome-extension.js b/lib/browser/chrome-extension.js index 7110c8b6ea63..a96a9353c6b4 100644 --- a/lib/browser/chrome-extension.js +++ b/lib/browser/chrome-extension.js @@ -1,8 +1,8 @@ 'use strict' const { app, webContents, BrowserWindow } = require('electron') -const { getAllWebContents } = process.atomBinding('web_contents') -const renderProcessPreferences = process.atomBinding('render_process_preferences').forAllWebContents() +const { getAllWebContents } = process.electronBinding('web_contents') +const renderProcessPreferences = process.electronBinding('render_process_preferences').forAllWebContents() const { ipcMainInternal } = require('@electron/internal/browser/ipc-main-internal') const ipcMainUtils = require('@electron/internal/browser/ipc-main-internal-utils') diff --git a/lib/browser/default-menu.ts b/lib/browser/default-menu.ts index 6f335c07278c..eedf8df02462 100644 --- a/lib/browser/default-menu.ts +++ b/lib/browser/default-menu.ts @@ -1,6 +1,6 @@ import { shell, Menu } from 'electron' -const v8Util = process.atomBinding('v8_util') +const v8Util = process.electronBinding('v8_util') const isMac = process.platform === 'darwin' diff --git a/lib/browser/desktop-capturer.js b/lib/browser/desktop-capturer.js index 0211b1505d6c..411f449fd17e 100644 --- a/lib/browser/desktop-capturer.js +++ b/lib/browser/desktop-capturer.js @@ -2,8 +2,8 @@ const ipcMainUtils = require('@electron/internal/browser/ipc-main-internal-utils') -const { desktopCapturer } = process.atomBinding('desktop_capturer') -const eventBinding = process.atomBinding('event') +const { desktopCapturer } = process.electronBinding('desktop_capturer') +const eventBinding = process.electronBinding('event') const deepEqual = (a, b) => JSON.stringify(a) === JSON.stringify(b) diff --git a/lib/browser/guest-view-manager.js b/lib/browser/guest-view-manager.js index 9f232026f367..b5db1ceb06fc 100644 --- a/lib/browser/guest-view-manager.js +++ b/lib/browser/guest-view-manager.js @@ -61,7 +61,7 @@ const getNextGuestInstanceId = function () { // Create a new guest instance. const createGuest = function (embedder, params) { if (webViewManager == null) { - webViewManager = process.atomBinding('web_view_manager') + webViewManager = process.electronBinding('web_view_manager') } const guestInstanceId = getNextGuestInstanceId(embedder) diff --git a/lib/browser/guest-window-manager.js b/lib/browser/guest-window-manager.js index 17148543e9f1..ee4b18559486 100644 --- a/lib/browser/guest-window-manager.js +++ b/lib/browser/guest-window-manager.js @@ -1,7 +1,7 @@ 'use strict' const { BrowserWindow, webContents } = require('electron') -const { isSameOrigin } = process.atomBinding('v8_util') +const { isSameOrigin } = process.electronBinding('v8_util') const { ipcMainInternal } = require('@electron/internal/browser/ipc-main-internal') const parseFeaturesString = require('@electron/internal/common/parse-features-string') diff --git a/lib/browser/init.ts b/lib/browser/init.ts index 3f21962823d5..1cb9d785de59 100644 --- a/lib/browser/init.ts +++ b/lib/browser/init.ts @@ -162,7 +162,7 @@ require('@electron/internal/browser/chrome-devtools') // Load the chrome extension support. require('@electron/internal/browser/chrome-extension') -const features = process.atomBinding('features') +const features = process.electronBinding('features') if (features.isDesktopCapturerEnabled()) { // Load internal desktop-capturer module. require('@electron/internal/browser/desktop-capturer') diff --git a/lib/browser/objects-registry.js b/lib/browser/objects-registry.js index c3bbfaed4255..a2d9b3ec9679 100644 --- a/lib/browser/objects-registry.js +++ b/lib/browser/objects-registry.js @@ -1,6 +1,6 @@ 'use strict' -const v8Util = process.atomBinding('v8_util') +const v8Util = process.electronBinding('v8_util') const getOwnerKey = (webContents, contextId) => { return `${webContents.id}-${contextId}` diff --git a/lib/browser/rpc-server.js b/lib/browser/rpc-server.js index de0690e585e2..131e25c52545 100644 --- a/lib/browser/rpc-server.js +++ b/lib/browser/rpc-server.js @@ -5,9 +5,9 @@ const { EventEmitter } = require('events') const fs = require('fs') const util = require('util') -const v8Util = process.atomBinding('v8_util') -const eventBinding = process.atomBinding('event') -const clipboard = process.atomBinding('clipboard') +const v8Util = process.electronBinding('v8_util') +const eventBinding = process.electronBinding('event') +const clipboard = process.electronBinding('clipboard') const { isPromise } = electron diff --git a/lib/common/api/clipboard.js b/lib/common/api/clipboard.js index a561b392a928..99b4644935ea 100644 --- a/lib/common/api/clipboard.js +++ b/lib/common/api/clipboard.js @@ -1,6 +1,6 @@ 'use strict' -const clipboard = process.atomBinding('clipboard') +const clipboard = process.electronBinding('clipboard') if (process.type === 'renderer') { const ipcRendererUtils = require('@electron/internal/renderer/ipc-renderer-internal-utils') diff --git a/lib/common/api/native-image.js b/lib/common/api/native-image.js index 134cf4d36815..f1f2d51d102e 100644 --- a/lib/common/api/native-image.js +++ b/lib/common/api/native-image.js @@ -1,5 +1,5 @@ 'use strict' -const { nativeImage } = process.atomBinding('native_image') +const { nativeImage } = process.electronBinding('native_image') module.exports = nativeImage diff --git a/lib/common/api/shell.js b/lib/common/api/shell.js index 6907d90119e3..9e9b67352358 100644 --- a/lib/common/api/shell.js +++ b/lib/common/api/shell.js @@ -1,3 +1,3 @@ 'use strict' -module.exports = process.atomBinding('shell') +module.exports = process.electronBinding('shell') diff --git a/lib/common/atom-binding-setup.ts b/lib/common/atom-binding-setup.ts index fc9460eb39f5..fcb79d3126b2 100644 --- a/lib/common/atom-binding-setup.ts +++ b/lib/common/atom-binding-setup.ts @@ -1,5 +1,5 @@ -export function atomBindingSetup (binding: typeof process['_linkedBinding'], processType: typeof process['type']): typeof process['atomBinding'] { - return function atomBinding (name: string) { +export function electronBindingSetup (binding: typeof process['_linkedBinding'], processType: typeof process['type']): typeof process['electronBinding'] { + return function electronBinding (name: string) { try { return binding(`atom_${processType}_${name}`) } catch (error) { diff --git a/lib/common/clipboard-utils.js b/lib/common/clipboard-utils.js index c5c498c7e5ff..f6e8be74be92 100644 --- a/lib/common/clipboard-utils.js +++ b/lib/common/clipboard-utils.js @@ -1,6 +1,6 @@ 'use strict' -const { nativeImage, NativeImage } = process.atomBinding('native_image') +const { nativeImage, NativeImage } = process.electronBinding('native_image') const objectMap = function (source, mapper) { const sourceEntries = Object.entries(source) diff --git a/lib/common/crash-reporter.js b/lib/common/crash-reporter.js index e889feec927c..145fe2c19952 100644 --- a/lib/common/crash-reporter.js +++ b/lib/common/crash-reporter.js @@ -1,6 +1,6 @@ 'use strict' -const binding = process.atomBinding('crash_reporter') +const binding = process.electronBinding('crash_reporter') class CrashReporter { contructor () { diff --git a/lib/common/init.ts b/lib/common/init.ts index 0d4705a108c9..30e9ecf9a3ba 100644 --- a/lib/common/init.ts +++ b/lib/common/init.ts @@ -1,9 +1,9 @@ import * as timers from 'timers' import * as util from 'util' -import { atomBindingSetup } from '@electron/internal/common/atom-binding-setup' +import { electronBindingSetup } from '@electron/internal/common/atom-binding-setup' -process.atomBinding = atomBindingSetup(process._linkedBinding, process.type) +process.electronBinding = electronBindingSetup(process._linkedBinding, process.type) type AnyFn = (...args: any[]) => any diff --git a/lib/content_script/init.js b/lib/content_script/init.js index 1f94e7fe15ec..2d97dcb519de 100644 --- a/lib/content_script/init.js +++ b/lib/content_script/init.js @@ -4,9 +4,9 @@ const { EventEmitter } = require('events') -process.atomBinding = require('@electron/internal/common/atom-binding-setup').atomBindingSetup(nodeProcess.binding, 'renderer') +process.electronBinding = require('@electron/internal/common/atom-binding-setup').electronBindingSetup(nodeProcess.binding, 'renderer') -const v8Util = process.atomBinding('v8_util') +const v8Util = process.electronBinding('v8_util') // The `lib/renderer/ipc-renderer-internal.js` module looks for the ipc object in the // "ipc-internal" hidden value v8Util.setHiddenValue(global, 'ipc-internal', new EventEmitter()) diff --git a/lib/isolated_renderer/init.js b/lib/isolated_renderer/init.js index 321b6d8dd7c9..ddbff865afde 100644 --- a/lib/isolated_renderer/init.js +++ b/lib/isolated_renderer/init.js @@ -2,9 +2,9 @@ /* global nodeProcess, isolatedWorld */ -const atomBinding = require('@electron/internal/common/atom-binding-setup').atomBindingSetup(nodeProcess.binding, 'renderer') +const electronBinding = require('@electron/internal/common/atom-binding-setup').electronBindingSetup(nodeProcess.binding, 'renderer') -const v8Util = atomBinding('v8_util') +const v8Util = electronBinding('v8_util') const webViewImpl = v8Util.getHiddenValue(isolatedWorld, 'web-view-impl') diff --git a/lib/renderer/api/ipc-renderer.js b/lib/renderer/api/ipc-renderer.js index 95b90280b06f..e91b7d71a4c8 100644 --- a/lib/renderer/api/ipc-renderer.js +++ b/lib/renderer/api/ipc-renderer.js @@ -1,7 +1,7 @@ 'use strict' -const binding = process.atomBinding('ipc') -const v8Util = process.atomBinding('v8_util') +const binding = process.electronBinding('ipc') +const v8Util = process.electronBinding('v8_util') // Created by init.js. const ipcRenderer = v8Util.getHiddenValue(global, 'ipc') diff --git a/lib/renderer/api/module-list.js b/lib/renderer/api/module-list.js index 0586f494cc5e..dba2880b30f0 100644 --- a/lib/renderer/api/module-list.js +++ b/lib/renderer/api/module-list.js @@ -1,7 +1,7 @@ 'use strict' -const features = process.atomBinding('features') -const v8Util = process.atomBinding('v8_util') +const features = process.electronBinding('features') +const v8Util = process.electronBinding('v8_util') const enableRemoteModule = v8Util.getHiddenValue(global, 'enableRemoteModule') diff --git a/lib/renderer/api/remote.js b/lib/renderer/api/remote.js index f422396fd83a..c7974a740ac6 100644 --- a/lib/renderer/api/remote.js +++ b/lib/renderer/api/remote.js @@ -1,6 +1,6 @@ 'use strict' -const v8Util = process.atomBinding('v8_util') +const v8Util = process.electronBinding('v8_util') const { isPromise } = require('electron') const resolvePromise = Promise.resolve.bind(Promise) diff --git a/lib/renderer/api/web-frame.ts b/lib/renderer/api/web-frame.ts index f723d521de8a..ca640c30ab4d 100644 --- a/lib/renderer/api/web-frame.ts +++ b/lib/renderer/api/web-frame.ts @@ -1,7 +1,7 @@ import { EventEmitter } from 'events' import { deprecate } from 'electron' -const binding = process.atomBinding('web_frame') +const binding = process.electronBinding('web_frame') class WebFrame extends EventEmitter { constructor (public context: Window) { diff --git a/lib/renderer/callbacks-registry.js b/lib/renderer/callbacks-registry.js index 6a1c63b20413..569f7f5d8152 100644 --- a/lib/renderer/callbacks-registry.js +++ b/lib/renderer/callbacks-registry.js @@ -1,6 +1,6 @@ 'use strict' -const v8Util = process.atomBinding('v8_util') +const v8Util = process.electronBinding('v8_util') class CallbacksRegistry { constructor () { diff --git a/lib/renderer/content-scripts-injector.ts b/lib/renderer/content-scripts-injector.ts index 2a39e17ba817..40613ccd3ea4 100644 --- a/lib/renderer/content-scripts-injector.ts +++ b/lib/renderer/content-scripts-injector.ts @@ -1,7 +1,7 @@ import { ipcRendererInternal } from '@electron/internal/renderer/ipc-renderer-internal' import { webFrame } from 'electron' -const v8Util = process.atomBinding('v8_util') +const v8Util = process.electronBinding('v8_util') const IsolatedWorldIDs = { /** diff --git a/lib/renderer/init.ts b/lib/renderer/init.ts index 08e6b27ed734..04487f80d3ea 100644 --- a/lib/renderer/init.ts +++ b/lib/renderer/init.ts @@ -20,7 +20,7 @@ const globalPaths = Module.globalPaths globalPaths.push(path.join(__dirname, 'api', 'exports')) // The global variable will be used by ipc for event dispatching -const v8Util = process.atomBinding('v8_util') +const v8Util = process.electronBinding('v8_util') v8Util.setHiddenValue(global, 'ipc', new EventEmitter()) v8Util.setHiddenValue(global, 'ipc-internal', new EventEmitter()) @@ -31,7 +31,7 @@ const { webFrameInit } = require('@electron/internal/renderer/web-frame-init') webFrameInit() // Process command line arguments. -const { hasSwitch, getSwitchValue } = process.atomBinding('command_line') +const { hasSwitch, getSwitchValue } = process.electronBinding('command_line') const parseOption = function ( name: string, defaultValue: T, converter?: (value: string) => T diff --git a/lib/renderer/ipc-renderer-internal.ts b/lib/renderer/ipc-renderer-internal.ts index 851c76885221..9da1186e9a7a 100644 --- a/lib/renderer/ipc-renderer-internal.ts +++ b/lib/renderer/ipc-renderer-internal.ts @@ -1,5 +1,5 @@ -const binding = process.atomBinding('ipc') -const v8Util = process.atomBinding('v8_util') +const binding = process.electronBinding('ipc') +const v8Util = process.electronBinding('v8_util') // Created by init.js. export const ipcRendererInternal: Electron.IpcRendererInternal = v8Util.getHiddenValue(global, 'ipc-internal') diff --git a/lib/renderer/web-view/web-view-impl.ts b/lib/renderer/web-view/web-view-impl.ts index a969e2d72a41..6a7fb961a649 100644 --- a/lib/renderer/web-view/web-view-impl.ts +++ b/lib/renderer/web-view/web-view-impl.ts @@ -9,7 +9,7 @@ import { asyncPromiseMethods } from '@electron/internal/common/web-view-methods' -const v8Util = process.atomBinding('v8_util') +const v8Util = process.electronBinding('v8_util') // ID generator. let nextId = 0 diff --git a/lib/renderer/web-view/web-view-init.ts b/lib/renderer/web-view/web-view-init.ts index 5e2c2fe15262..621ba569845d 100644 --- a/lib/renderer/web-view/web-view-init.ts +++ b/lib/renderer/web-view/web-view-init.ts @@ -1,6 +1,6 @@ import { ipcRendererInternal } from '@electron/internal/renderer/ipc-renderer-internal' -const v8Util = process.atomBinding('v8_util') +const v8Util = process.electronBinding('v8_util') function handleFocusBlur (guestInstanceId: number) { // Note that while Chromium content APIs have observer for focus/blur, they diff --git a/lib/sandboxed_renderer/api/module-list.js b/lib/sandboxed_renderer/api/module-list.js index 285a27632daf..81b0ef36a8dd 100644 --- a/lib/sandboxed_renderer/api/module-list.js +++ b/lib/sandboxed_renderer/api/module-list.js @@ -1,6 +1,6 @@ 'use strict' -const features = process.atomBinding('features') +const features = process.electronBinding('features') module.exports = [ { diff --git a/lib/sandboxed_renderer/init.js b/lib/sandboxed_renderer/init.js index f1e26139d29e..1a9088998f8f 100644 --- a/lib/sandboxed_renderer/init.js +++ b/lib/sandboxed_renderer/init.js @@ -5,9 +5,9 @@ const events = require('events') const { EventEmitter } = events -process.atomBinding = require('@electron/internal/common/atom-binding-setup').atomBindingSetup(binding.get, 'renderer') +process.electronBinding = require('@electron/internal/common/atom-binding-setup').electronBindingSetup(binding.get, 'renderer') -const v8Util = process.atomBinding('v8_util') +const v8Util = process.electronBinding('v8_util') // Expose browserify Buffer as a hidden value. This is used by C++ code to // deserialize Buffer instances sent from browser process. v8Util.setHiddenValue(global, 'Buffer', Buffer) @@ -35,7 +35,7 @@ const { process.isRemoteModuleEnabled = isRemoteModuleEnabled -// The electron module depends on process.atomBinding +// The electron module depends on process.electronBinding const electron = require('electron') const loadedModules = new Map([ @@ -47,7 +47,7 @@ const loadedModules = new Map([ // AtomSandboxedRendererClient will look for the "ipcNative" hidden object when // invoking the `onMessage`/`onExit` callbacks. -const ipcNative = process.atomBinding('ipc') +const ipcNative = process.electronBinding('ipc') v8Util.setHiddenValue(global, 'ipcNative', ipcNative) ipcNative.onMessage = function (internal, channel, args, senderId) { @@ -74,7 +74,7 @@ const { webFrameInit } = require('@electron/internal/renderer/web-frame-init') webFrameInit() // Pass different process object to the preload script(which should not have -// access to things like `process.atomBinding`). +// access to things like `process.electronBinding`). const preloadProcess = new EventEmitter() Object.assign(preloadProcess, binding.process) @@ -103,7 +103,7 @@ function preloadRequire (module) { } // Process command line arguments. -const { hasSwitch } = process.atomBinding('command_line') +const { hasSwitch } = process.electronBinding('command_line') const isBackgroundPage = hasSwitch('background-page') const contextIsolation = hasSwitch('context-isolation') diff --git a/spec-main/api-app-spec.ts b/spec-main/api-app-spec.ts index 710ec7ae86a8..6e0e9ae80be9 100644 --- a/spec-main/api-app-spec.ts +++ b/spec-main/api-app-spec.ts @@ -1151,7 +1151,7 @@ describe('app module', () => { it('keeps references to the menu', () => { app.dock.setMenu(new Menu()) - const v8Util = process.atomBinding('v8_util') + const v8Util = process.electronBinding('v8_util') v8Util.requestGarbageCollectionForTesting() }) }) diff --git a/spec/api-browser-window-spec.js b/spec/api-browser-window-spec.js index 4e3cd28e9eb3..7b0d3d62dbb3 100644 --- a/spec/api-browser-window-spec.js +++ b/spec/api-browser-window-spec.js @@ -13,7 +13,7 @@ const { emittedOnce } = require('./events-helpers') const { ipcRenderer, remote } = require('electron') const { app, ipcMain, BrowserWindow, BrowserView, protocol, session, screen, webContents } = remote -const features = process.atomBinding('features') +const features = process.electronBinding('features') const { expect } = chai const isCI = remote.getGlobal('isCi') const nativeModulesEnabled = remote.getGlobal('nativeModulesEnabled') diff --git a/spec/api-desktop-capturer-spec.js b/spec/api-desktop-capturer-spec.js index 22df5db6c2e4..bef2e463c91e 100644 --- a/spec/api-desktop-capturer-spec.js +++ b/spec/api-desktop-capturer-spec.js @@ -3,7 +3,7 @@ const dirtyChai = require('dirty-chai') const chaiAsPromised = require('chai-as-promised') const { desktopCapturer, ipcRenderer, remote } = require('electron') const { screen } = remote -const features = process.atomBinding('features') +const features = process.electronBinding('features') const { emittedOnce } = require('./events-helpers') const { expect } = chai diff --git a/spec/api-net-spec.js b/spec/api-net-spec.js index 703fac3ca8bf..311af3388956 100644 --- a/spec/api-net-spec.js +++ b/spec/api-net-spec.js @@ -1537,7 +1537,7 @@ describe('net module', () => { const {net} = require('electron') const urlRequest = net.request('${server.url}${requestUrl}') process.nextTick(() => { - const v8Util = process.atomBinding('v8_util') + const v8Util = process.electronBinding('v8_util') v8Util.requestGarbageCollectionForTesting() event.sender.send('api-net-spec-done') }) @@ -1577,7 +1577,7 @@ describe('net module', () => { }) process.nextTick(() => { // Trigger a garbage collection. - const v8Util = process.atomBinding('v8_util') + const v8Util = process.electronBinding('v8_util') v8Util.requestGarbageCollectionForTesting() event.sender.send('api-net-spec-resume') }) @@ -1613,7 +1613,7 @@ describe('net module', () => { }) urlRequest.on('close', () => { process.nextTick(() => { - const v8Util = process.atomBinding('v8_util') + const v8Util = process.electronBinding('v8_util') v8Util.requestGarbageCollectionForTesting() event.sender.send('api-net-spec-done') }) diff --git a/spec/api-web-contents-spec.js b/spec/api-web-contents-spec.js index d173272fe472..e104157fe9a7 100644 --- a/spec/api-web-contents-spec.js +++ b/spec/api-web-contents-spec.js @@ -10,7 +10,7 @@ const { emittedOnce } = require('./events-helpers') const chai = require('chai') const dirtyChai = require('dirty-chai') -const features = process.atomBinding('features') +const features = process.electronBinding('features') const { ipcRenderer, remote, clipboard } = require('electron') const { BrowserWindow, webContents, ipcMain, session } = remote const { expect } = chai diff --git a/spec/asar-spec.js b/spec/asar-spec.js index e00781efa290..db323dc704ec 100644 --- a/spec/asar-spec.js +++ b/spec/asar-spec.js @@ -12,7 +12,7 @@ const remote = require('electron').remote const { ipcMain, BrowserWindow } = remote -const features = process.atomBinding('features') +const features = process.electronBinding('features') describe('asar package', function () { const fixtures = path.join(__dirname, 'fixtures') diff --git a/spec/chromium-spec.js b/spec/chromium-spec.js index f78ab7484670..5f3bfdebf68a 100644 --- a/spec/chromium-spec.js +++ b/spec/chromium-spec.js @@ -13,7 +13,7 @@ const { closeWindow, waitForWebContentsToLoad } = require('./window-helpers') const { resolveGetters } = require('./assert-helpers') const { app, BrowserWindow, ipcMain, protocol, session, webContents } = remote const isCI = remote.getGlobal('isCi') -const features = process.atomBinding('features') +const features = process.electronBinding('features') const { expect } = chai chai.use(dirtyChai) @@ -83,7 +83,7 @@ describe('chromium feature', () => { describe('heap snapshot', () => { it('does not crash', function () { - process.atomBinding('v8_util').takeHeapSnapshot() + process.electronBinding('v8_util').takeHeapSnapshot() }) }) diff --git a/spec/modules-spec.js b/spec/modules-spec.js index 01fb8708cb26..ecafe8821575 100644 --- a/spec/modules-spec.js +++ b/spec/modules-spec.js @@ -5,7 +5,7 @@ const fs = require('fs') const { remote } = require('electron') const { BrowserWindow } = remote const { closeWindow } = require('./window-helpers') -const features = process.atomBinding('features') +const features = process.electronBinding('features') const nativeModulesEnabled = remote.getGlobal('nativeModulesEnabled') diff --git a/spec/node-spec.js b/spec/node-spec.js index b4855ca2f5a4..3c2616141a61 100644 --- a/spec/node-spec.js +++ b/spec/node-spec.js @@ -6,7 +6,7 @@ const fs = require('fs') const path = require('path') const os = require('os') const { ipcRenderer, remote } = require('electron') -const features = process.atomBinding('features') +const features = process.electronBinding('features') const isCI = remote.getGlobal('isCi') chai.use(dirtyChai) diff --git a/spec/webview-spec.js b/spec/webview-spec.js index 5390881fad5b..10f89187e109 100644 --- a/spec/webview-spec.js +++ b/spec/webview-spec.js @@ -12,7 +12,7 @@ const { emittedOnce, waitForEvent } = require('./events-helpers') const { expect } = chai chai.use(dirtyChai) -const features = process.atomBinding('features') +const features = process.electronBinding('features') const isCI = remote.getGlobal('isCi') const nativeModulesEnabled = remote.getGlobal('nativeModulesEnabled') diff --git a/typings/internal-ambient.d.ts b/typings/internal-ambient.d.ts index 52255f14e574..66aadeac1596 100644 --- a/typings/internal-ambient.d.ts +++ b/typings/internal-ambient.d.ts @@ -17,14 +17,14 @@ declare namespace NodeJS { } interface Process { /** - * DO NOT USE DIRECTLY, USE process.atomBinding + * DO NOT USE DIRECTLY, USE process.electronBinding */ _linkedBinding(name: string): any; - atomBinding(name: string): any; - atomBinding(name: 'features'): FeaturesBinding; - atomBinding(name: 'v8_util'): V8UtilBinding; - atomBinding(name: 'app'): { app: Electron.App, App: Function }; - atomBinding(name: 'command_line'): Electron.CommandLine; + electronBinding(name: string): any; + electronBinding(name: 'features'): FeaturesBinding; + electronBinding(name: 'v8_util'): V8UtilBinding; + electronBinding(name: 'app'): { app: Electron.App, App: Function }; + electronBinding(name: 'command_line'): Electron.CommandLine; log: NodeJS.WriteStream['write']; activateUvLoop(): void;