Compare commits

..

1 Commits

Author SHA1 Message Date
Shelley Vohr
7c9db24885 fix: offscreen mode under window.open creation 2025-08-14 13:43:55 +02:00
127 changed files with 737 additions and 1429 deletions

View File

@@ -17,6 +17,9 @@ inputs:
is-release:
description: 'Is release build'
required: true
strip-binaries:
description: 'Strip binaries (Linux only)'
required: false
generate-symbols:
description: 'Generate symbols'
required: true
@@ -60,14 +63,22 @@ runs:
sudo launchctl limit maxfiles 65536 200000
fi
NINJA_SUMMARIZE_BUILD=1 e build
NINJA_SUMMARIZE_BUILD=1 e build -j $NUMBER_OF_NINJA_PROCESSES
cp out/Default/.ninja_log out/electron_ninja_log
node electron/script/check-symlinks.js
- name: Strip Electron Binaries ${{ inputs.step-suffix }}
shell: bash
if: ${{ inputs.strip-binaries == 'true' }}
run: |
cd src
electron/script/copy-debug-symbols.py --target-cpu="${{ inputs.target-arch }}" --out-dir=out/Default/debug --compress
electron/script/strip-binaries.py --target-cpu="${{ inputs.target-arch }}" --verbose
electron/script/add-debug-link.py --target-cpu="${{ inputs.target-arch }}" --debug-dir=out/Default/debug
- name: Build Electron dist.zip ${{ inputs.step-suffix }}
shell: bash
run: |
cd src
e build --target electron:electron_dist_zip
e build --target electron:electron_dist_zip -j $NUMBER_OF_NINJA_PROCESSES -d explain
if [ "${{ inputs.is-asan }}" != "true" ]; then
target_os=${{ inputs.target-platform == 'macos' && 'mac' || inputs.target-platform }}
if [ "${{ inputs.artifact-platform }}" = "mas" ]; then
@@ -79,7 +90,7 @@ runs:
shell: bash
run: |
cd src
e build --target electron:electron_mksnapshot
e build --target electron:electron_mksnapshot -j $NUMBER_OF_NINJA_PROCESSES
ELECTRON_DEPOT_TOOLS_DISABLE_LOG=1 e d gn desc out/Default v8:run_mksnapshot_default args > out/Default/mksnapshot_args
# Remove unused args from mksnapshot_args
SEDOPTION="-i"
@@ -89,7 +100,20 @@ runs:
sed $SEDOPTION '/.*builtins-pgo/d' out/Default/mksnapshot_args
sed $SEDOPTION '/--turbo-profiling-input/d' out/Default/mksnapshot_args
e build --target electron:electron_mksnapshot_zip
if [ "${{ inputs.target-platform }}" = "linux" ]; then
if [ "${{ inputs.target-arch }}" = "arm" ]; then
electron/script/strip-binaries.py --file $PWD/out/Default/clang_x86_v8_arm/mksnapshot
electron/script/strip-binaries.py --file $PWD/out/Default/clang_x86_v8_arm/v8_context_snapshot_generator
elif [ "${{ inputs.target-arch }}" = "arm64" ]; then
electron/script/strip-binaries.py --file $PWD/out/Default/clang_x64_v8_arm64/mksnapshot
electron/script/strip-binaries.py --file $PWD/out/Default/clang_x64_v8_arm64/v8_context_snapshot_generator
else
electron/script/strip-binaries.py --file $PWD/out/Default/mksnapshot
electron/script/strip-binaries.py --file $PWD/out/Default/v8_context_snapshot_generator
fi
fi
e build --target electron:electron_mksnapshot_zip -j $NUMBER_OF_NINJA_PROCESSES
if [ "${{ inputs.target-platform }}" = "win" ]; then
cd out/Default
powershell Compress-Archive -update mksnapshot_args mksnapshot.zip
@@ -123,7 +147,7 @@ runs:
shell: bash
run: |
cd src
e build --target electron:electron_chromedriver
e build --target electron:electron_chromedriver -j $NUMBER_OF_NINJA_PROCESSES
e build --target electron:electron_chromedriver_zip
- name: Build Node.js headers ${{ inputs.step-suffix }}
shell: bash
@@ -166,24 +190,24 @@ runs:
electron/script/zip-symbols.py -b $BUILD_PATH
fi
- name: Generate FFMpeg ${{ inputs.step-suffix }}
shell: bash
if: ${{ inputs.is-release == 'true' }}
shell: bash
run: |
cd src
gn gen out/ffmpeg --args="import(\"//electron/build/args/ffmpeg.gn\") use_remoteexec=true use_siso=true $GN_EXTRA_ARGS"
e build --target electron:electron_ffmpeg_zip -C ../../out/ffmpeg
gn gen out/ffmpeg --args="import(\"//electron/build/args/ffmpeg.gn\") use_remoteexec=true $GN_EXTRA_ARGS"
e build --target electron:electron_ffmpeg_zip -C ../../out/ffmpeg -j $NUMBER_OF_NINJA_PROCESSES
- name: Generate Hunspell Dictionaries ${{ inputs.step-suffix }}
shell: bash
if: ${{ inputs.is-release == 'true' && inputs.target-platform == 'linux' }}
run: |
e build --target electron:hunspell_dictionaries_zip
e build --target electron:hunspell_dictionaries_zip -j $NUMBER_OF_NINJA_PROCESSES
- name: Generate Libcxx ${{ inputs.step-suffix }}
shell: bash
if: ${{ inputs.is-release == 'true' && inputs.target-platform == 'linux' }}
run: |
e build --target electron:libcxx_headers_zip
e build --target electron:libcxxabi_headers_zip
e build --target electron:libcxx_objects_zip
e build --target electron:libcxx_headers_zip -j $NUMBER_OF_NINJA_PROCESSES
e build --target electron:libcxxabi_headers_zip -j $NUMBER_OF_NINJA_PROCESSES
e build --target electron:libcxx_objects_zip -j $NUMBER_OF_NINJA_PROCESSES
- name: Remove Clang problem matcher
shell: bash
run: echo "::remove-matcher owner=clang::"
@@ -206,26 +230,7 @@ runs:
echo 'Uploading Electron release distribution to GitHub releases'
script/release/uploaders/upload.py --verbose
fi
- name: Generate siso report
if: ${{ inputs.target-platform != 'win' && !cancelled() }}
shell: bash
run: |
cd src
e d siso report -C out/Default > siso_report.txt
SISO_REPORT_PATH=$(grep -o '/.*siso-report-[^ ]*' siso_report.txt)
echo "SISO_REPORT_PATH=$SISO_REPORT_PATH" >> $GITHUB_ENV
- name: Generate siso report (Windows)
if: ${{ inputs.target-platform == 'win' && !cancelled() }}
shell: powershell
run: |
cd src
e d siso report -C out\Default > siso_report.txt
$SISO_REPORT_PATH = Get-Content "siso_report.txt" | Select-String "report file:\s*(.+)" | ForEach-Object {
$_.Matches.Groups[1].Value.Trim()
}
echo "SISO_REPORT_PATH=$SISO_REPORT_PATH" >> $env:GITHUB_ENV
- name: Generate Artifact Key
if: always() && !cancelled()
shell: bash
run: |
if [ "${{ inputs.is-asan }}" = "true" ]; then
@@ -237,11 +242,9 @@ runs:
# The current generated_artifacts_<< artifact.key >> name was taken from CircleCI
# to ensure we don't break anything, but we may be able to improve that.
- name: Move all Generated Artifacts to Upload Folder ${{ inputs.step-suffix }}
if: always() && !cancelled()
shell: bash
run: ./src/electron/script/actions/move-artifacts.sh
- name: Upload Generated Artifacts ${{ inputs.step-suffix }}
if: always() && !cancelled()
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808
with:
name: generated_artifacts_${{ env.ARTIFACT_KEY }}

View File

@@ -14,9 +14,6 @@ inputs:
description: 'Target platform, should be linux, win, macos'
package:
description: 'Package to install'
dependency-version:
description: 'Version of the dependency to install'
default: ''
runs:
using: "composite"
steps:
@@ -25,23 +22,15 @@ runs:
run : |
rm -rf ${{ inputs.cipd-root-prefix-path }}${{ inputs.installation-dir }}
- name: Create ensure file for ${{ inputs.dependency }}
if: ${{ inputs.dependency-version == '' }}
shell: bash
run: |
echo '${{ inputs.package }}' `e d gclient getdep --deps-file=${{ inputs.deps-file }} -r '${{ inputs.installation-dir }}:${{ inputs.package }}'` > ${{ inputs.dependency }}_ensure_file
cat ${{ inputs.dependency }}_ensure_file
- name: Create ensure file for ${{ inputs.dependency }} from dependency-version
if: ${{ inputs.dependency-version != '' }}
shell: bash
run: |
echo '${{ inputs.package }} ${{ inputs.dependency-version }}' > ${{ inputs.dependency }}_ensure_file
cat ${{ inputs.dependency }}_ensure_file
- name: CIPD installation of ${{ inputs.dependency }} (macOS)
if: ${{ inputs.target-platform != 'win' }}
if: ${{ inputs.target-platform == 'macos' }}
shell: bash
run: |
echo "ensuring ${{ inputs.dependency }}"
echo "ensuring ${{ inputs.dependency }} on macOS"
e d cipd ensure --root ${{ inputs.cipd-root-prefix-path }}${{ inputs.installation-dir }} -ensure-file ${{ inputs.dependency }}_ensure_file
- name: CIPD installation of ${{ inputs.dependency }} (Windows)
if: ${{ inputs.target-platform == 'win' }}

View File

@@ -20,13 +20,11 @@ runs:
using: "composite"
steps:
- name: Fix clang
if: ${{ inputs.target-platform != 'linux' }}
shell: bash
run : |
rm -rf src/third_party/llvm-build
python3 src/tools/clang/scripts/update.py
- name: Fix esbuild
if: ${{ inputs.target-platform != 'linux' }}
uses: ./src/electron/.github/actions/cipd-install
with:
cipd-root-prefix-path: src/third_party/devtools-frontend/src/
@@ -36,7 +34,6 @@ runs:
target-platform: ${{ inputs.target-platform }}
package: infra/3pp/tools/esbuild/${platform}
- name: Fix rustc
if: ${{ inputs.target-platform != 'linux' }}
shell: bash
run : |
rm -rf src/third_party/rust-toolchain
@@ -60,7 +57,6 @@ runs:
target-platform: ${{ inputs.target-platform }}
package: gn/gn/windows-amd64
- name: Fix reclient
if: ${{ inputs.target-platform != 'linux' }}
uses: ./src/electron/.github/actions/cipd-install
with:
dependency: reclient
@@ -69,7 +65,6 @@ runs:
target-platform: ${{ inputs.target-platform }}
package: infra/rbe/client/${platform}
- name: Configure reclient configs
if: ${{ inputs.target-platform != 'linux' }}
shell: bash
run : |
python3 src/buildtools/reclient_cfgs/configure_reclient_cfgs.py --rbe_instance "projects/rbe-chrome-untrusted/instances/default_instance" --reproxy_cfg_template reproxy.cfg.template --rewrapper_cfg_project "" --skip_remoteexec_cfg_fetch
@@ -87,7 +82,6 @@ runs:
python3 src/third_party/depot_tools/download_from_google_storage.py --no_resume --no_auth --bucket chromium-browser-clang -s $DSYM_SHA_FILE -o src/tools/clang/dsymutil/bin/dsymutil
fi
- name: Fix ninja
if: ${{ inputs.target-platform != 'linux' }}
uses: ./src/electron/.github/actions/cipd-install
with:
dependency: ninja
@@ -96,20 +90,10 @@ runs:
target-platform: ${{ inputs.target-platform }}
package: infra/3pp/tools/ninja/${platform}
- name: Set ninja in path
if: ${{ inputs.target-platform != 'linux' }}
shell: bash
run : |
echo "$(pwd)/src/third_party/ninja" >> $GITHUB_PATH
- name: Fix siso
uses: ./src/electron/.github/actions/cipd-install
with:
dependency: siso
deps-file: src/DEPS
installation-dir: src/third_party/siso/cipd
target-platform: ${{ inputs.target-platform }}
package: infra/build/siso/${platform}
- name: Fixup angle git
if: ${{ inputs.target-platform != 'linux' }}
shell: bash
run : |
cd src/third_party/angle

View File

@@ -13,9 +13,8 @@ runs:
git config --global core.fscache true
git config --global core.longpaths true
git config --global core.preloadindex true
git config --global core.longpaths true
fi
export BUILD_TOOLS_SHA=8559e5d325d61f195a255f41077ffc9e5b70b0e5
export BUILD_TOOLS_SHA=6e8526315ea3b4828882497e532b8340e64e053c
npm i -g @electron/build-tools
# Update depot_tools to ensure python
e d update_depot_tools

View File

@@ -97,7 +97,7 @@ runs:
$TEMP_DIR=New-Item -ItemType Directory -Path temp-cache
$TEMP_DIR_PATH = $TEMP_DIR.FullName
C:\ProgramData\Chocolatey\bin\7z.exe -y -snld20 x $src_cache -o"$TEMP_DIR_PATH"
C:\ProgramData\Chocolatey\bin\7z.exe -y -snld x $src_cache -o"$TEMP_DIR_PATH"
- name: Move Src Cache (Windows)
if: ${{ inputs.target-platform == 'win' }}

View File

@@ -6,10 +6,10 @@ inputs:
required: true
default: 'false'
timeout:
description: 'SSH session timeout in seconds'
description: 'SSH session timeout in minutes'
required: false
type: number
default: 3600
default: 60
runs:
using: composite
steps:

View File

@@ -1,20 +1,44 @@
#!/bin/bash -e
if [ "${TUNNEL}" != "true" ]; then
get_authorized_keys() {
if [ -z "$AUTHORIZED_USERS" ] || ! echo "$AUTHORIZED_USERS" | grep -q "\b$GITHUB_ACTOR\b"; then
return 1
fi
api_response=$(curl -s "https://api.github.com/users/$GITHUB_ACTOR/keys")
if echo "$api_response" | jq -e 'type == "object" and has("message")' >/dev/null; then
error_msg=$(echo "$api_response" | jq -r '.message')
echo "Error: $error_msg"
return 1
else
echo "$api_response" | jq -r '.[].key'
fi
}
authorized_keys=$(get_authorized_keys "$GITHUB_ACTOR")
if [ -n "$authorized_keys" ]; then
echo "Configured SSH key(s) for user: $GITHUB_ACTOR"
else
echo "Error: User '$GITHUB_ACTOR' is not authorized to access this debug session."
echo "Authorized users: $AUTHORIZED_USERS"
exit 1
fi
if [ "$TUNNEL" != "true" ]; then
echo "SSH tunneling is disabled. Set enable-tunnel: true to enable remote access."
echo "Local SSH server would be available on localhost:2222 if this were a local environment."
exit 0
fi
echo ::group::Configuring Tunnel
echo "SSH tunneling enabled. Setting up remote access..."
EXTERNAL_DEPS="curl jq ssh-keygen"
for dep in $EXTERNAL_DEPS; do
if ! command -v "${dep}" > /dev/null 2>&1; then
echo "Command ${dep} not installed on the system!" >&2
if ! command -v "$dep" > /dev/null 2>&1; then
echo "Command $dep not installed on the system!" >&2
exit 1
fi
done
@@ -24,21 +48,22 @@ cd "$GITHUB_ACTION_PATH"
bashrc_path=$(pwd)/bashrc
# Source `bashrc` to auto start tmux on SSH login.
if ! grep -q "${bashrc_path}" ~/.bash_profile; then
if ! grep -q "$bashrc_path" ~/.bash_profile; then
echo >> ~/.bash_profile # On macOS runner there's no newline at the end of the file
echo "source \"${bashrc_path}\"" >> ~/.bash_profile
echo "source \"$bashrc_path\"" >> ~/.bash_profile
fi
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m)
if [ "${ARCH}" = "x86_64" ]; then
if [ "$ARCH" = "x86_64" ]; then
ARCH="amd64"
elif [ "${ARCH}" = "aarch64" ]; then
elif [ "$ARCH" = "aarch64" ]; then
ARCH="arm64"
fi
if [ "${OS}" = "darwin" ] && ! command -v tmux > /dev/null 2>&1; then
# Install tmux on macOS runners if not present.
if [ "$OS" = "darwin" ] && ! command -v tmux > /dev/null 2>&1; then
echo "Installing tmux..."
brew install tmux
fi
@@ -46,80 +71,47 @@ fi
if [ "$OS" = "darwin" ]; then
cloudflared_url="https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-${OS}-${ARCH}.tgz"
echo "Downloading \`cloudflared\` from <$cloudflared_url>..."
curl --location --silent --output cloudflared.tgz "${cloudflared_url}"
curl --location --silent --output cloudflared.tgz "$cloudflared_url"
tar xf cloudflared.tgz
rm cloudflared.tgz
else
cloudflared_url="https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-${OS}-${ARCH}"
echo "Downloading \`cloudflared\` from <$cloudflared_url>..."
curl --location --silent --output cloudflared "$cloudflared_url"
fi
chmod +x cloudflared
echo "Setting up SSH key for authorized user: $GITHUB_ACTOR"
echo "$authorized_keys" > authorized_keys
echo 'Creating SSH server key...'
ssh-keygen -q -f ssh_host_rsa_key -N ''
echo 'Creating SSH server config...'
sed "s,\$PWD,${PWD},;s,\$USER,${USER}," sshd_config.template > sshd_config
sed "s,\$PWD,$PWD,;s,\$USER,$USER," sshd_config.template > sshd_config
echo 'Starting SSH server...'
sudo /usr/sbin/sshd -f sshd_config -D &
/usr/sbin/sshd -f sshd_config -D &
sshd_pid=$!
echo "SSH server started successfully (PID: ${sshd_pid})"
echo 'Starting tmux session...'
(cd "${GITHUB_WORKSPACE}" && tmux new-session -d -s debug)
(cd "$GITHUB_WORKSPACE" && tmux new-session -d -s debug)
mkdir ~/.cloudflared
CLEAN_TUNNEL_CERT=$(printf '%s\n' "${CLOUDFLARE_TUNNEL_CERT}" | tr -d '\r' | sed '/^[[:space:]]*$/d')
echo "${CLEAN_TUNNEL_CERT}" > ~/.cloudflared/cert.pem
CLEAN_USER_CA_CERT=$(printf '%s\n' "${CLOUDFLARE_USER_CA_CERT}" | tr -d '\r' | sed '/^[[:space:]]*$/d')
echo "${CLEAN_USER_CA_CERT}" | sudo tee /etc/ssh/ca.pub > /dev/null
sudo chmod 644 /etc/ssh/ca.pub
random_suffix=$(openssl rand -hex 5 | cut -c1-10)
tunnel_name="${GITHUB_SHA}-${GITHUB_RUN_ID}-${random_suffix}"
tunnel_url="${tunnel_name}.${CLOUDFLARE_TUNNEL_HOSTNAME}"
if ./cloudflared tunnel list | grep -q "${tunnel_name}"; then
echo "Deleting existing tunnel: ${tunnel_name}"
./cloudflared tunnel delete ${tunnel_name}
fi
echo "Creating new cloudflare tunnel: ${tunnel_name}"
./cloudflared tunnel create ${tunnel_name}
credentials_file=$(find ~/.cloudflared -name "*.json" | head -n 1)
if [ -z "${credentials_file}" ]; then
echo "Error: Could not find tunnel credentials file"
#if no cloudflare tunnel token is provided, exit
if [ -z "$CLOUDFLARE_TUNNEL_TOKEN" ]; then
echo "Error: required CLOUDFLARE_TUNNEL_TOKEN not found"
exit 1
fi
echo "Found credentials file: ${credentials_file}"
echo 'Starting Cloudflare tunnel...'
echo 'Creating tunnel configuration...'
cat > tunnel_config.yml << EOF
tunnel: ${tunnel_name}
credentials-file: ${credentials_file}
ingress:
- hostname: ${tunnel_url}
service: ssh://localhost:2222
- service: http_status:404
EOF
echo 'Setting up DNS routing for tunnel...'
./cloudflared tunnel route dns ${tunnel_name} ${tunnel_url}
echo 'Running cloudflare tunnel...'
./cloudflared tunnel --no-autoupdate --config tunnel_config.yml run 2>&1 | tee cloudflared.log | sed -u 's/^/cloudflared: /' &
./cloudflared tunnel --no-autoupdate run --token "$CLOUDFLARE_TUNNEL_TOKEN" 2>&1 | tee cloudflared.log | sed -u 's/^/cloudflared: /' &
cloudflared_pid=$!
echo ::endgroup::
echo ::notice title=SSH Debug Session Ready::ssh ${tunnel_url}
url="$TUNNEL_HOSTNAME"
public_key=$(cut -d' ' -f1,2 < ssh_host_rsa_key.pub)
(
echo ' '
@@ -127,20 +119,22 @@ echo ::notice title=SSH Debug Session Ready::ssh ${tunnel_url}
echo '🔗 SSH Debug Session Ready!'
echo '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'
echo ' '
echo '📋 Infra WG can copy and run this command to connect:'
echo '📋 Copy and run this command to connect:'
echo ' '
echo "ssh ${tunnel_url}"
if [ -n "$TUNNEL_HOSTNAME" ]; then
echo "ssh-keygen -R action-ssh-debug && echo 'action-ssh-debug $public_key' >> ~/.ssh/known_hosts && ssh -o ProxyCommand='cloudflared access tcp --hostname $url' runner@action-ssh-debug"
else
echo "ssh-keygen -R action-ssh-debug && echo 'action-ssh-debug $public_key' >> ~/.ssh/known_hosts && ssh -o ProxyCommand='cloudflared access tcp --hostname $url' runner@action-ssh-debug"
fi
echo ' '
echo "⏰ Session expires automatically in ${TIMEOUT} seconds"
echo "⏰ Session expires automatically in $TIMEOUT minutes"
echo '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'
echo ' '
echo ' '
) | cat
echo ::group::Starting Background Session
echo 'Starting SSH session in background...'
./ssh-session.sh "${sshd_pid}" "${cloudflared_pid}" "${TIMEOUT}" "${tunnel_name}" &
./ssh-session.sh "$sshd_pid" "$cloudflared_pid" $TIMEOUT &
echo 'SSH session is running in background. GitHub Action will continue.'
echo 'Session will auto-cleanup after timeout or when processes end.'
echo ::endgroup::

