From df53a3428af64392b336121194beaddce348688e Mon Sep 17 00:00:00 2001 From: Robo Date: Fri, 8 Mar 2019 23:59:52 +0530 Subject: [PATCH] refactor: load electron builtin modules with process._linkedBinding (#17247) * refactor: load electron builtin modules with process._linkedBinding NODE_BUILTING_MODULE_CONTEXT_AWARE and process.binding are removed in https://github.com/nodejs/node/pull/25829. This changes uses the alternative available without any functionality change. * chore: roll node --- DEPS | 2 +- atom/browser/api/atom_api_app.cc | 2 +- atom/browser/api/atom_api_auto_updater.cc | 2 +- atom/browser/api/atom_api_browser_view.cc | 2 +- atom/browser/api/atom_api_browser_window.cc | 2 +- atom/browser/api/atom_api_content_tracing.cc | 2 +- atom/browser/api/atom_api_debugger.cc | 2 +- atom/browser/api/atom_api_desktop_capturer.cc | 2 +- atom/browser/api/atom_api_dialog.cc | 2 +- atom/browser/api/atom_api_download_item.cc | 2 +- atom/browser/api/atom_api_event.cc | 2 +- atom/browser/api/atom_api_global_shortcut.cc | 2 +- atom/browser/api/atom_api_in_app_purchase.cc | 2 +- atom/browser/api/atom_api_menu.cc | 2 +- atom/browser/api/atom_api_net.cc | 2 +- atom/browser/api/atom_api_notification.cc | 2 +- atom/browser/api/atom_api_power_monitor.cc | 2 +- atom/browser/api/atom_api_power_save_blocker.cc | 2 +- atom/browser/api/atom_api_protocol.cc | 2 +- atom/browser/api/atom_api_render_process_preferences.cc | 4 ++-- atom/browser/api/atom_api_screen.cc | 2 +- atom/browser/api/atom_api_session.cc | 2 +- atom/browser/api/atom_api_system_preferences.cc | 2 +- atom/browser/api/atom_api_top_level_window.cc | 2 +- atom/browser/api/atom_api_tray.cc | 2 +- atom/browser/api/atom_api_view.cc | 2 +- atom/browser/api/atom_api_web_contents.cc | 2 +- atom/browser/api/atom_api_web_contents_view.cc | 2 +- atom/browser/api/atom_api_web_view_manager.cc | 2 +- atom/browser/api/views/atom_api_box_layout.cc | 2 +- atom/browser/api/views/atom_api_button.cc | 2 +- atom/browser/api/views/atom_api_label_button.cc | 2 +- atom/browser/api/views/atom_api_layout_manager.cc | 2 +- atom/browser/api/views/atom_api_md_text_button.cc | 2 +- atom/browser/api/views/atom_api_resize_area.cc | 2 +- atom/browser/api/views/atom_api_text_field.cc | 2 +- atom/common/api/atom_api_asar.cc | 2 +- atom/common/api/atom_api_clipboard.cc | 2 +- atom/common/api/atom_api_command_line.cc | 2 +- atom/common/api/atom_api_crash_reporter.cc | 2 +- atom/common/api/atom_api_native_image.cc | 2 +- atom/common/api/atom_api_shell.cc | 2 +- atom/common/api/atom_api_v8_util.cc | 2 +- atom/common/api/features.cc | 2 +- atom/common/node_bindings.cc | 2 +- atom/common/node_includes.h | 6 ++++++ atom/renderer/api/atom_api_renderer_ipc.cc | 2 +- atom/renderer/api/atom_api_web_frame.cc | 2 +- atom/renderer/atom_sandboxed_renderer_client.cc | 2 +- lib/common/atom-binding-setup.ts | 2 +- lib/common/init.ts | 2 +- typings/internal-ambient.d.ts | 2 +- 52 files changed, 58 insertions(+), 52 deletions(-) diff --git a/DEPS b/DEPS index 4c7cd0a23aeb6..49470f5574c95 100644 --- a/DEPS +++ b/DEPS @@ -12,7 +12,7 @@ vars = { 'chromium_version': '73.0.3683.68', 'node_version': - '70a78f07b1c4d53f3da462b08cef42a4ff8f949f', + '5e32b02e3c180c9997d60fe85042d335b6d9a588', 'boto_version': 'f7574aa6cc2c819430c1f05e9a1a1a666ef8169b', 'pyyaml_version': '3.12', diff --git a/atom/browser/api/atom_api_app.cc b/atom/browser/api/atom_api_app.cc index ad07393178cd4..f792c737733e3 100644 --- a/atom/browser/api/atom_api_app.cc +++ b/atom/browser/api/atom_api_app.cc @@ -1425,4 +1425,4 @@ void Initialize(v8::Local exports, } // namespace -NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_app, Initialize) +NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_app, Initialize) diff --git a/atom/browser/api/atom_api_auto_updater.cc b/atom/browser/api/atom_api_auto_updater.cc index 694f9beb54a89..e61e454805c88 100644 --- a/atom/browser/api/atom_api_auto_updater.cc +++ b/atom/browser/api/atom_api_auto_updater.cc @@ -154,4 +154,4 @@ void Initialize(v8::Local exports, } // namespace -NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_auto_updater, Initialize) +NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_auto_updater, Initialize) diff --git a/atom/browser/api/atom_api_browser_view.cc b/atom/browser/api/atom_api_browser_view.cc index 558b7f2063807..be5c31ca0126e 100644 --- a/atom/browser/api/atom_api_browser_view.cc +++ b/atom/browser/api/atom_api_browser_view.cc @@ -180,4 +180,4 @@ void Initialize(v8::Local exports, } // namespace -NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_browser_view, Initialize) +NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_browser_view, Initialize) diff --git a/atom/browser/api/atom_api_browser_window.cc b/atom/browser/api/atom_api_browser_window.cc index 80e23ebf76a09..1aec6a47c03b5 100644 --- a/atom/browser/api/atom_api_browser_window.cc +++ b/atom/browser/api/atom_api_browser_window.cc @@ -481,4 +481,4 @@ void Initialize(v8::Local exports, } // namespace -NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_window, Initialize) +NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_window, Initialize) diff --git a/atom/browser/api/atom_api_content_tracing.cc b/atom/browser/api/atom_api_content_tracing.cc index d2875ce8d9d78..f54632afa1918 100644 --- a/atom/browser/api/atom_api_content_tracing.cc +++ b/atom/browser/api/atom_api_content_tracing.cc @@ -148,4 +148,4 @@ void Initialize(v8::Local exports, } // namespace -NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_content_tracing, Initialize) +NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_content_tracing, Initialize) diff --git a/atom/browser/api/atom_api_debugger.cc b/atom/browser/api/atom_api_debugger.cc index 1016103fa3c8c..3794a7ab3ff9d 100644 --- a/atom/browser/api/atom_api_debugger.cc +++ b/atom/browser/api/atom_api_debugger.cc @@ -205,4 +205,4 @@ void Initialize(v8::Local exports, } // namespace -NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_debugger, Initialize); +NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_debugger, Initialize); diff --git a/atom/browser/api/atom_api_desktop_capturer.cc b/atom/browser/api/atom_api_desktop_capturer.cc index 10d53512e968d..f3883459343bb 100644 --- a/atom/browser/api/atom_api_desktop_capturer.cc +++ b/atom/browser/api/atom_api_desktop_capturer.cc @@ -232,4 +232,4 @@ void Initialize(v8::Local exports, } // namespace -NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_desktop_capturer, Initialize); +NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_desktop_capturer, Initialize); diff --git a/atom/browser/api/atom_api_dialog.cc b/atom/browser/api/atom_api_dialog.cc index 197acc3a2ed26..4b82461d1b23d 100644 --- a/atom/browser/api/atom_api_dialog.cc +++ b/atom/browser/api/atom_api_dialog.cc @@ -104,4 +104,4 @@ void Initialize(v8::Local exports, } // namespace -NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_dialog, Initialize) +NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_dialog, Initialize) diff --git a/atom/browser/api/atom_api_download_item.cc b/atom/browser/api/atom_api_download_item.cc index ef474201b1c7b..337274fa34e6f 100644 --- a/atom/browser/api/atom_api_download_item.cc +++ b/atom/browser/api/atom_api_download_item.cc @@ -251,4 +251,4 @@ void Initialize(v8::Local exports, } // namespace -NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_download_item, Initialize); +NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_download_item, Initialize); diff --git a/atom/browser/api/atom_api_event.cc b/atom/browser/api/atom_api_event.cc index da504b0ff23ee..96a3bf530e450 100644 --- a/atom/browser/api/atom_api_event.cc +++ b/atom/browser/api/atom_api_event.cc @@ -23,4 +23,4 @@ void Initialize(v8::Local exports, } // namespace -NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_event, Initialize) +NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_event, Initialize) diff --git a/atom/browser/api/atom_api_global_shortcut.cc b/atom/browser/api/atom_api_global_shortcut.cc index 1adb0b2edc566..7d7141635be54 100644 --- a/atom/browser/api/atom_api_global_shortcut.cc +++ b/atom/browser/api/atom_api_global_shortcut.cc @@ -166,4 +166,4 @@ void Initialize(v8::Local exports, } // namespace -NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_global_shortcut, Initialize) +NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_global_shortcut, Initialize) diff --git a/atom/browser/api/atom_api_in_app_purchase.cc b/atom/browser/api/atom_api_in_app_purchase.cc index 1f6718ba53ed9..85addb582fb66 100644 --- a/atom/browser/api/atom_api_in_app_purchase.cc +++ b/atom/browser/api/atom_api_in_app_purchase.cc @@ -140,4 +140,4 @@ void Initialize(v8::Local exports, } // namespace -NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_in_app_purchase, Initialize) +NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_in_app_purchase, Initialize) diff --git a/atom/browser/api/atom_api_menu.cc b/atom/browser/api/atom_api_menu.cc index 963cf28fc0af5..7ba79dac6de91 100644 --- a/atom/browser/api/atom_api_menu.cc +++ b/atom/browser/api/atom_api_menu.cc @@ -257,4 +257,4 @@ void Initialize(v8::Local exports, } // namespace -NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_menu, Initialize) +NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_menu, Initialize) diff --git a/atom/browser/api/atom_api_net.cc b/atom/browser/api/atom_api_net.cc index fc037fb9d8db2..c46f3a8ce6df5 100644 --- a/atom/browser/api/atom_api_net.cc +++ b/atom/browser/api/atom_api_net.cc @@ -61,4 +61,4 @@ void Initialize(v8::Local exports, } // namespace -NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_net, Initialize) +NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_net, Initialize) diff --git a/atom/browser/api/atom_api_notification.cc b/atom/browser/api/atom_api_notification.cc index 0ce0d065bd586..6f476487b95c9 100644 --- a/atom/browser/api/atom_api_notification.cc +++ b/atom/browser/api/atom_api_notification.cc @@ -272,4 +272,4 @@ void Initialize(v8::Local exports, } // namespace -NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_common_notification, Initialize) +NODE_LINKED_MODULE_CONTEXT_AWARE(atom_common_notification, Initialize) diff --git a/atom/browser/api/atom_api_power_monitor.cc b/atom/browser/api/atom_api_power_monitor.cc index 16eb9eeb2f8f1..82bae9d232bbd 100644 --- a/atom/browser/api/atom_api_power_monitor.cc +++ b/atom/browser/api/atom_api_power_monitor.cc @@ -148,4 +148,4 @@ void Initialize(v8::Local exports, } // namespace -NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_power_monitor, Initialize) +NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_power_monitor, Initialize) diff --git a/atom/browser/api/atom_api_power_save_blocker.cc b/atom/browser/api/atom_api_power_save_blocker.cc index ec77636a40b07..532bc7e270f55 100644 --- a/atom/browser/api/atom_api_power_save_blocker.cc +++ b/atom/browser/api/atom_api_power_save_blocker.cc @@ -151,4 +151,4 @@ void Initialize(v8::Local exports, } // namespace -NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_power_save_blocker, Initialize); +NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_power_save_blocker, Initialize); diff --git a/atom/browser/api/atom_api_protocol.cc b/atom/browser/api/atom_api_protocol.cc index 05694fddf6cbb..ce1f975848698 100644 --- a/atom/browser/api/atom_api_protocol.cc +++ b/atom/browser/api/atom_api_protocol.cc @@ -317,4 +317,4 @@ void Initialize(v8::Local exports, } // namespace -NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_protocol, Initialize) +NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_protocol, Initialize) diff --git a/atom/browser/api/atom_api_render_process_preferences.cc b/atom/browser/api/atom_api_render_process_preferences.cc index d0344261dc948..ac2605861338b 100644 --- a/atom/browser/api/atom_api_render_process_preferences.cc +++ b/atom/browser/api/atom_api_render_process_preferences.cc @@ -87,5 +87,5 @@ void Initialize(v8::Local exports, } // namespace -NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_render_process_preferences, - Initialize) +NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_render_process_preferences, + Initialize) diff --git a/atom/browser/api/atom_api_screen.cc b/atom/browser/api/atom_api_screen.cc index 65b9e3e11f1d9..fd380ff877426 100644 --- a/atom/browser/api/atom_api_screen.cc +++ b/atom/browser/api/atom_api_screen.cc @@ -171,4 +171,4 @@ void Initialize(v8::Local exports, } // namespace -NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_common_screen, Initialize) +NODE_LINKED_MODULE_CONTEXT_AWARE(atom_common_screen, Initialize) diff --git a/atom/browser/api/atom_api_session.cc b/atom/browser/api/atom_api_session.cc index 999aa1092b1db..5994d3ef933bb 100644 --- a/atom/browser/api/atom_api_session.cc +++ b/atom/browser/api/atom_api_session.cc @@ -826,4 +826,4 @@ void Initialize(v8::Local exports, } // namespace -NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_session, Initialize) +NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_session, Initialize) diff --git a/atom/browser/api/atom_api_system_preferences.cc b/atom/browser/api/atom_api_system_preferences.cc index ee95c17153ac9..bf957bb2c55ed 100644 --- a/atom/browser/api/atom_api_system_preferences.cc +++ b/atom/browser/api/atom_api_system_preferences.cc @@ -130,4 +130,4 @@ void Initialize(v8::Local exports, } // namespace -NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_system_preferences, Initialize); +NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_system_preferences, Initialize); diff --git a/atom/browser/api/atom_api_top_level_window.cc b/atom/browser/api/atom_api_top_level_window.cc index 10011e747d94d..3375c96ab1e4f 100644 --- a/atom/browser/api/atom_api_top_level_window.cc +++ b/atom/browser/api/atom_api_top_level_window.cc @@ -1195,4 +1195,4 @@ void Initialize(v8::Local exports, } // namespace -NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_top_level_window, Initialize) +NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_top_level_window, Initialize) diff --git a/atom/browser/api/atom_api_tray.cc b/atom/browser/api/atom_api_tray.cc index 625a828a5ed52..1ccd289f3867d 100644 --- a/atom/browser/api/atom_api_tray.cc +++ b/atom/browser/api/atom_api_tray.cc @@ -261,4 +261,4 @@ void Initialize(v8::Local exports, } // namespace -NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_tray, Initialize) +NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_tray, Initialize) diff --git a/atom/browser/api/atom_api_view.cc b/atom/browser/api/atom_api_view.cc index 4ef46cf3e712e..4d4508d3cd396 100644 --- a/atom/browser/api/atom_api_view.cc +++ b/atom/browser/api/atom_api_view.cc @@ -86,4 +86,4 @@ void Initialize(v8::Local exports, } // namespace -NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_view, Initialize) +NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_view, Initialize) diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index fd6eb0d6058d1..c896571d5e3d5 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -2283,4 +2283,4 @@ void Initialize(v8::Local exports, } // namespace -NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_web_contents, Initialize) +NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_web_contents, Initialize) diff --git a/atom/browser/api/atom_api_web_contents_view.cc b/atom/browser/api/atom_api_web_contents_view.cc index 5711a3b6f76fc..7f2c6719ecb00 100644 --- a/atom/browser/api/atom_api_web_contents_view.cc +++ b/atom/browser/api/atom_api_web_contents_view.cc @@ -131,4 +131,4 @@ void Initialize(v8::Local exports, } // namespace -NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_web_contents_view, Initialize) +NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_web_contents_view, Initialize) diff --git a/atom/browser/api/atom_api_web_view_manager.cc b/atom/browser/api/atom_api_web_view_manager.cc index e24d6306f62a6..0b49ca93c1228 100644 --- a/atom/browser/api/atom_api_web_view_manager.cc +++ b/atom/browser/api/atom_api_web_view_manager.cc @@ -55,4 +55,4 @@ void Initialize(v8::Local exports, } // namespace -NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_web_view_manager, Initialize) +NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_web_view_manager, Initialize) diff --git a/atom/browser/api/views/atom_api_box_layout.cc b/atom/browser/api/views/atom_api_box_layout.cc index 7ae33bac5edd6..a949f16a6b475 100644 --- a/atom/browser/api/views/atom_api_box_layout.cc +++ b/atom/browser/api/views/atom_api_box_layout.cc @@ -84,4 +84,4 @@ void Initialize(v8::Local exports, } // namespace -NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_box_layout, Initialize) +NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_box_layout, Initialize) diff --git a/atom/browser/api/views/atom_api_button.cc b/atom/browser/api/views/atom_api_button.cc index 32309dac84373..53f573599b5ad 100644 --- a/atom/browser/api/views/atom_api_button.cc +++ b/atom/browser/api/views/atom_api_button.cc @@ -57,4 +57,4 @@ void Initialize(v8::Local exports, } // namespace -NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_button, Initialize) +NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_button, Initialize) diff --git a/atom/browser/api/views/atom_api_label_button.cc b/atom/browser/api/views/atom_api_label_button.cc index 9a132ffc516bc..5cba900acf2ab 100644 --- a/atom/browser/api/views/atom_api_label_button.cc +++ b/atom/browser/api/views/atom_api_label_button.cc @@ -77,4 +77,4 @@ void Initialize(v8::Local exports, } // namespace -NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_label_button, Initialize) +NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_label_button, Initialize) diff --git a/atom/browser/api/views/atom_api_layout_manager.cc b/atom/browser/api/views/atom_api_layout_manager.cc index 79d9d61fca1bb..74156b32a3c67 100644 --- a/atom/browser/api/views/atom_api_layout_manager.cc +++ b/atom/browser/api/views/atom_api_layout_manager.cc @@ -60,4 +60,4 @@ void Initialize(v8::Local exports, } // namespace -NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_layout_manager, Initialize) +NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_layout_manager, Initialize) diff --git a/atom/browser/api/views/atom_api_md_text_button.cc b/atom/browser/api/views/atom_api_md_text_button.cc index 8d3ff55d18024..e263856a4ba48 100644 --- a/atom/browser/api/views/atom_api_md_text_button.cc +++ b/atom/browser/api/views/atom_api_md_text_button.cc @@ -54,4 +54,4 @@ void Initialize(v8::Local exports, } // namespace -NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_md_text_button, Initialize) +NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_md_text_button, Initialize) diff --git a/atom/browser/api/views/atom_api_resize_area.cc b/atom/browser/api/views/atom_api_resize_area.cc index 850afe348d949..b41ac3b704889 100644 --- a/atom/browser/api/views/atom_api_resize_area.cc +++ b/atom/browser/api/views/atom_api_resize_area.cc @@ -57,4 +57,4 @@ void Initialize(v8::Local exports, } // namespace -NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_resize_area, Initialize) +NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_resize_area, Initialize) diff --git a/atom/browser/api/views/atom_api_text_field.cc b/atom/browser/api/views/atom_api_text_field.cc index 19f84b1b777c2..08dd27dc86afe 100644 --- a/atom/browser/api/views/atom_api_text_field.cc +++ b/atom/browser/api/views/atom_api_text_field.cc @@ -64,4 +64,4 @@ void Initialize(v8::Local exports, } // namespace -NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_text_field, Initialize) +NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_text_field, Initialize) diff --git a/atom/common/api/atom_api_asar.cc b/atom/common/api/atom_api_asar.cc index ed013b8dd6082..2385b4e807a59 100644 --- a/atom/common/api/atom_api_asar.cc +++ b/atom/common/api/atom_api_asar.cc @@ -144,4 +144,4 @@ void Initialize(v8::Local exports, } // namespace -NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_common_asar, Initialize) +NODE_LINKED_MODULE_CONTEXT_AWARE(atom_common_asar, Initialize) diff --git a/atom/common/api/atom_api_clipboard.cc b/atom/common/api/atom_api_clipboard.cc index 351eef8427d04..f8e4e0e7d1264 100644 --- a/atom/common/api/atom_api_clipboard.cc +++ b/atom/common/api/atom_api_clipboard.cc @@ -227,4 +227,4 @@ void Initialize(v8::Local exports, } // namespace -NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_common_clipboard, Initialize) +NODE_LINKED_MODULE_CONTEXT_AWARE(atom_common_clipboard, Initialize) diff --git a/atom/common/api/atom_api_command_line.cc b/atom/common/api/atom_api_command_line.cc index 953779a8dfadf..e59f858d3fad7 100644 --- a/atom/common/api/atom_api_command_line.cc +++ b/atom/common/api/atom_api_command_line.cc @@ -58,4 +58,4 @@ void Initialize(v8::Local exports, } // namespace -NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_common_command_line, Initialize) +NODE_LINKED_MODULE_CONTEXT_AWARE(atom_common_command_line, Initialize) diff --git a/atom/common/api/atom_api_crash_reporter.cc b/atom/common/api/atom_api_crash_reporter.cc index 15271f4b81843..678a7cd651240 100644 --- a/atom/common/api/atom_api_crash_reporter.cc +++ b/atom/common/api/atom_api_crash_reporter.cc @@ -66,4 +66,4 @@ void Initialize(v8::Local exports, } // namespace -NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_common_crash_reporter, Initialize) +NODE_LINKED_MODULE_CONTEXT_AWARE(atom_common_crash_reporter, Initialize) diff --git a/atom/common/api/atom_api_native_image.cc b/atom/common/api/atom_api_native_image.cc index 9f70607badf23..f57d0a236371c 100644 --- a/atom/common/api/atom_api_native_image.cc +++ b/atom/common/api/atom_api_native_image.cc @@ -623,4 +623,4 @@ void Initialize(v8::Local exports, } // namespace -NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_common_native_image, Initialize) +NODE_LINKED_MODULE_CONTEXT_AWARE(atom_common_native_image, Initialize) diff --git a/atom/common/api/atom_api_shell.cc b/atom/common/api/atom_api_shell.cc index aa735ebd76183..bd34c42cdf620 100644 --- a/atom/common/api/atom_api_shell.cc +++ b/atom/common/api/atom_api_shell.cc @@ -170,4 +170,4 @@ void Initialize(v8::Local exports, } // namespace -NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_common_shell, Initialize) +NODE_LINKED_MODULE_CONTEXT_AWARE(atom_common_shell, Initialize) diff --git a/atom/common/api/atom_api_v8_util.cc b/atom/common/api/atom_api_v8_util.cc index 3d80db0c0a4cd..e705187c6581b 100644 --- a/atom/common/api/atom_api_v8_util.cc +++ b/atom/common/api/atom_api_v8_util.cc @@ -126,4 +126,4 @@ void Initialize(v8::Local exports, } // namespace -NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_common_v8_util, Initialize) +NODE_LINKED_MODULE_CONTEXT_AWARE(atom_common_v8_util, Initialize) diff --git a/atom/common/api/features.cc b/atom/common/api/features.cc index 2431b2d867b99..7645dc3394a3e 100644 --- a/atom/common/api/features.cc +++ b/atom/common/api/features.cc @@ -61,4 +61,4 @@ void Initialize(v8::Local exports, } // namespace -NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_common_features, Initialize) +NODE_LINKED_MODULE_CONTEXT_AWARE(atom_common_features, Initialize) diff --git a/atom/common/node_bindings.cc b/atom/common/node_bindings.cc index 12a4ecd2b360b..b965e73de8344 100644 --- a/atom/common/node_bindings.cc +++ b/atom/common/node_bindings.cc @@ -84,7 +84,7 @@ // __attribute__((constructor)), we call the _register_ // function for each built-in modules explicitly. This is only // forward declaration. The definitions are in each module's -// implementation when calling the NODE_BUILTIN_MODULE_CONTEXT_AWARE. +// implementation when calling the NODE_LINKED_MODULE_CONTEXT_AWARE. #define V(modname) void _register_##modname(); ELECTRON_BUILTIN_MODULES(V) #if BUILDFLAG(ENABLE_VIEW_API) diff --git a/atom/common/node_includes.h b/atom/common/node_includes.h index 1ce45edb8e516..f809bcfbfc9b6 100644 --- a/atom/common/node_includes.h +++ b/atom/common/node_includes.h @@ -53,6 +53,12 @@ #include "node_options.h" #include "node_platform.h" +// Alternative to NODE_MODULE_CONTEXT_AWARE_X. +// Allows to explicitly register builtin modules instead of using +// __attribute__((constructor)). +#define NODE_LINKED_MODULE_CONTEXT_AWARE(modname, regfunc) \ + NODE_MODULE_CONTEXT_AWARE_CPP(modname, regfunc, nullptr, NM_F_LINKED) + #pragma pop_macro("ASSERT") #pragma pop_macro("CHECK") #pragma pop_macro("CHECK_EQ") diff --git a/atom/renderer/api/atom_api_renderer_ipc.cc b/atom/renderer/api/atom_api_renderer_ipc.cc index ea7388e7b05b6..c6d0b94807dc2 100644 --- a/atom/renderer/api/atom_api_renderer_ipc.cc +++ b/atom/renderer/api/atom_api_renderer_ipc.cc @@ -107,4 +107,4 @@ void Initialize(v8::Local exports, } // namespace -NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_renderer_ipc, Initialize) +NODE_LINKED_MODULE_CONTEXT_AWARE(atom_renderer_ipc, Initialize) diff --git a/atom/renderer/api/atom_api_web_frame.cc b/atom/renderer/api/atom_api_web_frame.cc index 829a826af08e4..f970d5908acec 100644 --- a/atom/renderer/api/atom_api_web_frame.cc +++ b/atom/renderer/api/atom_api_web_frame.cc @@ -548,4 +548,4 @@ void Initialize(v8::Local exports, } // namespace -NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_renderer_web_frame, Initialize) +NODE_LINKED_MODULE_CONTEXT_AWARE(atom_renderer_web_frame, Initialize) diff --git a/atom/renderer/atom_sandboxed_renderer_client.cc b/atom/renderer/atom_sandboxed_renderer_client.cc index dc9c6aea54f74..814fabf93fbf8 100644 --- a/atom/renderer/atom_sandboxed_renderer_client.cc +++ b/atom/renderer/atom_sandboxed_renderer_client.cc @@ -68,7 +68,7 @@ v8::Local GetBinding(v8::Isolate* isolate, return exports; } - auto* mod = node::binding::get_builtin_module(module_key.c_str()); + auto* mod = node::binding::get_linked_module(module_key.c_str()); if (!mod) { char errmsg[1024]; diff --git a/lib/common/atom-binding-setup.ts b/lib/common/atom-binding-setup.ts index 89e7fd878754a..fc9460eb39f51 100644 --- a/lib/common/atom-binding-setup.ts +++ b/lib/common/atom-binding-setup.ts @@ -1,4 +1,4 @@ -export function atomBindingSetup (binding: typeof process['binding'], processType: typeof process['type']): typeof process['atomBinding'] { +export function atomBindingSetup (binding: typeof process['_linkedBinding'], processType: typeof process['type']): typeof process['atomBinding'] { return function atomBinding (name: string) { try { return binding(`atom_${processType}_${name}`) diff --git a/lib/common/init.ts b/lib/common/init.ts index 9fcc96097a6e0..0d4705a108c9b 100644 --- a/lib/common/init.ts +++ b/lib/common/init.ts @@ -3,7 +3,7 @@ import * as util from 'util' import { atomBindingSetup } from '@electron/internal/common/atom-binding-setup' -process.atomBinding = atomBindingSetup(process.binding, process.type) +process.atomBinding = atomBindingSetup(process._linkedBinding, process.type) type AnyFn = (...args: any[]) => any diff --git a/typings/internal-ambient.d.ts b/typings/internal-ambient.d.ts index 8c5f53281d34d..49886c3dbde0c 100644 --- a/typings/internal-ambient.d.ts +++ b/typings/internal-ambient.d.ts @@ -18,7 +18,7 @@ declare namespace NodeJS { /** * DO NOT USE DIRECTLY, USE process.atomBinding */ - binding(name: string): any; + _linkedBinding(name: string): any; atomBinding(name: string): any; atomBinding(name: 'features'): FeaturesBinding; atomBinding(name: 'v8_util'): V8UtilBinding;