Compare commits

..

25 Commits

Author SHA1 Message Date
trop[bot]
73cd1a880b fix: nodeIntegrationInWorker fails to boot in AudioWorklets (#37103)
* fix: nodeIntegrationInWorker in AudioWorklets

Co-authored-by: Jeremy Rose <jeremya@chromium.org>

* fix: typescript version issue

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-02-21 11:45:14 +01:00
Keeley Hammond
334627ce74 chore: cherry-pick e0efbd45ea74 from webrtc (#37299)
* chore: cherry-pick e0efbd45ea74 from webrtc

* chore: update patches

---------

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2023-02-20 13:12:58 +01:00
trop[bot]
e7791771ca chore: update https://cs.chromium.org/ links to https://source.chromium.org/ (#37235)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Milan Burda <miburda@microsoft.com>
2023-02-13 16:33:05 +09:00
John Kleinschmidt
2223b295df ci: update appveyor image (21-x-y) (#37230)
ci:update appveyor image

 (cherry picked from commit 454dc6a)
2023-02-11 19:21:05 -05:00
Keeley Hammond
90d51ea331 chore: cherry-pick d652130c4bc2 from chromium (#37170)
* chore: cherry-pick d652130c4bc2 from chromium

* chore: update patches

---------

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2023-02-08 15:27:03 +01:00
Milan Burda
2a9691fd3f fix: expose native bindings by process type (#36141)
fix: expose native bindings by process type (#35949)
2023-02-08 14:57:29 +01:00
trop[bot]
40cbdd340d fix: enable basic a11y when voice control is active (#37144)
* fix: enable basic a11y when voice control is active

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

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

* Update shell/browser/mac/electron_application.mm

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

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Samuel Attard <marshallofsound@electronjs.org>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: Robo <hop2deep@gmail.com>
2023-02-07 16:07:54 -05:00
trop[bot]
156a0cd12f docs: remove invalid appcache value from storages in clearStorageData() (#37106)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2023-02-03 09:47:38 +01:00
Keeley Hammond
27856acfdd chore: cherry-pick ca2b108a0f1f from chromium (#37057)
* chore: [21-x-y] cherry-pick ca2b108a0f1f from chromium

* chore: update patches

---------

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2023-02-02 20:53:44 +09:00
trop[bot]
cb5d93e9a7 feat: enable whole-program optimization native modules by default (#37048)
* feat: enable whole-program optimization

Enable whole-program optimization in electron native modules by default.

Co-authored-by: Kyrylo Hrechykhin <khrechykhin@microsoft.com>

* pass --with-ltcg to configure.py instead of setting variable

Co-authored-by: Kyrylo Hrechykhin <khrechykhin@microsoft.com>

* enable ltcg only on windows

Co-authored-by: Kyrylo Hrechykhin <khrechykhin@microsoft.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Kyrylo Hrechykhin <khrechykhin@microsoft.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2023-01-31 18:02:29 -08:00
trop[bot]
751fc04502 ci: ensure correct ninja is used (#37070)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2023-01-31 17:13:37 -05:00
Keeley Hammond
ee5b2523f7 chore: cherry-pick 57c54ae221d6 from chromium (#37023)
chore: [21-x-y] cherry-pick 57c54ae221d6 from chromium
2023-01-26 17:27:39 +09:00
Pedro Pontes
820bc2a499 chore: cherry-pick 0d4862e31aca and c4e7fe2f2e1b from chromium (#36586)
* chore: [21-x-y] cherry-pick 0d4862e31aca and c4e7fe2f2e1b from chromium

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: electron-patch-conflict-fixer[bot] <83340002+electron-patch-conflict-fixer[bot]@users.noreply.github.com>
2023-01-24 09:00:52 +01:00
trop[bot]
b110a19358 fix: handle null/undefined options for fs.readdir (#36846)
* fix: handle null/undefined options for fs.readdir (#34764)

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

* chore: remove optional chaining

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2023-01-23 16:22:52 +09:00
trop[bot]
418605e0fb fix: webview background color on reload (#36939)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-01-19 09:55:17 +01:00
trop[bot]
a571cfdf8c feat: add label property to Display objects (#36931)
Co-authored-by: Milan Burda <milan.burda@gmail.com>

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2023-01-19 15:59:05 +09:00
John Kleinschmidt
19e35495ee ci: run WOA tests on AppVeyor (21-x-y) (#36928)
ci: run WOA tests on AppVeyor
2023-01-18 12:12:32 +01:00
trop[bot]
cfac858d65 docs: add missing window-placement permission value to setPermissionRequestHandler() (#36905)
docs: add missing window-placement permission value to setPermissionRequestHandler() (#36777)

Co-authored-by: Milan Burda <miburda@microsoft.com>

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

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Milan Burda <milan.burda@gmail.com>
2023-01-17 16:25:23 -05:00
trop[bot]
545fd1c287 fix: Cmd+Tab not working when exiting kiosk mode (#36919)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-01-17 20:37:19 +09:00
Pedro Pontes
c73577ca99 chore: cherry-pick 43637378b14e from chromium (#36885)
* chore: cherry-pick 43637378b14e from chromium

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2023-01-13 19:11:34 +09:00
trop[bot]
82ff0acb11 fix: use the process cache to reduce the memory for asar file (#36663)
* fix: use the process cache to reduce the memory for asar file

Co-authored-by: webster.xu <webster.xu@ringcentral.com>

* Update shell/common/api/electron_api_asar.cc

Co-authored-by: Jeremy Rose <nornagon@nornagon.net>

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: webster.xu <webster.xu@ringcentral.com>
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2023-01-13 19:10:59 +09:00
Keeley Hammond
5d530d31f4 ci: bake appveyor images automatically, run sync on depshash change (#36484)
* ci: bake appveyor images automatically, run sync on depshash change

* build: fixup appveyor image for release

* build: make sure symstore is in the PATH when baking an image

* build: update to use fixed baked image

* cleanup sdk install

* chore: install VSC++ tools on bake, pin Node 16

* use newest baked image

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2023-01-12 17:51:56 -05:00
Pedro Pontes
e9b5cd7d2e chore: cherry-pick 0f481c9ddf2a from v8 (#36882)
* chore: cherry-pick 0f481c9ddf2a from v8

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-01-12 15:18:29 +01:00
Pedro Pontes
61af436d78 chore: cherry-pick 28b9c1c04e78 from v8 (#36879)
* chore: cherry-pick 28b9c1c04e78 from v8

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2023-01-12 11:58:36 +01:00
trop[bot]
d1e9dfdb75 build: migrate patch-up to use app creds (#36868)
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2023-01-11 20:22:38 +01:00
49 changed files with 3397 additions and 561 deletions

View File

@@ -235,6 +235,11 @@ step-depot-tools-get: &step-depot-tools-get
name: Get depot tools
command: |
git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
cd depot_tools
git fetch --depth 1 origin b7d8efd8bee494f4cfacacc19cf50fc4d4be3900
git checkout b7d8efd8bee494f4cfacacc19cf50fc4d4be3900
touch .disable_auto_update
cd ..
if [ "`uname`" == "Darwin" ]; then
# remove ninjalog_uploader_wrapper.py from autoninja since we don't use it and it causes problems
sed -i '' '/ninjalog_uploader_wrapper.py/d' ./depot_tools/autoninja
@@ -483,7 +488,9 @@ step-fix-sync: &step-fix-sync
run:
name: Fix Sync
command: |
SEDOPTION="-i"
if [ "`uname`" == "Darwin" ]; then
SEDOPTION="-i ''"
# Fix Clang Install (wrong binary)
rm -rf src/third_party/llvm-build
python3 src/tools/clang/scripts/update.py
@@ -2209,4 +2216,4 @@ workflows:
jobs:
- lint
# VS Code Extension Version: 1.1.1
# VS Code Extension Version: 1.5.1

View File

@@ -1,178 +0,0 @@
name: Electron WOA Testing
on:
push:
branches: '**'
workflow_dispatch:
inputs:
appveyor_job_id:
description: 'Job Id of Appveyor WOA job to test'
type: text
required: true
jobs:
electron-woa-init:
if: ${{ github.event_name == 'push' && github.repository == 'electron/electron' }}
runs-on: ubuntu-latest
steps:
- name: Dummy step for push event
run: |
echo "This job is a needed initialization step for Electron WOA testing. Another test result will appear once the electron-woa-testing build is done."
electron-woa-testing:
if: ${{ github.event_name == 'workflow_dispatch' && github.repository == 'electron/electron' }}
runs-on: [self-hosted, woa]
permissions:
checks: write
pull-requests: write
steps:
- uses: LouisBrunner/checks-action@v1.1.1
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: electron-woa-testing
status: in_progress
details_url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
output: |
{"summary":"Test In Progress","text_description":"See job details here: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"}
- name: Clean Workspace
run: |
Remove-Item * -Recurse -Force
shell: powershell
- name: Checkout
uses: actions/checkout@v3
with:
path: src\electron
fetch-depth: 0
- name: Yarn install
run: |
cd src\electron
node script/yarn.js install --frozen-lockfile
- name: Download and extract dist.zip for test
run: |
$localArtifactPath = "$pwd\dist.zip"
$serverArtifactPath = "https://ci.appveyor.com/api/buildjobs/${{ inputs.appveyor_job_id }}/artifacts/dist.zip"
Invoke-RestMethod -Method Get -Uri $serverArtifactPath -OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer ${{ secrets.APPVEYOR_TOKEN }}" }
& "${env:ProgramFiles(x86)}\7-Zip\7z.exe" x -osrc\out\Default -y $localArtifactPath
shell: powershell
- name: Download and extract native test executables for test
run: |
$localArtifactPath = "src\out\Default\shell_browser_ui_unittests.exe"
$serverArtifactPath = "https://ci.appveyor.com/api/buildjobs/${{ inputs.appveyor_job_id }}/artifacts/shell_browser_ui_unittests.exe"
Invoke-RestMethod -Method Get -Uri $serverArtifactPath -OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer ${{ secrets.APPVEYOR_TOKEN }}" }
shell: powershell
- name: Download and extract ffmpeg.zip for test
run: |
$localArtifactPath = "$pwd\ffmpeg.zip"
$serverArtifactPath = "https://ci.appveyor.com/api/buildjobs/${{ inputs.appveyor_job_id }}/artifacts/ffmpeg.zip"
Invoke-RestMethod -Method Get -Uri $serverArtifactPath -OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer ${{ secrets.APPVEYOR_TOKEN }}" }
& "${env:ProgramFiles(x86)}\7-Zip\7z.exe" x -osrc\out\ffmpeg $localArtifactPath
shell: powershell
- name: Download node headers for test
run: |
$localArtifactPath = "src\node_headers.zip"
$serverArtifactPath = "https://ci.appveyor.com/api/buildjobs/${{ inputs.appveyor_job_id }}/artifacts/node_headers.zip"
Invoke-RestMethod -Method Get -Uri $serverArtifactPath -OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer ${{ secrets.APPVEYOR_TOKEN }}" }
cd src
& "${env:ProgramFiles(x86)}\7-Zip\7z.exe" x -y node_headers.zip
shell: powershell
- name: Download electron.lib for test
run: |
$localArtifactPath = "src\out\Default\electron.lib"
$serverArtifactPath = "https://ci.appveyor.com/api/buildjobs/${{ inputs.appveyor_job_id }}/artifacts/electron.lib"
Invoke-RestMethod -Method Get -Uri $serverArtifactPath -OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer ${{ secrets.APPVEYOR_TOKEN }}" }
shell: powershell
# Uncomment the following block if pdb files are needed to debug issues
# - name: Download pdb files for detailed stacktraces
# if: ${{ github.event_name == 'workflow_dispatch' }}
# run: |
# try {
# $localArtifactPath = "src\pdb.zip"
# $serverArtifactPath = "https://ci.appveyor.com/api/buildjobs/${{ inputs.appveyor_job_id }}/artifacts/pdb.zip"
# Invoke-RestMethod -Method Get -Uri $serverArtifactPath -OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer ${{ secrets.APPVEYOR_TOKEN }}" }
# cd src
# & "${env:ProgramFiles(x86)}\7-Zip\7z.exe" x -y pdb.zip
# } catch {
# Write-Host "There was an exception encountered while downloading pdb files:" $_.Exception.Message
# } finally {
# $global:LASTEXITCODE = 0
# }
# shell: powershell
- name: Setup node headers
run: |
New-Item src\out\Default\gen\node_headers\Release -Type directory
Copy-Item -path src\out\Default\electron.lib -destination src\out\Default\gen\node_headers\Release\node.lib
shell: powershell
- name: Run Electron Main process tests
run: |
cd src
set npm_config_nodedir=%cd%\out\Default\gen\node_headers
set npm_config_arch=arm64
cd electron
node script/yarn test --runners=main --enable-logging --disable-features=CalculateNativeWinOcclusion
env:
ELECTRON_ENABLE_STACK_DUMPING: true
ELECTRON_OUT_DIR: Default
IGNORE_YARN_INSTALL_ERROR: 1
ELECTRON_TEST_RESULTS_DIR: junit
MOCHA_MULTI_REPORTERS: 'mocha-junit-reporter, tap'
MOCHA_REPORTER: mocha-multi-reporters
ELECTRON_SKIP_NATIVE_MODULE_TESTS: true
- name: Run Electron Remote based tests
if: ${{ success() || failure() }}
run: |
cd src
set npm_config_nodedir=%cd%\out\Default\gen\node_headers
set npm_config_arch=arm64
cd electron
node script/yarn test --runners=remote --enable-logging --disable-features=CalculateNativeWinOcclusion
env:
ELECTRON_OUT_DIR: Default
IGNORE_YARN_INSTALL_ERROR: 1
ELECTRON_TEST_RESULTS_DIR: junit
MOCHA_MULTI_REPORTERS: 'mocha-junit-reporter, tap'
MOCHA_REPORTER: mocha-multi-reporters
ELECTRON_SKIP_NATIVE_MODULE_TESTS: true
- name: Verify ffmpeg
run: |
cd src
echo "Verifying non proprietary ffmpeg"
python electron\script\verify-ffmpeg.py --build-dir out\Default --source-root %cd% --ffmpeg-path out\ffmpeg
shell: cmd
- name: Kill processes left running from last test run
if: ${{ always() }}
run: |
Get-Process | Where Name -Like "electron*" | Stop-Process
Get-Process | Where Name -Like "msedge*" | Stop-Process
shell: powershell
- name: Delete user app data directories
if: ${{ always() }}
run: |
Remove-Item -path $env:APPDATA/Electron* -Recurse -Force -ErrorAction Ignore
shell: powershell
- uses: LouisBrunner/checks-action@v1.1.1
if: ${{ success() }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: electron-woa-testing
conclusion: "${{ job.status }}"
details_url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
output: |
{"summary":"${{ job.status }}","text_description":"See job details here: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"}
- uses: LouisBrunner/checks-action@v1.1.1
if: ${{ success() }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: electron-woa-testing
conclusion: "${{ job.status }}"
details_url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
output: |
{"summary":"Job Succeeded","text_description":"See job details here: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"}
- uses: LouisBrunner/checks-action@v1.1.1
if: ${{ ! success() }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: electron-woa-testing
conclusion: "${{ job.status }}"
details_url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
output: |
{"summary":"Job Failed","text_description":"See job details here: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"}

View File

@@ -0,0 +1,62 @@
name: Update AppVeyor Image
# Run chron daily Mon-Fri
on:
schedule:
- cron: '0 8 * * 1-5' # runs 8:00 every business day (see https://crontab.guru)
permissions:
contents: write
pull-requests: write
jobs:
bake-appveyor-image:
name: Bake AppVeyor Image
permissions:
contents: write
pull-requests: write # to create a new PR with updated Appveyor images
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Yarn install
run: |
node script/yarn.js install --frozen-lockfile
- name: Set Repo for Commit
run: git config --global --add safe.directory $GITHUB_WORKSPACE
- name: Check AppVeyor Image
env:
APPVEYOR_TOKEN: ${{ secrets.APPVEYOR_TOKEN }}
run: |
node ./script/prepare-appveyor
if [ -f ./image_version.txt ]; then
echo "APPVEYOR_IMAGE_VERSION="$(cat image_version.txt)"" >> $GITHUB_ENV
rm image_version.txt
fi
- name: (Optionally) Update Appveyor Image
if: ${{ env.APPVEYOR_IMAGE_VERSION }}
uses: mikefarah/yq@v4.27.2
with:
cmd: yq '.image = "${{ env.APPVEYOR_IMAGE_VERSION }}"' "appveyor.yml" > "appveyor2.yml"
- name: (Optionally) Generate Commit Diff
if: ${{ env.APPVEYOR_IMAGE_VERSION }}
run: |
diff -w -B appveyor.yml appveyor2.yml > appveyor.diff || true
patch -f appveyor.yml < appveyor.diff
rm appveyor2.yml appveyor.diff
- name: (Optionally) Commit and Pull Request
if: ${{ env.APPVEYOR_IMAGE_VERSION }}
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.ACTIONS_GITHUB_TOKEN }}
commit-message: 'build: update appveyor image to latest version'
committer: GitHub <noreply@github.com>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
signoff: false
branch: bump-appveyor-image
delete-branch: true
title: 'build: update appveyor image to latest version'
body: |
This PR updates appveyor.yml to the latest baked image, ${{ env.APPVEYOR_IMAGE_VERSION }}.

107
appveyor-bake.yml Normal file
View File

@@ -0,0 +1,107 @@
# The config is used to bake appveyor images, not for running CI jobs.
# The config expects the following environment variables to be set:
# - "APPVEYOR_BAKE_IMAGE" e.g. 'electron-99.0.4767.0'. Name of the image to be baked.
# Typically named after the Chromium version on which the image is built.
# This can be set dynamically in the prepare-appveyor script.
version: 1.0.{build}
build_cloud: electronhq-16-core
image: e-111.0.5560.0-2
environment:
GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache
ELECTRON_OUT_DIR: Default
ELECTRON_ENABLE_STACK_DUMPING: 1
MOCHA_REPORTER: mocha-multi-reporters
MOCHA_MULTI_REPORTERS: mocha-appveyor-reporter, tap
GOMA_FALLBACK_ON_AUTH_FAILURE: true
DEPOT_TOOLS_WIN_TOOLCHAIN: 0
PYTHONIOENCODING: UTF-8
# The following lines are needed when baking from a completely new image (eg MicrosoftWindowsServer:WindowsServer:2019-Datacenter:latest via image: base-windows-server2019)
# init:
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
# - appveyor version
# - ps: $ErrorActionPreference = 'Stop'
# - ps: 'Write-Host "OS Build: $((Get-CimInstance Win32_OperatingSystem).BuildNumber)"'
# clone_folder: '%USERPROFILE%\image-bake-scripts'
# clone_script:
# - ps: Invoke-WebRequest "https://github.com/appveyor/build-images/archive/1f90d94e74c8243c909a09b994e527584dfcb838.zip" -OutFile "$env:temp\scripts.zip"
# - ps: Expand-Archive -Path "$env:temp\scripts.zip" -DestinationPath "$env:temp\scripts" -Force
# - ps: Copy-Item -Path "$env:temp\scripts\build-images-1f90d94e74c8243c909a09b994e527584dfcb838\scripts\Windows\*" -Destination $env:APPVEYOR_BUILD_FOLDER -Recurse
build_script:
# The following lines are needed when baking from a completely new image (eg MicrosoftWindowsServer:WindowsServer:2019-Datacenter:latest via image: base-windows-server2019)
# - ps: .\init_server.ps1
# - ps: .\extend_system_volume.ps1
# # Restart VM
# - ps: Start-Sleep -s 5; Restart-Computer
# - ps: Start-Sleep -s 5
# - appveyor version
# - ps: .\install_path_utils.ps1
# - ps: .\install_powershell_core.ps1
# - ps: .\install_powershell_get.ps1
# - ps: .\install_7zip.ps1
# - ps: .\install_chocolatey.ps1
# - ps: .\install_webpi.ps1
# - ps: .\install_nuget.ps1
# - ps: .\install_pstools.ps1
# - ps: .\install_git.ps1
# - ps: .\install_git_lfs.ps1
# # Restart VM
# - ps: Start-Sleep -s 5; Restart-Computer
# - ps: Start-Sleep -s 5
# END LINES FOR COMPLETELY NEW IMAGE
- git config --global core.longpaths true
- ps: >-
if (-not (Test-Path -Path C:\projects\src)) {
New-Item -Path C:\projects\src -ItemType Directory
}
- cd C:\projects\
- git clone -q --branch=%APPVEYOR_REPO_BRANCH% https://github.com/electron/electron.git C:\projects\src\electron
- git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
- ps: $env:PATH="$pwd\depot_tools;$env:PATH"
- update_depot_tools.bat
# Uncomment the following line if windows deps change
# - src\electron\script\setup-win-for-dev.bat
- >-
gclient config
--name "src\electron"
--unmanaged
%GCLIENT_EXTRA_ARGS%
"https://github.com/electron/electron"
- ps: cd src\electron
- ps: node script\generate-deps-hash.js
- ps: $depshash = Get-Content .\.depshash -Raw
- ps: Copy-Item -path .\.depshash -destination ..\.depshash
- ps: cd ..\..
- gclient sync --with_branch_heads --with_tags --nohooks
- ps: regsvr32 /s "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\DIA SDK\bin\amd64\msdia140.dll"
# The following lines are needed when baking from a completely new image (eg MicrosoftWindowsServer:WindowsServer:2019-Datacenter:latest via image: base-windows-server2019)
# # Restart VM
# - ps: Start-Sleep -s 5; Restart-Computer
# - ps: Start-Sleep -s 5
# - cd %USERPROFILE%\image-bake-scripts
# - appveyor version
# - ps: .\optimize_dotnet_runtime.ps1
# - ps: .\disable_windows_background_services.ps1
# - ps: .\enforce_windows_firewall.ps1
# - ps: .\cleanup_windows.ps1
# END LINES FOR COMPLETELY NEW IMAGE
on_image_bake:
- ps: >-
echo "Baking image: $env:APPVEYOR_BAKE_IMAGE at dir $PWD"
- ps: Remove-Item -Recurse -Force C:\projects\depot_tools
- ps: Remove-Item -Recurse -Force C:\projects\src\electron
# Uncomment these lines and set APPVEYOR_RDP_PASSWORD in project settings to enable RDP after bake is done
# # on_finish:
# - ps: >-
# $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))

286
appveyor-woa.yml Normal file
View File

@@ -0,0 +1,286 @@
# NOTE IF CHANGING THIS FILE, ALSO APPLY THE CHANGE TO appveyor.yml
# IF APPLICABLE!!!!
#
#
# The config expects the following environment variables to be set:
# - "GN_CONFIG" Build type. One of {'testing', 'release'}.
# - "GN_EXTRA_ARGS" Additional gn arguments for a build config,
# e.g. 'target_cpu="x86"' to build for a 32bit platform.
# https://gn.googlesource.com/gn/+/master/docs/reference.md#target_cpu
# Don't forget to set up "NPM_CONFIG_ARCH" and "TARGET_ARCH" accordingly
# if you pass a custom value for 'target_cpu'.
# - "ELECTRON_RELEASE" Set it to '1' upload binaries on success.
# - "NPM_CONFIG_ARCH" E.g. 'x86'. Is used to build native Node.js modules.
# Must match 'target_cpu' passed to "GN_EXTRA_ARGS" and "TARGET_ARCH" value.
# - "TARGET_ARCH" Choose from {'ia32', 'x64', 'arm', 'arm64', 'mips64el'}.
# Is used in some publishing scripts, but does NOT affect the Electron binary.
# Must match 'target_cpu' passed to "GN_EXTRA_ARGS" and "NPM_CONFIG_ARCH" value.
# - "UPLOAD_TO_STORAGE" Set it to '1' upload a release to the Azure bucket.
# Otherwise the release will be uploaded to the GitHub Releases.
# (The value is only checked if "ELECTRON_RELEASE" is defined.)
#
# The publishing scripts expect access tokens to be defined as env vars,
# but those are not covered here.
#
# AppVeyor docs on variables:
# https://www.appveyor.com/docs/environment-variables/
# https://www.appveyor.com/docs/build-configuration/#secure-variables
# https://www.appveyor.com/docs/build-configuration/#custom-environment-variables
version: 1.0.{build}
build_cloud: electronhq-16-core
image: e-106.0.5249.199-2
environment:
GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache
ELECTRON_OUT_DIR: Default
ELECTRON_ENABLE_STACK_DUMPING: 1
ELECTRON_ALSO_LOG_TO_STDERR: 1
MOCHA_REPORTER: mocha-multi-reporters
MOCHA_MULTI_REPORTERS: mocha-appveyor-reporter, tap
GOMA_FALLBACK_ON_AUTH_FAILURE: true
DEPOT_TOOLS_WIN_TOOLCHAIN: 0
PYTHONIOENCODING: UTF-8
matrix:
- job_name: Build Arm on X64 Windows
- job_name: Test On Windows On Arm Hardware
job_depends_on: Build Arm on X64 Windows
APPVEYOR_BUILD_WORKER_IMAGE: base-woa
APPVEYOR_BUILD_WORKER_CLOUD: electronhq-woa
clone_folder: C:\projects\src\electron
skip_branch_with_pr: true
# the first failed job cancels other jobs and fails entire build
matrix:
fast_finish: true
for:
- matrix:
only:
- job_name: Build Arm on X64 Windows
build_script:
- ps: |
node script/yarn.js install --frozen-lockfile
node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER --prBranch=$env:APPVEYOR_REPO_BRANCH
if ($LASTEXITCODE -eq 0) {
Write-warning "Skipping build for doc only change"; Exit-AppveyorBuild
}
$global:LASTEXITCODE = 0
- cd ..
- ps: Write-Host "Building $env:GN_CONFIG build"
- git config --global core.longpaths true
- ps: >-
if (Test-Path -Path "$pwd\depot_tools") {
Remove-Item -Recurse -Force $pwd\depot_tools
}
- ps: >-
if (Test-Path -Path "$pwd\build-tools") {
Remove-Item -Recurse -Force $pwd\build-tools
}
- git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
- ps: |
cd depot_tools
git fetch --depth 1 origin b7d8efd8bee494f4cfacacc19cf50fc4d4be3900
git checkout b7d8efd8bee494f4cfacacc19cf50fc4d4be3900
New-Item -Name .disable_auto_update -ItemType File
bootstrap\win_tools.bat
cd ..
- ps: $env:PATH="$pwd\depot_tools;$env:PATH"
- ps: >-
if (Test-Path -Path "$pwd\src\electron") {
Remove-Item -Recurse -Force $pwd\src\electron
}
- ps: >-
if (Test-Path 'env:RAW_GOMA_AUTH') {
$env:GOMA_OAUTH2_CONFIG_FILE = "$pwd\.goma_oauth2_config"
$env:RAW_GOMA_AUTH | Set-Content $env:GOMA_OAUTH2_CONFIG_FILE
}
- git clone https://github.com/electron/build-tools.git
- cd build-tools
- npm install
- mkdir third_party
- ps: >-
node -e "require('./src/utils/goma.js').downloadAndPrepare({ gomaOneForAll: true })"
- ps: $env:GN_GOMA_FILE = node -e "console.log(require('./src/utils/goma.js').gnFilePath)"
- ps: $env:LOCAL_GOMA_DIR = node -e "console.log(require('./src/utils/goma.js').dir)"
- cd ..\..
- ps: .\src\electron\script\start-goma.ps1 -gomaDir $env:LOCAL_GOMA_DIR
- ps: >-
if (Test-Path 'env:RAW_GOMA_AUTH') {
$goma_login = python $env:LOCAL_GOMA_DIR\goma_auth.py info
if ($goma_login -eq 'Login as Fermi Planck') {
Write-warning "Goma authentication is correct";
} else {
Write-warning "WARNING!!!!!! Goma authentication is incorrect; please update Goma auth token.";
$host.SetShouldExit(1)
}
}
- ps: $env:CHROMIUM_BUILDTOOLS_PATH="$pwd\src\buildtools"
- ps: >-
if ($env:GN_CONFIG -ne 'release') {
$env:NINJA_STATUS="[%r processes, %f/%t @ %o/s : %es] "
}
- gclient config --name "src\electron" --unmanaged %GCLIENT_EXTRA_ARGS% "https://github.com/electron/electron"
# Patches are applied in the image bake. Check depshash to see if patches have changed.
- ps: $env:RUN_GCLIENT_SYNC="false"
- ps: $depshash_baked = Get-Content .\src\.depshash -Raw
- ps: cd src\electron
- ps: node script\generate-deps-hash.js
- ps: $depshash = Get-Content .\.depshash -Raw
- ps: cd ..\..
- ps: >-
if ($depshash_baked -ne $depshash) {
$env:RUN_GCLIENT_SYNC="true"
}
- if "%RUN_GCLIENT_SYNC%"=="true" ( gclient sync --with_branch_heads --with_tags ) else ( gclient runhooks )
- cd src
- ps: $env:PATH="$pwd\third_party\ninja;$env:PATH"
- set BUILD_CONFIG_PATH=//electron/build/args/%GN_CONFIG%.gn
- gn gen out/Default "--args=import(\"%BUILD_CONFIG_PATH%\") import(\"%GN_GOMA_FILE%\") %GN_EXTRA_ARGS% "
- gn check out/Default //electron:electron_lib
- gn check out/Default //electron:electron_app
- gn check out/Default //electron/shell/common/api:mojo
- if DEFINED GN_GOMA_FILE (ninja -j 300 -C out/Default electron:electron_app) else (ninja -C out/Default electron:electron_app)
- if "%GN_CONFIG%"=="testing" ( python C:\depot_tools\post_build_ninja_summary.py -C out\Default )
- gn gen out/ffmpeg "--args=import(\"//electron/build/args/ffmpeg.gn\") %GN_EXTRA_ARGS%"
- ninja -C out/ffmpeg electron:electron_ffmpeg_zip
- ninja -C out/Default electron:electron_dist_zip
- ninja -C out/Default shell_browser_ui_unittests
- gn desc out/Default v8:run_mksnapshot_default args > out/Default/default_mksnapshot_args
# Remove unused args from mksnapshot_args
- ps: >-
Get-Content out/Default/default_mksnapshot_args | Where-Object { -not $_.Contains('--turbo-profiling-input') -And -not $_.Contains('builtins-pgo') } | Set-Content out/Default/mksnapshot_args
- ninja -C out/Default electron:electron_mksnapshot_zip
- cd out\Default
- 7z a mksnapshot.zip mksnapshot_args gen\v8\embedded.S
- cd ..\..
- ninja -C out/Default electron:hunspell_dictionaries_zip
- ninja -C out/Default electron:electron_chromedriver_zip
- ninja -C out/Default third_party/electron_node:headers
- python %LOCAL_GOMA_DIR%\goma_ctl.py stat
- ps: >-
Get-CimInstance -Namespace root\cimv2 -Class Win32_product | Select vendor, description, @{l='install_location';e='InstallLocation'}, @{l='install_date';e='InstallDate'}, @{l='install_date_2';e='InstallDate2'}, caption, version, name, @{l='sku_number';e='SKUNumber'} | ConvertTo-Json | Out-File -Encoding utf8 -FilePath .\installed_software.json
- python3 electron/build/profile_toolchain.py --output-json=out/Default/windows_toolchain_profile.json
- 7z a node_headers.zip out\Default\gen\node_headers
- ps: >-
if ($env:GN_CONFIG -eq 'release') {
# Needed for msdia140.dll on 64-bit windows
$env:Path += ";$pwd\third_party\llvm-build\Release+Asserts\bin"
ninja -C out/Default electron:electron_symbols
}
- ps: >-
if ($env:GN_CONFIG -eq 'release') {
python3 electron\script\zip-symbols.py
appveyor-retry appveyor PushArtifact out/Default/symbols.zip
} else {
# It's useful to have pdb files when debugging testing builds that are
# built on CI.
7z a pdb.zip out\Default\*.pdb
}
- python3 electron/script/zip_manifests/check-zip-manifest.py out/Default/dist.zip electron/script/zip_manifests/dist_zip.win.%TARGET_ARCH%.manifest
deploy_script:
- cd electron
- ps: >-
if (Test-Path Env:\ELECTRON_RELEASE) {
if (Test-Path Env:\UPLOAD_TO_STORAGE) {
Write-Output "Uploading Electron release distribution to azure"
& python3 script\release\uploaders\upload.py --verbose --upload_to_storage
} else {
Write-Output "Uploading Electron release distribution to github releases"
& python3 script\release\uploaders\upload.py --verbose
}
}
on_finish:
# Uncomment this lines to enable RDP
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
- cd C:\projects\src
- if exist out\Default\windows_toolchain_profile.json ( appveyor-retry appveyor PushArtifact out\Default\windows_toolchain_profile.json )
- if exist out\Default\dist.zip (appveyor-retry appveyor PushArtifact out\Default\dist.zip)
- if exist out\Default\shell_browser_ui_unittests.exe (appveyor-retry appveyor PushArtifact out\Default\shell_browser_ui_unittests.exe)
- if exist out\Default\chromedriver.zip (appveyor-retry appveyor PushArtifact out\Default\chromedriver.zip)
- if exist out\ffmpeg\ffmpeg.zip (appveyor-retry appveyor PushArtifact out\ffmpeg\ffmpeg.zip)
- if exist node_headers.zip (appveyor-retry appveyor PushArtifact node_headers.zip)
- if exist out\Default\mksnapshot.zip (appveyor-retry appveyor PushArtifact out\Default\mksnapshot.zip)
- if exist out\Default\hunspell_dictionaries.zip (appveyor-retry appveyor PushArtifact out\Default\hunspell_dictionaries.zip)
- if exist out\Default\electron.lib (appveyor-retry appveyor PushArtifact out\Default\electron.lib)
- ps: >-
if ((Test-Path "pdb.zip") -And ($env:GN_CONFIG -ne 'release')) {
appveyor-retry appveyor PushArtifact pdb.zip
}
- matrix:
only:
- job_name: Test On Windows On Arm Hardware
environment:
IGNORE_YARN_INSTALL_ERROR: 1
ELECTRON_TEST_RESULTS_DIR: junit
MOCHA_MULTI_REPORTERS: 'mocha-junit-reporter, tap'
MOCHA_REPORTER: mocha-multi-reporters
ELECTRON_SKIP_NATIVE_MODULE_TESTS: true
build_script:
- ps: |
node script/yarn.js install --frozen-lockfile
node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER --prBranch=$env:APPVEYOR_REPO_BRANCH
if ($LASTEXITCODE -eq 0) {
Write-warning "Skipping build for doc only change"; Exit-AppveyorBuild
}
$global:LASTEXITCODE = 0
- cd ..
- mkdir out\Default
- cd ..
- ps: |
# Download build artifacts
$apiUrl = 'https://ci.appveyor.com/api'
$build_info = Invoke-RestMethod -Method Get -Uri "$apiUrl/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/builds/$env:APPVEYOR_BUILD_ID"
$artifacts_to_download = @('dist.zip','ffmpeg.zip','node_headers.zip','pdb.zip','electron.lib')
foreach ($job in $build_info.build.jobs) {
if ($job.name -eq "Build Arm on X64 Windows") {
$jobId = $job.jobId
foreach($artifact_name in $artifacts_to_download) {
if ($artifact_name -eq 'shell_browser_ui_unittests.exe' -Or $artifact_name -eq 'electron.lib') {
$outfile = "src\out\Default\$artifact_name"
} else {
$outfile = $artifact_name
}
Invoke-RestMethod -Method Get -Uri "$apiUrl/buildjobs/$jobId/artifacts/$artifact_name" -OutFile $outfile
}
}
}
- ps: |
$out_default_zips = @('dist.zip','pdb.zip')
foreach($zip_name in $out_default_zips) {
7z x -y -osrc\out\Default $zip_name
}
- ps: 7z x -y -osrc\out\ffmpeg ffmpeg.zip
- ps: 7z x -y -osrc node_headers.zip
test_script:
# Workaround for https://github.com/appveyor/ci/issues/2420
- set "PATH=%PATH%;C:\Program Files\Git\mingw64\libexec\git-core"
- ps: |
cd src
New-Item .\out\Default\gen\node_headers\Release -Type directory
Copy-Item -path .\out\Default\electron.lib -destination .\out\Default\gen\node_headers\Release\node.lib
- set npm_config_nodedir=%cd%\out\Default\gen\node_headers
- set npm_config_arch=arm64
- cd electron
# Explicitly set npm_config_arch because the .env doesn't persist
- ps: >-
if ($env:TARGET_ARCH -eq 'ia32') {
$env:npm_config_arch = "ia32"
}
- echo Running main test suite & node script/yarn test --runners=main --enable-logging --disable-features=CalculateNativeWinOcclusion
- cd ..
- echo Verifying non proprietary ffmpeg & python electron\script\verify-ffmpeg.py --build-dir out\Default --source-root %cd% --ffmpeg-path out\ffmpeg
on_finish:
# Uncomment these lines to enable RDP
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
- if exist electron\electron.log ( appveyor-retry appveyor PushArtifact electron\electron.log )

View File

@@ -1,3 +1,7 @@
# NOTE IF CHANGING THIS FILE, ALSO APPLY THE CHANGE TO appveyor-woa.yml
# IF APPLICABLE!!!!
#
#
# The config expects the following environment variables to be set:
# - "GN_CONFIG" Build type. One of {'testing', 'release'}.
# - "GN_EXTRA_ARGS" Additional gn arguments for a build config,
@@ -24,193 +28,159 @@
# https://www.appveyor.com/docs/build-configuration/#custom-environment-variables
version: 1.0.{build}
build_cloud: electron-16-core
image: vs2019bt-16.16.11
build_cloud: electronhq-16-core
image: e-106.0.5249.199-2
environment:
GIT_CACHE_PATH: C:\Users\electron\libcc_cache
GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache
ELECTRON_OUT_DIR: Default
ELECTRON_ENABLE_STACK_DUMPING: 1
ELECTRON_ALSO_LOG_TO_STDERR: 1
MOCHA_REPORTER: mocha-multi-reporters
MOCHA_MULTI_REPORTERS: mocha-appveyor-reporter, tap
GOMA_FALLBACK_ON_AUTH_FAILURE: true
DEPOT_TOOLS_WIN_TOOLCHAIN: 0
PYTHONIOENCODING: UTF-8
matrix:
- job_name: Build
- job_name: Test
job_depends_on: Build
- job_name: Build
- job_name: Test
job_depends_on: Build
clone_folder: C:\projects\src\electron
skip_branch_with_pr: true
# the first failed job cancels other jobs and fails entire build
matrix:
fast_finish: true
for:
-
matrix:
- matrix:
only:
- job_name: Build
init:
- ps: >-
if(($env:APPVEYOR_PULL_REQUEST_HEAD_REPO_NAME -split "/")[0] -eq ($env:APPVEYOR_REPO_NAME -split "/")[0]) {
Write-warning "Skipping PR build for branch"; Exit-AppveyorBuild
}
build_script:
- ps: |
node script/yarn.js install --frozen-lockfile
node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER --prBranch=$env:APPVEYOR_REPO_BRANCH
if ($LASTEXITCODE -eq 0) {
Write-warning "Skipping tests for doc only change"; Exit-AppveyorBuild
}
$global:LASTEXITCODE = 0
- cd ..
- ps: Write-Host "Building $env:GN_CONFIG build"
- git config --global core.longpaths true
- update_depot_tools.bat
- ps: >-
if (Test-Path 'env:RAW_GOMA_AUTH') {
$env:GOMA_OAUTH2_CONFIG_FILE = "$pwd\.goma_oauth2_config"
$env:RAW_GOMA_AUTH | Set-Content $env:GOMA_OAUTH2_CONFIG_FILE
}
- git clone https://github.com/electron/build-tools.git
- cd build-tools
- npm install
- mkdir third_party
- ps: >-
node -e "require('./src/utils/goma.js').downloadAndPrepare({ gomaOneForAll: true })"
- ps: $env:GN_GOMA_FILE = node -e "console.log(require('./src/utils/goma.js').gnFilePath)"
- ps: $env:LOCAL_GOMA_DIR = node -e "console.log(require('./src/utils/goma.js').dir)"
- cd ..\..
- ps: .\src\electron\script\start-goma.ps1 -gomaDir $env:LOCAL_GOMA_DIR
- ps: >-
if (Test-Path 'env:RAW_GOMA_AUTH') {
$goma_login = python $env:LOCAL_GOMA_DIR\goma_auth.py info
if ($goma_login -eq 'Login as Fermi Planck') {
Write-warning "Goma authentication is correct";
} else {
Write-warning "WARNING!!!!!! Goma authentication is incorrect; please update Goma auth token.";
$host.SetShouldExit(1)
- ps: |
node script/yarn.js install --frozen-lockfile
node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER --prBranch=$env:APPVEYOR_REPO_BRANCH
if ($LASTEXITCODE -eq 0) {
Write-warning "Skipping build for doc only change"; Exit-AppveyorBuild
}
}
- ps: $env:CHROMIUM_BUILDTOOLS_PATH="$pwd\src\buildtools"
- ps: >-
if ($env:GN_CONFIG -ne 'release') {
$env:NINJA_STATUS="[%r processes, %f/%t @ %o/s : %es] "
}
- >-
gclient config
--name "src\electron"
--unmanaged
%GCLIENT_EXTRA_ARGS%
"https://github.com/electron/electron"
- ps: >-
if ($env:GN_CONFIG -eq 'release') {
$env:RUN_GCLIENT_SYNC="true"
} else {
cd src\electron
node script\generate-deps-hash.js
$depshash = Get-Content .\.depshash -Raw
$zipfile = "Z:\$depshash.7z"
cd ..\..
if (Test-Path -Path $zipfile) {
# file exists, unzip and then gclient sync
7z x -y $zipfile -mmt=14 -aoa
if (-not (Test-Path -Path "src\buildtools")) {
# the zip file must be corrupt - resync
$env:RUN_GCLIENT_SYNC="true"
if ($env:TARGET_ARCH -ne 'ia32') {
# only save on x64/woa to avoid contention saving
$env:SAVE_GCLIENT_SRC="true"
}
$global:LASTEXITCODE = 0
- cd ..
- ps: Write-Host "Building $env:GN_CONFIG build"
- git config --global core.longpaths true
- ps: >-
if (Test-Path -Path "$pwd\depot_tools") {
Remove-Item -Recurse -Force $pwd\depot_tools
}
- ps: >-
if (Test-Path -Path "$pwd\build-tools") {
Remove-Item -Recurse -Force $pwd\build-tools
}
- git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
- ps: |
cd depot_tools
git fetch --depth 1 origin b7d8efd8bee494f4cfacacc19cf50fc4d4be3900
git checkout b7d8efd8bee494f4cfacacc19cf50fc4d4be3900
New-Item -Name .disable_auto_update -ItemType File
bootstrap\win_tools.bat
cd ..
- ps: $env:PATH="$pwd\depot_tools;$env:PATH"
- ps: >-
if (Test-Path -Path "$pwd\src\electron") {
Remove-Item -Recurse -Force $pwd\src\electron
}
- ps: >-
if (Test-Path 'env:RAW_GOMA_AUTH') {
$env:GOMA_OAUTH2_CONFIG_FILE = "$pwd\.goma_oauth2_config"
$env:RAW_GOMA_AUTH | Set-Content $env:GOMA_OAUTH2_CONFIG_FILE
}
- git clone https://github.com/electron/build-tools.git
- cd build-tools
- npm install
- mkdir third_party
- ps: >-
node -e "require('./src/utils/goma.js').downloadAndPrepare({ gomaOneForAll: true })"
- ps: $env:GN_GOMA_FILE = node -e "console.log(require('./src/utils/goma.js').gnFilePath)"
- ps: $env:LOCAL_GOMA_DIR = node -e "console.log(require('./src/utils/goma.js').dir)"
- cd ..\..
- ps: .\src\electron\script\start-goma.ps1 -gomaDir $env:LOCAL_GOMA_DIR
- ps: >-
if (Test-Path 'env:RAW_GOMA_AUTH') {
$goma_login = python $env:LOCAL_GOMA_DIR\goma_auth.py info
if ($goma_login -eq 'Login as Fermi Planck') {
Write-warning "Goma authentication is correct";
} else {
# update angle
cd src\third_party\angle
git remote set-url origin https://chromium.googlesource.com/angle/angle.git
git fetch
cd ..\..\..
Write-warning "WARNING!!!!!! Goma authentication is incorrect; please update Goma auth token.";
$host.SetShouldExit(1)
}
} else {
# file does not exist, gclient sync, then zip
}
- ps: $env:CHROMIUM_BUILDTOOLS_PATH="$pwd\src\buildtools"
- ps: >-
if ($env:GN_CONFIG -ne 'release') {
$env:NINJA_STATUS="[%r processes, %f/%t @ %o/s : %es] "
}
- gclient config --name "src\electron" --unmanaged %GCLIENT_EXTRA_ARGS% "https://github.com/electron/electron"
# Patches are applied in the image bake. Check depshash to see if patches have changed.
- ps: $env:RUN_GCLIENT_SYNC="false"
- ps: $depshash_baked = Get-Content .\src\.depshash -Raw
- ps: cd src\electron
- ps: node script\generate-deps-hash.js
- ps: $depshash = Get-Content .\.depshash -Raw
- ps: cd ..\..
- ps: >-
if ($depshash_baked -ne $depshash) {
$env:RUN_GCLIENT_SYNC="true"
if ($env:TARGET_ARCH -ne 'ia32') {
# only save on x64/woa to avoid contention saving
$env:SAVE_GCLIENT_SRC="true"
}
}
}
- if "%RUN_GCLIENT_SYNC%"=="true" ( gclient sync )
- ps: >-
if ($env:SAVE_GCLIENT_SRC -eq 'true') {
# archive current source for future use
# only run on x64/woa to avoid contention saving
$(7z a $zipfile src -xr!android_webview -xr!electron -xr'!*\.git' -xr!third_party\blink\web_tests -xr!third_party\blink\perf_tests -slp -t7z -mmt=30)
if ($LASTEXITCODE -ne 0) {
Write-warning "Could not save source to shared drive; continuing anyway"
- if "%RUN_GCLIENT_SYNC%"=="true" ( gclient sync --with_branch_heads --with_tags ) else ( gclient runhooks )
- cd src
- set BUILD_CONFIG_PATH=//electron/build/args/%GN_CONFIG%.gn
- gn gen out/Default "--args=import(\"%BUILD_CONFIG_PATH%\") import(\"%GN_GOMA_FILE%\") %GN_EXTRA_ARGS% "
- gn check out/Default //electron:electron_lib
- gn check out/Default //electron:electron_app
- gn check out/Default //electron/shell/common/api:mojo
- if DEFINED GN_GOMA_FILE (ninja -j 300 -C out/Default electron:electron_app) else (ninja -C out/Default electron:electron_app)
- if "%GN_CONFIG%"=="testing" ( python C:\depot_tools\post_build_ninja_summary.py -C out\Default )
- gn gen out/ffmpeg "--args=import(\"//electron/build/args/ffmpeg.gn\") %GN_EXTRA_ARGS%"
- ninja -C out/ffmpeg electron:electron_ffmpeg_zip
- ninja -C out/Default electron:electron_dist_zip
- ninja -C out/Default shell_browser_ui_unittests
- gn desc out/Default v8:run_mksnapshot_default args > out/Default/default_mksnapshot_args
# Remove unused args from mksnapshot_args
- ps: >-
Get-Content out/Default/default_mksnapshot_args | Where-Object { -not $_.Contains('--turbo-profiling-input') -And -not $_.Contains('builtins-pgo') } | Set-Content out/Default/mksnapshot_args
- ninja -C out/Default electron:electron_mksnapshot_zip
- cd out\Default
- 7z a mksnapshot.zip mksnapshot_args gen\v8\embedded.S
- cd ..\..
- ninja -C out/Default electron:hunspell_dictionaries_zip
- ninja -C out/Default electron:electron_chromedriver_zip
- ninja -C out/Default third_party/electron_node:headers
- python %LOCAL_GOMA_DIR%\goma_ctl.py stat
- ps: >-
Get-CimInstance -Namespace root\cimv2 -Class Win32_product | Select vendor, description, @{l='install_location';e='InstallLocation'}, @{l='install_date';e='InstallDate'}, @{l='install_date_2';e='InstallDate2'}, caption, version, name, @{l='sku_number';e='SKUNumber'} | ConvertTo-Json | Out-File -Encoding utf8 -FilePath .\installed_software.json
- python3 electron/build/profile_toolchain.py --output-json=out/Default/windows_toolchain_profile.json
- 7z a node_headers.zip out\Default\gen\node_headers
- ps: >-
if ($env:GN_CONFIG -eq 'release') {
# Needed for msdia140.dll on 64-bit windows
$env:Path += ";$pwd\third_party\llvm-build\Release+Asserts\bin"
ninja -C out/Default electron:electron_symbols
}
# build time generation of file gen/angle/angle_commit.h depends on
# third_party/angle/.git
# https://chromium-review.googlesource.com/c/angle/angle/+/2074924
$(7z a $zipfile src\third_party\angle\.git)
if ($LASTEXITCODE -ne 0) {
Write-warning "Failed to add third_party\angle\.git; continuing anyway"
- ps: >-
if ($env:GN_CONFIG -eq 'release') {
python3 electron\script\zip-symbols.py
appveyor-retry appveyor PushArtifact out/Default/symbols.zip
} else {
# It's useful to have pdb files when debugging testing builds that are
# built on CI.
7z a pdb.zip out\Default\*.pdb
}
# build time generation of file dawn/common/Version_autogen.h depends on third_party/dawn/.git/HEAD
# https://dawn-review.googlesource.com/c/dawn/+/83901
$(7z a $zipfile src\third_party\dawn\.git)
if ($LASTEXITCODE -ne 0) {
Write-warning "Failed to add third_party\dawn\.git; continuing anyway"
}
}
- cd src
- set BUILD_CONFIG_PATH=//electron/build/args/%GN_CONFIG%.gn
- gn gen out/Default "--args=import(\"%BUILD_CONFIG_PATH%\") import(\"%GN_GOMA_FILE%\") %GN_EXTRA_ARGS% "
- gn check out/Default //electron:electron_lib
- gn check out/Default //electron:electron_app
- gn check out/Default //electron/shell/common/api:mojo
- if DEFINED GN_GOMA_FILE (ninja -j 300 -C out/Default electron:electron_app) else (ninja -C out/Default electron:electron_app)
- if "%GN_CONFIG%"=="testing" ( python C:\depot_tools\post_build_ninja_summary.py -C out\Default )
- gn gen out/ffmpeg "--args=import(\"//electron/build/args/ffmpeg.gn\") %GN_EXTRA_ARGS%"
- ninja -C out/ffmpeg electron:electron_ffmpeg_zip
- ninja -C out/Default electron:electron_dist_zip
- ninja -C out/Default shell_browser_ui_unittests
- gn desc out/Default v8:run_mksnapshot_default args > out/Default/default_mksnapshot_args
- ps: >-
# Remove unused args from mksnapshot_args
- python3 electron/script/zip_manifests/check-zip-manifest.py out/Default/dist.zip electron/script/zip_manifests/dist_zip.win.%TARGET_ARCH%.manifest
Get-Content out/Default/default_mksnapshot_args | Where-Object { -not $_.Contains('--turbo-profiling-input') -And -not $_.Contains('builtins-pgo') } | Set-Content out/Default/mksnapshot_args
- ninja -C out/Default electron:electron_mksnapshot_zip
- cd out\Default
- 7z a mksnapshot.zip mksnapshot_args gen\v8\embedded.S
- cd ..\..
- ninja -C out/Default electron:hunspell_dictionaries_zip
- ninja -C out/Default electron:electron_chromedriver_zip
- ninja -C out/Default third_party/electron_node:headers
- python %LOCAL_GOMA_DIR%\goma_ctl.py stat
- python3 electron/build/profile_toolchain.py --output-json=out/Default/windows_toolchain_profile.json
- 7z a node_headers.zip out\Default\gen\node_headers
- ps: >-
if ($env:GN_CONFIG -eq 'release') {
# Needed for msdia140.dll on 64-bit windows
$env:Path += ";$pwd\third_party\llvm-build\Release+Asserts\bin"
ninja -C out/Default electron:electron_symbols
}
- ps: >-
if ($env:GN_CONFIG -eq 'release') {
python3 electron\script\zip-symbols.py
appveyor-retry appveyor PushArtifact out/Default/symbols.zip
} else {
# It's useful to have pdb files when debugging testing builds that are
# built on CI.
7z a pdb.zip out\Default\*.pdb
}
- python3 electron/script/zip_manifests/check-zip-manifest.py out/Default/dist.zip electron/script/zip_manifests/dist_zip.win.%TARGET_ARCH%.manifest
deploy_script:
- cd electron
- ps: >-
@@ -222,12 +192,10 @@ for:
Write-Output "Uploading Electron release distribution to github releases"
& python3 script\release\uploaders\upload.py --verbose
}
} elseif (Test-Path Env:\TEST_WOA) {
node script/release/ci-release-build.js --job=electron-woa-testing --ci=GHA --appveyorJobId=$env:APPVEYOR_JOB_ID $env:APPVEYOR_REPO_BRANCH
}
on_finish:
# Uncomment this lines to enable RDP
#- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
- cd C:\projects\src
- if exist out\Default\windows_toolchain_profile.json ( appveyor-retry appveyor PushArtifact out\Default\windows_toolchain_profile.json )
- if exist out\Default\dist.zip (appveyor-retry appveyor PushArtifact out\Default\dist.zip)
@@ -241,57 +209,52 @@ for:
- ps: >-
if ((Test-Path "pdb.zip") -And ($env:GN_CONFIG -ne 'release')) {
appveyor-retry appveyor PushArtifact pdb.zip
}
-
matrix:
}
- matrix:
only:
- job_name: Test
init:
- ps: |
if ($env:RUN_TESTS -ne 'true') {
Write-warning "Skipping tests for $env:APPVEYOR_PROJECT_NAME"; Exit-AppveyorBuild
}
if(($env:APPVEYOR_PULL_REQUEST_HEAD_REPO_NAME -split "/")[0] -eq ($env:APPVEYOR_REPO_NAME -split "/")[0]) {
Write-warning "Skipping PR build for branch"; Exit-AppveyorBuild
}
- ps: |
if ($env:RUN_TESTS -ne 'true') {
Write-warning "Skipping tests for $env:APPVEYOR_PROJECT_NAME"; Exit-AppveyorBuild
}
build_script:
- ps: |
node script/yarn.js install --frozen-lockfile
node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER --prBranch=$env:APPVEYOR_REPO_BRANCH
if ($LASTEXITCODE -eq 0) {
Write-warning "Skipping tests for doc only change"; Exit-AppveyorBuild
}
$global:LASTEXITCODE = 0
- ps: |
cd ..
mkdir out\Default
cd ..
# Download build artifacts
$apiUrl = 'https://ci.appveyor.com/api'
$build_info = Invoke-RestMethod -Method Get -Uri "$apiUrl/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/builds/$env:APPVEYOR_BUILD_ID"
$artifacts_to_download = @('dist.zip','shell_browser_ui_unittests.exe','chromedriver.zip','ffmpeg.zip','node_headers.zip','mksnapshot.zip','electron.lib')
foreach ($job in $build_info.build.jobs) {
if ($job.name -eq "Build") {
$jobId = $job.jobId
foreach($artifact_name in $artifacts_to_download) {
if ($artifact_name -eq 'shell_browser_ui_unittests.exe' -Or $artifact_name -eq 'electron.lib') {
$outfile = "src\out\Default\$artifact_name"
} else {
$outfile = $artifact_name
- ps: |
node script/yarn.js install --frozen-lockfile
node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER --prBranch=$env:APPVEYOR_REPO_BRANCH
if ($LASTEXITCODE -eq 0) {
Write-warning "Skipping build for doc only change"; Exit-AppveyorBuild
}
$global:LASTEXITCODE = 0
- cd ..
- mkdir out\Default
- cd ..
- ps: |
# Download build artifacts
$apiUrl = 'https://ci.appveyor.com/api'
$build_info = Invoke-RestMethod -Method Get -Uri "$apiUrl/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/builds/$env:APPVEYOR_BUILD_ID"
$artifacts_to_download = @('dist.zip','shell_browser_ui_unittests.exe','chromedriver.zip','ffmpeg.zip','node_headers.zip','mksnapshot.zip','electron.lib')
foreach ($job in $build_info.build.jobs) {
if ($job.name -eq "Build") {
$jobId = $job.jobId
foreach($artifact_name in $artifacts_to_download) {
if ($artifact_name -eq 'shell_browser_ui_unittests.exe' -Or $artifact_name -eq 'electron.lib') {
$outfile = "src\out\Default\$artifact_name"
} else {
$outfile = $artifact_name
}
Invoke-RestMethod -Method Get -Uri "$apiUrl/buildjobs/$jobId/artifacts/$artifact_name" -OutFile $outfile
}
Invoke-RestMethod -Method Get -Uri "$apiUrl/buildjobs/$jobId/artifacts/$artifact_name" -OutFile $outfile
}
}
}
- ps: |
$out_default_zips = @('dist.zip','chromedriver.zip','mksnapshot.zip')
foreach($zip_name in $out_default_zips) {
7z x -y -osrc\out\Default $zip_name
}
- ps: 7z x -y -osrc\out\ffmpeg ffmpeg.zip
- ps: 7z x -y -osrc node_headers.zip
- ps: |
$out_default_zips = @('dist.zip','chromedriver.zip','mksnapshot.zip')
foreach($zip_name in $out_default_zips) {
7z x -y -osrc\out\Default $zip_name
}
- ps: 7z x -y -osrc\out\ffmpeg ffmpeg.zip
- ps: 7z x -y -osrc node_headers.zip
test_script:
# Workaround for https://github.com/appveyor/ci/issues/2420
@@ -301,15 +264,22 @@ for:
New-Item .\out\Default\gen\node_headers\Release -Type directory
Copy-Item -path .\out\Default\electron.lib -destination .\out\Default\gen\node_headers\Release\node.lib
- cd electron
# Explicitly set npm_config_arch because the .env doesn't persist
- ps: >-
if ($env:TARGET_ARCH -eq 'ia32') {
$env:npm_config_arch = "ia32"
}
- echo Running main test suite & node script/yarn test -- --trace-uncaught --runners=main --enable-logging=file --log-file=%cd%\electron.log
- echo Running native test suite & node script/yarn test -- --trace-uncaught --runners=native --enable-logging=file --log-file=%cd%\electron.log
- cd ..
- echo Verifying non proprietary ffmpeg & python3 electron\script\verify-ffmpeg.py --build-dir out\Default --source-root %cd% --ffmpeg-path out\ffmpeg
- echo Verifying non proprietary ffmpeg & python electron\script\verify-ffmpeg.py --build-dir out\Default --source-root %cd% --ffmpeg-path out\ffmpeg
- echo "About to verify mksnapshot"
- echo Verifying mksnapshot & python3 electron\script\verify-mksnapshot.py --build-dir out\Default --source-root %cd%
- echo Verifying mksnapshot & python electron\script\verify-mksnapshot.py --build-dir out\Default --source-root %cd%
- echo "Done verifying mksnapshot"
- echo Verifying chromedriver & python3 electron\script\verify-chromedriver.py --build-dir out\Default --source-root %cd%
- echo Verifying chromedriver & python electron\script\verify-chromedriver.py --build-dir out\Default --source-root %cd%
- echo "Done verifying chromedriver"
on_finish:
# Uncomment these lines to enable RDP
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
- if exist electron\electron.log ( appveyor-retry appveyor PushArtifact electron\electron.log )

View File

@@ -5,8 +5,6 @@ import sys
import os
import optparse
import json
import re
import subprocess
sys.path.append("%s/../../build" % os.path.dirname(os.path.realpath(__file__)))
@@ -36,56 +34,10 @@ def calculate_hash(root):
return CalculateHash('.', None)
def windows_installed_software():
powershell_command = [
"Get-CimInstance",
"-Namespace",
"root\cimv2",
"-Class",
"Win32_product",
"|",
"Select",
"vendor,",
"description,",
"@{l='install_location';e='InstallLocation'},",
"@{l='install_date';e='InstallDate'},",
"@{l='install_date_2';e='InstallDate2'},",
"caption,",
"version,",
"name,",
"@{l='sku_number';e='SKUNumber'}",
"|",
"ConvertTo-Json",
]
proc = subprocess.Popen(
["powershell.exe", "-Command", "-"],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
)
stdout, _ = proc.communicate(" ".join(powershell_command).encode("utf-8"))
if proc.returncode != 0:
raise RuntimeError("Failed to get list of installed software")
# On AppVeyor there's other output related to PSReadline,
# so grab only the JSON output and ignore everything else
json_match = re.match(
r".*(\[.*{.*}.*\]).*", stdout.decode("utf-8"), re.DOTALL
)
if not json_match:
raise RuntimeError(
"Couldn't find JSON output for list of installed software"
)
# Filter out missing keys
return list(
map(
lambda info: {k: info[k] for k in info if info[k]},
json.loads(json_match.group(1)),
)
)
# file_path = os.path.join(os.getcwd(), 'installed_software.json')
# return json.loads(open('installed_software.json').read().decode('utf-8'))
f = open('installed_software.json', encoding='utf-8-sig')
return json.load(f)
def windows_profile():

View File

@@ -1869,7 +1869,7 @@ removed in future Electron releases.
On a Window with Window Controls Overlay already enabled, this method updates
the style of the title bar overlay.
[runtime-enabled-features]: https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/runtime_enabled_features.json5?l=70
[runtime-enabled-features]: https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/runtime_enabled_features.json5
[page-visibility-api]: https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API
[quick-look]: https://en.wikipedia.org/wiki/Quick_Look
[vibrancy-docs]: https://developer.apple.com/documentation/appkit/nsvisualeffectview?preferredLanguage=objc

View File

@@ -405,7 +405,7 @@ Clears the sessions HTTP cache.
* `origin` string (optional) - Should follow `window.location.origin`s representation
`scheme://host:port`.
* `storages` string[] (optional) - The types of storages to clear, can contain:
`appcache`, `cookies`, `filesystem`, `indexdb`, `localstorage`,
`cookies`, `filesystem`, `indexdb`, `localstorage`,
`shadercache`, `websql`, `serviceworkers`, `cachestorage`. If not
specified, clear all storage types.
* `quotas` string[] (optional) - The types of quotas to clear, can contain:
@@ -638,6 +638,7 @@ win.webContents.session.setCertificateVerifyProc((request, callback) => {
* `pointerLock` - Request to directly interpret mouse movements as an input method. Click [here](https://developer.mozilla.org/en-US/docs/Web/API/Pointer_Lock_API) to know more. These requests always appear to originate from the main frame.
* `fullscreen` - Request for the app to enter fullscreen mode.
* `openExternal` - Request to open links in external applications.
* `window-placement` - Request access to enumerate screens using the [`getScreenDetails`](https://developer.chrome.com/en/articles/multi-screen-window-placement/) API.
* `unknown` - An unrecognized permission request
* `callback` Function
* `permissionGranted` boolean - Allow or deny the permission.

View File

@@ -1,6 +1,7 @@
# Display Object
* `id` number - Unique identifier associated with the display.
* `label` string - User-friendly label, determined by the platform.
* `rotation` number - Can be 0, 90, 180, 270, represents screen rotation in
clock-wise degrees.
* `scaleFactor` number - Output device's pixel scale factor.

View File

@@ -1020,7 +1020,7 @@ Emitted when DevTools is closed.
Emitted when DevTools is focused / opened.
[runtime-enabled-features]: https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/runtime_enabled_features.json5?l=70
[runtime-enabled-features]: https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/runtime_enabled_features.json5
[chrome-webview]: https://developer.chrome.com/docs/extensions/reference/webviewTag/
### Event: 'context-menu'

View File

@@ -18,8 +18,8 @@ See also [V8 Development](v8-development.md)
### Code Resources
- [Code Search](https://cs.chromium.org/) - Indexed and searchable source code for Chromium and associated projects.
- [Source Code](https://cs.chromium.org/chromium/src/) - The source code for Chromium itself.
- [Code Search](https://source.chromium.org/chromium) - Indexed and searchable source code for Chromium and associated projects.
- [Source Code](https://source.chromium.org/chromium/chromium/src) - The source code for Chromium itself.
- [Chromium Review](https://chromium-review.googlesource.com) - The searchable code host which facilitates code reviews for Chromium and related projects.
### Informational Resources

View File

@@ -144,7 +144,7 @@ NODE_LINKED_MODULE_CONTEXT_AWARE(electron_browser_{api_name},Initialize)
In your [`shell/common/node_bindings.cc`](https://github.com/electron/electron/blob/main/shell/common/node_bindings.cc) file, add your node binding name to Electron's built-in modules.
```cpp title='shell/common/node_bindings.cc'
#define ELECTRON_BUILTIN_MODULES(V) \
#define ELECTRON_BROWSER_MODULES(V) \
V(electron_browser_{api_name})
```

View File

@@ -623,11 +623,11 @@ export const wrapFsWithAsar = (fs: Record<string, any>) => {
};
const { readdir } = fs;
fs.readdir = function (pathArgument: string, options: { encoding?: string | null; withFileTypes?: boolean } = {}, callback?: Function) {
fs.readdir = function (pathArgument: string, options?: { encoding?: string | null; withFileTypes?: boolean } | null, callback?: Function) {
const pathInfo = splitPath(pathArgument);
if (typeof options === 'function') {
callback = options;
options = {};
options = undefined;
}
if (!pathInfo.isAsar) return readdir.apply(this, arguments);
const { asarPath, filePath } = pathInfo;
@@ -646,7 +646,7 @@ export const wrapFsWithAsar = (fs: Record<string, any>) => {
return;
}
if (options.withFileTypes) {
if (options && options.withFileTypes) {
const dirents = [];
for (const file of files) {
const childPath = path.join(filePath, file);

View File

@@ -21,8 +21,9 @@ global.module = new Module('electron/js2c/worker_init');
global.require = makeRequireFunction(global.module);
// Set the __filename to the path of html file if it is file: protocol.
if (self.location.protocol === 'file:') {
const pathname = process.platform === 'win32' && self.location.pathname[0] === '/' ? self.location.pathname.substr(1) : self.location.pathname;
// NB. 'self' isn't defined in an AudioWorklet.
if (typeof self !== 'undefined' && self.location.protocol === 'file:') {
const pathname = process.platform === 'win32' && self.location && self.location.pathname[0] === '/' ? self.location.pathname.substr(1) : self.location.pathname;
global.__filename = path.normalize(decodeURIComponent(pathname));
global.__dirname = path.dirname(global.__filename);

View File

@@ -7,8 +7,8 @@
"@azure/storage-blob": "^12.9.0",
"@electron/asar": "^3.2.1",
"@electron/docs-parser": "^1.0.0",
"@electron/github-app-auth": "^1.5.0",
"@electron/typescript-definitions": "^8.10.0",
"@octokit/auth-app": "^2.10.0",
"@octokit/rest": "^18.0.3",
"@primer/octicons": "^10.0.0",
"@types/basic-auth": "^1.1.3",

View File

@@ -140,3 +140,9 @@ cherry-pick-d1d654d73222.patch
cherry-pick-77208afba04d.patch
cherry-pick-65ad70274d4b.patch
cherry-pick-819d876e1bb8.patch
mojo_disable_sync_call_interrupts_in_the_browser.patch
mojo_validate_that_a_message_is_allowed_to_use_the_sync_flag.patch
cherry-pick-43637378b14e.patch
cherry-pick-57c54ae221d6.patch
cherry-pick-ca2b108a0f1f.patch
cherry-pick-d652130c4bc2.patch

View File

@@ -0,0 +1,104 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Maks Orlovich <morlovich@chromium.org>
Date: Tue, 22 Nov 2022 22:18:55 +0000
Subject: Align NetworkContext::SetNetworkConditions better with devtools
emulateNetworkConditions
The former used values of 0 to disable particular throttles, while the
later documents -1, and looks to be pretty much a direct client, and the
only one. So make NetworkService handle everything <= 0 as a disable,
clamping at intake of config.
Bug: 1382033
(cherry picked from commit ce463c2c939818a12bbcec5e2c91c35f2a0a1f0e)
Change-Id: I2fd3f075d5071cb0cf647838782115b5c00405bf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4035891
Reviewed-by: Ken Buchanan <kenrb@chromium.org>
Reviewed-by: Eric Orth <ericorth@chromium.org>
Commit-Queue: Maks Orlovich <morlovich@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#1073566}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4048289
Cr-Commit-Position: refs/branch-heads/5414@{#188}
Cr-Branched-From: 4417ee59d7bf6df7a9c9ea28f7722d2ee6203413-refs/heads/main@{#1070088}
diff --git a/services/network/public/mojom/network_context.mojom b/services/network/public/mojom/network_context.mojom
index 105011c25861fe00cc8e72fe8f310ee5118725c3..86535284fedeb875b4958322fdddaa52507cfbaa 100644
--- a/services/network/public/mojom/network_context.mojom
+++ b/services/network/public/mojom/network_context.mojom
@@ -561,11 +561,11 @@ struct NetworkConditions {
// response received.
mojo_base.mojom.TimeDelta latency;
- // Maximal aggregated download throughput (bytes/sec). 0 disables download
+ // Maximal aggregated download throughput (bytes/sec). <=0 disables download
// throttling.
double download_throughput;
- // Maximal aggregated upload throughput (bytes/sec). 0 disables upload
+ // Maximal aggregated upload throughput (bytes/sec). <=0 disables upload
// throttling.
double upload_throughput;
};
diff --git a/services/network/throttling/network_conditions.cc b/services/network/throttling/network_conditions.cc
index 71cd4ac0e52cc1f262c5b58caf20448b57b6b64f..18b2b6e0efdc2e17dbbbfaa411b4ab49ec787bc4 100644
--- a/services/network/throttling/network_conditions.cc
+++ b/services/network/throttling/network_conditions.cc
@@ -4,6 +4,8 @@
#include "services/network/throttling/network_conditions.h"
+#include <algorithm>
+
namespace network {
NetworkConditions::NetworkConditions() : NetworkConditions(false) {}
@@ -16,9 +18,9 @@ NetworkConditions::NetworkConditions(bool offline,
double download_throughput,
double upload_throughput)
: offline_(offline),
- latency_(latency),
- download_throughput_(download_throughput),
- upload_throughput_(upload_throughput) {}
+ latency_(std::max(latency, 0.0)),
+ download_throughput_(std::max(download_throughput, 0.0)),
+ upload_throughput_(std::max(upload_throughput, 0.0)) {}
NetworkConditions::~NetworkConditions() {}
diff --git a/services/network/throttling/network_conditions.h b/services/network/throttling/network_conditions.h
index f8c8214b34bafcb1f656dd3a39a0cf17fea821ea..c5232231d308b09105234101f4bc575491505372 100644
--- a/services/network/throttling/network_conditions.h
+++ b/services/network/throttling/network_conditions.h
@@ -28,6 +28,8 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) NetworkConditions {
bool IsThrottling() const;
bool offline() const { return offline_; }
+
+ // These are 0 if the corresponding throttle is disabled, >0 otherwise.
double latency() const { return latency_; }
double download_throughput() const { return download_throughput_; }
double upload_throughput() const { return upload_throughput_; }
diff --git a/services/network/throttling/throttling_controller_unittest.cc b/services/network/throttling/throttling_controller_unittest.cc
index fbe2c6d20d1d5362a77bd951e87b3fe41be13098..e834f8bdc13b5691b1e458dcafead482a0537e14 100644
--- a/services/network/throttling/throttling_controller_unittest.cc
+++ b/services/network/throttling/throttling_controller_unittest.cc
@@ -297,7 +297,7 @@ TEST(ThrottlingControllerTest, DownloadOnly) {
ThrottlingControllerTestHelper helper;
TestCallback* callback = helper.callback();
- helper.SetNetworkState(false, 10000000, 0);
+ helper.SetNetworkState(false, 10000000, -1);
int rv = helper.Start(false);
EXPECT_EQ(rv, net::ERR_IO_PENDING);
helper.FastForwardUntilNoTasksRemain();
@@ -316,7 +316,7 @@ TEST(ThrottlingControllerTest, UploadOnly) {
ThrottlingControllerTestHelper helper;
TestCallback* callback = helper.callback();
- helper.SetNetworkState(false, 0, 1000000);
+ helper.SetNetworkState(false, -2, 1000000);
int rv = helper.Start(true);
EXPECT_EQ(rv, net::OK);
helper.FastForwardUntilNoTasksRemain();

View File

@@ -0,0 +1,97 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Victor Vasiliev <vasilvv@chromium.org>
Date: Wed, 21 Dec 2022 17:26:42 +0000
Subject: Ensure clean destruction of network::WebTransport
Once the destruction of the object begins, we should not process any
callbacks, nor should we attempt to reset the streams on a connection
that is already being closed.
Bug: 1376354
Change-Id: Ib49e0ce0b177062cccd0e52368782e291cf8166c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4117501
Reviewed-by: Eric Orth <ericorth@chromium.org>
Commit-Queue: Victor Vasiliev <vasilvv@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1085965}
diff --git a/services/network/web_transport.cc b/services/network/web_transport.cc
index fd62b83d43052d9d588a211b59e46a6c25ffeb76..534954181abcd7c4cf11eade64a2aa97c62785cc 100644
--- a/services/network/web_transport.cc
+++ b/services/network/web_transport.cc
@@ -177,7 +177,7 @@ class WebTransport::Stream final {
~Stream() {
auto* stream = incoming_ ? incoming_.get() : outgoing_.get();
- if (!stream) {
+ if (!stream || transport_->closing_ || transport_->torn_down_) {
return;
}
stream->MaybeResetDueToStreamObjectGone();
@@ -399,7 +399,10 @@ WebTransport::WebTransport(
transport_->Connect();
}
-WebTransport::~WebTransport() = default;
+WebTransport::~WebTransport() {
+ // Ensure that we ignore all callbacks while mid-destruction.
+ torn_down_ = true;
+}
void WebTransport::SendDatagram(base::span<const uint8_t> data,
base::OnceCallback<void(bool)> callback) {
diff --git a/services/network/web_transport_unittest.cc b/services/network/web_transport_unittest.cc
index ffac5c19f9d154b91eb6aeac1e19a62277e4e7e8..46deb561091232fe64950be01e9157c8d891f111 100644
--- a/services/network/web_transport_unittest.cc
+++ b/services/network/web_transport_unittest.cc
@@ -611,6 +611,51 @@ TEST_F(WebTransportTest, EchoOnUnidirectionalStreams) {
EXPECT_EQ(0u, resets_sent.size());
}
+TEST_F(WebTransportTest, DeleteClientWithStreamsOpen) {
+ base::RunLoop run_loop_for_handshake;
+ mojo::PendingRemote<mojom::WebTransportHandshakeClient> handshake_client;
+ TestHandshakeClient test_handshake_client(
+ handshake_client.InitWithNewPipeAndPassReceiver(),
+ run_loop_for_handshake.QuitClosure());
+
+ CreateWebTransport(GetURL("/echo"),
+ url::Origin::Create(GURL("https://example.org/")),
+ std::move(handshake_client));
+
+ run_loop_for_handshake.Run();
+
+ ASSERT_TRUE(test_handshake_client.has_seen_connection_establishment());
+
+ TestClient client(test_handshake_client.PassClientReceiver());
+ mojo::Remote<mojom::WebTransport> transport_remote(
+ test_handshake_client.PassTransport());
+
+ constexpr int kNumStreams = 10;
+ auto writable_for_outgoing =
+ std::make_unique<mojo::ScopedDataPipeProducerHandle[]>(kNumStreams);
+ for (int i = 0; i < kNumStreams; i++) {
+ const MojoCreateDataPipeOptions options = {
+ sizeof(options), MOJO_CREATE_DATA_PIPE_FLAG_NONE, 1, 4 * 1024};
+ mojo::ScopedDataPipeConsumerHandle readable_for_outgoing;
+ ASSERT_EQ(MOJO_RESULT_OK,
+ mojo::CreateDataPipe(&options, writable_for_outgoing[i],
+ readable_for_outgoing));
+ base::RunLoop run_loop_for_stream_creation;
+ bool stream_created;
+ transport_remote->CreateStream(
+ std::move(readable_for_outgoing),
+ /*writable=*/{},
+ base::BindLambdaForTesting([&](bool b, uint32_t /*id*/) {
+ stream_created = b;
+ run_loop_for_stream_creation.Quit();
+ }));
+ run_loop_for_stream_creation.Run();
+ ASSERT_TRUE(stream_created);
+ }
+
+ // Keep the streams open so that they are closed via destructor.
+}
+
// crbug.com/1129847: disabled because it is flaky.
TEST_F(WebTransportTest, DISABLED_EchoOnBidirectionalStream) {
base::RunLoop run_loop_for_handshake;

View File

@@ -0,0 +1,116 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Harald Alvestrand <hta@chromium.org>
Date: Wed, 18 Jan 2023 08:02:48 +0000
Subject: Delete PeerConnectionHandler in PeerConnection finalizer
Also guard against removal of PC during PeerConnectionHandler
call that may cause garbage collection.
(cherry picked from commit 5066dd66309d884762e5fb9be04b59582893d09a)
Bug: chromium:1405256
Change-Id: I9adf7b219e2026e07ccc0868c1a85f3b35cd9d26
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4154578
Commit-Queue: Harald Alvestrand <hta@chromium.org>
Reviewed-by: Guido Urdaneta <guidou@chromium.org>
Commit-Queue: Guido Urdaneta <guidou@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#1091801}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4176372
Auto-Submit: Harald Alvestrand <hta@chromium.org>
Cr-Commit-Position: refs/branch-heads/5481@{#418}
Cr-Branched-From: 130f3e4d850f4bc7387cfb8d08aa993d288a67a9-refs/heads/main@{#1084008}
diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection.cc b/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection.cc
index 6da9e3f038869f204074aabfd8ec8a0dbc659ab6..ec4b8985b5fb072ea98f4c36a3d0b341000d96ad 100644
--- a/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection.cc
+++ b/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection.cc
@@ -741,10 +741,11 @@ RTCPeerConnection::~RTCPeerConnection() {
}
void RTCPeerConnection::Dispose() {
- // Promptly clears the handler's pointer to |this|
+ // Promptly clears the handler
// so that content/ doesn't access it in a lazy sweeping phase.
+ // Other references to the handler use a weak pointer, preventing access.
if (peer_handler_) {
- peer_handler_->CloseAndUnregister();
+ peer_handler_.reset();
}
}
diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection_handler.cc b/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection_handler.cc
index 8166a6fa6c9aff9d724200cbbfac189d3f887735..ee694f5820b4947dc5815a5dd2f41ecfd1c9cb4c 100644
--- a/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection_handler.cc
+++ b/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection_handler.cc
@@ -806,6 +806,8 @@ class RTCPeerConnectionHandler::WebRtcSetDescriptionObserverImpl
if (handler_) {
handler_->OnModifySctpTransport(std::move(states.sctp_transport_state));
}
+ // Since OnSessionDescriptionsUpdated can fire events, it may cause
+ // garbage collection. Ensure that handler_ is still valid.
if (handler_) {
handler_->OnModifyTransceivers(
states.signaling_state, std::move(states.transceiver_states),
@@ -1160,6 +1162,8 @@ bool RTCPeerConnectionHandler::Initialize(
CHECK(!initialize_called_);
initialize_called_ = true;
+ // Prevent garbage collection of client_ during processing.
+ auto* client_on_stack = client_;
peer_connection_tracker_ = PeerConnectionTracker::From(*frame);
configuration_ = server_configuration;
@@ -1198,8 +1202,8 @@ bool RTCPeerConnectionHandler::Initialize(
peer_connection_tracker_->RegisterPeerConnection(this, configuration_,
frame_);
}
-
- return true;
+ // Gratuitous usage of client_on_stack to prevent compiler errors.
+ return !!client_on_stack;
}
bool RTCPeerConnectionHandler::InitializeForTest(
@@ -2259,9 +2263,11 @@ void RTCPeerConnectionHandler::OnSessionDescriptionsUpdated(
pending_remote_description,
std::unique_ptr<webrtc::SessionDescriptionInterface>
current_remote_description) {
+ // Prevent garbage collection of client_ during processing.
+ auto* client_on_stack = client_;
if (!client_ || is_closed_)
return;
- client_->DidChangeSessionDescriptions(
+ client_on_stack->DidChangeSessionDescriptions(
pending_local_description
? CreateWebKitSessionDescription(pending_local_description.get())
: nullptr,
@@ -2573,8 +2579,12 @@ void RTCPeerConnectionHandler::OnIceCandidate(const String& sdp,
int sdp_mline_index,
int component,
int address_family) {
+ // In order to ensure that the RTCPeerConnection is not garbage collected
+ // from under the function, we keep a pointer to it on the stack.
+ auto* client_on_stack = client_;
DCHECK(task_runner_->RunsTasksInCurrentSequence());
TRACE_EVENT0("webrtc", "RTCPeerConnectionHandler::OnIceCandidateImpl");
+ // This line can cause garbage collection.
auto* platform_candidate = MakeGarbageCollected<RTCIceCandidatePlatform>(
sdp, sdp_mid, sdp_mline_index);
if (peer_connection_tracker_) {
@@ -2594,7 +2604,7 @@ void RTCPeerConnectionHandler::OnIceCandidate(const String& sdp,
}
}
if (!is_closed_)
- client_->DidGenerateICECandidate(platform_candidate);
+ client_on_stack->DidGenerateICECandidate(platform_candidate);
}
void RTCPeerConnectionHandler::OnIceCandidateError(
@@ -2606,7 +2616,6 @@ void RTCPeerConnectionHandler::OnIceCandidateError(
const String& error_text) {
DCHECK(task_runner_->RunsTasksInCurrentSequence());
TRACE_EVENT0("webrtc", "RTCPeerConnectionHandler::OnIceCandidateError");
-
if (peer_connection_tracker_) {
peer_connection_tracker_->TrackIceCandidateError(
this, address, port, host_candidate, url, error_code, error_text);

View File

@@ -0,0 +1,31 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Vasiliy Telezhnikov <vasilyt@chromium.org>
Date: Mon, 16 Jan 2023 17:43:34 +0000
Subject: Remove NUM_COMMAND_BUFFER_NAMESPACES from SyncToken.mojom
Mojo validates input for allowed values, NUM_COMMAND_BUFFER_NAMESPACES
is not valid value to send over ipc and is used only to know maximum
value in code.
Bug: 1406115
Change-Id: I8e5c3b6b2a9a9206fbeb377b27ceb1242a4f54e2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4167409
Reviewed-by: danakj <danakj@chromium.org>
Commit-Queue: Vasiliy Telezhnikov <vasilyt@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1093100}
diff --git a/gpu/ipc/common/sync_token.mojom b/gpu/ipc/common/sync_token.mojom
index 7c957007e3a377bd1e9969f14d9edc80c7d76645..b24017647aa6a11080580dd48e4c3d1cd79d1cf3 100644
--- a/gpu/ipc/common/sync_token.mojom
+++ b/gpu/ipc/common/sync_token.mojom
@@ -11,9 +11,7 @@ enum CommandBufferNamespace {
GPU_IO,
IN_PROCESS,
MOJO,
- MOJO_LOCAL,
-
- NUM_COMMAND_BUFFER_NAMESPACES
+ MOJO_LOCAL
};
// See gpu/command_buffer/common/sync_token.h

View File

@@ -0,0 +1,536 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ken Rockot <rockot@google.com>
Date: Thu, 10 Nov 2022 03:24:17 +0000
Subject: Mojo: Disable sync call interrupts in the browser
This changes the default Mojo sync call behavior in the browser process
to prevent any blocking sync calls from being interrupted by other
incoming sync IPC dispatches.
(cherry picked from commit b6f921260e0e763db7a72de9c7a3f0f78a99f21f)
Bug: 1376099
Change-Id: I53681ef379fdd3c2bfc37d7e16b3de17acad5d20
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3989408
Commit-Queue: Ken Rockot <rockot@google.com>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#1065369}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4018257
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Auto-Submit: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Ken Rockot <rockot@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/branch-heads/5359@{#719}
Cr-Branched-From: 27d3765d341b09369006d030f83f582a29eb57ae-refs/heads/main@{#1058933}
diff --git a/content/app/content_main_runner_impl.cc b/content/app/content_main_runner_impl.cc
index a3e5764a1920c8a6bf1ce21e02d0ac743b027a40..ce8b70cc792b2ae45624840e0f71270f85f00836 100644
--- a/content/app/content_main_runner_impl.cc
+++ b/content/app/content_main_runner_impl.cc
@@ -93,6 +93,7 @@
#include "media/media_buildflags.h"
#include "mojo/core/embedder/embedder.h"
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
+#include "mojo/public/cpp/bindings/sync_call_restrictions.h"
#include "mojo/public/cpp/platform/platform_channel.h"
#include "mojo/public/cpp/system/dynamic_library_support.h"
#include "mojo/public/cpp/system/invitation.h"
@@ -1083,6 +1084,11 @@ int ContentMainRunnerImpl::RunBrowser(MainFunctionParams main_params,
if (is_browser_main_loop_started_)
return -1;
+ if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kSingleProcess)) {
+ mojo::SyncCallRestrictions::DisableSyncCallInterrupts();
+ }
+
if (!mojo_ipc_support_) {
const ContentMainDelegate::InvokedInBrowserProcess invoked_in_browser{
.is_running_test = !main_params.ui_task.is_null()};
diff --git a/ipc/ipc_mojo_bootstrap.cc b/ipc/ipc_mojo_bootstrap.cc
index eb8fa358b0a72eea2e294c531549da5fc81f394c..8c13ef236ba6f7cf05584cffba522a3cb54536c9 100644
--- a/ipc/ipc_mojo_bootstrap.cc
+++ b/ipc/ipc_mojo_bootstrap.cc
@@ -16,13 +16,15 @@
#include "base/bind.h"
#include "base/callback.h"
#include "base/check_op.h"
+#include "base/containers/circular_deque.h"
#include "base/containers/contains.h"
-#include "base/containers/queue.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/no_destructor.h"
+#include "base/ranges/algorithm.h"
#include "base/strings/stringprintf.h"
#include "base/synchronization/lock.h"
+#include "base/synchronization/waitable_event.h"
#include "base/task/common/task_annotator.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/single_thread_task_runner.h"
@@ -48,6 +50,7 @@
#include "mojo/public/cpp/bindings/pipe_control_message_proxy.h"
#include "mojo/public/cpp/bindings/sequence_local_sync_event_watcher.h"
#include "mojo/public/cpp/bindings/tracing_helpers.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace IPC {
@@ -466,6 +469,11 @@ class ChannelAssociatedGroupController
return *this;
}
+ bool HasRequestId(uint64_t request_id) {
+ return !value_.IsNull() && value_.version() >= 1 &&
+ value_.header_v1()->request_id == request_id;
+ }
+
mojo::Message& value() { return value_; }
private:
@@ -557,10 +565,15 @@ class ChannelAssociatedGroupController
sync_watcher_.reset();
}
- uint32_t EnqueueSyncMessage(MessageWrapper message) {
+ absl::optional<uint32_t> EnqueueSyncMessage(MessageWrapper message) {
controller_->lock_.AssertAcquired();
+ if (exclusive_wait_ && exclusive_wait_->TryFulfillingWith(message)) {
+ exclusive_wait_ = nullptr;
+ return absl::nullopt;
+ }
+
uint32_t id = GenerateSyncMessageId();
- sync_messages_.emplace(id, std::move(message));
+ sync_messages_.emplace_back(id, std::move(message));
SignalSyncMessageEvent();
return id;
}
@@ -577,7 +590,7 @@ class ChannelAssociatedGroupController
if (sync_messages_.empty() || sync_messages_.front().first != id)
return MessageWrapper();
MessageWrapper message = std::move(sync_messages_.front().second);
- sync_messages_.pop();
+ sync_messages_.pop_front();
return message;
}
@@ -607,10 +620,38 @@ class ChannelAssociatedGroupController
return sync_watcher_->SyncWatch(&should_stop);
}
+ MessageWrapper WaitForIncomingSyncReply(uint64_t request_id) {
+ absl::optional<ExclusiveSyncWait> wait;
+ {
+ base::AutoLock lock(controller_->lock_);
+ for (auto& [id, message] : sync_messages_) {
+ if (message.HasRequestId(request_id)) {
+ return std::move(message);
+ }
+ }
+
+ DCHECK(!exclusive_wait_);
+ wait.emplace(request_id);
+ exclusive_wait_ = &wait.value();
+ }
+
+ wait->event.Wait();
+ return std::move(wait->message);
+ }
+
bool SyncWatchExclusive(uint64_t request_id) override {
- // We don't support exclusive waits on Channel-associated interfaces.
- NOTREACHED();
- return false;
+ MessageWrapper message = WaitForIncomingSyncReply(request_id);
+ if (message.value().IsNull() || !client_) {
+ return false;
+ }
+
+ if (!client_->HandleIncomingMessage(&message.value())) {
+ base::AutoLock locker(controller_->lock_);
+ controller_->RaiseError();
+ return false;
+ }
+
+ return true;
}
void RegisterExternalSyncWaiter(uint64_t request_id) override {}
@@ -624,6 +665,9 @@ class ChannelAssociatedGroupController
DCHECK(closed_);
DCHECK(peer_closed_);
DCHECK(!sync_watcher_);
+ if (exclusive_wait_) {
+ exclusive_wait_->event.Signal();
+ }
}
void OnSyncMessageEventReady() {
@@ -640,7 +684,7 @@ class ChannelAssociatedGroupController
if (!sync_messages_.empty()) {
MessageWrapper message_wrapper =
std::move(sync_messages_.front().second);
- sync_messages_.pop();
+ sync_messages_.pop_front();
bool dispatch_succeeded;
mojo::InterfaceEndpointClient* client = client_;
@@ -688,6 +732,28 @@ class ChannelAssociatedGroupController
return id;
}
+ // Tracks the state of a pending sync wait which excludes all other incoming
+ // IPC on the waiting thread.
+ struct ExclusiveSyncWait {
+ explicit ExclusiveSyncWait(uint64_t request_id)
+ : request_id(request_id) {}
+ ~ExclusiveSyncWait() = default;
+
+ bool TryFulfillingWith(MessageWrapper& wrapper) {
+ if (!wrapper.HasRequestId(request_id)) {
+ return false;
+ }
+
+ message = std::move(wrapper);
+ event.Signal();
+ return true;
+ }
+
+ uint64_t request_id;
+ base::WaitableEvent event;
+ MessageWrapper message;
+ };
+
const raw_ptr<ChannelAssociatedGroupController> controller_;
const mojo::InterfaceId id_;
@@ -699,7 +765,8 @@ class ChannelAssociatedGroupController
raw_ptr<mojo::InterfaceEndpointClient> client_ = nullptr;
scoped_refptr<base::SequencedTaskRunner> task_runner_;
std::unique_ptr<mojo::SequenceLocalSyncEventWatcher> sync_watcher_;
- base::queue<std::pair<uint32_t, MessageWrapper>> sync_messages_;
+ base::circular_deque<std::pair<uint32_t, MessageWrapper>> sync_messages_;
+ ExclusiveSyncWait* exclusive_wait_ = nullptr;
uint32_t next_sync_message_id_ = 0;
};
@@ -932,12 +999,15 @@ class ChannelAssociatedGroupController
// sync message queue. If the endpoint was blocking, it will dequeue the
// message and dispatch it. Otherwise the posted |AcceptSyncMessage()|
// call will dequeue the message and dispatch it.
- uint32_t message_id =
+ absl::optional<uint32_t> message_id =
endpoint->EnqueueSyncMessage(std::move(message_wrapper));
- task_runner->PostTask(
- FROM_HERE,
- base::BindOnce(&ChannelAssociatedGroupController::AcceptSyncMessage,
- this, id, message_id));
+ if (message_id) {
+ task_runner->PostTask(
+ FROM_HERE,
+ base::BindOnce(
+ &ChannelAssociatedGroupController::AcceptSyncMessage, this,
+ id, *message_id));
+ }
return true;
}
diff --git a/mojo/public/cpp/bindings/interface_endpoint_controller.h b/mojo/public/cpp/bindings/interface_endpoint_controller.h
index 89dbe39994620148e0ef33910b7cc7baacd7cc2e..8649abe1ac9c4b964c2bf833b850aa6f898b7103 100644
--- a/mojo/public/cpp/bindings/interface_endpoint_controller.h
+++ b/mojo/public/cpp/bindings/interface_endpoint_controller.h
@@ -36,6 +36,10 @@ class InterfaceEndpointController {
// Watches the endpoint for a specific incoming sync reply. This method only
// returns true once the reply is received, or false if the endpoint is
// detached or destroyed beforehand.
+ //
+ // Unlike with SyncWatch(), no other IPCs (not even other sync IPCs) can be
+ // dispatched to the calling thread while SyncWatchExclusive() is waiting on
+ // the reply for `request_id`.
virtual bool SyncWatchExclusive(uint64_t request_id) = 0;
// Notifies the controller that a specific in-flight sync message identified
diff --git a/mojo/public/cpp/bindings/lib/interface_endpoint_client.cc b/mojo/public/cpp/bindings/lib/interface_endpoint_client.cc
index 1830df7354d7dfa007cca97ddc346db0165098b7..c4ddc89cd9d0894814d64856179539f0d757a388 100644
--- a/mojo/public/cpp/bindings/lib/interface_endpoint_client.cc
+++ b/mojo/public/cpp/bindings/lib/interface_endpoint_client.cc
@@ -389,7 +389,9 @@ void ThreadSafeInterfaceEndpointClientProxy::SendMessageWithResponder(
}
// If the Remote is bound on another sequence, post the call.
- const bool allow_interrupt = !message.has_flag(Message::kFlagNoInterrupt);
+ const bool allow_interrupt =
+ SyncCallRestrictions::AreSyncCallInterruptsEnabled() &&
+ !message.has_flag(Message::kFlagNoInterrupt);
auto response = base::MakeRefCounted<SyncResponseInfo>();
auto response_signaler = std::make_unique<SyncResponseSignaler>(response);
task_runner_->PostTask(
@@ -627,7 +629,9 @@ bool InterfaceEndpointClient::SendMessageWithResponder(
const uint32_t message_name = message->name();
const bool is_sync = message->has_flag(Message::kFlagIsSync);
- const bool exclusive_wait = message->has_flag(Message::kFlagNoInterrupt);
+ const bool exclusive_wait =
+ message->has_flag(Message::kFlagNoInterrupt) ||
+ !SyncCallRestrictions::AreSyncCallInterruptsEnabled();
if (!controller_->SendMessage(message))
return false;
diff --git a/mojo/public/cpp/bindings/lib/sync_call_restrictions.cc b/mojo/public/cpp/bindings/lib/sync_call_restrictions.cc
index 329901dec12572e8d8833eba33ad1cc793919084..6242391074ee6279cfea29cf1e73ac4ef874445a 100644
--- a/mojo/public/cpp/bindings/lib/sync_call_restrictions.cc
+++ b/mojo/public/cpp/bindings/lib/sync_call_restrictions.cc
@@ -4,8 +4,6 @@
#include "mojo/public/cpp/bindings/sync_call_restrictions.h"
-#if ENABLE_SYNC_CALL_RESTRICTIONS
-
#include "base/check_op.h"
#include "base/debug/leak_annotations.h"
#include "base/logging.h"
@@ -19,6 +17,11 @@ namespace mojo {
namespace {
+// Sync call interrupts are enabled by default.
+bool g_enable_sync_call_interrupts = true;
+
+#if ENABLE_SYNC_CALL_RESTRICTIONS
+
class GlobalSyncCallSettings {
public:
GlobalSyncCallSettings() = default;
@@ -61,8 +64,12 @@ bool SyncCallRestrictionsEnforceable() {
return base::internal::SequenceLocalStorageMap::IsSetForCurrentThread();
}
+#endif // ENABLE_SYNC_CALL_RESTRICTIONS
+
} // namespace
+#if ENABLE_SYNC_CALL_RESTRICTIONS
+
// static
void SyncCallRestrictions::AssertSyncCallAllowed() {
if (GetGlobalSettings().sync_call_allowed_by_default() ||
@@ -102,6 +109,21 @@ void SyncCallRestrictions::DecreaseScopedAllowCount() {
--GetSequenceLocalScopedAllowCount();
}
-} // namespace mojo
-
#endif // ENABLE_SYNC_CALL_RESTRICTIONS
+
+// static
+void SyncCallRestrictions::DisableSyncCallInterrupts() {
+ g_enable_sync_call_interrupts = false;
+}
+
+// static
+void SyncCallRestrictions::EnableSyncCallInterruptsForTesting() {
+ g_enable_sync_call_interrupts = true;
+}
+
+// static
+bool SyncCallRestrictions::AreSyncCallInterruptsEnabled() {
+ return g_enable_sync_call_interrupts;
+}
+
+} // namespace mojo
diff --git a/mojo/public/cpp/bindings/sync_call_restrictions.h b/mojo/public/cpp/bindings/sync_call_restrictions.h
index e7e67ee824b2a87eb14b45a3f2d76d471ff864fb..1653fd63033383b40b643c03500b26bdc65a44a6 100644
--- a/mojo/public/cpp/bindings/sync_call_restrictions.h
+++ b/mojo/public/cpp/bindings/sync_call_restrictions.h
@@ -86,6 +86,20 @@ class COMPONENT_EXPORT(MOJO_CPP_BINDINGS) SyncCallRestrictions {
static void DisallowSyncCall() {}
#endif
+ // Globally disables sync call interrupts. This means that all sync calls in
+ // the current process will be strictly blocking until a reply is received,
+ // and no incoming sync calls can dispatch on the blocking thread in interim.
+ static void DisableSyncCallInterrupts();
+
+ // Used only in tests to re-enable sync call interrupts after disabling them.
+ static void EnableSyncCallInterruptsForTesting();
+
+ // Indicates whether sync call interrupts are enabled in the calling process.
+ // They're enabled by default, so any sync message that isn't marked [Sync]
+ // may have its blocking call interrupted to dispatch other incoming sync
+ // IPCs which target the blocking thread.
+ static bool AreSyncCallInterruptsEnabled();
+
private:
// DO NOT ADD ANY OTHER FRIEND STATEMENTS, talk to mojo/OWNERS first.
// BEGIN ALLOWED USAGE.
diff --git a/mojo/public/cpp/bindings/tests/sync_method_unittest.cc b/mojo/public/cpp/bindings/tests/sync_method_unittest.cc
index cfac737af29e653d788eb1ce7669f73ae7b320d4..d794d29df07d289d34b3b1aae9f8574fc914c050 100644
--- a/mojo/public/cpp/bindings/tests/sync_method_unittest.cc
+++ b/mojo/public/cpp/bindings/tests/sync_method_unittest.cc
@@ -25,6 +25,7 @@
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
#include "mojo/public/cpp/bindings/shared_associated_remote.h"
#include "mojo/public/cpp/bindings/shared_remote.h"
+#include "mojo/public/cpp/bindings/sync_call_restrictions.h"
#include "mojo/public/cpp/bindings/tests/bindings_test_base.h"
#include "mojo/public/cpp/bindings/tests/sync_method_unittest.test-mojom.h"
#include "mojo/public/interfaces/bindings/tests/test_sync_methods.mojom.h"
@@ -1563,7 +1564,144 @@ TEST_P(SyncInterruptTest, SharedAssociatedRemoteNoInterrupt) {
EXPECT_EQ(0, same_pipe_ponger().num_sync_pongs());
}
+class SyncService : public mojom::SyncService {
+ public:
+ explicit SyncService(PendingReceiver<mojom::SyncService> receiver)
+ : receiver_(this, std::move(receiver)) {}
+
+ void SetCallHandler(base::OnceClosure call_handler) {
+ call_handler_ = std::move(call_handler);
+ }
+
+ // mojom::SyncService:
+ void SyncCall(SyncCallCallback callback) override {
+ std::move(callback).Run();
+ if (call_handler_) {
+ std::move(call_handler_).Run();
+ }
+ }
+
+ private:
+ Receiver<mojom::SyncService> receiver_;
+ base::OnceClosure call_handler_;
+};
+
+class DisableSyncInterruptTest : public BindingsTestBase {
+ public:
+ void SetUp() override {
+ mojo::SyncCallRestrictions::DisableSyncCallInterrupts();
+ }
+
+ void TearDown() override {
+ mojo::SyncCallRestrictions::EnableSyncCallInterruptsForTesting();
+ }
+};
+
+TEST_P(DisableSyncInterruptTest, NoInterruptWhenDisabled) {
+ PendingRemote<mojom::SyncService> interrupter;
+ SyncService service(interrupter.InitWithNewPipeAndPassReceiver());
+
+ base::RunLoop wait_for_main_thread_service_call;
+ bool main_thread_service_called = false;
+ service.SetCallHandler(base::BindLambdaForTesting([&] {
+ main_thread_service_called = true;
+ wait_for_main_thread_service_call.Quit();
+ }));
+
+ Remote<mojom::SyncService> caller;
+ base::Thread background_service_thread("SyncService");
+ background_service_thread.Start();
+ base::SequenceBound<SyncService> background_service{
+ background_service_thread.task_runner(),
+ caller.BindNewPipeAndPassReceiver()};
+
+ base::Thread interrupter_thread("Interrupter");
+ interrupter_thread.Start();
+ interrupter_thread.task_runner()->PostTask(
+ FROM_HERE, base::BindLambdaForTesting([&interrupter] {
+ // Issue a sync call to the SyncService on the main thread. This should
+ // never be dispatched until *after* the sync call *from* the main
+ // thread completes below.
+ Remote<mojom::SyncService>(std::move(interrupter))->SyncCall();
+ }));
+
+ // The key test expectation here is that `main_thread_service_called` cannot
+ // be set to true until after SyncCall() returns and we can pump the thread's
+ // message loop. If sync interrupts are not properly disabled, this
+ // expectation can fail flakily (and often.)
+ caller->SyncCall();
+ EXPECT_FALSE(main_thread_service_called);
+
+ // Now the incoming sync call can be dispatched.
+ wait_for_main_thread_service_call.Run();
+ EXPECT_TRUE(main_thread_service_called);
+
+ background_service.SynchronouslyResetForTest();
+ interrupter_thread.Stop();
+ background_service_thread.Stop();
+}
+
+TEST_P(DisableSyncInterruptTest, SharedRemoteNoInterruptWhenDisabled) {
+ PendingRemote<mojom::SyncService> interrupter;
+ SyncService service(interrupter.InitWithNewPipeAndPassReceiver());
+
+ base::RunLoop wait_for_main_thread_service_call;
+ bool main_thread_service_called = false;
+ service.SetCallHandler(base::BindLambdaForTesting([&] {
+ main_thread_service_called = true;
+ wait_for_main_thread_service_call.Quit();
+ }));
+
+ // Bind a SharedRemote to another background thread so that we exercise
+ // SharedRemote's own sync wait codepath when called into from the main
+ // thread.
+ base::Thread background_client_thread("Client");
+ background_client_thread.Start();
+
+ base::Thread background_service_thread("Service");
+ background_service_thread.Start();
+
+ SharedRemote<mojom::SyncService> caller;
+ base::SequenceBound<SyncService> background_service{
+ background_service_thread.task_runner(),
+ caller.BindNewPipeAndPassReceiver(
+ background_client_thread.task_runner())};
+
+ base::Thread interrupter_thread("Interrupter");
+ interrupter_thread.Start();
+ interrupter_thread.task_runner()->PostTask(
+ FROM_HERE, base::BindLambdaForTesting([&interrupter] {
+ // Issue a sync call to the SyncService on the main thread. This should
+ // never be dispatched until *after* the sync call *from* the main
+ // thread completes below.
+ Remote<mojom::SyncService>(std::move(interrupter))->SyncCall();
+ }));
+
+ // The key test expectation here is that `main_thread_service_called` cannot
+ // be set to true until after SyncCall() returns and we can pump the thread's
+ // message loop. If sync interrupts are not properly disabled, this
+ // expectation can fail flakily (and often.)
+ caller->SyncCall();
+ EXPECT_FALSE(main_thread_service_called);
+
+ // Now the incoming sync call can be dispatched.
+ wait_for_main_thread_service_call.Run();
+ EXPECT_TRUE(main_thread_service_called);
+
+ background_service.SynchronouslyResetForTest();
+
+ // We need to reset the SharedRemote before the client thread is stopped, to
+ // ensure the necessary teardown work is executed on that thread. Otherwise
+ // the underlying pipe and related state will leak, and ASan will complain.
+ caller.reset();
+
+ interrupter_thread.Stop();
+ background_service_thread.Stop();
+ background_client_thread.Stop();
+}
+
INSTANTIATE_MOJO_BINDINGS_TEST_SUITE_P(SyncInterruptTest);
+INSTANTIATE_MOJO_BINDINGS_TEST_SUITE_P(DisableSyncInterruptTest);
} // namespace
} // namespace sync_method_unittest
diff --git a/mojo/public/cpp/bindings/tests/sync_method_unittest.test-mojom b/mojo/public/cpp/bindings/tests/sync_method_unittest.test-mojom
index 383b54f3ab654d664192522c061058b29fd0509a..951442b3585ad22f936568e211ad41f8ae358705 100644
--- a/mojo/public/cpp/bindings/tests/sync_method_unittest.test-mojom
+++ b/mojo/public/cpp/bindings/tests/sync_method_unittest.test-mojom
@@ -45,3 +45,7 @@ interface Ponger {
[Sync] Pong() => ();
PongAsync();
};
+
+interface SyncService {
+ [Sync] SyncCall() => ();
+};

View File

@@ -0,0 +1,946 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Daniel Cheng <dcheng@chromium.org>
Date: Sat, 12 Nov 2022 00:27:56 +0000
Subject: Validate that a message is allowed to use the sync flag.
This changes consists of several coordinated changes:
- The C++ bindings generator now emits an array of method ordinals that
are allowed to use sync calls, but only if any method has a [Sync]
annotation. This is intended to minimize the code cost to interfaces
that do not have any sync methods (i.e. most of them).
- The C++ binding endpoints (mojo::Receiver, et cetera) now plumb the
array of sync-allowed ordinals to the InterfaceEndpointClient.
- Processing an incoming message checks if the incoming message is
allowed to use the sync flag by filtering it against the array of
sync-allowed ordinals that was previously passed to the
InterfaceEndpointClient.
This also fixes an incorrect forward declaration of ValidationContext in
the generated bindings that discovered in the process of writing the
test.
(cherry picked from commit 4365dddb49847a422bce674383b4aa4f38ff9e89)
Bug: 1376099
Change-Id: Icb5864dcab96ccd18c98b4cc6ade7cdef39e209f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3994146
Reviewed-by: Ken Rockot <rockot@google.com>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#1067894}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4018151
Auto-Submit: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Ken Rockot <rockot@google.com>
Cr-Commit-Position: refs/branch-heads/5359@{#774}
Cr-Branched-From: 27d3765d341b09369006d030f83f582a29eb57ae-refs/heads/main@{#1058933}
diff --git a/mojo/public/cpp/bindings/BUILD.gn b/mojo/public/cpp/bindings/BUILD.gn
index 2c27474d1200f80ff7abc773eaafdc9d30494f58..de587d8759f2e850ef9de355551c4be12f3ca6e7 100644
--- a/mojo/public/cpp/bindings/BUILD.gn
+++ b/mojo/public/cpp/bindings/BUILD.gn
@@ -183,6 +183,7 @@ component("bindings") {
"lib/sync_event_watcher.cc",
"lib/sync_handle_registry.cc",
"lib/sync_handle_watcher.cc",
+ "lib/sync_method_traits.h",
"lib/task_runner_helper.cc",
"lib/task_runner_helper.h",
"lib/thread_safe_forwarder_base.cc",
diff --git a/mojo/public/cpp/bindings/associated_receiver.h b/mojo/public/cpp/bindings/associated_receiver.h
index 8731b179fecfa212c3c802fb5e57189e97d782e6..220c0355a45362bdb018e335a1cb0e8e4a4abd96 100644
--- a/mojo/public/cpp/bindings/associated_receiver.h
+++ b/mojo/public/cpp/bindings/associated_receiver.h
@@ -5,15 +5,19 @@
#ifndef MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_RECEIVER_H_
#define MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_RECEIVER_H_
+#include <stdint.h>
+
#include <memory>
#include <utility>
#include "base/check.h"
+#include "base/containers/span.h"
#include "base/memory/ptr_util.h"
#include "base/memory/scoped_refptr.h"
#include "base/memory/weak_ptr.h"
#include "base/strings/string_piece.h"
#include "base/task/sequenced_task_runner.h"
+#include "mojo/public/cpp/bindings/lib/sync_method_traits.h"
#include "mojo/public/cpp/bindings/pending_associated_receiver.h"
#include "mojo/public/cpp/bindings/pending_associated_remote.h"
#include "mojo/public/cpp/bindings/raw_ptr_impl_ref_traits.h"
@@ -60,7 +64,7 @@ class COMPONENT_EXPORT(MOJO_CPP_BINDINGS) AssociatedReceiverBase {
void BindImpl(ScopedInterfaceEndpointHandle handle,
MessageReceiverWithResponderStatus* receiver,
std::unique_ptr<MessageReceiver> payload_validator,
- bool expect_sync_requests,
+ base::span<const uint32_t> sync_method_ordinals,
scoped_refptr<base::SequencedTaskRunner> runner,
uint32_t interface_version,
const char* interface_name,
@@ -201,8 +205,8 @@ class AssociatedReceiver : public internal::AssociatedReceiverBase {
if (pending_receiver) {
BindImpl(pending_receiver.PassHandle(), &stub_,
base::WrapUnique(new typename Interface::RequestValidator_()),
- Interface::HasSyncMethods_, std::move(task_runner),
- Interface::Version_, Interface::Name_,
+ internal::SyncMethodTraits<Interface>::GetOrdinals(),
+ std::move(task_runner), Interface::Version_, Interface::Name_,
Interface::MessageToMethodInfo_,
Interface::MessageToMethodName_);
} else {
diff --git a/mojo/public/cpp/bindings/interface_endpoint_client.h b/mojo/public/cpp/bindings/interface_endpoint_client.h
index cd79a5edb3f939623b874db36542ee651113c164..d746b1473d95a367f47e309049e85241bdba095b 100644
--- a/mojo/public/cpp/bindings/interface_endpoint_client.h
+++ b/mojo/public/cpp/bindings/interface_endpoint_client.h
@@ -13,6 +13,7 @@
#include "base/callback.h"
#include "base/component_export.h"
+#include "base/containers/span.h"
#include "base/dcheck_is_on.h"
#include "base/location.h"
#include "base/memory/raw_ptr.h"
@@ -56,7 +57,7 @@ class COMPONENT_EXPORT(MOJO_CPP_BINDINGS) InterfaceEndpointClient
InterfaceEndpointClient(ScopedInterfaceEndpointHandle handle,
MessageReceiverWithResponderStatus* receiver,
std::unique_ptr<MessageReceiver> payload_validator,
- bool expect_sync_requests,
+ base::span<const uint32_t> sync_method_ordinals,
scoped_refptr<base::SequencedTaskRunner> task_runner,
uint32_t interface_version,
const char* interface_name,
@@ -220,6 +221,10 @@ class COMPONENT_EXPORT(MOJO_CPP_BINDINGS) InterfaceEndpointClient
// The router lock must be held when calling this.
void ForgetAsyncRequest(uint64_t request_id);
+ base::span<const uint32_t> sync_method_ordinals() const {
+ return sync_method_ordinals_;
+ }
+
private:
struct PendingAsyncResponse {
public:
@@ -281,7 +286,7 @@ class COMPONENT_EXPORT(MOJO_CPP_BINDINGS) InterfaceEndpointClient
bool HandleValidatedMessage(Message* message);
- const bool expect_sync_requests_ = false;
+ const base::span<const uint32_t> sync_method_ordinals_;
// The callback to invoke when our peer endpoint sends us NotifyIdle and we
// have no outstanding unacked messages. If null, no callback has been set and
diff --git a/mojo/public/cpp/bindings/lib/associated_interface_ptr_state.cc b/mojo/public/cpp/bindings/lib/associated_interface_ptr_state.cc
index 0be4148158a0d779770cba9c6cc2204d957e753d..5a23491320fbcf28db67511309dde641c4439837 100644
--- a/mojo/public/cpp/bindings/lib/associated_interface_ptr_state.cc
+++ b/mojo/public/cpp/bindings/lib/associated_interface_ptr_state.cc
@@ -4,6 +4,11 @@
#include "mojo/public/cpp/bindings/lib/associated_interface_ptr_state.h"
+#include <stdint.h>
+
+#include <utility>
+
+#include "base/containers/span.h"
#include "mojo/public/cpp/bindings/lib/task_runner_helper.h"
namespace mojo {
@@ -70,7 +75,8 @@ void AssociatedInterfacePtrStateBase::Bind(
// The version is only queried from the client so the value passed here
// will not be used.
endpoint_client_ = std::make_unique<InterfaceEndpointClient>(
- std::move(handle), nullptr, std::move(validator), false,
+ std::move(handle), nullptr, std::move(validator),
+ /*sync_method_ordinals=*/base::span<const uint32_t>(),
GetTaskRunnerToUseFromUserProvidedTaskRunner(std::move(runner)), 0u,
interface_name, method_info_callback, method_name_callback);
}
diff --git a/mojo/public/cpp/bindings/lib/associated_interface_ptr_state.h b/mojo/public/cpp/bindings/lib/associated_interface_ptr_state.h
index 5ac4091604df3054f5f678f97c39c1fb133346d3..67cc5b07c18375ea7f58cda223766b9fe8c5e4e0 100644
--- a/mojo/public/cpp/bindings/lib/associated_interface_ptr_state.h
+++ b/mojo/public/cpp/bindings/lib/associated_interface_ptr_state.h
@@ -141,6 +141,10 @@ class AssociatedInterfacePtrState : public AssociatedInterfacePtrStateBase {
return info;
}
+ InterfaceEndpointClient* endpoint_client_for_test() {
+ return endpoint_client();
+ }
+
private:
std::unique_ptr<Proxy> proxy_;
};
diff --git a/mojo/public/cpp/bindings/lib/associated_receiver.cc b/mojo/public/cpp/bindings/lib/associated_receiver.cc
index a25df8c6127e0c0f2fd398bb5e7dafe4be23aa94..c450ef2d9d0e66ba0ce66458c29d1ce616c5740e 100644
--- a/mojo/public/cpp/bindings/lib/associated_receiver.cc
+++ b/mojo/public/cpp/bindings/lib/associated_receiver.cc
@@ -64,7 +64,7 @@ void AssociatedReceiverBase::BindImpl(
ScopedInterfaceEndpointHandle handle,
MessageReceiverWithResponderStatus* receiver,
std::unique_ptr<MessageReceiver> payload_validator,
- bool expect_sync_requests,
+ base::span<const uint32_t> sync_method_ordinals,
scoped_refptr<base::SequencedTaskRunner> runner,
uint32_t interface_version,
const char* interface_name,
@@ -74,7 +74,7 @@ void AssociatedReceiverBase::BindImpl(
endpoint_client_ = std::make_unique<InterfaceEndpointClient>(
std::move(handle), receiver, std::move(payload_validator),
- expect_sync_requests,
+ sync_method_ordinals,
internal::GetTaskRunnerToUseFromUserProvidedTaskRunner(std::move(runner)),
interface_version, interface_name, method_info_callback,
method_name_callback);
diff --git a/mojo/public/cpp/bindings/lib/binding_state.cc b/mojo/public/cpp/bindings/lib/binding_state.cc
index 227727f170964cc761a358323272bb1e3123951d..e0c926b04d10364815f270a4f0e1dc542fa8370a 100644
--- a/mojo/public/cpp/bindings/lib/binding_state.cc
+++ b/mojo/public/cpp/bindings/lib/binding_state.cc
@@ -107,7 +107,7 @@ void BindingStateBase::BindInternal(
const char* interface_name,
std::unique_ptr<MessageReceiver> request_validator,
bool passes_associated_kinds,
- bool has_sync_methods,
+ base::span<const uint32_t> sync_method_ordinals,
MessageReceiverWithResponderStatus* stub,
uint32_t interface_version,
MessageToMethodInfoCallback method_info_callback,
@@ -121,7 +121,7 @@ void BindingStateBase::BindInternal(
MultiplexRouter::Config config =
passes_associated_kinds
? MultiplexRouter::MULTI_INTERFACE
- : (has_sync_methods
+ : (!sync_method_ordinals.empty()
? MultiplexRouter::SINGLE_INTERFACE_WITH_SYNC_METHODS
: MultiplexRouter::SINGLE_INTERFACE);
router_ = MultiplexRouter::CreateAndStartReceiving(
@@ -131,7 +131,7 @@ void BindingStateBase::BindInternal(
endpoint_client_ = std::make_unique<InterfaceEndpointClient>(
router_->CreateLocalEndpointHandle(kPrimaryInterfaceId), stub,
- std::move(request_validator), has_sync_methods,
+ std::move(request_validator), sync_method_ordinals,
std::move(sequenced_runner), interface_version, interface_name,
method_info_callback, method_name_callback);
endpoint_client_->SetIdleTrackingEnabledCallback(
diff --git a/mojo/public/cpp/bindings/lib/binding_state.h b/mojo/public/cpp/bindings/lib/binding_state.h
index 1b33aa78a952dcfeb39c466ecd47f840896c41c4..cf1f3f377e5e6662d86720fbd7121ed69e6c9b42 100644
--- a/mojo/public/cpp/bindings/lib/binding_state.h
+++ b/mojo/public/cpp/bindings/lib/binding_state.h
@@ -5,6 +5,8 @@
#ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDING_STATE_H_
#define MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDING_STATE_H_
+#include <stdint.h>
+
#include <memory>
#include <utility>
@@ -12,6 +14,7 @@
#include "base/callback.h"
#include "base/check.h"
#include "base/component_export.h"
+#include "base/containers/span.h"
#include "base/memory/ptr_util.h"
#include "base/memory/ref_counted.h"
#include "base/strings/string_piece.h"
@@ -23,6 +26,7 @@
#include "mojo/public/cpp/bindings/interface_id.h"
#include "mojo/public/cpp/bindings/lib/multiplex_router.h"
#include "mojo/public/cpp/bindings/lib/pending_receiver_state.h"
+#include "mojo/public/cpp/bindings/lib/sync_method_traits.h"
#include "mojo/public/cpp/bindings/message_header_validator.h"
#include "mojo/public/cpp/bindings/pending_flush.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
@@ -90,7 +94,7 @@ class COMPONENT_EXPORT(MOJO_CPP_BINDINGS) BindingStateBase {
const char* interface_name,
std::unique_ptr<MessageReceiver> request_validator,
bool passes_associated_kinds,
- bool has_sync_methods,
+ base::span<const uint32_t> sync_method_ordinals,
MessageReceiverWithResponderStatus* stub,
uint32_t interface_version,
MessageToMethodInfoCallback method_info_callback,
@@ -121,9 +125,9 @@ class BindingState : public BindingStateBase {
BindingStateBase::BindInternal(
std::move(receiver_state), runner, Interface::Name_,
std::make_unique<typename Interface::RequestValidator_>(),
- Interface::PassesAssociatedKinds_, Interface::HasSyncMethods_, &stub_,
- Interface::Version_, Interface::MessageToMethodInfo_,
- Interface::MessageToMethodName_);
+ Interface::PassesAssociatedKinds_,
+ SyncMethodTraits<Interface>::GetOrdinals(), &stub_, Interface::Version_,
+ Interface::MessageToMethodInfo_, Interface::MessageToMethodName_);
}
PendingReceiver<Interface> Unbind() {
diff --git a/mojo/public/cpp/bindings/lib/interface_endpoint_client.cc b/mojo/public/cpp/bindings/lib/interface_endpoint_client.cc
index c4ddc89cd9d0894814d64856179539f0d757a388..1a2799f11b987b17994aa4c85bd77af571cf73e9 100644
--- a/mojo/public/cpp/bindings/lib/interface_endpoint_client.cc
+++ b/mojo/public/cpp/bindings/lib/interface_endpoint_client.cc
@@ -441,13 +441,13 @@ InterfaceEndpointClient::InterfaceEndpointClient(
ScopedInterfaceEndpointHandle handle,
MessageReceiverWithResponderStatus* receiver,
std::unique_ptr<MessageReceiver> payload_validator,
- bool expect_sync_requests,
+ base::span<const uint32_t> sync_method_ordinals,
scoped_refptr<base::SequencedTaskRunner> task_runner,
uint32_t interface_version,
const char* interface_name,
MessageToMethodInfoCallback method_info_callback,
MessageToMethodNameCallback method_name_callback)
- : expect_sync_requests_(expect_sync_requests),
+ : sync_method_ordinals_(sync_method_ordinals),
handle_(std::move(handle)),
incoming_receiver_(receiver),
dispatcher_(&thunk_),
@@ -857,7 +857,8 @@ void InterfaceEndpointClient::InitControllerIfNecessary() {
controller_ = handle_.group_controller()->AttachEndpointClient(handle_, this,
task_runner_);
- if (expect_sync_requests_ && task_runner_->RunsTasksInCurrentSequence())
+ if (!sync_method_ordinals_.empty() &&
+ task_runner_->RunsTasksInCurrentSequence())
controller_->AllowWokenUpBySyncWatchOnSameThread();
}
diff --git a/mojo/public/cpp/bindings/lib/interface_ptr_state.cc b/mojo/public/cpp/bindings/lib/interface_ptr_state.cc
index 66bfb042c8c67644c2b94dd2dc7759aaf91088c6..1a9e45fd825c8ae867f36e03698176a15600ca0d 100644
--- a/mojo/public/cpp/bindings/lib/interface_ptr_state.cc
+++ b/mojo/public/cpp/bindings/lib/interface_ptr_state.cc
@@ -4,6 +4,11 @@
#include "mojo/public/cpp/bindings/lib/interface_ptr_state.h"
+#include <stdint.h>
+
+#include <utility>
+
+#include "base/containers/span.h"
#include "mojo/public/cpp/bindings/lib/task_runner_helper.h"
namespace mojo {
@@ -100,7 +105,9 @@ bool InterfacePtrStateBase::InitializeEndpointClient(
interface_name);
endpoint_client_ = std::make_unique<InterfaceEndpointClient>(
router_->CreateLocalEndpointHandle(kPrimaryInterfaceId), nullptr,
- std::move(payload_validator), false, std::move(runner_),
+ std::move(payload_validator),
+ /* sync_method_ordinals= */ base::span<const uint32_t>(),
+ std::move(runner_),
// The version is only queried from the client so the value passed here
// will not be used.
0u, interface_name, method_info_callback, method_name_callback);
diff --git a/mojo/public/cpp/bindings/lib/interface_ptr_state.h b/mojo/public/cpp/bindings/lib/interface_ptr_state.h
index 3e4a5f87422f40143c631123153b7b1138cdfb8f..b3921a464b96aa33d2a7d98309c9745008b4aae1 100644
--- a/mojo/public/cpp/bindings/lib/interface_ptr_state.h
+++ b/mojo/public/cpp/bindings/lib/interface_ptr_state.h
@@ -25,6 +25,7 @@
#include "mojo/public/cpp/bindings/interface_endpoint_client.h"
#include "mojo/public/cpp/bindings/lib/multiplex_router.h"
#include "mojo/public/cpp/bindings/lib/pending_remote_state.h"
+#include "mojo/public/cpp/bindings/lib/sync_method_traits.h"
#include "mojo/public/cpp/bindings/pending_flush.h"
#include "mojo/public/cpp/bindings/thread_safe_proxy.h"
#include "mojo/public/cpp/system/message_pipe.h"
@@ -249,6 +250,10 @@ class InterfacePtrState : public InterfacePtrStateBase {
endpoint_client()->RaiseError();
}
+ InterfaceEndpointClient* endpoint_client_for_test() {
+ return endpoint_client();
+ }
+
private:
void ConfigureProxyIfNecessary() {
// The proxy has been configured.
@@ -259,7 +264,8 @@ class InterfacePtrState : public InterfacePtrStateBase {
}
if (InitializeEndpointClient(
- Interface::PassesAssociatedKinds_, Interface::HasSyncMethods_,
+ Interface::PassesAssociatedKinds_,
+ !SyncMethodTraits<Interface>::GetOrdinals().empty(),
Interface::HasUninterruptableMethods_,
std::make_unique<typename Interface::ResponseValidator_>(),
Interface::Name_, Interface::MessageToMethodInfo_,
diff --git a/mojo/public/cpp/bindings/lib/multiplex_router.cc b/mojo/public/cpp/bindings/lib/multiplex_router.cc
index b9c92d5ec9eab57972cf870efff51fe09e381623..c04999f0ac8881cc86ed34761ddeb8e8dfc83164 100644
--- a/mojo/public/cpp/bindings/lib/multiplex_router.cc
+++ b/mojo/public/cpp/bindings/lib/multiplex_router.cc
@@ -1067,6 +1067,12 @@ bool MultiplexRouter::ProcessIncomingMessage(
bool can_direct_call;
if (message->has_flag(Message::kFlagIsSync)) {
+ if (!message->has_flag(Message::kFlagIsResponse) &&
+ !base::Contains(endpoint->client()->sync_method_ordinals(),
+ message->name())) {
+ RaiseErrorInNonTestingMode();
+ return true;
+ }
can_direct_call = client_call_behavior != NO_DIRECT_CLIENT_CALLS &&
endpoint->task_runner()->RunsTasksInCurrentSequence();
} else {
diff --git a/mojo/public/cpp/bindings/lib/sync_method_traits.h b/mojo/public/cpp/bindings/lib/sync_method_traits.h
new file mode 100644
index 0000000000000000000000000000000000000000..2b334f8d01c2edb7c3e6b98fb8d35925aded11ab
--- /dev/null
+++ b/mojo/public/cpp/bindings/lib/sync_method_traits.h
@@ -0,0 +1,31 @@
+// Copyright 2022 The Chromium Authors
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_SYNC_METHOD_TRAITS_H_
+#define MOJO_PUBLIC_CPP_BINDINGS_LIB_SYNC_METHOD_TRAITS_H_
+
+#include <stdint.h>
+
+#include <type_traits>
+
+#include "base/containers/span.h"
+
+namespace mojo::internal {
+
+template <typename Interface, typename SFINAE = void>
+struct SyncMethodTraits {
+ static constexpr base::span<const uint32_t> GetOrdinals() { return {}; }
+};
+
+template <typename Interface>
+struct SyncMethodTraits<Interface,
+ std::void_t<decltype(Interface::kSyncMethodOrdinals)>> {
+ static constexpr base::span<const uint32_t> GetOrdinals() {
+ return Interface::kSyncMethodOrdinals;
+ }
+};
+
+} // namespace mojo::internal
+
+#endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_SYNC_METHOD_TRAITS_H_
diff --git a/mojo/public/cpp/bindings/tests/BUILD.gn b/mojo/public/cpp/bindings/tests/BUILD.gn
index 248176f6f350b57bb5138924c68c4393ba1c11a8..25cfe56438d099ddcb4ed04a4e83b9abb89b8d14 100644
--- a/mojo/public/cpp/bindings/tests/BUILD.gn
+++ b/mojo/public/cpp/bindings/tests/BUILD.gn
@@ -65,6 +65,7 @@ source_set("tests") {
":mojo_public_bindings_test_utils",
":test_extra_cpp_template_mojom",
":test_mojom",
+ ":test_mojom__generate_message_ids",
"//base/test:test_support",
"//mojo/core/test:test_support",
"//mojo/public/cpp/bindings",
diff --git a/mojo/public/cpp/bindings/tests/bindings_perftest.cc b/mojo/public/cpp/bindings/tests/bindings_perftest.cc
index 173c6c801853fc9b19ca123d8cd1f580894d3e8e..383072ead95d459f62c2adf2a937edfc81681597 100644
--- a/mojo/public/cpp/bindings/tests/bindings_perftest.cc
+++ b/mojo/public/cpp/bindings/tests/bindings_perftest.cc
@@ -212,12 +212,12 @@ TEST_F(MojoBindingsPerftest, MultiplexRouterPingPong) {
InterfaceEndpointClient client0(
router0->CreateLocalEndpointHandle(kPrimaryInterfaceId), &paddle0,
- nullptr, false, base::ThreadTaskRunnerHandle::Get(), 0u,
- kTestInterfaceName, MessageToMethodInfo, MessageToMethodName);
+ nullptr, {}, base::ThreadTaskRunnerHandle::Get(), 0u, kTestInterfaceName,
+ MessageToMethodInfo, MessageToMethodName);
InterfaceEndpointClient client1(
router1->CreateLocalEndpointHandle(kPrimaryInterfaceId), &paddle1,
- nullptr, false, base::ThreadTaskRunnerHandle::Get(), 0u,
- kTestInterfaceName, MessageToMethodInfo, MessageToMethodName);
+ nullptr, {}, base::ThreadTaskRunnerHandle::Get(), 0u, kTestInterfaceName,
+ MessageToMethodInfo, MessageToMethodName);
paddle0.set_sender(&client0);
paddle1.set_sender(&client1);
@@ -264,8 +264,8 @@ TEST_F(MojoBindingsPerftest, MultiplexRouterDispatchCost) {
CounterReceiver receiver;
InterfaceEndpointClient client(
router->CreateLocalEndpointHandle(kPrimaryInterfaceId), &receiver,
- nullptr, false, base::ThreadTaskRunnerHandle::Get(), 0u,
- kTestInterfaceName, MessageToMethodInfo, MessageToMethodName);
+ nullptr, {}, base::ThreadTaskRunnerHandle::Get(), 0u, kTestInterfaceName,
+ MessageToMethodInfo, MessageToMethodName);
static const uint32_t kIterations[] = {1000, 3000000};
diff --git a/mojo/public/cpp/bindings/tests/multiplex_router_unittest.cc b/mojo/public/cpp/bindings/tests/multiplex_router_unittest.cc
index c04c3867a9629c28ec45c5d376c5688760c463c9..e340a28a0ea1536187386e3764fe019119e53f12 100644
--- a/mojo/public/cpp/bindings/tests/multiplex_router_unittest.cc
+++ b/mojo/public/cpp/bindings/tests/multiplex_router_unittest.cc
@@ -74,13 +74,13 @@ class MultiplexRouterTest : public testing::Test {
TEST_F(MultiplexRouterTest, BasicRequestResponse) {
InterfaceEndpointClient client0(
- std::move(endpoint0_), nullptr, std::make_unique<PassThroughFilter>(),
- false, base::ThreadTaskRunnerHandle::Get(), 0u, kTestInterfaceName,
+ std::move(endpoint0_), nullptr, std::make_unique<PassThroughFilter>(), {},
+ base::ThreadTaskRunnerHandle::Get(), 0u, kTestInterfaceName,
MessageToMethodInfo, MessageToMethodName);
ResponseGenerator generator;
InterfaceEndpointClient client1(
std::move(endpoint1_), &generator, std::make_unique<PassThroughFilter>(),
- false, base::ThreadTaskRunnerHandle::Get(), 0u, kTestInterfaceName,
+ {}, base::ThreadTaskRunnerHandle::Get(), 0u, kTestInterfaceName,
MessageToMethodInfo, MessageToMethodName);
Message request;
@@ -123,13 +123,13 @@ TEST_F(MultiplexRouterTest, BasicRequestResponse) {
TEST_F(MultiplexRouterTest, BasicRequestResponse_Synchronous) {
InterfaceEndpointClient client0(
- std::move(endpoint0_), nullptr, std::make_unique<PassThroughFilter>(),
- false, base::ThreadTaskRunnerHandle::Get(), 0u, kTestInterfaceName,
+ std::move(endpoint0_), nullptr, std::make_unique<PassThroughFilter>(), {},
+ base::ThreadTaskRunnerHandle::Get(), 0u, kTestInterfaceName,
MessageToMethodInfo, MessageToMethodName);
ResponseGenerator generator;
InterfaceEndpointClient client1(
std::move(endpoint1_), &generator, std::make_unique<PassThroughFilter>(),
- false, base::ThreadTaskRunnerHandle::Get(), 0u, kTestInterfaceName,
+ {}, base::ThreadTaskRunnerHandle::Get(), 0u, kTestInterfaceName,
MessageToMethodInfo, MessageToMethodName);
Message request;
@@ -173,14 +173,14 @@ TEST_F(MultiplexRouterTest, BasicRequestResponse_Synchronous) {
TEST_F(MultiplexRouterTest, LazyResponses) {
InterfaceEndpointClient client0(
std::move(endpoint0_), nullptr, base::WrapUnique(new PassThroughFilter()),
- false, base::ThreadTaskRunnerHandle::Get(), 0u, kTestInterfaceName,
+ {}, base::ThreadTaskRunnerHandle::Get(), 0u, kTestInterfaceName,
MessageToMethodInfo, MessageToMethodName);
base::RunLoop run_loop;
LazyResponseGenerator generator(run_loop.QuitClosure());
InterfaceEndpointClient client1(std::move(endpoint1_), &generator,
- base::WrapUnique(new PassThroughFilter()),
- false, base::ThreadTaskRunnerHandle::Get(),
- 0u, kTestInterfaceName, MessageToMethodInfo,
+ base::WrapUnique(new PassThroughFilter()), {},
+ base::ThreadTaskRunnerHandle::Get(), 0u,
+ kTestInterfaceName, MessageToMethodInfo,
MessageToMethodName);
Message request;
@@ -247,7 +247,7 @@ TEST_F(MultiplexRouterTest, MissingResponses) {
base::RunLoop run_loop0, run_loop1;
InterfaceEndpointClient client0(
std::move(endpoint0_), nullptr, base::WrapUnique(new PassThroughFilter()),
- false, base::ThreadTaskRunnerHandle::Get(), 0u, kTestInterfaceName,
+ {}, base::ThreadTaskRunnerHandle::Get(), 0u, kTestInterfaceName,
MessageToMethodInfo, MessageToMethodName);
bool error_handler_called0 = false;
client0.set_connection_error_handler(base::BindOnce(
@@ -256,9 +256,9 @@ TEST_F(MultiplexRouterTest, MissingResponses) {
base::RunLoop run_loop3;
LazyResponseGenerator generator(run_loop3.QuitClosure());
InterfaceEndpointClient client1(std::move(endpoint1_), &generator,
- base::WrapUnique(new PassThroughFilter()),
- false, base::ThreadTaskRunnerHandle::Get(),
- 0u, kTestInterfaceName, MessageToMethodInfo,
+ base::WrapUnique(new PassThroughFilter()), {},
+ base::ThreadTaskRunnerHandle::Get(), 0u,
+ kTestInterfaceName, MessageToMethodInfo,
MessageToMethodName);
bool error_handler_called1 = false;
client1.set_connection_error_handler(base::BindOnce(
@@ -306,12 +306,12 @@ TEST_F(MultiplexRouterTest, LateResponse) {
{
InterfaceEndpointClient client0(
std::move(endpoint0_), nullptr, std::make_unique<PassThroughFilter>(),
- false, base::ThreadTaskRunnerHandle::Get(), 0u, kTestInterfaceName,
+ {}, base::ThreadTaskRunnerHandle::Get(), 0u, kTestInterfaceName,
MessageToMethodInfo, MessageToMethodName);
InterfaceEndpointClient client1(std::move(endpoint1_), &generator,
- std::make_unique<PassThroughFilter>(),
- false, base::ThreadTaskRunnerHandle::Get(),
- 0u, kTestInterfaceName, MessageToMethodInfo,
+ std::make_unique<PassThroughFilter>(), {},
+ base::ThreadTaskRunnerHandle::Get(), 0u,
+ kTestInterfaceName, MessageToMethodInfo,
MessageToMethodName);
Message request;
diff --git a/mojo/public/cpp/bindings/tests/sync_method_unittest.cc b/mojo/public/cpp/bindings/tests/sync_method_unittest.cc
index d794d29df07d289d34b3b1aae9f8574fc914c050..6de90c8ec9619358e97d50726d7c8c6820df7990 100644
--- a/mojo/public/cpp/bindings/tests/sync_method_unittest.cc
+++ b/mojo/public/cpp/bindings/tests/sync_method_unittest.cc
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <tuple>
#include <utility>
#include "base/barrier_closure.h"
@@ -9,15 +10,21 @@
#include "base/check.h"
#include "base/run_loop.h"
#include "base/sequence_token.h"
+#include "base/task/sequenced_task_runner.h"
#include "base/task/thread_pool.h"
#include "base/test/bind.h"
#include "base/test/task_environment.h"
#include "base/threading/sequence_bound.h"
+#include "base/threading/sequenced_task_runner_handle.h"
#include "base/threading/thread.h"
#include "base/time/time.h"
#include "mojo/public/cpp/bindings/associated_receiver.h"
#include "mojo/public/cpp/bindings/associated_receiver_set.h"
#include "mojo/public/cpp/bindings/associated_remote.h"
+#include "mojo/public/cpp/bindings/lib/message_fragment.h"
+#include "mojo/public/cpp/bindings/lib/send_message_helper.h"
+#include "mojo/public/cpp/bindings/lib/serialization_util.h"
+#include "mojo/public/cpp/bindings/message.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/receiver_set.h"
#include "mojo/public/cpp/bindings/remote.h"
@@ -27,10 +34,16 @@
#include "mojo/public/cpp/bindings/shared_remote.h"
#include "mojo/public/cpp/bindings/sync_call_restrictions.h"
#include "mojo/public/cpp/bindings/tests/bindings_test_base.h"
+#include "mojo/public/cpp/bindings/tests/sync_method_unittest.test-mojom-shared-message-ids.h"
#include "mojo/public/cpp/bindings/tests/sync_method_unittest.test-mojom.h"
#include "mojo/public/interfaces/bindings/tests/test_sync_methods.mojom.h"
#include "testing/gtest/include/gtest/gtest.h"
+// This needs to be included last, since it forward declares a bunch of classes
+// but depends on those definitions to be included by headers that sort
+// lexicographically after.
+#include "mojo/public/cpp/bindings/tests/sync_method_unittest.test-mojom-params-data.h"
+
namespace mojo {
namespace test {
namespace sync_method_unittest {
@@ -1703,6 +1716,237 @@ TEST_P(DisableSyncInterruptTest, SharedRemoteNoInterruptWhenDisabled) {
INSTANTIATE_MOJO_BINDINGS_TEST_SUITE_P(SyncInterruptTest);
INSTANTIATE_MOJO_BINDINGS_TEST_SUITE_P(DisableSyncInterruptTest);
+class OneSyncImpl;
+
+class NoSyncImpl : public mojom::NoSync {
+ public:
+ explicit NoSyncImpl(PendingReceiver<mojom::NoSync> receiver)
+ : receiver_(this, std::move(receiver)) {}
+
+ explicit NoSyncImpl(
+ PendingAssociatedReceiver<mojom::NoSync> associated_receiver)
+ : associated_receiver_(this, std::move(associated_receiver)) {}
+
+ // mojom::NoSync implementation:
+ void Method(MethodCallback callback) override;
+ void BindNoSync(PendingAssociatedReceiver<mojom::NoSync> receiver) override;
+ void BindOneSync(PendingAssociatedReceiver<mojom::OneSync> receiver) override;
+
+ private:
+ Receiver<mojom::NoSync> receiver_{this};
+ AssociatedReceiver<mojom::NoSync> associated_receiver_{this};
+
+ std::unique_ptr<NoSyncImpl> associated_no_sync_;
+ std::unique_ptr<OneSyncImpl> associated_one_sync_;
+};
+
+class OneSyncImpl : public mojom::OneSync {
+ public:
+ explicit OneSyncImpl(PendingReceiver<mojom::OneSync> receiver)
+ : receiver_(this, std::move(receiver)) {}
+
+ explicit OneSyncImpl(
+ PendingAssociatedReceiver<mojom::OneSync> associated_receiver)
+ : associated_receiver_(this, std::move(associated_receiver)) {}
+
+ // mojom::OneSync implementation:
+ void Method(MethodCallback callback) override;
+ void SyncMethod(SyncMethodCallback callback) override;
+ void BindNoSync(PendingAssociatedReceiver<mojom::NoSync> receiver) override;
+ void BindOneSync(PendingAssociatedReceiver<mojom::OneSync> receiver) override;
+
+ private:
+ Receiver<mojom::OneSync> receiver_{this};
+ AssociatedReceiver<mojom::OneSync> associated_receiver_{this};
+
+ std::unique_ptr<NoSyncImpl> associated_no_sync_;
+ std::unique_ptr<OneSyncImpl> associated_one_sync_;
+};
+
+void NoSyncImpl::Method(MethodCallback callback) {
+ EXPECT_TRUE(false);
+ std::move(callback).Run();
+}
+
+void NoSyncImpl::BindNoSync(PendingAssociatedReceiver<mojom::NoSync> receiver) {
+ associated_no_sync_ = std::make_unique<NoSyncImpl>(std::move(receiver));
+}
+
+void NoSyncImpl::BindOneSync(
+ PendingAssociatedReceiver<mojom::OneSync> receiver) {
+ associated_one_sync_ = std::make_unique<OneSyncImpl>(std::move(receiver));
+}
+
+void OneSyncImpl::Method(MethodCallback callback) {
+ EXPECT_TRUE(false);
+ std::move(callback).Run();
+}
+
+void OneSyncImpl::SyncMethod(MethodCallback callback) {
+ std::move(callback).Run();
+}
+
+void OneSyncImpl::BindNoSync(
+ PendingAssociatedReceiver<mojom::NoSync> receiver) {
+ associated_no_sync_ = std::make_unique<NoSyncImpl>(std::move(receiver));
+}
+
+void OneSyncImpl::BindOneSync(
+ PendingAssociatedReceiver<mojom::OneSync> receiver) {
+ associated_one_sync_ = std::make_unique<OneSyncImpl>(std::move(receiver));
+}
+
+class NoResponseExpectedResponder : public MessageReceiver {
+ public:
+ explicit NoResponseExpectedResponder() = default;
+
+ // MessageReceiver implementation:
+ bool Accept(Message* message) override {
+ EXPECT_TRUE(false);
+ return true;
+ }
+};
+
+class SyncFlagValidationTest : public ::testing::TestWithParam<uint32_t> {
+ protected:
+ Message MakeNoSyncMethodMessage() {
+ const uint32_t flags =
+ // Always set the sync flag, as that's the primary point of the test.
+ Message::kFlagIsSync |
+ // InterfaceEndpointClient requires this flag if sending a message with
+ // a responder.
+ Message::kFlagExpectsResponse | GetParam();
+ Message message(mojom::internal::kNoSync_Method_Name, flags, 0, 0, nullptr);
+ ::mojo::internal::MessageFragment<
+ mojom::internal::NoSync_Method_Params_Data>
+ params(message);
+ params.Allocate();
+ return message;
+ }
+
+ Message MakeOneSyncMethodMessage() {
+ const uint32_t flags =
+ // Always set the sync flag, as that's the primary point of the test.
+ Message::kFlagIsSync |
+ // InterfaceEndpointClient requires this flag if sending a message with
+ // a responder.
+ Message::kFlagExpectsResponse | GetParam();
+ Message message(mojom::internal::kOneSync_Method_Name, flags, 0, 0,
+ nullptr);
+ ::mojo::internal::MessageFragment<
+ mojom::internal::NoSync_Method_Params_Data>
+ params(message);
+ params.Allocate();
+ return message;
+ }
+
+ void FlushPostedTasks() {
+ base::RunLoop run_loop;
+ base::SequencedTaskRunnerHandle::Get()->PostTask(FROM_HERE,
+ run_loop.QuitClosure());
+ run_loop.Run();
+ }
+
+ private:
+ base::test::SingleThreadTaskEnvironment task_environment;
+};
+
+TEST_P(SyncFlagValidationTest, NonSync) {
+ Remote<mojom::NoSync> remote;
+ NoSyncImpl impl(remote.BindNewPipeAndPassReceiver());
+
+ Message message = MakeNoSyncMethodMessage();
+ auto responder = std::make_unique<NoResponseExpectedResponder>();
+ ASSERT_TRUE(remote.internal_state()->endpoint_client_for_test());
+ ::mojo::internal::SendMojoMessage(
+ *remote.internal_state()->endpoint_client_for_test(), message,
+ std::move(responder));
+}
+
+TEST_P(SyncFlagValidationTest, OneSync) {
+ Remote<mojom::OneSync> remote;
+ OneSyncImpl impl(remote.BindNewPipeAndPassReceiver());
+
+ Message message = MakeOneSyncMethodMessage();
+ auto responder = std::make_unique<NoResponseExpectedResponder>();
+ ASSERT_TRUE(remote.internal_state()->endpoint_client_for_test());
+ ::mojo::internal::SendMojoMessage(
+ *remote.internal_state()->endpoint_client_for_test(), message,
+ std::move(responder));
+}
+
+TEST_P(SyncFlagValidationTest, NoSyncAssociatedWithNoSync) {
+ Remote<mojom::NoSync> remote;
+ NoSyncImpl impl(remote.BindNewPipeAndPassReceiver());
+
+ AssociatedRemote<mojom::NoSync> associated_remote;
+ remote->BindNoSync(associated_remote.BindNewEndpointAndPassReceiver());
+
+ FlushPostedTasks();
+
+ Message message = MakeNoSyncMethodMessage();
+ auto responder = std::make_unique<NoResponseExpectedResponder>();
+ ASSERT_TRUE(remote.internal_state()->endpoint_client_for_test());
+ ::mojo::internal::SendMojoMessage(
+ *associated_remote.internal_state()->endpoint_client_for_test(), message,
+ std::move(responder));
+}
+
+TEST_P(SyncFlagValidationTest, OneSyncAssociatedWithNoSync) {
+ Remote<mojom::NoSync> remote;
+ NoSyncImpl impl(remote.BindNewPipeAndPassReceiver());
+
+ AssociatedRemote<mojom::OneSync> associated_remote;
+ remote->BindOneSync(associated_remote.BindNewEndpointAndPassReceiver());
+
+ FlushPostedTasks();
+
+ Message message = MakeOneSyncMethodMessage();
+ auto responder = std::make_unique<NoResponseExpectedResponder>();
+ ASSERT_TRUE(remote.internal_state()->endpoint_client_for_test());
+ ::mojo::internal::SendMojoMessage(
+ *associated_remote.internal_state()->endpoint_client_for_test(), message,
+ std::move(responder));
+}
+
+TEST_P(SyncFlagValidationTest, NoSyncAssociatedWithOneSync) {
+ Remote<mojom::OneSync> remote;
+ OneSyncImpl impl(remote.BindNewPipeAndPassReceiver());
+
+ AssociatedRemote<mojom::NoSync> associated_remote;
+ remote->BindNoSync(associated_remote.BindNewEndpointAndPassReceiver());
+
+ FlushPostedTasks();
+
+ Message message = MakeNoSyncMethodMessage();
+ auto responder = std::make_unique<NoResponseExpectedResponder>();
+ ASSERT_TRUE(remote.internal_state()->endpoint_client_for_test());
+ ::mojo::internal::SendMojoMessage(
+ *associated_remote.internal_state()->endpoint_client_for_test(), message,
+ std::move(responder));
+}
+
+TEST_P(SyncFlagValidationTest, OneSyncAssociatedWithOneSync) {
+ Remote<mojom::OneSync> remote;
+ OneSyncImpl impl(remote.BindNewPipeAndPassReceiver());
+
+ AssociatedRemote<mojom::OneSync> associated_remote;
+ remote->BindOneSync(associated_remote.BindNewEndpointAndPassReceiver());
+
+ FlushPostedTasks();
+
+ Message message = MakeOneSyncMethodMessage();
+ auto responder = std::make_unique<NoResponseExpectedResponder>();
+ ASSERT_TRUE(remote.internal_state()->endpoint_client_for_test());
+ ::mojo::internal::SendMojoMessage(
+ *associated_remote.internal_state()->endpoint_client_for_test(), message,
+ std::move(responder));
+}
+
+INSTANTIATE_TEST_SUITE_P(,
+ SyncFlagValidationTest,
+ ::testing::Values(0, Message::kFlagIsResponse));
+
} // namespace
} // namespace sync_method_unittest
} // namespace test
diff --git a/mojo/public/cpp/bindings/tests/sync_method_unittest.test-mojom b/mojo/public/cpp/bindings/tests/sync_method_unittest.test-mojom
index 951442b3585ad22f936568e211ad41f8ae358705..0cc5f7c6d288f988b6114ff6b5b80546558eb378 100644
--- a/mojo/public/cpp/bindings/tests/sync_method_unittest.test-mojom
+++ b/mojo/public/cpp/bindings/tests/sync_method_unittest.test-mojom
@@ -49,3 +49,20 @@ interface Ponger {
interface SyncService {
[Sync] SyncCall() => ();
};
+
+interface NoSync {
+ Method() => ();
+
+ BindNoSync(pending_associated_receiver<NoSync> no_sync);
+ BindOneSync(pending_associated_receiver<OneSync> one_sync);
+};
+
+interface OneSync {
+ Method() => ();
+
+ [Sync]
+ SyncMethod() => ();
+
+ BindNoSync(pending_associated_receiver<NoSync> no_sync);
+ BindOneSync(pending_associated_receiver<OneSync> one_sync);
+};
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/interface_declaration.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/interface_declaration.tmpl
index c53d4eac2ee4c0c0134f25b3f7a1c2275c545f55..6e02107bd623def01aed76b85d58e932f92ef03f 100644
--- a/mojo/public/tools/bindings/generators/cpp_templates/interface_declaration.tmpl
+++ b/mojo/public/tools/bindings/generators/cpp_templates/interface_declaration.tmpl
@@ -32,7 +32,12 @@ class {{export_attribute}} {{interface.name}}
{%- endif %}
static constexpr uint32_t Version_ = {{interface.version}};
static constexpr bool PassesAssociatedKinds_ = {% if interface|passes_associated_kinds %}true{% else %}false{% endif %};
- static constexpr bool HasSyncMethods_ = {% if interface|has_sync_methods %}true{% else %}false{% endif %};
+{%- set sync_method_ordinals = interface|get_sync_method_ordinals -%}
+{%- if sync_method_ordinals %}
+ static inline constexpr uint32_t kSyncMethodOrdinals[] = {
+ {{sync_method_ordinals|sort|join(', \n')|indent(4)}}
+ };
+{%- endif %}
static constexpr bool HasUninterruptableMethods_ =
{%- if interface|has_uninterruptable_methods %} true
{%- else %} false{% endif %};
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/module-params-data.h.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/module-params-data.h.tmpl
index af3bc5168beb5f9e5b9cfe63354dbdb6b29ff8a1..ab71e91dab403f4c552165eba5da7e32a61b1b83 100644
--- a/mojo/public/tools/bindings/generators/cpp_templates/module-params-data.h.tmpl
+++ b/mojo/public/tools/bindings/generators/cpp_templates/module-params-data.h.tmpl
@@ -17,13 +17,15 @@
#pragma clang diagnostic ignored "-Wunused-private-field"
#endif
+namespace mojo::internal {
+class ValidationContext;
+}
+
{%- for namespace in namespaces_as_array %}
namespace {{namespace}} {
{%- endfor %}
namespace internal {
-class ValidationContext;
-
{#--- Interface parameter definitions #}
{%- for interface in interfaces %}
{%- for method in interface.methods %}
diff --git a/mojo/public/tools/bindings/generators/mojom_cpp_generator.py b/mojo/public/tools/bindings/generators/mojom_cpp_generator.py
index 014f2bf04da4f2e11a13d57d910ecc8a8b489113..add5a877cb7e38da4599d3ae76ea0bd9486637da 100644
--- a/mojo/public/tools/bindings/generators/mojom_cpp_generator.py
+++ b/mojo/public/tools/bindings/generators/mojom_cpp_generator.py
@@ -403,7 +403,7 @@ class Generator(generator.Generator):
"get_qualified_name_for_kind": self._GetQualifiedNameForKind,
"has_callbacks": mojom.HasCallbacks,
"has_packed_method_ordinals": HasPackedMethodOrdinals,
- "has_sync_methods": mojom.HasSyncMethods,
+ "get_sync_method_ordinals": mojom.GetSyncMethodOrdinals,
"has_uninterruptable_methods": mojom.HasUninterruptableMethods,
"method_supports_lazy_serialization":
self._MethodSupportsLazySerialization,
diff --git a/mojo/public/tools/mojom/mojom/generate/module.py b/mojo/public/tools/mojom/mojom/generate/module.py
index eff9376b78b20dfa39efc60f7548a965a38700f1..b952ada97535aa2da8a29bc6275f738dfb0c70db 100644
--- a/mojo/public/tools/mojom/mojom/generate/module.py
+++ b/mojo/public/tools/mojom/mojom/generate/module.py
@@ -1729,11 +1729,8 @@ def MethodPassesInterfaces(method):
return _AnyMethodParameterRecursive(method, IsInterfaceKind)
-def HasSyncMethods(interface):
- for method in interface.methods:
- if method.sync:
- return True
- return False
+def GetSyncMethodOrdinals(interface):
+ return [method.ordinal for method in interface.methods if method.sync]
def HasUninterruptableMethods(interface):

View File

@@ -11,3 +11,5 @@ revert_runtime_dhceck_terminating_exception_in_microtasks.patch
chore_disable_is_execution_terminating_dcheck.patch
cherry-pick-27fa951ae4a3.patch
cherry-pick-c79148742421.patch
cherry-pick-0f481c9ddf2a.patch
cherry-pick-28b9c1c04e78.patch

View File

@@ -0,0 +1,69 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Clemens Backes <clemensb@chromium.org>
Date: Thu, 15 Dec 2022 11:58:50 +0100
Subject: Merged: [wasm][turbofan] Load 32-bit values more efficiently
When loading a 32-bit value from the stack, just load 32 bit and
zero-extend them into the target register, instead of loading the full
64 bits.
As there are things to fix (see https://crbug.com/1356461), we only
enable this optimization for Wasm for now.
Also include the related fix https://crrev.com/c/4096985.
R=mslekova@chromium.org
(cherry picked from commit 2ee52447c878721c89a55a780eb689ecba6817d3)
(cherry picked from commit a38209949fcbf045231c316e2d790b8b70ccb7ef)
Bug: chromium:1395604
Change-Id: I54a2182ada6fadbfcf5565f0dc8d4f477ecff393
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4110897
Reviewed-by: Maya Lekova <mslekova@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/branch-heads/10.8@{#46}
Cr-Branched-From: f1bc03fd6b4c201abd9f0fd9d51fb989150f97b9-refs/heads/10.8.168@{#1}
Cr-Branched-From: 237de893e1c0a0628a57d0f5797483d3add7f005-refs/heads/main@{#83672}
diff --git a/src/compiler/backend/x64/code-generator-x64.cc b/src/compiler/backend/x64/code-generator-x64.cc
index 3a882f8c7938820b787d0a59c1208ea9517dde15..87ac836d59a1901a5513cb14dc0c0d2e25922be3 100644
--- a/src/compiler/backend/x64/code-generator-x64.cc
+++ b/src/compiler/backend/x64/code-generator-x64.cc
@@ -5215,7 +5215,22 @@ void CodeGenerator::AssembleMove(InstructionOperand* source,
case MoveType::kStackToRegister: {
Operand src = g.ToOperand(source);
if (source->IsStackSlot()) {
- __ movq(g.ToRegister(destination), src);
+ MachineRepresentation mr =
+ LocationOperand::cast(source)->representation();
+ const bool is_32_bit = mr == MachineRepresentation::kWord32 ||
+ mr == MachineRepresentation::kCompressed ||
+ mr == MachineRepresentation::kCompressedPointer;
+ // TODO(13581): Fix this for other code kinds (see
+ // https://crbug.com/1356461).
+ if (code_kind() == CodeKind::WASM_FUNCTION && is_32_bit) {
+ // When we need only 32 bits, move only 32 bits. Benefits:
+ // - Save a byte here and there (depending on the destination
+ // register; "movl eax, ..." is smaller than "movq rax, ...").
+ // - Safeguard against accidental decompression of compressed slots.
+ __ movl(g.ToRegister(destination), src);
+ } else {
+ __ movq(g.ToRegister(destination), src);
+ }
} else {
DCHECK(source->IsFPStackSlot());
XMMRegister dst = g.ToDoubleRegister(destination);
diff --git a/src/wasm/graph-builder-interface.cc b/src/wasm/graph-builder-interface.cc
index 31a06d5a138ac610b10f5eea6b338d44eac3373a..ca8394e5055889c81b57892c4efed53cc6bfa3bc 100644
--- a/src/wasm/graph-builder-interface.cc
+++ b/src/wasm/graph-builder-interface.cc
@@ -2060,7 +2060,7 @@ class WasmGraphBuildingInterface {
if (exception_value != nullptr) {
// TODO(manoskouk): Can we assign a wasm type to the exception value?
*exception_value = builder_->LoopExitValue(
- *exception_value, MachineRepresentation::kWord32);
+ *exception_value, MachineRepresentation::kTaggedPointer);
}
if (wrap_exit_values) {
WrapLocalsAtLoopExit(decoder, control);

View File

@@ -0,0 +1,77 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Clemens Backes <clemensb@chromium.org>
Date: Tue, 13 Dec 2022 22:37:27 +0100
Subject: Merged: [arm] Do not emit the constant pool before a branch
After computing the branch offset but before emitting the actual branch,
we should not emit a constant pool. Otherwise the previously computed
offset would be off.
Instead of handling this indirectly via the Assembler::branch_offset
method, do this directly in the Assembler::b method (and friends), so it
is not missed on other call sites.
R=nicohartmann@chromium.org
(cherry picked from commit 9be597d194e108ba718610b9a611fe19a0fbfde5)
Bug: chromium:1399424
Change-Id: Ie30ba70508b4fb8913f79e049a33108608915704
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4118864
Reviewed-by: Nico Hartmann <nicohartmann@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/branch-heads/10.8@{#48}
Cr-Branched-From: f1bc03fd6b4c201abd9f0fd9d51fb989150f97b9-refs/heads/10.8.168@{#1}
Cr-Branched-From: 237de893e1c0a0628a57d0f5797483d3add7f005-refs/heads/main@{#83672}
diff --git a/src/codegen/arm/assembler-arm.cc b/src/codegen/arm/assembler-arm.cc
index 645edb17a4892aec70f0221cec889996a6868242..a95d4df308fd4651093a4911ad1c50226e059ebb 100644
--- a/src/codegen/arm/assembler-arm.cc
+++ b/src/codegen/arm/assembler-arm.cc
@@ -1462,10 +1462,6 @@ int Assembler::branch_offset(Label* L) {
L->link_to(pc_offset());
}
- // Block the emission of the constant pool, since the branch instruction must
- // be emitted at the pc offset recorded by the label.
- if (!is_const_pool_blocked()) BlockConstPoolFor(1);
-
return target_pos - (pc_offset() + Instruction::kPcLoadDelta);
}
@@ -1476,6 +1472,11 @@ void Assembler::b(int branch_offset, Condition cond, RelocInfo::Mode rmode) {
int imm24 = branch_offset >> 2;
const bool b_imm_check = is_int24(imm24);
CHECK(b_imm_check);
+
+ // Block the emission of the constant pool before the next instruction.
+ // Otherwise the passed-in branch offset would be off.
+ BlockConstPoolFor(1);
+
emit(cond | B27 | B25 | (imm24 & kImm24Mask));
if (cond == al) {
@@ -1490,6 +1491,11 @@ void Assembler::bl(int branch_offset, Condition cond, RelocInfo::Mode rmode) {
int imm24 = branch_offset >> 2;
const bool bl_imm_check = is_int24(imm24);
CHECK(bl_imm_check);
+
+ // Block the emission of the constant pool before the next instruction.
+ // Otherwise the passed-in branch offset would be off.
+ BlockConstPoolFor(1);
+
emit(cond | B27 | B25 | B24 | (imm24 & kImm24Mask));
}
@@ -1499,6 +1505,11 @@ void Assembler::blx(int branch_offset) {
int imm24 = branch_offset >> 2;
const bool blx_imm_check = is_int24(imm24);
CHECK(blx_imm_check);
+
+ // Block the emission of the constant pool before the next instruction.
+ // Otherwise the passed-in branch offset would be off.
+ BlockConstPoolFor(1);
+
emit(kSpecialCondition | B27 | B25 | h | (imm24 & kImm24Mask));
}

View File

@@ -1,2 +1,3 @@
add_thread_local_to_x_error_trap_cc.patch
cherry-pick-136ef25acbf7.patch
cherry-pick-e0efbd45ea74.patch

View File

@@ -0,0 +1,60 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Henrik=20Bostr=C3=B6m?= <hbos@webrtc.org>
Date: Fri, 20 Jan 2023 10:48:31 +0100
Subject: =?UTF-8?q?=C2=A0[Stats]=20Handle=20the=20case=20of=20missing=20ce?=
=?UTF-8?q?rtificates.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Certificates being missing is a sign of a bug (e.g. webrtc:14844, to be
fixed separately) which is why we have a DCHECK. But this DCHECK does
not protect against accessing the invalid iterator if it is a release
build. This CL makes that safe.
# Mobile bots not running properly
NOTRY=True
(cherry picked from commit 124d7c3fe5bdc79a355c9df02d07f25331631a68)
Bug: chromium:1408392
Change-Id: I97a82786028e41c58ef8ef15002c3f959bbec7f1
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/291109
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Cr-Original-Commit-Position: refs/heads/main@{#39159}
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/291380
Cr-Commit-Position: refs/branch-heads/5481@{#2}
Cr-Branched-From: 2e1a9a4ae0234d4b1ea7a6fd4188afa1fb20379d-refs/heads/main@{#38901}
diff --git a/pc/rtc_stats_collector.cc b/pc/rtc_stats_collector.cc
index be6c23e8430cb2b19839c5b2cb7eebaa576a92cb..0c0bb1c5540c1196dc45cd4e2e2c91941a9a16ac 100644
--- a/pc/rtc_stats_collector.cc
+++ b/pc/rtc_stats_collector.cc
@@ -2106,16 +2106,17 @@ void RTCStatsCollector::ProduceTransportStats_n(
// exist.
const auto& certificate_stats_it =
transport_cert_stats.find(transport_name);
+ std::string local_certificate_id, remote_certificate_id;
RTC_DCHECK(certificate_stats_it != transport_cert_stats.cend());
- std::string local_certificate_id;
- if (certificate_stats_it->second.local) {
- local_certificate_id = RTCCertificateIDFromFingerprint(
- certificate_stats_it->second.local->fingerprint);
- }
- std::string remote_certificate_id;
- if (certificate_stats_it->second.remote) {
- remote_certificate_id = RTCCertificateIDFromFingerprint(
- certificate_stats_it->second.remote->fingerprint);
+ if (certificate_stats_it != transport_cert_stats.cend()) {
+ if (certificate_stats_it->second.local) {
+ local_certificate_id = RTCCertificateIDFromFingerprint(
+ certificate_stats_it->second.local->fingerprint);
+ }
+ if (certificate_stats_it->second.remote) {
+ remote_certificate_id = RTCCertificateIDFromFingerprint(
+ certificate_stats_it->second.remote->fingerprint);
+ }
}
// There is one transport stats for each channel.

View File

@@ -21,6 +21,10 @@ def run_node_configure(target_cpu):
# Work around "No acceptable ASM compiler found" error on some System,
# it breaks nothing since Electron does not use OpenSSL.
args += ['--openssl-no-asm']
# Enable whole-program optimization for electron native modules.
if sys.platform == "win32":
args += ['--with-ltcg']
subprocess.check_call([sys.executable, configure] + args)
def read_node_config_gypi():

View File

@@ -129,6 +129,7 @@ module.exports = {
getElectronExec,
getOutDir,
getAbsoluteElectronExec,
handleGitCall,
ELECTRON_DIR,
SRC_DIR
};

219
script/prepare-appveyor.js Normal file
View File

@@ -0,0 +1,219 @@
if (!process.env.CI) require('dotenv-safe').load();
const assert = require('assert');
const fs = require('fs');
const got = require('got');
const path = require('path');
const { handleGitCall, ELECTRON_DIR } = require('./lib/utils.js');
const { Octokit } = require('@octokit/rest');
const octokit = new Octokit();
const APPVEYOR_IMAGES_URL = 'https://ci.appveyor.com/api/build-clouds';
const APPVEYOR_JOB_URL = 'https://ci.appveyor.com/api/builds';
const ROLLER_BRANCH_PATTERN = /^roller\/chromium$/;
const DEFAULT_BUILD_CLOUD_ID = '1598';
const DEFAULT_BUILD_CLOUD = 'electronhq-16-core';
const DEFAULT_BAKE_BASE_IMAGE = 'base-windows-server2019';
const DEFAULT_BUILD_IMAGE = 'base-windows-server2019';
const appveyorBakeJob = 'electron-bake-image';
const appVeyorJobs = {
'electron-x64': 'electron-x64-testing',
'electron-woa': 'electron-woa-testing',
'electron-ia32': 'electron-ia32-testing'
};
async function makeRequest ({ auth, username, password, url, headers, body, method }) {
const clonedHeaders = {
...(headers || {})
};
if (auth?.bearer) {
clonedHeaders.Authorization = `Bearer ${auth.bearer}`;
}
const options = {
headers: clonedHeaders,
body,
method
};
if (username || password) {
options.username = username;
options.password = password;
}
const response = await got(url, options);
if (response.statusCode < 200 || response.statusCode >= 300) {
console.error('Error: ', `(status ${response.statusCode})`, response.body);
throw new Error(`Unexpected status code ${response.statusCode} from ${url}`);
}
return JSON.parse(response.body);
}
async function checkAppVeyorImage (options) {
const IMAGE_URL = `${APPVEYOR_IMAGES_URL}/${options.cloudId}`;
const requestOpts = {
url: IMAGE_URL,
auth: {
bearer: process.env.APPVEYOR_TOKEN
},
headers: {
'Content-Type': 'application/json'
},
method: 'GET'
};
try {
const { settings } = await makeRequest(requestOpts);
const { cloudSettings } = settings;
return cloudSettings.images.find(image => image.name === `${options.imageVersion}`) || null;
} catch (err) {
console.log('Could not call AppVeyor: ', err);
}
}
async function getPullRequestId (targetBranch) {
const prsForBranch = await octokit.pulls.list({
owner: 'electron',
repo: 'electron',
state: 'open',
head: `electron:${targetBranch}`
});
if (prsForBranch.data.length === 1) {
return prsForBranch.data[0].number;
} else {
return null;
}
}
function useAppVeyorImage (targetBranch, options) {
const validJobs = Object.keys(appVeyorJobs);
if (options.job) {
assert(validJobs.includes(options.job), `Unknown AppVeyor CI job name: ${options.job}. Valid values are: ${validJobs}.`);
callAppVeyorBuildJobs(targetBranch, options.job, options);
} else {
validJobs.forEach((job) => callAppVeyorBuildJobs(targetBranch, job, options));
}
}
async function callAppVeyorBuildJobs (targetBranch, job, options) {
console.log(`Using AppVeyor image ${options.version} for ${job}`);
const pullRequestId = await getPullRequestId(targetBranch);
const environmentVariables = {
APPVEYOR_BUILD_WORKER_CLOUD: DEFAULT_BUILD_CLOUD,
APPVEYOR_BUILD_WORKER_IMAGE: options.version,
ELECTRON_OUT_DIR: 'Default',
ELECTRON_ENABLE_STACK_DUMPING: 1,
ELECTRON_ALSO_LOG_TO_STDERR: 1,
GOMA_FALLBACK_ON_AUTH_FAILURE: true,
DEPOT_TOOLS_WIN_TOOLCHAIN: 0,
PYTHONIOENCODING: 'UTF-8'
};
const requestOpts = {
url: APPVEYOR_JOB_URL,
auth: {
bearer: process.env.APPVEYOR_TOKEN
},
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
accountName: 'electron-bot',
projectSlug: appVeyorJobs[job],
branch: targetBranch,
pullRequestId: pullRequestId || undefined,
commitId: options.commit || undefined,
environmentVariables
}),
method: 'POST'
};
try {
const { version } = await makeRequest(requestOpts);
const buildUrl = `https://ci.appveyor.com/project/electron-bot/${appVeyorJobs[job]}/build/${version}`;
console.log(`AppVeyor CI request for ${job} successful. Check status at ${buildUrl}`);
} catch (err) {
console.log('Could not call AppVeyor: ', err);
}
}
async function bakeAppVeyorImage (targetBranch, options) {
console.log(`Baking a new AppVeyor image for ${options.version}, on build cloud ${options.cloudId}`);
const environmentVariables = {
APPVEYOR_BUILD_WORKER_CLOUD: DEFAULT_BUILD_CLOUD,
APPVEYOR_BUILD_WORKER_IMAGE: DEFAULT_BAKE_BASE_IMAGE,
APPVEYOR_BAKE_IMAGE: options.version
};
const requestOpts = {
url: APPVEYOR_JOB_URL,
auth: {
bearer: process.env.APPVEYOR_TOKEN
},
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
accountName: 'electron-bot',
projectSlug: appveyorBakeJob,
branch: targetBranch,
commitId: options.commit || undefined,
environmentVariables
}),
method: 'POST'
};
try {
const { version } = await makeRequest(requestOpts);
const bakeUrl = `https://ci.appveyor.com/project/electron-bot/${appveyorBakeJob}/build/${version}`;
console.log(`AppVeyor image bake request for ${options.version} successful. Check bake status at ${bakeUrl}`);
} catch (err) {
console.log('Could not call AppVeyor: ', err);
}
}
async function prepareAppVeyorImage (opts) {
const branch = await handleGitCall(['rev-parse', '--abbrev-ref', 'HEAD'], ELECTRON_DIR);
if (ROLLER_BRANCH_PATTERN.test(branch)) {
useAppVeyorImage(branch, { ...opts, version: DEFAULT_BUILD_IMAGE, cloudId: DEFAULT_BUILD_CLOUD_ID });
} else {
// eslint-disable-next-line no-control-regex
const versionRegex = new RegExp('chromium_version\':\n +\'(.+?)\',', 'm');
const deps = fs.readFileSync(path.resolve(__dirname, '..', 'DEPS'), 'utf8');
const [, CHROMIUM_VERSION] = versionRegex.exec(deps);
const cloudId = opts.cloudId || DEFAULT_BUILD_CLOUD_ID;
const imageVersion = opts.imageVersion || `e-${CHROMIUM_VERSION}`;
const image = await checkAppVeyorImage({ cloudId, imageVersion });
if (image && image.name) {
console.log(`Image exists for ${image.name}. Continuing AppVeyor jobs using ${cloudId}.\n`);
} else {
console.log(`No AppVeyor image found for ${imageVersion} in ${cloudId}.
Creating new image for ${imageVersion}, using Chromium ${CHROMIUM_VERSION} - job will run after image is baked.`);
await bakeAppVeyorImage(branch, { ...opts, version: imageVersion, cloudId });
// write image to temp file if running on CI
if (process.env.CI) fs.writeFileSync('./image_version.txt', imageVersion);
}
}
}
module.exports = prepareAppVeyorImage;
// Load or bake AppVeyor images for Windows CI.
// Usage: prepare-appveyor.js [--cloudId=CLOUD_ID] [--appveyorJobId=xxx] [--imageVersion=xxx]
// [--commit=sha] [--branch=branch_name]
if (require.main === module) {
const args = require('minimist')(process.argv.slice(2));
prepareAppVeyorImage(args)
.catch((err) => {
console.error(err);
process.exit(1);
});
}

View File

@@ -1,4 +1,4 @@
const { createAppAuth } = require('@octokit/auth-app');
const { appCredentialsFromString, getTokenForRepo } = require('@electron/github-app-auth');
const cp = require('child_process');
if (!process.env.CIRCLE_BRANCH) {
@@ -11,17 +11,15 @@ if (process.env.CIRCLE_PR_NUMBER) {
process.exit(1);
}
const auth = createAppAuth({
appId: process.env.PATCH_UP_APP_ID,
privateKey: Buffer.from(process.env.PATCH_UP_PRIVATE_KEY, 'base64').toString('utf8'),
installationId: process.env.PATCH_UP_INSTALLATION_ID,
clientId: process.env.PATCH_UP_CLIENT_ID,
clientSecret: process.env.PATCH_UP_CLIENT_SECRET
});
async function main () {
const installationAuth = await auth({ type: 'installation' });
const remoteURL = `https://x-access-token:${installationAuth.token}@github.com/electron/electron.git`;
const token = await getTokenForRepo(
{
name: 'electron',
owner: 'electron'
},
appCredentialsFromString(process.env.PATCH_UP_APP_CREDS)
);
const remoteURL = `https://x-access-token:${token}@github.com/electron/electron.git`;
// NEVER LOG THE OUTPUT OF THIS COMMAND
// GIT LEAKS THE ACCESS CREDENTIALS IN CONSOLE LOGS
const { status } = cp.spawnSync('git', ['push', '--set-upstream', remoteURL], {

View File

@@ -24,8 +24,6 @@ const circleCIPublishIndividualArches = {
'linux-publish': ['arm', 'arm64', 'x64']
};
const GHAJobs = ['electron-woa-testing'];
let jobRequestedCount = 0;
async function makeRequest ({ auth, username, password, url, headers, body, method }) {
@@ -204,7 +202,7 @@ async function callAppVeyor (targetBranch, job, options) {
console.log(`Triggering AppVeyor to run build job: ${job} on branch: ${targetBranch} with release flag.`);
const environmentVariables = {
ELECTRON_RELEASE: 1,
APPVEYOR_BUILD_WORKER_CLOUD: 'libcc-20'
APPVEYOR_BUILD_WORKER_CLOUD: 'electronhq-16-core'
};
if (!options.ghRelease) {
@@ -250,31 +248,6 @@ function buildCircleCI (targetBranch, options) {
}
}
async function buildGHA (targetBranch, options) {
const { GHA_TOKEN } = process.env;
assert(GHA_TOKEN, `${options.ci} requires the $GHA_TOKEN environment variable to be provided`);
const octokit = new Octokit({ auth: GHA_TOKEN });
assert(GHAJobs.includes(options.job), `Unknown GitHub Actions arm test job name: ${options.job}. Valid values are: ${GHAJobs}.`);
assert(options.commit !== null, 'commit is a required option for GitHub Actions');
console.log(`Triggering GitHub Actions to run build on branch: ${targetBranch}.`);
jobRequestedCount++;
try {
const response = await octokit.request('POST /repos/electron/electron/actions/workflows/electron_woa_testing.yml/dispatches', {
ref: targetBranch,
inputs: {
appveyor_job_id: `${options.appveyorJobId}`
}
});
} catch (err) {
console.log('Problem calling GitHub Actions to get build definitions: ', err);
}
}
function runRelease (targetBranch, options) {
if (options.ci) {
switch (options.ci) {
@@ -286,10 +259,6 @@ function runRelease (targetBranch, options) {
buildAppVeyor(targetBranch, options);
break;
}
case 'GHA': {
buildGHA(targetBranch, options);
break;
}
default: {
console.log(`Error! Unknown CI: ${options.ci}.`);
process.exit(1);
@@ -311,7 +280,7 @@ if (require.main === module) {
const targetBranch = args._[0];
if (args._.length < 1) {
console.log(`Trigger CI to build release builds of electron.
Usage: ci-release-build.js [--job=CI_JOB_NAME] [--arch=INDIVIDUAL_ARCH] [--ci=CircleCI|AppVeyor|GHA]
Usage: ci-release-build.js [--job=CI_JOB_NAME] [--arch=INDIVIDUAL_ARCH] [--ci=CircleCI|AppVeyor]
[--ghRelease] [--circleBuildNum=xxx] [--appveyorJobId=xxx] [--commit=sha] TARGET_BRANCH
`);
process.exit(0);

View File

@@ -1,9 +1,7 @@
REM Parameters vs_buildtools.exe download link and wsdk version
@ECHO OFF
SET buildtools_link=https://download.visualstudio.microsoft.com/download/pr/d7691cc1-82e6-434f-8e9f-a612f85b4b76/c62179f8cbbb58d4af22c21e8d4e122165f21615f529c94fad5cc7e012f1ef08/vs_BuildTools.exe
SET wsdk10_link=https://go.microsoft.com/fwlink/p/?LinkId=845298
SET wsdk=10SDK.18362
SET wsdk=10SDK.20348
REM Check for disk space
Rem 543210987654321
@@ -44,24 +42,6 @@ IF NOT "%1"=="" (
if not exist "C:\TEMP\" mkdir C:\TEMP
REM Download vs_buildtools.exe to C:\TEMP\vs_buildtools.exe
powershell -command "& { iwr %buildtools_link% -OutFile C:\TEMP\vs_buildtools.exe }"
REM Install Visual Studio Toolchain
C:\TEMP\vs_buildtools.exe --quiet --wait --norestart --nocache ^
--installPath "%ProgramFiles(x86)%/Microsoft Visual Studio/2019/Community" ^
--add Microsoft.VisualStudio.Workload.VCTools ^
--add Microsoft.VisualStudio.Component.VC.140 ^
--add Microsoft.VisualStudio.Component.VC.ATLMFC ^
--add Microsoft.VisualStudio.Component.VC.Tools.ARM64 ^
--add Microsoft.VisualStudio.Component.VC.MFC.ARM64 ^
--add Microsoft.VisualStudio.Component.Windows%wsdk% ^
--includeRecommended
REM Install Windows SDK
powershell -command "& { iwr %wsdk10_link% -OutFile C:\TEMP\wsdk10.exe }"
C:\TEMP\wsdk10.exe /features /quiet
REM Install chocolatey to further install dependencies
set chocolateyUseWindowsCompression='true'
@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" ^
@@ -69,15 +49,22 @@ set chocolateyUseWindowsCompression='true'
-Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))"
SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
REM Install nodejs python git and yarn needed dependencies
choco install -y nodejs python2 git yarn windows-sdk-10-version-1903-windbg
call C:\ProgramData\chocolatey\bin\RefreshEnv.cmd
SET PATH=C:\Python27\;C:\Python27\Scripts;%PATH%
REM Install Visual Studio Toolchain
choco install visualstudio2019buildtools --package-parameters "--quiet --wait --norestart --nocache --installPath ""%ProgramFiles(x86)%/Microsoft Visual Studio/2019/Community"" --add Microsoft.VisualStudio.Workload.VCTools --add Microsoft.VisualStudio.Component.VC.140 --add Microsoft.VisualStudio.Component.VC.ATLMFC --add Microsoft.VisualStudio.Component.VC.Tools.ARM64 --add Microsoft.VisualStudio.Component.VC.MFC.ARM64 --add Microsoft.VisualStudio.Component.Windows%wsdk% --add Microsoft.VisualStudio.Workload.NativeDesktop --includeRecommended"
pip install pywin32
REM Install Windows SDK
choco install windows-sdk-10-version-2104-all
REM Install nodejs python git and yarn needed dependencies
choco install -y nodejs-lts --version=16.15.0
choco install -y python2 git yarn
choco install python --version 3.7.9
call C:\ProgramData\chocolatey\bin\RefreshEnv.cmd
pip2 install pywin32
SET PATH=C:\Python27\;C:\Python27\Scripts;C:\Python39\;C:\Python39\Scripts;%PATH%
REM Setup Depot Tools
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git C:\depot_tools
SET PATH=%PATH%;C:\depot_tools\
SET PATH=%PATH%;C:\depot_tools\
REM Add symstore to PATH permanently
setx path "%%path%%;C:\Program Files (x86)\Windows Kits\10\Debuggers\x64"

View File

@@ -1493,13 +1493,15 @@ void WebContents::HandleNewRenderFrame(
// Set the background color of RenderWidgetHostView.
auto* web_preferences = WebContentsPreferences::From(web_contents());
if (web_preferences) {
absl::optional<SkColor> maybe_color = web_preferences->GetBackgroundColor();
web_contents()->SetPageBaseBackgroundColor(maybe_color);
auto maybe_color = web_preferences->GetBackgroundColor();
bool guest = IsGuest() || type_ == Type::kBrowserView;
SkColor color =
// If webPreferences has no color stored we need to explicitly set guest
// webContents background color to transparent.
auto bg_color =
maybe_color.value_or(guest ? SK_ColorTRANSPARENT : SK_ColorWHITE);
SetBackgroundColor(rwhv, color);
web_contents()->SetPageBaseBackgroundColor(bg_color);
SetBackgroundColor(rwhv, bg_color);
}
if (!background_throttling_)

View File

@@ -193,6 +193,18 @@ inline void dispatch_sync_main(dispatch_block_t block) {
return [super accessibilitySetValue:value forAttribute:attribute];
}
- (NSAccessibilityRole)accessibilityRole {
// For non-VoiceOver AT, such as Voice Control, Apple recommends turning on
// a11y when an AT accesses the 'accessibilityRole' property. This function
// is accessed frequently so we only change the accessibility state when
// accessibility is disabled.
auto* ax_state = content::BrowserAccessibilityState::GetInstance();
if (!ax_state->GetAccessibilityMode().has_mode(ui::kAXModeBasic.mode())) {
ax_state->AddAccessibilityModeFlags(ui::kAXModeBasic);
}
return [super accessibilityRole];
}
- (void)orderFrontStandardAboutPanel:(id)sender {
electron::Browser::Get()->ShowAboutPanel();
}

View File

@@ -1122,9 +1122,12 @@ void NativeWindowMac::SetKiosk(bool kiosk) {
is_kiosk_ = true;
SetFullScreen(true);
} else if (!kiosk && is_kiosk_) {
[NSApp setPresentationOptions:kiosk_options_];
is_kiosk_ = false;
SetFullScreen(false);
// Set presentation options *after* asynchronously exiting
// fullscreen to ensure they take effect.
[NSApp setPresentationOptions:kiosk_options_];
}
}

View File

@@ -39,7 +39,7 @@ class Archive : public node::ObjectWrap {
Archive& operator=(const Archive&) = delete;
protected:
explicit Archive(std::unique_ptr<asar::Archive> archive)
explicit Archive(std::shared_ptr<asar::Archive> archive)
: archive_(std::move(archive)) {}
static void New(const v8::FunctionCallbackInfo<v8::Value>& args) {
@@ -52,8 +52,8 @@ class Archive : public node::ObjectWrap {
return;
}
auto archive = std::make_unique<asar::Archive>(path);
if (!archive->Init()) {
std::shared_ptr<asar::Archive> archive = asar::GetOrCreateAsarArchive(path);
if (!archive) {
isolate->ThrowException(v8::Exception::Error(node::FIXED_ONE_BYTE_STRING(
isolate, "failed to initialize archive")));
return;
@@ -190,7 +190,7 @@ class Archive : public node::ObjectWrap {
isolate, wrap->archive_ ? wrap->archive_->GetUnsafeFD() : -1));
}
std::unique_ptr<asar::Archive> archive_;
std::shared_ptr<asar::Archive> archive_;
};
static void InitAsarSupport(const v8::FunctionCallbackInfo<v8::Value>& args) {

View File

@@ -144,6 +144,7 @@ v8::Local<v8::Value> Converter<display::Display>::ToV8(
gin_helper::Dictionary dict = gin::Dictionary::CreateEmpty(isolate);
dict.SetHidden("simple", true);
dict.Set("id", val.id());
dict.Set("label", val.label());
dict.Set("bounds", val.bounds());
dict.Set("workArea", val.work_area());
dict.Set("accelerometerSupport", val.accelerometer_support());

View File

@@ -24,6 +24,7 @@
#include "base/trace_event/trace_event.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/common/content_paths.h"
#include "content/public/common/content_switches.h"
#include "electron/buildflags/buildflags.h"
#include "electron/fuses.h"
#include "shell/browser/api/electron_api_app.h"
@@ -43,7 +44,7 @@
#include "shell/common/crash_keys.h"
#endif
#define ELECTRON_BUILTIN_MODULES(V) \
#define ELECTRON_BROWSER_MODULES(V) \
V(electron_browser_app) \
V(electron_browser_auto_updater) \
V(electron_browser_browser_view) \
@@ -75,18 +76,22 @@
V(electron_browser_web_contents_view) \
V(electron_browser_web_frame_main) \
V(electron_browser_web_view_manager) \
V(electron_browser_window) \
V(electron_common_asar) \
V(electron_common_clipboard) \
V(electron_common_command_line) \
V(electron_common_environment) \
V(electron_common_features) \
V(electron_common_native_image) \
V(electron_common_shell) \
V(electron_common_v8_util) \
V(electron_renderer_context_bridge) \
V(electron_renderer_crash_reporter) \
V(electron_renderer_ipc) \
V(electron_browser_window)
#define ELECTRON_COMMON_MODULES(V) \
V(electron_common_asar) \
V(electron_common_clipboard) \
V(electron_common_command_line) \
V(electron_common_environment) \
V(electron_common_features) \
V(electron_common_native_image) \
V(electron_common_shell) \
V(electron_common_v8_util)
#define ELECTRON_RENDERER_MODULES(V) \
V(electron_renderer_context_bridge) \
V(electron_renderer_crash_reporter) \
V(electron_renderer_ipc) \
V(electron_renderer_web_frame)
#define ELECTRON_VIEWS_MODULES(V) V(electron_browser_image_view)
@@ -101,7 +106,9 @@
// forward declaration. The definitions are in each module's
// implementation when calling the NODE_LINKED_MODULE_CONTEXT_AWARE.
#define V(modname) void _register_##modname();
ELECTRON_BUILTIN_MODULES(V)
ELECTRON_BROWSER_MODULES(V)
ELECTRON_COMMON_MODULES(V)
ELECTRON_RENDERER_MODULES(V)
#if BUILDFLAG(ENABLE_VIEWS_API)
ELECTRON_VIEWS_MODULES(V)
#endif
@@ -351,13 +358,22 @@ NodeBindings::~NodeBindings() {
void NodeBindings::RegisterBuiltinModules() {
#define V(modname) _register_##modname();
ELECTRON_BUILTIN_MODULES(V)
auto* command_line = base::CommandLine::ForCurrentProcess();
std::string process_type =
command_line->GetSwitchValueASCII(::switches::kProcessType);
if (process_type.empty()) {
ELECTRON_BROWSER_MODULES(V)
#if BUILDFLAG(ENABLE_VIEWS_API)
ELECTRON_VIEWS_MODULES(V)
ELECTRON_VIEWS_MODULES(V)
#endif
#if BUILDFLAG(ENABLE_DESKTOP_CAPTURER)
ELECTRON_DESKTOP_CAPTURER_MODULE(V)
ELECTRON_DESKTOP_CAPTURER_MODULE(V)
#endif
}
ELECTRON_COMMON_MODULES(V)
if (process_type == ::switches::kRendererProcess) {
ELECTRON_RENDERER_MODULES(V)
}
#if DCHECK_IS_ON()
ELECTRON_TESTING_MODULE(V)
#endif

View File

@@ -79,8 +79,7 @@ ElectronContentUtilityClient::ElectronContentUtilityClient() = default;
ElectronContentUtilityClient::~ElectronContentUtilityClient() = default;
// The guts of this came from the chromium implementation
// https://cs.chromium.org/chromium/src/chrome/utility/
// chrome_content_utility_client.cc?sq=package:chromium&dr=CSs&g=0&l=142
// https://source.chromium.org/chromium/chromium/src/+/main:chrome/utility/chrome_content_utility_client.cc
void ElectronContentUtilityClient::ExposeInterfacesToBrowser(
mojo::BinderMap* binders) {
#if BUILDFLAG(IS_WIN)

View File

@@ -63,7 +63,7 @@ describe('BrowserView module', () => {
});
// Linux and arm64 platforms (WOA and macOS) do not return any capture sources
ifit(process.platform !== 'linux' && process.arch !== 'arm64')('sets the background color to transparent if none is set', async () => {
ifit(process.platform === 'darwin' && process.arch === 'x64')('sets the background color to transparent if none is set', async () => {
const display = screen.getPrimaryDisplay();
const WINDOW_BACKGROUND_COLOR = '#55ccbb';
@@ -87,7 +87,7 @@ describe('BrowserView module', () => {
});
// Linux and arm64 platforms (WOA and macOS) do not return any capture sources
ifit(process.platform !== 'linux' && process.arch !== 'arm64')('successfully applies the background color', async () => {
ifit(process.platform === 'darwin' && process.arch === 'x64')('successfully applies the background color', async () => {
const WINDOW_BACKGROUND_COLOR = '#55ccbb';
const VIEW_BACKGROUND_COLOR = '#ff00ff';
const display = screen.getPrimaryDisplay();

View File

@@ -5583,7 +5583,7 @@ describe('BrowserWindow module', () => {
});
// Linux and arm64 platforms (WOA and macOS) do not return any capture sources
ifit(process.platform !== 'linux' && process.arch !== 'arm64')('should not display a visible background', async () => {
ifit(process.platform === 'darwin' && process.arch !== 'arm64')('should not display a visible background', async () => {
const display = screen.getPrimaryDisplay();
const backgroundWindow = new BrowserWindow({
@@ -5625,7 +5625,7 @@ describe('BrowserWindow module', () => {
afterEach(closeAllWindows);
// Linux/WOA doesn't return any capture sources.
ifit(process.platform !== 'linux' && (process.platform !== 'win32' || process.arch !== 'arm64'))('should display the set color', async () => {
ifit(process.platform === 'darwin')('should display the set color', async () => {
const display = screen.getPrimaryDisplay();
const w = new BrowserWindow({

View File

@@ -80,7 +80,7 @@ describe('dialog module', () => {
afterEach(closeAllWindows);
// parentless message boxes are synchronous on macOS
// dangling message boxes on windows cause a DCHECK: https://cs.chromium.org/chromium/src/base/win/message_window.cc?l=68&rcl=7faa4bf236a866d007dc5672c9ce42660e67a6a6
// dangling message boxes on windows cause a DCHECK: https://source.chromium.org/chromium/chromium/src/+/main:base/win/message_window.cc;drc=7faa4bf236a866d007dc5672c9ce42660e67a6a6;l=68
ifit(process.platform !== 'darwin' && process.platform !== 'win32')('should not throw for a parentless message box', () => {
expect(() => {
dialog.showMessageBox({ message: 'i am message' });

View File

@@ -34,6 +34,7 @@ describe('screen module', () => {
expect(display).to.have.property('scaleFactor').that.is.a('number');
expect(display).to.have.property('id').that.is.a('number');
expect(display).to.have.property('label').that.is.a('string');
expect(display).to.have.property('rotation').that.is.a('number');
expect(display).to.have.property('touchSupport').that.is.a('string');
expect(display).to.have.property('accelerometerSupport').that.is.a('string');

View File

@@ -2066,6 +2066,54 @@ describe('navigator.serial', () => {
});
});
describe('window.getScreenDetails', () => {
let w: BrowserWindow;
before(async () => {
w = new BrowserWindow({
show: false
});
await w.loadFile(path.join(fixturesPath, 'pages', 'blank.html'));
});
after(closeAllWindows);
afterEach(() => {
session.defaultSession.setPermissionRequestHandler(null);
});
const getScreenDetails: any = () => {
return w.webContents.executeJavaScript('window.getScreenDetails().then(data => data.screens).catch(err => err.message)', true);
};
it('returns screens when a PermissionRequestHandler is not defined', async () => {
const screens = await getScreenDetails();
expect(screens).to.not.equal('Read permission denied.');
});
it('returns an error when permission denied', async () => {
session.defaultSession.setPermissionRequestHandler((wc, permission, callback) => {
if (permission === 'window-placement') {
callback(false);
} else {
callback(true);
}
});
const screens = await getScreenDetails();
expect(screens).to.equal('Permission denied.');
});
it('returns screens when permission is granted', async () => {
session.defaultSession.setPermissionRequestHandler((wc, permission, callback) => {
if (permission === 'window-placement') {
callback(true);
} else {
callback(false);
}
});
const screens = await getScreenDetails();
expect(screens).to.not.equal('Permission denied.');
});
});
describe('navigator.clipboard', () => {
let w: BrowserWindow;
before(async () => {

View File

@@ -1,4 +1,6 @@
import { expect } from 'chai';
import { BrowserWindow } from 'electron/main';
import { closeAllWindows } from './window-helpers';
describe('feature-string parsing', () => {
it('is indifferent to whitespace around keys and values', () => {
@@ -19,3 +21,44 @@ describe('feature-string parsing', () => {
checkParse(' a = yes , c = d ', { a: true, c: 'd' });
});
});
describe('process._linkedBinding', () => {
describe('in the main process', () => {
it('can access electron_browser bindings', () => {
process._linkedBinding('electron_browser_app');
});
it('can access electron_common bindings', () => {
process._linkedBinding('electron_common_v8_util');
});
it('cannot access electron_renderer bindings', () => {
expect(() => {
process._linkedBinding('electron_renderer_ipc');
}).to.throw(/No such module was linked: electron_renderer_ipc/);
});
});
describe('in the renderer process', () => {
afterEach(closeAllWindows);
it('cannot access electron_browser bindings', async () => {
const w = new BrowserWindow({ show: false, webPreferences: { nodeIntegration: true, contextIsolation: false } });
w.loadURL('about:blank');
await expect(w.webContents.executeJavaScript('void process._linkedBinding(\'electron_browser_app\')'))
.to.eventually.be.rejectedWith(/Script failed to execute/);
});
it('can access electron_common bindings', async () => {
const w = new BrowserWindow({ show: false, webPreferences: { nodeIntegration: true, contextIsolation: false } });
w.loadURL('about:blank');
await w.webContents.executeJavaScript('void process._linkedBinding(\'electron_common_v8_util\')');
});
it('can access electron_renderer bindings', async () => {
const w = new BrowserWindow({ show: false, webPreferences: { nodeIntegration: true, contextIsolation: false } });
w.loadURL('about:blank');
await w.webContents.executeJavaScript('void process._linkedBinding(\'electron_renderer_ipc\')');
});
});
});

View File

@@ -1014,6 +1014,32 @@ describe('asar package', function () {
}
});
});
it('handles null for options', function (done) {
const p = path.join(asarDir, 'a.asar', 'dir1');
fs.readdir(p, null, function (err, dirs) {
try {
expect(err).to.be.null();
expect(dirs).to.deep.equal(['file1', 'file2', 'file3', 'link1', 'link2']);
done();
} catch (e) {
done(e);
}
});
});
it('handles undefined for options', function (done) {
const p = path.join(asarDir, 'a.asar', 'dir1');
fs.readdir(p, undefined, function (err, dirs) {
try {
expect(err).to.be.null();
expect(dirs).to.deep.equal(['file1', 'file2', 'file3', 'link1', 'link2']);
done();
} catch (e) {
done(e);
}
});
});
});
describe('fs.promises.readdir', function () {

267
yarn.lock
View File

@@ -133,6 +133,14 @@
ora "^4.0.3"
pretty-ms "^5.1.0"
"@electron/github-app-auth@^1.5.0":
version "1.5.0"
resolved "https://registry.yarnpkg.com/@electron/github-app-auth/-/github-app-auth-1.5.0.tgz#426e64ba50143417d9b68f2795a1b119cb62108b"
integrity sha512-t6Za+3E7jdIf1CX06nNV/avZhqSXNEkCLJ1xeAt5FKU9HdGbjzwSfirM+UlHO7lMGyuf13BGCZOCB1kODhDLWQ==
dependencies:
"@octokit/auth-app" "^3.6.1"
"@octokit/rest" "^18.12.0"
"@electron/typescript-definitions@^8.10.0":
version "8.10.0"
resolved "https://registry.yarnpkg.com/@electron/typescript-definitions/-/typescript-definitions-8.10.0.tgz#e9cf2b329ec4b0b76947ef751725383a6cf8994d"
@@ -170,20 +178,79 @@
"@nodelib/fs.scandir" "2.1.3"
fastq "^1.6.0"
"@octokit/auth-app@^2.10.0":
version "2.10.0"
resolved "https://registry.yarnpkg.com/@octokit/auth-app/-/auth-app-2.10.0.tgz#ad79369fca1cc3035859f797310d5e81cc6e49c4"
integrity sha512-mKFU7O5wI651iWgecs4fmJ2aLqOM3sWD1FJsUTm7nx21I4ePDhS+rGQmS5TZk5yz75Va6wEXesxUNFzuqCbP2A==
"@octokit/auth-app@^3.6.1":
version "3.6.1"
resolved "https://registry.yarnpkg.com/@octokit/auth-app/-/auth-app-3.6.1.tgz#aa5b02cc211175cbc28ce6c03c73373c1206d632"
integrity sha512-6oa6CFphIYI7NxxHrdVOzhG7hkcKyGyYocg7lNDSJVauVOLtylg8hNJzoUyPAYKKK0yUeoZamE/lMs2tG+S+JA==
dependencies:
"@octokit/request" "^5.3.0"
"@octokit/request-error" "^2.0.0"
"@octokit/types" "^5.0.0"
"@octokit/auth-oauth-app" "^4.3.0"
"@octokit/auth-oauth-user" "^1.2.3"
"@octokit/request" "^5.6.0"
"@octokit/request-error" "^2.1.0"
"@octokit/types" "^6.0.3"
"@types/lru-cache" "^5.1.0"
deprecation "^2.3.1"
lru-cache "^6.0.0"
universal-github-app-jwt "^1.0.1"
universal-user-agent "^6.0.0"
"@octokit/auth-oauth-app@^4.3.0":
version "4.3.4"
resolved "https://registry.yarnpkg.com/@octokit/auth-oauth-app/-/auth-oauth-app-4.3.4.tgz#7030955b1a59d4d977904775c606477d95fcfe8e"
integrity sha512-OYOTSSINeUAiLMk1uelaGB/dEkReBqHHr8+hBejzMG4z1vA4c7QSvDAS0RVZSr4oD4PEUPYFzEl34K7uNrXcWA==
dependencies:
"@octokit/auth-oauth-device" "^3.1.1"
"@octokit/auth-oauth-user" "^2.0.0"
"@octokit/request" "^5.6.3"
"@octokit/types" "^6.0.3"
"@types/btoa-lite" "^1.0.0"
btoa-lite "^1.0.0"
universal-user-agent "^6.0.0"
"@octokit/auth-oauth-device@^3.1.1":
version "3.1.4"
resolved "https://registry.yarnpkg.com/@octokit/auth-oauth-device/-/auth-oauth-device-3.1.4.tgz#703c42f27a1e2eb23498a7001ad8e9ecf4a2f477"
integrity sha512-6sHE/++r+aEFZ/BKXOGPJcH/nbgbBjS1A4CHfq/PbPEwb0kZEt43ykW98GBO/rYBPAYaNpCPvXfGwzgR9yMCXg==
dependencies:
"@octokit/oauth-methods" "^2.0.0"
"@octokit/request" "^6.0.0"
"@octokit/types" "^6.10.0"
universal-user-agent "^6.0.0"
"@octokit/auth-oauth-device@^4.0.0":
version "4.0.3"
resolved "https://registry.yarnpkg.com/@octokit/auth-oauth-device/-/auth-oauth-device-4.0.3.tgz#00ce77233517e0d7d39e42a02652f64337d9df81"
integrity sha512-KPTx5nMntKjNZzzltO3X4T68v22rd7Cp/TcLJXQE2U8aXPcZ9LFuww9q9Q5WUNSu3jwi3lRwzfkPguRfz1R8Vg==
dependencies:
"@octokit/oauth-methods" "^2.0.0"
"@octokit/request" "^6.0.0"
"@octokit/types" "^8.0.0"
universal-user-agent "^6.0.0"
"@octokit/auth-oauth-user@^1.2.3":
version "1.3.0"
resolved "https://registry.yarnpkg.com/@octokit/auth-oauth-user/-/auth-oauth-user-1.3.0.tgz#da4e4529145181a6aa717ae858afb76ebd6e3360"
integrity sha512-3QC/TAdk7onnxfyZ24BnJRfZv8TRzQK7SEFUS9vLng4Vv6Hv6I64ujdk/CUkREec8lhrwU764SZ/d+yrjjqhaQ==
dependencies:
"@octokit/auth-oauth-device" "^3.1.1"
"@octokit/oauth-methods" "^1.1.0"
"@octokit/request" "^5.4.14"
"@octokit/types" "^6.12.2"
btoa-lite "^1.0.0"
universal-user-agent "^6.0.0"
"@octokit/auth-oauth-user@^2.0.0":
version "2.0.4"
resolved "https://registry.yarnpkg.com/@octokit/auth-oauth-user/-/auth-oauth-user-2.0.4.tgz#88f060ec678d7d493695af8d827e115dd064e212"
integrity sha512-HrbDzTPqz6GcGSOUkR+wSeF3vEqsb9NMsmPja/qqqdiGmlk/Czkxctc3KeWYogHonp62Ml4kjz2VxKawrFsadQ==
dependencies:
"@octokit/auth-oauth-device" "^4.0.0"
"@octokit/oauth-methods" "^2.0.0"
"@octokit/request" "^6.0.0"
"@octokit/types" "^8.0.0"
btoa-lite "^1.0.0"
universal-user-agent "^6.0.0"
"@octokit/auth-token@^2.4.0":
version "2.4.2"
resolved "https://registry.yarnpkg.com/@octokit/auth-token/-/auth-token-2.4.2.tgz#10d0ae979b100fa6b72fa0e8e63e27e6d0dbff8a"
@@ -191,6 +258,13 @@
dependencies:
"@octokit/types" "^5.0.0"
"@octokit/auth-token@^2.4.4":
version "2.5.0"
resolved "https://registry.yarnpkg.com/@octokit/auth-token/-/auth-token-2.5.0.tgz#27c37ea26c205f28443402477ffd261311f21e36"
integrity sha512-r5FVUJCOLl19AxiuZD2VRZ/ORjp/4IN98Of6YJoJOkY75CIBuYfmiNHGrDwXr+aLGG55igl9QrxX3hbiXlLb+g==
dependencies:
"@octokit/types" "^6.0.3"
"@octokit/core@^3.0.0":
version "3.1.1"
resolved "https://registry.yarnpkg.com/@octokit/core/-/core-3.1.1.tgz#1856745aa8fb154cf1544a2a1b82586c809c5e66"
@@ -203,6 +277,19 @@
before-after-hook "^2.1.0"
universal-user-agent "^6.0.0"
"@octokit/core@^3.5.1":
version "3.6.0"
resolved "https://registry.yarnpkg.com/@octokit/core/-/core-3.6.0.tgz#3376cb9f3008d9b3d110370d90e0a1fcd5fe6085"
integrity sha512-7RKRKuA4xTjMhY+eG3jthb3hlZCsOwg3rztWh75Xc+ShDWOfDDATWbeZpAHBNRpm4Tv9WgBMOy1zEJYXG6NJ7Q==
dependencies:
"@octokit/auth-token" "^2.4.4"
"@octokit/graphql" "^4.5.8"
"@octokit/request" "^5.6.3"
"@octokit/request-error" "^2.0.5"
"@octokit/types" "^6.0.3"
before-after-hook "^2.2.0"
universal-user-agent "^6.0.0"
"@octokit/endpoint@^6.0.1":
version "6.0.5"
resolved "https://registry.yarnpkg.com/@octokit/endpoint/-/endpoint-6.0.5.tgz#43a6adee813c5ffd2f719e20cfd14a1fee7c193a"
@@ -212,6 +299,15 @@
is-plain-object "^4.0.0"
universal-user-agent "^6.0.0"
"@octokit/endpoint@^7.0.0":
version "7.0.3"
resolved "https://registry.yarnpkg.com/@octokit/endpoint/-/endpoint-7.0.3.tgz#0b96035673a9e3bedf8bab8f7335de424a2147ed"
integrity sha512-57gRlb28bwTsdNXq+O3JTQ7ERmBTuik9+LelgcLIVfYwf235VHbN9QNo4kXExtp/h8T423cR5iJThKtFYxC7Lw==
dependencies:
"@octokit/types" "^8.0.0"
is-plain-object "^5.0.0"
universal-user-agent "^6.0.0"
"@octokit/graphql@^4.3.1":
version "4.5.3"
resolved "https://registry.yarnpkg.com/@octokit/graphql/-/graphql-4.5.3.tgz#d5ff0d4a8a33e98614a2a7359dac98bc285e062f"
@@ -221,6 +317,64 @@
"@octokit/types" "^5.0.0"
universal-user-agent "^6.0.0"
"@octokit/graphql@^4.5.8":
version "4.8.0"
resolved "https://registry.yarnpkg.com/@octokit/graphql/-/graphql-4.8.0.tgz#664d9b11c0e12112cbf78e10f49a05959aa22cc3"
integrity sha512-0gv+qLSBLKF0z8TKaSKTsS39scVKF9dbMxJpj3U0vC7wjNWFuIpL/z76Qe2fiuCbDRcJSavkXsVtMS6/dtQQsg==
dependencies:
"@octokit/request" "^5.6.0"
"@octokit/types" "^6.0.3"
universal-user-agent "^6.0.0"
"@octokit/oauth-authorization-url@^4.3.1":
version "4.3.3"
resolved "https://registry.yarnpkg.com/@octokit/oauth-authorization-url/-/oauth-authorization-url-4.3.3.tgz#6a6ef38f243086fec882b62744f39b517528dfb9"
integrity sha512-lhP/t0i8EwTmayHG4dqLXgU+uPVys4WD/qUNvC+HfB1S1dyqULm5Yx9uKc1x79aP66U1Cb4OZeW8QU/RA9A4XA==
"@octokit/oauth-authorization-url@^5.0.0":
version "5.0.0"
resolved "https://registry.yarnpkg.com/@octokit/oauth-authorization-url/-/oauth-authorization-url-5.0.0.tgz#029626ce87f3b31addb98cd0d2355c2381a1c5a1"
integrity sha512-y1WhN+ERDZTh0qZ4SR+zotgsQUE1ysKnvBt1hvDRB2WRzYtVKQjn97HEPzoehh66Fj9LwNdlZh+p6TJatT0zzg==
"@octokit/oauth-methods@^1.1.0":
version "1.2.6"
resolved "https://registry.yarnpkg.com/@octokit/oauth-methods/-/oauth-methods-1.2.6.tgz#b9ac65e374b2cc55ee9dd8dcdd16558550438ea7"
integrity sha512-nImHQoOtKnSNn05uk2o76om1tJWiAo4lOu2xMAHYsNr0fwopP+Dv+2MlGvaMMlFjoqVd3fF3X5ZDTKCsqgmUaQ==
dependencies:
"@octokit/oauth-authorization-url" "^4.3.1"
"@octokit/request" "^5.4.14"
"@octokit/request-error" "^2.0.5"
"@octokit/types" "^6.12.2"
btoa-lite "^1.0.0"
"@octokit/oauth-methods@^2.0.0":
version "2.0.4"
resolved "https://registry.yarnpkg.com/@octokit/oauth-methods/-/oauth-methods-2.0.4.tgz#6abd9593ca7f91fe5068375a363bd70abd5516dc"
integrity sha512-RDSa6XL+5waUVrYSmOlYROtPq0+cfwppP4VaQY/iIei3xlFb0expH6YNsxNrZktcLhJWSpm9uzeom+dQrXlS3A==
dependencies:
"@octokit/oauth-authorization-url" "^5.0.0"
"@octokit/request" "^6.0.0"
"@octokit/request-error" "^3.0.0"
"@octokit/types" "^8.0.0"
btoa-lite "^1.0.0"
"@octokit/openapi-types@^12.11.0":
version "12.11.0"
resolved "https://registry.yarnpkg.com/@octokit/openapi-types/-/openapi-types-12.11.0.tgz#da5638d64f2b919bca89ce6602d059f1b52d3ef0"
integrity sha512-VsXyi8peyRq9PqIz/tpqiL2w3w80OgVMwBHltTml3LmVvXiphgeqmY9mvBw9Wu7e0QWk/fqD37ux8yP5uVekyQ==
"@octokit/openapi-types@^14.0.0":
version "14.0.0"
resolved "https://registry.yarnpkg.com/@octokit/openapi-types/-/openapi-types-14.0.0.tgz#949c5019028c93f189abbc2fb42f333290f7134a"
integrity sha512-HNWisMYlR8VCnNurDU6os2ikx0s0VyEjDYHNS/h4cgb8DeOxQ0n72HyinUtdDVxJhFy3FWLGl0DJhfEWk3P5Iw==
"@octokit/plugin-paginate-rest@^2.16.8":
version "2.21.3"
resolved "https://registry.yarnpkg.com/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.21.3.tgz#7f12532797775640dbb8224da577da7dc210c87e"
integrity sha512-aCZTEf0y2h3OLbrgKkrfFdjRL6eSOo8komneVQJnYecAxIej7Bafor2xhuDJOIFau4pk0i/P28/XgtbyPF0ZHw==
dependencies:
"@octokit/types" "^6.40.0"
"@octokit/plugin-paginate-rest@^2.2.0":
version "2.3.0"
resolved "https://registry.yarnpkg.com/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.3.0.tgz#7d1073e56cfd15d3f99dcfe81fa5d2b466f3a6f6"
@@ -233,6 +387,11 @@
resolved "https://registry.yarnpkg.com/@octokit/plugin-request-log/-/plugin-request-log-1.0.0.tgz#eef87a431300f6148c39a7f75f8cfeb218b2547e"
integrity sha512-ywoxP68aOT3zHCLgWZgwUJatiENeHE7xJzYjfz8WI0goynp96wETBF+d95b8g/uL4QmS6owPVlaxiz3wyMAzcw==
"@octokit/plugin-request-log@^1.0.4":
version "1.0.4"
resolved "https://registry.yarnpkg.com/@octokit/plugin-request-log/-/plugin-request-log-1.0.4.tgz#5e50ed7083a613816b1e4a28aeec5fb7f1462e85"
integrity sha512-mLUsMkgP7K/cnFEw07kWqXGF5LKrOkD+lhCrKvPHXWDywAwuDUeDwWBpc69XK3pNX0uKiVt8g5z96PJ6z9xCFA==
"@octokit/plugin-rest-endpoint-methods@4.1.2":
version "4.1.2"
resolved "https://registry.yarnpkg.com/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-4.1.2.tgz#546a8f3e0b514f434a4ad4ef926005f1c81a5a5a"
@@ -241,6 +400,14 @@
"@octokit/types" "^5.1.1"
deprecation "^2.3.1"
"@octokit/plugin-rest-endpoint-methods@^5.12.0":
version "5.16.2"
resolved "https://registry.yarnpkg.com/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-5.16.2.tgz#7ee8bf586df97dd6868cf68f641354e908c25342"
integrity sha512-8QFz29Fg5jDuTPXVtey05BLm7OB+M8fnvE64RNegzX7U+5NUXcOcnpTIK0YfSHBg8gYd0oxIq3IZTe9SfPZiRw==
dependencies:
"@octokit/types" "^6.39.0"
deprecation "^2.3.1"
"@octokit/request-error@^2.0.0":
version "2.0.2"
resolved "https://registry.yarnpkg.com/@octokit/request-error/-/request-error-2.0.2.tgz#0e76b83f5d8fdda1db99027ea5f617c2e6ba9ed0"
@@ -250,6 +417,24 @@
deprecation "^2.0.0"
once "^1.4.0"
"@octokit/request-error@^2.0.5", "@octokit/request-error@^2.1.0":
version "2.1.0"
resolved "https://registry.yarnpkg.com/@octokit/request-error/-/request-error-2.1.0.tgz#9e150357831bfc788d13a4fd4b1913d60c74d677"
integrity sha512-1VIvgXxs9WHSjicsRwq8PlR2LR2x6DwsJAaFgzdi0JfJoGSO8mYI/cHJQ+9FbN21aa+DrgNLnwObmyeSC8Rmpg==
dependencies:
"@octokit/types" "^6.0.3"
deprecation "^2.0.0"
once "^1.4.0"
"@octokit/request-error@^3.0.0":
version "3.0.2"
resolved "https://registry.yarnpkg.com/@octokit/request-error/-/request-error-3.0.2.tgz#f74c0f163d19463b87528efe877216c41d6deb0a"
integrity sha512-WMNOFYrSaX8zXWoJg9u/pKgWPo94JXilMLb2VManNOby9EZxrQaBe/QSC4a1TzpAlpxofg2X/jMnCyZgL6y7eg==
dependencies:
"@octokit/types" "^8.0.0"
deprecation "^2.0.0"
once "^1.4.0"
"@octokit/request@^5.3.0", "@octokit/request@^5.4.0":
version "5.4.7"
resolved "https://registry.yarnpkg.com/@octokit/request/-/request-5.4.7.tgz#fd703ee092e0463ceba49ff7a3e61cb4cf8a0fde"
@@ -264,6 +449,30 @@
once "^1.4.0"
universal-user-agent "^6.0.0"
"@octokit/request@^5.4.14", "@octokit/request@^5.6.0", "@octokit/request@^5.6.3":
version "5.6.3"
resolved "https://registry.yarnpkg.com/@octokit/request/-/request-5.6.3.tgz#19a022515a5bba965ac06c9d1334514eb50c48b0"
integrity sha512-bFJl0I1KVc9jYTe9tdGGpAMPy32dLBXXo1dS/YwSCTL/2nd9XeHsY616RE3HPXDVk+a+dBuzyz5YdlXwcDTr2A==
dependencies:
"@octokit/endpoint" "^6.0.1"
"@octokit/request-error" "^2.1.0"
"@octokit/types" "^6.16.1"
is-plain-object "^5.0.0"
node-fetch "^2.6.7"
universal-user-agent "^6.0.0"
"@octokit/request@^6.0.0":
version "6.2.2"
resolved "https://registry.yarnpkg.com/@octokit/request/-/request-6.2.2.tgz#a2ba5ac22bddd5dcb3f539b618faa05115c5a255"
integrity sha512-6VDqgj0HMc2FUX2awIs+sM6OwLgwHvAi4KCK3mT2H2IKRt6oH9d0fej5LluF5mck1lRR/rFWN0YIDSYXYSylbw==
dependencies:
"@octokit/endpoint" "^7.0.0"
"@octokit/request-error" "^3.0.0"
"@octokit/types" "^8.0.0"
is-plain-object "^5.0.0"
node-fetch "^2.6.7"
universal-user-agent "^6.0.0"
"@octokit/rest@^18.0.3":
version "18.0.3"
resolved "https://registry.yarnpkg.com/@octokit/rest/-/rest-18.0.3.tgz#96a15ddb3a38dca5de9d75121378d6aa4a234fa5"
@@ -274,6 +483,16 @@
"@octokit/plugin-request-log" "^1.0.0"
"@octokit/plugin-rest-endpoint-methods" "4.1.2"
"@octokit/rest@^18.12.0":
version "18.12.0"
resolved "https://registry.yarnpkg.com/@octokit/rest/-/rest-18.12.0.tgz#f06bc4952fc87130308d810ca9d00e79f6988881"
integrity sha512-gDPiOHlyGavxr72y0guQEhLsemgVjwRePayJ+FcKc2SJqKUbxbkvf5kAZEWA/MKvsfYlQAMVzNJE3ezQcxMJ2Q==
dependencies:
"@octokit/core" "^3.5.1"
"@octokit/plugin-paginate-rest" "^2.16.8"
"@octokit/plugin-request-log" "^1.0.4"
"@octokit/plugin-rest-endpoint-methods" "^5.12.0"
"@octokit/types@^5.0.0", "@octokit/types@^5.0.1", "@octokit/types@^5.1.1", "@octokit/types@^5.2.0":
version "5.2.0"
resolved "https://registry.yarnpkg.com/@octokit/types/-/types-5.2.0.tgz#d075dc23bf293f540739250b6879e2c1be2fc20c"
@@ -281,6 +500,20 @@
dependencies:
"@types/node" ">= 8"
"@octokit/types@^6.0.3", "@octokit/types@^6.10.0", "@octokit/types@^6.12.2", "@octokit/types@^6.16.1", "@octokit/types@^6.39.0", "@octokit/types@^6.40.0":
version "6.41.0"
resolved "https://registry.yarnpkg.com/@octokit/types/-/types-6.41.0.tgz#e58ef78d78596d2fb7df9c6259802464b5f84a04"
integrity sha512-eJ2jbzjdijiL3B4PrSQaSjuF2sPEQPVCPzBvTHJD9Nz+9dw2SGH4K4xeQJ77YfTq5bRQ+bD8wT11JbeDPmxmGg==
dependencies:
"@octokit/openapi-types" "^12.11.0"
"@octokit/types@^8.0.0":
version "8.0.0"
resolved "https://registry.yarnpkg.com/@octokit/types/-/types-8.0.0.tgz#93f0b865786c4153f0f6924da067fe0bb7426a9f"
integrity sha512-65/TPpOJP1i3K4lBJMnWqPUJ6zuOtzhtagDvydAWbEXpbFYA0oMKKyLb95NFZZP0lSh/4b6K+DQlzvYQJQQePg==
dependencies:
"@octokit/openapi-types" "^14.0.0"
"@opentelemetry/api@^1.0.1":
version "1.0.4"
resolved "https://registry.yarnpkg.com/@opentelemetry/api/-/api-1.0.4.tgz#a167e46c10d05a07ab299fc518793b0cff8f6924"
@@ -337,6 +570,11 @@
"@types/connect" "*"
"@types/node" "*"
"@types/btoa-lite@^1.0.0":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@types/btoa-lite/-/btoa-lite-1.0.0.tgz#e190a5a548e0b348adb0df9ac7fa5f1151c7cca4"
integrity sha512-wJsiX1tosQ+J5+bY5LrSahHxr2wT+uME5UDwdN1kg4frt40euqA+wzECkmq4t5QbveHiJepfdThgQrPw6KiSlg==
"@types/busboy@^0.2.3":
version "0.2.3"
resolved "https://registry.yarnpkg.com/@types/busboy/-/busboy-0.2.3.tgz#6697ad29873246c530f09a3ff5a40861824230d5"
@@ -1325,6 +1563,11 @@ before-after-hook@^2.1.0:
resolved "https://registry.yarnpkg.com/before-after-hook/-/before-after-hook-2.1.0.tgz#b6c03487f44e24200dd30ca5e6a1979c5d2fb635"
integrity sha512-IWIbu7pMqyw3EAJHzzHbWa85b6oud/yfKYg5rqB5hNE8CeMi3nX+2C2sj0HswfblST86hpVEOAb9x34NZd6P7A==
before-after-hook@^2.2.0:
version "2.2.3"
resolved "https://registry.yarnpkg.com/before-after-hook/-/before-after-hook-2.2.3.tgz#c51e809c81a4e354084422b9b26bad88249c517c"
integrity sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ==
big.js@^5.2.2:
version "5.2.2"
resolved "https://registry.yarnpkg.com/big.js/-/big.js-5.2.2.tgz#65f0af382f578bcdc742bd9c281e9cb2d7768328"
@@ -1461,6 +1704,11 @@ browserify-zlib@^0.2.0:
dependencies:
pako "~1.0.5"
btoa-lite@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/btoa-lite/-/btoa-lite-1.0.0.tgz#337766da15801210fdd956c22e9c6891ab9d0337"
integrity sha512-gvW7InbIyF8AicrqWoptdW08pUxuhq8BEgowNajy9RhiE86fmGAGl+bLKo6oB8QP0CkqHLowfN0oJdKC/J6LbA==
buffer-equal-constant-time@1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz#f8e71132f7ffe6e01a5c9697a4c6f3e48d5cc819"
@@ -4030,6 +4278,11 @@ is-plain-object@^4.0.0:
resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-4.1.1.tgz#1a14d6452cbd50790edc7fdaa0aed5a40a35ebb5"
integrity sha512-5Aw8LLVsDlZsETVMhoMXzqsXwQqr/0vlnBYzIXJbYo2F4yYlhLHs+Ez7Bod7IIQKWkJbJfxrWD7pA1Dw1TKrwA==
is-plain-object@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-5.0.0.tgz#4427f50ab3429e9025ea7d52e9043a9ef4159344"
integrity sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==
is-regex@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.4.tgz#5517489b547091b0930e095654ced25ee97e9491"