Commit graph

31 commits

Author SHA1 Message Date
trop[bot]
0c2271a515
fix: net.isOnline always true in utility processes (#48151)
* fix: net.isOnline always true in utilityProcesses

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>

* Update shell/services/node/node_service.cc

Co-authored-by: Robo <hop2deep@gmail.com>

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-08-22 11:18:58 -04:00
Calvin
e3f358a45a
chore: move gin::Handle to gin_helper (#48016)
chore: move gin::Handle to gin_helper (#47959)

* chore: move gin::Handle to gin_helper

* chore: fix lint

Co-authored-by: Robo <hop2deep@gmail.com>
2025-08-10 21:46:37 +02:00
Calvin
4fff74b73e
chore: move gin::DeprecatedWrappable to gin_helper (#47996)
chore: move gin::DeprecatedWrappable to gin_helper (#47958)

* chore: move gin::DeprecatedWrappable to gin_helper

This is in preparation for migrating to gin::Wrappable
based on cppgc #47922
The upstream class will be deleted soon via roller PR but
the cppgc migration should happen outside the roll, this
change retains the current functionality by copying the
implementation into //electron/shell/common/gin_helper.
The class can be deleted once the cppgc migration is complete.

* chore: fix lint:cpp

Co-authored-by: Robo <hop2deep@gmail.com>
2025-08-09 13:00:45 +09:00
trop[bot]
e1e12318e2
refactor: avoid deprecated v8::Context::GetIsolate() calls (pt 2) (#47896)
* refactor: add a v8::Isolate* arg to Constructible::GetConstructor()

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* refactor: add a v8::Isolate* arg to NodeBindings::Initialize()

This is needed for the GetConstructor() call

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* refactor: avoid v8::Context::GetIsolate() call in GetIpcObject() by taking it as an arg

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* refactor: avoid v8::Context::GetIsolate() call in ipc_native::EmitIPCEvent() by taking it as an arg

Co-authored-by: Charles Kerr <charles@charleskerr.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-07-29 10:34:18 -04:00
trop[bot]
124bfd25f8
chore: bump chromium to 140.0.7301.0 (38-x-y) (#47849)
* chore: bump chromium in DEPS to 140.0.7296.0

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>

* chore: update patches

Co-authored-by: Keeley Hammond <khammond@slack-corp.com>

* 6702959: Remove OwnedByWidgetPassKey usage from content analysis dialog tests | https://chromium-review.googlesource.com/c/chromium/src/+/6702959

Co-authored-by: Keeley Hammond <khammond@slack-corp.com>

* 6722750: Remove un-used `stream_id` argument for `AidaCodeComplete` | https://chromium-review.googlesource.com/c/chromium/src/+/6722750

Co-authored-by: Keeley Hammond <khammond@slack-corp.com>

* 6696478: Reland Reland [video pip] Add fade in/out animation to controls visibility changes | https://chromium-review.googlesource.com/c/chromium/src/+/6696478

Co-authored-by: Keeley Hammond <vertedinde@electronjs.org>

* chore: update libc++-filenames

Co-authored-by: Keeley Hammond <vertedinde@electronjs.org>

* build: explicitly include cstdlib in Boyer-Moore patch

Co-authored-by: Keeley Hammond <vertedinde@electronjs.org>

* chore: bump chromium in DEPS to 140.0.7297.0

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>

* chore: update patches

Co-authored-by: Keeley Hammond <khammond@slack-corp.com>

* 6729537: [FPF] Pipe flag state from the browser to the renderer | https://chromium-review.googlesource.com/c/chromium/src/+/6729537

Co-authored-by: Keeley Hammond <khammond@slack-corp.com>

* 6727996: [Win] Detect pre-IPC crashes in sandboxed utility processes | https://chromium-review.googlesource.com/c/chromium/src/+/6727996

Co-authored-by: Keeley Hammond <khammond@slack-corp.com>

* 6707182: Move wtf/cross_thread_copier*.* to "blink" namespace | https://chromium-review.googlesource.com/c/chromium/src/+/6707182

Co-authored-by: Keeley Hammond <khammond@slack-corp.com>

* 6730796: extensions: Extract safe browsing/telemetry methods to new client class | https://chromium-review.googlesource.com/c/chromium/src/+/6730796

Co-authored-by: Keeley Hammond <khammond@slack-corp.com>

* chore: bump chromium in DEPS to 140.0.7299.0

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>

* chore: update patches

Co-authored-by: patchup[bot] <73610968+patchup[bot]@users.noreply.github.com>

* chore: update main patches

Co-authored-by: Keeley Hammond <khammond@slack-corp.com>

* build: reset the minimum macOS SDK to 15 to match upstream

This reverts commit 499e987c77.

Co-authored-by: Keeley Hammond <khammond@slack-corp.com>

* 6730215: Remove IPC_MESSAGE_LOG_ENABLED ifdef blocks. | https://chromium-review.googlesource.com/c/chromium/src/+/6730215

Co-authored-by: Keeley Hammond <khammond@slack-corp.com>

* 6690442: Delete ppapi/buildflags/buildflags.h | https://chromium-review.googlesource.com/c/chromium/src/+/6690442

Co-authored-by: Keeley Hammond <khammond@slack-corp.com>

* 6667681: Use more binaries from clang toolchain in mac build | https://chromium-review.googlesource.com/c/chromium/src/+/6667681

Co-authored-by: Keeley Hammond <khammond@slack-corp.com>

* chore: bump chromium in DEPS to 140.0.7301.0

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>

* chore: update patches

Co-authored-by: Keeley Hammond <khammond@slack-corp.com>

* 6656309: extensions: Port proxy API to desktop Android | https://chromium-review.googlesource.com/c/chromium/src/+/6656309

Co-authored-by: Keeley Hammond <khammond@slack-corp.com>

* 6758510: Reland 'Move GN enable_plugins variable out of //ppapi' | https://chromium-review.googlesource.com/c/chromium/src/+/6758510

Co-authored-by: Keeley Hammond <khammond@slack-corp.com>

* 6701466: [Extensions] Remove NaCl arch info from Update Client URLs | https://chromium-review.googlesource.com/c/chromium/src/+/6701466

Co-authored-by: Keeley Hammond <khammond@slack-corp.com>

* 6735979: [FSA] Replace `request_writable` with a new enum `FileSystemAccessPermissionMode`. | https://chromium-review.googlesource.com/c/chromium/src/+/6735979

Co-authored-by: Keeley Hammond <khammond@slack-corp.com>

* 6712080: Reland "Turn on gender translation PAK generation everywhere" | https://chromium-review.googlesource.com/c/chromium/src/+/6712080

Co-authored-by: Keeley Hammond <khammond@slack-corp.com>

* 6730796: extensions: Extract safe browsing/telemetry methods to new client class | https://chromium-review.googlesource.com/c/chromium/src/+/6730796

Co-authored-by: Keeley Hammond <khammond@slack-corp.com>

* build: restore minimum macOS SDK to 10, restore patch

This reverts commit a04c579b994d5f4a782b793a69f34ff7a260e74f.

Co-authored-by: Keeley Hammond <khammond@slack-corp.com>

* fixup! 6701466: [Extensions] Remove NaCl arch info from Update Client URLs | https://chromium-review.googlesource.com/c/chromium/src/+/6701466

Co-authored-by: Keeley Hammond <khammond@slack-corp.com>

* chore: correct node patches

Co-authored-by: Keeley Hammond <vertedinde@electronjs.org>

* fixup! 6667681: Use more binaries from clang toolchain in mac build | https://chromium-review.googlesource.com/c/chromium/src/+/6667681

Co-authored-by: Keeley Hammond <vertedinde@electronjs.org>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Keeley Hammond <khammond@slack-corp.com>
Co-authored-by: Keeley Hammond <vertedinde@electronjs.org>
Co-authored-by: patchup[bot] <73610968+patchup[bot]@users.noreply.github.com>
2025-07-21 11:55:08 -07:00
trop[bot]
d426b92326
refactor: avoid deprecated v8::Context::GetIsolate() calls (pt 1) (#47843)
* refactor: avoid redundant GetIsolate() calls in NodeBindings::CreateEnvironment()

Xref: https://chromium-review.googlesource.com/c/v8/v8/+/6563615

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* refactor: use v8::Isolate::GetCurrent() in Initialize() methods

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* refactor: add v8::Isolate* arg to NodeBindings::CreateEnvironment()

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* fixup! refactor: use v8::Isolate::GetCurrent() in Initialize() methods

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* refactor: add v8::Isolate* arg to RendererClientBase::DidCreateScriptContext()

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* fixup! refactor: add v8::Isolate* arg to NodeBindings::CreateEnvironment()

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* fixup! fixup! refactor: use v8::Isolate::GetCurrent() in Initialize() methods

refactor: prefer JavascriptEnvironment::GetIsolate() in the browser layer

Co-authored-by: Charles Kerr <charles@charleskerr.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-07-21 13:12:24 -04:00
electron-roller[bot]
2783f76f1f
chore: bump chromium to 140.0.7281.0 (38-x-y) (#47559)
* chore: bump chromium in DEPS to 139.0.7258.6

* chore: bump chromium in DEPS to 139.0.7258.5

* chore: bump chromium in DEPS to 140.0.7270.1

* chore: bump chromium in DEPS to 140.0.7271.1

* chore: bump chromium in DEPS to 140.0.7273.0

* chore: bump chromium in DEPS to 140.0.7273.1

* chore: bump chromium in DEPS to 140.0.7275.1

* chore: bump chromium in DEPS to 140.0.7275.4

* chore: bump chromium in DEPS to 140.0.7277.1

* chore: bump chromium in DEPS to 140.0.7279.1

* chore: bump chromium in DEPS to 140.0.7281.1

* chore: bump chromium in DEPS to 140.0.7283.1

* chore: bump chromium in DEPS to 140.0.7285.1

* chore: bump chromium in DEPS to 140.0.7287.1

* chore: bump chromium in DEPS to 140.0.7289.0

* chore: bump chromium in DEPS to 140.0.7289.1

* chore: bump chromium in DEPS to 140.0.7291.1

* chore: bump chromium in DEPS to 140.0.7293.1

* chore: bump chromium in DEPS to 140.0.7295.1

* chore: bump chromium in DEPS to 140.0.7296.0

* chore: bump chromium to 140.0.7281.0 (main) (#47616)

cherry picked from 603cafad7e

* chore: bump chromium in DEPS to 140.0.7269.2

* chore: bump chromium in DEPS to 140.0.7270.0

* chore: bump chromium in DEPS to 140.0.7271.0

* chore: bump chromium in DEPS to 140.0.7273.0

* 6516731: [ExclusiveAccessForAndroid] remove unneeded includes & deps | https://chromium-review.googlesource.com/c/chromium/src/+/6516731

* 6694809: dbus: Ensure systemd scope is started before using any portal services | https://chromium-review.googlesource.com/c/chromium/src/+/6694809

* chore: patch chromium

* chore: export patches

* chore: bump chromium in DEPS to 140.0.7275.0

* 6677511: [pepper] More pepper removal | https://chromium-review.googlesource.com/c/chromium/src/+/6677511

* 6513641: [gin] Rename gin::Wrappable to gin::DeprecatedWrappable | https://chromium-review.googlesource.com/c/chromium/src/+/6513641

* chore: export chromium patches

* 6513641: [gin] Rename gin::Wrappable to gin::DeprecatedWrappable | https://chromium-review.googlesource.com/c/chromium/src/+/6513641

* chore: bump chromium in DEPS to 140.0.7277.0

* chore: bump chromium in DEPS to 140.0.7279.0

* chore: bump chromium in DEPS to 140.0.7281.0

* 6677314: Plumb enabled client hints in the network requestion to network layer

https://chromium-review.googlesource.com/c/chromium/src/+/6677314

* 6351556: [source-phase-imports] Support Wasm Source Phase Imports

https://chromium-review.googlesource.com/c/chromium/src/+/6351556

* 6700077: [renderer] Avoid calls to deprecated GetIsolate methods

https://chromium-review.googlesource.com/c/chromium/src/+/6700077

* 6692873: Reland "Reland "FSA: Only normalize the hardcoded rules once during initialization""

https://chromium-review.googlesource.com/c/chromium/src/+/6692873

* 6686234: [gin] Cleanup NamedPropertyInterceptor for Wrappable

https://chromium-review.googlesource.com/c/chromium/src/+/6686234

* chore: export patches

* 6667723: Remove content_enable_legacy_ipc GN arg.

https://chromium-review.googlesource.com/c/chromium/src/+/6667723

* 6646566: ui: Move NativeWindowTracker to its own directory

https://chromium-review.googlesource.com/c/chromium/src/+/6646566

* fix: add missing includes

* 6580522: [WAR, DNR] Fix unsafe redirect error to web accessible resource

https://chromium-review.googlesource.com/c/chromium/src/+/6580522

* 6680477: Implement `completeCode` endpoint and expose to DevTools

https://chromium-review.googlesource.com/c/chromium/src/+/6680477

* 6677511: [pepper] More pepper removal

https://chromium-review.googlesource.com/c/chromium/src/+/6677511

* 6696689: Rename views::WidgetFocusManager -> NativeViewFocusManager

https://chromium-review.googlesource.com/c/chromium/src/+/6696689

* 6702812: Move wtf/text/string_impl*.* to "blink" namespace

https://chromium-review.googlesource.com/c/chromium/src/+/6702812

* chore: fix dialog patch

* 6702431: [animation-trigger] Parse timeline-trigger-name

https://chromium-review.googlesource.com/c/chromium/src/+/6702431

* chore: fixup patch indices

* feat: replace webFrame.routingId with webFrame.frameToken

* feat: WebFrameMain.prototype.frameToken

* test: refactor to use replacement APIs

* chore: fixup pip patch

* test: adjust webFrame tests for frameToken changes

* 6703757: Reland "Enable -fsanitize=array-bounds in non-UBSan builds"

https://chromium-review.googlesource.com/c/chromium/src/+/6703757

* test: switch to frameTokens

* test: routingId is fine to test in the main process

* docs: add routingId to breaking changes

* docs: update plugin-crashed event

* chore: fixup linux dialog patch

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: alice <alice@makenotion.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>
(cherry picked from commit 603cafad7e)

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: alice <alice@makenotion.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>
2025-07-15 12:05:29 -04:00
Robo
626895848e
fix: utilityProcess running user script after process.exit is called (#47469)
* fix: utilityProcess running user script after process.exit is called

* docs: update breaking changes

* chore: update spec

* chore: update spec/api-utility-process-spec.ts

Co-authored-by: David Sanders <dsanders11@ucsbalum.com>

* chore: remove interface bound checks

---------

Co-authored-by: Niklas Wenzel <dev@nikwen.de>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2025-06-18 04:36:22 +09:00
Shelley Vohr
c2ae4afb8f
fix: destroy parent port backend when JS env exits (#46437)
* fix: destroy parent port backend when JS env exits

* fix: close parent port before destroying

---------

Co-authored-by: deepak1556 <hop2deep@gmail.com>
2025-04-04 11:02:54 -05:00
Shelley Vohr
c0e180758b
fix: don't crash Utility Processes on unhandled rejections (#45921)
* fix: don't crash on unhandled rejections

* Update docs/breaking-changes.md

Co-authored-by: Niklas Wenzel <dev@nikwen.de>

---------

Co-authored-by: Niklas Wenzel <dev@nikwen.de>
2025-03-14 09:09:02 -05:00
Charles Kerr
c813bc2a92
refactor: use private inheritance from mojo::MessageReceiver (#45973)
* refactor: make UtilityProcessWrapper inherit privately from mojo::MessageReceiver

* refactor: make ParentPort inherit privately from mojo::MessageReceiver

* refactor: make MessagePort inherit privately from mojo::MessageReceiver
2025-03-12 19:06:41 +01:00
Robo
137a552641
fix: support for v8.setHeapSnapshotNearHeapLimit api (#45606)
* fix: support for v8.setHeapSnapshotNearHeapLimit api

* docs: add  support
2025-02-14 10:00:39 -06:00
Charles Kerr
566c72cd46
fix: -Wunsafe-buffer-usage warning in ChunkedDataPipeReadableStream (#44211)
* chore: rename v8_value_serializer.cc,h to v8_util.cc,h

* feat: add electron::util::as_byte_span(v8::Local<v8::ArrayBuffer>)

* fix: -Wunsafe-buffer-usage warnings in ChunkedDataPipeReadableStream::ReadInternal()

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5619253

* refactor: restore node buffer span util

* refactor: remove redundant span wrapper
2024-10-14 10:46:24 +02:00
Robo
f68184a9f9
feat: add error event for utility process (#43774)
* feat: add error event for utility process

* chore: use public report api

* chore: fix lint

* doc: mark error event as experimental

---------

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2024-09-27 10:17:06 +09:00
Charles Kerr
8ae5aacc8c
refactor: declare gin::Wrapper subclasses as final (#43527)
As per the gin docs: "Wrappable<T> explicitly does not support further
subclassing of T. Subclasses of Wrappable<T> should be declared final."
2024-09-04 18:40:02 -05:00
Robo
9b166b3ed4
feat: support app#login event for utility process net requests (#42631)
* feat: support app#login event for utility process net requests

* chore: address review feedback

* GlobalRequestID: Avoid unwanted inlining and narrowing int conversions

Refs https://chromium-review.googlesource.com/c/chromium/src/+/5702737
2024-08-14 11:36:47 +09:00
Charles Kerr
aa23198ad8
chore: remove more unused #include calls (#43000)
* chore: in shell/renderer/renderer_client_base.h, remove include media/base/key_systems_support_registration.h

last use removed in c670e38b (##41610)

* chore: iwyu electron/fuses.h

* chore: iwyu media/base/video_frame.h

* chore: iwyu base/functional/callback.h

* chore: iwyu base/task/cancelable_task_tracker.h

* chore: iwyu shell/browser/draggable_region_provider.h

* chore: iwyu shell/browser/ui/inspectable_web_contents_view.h

* chore: iwyu ui/aura/window.h

* chore: iwyu ui/base/win/shell.h

* chore: iwyu ui/display/win/screen_win.h

* chore: iwyu ui/gfx/geometry/insets.h

* chore: iwyu ui/display/display.h

* chore: iwyu ui/gfx/geometry/skia_conversions.h

* chore: iwyu ui/gfx/geometry/rect_conversions.h

* chore: iwyu ui/gfx/geometry/point.h

* chore: iwyu ui/gfx/scoped_canvas.h

* chore: iwyu ui/gfx/image/image.h

* chore: iwyu ui/accessibility/ax_node_data.h

* chore: iwyu ui/views/animation/ink_drop_highlight.h

* chore: iwyu ui/gfx/font_list.h

* chore: iwyu ui/linux/nav_button_provider.h

* chore: iwyu shell/browser/ui/views/frameless_view.h

* chore: iwyu services/metrics/public/cpp/ukm_source_id.h

* chore: iwyu net/http/http_util.h

* chore: iwyu net/base/mime_util.h

* chore: iwyu content/public/common/content_client.h

* chore: iwyu <list>

* chore: iwyu <optional>

* chore: iwyu <memory>

* chore: iwyu base/files/file_path.h

* chore: iwyu ui/base/cursor/cursor.h

* chore: iwyu build/build_config.h

* chore: iwyu content/public/browser/web_contents.h

* chore: iwyu shell/browser/hid/hid_chooser_context.h

* chore: iwyu shell/common/platform_util.h

* chore: iwyu base/task/single_thread_task_runner.h

* chore: iwyu content/browser/renderer_host/render_widget_host_impl.h

* chore: iwyu content/public/browser/render_widget_host.h

* chore: iwyu shell/browser/electron_browser_context.h

* chore: iwyu content/public/browser/web_contents_observer.h

* chore: iwyu content/public/browser/render_frame_host.h

* chore: iwyu content/public/browser/media_stream_request.h

* chore: iwyu chrome/common/chrome_paths.h

* chore: iwyu chrome/browser/icon_manager.h

* chore: iwyu printing/print_settings.h

* chore: iwyu renderer/pepper_helper.h

* chore: iwyu shell/browser/api/process_metric.h

* chore: iwyu shell/browser/electron_browser_client.h

* chore: iwyu shell/browser/electron_browser_context.h

* chore: iwyu shell/browser/api/electron_api_session.h

* chore: iwyu shell/browser/api/electron_api_app.h

* chore: iwyu shell/browser/ui/views/client_frame_view_linux.h

* chore: iwyu shell/browser/native_window_views.h

* chore: iwyu base/win/windows_version.h

* chore: iwyu shell/common/electron_paths.h

* chore: iwyu content/public/common/content_switches.h

* chore: iwyu third_party/skia/include/core/SkRRect.h

* chore: iwyu third_party/skia/include/core/SkBitmap.h

* chore: iwyu third_party/skia

* chore: iwyu shell/browser/osr/osr_host_display_client.h

* chore: iwyu shell/browser/login_handler.h

* chore: iwyu shell/browser/javascript_environment.h

* chore: iwyu shell/browser/event_emitter_mixin.h

* fix: mac

* fix: mac

* chore: iwyu base/nix/xdg_util.h

* fix: win

* fix: win

* fix: win

* fix: win
2024-07-25 11:25:45 +02:00
Shelley Vohr
8e8ea3ee8b
fix: MessagePort closing unexpectedly with non-cloneable objects (#42535)
* fix: MessagePort closing unexpectedly with non-cloneable objects

* fix: handle serialization failure in parentPort
2024-06-19 11:27:07 +02:00
Shelley Vohr
7f3dc7d4ce
fix: utilityProcess exit codes (#42297) 2024-06-07 10:06:00 +02:00
Shelley Vohr
4ded4d16a8
fix: destroy NodeService message pipe last (#41277)
refactor: destroy NodeService message pipe last
2024-02-09 22:44:35 +01:00
Devraj Mehta
8c71e2adc9
feat: add net module to utility process (#40017)
* chore: initial prototype of net api from utility process

* chore: update url loader to work on both browser and utility processes

* chore: add net files to utility process bundle

* chore: re-add app ready check but only on main process

* chore: replace browser thread dcheck's with sequence checker

* refactor: move url loader from browser to common

* refactor: move net-client-request.ts from browser to common

* docs: add utility process to net api docs

* refactor: move net module app ready check to browser only

* refactor: switch import from main to common after moving to common

* test: add basic net module test for utility process

* refactor: switch browser pid with utility pid

* refactor: move electron_api_net from browser to common

* chore: add fetch to utility net module

* chore: add isOnline and online to utility net module

* refactor: move net spec helpers into helper file

* refactor: break apart net module tests

Adds two additional net module test files: `api-net-session-spec.ts` for
tests that depend on a session being available (aka depend on running on
the main process) and `api-net-custom-protocols-spec.ts` for custom
protocol tests. This enables running `api-net-spec.ts` in the utility
process.

* test: add utility process mocha runner to run net module tests

* docs: add utility process to net module classes

* refactor: update imports in lib/utility to use electron/utility

* chore: check browser context before using in main process

Since the browser context supplied to the SimpleURLLoaderWrapper can now
be null for use in the UtilityProcess, adding a null check for the main
process before use to get a more sensible error if something goes wrong.

Co-authored-by: Cheng Zhao <github@zcbenz.com>

* chore: remove test debugging

* chore: remove unnecessary header include

* docs: add utility process net module limitations

* test: run net module tests in utility process individually

* refactor: clean up prior utility process net tests

* chore: add resolveHost to utility process net module

* chore: replace resolve host dcheck with sequence checker

* test: add net module tests for net.resolveHost

* docs: remove utility process limitation for resolveHost

---------

Co-authored-by: deepak1556 <hop2deep@gmail.com>
Co-authored-by: Cheng Zhao <github@zcbenz.com>
2024-01-04 16:20:37 -05:00
David Sanders
cf5f0419f1
chore: fix some typos (#40506) 2023-11-12 19:51:56 -08:00
Charles Kerr
a1c44a18e2
fix: NodeService order-of-destruction issue (#39783)
* refactor: make ElectronRendererClient::node_bindings_ a const ptr

refactor: make ElectronRendererClient::electron_bindings_ a const ptr

* fix: order-of-destruction bug in NodeService

js_env_ depends on the uv_loop from node_bindings_, but is destroyed after node_bindings_

* chore: revert unintentional commit
2023-09-12 12:27:14 +02:00
Charles Kerr
35969939a1
refactor: node::Environment self-cleanup (#39604)
* chore: savepoint

* chore: turn raw_ptr tests back off
2023-08-23 09:56:16 -04:00
Charles Kerr
5ad8b4b7d1
chore: remove unused std includes (#38767) 2023-06-14 11:07:18 -07:00
electron-roller[bot]
de192c2db2
chore: bump node to v18.16.0 (main) (#37973)
* chore: bump node in DEPS to v18.16.0

* build,test: add proper support for IBM i

https://github.com/nodejs/node/pull/46739

* lib: enforce use of trailing commas

https://github.com/nodejs/node/pull/46881

* src: add initial support for single executable applications

https://github.com/nodejs/node/pull/45038

* lib: do not crash using workers with disabled shared array buffers

https://github.com/nodejs/node/pull/41023

* src: remove shadowed variable in OptionsParser::Parse

https://github.com/nodejs/node/pull/46672

* src: allow embedder control of code generation policy

https://github.com/nodejs/node/pull/46368

* src: allow optional Isolate termination in node::Stop()

https://github.com/nodejs/node/pull/46583

* lib: fix BroadcastChannel initialization location

https://github.com/nodejs/node/pull/46864

* chore: fixup patch indices

* chore: sync filenames.json

* fix: add simdutf dep to src/inspector BUILD.gn

- https://github.com/nodejs/node/pull/46471
- https://github.com/nodejs/node/pull/46472

* deps: replace url parser with Ada

https://github.com/nodejs/node/pull/46410

* tls: support automatic DHE

https://github.com/nodejs/node/pull/46978

* fixup! src: add initial support for single executable applications

* http: unify header treatment

https://github.com/nodejs/node/pull/46528

* fix: libc++ buffer overflow in string_view ctor

https://github.com/nodejs/node/pull/46410

* test: include strace openat test

https://github.com/nodejs/node/pull/46150

* fixup! fixup! src: add initial support for single executable applications

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-04-18 22:23:11 +02:00
Shelley Vohr
6395898a79
refactor: use associated v8::Context for event setup (#37355)
refactor: use associated v8::Context for event setup
2023-02-22 10:03:46 +01:00
Shelley Vohr
478ce96914
fix: avoid using v8 on Isolate termination (#35766)
* fix: avoid using v8 on Isolate termination

* chore: refactor for review

---------

Co-authored-by: electron-patch-conflict-fixer[bot] <83340002+electron-patch-conflict-fixer[bot]@users.noreply.github.com>
2023-02-09 09:48:49 +01:00
Milan Burda
35a9e67dba
chore: rename built-in modules to bindings to match naming update in node (#37182) 2023-02-09 10:31:38 +09:00
electron-roller[bot]
d02c9f8bc6
chore: bump chromium to 111.0.5544.3 (main) (#36820)
* chore: bump chromium in DEPS to 111.0.5522.0

* chore: bump chromium in DEPS to 111.0.5524.0

* chore: bump chromium in DEPS to 111.0.5526.0

* chore: bump chromium in DEPS to 111.0.5528.0

* chore: update patches/chromium/mas_avoid_usage_of_private_macos_apis.patch

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4132807

Fix simple code shear

* chore: update patches/chromium/unsandboxed_ppapi_processes_skip_zygote.patch

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4130675

Fix simple code shear

* chore: update patches/chromium/hack_plugin_response_interceptor_to_point_to_electron.patch

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4144281

Fix simple code shear; applied cleanly w/patch-fuzz

* chore: update patches/chromium/disable_unload_metrics.patch

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4126173

Fix simple code shear; applied cleanly w/patch-fuzz

* chore: update patches/chromium/feat_add_data_parameter_to_processsingleton.patch

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4144281

Fix simple code shear; applied cleanly w/patch-fuzz

* chore: update patches/chromium/preconnect_manager.patch

https://chromium-review.googlesource.com/c/chromium/src/+/4144281

Fix simple code shear; applied cleanly w/patch-fuzz

* chore: update patches/v8/force_cppheapcreateparams_to_be_noncopyable.patch

https://chromium-review.googlesource.com/c/v8/v8/+/3533019

Fix simple code shear; applied cleanly w/patch-fuzz

* chore: update patches

* chore: update patches/chromium/add_maximized_parameter_to_linuxui_getwindowframeprovider.patch

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4128765

Upstream added a new call to HeaderContext(), whose signature we have patched

* chore: bump chromium in DEPS to 111.0.5530.0

* chore: update patches

* Move ChildProcessHost* from content/common to content/browser

Xref: Move ChildProcessHost* from content/common to content/browser

* Remove RenderViewHostChanged

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4134103
[upstream removal of RenderViewHostChanged]

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4092763
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4093234
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4133892
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4134103
[examples of upstream code adjusting to the change]

Upstream handles this change in roughly two approaches:

1. Move the code over to RenderFrameHostChanged(old_host, new_host)
   but test for new_host->IsInPrimaryMainFrame() before acting

2. Migrate to the PrimaryPageChanged(page) API and use
   page.GetMainDocument() to get the RenderFrameHost.

I've chosen 1. because electron_api_web_contents needed that pointer
to old_host to call RemoveInputEventListener(), but I may be missing
some context & would appreciate review on this commit.

* Make electron/shell/browser/relauncher_win.cc use <winternl.h>

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4129135

Many internal Windows types are now available in winternl.h
so upstrem no longer defines the types themselves.

* Move ChildProcessHost* from content/common to content/browser

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4134795

* fixup! Make electron/shell/browser/relauncher_win.cc use <winternl.h>

winternl.h does not define the field we need, so clone the struct Chromium was using into unnamed namespace

* fixup! Move ChildProcessHost* from content/common to content/browser

chore: update #includes too

* chore: bump chromium in DEPS to 111.0.5532.0

* chore: sync patches/chromium/pepper_plugin_support.patch

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4133323

manually reync patch; no code changes

* chore: sync patches/chromium/mas_no_private_api.patch

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4143865

the content/common/pseudonymization_salt.cc patch is no longer needed

* chore: sync patches/chromium/mas_disable_remote_accessibility.patch

patch-fuzz update; no manual changes

* chore: sync patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4111725

manually reync patch; no code changes

* chore: sync patches/chromium/create_browser_v8_snapshot_file_name_fuse.patch

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4133323

manually reync patch; no code changes

* chore: sync patches/v8/fix_build_deprecated_attribute_for_older_msvc_versions.patch

Xref: https://chromium-review.googlesource.com/c/v8/v8/+/4127230

patch-fuzz update; no manual changes

* chore: rebuild patches

* fixup! Remove RenderViewHostChanged

Use PrimaryPageChanged()

* chore: remove unused method TabsUpdateFunction::OnExecuteCodeFinished()

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4133991

This private, already-unused function showed up as a FTBFS because it
took a base::ListValue parameter and ListValue was removed upstream.

* task posting v3: remove includes of runner handles and IWYU task runners

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4133323

* chore: lint

* chore: more lint

* fixup! task posting v3: remove includes of runner handles and IWYU task runners

macOS, too

* fixup! task posting v3: remove includes of runner handles and IWYU task runners

* chore: bump chromium in DEPS to 111.0.5534.0

* chore: sync patches/chromium/allow_new_privileges_in_unsandboxed_child_processes.patch

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4141862

patch-fuzz update; no manual changes

* chore: sync patches/chromium/logging_win32_only_create_a_console_if_logging_to_stderr.patch

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4153110

Sync to minor upstream changes. Add const correctness.

* chore: sync electron/patches/chromium/feat_configure_launch_options_for_service_process.patch

https://chromium-review.googlesource.com/c/chromium/src/+/4141862

patch-fuzz update; no manual changes

* chore: patches/v8/fix_build_deprecated_attribute_for_older_msvc_versions.patch

sync https://chromium-review.googlesource.com/c/v8/v8/+/4147787

patch-fuzz update; no manual changes

* chore: update patches

* chore: bump chromium in DEPS to 111.0.5536.0

* chore: sync patches/chromium/allow_new_privileges_in_unsandboxed_child_processes.patch

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4141863

Sync with upstream code changes. Minor code golf for readability.

Note: upstream is laying groundwork for being able to work off of env vars
instead of switches. Doesn't affect us yet but worth being aware of.

> + // Environment variables could be supported in the future, but are not
> + // currently supported when launching with the zygote.

* chore: update patches/chromium/feat_expose_raw_response_headers_from_urlloader.patch

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4126836

patch-fuzz update; no manual changes

* chore: sync electron/patches/chromium/feat_configure_launch_options_for_service_process.patch

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4141863

manual sync

* chore: sync electron/patches/v8/fix_build_deprecated_attribute_for_older_msvc_versions.patch

https://chromium-review.googlesource.com/c/v8/v8/+/4147788

fuzz-patch

* chore: rebuild patches

* chore: bump chromium in DEPS to 111.0.5538.0

* chore: bump chromium in DEPS to 111.0.5540.0

* chore: update patches

* Remove sdk_forward_declarations

https://chromium-review.googlesource.com/c/chromium/src/+/4166680

* task posting v3: Remove task runner handles from codebase entirely

Refs https://chromium-review.googlesource.com/c/chromium/src/+/4150928

* Cleanup child_process_launcher_helper*

Refs https://chromium-review.googlesource.com/c/chromium/src/+/4141863

* fix: utilityprocess spec on macOS

* fix: build on windows

Refs https://chromium-review.googlesource.com/c/chromium/src/+/4141863

* chore: fix lint

* chore: bump chromium 111.0.5544.3

* chore: gen filenames.libcxx.gni

* Add check for Executable+Writable handles in renderer processes.

Refs https://chromium-review.googlesource.com/c/chromium/src/+/3774416

* fixup! Add check for Executable+Writable handles in renderer processes.

* 4143761: [110] Disable SwiftShader for WebGL on M1 Macs.

https://chromium-review.googlesource.com/c/chromium/src/+/4143761
(cherry picked from commit 2f74db3c2139424c416f92d9169aeaa8a2f9c1ec)

* chore: bump chromium to 111.0.5555.0

* 56085: Remove hmac.h include from ssl.h.

https://boringssl-review.googlesource.com/c/boringssl/+/56085

* 4167020: Remove forwarding headers

https://chromium-review.googlesource.com/c/chromium/src/+/4167020

* chore: bump chromium to 111.0.5559.0

* 4181044: Restrict WebCursor usage to RenderWidgetHostViewAura

https://chromium-review.googlesource.com/c/chromium/src/+/4181044

* 4189437: views: rename ink_drop_host_view to ink_drop_host

https://chromium-review.googlesource.com/c/chromium/src/+/4189437

* chore: bump chromium to 111.0.5560.0

* 4167016: win7dep: remove non aeroglass code

https://chromium-review.googlesource.com/c/chromium/src/+/4167016

* fixup after rebase: Remove forwarding header

s https://chromium-review.googlesource.com/c/chromium/src/+/4167020

* 4125755: Reland "Reject getDisplayMedia calls without user activation"

https://chromium-review.googlesource.com/c/chromium/src/+/4125755

* test: add workaround

* chore: update patches

* fix: alter coreModuleRegExp to prevent arm crash

* Revert "fix: alter coreModuleRegExp to prevent arm crash"

This reverts commit 7e50630c98137831a711c5abdbc8809e60cf1d73.

* 4218354: Disable the use of preserve_most on arm64 Windows

https://chromium-review.googlesource.com/c/v8/v8/+/4218354

* chore: review changes

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-02-03 12:43:42 +01:00
Robo
da0fd286b4
feat: UtilityProcess API (#34980)
* chore: initial scaffolding

* chore: implement interface and docs

* chore: address code style review

* fix: cleanup of utility process on shutdown

* chore: simplify NodeBindings::CreateEnvironment

* chore: rename disableLibraryValidation => allowLoadingUnsignedLibraries

* chore: implement process.parentPort

* chore(posix): implement stdio pipe interface

* chore(win): implement stdio interface

* chore: reenable SetNodeOptions for utility process

* chore: add specs

* chore: fix lint

* fix: update kill API

* fix: update process.parentPort API

* fix: exit event

* docs: update exit event

* fix: tests on linux

* chore: expand on some comments

* fix: shutdown of pipe reader

Avoid logging since it is always the case that reader end of
pipe will terminate after the child process.

* fix: remove exit code check for crash spec

* fix: rm PR_SET_NO_NEW_PRIVS for unsandbox utility process

* chore: fix incorrect rebase

* fix: address review feedback

* chore: rename utility_process -> utility

* chore: update docs

* chore: cleanup c++ implemantation

* fix: leak in NodeServiceHost impl

* chore: minor cleanup

* chore: cleanup JS implementation

* chore: flip default stdio to inherit

* fix: some api improvements

* Support cwd option
* Remove path restriction for modulePath
* Rewire impl for env support

* fix: add tests for cwd and env option

* chore: alt impl for reading stdio handles

* chore: support message queuing

* chore: fix lint

* chore: new UtilityProcess => utilityProcess.fork

* fix: support for uncaught exception exits

* chore: remove process.execArgv as default

* fix: windows build

* fix: style changes

* fix: docs and style changes

* chore: update patches

* spec: disable flaky test on win32 arm CI

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2022-10-19 22:49:49 -07:00