mirror of
https://github.com/electron/electron.git
synced 2026-02-26 03:01:17 -05:00
Compare commits
213 Commits
v35.0.0-be
...
v35.5.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6b08d83af7 | ||
|
|
71233a4517 | ||
|
|
f370a19e36 | ||
|
|
a7fd8872bf | ||
|
|
7f5e6c54bc | ||
|
|
fadec9ac65 | ||
|
|
a8cdd60c88 | ||
|
|
6280172ee9 | ||
|
|
94f6e16871 | ||
|
|
5fde5696d0 | ||
|
|
73605f97ee | ||
|
|
72d3d359c3 | ||
|
|
0b026d261e | ||
|
|
0954ac7843 | ||
|
|
feab959781 | ||
|
|
282903e7b8 | ||
|
|
15d6344b6a | ||
|
|
fcb576566a | ||
|
|
64a07ffc3f | ||
|
|
720684c766 | ||
|
|
b626829f71 | ||
|
|
2fb93ed6cb | ||
|
|
45f84be0b8 | ||
|
|
2bf22b53f1 | ||
|
|
853392e0f0 | ||
|
|
2b96789b23 | ||
|
|
406f4eded6 | ||
|
|
535d9fb1c8 | ||
|
|
caf1c1faf2 | ||
|
|
ed71d0733e | ||
|
|
d03a12aef4 | ||
|
|
458fa5f421 | ||
|
|
f872b431fe | ||
|
|
af31ce0135 | ||
|
|
f9bcea3bfc | ||
|
|
b8e4d3650e | ||
|
|
24fcd14cdc | ||
|
|
dec69bb61b | ||
|
|
9f4e0b9343 | ||
|
|
b8712a35db | ||
|
|
db3b0e01c1 | ||
|
|
f87950a371 | ||
|
|
d341a523e5 | ||
|
|
a2b954c8f3 | ||
|
|
8696da7de8 | ||
|
|
8e0f91f93f | ||
|
|
5104001067 | ||
|
|
102457bbd5 | ||
|
|
0630744f5b | ||
|
|
00d6963afd | ||
|
|
cd871fd58c | ||
|
|
800640ea2d | ||
|
|
621c6b4148 | ||
|
|
ec4eafecae | ||
|
|
d091cb91ba | ||
|
|
8275aa98ca | ||
|
|
b27a5f1cde | ||
|
|
bdde668926 | ||
|
|
afee4a78f2 | ||
|
|
713165e406 | ||
|
|
d224d03e31 | ||
|
|
52a7c752e6 | ||
|
|
40624199eb | ||
|
|
6433847b09 | ||
|
|
8e5735e499 | ||
|
|
96db57f36f | ||
|
|
ffe6656d2f | ||
|
|
fbc175aa1f | ||
|
|
b123b07d87 | ||
|
|
d605b97f9a | ||
|
|
d2134f84e1 | ||
|
|
0f73bba452 | ||
|
|
ee54727582 | ||
|
|
f6f9e23fe2 | ||
|
|
6e56fed2cb | ||
|
|
3437927a78 | ||
|
|
1543089e2f | ||
|
|
dc9f6ecd54 | ||
|
|
6d07f541b1 | ||
|
|
0675686451 | ||
|
|
ee04cb9ebe | ||
|
|
592d0155f1 | ||
|
|
1d2107ebff | ||
|
|
3d535afc28 | ||
|
|
88a1448b31 | ||
|
|
b2e695c2e2 | ||
|
|
c438ed4790 | ||
|
|
b1fdf2a8c7 | ||
|
|
48a7d5d45b | ||
|
|
f2a27511b1 | ||
|
|
23035a587e | ||
|
|
f66c385080 | ||
|
|
323aca8822 | ||
|
|
abef5d6eed | ||
|
|
c6c4ace8ef | ||
|
|
f26645e9ab | ||
|
|
ef973971a3 | ||
|
|
17ef6b8885 | ||
|
|
a2f3d820cb | ||
|
|
7886cc3cd0 | ||
|
|
cbc150486c | ||
|
|
1ebad64192 | ||
|
|
1fe77cdcf2 | ||
|
|
446128bc14 | ||
|
|
e76f986aa9 | ||
|
|
b44892e27c | ||
|
|
bd134a7f78 | ||
|
|
12cae22e22 | ||
|
|
23bd5c3d98 | ||
|
|
785193e858 | ||
|
|
3e4810484a | ||
|
|
e4554f9536 | ||
|
|
69a38fa5aa | ||
|
|
55e25b437d | ||
|
|
6048985cc8 | ||
|
|
3277481681 | ||
|
|
3343975488 | ||
|
|
71150ffe56 | ||
|
|
8bca8d2b9d | ||
|
|
f3d7a9043d | ||
|
|
cf559d7c72 | ||
|
|
d025ab4995 | ||
|
|
a644c7029a | ||
|
|
13488d3c98 | ||
|
|
d0658ccc98 | ||
|
|
c95323051a | ||
|
|
ff0156e67b | ||
|
|
65f9f08187 | ||
|
|
15d2a7dc4c | ||
|
|
073df4e738 | ||
|
|
c3127249e4 | ||
|
|
a842911215 | ||
|
|
b51d9976d0 | ||
|
|
46d9bd8b4a | ||
|
|
f527b982b5 | ||
|
|
60427961a2 | ||
|
|
929cba26c2 | ||
|
|
94926b734c | ||
|
|
dc4233fd40 | ||
|
|
ac20d29095 | ||
|
|
2b4716253d | ||
|
|
39cbd0c27c | ||
|
|
cd5da1b933 | ||
|
|
3023f14bdd | ||
|
|
fe445869ca | ||
|
|
f9164968d6 | ||
|
|
e0014f507f | ||
|
|
44afb48112 | ||
|
|
6e112a8410 | ||
|
|
c6c67208d2 | ||
|
|
a3ba653bee | ||
|
|
7a950f09ae | ||
|
|
ac22aa932f | ||
|
|
d38c2d507e | ||
|
|
7d27b2c542 | ||
|
|
8a120b6b58 | ||
|
|
11c1e70384 | ||
|
|
0d9b7d8121 | ||
|
|
09ec28b150 | ||
|
|
a82f92e1d8 | ||
|
|
a2a3f7cf1c | ||
|
|
262beabdc6 | ||
|
|
37f876e3b5 | ||
|
|
628288f074 | ||
|
|
230ecf7e32 | ||
|
|
538cf9ade7 | ||
|
|
b13526ecd0 | ||
|
|
56f17662a5 | ||
|
|
69b80e02e7 | ||
|
|
a1d8676e9c | ||
|
|
998de7aa6c | ||
|
|
e3d95bb8a4 | ||
|
|
b257f3c660 | ||
|
|
0b37f8cced | ||
|
|
4b40bfeb01 | ||
|
|
a29490a4e8 | ||
|
|
56b79a3a91 | ||
|
|
4137488761 | ||
|
|
a6fe725dab | ||
|
|
5f48031c24 | ||
|
|
344b0ae3ad | ||
|
|
c2ba6b7a28 | ||
|
|
f3c4f0ecf6 | ||
|
|
7d207c7a3b | ||
|
|
4b184a89d1 | ||
|
|
73a99ea189 | ||
|
|
ae55fce5df | ||
|
|
7388188015 | ||
|
|
65a7dddd4a | ||
|
|
6bbe996f62 | ||
|
|
3ad43182eb | ||
|
|
11bdd8cf44 | ||
|
|
75cf1b08c3 | ||
|
|
c91ddf2609 | ||
|
|
02783dd1e0 | ||
|
|
11fad1b737 | ||
|
|
de6105dc50 | ||
|
|
385b84ad87 | ||
|
|
7a9b9cdf0b | ||
|
|
de4458ff5c | ||
|
|
dda60cd4ed | ||
|
|
a2aacd7f25 | ||
|
|
702fdac1c4 | ||
|
|
0b24418ca7 | ||
|
|
3da65aa53e | ||
|
|
079b2bbf97 | ||
|
|
5b15c348e9 | ||
|
|
10da0d694e | ||
|
|
463031b771 | ||
|
|
53d7bd6abd | ||
|
|
6eb4932c68 | ||
|
|
179fde9278 | ||
|
|
107b3f8580 |
@@ -2,7 +2,7 @@ version: '3'
|
||||
|
||||
services:
|
||||
buildtools:
|
||||
image: ghcr.io/electron/devcontainer:77262e58c37631ab082482f42c33cdf68c6c394b
|
||||
image: ghcr.io/electron/devcontainer:424eedbf277ad9749ffa9219068aa72ed4a5e373
|
||||
|
||||
volumes:
|
||||
- ..:/workspaces/gclient/src/electron:cached
|
||||
|
||||
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -13,7 +13,7 @@ Contributors guide: https://github.com/electron/electron/blob/main/CONTRIBUTING.
|
||||
- [ ] PR description included and stakeholders cc'd
|
||||
- [ ] `npm test` passes
|
||||
- [ ] tests are [changed or added](https://github.com/electron/electron/blob/main/docs/development/testing.md)
|
||||
- [ ] relevant documentation, tutorials, templates and examples are changed or added
|
||||
- [ ] relevant API documentation, tutorials, and examples are updated and follow the [documentation style guide](https://github.com/electron/electron/blob/main/docs/development/style-guide.md)
|
||||
- [ ] [PR release notes](https://github.com/electron/clerk/blob/main/README.md) describe the change in a way relevant to app developers, and are [capitalized, punctuated, and past tense](https://github.com/electron/clerk/blob/main/README.md#examples).
|
||||
|
||||
#### Release Notes
|
||||
|
||||
6
.github/actions/build-electron/action.yml
vendored
6
.github/actions/build-electron/action.yml
vendored
@@ -38,6 +38,9 @@ runs:
|
||||
run: |
|
||||
GN_APPENDED_ARGS="$GN_EXTRA_ARGS target_cpu=\"x64\" v8_snapshot_toolchain=\"//build/toolchain/mac:clang_x64\""
|
||||
echo "GN_EXTRA_ARGS=$GN_APPENDED_ARGS" >> $GITHUB_ENV
|
||||
- name: Add Clang problem matcher
|
||||
shell: bash
|
||||
run: echo "::add-matcher::src/electron/.github/problem-matchers/clang.json"
|
||||
- name: Build Electron ${{ inputs.step-suffix }}
|
||||
shell: bash
|
||||
run: |
|
||||
@@ -199,6 +202,9 @@ runs:
|
||||
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::"
|
||||
- name: Generate TypeScript Definitions ${{ inputs.step-suffix }}
|
||||
if: ${{ inputs.is-release == 'true' }}
|
||||
shell: bash
|
||||
|
||||
73
.github/actions/checkout/action.yml
vendored
73
.github/actions/checkout/action.yml
vendored
@@ -9,6 +9,8 @@ inputs:
|
||||
description: 'Whether to persist the cache to the shared drive'
|
||||
required: false
|
||||
default: 'true'
|
||||
target-platform:
|
||||
description: 'Target platform, should be linux, win, macos'
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
@@ -18,40 +20,34 @@ runs:
|
||||
echo "GIT_CACHE_PATH=$(pwd)/git-cache" >> $GITHUB_ENV
|
||||
- name: Install Dependencies
|
||||
uses: ./src/electron/.github/actions/install-dependencies
|
||||
- name: Set Chromium Git Helper
|
||||
uses: ./src/electron/.github/actions/set-chromium-git-helper
|
||||
- name: Install Build Tools
|
||||
uses: ./src/electron/.github/actions/install-build-tools
|
||||
- name: Set Chromium Git Cookie
|
||||
uses: ./src/electron/.github/actions/set-chromium-cookie
|
||||
- name: Get Depot Tools
|
||||
shell: bash
|
||||
run: |
|
||||
if [[ ! -d depot_tools ]]; then
|
||||
git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
|
||||
|
||||
# Ensure depot_tools does not update.
|
||||
test -d depot_tools && cd depot_tools
|
||||
touch .disable_auto_update
|
||||
fi
|
||||
- name: Add Depot Tools to PATH
|
||||
shell: bash
|
||||
run: echo "$(pwd)/depot_tools" >> $GITHUB_PATH
|
||||
- name: Generate DEPS Hash
|
||||
shell: bash
|
||||
run: |
|
||||
node src/electron/script/generate-deps-hash.js
|
||||
echo "DEPSHASH=v1-src-cache-$(cat src/electron/.depshash)" >> $GITHUB_ENV
|
||||
DEPSHASH="v1-src-cache-$(cat src/electron/.depshash)"
|
||||
echo "DEPSHASH=$DEPSHASH" >> $GITHUB_ENV
|
||||
echo "CACHE_FILE=$DEPSHASH.tar" >> $GITHUB_ENV
|
||||
if [ "${{ inputs.target-platform }}" = "win" ]; then
|
||||
echo "CACHE_DRIVE=/mnt/win-cache" >> $GITHUB_ENV
|
||||
else
|
||||
echo "CACHE_DRIVE=/mnt/cross-instance-cache" >> $GITHUB_ENV
|
||||
fi
|
||||
- name: Generate SAS Key
|
||||
if: ${{ inputs.generate-sas-token == 'true' }}
|
||||
shell: bash
|
||||
run: |
|
||||
curl --unix-socket /var/run/sas/sas.sock --fail "http://foo/$DEPSHASH.tar" > sas-token
|
||||
curl --unix-socket /var/run/sas/sas.sock --fail "http://foo/$CACHE_FILE?platform=${{ inputs.target-platform }}" > sas-token
|
||||
- name: Save SAS Key
|
||||
if: ${{ inputs.generate-sas-token == 'true' }}
|
||||
uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57
|
||||
uses: actions/cache/save@d4323d4df104b026a6aa633fdb11d772146be0bf
|
||||
with:
|
||||
path: |
|
||||
sas-token
|
||||
key: sas-key-${{ github.run_number }}-${{ github.run_attempt }}
|
||||
path: sas-token
|
||||
key: sas-key-${{ inputs.target-platform }}-${{ github.run_number }}-${{ github.run_attempt }}
|
||||
enableCrossOsArchive: true
|
||||
- name: Check If Cache Exists
|
||||
id: check-cache
|
||||
shell: bash
|
||||
@@ -60,7 +56,7 @@ runs:
|
||||
echo "Not using cache this time..."
|
||||
echo "cache_exists=false" >> $GITHUB_OUTPUT
|
||||
else
|
||||
cache_path=/mnt/cross-instance-cache/$DEPSHASH.tar
|
||||
cache_path=$CACHE_DRIVE/$CACHE_FILE
|
||||
echo "Using cache key: $DEPSHASH"
|
||||
echo "Checking for cache in: $cache_path"
|
||||
if [ ! -f "$cache_path" ] || [ `du $cache_path | cut -f1` = "0" ]; then
|
||||
@@ -76,14 +72,17 @@ runs:
|
||||
shell: bash
|
||||
run: |
|
||||
# if there is less than 35 GB free space then creating the cache might fail so exit early
|
||||
freespace=`df -m /mnt/cross-instance-cache | grep -w /mnt/cross-instance-cache | awk '{print $4}'`
|
||||
freespace_human=`df -h /mnt/cross-instance-cache | grep -w /mnt/cross-instance-cache | awk '{print $4}'`
|
||||
freespace=`df -m $CACHE_DRIVE | grep -w $CACHE_DRIVE | awk '{print $4}'`
|
||||
freespace_human=`df -h $CACHE_DRIVE | grep -w $CACHE_DRIVE | awk '{print $4}'`
|
||||
if [ $freespace -le 35000 ]; then
|
||||
echo "The cross mount cache has $freespace_human free space which is not enough - exiting"
|
||||
exit 1
|
||||
else
|
||||
echo "The cross mount cache has $freespace_human free space - continuing"
|
||||
fi
|
||||
- name: Add patch conflict problem matcher
|
||||
shell: bash
|
||||
run: echo "::add-matcher::src/electron/.github/problem-matchers/patch-conflict.json"
|
||||
- name: Gclient Sync
|
||||
if: steps.check-cache.outputs.cache_exists == 'false'
|
||||
shell: bash
|
||||
@@ -99,7 +98,7 @@ runs:
|
||||
fi
|
||||
|
||||
ELECTRON_USE_THREE_WAY_MERGE_FOR_PATCHES=1 e d gclient sync --with_branch_heads --with_tags -vv
|
||||
if [ "${{ inputs.is-release }}" != "true" && -n "${{ env.PATCH_UP_APP_CREDS }}" ]; then
|
||||
if [[ "${{ inputs.is-release }}" != "true" ]]; then
|
||||
# Re-export all the patches to check if there were changes.
|
||||
python3 src/electron/script/export_all_patches.py src/electron/patches/config.json
|
||||
cd src/electron
|
||||
@@ -128,9 +127,15 @@ runs:
|
||||
cat ../../patches/update-patches.patch
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "No changes to patches detected"
|
||||
fi
|
||||
fi
|
||||
|
||||
- name: Remove patch conflict problem matcher
|
||||
shell: bash
|
||||
run: |
|
||||
echo "::remove-matcher owner=merge-conflict::"
|
||||
echo "::remove-matcher owner=patch-conflict::"
|
||||
# delete all .git directories under src/ except for
|
||||
# third_party/angle/ and third_party/dawn/ because of build time generation of files
|
||||
# gen/angle/commit.h depends on third_party/angle/.git/HEAD
|
||||
@@ -165,14 +170,14 @@ runs:
|
||||
shell: bash
|
||||
run: |
|
||||
echo "Uncompressed src size: $(du -sh src | cut -f1 -d' ')"
|
||||
tar -cf $DEPSHASH.tar src
|
||||
echo "Compressed src to $(du -sh $DEPSHASH.tar | cut -f1 -d' ')"
|
||||
cp ./$DEPSHASH.tar /mnt/cross-instance-cache/
|
||||
tar -cf $CACHE_FILE src
|
||||
echo "Compressed src to $(du -sh $CACHE_FILE | cut -f1 -d' ')"
|
||||
cp ./$CACHE_FILE $CACHE_DRIVE/
|
||||
- name: Persist Src Cache
|
||||
if: ${{ steps.check-cache.outputs.cache_exists == 'false' && inputs.use-cache == 'true' }}
|
||||
shell: bash
|
||||
run: |
|
||||
final_cache_path=/mnt/cross-instance-cache/$DEPSHASH.tar
|
||||
final_cache_path=$CACHE_DRIVE/$CACHE_FILE
|
||||
echo "Using cache key: $DEPSHASH"
|
||||
echo "Checking path: $final_cache_path"
|
||||
if [ ! -f "$final_cache_path" ]; then
|
||||
@@ -181,3 +186,11 @@ runs:
|
||||
else
|
||||
echo "Cache key persisted in $final_cache_path"
|
||||
fi
|
||||
- name: Wait for active SSH sessions
|
||||
shell: bash
|
||||
if: always() && !cancelled()
|
||||
run: |
|
||||
while [ -f /var/.ssh-lock ]
|
||||
do
|
||||
sleep 60
|
||||
done
|
||||
|
||||
40
.github/actions/cipd-install/action.yml
vendored
Normal file
40
.github/actions/cipd-install/action.yml
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
name: 'CIPD install'
|
||||
description: 'Installs the specified CIPD package'
|
||||
inputs:
|
||||
cipd-root-prefix-path:
|
||||
description: 'Path to prepend to installation directory'
|
||||
default: ''
|
||||
dependency:
|
||||
description: 'Name of dependency to install'
|
||||
deps-file:
|
||||
description: 'Location of DEPS file that defines the dependency'
|
||||
installation-dir:
|
||||
description: 'Location to install dependency'
|
||||
target-platform:
|
||||
description: 'Target platform, should be linux, win, macos'
|
||||
package:
|
||||
description: 'Package to install'
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Delete wrong ${{ inputs.dependency }}
|
||||
shell: bash
|
||||
run : |
|
||||
rm -rf ${{ inputs.cipd-root-prefix-path }}${{ inputs.installation-dir }}
|
||||
- name: Create ensure file for ${{ inputs.dependency }}
|
||||
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: CIPD installation of ${{ inputs.dependency }} (macOS)
|
||||
if: ${{ inputs.target-platform == 'macos' }}
|
||||
shell: bash
|
||||
run: |
|
||||
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' }}
|
||||
shell: powershell
|
||||
run: |
|
||||
echo "ensuring ${{ inputs.dependency }} on Windows"
|
||||
e d cipd ensure --root ${{ inputs.cipd-root-prefix-path }}${{ inputs.installation-dir }} -ensure-file ${{ inputs.dependency }}_ensure_file
|
||||
61
.github/actions/fix-sync-macos/action.yml
vendored
61
.github/actions/fix-sync-macos/action.yml
vendored
@@ -1,61 +0,0 @@
|
||||
name: 'Fix Sync macOS'
|
||||
description: 'Checks out Electron and stores it in the AKS Cache'
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Fix Sync
|
||||
shell: bash
|
||||
# This step is required to correct for differences between "gclient sync"
|
||||
# on Linux and the expected state on macOS. This requires:
|
||||
# 1. Fixing Clang Install (wrong binary)
|
||||
# 2. Fixing esbuild (wrong binary)
|
||||
# 3. Fixing rustc (wrong binary)
|
||||
# 4. Fixing gn (wrong binary)
|
||||
# 5. Fix reclient (wrong binary)
|
||||
# 6. Fixing dsymutil (wrong binary)
|
||||
# 7. Ensuring we are using the correct ninja and adding it to PATH
|
||||
# 8. Fixing angle (wrong remote)
|
||||
run : |
|
||||
SEDOPTION="-i ''"
|
||||
rm -rf src/third_party/llvm-build
|
||||
python3 src/tools/clang/scripts/update.py
|
||||
|
||||
echo 'infra/3pp/tools/esbuild/${platform}' `gclient getdep --deps-file=src/third_party/devtools-frontend/src/DEPS -r 'third_party/esbuild:infra/3pp/tools/esbuild/${platform}'` > esbuild_ensure_file
|
||||
# Remove extra output from calling gclient getdep which always calls update_depot_tools
|
||||
sed -i '' "s/Updating depot_tools... //g" esbuild_ensure_file
|
||||
cipd ensure --root src/third_party/devtools-frontend/src/third_party/esbuild -ensure-file esbuild_ensure_file
|
||||
|
||||
rm -rf src/third_party/rust-toolchain
|
||||
python3 src/tools/rust/update_rust.py
|
||||
|
||||
# Prevent calling gclient getdep which always calls update_depot_tools
|
||||
echo 'gn/gn/mac-${arch}' `gclient getdep --deps-file=src/DEPS -r 'src/buildtools/mac:gn/gn/mac-${arch}'` > gn_ensure_file
|
||||
sed -i '' "s/Updating depot_tools... //g" gn_ensure_file
|
||||
cipd ensure --root src/buildtools/mac -ensure-file gn_ensure_file
|
||||
|
||||
# Prevent calling gclient getdep which always calls update_depot_tools
|
||||
echo 'infra/rbe/client/${platform}' `gclient getdep --deps-file=src/DEPS -r 'src/buildtools/reclient:infra/rbe/client/${platform}'` > gn_ensure_file
|
||||
sed -i '' "s/Updating depot_tools... //g" gn_ensure_file
|
||||
cipd ensure --root src/buildtools/reclient -ensure-file gn_ensure_file
|
||||
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
|
||||
|
||||
if [ "${{ env.TARGET_ARCH }}" == "arm64" ]; then
|
||||
DSYM_SHA_FILE=src/tools/clang/dsymutil/bin/dsymutil.arm64.sha1
|
||||
else
|
||||
DSYM_SHA_FILE=src/tools/clang/dsymutil/bin/dsymutil.x64.sha1
|
||||
fi
|
||||
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
|
||||
|
||||
echo 'infra/3pp/tools/ninja/${platform}' `gclient getdep --deps-file=src/DEPS -r 'src/third_party/ninja:infra/3pp/tools/ninja/${platform}'` > ninja_ensure_file
|
||||
sed $SEDOPTION "s/Updating depot_tools... //g" ninja_ensure_file
|
||||
cipd ensure --root src/third_party/ninja -ensure-file ninja_ensure_file
|
||||
|
||||
echo "$(pwd)/src/third_party/ninja" >> $GITHUB_PATH
|
||||
|
||||
cd src/third_party/angle
|
||||
rm -f .git/objects/info/alternates
|
||||
git remote set-url origin https://chromium.googlesource.com/angle/angle.git
|
||||
cp .git/config .git/config.backup
|
||||
git remote remove origin
|
||||
mv .git/config.backup .git/config
|
||||
git fetch
|
||||
120
.github/actions/fix-sync/action.yml
vendored
Normal file
120
.github/actions/fix-sync/action.yml
vendored
Normal file
@@ -0,0 +1,120 @@
|
||||
name: 'Fix Sync'
|
||||
description: 'Ensures proper binaries are in place'
|
||||
# This action is required to correct for differences between "gclient sync"
|
||||
# on Linux and the expected state on macOS/windows. This requires:
|
||||
# 1. Fixing Clang Install (wrong binary)
|
||||
# 2. Fixing esbuild (wrong binary)
|
||||
# 3. Fixing rustc (wrong binary)
|
||||
# 4. Fixing gn (wrong binary)
|
||||
# 5. Fix reclient (wrong binary)
|
||||
# 6. Fixing dsymutil (wrong binary)
|
||||
# 7. Ensuring we are using the correct ninja and adding it to PATH
|
||||
# 8. Fixing angle (wrong remote)
|
||||
# 9. Install windows toolchain on Windows
|
||||
# 10. Fix node binary on Windows
|
||||
# 11. Fix rc binary on Windows
|
||||
inputs:
|
||||
target-platform:
|
||||
description: 'Target platform, should be linux, win, macos'
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Fix clang
|
||||
shell: bash
|
||||
run : |
|
||||
rm -rf src/third_party/llvm-build
|
||||
python3 src/tools/clang/scripts/update.py
|
||||
- name: Fix esbuild
|
||||
uses: ./src/electron/.github/actions/cipd-install
|
||||
with:
|
||||
cipd-root-prefix-path: src/third_party/devtools-frontend/src/
|
||||
dependency: esbuild
|
||||
deps-file: src/third_party/devtools-frontend/src/DEPS
|
||||
installation-dir: third_party/esbuild
|
||||
target-platform: ${{ inputs.target-platform }}
|
||||
package: infra/3pp/tools/esbuild/${platform}
|
||||
- name: Fix rustc
|
||||
shell: bash
|
||||
run : |
|
||||
rm -rf src/third_party/rust-toolchain
|
||||
python3 src/tools/rust/update_rust.py
|
||||
- name: Fix gn (macOS)
|
||||
if: ${{ inputs.target-platform == 'macos' }}
|
||||
uses: ./src/electron/.github/actions/cipd-install
|
||||
with:
|
||||
dependency: gn
|
||||
deps-file: src/DEPS
|
||||
installation-dir: src/buildtools/mac
|
||||
target-platform: ${{ inputs.target-platform }}
|
||||
package: gn/gn/mac-${arch}
|
||||
- name: Fix gn (Windows)
|
||||
if: ${{ inputs.target-platform == 'win' }}
|
||||
uses: ./src/electron/.github/actions/cipd-install
|
||||
with:
|
||||
dependency: gn
|
||||
deps-file: src/DEPS
|
||||
installation-dir: src/buildtools/win
|
||||
target-platform: ${{ inputs.target-platform }}
|
||||
package: gn/gn/windows-amd64
|
||||
- name: Fix reclient
|
||||
uses: ./src/electron/.github/actions/cipd-install
|
||||
with:
|
||||
dependency: reclient
|
||||
deps-file: src/DEPS
|
||||
installation-dir: src/buildtools/reclient
|
||||
target-platform: ${{ inputs.target-platform }}
|
||||
package: infra/rbe/client/${platform}
|
||||
- name: Configure reclient configs
|
||||
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
|
||||
- name: Fix dsymutil (macOS)
|
||||
if: ${{ inputs.target-platform == 'macos' }}
|
||||
shell: bash
|
||||
run : |
|
||||
# Fix dsymutil
|
||||
if [ "${{ inputs.target-platform }}" = "macos" ]; then
|
||||
if [ "${{ env.TARGET_ARCH }}" == "arm64" ]; then
|
||||
DSYM_SHA_FILE=src/tools/clang/dsymutil/bin/dsymutil.arm64.sha1
|
||||
else
|
||||
DSYM_SHA_FILE=src/tools/clang/dsymutil/bin/dsymutil.x64.sha1
|
||||
fi
|
||||
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
|
||||
uses: ./src/electron/.github/actions/cipd-install
|
||||
with:
|
||||
dependency: ninja
|
||||
deps-file: src/DEPS
|
||||
installation-dir: src/third_party/ninja
|
||||
target-platform: ${{ inputs.target-platform }}
|
||||
package: infra/3pp/tools/ninja/${platform}
|
||||
- name: Set ninja in path
|
||||
shell: bash
|
||||
run : |
|
||||
echo "$(pwd)/src/third_party/ninja" >> $GITHUB_PATH
|
||||
- name: Fixup angle git
|
||||
shell: bash
|
||||
run : |
|
||||
cd src/third_party/angle
|
||||
rm -f .git/objects/info/alternates
|
||||
git remote set-url origin https://chromium.googlesource.com/angle/angle.git
|
||||
cp .git/config .git/config.backup
|
||||
git remote remove origin
|
||||
mv .git/config.backup .git/config
|
||||
git fetch
|
||||
- name: Get Windows toolchain
|
||||
if: ${{ inputs.target-platform == 'win' }}
|
||||
shell: powershell
|
||||
run: e d vpython3 src\build\vs_toolchain.py update --force
|
||||
- name: Download nodejs
|
||||
if: ${{ inputs.target-platform == 'win' }}
|
||||
shell: powershell
|
||||
run: |
|
||||
$nodedeps = e d gclient getdep --deps-file=src/DEPS -r src/third_party/node/win | ConvertFrom-JSON
|
||||
python3 src\third_party\depot_tools\download_from_google_storage.py --no_resume --no_auth --bucket chromium-nodejs -o src\third_party\node\win\node.exe $nodedeps.object_name
|
||||
- name: Install rc
|
||||
if: ${{ inputs.target-platform == 'win' }}
|
||||
shell: bash
|
||||
run: |
|
||||
python3 src/third_party/depot_tools/download_from_google_storage.py --no_resume --no_auth --bucket chromium-browser-clang/rc -s src/build/toolchain/win/rc/win/rc.exe.sha1
|
||||
12
.github/actions/install-build-tools/action.yml
vendored
12
.github/actions/install-build-tools/action.yml
vendored
@@ -10,11 +10,21 @@ runs:
|
||||
git config --global core.filemode false
|
||||
git config --global core.autocrlf false
|
||||
git config --global branch.autosetuprebase always
|
||||
git config --global core.fscache true
|
||||
git config --global core.preloadindex true
|
||||
fi
|
||||
export BUILD_TOOLS_SHA=8246e57791b0af4ae5975eb96f09855f9269b1cd
|
||||
export BUILD_TOOLS_SHA=6e8526315ea3b4828882497e532b8340e64e053c
|
||||
npm i -g @electron/build-tools
|
||||
# Update depot_tools to ensure python
|
||||
e d update_depot_tools
|
||||
e auto-update disable
|
||||
# Disable further updates of depot_tools
|
||||
e d auto-update disable
|
||||
if [ "$(expr substr $(uname -s) 1 10)" == "MSYS_NT-10" ]; then
|
||||
e d cipd.bat --version
|
||||
cp "C:\Python311\python.exe" "C:\Python311\python3.exe"
|
||||
echo "C:\Users\ContainerAdministrator\.electron_build_tools\third_party\depot_tools" >> $GITHUB_PATH
|
||||
else
|
||||
echo "$HOME/.electron_build_tools/third_party/depot_tools" >> $GITHUB_PATH
|
||||
echo "$HOME/.electron_build_tools/third_party/depot_tools/python-bin" >> $GITHUB_PATH
|
||||
fi
|
||||
|
||||
10
.github/actions/restore-cache-aks/action.yml
vendored
10
.github/actions/restore-cache-aks/action.yml
vendored
@@ -1,12 +1,20 @@
|
||||
name: 'Restore Cache AKS'
|
||||
description: 'Restores Electron src cache via AKS'
|
||||
inputs:
|
||||
target-platform:
|
||||
description: 'Target platform, should be linux, win, macos'
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Restore and Ensure Src Cache
|
||||
shell: bash
|
||||
run: |
|
||||
cache_path=/mnt/cross-instance-cache/$DEPSHASH.tar
|
||||
if [ "${{ inputs.target-platform }}" = "win" ]; then
|
||||
cache_path=/mnt/win-cache/$DEPSHASH.tar
|
||||
else
|
||||
cache_path=/mnt/cross-instance-cache/$DEPSHASH.tar
|
||||
fi
|
||||
|
||||
echo "Using cache key: $DEPSHASH"
|
||||
echo "Checking for cache in: $cache_path"
|
||||
if [ ! -f "$cache_path" ]; then
|
||||
|
||||
75
.github/actions/restore-cache-azcopy/action.yml
vendored
75
.github/actions/restore-cache-azcopy/action.yml
vendored
@@ -1,22 +1,25 @@
|
||||
name: 'Restore Cache AZCopy'
|
||||
description: 'Restores Electron src cache via AZCopy'
|
||||
inputs:
|
||||
target-platform:
|
||||
description: 'Target platform, should be linux, win, macos'
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Obtain SAS Key
|
||||
continue-on-error: true
|
||||
uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57
|
||||
uses: actions/cache/restore@d4323d4df104b026a6aa633fdb11d772146be0bf
|
||||
with:
|
||||
path: |
|
||||
sas-token
|
||||
key: sas-key-${{ github.run_number }}-1
|
||||
path: sas-token
|
||||
key: sas-key-${{ inputs.target-platform }}-${{ github.run_number }}-1
|
||||
enableCrossOsArchive: true
|
||||
- name: Obtain SAS Key
|
||||
continue-on-error: true
|
||||
uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57
|
||||
uses: actions/cache/restore@d4323d4df104b026a6aa633fdb11d772146be0bf
|
||||
with:
|
||||
path: |
|
||||
sas-token
|
||||
key: sas-key-${{ github.run_number }}-${{ github.run_attempt }}
|
||||
path: sas-token
|
||||
key: sas-key-${{ inputs.target-platform }}-${{ github.run_number }}-${{ github.run_attempt }}
|
||||
enableCrossOsArchive: true
|
||||
- name: Download Src Cache from AKS
|
||||
# The cache will always exist here as a result of the checkout job
|
||||
# Either it was uploaded to Azure in the checkout job for this commit
|
||||
@@ -26,21 +29,30 @@ runs:
|
||||
timeout_minutes: 30
|
||||
max_attempts: 3
|
||||
retry_on: error
|
||||
shell: bash
|
||||
command: |
|
||||
sas_token=$(cat sas-token)
|
||||
if [ -z $sas-token ]; then
|
||||
echo "SAS Token not found; exiting src cache download early..."
|
||||
exit 1
|
||||
else
|
||||
if [ "${{ inputs.target-platform }}" = "win" ]; then
|
||||
azcopy copy --log-level=ERROR \
|
||||
"https://${{ env.AZURE_AKS_CACHE_STORAGE_ACCOUNT }}.file.core.windows.net/${{ env.AZURE_AKS_WIN_CACHE_SHARE_NAME }}/${{ env.CACHE_PATH }}?$sas_token" $DEPSHASH.tar
|
||||
else
|
||||
azcopy copy --log-level=ERROR \
|
||||
"https://${{ env.AZURE_AKS_CACHE_STORAGE_ACCOUNT }}.file.core.windows.net/${{ env.AZURE_AKS_CACHE_SHARE_NAME }}/${{ env.CACHE_PATH }}?$sas_token" $DEPSHASH.tar
|
||||
fi
|
||||
fi
|
||||
azcopy copy --log-level=ERROR \
|
||||
"https://${{ env.AZURE_AKS_CACHE_STORAGE_ACCOUNT }}.file.core.windows.net/${{ env.AZURE_AKS_CACHE_SHARE_NAME }}/${{ env.CACHE_PATH }}?$sas_token" $DEPSHASH.tar
|
||||
env:
|
||||
AZURE_AKS_CACHE_STORAGE_ACCOUNT: f723719aa87a34622b5f7f3
|
||||
AZURE_AKS_CACHE_SHARE_NAME: pvc-f6a4089f-b082-4bee-a3f9-c3e1c0c02d8f
|
||||
AZURE_AKS_WIN_CACHE_SHARE_NAME: pvc-71dec4f2-0d44-4fd1-a2c3-add049d70bdf
|
||||
- name: Clean SAS Key
|
||||
shell: bash
|
||||
run: rm -f sas-token
|
||||
- name: Unzip and Ensure Src Cache
|
||||
if: ${{ inputs.target-platform == 'macos' }}
|
||||
shell: bash
|
||||
run: |
|
||||
echo "Downloaded cache is $(du -sh $DEPSHASH.tar | cut -f1)"
|
||||
@@ -68,4 +80,45 @@ runs:
|
||||
fi
|
||||
|
||||
echo "Wiping Electron Directory"
|
||||
rm -rf src/electron
|
||||
rm -rf src/electron
|
||||
|
||||
- name: Unzip and Ensure Src Cache (Windows)
|
||||
if: ${{ inputs.target-platform == 'win' }}
|
||||
shell: powershell
|
||||
run: |
|
||||
$src_cache = "$env:DEPSHASH.tar"
|
||||
$cache_size = $(Get-Item $src_cache).length
|
||||
Write-Host "Downloaded cache is $cache_size"
|
||||
if ($cache_size -eq 0) {
|
||||
Write-Host "Cache is empty - exiting"
|
||||
exit 1
|
||||
}
|
||||
|
||||
$TEMP_DIR=New-Item -ItemType Directory -Path temp-cache
|
||||
$TEMP_DIR_PATH = $TEMP_DIR.FullName
|
||||
C:\ProgramData\Chocolatey\bin\7z.exe -y x $src_cache -o"$TEMP_DIR_PATH"
|
||||
|
||||
- name: Move Src Cache (Windows)
|
||||
if: ${{ inputs.target-platform == 'win' }}
|
||||
uses: nick-fields/retry@7152eba30c6575329ac0576536151aca5a72780e # v3.0.0
|
||||
with:
|
||||
timeout_minutes: 30
|
||||
max_attempts: 3
|
||||
retry_on: error
|
||||
shell: powershell
|
||||
command: |
|
||||
if (Test-Path "temp-cache\src") {
|
||||
Write-Host "Relocating Cache"
|
||||
Remove-Item -Recurse -Force src
|
||||
Move-Item temp-cache\src src
|
||||
|
||||
Write-Host "Deleting zip file"
|
||||
Remove-Item -Force $src_cache
|
||||
}
|
||||
if (-Not (Test-Path "src\third_party\blink")) {
|
||||
Write-Host "Cache was not correctly restored - exiting"
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Host "Wiping Electron Directory"
|
||||
Remove-Item -Recurse -Force src\electron
|
||||
|
||||
26
.github/actions/set-chromium-cookie/action.yml
vendored
26
.github/actions/set-chromium-cookie/action.yml
vendored
@@ -1,26 +0,0 @@
|
||||
name: 'Set Chromium Git Cookie'
|
||||
description: 'Sets an authenticated cookie from Chromium to allow for a higher request limit'
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Set the git cookie from chromium.googlesource.com (Unix)
|
||||
if: ${{ runner.os != 'Windows' && env.CHROMIUM_GIT_COOKIE }}
|
||||
shell: bash
|
||||
run: |
|
||||
eval 'set +o history' 2>/dev/null || setopt HIST_IGNORE_SPACE 2>/dev/null
|
||||
touch ~/.gitcookies
|
||||
chmod 0600 ~/.gitcookies
|
||||
|
||||
git config --global http.cookiefile ~/.gitcookies
|
||||
|
||||
tr , \\t <<\__END__ >>~/.gitcookies
|
||||
${{ env.CHROMIUM_GIT_COOKIE }}
|
||||
__END__
|
||||
eval 'set -o history' 2>/dev/null || unsetopt HIST_IGNORE_SPACE 2>/dev/null
|
||||
- name: Set the git cookie from chromium.googlesource.com (Windows)
|
||||
if: ${{ runner.os == 'Windows' && env.CHROMIUM_GIT_COOKIE_WINDOWS_STRING }}
|
||||
shell: cmd
|
||||
run: |
|
||||
git config --global http.cookiefile "%USERPROFILE%\.gitcookies"
|
||||
powershell -noprofile -nologo -command Write-Output "${{ env.CHROMIUM_GIT_COOKIE_WINDOWS_STRING }}" >>"%USERPROFILE%\.gitcookies"
|
||||
|
||||
41
.github/actions/set-chromium-git-helper/action.yml
vendored
Normal file
41
.github/actions/set-chromium-git-helper/action.yml
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
name: 'Set Chromium Git Helper'
|
||||
description: 'Sets Chromium Git Helper to allow for a higher request limit'
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Save the chromium git credentials to a file
|
||||
shell: bash
|
||||
run: |
|
||||
if [[ -z "${{ env.CHROMIUM_GIT_AUTH }}" ]]; then
|
||||
echo "CHROMIUM_GIT_AUTH is not set - cannot authenticate."
|
||||
exit 0
|
||||
fi
|
||||
if [[ "${{ runner.os }}" != "Windows" ]]; then
|
||||
cd $HOME
|
||||
fi
|
||||
echo "${{ env.CHROMIUM_GIT_AUTH }}" > .chromium_git_auth
|
||||
|
||||
- name: Set the chromium git helper to use auth from a file
|
||||
shell: bash
|
||||
run: |
|
||||
if [[ "${{ runner.os }}" == "Windows" ]]; then
|
||||
if [[ ! -f "/c/actions-runner/_work/electron/electron/.chromium_git_auth" ]]; then
|
||||
echo "File /c/actions-runner/_work/electron/electron/.chromium_git_auth does not exist - cannot authenticate."
|
||||
exit 0
|
||||
fi
|
||||
else
|
||||
if [[ ! -f "$HOME/.chromium_git_auth" ]]; then
|
||||
echo "File $HOME/.chromium_git_auth does not exist - cannot authenticate."
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
if [[ -z "${{ env.CHROMIUM_GIT_USER }}" ]]; then
|
||||
echo "CHROMIUM_GIT_USER is not set - cannot authenticate."
|
||||
exit 0
|
||||
fi
|
||||
git config --global credential.https://chromium.googlesource.com.username "${{ env.CHROMIUM_GIT_USER }}"
|
||||
if [[ "${{ runner.os }}" == "Windows" ]]; then
|
||||
git config --global credential.https://chromium.googlesource.com.helper '!f() { test "$1" = get && echo "password=$(cat /c/actions-runner/_work/electron/electron/.chromium_git_auth)"; }; f'
|
||||
else
|
||||
git config --global credential.https://chromium.googlesource.com.helper '!f() { test "$1" = get && echo "password=$(cat $HOME/.chromium_git_auth)"; }; f'
|
||||
fi
|
||||
18
.github/problem-matchers/clang.json
vendored
Normal file
18
.github/problem-matchers/clang.json
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"problemMatcher": [
|
||||
{
|
||||
"owner": "clang",
|
||||
"fromPath": "src/out/Default/args.gn",
|
||||
"pattern": [
|
||||
{
|
||||
"regexp": "^(.+)[(:](\\d+)[:,](\\d+)\\)?:\\s+(warning|error):\\s+(.*)$",
|
||||
"file": 1,
|
||||
"line": 2,
|
||||
"column": 3,
|
||||
"severity": 4,
|
||||
"message": 5
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
22
.github/problem-matchers/eslint-stylish.json
vendored
Normal file
22
.github/problem-matchers/eslint-stylish.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"problemMatcher": [
|
||||
{
|
||||
"owner": "eslint-stylish",
|
||||
"pattern": [
|
||||
{
|
||||
"regexp": "^\\s*([^\\s].*)$",
|
||||
"file": 1
|
||||
},
|
||||
{
|
||||
"regexp": "^\\s+(\\d+):(\\d+)\\s+(error|warning|info)\\s+(.*)\\s\\s+(.*)$",
|
||||
"line": 1,
|
||||
"column": 2,
|
||||
"severity": 3,
|
||||
"message": 4,
|
||||
"code": 5,
|
||||
"loop": true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
24
.github/problem-matchers/patch-conflict.json
vendored
Normal file
24
.github/problem-matchers/patch-conflict.json
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"problemMatcher": [
|
||||
{
|
||||
"owner": "merge-conflict",
|
||||
"pattern": [
|
||||
{
|
||||
"regexp": "^CONFLICT\\s\\(\\S+\\): (Merge conflict in \\S+)$",
|
||||
"message": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"owner": "patch-conflict",
|
||||
"pattern": [
|
||||
{
|
||||
"regexp": "^error: (patch failed: (\\S+):(\\d+))$",
|
||||
"message": 1,
|
||||
"file": 2,
|
||||
"line": 3
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
2
.github/workflows/archaeologist-dig.yml
vendored
2
.github/workflows/archaeologist-dig.yml
vendored
@@ -15,7 +15,7 @@ jobs:
|
||||
- name: Setup Node.js/npm
|
||||
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af
|
||||
with:
|
||||
node-version: 20.11.x
|
||||
node-version: 20.19.x
|
||||
- name: Setting Up Dig Site
|
||||
run: |
|
||||
echo "remote: ${{ github.event.pull_request.head.repo.clone_url }}"
|
||||
|
||||
29
.github/workflows/build.yml
vendored
29
.github/workflows/build.yml
vendored
@@ -6,7 +6,7 @@ on:
|
||||
build-image-sha:
|
||||
type: string
|
||||
description: 'SHA for electron/build image'
|
||||
default: 'bc2f48b2415a670de18d13605b1cf0eb5fdbaae1'
|
||||
default: '424eedbf277ad9749ffa9219068aa72ed4a5e373'
|
||||
required: true
|
||||
skip-macos:
|
||||
type: boolean
|
||||
@@ -64,7 +64,7 @@ jobs:
|
||||
id: set-output
|
||||
run: |
|
||||
if [ -z "${{ inputs.build-image-sha }}" ]; then
|
||||
echo "build-image-sha=bc2f48b2415a670de18d13605b1cf0eb5fdbaae1" >> "$GITHUB_OUTPUT"
|
||||
echo "build-image-sha=424eedbf277ad9749ffa9219068aa72ed4a5e373" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "build-image-sha=${{ inputs.build-image-sha }}" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
@@ -100,7 +100,8 @@ jobs:
|
||||
- /mnt/cross-instance-cache:/mnt/cross-instance-cache
|
||||
- /var/run/sas:/var/run/sas
|
||||
env:
|
||||
CHROMIUM_GIT_COOKIE: ${{ secrets.CHROMIUM_GIT_COOKIE }}
|
||||
CHROMIUM_GIT_AUTH: ${{ secrets.CHROMIUM_GIT_AUTH }}
|
||||
CHROMIUM_GIT_USER: ${{ secrets.CHROMIUM_GIT_USER }}
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_mac=True --custom-var=host_os=mac'
|
||||
outputs:
|
||||
build-image-sha: ${{ needs.setup.outputs.build-image-sha }}
|
||||
@@ -115,6 +116,7 @@ jobs:
|
||||
uses: ./src/electron/.github/actions/checkout
|
||||
with:
|
||||
generate-sas-token: 'true'
|
||||
target-platform: macos
|
||||
|
||||
checkout-linux:
|
||||
needs: setup
|
||||
@@ -127,7 +129,8 @@ jobs:
|
||||
- /mnt/cross-instance-cache:/mnt/cross-instance-cache
|
||||
- /var/run/sas:/var/run/sas
|
||||
env:
|
||||
CHROMIUM_GIT_COOKIE: ${{ secrets.CHROMIUM_GIT_COOKIE }}
|
||||
CHROMIUM_GIT_AUTH: ${{ secrets.CHROMIUM_GIT_AUTH }}
|
||||
CHROMIUM_GIT_USER: ${{ secrets.CHROMIUM_GIT_USER }}
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True'
|
||||
PATCH_UP_APP_CREDS: ${{ secrets.PATCH_UP_APP_CREDS }}
|
||||
outputs:
|
||||
@@ -150,10 +153,11 @@ jobs:
|
||||
image: ghcr.io/electron/build:${{ needs.setup.outputs.build-image-sha }}
|
||||
options: --user root --device /dev/fuse --cap-add SYS_ADMIN
|
||||
volumes:
|
||||
- /mnt/cross-instance-cache:/mnt/cross-instance-cache
|
||||
- /mnt/win-cache:/mnt/win-cache
|
||||
- /var/run/sas:/var/run/sas
|
||||
env:
|
||||
CHROMIUM_GIT_COOKIE: ${{ secrets.CHROMIUM_GIT_COOKIE }}
|
||||
CHROMIUM_GIT_COOKIE_WINDOWS_STRING: ${{ secrets.CHROMIUM_GIT_COOKIE_WINDOWS_STRING }}
|
||||
CHROMIUM_GIT_AUTH: ${{ secrets.CHROMIUM_GIT_AUTH }}
|
||||
CHROMIUM_GIT_USER: ${{ secrets.CHROMIUM_GIT_USER }}
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_win=True'
|
||||
TARGET_OS: 'win'
|
||||
ELECTRON_DEPOT_TOOLS_WIN_TOOLCHAIN: '1'
|
||||
@@ -168,6 +172,9 @@ jobs:
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
- name: Checkout & Sync & Save
|
||||
uses: ./src/electron/.github/actions/checkout
|
||||
with:
|
||||
generate-sas-token: 'true'
|
||||
target-platform: win
|
||||
|
||||
# GN Check Jobs
|
||||
macos-gn-check:
|
||||
@@ -198,7 +205,7 @@ jobs:
|
||||
target-platform: win
|
||||
target-archs: x64 x86 arm64
|
||||
check-runs-on: electron-arc-linux-amd64-8core
|
||||
check-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-windows.outputs.build-image-sha }}","options":"--user root --device /dev/fuse --cap-add SYS_ADMIN","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}'
|
||||
check-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-windows.outputs.build-image-sha }}","options":"--user root --device /dev/fuse --cap-add SYS_ADMIN","volumes":["/mnt/win-cache:/mnt/win-cache"]}'
|
||||
gn-build-type: testing
|
||||
secrets: inherit
|
||||
|
||||
@@ -326,7 +333,7 @@ jobs:
|
||||
issues: read
|
||||
pull-requests: read
|
||||
uses: ./.github/workflows/pipeline-electron-build-and-test.yml
|
||||
needs: setup
|
||||
needs: checkout-windows
|
||||
if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-windows }}
|
||||
with:
|
||||
build-runs-on: electron-arc-windows-amd64-16core
|
||||
@@ -345,7 +352,7 @@ jobs:
|
||||
issues: read
|
||||
pull-requests: read
|
||||
uses: ./.github/workflows/pipeline-electron-build-and-test.yml
|
||||
needs: setup
|
||||
needs: checkout-windows
|
||||
if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-windows }}
|
||||
with:
|
||||
build-runs-on: electron-arc-windows-amd64-16core
|
||||
@@ -364,7 +371,7 @@ jobs:
|
||||
issues: read
|
||||
pull-requests: read
|
||||
uses: ./.github/workflows/pipeline-electron-build-and-test.yml
|
||||
needs: setup
|
||||
needs: checkout-windows
|
||||
if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-windows }}
|
||||
with:
|
||||
build-runs-on: electron-arc-windows-amd64-16core
|
||||
|
||||
4
.github/workflows/clean-src-cache.yml
vendored
4
.github/workflows/clean-src-cache.yml
vendored
@@ -16,6 +16,7 @@ jobs:
|
||||
options: --user root
|
||||
volumes:
|
||||
- /mnt/cross-instance-cache:/mnt/cross-instance-cache
|
||||
- /mnt/win-cache:/mnt/win-cache
|
||||
steps:
|
||||
- name: Cleanup Source Cache
|
||||
shell: bash
|
||||
@@ -23,3 +24,6 @@ jobs:
|
||||
df -h /mnt/cross-instance-cache
|
||||
find /mnt/cross-instance-cache -type f -mtime +15 -delete
|
||||
df -h /mnt/cross-instance-cache
|
||||
df -h /mnt/win-cache
|
||||
find /mnt/win-cache -type f -mtime +15 -delete
|
||||
df -h /mnt/win-cache
|
||||
|
||||
4
.github/workflows/linux-publish.yml
vendored
4
.github/workflows/linux-publish.yml
vendored
@@ -6,7 +6,7 @@ on:
|
||||
build-image-sha:
|
||||
type: string
|
||||
description: 'SHA for electron/build image'
|
||||
default: 'bc2f48b2415a670de18d13605b1cf0eb5fdbaae1'
|
||||
default: '424eedbf277ad9749ffa9219068aa72ed4a5e373'
|
||||
upload-to-storage:
|
||||
description: 'Uploads to Azure storage'
|
||||
required: false
|
||||
@@ -27,6 +27,8 @@ jobs:
|
||||
- /mnt/cross-instance-cache:/mnt/cross-instance-cache
|
||||
- /var/run/sas:/var/run/sas
|
||||
env:
|
||||
CHROMIUM_GIT_AUTH: ${{ secrets.CHROMIUM_GIT_AUTH }}
|
||||
CHROMIUM_GIT_USER: ${{ secrets.CHROMIUM_GIT_USER }}
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True'
|
||||
steps:
|
||||
- name: Checkout Electron
|
||||
|
||||
5
.github/workflows/macos-publish.yml
vendored
5
.github/workflows/macos-publish.yml
vendored
@@ -6,7 +6,7 @@ on:
|
||||
build-image-sha:
|
||||
type: string
|
||||
description: 'SHA for electron/build image'
|
||||
default: 'bc2f48b2415a670de18d13605b1cf0eb5fdbaae1'
|
||||
default: '424eedbf277ad9749ffa9219068aa72ed4a5e373'
|
||||
required: true
|
||||
upload-to-storage:
|
||||
description: 'Uploads to Azure storage'
|
||||
@@ -28,6 +28,8 @@ jobs:
|
||||
- /mnt/cross-instance-cache:/mnt/cross-instance-cache
|
||||
- /var/run/sas:/var/run/sas
|
||||
env:
|
||||
CHROMIUM_GIT_AUTH: ${{ secrets.CHROMIUM_GIT_AUTH }}
|
||||
CHROMIUM_GIT_USER: ${{ secrets.CHROMIUM_GIT_USER }}
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_mac=True --custom-var=host_os=mac'
|
||||
steps:
|
||||
- name: Checkout Electron
|
||||
@@ -39,6 +41,7 @@ jobs:
|
||||
uses: ./src/electron/.github/actions/checkout
|
||||
with:
|
||||
generate-sas-token: 'true'
|
||||
target-platform: macos
|
||||
|
||||
publish-x64-darwin:
|
||||
uses: ./.github/workflows/pipeline-segment-electron-build.yml
|
||||
|
||||
10
.github/workflows/pipeline-electron-lint.yml
vendored
10
.github/workflows/pipeline-electron-lint.yml
vendored
@@ -13,7 +13,8 @@ concurrency:
|
||||
cancel-in-progress: ${{ github.ref_protected != true }}
|
||||
|
||||
env:
|
||||
CHROMIUM_GIT_COOKIE: ${{ secrets.CHROMIUM_GIT_COOKIE }}
|
||||
CHROMIUM_GIT_AUTH: ${{ secrets.CHROMIUM_GIT_AUTH }}
|
||||
CHROMIUM_GIT_USER: ${{ secrets.CHROMIUM_GIT_USER }}
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
@@ -30,8 +31,8 @@ jobs:
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
- name: Install Dependencies
|
||||
uses: ./src/electron/.github/actions/install-dependencies
|
||||
- name: Set Chromium Git Cookie
|
||||
uses: ./src/electron/.github/actions/set-chromium-cookie
|
||||
- name: Set Chromium Git Helper
|
||||
uses: ./src/electron/.github/actions/set-chromium-git-helper
|
||||
- name: Setup third_party Depot Tools
|
||||
shell: bash
|
||||
run: |
|
||||
@@ -61,6 +62,9 @@ jobs:
|
||||
curl -sL "https://chromium.googlesource.com/chromium/src/+/${chromium_revision}/buildtools/DEPS?format=TEXT" | base64 -d > src/buildtools/DEPS
|
||||
|
||||
gclient sync --spec="solutions=[{'name':'src/buildtools','url':None,'deps_file':'DEPS','custom_vars':{'process_deps':True},'managed':False}]"
|
||||
- name: Add ESLint problem matcher
|
||||
shell: bash
|
||||
run: echo "::add-matcher::src/electron/.github/problem-matchers/eslint-stylish.json"
|
||||
- name: Run Lint
|
||||
shell: bash
|
||||
run: |
|
||||
|
||||
@@ -65,8 +65,8 @@ concurrency:
|
||||
cancel-in-progress: ${{ github.ref_protected != true }}
|
||||
|
||||
env:
|
||||
CHROMIUM_GIT_COOKIE: ${{ secrets.CHROMIUM_GIT_COOKIE }}
|
||||
CHROMIUM_GIT_COOKIE_WINDOWS_STRING: ${{ secrets.CHROMIUM_GIT_COOKIE_WINDOWS_STRING }}
|
||||
CHROMIUM_GIT_AUTH: ${{ secrets.CHROMIUM_GIT_AUTH }}
|
||||
CHROMIUM_GIT_USER: ${{ secrets.CHROMIUM_GIT_USER }}
|
||||
ELECTRON_ARTIFACTS_BLOB_STORAGE: ${{ secrets.ELECTRON_ARTIFACTS_BLOB_STORAGE }}
|
||||
ELECTRON_RBE_JWT: ${{ secrets.ELECTRON_RBE_JWT }}
|
||||
SUDOWOODO_EXCHANGE_URL: ${{ secrets.SUDOWOODO_EXCHANGE_URL }}
|
||||
@@ -104,7 +104,7 @@ jobs:
|
||||
if: ${{ inputs.target-platform == 'macos' }}
|
||||
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af
|
||||
with:
|
||||
node-version: 20.11.x
|
||||
node-version: 20.19.x
|
||||
cache: yarn
|
||||
cache-dependency-path: src/electron/yarn.lock
|
||||
- name: Install Dependencies
|
||||
@@ -127,26 +127,10 @@ jobs:
|
||||
GN_EXTRA_ARGS='is_asan=true'
|
||||
fi
|
||||
echo "GN_EXTRA_ARGS=$GN_EXTRA_ARGS" >> $GITHUB_ENV
|
||||
- name: Set Chromium Git Cookie
|
||||
uses: ./src/electron/.github/actions/set-chromium-cookie
|
||||
- name: Get Depot Tools
|
||||
timeout-minutes: 5
|
||||
run: |
|
||||
git clone --filter=tree:0 https://chromium.googlesource.com/chromium/tools/depot_tools.git
|
||||
|
||||
SEDOPTION="-i"
|
||||
if [ "`uname`" = "Darwin" ]; then
|
||||
SEDOPTION="-i ''"
|
||||
fi
|
||||
|
||||
# remove ninjalog_uploader_wrapper.py from autoninja since we don't use it and it causes problems
|
||||
sed $SEDOPTION '/ninjalog_uploader_wrapper.py/d' ./depot_tools/autoninja
|
||||
|
||||
# Ensure depot_tools does not update.
|
||||
test -d depot_tools && cd depot_tools
|
||||
touch .disable_auto_update
|
||||
- name: Add Depot Tools to PATH
|
||||
run: echo "$(pwd)/depot_tools" >> $GITHUB_PATH
|
||||
- name: Set Chromium Git Helper
|
||||
uses: ./src/electron/.github/actions/set-chromium-git-helper
|
||||
- name: Install Build Tools
|
||||
uses: ./src/electron/.github/actions/install-build-tools
|
||||
- name: Generate DEPS Hash
|
||||
run: |
|
||||
node src/electron/script/generate-deps-hash.js
|
||||
@@ -154,24 +138,26 @@ jobs:
|
||||
echo "DEPSHASH=$DEPSHASH" >> $GITHUB_ENV
|
||||
echo "CACHE_PATH=$DEPSHASH.tar" >> $GITHUB_ENV
|
||||
- name: Restore src cache via AZCopy
|
||||
if: ${{ inputs.target-platform == 'macos' }}
|
||||
if: ${{ inputs.target-platform != 'linux' }}
|
||||
uses: ./src/electron/.github/actions/restore-cache-azcopy
|
||||
with:
|
||||
target-platform: ${{ inputs.target-platform }}
|
||||
- name: Restore src cache via AKS
|
||||
if: ${{ inputs.target-platform == 'linux' }}
|
||||
uses: ./src/electron/.github/actions/restore-cache-aks
|
||||
- name: Checkout src via gclient sync
|
||||
if: ${{ inputs.target-platform == 'win' }}
|
||||
uses: ./src/electron/.github/actions/checkout
|
||||
with:
|
||||
use-cache: 'false'
|
||||
- name: Checkout Electron
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
||||
with:
|
||||
path: src/electron
|
||||
fetch-depth: 0
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
- name: Install Build Tools
|
||||
uses: ./src/electron/.github/actions/install-build-tools
|
||||
- name: Fix Sync
|
||||
if: ${{ inputs.target-platform != 'linux' }}
|
||||
uses: ./src/electron/.github/actions/fix-sync
|
||||
with:
|
||||
target-platform: ${{ inputs.target-platform }}
|
||||
env:
|
||||
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 }}
|
||||
@@ -184,9 +170,6 @@ 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: Fix Sync (macOS)
|
||||
if: ${{ inputs.target-platform == 'macos' }}
|
||||
uses: ./src/electron/.github/actions/fix-sync-macos
|
||||
- name: Setup Number of Ninja Processes
|
||||
run: |
|
||||
echo "NUMBER_OF_NINJA_PROCESSES=${{ inputs.target-platform != 'macos' && '300' || '200' }}" >> $GITHUB_ENV
|
||||
|
||||
@@ -65,7 +65,9 @@ jobs:
|
||||
sudo rm -rf $TMPDIR/del-target
|
||||
- name: Check disk space after freeing up space
|
||||
if: ${{ inputs.target-platform == 'macos' }}
|
||||
run: df -h
|
||||
run: df -h
|
||||
- name: Set Chromium Git Helper
|
||||
uses: ./src/electron/.github/actions/set-chromium-git-helper
|
||||
- name: Install Build Tools
|
||||
uses: ./src/electron/.github/actions/install-build-tools
|
||||
- name: Enable windows toolchain
|
||||
@@ -81,9 +83,13 @@ jobs:
|
||||
- name: Restore src cache via AZCopy
|
||||
if: ${{ inputs.target-platform == 'macos' }}
|
||||
uses: ./src/electron/.github/actions/restore-cache-azcopy
|
||||
with:
|
||||
target-platform: ${{ inputs.target-platform }}
|
||||
- name: Restore src cache via AKS
|
||||
if: ${{ inputs.target-platform == 'linux' || inputs.target-platform == 'win' }}
|
||||
uses: ./src/electron/.github/actions/restore-cache-aks
|
||||
with:
|
||||
target-platform: ${{ inputs.target-platform }}
|
||||
- name: Run Electron Only Hooks
|
||||
run: |
|
||||
echo "solutions=[{'name':'src/electron','url':None,'deps_file':'DEPS','custom_vars':{'process_deps':False},'managed':False}]" > tmpgclient
|
||||
|
||||
@@ -36,8 +36,8 @@ permissions:
|
||||
pull-requests: read
|
||||
|
||||
env:
|
||||
CHROMIUM_GIT_COOKIE: ${{ secrets.CHROMIUM_GIT_COOKIE }}
|
||||
CHROMIUM_GIT_COOKIE_WINDOWS_STRING: ${{ secrets.CHROMIUM_GIT_COOKIE_WINDOWS_STRING }}
|
||||
CHROMIUM_GIT_AUTH: ${{ secrets.CHROMIUM_GIT_AUTH }}
|
||||
CHROMIUM_GIT_USER: ${{ secrets.CHROMIUM_GIT_USER }}
|
||||
ELECTRON_OUT_DIR: Default
|
||||
ELECTRON_RBE_JWT: ${{ secrets.ELECTRON_RBE_JWT }}
|
||||
|
||||
@@ -81,7 +81,7 @@ jobs:
|
||||
if: ${{ inputs.target-platform == 'win' }}
|
||||
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af
|
||||
with:
|
||||
node-version: 20.11.x
|
||||
node-version: 20.19.x
|
||||
- name: Add TCC permissions on macOS
|
||||
if: ${{ inputs.target-platform == 'macos' }}
|
||||
run: |
|
||||
@@ -126,14 +126,16 @@ jobs:
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
- name: Install Dependencies
|
||||
uses: ./src/electron/.github/actions/install-dependencies
|
||||
- name: Set Chromium Git Cookie
|
||||
uses: ./src/electron/.github/actions/set-chromium-cookie
|
||||
- name: Set Chromium Git Helper
|
||||
uses: ./src/electron/.github/actions/set-chromium-git-helper
|
||||
- name: Get Depot Tools
|
||||
timeout-minutes: 5
|
||||
run: |
|
||||
git config --global core.filemode false
|
||||
git config --global core.autocrlf false
|
||||
git config --global branch.autosetuprebase always
|
||||
git config --global core.fscache true
|
||||
git config --global core.preloadindex 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
|
||||
|
||||
@@ -31,7 +31,8 @@ concurrency:
|
||||
cancel-in-progress: ${{ github.ref_protected != true }}
|
||||
|
||||
env:
|
||||
CHROMIUM_GIT_COOKIE: ${{ secrets.CHROMIUM_GIT_COOKIE }}
|
||||
CHROMIUM_GIT_AUTH: ${{ secrets.CHROMIUM_GIT_AUTH }}
|
||||
CHROMIUM_GIT_USER: ${{ secrets.CHROMIUM_GIT_USER }}
|
||||
ELECTRON_OUT_DIR: Default
|
||||
ELECTRON_RBE_JWT: ${{ secrets.ELECTRON_RBE_JWT }}
|
||||
|
||||
@@ -51,6 +52,8 @@ jobs:
|
||||
path: src/electron
|
||||
fetch-depth: 0
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
- name: Set Chromium Git Helper
|
||||
uses: ./src/electron/.github/actions/set-chromium-git-helper
|
||||
- name: Install Build Tools
|
||||
uses: ./src/electron/.github/actions/install-build-tools
|
||||
- name: Init Build Tools
|
||||
@@ -58,17 +61,6 @@ jobs:
|
||||
e init -f --root=$(pwd) --out=Default ${{ inputs.gn-build-type }} --import ${{ inputs.gn-build-type }} --target-cpu ${{ inputs.target-arch }}
|
||||
- name: Install Dependencies
|
||||
uses: ./src/electron/.github/actions/install-dependencies
|
||||
- name: Set Chromium Git Cookie
|
||||
uses: ./src/electron/.github/actions/set-chromium-cookie
|
||||
- name: Get Depot Tools
|
||||
timeout-minutes: 5
|
||||
run: |
|
||||
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
|
||||
touch .disable_auto_update
|
||||
- name: Add Depot Tools to PATH
|
||||
run: echo "$(pwd)/depot_tools" >> $GITHUB_PATH
|
||||
- name: Download Generated Artifacts
|
||||
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16
|
||||
with:
|
||||
@@ -114,6 +106,8 @@ jobs:
|
||||
path: src/electron
|
||||
fetch-depth: 0
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
- name: Set Chromium Git Helper
|
||||
uses: ./src/electron/.github/actions/set-chromium-git-helper
|
||||
- name: Install Build Tools
|
||||
uses: ./src/electron/.github/actions/install-build-tools
|
||||
- name: Init Build Tools
|
||||
@@ -121,17 +115,6 @@ jobs:
|
||||
e init -f --root=$(pwd) --out=Default ${{ inputs.gn-build-type }}
|
||||
- name: Install Dependencies
|
||||
uses: ./src/electron/.github/actions/install-dependencies
|
||||
- name: Set Chromium Git Cookie
|
||||
uses: ./src/electron/.github/actions/set-chromium-cookie
|
||||
- name: Get Depot Tools
|
||||
timeout-minutes: 5
|
||||
run: |
|
||||
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
|
||||
touch .disable_auto_update
|
||||
- name: Add Depot Tools to PATH
|
||||
run: echo "$(pwd)/depot_tools" >> $GITHUB_PATH
|
||||
- name: Download Generated Artifacts
|
||||
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16
|
||||
with:
|
||||
|
||||
10
.github/workflows/windows-publish.yml
vendored
10
.github/workflows/windows-publish.yml
vendored
@@ -6,7 +6,7 @@ on:
|
||||
build-image-sha:
|
||||
type: string
|
||||
description: 'SHA for electron/build image'
|
||||
default: 'bc2f48b2415a670de18d13605b1cf0eb5fdbaae1'
|
||||
default: '424eedbf277ad9749ffa9219068aa72ed4a5e373'
|
||||
required: true
|
||||
upload-to-storage:
|
||||
description: 'Uploads to Azure storage'
|
||||
@@ -25,8 +25,11 @@ jobs:
|
||||
image: ghcr.io/electron/build:${{ inputs.build-image-sha }}
|
||||
options: --user root --device /dev/fuse --cap-add SYS_ADMIN
|
||||
volumes:
|
||||
- /mnt/cross-instance-cache:/mnt/cross-instance-cache
|
||||
- /mnt/win-cache:/mnt/win-cache
|
||||
- /var/run/sas:/var/run/sas
|
||||
env:
|
||||
CHROMIUM_GIT_AUTH: ${{ secrets.CHROMIUM_GIT_AUTH }}
|
||||
CHROMIUM_GIT_USER: ${{ secrets.CHROMIUM_GIT_USER }}
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_win=True'
|
||||
TARGET_OS: 'win'
|
||||
ELECTRON_DEPOT_TOOLS_WIN_TOOLCHAIN: '1'
|
||||
@@ -40,6 +43,9 @@ jobs:
|
||||
fetch-depth: 0
|
||||
- name: Checkout & Sync & Save
|
||||
uses: ./src/electron/.github/actions/checkout
|
||||
with:
|
||||
generate-sas-token: 'true'
|
||||
target-platform: win
|
||||
|
||||
publish-x64-win:
|
||||
uses: ./.github/workflows/pipeline-segment-electron-build.yml
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"config": {
|
||||
"extends": "@electron/lint-roller/configs/markdownlint.json",
|
||||
"descriptive-link-text": false,
|
||||
"link-image-style": {
|
||||
"autolink": false,
|
||||
"shortcut": false
|
||||
@@ -26,6 +27,6 @@
|
||||
"no-newline-in-links": true
|
||||
},
|
||||
"customRules": [
|
||||
"@electron/lint-roller/markdownlint-rules/"
|
||||
"./node_modules/@electron/lint-roller/markdownlint-rules/index.mjs"
|
||||
]
|
||||
}
|
||||
|
||||
4
BUILD.gn
4
BUILD.gn
@@ -670,6 +670,8 @@ source_set("electron_lib") {
|
||||
sources += [
|
||||
"shell/browser/certificate_manager_model.cc",
|
||||
"shell/browser/certificate_manager_model.h",
|
||||
"shell/browser/linux/x11_util.cc",
|
||||
"shell/browser/linux/x11_util.h",
|
||||
"shell/browser/ui/gtk_util.cc",
|
||||
"shell/browser/ui/gtk_util.h",
|
||||
]
|
||||
@@ -1246,7 +1248,7 @@ if (is_mac) {
|
||||
"//components/crash/core/app:run_as_crashpad_handler",
|
||||
]
|
||||
|
||||
ldflags = []
|
||||
ldflags = [ "/DELAYLOAD:ffmpeg.dll" ]
|
||||
|
||||
libs = [
|
||||
"comctl32.lib",
|
||||
|
||||
4
DEPS
4
DEPS
@@ -2,9 +2,9 @@ gclient_gn_args_from = 'src'
|
||||
|
||||
vars = {
|
||||
'chromium_version':
|
||||
'134.0.6998.44',
|
||||
'134.0.6998.205',
|
||||
'node_version':
|
||||
'v22.14.0',
|
||||
'v22.15.1',
|
||||
'nan_version':
|
||||
'e14bdcd1f72d62bca1d541b66da43130384ec213',
|
||||
'squirrel.mac_version':
|
||||
|
||||
@@ -1559,8 +1559,8 @@ command line arguments that Chromium uses.
|
||||
|
||||
### `app.dock` _macOS_ _Readonly_
|
||||
|
||||
A [`Dock`](./dock.md) `| undefined` object that allows you to perform actions on your app icon in the user's
|
||||
dock on macOS.
|
||||
A `Dock | undefined` property ([`Dock`](./dock.md) on macOS, `undefined` on all other
|
||||
platforms) that allows you to perform actions on your app icon in the user's dock.
|
||||
|
||||
### `app.isPackaged` _Readonly_
|
||||
|
||||
|
||||
@@ -342,12 +342,12 @@ Emitted when the window has closed a sheet.
|
||||
|
||||
Emitted when the native new tab button is clicked.
|
||||
|
||||
#### Event: 'system-context-menu' _Windows_
|
||||
#### Event: 'system-context-menu' _Windows_ _Linux_
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `point` [Point](structures/point.md) - The screen coordinates the context menu was triggered at
|
||||
* `point` [Point](structures/point.md) - The screen coordinates where the context menu was triggered.
|
||||
|
||||
Emitted when the system context menu is triggered on the window, this is
|
||||
normally only triggered when the user right clicks on the non-client area
|
||||
@@ -356,6 +356,8 @@ as `-webkit-app-region: drag` in a frameless window.
|
||||
|
||||
Calling `event.preventDefault()` will prevent the menu from being displayed.
|
||||
|
||||
To convert `point` to DIP, use [`screen.screenToDipPoint(point)`](./screen.md#screenscreentodippointpoint-windows-linux).
|
||||
|
||||
### Static Methods
|
||||
|
||||
The `BaseWindow` class has the following static methods:
|
||||
@@ -396,7 +398,7 @@ A `View` property for the content view of the window.
|
||||
|
||||
A `string` (optional) property that is equal to the `tabbingIdentifier` passed to the `BrowserWindow` constructor or `undefined` if none was set.
|
||||
|
||||
#### `win.autoHideMenuBar`
|
||||
#### `win.autoHideMenuBar` _Linux_ _Windows_
|
||||
|
||||
A `boolean` property that determines whether the window menu bar should hide itself automatically. Once set, the menu bar will only show when users press the single `Alt` key.
|
||||
|
||||
|
||||
@@ -421,12 +421,12 @@ Emitted when the window has closed a sheet.
|
||||
|
||||
Emitted when the native new tab button is clicked.
|
||||
|
||||
#### Event: 'system-context-menu' _Windows_
|
||||
#### Event: 'system-context-menu' _Windows_ _Linux_
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `point` [Point](structures/point.md) - The screen coordinates the context menu was triggered at
|
||||
* `point` [Point](structures/point.md) - The screen coordinates where the context menu was triggered.
|
||||
|
||||
Emitted when the system context menu is triggered on the window, this is
|
||||
normally only triggered when the user right clicks on the non-client area
|
||||
@@ -435,6 +435,8 @@ as `-webkit-app-region: drag` in a frameless window.
|
||||
|
||||
Calling `event.preventDefault()` will prevent the menu from being displayed.
|
||||
|
||||
To convert `point` to DIP, use [`screen.screenToDipPoint(point)`](./screen.md#screenscreentodippointpoint-windows-linux).
|
||||
|
||||
### Static Methods
|
||||
|
||||
The `BrowserWindow` class has the following static methods:
|
||||
@@ -497,7 +499,7 @@ A `Integer` property representing the unique ID of the window. Each ID is unique
|
||||
|
||||
A `string` (optional) property that is equal to the `tabbingIdentifier` passed to the `BrowserWindow` constructor or `undefined` if none was set.
|
||||
|
||||
#### `win.autoHideMenuBar`
|
||||
#### `win.autoHideMenuBar` _Linux_ _Windows_
|
||||
|
||||
A `boolean` property that determines whether the window menu bar should hide itself automatically. Once set, the menu bar will only show when users press the single `Alt` key.
|
||||
|
||||
|
||||
@@ -254,7 +254,7 @@ Electron supports some of the [CLI flags][node-cli] supported by Node.js.
|
||||
|
||||
**Note:** Passing unsupported command line switches to Electron when it is not running in `ELECTRON_RUN_AS_NODE` will have no effect.
|
||||
|
||||
### `--inspect-brk\[=\[host:]port]`
|
||||
### `--inspect-brk[=[host:]port]`
|
||||
|
||||
Activate inspector on host:port and break at start of user script. Default host:port is 127.0.0.1:9229.
|
||||
|
||||
@@ -266,13 +266,13 @@ Activate inspector on `host:port` and break at start of the first internal
|
||||
JavaScript script executed when the inspector is available.
|
||||
Default `host:port` is `127.0.0.1:9229`.
|
||||
|
||||
### `--inspect-port=\[host:]port`
|
||||
### `--inspect-port=[host:]port`
|
||||
|
||||
Set the `host:port` to be used when the inspector is activated. Useful when activating the inspector by sending the SIGUSR1 signal. Default host is `127.0.0.1`.
|
||||
|
||||
Aliased to `--debug-port=[host:]port`.
|
||||
|
||||
### `--inspect\[=\[host:]port]`
|
||||
### `--inspect[=[host:]port]`
|
||||
|
||||
Activate inspector on `host:port`. Default is `127.0.0.1:9229`.
|
||||
|
||||
@@ -288,6 +288,10 @@ Specify ways of the inspector web socket url exposure.
|
||||
|
||||
By default inspector websocket url is available in stderr and under /json/list endpoint on `http://host:port/json/list`.
|
||||
|
||||
### `--experimental-network-inspector`
|
||||
|
||||
Enable support for devtools network inspector events, for visibility into requests made by the nodejs `http` and `https` modules.
|
||||
|
||||
### `--no-deprecation`
|
||||
|
||||
Silence deprecation warnings.
|
||||
|
||||
@@ -20,45 +20,87 @@ document.
|
||||
|
||||
#### `commandLine.appendSwitch(switch[, value])`
|
||||
|
||||
* `switch` string - A command-line switch, without the leading `--`
|
||||
* `value` string (optional) - A value for the given switch
|
||||
* `switch` string - A command-line switch, without the leading `--`.
|
||||
* `value` string (optional) - A value for the given switch.
|
||||
|
||||
Append a switch (with optional `value`) to Chromium's command line.
|
||||
|
||||
**Note:** This will not affect `process.argv`. The intended usage of this function is to
|
||||
control Chromium's behavior.
|
||||
|
||||
```js
|
||||
const { app } = require('electron')
|
||||
|
||||
app.commandLine.appendSwitch('remote-debugging-port', '8315')
|
||||
```
|
||||
|
||||
#### `commandLine.appendArgument(value)`
|
||||
|
||||
* `value` string - The argument to append to the command line
|
||||
* `value` string - The argument to append to the command line.
|
||||
|
||||
Append an argument to Chromium's command line. The argument will be quoted
|
||||
correctly. Switches will precede arguments regardless of appending order.
|
||||
|
||||
If you're appending an argument like `--switch=value`, consider using `appendSwitch('switch', 'value')` instead.
|
||||
|
||||
```js
|
||||
const { app } = require('electron')
|
||||
|
||||
app.commandLine.appendArgument('--enable-experimental-web-platform-features')
|
||||
```
|
||||
|
||||
**Note:** This will not affect `process.argv`. The intended usage of this function is to
|
||||
control Chromium's behavior.
|
||||
|
||||
#### `commandLine.hasSwitch(switch)`
|
||||
|
||||
* `switch` string - A command-line switch
|
||||
* `switch` string - A command-line switch.
|
||||
|
||||
Returns `boolean` - Whether the command-line switch is present.
|
||||
|
||||
```js
|
||||
const { app } = require('electron')
|
||||
|
||||
app.commandLine.appendSwitch('remote-debugging-port', '8315')
|
||||
const hasPort = app.commandLine.hasSwitch('remote-debugging-port')
|
||||
console.log(hasPort) // true
|
||||
```
|
||||
|
||||
#### `commandLine.getSwitchValue(switch)`
|
||||
|
||||
* `switch` string - A command-line switch
|
||||
* `switch` string - A command-line switch.
|
||||
|
||||
Returns `string` - The command-line switch value.
|
||||
|
||||
This function is meant to obtain Chromium command line switches. It is not
|
||||
meant to be used for application-specific command line arguments. For the
|
||||
latter, please use `process.argv`.
|
||||
|
||||
```js
|
||||
const { app } = require('electron')
|
||||
|
||||
app.commandLine.appendSwitch('remote-debugging-port', '8315')
|
||||
const portValue = app.commandLine.getSwitchValue('remote-debugging-port')
|
||||
console.log(portValue) // '8315'
|
||||
```
|
||||
|
||||
**Note:** When the switch is not present or has no value, it returns empty string.
|
||||
|
||||
#### `commandLine.removeSwitch(switch)`
|
||||
|
||||
* `switch` string - A command-line switch
|
||||
* `switch` string - A command-line switch.
|
||||
|
||||
Removes the specified switch from Chromium's command line.
|
||||
|
||||
```js
|
||||
const { app } = require('electron')
|
||||
|
||||
app.commandLine.appendSwitch('remote-debugging-port', '8315')
|
||||
console.log(app.commandLine.hasSwitch('remote-debugging-port')) // true
|
||||
|
||||
app.commandLine.removeSwitch('remote-debugging-port')
|
||||
console.log(app.commandLine.hasSwitch('remote-debugging-port')) // false
|
||||
```
|
||||
|
||||
**Note:** This will not affect `process.argv`. The intended usage of this function is to
|
||||
control Chromium's behavior.
|
||||
|
||||
@@ -9,7 +9,7 @@ The following example shows how to bounce your icon on the dock.
|
||||
|
||||
```js
|
||||
const { app } = require('electron')
|
||||
app.dock.bounce()
|
||||
app.dock?.bounce()
|
||||
```
|
||||
|
||||
### Instance Methods
|
||||
|
||||
@@ -19,7 +19,7 @@ See [`Menu`](menu.md) for examples.
|
||||
* `type` string (optional) - Can be `normal`, `separator`, `submenu`, `checkbox` or
|
||||
`radio`.
|
||||
* `label` string (optional)
|
||||
* `sublabel` string (optional)
|
||||
* `sublabel` string (optional) _macOS_ - Available in macOS >= 14.4
|
||||
* `toolTip` string (optional) _macOS_ - Hover text for this menu item.
|
||||
* `accelerator` [Accelerator](accelerator.md) (optional)
|
||||
* `icon` ([NativeImage](native-image.md) | string) (optional)
|
||||
|
||||
@@ -327,6 +327,27 @@ name, no matter what label you set. To change it, modify your app bundle's
|
||||
[About Information Property List Files][AboutInformationPropertyListFiles]
|
||||
for more information.
|
||||
|
||||
### Menu Sublabels
|
||||
|
||||
Menu sublabels, or [subtitles](https://developer.apple.com/documentation/appkit/nsmenuitem/subtitle?language=objc), can be added to menu items using the `sublabel` option. Below is an example based on the renderer example above:
|
||||
|
||||
```js @ts-expect-error=[12]
|
||||
// main
|
||||
ipcMain.on('show-context-menu', (event) => {
|
||||
const template = [
|
||||
{
|
||||
label: 'Menu Item 1',
|
||||
sublabel: 'Subtitle 1',
|
||||
click: () => { event.sender.send('context-menu-command', 'menu-item-1') }
|
||||
},
|
||||
{ type: 'separator' },
|
||||
{ label: 'Menu Item 2', sublabel: 'Subtitle 2', type: 'checkbox', checked: true }
|
||||
]
|
||||
const menu = Menu.buildFromTemplate(template)
|
||||
menu.popup({ window: BrowserWindow.fromWebContents(event.sender) })
|
||||
})
|
||||
```
|
||||
|
||||
## Setting Menu for Specific Browser Window (_Linux_ _Windows_)
|
||||
|
||||
The [`setMenu` method][setMenu] of browser windows can set the menu of certain
|
||||
|
||||
@@ -63,6 +63,14 @@ Your application should then always use `shouldUseDarkColors` to determine what
|
||||
A `boolean` for if the OS / Chromium currently has high-contrast mode enabled
|
||||
or is being instructed to show a high-contrast UI.
|
||||
|
||||
### `nativeTheme.shouldUseDarkColorsForSystemIntegratedUI` _macOS_ _Windows_ _Readonly_
|
||||
|
||||
A `boolean` property indicating whether or not the system theme has been set to dark or light.
|
||||
|
||||
On Windows this property distinguishes between system and app light/dark theme, returning
|
||||
`true` if the system theme is set to dark theme and `false` otherwise. On macOS the return
|
||||
value will be the same as `nativeTheme.shouldUseDarkColors`.
|
||||
|
||||
### `nativeTheme.shouldUseInvertedColorScheme` _macOS_ _Windows_ _Readonly_
|
||||
|
||||
A `boolean` for if the OS / Chromium currently has an inverted color scheme
|
||||
|
||||
@@ -46,4 +46,7 @@ See: https://developer.apple.com/documentation/appkit/nsapplication/1428476-regi
|
||||
### `pushNotifications.unregisterForAPNSNotifications()` _macOS_
|
||||
|
||||
Unregisters the app from notifications received from APNS.
|
||||
|
||||
Apps unregistered through this method can always reregister.
|
||||
|
||||
See: https://developer.apple.com/documentation/appkit/nsapplication/1428747-unregisterforremotenotifications?language=objc
|
||||
|
||||
@@ -124,7 +124,7 @@ Returns [`Display`](structures/display.md) - The display nearest the specified p
|
||||
Returns [`Display`](structures/display.md) - The display that most closely
|
||||
intersects the provided bounds.
|
||||
|
||||
### `screen.screenToDipPoint(point)` _Windows_
|
||||
### `screen.screenToDipPoint(point)` _Windows_ _Linux_
|
||||
|
||||
* `point` [Point](structures/point.md)
|
||||
|
||||
@@ -133,7 +133,10 @@ Returns [`Point`](structures/point.md)
|
||||
Converts a screen physical point to a screen DIP point.
|
||||
The DPI scale is performed relative to the display containing the physical point.
|
||||
|
||||
### `screen.dipToScreenPoint(point)` _Windows_
|
||||
Not currently supported on Wayland - if used there it will return the point passed
|
||||
in with no changes.
|
||||
|
||||
### `screen.dipToScreenPoint(point)` _Windows_ _Linux_
|
||||
|
||||
* `point` [Point](structures/point.md)
|
||||
|
||||
@@ -142,6 +145,8 @@ Returns [`Point`](structures/point.md)
|
||||
Converts a screen DIP point to a screen physical point.
|
||||
The DPI scale is performed relative to the display containing the DIP point.
|
||||
|
||||
Not currently supported on Wayland.
|
||||
|
||||
### `screen.screenToDipRect(window, rect)` _Windows_
|
||||
|
||||
* `window` [BrowserWindow](browser-window.md) | null
|
||||
|
||||
@@ -58,8 +58,8 @@
|
||||
`false` on macOS. This option is not configurable on other platforms.
|
||||
* `disableAutoHideCursor` boolean (optional) - Whether to hide cursor when typing.
|
||||
Default is `false`.
|
||||
* `autoHideMenuBar` boolean (optional) - Auto hide the menu bar unless the `Alt`
|
||||
key is pressed. Default is `false`.
|
||||
* `autoHideMenuBar` boolean (optional) _Linux_ _Windows_ - Auto hide the menu bar
|
||||
unless the `Alt` key is pressed. Default is `false`.
|
||||
* `enableLargerThanScreen` boolean (optional) _macOS_ - Enable the window to
|
||||
be resized larger than screen. Only relevant for macOS, as other OSes
|
||||
allow larger-than-screen windows by default. Default is `false`.
|
||||
@@ -93,7 +93,7 @@
|
||||
**Note:** This option is currently experimental.
|
||||
* `titleBarOverlay` Object | Boolean (optional) - When using a frameless window in conjunction with `win.setWindowButtonVisibility(true)` on macOS or using a `titleBarStyle` so that the standard window controls ("traffic lights" on macOS) are visible, this property enables the Window Controls Overlay [JavaScript APIs][overlay-javascript-apis] and [CSS Environment Variables][overlay-css-env-vars]. Specifying `true` will result in an overlay with default system colors. Default is `false`.
|
||||
* `color` String (optional) _Windows_ _Linux_ - The CSS color of the Window Controls Overlay when enabled. Default is the system color.
|
||||
* `symbolColor` String (optional) _Windows_ - The CSS color of the symbols on the Window Controls Overlay when enabled. Default is the system color.
|
||||
* `symbolColor` String (optional) _Windows_ _Linux_ - The CSS color of the symbols on the Window Controls Overlay when enabled. Default is the system color.
|
||||
* `height` Integer (optional) - The height of the title bar and Window Controls Overlay in pixels. Default is system height.
|
||||
* `trafficLightPosition` [Point](point.md) (optional) _macOS_ -
|
||||
Set a custom position for the traffic light buttons in frameless windows.
|
||||
|
||||
@@ -44,6 +44,8 @@ Process: [Main](../glossary.md#main-process)<br />
|
||||
|
||||
Returns [`UtilityProcess`](utility-process.md#class-utilityprocess)
|
||||
|
||||
**Note:** `utilityProcess.fork` can only be called after the `ready` event has been emitted on `App`.
|
||||
|
||||
## Class: UtilityProcess
|
||||
|
||||
> Instances of the `UtilityProcess` represent the Chromium spawned child process
|
||||
|
||||
@@ -838,9 +838,10 @@ Emitted when a bluetooth device needs to be selected when a call to
|
||||
the `deviceId` of the device to be selected. Passing an empty string to
|
||||
`callback` will cancel the request.
|
||||
|
||||
If an event listener is not added for this event, or if `event.preventDefault`
|
||||
is not called when handling this event, the first available device will be
|
||||
automatically selected.
|
||||
If no event listener is added for this event, all bluetooth requests will be cancelled.
|
||||
|
||||
If `event.preventDefault` is not called when handling this event, the first available
|
||||
device will be automatically selected.
|
||||
|
||||
Due to the nature of bluetooth, scanning for devices when
|
||||
`navigator.bluetooth.requestDevice` is called may take time and will cause
|
||||
@@ -2389,7 +2390,7 @@ A [`WebFrameMain`](web-frame-main.md) property that represents the top frame of
|
||||
|
||||
#### `contents.opener` _Readonly_
|
||||
|
||||
A [`WebFrameMain`](web-frame-main.md) property that represents the frame that opened this WebContents, either
|
||||
A [`WebFrameMain | null`](web-frame-main.md) property that represents the frame that opened this WebContents, either
|
||||
with open(), or by navigating a link with a target attribute.
|
||||
|
||||
[keyboardevent]: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent
|
||||
|
||||
@@ -14,13 +14,21 @@ This document uses the following convention to categorize breaking changes:
|
||||
|
||||
## Planned Breaking API Changes (35.0)
|
||||
|
||||
### Behavior Changes: `app.commandLine`
|
||||
|
||||
`app.commandLine` will convert upper-cases switches and arguments to lowercase.
|
||||
|
||||
`app.commandLine` was only meant to handle chromium switches (which aren't case-sensitive) and switches passed via `app.commandLine` will not be passed down to any of the child processes.
|
||||
|
||||
If you were using `app.commandLine` to control the behavior of the main process, you should do this via `process.argv`.
|
||||
|
||||
### Behavior Changed: Dialog API's `defaultPath` option on Linux
|
||||
|
||||
On Linux, the required portal version for file dialogs has been reverted
|
||||
to 3 from 4. Using the `defaultPath` option of the Dialog API is not
|
||||
supported when using portal file chooser dialogs unless the portal
|
||||
backend is version 4 or higher. The `--xdg-portal-required-version`
|
||||
[command-line switch](/api/command-line-switches.md#--xdg-portal-required-versionversion)
|
||||
[command-line switch](api/command-line-switches.md#--xdg-portal-required-versionversion)
|
||||
can be used to force a required version for your application.
|
||||
See [#44426](https://github.com/electron/electron/pull/44426) for more details.
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ Verify that the Pull Request is correct and make a corresponding entry in the
|
||||
API History:
|
||||
|
||||
> [!NOTE]
|
||||
> Refer to the [API History section of `styleguide.md`](../styleguide.md#api-history)
|
||||
> Refer to the [API History section of `style-guide.md`](./style-guide.md#api-history)
|
||||
for information on how to create API History blocks.
|
||||
|
||||
`````markdown
|
||||
|
||||
@@ -195,7 +195,7 @@ required[, optional]
|
||||
More detailed information on each of the arguments is noted in an unordered list
|
||||
below the method. The type of argument is notated by either JavaScript primitives
|
||||
(e.g. `string`, `Promise`, or `Object`), a custom API structure like Electron's
|
||||
[`Cookie`](api/structures/cookie.md), or the wildcard `any`.
|
||||
[`Cookie`](../api/structures/cookie.md), or the wildcard `any`.
|
||||
|
||||
If the argument is of type `Array`, use `[]` shorthand with the type of value
|
||||
inside the array (for example,`any[]` or `string[]`).
|
||||
@@ -290,7 +290,7 @@ The purpose of the API History block is to describe when/where/how/why an API wa
|
||||
Each API change listed in the block should include a link to the
|
||||
PR where that change was made along with an optional short description of the
|
||||
change. If applicable, include the [heading id](https://gist.github.com/asabaylus/3071099)
|
||||
for that change from the [breaking changes documentation](./breaking-changes.md).
|
||||
for that change from the [breaking changes documentation](../breaking-changes.md).
|
||||
|
||||
The [API History linting script][api-history-linting-script] (`lint:api-history`)
|
||||
validates API History blocks in the Electron documentation against the schema and
|
||||
@@ -24,9 +24,7 @@ const dockMenu = Menu.buildFromTemplate([
|
||||
])
|
||||
|
||||
app.whenReady().then(() => {
|
||||
if (process.platform === 'darwin') {
|
||||
app.dock.setMenu(dockMenu)
|
||||
}
|
||||
app.dock?.setMenu(dockMenu)
|
||||
}).then(createWindow)
|
||||
|
||||
app.on('window-all-closed', () => {
|
||||
|
||||
@@ -37,7 +37,6 @@ the illusion of a circular window.
|
||||
open on the user's system).
|
||||
* The window will not be transparent when DevTools is opened.
|
||||
* On _Windows_:
|
||||
* Transparent windows will not work when DWM is disabled.
|
||||
* Transparent windows can not be maximized using the Windows system menu or by double
|
||||
clicking the title bar. The reasoning behind this can be seen on
|
||||
PR [#28207](https://github.com/electron/electron/pull/28207).
|
||||
|
||||
@@ -50,9 +50,7 @@ const dockMenu = Menu.buildFromTemplate([
|
||||
])
|
||||
|
||||
app.whenReady().then(() => {
|
||||
if (process.platform === 'darwin') {
|
||||
app.dock.setMenu(dockMenu)
|
||||
}
|
||||
app.dock?.setMenu(dockMenu)
|
||||
}).then(createWindow)
|
||||
|
||||
app.on('window-all-closed', () => {
|
||||
|
||||
1346
docs/tutorial/native-code-and-electron-cpp-win32.md
Normal file
1346
docs/tutorial/native-code-and-electron-cpp-win32.md
Normal file
File diff suppressed because it is too large
Load Diff
1152
docs/tutorial/native-code-and-electron-objc-macos.md
Normal file
1152
docs/tutorial/native-code-and-electron-objc-macos.md
Normal file
File diff suppressed because it is too large
Load Diff
380
docs/tutorial/native-code-and-electron.md
Normal file
380
docs/tutorial/native-code-and-electron.md
Normal file
@@ -0,0 +1,380 @@
|
||||
# Native Code and Electron
|
||||
|
||||
One of Electron's most powerful features is the ability to combine web technologies with native code - both for compute-intensive logic as well as for the occasional native user interface, where desired.
|
||||
|
||||
Electron does so by building on top of "Native Node.js Addons". You've probably already come across a few of them - packages like the famous [sqlite](https://www.npmjs.com/package/sqlite3) use native code to combine JavaScript and native technologies. You can use this feature to extend your Electron application with anything a fully native application can do:
|
||||
|
||||
* Access native platform APIs not available in JavaScript. Any macOS, Windows, or Linux operating system API is available to you.
|
||||
* Create UI components that interact with native desktop frameworks.
|
||||
* Integrate with existing native libraries.
|
||||
* Implement performance-critical code that runs faster than JavaScript.
|
||||
|
||||
Native Node.js addons are dynamically-linked shared objects (on Unix-like systems) or DLL files (on Windows) that can be loaded into Node.js or Electron using the `require()` or `import` functions. They behave just like regular JavaScript modules but provide an interface to code written in C++, Rust, or other languages that can compile to native code.
|
||||
|
||||
# Tutorial: Creating a Native Node.js Addon for Electron
|
||||
|
||||
This tutorial will walk you through building a basic Node.js native addon that can be used in Electron applications. We'll focus on concepts common to all platforms, using C++ as the implementation language. Once you complete this tutorial common to all native Node.js addons, you can move on to one of our platform-specific tutorials.
|
||||
|
||||
## Requirements
|
||||
|
||||
This tutorial assumes you have Node.js and npm installed, as well as the basic tools necessary for compiling code on your platform (like Visual Studio on Windows, Xcode on macOS, or GCC/Clang on Linux). You can find detailed instructions in the [`node-gyp` readme](https://github.com/nodejs/node-gyp?tab=readme-ov-file).
|
||||
|
||||
### Requirements: macOS
|
||||
|
||||
To build native Node.js addons on macOS, you'll need the Xcode Command Line Tools. These provide the necessary compilers and build tools (namely, `clang`, `clang++`, and `make`). The following command will prompt you to install the Command Line Tools if they aren't already installed.
|
||||
|
||||
```sh
|
||||
xcode-select --install
|
||||
```
|
||||
|
||||
### Requirements: Windows
|
||||
|
||||
The official Node.js installer offers the optional installation of "Tools for Native Modules", which installs everything required for the basic compilation of C++ modules - specifically, Python 3 and the "Visual Studio Desktop development with C++" workload. Alternatively, you can use `chocolatey`, `winget`, or the Windows Store.
|
||||
|
||||
### Requirements: Linux
|
||||
|
||||
* [A supported version of Python](https://devguide.python.org/versions/)
|
||||
* `make`
|
||||
* A proper C/C++ compiler toolchain, like [GCC](https://gcc.gnu.org)
|
||||
|
||||
## 1) Creating a package
|
||||
|
||||
First, create a new Node.js package that will contain your native addon:
|
||||
|
||||
```sh
|
||||
mkdir my-native-addon
|
||||
cd my-native-addon
|
||||
npm init -y
|
||||
```
|
||||
|
||||
This creates a basic `package.json` file. Next, we'll install the necessary dependencies:
|
||||
|
||||
```sh
|
||||
npm install node-addon-api bindings
|
||||
```
|
||||
|
||||
* `node-addon-api`: This is a C++ wrapper for the low-level Node.js API that makes it easier to build addons. It provides a C++ object-oriented API that's more convenient and safer to use than the raw C-style API.
|
||||
* `bindings`: A helper module that simplifies the process of loading your compiled native addon. It handles finding your compiled `.node` file automatically.
|
||||
|
||||
Now, let's update our `package.json` to include the appropriate build scripts. We will explain what these specifically do further below.
|
||||
|
||||
```json title='package.json'
|
||||
{
|
||||
"name": "my-native-addon",
|
||||
"version": "1.0.0",
|
||||
"description": "A native addon for Electron",
|
||||
"main": "js/index.js",
|
||||
"scripts": {
|
||||
"clean": "node -e \"require('fs').rmSync('build', { recursive: true, force: true })\"",
|
||||
"build": "node-gyp configure && node-gyp build"
|
||||
},
|
||||
"dependencies": {
|
||||
"bindings": "^1.5.0",
|
||||
"node-addon-api": "^8.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"node-gyp": "^11.1.0"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
These scripts will:
|
||||
|
||||
* `clean`: Remove the build directory, allowing for a fresh build
|
||||
* `build`: Run the standard node-gyp build process to compile your addon
|
||||
|
||||
## 2) Setting up the build system
|
||||
|
||||
Node.js addons use a build system called `node-gyp`, which is a cross-platform command-line tool written in Node.js. It compiles native addon modules for Node.js using platform-specific build tools behind the scenes:
|
||||
|
||||
* On Windows: Visual Studio
|
||||
* On macOS: Xcode or command-line tools
|
||||
* On Linux: GCC or similar compilers
|
||||
|
||||
### Configuring `node-gyp`
|
||||
|
||||
The `binding.gyp` file is a JSON-like configuration file that tells node-gyp how to build your native addon. It's similar to a make file or a project file but in a platform-independent format. Let's create a basic `binding.gyp` file:
|
||||
|
||||
```json title='binding.gyp'
|
||||
{
|
||||
"targets": [
|
||||
{
|
||||
"target_name": "my_addon",
|
||||
"sources": [
|
||||
"src/my_addon.cc",
|
||||
"src/cpp_code.cc"
|
||||
],
|
||||
"include_dirs": [
|
||||
"<!@(node -p \"require('node-addon-api').include\")",
|
||||
"include"
|
||||
],
|
||||
"dependencies": [
|
||||
"<!(node -p \"require('node-addon-api').gyp\")"
|
||||
],
|
||||
"defines": [
|
||||
"NODE_ADDON_API_CPP_EXCEPTIONS"
|
||||
],
|
||||
"cflags!": ["-fno-exceptions"],
|
||||
"cflags_cc!": ["-fno-exceptions"],
|
||||
"xcode_settings": {
|
||||
"GCC_ENABLE_CPP_EXCEPTIONS": "YES",
|
||||
"CLANG_CXX_LIBRARY": "libc++",
|
||||
"MACOSX_DEPLOYMENT_TARGET": "10.14"
|
||||
},
|
||||
"msvs_settings": {
|
||||
"VCCLCompilerTool": {
|
||||
"ExceptionHandling": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
Let's break down this configuration:
|
||||
|
||||
* `target_name`: The name of your addon. This determines the filename of the compiled module (my_addon.node).
|
||||
* `sources`: List of source files to compile. We'll have two files: the main addon file and our actual C++ implementation.
|
||||
* `include_dirs`: Directories to search for header files. The cryptic-looking line `<!@(node -p \"require('node-addon-api').include\")` runs a Node.js command to get the path to the node-addon-api include directory.
|
||||
* `dependencies`: The `node-addon-api` dependency. Similar to the include dirs, this executes a Node.js command to get the proper configuration.
|
||||
* `defines`: Preprocessor definitions. Here we're enabling C++ exceptions for node-addon-api.
|
||||
Platform-specific settings:
|
||||
* `cflags`! and cflags_cc!: Compiler flags for Unix-like systems
|
||||
* `xcode_settings`: Settings specific to macOS/Xcode compiler
|
||||
* `msvs_settings`: Settings specific to Microsoft Visual Studio on Windows
|
||||
|
||||
Now, create the directory structure for our project:
|
||||
|
||||
```sh
|
||||
mkdir src
|
||||
mkdir include
|
||||
mkdir js
|
||||
```
|
||||
|
||||
This creates:
|
||||
|
||||
* `src/`: Where our source files will go
|
||||
* `include/`: For header files
|
||||
* `js/`: For our JavaScript wrapper
|
||||
|
||||
## 3) "Hello World" from C++
|
||||
|
||||
Let's start by defining our C++ interface in a header file. Create `include/cpp_code.h`:
|
||||
|
||||
```cpp
|
||||
#pragma once
|
||||
#include <string>
|
||||
|
||||
namespace cpp_code {
|
||||
// A simple function that takes a string input and returns a string
|
||||
std::string hello_world(const std::string& input);
|
||||
} // namespace cpp_code
|
||||
```
|
||||
|
||||
The `#pragma once` directive is a header guard that prevents the file from being included multiple times in the same compilation unit. The actual function declaration is inside a namespace to avoid potential name conflicts.
|
||||
|
||||
Next, let's implement the function in `src/cpp_code.cc`:
|
||||
|
||||
```cpp title='src/cpp_code.cc'
|
||||
#include <string>
|
||||
#include "../include/cpp_code.h"
|
||||
|
||||
namespace cpp_code {
|
||||
std::string hello_world(const std::string& input) {
|
||||
// Simply concatenate strings and return
|
||||
return "Hello from C++! You said: " + input;
|
||||
}
|
||||
} // namespace cpp_code
|
||||
```
|
||||
|
||||
This is a simple implementation that just adds some text to the input string and returns it.
|
||||
|
||||
Now, let's create the addon code that bridges our C++ code with the Node.js/JavaScript world. Create `src/my_addon.cc`:
|
||||
|
||||
```cpp title='src/my_addon.cc'
|
||||
#include <napi.h>
|
||||
#include <string>
|
||||
#include "../include/cpp_code.h"
|
||||
|
||||
// Create a class that will be exposed to JavaScript
|
||||
class MyAddon : public Napi::ObjectWrap<MyAddon> {
|
||||
public:
|
||||
// This static method defines the class for JavaScript
|
||||
static Napi::Object Init(Napi::Env env, Napi::Object exports) {
|
||||
// Define the JavaScript class with method(s)
|
||||
Napi::Function func = DefineClass(env, "MyAddon", {
|
||||
InstanceMethod("helloWorld", &MyAddon::HelloWorld)
|
||||
});
|
||||
|
||||
// Create a persistent reference to the constructor
|
||||
Napi::FunctionReference* constructor = new Napi::FunctionReference();
|
||||
*constructor = Napi::Persistent(func);
|
||||
env.SetInstanceData(constructor);
|
||||
|
||||
// Set the constructor on the exports object
|
||||
exports.Set("MyAddon", func);
|
||||
return exports;
|
||||
}
|
||||
|
||||
// Constructor
|
||||
MyAddon(const Napi::CallbackInfo& info)
|
||||
: Napi::ObjectWrap<MyAddon>(info) {}
|
||||
|
||||
private:
|
||||
// Method that will be exposed to JavaScript
|
||||
Napi::Value HelloWorld(const Napi::CallbackInfo& info) {
|
||||
Napi::Env env = info.Env();
|
||||
|
||||
// Validate arguments (expecting one string)
|
||||
if (info.Length() < 1 || !info[0].IsString()) {
|
||||
Napi::TypeError::New(env, "Expected string argument").ThrowAsJavaScriptException();
|
||||
return env.Null();
|
||||
}
|
||||
|
||||
// Convert JavaScript string to C++ string
|
||||
std::string input = info[0].As<Napi::String>();
|
||||
|
||||
// Call our C++ function
|
||||
std::string result = cpp_code::hello_world(input);
|
||||
|
||||
// Convert C++ string back to JavaScript string and return
|
||||
return Napi::String::New(env, result);
|
||||
}
|
||||
};
|
||||
|
||||
// Initialize the addon
|
||||
Napi::Object Init(Napi::Env env, Napi::Object exports) {
|
||||
return MyAddon::Init(env, exports);
|
||||
}
|
||||
|
||||
// Register the initialization function
|
||||
NODE_API_MODULE(my_addon, Init)
|
||||
```
|
||||
|
||||
Let's break down this code:
|
||||
|
||||
1. We define a `MyAddon` class that inherits from `Napi::ObjectWrap<MyAddon>`, which handles wrapping our C++ class for JavaScript.
|
||||
2. The `Init` static method:
|
||||
2.1 Defines a JavaScript class with a method called `helloWorld`
|
||||
2.2 Creates a persistent reference to the constructor (to prevent garbage collection)
|
||||
2.3 Exports the class constructor
|
||||
3. The constructor simply passes its arguments to the parent class.
|
||||
4. The `HelloWorld` method:
|
||||
4.1 Gets the Napi environment
|
||||
4.2 Validates input arguments (expecting a string)
|
||||
4.3 Converts the JavaScript string to a C++ string
|
||||
4.4 Calls our C++ function
|
||||
4.5 Converts the result back to a JavaScript string and returns it
|
||||
5. We define an initialization function and register it with NODE_API_MODULE macro, which makes our module loadable by Node.js.
|
||||
|
||||
Now, let's create a JavaScript wrapper to make the addon easier to use. Create `js/index.js`:
|
||||
|
||||
```js title='js/index.js' @ts-expect-error=[5]
|
||||
const EventEmitter = require('events')
|
||||
|
||||
// Load the native addon using the 'bindings' module
|
||||
// This will look for the compiled .node file in various places
|
||||
const bindings = require('bindings')
|
||||
const native = bindings('my_addon')
|
||||
|
||||
// Create a nice JavaScript wrapper
|
||||
class MyNativeAddon extends EventEmitter {
|
||||
constructor () {
|
||||
super()
|
||||
|
||||
// Create an instance of our C++ class
|
||||
this.addon = new native.MyAddon()
|
||||
}
|
||||
|
||||
// Wrap the C++ method with a nicer JavaScript API
|
||||
helloWorld (input = '') {
|
||||
if (typeof input !== 'string') {
|
||||
throw new TypeError('Input must be a string')
|
||||
}
|
||||
return this.addon.helloWorld(input)
|
||||
}
|
||||
}
|
||||
|
||||
// Export a singleton instance
|
||||
if (process.platform === 'win32' || process.platform === 'darwin' || process.platform === 'linux') {
|
||||
module.exports = new MyNativeAddon()
|
||||
} else {
|
||||
// Provide a fallback for unsupported platforms
|
||||
console.warn('Native addon not supported on this platform')
|
||||
|
||||
module.exports = {
|
||||
helloWorld: (input) => `Hello from JS! You said: ${input}`
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
This JavaScript wrapper:
|
||||
|
||||
1. Uses `bindings` to load our compiled native addon
|
||||
1. Creates a class that extends EventEmitter (useful for future extensions that might emit events)
|
||||
1. Instantiates our C++ class and provides a simpler API
|
||||
1. Adds some input validation on the JavaScript side
|
||||
1. Exports a singleton instance of our wrapper
|
||||
1. Handles unsupported platforms gracefully
|
||||
|
||||
### Building and testing the addon
|
||||
|
||||
Now we can build our native addon:
|
||||
|
||||
```sh
|
||||
npm run build
|
||||
```
|
||||
|
||||
This will run `node-gyp configure` and `node-gyp build` to compile our C++ code into a `.node` file.
|
||||
Let's create a simple test script to verify everything works. Create `test.js` in the project root:
|
||||
|
||||
```js title='test.js' @ts-expect-error=[2]
|
||||
// Load our addon
|
||||
const myAddon = require('./js')
|
||||
|
||||
// Try the helloWorld function
|
||||
const result = myAddon.helloWorld('This is a test')
|
||||
|
||||
// Should print: "Hello from C++! You said: This is a test"
|
||||
console.log(result)
|
||||
```
|
||||
|
||||
Run the test:
|
||||
|
||||
```sh
|
||||
node test.js
|
||||
```
|
||||
|
||||
If everything works correctly, you should see:
|
||||
|
||||
```txt
|
||||
Hello from C++! You said: This is a test
|
||||
```
|
||||
|
||||
### Using the addon in Electron
|
||||
|
||||
To use this addon in an Electron application, you would:
|
||||
|
||||
1. Include it as a dependency in your Electron project
|
||||
1. Build it targeting your specific Electron version. `electron-forge` handles this step automatically for you - for more details, see [Native Node Modules](./using-native-node-modules.md).
|
||||
1. Import and use it just like any other module in a process that has Node.js enabled.
|
||||
|
||||
```js @ts-expect-error=[2]
|
||||
// In your main process
|
||||
const myAddon = require('my-native-addon')
|
||||
console.log(myAddon.helloWorld('Electron'))
|
||||
```
|
||||
|
||||
## References and further learning
|
||||
|
||||
Native addon development can be written in several languages beyond C++. Rust can be used with crates like [`napi-rs`](https://github.com/napi-rs/napi-rs), [`neon`](https://neon-rs.dev/), or [`node-bindgen`](https://github.com/infinyon/node-bindgen). Objective-C/Swift can be used through Objective-C++ on macOS.
|
||||
|
||||
The specific implementation details differ significantly by platform, especially when accessing platform-specific APIs or UI frameworks, like Windows' Win32 API, COM components, UWP/WinRT - or macOS's Cocoa, AppKit, or ObjectiveC runtime.
|
||||
|
||||
This means that you'll likely use two groups of references for your native code: First, on the Node.js side, use the [N-API documentation](https://nodejs.org/api/n-api.html) to learn about creating and exposing complex structures to JavaScript - like asynchronous thread-safe function calls or creating JavaScript-native objects (`error`, `promise`, etc). Secondly, on the side of the technology you're working with, you'll likely be looking at their lower-level documentation:
|
||||
|
||||
* [Microsoft C++, C, and Assembler documentation](https://learn.microsoft.com/en-us/cpp/?view=msvc-170)
|
||||
* [C++/WinRT](https://learn.microsoft.com/en-us/windows/uwp/cpp-and-winrt-apis/)
|
||||
* [MSVC-170 C++ Documentation](https://learn.microsoft.com/en-us/cpp/cpp/?view=msvc-170)
|
||||
* [Apple Developer Documentation](https://developer.apple.com/documentation)
|
||||
* [Programming with Objective-C](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/Introduction/Introduction.html#//apple_ref/doc/uid/TP40011210)
|
||||
@@ -35,6 +35,7 @@ filenames = {
|
||||
"shell/browser/relauncher_linux.cc",
|
||||
"shell/browser/ui/electron_desktop_window_tree_host_linux.cc",
|
||||
"shell/browser/ui/file_dialog_linux.cc",
|
||||
"shell/browser/ui/file_dialog_linux_portal.cc",
|
||||
"shell/browser/ui/gtk/menu_gtk.cc",
|
||||
"shell/browser/ui/gtk/menu_gtk.h",
|
||||
"shell/browser/ui/gtk/menu_util.cc",
|
||||
@@ -453,8 +454,6 @@ filenames = {
|
||||
"shell/browser/net/system_network_context_manager.h",
|
||||
"shell/browser/net/url_loader_network_observer.cc",
|
||||
"shell/browser/net/url_loader_network_observer.h",
|
||||
"shell/browser/net/url_pipe_loader.cc",
|
||||
"shell/browser/net/url_pipe_loader.h",
|
||||
"shell/browser/net/web_request_api_interface.h",
|
||||
"shell/browser/network_hints_handler_impl.cc",
|
||||
"shell/browser/network_hints_handler_impl.h",
|
||||
|
||||
@@ -54,7 +54,7 @@ BrowserWindow.prototype._init = function (this: BWT) {
|
||||
});
|
||||
this.on('close', (event) => {
|
||||
queueMicrotask(() => {
|
||||
if (!unresponsiveEvent && !event.defaultPrevented) {
|
||||
if (!unresponsiveEvent && !event?.defaultPrevented) {
|
||||
unresponsiveEvent = setTimeout(emitUnresponsiveEvent, 5000);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -78,7 +78,9 @@ export const roleList: Record<RoleId, Role> = {
|
||||
minimize: {
|
||||
label: 'Minimize',
|
||||
accelerator: 'CommandOrControl+M',
|
||||
windowMethod: w => w.minimize()
|
||||
windowMethod: w => {
|
||||
if (w.minimizable) w.minimize();
|
||||
}
|
||||
},
|
||||
paste: {
|
||||
label: 'Paste',
|
||||
|
||||
@@ -267,8 +267,17 @@ WebContents.prototype.print = function (options: ElectronInternal.WebContentsPri
|
||||
throw new TypeError('webContents.print(): Invalid print settings specified.');
|
||||
}
|
||||
|
||||
const pageSize = options.pageSize ?? 'A4';
|
||||
if (typeof pageSize === 'object') {
|
||||
const { pageSize } = options;
|
||||
if (typeof pageSize === 'string' && PDFPageSizes[pageSize]) {
|
||||
const mediaSize = PDFPageSizes[pageSize];
|
||||
options.mediaSize = {
|
||||
...mediaSize,
|
||||
imageable_area_left_microns: 0,
|
||||
imageable_area_bottom_microns: 0,
|
||||
imageable_area_right_microns: mediaSize.width_microns,
|
||||
imageable_area_top_microns: mediaSize.height_microns
|
||||
};
|
||||
} else if (typeof pageSize === 'object') {
|
||||
if (!pageSize.height || !pageSize.width) {
|
||||
throw new Error('height and width properties are required for pageSize');
|
||||
}
|
||||
@@ -290,16 +299,7 @@ WebContents.prototype.print = function (options: ElectronInternal.WebContentsPri
|
||||
imageable_area_right_microns: width,
|
||||
imageable_area_top_microns: height
|
||||
};
|
||||
} else if (typeof pageSize === 'string' && PDFPageSizes[pageSize]) {
|
||||
const mediaSize = PDFPageSizes[pageSize];
|
||||
options.mediaSize = {
|
||||
...mediaSize,
|
||||
imageable_area_left_microns: 0,
|
||||
imageable_area_bottom_microns: 0,
|
||||
imageable_area_right_microns: mediaSize.width_microns,
|
||||
imageable_area_top_microns: mediaSize.height_microns
|
||||
};
|
||||
} else {
|
||||
} else if (pageSize !== undefined) {
|
||||
throw new Error(`Unsupported pageSize: ${pageSize}`);
|
||||
}
|
||||
|
||||
|
||||
@@ -218,7 +218,6 @@ if (packagePath) {
|
||||
} else {
|
||||
// Call appCodeLoaded before just for safety, it doesn't matter here as _load is synchronous
|
||||
appCodeLoaded!();
|
||||
process._firstFileName = Module._resolveFilename(path.join(packagePath, mainStartupScript), null, false);
|
||||
Module._load(path.join(packagePath, mainStartupScript), Module, true);
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -26,7 +26,12 @@ const keysOfTypeNumberCompileTimeCheck: { [K in IntegerBrowserWindowOptionKeys]
|
||||
};
|
||||
// Note `top` / `left` are special cases from the browser which we later convert
|
||||
// to y / x.
|
||||
const keysOfTypeNumber = new Set(['top', 'left', ...Object.keys(keysOfTypeNumberCompileTimeCheck)]);
|
||||
// NOTE(@mlaurencin) `innerWidth` / `innerHeight` are also special cases. The spec
|
||||
// states that `width` and `height` represent the window content size and are equivalent
|
||||
// to `innerWidth` / `innerHeight`. However, our implementation currently incorrectly maps
|
||||
// `width` and `height` to `outerWidth` and `outerHeight`, or the size of the window
|
||||
// with all border and related window chrome.
|
||||
const keysOfTypeNumber = new Set(['top', 'left', 'innerWidth', 'innerHeight', ...Object.keys(keysOfTypeNumberCompileTimeCheck)]);
|
||||
|
||||
/**
|
||||
* Note that we only allow "0" and "1" boolean conversion when the type is known
|
||||
|
||||
@@ -667,10 +667,10 @@ export const wrapFsWithAsar = (fs: Record<string, any>) => {
|
||||
return p(pathArgument, options);
|
||||
};
|
||||
|
||||
const { readFileSync } = fs;
|
||||
fs.readFileSync = function (pathArgument: string, options: any) {
|
||||
const pathInfo = splitPath(pathArgument);
|
||||
if (!pathInfo.isAsar) return readFileSync.apply(this, arguments);
|
||||
function readFileFromArchiveSync (
|
||||
pathInfo: { asarPath: string; filePath: string },
|
||||
options: any
|
||||
): ReturnType<typeof readFileSync> {
|
||||
const { asarPath, filePath } = pathInfo;
|
||||
|
||||
const archive = getOrCreateArchive(asarPath);
|
||||
@@ -704,6 +704,14 @@ export const wrapFsWithAsar = (fs: Record<string, any>) => {
|
||||
fs.readSync(fd, buffer, 0, info.size, info.offset);
|
||||
validateBufferIntegrity(buffer, info.integrity);
|
||||
return (encoding) ? buffer.toString(encoding) : buffer;
|
||||
}
|
||||
|
||||
const { readFileSync } = fs;
|
||||
fs.readFileSync = function (pathArgument: string, options: any) {
|
||||
const pathInfo = splitPath(pathArgument);
|
||||
if (!pathInfo.isAsar) return readFileSync.apply(this, arguments);
|
||||
|
||||
return readFileFromArchiveSync(pathInfo, options);
|
||||
};
|
||||
|
||||
type ReaddirOptions = { encoding: BufferEncoding | null; withFileTypes?: false, recursive?: false } | undefined | null;
|
||||
@@ -980,25 +988,19 @@ export const wrapFsWithAsar = (fs: Record<string, any>) => {
|
||||
};
|
||||
|
||||
const modBinding = internalBinding('modules');
|
||||
const { readPackageJSON } = modBinding;
|
||||
internalBinding('modules').readPackageJSON = (
|
||||
jsonPath: string,
|
||||
isESM: boolean,
|
||||
base: undefined | string,
|
||||
specifier: undefined | string
|
||||
) => {
|
||||
modBinding.overrideReadFileSync((jsonPath: string): Buffer | false | undefined => {
|
||||
const pathInfo = splitPath(jsonPath);
|
||||
if (!pathInfo.isAsar) return readPackageJSON(jsonPath, isESM, base, specifier);
|
||||
const { asarPath, filePath } = pathInfo;
|
||||
|
||||
const archive = getOrCreateArchive(asarPath);
|
||||
if (!archive) return undefined;
|
||||
// Fallback to Node.js internal implementation
|
||||
if (!pathInfo.isAsar) return undefined;
|
||||
|
||||
const realPath = archive.copyFileOut(filePath);
|
||||
if (!realPath) return undefined;
|
||||
|
||||
return readPackageJSON(realPath, isESM, base, specifier);
|
||||
};
|
||||
try {
|
||||
return readFileFromArchiveSync(pathInfo, undefined);
|
||||
} catch {
|
||||
// Not found
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
const { internalModuleStat } = binding;
|
||||
internalBinding('fs').internalModuleStat = (receiver: unknown, pathArgument: string) => {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
"@electron/docs-parser": "^2.0.0",
|
||||
"@electron/fiddle-core": "^1.3.4",
|
||||
"@electron/github-app-auth": "^2.2.1",
|
||||
"@electron/lint-roller": "^2.4.0",
|
||||
"@electron/lint-roller": "^3.1.1",
|
||||
"@electron/typescript-definitions": "^9.0.0",
|
||||
"@octokit/rest": "^20.0.2",
|
||||
"@primer/octicons": "^10.0.0",
|
||||
@@ -40,7 +40,7 @@
|
||||
"got": "^11.8.5",
|
||||
"husky": "^8.0.1",
|
||||
"lint-staged": "^10.2.11",
|
||||
"markdownlint-cli2": "^0.13.0",
|
||||
"markdownlint-cli2": "^0.18.0",
|
||||
"minimist": "^1.2.8",
|
||||
"null-loader": "^4.0.1",
|
||||
"pre-flight": "^2.0.0",
|
||||
|
||||
@@ -83,7 +83,6 @@ feat_filter_out_non-shareable_windows_in_the_current_application_in.patch
|
||||
disable_freezing_flags_after_init_in_node.patch
|
||||
short-circuit_permissions_checks_in_mediastreamdevicescontroller.patch
|
||||
chore_add_electron_deps_to_gitignores.patch
|
||||
chore_allow_chromium_to_handle_synthetic_mouse_events_for_touch.patch
|
||||
add_maximized_parameter_to_linuxui_getwindowframeprovider.patch
|
||||
add_electron_deps_to_license_credits_file.patch
|
||||
fix_crash_loading_non-standard_schemes_in_iframes.patch
|
||||
@@ -132,7 +131,7 @@ osr_shared_texture_remove_keyed_mutex_on_win_dxgi.patch
|
||||
feat_allow_usage_of_sccontentsharingpicker_on_supported_platforms.patch
|
||||
chore_partial_revert_of.patch
|
||||
fix_software_compositing_infinite_loop.patch
|
||||
fix_add_method_which_disables_headless_mode_on_native_widget.patch
|
||||
fix_adjust_headless_mode_handling_in_native_widget.patch
|
||||
refactor_unfilter_unresponsive_events.patch
|
||||
build_disable_thin_lto_mac.patch
|
||||
build_add_public_config_simdutf_config.patch
|
||||
@@ -141,7 +140,16 @@ feat_add_signals_when_embedder_cleanup_callbacks_run_for.patch
|
||||
feat_separate_content_settings_callback_for_sync_and_async_clipboard.patch
|
||||
cherry-pick-dd8e2822e507.patch
|
||||
fix_osr_stutter_in_both_cpu_and_gpu_capture_when_page_has_animation.patch
|
||||
ignore_parse_errors_for_pkey_appusermodel_toastactivatorclsid.patch
|
||||
ignore_parse_errors_for_resolveshortcutproperties.patch
|
||||
fix_win32_synchronous_spellcheck.patch
|
||||
fix_drag_and_drop_icons_on_windows.patch
|
||||
chore_remove_conflicting_allow_unsafe_libc_calls.patch
|
||||
fix_take_snapped_status_into_account_when_showing_a_window.patch
|
||||
chore_modify_chromium_handling_of_mouse_events.patch
|
||||
mac_fix_check_on_ime_reconversion_due_to_invalid_replacement_range.patch
|
||||
windows_retrieve_primary_monitor_information_early.patch
|
||||
do_not_check_the_order_of_display_id_order_on_windows.patch
|
||||
add_linux_window_controls_menu.patch
|
||||
make_focus_methods_in_webcontentsviewchildframe_notimplemented.patch
|
||||
cherry-pick-295a4a1b14b8.patch
|
||||
cherry-pick-c3568ceda9d8.patch
|
||||
|
||||
475
patches/chromium/add_linux_window_controls_menu.patch
Normal file
475
patches/chromium/add_linux_window_controls_menu.patch
Normal file
@@ -0,0 +1,475 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Tom Anderson <thomasanderson@chromium.org>
|
||||
Date: Thu, 20 Feb 2025 17:19:15 -0800
|
||||
Subject: Add Linux window controls menu
|
||||
|
||||
This enables Linux users to access more window actions via the menu,
|
||||
eg: "take screenshot", "hide", "always on top", "always on visible
|
||||
workspace", "move to workspace", etc.
|
||||
|
||||
* Implement platform-specific behavior:
|
||||
* Wayland: Call xdg_toplevel::show_window_menu from xdg_shell.
|
||||
* X11: Send a _GTK_SHOW_WINDOW_MENU client message to the WM.
|
||||
* Only show the menu if (_GTK_SHOW_WINDOW_MENU is advertised by the
|
||||
WM, or if xdg_shell is supported on Wayland), and system titlebars
|
||||
are not enabled (because right-clicking the system titlebar already
|
||||
shows the system menu).
|
||||
|
||||
NO_IFTTT=The added command isn't gated on fenced frame network status
|
||||
|
||||
Change-Id: I6f8d224983931808a8ea87c8411eacdf837e2fbb
|
||||
Fixed: 41424652
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6231191
|
||||
Reviewed-by: Nick Yamane <nickdiego@igalia.com>
|
||||
Commit-Queue: Thomas Anderson <thomasanderson@chromium.org>
|
||||
Reviewed-by: Robert Liao <robliao@chromium.org>
|
||||
Reviewed-by: Avi Drissman <avi@chromium.org>
|
||||
Cr-Commit-Position: refs/heads/main@{#1422887}
|
||||
|
||||
diff --git a/ui/gfx/x/atom_cache.cc b/ui/gfx/x/atom_cache.cc
|
||||
index 3028fba0d46fe07efd6138b29b4ecc612c91e5ce..8a26aba4f8da4b5f3512132f9876a80e9df5ca59 100644
|
||||
--- a/ui/gfx/x/atom_cache.cc
|
||||
+++ b/ui/gfx/x/atom_cache.cc
|
||||
@@ -105,6 +105,7 @@ constexpr auto kAtomsToCache = std::to_array<const char* const>({
|
||||
"_CHROMIUM_DRAG_RECEIVER",
|
||||
"_GTK_FRAME_EXTENTS",
|
||||
"_GTK_HIDE_TITLEBAR_WHEN_MAXIMIZED",
|
||||
+ "_GTK_SHOW_WINDOW_MENU",
|
||||
"_GTK_THEME_VARIANT",
|
||||
"_ICC_PROFILE",
|
||||
"_MOTIF_WM_HINTS",
|
||||
diff --git a/ui/ozone/platform/wayland/host/shell_toplevel_wrapper.h b/ui/ozone/platform/wayland/host/shell_toplevel_wrapper.h
|
||||
index 1c2f0f5c929f32c8a14e2acea8245384749a9762..a6de8333fec78f1d2b1ae73aa0d44232f2e8657f 100644
|
||||
--- a/ui/ozone/platform/wayland/host/shell_toplevel_wrapper.h
|
||||
+++ b/ui/ozone/platform/wayland/host/shell_toplevel_wrapper.h
|
||||
@@ -106,6 +106,10 @@ class ShellToplevelWrapper {
|
||||
// .desktop file and use the icon set there.
|
||||
virtual void SetAppId(const std::string& app_id) = 0;
|
||||
|
||||
+ // Requests the compositor to show a menu with window controls.
|
||||
+ virtual void ShowWindowMenu(WaylandConnection* connection,
|
||||
+ const gfx::Point& point) = 0;
|
||||
+
|
||||
// In case of kClientSide or kServerSide, this function sends a request to the
|
||||
// wayland compositor to update the decoration mode for a surface associated
|
||||
// with this top level window.
|
||||
diff --git a/ui/ozone/platform/wayland/host/wayland_toplevel_window.cc b/ui/ozone/platform/wayland/host/wayland_toplevel_window.cc
|
||||
index 19aa42165ab02f5746ee564601e61c19132ef51e..0d549a0e5cf6983ebd72b6c4ab5cfeb74217390f 100644
|
||||
--- a/ui/ozone/platform/wayland/host/wayland_toplevel_window.cc
|
||||
+++ b/ui/ozone/platform/wayland/host/wayland_toplevel_window.cc
|
||||
@@ -263,6 +263,14 @@ void WaylandToplevelWindow::Restore() {
|
||||
SetWindowState(PlatformWindowState::kNormal, display::kInvalidDisplayId);
|
||||
}
|
||||
|
||||
+void WaylandToplevelWindow::ShowWindowControlsMenu(const gfx::Point& point) {
|
||||
+ if (shell_toplevel_) {
|
||||
+ shell_toplevel_->ShowWindowMenu(
|
||||
+ connection(),
|
||||
+ gfx::ScaleToRoundedPoint(point, applied_state().ui_scale));
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
void WaylandToplevelWindow::ActivateWithToken(std::string token) {
|
||||
DCHECK(connection()->xdg_activation());
|
||||
// xdg-activation implementation doesn't seem to interact well with dnd in
|
||||
diff --git a/ui/ozone/platform/wayland/host/wayland_toplevel_window.h b/ui/ozone/platform/wayland/host/wayland_toplevel_window.h
|
||||
index e088bb9e1dfe83118a6c1d5790bf2e6d7c580578..111048dff0ddf72faa5f4347f3fd64f161e3479c 100644
|
||||
--- a/ui/ozone/platform/wayland/host/wayland_toplevel_window.h
|
||||
+++ b/ui/ozone/platform/wayland/host/wayland_toplevel_window.h
|
||||
@@ -91,6 +91,7 @@ class WaylandToplevelWindow : public WaylandWindow,
|
||||
void Maximize() override;
|
||||
void Minimize() override;
|
||||
void Restore() override;
|
||||
+ void ShowWindowControlsMenu(const gfx::Point& point) override;
|
||||
void Activate() override;
|
||||
void SetWindowIcons(const gfx::ImageSkia& window_icon,
|
||||
const gfx::ImageSkia& app_icon) override;
|
||||
diff --git a/ui/ozone/platform/wayland/host/xdg_toplevel_wrapper_impl.cc b/ui/ozone/platform/wayland/host/xdg_toplevel_wrapper_impl.cc
|
||||
index db90fb7bcbeb9faa0d974a616e65e262cd149942..a856c45da7b235c501030486ebf2bd1241ec125c 100644
|
||||
--- a/ui/ozone/platform/wayland/host/xdg_toplevel_wrapper_impl.cc
|
||||
+++ b/ui/ozone/platform/wayland/host/xdg_toplevel_wrapper_impl.cc
|
||||
@@ -195,6 +195,16 @@ void XDGToplevelWrapperImpl::SetAppId(const std::string& app_id) {
|
||||
xdg_toplevel_set_app_id(xdg_toplevel_.get(), app_id.c_str());
|
||||
}
|
||||
|
||||
+void XDGToplevelWrapperImpl::ShowWindowMenu(WaylandConnection* connection,
|
||||
+ const gfx::Point& point) {
|
||||
+ DCHECK(xdg_toplevel_);
|
||||
+ if (auto serial = GetSerialForMoveResize(connection)) {
|
||||
+ xdg_toplevel_show_window_menu(xdg_toplevel_.get(),
|
||||
+ connection_->seat()->wl_object(),
|
||||
+ serial->value, point.x(), point.y());
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
void XDGToplevelWrapperImpl::SetDecoration(DecorationMode decoration) {
|
||||
SetTopLevelDecorationMode(decoration);
|
||||
}
|
||||
diff --git a/ui/ozone/platform/wayland/host/xdg_toplevel_wrapper_impl.h b/ui/ozone/platform/wayland/host/xdg_toplevel_wrapper_impl.h
|
||||
index 55dfb57f5d8c5e737fda0c31316cc136905c4570..599d1cf524d8ef7c01e33f08d819bd64f13c96c2 100644
|
||||
--- a/ui/ozone/platform/wayland/host/xdg_toplevel_wrapper_impl.h
|
||||
+++ b/ui/ozone/platform/wayland/host/xdg_toplevel_wrapper_impl.h
|
||||
@@ -42,6 +42,8 @@ class XDGToplevelWrapperImpl : public ShellToplevelWrapper {
|
||||
void SetMinSize(int32_t width, int32_t height) override;
|
||||
void SetMaxSize(int32_t width, int32_t height) override;
|
||||
void SetAppId(const std::string& app_id) override;
|
||||
+ void ShowWindowMenu(WaylandConnection* connection,
|
||||
+ const gfx::Point& point) override;
|
||||
void SetDecoration(DecorationMode decoration) override;
|
||||
void SetSystemModal(bool modal) override;
|
||||
void SetIcon(const gfx::ImageSkia& icon) override;
|
||||
diff --git a/ui/ozone/platform/wayland/ozone_platform_wayland.cc b/ui/ozone/platform/wayland/ozone_platform_wayland.cc
|
||||
index afc54743e93a85b71071abae46c6314b6d60ab9c..232b4db5d9fe5eadee9696795eb9ff14c151e2a5 100644
|
||||
--- a/ui/ozone/platform/wayland/ozone_platform_wayland.cc
|
||||
+++ b/ui/ozone/platform/wayland/ozone_platform_wayland.cc
|
||||
@@ -383,6 +383,7 @@ class OzonePlatformWayland : public OzonePlatform,
|
||||
(connection_->xdg_decoration_manager_v1() != nullptr &&
|
||||
override_supports_ssd_for_test == SupportsForTest::kNotSet) ||
|
||||
override_supports_ssd_for_test == SupportsForTest::kYes;
|
||||
+ properties.supports_server_window_menus = connection_->shell();
|
||||
properties.supports_overlays =
|
||||
connection_->ShouldUseOverlayDelegation() &&
|
||||
connection_->viewporter();
|
||||
diff --git a/ui/ozone/platform/x11/ozone_platform_x11.cc b/ui/ozone/platform/x11/ozone_platform_x11.cc
|
||||
index d5e5f81b8c6ccae1822e8192b107eeff2d3a6dd9..9a10db499bd0a48feb1c96f87e71af4ffb114d75 100644
|
||||
--- a/ui/ozone/platform/x11/ozone_platform_x11.cc
|
||||
+++ b/ui/ozone/platform/x11/ozone_platform_x11.cc
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "ui/gfx/linux/gpu_memory_buffer_support_x11.h"
|
||||
#include "ui/gfx/native_widget_types.h"
|
||||
#include "ui/gfx/switches.h"
|
||||
+#include "ui/gfx/x/atom_cache.h"
|
||||
#include "ui/gfx/x/visual_manager.h"
|
||||
#include "ui/linux/linux_ui_delegate.h"
|
||||
#include "ui/ozone/common/stub_overlay_manager.h"
|
||||
@@ -216,6 +217,9 @@ class OzonePlatformX11 : public OzonePlatform,
|
||||
}
|
||||
properties.supports_subwindows_as_accelerated_widgets = true;
|
||||
properties.supports_system_tray_windowing = true;
|
||||
+ properties.supports_server_window_menus =
|
||||
+ x11::Connection::Get()->WmSupportsHint(
|
||||
+ x11::GetAtom("_GTK_SHOW_WINDOW_MENU"));
|
||||
|
||||
return properties;
|
||||
}
|
||||
diff --git a/ui/ozone/platform/x11/x11_window.cc b/ui/ozone/platform/x11/x11_window.cc
|
||||
index 7d00ff55616fd01126268581fa0e2aba636226a5..cf012a4eb8f9ab6400a21db89b94631e1299c3f2 100644
|
||||
--- a/ui/ozone/platform/x11/x11_window.cc
|
||||
+++ b/ui/ozone/platform/x11/x11_window.cc
|
||||
@@ -771,6 +771,13 @@ void X11Window::Restore() {
|
||||
}
|
||||
}
|
||||
|
||||
+void X11Window::ShowWindowControlsMenu(const gfx::Point& point) {
|
||||
+ SendClientMessage(xwindow_, x_root_window_,
|
||||
+ x11::GetAtom("_GTK_SHOW_WINDOW_MENU"),
|
||||
+ {/*device_id=*/0, base::bit_cast<uint32_t>(point.x()),
|
||||
+ base::bit_cast<uint32_t>(point.y()), 0, 0});
|
||||
+}
|
||||
+
|
||||
PlatformWindowState X11Window::GetPlatformWindowState() const {
|
||||
return state_;
|
||||
}
|
||||
diff --git a/ui/ozone/platform/x11/x11_window.h b/ui/ozone/platform/x11/x11_window.h
|
||||
index 1857ee0f82b9b82403d20cb37a97f5e89515c5a2..14a78c3b61cd822bff981da95e2e1f41b2a75fcb 100644
|
||||
--- a/ui/ozone/platform/x11/x11_window.h
|
||||
+++ b/ui/ozone/platform/x11/x11_window.h
|
||||
@@ -94,6 +94,7 @@ class X11Window : public PlatformWindow,
|
||||
void Maximize() override;
|
||||
void Minimize() override;
|
||||
void Restore() override;
|
||||
+ void ShowWindowControlsMenu(const gfx::Point& point) override;
|
||||
PlatformWindowState GetPlatformWindowState() const override;
|
||||
void Activate() override;
|
||||
void Deactivate() override;
|
||||
diff --git a/ui/ozone/public/ozone_platform.h b/ui/ozone/public/ozone_platform.h
|
||||
index 8ca1b1451b5bea0100a723e327762d16622c76fe..0d3ad44225274a274102a0c741ad7471915ec071 100644
|
||||
--- a/ui/ozone/public/ozone_platform.h
|
||||
+++ b/ui/ozone/public/ozone_platform.h
|
||||
@@ -175,9 +175,13 @@ class COMPONENT_EXPORT(OZONE) OzonePlatform {
|
||||
// via overlays. If overlays are not supported the promotion and validation
|
||||
// logic can be skipped.
|
||||
bool supports_overlays = false;
|
||||
+
|
||||
// Indicates whether the platform supports server-side window decorations.
|
||||
bool supports_server_side_window_decorations = true;
|
||||
|
||||
+ // Indicates whether the platform supports window controls menus.
|
||||
+ bool supports_server_window_menus = false;
|
||||
+
|
||||
// For platforms that have optional support for server-side decorations,
|
||||
// this parameter allows setting the desired state in tests. The platform
|
||||
// must have the appropriate logic in its GetPlatformRuntimeProperties()
|
||||
diff --git a/ui/platform_window/platform_window.cc b/ui/platform_window/platform_window.cc
|
||||
index 3f224ec0b48442506fc3c9b19ae6c5f38932e344..8b5964d3c9993d9b39ba72d8ecc72b17919fe6ba 100644
|
||||
--- a/ui/platform_window/platform_window.cc
|
||||
+++ b/ui/platform_window/platform_window.cc
|
||||
@@ -62,6 +62,8 @@ void PlatformWindow::SetVideoCapture() {}
|
||||
|
||||
void PlatformWindow::ReleaseVideoCapture() {}
|
||||
|
||||
+void PlatformWindow::ShowWindowControlsMenu(const gfx::Point& point) {}
|
||||
+
|
||||
void PlatformWindow::SetOpaqueRegion(
|
||||
std::optional<std::vector<gfx::Rect>> region_px) {}
|
||||
|
||||
diff --git a/ui/platform_window/platform_window.h b/ui/platform_window/platform_window.h
|
||||
index 30e1f81d29507a906de8cc8dc195d51d208b1946..aa030af4844f7743777fd3fb6c898e0005af3276 100644
|
||||
--- a/ui/platform_window/platform_window.h
|
||||
+++ b/ui/platform_window/platform_window.h
|
||||
@@ -86,6 +86,7 @@ class COMPONENT_EXPORT(PLATFORM_WINDOW) PlatformWindow
|
||||
virtual void Maximize() = 0;
|
||||
virtual void Minimize() = 0;
|
||||
virtual void Restore() = 0;
|
||||
+ virtual void ShowWindowControlsMenu(const gfx::Point& point);
|
||||
virtual PlatformWindowState GetPlatformWindowState() const = 0;
|
||||
|
||||
virtual void Activate() = 0;
|
||||
diff --git a/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc b/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
|
||||
index 06b929f5afbf00fdd1bc8c84328ff36fb459143f..0ad582b8f33926dc8075b4ba9ed487ddad154653 100644
|
||||
--- a/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
|
||||
+++ b/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
|
||||
@@ -1052,6 +1052,12 @@ void DesktopNativeWidgetAura::Restore() {
|
||||
}
|
||||
}
|
||||
|
||||
+void DesktopNativeWidgetAura::ShowWindowControlsMenu(const gfx::Point& point) {
|
||||
+ if (desktop_window_tree_host_) {
|
||||
+ desktop_window_tree_host_->ShowWindowControlsMenu(point);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
void DesktopNativeWidgetAura::SetFullscreen(bool fullscreen,
|
||||
int64_t target_display_id) {
|
||||
if (desktop_window_tree_host_) {
|
||||
diff --git a/ui/views/widget/desktop_aura/desktop_native_widget_aura.h b/ui/views/widget/desktop_aura/desktop_native_widget_aura.h
|
||||
index 2ac64acf1152f004ec57a1c6057730cd6ab25819..378ca2a4914f5c14845c01c2114d27ce3e18daf7 100644
|
||||
--- a/ui/views/widget/desktop_aura/desktop_native_widget_aura.h
|
||||
+++ b/ui/views/widget/desktop_aura/desktop_native_widget_aura.h
|
||||
@@ -180,6 +180,7 @@ class VIEWS_EXPORT DesktopNativeWidgetAura
|
||||
bool IsMaximized() const override;
|
||||
bool IsMinimized() const override;
|
||||
void Restore() override;
|
||||
+ void ShowWindowControlsMenu(const gfx::Point& point) override;
|
||||
void SetFullscreen(bool fullscreen, int64_t target_display_id) override;
|
||||
bool IsFullscreen() const override;
|
||||
void SetCanAppearInExistingFullscreenSpaces(
|
||||
diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host.cc
|
||||
index abd40f8ab82a3e94a6c7241d946d61631c3529cd..6543ec901da65a78a4d174a32c2166b544ad8c55 100644
|
||||
--- a/ui/views/widget/desktop_aura/desktop_window_tree_host.cc
|
||||
+++ b/ui/views/widget/desktop_aura/desktop_window_tree_host.cc
|
||||
@@ -22,6 +22,8 @@ void DesktopWindowTreeHost::UpdateWindowShapeIfNeeded(
|
||||
|
||||
void DesktopWindowTreeHost::PaintAsActiveChanged() {}
|
||||
|
||||
+void DesktopWindowTreeHost::ShowWindowControlsMenu(const gfx::Point& point) {}
|
||||
+
|
||||
std::unique_ptr<aura::client::ScreenPositionClient>
|
||||
DesktopWindowTreeHost::CreateScreenPositionClient() {
|
||||
return std::make_unique<DesktopScreenPositionClient>(
|
||||
diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host.h b/ui/views/widget/desktop_aura/desktop_window_tree_host.h
|
||||
index 256b3ca3b25051cd8ab5eba9e919c7c0dca632f5..4a2279af3cfb7e7a453556744df74c530a456a51 100644
|
||||
--- a/ui/views/widget/desktop_aura/desktop_window_tree_host.h
|
||||
+++ b/ui/views/widget/desktop_aura/desktop_window_tree_host.h
|
||||
@@ -139,6 +139,7 @@ class VIEWS_EXPORT DesktopWindowTreeHost {
|
||||
virtual void Maximize() = 0;
|
||||
virtual void Minimize() = 0;
|
||||
virtual void Restore() = 0;
|
||||
+ virtual void ShowWindowControlsMenu(const gfx::Point& point);
|
||||
virtual bool IsMaximized() const = 0;
|
||||
virtual bool IsMinimized() const = 0;
|
||||
|
||||
diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_platform.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_platform.cc
|
||||
index 0ec0badc19066a80448d16eefb0edce89cad7193..e19eb0360e4caab709187a7ee58a6af8841a8dc0 100644
|
||||
--- a/ui/views/widget/desktop_aura/desktop_window_tree_host_platform.cc
|
||||
+++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_platform.cc
|
||||
@@ -629,6 +629,11 @@ void DesktopWindowTreeHostPlatform::Restore() {
|
||||
Show(ui::mojom::WindowShowState::kNormal, gfx::Rect());
|
||||
}
|
||||
|
||||
+void DesktopWindowTreeHostPlatform::ShowWindowControlsMenu(
|
||||
+ const gfx::Point& point) {
|
||||
+ platform_window()->ShowWindowControlsMenu(point);
|
||||
+}
|
||||
+
|
||||
bool DesktopWindowTreeHostPlatform::IsMaximized() const {
|
||||
return platform_window()->GetPlatformWindowState() ==
|
||||
ui::PlatformWindowState::kMaximized;
|
||||
diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_platform.h b/ui/views/widget/desktop_aura/desktop_window_tree_host_platform.h
|
||||
index 5260332d839100e6398ebdbdfc365ad7520ba1b2..8595482499067fcf1ce7b9a65faac0eb407a77d0 100644
|
||||
--- a/ui/views/widget/desktop_aura/desktop_window_tree_host_platform.h
|
||||
+++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_platform.h
|
||||
@@ -100,6 +100,7 @@ class VIEWS_EXPORT DesktopWindowTreeHostPlatform
|
||||
void Maximize() override;
|
||||
void Minimize() override;
|
||||
void Restore() override;
|
||||
+ void ShowWindowControlsMenu(const gfx::Point& point) override;
|
||||
bool IsMaximized() const override;
|
||||
bool IsMinimized() const override;
|
||||
bool HasCapture() const override;
|
||||
diff --git a/ui/views/widget/desktop_aura/window_event_filter_linux.cc b/ui/views/widget/desktop_aura/window_event_filter_linux.cc
|
||||
index 5c0d20c20316f098daf4166b1fe615958425b2d1..fd057baf0b6bda6c412b7f22543240f5470d52ed 100644
|
||||
--- a/ui/views/widget/desktop_aura/window_event_filter_linux.cc
|
||||
+++ b/ui/views/widget/desktop_aura/window_event_filter_linux.cc
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "ui/events/event.h"
|
||||
#include "ui/events/event_utils.h"
|
||||
#include "ui/linux/linux_ui.h"
|
||||
+#include "ui/ozone/public/ozone_platform.h"
|
||||
#include "ui/platform_window/wm/wm_move_resize_handler.h"
|
||||
#include "ui/views/widget/desktop_aura/desktop_window_tree_host_platform.h"
|
||||
#include "ui/views/widget/native_widget_aura.h"
|
||||
@@ -60,7 +61,7 @@ bool WindowEventFilterLinux::HandleMouseEventWithHitTest(
|
||||
int hit_test,
|
||||
ui::MouseEvent* event) {
|
||||
int previous_click_component = HTNOWHERE;
|
||||
- if (event->IsLeftMouseButton()) {
|
||||
+ if (event->changed_button_flags() & ui::EF_LEFT_MOUSE_BUTTON) {
|
||||
previous_click_component = click_component_;
|
||||
click_component_ = hit_test;
|
||||
}
|
||||
@@ -70,9 +71,22 @@ bool WindowEventFilterLinux::HandleMouseEventWithHitTest(
|
||||
return true;
|
||||
}
|
||||
|
||||
- if (hit_test == HTMAXBUTTON) {
|
||||
- OnClickedMaximizeButton(event);
|
||||
- return true;
|
||||
+ if (event->changed_button_flags() & ui::EF_RIGHT_MOUSE_BUTTON) {
|
||||
+ switch (hit_test) {
|
||||
+ case HTMINBUTTON:
|
||||
+ case HTMAXBUTTON:
|
||||
+ case HTCLOSE:
|
||||
+ if (ui::OzonePlatform::GetInstance()
|
||||
+ ->GetPlatformRuntimeProperties()
|
||||
+ .supports_server_window_menus) {
|
||||
+ desktop_window_tree_host_->ShowWindowControlsMenu(
|
||||
+ display::Screen::GetScreen()->GetCursorScreenPoint());
|
||||
+ return true;
|
||||
+ }
|
||||
+ break;
|
||||
+ default:
|
||||
+ break;
|
||||
+ }
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -83,13 +97,13 @@ void WindowEventFilterLinux::OnClickedCaption(ui::MouseEvent* event,
|
||||
ui::LinuxUi::WindowFrameActionSource action_type;
|
||||
ui::LinuxUi::WindowFrameAction default_action;
|
||||
|
||||
- if (event->IsRightMouseButton()) {
|
||||
+ if (event->changed_button_flags() & ui::EF_RIGHT_MOUSE_BUTTON) {
|
||||
action_type = ui::LinuxUi::WindowFrameActionSource::kRightClick;
|
||||
default_action = ui::LinuxUi::WindowFrameAction::kMenu;
|
||||
- } else if (event->IsMiddleMouseButton()) {
|
||||
+ } else if (event->changed_button_flags() & ui::EF_MIDDLE_MOUSE_BUTTON) {
|
||||
action_type = ui::LinuxUi::WindowFrameActionSource::kMiddleClick;
|
||||
default_action = ui::LinuxUi::WindowFrameAction::kNone;
|
||||
- } else if (event->IsLeftMouseButton() &&
|
||||
+ } else if (event->changed_button_flags() & ui::EF_LEFT_MOUSE_BUTTON &&
|
||||
event->flags() & ui::EF_IS_DOUBLE_CLICK) {
|
||||
click_component_ = HTNOWHERE;
|
||||
if (previous_click_component == HTCAPTION) {
|
||||
@@ -147,30 +161,6 @@ void WindowEventFilterLinux::OnClickedCaption(ui::MouseEvent* event,
|
||||
}
|
||||
}
|
||||
|
||||
-void WindowEventFilterLinux::OnClickedMaximizeButton(ui::MouseEvent* event) {
|
||||
- auto* content_window = desktop_window_tree_host_->GetContentWindow();
|
||||
- views::Widget* widget = views::Widget::GetWidgetForNativeView(content_window);
|
||||
- if (!widget) {
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- gfx::Rect display_work_area = display::Screen::GetScreen()
|
||||
- ->GetDisplayNearestWindow(content_window)
|
||||
- .work_area();
|
||||
- gfx::Rect bounds = widget->GetWindowBoundsInScreen();
|
||||
- if (event->IsMiddleMouseButton()) {
|
||||
- bounds.set_y(display_work_area.y());
|
||||
- bounds.set_height(display_work_area.height());
|
||||
- widget->SetBounds(bounds);
|
||||
- event->StopPropagation();
|
||||
- } else if (event->IsRightMouseButton()) {
|
||||
- bounds.set_x(display_work_area.x());
|
||||
- bounds.set_width(display_work_area.width());
|
||||
- widget->SetBounds(bounds);
|
||||
- event->StopPropagation();
|
||||
- }
|
||||
-}
|
||||
-
|
||||
void WindowEventFilterLinux::MaybeToggleMaximizedState(aura::Window* window) {
|
||||
if (!(window->GetProperty(aura::client::kResizeBehaviorKey) &
|
||||
aura::client::kResizeBehaviorCanMaximize)) {
|
||||
diff --git a/ui/views/widget/desktop_aura/window_event_filter_linux.h b/ui/views/widget/desktop_aura/window_event_filter_linux.h
|
||||
index d698d8b1a744ac435e4910ecb1c66717eff6ecc8..3d0509f2b31aa480b078b0d1cc834739a376049c 100644
|
||||
--- a/ui/views/widget/desktop_aura/window_event_filter_linux.h
|
||||
+++ b/ui/views/widget/desktop_aura/window_event_filter_linux.h
|
||||
@@ -45,9 +45,6 @@ class VIEWS_EXPORT WindowEventFilterLinux : public ui::EventHandler {
|
||||
// Called when the user clicked the caption area.
|
||||
void OnClickedCaption(ui::MouseEvent* event, int previous_click_component);
|
||||
|
||||
- // Called when the user clicked the maximize button.
|
||||
- void OnClickedMaximizeButton(ui::MouseEvent* event);
|
||||
-
|
||||
void MaybeToggleMaximizedState(aura::Window* window);
|
||||
|
||||
// Dispatches a message to the window manager to tell it to act as if a border
|
||||
diff --git a/ui/views/widget/native_widget_private.cc b/ui/views/widget/native_widget_private.cc
|
||||
index 5177574ebe7bde6968dcb212b9038269ad3a8924..3f3c1342e0710d1cf1a08b0225efe13dd1827d6c 100644
|
||||
--- a/ui/views/widget/native_widget_private.cc
|
||||
+++ b/ui/views/widget/native_widget_private.cc
|
||||
@@ -28,6 +28,8 @@ gfx::Rect NativeWidgetPrivate::ConstrainBoundsToDisplayWorkArea(
|
||||
|
||||
void NativeWidgetPrivate::PaintAsActiveChanged() {}
|
||||
|
||||
+void NativeWidgetPrivate::ShowWindowControlsMenu(const gfx::Point& point) {}
|
||||
+
|
||||
void NativeWidgetPrivate::ShowEmojiPanel() {
|
||||
ui::ShowEmojiPanel();
|
||||
}
|
||||
diff --git a/ui/views/widget/native_widget_private.h b/ui/views/widget/native_widget_private.h
|
||||
index 6f412161c0742a94b3c139c2bec0dc93872c584b..48d1cd41a9760022d1c0c07cfa504a91f009c79f 100644
|
||||
--- a/ui/views/widget/native_widget_private.h
|
||||
+++ b/ui/views/widget/native_widget_private.h
|
||||
@@ -212,6 +212,7 @@ class VIEWS_EXPORT NativeWidgetPrivate : public NativeWidget {
|
||||
virtual bool IsMaximized() const = 0;
|
||||
virtual bool IsMinimized() const = 0;
|
||||
virtual void Restore() = 0;
|
||||
+ virtual void ShowWindowControlsMenu(const gfx::Point& point);
|
||||
virtual void SetFullscreen(bool fullscreen, int64_t target_display_id) = 0;
|
||||
virtual bool IsFullscreen() const = 0;
|
||||
virtual void SetCanAppearInExistingFullscreenSpaces(
|
||||
diff --git a/ui/views/widget/widget.cc b/ui/views/widget/widget.cc
|
||||
index 6853d63ce96bd5e090eb8bdda570c7a56de4876f..7503edc778d590030c1088b83638da0704224fb6 100644
|
||||
--- a/ui/views/widget/widget.cc
|
||||
+++ b/ui/views/widget/widget.cc
|
||||
@@ -1141,6 +1141,12 @@ void Widget::Restore() {
|
||||
}
|
||||
}
|
||||
|
||||
+void Widget::ShowWindowControlsMenu(const gfx::Point& point) {
|
||||
+ if (native_widget_) {
|
||||
+ native_widget_->ShowWindowControlsMenu(point);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
bool Widget::IsMaximized() const {
|
||||
return native_widget_ ? native_widget_->IsMaximized() : false;
|
||||
}
|
||||
diff --git a/ui/views/widget/widget.h b/ui/views/widget/widget.h
|
||||
index 2e76f18cf48303462c7489a01d002a3531695b83..4fa83a96ab9690c77460de1214d8ec21809a76c3 100644
|
||||
--- a/ui/views/widget/widget.h
|
||||
+++ b/ui/views/widget/widget.h
|
||||
@@ -933,6 +933,10 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate,
|
||||
void Minimize();
|
||||
void Restore();
|
||||
|
||||
+ // Shows a menu with controls beyond minimize/maximize/restore. Only
|
||||
+ // implemented on Linux.
|
||||
+ void ShowWindowControlsMenu(const gfx::Point& point);
|
||||
+
|
||||
// Whether or not the window is maximized or minimized.
|
||||
virtual bool IsMaximized() const;
|
||||
bool IsMinimized() const;
|
||||
@@ -23,10 +23,10 @@ index 6c679ef877067297ec3bf1a23af6c03a2af8dcf5..1ac93433189580c13b69cd52ce62681a
|
||||
return receiver_.BindNewEndpointAndPassDedicatedRemote();
|
||||
}
|
||||
diff --git a/content/browser/renderer_host/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc
|
||||
index ac0856149902d266654ed245a5b4933ad7f239d0..26560099f3419247b2d27ccce3538ca1b4b65afd 100644
|
||||
index a387789fe4270739408a9beb32a5ad1a8e51e5f6..43c108bd6b51d293e0f8b1b5393c76c5d167ccef 100644
|
||||
--- a/content/browser/renderer_host/render_view_host_impl.cc
|
||||
+++ b/content/browser/renderer_host/render_view_host_impl.cc
|
||||
@@ -755,6 +755,11 @@ void RenderViewHostImpl::SetBackgroundOpaque(bool opaque) {
|
||||
@@ -765,6 +765,11 @@ void RenderViewHostImpl::SetBackgroundOpaque(bool opaque) {
|
||||
GetWidget()->GetAssociatedFrameWidget()->SetBackgroundOpaque(opaque);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,10 +6,10 @@ Subject: build: allow electron to use exec_script
|
||||
This is similar to the //build usecase so we're OK adding ourselves here
|
||||
|
||||
diff --git a/.gn b/.gn
|
||||
index 3f6571828197301361ebde2e19e8e3138597c276..9effa81a564c3d2afae3eb2bb7438635e45f124a 100644
|
||||
index 3f6571828197301361ebde2e19e8e3138597c276..a33cf302ce24385ce8c92a094a36a39346919793 100644
|
||||
--- a/.gn
|
||||
+++ b/.gn
|
||||
@@ -172,4 +172,26 @@ exec_script_allowlist =
|
||||
@@ -172,4 +172,27 @@ exec_script_allowlist =
|
||||
|
||||
"//tools/grit/grit_rule.gni",
|
||||
"//tools/gritsettings/BUILD.gn",
|
||||
@@ -34,5 +34,6 @@ index 3f6571828197301361ebde2e19e8e3138597c276..9effa81a564c3d2afae3eb2bb7438635
|
||||
+ "//third_party/electron_node/deps/sqlite/unofficial.gni",
|
||||
+ "//third_party/electron_node/deps/uv/unofficial.gni",
|
||||
+ "//third_party/electron_node/deps/uvwasi/unofficial.gni",
|
||||
+ "//third_party/electron_node/deps/zstd/unofficial.gni",
|
||||
+ "//third_party/electron_node/src/inspector/unofficial.gni",
|
||||
]
|
||||
|
||||
@@ -9,10 +9,10 @@ potentially prevent a window from being created.
|
||||
TODO(loc): this patch is currently broken.
|
||||
|
||||
diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc
|
||||
index 622142dcf64df8bf50a6ae5448fdf97c097e49c6..be846f0ff4d960d7d26071f4d3c9c34a3d99f233 100644
|
||||
index 6e28debbe692af473537f2840efcd8a5af35bfcd..3e5d99cc0daea8c9f6427bfe95780a7b3f03e848 100644
|
||||
--- a/content/browser/renderer_host/render_frame_host_impl.cc
|
||||
+++ b/content/browser/renderer_host/render_frame_host_impl.cc
|
||||
@@ -9605,6 +9605,7 @@ void RenderFrameHostImpl::CreateNewWindow(
|
||||
@@ -9606,6 +9606,7 @@ void RenderFrameHostImpl::CreateNewWindow(
|
||||
last_committed_origin_, params->window_container_type,
|
||||
params->target_url, params->referrer.To<Referrer>(),
|
||||
params->frame_name, params->disposition, *params->features,
|
||||
|
||||
269
patches/chromium/cherry-pick-295a4a1b14b8.patch
Normal file
269
patches/chromium/cherry-pick-295a4a1b14b8.patch
Normal file
@@ -0,0 +1,269 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Alex Gough <ajgo@chromium.org>
|
||||
Date: Mon, 5 May 2025 19:09:15 -0700
|
||||
Subject: Drop transitive trust from transports
|
||||
|
||||
Untrusted nodes could reflect a broker initiated transport back to
|
||||
a broker. This ultimately allows for handle leaks if the reflected
|
||||
transport was later used to deserialize another transport containing
|
||||
handles in the broker.
|
||||
|
||||
This CL addresses this along several axes:
|
||||
|
||||
1. untrusted transports cannot return new links to brokers.
|
||||
2. process trustiness on Windows is propagated when a transport is
|
||||
deserialized from a transport.
|
||||
|
||||
Windows has a special additional level of trustiness associated with
|
||||
mojo peers via the is_remote_process_untrusted attribute (the
|
||||
MOJO_SEND_INVITATION_FLAG_UNTRUSTED_PROCESS in invitations). This
|
||||
affects how handles are sent between processes. This was a bool on all
|
||||
platforms which was confusing.
|
||||
|
||||
This CL makes this attribute clearer. On Windows it is now a bi-state
|
||||
enum, while on other platforms it is simply kUntracked. This makes it
|
||||
easier to use default constructed values, and the same API on all
|
||||
platforms without using too many buildflag differences.
|
||||
|
||||
This state was not being propagated correctly during transport
|
||||
deserialization, and is now set as the same trust as the process from
|
||||
which a deserialized transport came. Processes currently default to
|
||||
being kTrusted, which matches the current behavior of the bool flag.
|
||||
|
||||
Finally, this CL turns a DCHECK into a CHECK to ensure peers are only
|
||||
elevated when expected.
|
||||
|
||||
Bug: 412578726
|
||||
Change-Id: I6741a3f53b26c3df854731177cdc886e9c8f7f11
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6497400
|
||||
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
|
||||
Commit-Queue: Alex Gough <ajgo@chromium.org>
|
||||
Cr-Commit-Position: refs/heads/main@{#1456055}
|
||||
|
||||
diff --git a/mojo/core/ipcz_driver/invitation.cc b/mojo/core/ipcz_driver/invitation.cc
|
||||
index 4b3f717dab641bc08070dbb70aad6838fa397c63..001b146f1469579c6b6192fb16ad06e49dc045eb 100644
|
||||
--- a/mojo/core/ipcz_driver/invitation.cc
|
||||
+++ b/mojo/core/ipcz_driver/invitation.cc
|
||||
@@ -90,7 +90,7 @@ IpczDriverHandle CreateTransportForMojoEndpoint(
|
||||
base::Process remote_process = base::Process(),
|
||||
MojoProcessErrorHandler error_handler = nullptr,
|
||||
uintptr_t error_handler_context = 0,
|
||||
- bool is_remote_process_untrusted = false) {
|
||||
+ Transport::ProcessTrust remote_process_trust = Transport::ProcessTrust{}) {
|
||||
CHECK_EQ(endpoint.num_platform_handles, 1u);
|
||||
auto handle =
|
||||
PlatformHandle::FromMojoPlatformHandle(&endpoint.platform_handles[0]);
|
||||
@@ -100,7 +100,7 @@ IpczDriverHandle CreateTransportForMojoEndpoint(
|
||||
|
||||
auto transport = base::MakeRefCounted<Transport>(
|
||||
endpoint_types, PlatformChannelEndpoint(std::move(handle)),
|
||||
- std::move(remote_process), is_remote_process_untrusted);
|
||||
+ std::move(remote_process), remote_process_trust);
|
||||
transport->SetErrorHandler(error_handler, error_handler_context);
|
||||
transport->set_leak_channel_on_shutdown(options.leak_channel_on_shutdown);
|
||||
transport->set_is_peer_trusted(options.is_peer_trusted);
|
||||
@@ -268,15 +268,21 @@ MojoResult Invitation::Send(
|
||||
// bit essentially means that the remote process is especially untrustworthy
|
||||
// (e.g. a Chrome renderer) and should be subject to additional constraints
|
||||
// regarding what types of objects can be transferred to it.
|
||||
- const bool is_remote_process_untrusted =
|
||||
- options &&
|
||||
- (options->flags & MOJO_SEND_INVITATION_FLAG_UNTRUSTED_PROCESS) != 0;
|
||||
+ Transport::ProcessTrust remote_process_trust{};
|
||||
+#if BUILDFLAG(IS_WIN)
|
||||
+ if (options &&
|
||||
+ (options->flags & MOJO_SEND_INVITATION_FLAG_UNTRUSTED_PROCESS) != 0) {
|
||||
+ remote_process_trust = Transport::ProcessTrust::kUntrusted;
|
||||
+ } else {
|
||||
+ remote_process_trust = Transport::ProcessTrust::kTrusted;
|
||||
+ }
|
||||
+#endif
|
||||
|
||||
const bool is_peer_elevated =
|
||||
options && (options->flags & MOJO_SEND_INVITATION_FLAG_ELEVATED);
|
||||
#if !BUILDFLAG(IS_WIN)
|
||||
// For now, the concept of an elevated process is only meaningful on Windows.
|
||||
- DCHECK(!is_peer_elevated);
|
||||
+ CHECK(!is_peer_elevated);
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
@@ -296,7 +302,7 @@ MojoResult Invitation::Send(
|
||||
*transport_endpoint,
|
||||
{.is_peer_trusted = is_peer_elevated, .is_trusted_by_peer = true},
|
||||
std::move(remote_process), error_handler, error_handler_context,
|
||||
- is_remote_process_untrusted);
|
||||
+ remote_process_trust);
|
||||
if (transport == IPCZ_INVALID_DRIVER_HANDLE) {
|
||||
return MOJO_RESULT_INVALID_ARGUMENT;
|
||||
}
|
||||
diff --git a/mojo/core/ipcz_driver/transport.cc b/mojo/core/ipcz_driver/transport.cc
|
||||
index d1e3286f5b59df3e971870c43511780538c3856e..45478609ee8d2dd79ef961ca286c3dbec437c681 100644
|
||||
--- a/mojo/core/ipcz_driver/transport.cc
|
||||
+++ b/mojo/core/ipcz_driver/transport.cc
|
||||
@@ -135,7 +135,7 @@ bool EncodeHandle(PlatformHandle& handle,
|
||||
const base::Process& remote_process,
|
||||
HandleOwner handle_owner,
|
||||
HandleData& out_handle_data,
|
||||
- bool is_remote_process_untrusted) {
|
||||
+ Transport::ProcessTrust remote_process_trust) {
|
||||
CHECK(handle.is_valid());
|
||||
// Duplicating INVALID_HANDLE_VALUE passes a process handle. If you intend to
|
||||
// do this, you must open a valid process handle, not pass the result of
|
||||
@@ -157,7 +157,7 @@ bool EncodeHandle(PlatformHandle& handle,
|
||||
DCHECK_EQ(handle_owner, HandleOwner::kRecipient);
|
||||
DCHECK(remote_process.IsValid());
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
- if (is_remote_process_untrusted) {
|
||||
+ if (remote_process_trust == Transport::ProcessTrust::kUntrusted) {
|
||||
DcheckIfFileHandleIsUnsafe(handle.GetHandle().get());
|
||||
}
|
||||
#endif
|
||||
@@ -229,23 +229,20 @@ size_t Transport::FirstHandleOffsetForTesting() {
|
||||
Transport::Transport(EndpointTypes endpoint_types,
|
||||
PlatformChannelEndpoint endpoint,
|
||||
base::Process remote_process,
|
||||
- bool is_remote_process_untrusted)
|
||||
+ ProcessTrust remote_process_trust)
|
||||
: endpoint_types_(endpoint_types),
|
||||
remote_process_(std::move(remote_process)),
|
||||
-#if BUILDFLAG(IS_WIN)
|
||||
- is_remote_process_untrusted_(is_remote_process_untrusted),
|
||||
-#endif
|
||||
- inactive_endpoint_(std::move(endpoint)) {
|
||||
-}
|
||||
+ remote_process_trust_(remote_process_trust),
|
||||
+ inactive_endpoint_(std::move(endpoint)) {}
|
||||
|
||||
// static
|
||||
scoped_refptr<Transport> Transport::Create(EndpointTypes endpoint_types,
|
||||
PlatformChannelEndpoint endpoint,
|
||||
base::Process remote_process,
|
||||
- bool is_remote_process_untrusted) {
|
||||
+ ProcessTrust remote_process_trust) {
|
||||
return base::MakeRefCounted<Transport>(endpoint_types, std::move(endpoint),
|
||||
std::move(remote_process),
|
||||
- is_remote_process_untrusted);
|
||||
+ remote_process_trust);
|
||||
}
|
||||
|
||||
// static
|
||||
@@ -482,7 +479,7 @@ IpczResult Transport::SerializeObject(ObjectBase& object,
|
||||
for (size_t i = 0; i < object_num_handles; ++i) {
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
ok &= EncodeHandle(platform_handles[i], remote_process_, handle_owner,
|
||||
- handle_data[i], is_remote_process_untrusted_);
|
||||
+ handle_data[i], remote_process_trust());
|
||||
#else
|
||||
handles[i] = TransmissiblePlatformHandle::ReleaseAsHandle(
|
||||
base::MakeRefCounted<TransmissiblePlatformHandle>(
|
||||
@@ -638,23 +635,39 @@ scoped_refptr<Transport> Transport::Deserialize(
|
||||
process = base::Process(handles[1].ReleaseHandle());
|
||||
}
|
||||
#endif
|
||||
+ // Reject transports with out of range enum value in destination_type.
|
||||
+ if (!(header.destination_type == kBroker ||
|
||||
+ header.destination_type == kNonBroker)) {
|
||||
+ return nullptr;
|
||||
+ }
|
||||
+
|
||||
const bool is_source_trusted = from_transport.is_peer_trusted() ||
|
||||
from_transport.destination_type() == kBroker;
|
||||
+
|
||||
const bool is_new_peer_trusted = header.is_peer_trusted;
|
||||
+ const bool is_trusted_by_peer = header.is_trusted_by_peer;
|
||||
+
|
||||
if (is_new_peer_trusted && !is_source_trusted) {
|
||||
// Untrusted transports cannot send us trusted transports.
|
||||
return nullptr;
|
||||
}
|
||||
+
|
||||
+ if (header.destination_type == kBroker && !is_source_trusted) {
|
||||
+ // Do not accept broker connections from untrusted transports.
|
||||
+ return nullptr;
|
||||
+ }
|
||||
+
|
||||
if (header.is_same_remote_process &&
|
||||
from_transport.remote_process().IsValid()) {
|
||||
process = from_transport.remote_process().Duplicate();
|
||||
}
|
||||
- auto transport = Create({.source = from_transport.source_type(),
|
||||
- .destination = header.destination_type},
|
||||
- PlatformChannelEndpoint(std::move(handles[0])),
|
||||
- std::move(process));
|
||||
+ auto transport =
|
||||
+ Create({.source = from_transport.source_type(),
|
||||
+ .destination = header.destination_type},
|
||||
+ PlatformChannelEndpoint(std::move(handles[0])), std::move(process),
|
||||
+ from_transport.remote_process_trust());
|
||||
transport->set_is_peer_trusted(is_new_peer_trusted);
|
||||
- transport->set_is_trusted_by_peer(header.is_trusted_by_peer);
|
||||
+ transport->set_is_trusted_by_peer(is_trusted_by_peer);
|
||||
|
||||
// Inherit the IO task used by the receiving Transport. Deserialized
|
||||
// transports are always adopted by the receiving node, and we want any given
|
||||
diff --git a/mojo/core/ipcz_driver/transport.h b/mojo/core/ipcz_driver/transport.h
|
||||
index 6e69734d350f3688d7f1b3c51aa5fec3b4937b5e..6e88d69c7b6bd68f9aa3c8722f4980a9b9bde3ad 100644
|
||||
--- a/mojo/core/ipcz_driver/transport.h
|
||||
+++ b/mojo/core/ipcz_driver/transport.h
|
||||
@@ -36,6 +36,18 @@ class MOJO_SYSTEM_IMPL_EXPORT Transport : public Object<Transport>,
|
||||
kNonBroker,
|
||||
};
|
||||
|
||||
+ // Is the remote process trusted, only tracked on Windows. Not directly
|
||||
+ // sent over the wire.
|
||||
+ enum class ProcessTrust : uint32_t {
|
||||
+#if BUILDFLAG(IS_WIN)
|
||||
+ // Default to kTrusted. TODO(crbug.com/414392683) - invert this.
|
||||
+ kTrusted,
|
||||
+ kUntrusted,
|
||||
+#else
|
||||
+ kUntracked,
|
||||
+#endif
|
||||
+ };
|
||||
+
|
||||
struct EndpointTypes {
|
||||
EndpointType source;
|
||||
EndpointType destination;
|
||||
@@ -43,7 +55,7 @@ class MOJO_SYSTEM_IMPL_EXPORT Transport : public Object<Transport>,
|
||||
Transport(EndpointTypes endpoint_types,
|
||||
PlatformChannelEndpoint endpoint,
|
||||
base::Process remote_process,
|
||||
- bool is_remote_process_untrusted = false);
|
||||
+ ProcessTrust remote_process_trust);
|
||||
|
||||
// Static helper that is slightly more readable due to better type deduction
|
||||
// than MakeRefCounted<T>.
|
||||
@@ -51,7 +63,7 @@ class MOJO_SYSTEM_IMPL_EXPORT Transport : public Object<Transport>,
|
||||
EndpointTypes endpoint_types,
|
||||
PlatformChannelEndpoint endpoint,
|
||||
base::Process remote_process = base::Process(),
|
||||
- bool is_remote_process_untrusted = false);
|
||||
+ ProcessTrust remote_process_trust = ProcessTrust{});
|
||||
|
||||
static std::pair<scoped_refptr<Transport>, scoped_refptr<Transport>>
|
||||
CreatePair(EndpointType first_type, EndpointType second_type);
|
||||
@@ -84,6 +96,8 @@ class MOJO_SYSTEM_IMPL_EXPORT Transport : public Object<Transport>,
|
||||
void set_is_trusted_by_peer(bool trusted) { is_trusted_by_peer_ = trusted; }
|
||||
bool is_trusted_by_peer() const { return is_trusted_by_peer_; }
|
||||
|
||||
+ ProcessTrust remote_process_trust() const { return remote_process_trust_; }
|
||||
+
|
||||
void SetErrorHandler(MojoProcessErrorHandler handler, uintptr_t context) {
|
||||
error_handler_ = handler;
|
||||
error_handler_context_ = context;
|
||||
@@ -206,12 +220,10 @@ class MOJO_SYSTEM_IMPL_EXPORT Transport : public Object<Transport>,
|
||||
// meaningless on platforms other than Windows.
|
||||
bool is_trusted_by_peer_ = false;
|
||||
|
||||
-#if BUILDFLAG(IS_WIN)
|
||||
// Indicates whether the remote process is "untrusted" in Mojo parlance,
|
||||
// meaning this Transport restricts what kinds of objects can be transferred
|
||||
- // from this end (Windows only.)
|
||||
- bool is_remote_process_untrusted_;
|
||||
-#endif
|
||||
+ // from this end (kTrusted or kUntrusted on Windows, kUntracked elsewhere.)
|
||||
+ const ProcessTrust remote_process_trust_;
|
||||
|
||||
// The channel endpoint which will be used by this Transport to construct and
|
||||
// start its underlying Channel instance once activated. Not guarded by a lock
|
||||
97
patches/chromium/cherry-pick-c3568ceda9d8.patch
Normal file
97
patches/chromium/cherry-pick-c3568ceda9d8.patch
Normal file
@@ -0,0 +1,97 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Takashi Nakayama <tnak@chromium.org>
|
||||
Date: Thu, 8 May 2025 04:57:11 -0700
|
||||
Subject: Set `referrerpolicy: "no-referrer"` in link loads from subresources
|
||||
|
||||
This CL overwrites the referrerpolicy attribute on Link header in sub-
|
||||
resource loads.
|
||||
See the bug for details.
|
||||
|
||||
Bug: 415810136
|
||||
Change-Id: I750e1043ecbd2ce63e827cdbdd2a2a22661ffea7
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6522070
|
||||
Commit-Queue: Takashi Nakayama <tnak@chromium.org>
|
||||
Reviewed-by: Kouhei Ueno <kouhei@chromium.org>
|
||||
Cr-Commit-Position: refs/heads/main@{#1457510}
|
||||
|
||||
diff --git a/third_party/blink/common/features.cc b/third_party/blink/common/features.cc
|
||||
index 34f5b77f9dc8a64312fe7a35883a9883859965ed..30b8bf535393a015e670acb64816c0e784dd92b0 100644
|
||||
--- a/third_party/blink/common/features.cc
|
||||
+++ b/third_party/blink/common/features.cc
|
||||
@@ -2830,6 +2830,10 @@ BASE_FEATURE(kWebviewAccelerateSmallCanvases,
|
||||
"WebviewAccelerateSmallCanvases",
|
||||
base::FEATURE_DISABLED_BY_DEFAULT);
|
||||
|
||||
+BASE_FEATURE(kNoReferrerForPreloadFromSubresource,
|
||||
+ "NoReferrerForPreloadFromSubresource",
|
||||
+ base::FEATURE_ENABLED_BY_DEFAULT);
|
||||
+
|
||||
// When adding new features or constants for features, please keep the features
|
||||
// sorted by identifier name (e.g. `kAwesomeFeature`), and the constants for
|
||||
// that feature grouped with the associated feature.
|
||||
diff --git a/third_party/blink/public/common/features.h b/third_party/blink/public/common/features.h
|
||||
index 4b59f650318fc6b946c41a7d05d68486313e8beb..360512748cbcc0321cb1c54d4c7f87753e182bd4 100644
|
||||
--- a/third_party/blink/public/common/features.h
|
||||
+++ b/third_party/blink/public/common/features.h
|
||||
@@ -1834,6 +1834,9 @@ BLINK_COMMON_EXPORT BASE_DECLARE_FEATURE(kWebUSBTransferSizeLimit);
|
||||
|
||||
BLINK_COMMON_EXPORT BASE_DECLARE_FEATURE(kWebviewAccelerateSmallCanvases);
|
||||
|
||||
+// Kill switch for https://crbug.com/415810136.
|
||||
+BLINK_COMMON_EXPORT BASE_DECLARE_FEATURE(kNoReferrerForPreloadFromSubresource);
|
||||
+
|
||||
// When adding new features or constants for features, please keep the features
|
||||
// sorted by identifier name (e.g. `kAwesomeFeature`), and the constants for
|
||||
// that feature grouped with the associated feature.
|
||||
diff --git a/third_party/blink/renderer/core/loader/preload_helper.cc b/third_party/blink/renderer/core/loader/preload_helper.cc
|
||||
index 0308d9d412fdb0ab3cfb8ab01b3d012133bd2b54..259776577188f48ae484f472f76f4aa3ea8d7ec3 100644
|
||||
--- a/third_party/blink/renderer/core/loader/preload_helper.cc
|
||||
+++ b/third_party/blink/renderer/core/loader/preload_helper.cc
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#include "third_party/blink/renderer/core/loader/preload_helper.h"
|
||||
|
||||
+#include "base/feature_list.h"
|
||||
#include "base/metrics/histogram_functions.h"
|
||||
#include "base/timer/elapsed_timer.h"
|
||||
#include "third_party/blink/public/common/features.h"
|
||||
@@ -246,6 +247,23 @@ bool IsCompressionDictionaryLoadAllowed(
|
||||
}
|
||||
}
|
||||
|
||||
+bool IsSubresourceLoad(PreloadHelper::LoadLinksFromHeaderMode mode) {
|
||||
+ switch (mode) {
|
||||
+ case PreloadHelper::LoadLinksFromHeaderMode::kDocumentBeforeCommit:
|
||||
+ case PreloadHelper::LoadLinksFromHeaderMode::
|
||||
+ kDocumentAfterCommitWithoutViewport:
|
||||
+ case PreloadHelper::LoadLinksFromHeaderMode::
|
||||
+ kDocumentAfterCommitWithViewport:
|
||||
+ case PreloadHelper::LoadLinksFromHeaderMode::kDocumentAfterLoadCompleted:
|
||||
+ return false;
|
||||
+ case PreloadHelper::LoadLinksFromHeaderMode::kSubresourceFromMemoryCache:
|
||||
+ case PreloadHelper::LoadLinksFromHeaderMode::kSubresourceNotFromMemoryCache:
|
||||
+ return true;
|
||||
+ default:
|
||||
+ NOTREACHED();
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
} // namespace
|
||||
|
||||
void PreloadHelper::DnsPrefetchIfNeeded(
|
||||
@@ -789,6 +807,15 @@ void PreloadHelper::LoadLinksFromHeader(
|
||||
LinkLoadParameters params(header, base_url);
|
||||
bool change_rel_to_prefetch = false;
|
||||
|
||||
+ // For security purposes, set `referrerpolicy: "no-referrer"` in link loads
|
||||
+ // from subresources. See https://crbug.com/415810136 for details.
|
||||
+ if (base::FeatureList::IsEnabled(
|
||||
+ blink::features::kNoReferrerForPreloadFromSubresource)) {
|
||||
+ if (IsSubresourceLoad(mode)) {
|
||||
+ params.referrer_policy = network::mojom::ReferrerPolicy::kNever;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
if (params.rel.IsLinkPreload() && recursive_prefetch_token) {
|
||||
// Only preload headers are expected to have a recursive prefetch token
|
||||
// In response to that token's existence, we treat the request as a
|
||||
@@ -1,11 +1,38 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: deepak1556 <hop2deep@gmail.com>
|
||||
Date: Fri, 29 Jul 2022 00:29:35 +0900
|
||||
Subject: chore: allow chromium to handle synthetic mouse events for touch
|
||||
Subject: chore: modify chromium handling of mouse events
|
||||
|
||||
With WCO, allow chromium to handle synthetic mouse events generated for touch
|
||||
This patch does the following:
|
||||
|
||||
1. When Windows Control Overlay is enabled, it allows chromium to handle synthetic mouse events generated for touch
|
||||
actions in the non-client caption area.
|
||||
2. It calls HandleMouseEvent on the delegate earlier in HandleMouseEventInternal, so that Electron can selectively disable
|
||||
draggable regions to allow events to propagate to the underlying renderer.
|
||||
|
||||
diff --git a/ui/events/event.h b/ui/events/event.h
|
||||
index 39b5a8fdd165efd74b00256552b51b5413107958..bfc4ef4f50efff4a77f2aef64335bb7e34c69f34 100644
|
||||
--- a/ui/events/event.h
|
||||
+++ b/ui/events/event.h
|
||||
@@ -587,6 +587,9 @@ class EVENTS_EXPORT MouseEvent : public LocatedEvent {
|
||||
|
||||
const PointerDetails& pointer_details() const { return pointer_details_; }
|
||||
|
||||
+ bool is_system_menu() const { return is_system_menu_; }
|
||||
+ void set_is_system_menu(bool is_menu) { is_system_menu_ = is_menu; }
|
||||
+
|
||||
// Event:
|
||||
std::string ToString() const override;
|
||||
std::unique_ptr<Event> Clone() const override;
|
||||
@@ -619,6 +622,8 @@ class EVENTS_EXPORT MouseEvent : public LocatedEvent {
|
||||
|
||||
// Structure for holding pointer details for implementing PointerEvents API.
|
||||
PointerDetails pointer_details_;
|
||||
+
|
||||
+ bool is_system_menu_ = false;
|
||||
};
|
||||
|
||||
class ScrollEvent;
|
||||
diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc
|
||||
index 2d05856687cd9669f72553d33c8033fd9083b4f8..645b7dd2cc20ce64ffa541c74930f541f083f931 100644
|
||||
--- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc
|
||||
@@ -34,10 +61,10 @@ index 932351e288f37fd09ae1a43f44e8b51fb0caa4b8..4a0616bc210d234e51e564daabdd2ebd
|
||||
// Overridden from WidgetObserver.
|
||||
void OnWidgetThemeChanged(Widget* widget) override;
|
||||
diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc
|
||||
index 2bd015be3178ab8dea012d6b1f71d13dd0548c14..759f00dd4e674d1dfca690b82e6e1820900ebf0c 100644
|
||||
index 193e7c1bd76ce18abe6ac47848fc0fb02f2151dd..e985cd1017a54cf8d93875d642d846efb76b60e0 100644
|
||||
--- a/ui/views/win/hwnd_message_handler.cc
|
||||
+++ b/ui/views/win/hwnd_message_handler.cc
|
||||
@@ -3144,15 +3144,19 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message,
|
||||
@@ -3165,15 +3165,19 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message,
|
||||
}
|
||||
// We must let Windows handle the caption buttons if it's drawing them, or
|
||||
// they won't work.
|
||||
@@ -59,6 +86,25 @@ index 2bd015be3178ab8dea012d6b1f71d13dd0548c14..759f00dd4e674d1dfca690b82e6e1820
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -3203,7 +3207,17 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message,
|
||||
w_param = static_cast<WPARAM>(SendMessage(
|
||||
hwnd(), WM_NCHITTEST, 0, MAKELPARAM(screen_point.x, screen_point.y)));
|
||||
if (w_param == HTCAPTION || w_param == HTSYSMENU) {
|
||||
- ShowSystemMenuAtScreenPixelLocation(hwnd(), gfx::Point(screen_point));
|
||||
+ LONG message_time = GetMessageTime();
|
||||
+ CHROME_MSG msg = {hwnd(),
|
||||
+ message,
|
||||
+ w_param,
|
||||
+ l_param,
|
||||
+ static_cast<DWORD>(message_time),
|
||||
+ {CR_GET_X_LPARAM(l_param), CR_GET_Y_LPARAM(l_param)}};
|
||||
+ ui::MouseEvent event(msg);
|
||||
+ event.set_is_system_menu(true);
|
||||
+ if (!delegate_->HandleMouseEvent(&event))
|
||||
+ ShowSystemMenuAtScreenPixelLocation(hwnd(), gfx::Point(screen_point));
|
||||
return 0;
|
||||
}
|
||||
} else if (message == WM_NCLBUTTONDOWN &&
|
||||
diff --git a/ui/views/win/hwnd_message_handler_delegate.h b/ui/views/win/hwnd_message_handler_delegate.h
|
||||
index 04dea68d74ea4f559db60f716c919e555db9ec80..2f8bd1a3c156bb6c04663c74b7279bb59926fc3d 100644
|
||||
--- a/ui/views/win/hwnd_message_handler_delegate.h
|
||||
@@ -95,10 +95,10 @@ index 801bfd401ea4a8e72417d88efaa718cc6fb60883..663fec68d0c2855cdf83bb259b85c229
|
||||
friend class ContentClientCreator;
|
||||
friend class ContentClientInitializer;
|
||||
diff --git a/gin/v8_initializer.cc b/gin/v8_initializer.cc
|
||||
index 59abc24988ab4d194461a3ca4f4b2bb68395bada..9e0b16dda73900210bfc6305a5d32e51a704513e 100644
|
||||
index 299e0ebd4ba0599257d5ffef8cefda187e549fcb..9b80a6f0cd185e6a9ccdaf3977040a241a25e568 100644
|
||||
--- a/gin/v8_initializer.cc
|
||||
+++ b/gin/v8_initializer.cc
|
||||
@@ -663,8 +663,7 @@ void V8Initializer::GetV8ExternalSnapshotData(const char** snapshot_data_out,
|
||||
@@ -662,8 +662,7 @@ void V8Initializer::GetV8ExternalSnapshotData(const char** snapshot_data_out,
|
||||
|
||||
#if defined(V8_USE_EXTERNAL_STARTUP_DATA)
|
||||
|
||||
@@ -108,7 +108,7 @@ index 59abc24988ab4d194461a3ca4f4b2bb68395bada..9e0b16dda73900210bfc6305a5d32e51
|
||||
if (g_mapped_snapshot) {
|
||||
// TODO(crbug.com/40558459): Confirm not loading different type of snapshot
|
||||
// files in a process.
|
||||
@@ -673,10 +672,17 @@ void V8Initializer::LoadV8Snapshot(V8SnapshotFileType snapshot_file_type) {
|
||||
@@ -672,10 +671,17 @@ void V8Initializer::LoadV8Snapshot(V8SnapshotFileType snapshot_file_type) {
|
||||
|
||||
base::MemoryMappedFile::Region file_region;
|
||||
base::File file =
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Mitsuru Oshima <oshima@chromium.org>
|
||||
Date: Thu, 17 Apr 2025 16:49:21 -0700
|
||||
Subject: Do not check the order of Display ID order on Windows
|
||||
|
||||
Id is generated by Windows side logic so this rule isn't applicable.
|
||||
|
||||
Bug: 394622418
|
||||
Change-Id: I79c7f91103c6b752b6a7a123aacd3573a9ab815f
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6471333
|
||||
Reviewed-by: Vincent Chiang <vincentchiang@chromium.org>
|
||||
Commit-Queue: Mitsuru Oshima <oshima@chromium.org>
|
||||
Cr-Commit-Position: refs/heads/main@{#1448671}
|
||||
|
||||
diff --git a/ui/display/display_layout.cc b/ui/display/display_layout.cc
|
||||
index 0d3746d8174868b743990b5ab10b3506819ef0ea..85d5c06851148576ab4dd272918215335292b4aa 100644
|
||||
--- a/ui/display/display_layout.cc
|
||||
+++ b/ui/display/display_layout.cc
|
||||
@@ -500,6 +500,7 @@ void DisplayLayout::ApplyToDisplayList(Displays* display_list,
|
||||
if (!DisplayLayout::Validate(DisplayListToDisplayIdList(*display_list),
|
||||
*this)) {
|
||||
// Prevent invalid and non-relevant display layouts.
|
||||
+ LOG(ERROR) << "Invalid Display Layout";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -549,15 +550,19 @@ bool DisplayLayout::Validate(const DisplayIdList& list,
|
||||
|
||||
bool has_primary_as_parent = false;
|
||||
// The placement list must be sorted by the first 8 bits of the display IDs.
|
||||
+#if BUILDFLAG(IS_CHROMEOS)
|
||||
int64_t prev_id = std::numeric_limits<int8_t>::min();
|
||||
+#endif // BUILDFLAG(IS_CHROMEOS)
|
||||
for (const auto& placement : layout.placement_list) {
|
||||
- // Placements are sorted by display_id.
|
||||
+#if BUILDFLAG(IS_CHROMEOS)
|
||||
+ // Placements are sorted by display_id on ChromeOS.
|
||||
if (prev_id >= (placement.display_id & 0xFF)) {
|
||||
DISPLAY_LOG(ERROR) << "PlacementList must be sorted by first 8 bits of"
|
||||
<< " display_id ";
|
||||
return false;
|
||||
}
|
||||
prev_id = (placement.display_id & 0xFF);
|
||||
+#endif // BUILDFLAG(IS_CHROMEOS)
|
||||
if (placement.display_id == kInvalidDisplayId) {
|
||||
DISPLAY_LOG(ERROR) << "display_id is not initialized";
|
||||
return false;
|
||||
diff --git a/ui/display/display_layout_unittest.cc b/ui/display/display_layout_unittest.cc
|
||||
index 68327c8a6b71853a0f1bf3c0351e38865bcbe054..4ea830ef086eb009c692a0b90b100eaaed303fd0 100644
|
||||
--- a/ui/display/display_layout_unittest.cc
|
||||
+++ b/ui/display/display_layout_unittest.cc
|
||||
@@ -122,6 +122,7 @@ TEST(DisplayLayoutTest, SwapPrimaryDisplayThreeDisplays) {
|
||||
EXPECT_EQ(Position::RIGHT, layout->placement_list[1].position);
|
||||
}
|
||||
|
||||
+#if BUILDFLAG(IS_CHROMEOS)
|
||||
// Makes sure that only the least significant 8 bits of the display IDs in the
|
||||
// placement lists are used to validate their sort order.
|
||||
TEST(DisplayLayoutTest, PlacementSortOrder) {
|
||||
@@ -148,6 +149,8 @@ TEST(DisplayLayoutTest, PlacementSortOrder) {
|
||||
EXPECT_TRUE(DisplayLayout::Validate({456, 0x0504, 0x0605, 0x0406}, *layout));
|
||||
}
|
||||
|
||||
+#endif // BUILDFLAG(IS_CHROMEOS)
|
||||
+
|
||||
namespace {
|
||||
|
||||
class TwoDisplays
|
||||
@@ -10,6 +10,8 @@ This CL adds support for the following features to //shell_dialogs:
|
||||
|
||||
It also:
|
||||
* Changes XDG Portal implementation behavior to set default path regardless of dialog type.
|
||||
* XDG Portal implementation calls into //electron to perform version checks on the dbus thread
|
||||
Refs https://github.com/electron/electron/issues/46652.
|
||||
|
||||
This may be partially upstreamed to Chromium in the future.
|
||||
|
||||
@@ -345,83 +347,52 @@ index 9d45ec49a4fb5e12407b65b83c1ba0c13cd0dfd8..400cce91b020ecd5e48566f125515d2c
|
||||
+
|
||||
} // namespace ui
|
||||
diff --git a/ui/shell_dialogs/select_file_dialog_linux_portal.cc b/ui/shell_dialogs/select_file_dialog_linux_portal.cc
|
||||
index b6a116654ef6815e3d97dd9302d2a9930877dda8..20ebcdd46bd1570ad671c661e7f866ea0396a49e 100644
|
||||
index b6a116654ef6815e3d97dd9302d2a9930877dda8..cdc929d9538ae22ad8b9fa4044e4fc6ee326564b 100644
|
||||
--- a/ui/shell_dialogs/select_file_dialog_linux_portal.cc
|
||||
+++ b/ui/shell_dialogs/select_file_dialog_linux_portal.cc
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <string_view>
|
||||
|
||||
#include "base/check.h"
|
||||
+#include "base/command_line.h"
|
||||
#include "base/files/file_util.h"
|
||||
#include "base/functional/bind.h"
|
||||
#include "base/logging.h"
|
||||
@@ -40,6 +41,8 @@ namespace {
|
||||
constexpr char kXdgPortalService[] = "org.freedesktop.portal.Desktop";
|
||||
constexpr char kXdgPortalObject[] = "/org/freedesktop/portal/desktop";
|
||||
|
||||
+// Version 4 includes support for current_folder option to the OpenFile method via
|
||||
+// https://github.com/flatpak/xdg-desktop-portal/commit/71165a5.
|
||||
constexpr int kXdgPortalRequiredVersion = 3;
|
||||
|
||||
constexpr char kFileChooserInterfaceName[] =
|
||||
@@ -61,6 +64,8 @@ constexpr uint32_t kFileChooserFilterKindGlob = 0;
|
||||
|
||||
constexpr char kFileUriPrefix[] = "file://";
|
||||
|
||||
+const char kXdgPortalRequiredVersionFlag[] = "xdg-portal-required-version";
|
||||
+
|
||||
enum class ServiceAvailability {
|
||||
kNotStarted,
|
||||
kInProgress,
|
||||
@@ -70,6 +75,9 @@ enum class ServiceAvailability {
|
||||
|
||||
ServiceAvailability g_service_availability = ServiceAvailability::kNotStarted;
|
||||
|
||||
+uint32_t g_available_portal_version = 0;
|
||||
+uint32_t g_required_portal_version = kXdgPortalRequiredVersion;
|
||||
+
|
||||
scoped_refptr<base::SequencedTaskRunner>& GetMainTaskRunner() {
|
||||
static base::NoDestructor<scoped_refptr<base::SequencedTaskRunner>>
|
||||
main_task_runner;
|
||||
@@ -89,9 +97,10 @@ void OnGetPropertyReply(dbus::Response* response) {
|
||||
return;
|
||||
}
|
||||
|
||||
- g_service_availability = version >= kXdgPortalRequiredVersion
|
||||
+ g_service_availability = version >= g_required_portal_version
|
||||
? ServiceAvailability::kAvailable
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "dbus/message.h"
|
||||
#include "dbus/object_path.h"
|
||||
#include "dbus/object_proxy.h"
|
||||
+#include "electron/shell/browser/ui/file_dialog.h"
|
||||
#include "ui/aura/window_tree_host.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "ui/gfx/native_widget_types.h"
|
||||
@@ -94,7 +95,7 @@ void OnGetPropertyReply(dbus::Response* response) {
|
||||
: ServiceAvailability::kNotAvailable;
|
||||
+ g_available_portal_version = version;
|
||||
}
|
||||
|
||||
void OnServiceStarted(std::optional<bool> service_started) {
|
||||
@@ -159,6 +168,12 @@ void SelectFileDialogLinuxPortal::StartAvailabilityTestInBackground() {
|
||||
}
|
||||
g_service_availability = ServiceAvailability::kInProgress;
|
||||
-void OnServiceStarted(std::optional<bool> service_started) {
|
||||
+[[maybe_unused]] void OnServiceStarted(std::optional<bool> service_started) {
|
||||
if (!service_started.value_or(false)) {
|
||||
g_service_availability = ServiceAvailability::kNotAvailable;
|
||||
return;
|
||||
@@ -161,18 +162,24 @@ void SelectFileDialogLinuxPortal::StartAvailabilityTestInBackground() {
|
||||
|
||||
+ auto* cmd = base::CommandLine::ForCurrentProcess();
|
||||
+ if (!base::StringToUint(cmd->GetSwitchValueASCII(kXdgPortalRequiredVersionFlag),
|
||||
+ &g_required_portal_version)) {
|
||||
+ g_required_portal_version = kXdgPortalRequiredVersion;
|
||||
+ }
|
||||
+
|
||||
GetMainTaskRunner() = base::SequencedTaskRunner::GetCurrentDefault();
|
||||
|
||||
+#if 0
|
||||
dbus_utils::CheckForServiceAndStart(dbus_thread_linux::GetSharedSessionBus(),
|
||||
@@ -175,6 +190,11 @@ bool SelectFileDialogLinuxPortal::IsPortalAvailable() {
|
||||
return g_service_availability == ServiceAvailability::kAvailable;
|
||||
kXdgPortalService,
|
||||
base::BindOnce(&OnServiceStarted));
|
||||
+#endif
|
||||
+ file_dialog::StartPortalAvailabilityTestInBackground();
|
||||
}
|
||||
|
||||
// static
|
||||
bool SelectFileDialogLinuxPortal::IsPortalAvailable() {
|
||||
+#if 0
|
||||
if (g_service_availability == ServiceAvailability::kInProgress) {
|
||||
LOG(WARNING) << "Portal availability checked before test was complete";
|
||||
}
|
||||
|
||||
return g_service_availability == ServiceAvailability::kAvailable;
|
||||
+#endif
|
||||
+ return file_dialog::IsPortalAvailable();
|
||||
}
|
||||
|
||||
+// static
|
||||
+uint32_t SelectFileDialogLinuxPortal::GetPortalVersion() {
|
||||
+ return g_available_portal_version;
|
||||
+}
|
||||
+
|
||||
bool SelectFileDialogLinuxPortal::IsRunning(
|
||||
gfx::NativeWindow parent_window) const {
|
||||
return parent_window && host_ && host_.get() == parent_window->GetHost();
|
||||
@@ -377,11 +397,14 @@ DbusDictionary SelectFileDialogLinuxPortal::BuildOptionsDictionary(
|
||||
@@ -377,11 +384,14 @@ DbusDictionary SelectFileDialogLinuxPortal::BuildOptionsDictionary(
|
||||
const PortalFilterSet& filter_set) {
|
||||
DbusDictionary dict;
|
||||
|
||||
@@ -439,7 +410,7 @@ index b6a116654ef6815e3d97dd9302d2a9930877dda8..20ebcdd46bd1570ad671c661e7f866ea
|
||||
[[fallthrough]];
|
||||
case SelectFileDialog::SELECT_FOLDER:
|
||||
case SelectFileDialog::Type::SELECT_EXISTING_FOLDER:
|
||||
@@ -394,6 +417,10 @@ DbusDictionary SelectFileDialogLinuxPortal::BuildOptionsDictionary(
|
||||
@@ -394,6 +404,10 @@ DbusDictionary SelectFileDialogLinuxPortal::BuildOptionsDictionary(
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -450,17 +421,3 @@ index b6a116654ef6815e3d97dd9302d2a9930877dda8..20ebcdd46bd1570ad671c661e7f866ea
|
||||
if (!default_path.empty()) {
|
||||
if (default_path_exists) {
|
||||
// If this is an existing directory, navigate to that directory, with no
|
||||
diff --git a/ui/shell_dialogs/select_file_dialog_linux_portal.h b/ui/shell_dialogs/select_file_dialog_linux_portal.h
|
||||
index 651684b1840eaff664f3d73d99bbea40e097c866..9a9d541f1e9586d9d545f8547d3f09ff33dce48d 100644
|
||||
--- a/ui/shell_dialogs/select_file_dialog_linux_portal.h
|
||||
+++ b/ui/shell_dialogs/select_file_dialog_linux_portal.h
|
||||
@@ -45,6 +45,9 @@ class SelectFileDialogLinuxPortal : public SelectFileDialogLinux {
|
||||
// availability test has not yet completed.
|
||||
static bool IsPortalAvailable();
|
||||
|
||||
+ // Get version of portal if available.
|
||||
+ static uint32_t GetPortalVersion();
|
||||
+
|
||||
protected:
|
||||
~SelectFileDialogLinuxPortal() override;
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ This patch likely can't be upstreamed as-is, as Chromium doesn't have
|
||||
this use case in mind currently.
|
||||
|
||||
diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc
|
||||
index 9888ac709c51cd30228e3bca6915f7d89071cb83..e7b2bc1905958d2ff9c34ed7a22eb53e7ea3b9b8 100644
|
||||
index 1bbc783c8606f28c93b6e3bf2c60fe8ea4e1fc01..79807442326d2e57b62cf889267507ebd4c484a9 100644
|
||||
--- a/ui/views/win/hwnd_message_handler.cc
|
||||
+++ b/ui/views/win/hwnd_message_handler.cc
|
||||
@@ -932,13 +932,13 @@ void HWNDMessageHandler::FrameTypeChanged() {
|
||||
@@ -33,6 +33,15 @@ index 9888ac709c51cd30228e3bca6915f7d89071cb83..e7b2bc1905958d2ff9c34ed7a22eb53e
|
||||
}
|
||||
|
||||
void HWNDMessageHandler::SetWindowIcons(const gfx::ImageSkia& window_icon,
|
||||
@@ -1725,7 +1725,7 @@ void HWNDMessageHandler::OnActivateApp(BOOL active, DWORD thread_id) {
|
||||
if (delegate_->HasNonClientView() && !active &&
|
||||
thread_id != GetCurrentThreadId()) {
|
||||
// Update the native frame if it is rendering the non-client area.
|
||||
- if (HasSystemFrame()) {
|
||||
+ if (is_translucent_ || HasSystemFrame()) {
|
||||
DefWindowProcWithRedrawLock(WM_NCACTIVATE, FALSE, 0);
|
||||
}
|
||||
}
|
||||
@@ -2327,17 +2327,18 @@ LRESULT HWNDMessageHandler::OnNCActivate(UINT message,
|
||||
delegate_->SchedulePaint();
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cezary Kulakowski <cezary@openfin.co>
|
||||
Date: Mon, 22 Jul 2024 16:23:13 +0200
|
||||
Subject: fix: add method which disables headless mode on native widget
|
||||
Subject: fix: adjust headless mode handling in native widget
|
||||
|
||||
We need this method as we create window in headless mode and we
|
||||
switch it back to normal mode only after inital paint is done in
|
||||
@@ -9,8 +9,27 @@ order to get some events like WebContents.beginFrameSubscription.
|
||||
If we don't set `is_headless_` to false then some child windows
|
||||
e.g. autofill popups will be created in headless mode leading to
|
||||
ui problems (like dissapearing popup during typing in html's
|
||||
input list.
|
||||
input list).
|
||||
|
||||
We also need to ensure that an initial paint is scheduled when
|
||||
the compositor is unsuspended in headles mode.
|
||||
|
||||
diff --git a/ui/views/cocoa/native_widget_mac_ns_window_host.mm b/ui/views/cocoa/native_widget_mac_ns_window_host.mm
|
||||
index fed3d6a70139443d76ce6181df69bb490c46a081..06783f617ec63702a95d460fc6f14dd94f95917e 100644
|
||||
--- a/ui/views/cocoa/native_widget_mac_ns_window_host.mm
|
||||
+++ b/ui/views/cocoa/native_widget_mac_ns_window_host.mm
|
||||
@@ -654,9 +654,10 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
|
||||
// case it will never become visible but we want its compositor to produce
|
||||
// frames for screenshooting and screencasting.
|
||||
UpdateCompositorProperties();
|
||||
- layer()->SetVisible(is_visible_);
|
||||
+ layer()->SetVisible(is_visible_ || is_headless_mode_window_);
|
||||
if (is_visible_ || is_headless_mode_window_) {
|
||||
compositor_->Unsuspend();
|
||||
+ layer()->SchedulePaint(layer()->bounds());
|
||||
}
|
||||
|
||||
// Register the CGWindowID (used to identify this window for video capture)
|
||||
diff --git a/ui/views/widget/widget.h b/ui/views/widget/widget.h
|
||||
index 6dae25a61bfaf26c59f044628629771c36be73f3..2e76f18cf48303462c7489a01d002a3531695b83 100644
|
||||
--- a/ui/views/widget/widget.h
|
||||
@@ -40,18 +40,18 @@ accessing uninitialized lower indexes can return garbage values that cannot be n
|
||||
Refer to v8::EmbedderDataSlot::store_aligned_pointer for context.
|
||||
|
||||
diff --git a/gin/public/gin_embedders.h b/gin/public/gin_embedders.h
|
||||
index 8d7c5631fd8f1499c67384286f0e3c4037673b32..99b2e2f63be8a46c5546dd53bc9b05e8c54e857c 100644
|
||||
index 8d7c5631fd8f1499c67384286f0e3c4037673b32..2b7bdfbac06a42e6bc51eb65e023c3673e6eb885 100644
|
||||
--- a/gin/public/gin_embedders.h
|
||||
+++ b/gin/public/gin_embedders.h
|
||||
@@ -18,6 +18,8 @@ namespace gin {
|
||||
enum GinEmbedder : uint16_t {
|
||||
kEmbedderNativeGin,
|
||||
@@ -20,6 +20,8 @@ enum GinEmbedder : uint16_t {
|
||||
kEmbedderBlink,
|
||||
+ kEmbedderElectron,
|
||||
+ kEmbedderBlinkTag,
|
||||
kEmbedderPDFium,
|
||||
kEmbedderFuchsia,
|
||||
+ kEmbedderElectron,
|
||||
+ kEmbedderBlinkTag,
|
||||
};
|
||||
|
||||
} // namespace gin
|
||||
diff --git a/third_party/blink/renderer/platform/bindings/script_state.cc b/third_party/blink/renderer/platform/bindings/script_state.cc
|
||||
index e4a27a24c83dd1a478b2ada8b6c8220076790791..c76dc818f38a62fff63852dbecbc85e304ac731d 100644
|
||||
--- a/third_party/blink/renderer/platform/bindings/script_state.cc
|
||||
@@ -86,7 +86,7 @@ index e4a27a24c83dd1a478b2ada8b6c8220076790791..c76dc818f38a62fff63852dbecbc85e3
|
||||
|
||||
// Cut the reference from ScriptState to V8 context.
|
||||
diff --git a/third_party/blink/renderer/platform/bindings/script_state.h b/third_party/blink/renderer/platform/bindings/script_state.h
|
||||
index b3cc8d819b06108386aed9465cab4f27a28b675f..a1757901e52360a9c2ec3c573adb20d03cd6ecae 100644
|
||||
index b3cc8d819b06108386aed9465cab4f27a28b675f..9c8818f10de59fdd2a3fd44d9cd23d40a93b53a7 100644
|
||||
--- a/third_party/blink/renderer/platform/bindings/script_state.h
|
||||
+++ b/third_party/blink/renderer/platform/bindings/script_state.h
|
||||
@@ -185,7 +185,12 @@ class PLATFORM_EXPORT ScriptState : public GarbageCollected<ScriptState> {
|
||||
@@ -112,14 +112,13 @@ index b3cc8d819b06108386aed9465cab4f27a28b675f..a1757901e52360a9c2ec3c573adb20d0
|
||||
static constexpr int kV8ContextPerContextDataIndex =
|
||||
static_cast<int>(gin::kPerContextDataStartIndex) +
|
||||
static_cast<int>(gin::kEmbedderBlink);
|
||||
@@ -271,6 +278,11 @@ class PLATFORM_EXPORT ScriptState : public GarbageCollected<ScriptState> {
|
||||
@@ -271,6 +278,10 @@ class PLATFORM_EXPORT ScriptState : public GarbageCollected<ScriptState> {
|
||||
// internals.idl.
|
||||
String last_compiled_script_file_name_;
|
||||
bool last_compiled_script_used_code_cache_ = false;
|
||||
+
|
||||
+ static constexpr int kV8ContextPerContextDataTagIndex =
|
||||
+ static_cast<int>(gin::kPerContextDataStartIndex) +
|
||||
+ static_cast<int>(gin::kEmbedderBlink) +
|
||||
+ static_cast<int>(gin::kEmbedderBlinkTag);
|
||||
};
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ or resizing, but Electron does not seem to run into that issue
|
||||
for opaque frameless windows even with that block commented out.
|
||||
|
||||
diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc
|
||||
index 759f00dd4e674d1dfca690b82e6e1820900ebf0c..9888ac709c51cd30228e3bca6915f7d89071cb83 100644
|
||||
index 2bd015be3178ab8dea012d6b1f71d13dd0548c14..1bbc783c8606f28c93b6e3bf2c60fe8ea4e1fc01 100644
|
||||
--- a/ui/views/win/hwnd_message_handler.cc
|
||||
+++ b/ui/views/win/hwnd_message_handler.cc
|
||||
@@ -1786,7 +1786,23 @@ LRESULT HWNDMessageHandler::OnCreate(CREATESTRUCT* create_struct) {
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shelley Vohr <shelley.vohr@gmail.com>
|
||||
Date: Thu, 13 Mar 2025 10:47:00 +0100
|
||||
Subject: fix: take Snapped status into account when showing a window
|
||||
|
||||
Adjusts HWNDMessageHandler::Show to correctly restore windows that were
|
||||
in a snapped state prior to being hidden or maximized. From Windows
|
||||
documentation at
|
||||
https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-iswindowarranged:
|
||||
|
||||
> A snapped window (see Snap your windows) is considered to be arranged.
|
||||
> You should treat arranged as a window state similar to maximized. Arranged,
|
||||
> maximized, and minimized are mutually exclusive states.
|
||||
|
||||
The logic already took into account a window being maximized and
|
||||
correctly restored it, but if the window was snapped prior to this CL it
|
||||
would be removed from its snapped state when re-shown. This fixes that.
|
||||
|
||||
Upstreamed at https://chromium-review.googlesource.com/c/chromium/src/+/6330848.
|
||||
|
||||
diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc
|
||||
index 79807442326d2e57b62cf889267507ebd4c484a9..193e7c1bd76ce18abe6ac47848fc0fb02f2151dd 100644
|
||||
--- a/ui/views/win/hwnd_message_handler.cc
|
||||
+++ b/ui/views/win/hwnd_message_handler.cc
|
||||
@@ -674,7 +674,8 @@ void HWNDMessageHandler::Show(ui::mojom::WindowShowState show_state,
|
||||
SetWindowPlacement(hwnd(), &placement);
|
||||
native_show_state = SW_SHOWMAXIMIZED;
|
||||
} else {
|
||||
- const bool is_maximized = IsMaximized();
|
||||
+ const bool is_maximized_or_arranged =
|
||||
+ IsMaximized() || IsWindowArranged(hwnd());
|
||||
|
||||
// Use SW_SHOW/SW_SHOWNA instead of SW_SHOWNORMAL/SW_SHOWNOACTIVATE so that
|
||||
// the window is not restored to its original position if it is maximized.
|
||||
@@ -684,7 +685,8 @@ void HWNDMessageHandler::Show(ui::mojom::WindowShowState show_state,
|
||||
// position, some do not. See crbug.com/1296710
|
||||
switch (show_state) {
|
||||
case ui::mojom::WindowShowState::kInactive:
|
||||
- native_show_state = is_maximized ? SW_SHOWNA : SW_SHOWNOACTIVATE;
|
||||
+ native_show_state =
|
||||
+ is_maximized_or_arranged ? SW_SHOWNA : SW_SHOWNOACTIVATE;
|
||||
break;
|
||||
case ui::mojom::WindowShowState::kMaximized:
|
||||
native_show_state = SW_SHOWMAXIMIZED;
|
||||
@@ -695,9 +697,11 @@ void HWNDMessageHandler::Show(ui::mojom::WindowShowState show_state,
|
||||
case ui::mojom::WindowShowState::kNormal:
|
||||
if ((GetWindowLong(hwnd(), GWL_EXSTYLE) & WS_EX_TRANSPARENT) ||
|
||||
(GetWindowLong(hwnd(), GWL_EXSTYLE) & WS_EX_NOACTIVATE)) {
|
||||
- native_show_state = is_maximized ? SW_SHOWNA : SW_SHOWNOACTIVATE;
|
||||
+ native_show_state =
|
||||
+ is_maximized_or_arranged ? SW_SHOWNA : SW_SHOWNOACTIVATE;
|
||||
} else {
|
||||
- native_show_state = is_maximized ? SW_SHOW : SW_SHOWNORMAL;
|
||||
+ native_show_state =
|
||||
+ is_maximized_or_arranged ? SW_SHOW : SW_SHOWNORMAL;
|
||||
}
|
||||
break;
|
||||
case ui::mojom::WindowShowState::kFullscreen:
|
||||
@@ -15,10 +15,10 @@ capturer was window or screen-specific, as the IDs remain valid for
|
||||
generic capturer as well.
|
||||
|
||||
diff --git a/content/browser/media/capture/desktop_capture_device.cc b/content/browser/media/capture/desktop_capture_device.cc
|
||||
index 56e7c4058bbdd4d13c5ac90eb41972ad63da8abf..f5d78bb1c70f656c91596fd389aa0b70533b6148 100644
|
||||
index 60eabf1a69089049d4cddb81f87efca4f096a3b6..6618477648b7148ba66f5bb695be8eb6da045849 100644
|
||||
--- a/content/browser/media/capture/desktop_capture_device.cc
|
||||
+++ b/content/browser/media/capture/desktop_capture_device.cc
|
||||
@@ -899,8 +899,14 @@ std::unique_ptr<media::VideoCaptureDevice> DesktopCaptureDevice::Create(
|
||||
@@ -811,8 +811,14 @@ std::unique_ptr<media::VideoCaptureDevice> DesktopCaptureDevice::Create(
|
||||
|
||||
switch (source.type) {
|
||||
case DesktopMediaID::TYPE_SCREEN: {
|
||||
@@ -35,7 +35,7 @@ index 56e7c4058bbdd4d13c5ac90eb41972ad63da8abf..f5d78bb1c70f656c91596fd389aa0b70
|
||||
if (screen_capturer && screen_capturer->SelectSource(source.id)) {
|
||||
capturer = std::make_unique<webrtc::DesktopAndCursorComposer>(
|
||||
std::move(screen_capturer), options);
|
||||
@@ -913,8 +919,14 @@ std::unique_ptr<media::VideoCaptureDevice> DesktopCaptureDevice::Create(
|
||||
@@ -825,8 +831,14 @@ std::unique_ptr<media::VideoCaptureDevice> DesktopCaptureDevice::Create(
|
||||
}
|
||||
|
||||
case DesktopMediaID::TYPE_WINDOW: {
|
||||
|
||||
@@ -41,10 +41,10 @@ index cb4517de39b2ca7b32db557c6d3dd0227ba5b4c2..d1d178de28c7d46db1c96ba321070612
|
||||
// Returns whether `Initialize` has already been invoked in the process.
|
||||
// Initialization is a one-way operation (i.e., this method cannot return
|
||||
diff --git a/gin/v8_initializer.cc b/gin/v8_initializer.cc
|
||||
index b6799720cad84282c5c4586adaf263689fd30bbb..59abc24988ab4d194461a3ca4f4b2bb68395bada 100644
|
||||
index 915ee4b463d1f9159ce647316d8bd499c7562d62..299e0ebd4ba0599257d5ffef8cefda187e549fcb 100644
|
||||
--- a/gin/v8_initializer.cc
|
||||
+++ b/gin/v8_initializer.cc
|
||||
@@ -547,7 +547,8 @@ void SetFeatureFlags() {
|
||||
@@ -546,7 +546,8 @@ void SetFeatureFlags() {
|
||||
void V8Initializer::Initialize(IsolateHolder::ScriptMode mode,
|
||||
const std::string& js_command_line_flags,
|
||||
bool disallow_v8_feature_flag_overrides,
|
||||
@@ -54,7 +54,7 @@ index b6799720cad84282c5c4586adaf263689fd30bbb..59abc24988ab4d194461a3ca4f4b2bb6
|
||||
static bool v8_is_initialized = false;
|
||||
if (v8_is_initialized)
|
||||
return;
|
||||
@@ -561,7 +562,8 @@ void V8Initializer::Initialize(IsolateHolder::ScriptMode mode,
|
||||
@@ -560,7 +561,8 @@ void V8Initializer::Initialize(IsolateHolder::ScriptMode mode,
|
||||
}
|
||||
SetFlags(mode, js_command_line_flags);
|
||||
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?David=20L=C3=B6nnhager?= <dv.lnh.d@gmail.com>
|
||||
Date: Fri, 17 Jan 2025 14:30:48 +0100
|
||||
Subject: Ignore parse errors for PKEY_AppUserModel_ToastActivatorCLSID
|
||||
|
||||
Some shortcuts store this as a string UUID as opposed to VT_CLSID,
|
||||
hitting NOTREACHED() and sometimes breaking parsing in Electron.
|
||||
Ignore this error instead.
|
||||
|
||||
Bug: N/A
|
||||
Change-Id: I9fc472212b2d3afac2c8e18a2159bc2d50bbdf98
|
||||
|
||||
diff --git a/AUTHORS b/AUTHORS
|
||||
index e96a3afdabc731afe355cda83eec4923ea780fec..0b1dc07aad197eab7b79344bc5aee702a2d580ab 100644
|
||||
--- a/AUTHORS
|
||||
+++ b/AUTHORS
|
||||
@@ -340,6 +340,7 @@ David Futcher <david.mike.futcher@gmail.com>
|
||||
David Jin <davidjin@amazon.com>
|
||||
David Lechner <david@pybricks.com>
|
||||
David Leen <davileen@amazon.com>
|
||||
+David Lönnhager <dv.lnh.d@gmail.com>
|
||||
David Manouchehri <david@davidmanouchehri.com>
|
||||
David McAllister <mcdavid@amazon.com>
|
||||
David Michael Barr <david.barr@samsung.com>
|
||||
diff --git a/base/win/shortcut.cc b/base/win/shortcut.cc
|
||||
index 967e130e823f41c402411dfadb53b805e8a8c92b..3a9df7f31861ca69168fd24513ee554d0984798d 100644
|
||||
--- a/base/win/shortcut.cc
|
||||
+++ b/base/win/shortcut.cc
|
||||
@@ -356,8 +356,9 @@ bool ResolveShortcutProperties(const FilePath& shortcut_path,
|
||||
*(pv_toast_activator_clsid.get().puuid));
|
||||
break;
|
||||
default:
|
||||
- NOTREACHED() << "Unexpected variant type: "
|
||||
- << pv_toast_activator_clsid.get().vt;
|
||||
+ // Shortcuts may use strings to represent the CLSID. This case is
|
||||
+ // ignored.
|
||||
+ break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?David=20L=C3=B6nnhager?= <dv.lnh.d@gmail.com>
|
||||
Date: Fri, 17 Jan 2025 14:30:48 +0100
|
||||
Subject: Ignore parse errors in ResolveShortcutProperties
|
||||
|
||||
Some shortcuts store this as a string UUID as opposed to VT_CLSID,
|
||||
hitting NOTREACHED() and sometimes breaking parsing in Electron.
|
||||
Ignore this error instead.
|
||||
|
||||
diff --git a/base/win/shortcut.cc b/base/win/shortcut.cc
|
||||
index 967e130e823f41c402411dfadb53b805e8a8c92b..c1cc95fa8993cc5bdab422710934fb6217272b96 100644
|
||||
--- a/base/win/shortcut.cc
|
||||
+++ b/base/win/shortcut.cc
|
||||
@@ -317,7 +317,8 @@ bool ResolveShortcutProperties(const FilePath& shortcut_path,
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
- NOTREACHED() << "Unexpected variant type: " << pv_app_id.get().vt;
|
||||
+ LOG(WARNING) << "Unexpected variant type: " << pv_app_id.get().vt;
|
||||
+ break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -336,7 +337,8 @@ bool ResolveShortcutProperties(const FilePath& shortcut_path,
|
||||
properties->set_dual_mode(pv_dual_mode.get().boolVal == VARIANT_TRUE);
|
||||
break;
|
||||
default:
|
||||
- NOTREACHED() << "Unexpected variant type: " << pv_dual_mode.get().vt;
|
||||
+ LOG(WARNING) << "Unexpected variant type: " << pv_dual_mode.get().vt;
|
||||
+ break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -356,8 +358,9 @@ bool ResolveShortcutProperties(const FilePath& shortcut_path,
|
||||
*(pv_toast_activator_clsid.get().puuid));
|
||||
break;
|
||||
default:
|
||||
- NOTREACHED() << "Unexpected variant type: "
|
||||
- << pv_toast_activator_clsid.get().vt;
|
||||
+ LOG(INFO) << "Unexpected variant type: "
|
||||
+ << pv_toast_activator_clsid.get().vt;
|
||||
+ break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Keren Zhu <kerenzhu@chromium.org>
|
||||
Date: Fri, 18 Apr 2025 11:02:46 -0700
|
||||
Subject: mac: fix CHECK on IME reconversion due to invalid replacement range
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
It appears that Google Japanese IME can call -setMarkedText: with an
|
||||
invalid replacement range when doing text reconversion (変換, i.e.,
|
||||
conversion between different text with same pronunciation). This range
|
||||
is a NSRange and NSRange.location is supposed to be NSNotFound (2^31-1)
|
||||
for invalid range, but the IME can pass in 2^32. Subsequently causing
|
||||
CHECK error.
|
||||
|
||||
This CL fixes the issue by converting such invalid NSRange to
|
||||
gfx::InvalidRange using FromPossiblyInvalidNSRange(range).
|
||||
|
||||
Fixed: 409864204
|
||||
Change-Id: I08ff426a933ef76aa81e33af59aa32e2ac0b674d
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6470915
|
||||
Commit-Queue: Keren Zhu <kerenzhu@chromium.org>
|
||||
Reviewed-by: Marijn Kruisselbrink <mek@chromium.org>
|
||||
Cr-Commit-Position: refs/heads/main@{#1448935}
|
||||
|
||||
diff --git a/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm b/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm
|
||||
index cb65efb56849d57e2e656f90d5b1d737ba2d952d..baad4cf7479646a25967892ef267bcea90c01ad0 100644
|
||||
--- a/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm
|
||||
+++ b/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm
|
||||
@@ -2430,9 +2430,10 @@ - (void)setMarkedText:(id)string
|
||||
if ([self isHandlingKeyDown] && !_isReconversionTriggered) {
|
||||
_setMarkedTextReplacementRange = gfx::Range(replacementRange);
|
||||
} else {
|
||||
- _host->ImeSetComposition(_markedText, _imeTextSpans,
|
||||
- gfx::Range(replacementRange), newSelRange.location,
|
||||
- NSMaxRange(newSelRange));
|
||||
+ _host->ImeSetComposition(
|
||||
+ _markedText, _imeTextSpans,
|
||||
+ gfx::Range::FromPossiblyInvalidNSRange(replacementRange),
|
||||
+ newSelRange.location, NSMaxRange(newSelRange));
|
||||
}
|
||||
|
||||
[[self inputContext] invalidateCharacterCoordinates];
|
||||
@@ -0,0 +1,50 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shelley Vohr <shelley.vohr@gmail.com>
|
||||
Date: Wed, 7 May 2025 05:08:18 -0700
|
||||
Subject: Make focus methods in WebContentsViewChildFrame NOTIMPLEMENTED
|
||||
|
||||
Change focus methods in WebContentsViewChildFrame to NOTIMPLEMENTED.
|
||||
It's possible to for focus to be called on the child frame, e.g. in the
|
||||
context of chrome.webviewTag, and shouldn't necessarily crash.
|
||||
|
||||
This also fixes an associated crash in Electron, where the NOTREACHED is
|
||||
hit when PointerLockController::LockPointer calls web_contents->Focus().
|
||||
|
||||
Change-Id: Ide58aae2187fbdd807be4ec176d13c76e459ba9c
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6508949
|
||||
Commit-Queue: Bo Liu <boliu@chromium.org>
|
||||
Reviewed-by: Bo Liu <boliu@chromium.org>
|
||||
Reviewed-by: Rakina Zata Amni <rakina@chromium.org>
|
||||
Cr-Commit-Position: refs/heads/main@{#1456886}
|
||||
|
||||
diff --git a/content/browser/web_contents/web_contents_view_child_frame.cc b/content/browser/web_contents/web_contents_view_child_frame.cc
|
||||
index b89d4621dc2acc84f7d8c749f34f7f5563543c72..9c206f6ee424fc423d5f772c7559e60ec0df6eef 100644
|
||||
--- a/content/browser/web_contents/web_contents_view_child_frame.cc
|
||||
+++ b/content/browser/web_contents/web_contents_view_child_frame.cc
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include <utility>
|
||||
|
||||
+#include "base/notimplemented.h"
|
||||
#include "build/build_config.h"
|
||||
#include "content/browser/renderer_host/render_frame_proxy_host.h"
|
||||
#include "content/browser/renderer_host/render_widget_host_view_child_frame.h"
|
||||
@@ -160,15 +161,15 @@ void WebContentsViewChildFrame::DestroyBackForwardTransitionAnimationManager() {
|
||||
}
|
||||
|
||||
void WebContentsViewChildFrame::RestoreFocus() {
|
||||
- NOTREACHED();
|
||||
+ NOTIMPLEMENTED();
|
||||
}
|
||||
|
||||
void WebContentsViewChildFrame::Focus() {
|
||||
- NOTREACHED();
|
||||
+ NOTIMPLEMENTED();
|
||||
}
|
||||
|
||||
void WebContentsViewChildFrame::StoreFocus() {
|
||||
- NOTREACHED();
|
||||
+ NOTIMPLEMENTED();
|
||||
}
|
||||
|
||||
void WebContentsViewChildFrame::FocusThroughTabTraversal(bool reverse) {
|
||||
@@ -10,7 +10,7 @@ an about:blank check to this area.
|
||||
Ref: https://chromium-review.googlesource.com/c/chromium/src/+/5403876
|
||||
|
||||
diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc
|
||||
index 66f6806030d01f6559b838d98a36959350337e3e..57f3cda1c8125f4a7dfb9a528ea242c450a019df 100644
|
||||
index 037b113a877682934967dbf6794b9c702ff4d346..e03646b6622e5078a710bfb728e4b299d1c1186c 100644
|
||||
--- a/content/browser/renderer_host/render_frame_host_impl.cc
|
||||
+++ b/content/browser/renderer_host/render_frame_host_impl.cc
|
||||
@@ -799,8 +799,8 @@ void VerifyThatBrowserAndRendererCalculatedOriginsToCommitMatch(
|
||||
|
||||
@@ -233,7 +233,7 @@ index 2991489fae8a4eecad97b1ecb2271f096d9a9229..93b7aa620ad1da250ac06e3383ca6897
|
||||
}
|
||||
|
||||
diff --git a/content/common/features.cc b/content/common/features.cc
|
||||
index 5323e486d6e1550195317275eb0226bd94ea8e35..d8ed1aba1c69bf3a78ba9cb681999c347cf4eb47 100644
|
||||
index 2f413423e29bfab95c2527f6a25cbd69da6911c1..2d144b8b81b5bcf6a01be4afed76489498063f34 100644
|
||||
--- a/content/common/features.cc
|
||||
+++ b/content/common/features.cc
|
||||
@@ -256,6 +256,14 @@ BASE_FEATURE(kIOSurfaceCapturer,
|
||||
@@ -252,7 +252,7 @@ index 5323e486d6e1550195317275eb0226bd94ea8e35..d8ed1aba1c69bf3a78ba9cb681999c34
|
||||
// invalidated upon notifications sent by base::SystemMonitor. If disabled, the
|
||||
// cache is considered invalid on every enumeration request.
|
||||
diff --git a/content/common/features.h b/content/common/features.h
|
||||
index 0f9451fcad172e09adbe0d93d93e78332429acbe..751c8c8ad6d4cf57fab7f9fd62d3f6a8db1ab31f 100644
|
||||
index 9e2bcef76f5698c1908a0b8173b4d71c6b821bad..38e7bd60ff0fc87540ef22d29f33e8d607966100 100644
|
||||
--- a/content/common/features.h
|
||||
+++ b/content/common/features.h
|
||||
@@ -67,6 +67,9 @@ CONTENT_EXPORT BASE_DECLARE_FEATURE(kInterestGroupUpdateIfOlderThan);
|
||||
|
||||
@@ -15,10 +15,10 @@ Note that we also need to manually update embedder's
|
||||
`api::WebContents::IsFullscreenForTabOrPending` value.
|
||||
|
||||
diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc
|
||||
index be846f0ff4d960d7d26071f4d3c9c34a3d99f233..66f6806030d01f6559b838d98a36959350337e3e 100644
|
||||
index 3e5d99cc0daea8c9f6427bfe95780a7b3f03e848..037b113a877682934967dbf6794b9c702ff4d346 100644
|
||||
--- a/content/browser/renderer_host/render_frame_host_impl.cc
|
||||
+++ b/content/browser/renderer_host/render_frame_host_impl.cc
|
||||
@@ -8714,6 +8714,17 @@ void RenderFrameHostImpl::EnterFullscreen(
|
||||
@@ -8715,6 +8715,17 @@ void RenderFrameHostImpl::EnterFullscreen(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Mitsuru Oshima <oshima@chromium.org>
|
||||
Date: Tue, 4 Mar 2025 12:58:08 -0800
|
||||
Subject: Retrieve primary monitor information early
|
||||
|
||||
This is a speculative workaround for the issue observed on the older
|
||||
version of Windows 10.
|
||||
|
||||
Bug: 394622418
|
||||
Change-Id: Ibda160b1a10e0619bbc837a8a50206db8faab361
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6321426
|
||||
Commit-Queue: Mitsuru Oshima <oshima@chromium.org>
|
||||
Reviewed-by: Robert Liao <robliao@chromium.org>
|
||||
Reviewed-by: Mitsuru Oshima <oshima@chromium.org>
|
||||
Cr-Commit-Position: refs/heads/main@{#1427929}
|
||||
|
||||
diff --git a/ui/display/win/screen_win.cc b/ui/display/win/screen_win.cc
|
||||
index 0d277625e3b827f4cf7dfb693bd518d46fc5f377..5cc792faaa062aa18c4dbb194958ab3648c12c6d 100644
|
||||
--- a/ui/display/win/screen_win.cc
|
||||
+++ b/ui/display/win/screen_win.cc
|
||||
@@ -899,6 +899,10 @@ gfx::Rect ScreenWin::DIPToScreenRectInWindow(gfx::NativeWindow window,
|
||||
|
||||
void ScreenWin::UpdateFromDisplayInfos(
|
||||
const std::vector<internal::DisplayInfo>& display_infos) {
|
||||
+ // Retrieve the primary monitor info here, instead of later below. This is a
|
||||
+ // speculative workaround for the issue observed on older version of Windows
|
||||
+ // 10. See crbug.com/394622418 for more detail.
|
||||
+ auto primary_monitor = MonitorFromWindow(nullptr, MONITOR_DEFAULTTOPRIMARY);
|
||||
auto new_screen_win_displays = DisplayInfosToScreenWinDisplays(
|
||||
display_infos, color_profile_reader_.get(), dxgi_info_.get());
|
||||
|
||||
@@ -932,7 +936,7 @@ void ScreenWin::UpdateFromDisplayInfos(
|
||||
|
||||
// This primary information is used only to detect if another monitor has
|
||||
// became the primary monitor.
|
||||
- primary_monitor_ = MonitorFromWindow(nullptr, MONITOR_DEFAULTTOPRIMARY);
|
||||
+ primary_monitor_ = primary_monitor;
|
||||
|
||||
const std::optional<MONITORINFOEX> primary_monitor_info =
|
||||
MonitorInfoFromHMONITOR(primary_monitor_);
|
||||
@@ -20,7 +20,7 @@ test_formally_mark_some_tests_as_flaky.patch
|
||||
fix_do_not_resolve_electron_entrypoints.patch
|
||||
ci_ensure_node_tests_set_electron_run_as_node.patch
|
||||
fix_assert_module_in_the_renderer_process.patch
|
||||
fix_revert_src_lb_reducing_c_calls_of_esm_legacy_main_resolve.patch
|
||||
fix_allow_passing_fileexists_fn_to_legacymainresolve.patch
|
||||
fix_remove_deprecated_errno_constants.patch
|
||||
build_enable_perfetto.patch
|
||||
fix_add_source_location_for_v8_task_runner.patch
|
||||
@@ -39,8 +39,9 @@ test_use_static_method_names_in_call_stacks.patch
|
||||
build_use_third_party_simdutf.patch
|
||||
fix_remove_fastapitypedarray_usage.patch
|
||||
test_handle_explicit_resource_management_globals.patch
|
||||
build_remove_explicit_linker_call_to_libm_on_macos.patch
|
||||
linux_try_preadv64_pwritev64_before_preadv_pwritev_4683.patch
|
||||
build_change_crdtp_protocoltypetraits_signatures_to_avoid_conflict.patch
|
||||
test_make_eval_snapshot_tests_more_flexible.patch
|
||||
build_option_to_use_custom_inspector_protocol_path.patch
|
||||
fix_ensure_traverseparent_bails_on_resource_path_exit.patch
|
||||
zlib_fix_pointer_alignment.patch
|
||||
fix_expose_readfilesync_override_for_modules.patch
|
||||
|
||||
@@ -54,71 +54,11 @@ index a2123cc6c6d21c53fafc8934203b3720393e7b11..245a43920c7baf000ba63192a84a4c3f
|
||||
}
|
||||
|
||||
assert(!node_enable_inspector || node_use_openssl,
|
||||
diff --git a/src/inspector/unofficial.gni b/src/inspector/unofficial.gni
|
||||
index 5d87f3c901ab509e534598ed1eb0796a96355b5e..3d7aa148678b2646b88fa7c32abec91791b02b82 100644
|
||||
--- a/src/inspector/unofficial.gni
|
||||
+++ b/src/inspector/unofficial.gni
|
||||
@@ -13,7 +13,7 @@ template("inspector_gn_build") {
|
||||
}
|
||||
|
||||
node_gen_dir = get_label_info("../..", "target_gen_dir")
|
||||
- protocol_tool_path = "../../tools/inspector_protocol"
|
||||
+ protocol_tool_path = "../../deps/inspector_protocol"
|
||||
|
||||
gypi_values = exec_script(
|
||||
"../../tools/gypi_to_gn.py",
|
||||
@@ -35,6 +35,8 @@ template("inspector_gn_build") {
|
||||
]
|
||||
|
||||
args = [
|
||||
+ "--inspector_protocol_dir",
|
||||
+ rebase_path(protocol_tool_path, root_build_dir),
|
||||
"--jinja_dir",
|
||||
# jinja is in third_party.
|
||||
rebase_path("//third_party/", root_build_dir),
|
||||
@@ -72,4 +74,37 @@ template("inspector_gn_build") {
|
||||
outputs = [ "$node_gen_dir/src/{{source_name_part}}.json" ]
|
||||
args = [ "{{source}}" ] + rebase_path(outputs, root_build_dir)
|
||||
}
|
||||
+
|
||||
+ config("crdtp_config") {
|
||||
+ include_dirs = [ protocol_tool_path ]
|
||||
+ }
|
||||
+
|
||||
+ static_library("crdtp") {
|
||||
+ public_configs = [ ":crdtp_config" ]
|
||||
+ sources = [
|
||||
+ "$protocol_tool_path/crdtp/cbor.cc",
|
||||
+ "$protocol_tool_path/crdtp/cbor.h",
|
||||
+ "$protocol_tool_path/crdtp/dispatch.cc",
|
||||
+ "$protocol_tool_path/crdtp/dispatch.h",
|
||||
+ "$protocol_tool_path/crdtp/error_support.cc",
|
||||
+ "$protocol_tool_path/crdtp/error_support.h",
|
||||
+ "$protocol_tool_path/crdtp/export.h",
|
||||
+ "$protocol_tool_path/crdtp/find_by_first.h",
|
||||
+ "$protocol_tool_path/crdtp/frontend_channel.h",
|
||||
+ "$protocol_tool_path/crdtp/glue.h",
|
||||
+ "$protocol_tool_path/crdtp/json.cc",
|
||||
+ "$protocol_tool_path/crdtp/json.h",
|
||||
+ "$protocol_tool_path/crdtp/parser_handler.h",
|
||||
+ "$protocol_tool_path/crdtp/protocol_core.cc",
|
||||
+ "$protocol_tool_path/crdtp/protocol_core.h",
|
||||
+ "$protocol_tool_path/crdtp/serializable.cc",
|
||||
+ "$protocol_tool_path/crdtp/serializable.h",
|
||||
+ "$protocol_tool_path/crdtp/span.cc",
|
||||
+ "$protocol_tool_path/crdtp/span.h",
|
||||
+ "$protocol_tool_path/crdtp/status.cc",
|
||||
+ "$protocol_tool_path/crdtp/status.h",
|
||||
+ "$protocol_tool_path/crdtp/json_platform.cc",
|
||||
+ "$protocol_tool_path/crdtp/json_platform.h",
|
||||
+ ]
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/node_builtins.cc b/src/node_builtins.cc
|
||||
index 894fd515202cc3a1f933c2bbc618dd09869ad904..4f1ed661e9c432f3b50f2e7e348ad9794ff773d0 100644
|
||||
index e85860de93dd5753dd4542ecee9f0888af93898a..04eab49c368c8f86837ed2c1384bf3c63e4bde24 100644
|
||||
--- a/src/node_builtins.cc
|
||||
+++ b/src/node_builtins.cc
|
||||
@@ -781,6 +781,7 @@ void BuiltinLoader::RegisterExternalReferences(
|
||||
@@ -783,6 +783,7 @@ void BuiltinLoader::RegisterExternalReferences(
|
||||
registry->Register(GetNatives);
|
||||
|
||||
RegisterExternalReferencesForInternalizedBuiltinCode(registry);
|
||||
@@ -298,7 +238,7 @@ index 21992cbe894a880e3223c379326b62db22f2f12d..1296a5457422099035ba34f2b02624f2
|
||||
} // namespace js2c
|
||||
} // namespace node
|
||||
diff --git a/tools/search_files.py b/tools/search_files.py
|
||||
index 65d0e1be42f0a85418491ebb548278cf431aa6a0..d4a31342f1c6107b029394c6e1d00a1d1e877e03 100755
|
||||
index 856878c33681a73d41016729dabe48b0a6a80589..91a11852d206b65485fe90fd037a0bd17a16c20b 100755
|
||||
--- a/tools/search_files.py
|
||||
+++ b/tools/search_files.py
|
||||
@@ -14,6 +14,7 @@ if __name__ == '__main__':
|
||||
@@ -306,14 +246,19 @@ index 65d0e1be42f0a85418491ebb548278cf431aa6a0..d4a31342f1c6107b029394c6e1d00a1d
|
||||
files = SearchFiles(*sys.argv[2:])
|
||||
files = [ os.path.relpath(x, sys.argv[1]) for x in files ]
|
||||
+ files = [os.path.normpath(x).replace(os.sep, '/') for x in files]
|
||||
print('\n'.join(files))
|
||||
except Exception as e:
|
||||
print(str(e))
|
||||
# Apply the same transform in SearchFiles after relpath
|
||||
if sys.platform == 'win32':
|
||||
files = [ x.replace('\\', '/') for x in files ]
|
||||
diff --git a/unofficial.gni b/unofficial.gni
|
||||
index 9e496d99d7141bf42ef7374a3c676c7b333eeeab..a2f3a769ceaa08db6d7438223884dc5aeab1340d 100644
|
||||
index 44641b92678ab2f28e6f5de75a92878f9f3d322d..672e97436d9220e8d5046b0c92025f50ae50a3d8 100644
|
||||
--- a/unofficial.gni
|
||||
+++ b/unofficial.gni
|
||||
@@ -145,6 +145,7 @@ template("node_gn_build") {
|
||||
@@ -142,32 +142,39 @@ template("node_gn_build") {
|
||||
public_configs = [
|
||||
":node_external_config",
|
||||
"deps/googletest:googletest_config",
|
||||
+ ":zstd_include_config"
|
||||
]
|
||||
public_deps = [
|
||||
"deps/ada",
|
||||
"deps/uv",
|
||||
@@ -321,7 +266,11 @@ index 9e496d99d7141bf42ef7374a3c676c7b333eeeab..a2f3a769ceaa08db6d7438223884dc5a
|
||||
"deps/simdjson",
|
||||
"$node_v8_path",
|
||||
]
|
||||
@@ -156,7 +157,6 @@ template("node_gn_build") {
|
||||
deps = [
|
||||
":run_node_js2c",
|
||||
- "deps/brotli",
|
||||
"deps/cares",
|
||||
"deps/histogram",
|
||||
"deps/llhttp",
|
||||
"deps/nbytes",
|
||||
"deps/nghttp2",
|
||||
@@ -329,7 +278,13 @@ index 9e496d99d7141bf42ef7374a3c676c7b333eeeab..a2f3a769ceaa08db6d7438223884dc5a
|
||||
"deps/postject",
|
||||
"deps/sqlite",
|
||||
"deps/uvwasi",
|
||||
@@ -165,7 +165,11 @@ template("node_gn_build") {
|
||||
- "deps/zstd",
|
||||
"//third_party/zlib",
|
||||
+ "//third_party/brotli:dec",
|
||||
+ "//third_party/brotli:enc",
|
||||
+ "//third_party/zstd:decompress",
|
||||
+ "//third_party/zstd:headers",
|
||||
"$node_simdutf_path",
|
||||
"$node_v8_path:v8_libplatform",
|
||||
]
|
||||
|
||||
@@ -341,7 +296,7 @@ index 9e496d99d7141bf42ef7374a3c676c7b333eeeab..a2f3a769ceaa08db6d7438223884dc5a
|
||||
"$target_gen_dir/node_javascript.cc",
|
||||
] + gypi_values.node_sources
|
||||
|
||||
@@ -185,11 +189,12 @@ template("node_gn_build") {
|
||||
@@ -190,7 +197,7 @@ template("node_gn_build") {
|
||||
}
|
||||
if (node_use_openssl) {
|
||||
deps += [ "deps/ncrypto" ]
|
||||
@@ -350,12 +305,18 @@ index 9e496d99d7141bf42ef7374a3c676c7b333eeeab..a2f3a769ceaa08db6d7438223884dc5a
|
||||
sources += gypi_values.node_crypto_sources
|
||||
}
|
||||
if (node_enable_inspector) {
|
||||
deps += [
|
||||
+ "src/inspector:crdtp",
|
||||
"src/inspector:node_protocol_generated_sources",
|
||||
"src/inspector:v8_inspector_compress_protocol_json",
|
||||
]
|
||||
@@ -282,6 +287,7 @@ template("node_gn_build") {
|
||||
@@ -214,6 +221,10 @@ template("node_gn_build") {
|
||||
}
|
||||
}
|
||||
|
||||
+ config("zstd_include_config") {
|
||||
+ include_dirs = [ "//third_party/zstd/src/lib" ]
|
||||
+ }
|
||||
+
|
||||
executable(target_name) {
|
||||
forward_variables_from(invoker, "*")
|
||||
|
||||
@@ -288,6 +299,7 @@ template("node_gn_build") {
|
||||
}
|
||||
|
||||
executable("node_js2c") {
|
||||
@@ -363,7 +324,7 @@ index 9e496d99d7141bf42ef7374a3c676c7b333eeeab..a2f3a769ceaa08db6d7438223884dc5a
|
||||
deps = [
|
||||
"deps/uv",
|
||||
"$node_simdutf_path",
|
||||
@@ -292,26 +298,75 @@ template("node_gn_build") {
|
||||
@@ -298,26 +310,75 @@ template("node_gn_build") {
|
||||
"src/embedded_data.cc",
|
||||
"src/embedded_data.h",
|
||||
]
|
||||
@@ -449,7 +410,7 @@ index 9e496d99d7141bf42ef7374a3c676c7b333eeeab..a2f3a769ceaa08db6d7438223884dc5a
|
||||
outputs = [ "$target_gen_dir/node_javascript.cc" ]
|
||||
|
||||
# Get the path to node_js2c executable of the host toolchain.
|
||||
@@ -325,11 +380,11 @@ template("node_gn_build") {
|
||||
@@ -331,11 +392,11 @@ template("node_gn_build") {
|
||||
get_label_info(":node_js2c($host_toolchain)", "name") +
|
||||
host_executable_suffix
|
||||
|
||||
|
||||
@@ -14,10 +14,10 @@ We don't need to do this for zlib, as the existing gn workflow uses the same
|
||||
Upstreamed at https://github.com/nodejs/node/pull/55903
|
||||
|
||||
diff --git a/unofficial.gni b/unofficial.gni
|
||||
index 08603eaef2da51fd92f9bf977647b56409eff48c..cd0eae52ca9bf244e43643a2034fa9d26c4db206 100644
|
||||
index 672e97436d9220e8d5046b0c92025f50ae50a3d8..a8ce18acfe333350f91b3e5f235db5f756b2e34a 100644
|
||||
--- a/unofficial.gni
|
||||
+++ b/unofficial.gni
|
||||
@@ -153,7 +153,6 @@ template("node_gn_build") {
|
||||
@@ -155,7 +155,6 @@ template("node_gn_build") {
|
||||
":run_node_js2c",
|
||||
"deps/cares",
|
||||
"deps/histogram",
|
||||
@@ -25,7 +25,7 @@ index 08603eaef2da51fd92f9bf977647b56409eff48c..cd0eae52ca9bf244e43643a2034fa9d2
|
||||
"deps/nbytes",
|
||||
"deps/nghttp2",
|
||||
"deps/postject",
|
||||
@@ -184,7 +183,17 @@ template("node_gn_build") {
|
||||
@@ -191,7 +190,17 @@ template("node_gn_build") {
|
||||
configs -= [ "//build/config/gcc:symbol_visibility_hidden" ]
|
||||
configs += [ "//build/config/gcc:symbol_visibility_default" ]
|
||||
}
|
||||
@@ -44,7 +44,7 @@ index 08603eaef2da51fd92f9bf977647b56409eff48c..cd0eae52ca9bf244e43643a2034fa9d2
|
||||
if (v8_enable_i18n_support) {
|
||||
deps += [ "//third_party/icu" ]
|
||||
}
|
||||
@@ -212,6 +221,19 @@ template("node_gn_build") {
|
||||
@@ -219,6 +228,19 @@ template("node_gn_build") {
|
||||
sources += node_inspector.node_inspector_sources +
|
||||
node_inspector.node_inspector_generated_sources
|
||||
}
|
||||
@@ -63,4 +63,4 @@ index 08603eaef2da51fd92f9bf977647b56409eff48c..cd0eae52ca9bf244e43643a2034fa9d2
|
||||
+ }
|
||||
}
|
||||
|
||||
executable(target_name) {
|
||||
config("zstd_include_config") {
|
||||
|
||||
@@ -14,7 +14,7 @@ error: duplicate symbol: crdtp::ProtocolTypeTraits<std::__Cr::basic_string<char,
|
||||
Some distinguishing change should be upstreamed to Node.js.
|
||||
|
||||
diff --git a/src/inspector/node_string.cc b/src/inspector/node_string.cc
|
||||
index d83c53c81ca7745a31b200d5af3656af59f4f530..b2f6d412415e2988ead3c1e25b9557e1f0c91de3 100644
|
||||
index 6db4bee1072bfe911a4179c3edb2bbaf18f1a182..c603f95f1f93438bd55bce3ff7f5bb314eb33666 100644
|
||||
--- a/src/inspector/node_string.cc
|
||||
+++ b/src/inspector/node_string.cc
|
||||
@@ -7,7 +7,8 @@
|
||||
@@ -44,7 +44,7 @@ index d83c53c81ca7745a31b200d5af3656af59f4f530..b2f6d412415e2988ead3c1e25b9557e1
|
||||
namespace inspector {
|
||||
namespace protocol {
|
||||
diff --git a/src/inspector/node_string.h b/src/inspector/node_string.h
|
||||
index d529d1337be0e2292202920446e841701d16b0b7..08e00f9b94918e3385aed18de80eec5c7ad81095 100644
|
||||
index 38cf96e874dcc49cde87137b2737c35a84f418d0..b2f67c224acc7b3a3b867867e251a7c62833f46e 100644
|
||||
--- a/src/inspector/node_string.h
|
||||
+++ b/src/inspector/node_string.h
|
||||
@@ -15,8 +15,8 @@ namespace crdtp {
|
||||
|
||||
@@ -10,10 +10,10 @@ V8 requires C++20 support as of https://chromium-review.googlesource.com/c/v8/v8
|
||||
This can be removed when Electron upgrades to a version of Node.js containing the required V8 version.
|
||||
|
||||
diff --git a/common.gypi b/common.gypi
|
||||
index 755bd203173a69564be203ad58c33eb50680b204..a7a0ffde7209de51ffcbf0db0ed7efcf09ad606d 100644
|
||||
index 53016fc79c3d914982abeb61bf0a76181024e2bf..99b147482b636706b1372b89298f35b60ca2bb31 100644
|
||||
--- a/common.gypi
|
||||
+++ b/common.gypi
|
||||
@@ -518,7 +518,7 @@
|
||||
@@ -530,7 +530,7 @@
|
||||
'-fno-rtti',
|
||||
'-fno-exceptions',
|
||||
'-fno-strict-aliasing',
|
||||
@@ -22,7 +22,7 @@ index 755bd203173a69564be203ad58c33eb50680b204..a7a0ffde7209de51ffcbf0db0ed7efcf
|
||||
],
|
||||
'defines': [ '__STDC_FORMAT_MACROS' ],
|
||||
'ldflags': [ '-rdynamic' ],
|
||||
@@ -688,7 +688,7 @@
|
||||
@@ -700,7 +700,7 @@
|
||||
['clang==1', {
|
||||
'xcode_settings': {
|
||||
'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0',
|
||||
|
||||
@@ -64,10 +64,10 @@ index 251f51ec454f9cba4023b8b6729241ee753aac13..1de8cac6e3953ce9cab9db03530da327
|
||||
|
||||
module.exports = {
|
||||
diff --git a/node.gyp b/node.gyp
|
||||
index d97004c8e148be6b63634dad5306756d503fb1f8..271fb4f76bc1e69baad0b1fafca128b3bca4a360 100644
|
||||
index ec1f90b73f7d119b2c0e0207a5e36f3cec7295e9..66244b6638e34536aed397f56c6a4570a73e9b90 100644
|
||||
--- a/node.gyp
|
||||
+++ b/node.gyp
|
||||
@@ -174,7 +174,6 @@
|
||||
@@ -175,7 +175,6 @@
|
||||
'src/timers.cc',
|
||||
'src/timer_wrap.cc',
|
||||
'src/tracing/agent.cc',
|
||||
@@ -75,7 +75,7 @@ index d97004c8e148be6b63634dad5306756d503fb1f8..271fb4f76bc1e69baad0b1fafca128b3
|
||||
'src/tracing/node_trace_writer.cc',
|
||||
'src/tracing/trace_event.cc',
|
||||
'src/tracing/traced_value.cc',
|
||||
@@ -302,7 +301,6 @@
|
||||
@@ -303,7 +302,6 @@
|
||||
'src/tcp_wrap.h',
|
||||
'src/timers.h',
|
||||
'src/tracing/agent.h',
|
||||
|
||||
@@ -7,10 +7,10 @@ Subject: build: ensure native module compilation fails if not using a new
|
||||
This should not be upstreamed, it is a quality-of-life patch for downstream module builders.
|
||||
|
||||
diff --git a/common.gypi b/common.gypi
|
||||
index 5d74876ab28f8c10bb9543f7652478514414d8d2..755bd203173a69564be203ad58c33eb50680b204 100644
|
||||
index f2a45f0f0bbfce93e61d3696a18425af4d022a00..53016fc79c3d914982abeb61bf0a76181024e2bf 100644
|
||||
--- a/common.gypi
|
||||
+++ b/common.gypi
|
||||
@@ -86,6 +86,8 @@
|
||||
@@ -88,6 +88,8 @@
|
||||
'v8_use_perfetto': 0,
|
||||
'tsan%': 0,
|
||||
|
||||
@@ -19,7 +19,7 @@ index 5d74876ab28f8c10bb9543f7652478514414d8d2..755bd203173a69564be203ad58c33eb5
|
||||
##### end V8 defaults #####
|
||||
|
||||
# When building native modules using 'npm install' with the system npm,
|
||||
@@ -291,6 +293,7 @@
|
||||
@@ -293,6 +295,7 @@
|
||||
# Defines these mostly for node-gyp to pickup.
|
||||
'defines': [
|
||||
'_GLIBCXX_USE_CXX11_ABI=1',
|
||||
@@ -27,7 +27,7 @@ index 5d74876ab28f8c10bb9543f7652478514414d8d2..755bd203173a69564be203ad58c33eb5
|
||||
],
|
||||
|
||||
# Forcibly disable -Werror. We support a wide range of compilers, it's
|
||||
@@ -437,6 +440,11 @@
|
||||
@@ -449,6 +452,11 @@
|
||||
}],
|
||||
],
|
||||
}],
|
||||
@@ -40,10 +40,10 @@ index 5d74876ab28f8c10bb9543f7652478514414d8d2..755bd203173a69564be203ad58c33eb5
|
||||
# list in v8/BUILD.gn.
|
||||
['v8_enable_v8_checks == 1', {
|
||||
diff --git a/configure.py b/configure.py
|
||||
index 712ed40f77e54d52d5b3c52bb68e2b7d48879812..6bcb7450975636b5dbc689470663ee37903874d5 100755
|
||||
index 95faeeef3867cbf3ca4b1857d893aa127d550a2f..b36f63a5482074f79a20709b8c4774cb6dadec52 100755
|
||||
--- a/configure.py
|
||||
+++ b/configure.py
|
||||
@@ -1644,6 +1644,7 @@ def configure_library(lib, output, pkgname=None):
|
||||
@@ -1698,6 +1698,7 @@ def configure_library(lib, output, pkgname=None):
|
||||
def configure_v8(o, configs):
|
||||
set_configuration_variable(configs, 'v8_enable_v8_checks', release=1, debug=0)
|
||||
|
||||
@@ -52,7 +52,7 @@ index 712ed40f77e54d52d5b3c52bb68e2b7d48879812..6bcb7450975636b5dbc689470663ee37
|
||||
o['variables']['v8_enable_javascript_promise_hooks'] = 1
|
||||
o['variables']['v8_enable_lite_mode'] = 1 if options.v8_lite_mode else 0
|
||||
diff --git a/src/node.h b/src/node.h
|
||||
index 7726d3de1e82689655e8fceb4135eec303498572..120e3a1042e29590cbbf4be258a1cd2d3d4f0043 100644
|
||||
index 8b77f7cb4d53105f42ba76d99a76a98b7a73789f..bdc77f8eb7abffa9e6c98cd254daedad3e44b981 100644
|
||||
--- a/src/node.h
|
||||
+++ b/src/node.h
|
||||
@@ -22,6 +22,12 @@
|
||||
|
||||
@@ -34,7 +34,7 @@ index 411eab8136d5957ae8a491bc38ffbdc88e59f5da..63c93b5be09692d0d4b6bfbb214b173b
|
||||
let kResistStopPropagation;
|
||||
|
||||
diff --git a/src/node_builtins.cc b/src/node_builtins.cc
|
||||
index 4f1ed661e9c432f3b50f2e7e348ad9794ff773d0..16c95348ee254061d5c48f405968c1b0ee33bf82 100644
|
||||
index 04eab49c368c8f86837ed2c1384bf3c63e4bde24..c3d2b3c90c206dd81a3d8aa6c14fdf4678a1cddd 100644
|
||||
--- a/src/node_builtins.cc
|
||||
+++ b/src/node_builtins.cc
|
||||
@@ -34,6 +34,7 @@ using v8::Value;
|
||||
|
||||
@@ -39,10 +39,10 @@ index d8aacbdf1a8fc858c792ad3ce17ca2f46baebe7e..4625008c048532c2c3340130670647d2
|
||||
|
||||
void HandleDouble(double value) override {
|
||||
diff --git a/src/inspector/node_string.h b/src/inspector/node_string.h
|
||||
index 08e00f9b94918e3385aed18de80eec5c7ad81095..e84281c0e06f1d09889c5e1f2b2c5144f1b77564 100644
|
||||
index b2f67c224acc7b3a3b867867e251a7c62833f46e..a17b12a17518259e243cb176e1fbdc11ce63c78d 100644
|
||||
--- a/src/inspector/node_string.h
|
||||
+++ b/src/inspector/node_string.h
|
||||
@@ -63,7 +63,7 @@ class Binary {
|
||||
@@ -66,7 +66,7 @@ class Binary {
|
||||
static Binary fromBase64(const std::string_view base64, bool* success) {
|
||||
UNREACHABLE();
|
||||
}
|
||||
@@ -65,10 +65,10 @@ index 3d7aa148678b2646b88fa7c32abec91791b02b82..4810d93eb971b253f7dadff7011a632f
|
||||
gypi_values = exec_script(
|
||||
"../../tools/gypi_to_gn.py",
|
||||
diff --git a/unofficial.gni b/unofficial.gni
|
||||
index cd0eae52ca9bf244e43643a2034fa9d26c4db206..d61a9bd5f4f0c92682f10b449976735859ecbc55 100644
|
||||
index a8ce18acfe333350f91b3e5f235db5f756b2e34a..6bcc40b282543fc40f80c5c6659de658209844b8 100644
|
||||
--- a/unofficial.gni
|
||||
+++ b/unofficial.gni
|
||||
@@ -204,13 +204,14 @@ template("node_gn_build") {
|
||||
@@ -211,13 +211,14 @@ template("node_gn_build") {
|
||||
}
|
||||
if (node_enable_inspector) {
|
||||
deps += [
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: deepak1556 <hop2deep@gmail.com>
|
||||
Date: Mon, 3 Feb 2025 21:44:36 +0900
|
||||
Subject: build: remove explicit linker call to libm on macOS
|
||||
|
||||
/usr/lib/libm.tbd is available via libSystem.*.dylib and
|
||||
reexports sanitizer symbols. When building for asan
|
||||
this becomes an issue as the linker will resolve the symbols
|
||||
from the system library rather from libclang_rt.*
|
||||
|
||||
For V8 that rely on specific version of these symbols
|
||||
that get bundled as part of clang, for ex:
|
||||
https://source.chromium.org/chromium/chromium/src/+/main:v8/src/heap/cppgc/platform.cc;l=93-97
|
||||
accepting nullptr for shadow_offset in `asan_get_shadow_mapping`,
|
||||
linking to system version that doesn't support this will lead to
|
||||
a crash.
|
||||
|
||||
Clang driver eventually links with `-lSystem`
|
||||
https://github.com/llvm/llvm-project/blob/e82f93890daefeb38fe2a22ee3db87a89948ec57/clang/lib/Driver/ToolChains/Darwin.cpp#L1628-L1631,
|
||||
this is done after linking the sanitizer libraries which
|
||||
ensures right order of resolution for the symbols.
|
||||
|
||||
PR-URL: https://github.com/nodejs/node/pull/56901
|
||||
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
|
||||
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
|
||||
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
|
||||
Reviewed-By: Shelley Vohr <shelley.vohr@gmail.com>
|
||||
|
||||
diff --git a/deps/brotli/unofficial.gni b/deps/brotli/unofficial.gni
|
||||
index 5e07e106672a04508a77584c109c97a67926c858..91001fa43ea4807d061f296eaeccb7512e34863e 100644
|
||||
--- a/deps/brotli/unofficial.gni
|
||||
+++ b/deps/brotli/unofficial.gni
|
||||
@@ -25,7 +25,7 @@ template("brotli_gn_build") {
|
||||
} else if (target_os == "freebsd") {
|
||||
defines = [ "OS_FREEBSD" ]
|
||||
}
|
||||
- if (!is_win) {
|
||||
+ if (is_linux) {
|
||||
libs = [ "m" ]
|
||||
}
|
||||
if (is_clang || !is_win) {
|
||||
diff --git a/deps/uv/unofficial.gni b/deps/uv/unofficial.gni
|
||||
index 348d2f0703e47ca7c5326a4b4c1d6ae31157eeb5..0944d6ddd241b113970ab6aa5804f9534fde882a 100644
|
||||
--- a/deps/uv/unofficial.gni
|
||||
+++ b/deps/uv/unofficial.gni
|
||||
@@ -87,11 +87,11 @@ template("uv_gn_build") {
|
||||
]
|
||||
}
|
||||
if (is_posix) {
|
||||
- libs = [ "m" ]
|
||||
ldflags = [ "-pthread" ]
|
||||
}
|
||||
if (is_linux) {
|
||||
- libs += [
|
||||
+ libs = [
|
||||
+ "m",
|
||||
"dl",
|
||||
"rt",
|
||||
]
|
||||
@@ -11,10 +11,10 @@ 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 a7a0ffde7209de51ffcbf0db0ed7efcf09ad606d..20fd68eeb878b51f361d72070d87338db3d9a8d4 100644
|
||||
index 99b147482b636706b1372b89298f35b60ca2bb31..5024e5fb0aee210f4986572638a523db6d26b4cc 100644
|
||||
--- a/common.gypi
|
||||
+++ b/common.gypi
|
||||
@@ -125,6 +125,7 @@
|
||||
@@ -127,6 +127,7 @@
|
||||
'v8_base': '<(PRODUCT_DIR)/obj.target/tools/v8_gypfiles/libv8_snapshot.a',
|
||||
}],
|
||||
['OS=="mac"', {
|
||||
|
||||
@@ -7,24 +7,6 @@ This allows embedders to tell Node.js what the first "real" file is when
|
||||
they use themselves as the entry point. We should try to upstream some form
|
||||
of this.
|
||||
|
||||
diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js
|
||||
index 9b5772fe9b8babbb892c7a5ec79258472da55a76..3568fd6ea0816f62d97d46f5d497bb1b23bf4e25 100644
|
||||
--- a/lib/internal/modules/cjs/loader.js
|
||||
+++ b/lib/internal/modules/cjs/loader.js
|
||||
@@ -1555,6 +1555,13 @@ Module.prototype._compile = function(content, filename, format) {
|
||||
this[kIsExecuting] = true;
|
||||
if (this[kIsMainSymbol] && getOptionValue('--inspect-brk')) {
|
||||
const { callAndPauseOnStart } = internalBinding('inspector');
|
||||
+ // process._firstFileName is used by Embedders to tell node what
|
||||
+ // the first "real" file is when they use themselves as the entry
|
||||
+ // point
|
||||
+ if (process._firstFileName) {
|
||||
+ resolvedArgv = process._firstFileName;
|
||||
+ delete process._firstFileName;
|
||||
+ }
|
||||
result = callAndPauseOnStart(compiledWrapper, thisValue, exports,
|
||||
require, module, filename, dirname,
|
||||
process, localGlobal, localBuffer);
|
||||
diff --git a/lib/internal/process/pre_execution.js b/lib/internal/process/pre_execution.js
|
||||
index d1c05d1717cdc825c4e48885c963c9ed65bcf51c..278665921c5160ff10b3178db27d4df319fab6b3 100644
|
||||
--- a/lib/internal/process/pre_execution.js
|
||||
|
||||
@@ -11,10 +11,10 @@ Without this patch, building with simdjson fails with
|
||||
This patch can be removed once this is fixed upstream in simdjson.
|
||||
|
||||
diff --git a/deps/simdjson/simdjson.h b/deps/simdjson/simdjson.h
|
||||
index f21cd9381eef59ec43502c796fcaddb1b96525f5..e691fd24aa24d225f8c00fa5638be07265bfeeab 100644
|
||||
index c1535ee81300b9cb93eb9ee6e769246793f936c3..3350287401e181e1d4ee432b8bd16081d0d7a73e 100644
|
||||
--- a/deps/simdjson/simdjson.h
|
||||
+++ b/deps/simdjson/simdjson.h
|
||||
@@ -3654,12 +3654,17 @@ inline std::ostream& operator<<(std::ostream& out, simdjson_result<padded_string
|
||||
@@ -3837,12 +3837,17 @@ inline std::ostream& operator<<(std::ostream& out, simdjson_result<padded_string
|
||||
|
||||
} // namespace simdjson
|
||||
|
||||
@@ -22,9 +22,9 @@ index f21cd9381eef59ec43502c796fcaddb1b96525f5..e691fd24aa24d225f8c00fa5638be072
|
||||
+#pragma clang diagnostic ignored "-Wdeprecated-literal-operator"
|
||||
+
|
||||
// This is deliberately outside of simdjson so that people get it without having to use the namespace
|
||||
inline simdjson::padded_string operator "" _padded(const char *str, size_t len);
|
||||
inline simdjson::padded_string operator ""_padded(const char *str, size_t len);
|
||||
#ifdef __cpp_char8_t
|
||||
inline simdjson::padded_string operator "" _padded(const char8_t *str, size_t len);
|
||||
inline simdjson::padded_string operator ""_padded(const char8_t *str, size_t len);
|
||||
#endif
|
||||
|
||||
+#pragma clang diagnostic pop
|
||||
@@ -32,17 +32,17 @@ index f21cd9381eef59ec43502c796fcaddb1b96525f5..e691fd24aa24d225f8c00fa5638be072
|
||||
namespace simdjson {
|
||||
namespace internal {
|
||||
|
||||
@@ -4037,6 +4042,9 @@ inline simdjson_result<padded_string> padded_string::load(std::string_view filen
|
||||
@@ -4242,6 +4247,9 @@ inline simdjson_result<padded_string> padded_string::load(std::string_view filen
|
||||
|
||||
} // namespace simdjson
|
||||
|
||||
+#pragma clang diagnostic push
|
||||
+#pragma clang diagnostic ignored "-Wdeprecated-literal-operator"
|
||||
+
|
||||
inline simdjson::padded_string operator "" _padded(const char *str, size_t len) {
|
||||
inline simdjson::padded_string operator ""_padded(const char *str, size_t len) {
|
||||
return simdjson::padded_string(str, len);
|
||||
}
|
||||
@@ -4045,6 +4053,8 @@ inline simdjson::padded_string operator "" _padded(const char8_t *str, size_t le
|
||||
@@ -4250,6 +4258,8 @@ inline simdjson::padded_string operator ""_padded(const char8_t *str, size_t len
|
||||
return simdjson::padded_string(reinterpret_cast<const char8_t *>(str), len);
|
||||
}
|
||||
#endif
|
||||
@@ -51,10 +51,3 @@ index f21cd9381eef59ec43502c796fcaddb1b96525f5..e691fd24aa24d225f8c00fa5638be072
|
||||
#endif // SIMDJSON_PADDED_STRING_INL_H
|
||||
/* end file simdjson/padded_string-inl.h */
|
||||
/* skipped duplicate #include "simdjson/padded_string_view.h" */
|
||||
@@ -118292,4 +118302,4 @@ namespace simdjson {
|
||||
/* end file simdjson/ondemand.h */
|
||||
|
||||
#endif // SIMDJSON_H
|
||||
-/* end file simdjson.h */
|
||||
+/* end file simdjson.h */
|
||||
\ No newline at end of file
|
||||
|
||||
@@ -11,7 +11,7 @@ its own blended handler between Node and Blink.
|
||||
Not upstreamable.
|
||||
|
||||
diff --git a/lib/internal/modules/esm/utils.js b/lib/internal/modules/esm/utils.js
|
||||
index 99061e62976e7cb24be81e8632b0e21d1e9adf9a..bbc9311c059e8ab0328c5f92b21a6be57620717e 100644
|
||||
index fd17ce8695c55f8f38ed19d59960acc1a7692bc8..96754db3277b3a0445b69275368602166c6d5423 100644
|
||||
--- a/lib/internal/modules/esm/utils.js
|
||||
+++ b/lib/internal/modules/esm/utils.js
|
||||
@@ -30,7 +30,7 @@ const {
|
||||
@@ -23,7 +23,7 @@ index 99061e62976e7cb24be81e8632b0e21d1e9adf9a..bbc9311c059e8ab0328c5f92b21a6be5
|
||||
const {
|
||||
loadPreloadModules,
|
||||
initializeFrozenIntrinsics,
|
||||
@@ -274,12 +274,13 @@ let _forceDefaultLoader = false;
|
||||
@@ -280,12 +280,13 @@ let _forceDefaultLoader = false;
|
||||
* @param {boolean} [forceDefaultLoader=false] - A boolean indicating disabling custom loaders.
|
||||
*/
|
||||
function initializeESM(forceDefaultLoader = false) {
|
||||
@@ -40,10 +40,10 @@ index 99061e62976e7cb24be81e8632b0e21d1e9adf9a..bbc9311c059e8ab0328c5f92b21a6be5
|
||||
|
||||
/**
|
||||
diff --git a/src/module_wrap.cc b/src/module_wrap.cc
|
||||
index 649ec428e2dd6fbf0082b3f1ba9fdfbfab892a94..168912fe6ede3b71ab3029c292ba430915fd79d8 100644
|
||||
index 912acc8da815405531d8b527383f19c3731be100..8d48f4693c3b5f0d1d94d3edadc48c4f36d1bf97 100644
|
||||
--- a/src/module_wrap.cc
|
||||
+++ b/src/module_wrap.cc
|
||||
@@ -832,7 +832,7 @@ MaybeLocal<Module> ModuleWrap::ResolveModuleCallback(
|
||||
@@ -858,7 +858,7 @@ MaybeLocal<Module> ModuleWrap::ResolveModuleCallback(
|
||||
return module->module_.Get(isolate);
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ index 649ec428e2dd6fbf0082b3f1ba9fdfbfab892a94..168912fe6ede3b71ab3029c292ba4309
|
||||
Local<Context> context,
|
||||
Local<Data> host_defined_options,
|
||||
Local<Value> resource_name,
|
||||
@@ -897,12 +897,13 @@ void ModuleWrap::SetImportModuleDynamicallyCallback(
|
||||
@@ -923,12 +923,13 @@ void ModuleWrap::SetImportModuleDynamicallyCallback(
|
||||
Realm* realm = Realm::GetCurrent(args);
|
||||
HandleScope handle_scope(isolate);
|
||||
|
||||
@@ -68,7 +68,7 @@ index 649ec428e2dd6fbf0082b3f1ba9fdfbfab892a94..168912fe6ede3b71ab3029c292ba4309
|
||||
}
|
||||
|
||||
void ModuleWrap::HostInitializeImportMetaObjectCallback(
|
||||
@@ -944,13 +945,14 @@ void ModuleWrap::SetInitializeImportMetaObjectCallback(
|
||||
@@ -970,13 +971,14 @@ void ModuleWrap::SetInitializeImportMetaObjectCallback(
|
||||
Realm* realm = Realm::GetCurrent(args);
|
||||
Isolate* isolate = realm->isolate();
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user