Compare commits

...

138 Commits

Author SHA1 Message Date
Keeley Hammond
63d1d9cb65 fix: SCContentSharingPicker crash in iframes (#44228)
fix: SCContentSharingPicker crash in iframes (#43905)

When running `getDisplayMedia` from an `iframe` and then destroying that
`iframe`, the destrutcor for ScreenCaptureKitDeviceMac gets run, but it
doesn't clean up the observers for the shared macOS picker.

In this change we remove the observer on cleanup and fix the associated
crash:

    *** Terminating app due to uncaught exception 'NSGenericException', reason: '*** Collection <__NSArrayM: 0x12c024123a0> was mutated while being enumerated.'
     0   CoreFoundation                      0x000000018eda0ec0 __exceptionPreprocess + 176
     1   libobjc.A.dylib                     0x000000018e886cd8 objc_exception_throw + 88
     2   CoreFoundation                      0x000000018ee47f80 -[__NSSingleObjectEnumerator init] + 0
     3   ScreenCaptureKit                    0x000000022971f3e0 -[SCContentSharingPicker contentPickerDidSelectFilter:forStream:] + 436
     4   ReplayKit                           0x00000001d7b879d8 -[RPScreenRecorder contentPickerDidSelectFilter:forStream:] + 84
     5   ReplayKit                           0x00000001d7b95ce0 -[RPDaemonProxy contentPickerDidSelectFilter:forStream:] + 224
     6   CoreFoundation                      0x000000018ed0e8b4 __invoking___ + 148
     7   CoreFoundation                      0x000000018ed0e72c -[NSInvocation invoke] + 428
     8   ReplayKit                           0x00000001d7b91678 -[RPDaemonProxy connection:handleInvocation:isReply:] + 316
     9   Foundation                          0x0000000190899f64 -[NSXPCConnection _decodeAndInvokeMessageWithEvent:reply:flags:] + 1108
     10  Foundation                          0x000000019089b7d0 message_handler_message + 88
     11  Foundation                          0x000000018feb0160 message_handler + 152
     12  libxpc.dylib                        0x000000018e954460 _xpc_connection_call_event_handler + 144
     13  libxpc.dylib                        0x000000018e952bb4 _xpc_connection_mach_event + 1120
     14  libdispatch.dylib                   0x000000018ea94718 _dispatch_client_callout4 + 20
     15  libdispatch.dylib                   0x000000018eab0c00 _dispatch_mach_msg_invoke + 464
     16  libdispatch.dylib                   0x000000018ea9bae8 _dispatch_lane_serial_drain + 368
     17  libdispatch.dylib                   0x000000018eab1954 _dispatch_mach_invoke + 456
     18  libdispatch.dylib                   0x000000018ea9bae8 _dispatch_lane_serial_drain + 368
     19  libdispatch.dylib                   0x000000018ea9c79c _dispatch_lane_invoke + 432
    20  libdispatch.dylib                   0x000000018eaa77e8 _dispatch_root_queue_drain_deferred_wlh + 288
    21  libdispatch.dylib                   0x000000018eaa7034 _dispatch_workloop_worker_thread + 540
    22  libsystem_pthread.dylib             0x000000018ec433d8 _pthread_wqthread + 288
    23  libsystem_pthread.dylib             0x000000018ec420f0 start_wqthread + 8

Co-authored-by: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com>
2024-10-14 13:51:20 -04:00
trop[bot]
dd5bce17cb docs: update timelines for E34 (#44225)
update dates for e34

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: George Xu <george.xu@slack-corp.com>
2024-10-14 13:51:06 -04:00
trop[bot]
258a4a76cf fix: -Wunsafe-buffer-usage warning in ChunkedDataPipeReadableStream (#44223)
* chore: rename v8_value_serializer.cc,h to v8_util.cc,h

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

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

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

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

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

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

* refactor: restore node buffer span util

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

* refactor: remove redundant span wrapper

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>
2024-10-14 11:37:40 -05:00
trop[bot]
f269ca1d93 test: fix visibility-state-spec.ts flaky test (#44199)
* test: refactor visibility-state-spec

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>

* ci: shard tests

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>

* test: update split-tests for use on Windows

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>

* test: run visibility-state-spec.ts first

Co-Authored-By: John Kleinschmidt <jkleinsc@electronjs.org>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2024-10-14 09:39:19 -04:00
trop[bot]
7887395e92 fix: -Wunsafe-buffer-usage warnings when read()ing and write()ing integers (#44208)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-10-11 18:31:27 -05:00
trop[bot]
9011532b2e fix: clang variable configuration in generated node headers (#44200)
* fix: clang variable configuration in generated node headers

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

* chore: restore value in common.gypi

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

* chore: update patches

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2024-10-11 12:25:42 -05:00
trop[bot]
afce3ce7c7 docs: clarify interplay between utility process events (#44203)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Niklas Wenzel <dev@nikwen.de>
2024-10-11 09:36:32 -05:00
trop[bot]
eb90fb3b9e ci: don't call datadog test logging on forks (#44193)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2024-10-11 09:43:24 -04:00
trop[bot]
6964b79e68 refactor: spanify image utils (#44178)
* refactor: electron::util::AddImageSkiaRepFromJPEG() takes a span arg

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

* refactor: electron::util::AddImageSkiaRepFromPNG() takes a span arg

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

* refactor: electron::util::AddImageSkiaRepFromBuffer() takes a span arg

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

* feat: add Node-buffer-to-base-span helper function

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

* refactor: electron::api::NativeImage::CreateFromPNG() now takes a span param

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

* refactor: electron::api::NativeImage::CreateFromJPEG() now takes a span param

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

* refactor: use base::as_byte_span()

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

* fix: -Wunsafe-buffer-usage warning in NativeImage::CreateFromNamedImage()

Warning fixed by this commit:

../../electron/shell/common/api/electron_api_native_image_mac.mm:131:11: error: function introduces unsafe buffer manipulation [-Werror,-Wunsafe-buffer-usage]
  131 |           {reinterpret_cast<const uint8_t*>((char*)[png_data bytes]),
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  132 |            [png_data length]});
      |            ~~~~~~~~~~~~~~~~~~
../../electron/shell/common/api/electron_api_native_image_mac.mm:131:11: note: See //docs/unsafe_buffers.md for help.

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

* chore: add // SAFETY comment for Node-buffer-to-span func

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

* chore: add // SAFETY comment for NSData-to-span func

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>
2024-10-10 13:24:26 -04:00
electron-roller[bot]
5bb1bb9b7a chore: bump chromium to 130.0.6723.44 (33-x-y) (#44177)
chore: bump chromium in DEPS to 130.0.6723.44

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
2024-10-10 12:07:44 -04:00
trop[bot]
78cb71f7b1 fix: -Wunsafe-buffer-usage warning in HasWordCharacters() (#44171)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-10-09 22:25:34 -05:00
trop[bot]
c9474ef5da fix: -Wunsafe-buffer-usage warning in WriteAsciiChunk() (#44169)
* fix: -Wunsafe-buffer-usage warning in WriteAsciiChunk()

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

* chore: add // SAFETY comment to explain UNSAFE_BUFFERS() use

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>
2024-10-09 19:05:24 -05:00
trop[bot]
5244fcecd3 fix: -Wunsafe-buffer-usage warnings in GetNextZoomLevel() (#44163)
fixup e8948397 really fix the warning this time

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-10-09 16:30:45 -05:00
trop[bot]
af5901bc6a ci: add datadog test logging (#44141)
* ci: add datadog test logging

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>

* ci: only upload to datadog when running tests

(cherry picked from commit c3200d8f15)

* Trigger CI

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2024-10-09 11:40:53 -04:00
trop[bot]
4e6e77d696 refactor: revert url::DomainIs() for cookie domains (#44154) 2024-10-08 20:34:55 -07:00
electron-roller[bot]
9469efb4c9 chore: bump node to v20.18.0 (33-x-y) (#44118)
* chore: bump node in DEPS to v20.18.0

* chore: update patches

(cherry picked from commit b108b649c2)

* src: improve buffer.transcode performance

https://github.com/nodejs/node/pull/54153
(cherry picked from commit 669984dafc)

* chore: update patches

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2024-10-08 11:21:56 -04:00
electron-roller[bot]
8cbe09d412 chore: bump chromium to 130.0.6723.31 (33-x-y) (#44111)
chore: bump chromium in DEPS to 130.0.6723.31

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
2024-10-03 16:05:06 -05:00
Samuel Attard
e9cb85bea6 build: add import/order eslint rule (#44106)
build: add import/order eslint rule (#44085)

* build: add import/order eslint rule

* chore: run lint:js --fix
2024-10-02 20:52:01 -07:00
trop[bot]
479caedc8a fix: remove use of deprecated API base::Hash() (#44103)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-10-02 19:14:02 -05:00
trop[bot]
86d86768b3 fix: deprecated API and -Wunsafe-buffer-usage warnings in AsarFileValidator (#44105)
* refactor: const correctness

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

* refactor: extract-method AsarFileValidator::EnsureHashExists()

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

* refactor: replace use of deprecated crypto API

https://crbug.com/364687923

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

* refactor: use span API in AsarFileValidator::OnRead()

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

* refactor: replace use of deprecated crypto API

https://crbug.com/364687923

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

* fixup! refactor: use span API in AsarFileValidator::OnRead()

fix: electron-ia32-testing FTBFS

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>
2024-10-02 19:13:34 -05:00
trop[bot]
bd0277923f build: fix relative file read during npm publish (#44089)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2024-10-01 17:14:02 -07:00
trop[bot]
dd8c3b8dd9 fix: -Wunsafe-buffer-usage warnings in ElectronAccessibilityUI ctor (#44074)
fix: -Wunsafe-buffer-usage warnings in ElectronAccessibilityUI constructor

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-10-01 16:14:46 -05:00
trop[bot]
6074f7ed31 build: cleanup release scripts, separate cli entrypoints from logic (#44082)
* build: cleanup release scripts, separate cli entrypoints from logic

Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>

* build: use repo/org constants

Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2024-10-01 14:08:15 -07:00
trop[bot]
7b14a305f8 perf: use ArrayBuffer::Data() instead of GetBackingStore()->Data() (#44073)
perf: use ArrayBuffer::Data() API

Replace our `GetBackingStore()->Data()` calls with this instead.
Explained by the V8 docs, ArrayBuffer.Data() is

> More efficient shortcut for GetBackingStore()->Data(). The
> returned pointer is valid as long as the ArrayBuffer is alive.

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-10-01 13:52:00 -05:00
trop[bot]
0646cbfba6 fix: -Wunsafe-buffer-usage warnings in WebFrameRenderer::ExecuteJavaScript() (#44075)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-10-01 13:51:06 -05:00
Samuel Attard
8af5c6d130 build: update some build dependencies (#44069)
* build: update some build dependencies (#43882)

* build: update some build dependencies

* build: fix eslint issues after updating

* build: disable ts check on busted js example

* build: update internal types for stricter event handling

* restore url.parse behavior

* fix typing issues

* sigh

* build: update easy deps

* build: skip woa engines check

* build: s/colors/chalk
2024-10-01 11:09:28 -07:00
dependabot[bot]
ac10ddaa48 build(deps): bump actions/checkout from 4.1.7 to 4.2.0 (#44040)
Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.7 to 4.2.0.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](692973e3d9...d632683dd7)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-01 11:16:20 -05:00
Samuel Attard
fc9cda72d2 build: convert all release scripts to typescript (#44059)
* build: convert all release scripts to typescript (#44035)

* build: convert all release scripts to typescript

* fix test imports

* build: fix version bumper export

* refactor: use as const

* spec: fix bad type spec

* build: use ts-node to spawn the version-bumper (#44057)

Missed this in the tsification, we should probably call this via API instead of spawning a sub-proc?

* build: still colors
2024-10-01 12:04:22 +02:00
dependabot[bot]
52a8d133cd build(deps): bump github/codeql-action from 3.26.8 to 3.26.10 (#44039)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.26.8 to 3.26.10.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](294a9d9291...e2b3eafc8d)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-30 17:22:50 -07:00
trop[bot]
e019b37231 fix: -Wunsafe-buffer-usage warnings in AddComponentResourceEntries() (#44031)
fix: -Wunsafe-buffer-usage warnings in ElectronComponentExtensionResourceManager::AddComponentResourceEntries()

just replace pointer-and-length args with a span

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-09-30 14:40:42 -05:00
trop[bot]
c8788f8217 fix: -Wunsafe-buffer-usage in electron::SetFontDefaults() (#44028)
* refactor: reduce code duplication in WebContentsPreferences::OverrideWebkitPrefs()

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

* refactor: limit scope of web_preferences temporary in ElectronBrowserClient::OverrideWebkitPrefs()

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

* chore: savepoint

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

* chore: savepoint

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

* chore: savepoint

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

* chore: savepoint

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

* chore: remove logging

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

* fix: unconditionally write

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

* chore: naming

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

* chore: add code comments

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

* chore: more code comments

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

* chore: remove unrelated changes

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

* chore: remove redundant static keyword on function in anonymous namespace

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

* refactor: naming

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

* refactor: naming

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

* refactor: naming

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

* refactor: slightly more explicit typing

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

* refactor: remove unnecessary utf16 -> utf8 -> utf16 conversion steps

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

* chore: remove unused #includes

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>
2024-09-30 11:59:24 -04:00
trop[bot]
4d16326b4d fix: FTBFS when building with enable_plugins = false (#44025)
* fix: do not build electron_plugin_info_host_impl.cc when plugins are disabled

it fails to build from source with this error:

../../content/public/browser/plugin_service.h:17:2: error: "Plugins should be enabled"
   17 | #error "Plugins should be enabled"

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

* fix: FTBFS in printing_utils.cc when ENABLE_PDF is false

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

* fixup! fix: do not build electron_plugin_info_host_impl.cc when plugins are disabled

fix BUILD.gn linting

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>
2024-09-30 06:23:18 -05:00
Charles Kerr
5836ea1a78 feat: add error event for utility process (33-x-y) (#43997)
* 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>

* fixup! feat: add error event for utility process (#43774)

remove #include "electron/mas.h"

this header did not exist before c1c8fbfd9

---------

Co-authored-by: Robo <hop2deep@gmail.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2024-09-29 17:12:15 -05:00
trop[bot]
d8cd86c4fa ci: write test logging to console on Windows (#44007)
test: write logging to console on Windows

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2024-09-29 09:55:09 +02:00
Charles Kerr
a44059aa05 fix: ensure correct WebContents when checking PDFReadyToPrint (33-x-y) (#43998)
* fix: ensure correct `WebContents` when checking `PDFReadyToPrint` (#43943)

* fix: ensure correct WebContents when checking PDFReadyToPrint

* test: fix paths on Windows

* Update spec/api-web-contents-spec.ts

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>

---------

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2024-09-27 17:05:42 -04:00
Charles Kerr
73c1413374 build: use Node 20 in Appveyor images (33-x-y) (#44002)
build: use Node 20 in Appveyor images (#43897)

* build: update Appveyor to Node 20

* build: update appveyor images

* chore: return bake script to original form

Co-authored-by: Keeley Hammond <vertedinde@electronjs.org>
2024-09-27 14:47:17 -04:00
trop[bot]
ce2163da2f fix: remove resize listener when BrowserWindow closed (#44000)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2024-09-27 14:46:22 -04:00
trop[bot]
481f9b25a7 chore: remove unused nogncheck includes (#43991)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-09-26 21:49:42 -05:00
trop[bot]
9ca68e2b8c perf: build g_dgettext domain name at compile time (#43987)
perf: build GettextPackage name at compile time

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-09-26 17:07:21 -05:00
trop[bot]
9ef7ec02e5 fix: replace deprecated libnotify API calls (#43983)
notify_notification_set_hint_string() is deprecated, so let's use
notify_notification_set_hint() instead.

Xref: 2fe1748295

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-09-26 13:59:21 -04:00
electron-roller[bot]
e32e85abb2 chore: bump chromium to 130.0.6723.19 (33-x-y) (#43975)
* chore: bump chromium in DEPS to 130.0.6723.19

* chore: update patches

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2024-09-26 12:47:11 -04:00
trop[bot]
6973af4f7a fix: -Wunsafe-buffer-usage warnings in GdkPixbufFromSkBitmap() (#43980)
* fix: -Wunsafe-buffer-usage warnings in GdkPixbufFromSkBitmap()

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

* refactor: don't change previous behavior for 0-height images

Is a 0x0 image even a thing? I'm not sure; but just in case, let's
treat it the same way the previous implementation did.

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>
2024-09-26 11:21:24 -05:00
John Kleinschmidt
625d950e32 docs: document breaking change in 33, not 32 (#43977) 2024-09-26 09:07:04 -04:00
electron-roller[bot]
d62097e067 chore: bump chromium to 130.0.6723.6 (33-x-y) (#43453)
* chore: bump chromium in DEPS to 130.0.6673.0

* chore: bump chromium in DEPS to 130.0.6675.0

* chore: bump chromium in DEPS to 130.0.6677.2

* chore: bump chromium in DEPS to 130.0.6679.1

* chore: bump chromium in DEPS to 130.0.6681.1

* chore: bump chromium in DEPS to 130.0.6683.2

* chore: bump chromium in DEPS to 130.0.6685.0

* chore: bump chromium in DEPS to 130.0.6687.0

* chore: bump chromium in DEPS to 130.0.6689.0

* chore: bump chromium in DEPS to 130.0.6691.1

* chore: bump chromium in DEPS to 130.0.6693.1

* chore: bump chromium in DEPS to 130.0.6695.1

* chore: bump chromium in DEPS to 130.0.6697.1

* chore: bump chromium in DEPS to 130.0.6699.1

* chore: bump chromium in DEPS to 130.0.6701.1

* chore: bump chromium in DEPS to 130.0.6703.1

* chore: bump chromium in DEPS to 130.0.6705.1

* chore: bump chromium in DEPS to 130.0.6707.1

* chore: bump chromium in DEPS to 130.0.6709.1

* chore: bump chromium in DEPS to 130.0.6711.1

* chore: bump chromium in DEPS to 130.0.6713.1

* chore: bump chromium in DEPS to 130.0.6715.2

* chore: bump chromium in DEPS to 130.0.6717.0

* chore: bump chromium in DEPS to 130.0.6719.1

* chore: bump chromium in DEPS to 130.0.6720.1

* chore: bump chromium in DEPS to 130.0.6723.1

* chore: bump chromium in DEPS to 130.0.6723.4

* chore: bump chromium in DEPS to 130.0.6723.6

* chore: bump chromium to 130.0.6695.0 (main) (#43454)

* chore: bump chromium in DEPS to 130.0.6673.0

* chore: bump chromium in DEPS to 130.0.6675.0

* chore: bump chromium in DEPS to 130.0.6677.2

* chore: bump chromium in DEPS to 130.0.6679.0

* 5802981: [Partitioned Popins] UKM

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

* 5799275: ash: Create //chrome/browser/ui/ash/web_view

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

* 5791853: [PWA] Allow WebContentsImpl::CreateNewWindow() to use new web contents for loading url

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

* 5805208: Move third_party/jacoco to a cipd/ subdirectory.

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

* chore: fixup patch indices

* 5771091: Introduce InputManager class for handling input in Viz.

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

* 5498921: [Permission] Remove SubscribeToPermissionStatusChange from PermissionManager

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

* 5791853: [PWA] Allow WebContentsImpl::CreateNewWindow() to use new web contents for loading url

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

* 5801311: Don't use int for bindings

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

* 5548827: [Web Install] Define the web-app-installation PermissionPolicy

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

* 5786325: Add Infrastructure for Hand tracking permission

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

* chore: fixup patch indices

* chore: bump chromium in DEPS to 130.0.6681.0

* [Views AX] Move BrowserAccessibility* to //ui/accessibility/platform

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

* chore: e patches all

* Don't have default arguments on virtual functions in render_frame_host.h

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

* test: log if loadURL fails in base url test

* chore: bump chromium in DEPS to 130.0.6683.2

* chore: fix support_mixed_sandbox_with_zygote.patch

content: restore old DisableJit behavior

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

* chore: update patch indices

* chore: bump chromium in DEPS to 130.0.6685.0

* Parallel process launching

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

* chore: update feat_expose_documentloader_setdefersloading_on_webdocumentloader.patch

No manual changes; patch applied with fuzz 1

* chore: e patches all

* chore: bump chromium in DEPS to 130.0.6687.0

* chore: bump chromium in DEPS to 130.0.6689.0

* chore: bump chromium in DEPS to 130.0.6691.0

* chore: bump chromium in DEPS to 130.0.6693.0

* chore: update patches

* chore: bump chromium in DEPS to 130.0.6695.0

* chore: free up macos disk space as soon as possible

* 5824143: Use checked in source lists for third_party/boringssl

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

* chore: update patches

* 5824122: Extensions: Add a new view type enum for developer tools contexts

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

* 5806109: Option for JavaScriptExecuteRequestForTests() to ignore content settings

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

* build: free up disk space on gn check too

* 5799369: [Refactoring] Make allow_http1_for_streaming_upload flags false.

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

* fixup! 5015584: Parallel process launching | https://chromium-review.googlesource.com/c/chromium/src/+/5015584

* Disable failing test for short-term

See: https://github.com/electron/electron/issues/43730

* oops

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: Keeley Hammond <khammond@slack-corp.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: clavin <clavin@electronjs.org>
(cherry picked from commit 4bcbc955dd)

* build: update appveyor image to latest version (#43772)

Co-authored-by: electron-appveyor-updater[bot] <161660339+electron-appveyor-updater[bot]@users.noreply.github.com>
(cherry picked from commit 02fd8bbcc1)

* chore: fixup patches

* chore: fixup patch

* chore: bump chromium in DEPS to 130.0.6723.6

* chore: update filenames.libcxx.gni

* test: re-enable disabled test

* 5844369: controlledframe: Disable Web Bluetooth for <webview> & <controlledframe>
https://chromium-review.googlesource.com/c/chromium/src/+/5844369

(cherry picked from commit 0ac4852763)

* (multiple CLs): Use an opaque type for FrameTreeNode IDs

5807683: Use an opaque type for FrameTreeNode IDs, part 1 | https://chromium-review.googlesource.com/c/chromium/src/+/5807683
5829746: Use an opaque type for FrameTreeNode IDs, part 2 | https://chromium-review.googlesource.com/c/chromium/src/+/5829746
5836903: Use an opaque type for FrameTreeNode IDs, part 7 | https://chromium-review.googlesource.com/c/chromium/src/+/5836903
5837249: Use an opaque type for FrameTreeNode IDs, part 8 | https://chromium-review.googlesource.com/c/chromium/src/+/5837249
5836564: Use an opaque type for FrameTreeNode IDs, part 12 | https://chromium-review.googlesource.com/c/chromium/src/+/5836564
5837180: Use an opaque type for FrameTreeNode IDs, part 15 | https://chromium-review.googlesource.com/c/chromium/src/+/5837180
(cherry picked from commit 1dd67f5241)

* 5822889: [task] Make GetForegroundTaskRunner non-virtual
https://chromium-review.googlesource.com/c/v8/v8/+/5822889

(cherry picked from commit ae1e7232a3)

* 5833297: Remove unused inner WebContents attach params
https://chromium-review.googlesource.com/c/chromium/src/+/5833297

(cherry picked from commit 390bb42e39)

* 5806403: Shift PowerMonitor to non static
https://chromium-review.googlesource.com/c/chromium/src/+/5806403

(cherry picked from commit 128e3826e1)

* 5666874: [3/N] Remove old OnPowerChange in PowerObserver
https://chromium-review.googlesource.com/c/chromium/src/+/5666874

(cherry picked from commit 6ea6ea14ae)

* 5829085: [v8] Differentiate between UserVisible and BestEffort task runners
https://chromium-review.googlesource.com/c/chromium/src/+/5829085

(cherry picked from commit 1db28ee4a5)

* 5791112: [webrtc] Use `c/b/permissions/system` for system permissions
https://chromium-review.googlesource.com/c/chromium/src/+/5791112

(cherry picked from commit 50d4a71923)

* fixup! (multiple CLs): Use an opaque type for FrameTreeNode IDs

(cherry picked from commit 9271130e16)

* fixup! 5791112: [webrtc] Use `c/b/permissions/system` for system permissions https://chromium-review.googlesource.com/c/chromium/src/+/5791112

(cherry picked from commit db2c8c69d0)

* 5825636: [Extensions] Create WebContentsObservers with ExtensionsBrowserClient
https://chromium-review.googlesource.com/c/chromium/src/+/5825636

(cherry picked from commit f2c3d09ccd)

* 5854811: Use kNotAllowedError instead of kSecurityError for Web MIDI

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

* test: fix should support base url for data urls test

Caused by https://chromium-review.googlesource.com/c/chromium/src/+/5802682

* test: fixup extensions can cancel http requests

* chore: document custom protocol handling on Windows change due to Non-Special Scheme URLs shipping

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

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: electron-appveyor-updater[bot] <161660339+electron-appveyor-updater[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: clavin <clavin@electronjs.org>
2024-09-26 11:12:12 +02:00
trop[bot]
ad8f2f8d5d test: add tests dbus notification images (#43946)
* test: add tests dbus notification images

Provide a NativeImage icon in the notification tests and then inspect
the DBus message payload's `image_data` hint to see if it's correct.
This adds test coverage for LibnotifyNotification::Show() and for
GdkPixbufFromSkBitmap().

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

* chore: use the same notification_icon.png as in main

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-09-25 16:48:24 -05:00
trop[bot]
53cc8aef9b fix: close all open sheets before closing window on macOS (#43952)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: John Beutner <beutner.john@gmail.com>
2024-09-25 13:30:56 -05:00
trop[bot]
0ffafbc295 test: ensure sender-pid hint is set in Linux notifications (#43949)
test: expect a `sender-pid` hint in Linux notifications.

This PR ensures that the `sender-pid` hint is set for new notifications.
It also updates the spec to confirm that DBus receives the hint and that
it has the correct value.

This fixes a spec failure when running libnotify >= 0.7.12 (2022-05-05).
Starting with that version, libnotify started injecting `sender-pid` if
not provided by the client. So our tests received a slightly different
DBus payload depending on what version of libnotify was installed,
causing our deep-equals tests to fail.

By always providing and testing the `sender-pid` hint, our behavior and
tests should be consistent across distros.

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-09-25 13:09:32 -05:00
trop[bot]
134176a1d1 fix: detach native view when its removed from parent on macOS (#43922)
Right now DelayedNativeViewHost attaches its underlying native view
when it's being attached to a widget but it doesn't detach it when
it's being detached. It may lead to use-after-free and crash.

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Cezary Kulakowski <cezary@openfin.co>
2024-09-25 13:17:59 +02:00
trop[bot]
d2bd4cf91c fix: crash when focusing WebView webContents (#43932)
fix: crash when focusing WebView

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2024-09-25 06:16:49 -05:00
trop[bot]
1af736bc15 fix: -Wunsafe-buffer-usage warning in asar_util's ReadFileToString() (#43930)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-09-25 11:21:47 +02:00
trop[bot]
f609d77e29 refactor: add SerialChooserController::web_contents_ (#43920)
Add a `base::WeakPtr<WebContents>` field to SerialChooserController and
stop subclassing from WebContentsObserver. This follows the Observer docs:

> don't create a `WebContentsObserver` just to be able to check
> for a null `WebContentsObserver::web_contents()`.
> Use a `base::WeakPtr<WebContents>` instead.

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-09-24 08:26:29 -05:00
trop[bot]
ae6d5c4661 refactor: hide printing impl details in api::WebContents (#43917)
* refactor: move api::WebContents::OnGetDeviceNameToUse() into an anonymous namespace

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

* refactor: move api::WebContents::OnPDFCreated() into an anonymous namespace

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

* refactor: remove unused #include

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>
2024-09-24 10:11:56 +02:00
trop[bot]
cdcfe49592 refactor: prefer member initializers in asar structs (#43918)
prefactor: prefer member initializers in asar::Archive

prefactor: prefer member initializers in asar::Archive::FileInfo

prefactor: prefer member initializers in asar::IntegrityPayload

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-09-24 10:11:50 +02:00
trop[bot]
d35b848f95 refactor: remove C-style void arg type for no-arg functions (#43919)
A small cleanup to remove use of the C-style function declaration idiom.

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-09-24 00:36:20 -07:00
trop[bot]
ff65b58e2c build: add support for fetching github token from sudowoodo (#43886)
* build: add support for fetching github token from sudowoodo

Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>

* chore: update release notes cache for tests

Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>

* build: support nightlies repo correctly

Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>

* build: post token

Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2024-09-23 11:07:20 -07:00
trop[bot]
dddcc09185 docs: navigation history example (#43890)
* docs: add fiddle example

Co-authored-by: Alice Zhao <alice@makenotion.com>

* docs: add tutorial guide

Co-authored-by: Alice Zhao <alice@makenotion.com>

* refactor: PR review comments

Co-authored-by: Alice Zhao <alice@makenotion.com>

* refactor: add eof

Co-authored-by: Alice Zhao <alice@makenotion.com>

* refactor: render navigation history and make demo better.

Co-authored-by: Alice Zhao <alice@makenotion.com>

* refactor: fix broken links

Co-authored-by: Alice Zhao <alice@makenotion.com>

* refactor: add eof newline

Co-authored-by: Alice Zhao <alice@makenotion.com>

* docs: review feedback :)

Co-authored-by: Alice Zhao <alice@makenotion.com>

* chore: lint add space around list

Co-authored-by: Alice Zhao <alice@makenotion.com>

* doc: transformURL

Co-authored-by: Alice Zhao <alice@makenotion.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Alice Zhao <alice@makenotion.com>
2024-09-23 11:02:52 -07:00
trop[bot]
8fa00dbe1a docs: add advanced specification for Squirrel updater (#43892)
* docs: add advanced specification for Squirrel updater

Co-authored-by: Erick Zhao <ezhao@slack-corp.com>

* address feedback

Co-authored-by: Erick Zhao <ezhao@slack-corp.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Erick Zhao <ezhao@slack-corp.com>
2024-09-23 11:02:28 -07:00
dependabot[bot]
eda8205424 build(deps): bump actions/setup-node from 4.0.3 to 4.0.4 (#43847)
Bumps [actions/setup-node](https://github.com/actions/setup-node) from 4.0.3 to 4.0.4.
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](1e60f620b9...0a44ba7841)

---
updated-dependencies:
- dependency-name: actions/setup-node
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-23 06:56:21 -07:00
dependabot[bot]
c4921d2592 build(deps): bump github/codeql-action from 3.26.3 to 3.26.8 (#43841)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.26.3 to 3.26.8.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](883d8588e5...294a9d9291)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-23 06:54:30 -07:00
dependabot[bot]
723015db29 build(deps): bump actions/upload-artifact from 4.3.6 to 4.4.0 (#43836)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4.3.6 to 4.4.0.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v4.3.6...50769540e7f4bd5e21e526ee35c689e35e0d6874)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-23 06:52:57 -07:00
dependabot[bot]
7d108a163f build(deps): bump slackapi/slack-github-action from 1.26.0 to 1.27.0 (#43844)
Bumps [slackapi/slack-github-action](https://github.com/slackapi/slack-github-action) from 1.26.0 to 1.27.0.
- [Release notes](https://github.com/slackapi/slack-github-action/releases)
- [Commits](70cd7be8e4...37ebaef184)

---
updated-dependencies:
- dependency-name: slackapi/slack-github-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-23 11:00:17 +02:00
trop[bot]
7f473f2fba fix: -Wunsafe-buffer-usage warnings in GetNextZoomLevel() (#43820)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-09-22 07:11:49 -05:00
trop[bot]
95caa1f0bd fix: -Wunsafe-buffer-usage warnings in Clipboard::WriteBuffer() (#43813)
* fix: -Wunsafe-buffer-usage warnings in Clipboard::WriteBuffer()

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

* chore: add a DCHECK to confirm the BigBuffer is full

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>
2024-09-20 08:47:49 -05:00
trop[bot]
45a7a5d22c fix: createWindow shouldn't load URL for webContents (#43816)
* fix: createWindow shouldn't load URL for webContents

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

* chore: add non about blank test

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>
2024-09-20 08:47:30 -05:00
trop[bot]
3232505c55 docs: document Windows pitfall when updating patches (#43814)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-09-20 00:30:35 -05:00
trop[bot]
b896dbb103 fix: third time screen sharing on macOS (#43810)
Because we used decrementing negative source ids for fake video id when
instantating a native macOS screen share picker, we eventually hit the
`DesktopMediaID::kFakeId = -3` in Chromium source code which displayed a
test green screen.

In this change we reserve our own fake id of `-4` and decrement the
window id integer for uniqueness instead.

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Fedor Indutny <238531+indutny@users.noreply.github.com>
2024-09-19 22:12:19 -05:00
trop[bot]
3ee3844bdb refactor: NotificationPresenter::Create() returns a std::unique_ptr<> (#43804)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-09-19 22:11:48 -05:00
trop[bot]
78ede09ecd chore: fix compile issue about ambiguous error of multiple methods named 'highlight'. (#43800)
chore: fix ambiguous error of multiple methods named 'highlight'

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: bill.shen <shenyb32768@gmail.com>
2024-09-19 07:20:56 -05:00
Charles Kerr
5c92ea76e9 refactor: reduce code duplication in gin_helper::Promise (33-x-y) (#43778)
refactor: reduce code duplication in gin_helper::Promise (#43716)

* refactor: move scope scaffolding into SettletScope

idea stolen from SpellCheckScope

* refactor: move impl of PromiseBase::RejectPromise() to the cc file

* chore: remove unused #include

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2024-09-19 13:01:13 +02:00
Charles Kerr
68869c18cd docs: update window customization tutorial (33-x-y) (#43781)
docs: update window customization tutorial (#43388)

Co-authored-by: Keeley Hammond <vertedinde@electronjs.org>
2024-09-19 10:00:36 +02:00
Charles Kerr
d3cfe7aacb chore: iwyu mojom-forward header files (33-x-y) (#43777)
chore: iwyu mojom-forward header files (#43741)

* chore: iwyu mojom.h headers

* fixup! chore: iwyu mojom.h headers

make previously-indirect include dependency direct

* fixup! fixup! chore: iwyu mojom.h headers

make previously-indirect include dependency direct
2024-09-19 09:58:45 +02:00
trop[bot]
753cf3d409 perf: hold V8FunctionInvoker args in a std::array (#43793)
perf: hold V8FunctionInvoker args in a std::array

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-09-18 18:45:39 -05:00
trop[bot]
3a4664f836 build: let darwin/mas run concurrently (#43792)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2024-09-18 16:37:06 -07:00
trop[bot]
948a28fdb8 perf: hold Emit() arg arrays in a std::array (#43776)
* refactor: CallMethodWithArgs() now takes a span of value handles

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

* perf: use std::array instead of std::vector to hold Emit arg parameter packs

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

* chore: remove unused gin_helper::EmitEvent(iso, obj, name, span<Local>)

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>
2024-09-18 14:55:53 -04:00
trop[bot]
48d4adedaa build: split darwin/mas macOS publish jobs (#43764)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2024-09-17 20:07:46 -07:00
Samuel Attard
a27df94f71 build: improve logging on http errors during release process (#43759)
* build: improve logging on http errors during release process (#43756)

* build: improve logging on http errors during release process (again) (#43757)

* build: improve logging on http errors during release process (again, but more) (#43758)
2024-09-17 15:27:27 -07:00
trop[bot]
888928887c fix: in Emit(), don't leak converted Arg Local<Values> into caller's scope (#43746)
fix: Emit() should not leak converted arg handles into caller's HandleScope

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-09-17 10:57:21 -05:00
John Kleinschmidt
4ee00641eb ci: move Archaeologist to GHA (#43732)
ci: move Archaeologist to GHA (#43701)

* chore: move Archaeologist to GHA

* chore: test archaelogist changes

* Revert "chore: test archaelogist changes"

This reverts commit a575d6ef3a.

* chore: properly name steps in archaeologist-dig
2024-09-17 11:23:26 -04:00
trop[bot]
12bb7093e2 fix: resizing border on Linux WCO caption buttons (#43744)
Closes https://github.com/electron/electron/issues/43714.

Fixes an issue where the resizing border was not being handled correctly on Linux WCO
caption buttons. This is now taken into account as a part of the NonClientHitTest.

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2024-09-17 15:33:28 +02:00
trop[bot]
6b4f269d22 fix: prevent loading spinner when launching utility process on Windows (#43731)
fix: prevent spinning cursor when launching utility process on Windows

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Niklas Wenzel <dev@nikwen.de>
2024-09-17 11:51:12 +02:00
Charles Kerr
d11c840cf0 refactor: add EmitWarning(v8::Isolate*) helper (#43736)
refactor: add `EmitWarning(v8::Isolate*)` helper (#43722)

* refactor: add EmitWarning(Isolate*, ...) warning

* chore: remove EmitWarning(node::Environment*, ...)

* chore: add code comments

* fixup! refactor: add EmitWarning(Isolate*, ...) warning

* chore: remove unused node #includes
2024-09-17 11:50:48 +02:00
trop[bot]
18bd295873 docs: document View.removeChildView edge case (#43725)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Niklas Wenzel <dev@nikwen.de>
2024-09-16 12:53:10 +02:00
trop[bot]
748f293400 refactor: remove use of deprecated API BuildServiceInstanceFor() (#43707)
* refactor: update BadgeManagerFactory

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

* refactor: update NetworkContextServiceFactory

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

* refactor: update ElectronExtensionSystemFactory

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

* refactor: update UsbChooserContextFactory

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

* refactor: update UsbHidChooserContextFactory

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

* refactor: update SerialChooserContextFactory

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

* refactor: update FileSystemAccessPermissionContextFactory

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

* empty commit

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-09-13 15:26:10 -05:00
trop[bot]
7a04a77ed0 refactor: avoid minor code repetition in native_image.cc (#43704)
chore: delegate handle creation in NativeImage::Resize()

chore: delegate handle creation in NativeImage::Crop()

chore: delegate handle creation in NativeImage::CreateEmpty()

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-09-12 20:13:27 +02:00
trop[bot]
810a6d6ef4 fix: EyeDropper working in devtools (#43700)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2024-09-12 19:20:34 +02:00
trop[bot]
27aea84411 fix: native View wrapper crash missing when adding child view (#43696)
fix: native View wrapper crash missing when adding child view

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2024-09-12 12:48:16 +02:00
trop[bot]
2aa2611f76 feat: add support for system picker in setDisplayMediaRequestHandler (#43680)
* tmp

Co-authored-by: Samuel Attard <marshallofsound@electronjs.org>

* feat: add support for system picker in setDisplayMediaRequestHandler

Co-authored-by: Samuel Attard <marshallofsound@electronjs.org>

* oops

Co-authored-by: Samuel Attard <marshallofsound@electronjs.org>

* Apply suggestions from code review

Co-authored-by: Erick Zhao <erick@hotmail.ca>

Co-authored-by: Samuel Attard <sam@electronjs.org>

* stuff

Co-authored-by: Samuel Attard <marshallofsound@electronjs.org>

* well...

Co-authored-by: Samuel Attard <marshallofsound@electronjs.org>

* seems legit

Co-authored-by: Samuel Attard <marshallofsound@electronjs.org>

* chore: update patch to handle screenCapturer

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

* feat: modify API to use useSystemPicker

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

* fix: gate ScreenCaptureKitPicker to macos 15 or higher

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

* fix: don't use native picker with legacy media selection

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

* chore: code review, boolean set & docs update

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

* fix: add cancelCallback

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

* docs: clarify session & desktopCapturer docs

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

* chore: update patches

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Samuel Attard <marshallofsound@electronjs.org>
Co-authored-by: Samuel Attard <sam@electronjs.org>
Co-authored-by: Keeley Hammond <khammond@slack-corp.com>
2024-09-11 09:57:39 -07:00
trop[bot]
57aeb9dfc6 fix: ensure SetPluginCanSave updated in PDFs (#43686)
fix: ensure SetPluginCanSave updated in PDFs

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2024-09-11 17:56:23 +02:00
trop[bot]
454218bd2b build: compile Node.js with C++20 support (#43684)
* build: compile with C++20 support

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

* build: update build-image-sha for gcc 10

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>
2024-09-11 17:10:33 +02:00
trop[bot]
c56673f83d fix: -Wunsafe-buffer-usage warning in V8Serializer::Serialize() (#43675)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-09-10 19:00:47 -05:00
trop[bot]
87fc32f0aa fix: restore Chromium default Content-Disposition header parsing (#43670)
* fix: restore Chromium default Content-Disposition header parsing

Co-authored-by: Milan Burda <milan.burda@gmail.com>

* Update api-web-request-spec.ts

Co-authored-by: Milan Burda <milan.burda@gmail.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2024-09-10 12:10:53 -04:00
trop[bot]
c7380437aa fix: -Wunsafe-buffer-usage warnings in asar file IO (#43650)
* fix: -Wunsafe-buffer-usage warnings in ScopedTemporaryFile::InitFromFile()

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

* fix: -Wunsafe-buffer-usage warnings in Archive::Init()

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>
2024-09-09 17:27:49 -05:00
trop[bot]
511dece7ff fix: out-of-scope Local handle in node::CallbackScope (#43640)
refactor: use an EscapableHandleScope

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-09-09 17:30:34 -04:00
trop[bot]
12ce546ded fix: update BrowserView#lastWindowSize after window resize (#43636)
fix: update BrowserView#lastWindowSize after window resize (#43462)

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Zonglong Liu <83216456+mai-121@users.noreply.github.com>
2024-09-09 17:40:27 +02:00
trop[bot]
67da1f2f9f fix: UvHandle move semantics (#43634)
reassign the uv_handle_t of the source

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-09-09 10:35:58 -05:00
trop[bot]
8d9ed52c72 perf: avoid redundant Promise.GetContext calls (#43620)
refactor: avoid redundant Promise.GetContext calls

Several Promise methods call `GetContext()` multiple times. From looking
at the assembly in obj/electron/electron_lib/promise.o, these redundant
calls are actually being made -- they aren't optmized out.

This PR keeps the return value in a local variable to avoid extra calls.

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-09-08 10:37:42 -05:00
trop[bot]
8d76b8dba9 refactor: take a uint8_t span in ValidateIntegrityOrDie() (#43612)
refactor: take a uint8_t span in ValidateIntegrityOrDie()

Doing some groundwork for fixing unsafe base::File() APIs:

- Change ValidateIntegrityOrDie() to take a span<const uint8_t> arg.
  We'll need this to migrate asar's base::File API calls away from the
  ones tagged `UNSAFE_BUFFER_USAGE` because the safe counterparts use
  span<uint8_t> too.

- Simplify ValidateIntegrityOrDie()'s implementation by using
  crypto::SHA256Hash() instead of reinventing the wheel.

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-09-06 21:56:27 -05:00
trop[bot]
6f68a40430 refactor: NativeWindow::Create() returns a unique_ptr (#43607)
refactor: NativeWindow::Create() returns a unique_ptr

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-09-06 14:20:09 -05:00
trop[bot]
cf8a97a924 fix: confirm a v8::Value is a v8::Object before casting it (#43601)
fix: confirm a v8::Value is a v8::Object before casting it

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-09-06 14:18:26 -05:00
trop[bot]
37a7cb2c11 fix: ensure version of xdg-dialog-portal with defaultPath support (#43595)
fix: ensure version of xdg-dialog-portal with defaultPath support

Closes https://github.com/electron/electron/issues/43310

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2024-09-06 13:58:55 -04:00
trop[bot]
d92770a275 fix: delete UvTaskRunner's timers only after they're closed (#43597)
* fix: free UvTaskRunner timers only after they are closed

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

* refactor: UvTaskRunner now holds UvHandles

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>
2024-09-06 08:37:33 -05:00
trop[bot]
60264f30d8 build: use proper targets for building (#43588)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2024-09-06 12:07:55 +02:00
trop[bot]
b31a4dcdf3 docs: explain ipcRenderer behavior in context-bridge.md (#43584)
* docs: explain ipcRenderer behavior in context-bridge.md

Co-authored-by: Kilian Valkhof <kilian@kilianvalkhof.com>

* Update context-bridge.md

Co-authored-by: Kilian Valkhof <kilian@kilianvalkhof.com>

* Update context-bridge.md

Co-authored-by: Kilian Valkhof <kilian@kilianvalkhof.com>

* Update docs/api/context-bridge.md

Co-authored-by: Erik Moura <erikian@erikian.dev>

Co-authored-by: Kilian Valkhof <kilian@kilianvalkhof.com>

* Update context-bridge.md

Co-authored-by: Kilian Valkhof <kilian@kilianvalkhof.com>

* Update context-bridge.md

Co-authored-by: Kilian Valkhof <kilian@kilianvalkhof.com>

* Update context-bridge.md

Co-authored-by: Kilian Valkhof <kilian@kilianvalkhof.com>

* Update docs/api/context-bridge.md

Co-authored-by: Erick Zhao <erick@hotmail.ca>

Co-authored-by: Kilian Valkhof <kilian@kilianvalkhof.com>

* Update docs/api/context-bridge.md

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

Co-authored-by: Kilian Valkhof <kilian@kilianvalkhof.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Kilian Valkhof <kilian@kilianvalkhof.com>
2024-09-05 17:05:46 -04:00
trop[bot]
1d3200d7da fix: Launch apps with XDG_ACTIVATION_TOKEN in ozone/wayland (#43579)
* fix: Launch apps with XDG_ACTIVATION_TOKEN in ozone/wayland

Ensure apps are launched with the activation token received from
xdg_activation_v1 protocol.

Co-authored-by: Orko Garai <orko@igalia.com>

* add focus_launched_process option

Co-authored-by: Orko Garai <orko@igalia.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Orko Garai <orko@igalia.com>
2024-09-05 15:00:15 -05:00
trop[bot]
bf10a437bc build: fix telemetry error when using autoninja (#43574)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2024-09-05 09:08:38 -04:00
trop[bot]
60247e685d perf: use v8::Local<v8::Object> as the key in ObjectCache (#43568)
* perf: use v8::Object* as direct keys instead of using hash + a linked list

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

* refactor: use v8::Local<v8::Object> as the key

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>
2024-09-05 10:08:42 +02:00
trop[bot]
5d340577b6 fix: systemMediaPermissionDenied should not check camera perms when the request is asking for screen share (#43543)
* fix: systemMediaPermissionDenied: should check for screen capture perms instead of camera

Co-authored-by: George Xu <george.xu@slack-corp.com>

* Revert "fix: systemMediaPermissionDenied: should check for screen capture perms instead of camera"

This reverts commit e9cc672165.

Co-authored-by: George Xu <george.xu@slack-corp.com>

* should only do these checks for audio or video, but not screenshare

Co-authored-by: George Xu <george.xu@slack-corp.com>

* no service

Co-authored-by: George Xu <george.xu@slack-corp.com>

* oops

Co-authored-by: George Xu <george.xu@slack-corp.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: George Xu <george.xu@slack-corp.com>
2024-09-04 22:52:18 -05:00
trop[bot]
40316df338 fix: -Wunsafe-buffer-usage warnings in IsUrlArg() (#43539)
* fix: -Wunsafe-buffer-usage warnings in IsUrlArg()

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

* chore: improve code comments for CheckCommandLineArguments()

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

* chore: reduce diffs from main

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

* refactor: CheckCommandLineArguments takes a StringVector arg

Fixes another buffer warning!

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>
2024-09-04 22:51:54 -05:00
trop[bot]
e92eb210bb refactor: declare gin::Wrapper subclasses as final (#43565)
As per the gin docs: "Wrappable<T> explicitly does not support further
subclassing of T. Subclasses of Wrappable<T> should be declared final."

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-09-04 21:26:25 -05:00
trop[bot]
f30c9120a1 build: don't run symbol generation on PS (#43559)
fix: don't run symbol generation on PS

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Keeley Hammond <khammond@slack-corp.com>
2024-09-04 18:39:25 +01:00
trop[bot]
986a621bfc fix: don't use deprecate-soon class v8::String::Value (#43551)
* fix: remove use of deprecated v8::String::Value

Upstream marked v8::String::Value as `V8_DEPRECATE_SOON` last month,
so let's stop using it.

The replacement code mostly does the same as v8::String::Value();
but since our test only cares about the length and not the contents,
we get a small perf win of not needing to allocate a char array and
not needing to call Local::String::Write().

Upstream V8_DEPRECATE_SOON:
Xref: https://chromium-review.googlesource.com/c/v8/v8/+/5667299kkk

v8::String::Value() implementation:
20226b740b/src/api/api.cc (10883)

History on why we used it:
80c1a9739d
f49ed30f72

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

* Update shell/common/gin_converters/file_path_converter.h

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

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

* fixup! Update shell/common/gin_converters/file_path_converter.h

do not return success for all non-Null non-Strings

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>
2024-09-04 11:00:34 -05:00
trop[bot]
6172e1d2b9 fix: Use XDG_ACTIVATION_TOKEN in wayland when launched by other app (#43546)
When an electron app is launched by another app ensure that the
XDG_ACTIVATION_TOKEN env var is read and used for activation using
xdg_activation_v1 protocol.

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Orko Garai <orko@igalia.com>
2024-09-04 17:28:06 +02:00
trop[bot]
0ee624c308 build: free up macos disk space as soon as possible (#43536)
* chore: free up macos disk space as soon as possible

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>

* build: free up disk space on gn check too

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2024-09-04 09:55:22 +01:00
trop[bot]
d8e46cdd50 chore: speed up cache only reclient for fork PRs (#43506)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2024-08-30 20:26:12 -04:00
trop[bot]
bcf948595d fix: devtools dock state with WCO on linux (#43499)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
2024-08-29 11:27:10 -04:00
electron-roller[bot]
66fa1f4665 chore: bump node to v20.17.0 (33-x-y) (#43426)
* chore: bump node in DEPS to v20.17.0

* module: disallow CJS <-> ESM edges in a cycle from require(esm)

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

* src: expose LookupAndCompile with parameters

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

* src: fix -Wshadow warning

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

* lib: convert WeakMaps in cjs loader with symbol properties

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

* src: reduce unnecessary serialization of CLI options in C++

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

* build: ensure v8_pointer_compression_sandbox is enabled on 64bit

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

* lib: improve error message when index not found on cjs

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

* src,lib: expose getCategoryEnabledBuffer to use on node.http

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

* deps: update c-ares to v1.32.2

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

* chore: update patch indices

* deps: update V8 to 12.2

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

* stream: Expose DuplexPair API

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

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2024-08-27 15:03:21 -04:00
trop[bot]
1fcd981e5e refactor: simplify KeyWeakMap impl (#43483)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-08-26 18:09:12 -04:00
trop[bot]
9a3618e912 refactor: prefer std::ranges over begin() and end() (#43482)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-08-26 14:37:56 -04:00
trop[bot]
d55e120038 chore: remove unused WinFrameView::kInactiveTitlebarFeatureAlpha (#43476)
added in Aug 2021 (41646d11, #29600) but never used

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-08-24 00:33:31 -05:00
trop[bot]
26d6f62c01 fix: ensure bounds stability in OnWidgetBoundsChanged (#43457)
* fix: ensure bounds stability in OnWidgetBoundsChanged

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

* Update shell/browser/native_window_views.cc

Co-authored-by: Charles Kerr <charles@charleskerr.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>
2024-08-24 00:31:48 -05:00
trop[bot]
d769f1ea71 build: update appveyor image to latest version (#43472)
* build: update appveyor image to latest version

Co-authored-by: electron-appveyor-updater[bot] <161660339+electron-appveyor-updater[bot]@users.noreply.github.com>

* build: update appveyor image to latest version (#43451)

Co-authored-by: electron-appveyor-updater[bot] <161660339+electron-appveyor-updater[bot]@users.noreply.github.com>
(cherry picked from commit e6555ac5e1)

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: electron-appveyor-updater[bot] <161660339+electron-appveyor-updater[bot]@users.noreply.github.com>
2024-08-23 23:07:45 -05:00
trop[bot]
f08c6f2e85 perf: prefer GURL string_view getters (#43471)
* chore: avoid double-call to url.scheme() in WebContentsZoomController::SetZoomMode()

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

* perf: use gurl.scheme_piece() in GetAppInfoHelperForProtocol()

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

* perf: use gurl.scheme_piece() in Browser::GetApplicationNameForProtocol()

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

* refactor: add std::less<> to HandlersMap

This lets us search it using string_view keys

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

* refactor: ProtocolRegistry::FindRegistered() now takes a std::string_view

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

* perf: use gurl.scheme_piece() in InspectableWebContents::LoadNetworkResource()

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

* refactor: ProtocolRegistry::FindIntercepted() now takes a std::string_view

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

* perf: use gurl.scheme_piece() in SimpleURLLoaderWrapper::GetURLLoaderFactoryForURL()

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

* perf: use gurl.scheme_piece() in ProxyingURLLoaderFactory::CreateLoaderAndStart()

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

* perf: use gurl.host_piece() in ElectronWebUIControllerFactory::GetWebUIType()

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

* perf: use gurl.host_piece() in ElectronWebUIControllerFactory::CreateWebUIControllerForURL()

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>
2024-08-23 20:58:59 -05:00
trop[bot]
824b1aeb71 test: add -pdf-ready-to-print event to WebContents for testing (#43465)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2024-08-23 17:16:22 -05:00
trop[bot]
ddc19e3ea0 chore: remove unused method asar::ClearArchives() (#43468)
chore: remove unused asar::ClearArchives()

last use removed in Jun 2021 (b1d1ac65, #29293)

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-08-23 17:02:40 -05:00
trop[bot]
d9aa185ec5 docs: titleBarOverlay is defined as a BaseWindow ctor option (#43460)
docs: titleBarOverlay is defined as a BaseWindow ctor option

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2024-08-23 10:38:46 -05:00
electron-roller[bot]
3169351511 chore: bump chromium to 130.0.6672.0 (33-x-y) (#43444)
chore: bump chromium in DEPS to 130.0.6672.0

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
2024-08-22 18:27:38 -05:00
trop[bot]
75ce3ac6a2 fix: menu should allow focused BaseWindow where possible (#43438)
fix: menu should allow focused BaseWindow

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2024-08-22 15:51:20 -05:00
trop[bot]
656a86169a chore: bump chromium to 130.0.6671.0 (33-x-y) (#43440)
* chore: bump chromium in DEPS to 130.0.6671.0

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

* 5802591: [Partitioned Popins] (6) Add permissions policy for popin

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

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

* 5794132: [video pip] Move back to tab button to the header

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

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

---------

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: Shelley Vohr <shelley.vohr@gmail.com>
2024-08-22 15:50:23 -05:00
trop[bot]
e08be7d8ce chore: fix typos in 'spec/' folder (and one in 'lib/' folder) (#43432)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Alexander Cyon <alex.cyon@gmail.com>
2024-08-22 12:30:24 -05:00
trop[bot]
150d332f10 fix: documentation spelling errors (#43435)
chore: fix typos in 'docs/' folder.

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Alexander Cyon <alex.cyon@gmail.com>
2024-08-22 16:04:02 +02:00
trop[bot]
85bac873e7 fix: touch bar functionality on BaseWindow (#43422)
* fix: touch bar functionality on BaseWindow

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

* test: add test for BaseWindow.setTouchBar

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>
2024-08-22 16:03:33 +02:00
trop[bot]
706d416284 docs: clarify icon value in Notification (#43414)
* docs: clarify icon value in Notification

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

* Update docs/api/notification.md

Co-authored-by: Erick Zhao <erick@hotmail.ca>

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>
2024-08-21 21:30:13 -05:00
trop[bot]
0a1e906aa8 refactor: move impl functions into private namespace (#43408)
* refactor: move into unnamed namespace: IsKillURL()

refactor: move into unnamed namespace: ResolvePossiblyRelativeURL()

refactor: move into unnamed namespace: AllowFileAccess()

refactor: move into unnamed namespace: PrepareURLForNavigation()

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

* refactor: move into unnamed namespace: GetMonitors()

refactor: move into unnamed namespace: GetEDIDProperty()

refactor: move into unnamed namespace: MonitorAtomIdToDisplayId()

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

* refactor: move into unnamed namespace: GetPermissionInfos() } refactor: move into unnamed namespace: GetPermissionAliases()

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

* refactor: move into unnamed namespace: OnOpenExternal()

refactor: move into unnamed namespace: HandleExternalProtocolInUI()

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

* refactor: move into unnamed namespace: BindMimeHandlerService()

refactor: move into unnamed namespace: BindBeforeUnloadControl()

refactor: move into unnamed namespace: BindBadgeServiceForServiceWorker()

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

* refactor: move into unnamed namespace: GetClientIdPath()

refactor: move into unnamed namespace: ReadClientId()

refactor: move into unnamed namespace: WriteClientId()

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

* refactor: move into unnamed namespace: HasExplicitLogFile()

refactor: move into unnamed namespace: DetermineLoggingDestination()

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

* refactor: move into unnamed namespace: GetArchiveCache()

refactor: move into unnamed namespace: GetArchiveCacheLock()

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

* refactor: move into unnamed namespace: GetParameters()

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

* refactor: move into unnamed namespace: GetDoomed()

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

* refactor: move into unnamed namespace: EncodeToken()

refactor: move into unnamed namespace: PortInfoToValue()

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>
2024-08-21 19:43:01 -05:00
trop[bot]
cd944384e2 docs: update timelines for E33 (#43411)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2024-08-21 15:50:50 -07:00
trop[bot]
dbd7840254 chore: bump chromium to 130.0.6669.0 (33-x-y) (#43403)
* chore: bump chromium in DEPS to 130.0.6669.0

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

* 5789734: Consolidate all the accessibility scale factor utility code into one file

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

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

* 5798543: [autofill] Don't emit autofill audit reports if inspector not connected

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

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

* 5797073: [wasm] Spill all loop inputs before entering loop

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

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

* chore: fixup patch indices

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

* 5795224: Version 13.0.0

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

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

---------

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: Shelley Vohr <shelley.vohr@gmail.com>
2024-08-21 20:20:13 +02:00
Charles Kerr
6263a39d9a refactor: NodeBindings::Create() returns a unique_ptr (#43381)
refactor: NodeBindings::Create() returns a unique_ptr (#43361)

* refactor: NodeBindings::Create() returns a unique_ptr

* empty commit
2024-08-21 10:15:04 +02:00
Keeley Hammond
5134328872 chore: cherry-pick 9797576 from v8 (#43385)
chore: cherry-pick 9797576 from v8 (#43376)

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2024-08-20 15:46:00 -07:00
Charles Kerr
2d240453de chore: remove unused ConvertableToTraceFormatWrapper (33-x-y) (#43378)
chore: remove unused ConvertableToTraceFormatWrapper (#43356)

* chore: remove unused ConvertableToTraceFormatWrapper

Last use removed in Apr 2024 (39bf441b, #41880)

* fixup! chore: remove unused ConvertableToTraceFormatWrapper

remove now-unused trace_event.h header, too
2024-08-20 16:53:28 -05:00
657 changed files with 9454 additions and 5913 deletions

View File

@@ -19,7 +19,40 @@
"prefer-const": ["error", {
"destructuring": "all"
}],
"standard/no-callback-literal": "off"
"n/no-callback-literal": "off",
"import/newline-after-import": "error",
"import/order": ["error", {
"alphabetize": {
"order": "asc"
},
"newlines-between": "always",
"pathGroups": [
{
"pattern": "@electron/internal/**",
"group": "external",
"position": "before"
},
{
"pattern": "@electron/**",
"group": "external",
"position": "before"
},
{
"pattern": "{electron,electron/**}",
"group": "external",
"position": "before"
}
],
"pathGroupsExcludedImportTypes": [],
"distinctGroup": true,
"groups": [
"external",
"builtin",
["sibling", "parent"],
"index",
"type"
]
}]
},
"parserOptions": {
"ecmaVersion": 6,

View File

@@ -69,7 +69,7 @@ runs:
shell: bash
run: |
cd src
e build electron:electron_dist_zip -j $NUMBER_OF_NINJA_PROCESSES
e build --target electron:electron_dist_zip -j $NUMBER_OF_NINJA_PROCESSES
if [ "${{ inputs.is-asan }}" != "true" ]; then
target_os=${{ inputs.target-platform == 'linux' && 'linux' || 'mac'}}
if [ "${{ inputs.artifact-platform }}" = "mas" ]; then
@@ -81,7 +81,7 @@ runs:
shell: bash
run: |
cd src
e build electron:electron_mksnapshot -j $NUMBER_OF_NINJA_PROCESSES
e build --target electron:electron_mksnapshot -j $NUMBER_OF_NINJA_PROCESSES
gn desc out/Default v8:run_mksnapshot_default args > out/Default/mksnapshot_args
# Remove unused args from mksnapshot_args
SEDOPTION="-i"
@@ -104,7 +104,7 @@ runs:
fi
fi
e build electron:electron_mksnapshot_zip -j $NUMBER_OF_NINJA_PROCESSES
e build --target electron:electron_mksnapshot_zip -j $NUMBER_OF_NINJA_PROCESSES
(cd out/Default; zip mksnapshot.zip mksnapshot_args gen/v8/embedded.S)
- name: Generate Cross-Arch Snapshot (arm/arm64) ${{ inputs.step-suffix }}
shell: bash
@@ -130,24 +130,24 @@ runs:
shell: bash
run: |
cd src
e build electron:electron_chromedriver -j $NUMBER_OF_NINJA_PROCESSES
e build electron:electron_chromedriver_zip
e build --target electron:electron_chromedriver -j $NUMBER_OF_NINJA_PROCESSES
e build --target electron:electron_chromedriver_zip
- name: Build Node.js headers ${{ inputs.step-suffix }}
shell: bash
run: |
cd src
e build electron:node_headers
e build --target electron:node_headers
- name: Generate & Zip Symbols ${{ inputs.step-suffix }}
shell: bash
run: |
# Generate breakpad symbols on release builds
if [ "${{ inputs.generate-symbols }}" = "true" ]; then
e build electron:electron_symbols
e build --target electron:electron_symbols
fi
cd src
export BUILD_PATH="$(pwd)/out/Default"
e build electron:licenses
e build electron:electron_version_file
e build --target electron:licenses
e build --target electron:electron_version_file
if [ "${{ inputs.is-release }}" = "true" ]; then
DELETE_DSYMS_AFTER_ZIP=1 electron/script/zip-symbols.py -b $BUILD_PATH
else

View File

@@ -0,0 +1,24 @@
name: 'Generate Types for Archaeologist Dig'
description: 'Generate Types for Archaeologist Dig'
inputs:
sha-file:
description: 'File containing sha'
required: true
filename:
description: 'Filename to write types to'
required: true
runs:
using: "composite"
steps:
- name: Generating Types for SHA in ${{ inputs.sha-file }}
shell: bash
run: |
git checkout $(cat ${{ inputs.sha-file }})
rm -rf node_modules
yarn install --frozen-lockfile --ignore-scripts
echo "#!/usr/bin/env node\nglobal.x=1" > node_modules/typescript/bin/tsc
node node_modules/.bin/electron-docs-parser --dir=./ --outDir=./ --moduleVersion=0.0.0-development
node node_modules/.bin/electron-typescript-definitions --api=electron-api.json --outDir=artifacts
mv artifacts/electron.d.ts artifacts/${{ inputs.filename }}
git checkout .
working-directory: ./electron

61
.github/workflows/archaeologist-dig.yml vendored Normal file
View File

@@ -0,0 +1,61 @@
name: Archaeologist
on:
pull_request:
jobs:
archaeologist-dig:
name: Archaeologist Dig
runs-on: ubuntu-latest
steps:
- name: Checkout Electron
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 #v4.0.2
with:
fetch-depth: 0
- name: Setting Up Dig Site
run: |
echo "remote: ${{ github.event.pull_request.head.repo.clone_url }}"
echo "sha ${{ github.event.pull_request.head.sha }}"
echo "base ref ${{ github.event.pull_request.base.ref }}"
git clone https://github.com/electron/electron.git electron
cd electron
mkdir -p artifacts
git remote add fork ${{ github.event.pull_request.head.repo.clone_url }} && git fetch fork
git checkout ${{ github.event.pull_request.head.sha }}
git merge-base origin/${{ github.event.pull_request.base.ref }} HEAD > .dig-old
echo ${{ github.event.pull_request.head.sha }} > .dig-new
cp .dig-old artifacts
- name: Generating Types for SHA in .dig-new
uses: ./.github/actions/generate-types
with:
sha-file: .dig-new
filename: electron.new.d.ts
- name: Generating Types for SHA in .dig-old
uses: ./.github/actions/generate-types
with:
sha-file: .dig-old
filename: electron.old.d.ts
- name: Upload artifacts
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 #v4.4.0
with:
name: artifacts
path: electron/artifacts
include-hidden-files: true
- name: Set job output
run: |
git diff --no-index electron.old.d.ts electron.new.d.ts > patchfile || true
if [ -s patchfile ]; then
echo "Changes Detected"
echo "## Changes Detected" > $GITHUB_STEP_SUMMARY
echo "Looks like the \`electron.d.ts\` file changed." >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`\`\`\`diff" >> $GITHUB_STEP_SUMMARY
cat patchfile >> $GITHUB_STEP_SUMMARY
echo "\`\`\`\`\`\`" >> $GITHUB_STEP_SUMMARY
else
echo "No Changes Detected"
echo "## No Changes" > $GITHUB_STEP_SUMMARY
echo "We couldn't see any changes in the \`electron.d.ts\` artifact" >> $GITHUB_STEP_SUMMARY
fi
working-directory: ./electron/artifacts

View File

@@ -40,7 +40,7 @@ jobs:
build-image-sha: ${{ steps.set-output.outputs.build-image-sha }}
docs-only: ${{ steps.set-output.outputs.docs-only }}
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 #v4.0.2
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 #v4.0.2
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: filter
with:
@@ -53,7 +53,7 @@ jobs:
id: set-output
run: |
if [ -z "${{ inputs.build-image-sha }}" ]; then
echo "build-image-sha=cf814a4d2501e8e843caea071a6b70a48e78b855" >> "$GITHUB_OUTPUT"
echo "build-image-sha=77262e58c37631ab082482f42c33cdf68c6c394b" >> "$GITHUB_OUTPUT"
else
echo "build-image-sha=${{ inputs.build-image-sha }}" >> "$GITHUB_OUTPUT"
fi
@@ -94,7 +94,7 @@ jobs:
build-image-sha: ${{ needs.setup.outputs.build-image-sha }}
steps:
- name: Checkout Electron
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
with:
path: src/electron
fetch-depth: 0
@@ -120,7 +120,7 @@ jobs:
build-image-sha: ${{ needs.setup.outputs.build-image-sha}}
steps:
- name: Checkout Electron
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
with:
path: src/electron
fetch-depth: 0

View File

@@ -30,7 +30,7 @@ jobs:
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True'
steps:
- name: Checkout Electron
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
with:
path: src/electron
fetch-depth: 0

View File

@@ -31,7 +31,7 @@ jobs:
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_mac=True --custom-var=host_os=mac'
steps:
- name: Checkout Electron
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
with:
path: src/electron
fetch-depth: 0
@@ -40,7 +40,7 @@ jobs:
with:
generate-sas-token: 'true'
publish-x64:
publish-x64-darwin:
uses: ./.github/workflows/pipeline-segment-electron-build.yml
needs: checkout-macos
with:
@@ -48,13 +48,29 @@ jobs:
build-runs-on: macos-14-xlarge
target-platform: macos
target-arch: x64
target-variant: darwin
is-release: true
gn-build-type: release
generate-symbols: true
upload-to-storage: ${{ inputs.upload-to-storage }}
secrets: inherit
publish-arm64:
publish-x64-mas:
uses: ./.github/workflows/pipeline-segment-electron-build.yml
needs: checkout-macos
with:
environment: production-release
build-runs-on: macos-14-xlarge
target-platform: macos
target-arch: x64
target-variant: mas
is-release: true
gn-build-type: release
generate-symbols: true
upload-to-storage: ${{ inputs.upload-to-storage }}
secrets: inherit
publish-arm64-darwin:
uses: ./.github/workflows/pipeline-segment-electron-build.yml
needs: checkout-macos
with:
@@ -62,6 +78,22 @@ jobs:
build-runs-on: macos-14-xlarge
target-platform: macos
target-arch: arm64
target-variant: darwin
is-release: true
gn-build-type: release
generate-symbols: true
upload-to-storage: ${{ inputs.upload-to-storage }}
secrets: inherit
publish-arm64-mas:
uses: ./.github/workflows/pipeline-segment-electron-build.yml
needs: checkout-macos
with:
environment: production-release
build-runs-on: macos-14-xlarge
target-platform: macos
target-arch: arm64
target-variant: mas
is-release: true
gn-build-type: release
generate-symbols: true

View File

@@ -20,7 +20,7 @@ jobs:
container: ${{ fromJSON(inputs.container) }}
steps:
- name: Checkout Electron
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
with:
path: src/electron
fetch-depth: 0

View File

@@ -20,7 +20,7 @@ jobs:
container: ${{ fromJSON(inputs.container) }}
steps:
- name: Checkout Electron
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
with:
path: src/electron
fetch-depth: 0

View File

@@ -15,6 +15,10 @@ on:
type: string
description: 'Arch to build for, can be x64, arm64 or arm'
required: true
target-variant:
type: string
description: 'Variant to build for, no effect on non-macOS target platforms. Can be darwin, mas or all.'
default: all
build-runs-on:
type: string
description: 'What host to run the build'
@@ -57,13 +61,14 @@ on:
concurrency:
group: electron-build-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ inputs.is-asan }}-${{ github.ref }}
group: electron-build-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ inputs.target-variant }}-${{ inputs.is-asan }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' && !endsWith(github.ref, '-x-y') }}
env:
ELECTRON_ARTIFACTS_BLOB_STORAGE: ${{ secrets.ELECTRON_ARTIFACTS_BLOB_STORAGE }}
ELECTRON_RBE_JWT: ${{ secrets.ELECTRON_RBE_JWT }}
ELECTRON_GITHUB_TOKEN: ${{ secrets.ELECTRON_GITHUB_TOKEN }}
SUDOWOODO_EXCHANGE_URL: ${{ secrets.SUDOWOODO_EXCHANGE_URL }}
SUDOWOODO_EXCHANGE_TOKEN: ${{ secrets.SUDOWOODO_EXCHANGE_TOKEN }}
GCLIENT_EXTRA_ARGS: ${{ inputs.target-platform == 'macos' && '--custom-var=checkout_mac=True --custom-var=host_os=mac' || '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True' }}
ELECTRON_OUT_DIR: Default
@@ -78,13 +83,19 @@ jobs:
- name: Create src dir
run: mkdir src
- name: Checkout Electron
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
with:
path: src/electron
fetch-depth: 0
- name: Free up space (macOS)
if: ${{ inputs.target-platform == 'macos' }}
uses: ./src/electron/.github/actions/free-space-macos
- name: Check disk space after freeing up space
if: ${{ inputs.target-platform == 'macos' }}
run: df -h
- name: Setup Node.js/npm
if: ${{ inputs.target-platform == 'macos' }}
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b
uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6
with:
node-version: 20.11.x
cache: yarn
@@ -145,7 +156,7 @@ jobs:
if: ${{ inputs.target-platform == 'linux' }}
uses: ./src/electron/.github/actions/restore-cache-aks
- name: Checkout Electron
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
with:
path: src/electron
fetch-depth: 0
@@ -182,6 +193,7 @@ jobs:
if: ${{ inputs.target-platform == 'macos' }}
uses: ./src/electron/.github/actions/free-space-macos
- name: Build Electron
if: ${{ inputs.target-platform != 'macos' || (inputs.target-variant == 'all' || inputs.target-variant == 'darwin') }}
uses: ./src/electron/.github/actions/build-electron
with:
target-arch: ${{ inputs.target-arch }}
@@ -193,13 +205,13 @@ jobs:
upload-to-storage: '${{ inputs.upload-to-storage }}'
is-asan: '${{ inputs.is-asan }}'
- name: Set GN_EXTRA_ARGS for MAS Build
if: ${{ inputs.target-platform == 'macos' }}
if: ${{ inputs.target-platform == 'macos' && (inputs.target-variant == 'all' || inputs.target-variant == 'mas') }}
run: |
echo "MAS_BUILD=true" >> $GITHUB_ENV
GN_EXTRA_ARGS='is_mas_build=true'
echo "GN_EXTRA_ARGS=$GN_EXTRA_ARGS" >> $GITHUB_ENV
- name: Build Electron (MAS)
if: ${{ inputs.target-platform == 'macos' }}
if: ${{ inputs.target-platform == 'macos' && (inputs.target-variant == 'all' || inputs.target-variant == 'mas') }}
uses: ./src/electron/.github/actions/build-electron
with:
target-arch: ${{ inputs.target-arch }}

View File

@@ -50,10 +50,27 @@ jobs:
TARGET_ARCH: ${{ inputs.target-arch }}
steps:
- name: Checkout Electron
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
with:
path: src/electron
fetch-depth: 0
- name: Cleanup disk space on macOS
if: ${{ inputs.target-platform == 'macos' }}
shell: bash
run: |
sudo mkdir -p $TMPDIR/del-target
tmpify() {
if [ -d "$1" ]; then
sudo mv "$1" $TMPDIR/del-target/$(echo $1|shasum -a 256|head -n1|cut -d " " -f1)
fi
}
tmpify /Library/Developer/CoreSimulator
tmpify ~/Library/Developer/CoreSimulator
sudo rm -rf $TMPDIR/del-target
- name: Check disk space after freeing up space
if: ${{ inputs.target-platform == 'macos' }}
run: df -h
- name: Install Build Tools
uses: ./src/electron/.github/actions/install-build-tools
- name: Init Build Tools
@@ -111,7 +128,7 @@ jobs:
- name: Add CHROMIUM_BUILDTOOLS_PATH to env
run: echo "CHROMIUM_BUILDTOOLS_PATH=$(pwd)/src/buildtools" >> $GITHUB_ENV
- name: Checkout Electron
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
with:
path: src/electron
fetch-depth: 0

View File

@@ -38,7 +38,6 @@ permissions:
env:
ELECTRON_OUT_DIR: Default
ELECTRON_RBE_JWT: ${{ secrets.ELECTRON_RBE_JWT }}
ELECTRON_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
test:
@@ -92,7 +91,7 @@ jobs:
fi
done
- name: Checkout Electron
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
with:
path: src/electron
fetch-depth: 0
@@ -147,17 +146,21 @@ jobs:
sudo security authorizationdb write com.apple.trust-settings.admin allow
cd src/electron
./script/codesign/generate-identity.sh
- name: Install Datadog CLI
run: |
cd src/electron
node script/yarn global add @datadog/datadog-ci
- name: Run Electron Tests
shell: bash
env:
MOCHA_REPORTER: mocha-multi-reporters
ELECTRON_TEST_RESULTS_DIR: junit
MOCHA_MULTI_REPORTERS: mocha-junit-reporter, tap
ELECTRON_DISABLE_SECURITY_WARNINGS: 1
ELECTRON_SKIP_NATIVE_MODULE_TESTS: true
DISPLAY: ':99.0'
run: |
cd src/electron
export ELECTRON_TEST_RESULTS_DIR=`pwd`/junit
# Get which tests are on this shard
tests_files=$(node script/split-tests ${{ matrix.shard }} ${{ inputs.target-platform == 'macos' && 2 || 3 }})
@@ -186,9 +189,21 @@ jobs:
runuser -u builduser -- xvfb-run script/actions/run-tests.sh script/yarn test --runners=main --trace-uncaught --enable-logging --files $tests_files
fi
fi
- name: Upload Test results to Datadog
env:
DD_ENV: ci
DD_SERVICE: electron
DD_API_KEY: ${{ secrets.DD_API_KEY }}
DD_CIVISIBILITY_LOGS_ENABLED: true
DD_TAGS: "os.architecture:${{ inputs.target-arch }},os.family:${{ inputs.target-platform }},os.platform:${{ inputs.target-platform }},asan:${{ inputs.is-asan }}"
run: |
if ! [ -z $DD_API_KEY ]; then
datadog-ci junit upload src/electron/junit/test-results-main.xml
fi
if: always() && !cancelled()
- name: Upload Test Artifacts
if: always() && !cancelled()
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874
with:
name: test_artifacts_${{ env.ARTIFACT_KEY }}
path: src/electron/spec/artifacts

View File

@@ -45,7 +45,7 @@ jobs:
container: ${{ fromJSON(inputs.test-container) }}
steps:
- name: Checkout Electron
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
with:
path: src/electron
fetch-depth: 0
@@ -108,7 +108,7 @@ jobs:
container: ${{ fromJSON(inputs.test-container) }}
steps:
- name: Checkout Electron
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
with:
path: src/electron
fetch-depth: 0

View File

@@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Trigger Slack workflow
uses: slackapi/slack-github-action@70cd7be8e40a46e8b0eced40b0de447bdb42f68e # v1.26.0
uses: slackapi/slack-github-action@37ebaef184d7626c5f204ab8d3baff4262dd30f0 # v1.27.0
with:
payload: |
{

View File

@@ -22,7 +22,7 @@ jobs:
steps:
- name: "Checkout code"
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
with:
persist-credentials: false
@@ -42,7 +42,7 @@ jobs:
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
# format to the repository Actions tab.
- name: "Upload artifact"
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: SARIF file
path: results.sarif
@@ -50,6 +50,6 @@ jobs:
# Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@883d8588e56d1753a8a58c1c86e88976f0c23449 # v3.26.3
uses: github/codeql-action/upload-sarif@e2b3eafc8d227b0241d48be5f425d47c2d750a13 # v3.26.10
with:
sarif_file: results.sarif

View File

@@ -19,7 +19,7 @@ jobs:
with:
creds: ${{ secrets.APPVEYOR_UPDATER_GH_APP_CREDS }}
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
with:
fetch-depth: 0
token: ${{ steps.generate-token.outputs.token }}

View File

@@ -74,7 +74,7 @@ if (is_linux) {
"notify_notification_set_image_from_pixbuf",
"notify_notification_set_timeout",
"notify_notification_set_urgency",
"notify_notification_set_hint_string",
"notify_notification_set_hint",
"notify_notification_show",
"notify_notification_close",
]
@@ -674,6 +674,8 @@ source_set("electron_lib") {
if (enable_plugins) {
sources += [
"shell/browser/electron_plugin_info_host_impl.cc",
"shell/browser/electron_plugin_info_host_impl.h",
"shell/common/plugin_info.cc",
"shell/common/plugin_info.h",
]
@@ -733,6 +735,7 @@ source_set("electron_lib") {
"//components/pdf/common:util",
"//components/pdf/renderer",
"//pdf",
"//pdf:content_restriction",
]
sources += [
"shell/browser/electron_pdf_document_helper_client.cc",

4
DEPS
View File

@@ -2,9 +2,9 @@ gclient_gn_args_from = 'src'
vars = {
'chromium_version':
'129.0.6668.0',
'130.0.6723.44',
'node_version':
'v20.16.0',
'v20.18.0',
'nan_version':
'e14bdcd1f72d62bca1d541b66da43130384ec213',
'squirrel.mac_version':

View File

@@ -29,14 +29,14 @@
version: 1.0.{build}
build_cloud: electronhq-16-core
image: e-129.0.6656.0
image: e-130.0.6695.0-node-20
environment:
GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache
ELECTRON_OUT_DIR: Default
ELECTRON_ENABLE_STACK_DUMPING: 1
ELECTRON_ALSO_LOG_TO_STDERR: 1
MOCHA_REPORTER: mocha-multi-reporters
MOCHA_MULTI_REPORTERS: "@marshallofsound/mocha-appveyor-reporter, tap"
MOCHA_MULTI_REPORTERS: "@marshallofsound/mocha-appveyor-reporter, mocha-junit-reporter, tap"
DEPOT_TOOLS_WIN_TOOLCHAIN: 1
DEPOT_TOOLS_WIN_TOOLCHAIN_BASE_URL: "https://dev-cdn.electronjs.org/windows-toolchains/_"
GYP_MSVS_HASH_7393122652: 3ba76c5c20
@@ -45,10 +45,16 @@ environment:
matrix:
- job_name: Build Arm on X64 Windows
- job_name: Test On Windows On Arm Hardware
- job_name: Test On Windows On Arm Hardware 1
job_depends_on: Build Arm on X64 Windows
APPVEYOR_BUILD_WORKER_IMAGE: base-woa
APPVEYOR_BUILD_WORKER_CLOUD: electronhq-woa
shard: 1
- job_name: Test On Windows On Arm Hardware 2
job_depends_on: Build Arm on X64 Windows
APPVEYOR_BUILD_WORKER_IMAGE: base-woa
APPVEYOR_BUILD_WORKER_CLOUD: electronhq-woa
shard: 2
clone_script:
- ps: git clone -q $("--branch=" + $Env:APPVEYOR_REPO_BRANCH) $("https://github.com/" + $Env:APPVEYOR_REPO_NAME + ".git") $Env:APPVEYOR_BUILD_FOLDER
@@ -70,8 +76,9 @@ for:
- job_name: Build Arm on X64 Windows
build_script:
# TODO: Remove --ignore-engines once WOA image is up to node 20
- ps: |
node script/yarn.js install --frozen-lockfile
node script/yarn.js install --frozen-lockfile --ignore-engines
node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER
$env:SHOULD_SKIP_ARTIFACT_VALIDATION = "false"
if ($LASTEXITCODE -eq 0) {
@@ -95,6 +102,8 @@ for:
- git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
- ps: New-Item -Name depot_tools\.disable_auto_update -ItemType File
- depot_tools\bootstrap\win_tools.bat
- ps: |
Set-Content -Path $pwd\depot_tools\build_telemetry.cfg -Value '{"user": "info@electronjs.org", "status": "opt-out", "countdown": 10, "version": 1}'
- ps: $env:PATH="$pwd\depot_tools;$env:PATH"
- ps: >-
if (Test-Path -Path "$pwd\src\electron") {
@@ -115,6 +124,13 @@ for:
$env:RBE_experimental_credentials_helper = $env:RECLIENT_HELPER
- ps: >-
$env:RBE_experimental_credentials_helper_args = "print"
- ps: >-
if ($env:ELECTRON_RBE_JWT -eq '') {
$env:RBE_fail_early_min_action_count = "0"
$env:RBE_fail_early_min_fallback_ratio = "0"
$env:RBE_exec_strategy = "local"
$env:RBE_remote_update_cache= "false"
}
- cd ..\..
- ps: $env:CHROMIUM_BUILDTOOLS_PATH="$pwd\src\buildtools"
- ps: >-
@@ -167,8 +183,8 @@ for:
if ($env:GN_CONFIG -eq 'release') {
# Needed for msdia140.dll on 64-bit windows
$env:Path += ";$pwd\third_party\llvm-build\Release+Asserts\bin"
autoninja -C out/Default electron:electron_symbols
}
- if "%GN_CONFIG%"=="release" ( autoninja -C out/Default electron:electron_symbols )
- ps: >-
if ($env:GN_CONFIG -eq 'release') {
python3 electron\script\zip-symbols.py
@@ -244,18 +260,23 @@ for:
}
- matrix:
only:
- job_name: Test On Windows On Arm Hardware
- job_name: Test On Windows On Arm Hardware 1
- job_name: Test On Windows On Arm Hardware 2
environment:
IGNORE_YARN_INSTALL_ERROR: 1
ELECTRON_TEST_RESULTS_DIR: junit
MOCHA_MULTI_REPORTERS: 'mocha-junit-reporter, tap'
ELECTRON_TEST_RESULTS_DIR: C:\projects\src\electron\junit
MOCHA_MULTI_REPORTERS: "@marshallofsound/mocha-appveyor-reporter, mocha-junit-reporter, tap"
MOCHA_REPORTER: mocha-multi-reporters
ELECTRON_SKIP_NATIVE_MODULE_TESTS: true
DD_ENV: ci
DD_SERVICE: electron
DD_CIVISIBILITY_LOGS_ENABLED: true
DD_GIT_REPOSITORY_URL: "https://github.com/electron/electron.git"
build_script:
- ps: |
node script/yarn.js install --frozen-lockfile
node script/yarn.js install --frozen-lockfile --ignore-engines
node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER
if ($LASTEXITCODE -eq 0) {
Write-warning "Skipping build for doc only change"
@@ -263,6 +284,7 @@ for:
} else {
$global:LASTEXITCODE = 0
}
- ps: Invoke-WebRequest -Uri "https://github.com/DataDog/datadog-ci/releases/latest/download/datadog-ci_win-x64" -OutFile "C:\projects\src\electron\datadog-ci.exe"
- cd ..
- mkdir out\Default
- cd ..
@@ -311,11 +333,22 @@ for:
if ($env:TARGET_ARCH -eq 'ia32') {
$env:npm_config_arch = "ia32"
}
- echo Running main test suite & node script/yarn test --runners=main --enable-logging --disable-features=CalculateNativeWinOcclusion
- ps: $env:tests_files=node script\split-tests $env:shard 2
- echo "Running shard %shard% specs %tests_files%"
- echo Running main test suite & node script/yarn test --runners=main --enable-logging --disable-features=CalculateNativeWinOcclusion --files %tests_files%
- cd ..
- echo Verifying non proprietary ffmpeg & python electron\script\verify-ffmpeg.py --build-dir out\Default --source-root %cd% --ffmpeg-path out\ffmpeg
on_finish:
# Uncomment these lines to enable RDP
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
- if exist electron\electron.log ( appveyor-retry appveyor PushArtifact electron\electron.log )
- if exist electron\junit\test-results-main.xml ( appveyor-retry appveyor PushArtifact electron\junit\test-results-main.xml )
- ps: |
if ($env:DD_API_KEY) {
$env:DD_GIT_COMMIT_SHA = $env:APPVEYOR_REPO_COMMIT
$env:DD_GIT_BRANCH = $env:APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH
$env:DD_TAGS = "os.architecture:$env:TARGET_ARCH,os.family:windows,os.platform:win32"
if (Test-Path -Path "C:\projects\src\electron\junit\test-results-main.xml") {
C:\projects\src\electron\datadog-ci.exe junit upload --verbose C:\projects\src\electron\junit\test-results-main.xml
}
}

View File

@@ -29,14 +29,14 @@
version: 1.0.{build}
build_cloud: electronhq-16-core
image: e-129.0.6656.0
image: e-130.0.6695.0-node-20
environment:
GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache
ELECTRON_OUT_DIR: Default
ELECTRON_ENABLE_STACK_DUMPING: 1
ELECTRON_ALSO_LOG_TO_STDERR: 1
MOCHA_REPORTER: mocha-multi-reporters
MOCHA_MULTI_REPORTERS: "@marshallofsound/mocha-appveyor-reporter, tap"
MOCHA_MULTI_REPORTERS: "@marshallofsound/mocha-appveyor-reporter, mocha-junit-reporter, tap"
DEPOT_TOOLS_WIN_TOOLCHAIN: 1
DEPOT_TOOLS_WIN_TOOLCHAIN_BASE_URL: "https://dev-cdn.electronjs.org/windows-toolchains/_"
GYP_MSVS_HASH_7393122652: 3ba76c5c20
@@ -45,8 +45,12 @@ environment:
matrix:
- job_name: Build
- job_name: Test
- job_name: Test 1
job_depends_on: Build
shard: 1
- job_name: Test 2
job_depends_on: Build
shard: 2
clone_script:
- ps: git clone -q $("--branch=" + $Env:APPVEYOR_REPO_BRANCH) $("https://github.com/" + $Env:APPVEYOR_REPO_NAME + ".git") $Env:APPVEYOR_BUILD_FOLDER
@@ -93,6 +97,8 @@ for:
- git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
- ps: New-Item -Name depot_tools\.disable_auto_update -ItemType File
- depot_tools\bootstrap\win_tools.bat
- ps: |
Set-Content -Path $pwd\depot_tools\build_telemetry.cfg -Value '{"user": "info@electronjs.org", "status": "opt-out", "countdown": 10, "version": 1}'
- ps: $env:PATH="$pwd\depot_tools;$env:PATH"
- ps: >-
if (Test-Path -Path "$pwd\src\electron") {
@@ -113,6 +119,13 @@ for:
$env:RBE_experimental_credentials_helper = $env:RECLIENT_HELPER
- ps: >-
$env:RBE_experimental_credentials_helper_args = "print"
- ps: >-
if ($env:ELECTRON_RBE_JWT -eq '') {
$env:RBE_fail_early_min_action_count = "0"
$env:RBE_fail_early_min_fallback_ratio = "0"
$env:RBE_exec_strategy = "local"
$env:RBE_remote_update_cache= "false"
}
- cd ..\..
- ps: $env:CHROMIUM_BUILDTOOLS_PATH="$pwd\src\buildtools"
- ps: >-
@@ -164,8 +177,8 @@ for:
if ($env:GN_CONFIG -eq 'release') {
# Needed for msdia140.dll on 64-bit windows
$env:Path += ";$pwd\third_party\llvm-build\Release+Asserts\bin"
autoninja -C out/Default electron:electron_symbols
}
- if "%GN_CONFIG%"=="release" ( autoninja -C out/Default electron:electron_symbols )
- ps: >-
if ($env:GN_CONFIG -eq 'release') {
python3 electron\script\zip-symbols.py
@@ -237,7 +250,15 @@ for:
}
- matrix:
only:
- job_name: Test
- job_name: Test 1
- job_name: Test 2
environment:
DD_ENV: ci
DD_SERVICE: electron
DD_CIVISIBILITY_LOGS_ENABLED: true
DD_GIT_REPOSITORY_URL: "https://github.com/electron/electron.git"
ELECTRON_TEST_RESULTS_DIR: C:\projects\src\electron\junit
init:
- ps: |
@@ -254,6 +275,7 @@ for:
} else {
$global:LASTEXITCODE = 0
}
- npm install -g @datadog/datadog-ci
- cd ..
- mkdir out\Default
- cd ..
@@ -299,7 +321,9 @@ for:
if ($env:TARGET_ARCH -eq 'ia32') {
$env:npm_config_arch = "ia32"
}
- echo Running main test suite & node script/yarn test -- --trace-uncaught --runners=main --enable-logging=file --log-file=%cd%\electron.log
- ps: $env:tests_files=node script\split-tests $env:shard 2
- echo "Running shard %shard% specs %tests_files%"
- echo Running main test suite & node script/yarn test -- --trace-uncaught --runners=main --enable-logging --files %tests_files%
- cd ..
- echo Verifying non proprietary ffmpeg & python electron\script\verify-ffmpeg.py --build-dir out\Default --source-root %cd% --ffmpeg-path out\ffmpeg
- echo "About to verify mksnapshot"
@@ -311,4 +335,13 @@ for:
on_finish:
# Uncomment these lines to enable RDP
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
- if exist electron\electron.log ( appveyor-retry appveyor PushArtifact electron\electron.log )
- if exist electron\junit\test-results-main.xml ( appveyor-retry appveyor PushArtifact electron\junit\test-results-main.xml )
- ps: |
if ($env:RUN_TESTS -eq 'true' -And $env:DD_API_KEY) {
$env:DD_GIT_COMMIT_SHA = $env:APPVEYOR_REPO_COMMIT
$env:DD_GIT_BRANCH = $env:APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH
$env:DD_TAGS = "os.architecture:$env:TARGET_ARCH,os.family:windows,os.platform:win32"
if (Test-Path -Path "C:\projects\src\electron\junit\test-results-main.xml") {
C:\Users\appveyor\AppData\Roaming\npm\datadog-ci.ps1 junit upload --verbose C:\projects\src\electron\junit\test-results-main.xml
}
}

View File

@@ -1,8 +1,9 @@
const TerserPlugin = require('terser-webpack-plugin');
const webpack = require('webpack');
const WrapperPlugin = require('wrapper-webpack-plugin');
const fs = require('node:fs');
const path = require('node:path');
const webpack = require('webpack');
const TerserPlugin = require('terser-webpack-plugin');
const WrapperPlugin = require('wrapper-webpack-plugin');
const electronRoot = path.resolve(__dirname, '../..');

View File

@@ -114,6 +114,8 @@ static_library("chrome") {
"//chrome/browser/ui/view_ids.h",
"//chrome/browser/ui/views/eye_dropper/eye_dropper.cc",
"//chrome/browser/ui/views/eye_dropper/eye_dropper.h",
"//chrome/browser/ui/views/overlay/back_to_tab_button.cc",
"//chrome/browser/ui/views/overlay/back_to_tab_button.h",
"//chrome/browser/ui/views/overlay/back_to_tab_label_button.cc",
"//chrome/browser/ui/views/overlay/close_image_button.cc",
"//chrome/browser/ui/views/overlay/close_image_button.h",
@@ -266,11 +268,13 @@ static_library("chrome") {
"//chrome/browser/media/webrtc/thumbnail_capturer_mac.h",
"//chrome/browser/media/webrtc/thumbnail_capturer_mac.mm",
"//chrome/browser/media/webrtc/window_icon_util_mac.mm",
"//chrome/browser/permissions/system/media_authorization_wrapper_mac.h",
"//chrome/browser/platform_util_mac.mm",
"//chrome/browser/process_singleton_mac.mm",
"//chrome/browser/ui/views/eye_dropper/eye_dropper_view_mac.h",
"//chrome/browser/ui/views/eye_dropper/eye_dropper_view_mac.mm",
]
deps += [ ":system_media_capture_permissions_mac_conflict" ]
}
if (enable_widevine) {
@@ -490,3 +494,16 @@ source_set("chrome_spellchecker") {
"//components/spellcheck/renderer",
]
}
# These sources create an object file conflict with one in |:chrome|, so they
# must live in a separate target.
# Conflicting sources:
# //chrome/browser/media/webrtc/system_media_capture_permissions_stats_mac.mm
# //chrome/browser/permissions/system/system_media_capture_permissions_mac.mm
source_set("system_media_capture_permissions_mac_conflict") {
sources = [
"//chrome/browser/permissions/system/system_media_capture_permissions_mac.h",
"//chrome/browser/permissions/system/system_media_capture_permissions_mac.mm",
]
deps = [ "//chrome/common" ]
}

View File

@@ -1,5 +1,6 @@
import { shell } from 'electron/common';
import { app, dialog, BrowserWindow, ipcMain } from 'electron/main';
import * as path from 'node:path';
import * as url from 'node:url';

View File

@@ -4,6 +4,7 @@ import * as fs from 'node:fs';
import { Module } from 'node:module';
import * as path from 'node:path';
import * as url from 'node:url';
const { app, dialog } = electron;
type DefaultAppOptions = {
@@ -255,6 +256,7 @@ async function startRepl () {
// start the default app.
if (option.file && !option.webdriver) {
const file = option.file;
// eslint-disable-next-line n/no-deprecated-api
const protocol = url.parse(file).protocol;
const extension = path.extname(file);
if (protocol === 'http:' || protocol === 'https:' || protocol === 'file:' || protocol === 'chrome:') {

View File

@@ -37,6 +37,7 @@ an issue:
* [Offline/Online Detection](tutorial/online-offline-events.md)
* [Represented File for macOS BrowserWindows](tutorial/represented-file.md)
* [Native File Drag & Drop](tutorial/native-file-drag-drop.md)
* [Navigation History](tutorial/navigation-history.md)
* [Offscreen Rendering](tutorial/offscreen-rendering.md)
* [Dark Mode](tutorial/dark-mode.md)
* [Web embeds in Electron](tutorial/web-embeds.md)

View File

@@ -32,22 +32,28 @@ This is a requirement of `Squirrel.Mac`.
### Windows
On Windows, you have to install your app into a user's machine before you can
use the `autoUpdater`, so it is recommended that you use the
[electron-winstaller][installer-lib], [Electron Forge][electron-forge-lib] or the [grunt-electron-installer][installer] package to generate a Windows installer.
use the `autoUpdater`, so it is recommended that you use
[electron-winstaller][installer-lib] or [Electron Forge's Squirrel.Windows maker][electron-forge-lib] to generate a Windows installer.
When using [electron-winstaller][installer-lib] or [Electron Forge][electron-forge-lib] make sure you do not try to update your app [the first time it runs](https://github.com/electron/windows-installer#handling-squirrel-events) (Also see [this issue for more info](https://github.com/electron/electron/issues/7155)). It's also recommended to use [electron-squirrel-startup](https://github.com/mongodb-js/electron-squirrel-startup) to get desktop shortcuts for your app.
Apps built with Squirrel.Windows will trigger [custom launch events](https://github.com/Squirrel/Squirrel.Windows/blob/51f5e2cb01add79280a53d51e8d0cfa20f8c9f9f/docs/using/custom-squirrel-events-non-cs.md#application-startup-commands)
that must be handled by your Electron application to ensure proper setup and teardown.
The installer generated with Squirrel will create a shortcut icon with an
Squirrel.Windows apps will launch with the `--squirrel-firstrun` argument immediately
after installation. During this time, Squirrel.Windows will obtain a file lock on
your app, and `autoUpdater` requests will fail until the lock is released. In practice,
this means that you won't be able to check for updates on first launch for the first
few seconds. You can work around this by not checking for updates when `process.argv`
contains the `--squirrel-firstrun` flag or by setting a 10-second timeout on your
update checks (see [electron/electron#7155](https://github.com/electron/electron/issues/7155)
for more information).
The installer generated with Squirrel.Windows will create a shortcut icon with an
[Application User Model ID][app-user-model-id] in the format of
`com.squirrel.PACKAGE_ID.YOUR_EXE_WITHOUT_DOT_EXE`, examples are
`com.squirrel.slack.Slack` and `com.squirrel.code.Code`. You have to use the
same ID for your app with `app.setAppUserModelId` API, otherwise Windows will
not be able to pin your app properly in task bar.
Like Squirrel.Mac, Windows can host updates on S3 or any other static file host.
You can read the documents of [Squirrel.Windows][squirrel-windows] to get more details
about how Squirrel.Windows works.
## Events
The `autoUpdater` object emits the following events:
@@ -137,9 +143,7 @@ application starts.
[squirrel-mac]: https://github.com/Squirrel/Squirrel.Mac
[server-support]: https://github.com/Squirrel/Squirrel.Mac#server-support
[squirrel-windows]: https://github.com/Squirrel/Squirrel.Windows
[installer]: https://github.com/electron-archive/grunt-electron-installer
[installer-lib]: https://github.com/electron/windows-installer
[electron-forge-lib]: https://github.com/electron/forge
[electron-forge-lib]: https://www.electronforge.io/config/makers/squirrel.windows
[app-user-model-id]: https://learn.microsoft.com/en-us/windows/win32/shell/appids
[event-emitter]: https://nodejs.org/api/events.html#events_class_eventemitter

View File

@@ -126,10 +126,18 @@ or session log off.
#### Event: 'blur'
Returns:
* `event` Event
Emitted when the window loses focus.
#### Event: 'focus'
Returns:
* `event` Event
Emitted when the window gains focus.
#### Event: 'show'

View File

@@ -53,7 +53,7 @@ following properties:
[`request.followRedirect`](#requestfollowredirect) is invoked synchronously
during the [`redirect`](#event-redirect) event. Defaults to `follow`.
* `origin` string (optional) - The origin URL of the request.
* `referrerPolicy` string (optional) - can be `""`, `no-referrer`,
* `referrerPolicy` string (optional) - can be "", `no-referrer`,
`no-referrer-when-downgrade`, `origin`, `origin-when-cross-origin`,
`unsafe-url`, `same-origin`, `strict-origin`, or
`strict-origin-when-cross-origin`. Defaults to

View File

@@ -147,6 +147,25 @@ has been included below for completeness:
If the type you care about is not in the above table, it is probably not supported.
### Exposing ipcRenderer
Attempting to send the entire `ipcRenderer` module as an object over the `contextBridge` will result in
an empty object on the receiving side of the bridge. Sending over `ipcRenderer` in full can let any
code send any message, which is a security footgun. To interact through `ipcRenderer`, provide a safe wrapper
like below:
```js
// Preload (Isolated World)
contextBridge.exposeInMainWorld('electron', {
onMyEventName: (callback) => ipcRenderer.on('MyEventName', (e, ...args) => callback(args))
})
```
```js @ts-nocheck
// Renderer (Main World)
window.electron.onMyEventName(data => { /* ... */ })
```
### Exposing Node Global Symbols
The `contextBridge` can be used by the preload script to give your renderer access to Node APIs.

View File

@@ -74,7 +74,7 @@ The following methods are available on instances of `Cookies`:
`url`. Empty implies retrieving cookies of all URLs.
* `name` string (optional) - Filters cookies by name.
* `domain` string (optional) - Retrieves cookies whose domains match or are
subdomains of `domain`.
subdomains of `domains`.
* `path` string (optional) - Retrieves cookies whose path matches `path`.
* `secure` boolean (optional) - Filters cookies by their Secure property.
* `session` boolean (optional) - Filters out session or persistent cookies.

View File

@@ -20,7 +20,11 @@ app.whenReady().then(() => {
// Grant access to the first screen found.
callback({ video: sources[0], audio: 'loopback' })
})
})
// If true, use the system picker if available.
// Note: this is currently experimental. If the system picker
// is available, it will be used and the media request handler
// will not be invoked.
}, { useSystemPicker: true })
mainWindow.loadFile('index.html')
})

View File

@@ -31,7 +31,7 @@ Emitted when a request has been canceled during an ongoing HTTP transaction.
Returns:
`error` Error - Typically holds an error string identifying failure root cause.
* `error` Error - Typically holds an error string identifying failure root cause.
Emitted when an error was encountered while streaming response data events. For
instance, if the server closes the underlying while the response is still

View File

@@ -10,9 +10,9 @@ See [`Menu`](menu.md) for examples.
* `options` Object
* `click` Function (optional) - Will be called with
`click(menuItem, browserWindow, event)` when the menu item is clicked.
`click(menuItem, window, event)` when the menu item is clicked.
* `menuItem` MenuItem
* `browserWindow` [BrowserWindow](browser-window.md) | undefined - This will not be defined if no window is open.
* `window` [BaseWindow](base-window.md) | undefined - This will not be defined if no window is open.
* `event` [KeyboardEvent](structures/keyboard-event.md)
* `role` string (optional) - Can be `undo`, `redo`, `cut`, `copy`, `paste`, `pasteAndMatchStyle`, `delete`, `selectAll`, `reload`, `forceReload`, `toggleDevTools`, `resetZoom`, `zoomIn`, `zoomOut`, `toggleSpellChecker`, `togglefullscreen`, `window`, `minimize`, `close`, `help`, `about`, `services`, `hide`, `hideOthers`, `unhide`, `quit`, `showSubstitutions`, `toggleSmartQuotes`, `toggleSmartDashes`, `toggleTextReplacement`, `startSpeaking`, `stopSpeaking`, `zoom`, `front`, `appMenu`, `fileMenu`, `editMenu`, `viewMenu`, `shareMenu`, `recentDocuments`, `toggleTabBar`, `selectNextTab`, `selectPreviousTab`, `showAllTabs`, `mergeAllWindows`, `clearRecentDocuments`, `moveTabToNewWindow` or `windowMenu` - Define the action of the menu item, when specified the
`click` property will be ignored. See [roles](#roles).
@@ -146,7 +146,7 @@ A `Function` that is fired when the MenuItem receives a click event.
It can be called with `menuItem.click(event, focusedWindow, focusedWebContents)`.
* `event` [KeyboardEvent](structures/keyboard-event.md)
* `focusedWindow` [BrowserWindow](browser-window.md)
* `focusedWindow` [BaseWindow](browser-window.md)
* `focusedWebContents` [WebContents](web-contents.md)
#### `menuItem.submenu`

View File

@@ -36,7 +36,7 @@ Returns `boolean` - Whether or not desktop notifications are supported on the cu
* `subtitle` string (optional) _macOS_ - A subtitle for the notification, which will be displayed below the title.
* `body` string (optional) - The body text of the notification, which will be displayed below the title or subtitle.
* `silent` boolean (optional) - Whether or not to suppress the OS notification noise when showing the notification.
* `icon` (string | [NativeImage](native-image.md)) (optional) - An icon to use in the notification.
* `icon` (string | [NativeImage](native-image.md)) (optional) - An icon to use in the notification. If a string is passed, it must be a valid path to a local icon file.
* `hasReply` boolean (optional) _macOS_ - Whether or not to add an inline reply option to the notification.
* `timeoutType` string (optional) _Linux_ _Windows_ - The timeout duration of the notification. Can be 'default' or 'never'.
* `replyPlaceholder` string (optional) _macOS_ - The placeholder to write in the inline reply input field.

View File

@@ -495,7 +495,7 @@ app.whenReady().then(() => {
})
```
```js
```js @ts-nocheck
// Renderer Process
const portConnect = async () => {
@@ -953,7 +953,7 @@ session.fromPartition('some-partition').setPermissionCheckHandler((webContents,
})
```
#### `ses.setDisplayMediaRequestHandler(handler)`
#### `ses.setDisplayMediaRequestHandler(handler[, opts])`
* `handler` Function | null
* `request` Object
@@ -980,12 +980,18 @@ session.fromPartition('some-partition').setPermissionCheckHandler((webContents,
and this is set to `true`, then local playback of audio will not be muted (e.g. using `MediaRecorder`
to record `WebFrameMain` with this flag set to `true` will allow audio to pass through to the speakers
while recording). Default is `false`.
* `opts` Object (optional) _macOS_ _Experimental_
* `useSystemPicker` Boolean - true if the available native system picker should be used. Default is `false`. _macOS_ _Experimental_
This handler will be called when web content requests access to display media
via the `navigator.mediaDevices.getDisplayMedia` API. Use the
[desktopCapturer](desktop-capturer.md) API to choose which stream(s) to grant
access to.
`useSystemPicker` allows an application to use the system picker instead of providing a specific video source from `getSources`.
This option is experimental, and currently available for MacOS 15+ only. If the system picker is available and `useSystemPicker`
is set to `true`, the handler will not be invoked.
```js
const { session, desktopCapturer } = require('electron')
@@ -994,7 +1000,11 @@ session.defaultSession.setDisplayMediaRequestHandler((request, callback) => {
// Grant access to the first screen found.
callback({ video: sources[0] })
})
})
// Use the system picker if available.
// Note: this is currently experimental. If the system picker
// is available, it will be used and the media request handler
// will not be invoked.
}, { useSystemPicker: true })
```
Passing a [WebFrameMain](web-frame-main.md) object as a video or audio stream
@@ -1511,7 +1521,7 @@ Returns `Promise<void>` - resolves when all data has been cleared.
Clears various different types of data.
This method clears more types of data and is more thourough than the
This method clears more types of data and is more thorough than the
`clearStorageData` method.
**Note:** Cookies are stored at a broader scope than origins. When removing cookies and filtering by `origins` (or `excludeOrigins`), the cookies will be removed at the [registrable domain](https://url.spec.whatwg.org/#host-registrable-domain) level. For example, clearing cookies for the origin `https://really.specific.origin.example.com/` will end up clearing all cookies for `example.com`. Clearing cookies for the origin `https://my.website.example.co.uk/` will end up clearing all cookies for `example.co.uk`.

View File

@@ -91,6 +91,10 @@
title bar and a full size content window, the traffic light buttons will
display when being hovered over in the top left of the window.
**Note:** This option is currently experimental.
* `titleBarOverlay` Object | Boolean (optional) - When using a frameless window in conjunction with `win.setWindowButtonVisibility(true)` on macOS or using a `titleBarStyle` so that the standard window controls ("traffic lights" on macOS) are visible, this property enables the Window Controls Overlay [JavaScript APIs][overlay-javascript-apis] and [CSS Environment Variables][overlay-css-env-vars]. Specifying `true` will result in an overlay with default system colors. Default is `false`.
* `color` String (optional) _Windows_ _Linux_ - The CSS color of the Window Controls Overlay when enabled. Default is the system color.
* `symbolColor` String (optional) _Windows_ - The CSS color of the symbols on the Window Controls Overlay when enabled. Default is the system color.
* `height` Integer (optional) - The height of the title bar and Window Controls Overlay in pixels. Default is system height.
* `trafficLightPosition` [Point](point.md) (optional) _macOS_ -
Set a custom position for the traffic light buttons in frameless windows.
* `roundedCorners` boolean (optional) _macOS_ - Whether frameless window
@@ -149,3 +153,6 @@ Possible values are:
reserved for NSPanel, at runtime. Also, the window will appear on all
spaces (desktops).
* On Windows, possible type is `toolbar`.
[overlay-css-env-vars]: https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#css-environment-variables
[overlay-javascript-apis]: https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#javascript-apis

View File

@@ -2,10 +2,3 @@
* `webPreferences` [WebPreferences](web-preferences.md?inline) (optional) - Settings of web page's features.
* `paintWhenInitiallyHidden` boolean (optional) - Whether the renderer should be active when `show` is `false` and it has just been created. In order for `document.visibilityState` to work correctly on first load with `show: false` you should set this to `false`. Setting this to `false` will cause the `ready-to-show` event to not fire. Default is `true`.
* `titleBarOverlay` Object | Boolean (optional) - When using a frameless window in conjunction with `win.setWindowButtonVisibility(true)` on macOS or using a `titleBarStyle` so that the standard window controls ("traffic lights" on macOS) are visible, this property enables the Window Controls Overlay [JavaScript APIs][overlay-javascript-apis] and [CSS Environment Variables][overlay-css-env-vars]. Specifying `true` will result in an overlay with default system colors. Default is `false`.
* `color` String (optional) _Windows_ _Linux_ - The CSS color of the Window Controls Overlay when enabled. Default is the system color.
* `symbolColor` String (optional) _Windows_ - The CSS color of the symbols on the Window Controls Overlay when enabled. Default is the system color.
* `height` Integer (optional) - The height of the title bar and Window Controls Overlay in pixels. Default is system height.
[overlay-css-env-vars]: https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#css-environment-variables
[overlay-javascript-apis]: https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#javascript-apis

View File

@@ -39,7 +39,7 @@ updates the control in the touch bar. Possible values:
#### `touchBarScrubber.overlayStyle`
A `string` representing the style that selected items in the scrubber should have. This style is overlayed on top
A `string` representing the style that selected items in the scrubber should have. This style is overlaid on top
of the scrubber item instead of being placed behind it. Updating this value immediately updates the control in the
touch bar. Possible values:

View File

@@ -116,6 +116,20 @@ When the child process exits, then the value is `null` after the `exit` event is
Emitted once the child process has spawned successfully.
#### Event: 'error' _Experimental_
Returns:
* `type` string - Type of error. One of the following values:
* `FatalError`
* `location` string - Source location from where the error originated.
* `report` string - [`Node.js diagnostic report`][].
Emitted when the child process needs to terminate due to non continuable error from V8.
No matter if you listen to the `error` event, the `exit` event will be emitted after the
child process terminates.
#### Event: 'exit'
Returns:
@@ -138,3 +152,4 @@ Emitted when the child process sends a message using [`process.parentPort.postMe
[stdio]: https://nodejs.org/dist/latest/docs/api/child_process.html#optionsstdio
[event-emitter]: https://nodejs.org/api/events.html#events_class_eventemitter
[`MessagePortMain`]: message-port-main.md
[`Node.js diagnostic report`]: https://nodejs.org/docs/latest/api/report.html#diagnostic-report

View File

@@ -55,6 +55,8 @@ it becomes the topmost view.
* `view` View - Child view to remove.
If the view passed as a parameter is not a child of this view, this method is a no-op.
#### `view.setBounds(bounds)`
* `bounds` [Rectangle](structures/rectangle.md) - New bounds of the View.

View File

@@ -14,7 +14,7 @@ The `webUtils` module has the following methods:
Returns `string` - The file system path that this `File` object points to. In the case where the object passed in is not a `File` object an exception is thrown. In the case where the File object passed in was constructed in JS and is not backed by a file on disk an empty string is returned.
This method superceded the previous augmentation to the `File` object with the `path` property. An example is included below.
This method superseded the previous augmentation to the `File` object with the `path` property. An example is included below.
```js
// Before

View File

@@ -14,6 +14,33 @@ This document uses the following convention to categorize breaking changes:
## Planned Breaking API Changes (33.0)
### Behavior Changed: custom protocol URL handling on Windows
Due to changes made in Chromium to support [Non-Special Scheme URLs](http://bit.ly/url-non-special), custom protocol URLs that use Windows file paths will no longer work correctly with the deprecated `protocol.registerFileProtocol` and the `baseURLForDataURL` property on `BrowserWindow.loadURL`, `WebContents.loadURL`, and `<webview>.loadURL`. `protocol.handle` will also not work with these types of URLs but this is not a change since it has always worked that way.
```js
// No longer works
protocol.registerFileProtocol('other', () => {
callback({ filePath: '/path/to/my/file' })
})
const mainWindow = new BrowserWindow()
mainWindow.loadURL('data:text/html,<script src="loaded-from-dataurl.js"></script>', { baseURLForDataURL: 'other://C:\\myapp' })
mainWindow.loadURL('other://C:\\myapp\\index.html')
// Replace with
const path = require('node:path')
const nodeUrl = require('node:url')
protocol.handle(other, (req) => {
const srcPath = 'C:\\myapp\\'
const reqURL = new URL(req.url)
return net.fetch(nodeUrl.pathToFileURL(path.join(srcPath, reqURL.pathname)).toString())
})
mainWindow.loadURL('data:text/html,<script src="loaded-from-dataurl.js"></script>', { baseURLForDataURL: 'other://' })
mainWindow.loadURL('other://index.html')
```
### Behavior Changed: `webContents` property on `login` on `app`
The `webContents` property in the `login` event from `app` will be `null`

View File

@@ -65,6 +65,8 @@ $ git rebase --autosquash -i [COMMIT_SHA]^
$ ../electron/script/git-export-patches -o ../electron/patches/v8
```
Note that the `^` symbol [can cause trouble on Windows](https://stackoverflow.com/questions/14203952/git-reset-asks-more/14204318#14204318). The workaround is to either quote it `"[COMMIT_SHA]^"` or avoid it `[COMMIT_SHA]~1`.
#### Removing a patch
```bash

View File

@@ -0,0 +1,32 @@
<!DOCTYPE html>
<html>
<head>
<title>Enhanced Browser with Navigation History</title>
<link href="styles.css" rel="stylesheet" />
</head>
<body>
<div id="controls">
<button id="backBtn" title="Go back">Back</button>
<button id="forwardBtn" title="Go forward">Forward</button>
<button id="backHistoryBtn" title="Show back history">Back History</button>
<button id="forwardHistoryBtn" title="Show forward history">Forward History</button>
<input id="urlInput" type="text" placeholder="Enter URL">
<button id="goBtn" title="Navigate to URL">Go</button>
</div>
<div id="historyPanel" class="history-panel"></div>
<div id="description">
<h2>Navigation History Demo</h2>
<p>This demo showcases Electron's NavigationHistory API functionality.</p>
<p><strong>Back/Forward:</strong> Navigate through your browsing history.</p>
<p><strong>Back History/Forward History:</strong> View and select from your browsing history.</p>
<p><strong>URL Bar:</strong> Enter a URL and click 'Go' or press Enter to navigate.</p>
</div>
<script src="renderer.js"></script>
</body>
</html>

View File

@@ -0,0 +1,58 @@
const { app, BrowserWindow, BrowserView, ipcMain } = require('electron')
const path = require('path')
function createWindow () {
const mainWindow = new BrowserWindow({
width: 1000,
height: 800,
webPreferences: {
preload: path.join(__dirname, 'preload.js'),
nodeIntegration: false,
contextIsolation: true
}
})
mainWindow.loadFile('index.html')
const view = new BrowserView()
mainWindow.setBrowserView(view)
view.setBounds({ x: 0, y: 100, width: 1000, height: 800 })
view.setAutoResize({ width: true, height: true })
const navigationHistory = view.webContents.navigationHistory
ipcMain.handle('nav:back', () =>
navigationHistory.goBack()
)
ipcMain.handle('nav:forward', () => {
navigationHistory.goForward()
})
ipcMain.handle('nav:canGoBack', () => navigationHistory.canGoBack())
ipcMain.handle('nav:canGoForward', () => navigationHistory.canGoForward())
ipcMain.handle('nav:loadURL', (_, url) =>
view.webContents.loadURL(url)
)
ipcMain.handle('nav:getCurrentURL', () => view.webContents.getURL())
ipcMain.handle('nav:getHistory', () => {
return navigationHistory.getAllEntries()
})
view.webContents.on('did-navigate', () => {
mainWindow.webContents.send('nav:updated')
})
view.webContents.on('did-navigate-in-page', () => {
mainWindow.webContents.send('nav:updated')
})
}
app.whenReady().then(createWindow)
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') app.quit()
})
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) createWindow()
})

View File

@@ -0,0 +1,12 @@
const { contextBridge, ipcRenderer } = require('electron')
contextBridge.exposeInMainWorld('electronAPI', {
goBack: () => ipcRenderer.invoke('nav:back'),
goForward: () => ipcRenderer.invoke('nav:forward'),
canGoBack: () => ipcRenderer.invoke('nav:canGoBack'),
canGoForward: () => ipcRenderer.invoke('nav:canGoForward'),
loadURL: (url) => ipcRenderer.invoke('nav:loadURL', url),
getCurrentURL: () => ipcRenderer.invoke('nav:getCurrentURL'),
getHistory: () => ipcRenderer.invoke('nav:getHistory'),
onNavigationUpdate: (callback) => ipcRenderer.on('nav:updated', callback)
})

View File

@@ -0,0 +1,84 @@
const backBtn = document.getElementById('backBtn')
const forwardBtn = document.getElementById('forwardBtn')
const backHistoryBtn = document.getElementById('backHistoryBtn')
const forwardHistoryBtn = document.getElementById('forwardHistoryBtn')
const urlInput = document.getElementById('urlInput')
const goBtn = document.getElementById('goBtn')
const historyPanel = document.getElementById('historyPanel')
async function updateButtons () {
const canGoBack = await window.electronAPI.canGoBack()
const canGoForward = await window.electronAPI.canGoForward()
backBtn.disabled = !canGoBack
backHistoryBtn.disabled = !canGoBack
forwardBtn.disabled = !canGoForward
forwardHistoryBtn.disabled = !canGoForward
}
async function updateURL () {
urlInput.value = await window.electronAPI.getCurrentURL()
}
function transformURL (url) {
if (!url.startsWith('http://') && !url.startsWith('https://')) {
const updatedUrl = 'https://' + url
return updatedUrl
}
return url
}
async function navigate (url) {
const urlInput = transformURL(url)
await window.electronAPI.loadURL(urlInput)
}
async function showHistory (forward = false) {
const history = await window.electronAPI.getHistory()
const currentIndex = history.findIndex(entry => entry.url === transformURL(urlInput.value))
if (!currentIndex) {
return
}
const relevantHistory = forward
? history.slice(currentIndex + 1)
: history.slice(0, currentIndex).reverse()
historyPanel.innerHTML = ''
relevantHistory.forEach(entry => {
const div = document.createElement('div')
div.textContent = `Title: ${entry.title}, URL: ${entry.url}`
div.onclick = () => navigate(entry.url)
historyPanel.appendChild(div)
})
historyPanel.style.display = 'block'
}
backBtn.addEventListener('click', () => window.electronAPI.goBack())
forwardBtn.addEventListener('click', () => window.electronAPI.goForward())
backHistoryBtn.addEventListener('click', () => showHistory(false))
forwardHistoryBtn.addEventListener('click', () => showHistory(true))
goBtn.addEventListener('click', () => navigate(urlInput.value))
urlInput.addEventListener('keypress', (e) => {
if (e.key === 'Enter') {
navigate(urlInput.value)
}
})
document.addEventListener('click', (e) => {
if (e.target !== historyPanel && !historyPanel.contains(e.target) &&
e.target !== backHistoryBtn && e.target !== forwardHistoryBtn) {
historyPanel.style.display = 'none'
}
})
window.electronAPI.onNavigationUpdate(() => {
updateButtons()
updateURL()
})
updateButtons()

View File

@@ -0,0 +1,58 @@
body {
margin: 0;
font-family: Arial, sans-serif;
background-color: #f0f0f0;
}
#controls {
display: flex;
align-items: center;
padding: 10px;
background-color: #ffffff;
border-bottom: 1px solid #ccc;
}
button {
margin-right: 10px;
padding: 8px 12px;
font-size: 14px;
background-color: #4CAF50;
color: white;
border: none;
cursor: pointer;
transition: background-color 0.3s;
}
button:hover {
background-color: #45a049;
}
button:disabled {
background-color: #cccccc;
cursor: not-allowed;
}
#urlInput {
flex-grow: 1;
margin: 0 10px;
padding: 8px;
font-size: 14px;
}
#historyPanel {
display: none;
position: absolute;
top: 60px;
left: 10px;
background: white;
border: 1px solid #ccc;
padding: 10px;
max-height: 300px;
overflow-y: auto;
z-index: 1000;
}
#historyPanel div {
cursor: pointer;
padding: 5px;
}
#description {
background-color: #f0f0f0;
padding: 10px;
margin-top: 150px;
}

View File

@@ -9,10 +9,12 @@ check out our [Electron Versioning](./electron-versioning.md) doc.
| Electron | Alpha | Beta | Stable | EOL | Chrome | Node | Supported |
| ------- | ----- | ------- | ------ | ------ | ---- | ---- | ---- |
| 32.0.0 | 2024-Jun-14 | 2024-Jul-24 | 2024-Aug-20 | 2025-Mar-04 | M128 | TBD | ✅ |
| 34.0.0 | 2024-Oct-17 | 2024-Nov-13 | 2024-Jan-07 | 2025-Jun-24 | M132 | TBD | ✅ |
| 33.0.0 | 2024-Aug-22 | 2024-Sep-18 | 2024-Oct-15 | 2025-Apr-29 | M130 | v20.18 | ✅ |
| 32.0.0 | 2024-Jun-14 | 2024-Jul-24 | 2024-Aug-20 | 2025-Mar-04 | M128 | v20.16 | ✅ |
| 31.0.0 | 2024-Apr-18 | 2024-May-15 | 2024-Jun-11 | 2025-Jan-07 | M126 | v20.14 | ✅ |
| 30.0.0 | 2024-Feb-22 | 2024-Mar-20 | 2024-Apr-16 | 2024-Oct-15 | M124 | v20.11 | |
| 29.0.0 | 2023-Dec-07 | 2024-Jan-24 | 2024-Feb-20 | 2024-Aug-20 | M122 | v20.9 | |
| 30.0.0 | 2024-Feb-22 | 2024-Mar-20 | 2024-Apr-16 | 2024-Oct-15 | M124 | v20.11 | 🚫 |
| 29.0.0 | 2023-Dec-07 | 2024-Jan-24 | 2024-Feb-20 | 2024-Aug-20 | M122 | v20.9 | 🚫 |
| 28.0.0 | 2023-Oct-11 | 2023-Nov-06 | 2023-Dec-05 | 2024-Jun-11 | M120 | v18.18 | 🚫 |
| 27.0.0 | 2023-Aug-17 | 2023-Sep-13 | 2023-Oct-10 | 2024-Apr-16 | M118 | v18.17 | 🚫 |
| 26.0.0 | 2023-Jun-01 | 2023-Jun-27 | 2023-Aug-15 | 2024-Feb-20 | M116 | v18.16 | 🚫 |

View File

@@ -0,0 +1,76 @@
---
title: "Navigation History"
description: "The NavigationHistory API allows you to manage and interact with the browsing history of your Electron application."
slug: navigation-history
hide_title: false
---
# Navigation History
## Overview
The [NavigationHistory](../api/navigation-history.md) class allows you to manage and interact with the browsing history of your Electron application. This powerful feature enables you to create intuitive navigation experiences for your users.
## Accessing NavigationHistory
Navigation history is stored per [`WebContents`](../api/web-contents.md) instance. To access a specific instance of the NavigationHistory class, use the WebContents class's [`contents.navigationHistory` instance property](https://www.electronjs.org/docs/latest/api/web-contents#contentsnavigationhistory-readonly).
```js
const { BrowserWindow } = require('electron')
const mainWindow = new BrowserWindow()
const { navigationHistory } = mainWindow.webContents
```
## Navigating through history
Easily implement back and forward navigation:
```js @ts-type={navigationHistory:Electron.NavigationHistory}
// Go back
if (navigationHistory.canGoBack()) {
navigationHistory.goBack()
}
// Go forward
if (navigationHistory.canGoForward()) {
navigationHistory.goForward()
}
```
## Accessing history entries
Retrieve and display the user's browsing history:
```js @ts-type={navigationHistory:Electron.NavigationHistory}
const entries = navigationHistory.getAllEntries()
entries.forEach((entry) => {
console.log(`${entry.title}: ${entry.url}`)
})
```
Each navigation entry corresponds to a specific page. The indexing system follows a sequential order:
- Index 0: Represents the earliest visited page.
- Index N: Represents the most recent page visited.
## Navigating to specific entries
Allow users to jump to any point in their browsing history:
```js @ts-type={navigationHistory:Electron.NavigationHistory}
// Navigate to the 5th entry in the history, if the index is valid
navigationHistory.goToIndex(4)
// Navigate to the 2nd entry forward from the current position
if (navigationHistory.canGoToOffset(2)) {
navigationHistory.goToOffset(2)
}
```
Here's a full example that you can open with Electron Fiddle:
```fiddle docs/fiddles/features/navigation-history
```

View File

@@ -261,7 +261,59 @@ server-communication aspect of the process by loading your update from a local d
## Update server specification
A Squirrel-compatible update server has different
For advanced deployment needs, you can also roll out your own Squirrel-compatible update server.
For example, you may want to have percentage-based rollouts, distribute your app through separate
release channels, or put your update server behind an authentication check.
Squirrel.Windows and Squirrel.Mac clients require different response formats,
but you can use a single server for both platforms by sending requests to
different endpoints depending on the value of `process.platform`.
```js title='main.js'
const { app, autoUpdater } = require('electron')
const server = 'https://your-deployment-url.com'
// e.g. for Windows and app version 1.2.3
// https://your-deployment-url.com/update/win32/1.2.3
const url = `${server}/update/${process.platform}/${app.getVersion()}`
autoUpdater.setFeedURL({ url })
```
### Windows
A Squirrel.Windows client expects the update server to return the `RELEASES` artifact
of the latest available build at the `/RELEASES` subpath of your endpoint.
For example, if your feed URL is `https://your-deployment-url.com/update/win32/1.2.3`,
then the `https://your-deployment-url.com/update/win32/1.2.3/RELEASES` endpoint
should return the contents of the `RELEASES` artifact of the version you want to serve.
```plaintext title='https://your-deployment-url.com/update/win32/1.2.3/RELEASES'
B0892F3C7AC91D72A6271FF36905FEF8FE993520 https://your-static.storage/your-app-1.2.3-full.nupkg 103298365
```
Squirrel.Windows does the comparison check to see if the current app should update to
the version returned in `RELEASES`, so you should return a response even when no update
is available.
### macOS
When an update is available, the Squirrel.Mac client expects a JSON response at the feed URL's endpoint.
This object has a mandatory `url` property that maps to a ZIP archive of the
app update. All other properties in the object are optional.
```json title='https://your-deployment-url.com/update/darwin/0.31.0'
{
"url": "https://your-static.storage/your-app-1.2.3-darwin.zip",
"name": "1.2.3",
"notes": "Theses are some release notes innit",
"pub_date": "2024-09-18T12:29:53+01:00"
}
```
If no update is available, the server should return a [`204 No Content`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/204)
HTTP response.
[vercel]: https://vercel.com
[hazel]: https://github.com/vercel/hazel

View File

@@ -97,7 +97,7 @@ The [Window Controls Overlay API][] is a web standard that gives web apps the ab
customize their title bar region when installed on desktop. Electron exposes this API
through the `BrowserWindow` constructor option `titleBarOverlay`.
This option only works whenever a custom `titlebarStyle` is applied on macOS or Windows.
This option only works whenever a custom `titlebarStyle` is applied.
When `titleBarOverlay` is enabled, the window controls become exposed in their default
position, and DOM elements cannot use the area underneath this region.
@@ -107,7 +107,6 @@ Specifying `true` on either platform will result in an overlay region with defau
system colors:
```js title='main.js'
// on macOS or Windows
const { BrowserWindow } = require('electron')
const win = new BrowserWindow({
titleBarStyle: 'hidden',

View File

@@ -270,6 +270,7 @@ filenames = {
"shell/browser/api/electron_api_debugger.h",
"shell/browser/api/electron_api_desktop_capturer.cc",
"shell/browser/api/electron_api_desktop_capturer.h",
"shell/browser/api/electron_api_desktop_capturer_mac.mm",
"shell/browser/api/electron_api_dialog.cc",
"shell/browser/api/electron_api_download_item.cc",
"shell/browser/api/electron_api_download_item.h",
@@ -378,8 +379,6 @@ filenames = {
"shell/browser/electron_navigation_throttle.h",
"shell/browser/electron_permission_manager.cc",
"shell/browser/electron_permission_manager.h",
"shell/browser/electron_plugin_info_host_impl.cc",
"shell/browser/electron_plugin_info_host_impl.h",
"shell/browser/electron_speech_recognition_manager_delegate.cc",
"shell/browser/electron_speech_recognition_manager_delegate.h",
"shell/browser/electron_web_contents_utility_handler_impl.cc",
@@ -681,8 +680,8 @@ filenames = {
"shell/common/skia_util.cc",
"shell/common/skia_util.h",
"shell/common/thread_restrictions.h",
"shell/common/v8_value_serializer.cc",
"shell/common/v8_value_serializer.h",
"shell/common/v8_util.cc",
"shell/common/v8_util.h",
"shell/common/world_ids.h",
"shell/renderer/api/context_bridge/object_cache.cc",
"shell/renderer/api/context_bridge/object_cache.h",

View File

@@ -326,6 +326,11 @@ libcxx_headers = [
"//third_party/libc++/src/include/__coroutine/coroutine_traits.h",
"//third_party/libc++/src/include/__coroutine/noop_coroutine_handle.h",
"//third_party/libc++/src/include/__coroutine/trivial_awaitables.h",
"//third_party/libc++/src/include/__cstddef/byte.h",
"//third_party/libc++/src/include/__cstddef/max_align_t.h",
"//third_party/libc++/src/include/__cstddef/nullptr_t.h",
"//third_party/libc++/src/include/__cstddef/ptrdiff_t.h",
"//third_party/libc++/src/include/__cstddef/size_t.h",
"//third_party/libc++/src/include/__debug_utils/randomize_range.h",
"//third_party/libc++/src/include/__debug_utils/sanitizers.h",
"//third_party/libc++/src/include/__debug_utils/strict_weak_ordering_check.h",
@@ -415,11 +420,13 @@ libcxx_headers = [
"//third_party/libc++/src/include/__functional/weak_result_type.h",
"//third_party/libc++/src/include/__fwd/array.h",
"//third_party/libc++/src/include/__fwd/bit_reference.h",
"//third_party/libc++/src/include/__fwd/byte.h",
"//third_party/libc++/src/include/__fwd/complex.h",
"//third_party/libc++/src/include/__fwd/deque.h",
"//third_party/libc++/src/include/__fwd/format.h",
"//third_party/libc++/src/include/__fwd/fstream.h",
"//third_party/libc++/src/include/__fwd/functional.h",
"//third_party/libc++/src/include/__fwd/get.h",
"//third_party/libc++/src/include/__fwd/ios.h",
"//third_party/libc++/src/include/__fwd/istream.h",
"//third_party/libc++/src/include/__fwd/mdspan.h",
@@ -436,6 +443,7 @@ libcxx_headers = [
"//third_party/libc++/src/include/__fwd/string_view.h",
"//third_party/libc++/src/include/__fwd/subrange.h",
"//third_party/libc++/src/include/__fwd/tuple.h",
"//third_party/libc++/src/include/__fwd/variant.h",
"//third_party/libc++/src/include/__fwd/vector.h",
"//third_party/libc++/src/include/__hash_table",
"//third_party/libc++/src/include/__ios/fpos.h",
@@ -538,6 +546,7 @@ libcxx_headers = [
"//third_party/libc++/src/include/__memory/construct_at.h",
"//third_party/libc++/src/include/__memory/destruct_n.h",
"//third_party/libc++/src/include/__memory/inout_ptr.h",
"//third_party/libc++/src/include/__memory/noexcept_move_assign_container.h",
"//third_party/libc++/src/include/__memory/out_ptr.h",
"//third_party/libc++/src/include/__memory/pointer_traits.h",
"//third_party/libc++/src/include/__memory/ranges_construct_at.h",
@@ -826,7 +835,6 @@ libcxx_headers = [
"//third_party/libc++/src/include/__type_traits/maybe_const.h",
"//third_party/libc++/src/include/__type_traits/nat.h",
"//third_party/libc++/src/include/__type_traits/negation.h",
"//third_party/libc++/src/include/__type_traits/noexcept_move_assign_container.h",
"//third_party/libc++/src/include/__type_traits/promote.h",
"//third_party/libc++/src/include/__type_traits/rank.h",
"//third_party/libc++/src/include/__type_traits/remove_all_extents.h",
@@ -921,7 +929,6 @@ libcxx_headers = [
"//third_party/libc++/src/include/exception",
"//third_party/libc++/src/include/execution",
"//third_party/libc++/src/include/expected",
"//third_party/libc++/src/include/experimental/__config",
"//third_party/libc++/src/include/experimental/__simd/aligned_tag.h",
"//third_party/libc++/src/include/experimental/__simd/declaration.h",
"//third_party/libc++/src/include/experimental/__simd/reference.h",

View File

@@ -1,7 +1,7 @@
import * as fs from 'fs';
import { Menu } from 'electron/main';
import * as fs from 'fs';
const bindings = process._linkedBinding('electron_browser_app');
const commandLine = process._linkedBinding('electron_common_command_line');
const { app } = bindings;

View File

@@ -1,7 +1,9 @@
import { app } from 'electron/main';
import { EventEmitter } from 'events';
import * as squirrelUpdate from '@electron/internal/browser/api/auto-updater/squirrel-update-win';
import { app } from 'electron/main';
import { EventEmitter } from 'events';
class AutoUpdater extends EventEmitter implements Electron.AutoUpdater {
updateAvailable: boolean = false;
updateURL: string | null = null;

View File

@@ -1,6 +1,6 @@
import { spawn, ChildProcessWithoutNullStreams } from 'child_process';
import * as fs from 'fs';
import * as path from 'path';
import { spawn, ChildProcessWithoutNullStreams } from 'child_process';
// i.e. my-app/app-0.1.13/
const appFolder = path.dirname(process.execPath);

View File

@@ -1,5 +1,8 @@
import { EventEmitter } from 'events';
import { TouchBar } from 'electron/main';
import type { BaseWindow as TLWT } from 'electron/main';
import { EventEmitter } from 'events';
const { BaseWindow } = process._linkedBinding('electron_browser_base_window') as { BaseWindow: typeof TLWT };
Object.setPrototypeOf(BaseWindow.prototype, EventEmitter.prototype);
@@ -15,6 +18,10 @@ BaseWindow.prototype._init = function (this: TLWT) {
}
};
BaseWindow.prototype.setTouchBar = function (touchBar) {
(TouchBar as any)._setOnWindow(touchBar, this);
};
// Properties
Object.defineProperty(BaseWindow.prototype, 'autoHideMenuBar', {

View File

@@ -68,10 +68,7 @@ export default class BrowserView {
// a webContents can be closed by the user while the BrowserView
// remains alive and attached to a BrowserWindow.
set ownerWindow (w: BrowserWindow | null) {
if (this.#ownerWindow && this.#resizeListener) {
this.#ownerWindow.off('resize', this.#resizeListener);
this.#resizeListener = null;
}
this.#removeResizeListener();
if (this.webContents && !this.webContents.isDestroyed()) {
this.webContents._setOwnerWindow(w);
@@ -82,6 +79,7 @@ export default class BrowserView {
this.#lastWindowSize = w.getBounds();
w.on('resize', this.#resizeListener = this.#autoResize.bind(this));
w.on('closed', () => {
this.#removeResizeListener();
this.#ownerWindow = null;
this.#destroyListener = null;
});
@@ -94,6 +92,13 @@ export default class BrowserView {
this.#ownerWindow?.contentView.removeChildView(this.webContentsView);
}
#removeResizeListener () {
if (this.#ownerWindow && this.#resizeListener) {
this.#ownerWindow.off('resize', this.#resizeListener);
this.#resizeListener = null;
}
}
#autoHorizontalProportion: {width: number, left: number} | null = null;
#autoVerticalProportion: {height: number, top: number} | null = null;
#autoResize () {
@@ -145,6 +150,12 @@ export default class BrowserView {
if (this.#autoHorizontalProportion || this.#autoVerticalProportion) {
this.#webContentsView.setBounds(newViewBounds);
}
// Update #lastWindowSize value after browser windows resize
this.#lastWindowSize = {
width: newBounds.width,
height: newBounds.height
};
}
get webContentsView () {

View File

@@ -1,5 +1,6 @@
import { BaseWindow, WebContents, TouchBar, BrowserView } from 'electron/main';
import { BaseWindow, WebContents, BrowserView } from 'electron/main';
import type { BrowserWindow as BWT } from 'electron/main';
const { BrowserWindow } = process._linkedBinding('electron_browser_window') as { BrowserWindow: typeof BWT };
Object.setPrototypeOf(BrowserWindow.prototype, BaseWindow.prototype);
@@ -100,10 +101,6 @@ BrowserWindow.fromBrowserView = (browserView: BrowserView) => {
return BrowserWindow.fromWebContents(browserView.webContents);
};
BrowserWindow.prototype.setTouchBar = function (touchBar) {
(TouchBar as any)._setOnWindow(touchBar, this);
};
// Forwarded to webContents:
BrowserWindow.prototype.loadURL = function (...args) {

View File

@@ -1,6 +1,7 @@
import { app } from 'electron/main';
import * as deprecate from '@electron/internal/common/deprecate';
import { app } from 'electron/main';
const binding = process._linkedBinding('electron_browser_crash_reporter');
class CrashReporter implements Electron.CrashReporter {

View File

@@ -1,5 +1,6 @@
import { BrowserWindow } from 'electron/main';
const { createDesktopCapturer } = process._linkedBinding('electron_browser_desktop_capturer');
const { createDesktopCapturer, isDisplayMediaSystemPickerAvailable } = process._linkedBinding('electron_browser_desktop_capturer');
const deepEqual = (a: ElectronInternal.GetSourcesOptions, b: ElectronInternal.GetSourcesOptions) => JSON.stringify(a) === JSON.stringify(b);
@@ -13,6 +14,8 @@ function isValid (options: Electron.SourcesOptions) {
return Array.isArray(options?.types);
}
export { isDisplayMediaSystemPickerAvailable };
export async function getSources (args: Electron.SourcesOptions) {
if (!isValid(args)) throw new Error('Invalid options');

View File

@@ -1,5 +1,6 @@
import { app, BaseWindow } from 'electron/main';
import type { OpenDialogOptions, OpenDialogReturnValue, MessageBoxOptions, SaveDialogOptions, SaveDialogReturnValue, MessageBoxReturnValue, CertificateTrustDialogOptions } from 'electron/main';
const dialogBinding = process._linkedBinding('electron_browser_dialog');
enum SaveFileDialogProperties {

View File

@@ -1,6 +1,6 @@
import { defineProperties } from '@electron/internal/common/define-properties';
import { commonModuleList } from '@electron/internal/common/api/module-list';
import { browserModuleList } from '@electron/internal/browser/api/module-list';
import { commonModuleList } from '@electron/internal/common/api/module-list';
import { defineProperties } from '@electron/internal/common/define-properties';
module.exports = {};

View File

@@ -1,4 +1,4 @@
import { app, BrowserWindow, session, webContents, WebContents, MenuItemConstructorOptions } from 'electron/main';
import { app, BaseWindow, BrowserWindow, session, webContents, WebContents, MenuItemConstructorOptions } from 'electron/main';
const isMac = process.platform === 'darwin';
const isWindows = process.platform === 'win32';
@@ -13,7 +13,7 @@ interface Role {
label: string;
accelerator?: string;
checked?: boolean;
windowMethod?: ((window: BrowserWindow) => void);
windowMethod?: ((window: BaseWindow) => void);
webContentsMethod?: ((webContents: WebContents) => void);
appMethod?: () => void;
registerAccelerator?: boolean;
@@ -53,8 +53,10 @@ export const roleList: Record<RoleId, Role> = {
label: 'Force Reload',
accelerator: 'Shift+CmdOrCtrl+R',
nonNativeMacOSRole: true,
windowMethod: (window: BrowserWindow) => {
window.webContents.reloadIgnoringCache();
windowMethod: (window: BaseWindow) => {
if (window instanceof BrowserWindow) {
window.webContents.reloadIgnoringCache();
}
}
},
front: {
@@ -110,7 +112,11 @@ export const roleList: Record<RoleId, Role> = {
label: 'Reload',
accelerator: 'CmdOrCtrl+R',
nonNativeMacOSRole: true,
windowMethod: w => w.reload()
windowMethod: (w: BaseWindow) => {
if (w instanceof BrowserWindow) {
w.reload();
}
}
},
resetzoom: {
label: 'Actual Size',
@@ -164,7 +170,7 @@ export const roleList: Record<RoleId, Role> = {
togglefullscreen: {
label: 'Toggle Full Screen',
accelerator: isMac ? 'Control+Command+F' : 'F11',
windowMethod: (window: BrowserWindow) => {
windowMethod: (window: BaseWindow) => {
window.setFullScreen(!window.isFullScreen());
}
},
@@ -245,33 +251,35 @@ export const roleList: Record<RoleId, Role> = {
{ role: 'cut' },
{ role: 'copy' },
{ role: 'paste' },
...(isMac ? [
{ role: 'pasteAndMatchStyle' },
{ role: 'delete' },
{ role: 'selectAll' },
{ type: 'separator' },
{
label: 'Substitutions',
submenu: [
{ role: 'showSubstitutions' },
{ type: 'separator' },
{ role: 'toggleSmartQuotes' },
{ role: 'toggleSmartDashes' },
{ role: 'toggleTextReplacement' }
]
},
{
label: 'Speech',
submenu: [
{ role: 'startSpeaking' },
{ role: 'stopSpeaking' }
]
}
] as MenuItemConstructorOptions[] : [
{ role: 'delete' },
{ type: 'separator' },
{ role: 'selectAll' }
] as MenuItemConstructorOptions[])
...(isMac
? [
{ role: 'pasteAndMatchStyle' },
{ role: 'delete' },
{ role: 'selectAll' },
{ type: 'separator' },
{
label: 'Substitutions',
submenu: [
{ role: 'showSubstitutions' },
{ type: 'separator' },
{ role: 'toggleSmartQuotes' },
{ role: 'toggleSmartDashes' },
{ role: 'toggleTextReplacement' }
]
},
{
label: 'Speech',
submenu: [
{ role: 'startSpeaking' },
{ role: 'stopSpeaking' }
]
}
] as MenuItemConstructorOptions[]
: [
{ role: 'delete' },
{ type: 'separator' },
{ role: 'selectAll' }
] as MenuItemConstructorOptions[])
]
},
// View submenu
@@ -295,12 +303,14 @@ export const roleList: Record<RoleId, Role> = {
submenu: [
{ role: 'minimize' },
{ role: 'zoom' },
...(isMac ? [
{ type: 'separator' },
{ role: 'front' }
] as MenuItemConstructorOptions[] : [
{ role: 'close' }
] as MenuItemConstructorOptions[])
...(isMac
? [
{ type: 'separator' },
{ role: 'front' }
] as MenuItemConstructorOptions[]
: [
{ role: 'close' }
] as MenuItemConstructorOptions[])
]
},
// Share submenu
@@ -361,7 +371,7 @@ export function getDefaultSubmenu (role: RoleId) {
return submenu;
}
export function execute (role: RoleId, focusedWindow: BrowserWindow, focusedWebContents: WebContents) {
export function execute (role: RoleId, focusedWindow: BaseWindow, focusedWebContents: WebContents) {
if (!canExecuteRole(role)) return false;
const { appMethod, webContentsMethod, windowMethod } = roleList[role];

View File

@@ -1,5 +1,6 @@
import * as roles from '@electron/internal/browser/api/menu-item-roles';
import { Menu, BrowserWindow, WebContents, KeyboardEvent } from 'electron/main';
import { Menu, BaseWindow, WebContents, KeyboardEvent } from 'electron/main';
let nextCommandId = 0;
@@ -53,7 +54,7 @@ const MenuItem = function (this: any, options: any) {
});
const click = options.click;
this.click = (event: KeyboardEvent, focusedWindow: BrowserWindow, focusedWebContents: WebContents) => {
this.click = (event: KeyboardEvent, focusedWindow: BaseWindow, focusedWebContents: WebContents) => {
// Manually flip the checked flags when clicked.
if (!roles.shouldOverrideCheckStatus(this.role) &&
(this.type === 'checkbox' || this.type === 'radio')) {

View File

@@ -1,7 +1,8 @@
import { BaseWindow, MenuItem, webContents, Menu as MenuType, BrowserWindow, MenuItemConstructorOptions } from 'electron/main';
import { sortMenuItems } from '@electron/internal/browser/api/menu-utils';
import { setApplicationMenuWasSet } from '@electron/internal/browser/default-menu';
import { BaseWindow, MenuItem, webContents, Menu as MenuType, MenuItemConstructorOptions } from 'electron/main';
const bindings = process._linkedBinding('electron_browser_menu');
const { Menu } = bindings as { Menu: typeof MenuType };
@@ -54,7 +55,7 @@ Menu.prototype._executeCommand = function (event, id) {
const command = this.commandsMap[id];
if (!command) return;
const focusedWindow = BaseWindow.getFocusedWindow();
command.click(event, focusedWindow instanceof BrowserWindow ? focusedWindow : undefined, webContents.getFocusedWebContents());
command.click(event, focusedWindow, webContents.getFocusedWebContents());
};
Menu.prototype._menuWillShow = function () {

View File

@@ -1,5 +1,7 @@
import { MessagePortMain } from '@electron/internal/browser/message-port-main';
import { EventEmitter } from 'events';
const { createPair } = process._linkedBinding('electron_browser_message_port');
export default class MessageChannelMain extends EventEmitter implements Electron.MessageChannelMain {

View File

@@ -1,7 +1,9 @@
import { ClientRequestConstructorOptions, ClientRequest, IncomingMessage, Session as SessionT } from 'electron/main';
import { Readable, Writable, isReadable } from 'stream';
import { allowAnyProtocol } from '@electron/internal/common/api/net-client-request';
import { ClientRequestConstructorOptions, ClientRequest, IncomingMessage, Session as SessionT } from 'electron/main';
import { Readable, Writable, isReadable } from 'stream';
function createDeferredPromise<T, E extends Error = Error> (): { promise: Promise<T>; resolve: (x: T) => void; reject: (e: E) => void; } {
let res: (x: T) => void;
let rej: (e: E) => void;

View File

@@ -1,6 +1,7 @@
import { ClientRequest } from '@electron/internal/common/api/net-client-request';
import { app, IncomingMessage, session } from 'electron/main';
import type { ClientRequestConstructorOptions } from 'electron/main';
import { ClientRequest } from '@electron/internal/common/api/net-client-request';
const { isOnline } = process._linkedBinding('electron_common_net');

View File

@@ -1,4 +1,5 @@
import { ProtocolRequest, session } from 'electron/main';
import { createReadStream } from 'fs';
import { Readable } from 'stream';
import { ReadableStream } from 'stream/web';

View File

@@ -1,11 +1,41 @@
import { fetchWithSession } from '@electron/internal/browser/api/net-fetch';
import { net } from 'electron/main';
const { fromPartition, fromPath, Session } = process._linkedBinding('electron_browser_session');
const { isDisplayMediaSystemPickerAvailable } = process._linkedBinding('electron_browser_desktop_capturer');
// Fake video window that activates the native system picker
// This is used to get around the need for a screen/window
// id in Chrome's desktopCapturer.
let fakeVideoWindowId = -1;
// See content/public/browser/desktop_media_id.h
const kMacOsNativePickerId = -4;
const systemPickerVideoSource = Object.create(null);
Object.defineProperty(systemPickerVideoSource, 'id', {
get () {
return `window:${kMacOsNativePickerId}:${fakeVideoWindowId--}`;
}
});
systemPickerVideoSource.name = '';
Object.freeze(systemPickerVideoSource);
Session.prototype.fetch = function (input: RequestInfo, init?: RequestInit) {
return fetchWithSession(input, init, this, net.request);
};
Session.prototype.setDisplayMediaRequestHandler = function (handler, opts) {
if (!handler) return this._setDisplayMediaRequestHandler(handler, opts);
this._setDisplayMediaRequestHandler(async (req, callback) => {
if (opts && opts.useSystemPicker && isDisplayMediaSystemPickerAvailable()) {
return callback({ video: systemPickerVideoSource });
}
return handler(req, callback);
}, opts);
};
export default {
fromPartition,
fromPath,

View File

@@ -1,4 +1,5 @@
import { BrowserWindow, Menu, SharingItem, PopupOptions } from 'electron/main';
import { EventEmitter } from 'events';
class ShareMenu extends EventEmitter implements Electron.ShareMenu {

View File

@@ -1,4 +1,5 @@
import * as deprecate from '@electron/internal/common/deprecate';
const { systemPreferences } = process._linkedBinding('electron_browser_system_preferences');
if ('getEffectiveAppearance' in systemPreferences) {

View File

@@ -117,10 +117,12 @@ class TouchBarColorPicker extends TouchBarItem<Electron.TouchBarColorPickerConst
@LiveProperty<TouchBarColorPicker>(config => config.selectedColor)
selectedColor!: string;
@ImmutableProperty<TouchBarColorPicker>(({ change: onChange }, setInternalProp) => typeof onChange === 'function' ? (details: { color: string }) => {
setInternalProp('selectedColor', details.color);
onChange(details.color);
} : null)
@ImmutableProperty<TouchBarColorPicker>(({ change: onChange }, setInternalProp) => typeof onChange === 'function'
? (details: { color: string }) => {
setInternalProp('selectedColor', details.color);
onChange(details.color);
}
: null)
onInteraction!: Function | null;
}
@@ -203,10 +205,12 @@ class TouchBarSlider extends TouchBarItem<Electron.TouchBarSliderConstructorOpti
@LiveProperty<TouchBarSlider>(config => config.value)
value!: number;
@ImmutableProperty<TouchBarSlider>(({ change: onChange }, setInternalProp) => typeof onChange === 'function' ? (details: { value: number }) => {
setInternalProp('value', details.value);
onChange(details.value);
} : null)
@ImmutableProperty<TouchBarSlider>(({ change: onChange }, setInternalProp) => typeof onChange === 'function'
? (details: { value: number }) => {
setInternalProp('value', details.value);
onChange(details.value);
}
: null)
onInteraction!: Function | null;
}
@@ -236,10 +240,12 @@ class TouchBarSegmentedControl extends TouchBarItem<Electron.TouchBarSegmentedCo
@LiveProperty<TouchBarSegmentedControl>(config => config.mode)
mode!: Electron.TouchBarSegmentedControl['mode'];
@ImmutableProperty<TouchBarSegmentedControl>(({ change: onChange }, setInternalProp) => typeof onChange === 'function' ? (details: { selectedIndex: number, isSelected: boolean }) => {
setInternalProp('selectedIndex', details.selectedIndex);
onChange(details.selectedIndex, details.isSelected);
} : null)
@ImmutableProperty<TouchBarSegmentedControl>(({ change: onChange }, setInternalProp) => typeof onChange === 'function'
? (details: { selectedIndex: number, isSelected: boolean }) => {
setInternalProp('selectedIndex', details.selectedIndex);
onChange(details.selectedIndex, details.isSelected);
}
: null)
onInteraction!: Function | null;
}
@@ -265,13 +271,15 @@ class TouchBarScrubber extends TouchBarItem<Electron.TouchBarScrubberConstructor
@LiveProperty<TouchBarScrubber>(config => typeof config.continuous === 'undefined' ? true : config.continuous)
continuous!: boolean;
@ImmutableProperty<TouchBarScrubber>(({ select: onSelect, highlight: onHighlight }) => typeof onSelect === 'function' || typeof onHighlight === 'function' ? (details: { type: 'select'; selectedIndex: number } | { type: 'highlight'; highlightedIndex: number }) => {
if (details.type === 'select') {
if (onSelect) onSelect(details.selectedIndex);
} else {
if (onHighlight) onHighlight(details.highlightedIndex);
}
} : null)
@ImmutableProperty<TouchBarScrubber>(({ select: onSelect, highlight: onHighlight }) => typeof onSelect === 'function' || typeof onHighlight === 'function'
? (details: { type: 'select'; selectedIndex: number } | { type: 'highlight'; highlightedIndex: number }) => {
if (details.type === 'select') {
if (onSelect) onSelect(details.selectedIndex);
} else {
if (onHighlight) onHighlight(details.highlightedIndex);
}
}
: null)
onInteraction!: Function | null;
}
@@ -284,7 +292,7 @@ const escapeItemSymbol = Symbol('escape item');
class TouchBar extends EventEmitter implements Electron.TouchBar {
// Bind a touch bar to a window
static _setOnWindow (touchBar: TouchBar | Electron.TouchBarConstructorOptions['items'], window: Electron.BrowserWindow) {
static _setOnWindow (touchBar: TouchBar | Electron.TouchBarConstructorOptions['items'], window: Electron.BaseWindow) {
if (window._touchBar != null) {
window._touchBar._removeFromWindow(window);
}
@@ -383,7 +391,7 @@ class TouchBar extends EventEmitter implements Electron.TouchBar {
return this[escapeItemSymbol];
}
_addToWindow (window: Electron.BrowserWindow) {
_addToWindow (window: Electron.BaseWindow) {
const { id } = window;
// Already added to window
@@ -439,7 +447,7 @@ class TouchBar extends EventEmitter implements Electron.TouchBar {
escapeItemListener(this.escapeItem);
}
_removeFromWindow (window: Electron.BrowserWindow) {
_removeFromWindow (window: Electron.BaseWindow) {
const removeListeners = this.windowListeners.get(window.id);
if (removeListeners != null) removeListeners();
}

View File

@@ -1,7 +1,9 @@
import { EventEmitter } from 'events';
import { Duplex, PassThrough } from 'stream';
import { Socket } from 'net';
import { MessagePortMain } from '@electron/internal/browser/message-port-main';
import { EventEmitter } from 'events';
import { Socket } from 'net';
import { Duplex, PassThrough } from 'stream';
const { _fork } = process._linkedBinding('electron_browser_utility_process');
class ForkUtilityProcess extends EventEmitter implements Electron.UtilityProcess {

View File

@@ -1,4 +1,5 @@
import { EventEmitter } from 'events';
const { View } = process._linkedBinding('electron_browser_view');
Object.setPrototypeOf((View as any).prototype, EventEmitter.prototype);

View File

@@ -1,16 +1,17 @@
import { app, ipcMain, session, webFrameMain, dialog } from 'electron/main';
import type { BrowserWindowConstructorOptions, LoadURLOptions, MessageBoxOptions, WebFrameMain } from 'electron/main';
import * as url from 'url';
import * as path from 'path';
import { openGuestWindow, makeWebPreferences, parseContentTypeFormat } from '@electron/internal/browser/guest-window-manager';
import { parseFeatures } from '@electron/internal/browser/parse-features-string';
import { IpcMainImpl } from '@electron/internal/browser/ipc-main-impl';
import { ipcMainInternal } from '@electron/internal/browser/ipc-main-internal';
import * as ipcMainUtils from '@electron/internal/browser/ipc-main-internal-utils';
import { MessagePortMain } from '@electron/internal/browser/message-port-main';
import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
import { IpcMainImpl } from '@electron/internal/browser/ipc-main-impl';
import { parseFeatures } from '@electron/internal/browser/parse-features-string';
import * as deprecate from '@electron/internal/common/deprecate';
import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
import { app, ipcMain, session, webFrameMain, dialog } from 'electron/main';
import type { BrowserWindowConstructorOptions, MessageBoxOptions } from 'electron/main';
import * as path from 'path';
import * as url from 'url';
// session is not used here, the purpose is to make sure session is initialized
// before the webContents module.
@@ -24,8 +25,6 @@ const getNextId = function () {
return ++nextId;
};
type PostData = LoadURLOptions['postData']
// Stock page sizes
const PDFPageSizes: Record<string, ElectronInternal.MediaSize> = {
Letter: {
@@ -403,7 +402,7 @@ WebContents.prototype.loadURL = function (url, options) {
// the only one is with a bad scheme, perhaps ERR_INVALID_ARGUMENT
// would be more appropriate.
if (!error) {
error = { errorCode: -2, errorDescription: 'ERR_FAILED', url: url };
error = { errorCode: -2, errorDescription: 'ERR_FAILED', url };
}
finishListener();
};
@@ -604,7 +603,7 @@ WebContents.prototype._init = function () {
});
// Dispatch IPC messages to the ipc module.
this.on('-ipc-message' as any, function (this: Electron.WebContents, event: Electron.IpcMainEvent, internal: boolean, channel: string, args: any[]) {
this.on('-ipc-message', function (this: Electron.WebContents, event, internal, channel, args) {
addSenderToEvent(event, this);
if (internal) {
ipcMainInternal.emit(channel, event, ...args);
@@ -618,7 +617,7 @@ WebContents.prototype._init = function () {
}
});
this.on('-ipc-invoke' as any, async function (this: Electron.WebContents, event: Electron.IpcMainInvokeEvent, internal: boolean, channel: string, args: any[]) {
this.on('-ipc-invoke', async function (this: Electron.WebContents, event, internal, channel, args) {
addSenderToEvent(event, this);
const replyWithResult = (result: any) => event._replyChannel.sendReply({ result });
const replyWithError = (error: Error) => {
@@ -640,7 +639,7 @@ WebContents.prototype._init = function () {
}
});
this.on('-ipc-message-sync' as any, function (this: Electron.WebContents, event: Electron.IpcMainEvent, internal: boolean, channel: string, args: any[]) {
this.on('-ipc-message-sync', function (this: Electron.WebContents, event, internal, channel, args) {
addSenderToEvent(event, this);
addReturnValueToEvent(event);
if (internal) {
@@ -658,7 +657,7 @@ WebContents.prototype._init = function () {
}
});
this.on('-ipc-ports' as any, function (this: Electron.WebContents, event: Electron.IpcMainEvent, internal: boolean, channel: string, message: any, ports: any[]) {
this.on('-ipc-ports', function (this: Electron.WebContents, event: Electron.IpcMainEvent, internal: boolean, channel: string, message: any, ports: any[]) {
addSenderToEvent(event, this);
event.ports = ports.map(p => new MessagePortMain(p));
const maybeWebFrame = getWebFrameForEvent(event);
@@ -676,7 +675,7 @@ WebContents.prototype._init = function () {
}
});
this.on('-before-unload-fired' as any, function (this: Electron.WebContents, event: Electron.Event, proceed: boolean) {
this.on('-before-unload-fired', function (this: Electron.WebContents, event, proceed) {
const type = this.getType();
// These are the "interactive" types, i.e. ones a user might be looking at.
// All other types should ignore the "proceed" signal and unload
@@ -693,12 +692,13 @@ WebContents.prototype._init = function () {
if (this.getType() !== 'remote') {
// Make new windows requested by links behave like "window.open".
this.on('-new-window' as any, (event: Electron.Event, url: string, frameName: string, disposition: Electron.HandlerDetails['disposition'],
rawFeatures: string, referrer: Electron.Referrer, postData: PostData) => {
const postBody = postData ? {
data: postData,
...parseContentTypeFormat(postData)
} : undefined;
this.on('-new-window', (event, url, frameName, disposition, rawFeatures, referrer, postData) => {
const postBody = postData
? {
data: postData,
...parseContentTypeFormat(postData)
}
: undefined;
const details: Electron.HandlerDetails = {
url,
frameName,
@@ -735,11 +735,13 @@ WebContents.prototype._init = function () {
let windowOpenOutlivesOpenerOption: boolean = false;
let createWindow: Electron.CreateWindowFunction | undefined;
this.on('-will-add-new-contents' as any, (event: Electron.Event, url: string, frameName: string, rawFeatures: string, disposition: Electron.HandlerDetails['disposition'], referrer: Electron.Referrer, postData: PostData) => {
const postBody = postData ? {
data: postData,
...parseContentTypeFormat(postData)
} : undefined;
this.on('-will-add-new-contents', (event, url, frameName, rawFeatures, disposition, referrer, postData) => {
const postBody = postData
? {
data: postData,
...parseContentTypeFormat(postData)
}
: undefined;
const details: Electron.HandlerDetails = {
url,
frameName,
@@ -761,14 +763,16 @@ WebContents.prototype._init = function () {
windowOpenOverriddenOptions = result.browserWindowConstructorOptions;
createWindow = result.createWindow;
if (!event.defaultPrevented) {
const secureOverrideWebPreferences = windowOpenOverriddenOptions ? {
// Allow setting of backgroundColor as a webPreference even though
// it's technically a BrowserWindowConstructorOptions option because
// we need to access it in the renderer at init time.
backgroundColor: windowOpenOverriddenOptions.backgroundColor,
transparent: windowOpenOverriddenOptions.transparent,
...windowOpenOverriddenOptions.webPreferences
} : undefined;
const secureOverrideWebPreferences = windowOpenOverriddenOptions
? {
// Allow setting of backgroundColor as a webPreference even though
// it's technically a BrowserWindowConstructorOptions option because
// we need to access it in the renderer at init time.
backgroundColor: windowOpenOverriddenOptions.backgroundColor,
transparent: windowOpenOverriddenOptions.transparent,
...windowOpenOverriddenOptions.webPreferences
}
: undefined;
const { webPreferences: parsedWebPreferences } = parseFeatures(rawFeatures);
const webPreferences = makeWebPreferences({
embedder: this,
@@ -784,9 +788,7 @@ WebContents.prototype._init = function () {
});
// Create a new browser window for "window.open"
this.on('-add-new-contents' as any, (event: Electron.Event, webContents: Electron.WebContents, disposition: string,
_userGesture: boolean, _left: number, _top: number, _width: number, _height: number, url: string, frameName: string,
referrer: Electron.Referrer, rawFeatures: string, postData: PostData) => {
this.on('-add-new-contents', (event, webContents, disposition, _userGesture, _left, _top, _width, _height, url, frameName, referrer, rawFeatures, postData) => {
const overriddenOptions = windowOpenOverriddenOptions || undefined;
const outlivesOpener = windowOpenOutlivesOpenerOption;
const windowOpenFunction = createWindow;
@@ -824,7 +826,7 @@ WebContents.prototype._init = function () {
app.emit('login', event, this, ...args);
});
this.on('ready-to-show' as any, () => {
this.on('ready-to-show', () => {
const owner = this.getOwnerBrowserWindow();
if (owner && !owner.isDestroyed()) {
process.nextTick(() => {
@@ -843,7 +845,7 @@ WebContents.prototype._init = function () {
const originCounts = new Map<string, number>();
const openDialogs = new Set<AbortController>();
this.on('-run-dialog' as any, async (info: {frame: WebFrameMain, dialogType: 'prompt' | 'confirm' | 'alert', messageText: string, defaultPromptText: string}, callback: (success: boolean, user_input: string) => void) => {
this.on('-run-dialog', async (info, callback) => {
const originUrl = new URL(info.frame.url);
const origin = originUrl.protocol === 'file:' ? originUrl.href : originUrl.origin;
if ((originCounts.get(origin) ?? 0) < 0) return callback(false, '');
@@ -864,15 +866,17 @@ WebContents.prototype._init = function () {
message: info.messageText,
checkboxLabel: checkbox,
signal: abortController.signal,
...(info.dialogType === 'confirm') ? {
buttons: ['OK', 'Cancel'],
defaultId: 0,
cancelId: 1
} : {
buttons: ['OK'],
defaultId: -1, // No default button
cancelId: 0
}
...(info.dialogType === 'confirm')
? {
buttons: ['OK', 'Cancel'],
defaultId: 0,
cancelId: 1
}
: {
buttons: ['OK'],
defaultId: -1, // No default button
cancelId: 0
}
};
openDialogs.add(abortController);
const promise = parent && !prefs.offscreen ? dialog.showMessageBox(parent, options) : dialog.showMessageBox(options);
@@ -886,7 +890,7 @@ WebContents.prototype._init = function () {
}
});
this.on('-cancel-dialogs' as any, () => {
this.on('-cancel-dialogs', () => {
for (const controller of openDialogs) { controller.abort(); }
openDialogs.clear();
});

View File

@@ -1,5 +1,5 @@
import { MessagePortMain } from '@electron/internal/browser/message-port-main';
import { IpcMainImpl } from '@electron/internal/browser/ipc-main-impl';
import { MessagePortMain } from '@electron/internal/browser/message-port-main';
const { WebFrameMain, fromId } = process._linkedBinding('electron_browser_web_frame_main');

View File

@@ -1,5 +1,5 @@
import { app, Menu } from 'electron/main';
import { shell } from 'electron/common';
import { app, Menu } from 'electron/main';
const isMac = process.platform === 'darwin';
@@ -14,33 +14,35 @@ export const setDefaultApplicationMenu = () => {
const helpMenu: Electron.MenuItemConstructorOptions = {
role: 'help',
submenu: app.isPackaged ? [] : [
{
label: 'Learn More',
click: async () => {
await shell.openExternal('https://electronjs.org');
}
},
{
label: 'Documentation',
click: async () => {
const version = process.versions.electron;
await shell.openExternal(`https://github.com/electron/electron/tree/v${version}/docs#readme`);
}
},
{
label: 'Community Discussions',
click: async () => {
await shell.openExternal('https://discord.gg/electronjs');
}
},
{
label: 'Search Issues',
click: async () => {
await shell.openExternal('https://github.com/electron/electron/issues');
}
}
]
submenu: app.isPackaged
? []
: [
{
label: 'Learn More',
click: async () => {
await shell.openExternal('https://electronjs.org');
}
},
{
label: 'Documentation',
click: async () => {
const version = process.versions.electron;
await shell.openExternal(`https://github.com/electron/electron/tree/v${version}/docs#readme`);
}
},
{
label: 'Community Discussions',
click: async () => {
await shell.openExternal('https://discord.gg/electronjs');
}
},
{
label: 'Search Issues',
click: async () => {
await shell.openExternal('https://github.com/electron/electron/issues');
}
}
]
};
const macAppMenu: Electron.MenuItemConstructorOptions = { role: 'appMenu' };

View File

@@ -1,29 +1,36 @@
import { dialog, Menu } from 'electron/main';
import * as fs from 'fs';
import { IPC_MESSAGES } from '@electron/internal//common/ipc-messages';
import { ipcMainInternal } from '@electron/internal/browser/ipc-main-internal';
import * as ipcMainUtils from '@electron/internal/browser/ipc-main-internal-utils';
import { IPC_MESSAGES } from '@electron/internal//common/ipc-messages';
import { dialog, Menu } from 'electron/main';
import * as fs from 'fs';
const convertToMenuTemplate = function (items: ContextMenuItem[], handler: (id: number) => void) {
return items.map(function (item) {
const transformed: Electron.MenuItemConstructorOptions = item.type === 'subMenu' ? {
type: 'submenu',
label: item.label,
enabled: item.enabled,
submenu: convertToMenuTemplate(item.subItems, handler)
} : item.type === 'separator' ? {
type: 'separator'
} : item.type === 'checkbox' ? {
type: 'checkbox',
label: item.label,
enabled: item.enabled,
checked: item.checked
} : {
type: 'normal',
label: item.label,
enabled: item.enabled
};
const transformed: Electron.MenuItemConstructorOptions = item.type === 'subMenu'
? {
type: 'submenu',
label: item.label,
enabled: item.enabled,
submenu: convertToMenuTemplate(item.subItems, handler)
}
: item.type === 'separator'
? {
type: 'separator'
}
: item.type === 'checkbox'
? {
type: 'checkbox',
label: item.label,
enabled: item.enabled,
checked: item.checked
}
: {
type: 'normal',
label: item.label,
enabled: item.enabled
};
if (item.id != null) {
transformed.click = () => handler(item.id);

View File

@@ -1,10 +1,11 @@
import { webContents } from 'electron/main';
import { ipcMainInternal } from '@electron/internal/browser/ipc-main-internal';
import * as ipcMainUtils from '@electron/internal/browser/ipc-main-internal-utils';
import { parseWebViewWebPreferences } from '@electron/internal/browser/parse-features-string';
import { syncMethods, asyncMethods, properties, navigationHistorySyncMethods } from '@electron/internal/common/web-view-methods';
import { webViewEvents } from '@electron/internal/browser/web-view-events';
import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
import { syncMethods, asyncMethods, properties, navigationHistorySyncMethods } from '@electron/internal/common/web-view-methods';
import { webContents } from 'electron/main';
interface GuestInstance {
elementInstanceId: number;
@@ -237,7 +238,7 @@ const watchEmbedder = function (embedder: Electron.WebContents) {
}
}
};
embedder.on('-window-visibility-change' as any, onVisibilityChange);
embedder.on('-window-visibility-change', onVisibilityChange);
embedder.once('will-destroy' as any, () => {
// Usually the guestInstances is cleared when guest is destroyed, but it
@@ -249,7 +250,7 @@ const watchEmbedder = function (embedder: Electron.WebContents) {
}
}
// Clear the listeners.
embedder.removeListener('-window-visibility-change' as any, onVisibilityChange);
embedder.removeListener('-window-visibility-change', onVisibilityChange);
watchedEmbedders.delete(embedder);
});
};

View File

@@ -5,9 +5,10 @@
* out-of-process (cross-origin) are created here. "Embedder" roughly means
* "parent."
*/
import { parseFeatures } from '@electron/internal/browser/parse-features-string';
import { BrowserWindow } from 'electron/main';
import type { BrowserWindowConstructorOptions, Referrer, WebContents, LoadURLOptions } from 'electron/main';
import { parseFeatures } from '@electron/internal/browser/parse-features-string';
type PostData = LoadURLOptions['postData']
export type WindowOpenArgs = {
@@ -71,14 +72,6 @@ export function openGuestWindow ({ embedder, guest, referrer, disposition, postD
throw new Error('Invalid webContents. Created window should be connected to webContents passed with options object.');
}
webContents.loadURL(url, {
httpReferrer: referrer,
...(postData && {
postData,
extraHeaders: formatPostDataHeaders(postData as Electron.UploadRawData[])
})
});
handleWindowLifecycleEvents({ embedder, frameName, guest, outlivesOpener });
}

View File

@@ -1,8 +1,9 @@
import type * as defaultMenuModule from '@electron/internal/browser/default-menu';
import { EventEmitter } from 'events';
import * as fs from 'fs';
import * as path from 'path';
import type * as defaultMenuModule from '@electron/internal/browser/default-menu';
import type * as url from 'url';
import type * as v8 from 'v8';
@@ -212,7 +213,7 @@ if (packagePath) {
}
});
} else {
// Call appCodeLoaded before just for safety, it doesn't matter here as _load is syncronous
// Call appCodeLoaded before just for safety, it doesn't matter here as _load is synchronous
appCodeLoaded!();
process._firstFileName = Module._resolveFilename(path.join(packagePath, mainStartupScript), null, false);
Module._load(path.join(packagePath, mainStartupScript), Module, true);

View File

@@ -1,6 +1,7 @@
import { EventEmitter } from 'events';
import { IpcMainInvokeEvent } from 'electron/main';
import { EventEmitter } from 'events';
export class IpcMainImpl extends EventEmitter implements Electron.IpcMain {
private _invokeHandlers: Map<string, (e: IpcMainInvokeEvent, ...args: any[]) => void> = new Map();

View File

@@ -1,9 +1,11 @@
import { clipboard } from 'electron/common';
import * as fs from 'fs';
import { ipcMainInternal } from '@electron/internal/browser/ipc-main-internal';
import * as ipcMainUtils from '@electron/internal/browser/ipc-main-internal-utils';
import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
import { clipboard } from 'electron/common';
import * as fs from 'fs';
// Implements window.close()
ipcMainInternal.on(IPC_MESSAGES.BROWSER_WINDOW_CLOSE, function (event) {
const window = event.sender.getOwnerBrowserWindow();

View File

@@ -1,10 +1,11 @@
import * as url from 'url';
import { Readable, Writable } from 'stream';
import type {
ClientRequestConstructorOptions,
UploadProgress
} from 'electron/common';
import { Readable, Writable } from 'stream';
import * as url from 'url';
const {
isValidHeaderName,
isValidHeaderValue,
@@ -226,7 +227,7 @@ function validateHeader (name: any, value: any): void {
}
function parseOptions (optionsIn: ClientRequestConstructorOptions | string): NodeJS.CreateURLLoaderOptions & ExtraURLLoaderOptions {
// eslint-disable-next-line node/no-deprecated-api
// eslint-disable-next-line n/no-deprecated-api
const options: any = typeof optionsIn === 'string' ? url.parse(optionsIn) : { ...optionsIn };
let urlStr: string = options.url;
@@ -259,7 +260,7 @@ function parseOptions (optionsIn: ClientRequestConstructorOptions | string): Nod
// an invalid request.
throw new TypeError('Request path contains unescaped characters');
}
// eslint-disable-next-line node/no-deprecated-api
// eslint-disable-next-line n/no-deprecated-api
const pathObj = url.parse(options.path || '/');
urlObj.pathname = pathObj.pathname;
urlObj.search = pathObj.search;

View File

@@ -1,7 +1,7 @@
import * as util from 'util';
import type * as stream from 'stream';
import timers = require('timers');
import * as util from 'util';
import type * as stream from 'stream';
type AnyFn = (...args: any[]) => any

View File

@@ -1,3 +1,5 @@
/* eslint-disable import/newline-after-import */
/* eslint-disable import/order */
// Initialize ASAR support in fs module.
import { wrapFsWithAsar } from './asar-fs-wrapper';
wrapFsWithAsar(require('fs'));

View File

@@ -1,5 +1,5 @@
import { defineProperties } from '@electron/internal/common/define-properties';
import { commonModuleList } from '@electron/internal/common/api/module-list';
import { defineProperties } from '@electron/internal/common/define-properties';
import { rendererModuleList } from '@electron/internal/renderer/api/module-list';
module.exports = {};

View File

@@ -1,10 +1,10 @@
import { ipcRenderer } from 'electron/renderer';
import { ipcRendererInternal } from '@electron/internal/renderer/ipc-renderer-internal';
import type * as securityWarningsModule from '@electron/internal/renderer/security-warnings';
import type * as webFrameInitModule from '@electron/internal/renderer/web-frame-init';
import type * as webViewInitModule from '@electron/internal/renderer/web-view/web-view-init';
import type * as windowSetupModule from '@electron/internal/renderer/window-setup';
import type * as webFrameInitModule from '@electron/internal/renderer/web-frame-init';
import type * as securityWarningsModule from '@electron/internal/renderer/security-warnings';
import { ipcRenderer } from 'electron/renderer';
const { mainFrame } = process._linkedBinding('electron_renderer_web_frame');
const v8Util = process._linkedBinding('electron_common_v8_util');
@@ -49,6 +49,7 @@ if (process.isMainFrame) {
}
const { webFrameInit } = require('@electron/internal/renderer/web-frame-init') as typeof webFrameInitModule;
webFrameInit();
// Warn about security issues

View File

@@ -1,10 +1,10 @@
import * as path from 'path';
import { pathToFileURL } from 'url';
import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
import type * as ipcRendererInternalModule from '@electron/internal/renderer/ipc-renderer-internal';
import type * as ipcRendererUtilsModule from '@electron/internal/renderer/ipc-renderer-internal-utils';
import * as path from 'path';
import { pathToFileURL } from 'url';
const Module = require('module') as NodeJS.ModuleInternal;
// We do not want to allow use of the VM module in the renderer process as

View File

@@ -1,8 +1,9 @@
import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
import { internalContextBridge } from '@electron/internal/renderer/api/context-bridge';
import { ipcRendererInternal } from '@electron/internal/renderer/ipc-renderer-internal';
import * as ipcRendererUtils from '@electron/internal/renderer/ipc-renderer-internal-utils';
import { webFrame } from 'electron/renderer';
import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
const { contextIsolationEnabled } = internalContextBridge;

View File

@@ -1,5 +1,5 @@
import { ipcRendererInternal } from '@electron/internal/renderer/ipc-renderer-internal';
import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
import { ipcRendererInternal } from '@electron/internal/renderer/ipc-renderer-internal';
const { mainFrame: webFrame } = process._linkedBinding('electron_renderer_web_frame');

View File

@@ -1,6 +1,7 @@
import { webFrame, WebFrame } from 'electron/renderer';
import * as ipcRendererUtils from '@electron/internal/renderer/ipc-renderer-internal-utils';
import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
import * as ipcRendererUtils from '@electron/internal/renderer/ipc-renderer-internal-utils';
import { webFrame, WebFrame } from 'electron/renderer';
// All keys of WebFrame that extend Function
type WebFrameMethod = {

View File

@@ -1,6 +1,6 @@
import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
import { ipcRendererInternal } from '@electron/internal/renderer/ipc-renderer-internal';
import * as ipcRendererUtils from '@electron/internal/renderer/ipc-renderer-internal-utils';
import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
const { mainFrame: webFrame } = process._linkedBinding('electron_renderer_web_frame');

View File

@@ -1,5 +1,5 @@
import type { WebViewImpl } from '@electron/internal/renderer/web-view/web-view-impl';
import { WEB_VIEW_ATTRIBUTES, WEB_VIEW_ERROR_MESSAGES } from '@electron/internal/renderer/web-view/web-view-constants';
import type { WebViewImpl } from '@electron/internal/renderer/web-view/web-view-impl';
const resolveURL = function (url?: string | null) {
return url ? new URL(url, location.href).href : '';

View File

@@ -8,9 +8,9 @@
// which runs in browserify environment instead of Node environment, all native
// modules must be passed from outside, all included files must be plain JS.
import type { SrcAttribute } from '@electron/internal/renderer/web-view/web-view-attributes';
import { WEB_VIEW_ATTRIBUTES, WEB_VIEW_ERROR_MESSAGES } from '@electron/internal/renderer/web-view/web-view-constants';
import { WebViewImpl, WebViewImplHooks, setupMethods } from '@electron/internal/renderer/web-view/web-view-impl';
import type { SrcAttribute } from '@electron/internal/renderer/web-view/web-view-attributes';
const internals = new WeakMap<HTMLElement, WebViewImpl>();

View File

@@ -1,8 +1,8 @@
import type * as guestViewInternalModule from '@electron/internal/renderer/web-view/guest-view-internal';
import { WEB_VIEW_ATTRIBUTES } from '@electron/internal/renderer/web-view/web-view-constants';
import { syncMethods, asyncMethods, properties } from '@electron/internal/common/web-view-methods';
import type * as guestViewInternalModule from '@electron/internal/renderer/web-view/guest-view-internal';
import type { WebViewAttribute, PartitionAttribute } from '@electron/internal/renderer/web-view/web-view-attributes';
import { setupWebViewAttributes } from '@electron/internal/renderer/web-view/web-view-attributes';
import { WEB_VIEW_ATTRIBUTES } from '@electron/internal/renderer/web-view/web-view-constants';
// ID generator.
let nextId = 0;

View File

@@ -1,8 +1,7 @@
import { ipcRendererInternal } from '@electron/internal/renderer/ipc-renderer-internal';
import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
import type * as webViewElementModule from '@electron/internal/renderer/web-view/web-view-element';
import { ipcRendererInternal } from '@electron/internal/renderer/ipc-renderer-internal';
import type * as guestViewInternalModule from '@electron/internal/renderer/web-view/guest-view-internal';
import type * as webViewElementModule from '@electron/internal/renderer/web-view/web-view-element';
const v8Util = process._linkedBinding('electron_common_v8_util');
const { mainFrame: webFrame } = process._linkedBinding('electron_renderer_web_frame');

Some files were not shown because too many files have changed in this diff Show More