View File

@@ -2,51 +2,20 @@
SSHD_PID=$1
CLOUDFLARED_PID=$2
SESSION_TIMEOUT=${3:-10000}
TUNNEL_NAME=$4
cleanup() {
# Kill processes.
for pid in "$SLEEP_PID" "$SSHD_PID" "$CLOUDFLARED_PID"; do
if [ -n "$pid" ] && kill -0 "$pid" 2>/dev/null; then
kill "$pid" 2>/dev/null || true
fi
done
# Clean up tunnel.
if [ -n "$TUNNEL_NAME" ]; then
cd "$GITHUB_ACTION_PATH"
./cloudflared tunnel delete "$TUNNEL_NAME" 2>/dev/null || {
echo "Failed to delete tunnel"
}
fi
echo "Session ended at $(date)"
exit 0
}
# Trap signals to ensure cleanup.
trap cleanup SIGTERM SIGINT SIGQUIT SIGHUP EXIT
SESSION_TIMEOUT=${3:-3600}
# Wait for timeout or until processes die.
sleep "$SESSION_TIMEOUT" &
SLEEP_PID=$!
# Monitor processes
while kill -0 "$SLEEP_PID" 2>/dev/null; do
# Check SSH daemon.
if ! kill -0 "$SSHD_PID" 2>/dev/null; then
echo "SSH daemon died at $(date)"
break
fi
# Check cloudflared,
if ! kill -0 "$CLOUDFLARED_PID" 2>/dev/null; then
echo "Cloudflared died at $(date)"
break
fi
sleep 10
# Monitor if SSH or cloudflared dies early.
while kill -0 "$SSHD_PID" 2>/dev/null && kill -0 "$CLOUDFLARED_PID" 2>/dev/null && kill -0 "$SLEEP_PID" 2>/dev/null; do
sleep 10
done
cleanup
# Cleanup.
kill "$SLEEP_PID" 2>/dev/null || true
kill "$SSHD_PID" 2>/dev/null || true
kill "$CLOUDFLARED_PID" 2>/dev/null || true
echo "SSH session ended"

View File

@@ -2,24 +2,8 @@ Port 2222
HostKey $PWD/ssh_host_rsa_key
PidFile $PWD/sshd.pid
# Connection settings
ClientAliveInterval 30
ClientAliveCountMax 10
MaxStartups 10
LoginGraceTime 120
# Only allow single user
AllowUsers $USER
# Allow TCP forwarding for tunneling
AllowTcpForwarding yes
# Try to prevent timeouts
TCPKeepAlive yes
# Security
TrustedUserCAKeys /etc/ssh/ca.pub
PubkeyAuthentication yes
PasswordAuthentication no
AuthorizedPrincipalsCommand /bin/bash -c "echo '%t %k' | ssh-keygen -L -f - | grep -A1 Principals"
AuthorizedPrincipalsCommandUser nobody
PubkeyAcceptedKeyTypes ssh-rsa,ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,rsa-sha2-512-cert-v01@openssh.com
# Only allow those keys
AuthorizedKeysFile $PWD/authorized_keys

View File

@@ -28,11 +28,6 @@ on:
description: 'Skip lint check'
default: false
required: false
enable-ssh:
description: 'Enable SSH debugging'
required: false
type: boolean
default: false
push:
branches:
- main
@@ -86,11 +81,11 @@ jobs:
# Docs Only Jobs
docs-only:
needs: [setup, checkout-linux]
needs: setup
if: ${{ needs.setup.outputs.docs-only == 'true' }}
uses: ./.github/workflows/pipeline-electron-docs-only.yml
with:
container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}'
container: '{"image":"ghcr.io/electron/build:${{ needs.setup.outputs.build-image-sha }}","options":"--user root"}'
secrets: inherit
# Checkout Jobs
@@ -124,7 +119,7 @@ jobs:
checkout-linux:
needs: setup
if: ${{ !inputs.skip-linux}}
if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-linux}}
runs-on: electron-arc-centralus-linux-amd64-32core
container:
image: ghcr.io/electron/build:${{ needs.setup.outputs.build-image-sha }}
@@ -193,7 +188,6 @@ jobs:
linux-gn-check:
uses: ./.github/workflows/pipeline-segment-electron-gn-check.yml
needs: checkout-linux
if: ${{ needs.setup.outputs.src == 'true' }}
with:
target-platform: linux
target-archs: x64 arm arm64
@@ -230,7 +224,6 @@ jobs:
gn-build-type: testing
generate-symbols: false
upload-to-storage: '0'
enable-ssh: ${{ inputs.enable-ssh || false }}
secrets: inherit
macos-arm64:
@@ -249,7 +242,6 @@ jobs:
gn-build-type: testing
generate-symbols: false
upload-to-storage: '0'
enable-ssh: ${{ inputs.enable-ssh || false }}
secrets: inherit
linux-x64:
@@ -259,7 +251,6 @@ jobs:
pull-requests: read
uses: ./.github/workflows/pipeline-electron-build-and-test-and-nan.yml
needs: checkout-linux
if: ${{ needs.setup.outputs.src == 'true' }}
with:
build-runs-on: electron-arc-centralus-linux-amd64-32core
test-runs-on: electron-arc-centralus-linux-amd64-4core
@@ -280,7 +271,6 @@ jobs:
pull-requests: read
uses: ./.github/workflows/pipeline-electron-build-and-test.yml
needs: checkout-linux
if: ${{ needs.setup.outputs.src == 'true' }}
with:
build-runs-on: electron-arc-centralus-linux-amd64-32core
test-runs-on: electron-arc-centralus-linux-amd64-4core
@@ -302,7 +292,6 @@ jobs:
pull-requests: read
uses: ./.github/workflows/pipeline-electron-build-and-test.yml
needs: checkout-linux
if: ${{ needs.setup.outputs.src == 'true' }}
with:
build-runs-on: electron-arc-centralus-linux-amd64-32core
test-runs-on: electron-arc-centralus-linux-arm64-4core
@@ -323,10 +312,9 @@ jobs:
pull-requests: read
uses: ./.github/workflows/pipeline-electron-build-and-test.yml
needs: checkout-linux
if: ${{ needs.setup.outputs.src == 'true' }}
with:
build-runs-on: electron-arc-centralus-linux-amd64-32core
test-runs-on: ubuntu-22.04-arm
test-runs-on: electron-arc-centralus-linux-arm64-4core
build-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}'
test-container: '{"image":"ghcr.io/electron/test:arm64v8-${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root --privileged --init"}'
target-platform: linux
@@ -385,7 +373,7 @@ jobs:
if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-windows }}
with:
build-runs-on: electron-arc-centralus-windows-amd64-16core
test-runs-on: windows-11-arm
test-runs-on: electron-hosted-windows-arm64-4core
target-platform: win
target-arch: arm64
is-release: false

View File

@@ -50,6 +50,7 @@ jobs:
is-release: true
gn-build-type: release
generate-symbols: true
strip-binaries: true
upload-to-storage: ${{ inputs.upload-to-storage }}
secrets: inherit
@@ -65,6 +66,7 @@ jobs:
is-release: true
gn-build-type: release
generate-symbols: true
strip-binaries: true
upload-to-storage: ${{ inputs.upload-to-storage }}
secrets: inherit
@@ -80,5 +82,6 @@ jobs:
is-release: true
gn-build-type: release
generate-symbols: true
strip-binaries: true
upload-to-storage: ${{ inputs.upload-to-storage }}
secrets: inherit

View File

@@ -54,11 +54,6 @@ on:
required: false
type: boolean
default: false
enable-ssh:
description: 'Enable SSH debugging'
required: false
type: boolean
default: false
concurrency:
group: electron-build-and-test-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ github.ref_protected == true && github.run_id || github.ref }}
@@ -81,8 +76,7 @@ jobs:
gn-build-type: ${{ inputs.gn-build-type }}
generate-symbols: ${{ inputs.generate-symbols }}
upload-to-storage: ${{ inputs.upload-to-storage }}
is-asan: ${{ inputs.is-asan }}
enable-ssh: ${{ inputs.enable-ssh }}
is-asan: ${{ inputs.is-asan}}
secrets: inherit
test:
uses: ./.github/workflows/pipeline-segment-electron-test.yml
@@ -92,6 +86,5 @@ jobs:
target-platform: ${{ inputs.target-platform }}
test-runs-on: ${{ inputs.test-runs-on }}
test-container: ${{ inputs.test-container }}
is-asan: ${{ inputs.is-asan }}
enable-ssh: ${{ inputs.enable-ssh }}
is-asan: ${{ inputs.is-asan}}
secrets: inherit

View File

@@ -12,9 +12,6 @@ concurrency:
group: electron-docs-only-${{ github.ref }}
cancel-in-progress: true
env:
GCLIENT_EXTRA_ARGS: --custom-var=checkout_arm=True --custom-var=checkout_arm64=True
jobs:
docs-only:
name: Docs Only Compile
@@ -22,22 +19,6 @@ jobs:
timeout-minutes: 20
container: ${{ fromJSON(inputs.container) }}
steps:
- name: Checkout Electron
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
path: src/electron
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Generate DEPS Hash
run: |
node src/electron/script/generate-deps-hash.js
DEPSHASH=v1-src-cache-$(cat src/electron/.depshash)
echo "DEPSHASH=$DEPSHASH" >> $GITHUB_ENV
echo "CACHE_PATH=$DEPSHASH.tar" >> $GITHUB_ENV
- name: Restore src cache via AKS
uses: ./src/electron/.github/actions/restore-cache-aks
with:
target-platform: linux
- name: Checkout Electron
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:

View File

@@ -48,16 +48,17 @@ on:
required: true
type: string
default: '0'
strip-binaries:
description: 'Strip the binaries before release (Linux only)'
required: false
type: boolean
default: false
is-asan:
description: 'Building the Address Sanitizer (ASan) Linux build'
required: false
type: boolean
default: false
enable-ssh:
description: 'Enable SSH debugging'
required: false
type: boolean
default: false
concurrency:
group: electron-build-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ inputs.target-variant }}-${{ inputs.is-asan }}-${{ github.ref_protected == true && github.run_id || github.ref }}
@@ -95,16 +96,14 @@ jobs:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Setup SSH Debugging
if: ${{ inputs.target-platform == 'macos' && (inputs.enable-ssh || env.ACTIONS_STEP_DEBUG == 'true') }}
if: ${{ inputs.target-platform == 'macos' && env.ACTIONS_STEP_DEBUG == 'true' }}
uses: ./src/electron/.github/actions/ssh-debug
with:
tunnel: 'true'
env:
CLOUDFLARE_TUNNEL_CERT: ${{ secrets.CLOUDFLARE_TUNNEL_CERT }}
CLOUDFLARE_TUNNEL_HOSTNAME: ${{ vars.CLOUDFLARE_TUNNEL_HOSTNAME }}
CLOUDFLARE_USER_CA_CERT: ${{ secrets.CLOUDFLARE_USER_CA_CERT }}
CLOUDFLARE_TUNNEL_TOKEN: ${{ secrets.CLOUDFLARE_TUNNEL_TOKEN }}
TUNNEL_HOSTNAME: ${{ secrets.CLOUDFLARED_SSH_HOSTNAME }}
AUTHORIZED_USERS: ${{ secrets.SSH_DEBUG_AUTHORIZED_USERS }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Free up space (macOS)
if: ${{ inputs.target-platform == 'macos' }}
uses: ./src/electron/.github/actions/free-space-macos
@@ -171,7 +170,7 @@ jobs:
ELECTRON_DEPOT_TOOLS_DISABLE_LOG: true
- 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 }} --remote-build siso
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: |
e d gclient runhooks --spec="solutions=[{'name':'src/electron','url':None,'deps_file':'DEPS','custom_vars':{'process_deps':False},'managed':False}]"
@@ -181,6 +180,9 @@ jobs:
echo "DEPSHASH=$(cat src/electron/.depshash)" >> $GITHUB_ENV
- name: Add CHROMIUM_BUILDTOOLS_PATH to env
run: echo "CHROMIUM_BUILDTOOLS_PATH=$(pwd)/src/buildtools" >> $GITHUB_ENV
- name: Setup Number of Ninja Processes
run: |
echo "NUMBER_OF_NINJA_PROCESSES=${{ inputs.target-platform != 'macos' && '300' || '200' }}" >> $GITHUB_ENV
- name: Free up space (macOS)
if: ${{ inputs.target-platform == 'macos' }}
uses: ./src/electron/.github/actions/free-space-macos
@@ -193,6 +195,7 @@ jobs:
artifact-platform: ${{ inputs.target-platform == 'macos' && 'darwin' || inputs.target-platform }}
is-release: '${{ inputs.is-release }}'
generate-symbols: '${{ inputs.generate-symbols }}'
strip-binaries: '${{ inputs.strip-binaries }}'
upload-to-storage: '${{ inputs.upload-to-storage }}'
is-asan: '${{ inputs.is-asan }}'
- name: Set GN_EXTRA_ARGS for MAS Build

View File

