Compare commits

..

31 Commits

Author SHA1 Message Date
alice
d9dc42a304 test: add regression test for window focus 2024-10-28 19:52:21 -07:00
alice
08d8163201 fix: update to use BindPostTaskToCurrentDefault 2024-10-28 11:06:10 -07:00
alice
204e195b6f fix: add dispatch_async to replace GetUIThreadTaskRunner 2024-10-27 19:16:53 -07:00
alice
eb621e7c9c test: add a test 2024-10-25 18:38:48 -07:00
alice
08dbb388e5 fix: Use openURL:configuration:completionHandler instead of openUrl 2024-10-25 18:38:37 -07:00
trop[bot]
739df86774 fix: respect setAlwaysOnTop before showInactive on Linux under X11 (#44324)
fix: respect setAlwaysOnTop before showInactive on Linux under X11 (#44078)

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: John Beutner <31829097+cptpcrd@users.noreply.github.com>
2024-10-18 17:20:13 -04:00
John Kleinschmidt
9a087b9c56 chore: fixup reclient read only access on forks (#44304)
chore: fixup reclient read only access on forks (#44280)
2024-10-18 15:39:59 +02:00
trop[bot]
8b3f2c5d7c fix: trace-startup crashing child process on macOS (#44276)
* fix: trace-startup crashing child process on macOS

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

* chore: disable test on linux arm

* chore: also disable on linux arm64

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
2024-10-17 22:23:30 -04:00
trop[bot]
ad9bf6b041 fix: Linux crash after webContents.print() with no parent window (#44285)
fix: Linux crash after print with no parent window

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2024-10-17 22:21:57 -04:00
trop[bot]
32822cd747 build: remove dead code in prepare release script (#44289)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2024-10-17 17:10:49 -04:00
trop[bot]
e1419b2fdf fix: ensure utilityProcess only emits one 'exit' event (#44266)
fix: ensure utilityProcess only emits one exit

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2024-10-16 15:01:09 -04:00
electron-roller[bot]
11c2b61011 chore: bump chromium to 130.0.6723.59 (33-x-y) (#44271)
chore: bump chromium in DEPS to 130.0.6723.59

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
2024-10-16 11:01:31 -04:00
trop[bot]
6b458c78b0 fix: -Wunsafe-buffer-usage warnings in TaskbarHost::SetThumbarButtons() (#44260)
* fix: -Wunsafe-buffer-usage warnings in TaskbarHost::SetThumbarButtons()

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

* fixup! fix: -Wunsafe-buffer-usage warning in ChunkedDataPipeReadableStream (#44211)

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-16 15:03:38 +02:00
trop[bot]
77324ff514 build: update devcontainer sha (#44245)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2024-10-15 09:19:27 -05:00
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
96 changed files with 825 additions and 667 deletions

View File

@@ -2,7 +2,7 @@ version: '3'
services:
buildtools:
image: ghcr.io/electron/devcontainer:9a43c14f5c19be0359843299f79e736521373adc
image: ghcr.io/electron/devcontainer:77262e58c37631ab082482f42c33cdf68c6c394b
volumes:
- ..:/workspaces/gclient/src/electron:cached

View File

@@ -6,6 +6,6 @@ runs:
- name: Install Build Tools
shell: bash
run: |
export BUILD_TOOLS_SHA=d5b87591842be19058e8d75d2c5b7f1fabe9f450
export BUILD_TOOLS_SHA=eeb1a11392e4cec08fd926c93b31ab556dc0c23b
npm i -g @electron/build-tools
e auto-update disable

View File

@@ -164,7 +164,7 @@ jobs:
uses: ./src/electron/.github/actions/install-build-tools
- name: Init Build Tools
run: |
e init -f --root=$(pwd) --out=Default ${{ inputs.gn-build-type }} --import ${{ inputs.gn-build-type }} --target-cpu ${{ inputs.target-arch }} --only-sdk
e init -f --root=$(pwd) --out=Default ${{ inputs.gn-build-type }} --import ${{ inputs.gn-build-type }} --target-cpu ${{ inputs.target-arch }}
- name: Run Electron Only Hooks
run: |
gclient runhooks --spec="solutions=[{'name':'src/electron','url':None,'deps_file':'DEPS','custom_vars':{'process_deps':False},'managed':False}]"
@@ -177,18 +177,9 @@ jobs:
- name: Fix Sync (macOS)
if: ${{ inputs.target-platform == 'macos' }}
uses: ./src/electron/.github/actions/fix-sync-macos
- name: Install build-tools & Setup RBE
- name: Setup Number of Ninja Processes
run: |
echo "NUMBER_OF_NINJA_PROCESSES=${{ inputs.target-platform == 'linux' && '300' || '200' }}" >> $GITHUB_ENV
cd ~/.electron_build_tools
npx yarn --ignore-engines
# Pull down credential helper and print status
node -e "require('./src/utils/reclient.js').downloadAndPrepare({})"
HELPER=$(node -p "require('./src/utils/reclient.js').helperPath({})")
$HELPER login
echo 'RBE_service='`node -e "console.log(require('./src/utils/reclient.js').serviceAddress)"` >> $GITHUB_ENV
echo 'RBE_experimental_credentials_helper='`node -e "console.log(require('./src/utils/reclient.js').helperPath({}))"` >> $GITHUB_ENV
echo 'RBE_experimental_credentials_helper_args=print' >> $GITHUB_ENV
- name: Free up space (macOS)
if: ${{ inputs.target-platform == 'macos' }}
uses: ./src/electron/.github/actions/free-space-macos

View File

@@ -75,7 +75,7 @@ jobs:
uses: ./src/electron/.github/actions/install-build-tools
- name: Init Build Tools
run: |
e init -f --root=$(pwd) --out=Default ${{ inputs.gn-build-type }} --import ${{ inputs.gn-build-type }} --target-cpu ${{ inputs.target-arch }} --only-sdk
e init -f --root=$(pwd) --out=Default ${{ inputs.gn-build-type }} --import ${{ inputs.gn-build-type }} --target-cpu ${{ inputs.target-arch }}
- name: Get Depot Tools
timeout-minutes: 5
run: |

View File

@@ -146,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 }})
@@ -185,6 +189,18 @@ 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@50769540e7f4bd5e21e526ee35c689e35e0d6874

4
DEPS
View File

@@ -2,9 +2,9 @@ gclient_gn_args_from = 'src'
vars = {
'chromium_version':
'130.0.6723.19',
'130.0.6723.59',
'node_version':
'v20.17.0',
'v20.18.0',
'nan_version':
'e14bdcd1f72d62bca1d541b66da43130384ec213',
'squirrel.mac_version':

View File

@@ -36,7 +36,7 @@ environment:
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
@@ -122,8 +128,6 @@ for:
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"
@@ -152,7 +156,7 @@ for:
- gn check out/Default //electron:electron_app
- gn check out/Default //electron/shell/common:mojo
- gn check out/Default //electron/shell/common:plugin
- if DEFINED ELECTRON_RBE_JWT (autoninja -j 300 -C out/Default electron:electron_app) else (autoninja -C out/Default electron:electron_app)
- autoninja -j 300 -C out/Default electron:electron_app
- if "%GN_CONFIG%"=="testing" ( python C:\depot_tools\post_build_ninja_summary.py -C out\Default )
- gn gen out/ffmpeg "--args=import(\"//electron/build/args/ffmpeg.gn\") use_remoteexec=true %GN_EXTRA_ARGS%"
- autoninja -C out/ffmpeg electron:electron_ffmpeg_zip
@@ -254,14 +258,19 @@ 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: |
@@ -273,6 +282,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 ..
@@ -321,10 +331,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\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

@@ -36,7 +36,7 @@ environment:
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
@@ -119,8 +123,6 @@ for:
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"
@@ -149,7 +151,7 @@ for:
- gn check out/Default //electron:electron_app
- gn check out/Default //electron/shell/common:mojo
- gn check out/Default //electron/shell/common:plugin
- if DEFINED ELECTRON_RBE_JWT (autoninja -j 300 -C out/Default electron:electron_app) else (autoninja -C out/Default electron:electron_app)
- autoninja -j 300 -C out/Default electron:electron_app
- if "%GN_CONFIG%"=="testing" ( python C:\depot_tools\post_build_ninja_summary.py -C out\Default )
- gn gen out/ffmpeg "--args=import(\"//electron/build/args/ffmpeg.gn\") use_remoteexec=true %GN_EXTRA_ARGS%"
- autoninja -C out/ffmpeg electron:electron_ffmpeg_zip
@@ -246,7 +248,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: |
@@ -263,6 +273,7 @@ for:
} else {
$global:LASTEXITCODE = 0
}
- npm install -g @datadog/datadog-ci
- cd ..
- mkdir out\Default
- cd ..
@@ -308,7 +319,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
- 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"
@@ -320,3 +333,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\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

@@ -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

@@ -127,6 +127,9 @@ Returns:
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:

View File

@@ -9,10 +9,11 @@ check out our [Electron Versioning](./electron-versioning.md) doc.
| Electron | Alpha | Beta | Stable | EOL | Chrome | Node | Supported |
| ------- | ----- | ------- | ------ | ------ | ---- | ---- | ---- |
| 33.0.0 | 2024-Aug-22 | 2024-Sep-18 | 2024-Oct-15 | 2025-Apr-29 | M130 | 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 | |
| 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 | 🚫 |

View File

@@ -680,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

@@ -130,4 +130,3 @@ chore_remove_reference_to_chrome_browser_themes.patch
feat_enable_customizing_symbol_color_in_framecaptionbutton.patch
build_expose_webplugininfo_interface_to_electron.patch
feat_allow_usage_of_sccontentsharingpicker_on_supported_platforms.patch
feat_allow_-4_as_a_macos_screen_share_id.patch

View File

@@ -23,10 +23,10 @@ index ad0092ef2e13853e4bb8b923481559a043b00ab7..1c2dfd23f18733e21312992877ae1499
int32_t world_id) {}
virtual void DidClearWindowObject() {}
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index 724818204a4fa1578102c2fe1a8877735323595a..954fdbbdd4d07c32d6fe78632ca95efc29fadc3c 100644
index 24904d0b6436353601aa43c603f9d12fb8eff960..a673c3c00bc59e3bd8b0ed2ecb086856f57134ac 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -4791,6 +4791,12 @@ void RenderFrameImpl::DidCreateScriptContext(v8::Local<v8::Context> context,
@@ -4794,6 +4794,12 @@ void RenderFrameImpl::DidCreateScriptContext(v8::Local<v8::Context> context,
observer.DidCreateScriptContext(context, world_id);
}

View File

@@ -15,10 +15,10 @@ Refs changes in:
This patch reverts the changes to fix associated crashes in Electron.
diff --git a/third_party/blink/renderer/core/frame/frame.cc b/third_party/blink/renderer/core/frame/frame.cc
index 6210eae2b7c25dae24ad7087d3e0ac494dada375..934ee55c89c526ca8fa390a13c4dd79b1c85882f 100644
index 2f33ec660a975522c473ecd50e633b5edaca707f..65221a51927d9f44bd6adbad88fa1144f2db3add 100644
--- a/third_party/blink/renderer/core/frame/frame.cc
+++ b/third_party/blink/renderer/core/frame/frame.cc
@@ -131,14 +131,6 @@ bool Frame::Detach(FrameDetachType type) {
@@ -135,14 +135,6 @@ bool Frame::Detach(FrameDetachType type) {
DCHECK(!IsDetached());
@@ -33,7 +33,7 @@ index 6210eae2b7c25dae24ad7087d3e0ac494dada375..934ee55c89c526ca8fa390a13c4dd79b
if (type == FrameDetachType::kRemove) {
if (provisional_frame_) {
provisional_frame_->Detach(FrameDetachType::kRemove);
@@ -162,6 +154,14 @@ bool Frame::Detach(FrameDetachType type) {
@@ -166,6 +158,14 @@ bool Frame::Detach(FrameDetachType type) {
GetWindowProxyManager()->ClearForSwap();
}

View File

@@ -33,10 +33,10 @@ index ad7aef003b233245201937c58be12fa3acb6b1a4..275eb74983e684310753dabcd453e5a2
"//base",
"//build:branding_buildflags",
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
index dd5c9db43d693fb9df7b5a0d661b4e8999956c49..2ea0ea1dd6f30e4e3c88ad803314bc5239545c1f 100644
index 7f1c26990d8d43e92615bd3a5f4046d121d6ac6b..89d03b68cab5cec6095c2df2159a2f1cd15df0be 100644
--- a/chrome/browser/BUILD.gn
+++ b/chrome/browser/BUILD.gn
@@ -4488,7 +4488,7 @@ static_library("browser") {
@@ -4486,7 +4486,7 @@ static_library("browser") {
]
}
@@ -46,7 +46,7 @@ index dd5c9db43d693fb9df7b5a0d661b4e8999956c49..2ea0ea1dd6f30e4e3c88ad803314bc52
# than here in :chrome_dll.
deps += [ "//chrome:packed_resources_integrity_header" ]
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn
index c79b93b972e244cc3f7bcce039e24bbfe363ed04..2a3b25d5f2dcf80d2e4c462d6cba00583785ca8e 100644
index c53d7af88b3570e6c320b408afa449e51e355b6b..61aecb395632212911d57545cb068ca67bbac7d5 100644
--- a/chrome/test/BUILD.gn
+++ b/chrome/test/BUILD.gn
@@ -7173,9 +7173,12 @@ test("unit_tests") {
@@ -63,7 +63,7 @@ index c79b93b972e244cc3f7bcce039e24bbfe363ed04..2a3b25d5f2dcf80d2e4c462d6cba0058
"//chrome//services/util_win:unit_tests",
"//chrome/app:chrome_dll_resources",
"//chrome/app:win_unit_tests",
@@ -8180,6 +8183,10 @@ test("unit_tests") {
@@ -8181,6 +8184,10 @@ test("unit_tests") {
"../browser/performance_manager/policies/background_tab_loading_policy_unittest.cc",
]
@@ -74,7 +74,7 @@ index c79b93b972e244cc3f7bcce039e24bbfe363ed04..2a3b25d5f2dcf80d2e4c462d6cba0058
sources += [
# The importer code is not used on Android.
"../common/importer/firefox_importer_utils_unittest.cc",
@@ -8236,7 +8243,6 @@ test("unit_tests") {
@@ -8237,7 +8244,6 @@ test("unit_tests") {
# Non-android deps for "unit_tests" target.
deps += [
"../browser/screen_ai:screen_ai_install_state",

View File

@@ -9,10 +9,10 @@ potentially prevent a window from being created.
TODO(loc): this patch is currently broken.
diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc
index 2fd13bfb778f31eff97ced7d5e41de30398b0a74..99a54798649942244c2ee51d1d10da8a8a637bfa 100644
index a0d5a983bb46a50dcf31afadc10f597a0e3ed15d..b6bda9691f0ae96ee4ba5d0d96d4e57e4fa592c2 100644
--- a/content/browser/renderer_host/render_frame_host_impl.cc
+++ b/content/browser/renderer_host/render_frame_host_impl.cc
@@ -8945,6 +8945,7 @@ void RenderFrameHostImpl::CreateNewWindow(
@@ -9060,6 +9060,7 @@ void RenderFrameHostImpl::CreateNewWindow(
last_committed_origin_, params->window_container_type,
params->target_url, params->referrer.To<Referrer>(),
params->frame_name, params->disposition, *params->features,
@@ -148,10 +148,10 @@ index a080fb57f00c712eb8a3a9be669413e1082ce3b3..4826eea9747c4860d7f5b4b8d478e62c
// typically happens when popups are created.
virtual void WebContentsCreated(WebContents* source_contents,
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index d5e16b9e780efac46e088b3ef226e4418a90aeaf..724818204a4fa1578102c2fe1a8877735323595a 100644
index 7b7e727c44a1477640f8702ad818f4a8607e3fb7..24904d0b6436353601aa43c603f9d12fb8eff960 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -6834,6 +6834,10 @@ WebView* RenderFrameImpl::CreateNewWindow(
@@ -6837,6 +6837,10 @@ WebView* RenderFrameImpl::CreateNewWindow(
request.HasUserGesture(), GetWebFrame()->IsAdFrame(),
GetWebFrame()->IsAdScriptInStack());
@@ -210,10 +210,10 @@ index c576ace24e81cc877aa2595d40e0a13a7af9f6a2..210fb97d44c19c29af424cc7b9cb3169
} // namespace blink
diff --git a/third_party/blink/renderer/core/frame/local_dom_window.cc b/third_party/blink/renderer/core/frame/local_dom_window.cc
index 7b8158aff39c247e1729edb032833cdebf949acf..7d77f26106950deb1bae43ca7dcd7e0cde0ac6b5 100644
index fe3c23e1dd1c818b5cb07a609dbbf17763c6d583..77bcaaf388fe1fb4577e25880b10154db0b46ce4 100644
--- a/third_party/blink/renderer/core/frame/local_dom_window.cc
+++ b/third_party/blink/renderer/core/frame/local_dom_window.cc
@@ -2248,6 +2248,8 @@ DOMWindow* LocalDOMWindow::open(v8::Isolate* isolate,
@@ -2251,6 +2251,8 @@ DOMWindow* LocalDOMWindow::open(v8::Isolate* isolate,
WebWindowFeatures window_features =
GetWindowFeaturesFromString(features, entered_window);

View File

@@ -1,63 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Fedor Indutny <indutny@signal.org>
Date: Tue, 17 Sep 2024 17:51:46 -0700
Subject: feat: allow -4 as a macos screen share id
We use fake video source ids for native macOS screen share window picker
of the following form:
window:-4:-1
Where the last digit represents the window id and decrements with each
requested screen share.
diff --git a/content/browser/media/capture/screen_capture_kit_device_mac.mm b/content/browser/media/capture/screen_capture_kit_device_mac.mm
index 1c2d0c6dd4101fe0bac69e3018bbbedadce224cc..e407382a3463374fd57a83d70c5f96dca5825faf 100644
--- a/content/browser/media/capture/screen_capture_kit_device_mac.mm
+++ b/content/browser/media/capture/screen_capture_kit_device_mac.mm
@@ -510,7 +510,9 @@ void OnStart(std::optional<bool> use_native_picker) override {
if (@available(macOS 15.0, *)) {
constexpr bool DefaultUseNativePicker = true;
- if (use_native_picker.value_or(DefaultUseNativePicker) && source_.id < 0 && source_.window_id == 0) {
+ if (use_native_picker.value_or(DefaultUseNativePicker) &&
+ source_.id == DesktopMediaID::kMacOsNativePickerId &&
+ source_.window_id < 0) {
auto* picker = [SCContentSharingPicker sharedPicker];
ScreenCaptureKitDeviceMac::active_streams_++;
picker.maximumStreamCount = @(ScreenCaptureKitDeviceMac::active_streams_);
diff --git a/content/browser/renderer_host/media/in_process_video_capture_device_launcher.cc b/content/browser/renderer_host/media/in_process_video_capture_device_launcher.cc
index d162612dc70a2b57190aaf558aca8f46cbdedcad..bab2f0282b191a4263fc964125e199e52c62554b 100644
--- a/content/browser/renderer_host/media/in_process_video_capture_device_launcher.cc
+++ b/content/browser/renderer_host/media/in_process_video_capture_device_launcher.cc
@@ -332,8 +332,16 @@ void InProcessVideoCaptureDeviceLauncher::LaunchDeviceAsync(
break;
}
+#if defined(USE_AURA)
+ bool allow_window_id = false;
+#elif BUILDFLAG(IS_MAC)
+ bool allow_window_id =
+ desktop_id.id == DesktopMediaID::kMacOsNativePickerId;
+#endif
+
#if defined(USE_AURA) || BUILDFLAG(IS_MAC)
- if (desktop_id.window_id != DesktopMediaID::kNullId) {
+ if (!allow_window_id &&
+ desktop_id.window_id != DesktopMediaID::kNullId) {
// For the other capturers, when a bug reports the type of capture it's
// easy enough to determine which capturer was used, but it's a little
// fuzzier with window capture.
diff --git a/content/public/browser/desktop_media_id.h b/content/public/browser/desktop_media_id.h
index 415156d403a59bf426cf4561a9d58ecdb27524b4..78aa7b2359c684d5305bf6352751dfbb7ca00d29 100644
--- a/content/public/browser/desktop_media_id.h
+++ b/content/public/browser/desktop_media_id.h
@@ -27,6 +27,8 @@ struct CONTENT_EXPORT DesktopMediaID {
static constexpr Id kNullId = 0;
// Represents a fake id to create a dummy capturer for autotests.
static constexpr Id kFakeId = -3;
+ // Represents an id to use native macOS picker for screenshare
+ static constexpr Id kMacOsNativePickerId = -4;
#if defined(USE_AURA) || BUILDFLAG(IS_MAC)
// Assigns integer identifier to the |window| and returns its DesktopMediaID.

View File

@@ -46,7 +46,7 @@ index 8ac12480f663a74dfbdcf7128a582a81b4474d25..db6802a2603e1d3c3039e49737438124
// OnStop is called by StopAndDeAllocate.
virtual void OnStop() = 0;
diff --git a/content/browser/media/capture/screen_capture_kit_device_mac.mm b/content/browser/media/capture/screen_capture_kit_device_mac.mm
index b6129282c6807702cf88e0a3e2ba233e41a20960..1c2d0c6dd4101fe0bac69e3018bbbedadce224cc 100644
index b6129282c6807702cf88e0a3e2ba233e41a20960..87a00302de8db47299b185471e303b9e172e9c76 100644
--- a/content/browser/media/capture/screen_capture_kit_device_mac.mm
+++ b/content/browser/media/capture/screen_capture_kit_device_mac.mm
@@ -24,24 +24,83 @@
@@ -143,7 +143,7 @@ index b6129282c6807702cf88e0a3e2ba233e41a20960..1c2d0c6dd4101fe0bac69e3018bbbeda
public:
explicit ScreenCaptureKitDeviceMac(const DesktopMediaID& source,
SCContentFilter* filter)
@@ -152,18 +212,41 @@ explicit ScreenCaptureKitDeviceMac(const DesktopMediaID& source,
@@ -152,18 +212,42 @@ explicit ScreenCaptureKitDeviceMac(const DesktopMediaID& source,
device_task_runner_,
base::BindRepeating(&ScreenCaptureKitDeviceMac::OnStreamSample,
weak_factory_.GetWeakPtr()));
@@ -165,8 +165,8 @@ index b6129282c6807702cf88e0a3e2ba233e41a20960..1c2d0c6dd4101fe0bac69e3018bbbeda
+ device_task_runner_,
+ base::BindRepeating(&ScreenCaptureKitDeviceMac::OnContentFilterReady, weak_factory_.GetWeakPtr())
+ );
+ auto* picker_observer = [[ScreenCaptureKitPickerHelper alloc] initWithStreamPickCallback:picker_callback cancelCallback:cancel_callback errorCallback:error_callback];
+ [[SCContentSharingPicker sharedPicker] addObserver:picker_observer];
+ picker_helper_ = [[ScreenCaptureKitPickerHelper alloc] initWithStreamPickCallback:picker_callback cancelCallback:cancel_callback errorCallback:error_callback];
+ [[SCContentSharingPicker sharedPicker] addObserver:picker_helper_];
+ }
}
ScreenCaptureKitDeviceMac(const ScreenCaptureKitDeviceMac&) = delete;
@@ -180,13 +180,14 @@ index b6129282c6807702cf88e0a3e2ba233e41a20960..1c2d0c6dd4101fe0bac69e3018bbbeda
+ picker.maximumStreamCount = @(ScreenCaptureKitDeviceMac::active_streams_);
+ if (ScreenCaptureKitDeviceMac::active_streams_ == 0 && picker.active) {
+ picker.active = false;
+ [[SCContentSharingPicker sharedPicker] removeObserver:picker_helper_];
+ }
+ }
+ }
void OnShareableContentCreated(SCShareableContent* content) {
DCHECK(device_task_runner_->RunsTasksInCurrentSequence());
@@ -232,7 +315,7 @@ void CreateStream(SCContentFilter* filter) {
@@ -232,7 +316,7 @@ void CreateStream(SCContentFilter* filter) {
return;
}
@@ -195,7 +196,7 @@ index b6129282c6807702cf88e0a3e2ba233e41a20960..1c2d0c6dd4101fe0bac69e3018bbbeda
// Update the content size. This step is neccessary when used together
// with SCContentSharingPicker. If the Chrome picker is used, it will
// change to retina resolution if applicable.
@@ -241,6 +324,9 @@ void CreateStream(SCContentFilter* filter) {
@@ -241,6 +325,9 @@ void CreateStream(SCContentFilter* filter) {
filter.contentRect.size.height * filter.pointPixelScale);
}
@@ -205,7 +206,7 @@ index b6129282c6807702cf88e0a3e2ba233e41a20960..1c2d0c6dd4101fe0bac69e3018bbbeda
gfx::RectF dest_rect_in_frame;
actual_capture_format_ = capture_params().requested_format;
actual_capture_format_.pixel_format = media::PIXEL_FORMAT_NV12;
@@ -254,6 +340,7 @@ void CreateStream(SCContentFilter* filter) {
@@ -254,6 +341,7 @@ void CreateStream(SCContentFilter* filter) {
stream_ = [[SCStream alloc] initWithFilter:filter
configuration:config
delegate:helper_];
@@ -213,7 +214,7 @@ index b6129282c6807702cf88e0a3e2ba233e41a20960..1c2d0c6dd4101fe0bac69e3018bbbeda
{
NSError* error = nil;
bool add_stream_output_result =
@@ -395,7 +482,7 @@ void OnStreamError() {
@@ -395,7 +483,7 @@ void OnStreamError() {
if (fullscreen_module_) {
fullscreen_module_->Reset();
}
@@ -222,7 +223,7 @@ index b6129282c6807702cf88e0a3e2ba233e41a20960..1c2d0c6dd4101fe0bac69e3018bbbeda
} else {
client()->OnError(media::VideoCaptureError::kScreenCaptureKitStreamError,
FROM_HERE, "Stream delegate called didStopWithError");
@@ -418,23 +505,39 @@ void OnUpdateConfigurationError() {
@@ -418,23 +506,41 @@ void OnUpdateConfigurationError() {
}
// IOSurfaceCaptureDeviceBase:
@@ -246,7 +247,9 @@ index b6129282c6807702cf88e0a3e2ba233e41a20960..1c2d0c6dd4101fe0bac69e3018bbbeda
+
+ if (@available(macOS 15.0, *)) {
+ constexpr bool DefaultUseNativePicker = true;
+ if (use_native_picker.value_or(DefaultUseNativePicker) && source_.id < 0 && source_.window_id == 0) {
+ if (use_native_picker.value_or(DefaultUseNativePicker) &&
+ source_.id == DesktopMediaID::kMacOsNativePickerId &&
+ source_.window_id < 0) {
+ auto* picker = [SCContentSharingPicker sharedPicker];
+ ScreenCaptureKitDeviceMac::active_streams_++;
+ picker.maximumStreamCount = @(ScreenCaptureKitDeviceMac::active_streams_);
@@ -277,7 +280,7 @@ index b6129282c6807702cf88e0a3e2ba233e41a20960..1c2d0c6dd4101fe0bac69e3018bbbeda
}
void OnStop() override {
DCHECK(device_task_runner_->RunsTasksInCurrentSequence());
@@ -492,6 +595,8 @@ void ResetStreamTo(SCWindow* window) override {
@@ -492,6 +598,8 @@ void ResetStreamTo(SCWindow* window) override {
}
private:
@@ -286,7 +289,18 @@ index b6129282c6807702cf88e0a3e2ba233e41a20960..1c2d0c6dd4101fe0bac69e3018bbbeda
const DesktopMediaID source_;
SCContentFilter* const filter_;
const scoped_refptr<base::SingleThreadTaskRunner> device_task_runner_;
@@ -521,6 +626,8 @@ void ResetStreamTo(SCWindow* window) override {
@@ -509,6 +617,10 @@ void ResetStreamTo(SCWindow* window) override {
// Helper class that acts as output and delegate for `stream_`.
ScreenCaptureKitDeviceHelper* __strong helper_;
+ // Helper class that acts as an observer for SCContentSharingPicker
+ API_AVAILABLE(macos(15.0))
+ ScreenCaptureKitPickerHelper* __strong picker_helper_;
+
// This is used to detect when a captured presentation enters fullscreen mode.
// If this happens, the module will call the ResetStreamTo function.
std::unique_ptr<ScreenCaptureKitFullscreenModule> fullscreen_module_;
@@ -521,6 +633,8 @@ void ResetStreamTo(SCWindow* window) override {
base::WeakPtrFactory<ScreenCaptureKitDeviceMac> weak_factory_{this};
};
@@ -296,10 +310,28 @@ index b6129282c6807702cf88e0a3e2ba233e41a20960..1c2d0c6dd4101fe0bac69e3018bbbeda
// Although ScreenCaptureKit is available in 12.3 there were some bugs that
diff --git a/content/browser/renderer_host/media/in_process_video_capture_device_launcher.cc b/content/browser/renderer_host/media/in_process_video_capture_device_launcher.cc
index 7adf8264cfa9980c4a8414bf0f8bfa9ad70ec0b3..d162612dc70a2b57190aaf558aca8f46cbdedcad 100644
index 7adf8264cfa9980c4a8414bf0f8bfa9ad70ec0b3..bab2f0282b191a4263fc964125e199e52c62554b 100644
--- a/content/browser/renderer_host/media/in_process_video_capture_device_launcher.cc
+++ b/content/browser/renderer_host/media/in_process_video_capture_device_launcher.cc
@@ -360,13 +360,15 @@ void InProcessVideoCaptureDeviceLauncher::LaunchDeviceAsync(
@@ -332,8 +332,16 @@ void InProcessVideoCaptureDeviceLauncher::LaunchDeviceAsync(
break;
}
+#if defined(USE_AURA)
+ bool allow_window_id = false;
+#elif BUILDFLAG(IS_MAC)
+ bool allow_window_id =
+ desktop_id.id == DesktopMediaID::kMacOsNativePickerId;
+#endif
+
#if defined(USE_AURA) || BUILDFLAG(IS_MAC)
- if (desktop_id.window_id != DesktopMediaID::kNullId) {
+ if (!allow_window_id &&
+ desktop_id.window_id != DesktopMediaID::kNullId) {
// For the other capturers, when a bug reports the type of capture it's
// easy enough to determine which capturer was used, but it's a little
// fuzzier with window capture.
@@ -360,13 +368,15 @@ void InProcessVideoCaptureDeviceLauncher::LaunchDeviceAsync(
std::move(after_start_capture_callback));
break;
#else
@@ -316,6 +348,19 @@ index 7adf8264cfa9980c4a8414bf0f8bfa9ad70ec0b3..d162612dc70a2b57190aaf558aca8f46
CreateDeviceClient(media::VideoCaptureBufferType::kSharedMemory,
kMaxNumberOfBuffers, std::move(receiver),
std::move(receiver_on_io_thread)),
diff --git a/content/public/browser/desktop_media_id.h b/content/public/browser/desktop_media_id.h
index 415156d403a59bf426cf4561a9d58ecdb27524b4..78aa7b2359c684d5305bf6352751dfbb7ca00d29 100644
--- a/content/public/browser/desktop_media_id.h
+++ b/content/public/browser/desktop_media_id.h
@@ -27,6 +27,8 @@ struct CONTENT_EXPORT DesktopMediaID {
static constexpr Id kNullId = 0;
// Represents a fake id to create a dummy capturer for autotests.
static constexpr Id kFakeId = -3;
+ // Represents an id to use native macOS picker for screenshare
+ static constexpr Id kMacOsNativePickerId = -4;
#if defined(USE_AURA) || BUILDFLAG(IS_MAC)
// Assigns integer identifier to the |window| and returns its DesktopMediaID.
diff --git a/media/capture/video_capture_types.h b/media/capture/video_capture_types.h
index f2b75f5b2f547ad135c1288bf3639b26dedc8053..ef18724d9f2ea68a47b66fc3981f58a73ac1b51d 100644
--- a/media/capture/video_capture_types.h

View File

@@ -40,10 +40,10 @@ index 22bb23e6a84d3b6686461f87e846125ad7484742..198403ec544e71f50c8555d131015b80
// origin of |common_params.url| and/or |common_params.initiator_origin|.
url::Origin resolved_origin = url::Origin::Resolve(
diff --git a/third_party/blink/renderer/core/loader/document_loader.cc b/third_party/blink/renderer/core/loader/document_loader.cc
index 0fb02ada85ed3d4cc113ac7ce18d6efdb7065627..9e78c486fdc9b931dfcbcf40145076a22f221e35 100644
index f8098c86def00cac76932551bf413266facdc935..98a4c1ad9f561e1bec1e6113db46d4bcf3d3f694 100644
--- a/third_party/blink/renderer/core/loader/document_loader.cc
+++ b/third_party/blink/renderer/core/loader/document_loader.cc
@@ -2261,6 +2261,10 @@ Frame* DocumentLoader::CalculateOwnerFrame() {
@@ -2264,6 +2264,10 @@ Frame* DocumentLoader::CalculateOwnerFrame() {
scoped_refptr<SecurityOrigin> DocumentLoader::CalculateOrigin(
Document* owner_document) {
scoped_refptr<SecurityOrigin> origin;
@@ -54,7 +54,7 @@ index 0fb02ada85ed3d4cc113ac7ce18d6efdb7065627..9e78c486fdc9b931dfcbcf40145076a2
StringBuilder debug_info_builder;
// Whether the origin is newly created within this call, instead of copied
// from an existing document's origin or from `origin_to_commit_`. If this is
@@ -2313,6 +2317,10 @@ scoped_refptr<SecurityOrigin> DocumentLoader::CalculateOrigin(
@@ -2316,6 +2320,10 @@ scoped_refptr<SecurityOrigin> DocumentLoader::CalculateOrigin(
debug_info_builder.Append(", url=");
debug_info_builder.Append(owner_document->Url().BaseAsString());
debug_info_builder.Append(")");

View File

@@ -1343,7 +1343,7 @@ index 2e24201fcdc1ec65688e2b08d28a74a218792af2..53b399c13c344b72992b9433add202ed
if (is_ios) {
diff --git a/ui/accessibility/platform/browser_accessibility_manager_mac.mm b/ui/accessibility/platform/browser_accessibility_manager_mac.mm
index f9bd6478bea53f2b005c2d57b5f1db5313f77595..41a032e34335c554eca40edd74e8c271b3570a08 100644
index be442f6a2a67d07ec78fe00a3e864bf0088fe504..3a8c8a3900db26b10f2b7735b860d8935d2a6085 100644
--- a/ui/accessibility/platform/browser_accessibility_manager_mac.mm
+++ b/ui/accessibility/platform/browser_accessibility_manager_mac.mm
@@ -19,7 +19,9 @@

View File

@@ -10,10 +10,10 @@ an about:blank check to this area.
Ref: https://chromium-review.googlesource.com/c/chromium/src/+/5403876
diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc
index 379da2b28724fb271338f797a116e5c44986c324..1277ee2264131e5da937b4c01f5c259eded2df39 100644
index 67e53ad616687ea17719e3f4f1d00192c5b69d61..1642d61585c7aee3ec7a0907f5cdcd016e29ca6e 100644
--- a/content/browser/renderer_host/render_frame_host_impl.cc
+++ b/content/browser/renderer_host/render_frame_host_impl.cc
@@ -778,8 +778,8 @@ void VerifyThatBrowserAndRendererCalculatedOriginsToCommitMatch(
@@ -782,8 +782,8 @@ void VerifyThatBrowserAndRendererCalculatedOriginsToCommitMatch(
// TODO(crbug.com/40092527): Consider adding a separate boolean that
// tracks this instead of piggybacking `origin_calculation_debug_info`.
if (renderer_side_origin.opaque() &&

View File

@@ -926,3 +926,23 @@ index 7a65f7f2d68edb74fbaf74fe41949ed9cc198b25..4d7c59e93d71b624d4e93e643932c816
namespace sandbox::policy {
base::FilePath GetCanonicalPath(const base::FilePath& path) {
diff --git a/ui/gtk/gtk_util.cc b/ui/gtk/gtk_util.cc
index d86fbcf969f2fa0d176ead903703ab612e5464c2..6b963ea8401d20e655d068a69105586814bab320 100644
--- a/ui/gtk/gtk_util.cc
+++ b/ui/gtk/gtk_util.cc
@@ -227,9 +227,13 @@ aura::Window* GetAuraTransientParent(GtkWidget* dialog) {
}
void ClearAuraTransientParent(GtkWidget* dialog, aura::Window* parent) {
+ if (!parent || !parent->GetHost()) {
+ return;
+ }
+
g_object_set_data(G_OBJECT(dialog), kAuraTransientParent, nullptr);
- GtkUi::GetPlatform()->ClearTransientFor(
- parent->GetHost()->GetAcceleratedWidget());
+ gfx::AcceleratedWidget parent_id = parent->GetHost()->GetAcceleratedWidget();
+ GtkUi::GetPlatform()->ClearTransientFor(parent_id);
}
base::OnceClosure DisableHostInputHandling(GtkWidget* dialog,

View File

@@ -15,10 +15,10 @@ Note that we also need to manually update embedder's
`api::WebContents::IsFullscreenForTabOrPending` value.
diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc
index 99a54798649942244c2ee51d1d10da8a8a637bfa..379da2b28724fb271338f797a116e5c44986c324 100644
index b6bda9691f0ae96ee4ba5d0d96d4e57e4fa592c2..67e53ad616687ea17719e3f4f1d00192c5b69d61 100644
--- a/content/browser/renderer_host/render_frame_host_impl.cc
+++ b/content/browser/renderer_host/render_frame_host_impl.cc
@@ -8060,6 +8060,17 @@ void RenderFrameHostImpl::EnterFullscreen(
@@ -8175,6 +8175,17 @@ void RenderFrameHostImpl::EnterFullscreen(
}
}

View File

@@ -45,12 +45,11 @@ src_do_not_use_deprecated_v8_api.patch
src_use_new_v8_api_to_define_stream_accessor.patch
src_remove_dependency_on_wrapper-descriptor-based_cppheap.patch
test_update_v8-stats_test_for_v8_12_6.patch
chore_remove_calls_to_v8_functioncallbackinfo_holder.patch
src_do_not_use_soon-to-be-deprecated_v8_api.patch
fix_add_property_query_interceptors.patch
src_account_for_openssl_unexpected_version.patch
src_stop_using_deprecated_fields_of_fastapicallbackoptions.patch
build_don_t_redefine_win32_lean_and_mean.patch
src_use_supported_api_to_get_stalled_tla_messages.patch
build_compile_with_c_20_support.patch
add_v8_taskpirority_to_foreground_task_runner_signature.patch
build_restore_clang_as_default_compiler_on_macos.patch

View File

@@ -537,10 +537,10 @@ index 0e69d7383762f6b81c5b57698aa9d121d5a9c401..35bbeb37acc7ccb14b4b8a644ec3d4c7
cflags_c = [
"-mavx512vl",
diff --git a/deps/cares/BUILD.gn b/deps/cares/BUILD.gn
index ac19ac73ed1e24c61cb679f3851685b79cfc8b39..d083aea4cb895d8425041879f1b22a6ee43a0b60 100644
index ac19ac73ed1e24c61cb679f3851685b79cfc8b39..7f4885631a85a25692e8969991951be02e5d73f1 100644
--- a/deps/cares/BUILD.gn
+++ b/deps/cares/BUILD.gn
@@ -1,14 +1,172 @@
@@ -1,14 +1,175 @@
-##############################################################################
-# #
-# DO NOT EDIT THIS FILE! #
@@ -569,60 +569,18 @@ index ac19ac73ed1e24c61cb679f3851685b79cfc8b39..d083aea4cb895d8425041879f1b22a6e
+ "include/ares_version.h",
+ "src/lib/ares__addrinfo2hostent.c",
+ "src/lib/ares__addrinfo_localhost.c",
+ "src/lib/ares__buf.c",
+ "src/lib/ares__buf.h",
+ "src/lib/ares__close_sockets.c",
+ "src/lib/ares__hosts_file.c",
+ "src/lib/ares__htable.c",
+ "src/lib/ares__htable.h",
+ "src/lib/ares__htable_asvp.c",
+ "src/lib/ares__htable_asvp.h",
+ "src/lib/ares__htable_strvp.c",
+ "src/lib/ares__htable_strvp.h",
+ "src/lib/ares__htable_szvp.c",
+ "src/lib/ares__htable_szvp.h",
+ "src/lib/ares__htable_vpvp.c",
+ "src/lib/ares__htable_vpvp.h",
+ "src/lib/ares__iface_ips.c",
+ "src/lib/ares__iface_ips.h",
+ "src/lib/ares__llist.c",
+ "src/lib/ares__llist.h",
+ "src/lib/ares__parse_into_addrinfo.c",
+ "src/lib/ares__slist.c",
+ "src/lib/ares__slist.h",
+ "src/lib/ares__socket.c",
+ "src/lib/ares__sortaddrinfo.c",
+ "src/lib/ares__threads.c",
+ "src/lib/ares__threads.h",
+ "src/lib/ares__timeval.c",
+ "src/lib/ares_android.c",
+ "src/lib/ares_android.h",
+ "src/lib/ares_cancel.c",
+ "src/lib/ares_create_query.c",
+ "src/lib/ares_cookie.c",
+ "src/lib/ares_data.c",
+ "src/lib/ares_data.h",
+ "src/lib/ares_destroy.c",
+ "src/lib/ares_dns_mapping.c",
+ "src/lib/ares_dns_multistring.c",
+ "src/lib/ares_dns_multistring.h",
+ "src/lib/ares_dns_name.c",
+ "src/lib/ares_dns_parse.c",
+ "src/lib/ares_dns_record.c",
+ "src/lib/ares_dns_private.h",
+ "src/lib/ares_dns_write.c",
+ "src/lib/ares_event_configchg.c",
+ "src/lib/ares_event.h",
+ "src/lib/ares_event_win32.h",
+ "src/lib/ares_event_epoll.c",
+ "src/lib/ares_event_kqueue.c",
+ "src/lib/ares_event_poll.c",
+ "src/lib/ares_event_select.c",
+ "src/lib/ares_event_thread.c",
+ "src/lib/ares_event_wake_pipe.c",
+ "src/lib/ares_event_win32.c",
+ "src/lib/ares_expand_name.c",
+ "src/lib/ares_expand_string.c",
+ "src/lib/ares_fds.c",
+ "src/lib/ares_free_hostent.c",
+ "src/lib/ares_free_string.c",
+ "src/lib/ares_freeaddrinfo.c",
@@ -632,49 +590,94 @@ index ac19ac73ed1e24c61cb679f3851685b79cfc8b39..d083aea4cb895d8425041879f1b22a6e
+ "src/lib/ares_gethostbyaddr.c",
+ "src/lib/ares_gethostbyname.c",
+ "src/lib/ares_getnameinfo.c",
+ "src/lib/ares_getsock.c",
+ "src/lib/ares_inet_net_pton.h",
+ "src/lib/ares_init.c",
+ "src/lib/ares_library_init.c",
+ "src/lib/ares_ipv6.h",
+ "src/lib/ares_math.c",
+ "src/lib/ares_library_init.c",
+ "src/lib/ares_metrics.c",
+ "src/lib/ares_options.c",
+ "src/lib/ares_parse_a_reply.c",
+ "src/lib/ares_parse_aaaa_reply.c",
+ "src/lib/ares_parse_caa_reply.c",
+ "src/lib/ares_parse_mx_reply.c",
+ "src/lib/ares_parse_naptr_reply.c",
+ "src/lib/ares_parse_ns_reply.c",
+ "src/lib/ares_parse_ptr_reply.c",
+ "src/lib/ares_parse_soa_reply.c",
+ "src/lib/ares_parse_srv_reply.c",
+ "src/lib/ares_parse_txt_reply.c",
+ "src/lib/ares_parse_uri_reply.c",
+ "src/lib/ares_platform.c",
+ "src/lib/ares_platform.h",
+ "src/lib/ares_private.h",
+ "src/lib/ares_process.c",
+ "src/lib/ares_qcache.c",
+ "src/lib/ares_query.c",
+ "src/lib/ares_rand.c",
+ "src/lib/ares_search.c",
+ "src/lib/ares_send.c",
+ "src/lib/ares_setup.h",
+ "src/lib/ares_strcasecmp.c",
+ "src/lib/ares_strcasecmp.h",
+ "src/lib/ares_str.c",
+ "src/lib/ares_str.h",
+ "src/lib/ares_strerror.c",
+ "src/lib/ares_strsplit.c",
+ "src/lib/ares_strsplit.h",
+ "src/lib/ares_sysconfig.c",
+ "src/lib/ares_sysconfig_files.c",
+ "src/lib/ares_timeout.c",
+ "src/lib/ares_update_servers.c",
+ "src/lib/ares_version.c",
+ "src/lib/dsa/ares__array.c",
+ "src/lib/dsa/ares__array.h",
+ "src/lib/dsa/ares__htable.c",
+ "src/lib/dsa/ares__htable.h",
+ "src/lib/dsa/ares__htable_asvp.c",
+ "src/lib/dsa/ares__htable_asvp.h",
+ "src/lib/dsa/ares__htable_strvp.c",
+ "src/lib/dsa/ares__htable_strvp.h",
+ "src/lib/dsa/ares__htable_szvp.c",
+ "src/lib/dsa/ares__htable_szvp.h",
+ "src/lib/dsa/ares__htable_vpvp.c",
+ "src/lib/dsa/ares__htable_vpvp.h",
+ "src/lib/dsa/ares__llist.c",
+ "src/lib/dsa/ares__llist.h",
+ "src/lib/dsa/ares__slist.c",
+ "src/lib/dsa/ares__slist.h",
+ "src/lib/event/ares_event.h",
+ "src/lib/event/ares_event_configchg.c",
+ "src/lib/event/ares_event_epoll.c",
+ "src/lib/event/ares_event_kqueue.c",
+ "src/lib/event/ares_event_poll.c",
+ "src/lib/event/ares_event_select.c",
+ "src/lib/event/ares_event_thread.c",
+ "src/lib/event/ares_event_wake_pipe.c",
+ "src/lib/event/ares_event_win32.c",
+ "src/lib/event/ares_event_win32.h",
+ "src/lib/inet_net_pton.c",
+ "src/lib/inet_ntop.c",
+ "src/lib/legacy/ares_create_query.c",
+ "src/lib/legacy/ares_expand_name.c",
+ "src/lib/legacy/ares_expand_string.c",
+ "src/lib/legacy/ares_fds.c",
+ "src/lib/legacy/ares_getsock.c",
+ "src/lib/legacy/ares_parse_a_reply.c",
+ "src/lib/legacy/ares_parse_aaaa_reply.c",
+ "src/lib/legacy/ares_parse_caa_reply.c",
+ "src/lib/legacy/ares_parse_mx_reply.c",
+ "src/lib/legacy/ares_parse_naptr_reply.c",
+ "src/lib/legacy/ares_parse_ns_reply.c",
+ "src/lib/legacy/ares_parse_ptr_reply.c",
+ "src/lib/legacy/ares_parse_soa_reply.c",
+ "src/lib/legacy/ares_parse_srv_reply.c",
+ "src/lib/legacy/ares_parse_txt_reply.c",
+ "src/lib/legacy/ares_parse_uri_reply.c",
+ "src/lib/record/ares_dns_mapping.c",
+ "src/lib/record/ares_dns_multistring.c",
+ "src/lib/record/ares_dns_multistring.h",
+ "src/lib/record/ares_dns_name.c",
+ "src/lib/record/ares_dns_parse.c",
+ "src/lib/record/ares_dns_private.h",
+ "src/lib/record/ares_dns_record.c",
+ "src/lib/record/ares_dns_write.c",
+ "src/lib/str/ares__buf.c",
+ "src/lib/str/ares__buf.h",
+ "src/lib/str/ares_str.c",
+ "src/lib/str/ares_str.h",
+ "src/lib/str/ares_strcasecmp.c",
+ "src/lib/str/ares_strcasecmp.h",
+ "src/lib/str/ares_strsplit.c",
+ "src/lib/str/ares_strsplit.h",
+ "src/lib/util/ares__iface_ips.c",
+ "src/lib/util/ares__iface_ips.h",
+ "src/lib/util/ares__threads.c",
+ "src/lib/util/ares__threads.h",
+ "src/lib/util/ares__timeval.c",
+ "src/lib/util/ares_math.c",
+ "src/lib/util/ares_rand.c",
+ "src/tools/ares_getopt.c",
+ "src/tools/ares_getopt.h",
+ ]
@@ -1265,10 +1268,10 @@ index 0000000000000000000000000000000000000000..af9cbada10203b387fb9732b346583b1
+}
diff --git a/filenames.json b/filenames.json
new file mode 100644
index 0000000000000000000000000000000000000000..646df853a2b985f14fd66cae6af854977c074706
index 0000000000000000000000000000000000000000..889a487e24721a8ecfef91f5a655892a607bb12f
--- /dev/null
+++ b/filenames.json
@@ -0,0 +1,737 @@
@@ -0,0 +1,741 @@
+// This file is automatically generated by generate_gn_filenames_json.py
+// DO NOT EDIT
+{
@@ -1477,6 +1480,7 @@ index 0000000000000000000000000000000000000000..646df853a2b985f14fd66cae6af85497
+ "lib/internal/assert.js",
+ "lib/internal/assert/assertion_error.js",
+ "lib/internal/assert/calltracker.js",
+ "lib/internal/assert/utils.js",
+ "lib/internal/async_hooks.js",
+ "lib/internal/blob.js",
+ "lib/internal/blocklist.js",
@@ -1548,6 +1552,7 @@ index 0000000000000000000000000000000000000000..646df853a2b985f14fd66cae6af85497
+ "lib/internal/http2/util.js",
+ "lib/internal/idna.js",
+ "lib/internal/inspector_async_hook.js",
+ "lib/internal/inspector_network_tracking.js",
+ "lib/internal/js_stream_socket.js",
+ "lib/internal/legacy/processbinding.js",
+ "lib/internal/linkedlist.js",
@@ -1655,6 +1660,7 @@ index 0000000000000000000000000000000000000000..646df853a2b985f14fd66cae6af85497
+ "lib/internal/test/transfer.js",
+ "lib/internal/test_runner/coverage.js",
+ "lib/internal/test_runner/harness.js",
+ "lib/internal/test_runner/mock/loader.js",
+ "lib/internal/test_runner/mock/mock.js",
+ "lib/internal/test_runner/mock/mock_timers.js",
+ "lib/internal/test_runner/reporter/dot.js",
@@ -1662,6 +1668,7 @@ index 0000000000000000000000000000000000000000..646df853a2b985f14fd66cae6af85497
+ "lib/internal/test_runner/reporter/lcov.js",
+ "lib/internal/test_runner/reporter/spec.js",
+ "lib/internal/test_runner/reporter/tap.js",
+ "lib/internal/test_runner/reporter/utils.js",
+ "lib/internal/test_runner/reporter/v8-serializer.js",
+ "lib/internal/test_runner/runner.js",
+ "lib/internal/test_runner/test.js",
@@ -2007,10 +2014,10 @@ index 0000000000000000000000000000000000000000..646df853a2b985f14fd66cae6af85497
+ ]
+}
diff --git a/src/inspector/BUILD.gn b/src/inspector/BUILD.gn
index 909fd14345fcd988c381e640280f4b33f2e0c351..800431e6659f95f0495cb90b8fa2cccbc9f34661 100644
index 909fd14345fcd988c381e640280f4b33f2e0c351..3b430a666a7d5cb52ec41f8d828284625f916701 100644
--- a/src/inspector/BUILD.gn
+++ b/src/inspector/BUILD.gn
@@ -1,14 +1,202 @@
@@ -1,14 +1,208 @@
-##############################################################################
-# #
-# DO NOT EDIT THIS FILE! #
@@ -2034,6 +2041,8 @@ index 909fd14345fcd988c381e640280f4b33f2e0c351..800431e6659f95f0495cb90b8fa2cccb
+ "protocol/NodeTracing.h",
+ "protocol/NodeRuntime.cpp",
+ "protocol/NodeRuntime.h",
+ "protocol/Network.cpp",
+ "protocol/Network.h",
+]
-inspector_gn_build("inspector") {
@@ -2066,6 +2075,10 @@ index 909fd14345fcd988c381e640280f4b33f2e0c351..800431e6659f95f0495cb90b8fa2cccb
+ "tracing_agent.h",
+ "worker_agent.cc",
+ "worker_agent.h",
+ "network_inspector.cc",
+ "network_inspector.h",
+ "network_agent.cc",
+ "network_agent.h",
+ "worker_inspector.cc",
+ "worker_inspector.h",
+ ]

View File

@@ -10,10 +10,10 @@ V8 requires C++20 support as of https://chromium-review.googlesource.com/c/v8/v8
This can be removed when Electron upgrades to a version of Node.js containing the required V8 version.
diff --git a/common.gypi b/common.gypi
index 8736ad12eec294070a5160a64248044cd16347c9..216200c279c599f6dee228120ff5f3943fa52ffd 100644
index bdf1a1f33f3ea09d933757c7fee87c563cc833ab..2eb62610db2f0ebf68fa9a55ffba98291ecfe451 100644
--- a/common.gypi
+++ b/common.gypi
@@ -307,7 +307,7 @@
@@ -305,7 +305,7 @@
'VCCLCompilerTool': {
'AdditionalOptions': [
'/Zc:__cplusplus',
@@ -22,7 +22,7 @@ index 8736ad12eec294070a5160a64248044cd16347c9..216200c279c599f6dee228120ff5f394
],
'BufferSecurityCheck': 'true',
'DebugInformationFormat': 1, # /Z7 embed info in .obj files
@@ -489,7 +489,7 @@
@@ -487,7 +487,7 @@
}],
[ 'OS in "linux freebsd openbsd solaris android aix os400 cloudabi"', {
'cflags': [ '-Wall', '-Wextra', '-Wno-unused-parameter', ],
@@ -31,7 +31,7 @@ index 8736ad12eec294070a5160a64248044cd16347c9..216200c279c599f6dee228120ff5f394
'defines': [ '__STDC_FORMAT_MACROS' ],
'ldflags': [ '-rdynamic' ],
'target_conditions': [
@@ -660,7 +660,7 @@
@@ -658,7 +658,7 @@
['clang==1', {
'xcode_settings': {
'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0',

View File

@@ -33,10 +33,10 @@ index 8d7204f6cb48f783adc4d1c1eb2de0c83b7fffe2..a154559a56bf383d3c26af523c9bb07b
// Non-alphabetic chars.
diff --git a/lib/internal/http.js b/lib/internal/http.js
index c26c322aafc64ed9ca2a7c1fd703555a251db9de..f94bc5824d6c83fd1feca31c572dcfd3ac130bda 100644
index 251f51ec454f9cba4023b8b6729241ee753aac13..1de8cac6e3953ce9cab9db03530da327199acfd5 100644
--- a/lib/internal/http.js
+++ b/lib/internal/http.js
@@ -10,8 +10,8 @@ const {
@@ -8,8 +8,8 @@ const {
const { setUnrefTimeout } = require('internal/timers');
const { getCategoryEnabledBuffer, trace } = internalBinding('trace_events');
const {
@@ -47,7 +47,7 @@ index c26c322aafc64ed9ca2a7c1fd703555a251db9de..f94bc5824d6c83fd1feca31c572dcfd3
} = require('internal/constants');
let utcCache;
@@ -46,11 +46,13 @@ function isTraceHTTPEnabled() {
@@ -44,11 +44,13 @@ function isTraceHTTPEnabled() {
const traceEventCategory = 'node,node.http';
function traceBegin(...args) {

View File

@@ -7,10 +7,10 @@ Subject: build: ensure native module compilation fails if not using a new
This should not be upstreamed, it is a quality-of-life patch for downstream module builders.
diff --git a/common.gypi b/common.gypi
index 689e7fb2339253d0f2be3ccf33ecd76660ccf176..8736ad12eec294070a5160a64248044cd16347c9 100644
index 697b8bba6a55358924d6986f2eb347a99ff73889..bdf1a1f33f3ea09d933757c7fee87c563cc833ab 100644
--- a/common.gypi
+++ b/common.gypi
@@ -87,6 +87,8 @@
@@ -86,6 +86,8 @@
'v8_use_perfetto': 0,
'tsan%': 0,
@@ -19,7 +19,7 @@ index 689e7fb2339253d0f2be3ccf33ecd76660ccf176..8736ad12eec294070a5160a64248044c
##### end V8 defaults #####
# When building native modules using 'npm install' with the system npm,
@@ -287,6 +289,7 @@
@@ -285,6 +287,7 @@
# Defines these mostly for node-gyp to pickup.
'defines': [
'_GLIBCXX_USE_CXX11_ABI=1',
@@ -27,7 +27,7 @@ index 689e7fb2339253d0f2be3ccf33ecd76660ccf176..8736ad12eec294070a5160a64248044c
],
# Forcibly disable -Werror. We support a wide range of compilers, it's
@@ -416,6 +419,11 @@
@@ -414,6 +417,11 @@
}],
],
}],
@@ -40,10 +40,10 @@ index 689e7fb2339253d0f2be3ccf33ecd76660ccf176..8736ad12eec294070a5160a64248044c
# list in v8/BUILD.gn.
['v8_enable_v8_checks == 1', {
diff --git a/configure.py b/configure.py
index 3084cc964cbe6d02f98d08cd6f847ea7f4a3d0db..5b6a3b62082985debf6ebc4bc09a7d056f58514a 100755
index a6f66c41f75bffcfaf75d4415c694300b7624136..7ca0762fe3590fef7b88ba684de44d99aaecace4 100755
--- a/configure.py
+++ b/configure.py
@@ -1559,6 +1559,7 @@ def configure_library(lib, output, pkgname=None):
@@ -1585,6 +1585,7 @@ def configure_library(lib, output, pkgname=None):
def configure_v8(o):

View File

@@ -0,0 +1,24 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: deepak1556 <hop2deep@gmail.com>
Date: Fri, 11 Oct 2024 15:01:25 +0900
Subject: build: restore clang as default compiler on macOS
Refs https://github.com/nodejs/node/commit/6e0a2bb54c5bbeff0e9e33e1a0c683ed980a8a0f
configures the value at build time which doesn't work in Electron
as it depends on the environment in which the headers got generated from which
cannot reflect the value per platform. It works for Node.js since
node-gyp will use the result of `process.config` that reflects the environment
in which the binary got built.
diff --git a/common.gypi b/common.gypi
index 2eb62610db2f0ebf68fa9a55ffba98291ecfe451..3ec08ee144b586d05c4e49c2251416734cbc02c5 100644
--- a/common.gypi
+++ b/common.gypi
@@ -125,6 +125,7 @@
'v8_base': '<(PRODUCT_DIR)/obj.target/tools/v8_gypfiles/libv8_snapshot.a',
}],
['OS=="mac"', {
+ 'clang%': 1,
'obj_dir%': '<(PRODUCT_DIR)/obj.target',
'v8_base': '<(PRODUCT_DIR)/libv8_snapshot.a',
}],

View File

@@ -50,10 +50,10 @@ index 4bf80aa6cc6385dc376fd0a3538efc27fe5bd0a2..3e37aa8b0c9696cceb3f3cfab9721f38
BuiltinCodeCacheData cached_data{};
{
diff --git a/src/node_contextify.cc b/src/node_contextify.cc
index 708fa03d088e67a50dc4e69bb3f2cc14529dc3f1..4b7c4556d4cc94f589065409ed2a0aca497c99d0 100644
index 6456d87d4202c013aafe071adbac06852b3ae2c1..28ba7dbe66a44a43c39e3d75edf0be9513bcf732 100644
--- a/src/node_contextify.cc
+++ b/src/node_contextify.cc
@@ -850,16 +850,15 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
@@ -877,16 +877,15 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
host_defined_options->Set(
isolate, loader::HostDefinedOptions::kID, id_symbol);
@@ -79,7 +79,7 @@ index 708fa03d088e67a50dc4e69bb3f2cc14529dc3f1..4b7c4556d4cc94f589065409ed2a0aca
host_defined_options);
ScriptCompiler::Source source(code, origin, cached_data);
ScriptCompiler::CompileOptions compile_options =
@@ -971,7 +970,7 @@ MaybeLocal<Function> CompileFunction(Local<Context> context,
@@ -998,7 +997,7 @@ MaybeLocal<Function> CompileFunction(Local<Context> context,
Local<String> filename,
Local<String> content,
std::vector<Local<String>>* parameters) {
@@ -88,15 +88,15 @@ index 708fa03d088e67a50dc4e69bb3f2cc14529dc3f1..4b7c4556d4cc94f589065409ed2a0aca
ScriptCompiler::Source script_source(content, script_origin);
return ScriptCompiler::CompileFunction(context,
@@ -1081,7 +1080,6 @@ bool ContextifyScript::EvalMachine(Local<Context> context,
@@ -1108,7 +1107,6 @@ bool ContextifyScript::EvalMachine(Local<Context> context,
}
TryCatchScope try_catch(env);
- Isolate::SafeForTerminationScope safe_for_termination(env->isolate());
ContextifyScript* wrapped_script;
ASSIGN_OR_RETURN_UNWRAP(&wrapped_script, args.Holder(), false);
ASSIGN_OR_RETURN_UNWRAP(&wrapped_script, args.This(), false);
Local<UnboundScript> unbound_script =
@@ -1259,8 +1257,7 @@ void ContextifyContext::CompileFunction(
@@ -1286,8 +1284,7 @@ void ContextifyContext::CompileFunction(
Local<PrimitiveArray> host_defined_options =
GetHostDefinedOptions(isolate, id_symbol);
ScriptCompiler::Source source =
@@ -106,7 +106,7 @@ index 708fa03d088e67a50dc4e69bb3f2cc14529dc3f1..4b7c4556d4cc94f589065409ed2a0aca
filename,
line_offset,
column_offset,
@@ -1315,15 +1312,13 @@ void ContextifyContext::CompileFunction(
@@ -1342,15 +1339,13 @@ void ContextifyContext::CompileFunction(
}
ScriptCompiler::Source ContextifyContext::GetCommonJSSourceInstance(
@@ -123,7 +123,7 @@ index 708fa03d088e67a50dc4e69bb3f2cc14529dc3f1..4b7c4556d4cc94f589065409ed2a0aca
line_offset, // line offset
column_offset, // column offset
true, // is cross origin
@@ -1501,7 +1496,7 @@ void ContextifyContext::ContainsModuleSyntax(
@@ -1528,7 +1523,7 @@ void ContextifyContext::ContainsModuleSyntax(
Local<PrimitiveArray> host_defined_options =
GetHostDefinedOptions(isolate, id_symbol);
ScriptCompiler::Source source = GetCommonJSSourceInstance(
@@ -132,7 +132,7 @@ index 708fa03d088e67a50dc4e69bb3f2cc14529dc3f1..4b7c4556d4cc94f589065409ed2a0aca
ScriptCompiler::CompileOptions options = GetCompileOptions(source);
std::vector<Local<String>> params = GetCJSParameters(env->isolate_data());
@@ -1549,7 +1544,7 @@ void ContextifyContext::ContainsModuleSyntax(
@@ -1576,7 +1571,7 @@ void ContextifyContext::ContainsModuleSyntax(
code,
String::NewFromUtf8(isolate, "})();").ToLocalChecked());
ScriptCompiler::Source wrapped_source = GetCommonJSSourceInstance(
@@ -141,7 +141,7 @@ index 708fa03d088e67a50dc4e69bb3f2cc14529dc3f1..4b7c4556d4cc94f589065409ed2a0aca
std::ignore = ScriptCompiler::CompileFunction(
context,
&wrapped_source,
@@ -1602,8 +1597,7 @@ static void CompileFunctionForCJSLoader(
@@ -1629,8 +1624,7 @@ static void CompileFunctionForCJSLoader(
Local<Symbol> symbol = env->vm_dynamic_import_default_internal();
Local<PrimitiveArray> hdo = GetHostDefinedOptions(isolate, symbol);
@@ -152,10 +152,10 @@ index 708fa03d088e67a50dc4e69bb3f2cc14529dc3f1..4b7c4556d4cc94f589065409ed2a0aca
0, // column offset
true, // is cross origin
diff --git a/src/node_contextify.h b/src/node_contextify.h
index e96df803b7ec2aa1231d4ab5d4ae0fe863ceb672..d42b5e0c544e726fc3f6d8392a554df9aa480fe9 100644
index 517e3f44d324900222e1da961a4cd60bbb4a85f9..10715c7eb07715cc11e49734bd54747dad95f6a4 100644
--- a/src/node_contextify.h
+++ b/src/node_contextify.h
@@ -95,7 +95,6 @@ class ContextifyContext : public BaseObject {
@@ -99,7 +99,6 @@ class ContextifyContext : public BaseObject {
v8::Local<v8::Symbol> id_symbol,
const errors::TryCatchScope& try_catch);
static v8::ScriptCompiler::Source GetCommonJSSourceInstance(

View File

@@ -26,10 +26,10 @@ index 364469160af5e348f8890417de16a63c0d1dca67..75d5f58fe02fa8cfa7716ffaf761d567
try {
resolvedArgv = Module._resolveFilename(process.argv[1], null, false);
diff --git a/lib/internal/process/pre_execution.js b/lib/internal/process/pre_execution.js
index 59308ab817fb864a7b84ecf349c9e08d1c710342..8398657065b28a4451b8fe3996e63838a1645314 100644
index ea7afd52fab1cf3fde1674be1429a00562b714c0..02cfc8b3328fedb6306abf6c738bea772c674458 100644
--- a/lib/internal/process/pre_execution.js
+++ b/lib/internal/process/pre_execution.js
@@ -245,12 +245,14 @@ function patchProcessObject(expandArgv1) {
@@ -247,12 +247,14 @@ function patchProcessObject(expandArgv1) {
if (expandArgv1 && process.argv[1] &&
!StringPrototypeStartsWith(process.argv[1], '-')) {
// Expand process.argv[1] into a full path.

View File

@@ -9,7 +9,7 @@ This patch can be removed when Node.js upgrades to a version of V8 containing
the above CL.
diff --git a/lib/.eslintrc.yaml b/lib/.eslintrc.yaml
index 0cf84a0da5ee9e63d7b01d0a27946fc29090e516..ee16099ddc9abe5c19b319c111d1319c33b17be4 100644
index 74e867ace6207751a96b4da03802b50b620dbd7b..53ceabeb58f56ebd27e60fd49c362d26e361e6d8 100644
--- a/lib/.eslintrc.yaml
+++ b/lib/.eslintrc.yaml
@@ -30,10 +30,6 @@ rules:

View File

@@ -1,24 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: John Kleinschmidt <jkleinsc@electronjs.org>
Date: Mon, 10 Jun 2024 11:18:56 -0500
Subject: chore: remove calls to v8::FunctionCallbackInfo::Holder()
Use This() instead.
Refs: https://chromium-review.googlesource.com/c/v8/v8/+/5604487
https://issues.chromium.org/issues/333672197
This patch can be removed once Node addresses this change.
diff --git a/src/node_internals.h b/src/node_internals.h
index 5dff80ee287256ba40bfa496df6db60a18fbb9d7..a9162b4e2ee48dbebec8dc52b6990369be15fe4a 100644
--- a/src/node_internals.h
+++ b/src/node_internals.h
@@ -67,7 +67,7 @@ template <typename T, int (*F)(const typename T::HandleType*, sockaddr*, int*)>
void GetSockOrPeerName(const v8::FunctionCallbackInfo<v8::Value>& args) {
T* wrap;
ASSIGN_OR_RETURN_UNWRAP(&wrap,
- args.Holder(),
+ args.This(),
args.GetReturnValue().Set(UV_EBADF));
CHECK(args[0]->IsObject());
sockaddr_storage storage;

View File

@@ -21,10 +21,10 @@ index 606a6f5caa3b11b6d2a9068ed2fd65800530a5eb..080dcce21da05ccea398d8a856deb397
typedef void (*FreeCallback)(char* data, void* hint);
diff --git a/src/node_errors.h b/src/node_errors.h
index ad40141ca92c5a46ae2e4dfa96e4d6c239da8516..c462e5afcaa2328c4908fff462fc7c9fbfc1fd5f 100644
index 1662491bac44311421eeb7ee35bb47c025162abf..a62b18e832986ee38d93b412b36020a2c22255a9 100644
--- a/src/node_errors.h
+++ b/src/node_errors.h
@@ -232,7 +232,7 @@ inline v8::Local<v8::Value> ERR_BUFFER_TOO_LARGE(v8::Isolate* isolate) {
@@ -230,7 +230,7 @@ inline v8::Local<v8::Object> ERR_BUFFER_TOO_LARGE(v8::Isolate* isolate) {
char message[128];
snprintf(message, sizeof(message),
"Cannot create a Buffer larger than 0x%zx bytes",

View File

@@ -7,10 +7,10 @@ common.gypi is a file that's included in the node header bundle, despite
the fact that we do not build node with gyp.
diff --git a/common.gypi b/common.gypi
index 7c0b4a0851b295ee0c86f701c997b739a3cb7a7a..689e7fb2339253d0f2be3ccf33ecd76660ccf176 100644
index 1ece4f5e494533ea0fa25e0d35143fe424dbf70b..697b8bba6a55358924d6986f2eb347a99ff73889 100644
--- a/common.gypi
+++ b/common.gypi
@@ -89,6 +89,23 @@
@@ -88,6 +88,23 @@
##### end V8 defaults #####

View File

@@ -13,7 +13,7 @@ CL: https://chromium-review.googlesource.com/c/v8/v8/+/5630388
This patch can be removed when the node change is incorporated into main.
diff --git a/src/node_contextify.cc b/src/node_contextify.cc
index 4b7c4556d4cc94f589065409ed2a0aca497c99d0..b4d6116f0c84b0cf3e1045c6b9571fd295fe5412 100644
index 28ba7dbe66a44a43c39e3d75edf0be9513bcf732..0401b968916e5f45d148281c74b7e465e11439b8 100644
--- a/src/node_contextify.cc
+++ b/src/node_contextify.cc
@@ -49,6 +49,7 @@ using v8::FunctionTemplate;
@@ -24,7 +24,7 @@ index 4b7c4556d4cc94f589065409ed2a0aca497c99d0..b4d6116f0c84b0cf3e1045c6b9571fd2
using v8::Isolate;
using v8::Just;
using v8::Local;
@@ -457,14 +458,15 @@ bool ContextifyContext::IsStillInitializing(const ContextifyContext* ctx) {
@@ -484,14 +485,15 @@ bool ContextifyContext::IsStillInitializing(const ContextifyContext* ctx) {
}
// static
@@ -44,7 +44,7 @@ index 4b7c4556d4cc94f589065409ed2a0aca497c99d0..b4d6116f0c84b0cf3e1045c6b9571fd2
Local<Context> context = ctx->context();
Local<Object> sandbox = ctx->sandbox();
@@ -488,18 +490,22 @@ void ContextifyContext::PropertyGetterCallback(
@@ -515,18 +517,22 @@ void ContextifyContext::PropertyGetterCallback(
rv = ctx->global_proxy();
args.GetReturnValue().Set(rv);
@@ -70,7 +70,7 @@ index 4b7c4556d4cc94f589065409ed2a0aca497c99d0..b4d6116f0c84b0cf3e1045c6b9571fd2
Local<Context> context = ctx->context();
PropertyAttribute attributes = PropertyAttribute::None;
@@ -517,8 +523,9 @@ void ContextifyContext::PropertySetterCallback(
@@ -544,8 +550,9 @@ void ContextifyContext::PropertySetterCallback(
(static_cast<int>(attributes) &
static_cast<int>(PropertyAttribute::ReadOnly));
@@ -82,7 +82,7 @@ index 4b7c4556d4cc94f589065409ed2a0aca497c99d0..b4d6116f0c84b0cf3e1045c6b9571fd2
// true for x = 5
// false for this.x = 5
@@ -537,11 +544,16 @@ void ContextifyContext::PropertySetterCallback(
@@ -564,11 +571,16 @@ void ContextifyContext::PropertySetterCallback(
bool is_declared = is_declared_on_global_proxy || is_declared_on_sandbox;
if (!is_declared && args.ShouldThrowOnError() && is_contextual_store &&
@@ -103,7 +103,7 @@ index 4b7c4556d4cc94f589065409ed2a0aca497c99d0..b4d6116f0c84b0cf3e1045c6b9571fd2
Local<Value> desc;
if (is_declared_on_sandbox &&
@@ -555,19 +567,23 @@ void ContextifyContext::PropertySetterCallback(
@@ -582,19 +594,23 @@ void ContextifyContext::PropertySetterCallback(
// We have to specify the return value for any contextual or get/set
// property
if (desc_obj->HasOwnProperty(context, env->get_string()).FromMaybe(false) ||
@@ -132,7 +132,7 @@ index 4b7c4556d4cc94f589065409ed2a0aca497c99d0..b4d6116f0c84b0cf3e1045c6b9571fd2
Local<Context> context = ctx->context();
@@ -577,19 +593,23 @@ void ContextifyContext::PropertyDescriptorCallback(
@@ -604,19 +620,23 @@ void ContextifyContext::PropertyDescriptorCallback(
Local<Value> desc;
if (sandbox->GetOwnPropertyDescriptor(context, property).ToLocal(&desc)) {
args.GetReturnValue().Set(desc);
@@ -159,7 +159,7 @@ index 4b7c4556d4cc94f589065409ed2a0aca497c99d0..b4d6116f0c84b0cf3e1045c6b9571fd2
Local<Context> context = ctx->context();
Isolate* isolate = context->GetIsolate();
@@ -608,7 +628,7 @@ void ContextifyContext::PropertyDefinerCallback(
@@ -635,7 +655,7 @@ void ContextifyContext::PropertyDefinerCallback(
// If the property is set on the global as neither writable nor
// configurable, don't change it on the global or sandbox.
if (is_declared && read_only && dont_delete) {
@@ -168,7 +168,7 @@ index 4b7c4556d4cc94f589065409ed2a0aca497c99d0..b4d6116f0c84b0cf3e1045c6b9571fd2
}
Local<Object> sandbox = ctx->sandbox();
@@ -631,6 +651,9 @@ void ContextifyContext::PropertyDefinerCallback(
@@ -658,6 +678,9 @@ void ContextifyContext::PropertyDefinerCallback(
desc.has_set() ? desc.set() : Undefined(isolate).As<Value>());
define_prop_on_sandbox(&desc_for_sandbox);
@@ -178,7 +178,7 @@ index 4b7c4556d4cc94f589065409ed2a0aca497c99d0..b4d6116f0c84b0cf3e1045c6b9571fd2
} else {
Local<Value> value =
desc.has_value() ? desc.value() : Undefined(isolate).As<Value>();
@@ -642,26 +665,32 @@ void ContextifyContext::PropertyDefinerCallback(
@@ -669,26 +692,32 @@ void ContextifyContext::PropertyDefinerCallback(
PropertyDescriptor desc_for_sandbox(value);
define_prop_on_sandbox(&desc_for_sandbox);
}
@@ -217,7 +217,7 @@ index 4b7c4556d4cc94f589065409ed2a0aca497c99d0..b4d6116f0c84b0cf3e1045c6b9571fd2
}
// static
@@ -681,76 +710,84 @@ void ContextifyContext::PropertyEnumeratorCallback(
@@ -708,76 +737,84 @@ void ContextifyContext::PropertyEnumeratorCallback(
}
// static
@@ -328,10 +328,10 @@ index 4b7c4556d4cc94f589065409ed2a0aca497c99d0..b4d6116f0c84b0cf3e1045c6b9571fd2
void ContextifyScript::CreatePerIsolateProperties(
diff --git a/src/node_contextify.h b/src/node_contextify.h
index d42b5e0c544e726fc3f6d8392a554df9aa480fe9..ea2d513463057715127cb4b4f2d66b4cfcf71351 100644
index 10715c7eb07715cc11e49734bd54747dad95f6a4..49b9fabb399aed962e0d29e784a25ca4e9780a8f 100644
--- a/src/node_contextify.h
+++ b/src/node_contextify.h
@@ -107,42 +107,39 @@ class ContextifyContext : public BaseObject {
@@ -111,42 +111,39 @@ class ContextifyContext : public BaseObject {
const v8::FunctionCallbackInfo<v8::Value>& args);
static void WeakCallback(
const v8::WeakCallbackInfo<ContextifyContext>& data);
@@ -541,10 +541,10 @@ index bce7ae07214ddf970a530db29ed6970e14b7a5ed..85f82180d48d6cfd7738cd7b1e504f23
}
diff --git a/src/node_external_reference.h b/src/node_external_reference.h
index 9238f2d4d7376b22e264dbc9359b480937d29676..b5c1df6941616642075babdad81be00ce63ffd56 100644
index c4aba23510872d66b58a1adc88cdd1ee85a86cfe..6d9988810b951771064de523bc20aaf389a9c08a 100644
--- a/src/node_external_reference.h
+++ b/src/node_external_reference.h
@@ -59,16 +59,17 @@ class ExternalReferenceRegistry {
@@ -66,16 +66,17 @@ class ExternalReferenceRegistry {
V(v8::FunctionCallback) \
V(v8::AccessorNameGetterCallback) \
V(v8::AccessorNameSetterCallback) \

View File

@@ -12,19 +12,19 @@ if the override has been disabled.
This will be upstreamed.
diff --git a/lib/assert.js b/lib/assert.js
index eadc3844c20128bb9f9a269e5d599f8febf17421..e4615e55c0847d969e9c95295ddecfc640019c99 100644
--- a/lib/assert.js
+++ b/lib/assert.js
@@ -66,6 +66,7 @@ const { inspect } = require('internal/util/inspect');
const { isPromise, isRegExp } = require('internal/util/types');
diff --git a/lib/internal/assert/utils.js b/lib/internal/assert/utils.js
index 59b5a16f1309a5e4055bccfdb7a529045ad30402..bfdaf6211466a01b64b7942f7b16c480283278ff 100644
--- a/lib/internal/assert/utils.js
+++ b/lib/internal/assert/utils.js
@@ -25,6 +25,7 @@ const AssertionError = require('internal/assert/assertion_error');
const { openSync, closeSync, readSync } = require('fs');
const { EOL } = require('internal/constants');
const { BuiltinModule } = require('internal/bootstrap/realm');
+const { getEmbedderOptions } = require('internal/options');
const { isError, deprecate } = require('internal/util');
const { isError } = require('internal/util');
const errorCache = new SafeMap();
@@ -294,8 +295,16 @@ function getErrMessage(message, fn) {
@@ -167,8 +168,16 @@ function getErrMessage(message, fn) {
ErrorCaptureStackTrace(err, fn);
if (errorStackTraceLimitIsWritable) Error.stackTraceLimit = tmpLimit;
@@ -44,7 +44,7 @@ index eadc3844c20128bb9f9a269e5d599f8febf17421..e4615e55c0847d969e9c95295ddecfc6
let filename = call.getFileName();
const line = call.getLineNumber() - 1;
diff --git a/src/api/environment.cc b/src/api/environment.cc
index fe41619f45913fe31a59771c8d1af6cde3b89f66..bb6c6d51846fed1d160ec9dcd5a5dd67b4fef911 100644
index b9098d102b40adad7fafcc331ac62870617019b9..cb9269a31e073caf86164aa39c0640370ade60fd 100644
--- a/src/api/environment.cc
+++ b/src/api/environment.cc
@@ -244,6 +244,9 @@ void SetIsolateErrorHandlers(v8::Isolate* isolate, const IsolateSettings& s) {
@@ -58,10 +58,10 @@ index fe41619f45913fe31a59771c8d1af6cde3b89f66..bb6c6d51846fed1d160ec9dcd5a5dd67
}
diff --git a/src/node_options.cc b/src/node_options.cc
index 74955717117001393e8b55809b4e4a1424019dad..409c6e3918e3ef7c9d35f87e093cb965cb889dd7 100644
index 818baf611fcab7838a339f3ea137467653e270d0..4e3c82e9528b04fd1a0cc99d30fb885e4b224bc9 100644
--- a/src/node_options.cc
+++ b/src/node_options.cc
@@ -1393,14 +1393,16 @@ void GetEmbedderOptions(const FunctionCallbackInfo<Value>& args) {
@@ -1405,14 +1405,16 @@ void GetEmbedderOptions(const FunctionCallbackInfo<Value>& args) {
}
Isolate* isolate = args.GetIsolate();

View File

@@ -10,7 +10,7 @@ in the nodejs test suite. Need to be followed-up with upstream
on the broader change as there maybe other callsites.
diff --git a/src/handle_wrap.cc b/src/handle_wrap.cc
index 69e2a389f9e1480a1a4ba37f5df5356b42f7d52d..0c29b00298b44b97f88a63aa5b89f1c201f6326a 100644
index be02d4aaa04685cbd6a9ecfe082e38f179129ab5..277748a30bd97ae816d9ba1f2d73851a29b81010 100644
--- a/src/handle_wrap.cc
+++ b/src/handle_wrap.cc
@@ -148,6 +148,9 @@ void HandleWrap::OnClose(uv_handle_t* handle) {
@@ -24,10 +24,10 @@ index 69e2a389f9e1480a1a4ba37f5df5356b42f7d52d..0c29b00298b44b97f88a63aa5b89f1c2
wrap->object()->Has(env->context(), env->handle_onclose_symbol())
.FromMaybe(false)) {
diff --git a/src/node_contextify.cc b/src/node_contextify.cc
index d873792ab95e41d54579f552c6c1fa43447ca4cd..708fa03d088e67a50dc4e69bb3f2cc14529dc3f1 100644
index 8951cd378a9025f58fada47cf96f686d14639f95..6456d87d4202c013aafe071adbac06852b3ae2c1 100644
--- a/src/node_contextify.cc
+++ b/src/node_contextify.cc
@@ -460,6 +460,7 @@ bool ContextifyContext::IsStillInitializing(const ContextifyContext* ctx) {
@@ -487,6 +487,7 @@ bool ContextifyContext::IsStillInitializing(const ContextifyContext* ctx) {
void ContextifyContext::PropertyGetterCallback(
Local<Name> property,
const PropertyCallbackInfo<Value>& args) {
@@ -35,7 +35,7 @@ index d873792ab95e41d54579f552c6c1fa43447ca4cd..708fa03d088e67a50dc4e69bb3f2cc14
ContextifyContext* ctx = ContextifyContext::Get(args);
// Still initializing
@@ -467,6 +468,8 @@ void ContextifyContext::PropertyGetterCallback(
@@ -494,6 +495,8 @@ void ContextifyContext::PropertyGetterCallback(
Local<Context> context = ctx->context();
Local<Object> sandbox = ctx->sandbox();
@@ -44,7 +44,7 @@ index d873792ab95e41d54579f552c6c1fa43447ca4cd..708fa03d088e67a50dc4e69bb3f2cc14
MaybeLocal<Value> maybe_rv =
sandbox->GetRealNamedProperty(context, property);
if (maybe_rv.IsEmpty()) {
@@ -476,6 +479,11 @@ void ContextifyContext::PropertyGetterCallback(
@@ -503,6 +506,11 @@ void ContextifyContext::PropertyGetterCallback(
Local<Value> rv;
if (maybe_rv.ToLocal(&rv)) {

View File

@@ -608,7 +608,7 @@ index 61bd65fc92678c24baa3c0eb9ffb1ead64ace70b..cb690351696a811210b9d990ee4cde3c
};
assert.throws(() => crypto.scrypt('pass', 'salt', 1, options, () => {}),
diff --git a/test/parallel/test-crypto-sign-verify.js b/test/parallel/test-crypto-sign-verify.js
index 56e5c16c2867f019caccf42f228193cae6167150..dc585c44db9894ae57a5e11d453af03e1ea4f211 100644
index 9dd586a1a1f9a00d9bb0af5b0532e81e7b96a5ce..1a0d0cfc09fb61d65472723ba54e1d0be69b5c68 100644
--- a/test/parallel/test-crypto-sign-verify.js
+++ b/test/parallel/test-crypto-sign-verify.js
@@ -28,6 +28,7 @@ const keySize = 2048;

View File

@@ -6,10 +6,10 @@ Subject: fix: expose the built-in electron module via the ESM loader
This allows usage of `import { app } from 'electron'` and `import('electron')` natively in the browser + non-sandboxed renderer
diff --git a/lib/internal/modules/esm/get_format.js b/lib/internal/modules/esm/get_format.js
index 1931688e85d05ee2da4f88efb05d635cb43be233..afccc24392abff9eef2b9953fcffeb79ee71ad15 100644
index 1fe5564545dbc86d7f2968274a25ee1579bcbf28..b876af21a0e97ae06dc344d9f78c8f5c7e403d43 100644
--- a/lib/internal/modules/esm/get_format.js
+++ b/lib/internal/modules/esm/get_format.js
@@ -30,6 +30,7 @@ const protocolHandlers = {
@@ -31,6 +31,7 @@ const protocolHandlers = {
'http:': getHttpProtocolModuleFormat,
'https:': getHttpProtocolModuleFormat,
'node:'() { return 'builtin'; },
@@ -108,10 +108,10 @@ index 8f4b6b25d8889686d00613fd9821b0aa822a946a..89ca269294ee1afa7f5aeb0ac6b8958f
// or as the initial entry point when the ESM loader handles a CommonJS entry.
translators.set('commonjs', async function commonjsStrategy(url, source,
diff --git a/lib/internal/url.js b/lib/internal/url.js
index 4103775560644e4f1a78bf11da6cc07d5dc4cda2..474cf3b44d680c4c897553d5e98c3c43699e6592 100644
index e6ed5466b8807a52633d8406824058bdc8c2ce13..e055facddf086eb8fb456b865ce006cdb7602b0a 100644
--- a/lib/internal/url.js
+++ b/lib/internal/url.js
@@ -1459,6 +1459,8 @@ function fileURLToPath(path, options = kEmptyObject) {
@@ -1485,6 +1485,8 @@ function fileURLToPath(path, options = kEmptyObject) {
path = new URL(path);
else if (!isURL(path))
throw new ERR_INVALID_ARG_TYPE('path', ['string', 'URL'], path);

View File

@@ -7,10 +7,10 @@ Subject: fix: expose tracing::Agent and use tracing::TracingController instead
This API is used by Electron to create Node's tracing controller.
diff --git a/src/api/environment.cc b/src/api/environment.cc
index cb4095dee52c5a5d40815c20c33065fd03ce0804..60be2353cf0e77287dfda965c820cf36655a7ce5 100644
index 46106fa94b3055648e4f01cd28860d427268a253..e0bf37f09dceb93af58990438ab577a9d4b843e8 100644
--- a/src/api/environment.cc
+++ b/src/api/environment.cc
@@ -558,6 +558,10 @@ MultiIsolatePlatform* GetMultiIsolatePlatform(IsolateData* env) {
@@ -557,6 +557,10 @@ MultiIsolatePlatform* GetMultiIsolatePlatform(IsolateData* env) {
return env->platform();
}

View File

@@ -17,7 +17,7 @@ Upstreams:
- https://github.com/nodejs/node/pull/39136
diff --git a/src/crypto/crypto_cipher.cc b/src/crypto/crypto_cipher.cc
index 67cd4f2adf15e7d8511f561c54163b1842e971af..88471fd6bc0b8a810bb55464cd2d1933d11a8623 100644
index 4f0637f9511d1b90ae9d33760428dceb772667bd..5aba390c49613816ac359dfe995dc2c0a93f2206 100644
--- a/src/crypto/crypto_cipher.cc
+++ b/src/crypto/crypto_cipher.cc
@@ -1088,7 +1088,7 @@ void PublicKeyCipher::Cipher(const FunctionCallbackInfo<Value>& args) {
@@ -109,7 +109,7 @@ index 85d48dfd2c15c453707bf6eb94e22f89b4f856b2..fe31a9a7f465a03d2de365cef392dfbb
crypto::EVPKeyPointer key(raw_key);
diff --git a/src/crypto/crypto_context.cc b/src/crypto/crypto_context.cc
index e26e64834bee7fd9cd4e18bfe69a4f41d51fa8e9..a5b1ec5ea6284ab9892d5a2e576f369ae3bbac91 100644
index cef0c877c67643d47da787eddb95ed5a410a941b..1b8af49a48f1a34a92d4f0b502d435f3a4ab5d8e 100644
--- a/src/crypto/crypto_context.cc
+++ b/src/crypto/crypto_context.cc
@@ -63,7 +63,7 @@ inline X509_STORE* GetOrCreateRootCertStore() {
@@ -121,7 +121,7 @@ index e26e64834bee7fd9cd4e18bfe69a4f41d51fa8e9..a5b1ec5ea6284ab9892d5a2e576f369a
if (!bio) return nullptr;
ByteSource bsrc = ByteSource::FromStringOrBuffer(env, v);
if (bsrc.size() > INT_MAX) return nullptr;
@@ -861,10 +861,12 @@ void SecureContext::SetDHParam(const FunctionCallbackInfo<Value>& args) {
@@ -882,10 +882,12 @@ void SecureContext::SetDHParam(const FunctionCallbackInfo<Value>& args) {
// If the user specified "auto" for dhparams, the JavaScript layer will pass
// true to this function instead of the original string. Any other string
// value will be interpreted as custom DH parameters below.
@@ -135,7 +135,7 @@ index e26e64834bee7fd9cd4e18bfe69a4f41d51fa8e9..a5b1ec5ea6284ab9892d5a2e576f369a
DHPointer dh;
{
diff --git a/src/crypto/crypto_dh.cc b/src/crypto/crypto_dh.cc
index b4447102a8478639a5aa774e583834d79808603f..fa507b6d3c04691f44b3302058d2007a966306db 100644
index dac37f52b9687cadfa2d02152241e9a6e4c16ddf..d47cfa4ad8707ed7f0a42e7fe176fec25be64305 100644
--- a/src/crypto/crypto_dh.cc
+++ b/src/crypto/crypto_dh.cc
@@ -154,13 +154,11 @@ bool DiffieHellman::Init(BignumPointer&& bn_p, int g) {
@@ -237,7 +237,7 @@ index 3fa4a415dc911a13afd90dfb31c1ed4ad0fd268f..fa48dffc31342c44a1c1207b9d4c3dc7
return EVPKeyCtxPointer();
diff --git a/src/crypto/crypto_keys.cc b/src/crypto/crypto_keys.cc
index ce28ec8f37a5e483b11284bc866cb649ad7b61cf..eaaa151a770a23a498984cf03c0e9b999a4ad8e8 100644
index 35474c31bfc2e3692b7ca10e4ed7026b9c275dfb..43c42c14f75018d4705f218fe4ed7e5dacb46bb8 100644
--- a/src/crypto/crypto_keys.cc
+++ b/src/crypto/crypto_keys.cc
@@ -1239,6 +1239,7 @@ void KeyObjectHandle::GetAsymmetricKeyType(
@@ -353,7 +353,7 @@ index 990638ec3993bde40ad3dd40d373d816ebc66a6a..63d971e1fe6b861e29c12f04563701b0
} // namespace
diff --git a/src/env.h b/src/env.h
index 1ca2d5ed40fa3c72256182fa4ca4b6a09190ca16..c6cc2c874b603f595a008a7d3bc229d6b9834f55 100644
index 30561ab7a24c734be71ed29d963c11e2ea2c2b22..7cb77fb4f35a60fbda5b868798321ac8b6340bfa 100644
--- a/src/env.h
+++ b/src/env.h
@@ -49,7 +49,7 @@
@@ -365,7 +365,7 @@ index 1ca2d5ed40fa3c72256182fa4ca4b6a09190ca16..c6cc2c874b603f595a008a7d3bc229d6
#include <openssl/evp.h>
#endif
@@ -1040,7 +1040,7 @@ class Environment : public MemoryRetainer {
@@ -1065,7 +1065,7 @@ class Environment : public MemoryRetainer {
kExitInfoFieldCount
};
@@ -388,7 +388,7 @@ index cf051585e779e2b03bd7b95fe5008b89cc7f8162..9de49c6828468fdf846dcd4ad445390f
#if NODE_OPENSSL_HAS_QUIC
#include <openssl/quic.h>
diff --git a/src/node_options.cc b/src/node_options.cc
index e94e4dbc959cee1fcab68799edc84745dfc07ec8..74955717117001393e8b55809b4e4a1424019dad 100644
index dba59c5560c22899bd108789360f21fd85dd41bf..818baf611fcab7838a339f3ea137467653e270d0 100644
--- a/src/node_options.cc
+++ b/src/node_options.cc
@@ -6,7 +6,7 @@
@@ -401,7 +401,7 @@ index e94e4dbc959cee1fcab68799edc84745dfc07ec8..74955717117001393e8b55809b4e4a14
#endif
diff --git a/src/node_options.h b/src/node_options.h
index c978c339cbbb388f0f49d26ded0e92bb52a7973a..d13c97e8a0e1ea0212fb34a0178b3a7c74ff43e6 100644
index 10c220f66122336215f25b9674acfdfe6df82a8e..e8b2243d24fe95ff31254071133fb646e186c07e 100644
--- a/src/node_options.h
+++ b/src/node_options.h
@@ -11,7 +11,7 @@

View File

@@ -142,7 +142,7 @@ index 69f73f829706deddc4f328b78af9d58434af647d..1d53a2a47423150e822bb917b2725d3a
const encodedSepRegEx = /%2F|%5C/i;
diff --git a/src/node_file.cc b/src/node_file.cc
index 80ff36f2463035ed32cb8b7b826bfe94c339dbe2..cca6c6775bc8dd35b897498c7dd65b2e3957ee40 100644
index 73ad5a1a2c092d7f8dac84585fb9b13e76e84e13..039f693de14bec248f93262ad70f2736c24827e3 100644
--- a/src/node_file.cc
+++ b/src/node_file.cc
@@ -19,14 +19,11 @@

View File

@@ -6,7 +6,7 @@ Subject: spec: add Iterator to global intrinsics
Ref: https://chromium-review.googlesource.com/c/v8/v8/+/4266490
diff --git a/test/common/globals.js b/test/common/globals.js
index 8b9b6b34f6abaf713f362e8bcdbd140a86dfa767..7b5643a926d970e0e6c91d52b86ebd857d2cf062 100644
index cb7c1629007ecfc6c6a1aae0e6d1e9a50f07d147..5d1c4415eeb09e92d062330afc0aecb1d297b6d3 100644
--- a/test/common/globals.js
+++ b/test/common/globals.js
@@ -63,6 +63,7 @@ const intrinsics = new Set([

View File

@@ -1,45 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shelley Vohr <shelley.vohr@gmail.com>
Date: Thu, 25 Jul 2024 12:19:41 +0200
Subject: src: account for OpenSSL unexpected version
Fixes a crash that occurs because the logic to parse for an OpenSSL
version didn't account for OpenSSL_version returning a value that
doesn't match the expected pattern of OpenSSL 1.1.0i 14 Aug 2018.
In Electron's case, OpenSSL_version returns just BoringSSL, which in
combination with the search logic not accounting for the delimiter not
being present caused an out-of-bounds crash:
out_of_range was thrown in -fno-exceptions mode with message "basic_string"
This fixes that by checking for the null terminator and returning 0.0.0
when the target delimiter isn't present.
Upstreamed at https://github.com/nodejs/node/pull/54038
diff --git a/src/node_metadata.cc b/src/node_metadata.cc
index 985d44b3cd1f1aa5c09f99e868083f2e48c7e32b..1876249eb88065f649aee2c8348f42ec90ab70da 100644
--- a/src/node_metadata.cc
+++ b/src/node_metadata.cc
@@ -48,14 +48,19 @@ Metadata metadata;
#if HAVE_OPENSSL
static constexpr size_t search(const char* s, char c, size_t n = 0) {
- return *s == c ? n : search(s + 1, c, n + 1);
+ return *s == '\0' ? n : (*s == c ? n : search(s + 1, c, n + 1));
}
static inline std::string GetOpenSSLVersion() {
// sample openssl version string format
// for reference: "OpenSSL 1.1.0i 14 Aug 2018"
const char* version = OpenSSL_version(OPENSSL_VERSION);
- const size_t start = search(version, ' ') + 1;
+ const size_t first_space = search(version, ' ');
+ if (version[first_space] == '\0') {
+ return std::string("0.0.0");
+ }
+
+ const size_t start = first_space + 1;
const size_t len = search(&version[start], ' ');
return std::string(version, start, len);
}

View File

@@ -104,10 +104,10 @@ index 3e37aa8b0c9696cceb3f3cfab9721f38c74a2fba..78f20de6b127961e9de7b5caaeca702e
SetMethod(isolate, target, "getCacheUsage", BuiltinLoader::GetCacheUsage);
diff --git a/src/node_external_reference.h b/src/node_external_reference.h
index a3317d25ad6a963751073287dba71cc766ada2a2..9238f2d4d7376b22e264dbc9359b480937d29676 100644
index 4e2ad9024020fa0851da41da44afccdf188c7044..c4aba23510872d66b58a1adc88cdd1ee85a86cfe 100644
--- a/src/node_external_reference.h
+++ b/src/node_external_reference.h
@@ -57,8 +57,6 @@ class ExternalReferenceRegistry {
@@ -64,8 +64,6 @@ class ExternalReferenceRegistry {
V(CFunctionWithBool) \
V(const v8::CFunctionInfo*) \
V(v8::FunctionCallback) \

View File

@@ -16,7 +16,7 @@ patch:
(cherry picked from commit 30329d06235a9f9733b1d4da479b403462d1b326)
diff --git a/src/env-inl.h b/src/env-inl.h
index 18b1461e50e456728cbc5e26259d06e7602a8d11..c5973e430debcf354afb9c9288c9ba8cf8f538ee 100644
index d98a32d6ec311459877bc3b0de33cca4766aeda7..9fc934975b015b97ddd84bf3eea5d53144130035 100644
--- a/src/env-inl.h
+++ b/src/env-inl.h
@@ -62,31 +62,6 @@ inline uv_loop_t* IsolateData::event_loop() const {
@@ -52,7 +52,7 @@ index 18b1461e50e456728cbc5e26259d06e7602a8d11..c5973e430debcf354afb9c9288c9ba8c
return &(wrapper_data_->cppgc_id);
}
diff --git a/src/env.cc b/src/env.cc
index ea0ae4e08ec7dd98721bc89d2fe80fa47eaddfec..0f9846baeef6fd490cdc43893e29ea2d0a731d1d 100644
index 38802b1e9acf9b3e99fdc4f39770e896393befe3..e0433e29ca98c42a38d1da6d66085fdea1edde29 100644
--- a/src/env.cc
+++ b/src/env.cc
@@ -22,6 +22,7 @@
@@ -86,7 +86,7 @@ index ea0ae4e08ec7dd98721bc89d2fe80fa47eaddfec..0f9846baeef6fd490cdc43893e29ea2d
constexpr uint16_t kDefaultCppGCEmbedderID = 0x90de;
Mutex IsolateData::isolate_data_mutex_;
std::unordered_map<uint16_t, std::unique_ptr<PerIsolateWrapperData>>
@@ -551,36 +559,16 @@ IsolateData::IsolateData(Isolate* isolate,
@@ -567,36 +575,16 @@ IsolateData::IsolateData(Isolate* isolate,
v8::CppHeap* cpp_heap = isolate->GetCppHeap();
uint16_t cppgc_id = kDefaultCppGCEmbedderID;
@@ -130,7 +130,7 @@ index ea0ae4e08ec7dd98721bc89d2fe80fa47eaddfec..0f9846baeef6fd490cdc43893e29ea2d
{
// GC could still be run after the IsolateData is destroyed, so we store
@@ -612,11 +600,12 @@ IsolateData::~IsolateData() {
@@ -628,11 +616,12 @@ IsolateData::~IsolateData() {
}
}
@@ -146,10 +146,10 @@ index ea0ae4e08ec7dd98721bc89d2fe80fa47eaddfec..0f9846baeef6fd490cdc43893e29ea2d
void IsolateData::MemoryInfo(MemoryTracker* tracker) const {
diff --git a/src/env.h b/src/env.h
index c6cc2c874b603f595a008a7d3bc229d6b9834f55..f378e810e8b48dd07ec25c7eae7923767ef25270 100644
index 7cb77fb4f35a60fbda5b868798321ac8b6340bfa..06746554e1d60a9377ff6d7d970220f3fa88e4ac 100644
--- a/src/env.h
+++ b/src/env.h
@@ -164,10 +164,6 @@ class NODE_EXTERN_PRIVATE IsolateData : public MemoryRetainer {
@@ -174,10 +174,6 @@ class NODE_EXTERN_PRIVATE IsolateData : public MemoryRetainer {
uint16_t* embedder_id_for_cppgc() const;
uint16_t* embedder_id_for_non_cppgc() const;

View File

@@ -12,7 +12,7 @@ branch of Node.js. This patch can be removed when Electron upgrades to
a stable Node release that contains the change. -- Charles)
diff --git a/src/histogram.cc b/src/histogram.cc
index 4f58359fe58529329fca8b13d4d4655d87a097f2..18983209db834d10faad6c2a56658ab060bcd097 100644
index 4dbdea9be5721486d71a9dda77311b4919d450a3..4aacaa2a5d12533a039b4b96cb7f1fd79063d50f 100644
--- a/src/histogram.cc
+++ b/src/histogram.cc
@@ -193,7 +193,8 @@ void HistogramBase::FastRecord(Local<Value> receiver,

View File

@@ -80,7 +80,7 @@ index 5c16d0d1b32e2d056f4fcfa0e01781292932a0fa..ce6277dec5a2b9313ecd3699b39ec175
// This is a bit of a hack. See the override in async_wrap.cc for details.
virtual bool IsDoneInitializing() const;
diff --git a/src/stream_base.cc b/src/stream_base.cc
index af714734f49b836de79ebb25e61f1376b757d5ed..a8f9f98d413c8573eb22960a4cefb47408215469 100644
index d2649ea0a649bb2f6c6becf1891c0b6d773c1a62..9d855c2992492d3394d9f8af4e53781027a2dd83 100644
--- a/src/stream_base.cc
+++ b/src/stream_base.cc
@@ -492,6 +492,29 @@ Local<Object> StreamBase::GetObject() {

View File

@@ -7,7 +7,7 @@ This refactors several allocators to allocate within the V8 memory cage,
allowing them to be compatible with the V8_SANDBOXED_POINTERS feature.
diff --git a/src/api/environment.cc b/src/api/environment.cc
index 60be2353cf0e77287dfda965c820cf36655a7ce5..fe41619f45913fe31a59771c8d1af6cde3b89f66 100644
index e0bf37f09dceb93af58990438ab577a9d4b843e8..b9098d102b40adad7fafcc331ac62870617019b9 100644
--- a/src/api/environment.cc
+++ b/src/api/environment.cc
@@ -101,6 +101,14 @@ MaybeLocal<Value> PrepareStackTraceCallback(Local<Context> context,
@@ -105,10 +105,10 @@ index 63d971e1fe6b861e29c12f04563701b01fdfb976..f39652a6f5196531cd78ce74e91076b1
void SecureHeapUsed(const FunctionCallbackInfo<Value>& args) {
#ifndef OPENSSL_IS_BORINGSSL
diff --git a/src/crypto/crypto_util.h b/src/crypto/crypto_util.h
index 0ae2946e5e5884d6d095c039a3b4dc537e0f29a2..8c06e81de3ae93d82bf7eaf1bada77164a130695 100644
index 4ba261014695cf1aa8eb53b21a2873f4c4ea8e43..b695d131bcdc331974f544924138bb5eedc50c9f 100644
--- a/src/crypto/crypto_util.h
+++ b/src/crypto/crypto_util.h
@@ -280,7 +280,7 @@ class ByteSource {
@@ -285,7 +285,7 @@ class ByteSource {
// Creates a v8::BackingStore that takes over responsibility for
// any allocated data. The ByteSource will be reset with size = 0
// after being called.
@@ -118,10 +118,10 @@ index 0ae2946e5e5884d6d095c039a3b4dc537e0f29a2..8c06e81de3ae93d82bf7eaf1bada7716
v8::Local<v8::ArrayBuffer> ToArrayBuffer(Environment* env);
diff --git a/src/node_i18n.cc b/src/node_i18n.cc
index d45325954d980724f80d49298bbe837197237a9b..ccea18080142bd9cba3765dbbec61c2a63406667 100644
index 2aa7cd98ecc179519a6bb1932dafa86a38bda4f5..79376bef2e674f05fd95380dd419e8778cb98623 100644
--- a/src/node_i18n.cc
+++ b/src/node_i18n.cc
@@ -105,7 +105,7 @@ namespace {
@@ -106,7 +106,7 @@ namespace {
template <typename T>
MaybeLocal<Object> ToBufferEndian(Environment* env, MaybeStackBuffer<T>* buf) {
@@ -130,11 +130,38 @@ index d45325954d980724f80d49298bbe837197237a9b..ccea18080142bd9cba3765dbbec61c2a
if (ret.IsEmpty())
return ret;
@@ -183,7 +183,7 @@ MaybeLocal<Object> TranscodeLatin1ToUcs2(Environment* env,
return {};
}
- return Buffer::New(env, &destbuf);
+ return Buffer::Copy(env, reinterpret_cast<char*>(destbuf.out()), destbuf.length() * sizeof(UChar));
}
MaybeLocal<Object> TranscodeFromUcs2(Environment* env,
@@ -228,7 +228,7 @@ MaybeLocal<Object> TranscodeUcs2FromUtf8(Environment* env,
return {};
}
- return Buffer::New(env, &destbuf);
+ return Buffer::Copy(env, reinterpret_cast<char*>(destbuf.out()), destbuf.length() * sizeof(UChar));
}
MaybeLocal<Object> TranscodeUtf8FromUcs2(Environment* env,
@@ -252,7 +252,7 @@ MaybeLocal<Object> TranscodeUtf8FromUcs2(Environment* env,
return {};
}
- return Buffer::New(env, &destbuf);
+ return Buffer::Copy(env, reinterpret_cast<char*>(destbuf.out()), destbuf.length() * sizeof(char));
}
constexpr const char* EncodingName(const enum encoding encoding) {
diff --git a/src/node_internals.h b/src/node_internals.h
index e04fadd7f83e52fe965d8c73916a56f60425ba3d..5dff80ee287256ba40bfa496df6db60a18fbb9d7 100644
index 6264f23d54d6028bb0158f12a9296ba67a846358..613300215766aeb108219b0d1c3b95ee02db964f 100644
--- a/src/node_internals.h
+++ b/src/node_internals.h
@@ -118,7 +118,9 @@ v8::Maybe<bool> InitializePrimordials(v8::Local<v8::Context> context);
@@ -117,7 +117,9 @@ v8::Maybe<bool> InitializePrimordials(v8::Local<v8::Context> context);
class NodeArrayBufferAllocator : public ArrayBufferAllocator {
public:
@@ -145,7 +172,7 @@ index e04fadd7f83e52fe965d8c73916a56f60425ba3d..5dff80ee287256ba40bfa496df6db60a
void* Allocate(size_t size) override; // Defined in src/node.cc
void* AllocateUninitialized(size_t size) override;
@@ -136,7 +138,7 @@ class NodeArrayBufferAllocator : public ArrayBufferAllocator {
@@ -135,7 +137,7 @@ class NodeArrayBufferAllocator : public ArrayBufferAllocator {
}
private:
@@ -155,7 +182,7 @@ index e04fadd7f83e52fe965d8c73916a56f60425ba3d..5dff80ee287256ba40bfa496df6db60a
// Delegate to V8's allocator for compatibility with the V8 memory cage.
diff --git a/src/node_serdes.cc b/src/node_serdes.cc
index 6698a1df81cb4e0947c86fb30c2d77fca8e2d9d1..dad297652b347819805b09fbfd869f1d037e31c1 100644
index 7a70997bc024efa4f3ff4cabe30d5e88dcc7bc78..438d6e581a2ee55216f9a9945204b07824fc28a0 100644
--- a/src/node_serdes.cc
+++ b/src/node_serdes.cc
@@ -29,6 +29,11 @@ using v8::ValueSerializer;
@@ -238,7 +265,7 @@ index 6698a1df81cb4e0947c86fb30c2d77fca8e2d9d1..dad297652b347819805b09fbfd869f1d
if (!buf.IsEmpty()) {
args.GetReturnValue().Set(buf.ToLocalChecked());
diff --git a/src/node_trace_events.cc b/src/node_trace_events.cc
index c4960ee1427e3b29b873135a815a7a09bedcfb73..2c6d8cdeb37f7dce9f29b8f3b260036ae23e6fb5 100644
index 9787b14352753c5e0f8dc2b90093680e7cd10f1a..31af9e62396368af1b81f8841a705fd313df2b9f 100644
--- a/src/node_trace_events.cc
+++ b/src/node_trace_events.cc
@@ -132,12 +132,28 @@ static void GetCategoryEnabledBuffer(const FunctionCallbackInfo<Value>& args) {

View File

@@ -7,7 +7,7 @@ Instead of disabling the tests, flag them as flaky so they still run
but don't cause CI failures on flakes.
diff --git a/test/parallel/parallel.status b/test/parallel/parallel.status
index 28f25e4be7e3104894e53a22e50f5474e0b7bc76..2525b094e1eb936d311a0b57fc9579df360883d6 100644
index 79a953df7da64b7d7580e099a5cc5160e7842999..94616df356cab50c8ef4099e7863f5986deed377 100644
--- a/test/parallel/parallel.status
+++ b/test/parallel/parallel.status
@@ -5,6 +5,16 @@ prefix parallel
@@ -28,7 +28,7 @@ index 28f25e4be7e3104894e53a22e50f5474e0b7bc76..2525b094e1eb936d311a0b57fc9579df
test-net-write-fully-async-hex-string: PASS, FLAKY
# https://github.com/nodejs/node/issues/52273
diff --git a/test/sequential/sequential.status b/test/sequential/sequential.status
index ccab879b6e5fcdcc0d3a4b790b97db94d92f1a59..11339325697ae98f6996101163679590451c0b81 100644
index a539649d5537376a6a2ac9a7a46051b8648f0cb1..a03c86b752772be7ae36fab31faeccf3b0ccff64 100644
--- a/test/sequential/sequential.status
+++ b/test/sequential/sequential.status
@@ -7,6 +7,18 @@ prefix sequential

View File

@@ -7,10 +7,10 @@ Subject: test: match wpt/streams/transferable/transform-stream-members.any.js
All four of this calls should fail - see third_party/blink/web_tests/external/wpt/streams/transferable/transform-stream-members.any-expected.txt
diff --git a/test/wpt/status/streams.json b/test/wpt/status/streams.json
index 3b6e0ce6429f9dddb0b1a6882ce9e3a5158300e5..7ec49a378bfc84728b473d5df69675fff1dfdfef 100644
index 5425c86bba85079a44745779d998337aaa063df1..775661cd59b14132c9a811e448792ea02198f949 100644
--- a/test/wpt/status/streams.json
+++ b/test/wpt/status/streams.json
@@ -50,7 +50,9 @@
@@ -60,7 +60,9 @@
"fail": {
"expected": [
"Transferring [object TransformStream],[object ReadableStream] should fail",

View File

@@ -61,6 +61,10 @@ def main(target_file, target_cpu):
v['node_module_version'] = int(args['node_module_version'])
# Used by certain versions of node-gyp.
v['build_v8_with_gn'] = 'false'
# Enable clang conditionally based on target platform
# in common.gypi
if 'clang' in v:
del v['clang']
with open(target_file, 'w+', encoding='utf-8') as file_out:
file_out.write(pprint.pformat(config, indent=2))

View File

@@ -205,17 +205,6 @@ async function tagRelease (version: string) {
}
}
// function to determine if there have been commits to main since the last release
async function changesToRelease () {
const lastCommitWasRelease =
/^Bump v[0-9]+.[0-9]+.[0-9]+(-beta.[0-9]+)?(-alpha.[0-9]+)?(-nightly.[0-9]+)?$/g;
const lastCommit = await GitProcess.exec(
['log', '-n', '1', "--pretty=format:'%s'"],
ELECTRON_DIR
);
return !lastCommitWasRelease.test(lastCommit.stdout);
}
export async function printNextVersion (options: PrepareReleaseOptions) {
const newVersion = await getNewVersion(options, DryRunMode.DRY_RUN);
console.log(newVersion);
@@ -225,17 +214,9 @@ export async function prepareRelease (options: PrepareReleaseOptions) {
const currentBranch =
options.targetBranch || (await getCurrentBranch(ELECTRON_DIR));
const changes = await changesToRelease();
if (changes) {
const newVersion = await getNewVersion(options, DryRunMode.DRY_RUN);
console.log(`${pass} Starting release of ${newVersion}`);
await createRelease(options, currentBranch);
await pushRelease(currentBranch);
await runReleaseBuilds(currentBranch, newVersion);
} else {
console.log(
'There are no new changes to this branch since the last release, aborting release.'
);
process.exit(1);
}
const newVersion = await getNewVersion(options, DryRunMode.DRY_RUN);
console.log(`${pass} Starting release of ${newVersion}`);
await createRelease(options, currentBranch);
await pushRelease(currentBranch);
await runReleaseBuilds(currentBranch, newVersion);
}

View File

@@ -1,6 +1,7 @@
const glob = require('glob');
const fs = require('node:fs');
const path = require('node:path');
const currentShard = parseInt(process.argv[2], 10);
const shardCount = parseInt(process.argv[3], 10);
@@ -25,7 +26,7 @@ specFiles.sort((a, b) => {
let shard = 0;
for (const specFile of specFiles) {
buckets[shard].push(specFile);
buckets[shard].push(path.normalize(specFile));
shard++;
if (shard === shardCount) shard = 0;
}

View File

@@ -23,6 +23,13 @@ int ElectronMain(int argc, char* argv[]) {
params.argc = argc;
params.argv = const_cast<const char**>(argv);
electron::ElectronCommandLine::Init(argc, argv);
// Ensure that Bundle Id is set before ContentMain.
// Refs https://chromium-review.googlesource.com/c/chromium/src/+/5581006
delegate.OverrideChildProcessPath();
delegate.OverrideFrameworkBundlePath();
delegate.SetUpBundleOverrides();
return content::ContentMain(std::move(params));
}

View File

@@ -270,12 +270,6 @@ std::optional<int> ElectronMainDelegate::BasicStartupComplete() {
kNonWildcardDomainNonPortSchemes, kNonWildcardDomainNonPortSchemesSize);
#endif
#if BUILDFLAG(IS_MAC)
OverrideChildProcessPath();
OverrideFrameworkBundlePath();
SetUpBundleOverrides();
#endif
#if BUILDFLAG(IS_WIN)
// Ignore invalid parameter errors.
_set_invalid_parameter_handler(InvalidParameterHandler);

View File

@@ -34,6 +34,12 @@ class ElectronMainDelegate : public content::ContentMainDelegate {
ElectronMainDelegate(const ElectronMainDelegate&) = delete;
ElectronMainDelegate& operator=(const ElectronMainDelegate&) = delete;
#if BUILDFLAG(IS_MAC)
void OverrideChildProcessPath();
void OverrideFrameworkBundlePath();
void SetUpBundleOverrides();
#endif
protected:
// content::ContentMainDelegate:
std::string_view GetBrowserV8SnapshotFilename() override;
@@ -57,12 +63,6 @@ class ElectronMainDelegate : public content::ContentMainDelegate {
#endif
private:
#if BUILDFLAG(IS_MAC)
void OverrideChildProcessPath();
void OverrideFrameworkBundlePath();
void SetUpBundleOverrides();
#endif
std::unique_ptr<content::ContentBrowserClient> browser_client_;
std::unique_ptr<content::ContentClient> content_client_;
std::unique_ptr<content::ContentGpuClient> gpu_client_;

View File

@@ -79,7 +79,7 @@
#include "shell/common/node_includes.h"
#include "shell/common/options_switches.h"
#include "shell/common/thread_restrictions.h"
#include "shell/common/v8_value_serializer.h"
#include "shell/common/v8_util.h"
#include "ui/gfx/image/image.h"
#if BUILDFLAG(IS_WIN)

View File

@@ -30,7 +30,6 @@
#include "shell/common/gin_helper/dictionary.h"
#include "shell/common/gin_helper/object_template_builder.h"
#include "shell/common/gin_helper/promise.h"
#include "url/url_util.h"
namespace gin {
@@ -101,12 +100,25 @@ namespace electron::api {
namespace {
bool DomainIs(std::string_view host, const std::string_view domain) {
// Strip any leading '.' character from the input cookie domain.
if (host.starts_with('.'))
host.remove_prefix(1);
// Returns whether |domain| matches |filter|.
bool MatchesDomain(std::string filter, const std::string& domain) {
// Add a leading '.' character to the filter domain if it doesn't exist.
if (net::cookie_util::DomainIsHostOnly(filter))
filter.insert(0, ".");
return url::DomainIs(host, domain);
std::string sub_domain(domain);
// Strip any leading '.' character from the input cookie domain.
if (!net::cookie_util::DomainIsHostOnly(sub_domain))
sub_domain = sub_domain.substr(1);
// Now check whether the domain argument is a subdomain of the filter domain.
for (sub_domain.insert(0, "."); sub_domain.length() >= filter.length();) {
if (sub_domain == filter)
return true;
const size_t next_dot = sub_domain.find('.', 1); // Skip over leading dot.
sub_domain.erase(0, next_dot);
}
return false;
}
// Returns whether |cookie| matches |filter|.
@@ -117,7 +129,8 @@ bool MatchesCookie(const base::Value::Dict& filter,
return false;
if ((str = filter.FindString("path")) && *str != cookie.Path())
return false;
if ((str = filter.FindString("domain")) && !DomainIs(cookie.Domain(), *str))
if ((str = filter.FindString("domain")) &&
!MatchesDomain(*str, cookie.Domain()))
return false;
std::optional<bool> secure_filter = filter.FindBool("secure");
if (secure_filter && *secure_filter != cookie.SecureAttribute())

View File

@@ -28,7 +28,7 @@
#include "shell/common/gin_helper/dictionary.h"
#include "shell/common/gin_helper/object_template_builder.h"
#include "shell/common/node_includes.h"
#include "shell/common/v8_value_serializer.h"
#include "shell/common/v8_util.h"
#include "third_party/blink/public/common/messaging/message_port_descriptor.h"
#include "third_party/blink/public/common/messaging/transferable_message_mojom_traits.h"
@@ -247,12 +247,16 @@ void UtilityProcessWrapper::OnServiceProcessLaunch(
}
void UtilityProcessWrapper::HandleTermination(uint64_t exit_code) {
// HandleTermination is called from multiple callsites,
// we need to ensure we only process it for the first callsite.
if (terminated_)
return;
terminated_ = true;
if (pid_ != base::kNullProcessId)
GetAllUtilityProcessWrappers().Remove(pid_);
CloseConnectorPort();
EmitWithoutEvent("exit", exit_code);
Unpin();
}
@@ -292,13 +296,8 @@ void UtilityProcessWrapper::CloseConnectorPort() {
}
void UtilityProcessWrapper::Shutdown(uint64_t exit_code) {
if (pid_ != base::kNullProcessId)
GetAllUtilityProcessWrappers().Remove(pid_);
node_service_remote_.reset();
CloseConnectorPort();
// Emit 'exit' event
EmitWithoutEvent("exit", exit_code);
Unpin();
HandleTermination(exit_code);
}
void UtilityProcessWrapper::PostMessage(gin::Arguments* args) {

View File

@@ -105,6 +105,7 @@ class UtilityProcessWrapper final
int stdout_read_fd_ = -1;
int stderr_read_fd_ = -1;
bool connector_closed_ = false;
bool terminated_ = false;
std::unique_ptr<mojo::Connector> connector_;
blink::MessagePortDescriptor host_port_;
mojo::Receiver<node::mojom::NodeServiceClient> receiver_{this};

View File

@@ -133,7 +133,7 @@
#include "shell/common/node_util.h"
#include "shell/common/options_switches.h"
#include "shell/common/thread_restrictions.h"
#include "shell/common/v8_value_serializer.h"
#include "shell/common/v8_util.h"
#include "storage/browser/file_system/isolated_context.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
#include "third_party/blink/public/common/input/web_input_event.h"

View File

@@ -31,7 +31,7 @@
#include "shell/common/gin_helper/object_template_builder.h"
#include "shell/common/gin_helper/promise.h"
#include "shell/common/node_includes.h"
#include "shell/common/v8_value_serializer.h"
#include "shell/common/v8_util.h"
namespace gin {

View File

@@ -21,7 +21,7 @@
#include "shell/common/gin_helper/error_thrower.h"
#include "shell/common/gin_helper/event_emitter_caller.h"
#include "shell/common/node_includes.h"
#include "shell/common/v8_value_serializer.h"
#include "shell/common/v8_util.h"
#include "third_party/blink/public/common/messaging/transferable_message.h"
#include "third_party/blink/public/common/messaging/transferable_message_mojom_traits.h"
#include "third_party/blink/public/mojom/messaging/transferable_message.mojom.h"

View File

@@ -25,6 +25,18 @@ namespace electron {
namespace {
// write |ref|'s raw bytes to |fd|.
template <typename T>
void WriteValToFd(int fd, const T& ref) {
base::span<const uint8_t> bytes = base::byte_span_from_ref(ref);
while (!bytes.empty()) {
const ssize_t rv = HANDLE_EINTR(write(fd, bytes.data(), bytes.size()));
RAW_CHECK(rv >= 0);
const size_t n_bytes_written = rv >= 0 ? static_cast<size_t>(rv) : 0U;
bytes = bytes.subspan(n_bytes_written);
}
}
// See comment in |PreEarlyInitialization()|, where sigaction is called.
void SIGCHLDHandler(int signal) {}
@@ -49,15 +61,7 @@ void GracefulShutdownHandler(int signal) {
RAW_CHECK(g_pipe_pid == getpid());
RAW_CHECK(g_shutdown_pipe_write_fd != -1);
RAW_CHECK(g_shutdown_pipe_read_fd != -1);
size_t bytes_written = 0;
do {
int rv = HANDLE_EINTR(
write(g_shutdown_pipe_write_fd,
reinterpret_cast<const char*>(&signal) + bytes_written,
sizeof(signal) - bytes_written));
RAW_CHECK(rv >= 0);
bytes_written += rv;
} while (bytes_written < sizeof(signal));
WriteValToFd(g_shutdown_pipe_write_fd, signal);
}
// See comment in |PostCreateMainMessageLoop()|, where sigaction is called.
@@ -130,26 +134,33 @@ NOINLINE void ExitPosted() {
sleep(UINT_MAX);
}
// read |sizeof(T)| raw bytes from |fd| and return the result
template <typename T>
[[nodiscard]] std::optional<T> ReadValFromFd(int fd) {
auto val = T{};
base::span<uint8_t> bytes = base::byte_span_from_ref(val);
while (!bytes.empty()) {
const ssize_t rv = HANDLE_EINTR(read(fd, bytes.data(), bytes.size()));
if (rv < 0) {
NOTREACHED_IN_MIGRATION() << "Unexpected error: " << strerror(errno);
ShutdownFDReadError();
return {};
}
if (rv == 0) {
NOTREACHED_IN_MIGRATION() << "Unexpected closure of shutdown pipe.";
ShutdownFDClosedError();
return {};
}
const size_t n_bytes_read = static_cast<size_t>(rv);
bytes = bytes.subspan(n_bytes_read);
}
return val;
}
void ShutdownDetector::ThreadMain() {
base::PlatformThread::SetName("CrShutdownDetector");
int signal;
size_t bytes_read = 0;
do {
const ssize_t ret = HANDLE_EINTR(
read(shutdown_fd_, reinterpret_cast<char*>(&signal) + bytes_read,
sizeof(signal) - bytes_read));
if (ret < 0) {
NOTREACHED_IN_MIGRATION() << "Unexpected error: " << strerror(errno);
ShutdownFDReadError();
break;
} else if (ret == 0) {
NOTREACHED_IN_MIGRATION() << "Unexpected closure of shutdown pipe.";
ShutdownFDClosedError();
break;
}
bytes_read += ret;
} while (bytes_read < sizeof(signal));
const int signal = ReadValFromFd<int>(shutdown_fd_).value_or(0);
VLOG(1) << "Handling shutdown for signal " << signal << ".";
if (!task_runner_->PostTask(FROM_HERE,

View File

@@ -11,7 +11,7 @@
#include "shell/common/gin_converters/callback_converter.h"
#include "shell/common/gin_helper/callback.h"
#include "shell/common/gin_helper/dictionary.h"
#include "shell/common/v8_value_serializer.h"
#include "shell/common/v8_util.h"
ElectronNSSCryptoModuleDelegate::ElectronNSSCryptoModuleDelegate(
const net::HostPortPair& server)

View File

@@ -538,6 +538,11 @@ void NativeWindowViews::ShowInactive() {
#if BUILDFLAG(IS_LINUX)
if (global_menu_bar_)
global_menu_bar_->OnWindowMapped();
// On X11, setting Z order before showing the window doesn't take effect,
// so we have to call it again.
if (IsX11())
widget()->SetZOrderLevel(widget()->GetZOrderLevel());
#endif
}

View File

@@ -120,20 +120,20 @@ void SetZoomLevelForWebContents(content::WebContents* web_contents,
content::HostZoomMap::SetZoomLevel(web_contents, level);
}
double GetNextZoomLevel(const double level, const bool out) {
double GetNextZoomLevel(double level, bool out) {
static constexpr std::array<double, 16U> kPresetFactors{
0.25, 0.333, 0.5, 0.666, 0.75, 0.9, 1.0, 1.1,
1.25, 1.5, 1.75, 2.0, 2.5, 3.0, 4.0, 5.0};
static constexpr auto kBegin = kPresetFactors.begin();
static constexpr auto kEnd = kPresetFactors.end();
static constexpr size_t size = std::size(kPresetFactors);
const double factor = blink::ZoomLevelToZoomFactor(level);
auto matches = [=](auto val) { return blink::ZoomValuesEqual(factor, val); };
if (auto iter = std::find_if(kBegin, kEnd, matches); iter != kEnd) {
if (out && iter != kBegin)
return blink::ZoomFactorToZoomLevel(*--iter);
if (!out && ++iter != kEnd)
return blink::ZoomFactorToZoomLevel(*iter);
for (size_t i = 0U; i < size; ++i) {
if (!blink::ZoomValuesEqual(kPresetFactors[i], factor))
continue;
if (out && i > 0U)
return blink::ZoomFactorToZoomLevel(kPresetFactors[i - 1U]);
if (!out && i + 1U < size)
return blink::ZoomFactorToZoomLevel(kPresetFactors[i + 1U]);
}
return level;
}

View File

@@ -5,6 +5,7 @@
#include "shell/browser/ui/win/taskbar_host.h"
#include <objbase.h>
#include <array>
#include <string>
#include "base/strings/utf_string_conversions.h"
@@ -25,10 +26,10 @@ namespace {
// From MSDN:
// https://msdn.microsoft.com/en-us/library/windows/desktop/dd378460(v=vs.85).aspx#thumbbars
// The thumbnail toolbar has a maximum of seven buttons due to the limited room.
const size_t kMaxButtonsCount = 7;
constexpr size_t kMaxButtonsCount = 7U;
// The base id of Thumbar button.
const int kButtonIdBase = 40001;
constexpr int kButtonIdBase = 40001;
bool GetThumbarButtonFlags(const std::vector<std::string>& flags,
THUMBBUTTONFLAGS* out) {
@@ -72,10 +73,10 @@ bool TaskbarHost::SetThumbarButtons(HWND window,
// The number of buttons in thumbar can not be changed once it is created,
// so we have to claim kMaxButtonsCount buttons initially in case users add
// more buttons later.
base::win::ScopedHICON icons[kMaxButtonsCount] = {};
THUMBBUTTON thumb_buttons[kMaxButtonsCount] = {};
auto icons = std::array<base::win::ScopedHICON, kMaxButtonsCount>{};
auto thumb_buttons = std::array<THUMBBUTTON, kMaxButtonsCount>{};
for (size_t i = 0; i < kMaxButtonsCount; ++i) {
for (size_t i = 0U; i < kMaxButtonsCount; ++i) {
THUMBBUTTON& thumb_button = thumb_buttons[i];
// Set ID.
@@ -118,10 +119,11 @@ bool TaskbarHost::SetThumbarButtons(HWND window,
// Finally add them to taskbar.
HRESULT r;
if (thumbar_buttons_added_) {
r = taskbar_->ThumbBarUpdateButtons(window, kMaxButtonsCount,
thumb_buttons);
r = taskbar_->ThumbBarUpdateButtons(window, thumb_buttons.size(),
thumb_buttons.data());
} else {
r = taskbar_->ThumbBarAddButtons(window, kMaxButtonsCount, thumb_buttons);
r = taskbar_->ThumbBarAddButtons(window, thumb_buttons.size(),
thumb_buttons.data());
}
thumbar_buttons_added_ = true;

View File

@@ -30,6 +30,7 @@
#include "shell/common/gin_helper/function_template_extensions.h"
#include "shell/common/gin_helper/object_template_builder.h"
#include "shell/common/node_includes.h"
#include "shell/common/node_util.h"
#include "shell/common/process_util.h"
#include "shell/common/skia_util.h"
#include "shell/common/thread_restrictions.h"
@@ -397,20 +398,18 @@ void NativeImage::AddRepresentation(const gin_helper::Dictionary& options) {
v8::Local<v8::Value> buffer;
GURL url;
if (options.Get("buffer", &buffer) && node::Buffer::HasInstance(buffer)) {
auto* data = reinterpret_cast<unsigned char*>(node::Buffer::Data(buffer));
auto size = node::Buffer::Length(buffer);
skia_rep_added = electron::util::AddImageSkiaRepFromBuffer(
&image_skia, data, size, width, height, scale_factor);
&image_skia, electron::util::as_byte_span(buffer), width, height,
scale_factor);
} else if (options.Get("dataURL", &url)) {
std::string mime_type, charset, data;
if (net::DataURL::Parse(url, &mime_type, &charset, &data)) {
auto* data_ptr = reinterpret_cast<const unsigned char*>(data.c_str());
if (mime_type == "image/png") {
skia_rep_added = electron::util::AddImageSkiaRepFromPNG(
&image_skia, data_ptr, data.size(), scale_factor);
&image_skia, base::as_byte_span(data), scale_factor);
} else if (mime_type == "image/jpeg") {
skia_rep_added = electron::util::AddImageSkiaRepFromJPEG(
&image_skia, data_ptr, data.size(), scale_factor);
&image_skia, base::as_byte_span(data), scale_factor);
}
}
}
@@ -442,22 +441,20 @@ gin::Handle<NativeImage> NativeImage::Create(v8::Isolate* isolate,
}
// static
gin::Handle<NativeImage> NativeImage::CreateFromPNG(v8::Isolate* isolate,
const char* buffer,
size_t length) {
gin::Handle<NativeImage> NativeImage::CreateFromPNG(
v8::Isolate* isolate,
const base::span<const uint8_t> data) {
gfx::ImageSkia image_skia;
electron::util::AddImageSkiaRepFromPNG(
&image_skia, reinterpret_cast<const unsigned char*>(buffer), length, 1.0);
electron::util::AddImageSkiaRepFromPNG(&image_skia, data, 1.0);
return Create(isolate, gfx::Image(image_skia));
}
// static
gin::Handle<NativeImage> NativeImage::CreateFromJPEG(v8::Isolate* isolate,
const char* buffer,
size_t length) {
gin::Handle<NativeImage> NativeImage::CreateFromJPEG(
v8::Isolate* isolate,
const base::span<const uint8_t> buffer) {
gfx::ImageSkia image_skia;
electron::util::AddImageSkiaRepFromJPEG(
&image_skia, reinterpret_cast<const unsigned char*>(buffer), length, 1.0);
electron::util::AddImageSkiaRepFromJPEG(&image_skia, buffer, 1.0);
return Create(isolate, gfx::Image(image_skia));
}
@@ -509,7 +506,8 @@ gin::Handle<NativeImage> NativeImage::CreateFromBitmap(
auto info = SkImageInfo::MakeN32(width, height, kPremul_SkAlphaType);
auto size_bytes = info.computeMinByteSize();
if (size_bytes != node::Buffer::Length(buffer)) {
const auto buffer_data = electron::util::as_byte_span(buffer);
if (size_bytes != buffer_data.size()) {
thrower.ThrowError("invalid buffer size");
return gin::Handle<NativeImage>();
}
@@ -522,7 +520,7 @@ gin::Handle<NativeImage> NativeImage::CreateFromBitmap(
SkBitmap bitmap;
bitmap.allocN32Pixels(width, height, false);
bitmap.writePixels({info, node::Buffer::Data(buffer), bitmap.rowBytes()});
bitmap.writePixels({info, buffer_data.data(), bitmap.rowBytes()});
gfx::ImageSkia image_skia =
gfx::ImageSkia::CreateFromBitmap(bitmap, scale_factor);
@@ -553,8 +551,8 @@ gin::Handle<NativeImage> NativeImage::CreateFromBuffer(
gfx::ImageSkia image_skia;
electron::util::AddImageSkiaRepFromBuffer(
&image_skia, reinterpret_cast<unsigned char*>(node::Buffer::Data(buffer)),
node::Buffer::Length(buffer), width, height, scale_factor);
&image_skia, electron::util::as_byte_span(buffer), width, height,
scale_factor);
return Create(args->isolate(), gfx::Image(image_skia));
}
@@ -564,9 +562,9 @@ gin::Handle<NativeImage> NativeImage::CreateFromDataURL(v8::Isolate* isolate,
std::string mime_type, charset, data;
if (net::DataURL::Parse(url, &mime_type, &charset, &data)) {
if (mime_type == "image/png")
return CreateFromPNG(isolate, data.c_str(), data.size());
else if (mime_type == "image/jpeg")
return CreateFromJPEG(isolate, data.c_str(), data.size());
return CreateFromPNG(isolate, base::as_byte_span(data));
if (mime_type == "image/jpeg")
return CreateFromJPEG(isolate, base::as_byte_span(data));
}
return CreateEmpty(isolate);

View File

@@ -9,6 +9,7 @@
#include <vector>
#include "base/containers/flat_map.h"
#include "base/containers/span.h"
#include "base/memory/raw_ptr.h"
#include "base/values.h"
#include "gin/wrappable.h"
@@ -61,11 +62,10 @@ class NativeImage final : public gin::Wrappable<NativeImage> {
static gin::Handle<NativeImage> Create(v8::Isolate* isolate,
const gfx::Image& image);
static gin::Handle<NativeImage> CreateFromPNG(v8::Isolate* isolate,
const char* buffer,
size_t length);
static gin::Handle<NativeImage> CreateFromJPEG(v8::Isolate* isolate,
const char* buffer,
size_t length);
base::span<const uint8_t> data);
static gin::Handle<NativeImage> CreateFromJPEG(
v8::Isolate* isolate,
base::span<const uint8_t> data);
static gin::Handle<NativeImage> CreateFromPath(v8::Isolate* isolate,
const base::FilePath& path);
static gin::Handle<NativeImage> CreateFromBitmap(

View File

@@ -26,6 +26,19 @@
namespace electron::api {
namespace {
base::span<const uint8_t> as_byte_span(NSData* data) {
// SAFETY: There is no NSData API that passes the UNSAFE_BUFFER_USAGE
// test, so let's isolate the unsafe API use into this function. Instead of
// calling '[data bytes]' and '[data length]' directly, the rest of our
// code should prefer to use spans returned by this function.
return UNSAFE_BUFFERS(base::span{
reinterpret_cast<const uint8_t*>([data bytes]), [data length]});
}
} // namespace
NSData* bufferFromNSImage(NSImage* image) {
CGImageRef ref = [image CGImageForProposedRect:nil context:nil hints:nil];
NSBitmapImageRep* rep = [[NSBitmapImageRep alloc] initWithCGImage:ref];
@@ -127,9 +140,7 @@ gin::Handle<NativeImage> NativeImage::CreateFromNamedImage(gin::Arguments* args,
NSData* png_data = bufferFromNSImage(image);
if (args->GetNext(&hsl_shift) && hsl_shift.size() == 3) {
gfx::Image gfx_image = gfx::Image::CreateFrom1xPNGBytes(
{reinterpret_cast<const uint8_t*>((char*)[png_data bytes]),
[png_data length]});
auto gfx_image = gfx::Image::CreateFrom1xPNGBytes(as_byte_span(png_data));
color_utils::HSL shift = {safeShift(hsl_shift[0], -1),
safeShift(hsl_shift[1], 0.5),
safeShift(hsl_shift[2], 0.5)};
@@ -139,8 +150,7 @@ gin::Handle<NativeImage> NativeImage::CreateFromNamedImage(gin::Arguments* args,
.AsNSImage());
}
return CreateFromPNG(args->isolate(), (char*)[png_data bytes],
[png_data length]);
return CreateFromPNG(args->isolate(), as_byte_span(png_data));
}
}

View File

@@ -21,7 +21,7 @@
#include "shell/common/gin_converters/value_converter.h"
#include "shell/common/gin_helper/dictionary.h"
#include "shell/common/keyboard_util.h"
#include "shell/common/v8_value_serializer.h"
#include "shell/common/v8_util.h"
#include "third_party/blink/public/common/context_menu_data/edit_flags.h"
#include "third_party/blink/public/common/input/web_input_event.h"
#include "third_party/blink/public/common/input/web_keyboard_event.h"

View File

@@ -35,6 +35,7 @@
#include "shell/common/gin_converters/value_converter.h"
#include "shell/common/gin_helper/promise.h"
#include "shell/common/node_includes.h"
#include "shell/common/v8_util.h"
namespace gin {
@@ -369,10 +370,7 @@ class ChunkedDataPipeReadableStream final
num_bytes = *size_ - bytes_read_;
MojoResult rv = data_pipe_->ReadData(
MOJO_READ_DATA_FLAG_NONE,
base::span(static_cast<uint8_t*>(buf->Buffer()->Data()),
buf->ByteLength())
.subspan(buf->ByteOffset(), num_bytes),
num_bytes);
electron::util::as_byte_span(buf).first(num_bytes), num_bytes);
if (rv == MOJO_RESULT_OK) {
bytes_read_ += num_bytes;
// Not needed for correctness, but this allows the consumer to send the

View File

@@ -4,6 +4,7 @@
#include "shell/common/heap_snapshot.h"
#include "base/containers/span.h"
#include "base/files/file.h"
#include "base/memory/raw_ptr.h"
#include "v8/include/v8-profiler.h"
@@ -24,8 +25,13 @@ class HeapSnapshotOutputStream : public v8::OutputStream {
void EndOfStream() override { is_complete_ = true; }
v8::OutputStream::WriteResult WriteAsciiChunk(char* data, int size) override {
auto bytes_written = file_->WriteAtCurrentPos(data, size);
return bytes_written == size ? kContinue : kAbort;
const uint8_t* udata = reinterpret_cast<const uint8_t*>(data);
const size_t usize = static_cast<size_t>(std::max(0, size));
// SAFETY: since WriteAsciiChunk() only gives us data + size, our
// UNSAFE_BUFFERS macro call is unavoidable here. It can be removed
// if/when v8 changes WriteAsciiChunk() to pass a v8::MemorySpan.
const auto data_span = UNSAFE_BUFFERS(base::span(udata, usize));
return file_->WriteAtCurrentPosAndCheck(data_span) ? kContinue : kAbort;
}
private:

View File

@@ -4,6 +4,7 @@
#include "shell/common/node_util.h"
#include "base/compiler_specific.h"
#include "base/logging.h"
#include "gin/converter.h"
#include "gin/dictionary.h"
@@ -65,4 +66,14 @@ void EmitWarning(v8::Isolate* isolate,
emit_warning.Run(warning_msg, warning_type, "");
}
// SAFETY: There is no node::Buffer API that passes the UNSAFE_BUFFER_USAGE
// test, so let's isolate the unsafe API use into this function. Instead of
// calling `Buffer::Data()` and `Buffer::Length()` directly, the rest of our
// code should prefer to use spans returned by this function.
base::span<uint8_t> as_byte_span(v8::Local<v8::Value> node_buffer) {
auto* data = reinterpret_cast<uint8_t*>(node::Buffer::Data(node_buffer));
const auto size = node::Buffer::Length(node_buffer);
return UNSAFE_BUFFERS(base::span{data, size});
}
} // namespace electron::util

View File

@@ -8,6 +8,7 @@
#include <string_view>
#include <vector>
#include "base/containers/span.h"
#include "v8/include/v8-forward.h"
namespace node {
@@ -36,6 +37,11 @@ v8::MaybeLocal<v8::Value> CompileAndCall(
std::vector<v8::Local<v8::String>>* parameters,
std::vector<v8::Local<v8::Value>>* arguments);
// Convenience function to view a Node buffer's data as a base::span().
// Analogous to base::as_byte_span()
[[nodiscard]] base::span<uint8_t> as_byte_span(
v8::Local<v8::Value> node_buffer);
} // namespace electron::util
#endif // ELECTRON_SHELL_COMMON_NODE_UTIL_H_

View File

@@ -19,8 +19,10 @@
#include "base/logging.h"
#include "base/mac/scoped_aedesc.h"
#include "base/strings/sys_string_conversions.h"
#include "base/task/bind_post_task.h"
#include "base/task/thread_pool.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "net/base/apple/url_conversions.h"
#include "ui/views/widget/widget.h"
#include "url/gurl.h"
@@ -146,11 +148,23 @@ void OpenExternal(const GURL& url,
return;
}
bool success = [[NSWorkspace sharedWorkspace] openURL:ns_url];
if (success && options.activate)
[NSApp activateIgnoringOtherApps:YES];
NSWorkspaceOpenConfiguration* configuration =
[NSWorkspaceOpenConfiguration configuration];
configuration.activates = options.activate;
std::move(callback).Run(success ? "" : "Failed to open URL");
__block OpenCallback copied_callback =
base::BindPostTaskToCurrentDefault(std::move(callback));
[[NSWorkspace sharedWorkspace] openURL:ns_url
configuration:configuration
completionHandler:^(NSRunningApplication* _Nullable app,
NSError* _Nullable error) {
if (error) {
std::move(copied_callback).Run("Failed to open URL");
} else {
std::move(copied_callback).Run("");
}
}];
}
bool MoveItemToTrashWithError(const base::FilePath& full_path,

View File

@@ -56,11 +56,10 @@ float GetScaleFactorFromPath(const base::FilePath& path) {
}
bool AddImageSkiaRepFromPNG(gfx::ImageSkia* image,
const unsigned char* data,
size_t size,
const base::span<const uint8_t> data,
double scale_factor) {
SkBitmap bitmap;
if (!gfx::PNGCodec::Decode(data, size, &bitmap))
if (!gfx::PNGCodec::Decode(data.data(), data.size(), &bitmap))
return false;
image->AddRepresentation(gfx::ImageSkiaRep(bitmap, scale_factor));
@@ -68,10 +67,9 @@ bool AddImageSkiaRepFromPNG(gfx::ImageSkia* image,
}
bool AddImageSkiaRepFromJPEG(gfx::ImageSkia* image,
const unsigned char* data,
size_t size,
const base::span<const uint8_t> data,
double scale_factor) {
auto bitmap = gfx::JPEGCodec::Decode(data, size);
auto bitmap = gfx::JPEGCodec::Decode(data.data(), data.size());
if (!bitmap)
return false;
@@ -89,29 +87,28 @@ bool AddImageSkiaRepFromJPEG(gfx::ImageSkia* image,
}
bool AddImageSkiaRepFromBuffer(gfx::ImageSkia* image,
const unsigned char* data,
size_t size,
const base::span<const uint8_t> data,
int width,
int height,
double scale_factor) {
// Try PNG first.
if (AddImageSkiaRepFromPNG(image, data, size, scale_factor))
if (AddImageSkiaRepFromPNG(image, data, scale_factor))
return true;
// Try JPEG second.
if (AddImageSkiaRepFromJPEG(image, data, size, scale_factor))
if (AddImageSkiaRepFromJPEG(image, data, scale_factor))
return true;
if (width == 0 || height == 0)
return false;
auto info = SkImageInfo::MakeN32(width, height, kPremul_SkAlphaType);
if (size < info.computeMinByteSize())
if (data.size() < info.computeMinByteSize())
return false;
SkBitmap bitmap;
bitmap.allocN32Pixels(width, height, false);
bitmap.writePixels({info, data, bitmap.rowBytes()});
bitmap.writePixels({info, data.data(), bitmap.rowBytes()});
image->AddRepresentation(gfx::ImageSkiaRep(bitmap, scale_factor));
return true;
@@ -127,11 +124,8 @@ bool AddImageSkiaRepFromPath(gfx::ImageSkia* image,
return false;
}
const auto* data =
reinterpret_cast<const unsigned char*>(file_contents.data());
size_t size = file_contents.size();
return AddImageSkiaRepFromBuffer(image, data, size, 0, 0, scale_factor);
return AddImageSkiaRepFromBuffer(image, base::as_byte_span(file_contents), 0,
0, scale_factor);
}
bool PopulateImageSkiaRepsFromPath(gfx::ImageSkia* image,

View File

@@ -5,9 +5,13 @@
#ifndef ELECTRON_SHELL_COMMON_SKIA_UTIL_H_
#define ELECTRON_SHELL_COMMON_SKIA_UTIL_H_
#include <cstdint>
#include "base/containers/span.h"
namespace base {
class FilePath;
}
} // namespace base
namespace gfx {
class ImageSkia;
@@ -19,20 +23,17 @@ bool PopulateImageSkiaRepsFromPath(gfx::ImageSkia* image,
const base::FilePath& path);
bool AddImageSkiaRepFromBuffer(gfx::ImageSkia* image,
const unsigned char* data,
size_t size,
base::span<const uint8_t> data,
int width,
int height,
double scale_factor);
bool AddImageSkiaRepFromJPEG(gfx::ImageSkia* image,
const unsigned char* data,
size_t size,
base::span<const uint8_t> data,
double scale_factor);
bool AddImageSkiaRepFromPNG(gfx::ImageSkia* image,
const unsigned char* data,
size_t size,
base::span<const uint8_t> data,
double scale_factor);
#if BUILDFLAG(IS_WIN)

View File

@@ -2,7 +2,7 @@
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "shell/common/v8_value_serializer.h"
#include "shell/common/v8_util.h"
#include <utility>
#include <vector>
@@ -240,4 +240,23 @@ v8::Local<v8::Value> DeserializeV8Value(v8::Isolate* isolate,
return V8Deserializer(isolate, data).Deserialize();
}
namespace util {
/**
* SAFETY: There is not yet any v8::ArrayBufferView API that passes the
* UNSAFE_BUFFER_USAGE test, so let's isolate the unsafe API here.
*
* Where possible, Electron should use spans returned here instead of
* |v8::ArrayBufferView::Buffer()->Data()|,
* |v8::ArrayBufferView::ByteOffset()|,
* |v8::ArrayBufferView::ByteLength()|.
*/
base::span<uint8_t> as_byte_span(v8::Local<v8::ArrayBufferView> val) {
uint8_t* data = UNSAFE_BUFFERS(static_cast<uint8_t*>(val->Buffer()->Data()) +
val->ByteOffset());
const size_t size = val->ByteLength();
return UNSAFE_BUFFERS(base::span{data, size});
}
} // namespace util
} // namespace electron

View File

@@ -9,6 +9,7 @@
#include "ui/gfx/image/image_skia_rep.h"
namespace v8 {
class ArrayBufferView;
class Isolate;
template <class T>
class Local;
@@ -29,6 +30,12 @@ v8::Local<v8::Value> DeserializeV8Value(v8::Isolate* isolate,
v8::Local<v8::Value> DeserializeV8Value(v8::Isolate* isolate,
base::span<const uint8_t> data);
namespace util {
[[nodiscard]] base::span<uint8_t> as_byte_span(
v8::Local<v8::ArrayBufferView> abv);
} // namespace util
} // namespace electron
#endif // ELECTRON_SHELL_COMMON_V8_VALUE_SERIALIZER_H_

View File

@@ -19,7 +19,7 @@
#include "shell/common/gin_helper/promise.h"
#include "shell/common/node_bindings.h"
#include "shell/common/node_includes.h"
#include "shell/common/v8_value_serializer.h"
#include "shell/common/v8_util.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
#include "third_party/blink/public/web/web_local_frame.h"
#include "third_party/blink/public/web/web_message_port_converter.h"

View File

@@ -15,6 +15,7 @@
#include "base/containers/contains.h"
#include "base/logging.h"
#include "base/numerics/safe_conversions.h"
#include "base/strings/utf_string_conversion_utils.h"
#include "base/task/single_thread_task_runner.h"
#include "components/spellcheck/renderer/spellcheck_worditerator.h"
#include "shell/common/gin_helper/dictionary.h"
@@ -29,12 +30,9 @@ namespace electron::api {
namespace {
bool HasWordCharacters(const std::u16string& text, int index) {
const char16_t* data = text.data();
int length = text.length();
while (index < length) {
uint32_t code = 0;
U16_NEXT(data, index, length, code);
bool HasWordCharacters(const std::u16string& text, size_t index) {
base_icu::UChar32 code;
while (base::ReadUnicodeCharacter(text.c_str(), text.size(), &index, &code)) {
UErrorCode error = U_ZERO_ERROR;
if (uscript_getScript(code, &error) != USCRIPT_COMMON)
return true;

View File

@@ -19,7 +19,7 @@
#include "shell/common/node_includes.h"
#include "shell/common/options_switches.h"
#include "shell/common/thread_restrictions.h"
#include "shell/common/v8_value_serializer.h"
#include "shell/common/v8_util.h"
#include "shell/renderer/electron_render_frame_observer.h"
#include "shell/renderer/renderer_client_base.h"
#include "third_party/blink/public/mojom/frame/user_activation_notification_type.mojom-shared.h"

View File

@@ -15,7 +15,7 @@
#include "shell/common/gin_helper/dictionary.h"
#include "shell/common/gin_helper/event_emitter_caller.h"
#include "shell/common/node_includes.h"
#include "shell/common/v8_value_serializer.h"
#include "shell/common/v8_util.h"
#include "third_party/blink/public/common/messaging/transferable_message_mojom_traits.h"
namespace electron {

View File

@@ -2512,6 +2512,22 @@ describe('BrowserWindow module', () => {
expect(c.isAlwaysOnTop()).to.be.true('child is not always on top');
expect(c._getAlwaysOnTopLevel()).to.equal('screen-saver');
});
it('works when called prior to show', async () => {
w = new BrowserWindow({ show: false });
w.setAlwaysOnTop(true, 'screen-saver');
w.show();
await setTimeout(1000);
expect(w.isAlwaysOnTop()).to.be.true('is not alwaysOnTop');
});
it('works when called prior to showInactive', async () => {
w = new BrowserWindow({ show: false });
w.setAlwaysOnTop(true, 'screen-saver');
w.showInactive();
await setTimeout(1000);
expect(w.isAlwaysOnTop()).to.be.true('is not alwaysOnTop');
});
});
describe('preconnect feature', () => {

View File

@@ -5,7 +5,6 @@ import { expect } from 'chai';
import * as send from 'send';
import * as ChildProcess from 'node:child_process';
import * as crypto from 'node:crypto';
import { once } from 'node:events';
import * as fs from 'node:fs';
import * as http from 'node:http';
@@ -130,54 +129,6 @@ describe('session module', () => {
expect(cs.some(c => c.name === name && c.value === value)).to.equal(true);
});
it('does not match on empty domain filter strings', async () => {
const { cookies } = session.defaultSession;
const name = crypto.randomBytes(20).toString('hex');
const value = '1';
const url = 'https://microsoft.com/';
await cookies.set({ url, name, value });
const cs = await cookies.get({ domain: '' });
expect(cs.some(c => c.name === name && c.value === value)).to.equal(false);
cookies.remove(url, name);
});
it('gets domain-equal cookies', async () => {
const { cookies } = session.defaultSession;
const name = crypto.randomBytes(20).toString('hex');
const value = '1';
const url = 'https://microsoft.com/';
await cookies.set({ url, name, value });
const cs = await cookies.get({ domain: 'microsoft.com' });
expect(cs.some(c => c.name === name && c.value === value)).to.equal(true);
cookies.remove(url, name);
});
it('gets domain-inclusive cookies', async () => {
const { cookies } = session.defaultSession;
const name = crypto.randomBytes(20).toString('hex');
const value = '1';
const url = 'https://subdomain.microsoft.com/';
await cookies.set({ url, name, value });
const cs = await cookies.get({ domain: 'microsoft.com' });
expect(cs.some(c => c.name === name && c.value === value)).to.equal(true);
cookies.remove(url, name);
});
it('omits domain-exclusive cookies', async () => {
const { cookies } = session.defaultSession;
const name = crypto.randomBytes(20).toString('hex');
const value = '1';
const url = 'https://microsoft.com';
await cookies.set({ url, name, value });
const cs = await cookies.get({ domain: 'subdomain.microsoft.com' });
expect(cs.some(c => c.name === name && c.value === value)).to.equal(false);
cookies.remove(url, name);
});
it('rejects when setting a cookie with missing required fields', async () => {
const { cookies } = session.defaultSession;
const name = '1';

View File

@@ -76,6 +76,21 @@ describe('shell module', () => {
requestReceived
]);
});
ifit(process.platform === 'darwin')('removes focus from the electron window after opening an external link', async () => {
const url = 'http://127.0.0.1';
const w = new BrowserWindow({ show: true });
await once(w, 'focus');
expect(w.isFocused()).to.be.true();
await Promise.all<void>([
shell.openExternal(url),
once(w, 'blur') as Promise<any>
]);
expect(w.isFocused()).to.be.false();
});
});
describe('shell.trashItem()', () => {

View File

@@ -58,10 +58,20 @@ describe('utilityProcess module', () => {
await once(child, 'spawn');
});
it('emits \'exit\' when child process exits gracefully', async () => {
it('emits \'exit\' when child process exits gracefully', (done) => {
const child = utilityProcess.fork(path.join(fixturesPath, 'empty.js'));
const [code] = await once(child, 'exit');
expect(code).to.equal(0);
child.on('exit', (code) => {
expect(code).to.equal(0);
done();
});
});
it('emits \'exit\' when the child process file does not exist', (done) => {
const child = utilityProcess.fork('nonexistent');
child.on('exit', (code) => {
expect(code).to.equal(1);
done();
});
});
ifit(!isWindows32Bit)('emits the correct error code when child process exits nonzero', async () => {

View File

@@ -15,7 +15,7 @@ import * as path from 'node:path';
import { setTimeout } from 'node:timers/promises';
import * as url from 'node:url';
import { ifit, ifdescribe, defer, itremote, listen } from './lib/spec-helpers';
import { ifit, ifdescribe, defer, itremote, listen, startRemoteControlApp } from './lib/spec-helpers';
import { closeAllWindows } from './lib/window-helpers';
import { PipeTransport } from './pipe-transport';
@@ -556,6 +556,38 @@ describe('command line switches', () => {
});
});
});
describe('--trace-startup switch', () => {
const outputFilePath = path.join(app.getPath('temp'), 'trace.json');
afterEach(() => {
if (fs.existsSync(outputFilePath)) {
fs.unlinkSync(outputFilePath);
}
});
// Disable the test on linux arm and arm64 to avoid startup crash
// https://github.com/electron/electron/issues/44293#issuecomment-2420077154
ifit(process.platform !== 'linux' || (process.arch !== 'arm' && process.arch !== 'arm64'))('creates startup trace', async () => {
const rc = await startRemoteControlApp(['--trace-startup=*', `--trace-startup-file=${outputFilePath}`, '--trace-startup-duration=1', '--enable-logging']);
const stderrComplete = new Promise<string>(resolve => {
let stderr = '';
rc.process.stderr!.on('data', (chunk) => {
stderr += chunk.toString('utf8');
});
rc.process.on('close', () => { resolve(stderr); });
});
rc.remotely(() => {
global.setTimeout(() => {
require('electron').app.quit();
}, 5000);
});
const stderr = await stderrComplete;
expect(stderr).to.match(/Completed startup tracing to/);
expect(fs.existsSync(outputFilePath)).to.be.true('output exists');
expect(fs.statSync(outputFilePath).size).to.be.above(0,
`the trace output file is empty, check "${outputFilePath}"`);
});
});
});
describe('chromium features', () => {

View File

@@ -7,12 +7,6 @@
<title>Document</title>
</head>
<body>
<script>
const { ipcRenderer } = require('electron')
ipcRenderer.send('initial-visibility-state', document.visibilityState)
document.addEventListener('visibilitychange', () => {
ipcRenderer.send(`visibility-change-${document.visibilityState}`)
})
</script>
<h1>Visibility Test</h1>
</body>
</html>

View File

@@ -149,7 +149,17 @@ app.whenReady().then(async () => {
const { getFiles } = require('./get-files');
const testFiles = await getFiles(__dirname, filter);
for (const file of testFiles.sort()) {
const VISIBILITY_SPEC = ('visibility-state-spec.ts');
const sortedFiles = testFiles.sort((a, b) => {
// If visibility-state-spec is in the list, move it to the first position
// so that it gets executed first to avoid other specs interferring with it.
if (a.indexOf(VISIBILITY_SPEC) > -1) {
return -1;
} else {
return a.localeCompare(b);
}
});
for (const file of sortedFiles) {
mocha.addFile(file);
}

View File

@@ -1,26 +1,37 @@
import { BaseWindow, BrowserWindow, BrowserWindowConstructorOptions, ipcMain, WebContents, WebContentsView } from 'electron/main';
import { BaseWindow, BrowserWindow, BrowserWindowConstructorOptions, WebContents, WebContentsView } from 'electron/main';
import { expect } from 'chai';
import * as cp from 'node:child_process';
import { once } from 'node:events';
import * as path from 'node:path';
import { setTimeout } from 'node:timers/promises';
import { ifdescribe } from './lib/spec-helpers';
import { closeWindow } from './lib/window-helpers';
import { ifdescribe, waitUntil } from './lib/spec-helpers';
import { closeAllWindows } from './lib/window-helpers';
// visibilityState specs pass on linux with a real window manager but on CI
// the environment does not let these specs pass
ifdescribe(process.platform !== 'linux')('document.visibilityState', () => {
let w: BaseWindow & {webContents: WebContents};
afterEach(() => {
return closeWindow(w);
before(() => {
for (const checkWin of BaseWindow.getAllWindows()) {
console.log('WINDOW EXISTS BEFORE TEST STARTED:', checkWin.title, checkWin.id);
}
});
afterEach(async () => {
await closeAllWindows();
w = null as unknown as BrowserWindow;
});
const load = () => w.webContents.loadFile(path.resolve(__dirname, 'fixtures', 'chromium', 'visibilitystate.html'));
async function haveVisibilityState (state: string) {
const docVisState = await w.webContents.executeJavaScript('document.visibilityState');
return docVisState === state;
}
const itWithOptions = (name: string, options: BrowserWindowConstructorOptions, fn: Mocha.Func) => {
it(name, async function (...args) {
w = new BrowserWindow({
@@ -32,6 +43,9 @@ ifdescribe(process.platform !== 'linux')('document.visibilityState', () => {
contextIsolation: false
}
});
if (options.show && process.platform === 'darwin') {
await once(w, 'show');
}
await Promise.resolve(fn.apply(this, args));
});
@@ -42,30 +56,30 @@ ifdescribe(process.platform !== 'linux')('document.visibilityState', () => {
const wcv = new WebContentsView({ webPreferences: { ...(options.webPreferences ?? {}), nodeIntegration: true, contextIsolation: false } });
baseWindow.contentView = wcv;
w = Object.assign(baseWindow, { webContents: wcv.webContents });
if (options.show && process.platform === 'darwin') {
await once(w, 'show');
}
await Promise.resolve(fn.apply(this, args));
});
};
itWithOptions('should be visible when the window is initially shown by default', {}, async () => {
load();
const [, state] = await once(ipcMain, 'initial-visibility-state');
expect(state).to.equal('visible');
await expect(waitUntil(async () => await haveVisibilityState('visible'))).to.eventually.be.fulfilled();
});
itWithOptions('should be visible when the window is initially shown', {
show: true
}, async () => {
load();
const [, state] = await once(ipcMain, 'initial-visibility-state');
expect(state).to.equal('visible');
await expect(waitUntil(async () => await haveVisibilityState('visible'))).to.eventually.be.fulfilled();
});
itWithOptions('should be hidden when the window is initially hidden', {
show: false
}, async () => {
load();
const [, state] = await once(ipcMain, 'initial-visibility-state');
expect(state).to.equal('hidden');
await expect(waitUntil(async () => await haveVisibilityState('hidden'))).to.eventually.be.fulfilled();
});
itWithOptions('should be visible when the window is initially hidden but shown before the page is loaded', {
@@ -73,52 +87,40 @@ ifdescribe(process.platform !== 'linux')('document.visibilityState', () => {
}, async () => {
w.show();
load();
const [, state] = await once(ipcMain, 'initial-visibility-state');
expect(state).to.equal('visible');
await expect(waitUntil(async () => await haveVisibilityState('visible'))).to.eventually.be.fulfilled();
});
itWithOptions('should be hidden when the window is initially shown but hidden before the page is loaded', {
show: true
}, async () => {
// TODO(MarshallOfSound): Figure out if we can work around this 1 tick issue for users
if (process.platform === 'darwin') {
// Wait for a tick, the window being "shown" takes 1 tick on macOS
await setTimeout(10000);
}
w.hide();
load();
const [, state] = await once(ipcMain, 'initial-visibility-state');
expect(state).to.equal('hidden');
await expect(waitUntil(async () => await haveVisibilityState('hidden'))).to.eventually.be.fulfilled();
});
itWithOptions('should be toggle between visible and hidden as the window is hidden and shown', {}, async () => {
load();
const [, initialState] = await once(ipcMain, 'initial-visibility-state');
expect(initialState).to.equal('visible');
await expect(waitUntil(async () => await haveVisibilityState('visible'))).to.eventually.be.fulfilled();
w.hide();
await once(ipcMain, 'visibility-change-hidden');
await expect(waitUntil(async () => await haveVisibilityState('hidden'))).to.eventually.be.fulfilled();
w.show();
await once(ipcMain, 'visibility-change-visible');
await expect(waitUntil(async () => await haveVisibilityState('visible'))).to.eventually.be.fulfilled();
});
itWithOptions('should become hidden when a window is minimized', {}, async () => {
load();
const [, initialState] = await once(ipcMain, 'initial-visibility-state');
expect(initialState).to.equal('visible');
await expect(waitUntil(async () => await haveVisibilityState('visible'))).to.eventually.be.fulfilled();
w.minimize();
const p = once(ipcMain, 'visibility-change-hidden');
w.minimize();
await p;
await expect(waitUntil(async () => await haveVisibilityState('hidden'))).to.eventually.be.fulfilled();
});
itWithOptions('should become visible when a window is restored', {}, async () => {
load();
const [, initialState] = await once(ipcMain, 'initial-visibility-state');
expect(initialState).to.equal('visible');
await expect(waitUntil(async () => await haveVisibilityState('visible'))).to.eventually.be.fulfilled();
w.minimize();
await once(ipcMain, 'visibility-change-hidden');
await expect(waitUntil(async () => await haveVisibilityState('hidden'))).to.eventually.be.fulfilled();
w.restore();
await once(ipcMain, 'visibility-change-visible');
await expect(waitUntil(async () => await haveVisibilityState('visible'))).to.eventually.be.fulfilled();
});
ifdescribe(process.platform === 'darwin')('on platforms that support occlusion detection', () => {
@@ -152,8 +154,7 @@ ifdescribe(process.platform !== 'linux')('document.visibilityState', () => {
height: 200
});
load();
const [, state] = await once(ipcMain, 'initial-visibility-state');
expect(state).to.equal('visible');
await expect(waitUntil(async () => await haveVisibilityState('visible'))).to.eventually.be.fulfilled();
});
itWithOptions('should be visible when two windows are on screen that overlap partially', {
@@ -169,8 +170,7 @@ ifdescribe(process.platform !== 'linux')('document.visibilityState', () => {
height: 200
});
load();
const [, state] = await once(ipcMain, 'initial-visibility-state');
expect(state).to.equal('visible');
await expect(waitUntil(async () => await haveVisibilityState('visible'))).to.eventually.be.fulfilled();
});
itWithOptions('should be hidden when a second window completely occludes the current window', {
@@ -181,15 +181,14 @@ ifdescribe(process.platform !== 'linux')('document.visibilityState', () => {
}, async function () {
this.timeout(240000);
load();
const [, state] = await once(ipcMain, 'initial-visibility-state');
expect(state).to.equal('visible');
await expect(waitUntil(async () => await haveVisibilityState('visible'))).to.eventually.be.fulfilled();
makeOtherWindow({
x: 0,
y: 0,
width: 300,
height: 300
});
await once(ipcMain, 'visibility-change-hidden');
await expect(waitUntil(async () => await haveVisibilityState('hidden'))).to.eventually.be.fulfilled();
});
});
});