@@ -25,11 +25,6 @@ on:
required: false
type: boolean
default: false
enable-ssh:
description: 'Enable SSH debugging'
required: false
type: boolean
default: false
concurrency:
group: electron-test-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ inputs.is-asan }}-${{ github.ref_protected == true && github.run_id || github.ref }}
@@ -68,6 +63,21 @@ jobs:
if: ${{ inputs.target-arch == 'arm' && inputs.target-platform == 'linux' }}
run: |
cp $(which node) /mnt/runner-externals/node20/bin/
- name: Install Git on Windows arm64 runners
if: ${{ inputs.target-arch == 'arm64' && inputs.target-platform == 'win' }}
shell: powershell
run: |
Set-ExecutionPolicy Bypass -Scope Process -Force
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
choco install -y --no-progress git.install --params "'/GitAndUnixToolsOnPath'"
choco install -y --no-progress git
choco install -y --no-progress python --version 3.11.9
choco install -y --no-progress visualstudio2022-workload-vctools --package-parameters "--add Microsoft.VisualStudio.Component.VC.Tools.ARM64"
echo "C:\Program Files\Git\cmd" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "C:\Program Files\Git\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "C:\Python311" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
cp "C:\Python311\python.exe" "C:\Python311\python3.exe"
- name: Setup Node.js/npm
if: ${{ inputs.target-platform == 'win' }}
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a
@@ -118,16 +128,14 @@ jobs:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Setup SSH Debugging
if: ${{ inputs.target-platform == 'macos' && (inputs.enable-ssh || env.ACTIONS_STEP_DEBUG == 'true') }}
if: ${{ inputs.target-platform == 'macos' && env.ACTIONS_STEP_DEBUG == 'true' }}
uses: ./src/electron/.github/actions/ssh-debug
with:
tunnel: 'true'
env:
CLOUDFLARE_TUNNEL_CERT: ${{ secrets.CLOUDFLARE_TUNNEL_CERT }}
CLOUDFLARE_TUNNEL_HOSTNAME: ${{ vars.CLOUDFLARE_TUNNEL_HOSTNAME }}
CLOUDFLARE_USER_CA_CERT: ${{ secrets.CLOUDFLARE_USER_CA_CERT }}
CLOUDFLARE_TUNNEL_TOKEN: ${{ secrets.CLOUDFLARE_TUNNEL_TOKEN }}
TUNNEL_HOSTNAME: ${{ secrets.CLOUDFLARED_SSH_HOSTNAME }}
AUTHORIZED_USERS: ${{ secrets.SSH_DEBUG_AUTHORIZED_USERS }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install Dependencies
uses: ./src/electron/.github/actions/install-dependencies
- name: Set Chromium Git Cookie
@@ -141,7 +149,6 @@ jobs:
git config --global core.fscache true
git config --global core.longpaths true
git config --global core.preloadindex true
git config --global core.longpaths true
git clone --filter=tree:0 https://chromium.googlesource.com/chromium/tools/depot_tools.git
# Ensure depot_tools does not update.
test -d depot_tools && cd depot_tools

110
BUILD.gn
View File

@@ -44,7 +44,6 @@ if (is_mac) {
if (is_linux) {
import("//build/config/linux/pkg_config.gni")
import("//electron/build/linux/strip_binary.gni")
import("//tools/generate_stubs/rules.gni")
pkg_config("gio_unix") {
@@ -519,10 +518,6 @@ source_set("electron_lib") {
"//v8:v8_libplatform",
]
if (v8_use_external_startup_data && use_v8_context_snapshot) {
deps += [ ":mksnapshot_checksum_gen" ]
}
public_deps = [
"//base",
"//base:i18n",
@@ -777,14 +772,6 @@ source_set("electron_lib") {
}
}
action("mksnapshot_checksum_gen") {
script = "build/checksum_header.py"
outputs = [ "$target_gen_dir/snapshot_checksum.h" ]
inputs = [ "$root_out_dir/$v8_context_snapshot_filename" ]
args = rebase_path(inputs) + rebase_path(outputs)
deps = [ "//tools/v8_context_snapshot" ]
}
electron_paks("packed_resources") {
if (is_mac) {
output_dir = "$root_gen_dir/electron_repack"
@@ -1422,18 +1409,6 @@ dist_zip("electron_dist_zip") {
":licenses",
]
if (is_linux) {
if (is_official_build) {
data_deps += [
":strip_chrome_crashpad_handler",
":strip_chrome_sandbox",
":strip_electron_binary",
":strip_libEGL_shlib",
":strip_libGLESv2_shlib",
":strip_libffmpeg_shlib",
":strip_libvk_swiftshader_shlib",
]
}
data_deps += [ "//sandbox/linux:chrome_sandbox" ]
}
deps = data_deps
@@ -1479,16 +1454,6 @@ group("electron_mksnapshot") {
dist_zip("electron_mksnapshot_zip") {
data_deps = mksnapshot_deps
if (is_linux && is_official_build) {
data_deps += [
":strip_libEGL_shlib",
":strip_libGLESv2_shlib",
":strip_libffmpeg_shlib",
":strip_libvk_swiftshader_shlib",
":strip_mksnapshot_binary",
":strip_v8_context_snapshot_generator_binary",
]
}
deps = data_deps
outputs = [ "$root_build_dir/mksnapshot.zip" ]
}
@@ -1613,78 +1578,3 @@ group("copy_node_headers") {
group("node_headers") {
public_deps = [ ":tar_node_headers" ]
}
if (is_linux && is_official_build) {
strip_binary("strip_electron_binary") {
binary_input = "$root_out_dir/$electron_project_name"
symbol_output = "$root_out_dir/debug/$electron_project_name.debug"
compress_debug_sections = true
deps = [ ":electron_app" ]
}
strip_binary("strip_chrome_crashpad_handler") {
binary_input = "$root_out_dir/chrome_crashpad_handler"
symbol_output = "$root_out_dir/debug/chrome_crashpad_handler.debug"
compress_debug_sections = true
deps = [ "//components/crash/core/app:chrome_crashpad_handler" ]
}
strip_binary("strip_chrome_sandbox") {
binary_input = "$root_out_dir/chrome_sandbox"
symbol_output = "$root_out_dir/debug/chrome-sandbox.debug"
compress_debug_sections = true
deps = [ "//sandbox/linux:chrome_sandbox" ]
}
strip_binary("strip_libEGL_shlib") {
binary_input = "$root_out_dir/libEGL.so"
symbol_output = "$root_out_dir/debug/libEGL.so.debug"
compress_debug_sections = true
deps = [ "//third_party/angle:libEGL" ]
}
strip_binary("strip_libGLESv2_shlib") {
binary_input = "$root_out_dir/libGLESv2.so"
symbol_output = "$root_out_dir/debug/libGLESv2.so.debug"
compress_debug_sections = true
deps = [ "//third_party/angle:libGLESv2" ]
}
strip_binary("strip_libffmpeg_shlib") {
binary_input = "$root_out_dir/libffmpeg.so"
symbol_output = "$root_out_dir/debug/libffmpeg.so.debug"
compress_debug_sections = true
deps = [ "//third_party/ffmpeg" ]
}
strip_binary("strip_libvk_swiftshader_shlib") {
binary_input = "$root_out_dir/libvk_swiftshader.so"
symbol_output = "$root_out_dir/debug/libvk_swiftshader.so.debug"
compress_debug_sections = true
deps = [ "//third_party/swiftshader/src/Vulkan:swiftshader_libvulkan" ]
}
strip_binary("strip_mksnapshot_binary") {
_binary_path = rebase_path(
get_label_info(
":v8_context_snapshot_generator($v8_snapshot_toolchain)",
"root_out_dir") + "/mksnapshot",
root_build_dir)
binary_input = "$root_out_dir/$_binary_path"
symbol_output = "$root_out_dir/debug/${_binary_path}.debug"
compress_debug_sections = true
deps = mksnapshot_deps
}
strip_binary("strip_v8_context_snapshot_generator_binary") {
_binary_path = rebase_path(
get_label_info(
":v8_context_snapshot_generator($v8_snapshot_toolchain)",
"root_out_dir") + "/v8_context_snapshot_generator",
root_build_dir)
binary_input = "$root_out_dir/$_binary_path"
symbol_output = "$root_out_dir/debug/${_binary_path}.debug"
compress_debug_sections = true
deps = mksnapshot_deps
}
}

2
DEPS
View File

@@ -4,7 +4,7 @@ vars = {
'chromium_version':
'136.0.7103.177',
'node_version':
'v22.19.0',
'v22.18.0',
'nan_version':
'e14bdcd1f72d62bca1d541b66da43130384ec213',
'squirrel.mac_version':

View File

@@ -75,6 +75,3 @@ enterprise_cloud_content_analysis = false
content_enable_legacy_ipc = true
clang_unsafe_buffers_paths = "//electron/electron_unsafe_buffers_paths.txt"
# We don't use anything from here, and it causes target collisions
enable_linux_installer = false

View File

@@ -1,37 +0,0 @@
#!/usr/bin/env python3
import os
import sys
import hashlib
dir_path = os.path.dirname(os.path.realpath(__file__))
TEMPLATE_H = """
#ifndef ELECTRON_SNAPSHOT_CHECKSUM_H_
#define ELECTRON_SNAPSHOT_CHECKSUM_H_
namespace electron::snapshot_checksum {
const std::string kChecksum = "{checksum}";
} // namespace electron::snapshot_checksum
#endif // ELECTRON_SNAPSHOT_CHECKSUM_H_
"""
def calculate_sha256(filepath):
sha256_hash = hashlib.sha256()
with open(filepath, "rb") as f:
for byte_block in iter(lambda: f.read(4096), b""):
sha256_hash.update(byte_block)
return sha256_hash.hexdigest()
input_file = sys.argv[1]
output_file = sys.argv[2]
checksum = calculate_sha256(input_file)
checksum_h = TEMPLATE_H.replace("{checksum}", checksum)
with open(output_file, 'w') as f:
f.write(checksum_h)

View File

@@ -1,70 +0,0 @@
# Copyright 2021 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# This has been adapted from https://source.chromium.org/chromium/chromium/src/+/main:build/linux/strip_binary.gni;drc=c220a41e0422d45f1657c28146d32e99cc53640b
# The notable difference is it has an option to compress the debug sections
import("//build/config/clang/clang.gni")
import("//build/toolchain/toolchain.gni")
# Extracts symbols from a binary into a symbol file.
#
# Args:
# binary_input: Path to the binary containing symbols to extract, e.g.:
# "$root_out_dir/chrome"
# symbol_output: Desired output file for symbols, e.g.:
# "$root_out_dir/chrome.debug"
# stripped_binary_output: Desired output file for stripped file, e.g.:
# "$root_out_dir/chrome.stripped"
# compress_debug_sections: If true, compress the extracted debug sections
template("strip_binary") {
forward_variables_from(invoker,
[
"deps",
"testonly",
])
action("${target_name}") {
llvm_strip_binary = "${clang_base_path}/bin/llvm-strip"
llvm_objcopy_binary = "${clang_base_path}/bin/llvm-objcopy"
script = "//electron/build/linux/strip_binary.py"
if (defined(invoker.stripped_binary_output)) {
stripped_binary_output = invoker.stripped_binary_output
} else {
stripped_binary_output = invoker.binary_input + ".stripped"
}
if (defined(invoker.symbol_output)) {
symbol_output = invoker.symbol_output
} else {
symbol_output = invoker.binary_input + ".debug"
}
inputs = [
invoker.binary_input,
llvm_strip_binary,
llvm_objcopy_binary,
]
outputs = [
symbol_output,
stripped_binary_output,
]
args = [
"--llvm-strip-binary-path",
rebase_path(llvm_strip_binary, root_build_dir),
"--llvm-objcopy-binary-path",
rebase_path(llvm_objcopy_binary, root_build_dir),
"--symbol-output",
rebase_path(symbol_output, root_build_dir),
"--stripped-binary-output",
rebase_path(stripped_binary_output, root_build_dir),
"--binary-input",
rebase_path(invoker.binary_input, root_build_dir),
]
if (defined(invoker.compress_debug_sections) &&
invoker.compress_debug_sections) {
args += [ "--compress-debug-sections" ]
}
}
}

View File

@@ -1,63 +0,0 @@
#!/usr/bin/env python3
#
# Copyright 2021 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# This has been adapted from https://source.chromium.org/chromium/chromium/src/+/main:build/linux/strip_binary.py;drc=c220a41e0422d45f1657c28146d32e99cc53640b
# The notable difference is it has an option to compress the debug sections
import argparse
import subprocess
import sys
def main() -> int:
parser = argparse.ArgumentParser(description="Strip binary using LLVM tools.")
parser.add_argument("--llvm-strip-binary-path",
help="Path to llvm-strip executable.")
parser.add_argument("--llvm-objcopy-binary-path",
required=True,
help="Path to llvm-objcopy executable.")
parser.add_argument("--binary-input", help="Input ELF binary.")
parser.add_argument("--symbol-output",
help="File to write extracted debug info (.debug).")
parser.add_argument("--compress-debug-sections",
action="store_true",
help="Compress extracted debug info.")
parser.add_argument("--stripped-binary-output",
help="File to write stripped binary.")
args = parser.parse_args()
# Replicate the behavior of:
# eu-strip <binary_input> -o <stripped_binary_output> -f <symbol_output>
objcopy_args = [
"--only-keep-debug",
args.binary_input,
args.symbol_output,
]
if args.compress_debug_sections:
objcopy_args.insert(0, "--compress-debug-sections")
subprocess.check_output([args.llvm_objcopy_binary_path] + objcopy_args)
subprocess.check_output([
args.llvm_strip_binary_path,
"--strip-debug",
"--strip-unneeded",
"-o",
args.stripped_binary_output,
args.binary_input,
])
subprocess.check_output([
args.llvm_objcopy_binary_path,
f"--add-gnu-debuglink={args.symbol_output}",
args.stripped_binary_output,
])
return 0
if __name__ == "__main__":
sys.exit(main())

View File

@@ -1,21 +0,0 @@
# -*- bazel-starlark -*-
load("@builtin//struct.star", "module")
def __platform_properties(ctx):
container_image = "docker://gcr.io/chops-public-images-prod/rbe/siso-chromium/linux@sha256:d7cb1ab14a0f20aa669c23f22c15a9dead761dcac19f43985bf9dd5f41fbef3a"
return {
"default": {
"OSFamily": "Linux",
"container-image": container_image,
},
"large": {
"OSFamily": "Linux",
"container-image": container_image,
},
}
backend = module(
"backend",
platform_properties = __platform_properties,
)

View File

@@ -1,66 +0,0 @@
load("@builtin//encoding.star", "json")
load("@builtin//path.star", "path")
load("@builtin//runtime.star", "runtime")
load("@builtin//struct.star", "module")
load("@config//main.star", upstream_init = "init")
load("@config//win_sdk.star", "win_sdk")
load("@config//gn_logs.star", "gn_logs")
def init(ctx):
mod = upstream_init(ctx)
step_config = json.decode(mod.step_config)
# Buildbarn doesn't support input_root_absolute_path so disable that
for rule in step_config["rules"]:
input_root_absolute_path = rule.get("input_root_absolute_path", False)
if input_root_absolute_path:
rule.pop("input_root_absolute_path", None)
# Only wrap clang rules with a remote wrapper if not on Linux. These are currently only
# needed for X-Compile builds, which run on Windows and Mac.
if runtime.os != "linux":
for rule in step_config["rules"]:
if rule["name"].startswith("clang/") or rule["name"].startswith("clang-cl/"):
rule["remote_wrapper"] = "../../buildtools/reclient_cfgs/chromium-browser-clang/clang_remote_wrapper"
if "inputs" not in rule:
rule["inputs"] = []
rule["inputs"].append("buildtools/reclient_cfgs/chromium-browser-clang/clang_remote_wrapper")
rule["inputs"].append("third_party/llvm-build/Release+Asserts_linux/bin/clang")
if "executables" not in step_config:
step_config["executables"] = []
step_config["executables"].append("buildtools/reclient_cfgs/chromium-browser-clang/clang_remote_wrapper")
step_config["executables"].append("third_party/llvm-build/Release+Asserts_linux/bin/clang")
if runtime.os == "darwin":
# Update platforms to match our default siso config instead of reclient configs.
step_config["platforms"].update({
"clang": step_config["platforms"]["default"],
"clang_large": step_config["platforms"]["default"],
})
if runtime.os == "windows":
# Add additional Windows SDK headers needed by Electron
win_toolchain_dir = win_sdk.toolchain_dir(ctx)
if win_toolchain_dir:
sdk_version = gn_logs.read(ctx).get("windows_sdk_version")
step_config["input_deps"][win_toolchain_dir + ":headers"].extend([
# third_party/electron_node/deps/uv/include/uv/win.h includes mswsock.h
path.join(win_toolchain_dir, "Windows Kits/10/Include", sdk_version, "um/mswsock.h"),
# third_party/electron_node/src/debug_utils.cc includes lm.h
path.join(win_toolchain_dir, "Windows Kits/10/Include", sdk_version, "um/Lm.h"),
])
# Update platforms to match our default siso config instead of reclient configs.
step_config["platforms"].update({
"clang-cl": step_config["platforms"]["default"],
"clang-cl_large": step_config["platforms"]["default"],
"lld-link": step_config["platforms"]["default"],
})
return module(
"config",
step_config = json.encode(step_config),
filegroups = mod.filegroups,
handlers = mod.handlers,
)

View File

@@ -121,7 +121,6 @@ if ((globalThis.process || binding.process).argv.includes("--profile-electron-in
'electron/main$': electronAPIFile,
'electron/renderer$': electronAPIFile,
'electron/common$': electronAPIFile,
'electron/utility$': electronAPIFile,
// Force timers to resolve to our dependency that doesn't use window.postMessage
timers: path.resolve(electronRoot, 'node_modules', 'timers-browserify', 'main.js')
},
@@ -144,9 +143,7 @@ if ((globalThis.process || binding.process).argv.includes("--profile-electron-in
transpileOnly: onlyPrintingGraph,
ignoreDiagnostics: [
// File '{0}' is not under 'rootDir' '{1}'.
6059,
// Private field '{0}' must be declared in an enclosing class.
1111
6059
]
}
}]

View File

@@ -41,8 +41,6 @@ PATHS_TO_SKIP = [
'resources/inspector',
'gen/third_party/devtools-frontend/src',
'gen/ui/webui',
# Skip because these get zipped separately in script/zip-symbols.py
'debug',
]
def skip_path(dep, dist_zip, target_cpu):
@@ -82,11 +80,6 @@ def main(argv):
dep = dep.strip()
if not skip_path(dep, dist_zip, target_cpu):
dist_files.add(dep)
# On Linux, filter out any files which have a .stripped companion
if sys.platform == 'linux':
dist_files = {
dep for dep in dist_files if f"{dep.removeprefix('./')}.stripped" not in dist_files
}
if sys.platform == 'darwin' and not should_flatten:
execute(['zip', '-r', '-y', dist_zip] + list(dist_files))
else:
@@ -103,13 +96,10 @@ def main(argv):
dirname = os.path.dirname(dep)
arcname = (
os.path.join(dirname, 'chrome-sandbox')
if basename.removesuffix('.stripped') == 'chrome_sandbox'
if basename == 'chrome_sandbox'
else dep
)
name_to_write = arcname
# On Linux, strip the .stripped suffix from the name before zipping
if sys.platform == 'linux':
name_to_write = name_to_write.removesuffix('.stripped')
if should_flatten:
if flatten_relative_to:
if name_to_write.startswith(flatten_relative_to):

View File

@@ -76,15 +76,7 @@ app.whenReady().then(() => {
### `new Tray(image, [guid])`
* `image` ([NativeImage](native-image.md) | string)
* `guid` string (optional) _Windows_ _macOS_ - A unique string used to identify the tray icon. Must adhere to [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier) format.
**Windows**
On Windows, if the executable is signed and the signature contains an organization in the subject line then the GUID is permanently associated with that signature. OS level settings like the position of the tray icon in the system tray will persist even if the path to the executable changes. If the executable is not code-signed then the GUID is permanently associated with the path to the executable. Changing the path to the executable will break the creation of the tray icon and a new GUID must be used. However, it is highly recommended to use the GUID parameter only in conjunction with code-signed executable. If an App defines multiple tray icons then each icon must use a separate GUID.
**MacOS**
On macOS, the `guid` is a string used to uniquely identify the tray icon and allow it to retain its position between relaunches. Using the same string for a new tray item will create it in the same position as the previous tray item to use the string.
* `guid` string (optional) _Windows_ - Assigns a GUID to the tray icon. If the executable is signed and the signature contains an organization in the subject line then the GUID is permanently associated with that signature. OS level settings like the position of the tray icon in the system tray will persist even if the path to the executable changes. If the executable is not code-signed then the GUID is permanently associated with the path to the executable. Changing the path to the executable will break the creation of the tray icon and a new GUID must be used. However, it is highly recommended to use the GUID parameter only in conjunction with code-signed executable. If an App defines multiple tray icons then each icon must use a separate GUID.
Creates a new tray icon associated with the `image`.
@@ -332,10 +324,6 @@ Returns [`Rectangle`](structures/rectangle.md)
The `bounds` of this tray icon as `Object`.
#### `tray.getGUID()` _macOS_ _Windows_
Returns `string | null` - The GUID used to uniquely identify the tray icon and allow it to retain its position between relaunches, or null if none is set.
#### `tray.isDestroyed()`
Returns `boolean` - Whether the tray icon is destroyed.

View File

@@ -191,6 +191,12 @@ $ ./out/Testing/electron
### Packaging
On linux, first strip the debugging and symbol information:
```sh
$ electron/script/strip-binaries.py -d out/Release
```
To package the electron build as a distributable zip file:
```sh

View File

@@ -204,7 +204,7 @@ delete process.appCodeLoaded;
if (packagePath) {
// Finally load app's main.js and transfer control to C++.
if ((packageJson.type === 'module' && !mainStartupScript.endsWith('.cjs')) || mainStartupScript.endsWith('.mjs')) {
const { runEntryPointWithESMLoader } = __non_webpack_require__('internal/modules/run_main') as typeof import('@node/lib/internal/modules/run_main');
const { runEntryPointWithESMLoader } = __non_webpack_require__('internal/modules/run_main');
const main = (require('url') as typeof url).pathToFileURL(path.join(packagePath, mainStartupScript));
runEntryPointWithESMLoader(async (cascadedLoader: any) => {
try {

View File

@@ -52,20 +52,20 @@ const {
getValidatedPath,
getOptions,
getDirent
} = __non_webpack_require__('internal/fs/utils') as typeof import('@node/lib/internal/fs/utils');
} = __non_webpack_require__('internal/fs/utils');
const {
assignFunctionName
} = __non_webpack_require__('internal/util') as typeof import('@node/lib/internal/util');
} = __non_webpack_require__('internal/util');
const {
validateBoolean,
validateFunction
} = __non_webpack_require__('internal/validators') as typeof import('@node/lib/internal/validators');
} = __non_webpack_require__('internal/validators');
// In the renderer node internals use the node global URL but we do not set that to be
// the global URL instance. We need to do instanceof checks against the internal URL impl
const { URL: NodeURL } = __non_webpack_require__('internal/url') as typeof import('@node/lib/internal/url');
const { URL: NodeURL } = __non_webpack_require__('internal/url');
// Separate asar package's path from full path.
const splitPath = (archivePathOrBuffer: string | Buffer | URL) => {
@@ -745,8 +745,8 @@ export const wrapFsWithAsar = (fs: Record<string, any>) => {
const stat = internalBinding('fs').internalModuleStat(resultPath);
context.readdirResults.push(dirent);
if (dirent!.isDirectory() || stat === 1) {
context.pathsQueue.push(path.join(dirent!.path, dirent!.name));
if (dirent.isDirectory() || stat === 1) {
context.pathsQueue.push(path.join(dirent.path, dirent.name));
}
}
}
@@ -857,13 +857,13 @@ export const wrapFsWithAsar = (fs: Record<string, any>) => {
const { readdir } = fs;
fs.readdir = function (pathArgument: string, options: ReaddirOptions, callback: ReaddirCallback) {
callback = typeof options === 'function' ? options : callback;
validateFunction(callback, 'callback')!;
validateFunction(callback, 'callback');
options = getOptions(options);
pathArgument = getValidatedPath(pathArgument);
if (options?.recursive != null) {
validateBoolean(options?.recursive, 'options.recursive')!;
validateBoolean(options?.recursive, 'options.recursive');
}
if (options?.recursive) {
@@ -914,7 +914,7 @@ export const wrapFsWithAsar = (fs: Record<string, any>) => {
pathArgument = getValidatedPath(pathArgument);
if (options?.recursive != null) {
validateBoolean(options?.recursive, 'options.recursive')!;
validateBoolean(options?.recursive, 'options.recursive');
}
if (options?.recursive) {
@@ -957,7 +957,7 @@ export const wrapFsWithAsar = (fs: Record<string, any>) => {
pathArgument = getValidatedPath(pathArgument);
if (options?.recursive != null) {
validateBoolean(options?.recursive, 'options.recursive')!;
validateBoolean(options?.recursive, 'options.recursive');
}
if (options?.recursive) {

View File

@@ -65,9 +65,9 @@ require('@electron/internal/renderer/common-init');
if (nodeIntegration) {
// Export node bindings to global.
const { makeRequireFunction } = __non_webpack_require__('internal/modules/helpers') as typeof import('@node/lib/internal/modules/helpers');
const { makeRequireFunction } = __non_webpack_require__('internal/modules/helpers');
global.module = new Module('electron/js2c/renderer_init');
global.require = makeRequireFunction(global.module) as NodeRequire;
global.require = makeRequireFunction(global.module);
// Set the __filename to the path of html file if it is file: protocol.
if (window.location.protocol === 'file:') {
@@ -150,7 +150,7 @@ if (cjsPreloads.length) {
}
}
if (esmPreloads.length) {
const { runEntryPointWithESMLoader } = __non_webpack_require__('internal/modules/run_main') as typeof import('@node/lib/internal/modules/run_main');
const { runEntryPointWithESMLoader } = __non_webpack_require__('internal/modules/run_main');
runEntryPointWithESMLoader(async (cascadedLoader: any) => {
// Load the preload scripts.

View File

@@ -36,7 +36,7 @@ parentPort.on('removeListener', (name: string) => {
});
// Finally load entry script.
const { runEntryPointWithESMLoader } = __non_webpack_require__('internal/modules/run_main') as typeof import('@node/lib/internal/modules/run_main');
const { runEntryPointWithESMLoader } = __non_webpack_require__('internal/modules/run_main');
const mainEntry = pathToFileURL(entryScript);
runEntryPointWithESMLoader(async (cascadedLoader: any) => {

View File

@@ -13,9 +13,9 @@ require('@electron/internal/common/init');
const { hasSwitch, getSwitchValue } = process._linkedBinding('electron_common_command_line');
// Export node bindings to global.
const { makeRequireFunction } = __non_webpack_require__('internal/modules/helpers') as typeof import('@node/lib/internal/modules/helpers');
const { makeRequireFunction } = __non_webpack_require__('internal/modules/helpers');
global.module = new Module('electron/js2c/worker_init');
global.require = makeRequireFunction(global.module) as NodeRequire;
global.require = makeRequireFunction(global.module);
// See WebWorkerObserver::WorkerScriptReadyForEvaluation.
if ((globalThis as any).blinkfetch) {

View File

@@ -18,6 +18,7 @@
"@types/semver": "^7.5.8",
"@types/stream-json": "^1.7.7",
"@types/temp": "^0.9.4",
"@types/webpack-env": "^1.18.5",
"@typescript-eslint/eslint-plugin": "^8.7.0",
"@typescript-eslint/parser": "^8.7.0",
"buffer": "^6.0.3",

View File

@@ -149,5 +149,3 @@ do_not_check_the_order_of_display_id_order_on_windows.patch
make_focus_methods_in_webcontentsviewchildframe_notimplemented.patch
cherry-pick-f1e6422a355c.patch
fix_resolve_dynamic_background_material_update_issue_on_windows_11.patch
feat_add_support_for_embedder_snapshot_validation.patch
band-aid_over_an_issue_with_using_deprecated_nsopenpanel_api.patch

View File

@@ -1,108 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Avi Drissman <avi@chromium.org>
Date: Thu, 21 Aug 2025 07:33:53 -0700
Subject: Band-aid over an issue with using deprecated NSOpenPanel API
Because deprecated and broken NSOpenPanel API is used, the open panel
will sometimes incorrectly misunderstand a folder to be a package and
return it as a user selection when folders are disallowed from
selection. In that case, skip it.
Bug: 40861123
Bug: 41275486
Bug: 440106155
Change-Id: Ia0459a2bb76a30f4e126bd83069d7e13894d62f6
Fixed: 438779953
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6867298
Commit-Queue: Avi Drissman <avi@chromium.org>
Reviewed-by: Christine Hollingsworth <christinesm@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1504534}
diff --git a/components/remote_cocoa/app_shim/select_file_dialog_bridge.mm b/components/remote_cocoa/app_shim/select_file_dialog_bridge.mm
index 8e5fcc911dd28b99786ae2708184a7c47d3b1c3c..1f9977ffb1d7fd5d8bcc22f6f1ca2b840af909d6 100644
--- a/components/remote_cocoa/app_shim/select_file_dialog_bridge.mm
+++ b/components/remote_cocoa/app_shim/select_file_dialog_bridge.mm
@@ -220,7 +220,7 @@ - (void)popupAction:(id)sender {
// Unfortunately, there's no great way to do strict type matching with
// NSOpenPanel. Setting explicit extensions via -allowedFileTypes is
// deprecated, and there's no way to specify that strict type equality should
- // be used for -allowedContentTypes (FB13721802).
+ // be used for -allowedContentTypes (https://crbug.com/41275486, FB13721802).
//
// -[NSOpenSavePanelDelegate panel:shouldEnableURL:] could be used to enforce
// strict type matching, however its presence on the delegate means that all
@@ -230,6 +230,10 @@ - (void)popupAction:(id)sender {
//
// Therefore, use the deprecated API, because it's the only way to remain
// performant while achieving strict type matching.
+ //
+ // TODO(https://crbug.com/440106155): Possibly reconsider using
+ // -panel:shouldEnableURL: if the speed impact is judged to be acceptable
+ // nowadays.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
@@ -462,8 +466,8 @@ - (void)popupAction:(id)sender {
// See -[ExtensionDropdownHandler popupAction:] as to why file extensions
// are collected here rather than being converted to UTTypes.
- // TODO(FB13721802): Use UTTypes when strict type matching can be
- // specified.
+ // TODO(https://crbug.com/440106155, FB13721802): Use UTTypes when strict
+ // type matching can be specified.
NSString* ext_ns = base::SysUTF8ToNSString(ext);
if (![file_extensions_array containsObject:ext_ns]) {
[file_extensions_array addObject:ext_ns];
@@ -554,18 +558,46 @@ - (void)popupAction:(id)sender {
}
NSString* path = url.path;
- // There is a bug in macOS where, despite a request to disallow file
- // selection, files/packages are able to be selected. If indeed file
- // selection was disallowed, drop any files selected.
- // https://crbug.com/40861123, FB11405008
- if (!open_panel.canChooseFiles) {
+ if (base::mac::MacOSMajorVersion() < 14) {
+ // There is a bug in macOS (https://crbug.com/40861123, FB11405008)
+ // where, despite a request to disallow file selection, files/packages
+ // are able to be selected. If indeed file selection was disallowed,
+ // drop any files selected. This issue is fixed in macOS 14, so only
+ // do the workaround on previous releases.
+ if (!open_panel.canChooseFiles) {
+ BOOL is_directory;
+ BOOL exists =
+ [NSFileManager.defaultManager fileExistsAtPath:path
+ isDirectory:&is_directory];
+ BOOL is_package =
+ [NSWorkspace.sharedWorkspace isFilePackageAtPath:path];
+ if (!exists || !is_directory || is_package) {
+ continue;
+ }
+ }
+ }
+
+ // As long as FB13721802 remains unfixed, this class uses extensions to
+ // filter what files are available rather than UTTypes. This deprecated
+ // API has a problem, however. If you specify an extension to be shown
+ // as available, then the NSOpenPanel will assume that any directory
+ // that has that extension is a package, and will offer it to the user
+ // for selection even if directory selection isn't otherwise allowed.
+ // Therefore, if directories are disallowed, filter out any that find
+ // their way in if they're not actually packages.
+ //
+ // TODO(https://crbug.com/440106155, FB13721802): Possibly reconsider
+ // using -panel:shouldEnableURL: if the speed impact is judged to be
+ // acceptable nowadays, and drop this band-aid.
+ if (!open_panel.canChooseDirectories) {
BOOL is_directory;
BOOL exists =
[NSFileManager.defaultManager fileExistsAtPath:path
isDirectory:&is_directory];
BOOL is_package =
[NSWorkspace.sharedWorkspace isFilePackageAtPath:path];
- if (!exists || !is_directory || is_package) {
+ if (!exists || (is_directory && !is_package)) {
+ NSLog(@"dropping %@", path);
continue;
}
}

View File

@@ -21,23 +21,34 @@ index 775a132ea523c509433a3a9560fe3a5419dfaa3f..2b99d0b584760ab3f51561c030ca1990
&no_javascript_access);
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 2896b2b15d9c22e27c37719867c20213b9983984..83c5918c1bc0417ed3c744828b9f93e7c00d22c3 100644
index 2896b2b15d9c22e27c37719867c20213b9983984..572dfd03c9e76a0a71e511dade83f1877ae85b4a 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -5101,6 +5101,12 @@ FrameTree* WebContentsImpl::CreateNewWindow(
@@ -5049,6 +5049,10 @@ FrameTree* WebContentsImpl::CreateNewWindow(
create_params.initially_hidden = renderer_started_hidden;
create_params.initial_popup_url = params.target_url;
+ // Potentially allow the delegate to override the create_params.
+ if (delegate_)
+ delegate_->MaybeOverrideCreateParamsForNewWindow(&create_params);
+
// Even though all codepaths leading here are in response to a renderer
// trying to open a new window, if the new window ends up in a different
// browsing instance, then the RenderViewHost, RenderWidgetHost,
@@ -5101,6 +5105,12 @@ FrameTree* WebContentsImpl::CreateNewWindow(
SetPartitionedPopinOpenerOnNewWindowIfNeeded(new_contents_impl, params,
opener);
+ if (delegate_) {
+ delegate_->WebContentsCreatedWithFullParams(this, render_process_id,
+ opener->GetRoutingID(),
+ params, new_contents_impl);
+ delegate_->WebContentsCreated(this, render_process_id,
+ opener->GetRoutingID(), params.frame_name,
+ params.target_url, new_contents_impl);
+ }
+
// If the new frame has a name, make sure any SiteInstances that can find
// this named frame have proxies for it. Must be called after
// SetSessionStorageNamespace, since this calls CreateRenderView, which uses
@@ -5142,12 +5148,6 @@ FrameTree* WebContentsImpl::CreateNewWindow(
@@ -5142,12 +5152,6 @@ FrameTree* WebContentsImpl::CreateNewWindow(
AddWebContentsDestructionObserver(new_contents_impl);
}
@@ -122,7 +133,7 @@ index b390356721fa226c348923f33601c4a1a2d9702d..97a3ea6f292563a41fd41f812ac72526
WebContents* source,
const OpenURLParams& params,
diff --git a/content/public/browser/web_contents_delegate.h b/content/public/browser/web_contents_delegate.h
index da319cb20733150366d85bee95609f0f2d9def7f..8a18958035cc1dd26be558349f64f7727570c4ba 100644
index da319cb20733150366d85bee95609f0f2d9def7f..a5e731806c4c8418a36ee89d4689f43b41d2d7eb 100644
--- a/content/public/browser/web_contents_delegate.h
+++ b/content/public/browser/web_contents_delegate.h
@@ -18,6 +18,7 @@
@@ -133,7 +144,7 @@ index da319cb20733150366d85bee95609f0f2d9def7f..8a18958035cc1dd26be558349f64f772
#include "content/public/browser/eye_dropper.h"
#include "content/public/browser/fullscreen_types.h"
#include "content/public/browser/invalidate_type.h"
@@ -376,6 +377,13 @@ class CONTENT_EXPORT WebContentsDelegate {
@@ -376,6 +377,16 @@ class CONTENT_EXPORT WebContentsDelegate {
const StoragePartitionConfig& partition_config,
SessionStorageNamespace* session_storage_namespace);
@@ -143,6 +154,9 @@ index da319cb20733150366d85bee95609f0f2d9def7f..8a18958035cc1dd26be558349f64f772
+ int opener_render_frame_id,
+ const mojom::CreateNewWindowParams& params,
+ WebContents* new_contents);
+
+ virtual void MaybeOverrideCreateParamsForNewWindow(
+ content::WebContents::CreateParams* create_params) {}
+
// Notifies the delegate about the creation of a new WebContents. This
// typically happens when popups are created.

View File

@@ -14,7 +14,7 @@ track down the source of this problem & figure out if we can fix it
by changing something in Electron.
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 5465e9d42a5c4eed3b6f819418a7b0ab92c7eae2..54ff9675fef009c5bb79becb59146436508ad835 100644
index dfe9ab128729d0f26c99679f8840138d654c9b59..002a8a352af6bd4acf69c5a8308e50b9a571b18d 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -5020,7 +5020,7 @@ FrameTree* WebContentsImpl::CreateNewWindow(

View File

@@ -218,7 +218,7 @@ index c6838c83ef971b88769b1f3fba8095025ae25464..2da6a4e08340e72ba7de5d03444c2f17
content::WebContents* AddNewContents(
content::WebContents* source,
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index d13c38de7a2e69565020ab92c874bf1289d63833..d7ec62c6761bcc8d4bb5889e873e22c4a27e7f17 100644
index f85609c193d2f1c709f5c1beafd43f8bb82ef8c1..77b16f8c5f2aa564d4dba8f17646c516b28963dc 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -4983,8 +4983,7 @@ FrameTree* WebContentsImpl::CreateNewWindow(
@@ -246,7 +246,7 @@ index 97a3ea6f292563a41fd41f812ac72526a96d8471..b299dd5659100d317a3574e902bf2c29
}
diff --git a/content/public/browser/web_contents_delegate.h b/content/public/browser/web_contents_delegate.h
index 8a18958035cc1dd26be558349f64f7727570c4ba..7d9c9b06bcc57ef5eb0a2ca74ee20632a1393f9e 100644
index a5e731806c4c8418a36ee89d4689f43b41d2d7eb..e53b4ff7f98c87c1da838f44f07fbc7ee09198e9 100644
--- a/content/public/browser/web_contents_delegate.h
+++ b/content/public/browser/web_contents_delegate.h
@@ -355,8 +355,7 @@ class CONTENT_EXPORT WebContentsDelegate {

View File

@@ -1,67 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Samuel Attard <sattard@anthropic.com>
Date: Fri, 15 Aug 2025 14:58:12 -0700
Subject: feat: add support for embedder snapshot validation
IsValid is not exposed despite being commented as for embedders, this exposes something that works for us.
diff --git a/gin/v8_initializer.cc b/gin/v8_initializer.cc
index e07bdaeccecc8015462e35d5cf4606335e2e962c..28b133626cf3488dee6f43bfd0ac9b6b14ed3980 100644
--- a/gin/v8_initializer.cc
+++ b/gin/v8_initializer.cc
@@ -75,11 +75,23 @@ bool GenerateEntropy(unsigned char* buffer, size_t amount) {
return true;
}
+static base::RepeatingCallback<void(v8::StartupData*)>& SnapshotValidator() {
+ static base::NoDestructor<base::RepeatingCallback<void(v8::StartupData*)>>
+ validator(
+ base::BindRepeating([](v8::StartupData* data) -> void { /* empty */ }));
+ return *validator;
+}
+
+void SetV8SnapshotValidatorInner(const base::RepeatingCallback<void(v8::StartupData*)>& callback) {
+ SnapshotValidator() = std::move(callback);
+}
+
void GetMappedFileData(base::MemoryMappedFile* mapped_file,
v8::StartupData* data) {
if (mapped_file) {
data->data = reinterpret_cast<const char*>(mapped_file->data());
data->raw_size = static_cast<int>(mapped_file->length());
+ SnapshotValidator().Run(data);
} else {
data->data = nullptr;
data->raw_size = 0;
@@ -223,6 +235,10 @@ constexpr std::string_view kV8FlagFeaturePrefix = "V8Flag_";
} // namespace
+void SetV8SnapshotValidator(const base::RepeatingCallback<void(v8::StartupData*)>& callback) {
+ SetV8SnapshotValidatorInner(std::move(callback));
+}
+
class V8FeatureVisitor : public base::FeatureVisitor {
public:
void Visit(const std::string& feature_name,
diff --git a/gin/v8_initializer.h b/gin/v8_initializer.h
index 6f7382cd600cd34916d9382878aee4b469dae5d0..61ed0f46437d2e1abbcebcfb64df06d17c8d9139 100644
--- a/gin/v8_initializer.h
+++ b/gin/v8_initializer.h
@@ -11,6 +11,7 @@
#include "base/files/file.h"
#include "base/files/memory_mapped_file.h"
+#include "base/functional/callback.h"
#include "build/build_config.h"
#include "gin/array_buffer.h"
#include "gin/gin_export.h"
@@ -28,6 +29,8 @@ class StartupData;
namespace gin {
+void SetV8SnapshotValidator(const base::RepeatingCallback<void(v8::StartupData*)>& callback);
+
class GIN_EXPORT V8Initializer {
public:
// This should be called by IsolateHolder::Initialize().

View File

@@ -87,10 +87,10 @@ index 75df43e3cd2721a92c90c18154d53d5c203e2465..ce42c75c8face36d21f53f44c0201ac4
// The view with active text input state, i.e., a focused <input> element.
// It will be nullptr if no such view exists. Note that the active view
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 26f41d34766899e81e32c319aad00172ffdc5fca..5465e9d42a5c4eed3b6f819418a7b0ab92c7eae2 100644
index 52539a51fb6c180020dea20a36482e6020be1b0f..dfe9ab128729d0f26c99679f8840138d654c9b59 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -9856,7 +9856,7 @@ void WebContentsImpl::OnFocusedElementChangedInFrame(
@@ -9860,7 +9860,7 @@ void WebContentsImpl::OnFocusedElementChangedInFrame(
"WebContentsImpl::OnFocusedElementChangedInFrame",
"render_frame_host", frame);
RenderWidgetHostViewBase* root_view =

View File

@@ -44,10 +44,10 @@ index 20fcda4eb20459b69247003c51c2a3ed37c7b1e8..9bcab4e1e8a0fa429488555f4f7bd1c5
void RenderWidgetHostImpl::ShowContextMenuAtPoint(
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 83c5918c1bc0417ed3c744828b9f93e7c00d22c3..d13c38de7a2e69565020ab92c874bf1289d63833 100644
index 572dfd03c9e76a0a71e511dade83f1877ae85b4a..f85609c193d2f1c709f5c1beafd43f8bb82ef8c1 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -5853,6 +5853,11 @@ TextInputManager* WebContentsImpl::GetTextInputManager() {
@@ -5857,6 +5857,11 @@ TextInputManager* WebContentsImpl::GetTextInputManager() {
return text_input_manager_.get();
}

View File

@@ -15,10 +15,10 @@ This CL removes these filters so the unresponsive event can still be
accessed from our JS event. The filtering is moved into Electron's code.
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 54ff9675fef009c5bb79becb59146436508ad835..aebd3b4fd597db7b02214dd61708711dc4ad75f3 100644
index 002a8a352af6bd4acf69c5a8308e50b9a571b18d..cd146c716a9cd8ab593812944778674c0084c046 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -9993,25 +9993,13 @@ void WebContentsImpl::RendererUnresponsive(
@@ -9997,25 +9997,13 @@ void WebContentsImpl::RendererUnresponsive(
base::RepeatingClosure hang_monitor_restarter) {
OPTIONAL_TRACE_EVENT1("content", "WebContentsImpl::RendererUnresponsive",
"render_widget_host", render_widget_host);

View File

@@ -9,7 +9,7 @@ is needed for OSR.
Originally landed in https://github.com/electron/libchromiumcontent/pull/226.
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index d7ec62c6761bcc8d4bb5889e873e22c4a27e7f17..ac8aa81e213689a612d322fa75e81798ae1010e6 100644
index 77b16f8c5f2aa564d4dba8f17646c516b28963dc..44989cbf81699e0d5f8b69bbb9e22b90930f6c6b 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -3922,6 +3922,13 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params,

View File

@@ -37,7 +37,7 @@ index 2b99d0b584760ab3f51561c030ca199055bacd26..9d7b8758cb8f115e5c83f3913c7172f2
if (had_fullscreen_token && !GetView()->HasFocus())
GetView()->Focus();
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index ac8aa81e213689a612d322fa75e81798ae1010e6..26f41d34766899e81e32c319aad00172ffdc5fca 100644
index 44989cbf81699e0d5f8b69bbb9e22b90930f6c6b..52539a51fb6c180020dea20a36482e6020be1b0f 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -4197,21 +4197,25 @@ KeyboardEventProcessingResult WebContentsImpl::PreHandleKeyboardEvent(

View File

@@ -30,7 +30,7 @@ build_compile_with_c_20_support.patch
add_v8_taskpirority_to_foreground_task_runner_signature.patch
cli_remove_deprecated_v8_flag.patch
build_restore_clang_as_default_compiler_on_macos.patch
fix_remove_outdated_v8_flags_from_node_cc.patch
fix_remove_harmony-import-assertions_from_node_cc.patch
chore_disable_deprecation_ftbfs_in_simdjson_header.patch
build_allow_unbundling_of_node_js_dependencies.patch
test_use_static_method_names_in_call_stacks.patch

View File

@@ -24,7 +24,7 @@ index 2415940835036226799a7ea14c6687cc0d56c523..0feb07afbccad97a92cee00954443407
o['variables']['v8_enable_external_code_space'] = 1 if options.enable_pointer_compression else 0
o['variables']['v8_enable_31bit_smis_on_64bit_arch'] = 1 if options.enable_pointer_compression else 0
diff --git a/node.gni b/node.gni
index d4438f7fd61598afac2c1e3184721a759d22b10c..e2407027ab05e59b2f0f1c213b98ea469db7a91b 100644
index b049f0692980c3e26771c3209c3bdd2e9a4d637b..e2407027ab05e59b2f0f1c213b98ea469db7a91b 100644
--- a/node.gni
+++ b/node.gni
@@ -5,10 +5,10 @@
@@ -40,7 +40,15 @@ index d4438f7fd61598afac2c1e3184721a759d22b10c..e2407027ab05e59b2f0f1c213b98ea46
# The location of OpenSSL - use the one from node's deps by default.
node_openssl_path = "$node_path/deps/openssl"
@@ -50,7 +50,7 @@ declare_args() {
@@ -42,12 +42,15 @@ declare_args() {
# The variable is called "openssl" for parity with node's GYP build.
node_use_openssl = true
+ # Build node with SQLite support.
+ node_use_sqlite = true
+
# Use the specified path to system CA (PEM format) in addition to
# the BoringSSL supplied CA store or compiled-in Mozilla CA copy.
node_openssl_system_ca_path = ""
# Initialize v8 platform during node.js startup.
@@ -49,7 +57,7 @@ index d4438f7fd61598afac2c1e3184721a759d22b10c..e2407027ab05e59b2f0f1c213b98ea46
# Custom build tag.
node_tag = ""
@@ -70,10 +70,16 @@ declare_args() {
@@ -67,10 +70,16 @@ declare_args() {
# TODO(zcbenz): There are few broken things for now:
# 1. cross-os compilation is not supported.
# 2. node_mksnapshot crashes when cross-compiling for x64 from arm64.
@@ -68,7 +76,7 @@ index d4438f7fd61598afac2c1e3184721a759d22b10c..e2407027ab05e59b2f0f1c213b98ea46
assert(!node_enable_inspector || node_use_openssl,
diff --git a/src/node_builtins.cc b/src/node_builtins.cc
index b4acc40618e372b09d0cb5e3755034f08711a282..efeaaef7e4dc64a0adb5e6bdbbe18945890de62c 100644
index abf1583cdac9f139056cf4809f14e28e62f6d24c..8b104e175ccf8de90c138337f83f8f6ce1348ac7 100644
--- a/src/node_builtins.cc
+++ b/src/node_builtins.cc
@@ -789,6 +789,7 @@ void BuiltinLoader::RegisterExternalReferences(
@@ -271,10 +279,22 @@ index 856878c33681a73d41016729dabe48b0a6a80589..91a11852d206b65485fe90fd037a0bd1
if sys.platform == 'win32':
files = [ x.replace('\\', '/') for x in files ]
diff --git a/unofficial.gni b/unofficial.gni
index 865a0d5ce9c6792e57f4216bcaa594ca6fc7b1c8..26ebc811272ef2990f8d090c54e7f5294aab9d37 100644
index da565473f1ae96b4d009935f7733e6ab15ea9de2..26ebc811272ef2990f8d090c54e7f5294aab9d37 100644
--- a/unofficial.gni
+++ b/unofficial.gni
@@ -147,31 +147,41 @@ template("node_gn_build") {
@@ -22,6 +22,11 @@ template("node_gn_build") {
} else {
defines += [ "HAVE_OPENSSL=0" ]
}
+ if (node_use_sqlite) {
+ defines += [ "HAVE_SQLITE=1" ]
+ } else {
+ defines += [ "HAVE_SQLITE=0" ]
+ }
if (node_use_amaro) {
defines += [ "HAVE_AMARO=1" ]
} else {
@@ -142,32 +147,41 @@ template("node_gn_build") {
public_configs = [
":node_external_config",
"deps/googletest:googletest_config",
@@ -297,6 +317,7 @@ index 865a0d5ce9c6792e57f4216bcaa594ca6fc7b1c8..26ebc811272ef2990f8d090c54e7f529
"deps/nghttp2",
- "deps/ngtcp2",
"deps/postject",
- "deps/sqlite",
"deps/uvwasi",
- "deps/zstd",
"//third_party/zlib",
@@ -319,7 +340,7 @@ index 865a0d5ce9c6792e57f4216bcaa594ca6fc7b1c8..26ebc811272ef2990f8d090c54e7f529
"$target_gen_dir/node_javascript.cc",
] + gypi_values.node_sources
@@ -194,7 +204,7 @@ template("node_gn_build") {
@@ -190,9 +204,13 @@ template("node_gn_build") {
}
if (node_use_openssl) {
deps += [ "deps/ncrypto" ]
@@ -327,8 +348,14 @@ index 865a0d5ce9c6792e57f4216bcaa594ca6fc7b1c8..26ebc811272ef2990f8d090c54e7f529
+ public_deps += [ "//third_party/boringssl" ]
sources += gypi_values.node_crypto_sources
}
if (node_use_sqlite) {
@@ -223,6 +233,10 @@ template("node_gn_build") {
+ if (node_use_sqlite) {
+ deps += [ "deps/sqlite" ]
+ sources += gypi_values.node_sqlite_sources
+ }
if (node_enable_inspector) {
deps += [
"$node_inspector_protocol_path:crdtp",
@@ -215,6 +233,10 @@ template("node_gn_build") {
}
}
@@ -339,7 +366,7 @@ index 865a0d5ce9c6792e57f4216bcaa594ca6fc7b1c8..26ebc811272ef2990f8d090c54e7f529
executable(target_name) {
forward_variables_from(invoker, "*")
@@ -297,6 +311,7 @@ template("node_gn_build") {
@@ -289,6 +311,7 @@ template("node_gn_build") {
}
executable("node_js2c") {
@@ -347,7 +374,7 @@ index 865a0d5ce9c6792e57f4216bcaa594ca6fc7b1c8..26ebc811272ef2990f8d090c54e7f529
deps = [
"deps/uv",
"$node_simdutf_path",
@@ -307,26 +322,75 @@ template("node_gn_build") {
@@ -299,26 +322,75 @@ template("node_gn_build") {
"src/embedded_data.cc",
"src/embedded_data.h",
]
@@ -433,7 +460,7 @@ index 865a0d5ce9c6792e57f4216bcaa594ca6fc7b1c8..26ebc811272ef2990f8d090c54e7f529
outputs = [ "$target_gen_dir/node_javascript.cc" ]
# Get the path to node_js2c executable of the host toolchain.
@@ -340,11 +404,11 @@ template("node_gn_build") {
@@ -332,11 +404,11 @@ template("node_gn_build") {
get_label_info(":node_js2c($host_toolchain)", "name") +
host_executable_suffix

View File

@@ -10,7 +10,7 @@ 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 3a1d2fc9d147a8c89f7b5231d63d37f29979965d..6425ee9e8dba993f3e899362ce9bd7b097f08883 100644
index 679633dc6b4ce2a1f5f88e93d1a1c1feb4bbadb4..2caa183213d5632be81b763e894e37c09384391f 100644
--- a/common.gypi
+++ b/common.gypi
@@ -539,7 +539,7 @@

View File

@@ -64,7 +64,7 @@ index 251f51ec454f9cba4023b8b6729241ee753aac13..1de8cac6e3953ce9cab9db03530da327
module.exports = {
diff --git a/node.gyp b/node.gyp
index d604e0ddd973174aa7be6f2d250af7b9c2b0fcfd..8e97aa3f44087213425927113fe72bca9ddef45b 100644
index 442c1e7a6ddafbb7a7ec7a42a97ec04b28ea4d93..3a66c11d39dd2fd129c8f54098a9607e080ecca0 100644
--- a/node.gyp
+++ b/node.gyp
@@ -176,7 +176,6 @@

View File

@@ -7,7 +7,7 @@ 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 e56ba31ed068b81f5c6fbd432cd82bb6916e9a85..3a1d2fc9d147a8c89f7b5231d63d37f29979965d 100644
index 33af43cd768c24b26d523f3db66eb8b9eb26859a..679633dc6b4ce2a1f5f88e93d1a1c1feb4bbadb4 100644
--- a/common.gypi
+++ b/common.gypi
@@ -89,6 +89,8 @@

View File

@@ -34,7 +34,7 @@ index 0244a214b187e67e0cb89f26cd019855963ec93a..b65a3be6bcb0e28f7f43367d0fa9da53
let kResistStopPropagation;
diff --git a/src/node_builtins.cc b/src/node_builtins.cc
index efeaaef7e4dc64a0adb5e6bdbbe18945890de62c..557972987abeaa56918362638a17a9b6e0763238 100644
index 8b104e175ccf8de90c138337f83f8f6ce1348ac7..35cf42a5e533cb799bf129df0c8370bfe8310233 100644
--- a/src/node_builtins.cc
+++ b/src/node_builtins.cc
@@ -35,6 +35,7 @@ using v8::Value;

View File

@@ -11,7 +11,7 @@ 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 6425ee9e8dba993f3e899362ce9bd7b097f08883..95d66f75b582b3fd3b833109dfe110ae5b196f83 100644
index 2caa183213d5632be81b763e894e37c09384391f..2cce436c4a9e3d942f957f6c94a4ef9e3db391ce 100644
--- a/common.gypi
+++ b/common.gypi
@@ -128,6 +128,7 @@

View File

@@ -8,7 +8,7 @@ they use themselves as the entry point. We should try to upstream some form
of this.
diff --git a/lib/internal/process/pre_execution.js b/lib/internal/process/pre_execution.js
index 98ed40e3076f6628b1771dade63ac51600e8e447..1eba13caf1e00a8b41b2cf8afc4168c8f98be69f 100644
index 0cda54fd85e1e0bff13d4718a269eb3e7c60312a..6b165062a5eaa40f6e5614bca50bc33ccbdb85cc 100644
--- a/lib/internal/process/pre_execution.js
+++ b/lib/internal/process/pre_execution.js
@@ -245,12 +245,14 @@ function patchProcessObject(expandArgv1) {

View File

@@ -15,10 +15,10 @@ Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io>
diff --git a/doc/api/cli.md b/doc/api/cli.md
index 8cabb58e621a9951acd5551afb85c192f2b1c690..b69bacebef3e5e5e5b191c61aa5fe0f71c1edfb3 100644
index 404e87e6d1237b5ee79cafd8a959c1b6d9d23fe5..7deda572c940f7b2e8c6813f1826796a13e4db38 100644
--- a/doc/api/cli.md
+++ b/doc/api/cli.md
@@ -2712,39 +2712,6 @@ added: v12.0.0
@@ -2709,39 +2709,6 @@ added: v12.0.0
Set default [`tls.DEFAULT_MIN_VERSION`][] to 'TLSv1.3'. Use to disable support
for TLSv1.2, which is not as secure as TLSv1.3.
@@ -58,7 +58,7 @@ index 8cabb58e621a9951acd5551afb85c192f2b1c690..b69bacebef3e5e5e5b191c61aa5fe0f7
### `--trace-deprecation`
<!-- YAML
@@ -3429,7 +3396,6 @@ one is included in the list below.
@@ -3423,7 +3390,6 @@ one is included in the list below.
* `--tls-min-v1.1`
* `--tls-min-v1.2`
* `--tls-min-v1.3`
@@ -67,7 +67,7 @@ index 8cabb58e621a9951acd5551afb85c192f2b1c690..b69bacebef3e5e5e5b191c61aa5fe0f7
* `--trace-env-js-stack`
* `--trace-env-native-stack`
diff --git a/doc/node.1 b/doc/node.1
index 6913992a5476d2317a34fb69d3c6af63b686f9a6..1faef5ba1d4206a5cc4c71cb71f7a08f613fbf17 100644
index f41323c799ad34c8e17a36d81e4cc2b16e50e9ee..a9ff54edfad1d053ec1ac544f28e14a1898ac177 100644
--- a/doc/node.1
+++ b/doc/node.1
@@ -539,11 +539,6 @@ but the option is supported for compatibility with older Node.js versions.
@@ -83,7 +83,7 @@ index 6913992a5476d2317a34fb69d3c6af63b686f9a6..1faef5ba1d4206a5cc4c71cb71f7a08f
Print stack traces for deprecations.
.
diff --git a/src/node.cc b/src/node.cc
index 0d383dcdb80fe30e3c2d6880b44f626f065bb1f3..9d9992dacbc595c987827f55eb12ea8af0480df6 100644
index 0c2a4d344c991c2ca0d9d90934cf7921abf2a629..19d9fb77f1aaf003e43b7d7016f45e6c35df06b3 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -232,44 +232,6 @@ void Environment::WaitForInspectorFrontendByOptions() {
@@ -150,7 +150,7 @@ index 0d383dcdb80fe30e3c2d6880b44f626f065bb1f3..9d9992dacbc595c987827f55eb12ea8a
isolate_->SetPromiseHook(TracePromises);
}
diff --git a/src/node_options.cc b/src/node_options.cc
index cfb95f65ccb0c6d150be8a4039caf26faf7cd06d..cb0ecd81b33abd7743e66e225a6cb96b4094f935 100644
index d6988a5a8c068022d10607c32e57ac667f821337..4deaa52a8a4688bca32d41b74124604b6e33c80b 100644
--- a/src/node_options.cc
+++ b/src/node_options.cc
@@ -773,10 +773,6 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() {
@@ -165,7 +165,7 @@ index cfb95f65ccb0c6d150be8a4039caf26faf7cd06d..cb0ecd81b33abd7743e66e225a6cb96b
"show stack traces on deprecations",
&EnvironmentOptions::trace_deprecation,
diff --git a/src/node_options.h b/src/node_options.h
index 3ff1f4b4baa64b8ee2a4587e150ea14cb2fdfdf4..26ac54c4b18dd00b2c1f915dc1ba0e90ca70b48f 100644
index 2b7df46312b8be58d6062b6a2f6084247e075c37..2d52cde518926577834f77424fa5b2231ca3374e 100644
--- a/src/node_options.h
+++ b/src/node_options.h
@@ -204,7 +204,6 @@ class EnvironmentOptions : public Options {

View File

@@ -18,10 +18,10 @@ Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
diff --git a/doc/api/cli.md b/doc/api/cli.md
index 1a1e0ec1d89a4d0ecf1c9ae37c23b8f660c051d6..8cabb58e621a9951acd5551afb85c192f2b1c690 100644
index 78c0794a57fd4fdcdd8a64fe98a6b13f9ef3f23a..404e87e6d1237b5ee79cafd8a959c1b6d9d23fe5 100644
--- a/doc/api/cli.md
+++ b/doc/api/cli.md
@@ -3467,7 +3467,6 @@ V8 options that are allowed are:
@@ -3461,7 +3461,6 @@ V8 options that are allowed are:
* `--disallow-code-generation-from-strings`
* `--enable-etw-stack-walking`
* `--expose-gc`
@@ -30,7 +30,7 @@ index 1a1e0ec1d89a4d0ecf1c9ae37c23b8f660c051d6..8cabb58e621a9951acd5551afb85c192
* `--jitless`
* `--max-old-space-size`
diff --git a/src/node_options.cc b/src/node_options.cc
index 415d4e34f29bc303674dccbfdc231b251401961b..cfb95f65ccb0c6d150be8a4039caf26faf7cd06d 100644
index 367f7d9b1450e4d9e6d8fef36a2234e7d1344804..d6988a5a8c068022d10607c32e57ac667f821337 100644
--- a/src/node_options.cc
+++ b/src/node_options.cc
@@ -1001,11 +1001,6 @@ PerIsolateOptionsParser::PerIsolateOptionsParser(

View File

@@ -7,7 +7,7 @@ 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 7780ae106b479ca620a4065f08d6e4acc200628c..e56ba31ed068b81f5c6fbd432cd82bb6916e9a85 100644
index 20135003dd040ebfb3661c81c89fde93ce00fbfb..33af43cd768c24b26d523f3db66eb8b9eb26859a 100644
--- a/common.gypi
+++ b/common.gypi
@@ -91,6 +91,23 @@

View File

@@ -11,7 +11,7 @@ We can fix this by allowing the C++ implementation of legacyMainResolve to use
a fileExists function that does take Asar into account.
diff --git a/lib/internal/modules/esm/resolve.js b/lib/internal/modules/esm/resolve.js
index e3afd30ba1f591d0298793bc42fd7166a4219bce..408dc96307d7f52f92db41004b358051a81c627c 100644
index 7572bfc34d4c21b2ad618a68c4a2026400ad7338..5ce696a4e50d8d8bbe311340d665b3bdc330327f 100644
--- a/lib/internal/modules/esm/resolve.js
+++ b/lib/internal/modules/esm/resolve.js
@@ -28,14 +28,13 @@ const { BuiltinModule } = require('internal/bootstrap/realm');
@@ -53,10 +53,10 @@ index e3afd30ba1f591d0298793bc42fd7166a4219bce..408dc96307d7f52f92db41004b358051
const maybeMain = resolvedOption <= legacyMainResolveExtensionsIndexes.kResolvedByMainIndexNode ?
packageConfig.main || './' : '';
diff --git a/src/node_file.cc b/src/node_file.cc
index c8e7e341b1d9f5a1142afdc265704455c252a0c3..7221708a2296ff44c19ed01dc52d78653ecc4e58 100644
index 7d174113a22cb26e767f8756ce0f0cdedd68d7d7..f3142dab526064114771af154c3389961771b5dc 100644
--- a/src/node_file.cc
+++ b/src/node_file.cc
@@ -3504,13 +3504,25 @@ static void CpSyncCopyDir(const FunctionCallbackInfo<Value>& args) {
@@ -3482,13 +3482,25 @@ static void CpSyncCopyDir(const FunctionCallbackInfo<Value>& args) {
}
BindingData::FilePathIsFileReturnType BindingData::FilePathIsFile(
@@ -83,7 +83,7 @@ index c8e7e341b1d9f5a1142afdc265704455c252a0c3..7221708a2296ff44c19ed01dc52d7865
uv_fs_t req;
int rc = uv_fs_stat(env->event_loop(), &req, file_path.c_str(), nullptr);
@@ -3568,6 +3580,11 @@ void BindingData::LegacyMainResolve(const FunctionCallbackInfo<Value>& args) {
@@ -3546,6 +3558,11 @@ void BindingData::LegacyMainResolve(const FunctionCallbackInfo<Value>& args) {
std::optional<std::string> initial_file_path;
std::string file_path;
@@ -95,7 +95,7 @@ index c8e7e341b1d9f5a1142afdc265704455c252a0c3..7221708a2296ff44c19ed01dc52d7865
if (args.Length() >= 2 && args[1]->IsString()) {
auto package_config_main = Utf8Value(isolate, args[1]).ToString();
@@ -3588,7 +3605,7 @@ void BindingData::LegacyMainResolve(const FunctionCallbackInfo<Value>& args) {
@@ -3566,7 +3583,7 @@ void BindingData::LegacyMainResolve(const FunctionCallbackInfo<Value>& args) {
BufferValue buff_file_path(isolate, local_file_path);
ToNamespacedPath(env, &buff_file_path);
@@ -104,7 +104,7 @@ index c8e7e341b1d9f5a1142afdc265704455c252a0c3..7221708a2296ff44c19ed01dc52d7865
case BindingData::FilePathIsFileReturnType::kIsFile:
return args.GetReturnValue().Set(i);
case BindingData::FilePathIsFileReturnType::kIsNotFile:
@@ -3625,7 +3642,7 @@ void BindingData::LegacyMainResolve(const FunctionCallbackInfo<Value>& args) {
@@ -3603,7 +3620,7 @@ void BindingData::LegacyMainResolve(const FunctionCallbackInfo<Value>& args) {
BufferValue buff_file_path(isolate, local_file_path);
ToNamespacedPath(env, &buff_file_path);

View File

@@ -13,7 +13,7 @@ if the override has been disabled.
This will be upstreamed.
diff --git a/lib/internal/assert/utils.js b/lib/internal/assert/utils.js
index 13e41d67c635c27bd5e69eb4960eace34beaef0d..9a99c9ca93907630f9f3ba7ba24577a11465661c 100644
index d059fa89baf7d4f7d921d00871a97494be4a166a..a0f7fd2e4512e9b4196bbf5fe4390b00e5e2d9a8 100644
--- a/lib/internal/assert/utils.js
+++ b/lib/internal/assert/utils.js
@@ -24,6 +24,7 @@ const AssertionError = require('internal/assert/assertion_error');
@@ -44,7 +44,7 @@ index 13e41d67c635c27bd5e69eb4960eace34beaef0d..9a99c9ca93907630f9f3ba7ba24577a1
let filename = call.getFileName();
const line = call.getLineNumber() - 1;
diff --git a/src/node_options.cc b/src/node_options.cc
index 653112fbaea59fe8b446236085dcae8be671c6e5..415d4e34f29bc303674dccbfdc231b251401961b 100644
index 9cf107b1048208ffcb69ff91e0d36ffacc741805..367f7d9b1450e4d9e6d8fef36a2234e7d1344804 100644
--- a/src/node_options.cc
+++ b/src/node_options.cc
@@ -1566,14 +1566,16 @@ void GetEmbedderOptions(const FunctionCallbackInfo<Value>& args) {

View File

@@ -12,10 +12,10 @@ This can be removed/refactored once Node.js upgrades to a version of V8
containing the above CL.
diff --git a/src/node.cc b/src/node.cc
index 9d9992dacbc595c987827f55eb12ea8af0480df6..d43a88b8780f04d186485a2dc58ad07083e699ac 100644
index 19d9fb77f1aaf003e43b7d7016f45e6c35df06b3..9fad3198757ce639eb491eb628c6264a17002bf2 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -1222,7 +1222,7 @@ InitializeOncePerProcessInternal(const std::vector<std::string>& args,
@@ -1208,7 +1208,7 @@ InitializeOncePerProcessInternal(const std::vector<std::string>& args,
result->platform_ = per_process::v8_platform.Platform();
}

View File

@@ -11,7 +11,7 @@ before it's acceptable to upstream, as this patch comments out a couple
of tests that upstream probably cares about.
diff --git a/test/parallel/test-crypto-async-sign-verify.js b/test/parallel/test-crypto-async-sign-verify.js
index 7a5e72b1e8e498fdfa8de12aa9b9672dc047248c..f326c52894f86ef9c82c685a8685245138f01ed5 100644
index b35dd08e6c49796418cd9d10eb5cc9d02b39961e..97bcd79b331db140d157e6b1faf92625597edc98 100644
--- a/test/parallel/test-crypto-async-sign-verify.js
+++ b/test/parallel/test-crypto-async-sign-verify.js
@@ -89,6 +89,7 @@ test('rsa_public.pem', 'rsa_private.pem', 'sha256', false,
@@ -268,7 +268,7 @@ index 48cd1ed4df61aaddeee8785cb90f83bdd9628187..d09e01712c617597833bb1320a32a967
// No-pad encrypted string should return the same:
diff --git a/test/parallel/test-crypto-rsa-dsa.js b/test/parallel/test-crypto-rsa-dsa.js
index 119bc3c2d20ea7d681f0b579f9d91ad46cdc3634..8d13b105fa426015a873c411ad1d7f64b3d9580e 100644
index dcd5045daaf58c60e27c1e2f7941033302241339..b52ec0e2cd5d6b1c9a0fee3064f2f8ff3b6e4308 100644
--- a/test/parallel/test-crypto-rsa-dsa.js
+++ b/test/parallel/test-crypto-rsa-dsa.js
@@ -29,12 +29,11 @@ const dsaPkcs8KeyPem = fixtures.readKey('dsa_private_pkcs8.pem');
@@ -296,9 +296,9 @@ index 119bc3c2d20ea7d681f0b579f9d91ad46cdc3634..8d13b105fa426015a873c411ad1d7f64
- if (padding === constants.RSA_PKCS1_PADDING) {
+ if (!process.features.openssl_is_boringssl) {
if (!process.config.variables.node_shared_openssl) {
// TODO(richardlau) remove check and else branch after deps/openssl
// is upgraded.
@@ -489,7 +488,7 @@ assert.throws(() => {
assert.throws(() => {
crypto.privateDecrypt({
@@ -471,7 +470,7 @@ assert.throws(() => {
//
// Test DSA signing and verification
//

View File

@@ -6,7 +6,7 @@ Subject: fix: do not resolve electron entrypoints
This wastes fs cycles and can result in strange behavior if this path actually exists on disk
diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js
index 8e099e0961b624c6143f5a60f050855b3366f177..dfed827fd3fc794f52bad39ccf7b5c14b1caebc3 100644
index 8b55082d2bb0ce743b190a601aff0651095049cd..eb71a78c91b277157980aa1359578390c9fd1ae3 100644
--- a/lib/internal/modules/esm/translators.js
+++ b/lib/internal/modules/esm/translators.js
@@ -293,6 +293,9 @@ function cjsPreparseModuleExports(filename, source, isMain, format) {

View File

@@ -8,10 +8,10 @@ an API override to replace the native `ReadFileSync` in the `modules`
binding.
diff --git a/src/env_properties.h b/src/env_properties.h
index 5cb8dd86fe712755fe09556d227702aec905fbc9..f1768da6ef82fa85700fecbdf9321653345e92c5 100644
index d4961ac90fbc7fffe44f7d494bfae37ba0fa07e0..7b414e6733adff5740bd8e661846824962048c3e 100644
--- a/src/env_properties.h
+++ b/src/env_properties.h
@@ -506,6 +506,7 @@
@@ -505,6 +505,7 @@
V(maybe_cache_generated_source_map, v8::Function) \
V(messaging_deserialize_create_object, v8::Function) \
V(message_port, v8::Object) \

View File

@@ -64,10 +64,10 @@ index e718d7b3e7c11addc78cf7af33c93f63a9cb247b..3334818153068468967baa5adc1ed238
}
}
diff --git a/lib/internal/modules/esm/loader.js b/lib/internal/modules/esm/loader.js
index 87c14d1f84def72c1326e09154b38c417840634e..4491499e6da1724a7fd66b028a78ba145d6114aa 100644
index 8d98d50395cf7fbbaf9ae30387727bff5c6cd550..ed3b3c02bbdac78c163d589557651618814685a5 100644
--- a/lib/internal/modules/esm/loader.js
+++ b/lib/internal/modules/esm/loader.js
@@ -498,7 +498,7 @@ class ModuleLoader {
@@ -494,7 +494,7 @@ class ModuleLoader {
}
const cjsModule = wrap[imported_cjs_symbol];
@@ -77,20 +77,18 @@ index 87c14d1f84def72c1326e09154b38c417840634e..4491499e6da1724a7fd66b028a78ba14
// Check if the ESM initiating import CJS is being required by the same CJS module.
if (cjsModule?.[kIsExecuting]) {
diff --git a/lib/internal/modules/esm/resolve.js b/lib/internal/modules/esm/resolve.js
index 859b6bfedac4bbee2df054f9ebca7cbaaed45f18..5aa946f66c71beff0b7a43c30638ab28a1a5dfc0 100644
index 859b6bfedac4bbee2df054f9ebca7cbaaed45f18..a609671e64e3b159f6f00d4f69cde2039cc0bc38 100644
--- a/lib/internal/modules/esm/resolve.js
+++ b/lib/internal/modules/esm/resolve.js
@@ -750,6 +750,9 @@ function packageImportsResolve(name, base, conditions) {
@@ -750,6 +750,7 @@ function packageImportsResolve(name, base, conditions) {
throw importNotDefined(name, packageJSONUrl, base);
}
+const electronTypes = [
+ 'electron', 'electron/main', 'electron/common', 'electron/renderer', 'electron/utility'
+];
+const electronTypes = ['electron', 'electron/main', 'electron/common', 'electron/renderer'];
/**
* Resolves a package specifier to a URL.
@@ -764,6 +767,11 @@ function packageResolve(specifier, base, conditions) {
@@ -764,6 +765,11 @@ function packageResolve(specifier, base, conditions) {
return new URL('node:' + specifier);
}
@@ -103,7 +101,7 @@ index 859b6bfedac4bbee2df054f9ebca7cbaaed45f18..5aa946f66c71beff0b7a43c30638ab28
const packageConfig = packageJsonReader.read(packageJSONPath, { __proto__: null, specifier, base, isESM: true });
diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js
index d595ccbab8ce3042e83054e875eef612914115d8..7ea645b92a015b04cc121ff62aa1fc64b2961241 100644
index 3a69558d7a3dba5bfcb7d3c13299f698fe6c18a1..de1539cebeb1874cbafbe76a4f03217693db2aa1 100644
--- a/lib/internal/modules/esm/translators.js
+++ b/lib/internal/modules/esm/translators.js
@@ -188,7 +188,7 @@ function createCJSModuleWrap(url, source, isMain, format, loadCJS = loadCJSModul

View File

@@ -228,10 +228,10 @@ index d94f6e1c82c4a62547b3b395f375c86ce4deb5de..b81b9005365272217c77e2b9289bd9f8
X509View ca(sk_X509_value(peer_certs.get(), i));
if (!cert->view().isIssuedBy(ca)) continue;
diff --git a/src/crypto/crypto_context.cc b/src/crypto/crypto_context.cc
index 5e368e3fd93b560c629aef720acd576f118cb1d6..ea5179ad5155cb599891d7421cd61df719ac4cae 100644
index 64b850089ec837915910a243b1d5e4ed68655f63..508f7c1a49a0812583363c9e35244c3f5fbf5f89 100644
--- a/src/crypto/crypto_context.cc
+++ b/src/crypto/crypto_context.cc
@@ -141,7 +141,7 @@ int SSL_CTX_use_certificate_chain(SSL_CTX* ctx,
@@ -121,7 +121,7 @@ int SSL_CTX_use_certificate_chain(SSL_CTX* ctx,
// the CA certificates.
SSL_CTX_clear_extra_chain_certs(ctx);
@@ -240,7 +240,7 @@ index 5e368e3fd93b560c629aef720acd576f118cb1d6..ea5179ad5155cb599891d7421cd61df7
X509* ca = sk_X509_value(extra_certs, i);
// NOTE: Increments reference count on `ca`
@@ -1752,11 +1752,12 @@ void SecureContext::SetDHParam(const FunctionCallbackInfo<Value>& args) {
@@ -1584,11 +1584,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.
@@ -254,7 +254,7 @@ index 5e368e3fd93b560c629aef720acd576f118cb1d6..ea5179ad5155cb599891d7421cd61df7
DHPointer dh;
{
BIOPointer bio(LoadBIO(env, args[0]));
@@ -1982,7 +1983,7 @@ void SecureContext::LoadPKCS12(const FunctionCallbackInfo<Value>& args) {
@@ -1814,7 +1815,7 @@ void SecureContext::LoadPKCS12(const FunctionCallbackInfo<Value>& args) {
}
// Add CA certs too
@@ -555,7 +555,7 @@ index 7b2072ad39c3f1a7c73101b25b69beb781141e26..d23536d88d21255d348175425a59e242
#if NODE_OPENSSL_HAS_QUIC
#include <openssl/quic.h>
diff --git a/src/node_options.cc b/src/node_options.cc
index 249361e351946c16452124029c60fca52782adf9..653112fbaea59fe8b446236085dcae8be671c6e5 100644
index 228fbe645587ab2d36574b46f1a4f6668bd56177..9cf107b1048208ffcb69ff91e0d36ffacc741805 100644
--- a/src/node_options.cc
+++ b/src/node_options.cc
@@ -7,7 +7,7 @@
@@ -568,7 +568,7 @@ index 249361e351946c16452124029c60fca52782adf9..653112fbaea59fe8b446236085dcae8b
#endif
diff --git a/src/node_options.h b/src/node_options.h
index 2a1a6aaf9f2d358ffffb0a8171df470686b9450e..3ff1f4b4baa64b8ee2a4587e150ea14cb2fdfdf4 100644
index 0b75516eb426929dc95b7531a00bdb01d1c39185..2b7df46312b8be58d6062b6a2f6084247e075c37 100644
--- a/src/node_options.h
+++ b/src/node_options.h
@@ -11,7 +11,7 @@

View File

@@ -28,7 +28,7 @@ index 3334818153068468967baa5adc1ed2382592ec76..ab4c8a4d00f1813e72f1ea8349850b40
const result = dataURLProcessor(url);
if (result === 'failure') {
diff --git a/lib/internal/modules/esm/resolve.js b/lib/internal/modules/esm/resolve.js
index 5aa946f66c71beff0b7a43c30638ab28a1a5dfc0..e3afd30ba1f591d0298793bc42fd7166a4219bce 100644
index a609671e64e3b159f6f00d4f69cde2039cc0bc38..7572bfc34d4c21b2ad618a68c4a2026400ad7338 100644
--- a/lib/internal/modules/esm/resolve.js
+++ b/lib/internal/modules/esm/resolve.js
@@ -25,7 +25,7 @@ const {
@@ -50,7 +50,7 @@ index 5aa946f66c71beff0b7a43c30638ab28a1a5dfc0..e3afd30ba1f591d0298793bc42fd7166
});
const { search, hash } = resolved;
diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js
index 7ea645b92a015b04cc121ff62aa1fc64b2961241..8e099e0961b624c6143f5a60f050855b3366f177 100644
index de1539cebeb1874cbafbe76a4f03217693db2aa1..8b55082d2bb0ce743b190a601aff0651095049cd 100644
--- a/lib/internal/modules/esm/translators.js
+++ b/lib/internal/modules/esm/translators.js
@@ -25,7 +25,7 @@ const {

View File

@@ -48,7 +48,7 @@ index fe669d40c31a29334b047b9cfee3067f64ef0a7b..9e5de7bbe574add017cd12ee091304d0
static CFunction fast_timing_safe_equal(CFunction::Make(FastTimingSafeEqual));
diff --git a/src/node_buffer.cc b/src/node_buffer.cc
index e39852c8e0392e0a9ae5d4ea58be115416e19233..c94b14741c827a81d69a6f036426a344e563ad72 100644
index d0338b8a2d9cd3fd9f6db1f0f16f83b198ce0e7e..c4a87539dab49ff40e0951616777b132d4059e01 100644
--- a/src/node_buffer.cc
+++ b/src/node_buffer.cc
@@ -44,6 +44,14 @@
@@ -135,7 +135,7 @@ index e39852c8e0392e0a9ae5d4ea58be115416e19233..c94b14741c827a81d69a6f036426a344
}
static v8::CFunction fast_compare(v8::CFunction::Make(FastCompare));
@@ -1149,14 +1159,13 @@ void SlowIndexOfNumber(const FunctionCallbackInfo<Value>& args) {
@@ -1148,14 +1158,13 @@ void SlowIndexOfNumber(const FunctionCallbackInfo<Value>& args) {
}
int32_t FastIndexOfNumber(v8::Local<v8::Value>,
@@ -153,7 +153,7 @@ index e39852c8e0392e0a9ae5d4ea58be115416e19233..c94b14741c827a81d69a6f036426a344
}
static v8::CFunction fast_index_of_number(
@@ -1496,21 +1505,31 @@ void SlowWriteString(const FunctionCallbackInfo<Value>& args) {
@@ -1495,21 +1504,31 @@ void SlowWriteString(const FunctionCallbackInfo<Value>& args) {
template <encoding encoding>
uint32_t FastWriteString(Local<Value> receiver,
@@ -194,7 +194,7 @@ index e39852c8e0392e0a9ae5d4ea58be115416e19233..c94b14741c827a81d69a6f036426a344
static const v8::CFunction fast_write_string_ascii(
diff --git a/src/util.h b/src/util.h
index dbec66247852df91c57c2a4e9664d2fea7d3dcef..efeb12d837db7b88093e4a6a2e20df562180ca1e 100644
index 6376cf4f81113cdb2e3c179b800f1c79b51ab762..cc7ad99f981f564fba0395159d9d8b39901050ff 100644
--- a/src/util.h
+++ b/src/util.h
@@ -60,6 +60,7 @@

View File

@@ -0,0 +1,25 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shelley Vohr <shelley.vohr@gmail.com>
Date: Fri, 18 Oct 2024 17:01:06 +0200
Subject: fix: remove harmony-import-assertions from node.cc
harmony-import-assertions has been removed from V8 as of
https://chromium-review.googlesource.com/c/v8/v8/+/5507047,
so we should remove it from node.cc as well.
This patch can be removed when we upgrade to a V8 version that
contains the above CL.
diff --git a/src/node.cc b/src/node.cc
index c0d0b734edfa729c91a8112189c480e3f2382988..a43d36c731693b9d2ed1ba13f6b4bb33bf6c4ca4 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -816,7 +816,7 @@ static ExitCode ProcessGlobalArgsInternal(std::vector<std::string>* args,
}
// TODO(nicolo-ribaudo): remove this once V8 doesn't enable it by default
// anymore.
- v8_args.emplace_back("--no-harmony-import-assertions");
+ // v8_args.emplace_back("--no-harmony-import-assertions");
auto env_opts = per_process::cli_options->per_isolate->per_env;
if (std::find(v8_args.begin(), v8_args.end(),

View File

@@ -1,36 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shelley Vohr <shelley.vohr@gmail.com>
Date: Fri, 18 Oct 2024 17:01:06 +0200
Subject: fix: remove outdated V8 flags from node.cc
Refs https://chromium-review.googlesource.com/c/v8/v8/+/5507047
Refs https://chromium-review.googlesource.com/c/v8/v8/+/6249026
The above CL removes the `--harmony-import-assertions` and
--experimental-wasm-memory64 flags from V8.
This patch can be removed when we upgrade to a V8 version that
contains the above CLs.
diff --git a/src/node.cc b/src/node.cc
index 1b5e989e5456a9bf77475e06250702029568c08d..61d65094aebd7f3016d51a8e7c9c761fc69cecba 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -816,7 +816,7 @@ static ExitCode ProcessGlobalArgsInternal(std::vector<std::string>* args,
}
// TODO(nicolo-ribaudo): remove this once V8 doesn't enable it by default
// anymore.
- v8_args.emplace_back("--no-harmony-import-assertions");
+ // v8_args.emplace_back("--no-harmony-import-assertions");
auto env_opts = per_process::cli_options->per_isolate->per_env;
if (std::find(v8_args.begin(), v8_args.end(),
@@ -828,7 +828,7 @@ static ExitCode ProcessGlobalArgsInternal(std::vector<std::string>* args,
// Support stable Phase 5 WebAssembly proposals
v8_args.emplace_back("--experimental-wasm-imported-strings");
- v8_args.emplace_back("--experimental-wasm-memory64");
+ // v8_args.emplace_back("--experimental-wasm-memory64");
v8_args.emplace_back("--experimental-wasm-exnref");
#ifdef __POSIX__

View File

@@ -6,10 +6,10 @@ Subject: Pass all globals through "require"
(cherry picked from commit 7d015419cb7a0ecfe6728431a4ed2056cd411d62)
diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js
index a7d8fa1139c82054ac37a4e11cfb68605dc21f31..589c239aa544e118b7d9b7fff86d7deefe903896 100644
index 9b51e5bf4cdfbc8127efc7d5882581daa1cbd81f..aca7c36e9b566847228bd4f13f2c8237509207db 100644
--- a/lib/internal/modules/cjs/loader.js
+++ b/lib/internal/modules/cjs/loader.js
@@ -202,6 +202,13 @@ const {
@@ -200,6 +200,13 @@ const {
CHAR_FORWARD_SLASH,
} = require('internal/constants');
@@ -23,7 +23,7 @@ index a7d8fa1139c82054ac37a4e11cfb68605dc21f31..589c239aa544e118b7d9b7fff86d7dee
const {
isProxy,
} = require('internal/util/types');
@@ -1701,10 +1708,12 @@ Module.prototype._compile = function(content, filename, format) {
@@ -1683,10 +1690,12 @@ Module.prototype._compile = function(content, filename, format) {
if (this[kIsMainSymbol] && getOptionValue('--inspect-brk')) {
const { callAndPauseOnStart } = internalBinding('inspector');
result = callAndPauseOnStart(compiledWrapper, thisValue, exports,

View File

@@ -7,7 +7,7 @@ We use this to allow node's 'fs' module to read from ASAR files as if they were
a real filesystem.
diff --git a/lib/internal/bootstrap/node.js b/lib/internal/bootstrap/node.js
index 1a39b9f15e689e5c7ca1e3001b2ef6d854f8cc1e..9035311718c0a68e903e0ce748480bc78112c6ff 100644
index dd9e3e58d72fb9ada1528212f80e0e911292a266..5758c74f6139dbe4fbeeae9d1e9b078688261257 100644
--- a/lib/internal/bootstrap/node.js
+++ b/lib/internal/bootstrap/node.js
@@ -132,6 +132,10 @@ process.domain = null;

View File

@@ -102,10 +102,10 @@ index 1079e3beb02e5f5d71a15fd2db65cb93ebd175d6..a7be609c3ab9093cec5145367b95ae68
worker::Worker* worker_context_ = nullptr;
PerIsolateWrapperData* wrapper_data_;
diff --git a/src/node.cc b/src/node.cc
index 61d65094aebd7f3016d51a8e7c9c761fc69cecba..0d383dcdb80fe30e3c2d6880b44f626f065bb1f3 100644
index a43d36c731693b9d2ed1ba13f6b4bb33bf6c4ca4..0c2a4d344c991c2ca0d9d90934cf7921abf2a629 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -1271,6 +1271,14 @@ InitializeOncePerProcessInternal(const std::vector<std::string>& args,
@@ -1257,6 +1257,14 @@ InitializeOncePerProcessInternal(const std::vector<std::string>& args,
result->platform_ = per_process::v8_platform.Platform();
}
@@ -120,7 +120,7 @@ index 61d65094aebd7f3016d51a8e7c9c761fc69cecba..0d383dcdb80fe30e3c2d6880b44f626f
if (!(flags & ProcessInitializationFlags::kNoInitializeV8)) {
V8::Initialize();
@@ -1280,14 +1288,6 @@ InitializeOncePerProcessInternal(const std::vector<std::string>& args,
@@ -1266,14 +1274,6 @@ InitializeOncePerProcessInternal(const std::vector<std::string>& args,
absl::SetMutexDeadlockDetectionMode(absl::OnDeadlockCycle::kIgnore);
}
@@ -174,10 +174,10 @@ index 4119ac1b002681d39711eac810ca2fcc2702ffc7..790347056cde949ffe6cf8498a7eca0c
ExitCode NodeMainInstance::Run() {
diff --git a/src/node_worker.cc b/src/node_worker.cc
index e2dbdd39b06c4f2f85eba46cbf1383af144456c6..6c43928ba5a9752c78544d1c77198278eb11ccd7 100644
index 9d56d8f793ef48a79867f465530554ae0226f2cd..842eb999c6ef0cb877cc2ee4acf75bb597a117da 100644
--- a/src/node_worker.cc
+++ b/src/node_worker.cc
@@ -163,6 +163,9 @@ class WorkerThreadData {
@@ -162,6 +162,9 @@ class WorkerThreadData {
SetIsolateCreateParamsForNode(&params);
w->UpdateResourceConstraints(&params.constraints);
params.array_buffer_allocator_shared = allocator;
@@ -187,7 +187,7 @@ index e2dbdd39b06c4f2f85eba46cbf1383af144456c6..6c43928ba5a9752c78544d1c77198278
Isolate* isolate =
NewIsolate(&params, &loop_, w->platform_, w->snapshot_data());
if (isolate == nullptr) {
@@ -231,13 +234,8 @@ class WorkerThreadData {
@@ -230,13 +233,8 @@ class WorkerThreadData {
*static_cast<bool*>(data) = true;
}, &platform_finished);

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 0546a81ef11ec7ac8d6e214e4090b0e7b94bf70f..25b08be32c7a0aa501b64102f10c9bffc8c57970 100644
index 6303908ce180db4d409707ae1f049319358642fb..d487497417e20c778dde57197dc18373799df36a 100644
--- a/test/parallel/parallel.status
+++ b/test/parallel/parallel.status
@@ -5,6 +5,16 @@ prefix parallel

View File

@@ -6,10 +6,10 @@ Subject: test: use static method names in call stacks
Refs: https://chromium-review.googlesource.com/c/v8/v8/+/5907815
diff --git a/test/message/assert_throws_stack.out b/test/message/assert_throws_stack.out
index 1ecda64889e07fe64d03404d478311f9f8267a4e..2b5587292a2c7a8797589804f14bfd0c3e9725f8 100644
index b1f3ea2108ba9c1a4f98928062b44b927eea31f2..897ddf36a04eb03edd01dd6b9a6fb4394cbdf114 100644
--- a/test/message/assert_throws_stack.out
+++ b/test/message/assert_throws_stack.out
@@ -24,7 +24,7 @@ AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal:
@@ -23,7 +23,7 @@ AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal:
actual: Error: foo
at assert.throws.bar (*assert_throws_stack.js:*)
at getActual (node:assert:*)

View File

@@ -113,8 +113,5 @@ mv_if_exist src/out/Default/hunspell_dictionaries.zip
mv_if_exist src/cross-arch-snapshots
cp_if_exist src/out/electron_ninja_log
cp_if_exist src/out/Default/.ninja_log
if [ -n "$SISO_REPORT_PATH" ]; then
cp_if_exist "$SISO_REPORT_PATH"
fi
move_src_dirs_if_exist

62
script/add-debug-link.py Executable file
View File

@@ -0,0 +1,62 @@
#!/usr/bin/env python3
import argparse
import os
import sys
from lib.config import PLATFORM
from lib.util import execute, get_linux_binaries, get_out_dir
def add_debug_link_into_binaries(directory, target_cpu, debug_dir):
for binary in get_linux_binaries():
binary_path = os.path.join(directory, binary)
if os.path.isfile(binary_path):
add_debug_link_into_binary(binary_path, target_cpu, debug_dir)
def add_debug_link_into_binary(binary_path, target_cpu, debug_dir):
if PLATFORM == 'linux' and target_cpu in ('x86', 'arm', 'arm64'):
# Skip because no objcopy binary on the given target.
return
debug_name = get_debug_name(binary_path)
# Make sure the path to the binary is not relative because of cwd param.
real_binary_path = os.path.realpath(binary_path)
cmd = ['objcopy', '--add-gnu-debuglink=' + debug_name, real_binary_path]
execute(cmd, cwd=debug_dir)
def get_debug_name(binary_path):
return os.path.basename(binary_path) + '.debug'
def main():
args = parse_args()
if args.file:
add_debug_link_into_binary(args.file, args.target_cpu, args.debug_dir)
else:
add_debug_link_into_binaries(args.directory, args.target_cpu,
args.debug_dir)
def parse_args():
parser = argparse.ArgumentParser(description='Add debug link to binaries')
parser.add_argument('-d', '--directory',
help='Path to the dir that contains files to add links',
default=get_out_dir(),
required=False)
parser.add_argument('-f', '--file',
help='Path to a specific file to add debug link',
required=False)
parser.add_argument('-s', '--debug-dir',
help='Path to the dir that contain the debugs',
default=None,
required=True)
parser.add_argument('-v', '--verbose',
action='store_true',
help='Prints the output of the subprocesses')
parser.add_argument('--target-cpu',
default='',
required=False,
help='Target cpu of binaries to add debug link')
return parser.parse_args()
if __name__ == '__main__':
sys.exit(main())

69
script/copy-debug-symbols.py Executable file
View File

@@ -0,0 +1,69 @@
#!/usr/bin/env python3
import argparse
import os
import sys
from lib.config import PLATFORM
from lib.util import execute, get_linux_binaries, get_out_dir, safe_mkdir
# It has to be done before stripping the binaries.
def copy_debug_from_binaries(directory, out_dir, target_cpu, compress):
for binary in get_linux_binaries():
binary_path = os.path.join(directory, binary)
if os.path.isfile(binary_path):
copy_debug_from_binary(binary_path, out_dir, target_cpu, compress)
def copy_debug_from_binary(binary_path, out_dir, target_cpu, compress):
if PLATFORM == 'linux' and target_cpu in ('x86', 'arm', 'arm64'):
# Skip because no objcopy binary on the given target.
return
debug_name = get_debug_name(binary_path)
cmd = ['objcopy', '--only-keep-debug']
if compress:
cmd.extend(['--compress-debug-sections'])
cmd.extend([binary_path, os.path.join(out_dir, debug_name)])
execute(cmd)
def get_debug_name(binary_path):
return os.path.basename(binary_path) + '.debug'
def main():
args = parse_args()
safe_mkdir(args.out_dir)
if args.file:
copy_debug_from_binary(args.file, args.out_dir, args.target_cpu,
args.compress)
else:
copy_debug_from_binaries(args.directory, args.out_dir, args.target_cpu,
args.compress)
def parse_args():
parser = argparse.ArgumentParser(description='Copy debug from binaries')
parser.add_argument('-d', '--directory',
help='Path to the dir that contains files to copy',
default=get_out_dir(),
required=False)
parser.add_argument('-f', '--file',
help='Path to a specific file to copy debug symbols',
required=False)
parser.add_argument('-o', '--out-dir',
help='Path to the dir that will contain the debugs',
default=None,
required=True)
parser.add_argument('-v', '--verbose',
action='store_true',
help='Prints the output of the subprocesses')
parser.add_argument('--target-cpu',
default='',
required=False,
help='Target cpu of binaries to copy debug symbols')
parser.add_argument('--compress',
action='store_true',
required=False,
help='Compress the debug symbols')
return parser.parse_args()
if __name__ == '__main__':
sys.exit(main())

View File

@@ -207,3 +207,14 @@ def get_depot_tools_executable(name):
if sys.platform == 'win32':
path += '.bat'
return path
def get_linux_binaries():
return [
'chrome-sandbox',
'chrome_crashpad_handler',
get_electron_branding()['project_name'],
'libEGL.so',
'libGLESv2.so',
'libffmpeg.so',
'libvk_swiftshader.so',
]

View File

@@ -118,7 +118,6 @@
"parallel/test-tls-server-failed-handshake-emits-clienterror",
"parallel/test-tls-set-ciphers",
"parallel/test-tls-set-ciphers-error",
"parallel/test-tls-set-default-ca-certificates-recovery",
"parallel/test-tls-set-sigalgs",
"parallel/test-tls-socket-allow-half-open-option",
"parallel/test-tls-socket-failed-handshake-emits-error",

View File

@@ -16,6 +16,10 @@ for fs_file in fs_files:
'lib/original-fs.js').replace('lib/fs/',
'lib/original-fs/')
with open(os.path.join(out_dir, fs_file), 'w', encoding='utf-8'
) as original_f:
original_f.write(contents)
with open(os.path.join(out_dir, original_fs_file), 'w',
encoding='utf-8') as transformed_f:
transformed_contents = contents.replace('internal/fs/',

81
script/strip-binaries.py Executable file
View File

@@ -0,0 +1,81 @@
#!/usr/bin/env python3
import argparse
import os
import sys
from lib.config import set_verbose_mode, is_verbose_mode, verbose_mode_print
from lib.util import execute, get_linux_binaries, get_out_dir
def get_size(path):
size = os.path.getsize(path)
units = ["bytes", "KB", "MB", "GB"]
for unit in units:
if size < 1024:
return f"{size:.2f} {unit}"
size /= 1024
raise ValueError("File size is too large to be processed")
def strip_binaries(directory, target_cpu):
if not os.path.isdir(directory):
verbose_mode_print('Directory ' + directory + ' does not exist.')
return
verbose_mode_print('Stripping binaries in ' + directory)
for binary in get_linux_binaries():
verbose_mode_print('\nStripping ' + binary)
binary_path = os.path.join(directory, binary)
if os.path.isfile(binary_path):
strip_binary(binary_path, target_cpu)
def strip_binary(binary_path, target_cpu):
if target_cpu == 'arm':
strip = 'arm-linux-gnueabihf-strip'
elif target_cpu == 'arm64':
strip = 'aarch64-linux-gnu-strip'
else:
strip = 'strip'
strip_args = [strip,
'--discard-all',
'--strip-debug',
'--preserve-dates',
binary_path]
if (is_verbose_mode()):
strip_args.insert(1, '--verbose')
verbose_mode_print('Binary size before stripping: ' +
str(get_size(binary_path)))
execute(strip_args)
verbose_mode_print('Binary size after stripping: ' +
str(get_size(binary_path)))
def main():
args = parse_args()
set_verbose_mode(args.verbose)
if args.file:
strip_binary(args.file, args.target_cpu)
else:
strip_binaries(args.directory, args.target_cpu)
def parse_args():
parser = argparse.ArgumentParser(description='Strip linux binaries')
parser.add_argument('-d', '--directory',
help='Path to the dir that contains files to strip.',
default=get_out_dir(),
required=False)
parser.add_argument('-f', '--file',
help='Path to a specific file to strip.',
required=False)
parser.add_argument('-v', '--verbose',
default=False,
action='store_true',
help='Prints the output of the subprocesses')
parser.add_argument('--target-cpu',
default='',
required=False,
help='Target cpu of binaries to strip')
return parser.parse_args()
if __name__ == '__main__':
sys.exit(main())

View File

@@ -23,13 +23,10 @@
#include "components/content_settings/core/common/content_settings_pattern.h"
#include "content/public/app/initialize_mojo_core.h"
#include "content/public/common/content_switches.h"
#include "crypto/hash.h"
#include "electron/buildflags/buildflags.h"
#include "electron/fuses.h"
#include "electron/mas.h"
#include "electron/snapshot_checksum.h"
#include "extensions/common/constants.h"
#include "gin/v8_initializer.h"
#include "ipc/ipc_buildflags.h"
#include "sandbox/policy/switches.h"
#include "services/tracing/public/cpp/stack_sampling/tracing_sampler_profiler.h"
@@ -52,7 +49,6 @@
#include "third_party/abseil-cpp/absl/types/variant.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/ui_base_switches.h"
#include "v8/include/v8-snapshot.h"
#if BUILDFLAG(IS_MAC)
#include "shell/app/electron_main_delegate_mac.h"
@@ -210,20 +206,6 @@ void RegisterPathProvider() {
PATH_END);
}
void ValidateV8Snapshot(v8::StartupData* data) {
if (data->data &&
electron::fuses::IsEmbeddedAsarIntegrityValidationEnabled()) {
CHECK_GT(data->raw_size, 0);
UNSAFE_BUFFERS({
base::span<const char> span_data(
data->data, static_cast<unsigned long>(data->raw_size));
CHECK(base::ToLowerASCII(base::HexEncode(
crypto::hash::Sha256(base::as_bytes(span_data)))) ==
electron::snapshot_checksum::kChecksum);
})
}
}
} // namespace
std::string LoadResourceBundle(const std::string& locale) {
@@ -247,9 +229,7 @@ std::string LoadResourceBundle(const std::string& locale) {
return loaded_locale;
}
ElectronMainDelegate::ElectronMainDelegate() {
gin::SetV8SnapshotValidator(base::BindRepeating(&ValidateV8Snapshot));
}
ElectronMainDelegate::ElectronMainDelegate() = default;
ElectronMainDelegate::~ElectronMainDelegate() = default;

View File

@@ -52,12 +52,10 @@ gin::WrapperInfo Tray::kWrapperInfo = {gin::kEmbedderNativeGin};
Tray::Tray(v8::Isolate* isolate,
v8::Local<v8::Value> image,
std::optional<base::Uuid> guid)
: guid_(guid), tray_icon_(TrayIcon::Create(guid)) {
std::optional<UUID> guid)
: tray_icon_(TrayIcon::Create(guid)) {
SetImage(isolate, image);
tray_icon_->AddObserver(this);
if (guid.has_value())
tray_icon_->SetAutoSaveName(guid.value().AsLowercaseString());
}
Tray::~Tray() = default;
@@ -65,17 +63,19 @@ Tray::~Tray() = default;
// static
gin::Handle<Tray> Tray::New(gin_helper::ErrorThrower thrower,
v8::Local<v8::Value> image,
std::optional<base::Uuid> guid,
std::optional<UUID> guid,
gin::Arguments* args) {
if (!Browser::Get()->is_ready()) {
thrower.ThrowError("Cannot create Tray before app is ready");
return {};
}
#if BUILDFLAG(IS_WIN)
if (!guid.has_value() && args->Length() > 1) {
thrower.ThrowError("Invalid GUID format - GUID must be a string");
thrower.ThrowError("Invalid GUID format");
return {};
}
#endif
// Error thrown by us will be dropped when entering V8.
// Make sure to abort early and propagate the error to JS.
@@ -392,15 +392,6 @@ gfx::Rect Tray::GetBounds() {
return tray_icon_->GetBounds();
}
v8::Local<v8::Value> Tray::GetGUID() {
if (!CheckAlive())
return {};
auto* isolate = JavascriptEnvironment::GetIsolate();
if (!guid_)
return v8::Null(isolate);
return gin::ConvertToV8(isolate, guid_.value());
}
bool Tray::CheckAlive() {
if (!tray_icon_) {
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
@@ -433,7 +424,6 @@ void Tray::FillObjectTemplate(v8::Isolate* isolate,
.SetMethod("closeContextMenu", &Tray::CloseContextMenu)
.SetMethod("setContextMenu", &Tray::SetContextMenu)
.SetMethod("getBounds", &Tray::GetBounds)
.SetMethod("getGUID", &Tray::GetGUID)
.Build();
}

View File

@@ -48,7 +48,7 @@ class Tray final : public gin::Wrappable<Tray>,
// gin_helper::Constructible
static gin::Handle<Tray> New(gin_helper::ErrorThrower thrower,
v8::Local<v8::Value> image,
std::optional<base::Uuid> guid,
std::optional<UUID> guid,
gin::Arguments* args);
static void FillObjectTemplate(v8::Isolate*, v8::Local<v8::ObjectTemplate>);
@@ -68,7 +68,7 @@ class Tray final : public gin::Wrappable<Tray>,
private:
Tray(v8::Isolate* isolate,
v8::Local<v8::Value> image,
std::optional<base::Uuid> guid);
std::optional<UUID> guid);
~Tray() override;
// TrayIconObserver:
@@ -114,12 +114,10 @@ class Tray final : public gin::Wrappable<Tray>,
void SetContextMenu(gin_helper::ErrorThrower thrower,
v8::Local<v8::Value> arg);
gfx::Rect GetBounds();
v8::Local<v8::Value> GetGUID();
bool CheckAlive();
v8::Global<v8::Value> menu_;
std::optional<base::Uuid> guid_;
std::unique_ptr<TrayIcon> tray_icon_;
};

View File

@@ -1208,6 +1208,31 @@ content::WebContents* WebContents::CreateCustomWebContents(
return nullptr;
}
void WebContents::MaybeOverrideCreateParamsForNewWindow(
content::WebContents::CreateParams* create_params) {
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
v8::HandleScope handle_scope(isolate);
gin_helper::Dictionary dict;
gin::ConvertFromV8(isolate, pending_child_web_preferences_.Get(isolate),
&dict);
v8::Local<v8::Value> use_offscreen;
if (dict.Get(options::kOffscreen, &use_offscreen)) {
bool is_offscreen =
use_offscreen->IsObject() ||
(use_offscreen->IsBoolean() &&
dict.Get(options::kOffscreen, &is_offscreen) && is_offscreen);
if (is_offscreen) {
auto* view = new OffScreenWebContentsView(
false, offscreen_use_shared_texture_,
base::BindRepeating(&WebContents::OnPaint, base::Unretained(this)));
create_params->view = view;
create_params->delegate_view = view;
}
}
}
content::WebContents* WebContents::AddNewContents(
content::WebContents* source,
std::unique_ptr<content::WebContents> new_contents,
@@ -1221,9 +1246,13 @@ content::WebContents* WebContents::AddNewContents(
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
Type type = Type::kBrowserWindow;
auto* web_preferences = WebContentsPreferences::From(new_contents.get());
if (web_preferences && web_preferences->IsOffscreen())
type = Type::kOffScreen;
v8::HandleScope handle_scope(isolate);
auto api_web_contents =
CreateAndTake(isolate, std::move(new_contents), Type::kBrowserWindow);
auto api_web_contents = CreateAndTake(isolate, std::move(new_contents), type);
// We call RenderFrameCreated here as at this point the empty "about:blank"
// render frame has already been created. If the window never navigates again
@@ -2001,21 +2030,16 @@ SkRegion* WebContents::draggable_region() {
void WebContents::DidStartNavigation(
content::NavigationHandle* navigation_handle) {
base::AutoReset<bool> resetter(&is_safe_to_delete_, false);
EmitNavigationEvent("did-start-navigation", navigation_handle);
}
void WebContents::DidRedirectNavigation(
content::NavigationHandle* navigation_handle) {
base::AutoReset<bool> resetter(&is_safe_to_delete_, false);
EmitNavigationEvent("did-redirect-navigation", navigation_handle);
}
void WebContents::ReadyToCommitNavigation(
content::NavigationHandle* navigation_handle) {
base::AutoReset<bool> resetter(&is_safe_to_delete_, false);
EmitNavigationEvent("-ready-to-commit-navigation", navigation_handle);
// Don't focus content in an inactive window.
if (!owner_window())
return;
@@ -2358,7 +2382,7 @@ void WebContents::LoadURL(const GURL& url,
// http://crbug.com/347742.
auto& ctrl_impl = static_cast<content::NavigationControllerImpl&>(
web_contents()->GetController());
if (!is_safe_to_delete_ || ctrl_impl.in_navigate_to_pending_entry()) {
if (ctrl_impl.in_navigate_to_pending_entry()) {
Emit("did-fail-load", static_cast<int>(net::ERR_FAILED),
net::ErrorToShortString(net::ERR_FAILED), url.possibly_invalid_spec(),
true);

View File

@@ -508,6 +508,8 @@ class WebContents final : public ExclusiveAccessContext,
int opener_render_frame_id,
const content::mojom::CreateNewWindowParams& params,
content::WebContents* new_contents) override;
void MaybeOverrideCreateParamsForNewWindow(
content::WebContents::CreateParams* create_params) override;
content::WebContents* AddNewContents(
content::WebContents* source,
std::unique_ptr<content::WebContents> new_contents,
@@ -856,9 +858,6 @@ class WebContents final : public ExclusiveAccessContext,
const scoped_refptr<base::TaskRunner> print_task_runner_;
#endif
// Track navigation state in order to avoid potential re-entrancy crashes.
bool is_safe_to_delete_ = true;
// Stores the frame that's currently in fullscreen, nullptr if there is none.
raw_ptr<content::RenderFrameHost> fullscreen_frame_ = nullptr;

View File

@@ -411,18 +411,19 @@ v8::Local<v8::Value> Browser::GetLoginItemSettings(
#else
// If the app was previously set as a LoginItem with the deprecated API,
// we should report its LoginItemSettings via the old API.
LoginItemSettings settings_deprecated = GetLoginItemSettingsDeprecated();
if (@available(macOS 13, *)) {
const std::string status =
platform_util::GetLoginItemEnabled(options.type, options.service_name);
if (status == "enabled-deprecated") {
settings = GetLoginItemSettingsDeprecated();
settings = settings_deprecated;
} else {
settings.open_at_login = status == "enabled";
settings.opened_at_login = was_launched_at_login_;
settings.status = status;
}
} else {
settings = GetLoginItemSettingsDeprecated();
settings = settings_deprecated;
}
#endif
return gin::ConvertToV8(isolate, settings);

View File

@@ -310,9 +310,6 @@ class NativeWindowViews : public NativeWindow,
// Whether the window is currently being moved.
bool is_moving_ = false;
// Whether or not the window was previously snapped e.g. before minimizing.
bool was_snapped_ = false;
std::variant<std::monostate, bool, SkColor> accent_color_;
std::optional<gfx::Rect> pending_bounds_change_;

View File

@@ -322,6 +322,11 @@ bool NativeWindowViews::PreHandleMSG(UINT message,
return false;
}
case WM_RBUTTONUP: {
if (!has_frame())
electron::api::WebContents::SetDisableDraggableRegions(false);
return false;
}
case WM_GETMINMAXINFO: {
WINDOWPLACEMENT wp;
wp.length = sizeof(WINDOWPLACEMENT);
@@ -457,12 +462,11 @@ bool NativeWindowViews::PreHandleMSG(UINT message,
return false;
}
case WM_SYSCOMMAND: {
WPARAM cmd = w_param & 0xFFF0;
// Needed to account for double clicking title bar to maximize.
if (transparent() && (cmd == SC_MAXIMIZE))
// Mask is needed to account for double clicking title bar to maximize
WPARAM max_mask = 0xFFF0;
if (transparent() && ((w_param & max_mask) == SC_MAXIMIZE)) {
return true;
if (cmd == SC_MINIMIZE)
was_snapped_ = IsSnapped();
}
return false;
}
case WM_INITMENU: {
@@ -515,13 +519,8 @@ void NativeWindowViews::HandleSizeEvent(WPARAM w_param, LPARAM l_param) {
// multiple times for one resize because of the SetWindowPlacement call.
if (w_param == SIZE_MAXIMIZED &&
last_window_state_ != ui::mojom::WindowShowState::kMaximized) {
if (last_window_state_ == ui::mojom::WindowShowState::kMinimized) {
if (was_snapped_) {
SetRoundedCorners(false);
was_snapped_ = false;
}
if (last_window_state_ == ui::mojom::WindowShowState::kMinimized)
NotifyWindowRestore();
}
last_window_state_ = ui::mojom::WindowShowState::kMaximized;
NotifyWindowMaximize();
ResetWindowControls();
@@ -543,10 +542,6 @@ void NativeWindowViews::HandleSizeEvent(WPARAM w_param, LPARAM l_param) {
last_window_state_ = ui::mojom::WindowShowState::kFullscreen;
NotifyWindowEnterFullScreen();
} else {
if (was_snapped_) {
SetRoundedCorners(false);
was_snapped_ = false;
}
last_window_state_ = ui::mojom::WindowShowState::kNormal;
NotifyWindowRestore();
}

View File

@@ -160,7 +160,6 @@ DialogResult ShowTaskDialogWstr(gfx::AcceleratedWidget parent,
if (parent) {
config.hwndParent = parent;
config.dwFlags |= TDF_POSITION_RELATIVE_TO_WINDOW;
}
if (default_id > 0)

View File

@@ -16,8 +16,6 @@ gfx::Rect TrayIcon::GetBounds() {
return {};
}
void TrayIcon::SetAutoSaveName(const std::string& name) {}
void TrayIcon::NotifyClicked(const gfx::Rect& bounds,
const gfx::Point& location,
int modifiers) {

View File

@@ -18,7 +18,7 @@ namespace electron {
class TrayIcon {
public:
static TrayIcon* Create(std::optional<base::Uuid> guid);
static TrayIcon* Create(std::optional<UUID> guid);
#if BUILDFLAG(IS_WIN)
using ImageType = HICON;
@@ -99,8 +99,6 @@ class TrayIcon {
// Returns the bounds of tray icon.
virtual gfx::Rect GetBounds();
virtual void SetAutoSaveName(const std::string& name);
void AddObserver(TrayIconObserver* obs) { observers_.AddObserver(obs); }
void RemoveObserver(TrayIconObserver* obs) { observers_.RemoveObserver(obs); }

View File

@@ -35,7 +35,6 @@ class TrayIconCocoa : public TrayIcon {
void CloseContextMenu() override;
void SetContextMenu(raw_ptr<ElectronMenuModel> menu_model) override;
gfx::Rect GetBounds() override;
void SetAutoSaveName(const std::string& name) override;
base::WeakPtr<TrayIconCocoa> GetWeakPtr() {
return weak_factory_.GetWeakPtr();

View File

@@ -11,7 +11,6 @@
#include "base/message_loop/message_pump_apple.h"
#include "base/strings/sys_string_conversions.h"
#include "base/task/current_thread.h"
#include "base/uuid.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "shell/browser/ui/cocoa/NSString+ANSI.h"
@@ -69,10 +68,6 @@
[self setFrame:[statusItem_ button].frame];
}
- (void)setAutosaveName:(NSString*)name {
statusItem_.autosaveName = name;
}
- (void)updateTrackingAreas {
// Use NSTrackingArea for listening to mouseEnter, mouseExit, and mouseMove
// events.
@@ -425,12 +420,8 @@ gfx::Rect TrayIconCocoa::GetBounds() {
return gfx::ScreenRectFromNSRect([status_item_view_ window].frame);
}
void TrayIconCocoa::SetAutoSaveName(const std::string& name) {
[status_item_view_ setAutosaveName:base::SysUTF8ToNSString(name)];
}
// static
TrayIcon* TrayIcon::Create(std::optional<base::Uuid> guid) {
TrayIcon* TrayIcon::Create(std::optional<UUID> guid) {
return new TrayIconCocoa;
}

View File

@@ -112,7 +112,7 @@ ui::StatusIconLinux* TrayIconLinux::GetStatusIcon() {
}
// static
TrayIcon* TrayIcon::Create(std::optional<base::Uuid> guid) {
TrayIcon* TrayIcon::Create(std::optional<UUID> guid) {
return new TrayIconLinux;
}

View File

@@ -8,7 +8,7 @@
namespace electron {
// static
TrayIcon* TrayIcon::Create(std::optional<base::Uuid> guid) {
TrayIcon* TrayIcon::Create(std::optional<UUID> guid) {
static NotifyIconHost host;
return host.CreateNotifyIcon(guid);
}

View File

@@ -142,7 +142,6 @@ bool ElectronDesktopWindowTreeHostWin::HandleMouseEvent(ui::MouseEvent* event) {
if (prevent_default) {
electron::api::WebContents::SetDisableDraggableRegions(true);
views::DesktopWindowTreeHostWin::HandleMouseEvent(event);
electron::api::WebContents::SetDisableDraggableRegions(false);
}
return prevent_default;
}

View File

@@ -190,32 +190,21 @@ NotifyIconHost::~NotifyIconHost() {
delete ptr;
}
NotifyIcon* NotifyIconHost::CreateNotifyIcon(std::optional<base::Uuid> guid) {
std::string guid_str =
guid.has_value() ? guid.value().AsLowercaseString() : "";
UUID uid = GUID_NULL;
if (!guid_str.empty()) {
if (guid_str[0] == '{' && guid_str[guid_str.length() - 1] == '}') {
guid_str = guid_str.substr(1, guid_str.length() - 2);
}
unsigned char* uid_cstr = (unsigned char*)guid_str.c_str();
RPC_STATUS result = UuidFromStringA(uid_cstr, &uid);
if (result != RPC_S_INVALID_STRING_UUID) {
for (NotifyIcons::const_iterator i(notify_icons_.begin());
i != notify_icons_.end(); ++i) {
auto* current_win_icon = static_cast<NotifyIcon*>(*i);
if (current_win_icon->guid() == uid) {
LOG(WARNING)
<< "Guid already in use. Existing tray entry will be replaced.";
}
NotifyIcon* NotifyIconHost::CreateNotifyIcon(std::optional<UUID> guid) {
if (guid.has_value()) {
for (NotifyIcons::const_iterator i(notify_icons_.begin());
i != notify_icons_.end(); ++i) {
auto* current_win_icon = static_cast<NotifyIcon*>(*i);
if (current_win_icon->guid() == guid.value()) {
LOG(WARNING)
<< "Guid already in use. Existing tray entry will be replaced.";
}
}
}
auto* notify_icon =
new NotifyIcon(this, NextIconId(), window_, kNotifyIconMessage,
uid == GUID_NULL ? GUID_DEFAULT : uid);
guid.has_value() ? guid.value() : GUID_DEFAULT);
notify_icons_.push_back(notify_icon);
return notify_icon;

View File

@@ -27,7 +27,7 @@ class NotifyIconHost {
NotifyIconHost(const NotifyIconHost&) = delete;
NotifyIconHost& operator=(const NotifyIconHost&) = delete;
NotifyIcon* CreateNotifyIcon(std::optional<base::Uuid> guid);
NotifyIcon* CreateNotifyIcon(std::optional<UUID> guid);
void Remove(NotifyIcon* notify_icon);
private:

View File

@@ -12,8 +12,6 @@
#if BUILDFLAG(IS_WIN)
#include <dwmapi.h>
#include "base/win/registry.h"
#endif
namespace {
@@ -70,18 +68,12 @@ std::string ToRGBAHex(SkColor color, bool include_hash) {
#if BUILDFLAG(IS_WIN)
std::optional<DWORD> GetSystemAccentColor() {
base::win::RegKey key;
if (key.Open(HKEY_CURRENT_USER, L"SOFTWARE\\Microsoft\\Windows\\DWM",
KEY_READ) != ERROR_SUCCESS) {
return std::nullopt;
}
DWORD color = 0;
BOOL opaque = FALSE;
DWORD accent_color = 0;
if (key.ReadValueDW(L"AccentColor", &accent_color) != ERROR_SUCCESS) {
if (FAILED(DwmGetColorizationColor(&color, &opaque)))
return std::nullopt;
}
return accent_color;
return color;
}
#endif

View File

@@ -7,8 +7,6 @@
#include <string>
#include "base/strings/string_util.h"
#include "base/uuid.h"
#include "gin/converter.h"
#if BUILDFLAG(IS_WIN)
@@ -38,40 +36,18 @@ typedef struct {
namespace gin {
template <>
struct Converter<base::Uuid> {
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
base::Uuid* out) {
std::string guid;
if (!gin::ConvertFromV8(isolate, val, &guid))
return false;
base::Uuid parsed = base::Uuid::ParseLowercase(base::ToLowerASCII(guid));
if (!parsed.is_valid())
return false;
*out = parsed;
return true;
}
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate, base::Uuid val) {
const std::string guid = val.AsLowercaseString();
return gin::ConvertToV8(isolate, guid);
}
};
#if BUILDFLAG(IS_WIN)
template <>
struct Converter<UUID> {
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
UUID* out) {
#if BUILDFLAG(IS_WIN)
std::string guid;
if (!gin::ConvertFromV8(isolate, val, &guid))
return false;
UUID uid;
if (!guid.empty()) {
if (guid[0] == '{' && guid[guid.length() - 1] == '}') {
guid = guid.substr(1, guid.length() - 2);
@@ -86,8 +62,12 @@ struct Converter<UUID> {
}
}
return false;
#else
return false;
#endif
}
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate, UUID val) {
#if BUILDFLAG(IS_WIN)
const GUID GUID_NULL = {};
if (val == GUID_NULL) {
return v8::String::Empty(isolate);
@@ -95,9 +75,11 @@ struct Converter<UUID> {
std::wstring uid = base::win::WStringFromGUID(val);
return StringToV8(isolate, base::SysWideToUTF8(uid));
}
#else
return v8::Undefined(isolate);
#endif
}
};
#endif
} // namespace gin

View File

@@ -348,7 +348,7 @@ void ShowItemInFolder(const base::FilePath& full_path) {
void OpenPath(const base::FilePath& full_path, OpenCallback callback) {
// This is async, so we don't care about the return value.
XDGOpen(full_path.DirName(), full_path.value(), false, std::move(callback));
XDGOpen(full_path.DirName(), full_path.value(), true, std::move(callback));
}
void OpenFolder(const base::FilePath& full_path) {

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