mirror of
https://github.com/electron/electron.git
synced 2026-02-26 03:01:17 -05:00
Compare commits
12 Commits
v32.0.0-al
...
v32.0.0-al
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
670cc53f5a | ||
|
|
18c54a2978 | ||
|
|
170c61e409 | ||
|
|
d3596f61b6 | ||
|
|
8ed34bf203 | ||
|
|
e69329bd9c | ||
|
|
e880530911 | ||
|
|
24a6c66145 | ||
|
|
c4d9e79021 | ||
|
|
ef4896b37f | ||
|
|
fe31c8eeac | ||
|
|
02306b46a5 |
1
.circleci/.gitignore
vendored
1
.circleci/.gitignore
vendored
@@ -1 +0,0 @@
|
||||
config-staging
|
||||
@@ -1,57 +0,0 @@
|
||||
version: 2.1
|
||||
|
||||
# Required for dynamic configuration
|
||||
setup: true
|
||||
|
||||
# Orbs
|
||||
orbs:
|
||||
path-filtering: circleci/path-filtering@0.1.0
|
||||
continuation: circleci/continuation@0.2.0
|
||||
|
||||
# All input parameters to pass to build config
|
||||
parameters:
|
||||
run-docs-only:
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
upload-to-storage:
|
||||
type: string
|
||||
default: '1'
|
||||
|
||||
run-build-linux:
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
jobs:
|
||||
generate-config:
|
||||
docker:
|
||||
- image: cimg/node:16.14
|
||||
steps:
|
||||
- checkout
|
||||
- path-filtering/set-parameters:
|
||||
base-revision: main
|
||||
mapping: |
|
||||
^((?!docs/).)*$ run-build-mac true
|
||||
^((?!docs/).)*$ run-build-linux true
|
||||
docs/.* run-docs-only true
|
||||
^((?!docs/).)*$ run-docs-only false
|
||||
- run:
|
||||
command: |
|
||||
cd .circleci/config
|
||||
yarn
|
||||
export CIRCLECI_BINARY="$HOME/circleci"
|
||||
curl -fLSs https://raw.githubusercontent.com/CircleCI-Public/circleci-cli/main/install.sh | DESTDIR=$CIRCLECI_BINARY bash
|
||||
node build.js
|
||||
name: Pack config.yml
|
||||
- run:
|
||||
name: Set params
|
||||
command: node .circleci/config/params.js
|
||||
- continuation/continue:
|
||||
configuration_path: .circleci/config-staging/built.yml
|
||||
parameters: /tmp/pipeline-parameters.json
|
||||
|
||||
# Initial setup workflow
|
||||
workflows:
|
||||
setup:
|
||||
jobs:
|
||||
- generate-config
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,34 +0,0 @@
|
||||
const cp = require('child_process');
|
||||
const fs = require('fs-extra');
|
||||
const path = require('path');
|
||||
const yaml = require('js-yaml');
|
||||
|
||||
const STAGING_DIR = path.resolve(__dirname, '..', 'config-staging');
|
||||
|
||||
function copyAndExpand(dir = './') {
|
||||
const absDir = path.resolve(__dirname, dir);
|
||||
const targetDir = path.resolve(STAGING_DIR, dir);
|
||||
|
||||
if (!fs.existsSync(targetDir)) {
|
||||
fs.mkdirSync(targetDir);
|
||||
}
|
||||
|
||||
for (const file of fs.readdirSync(absDir)) {
|
||||
if (!file.endsWith('.yml')) {
|
||||
if (fs.statSync(path.resolve(absDir, file)).isDirectory()) {
|
||||
copyAndExpand(path.join(dir, file));
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
fs.writeFileSync(path.resolve(targetDir, file), yaml.dump(yaml.load(fs.readFileSync(path.resolve(absDir, file), 'utf8')), {
|
||||
noRefs: true,
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
if (fs.pathExists(STAGING_DIR)) fs.removeSync(STAGING_DIR);
|
||||
copyAndExpand();
|
||||
|
||||
const output = cp.spawnSync(process.env.CIRCLECI_BINARY || 'circleci', ['config', 'pack', STAGING_DIR]);
|
||||
fs.writeFileSync(path.resolve(STAGING_DIR, 'built.yml'), output.stdout.toString());
|
||||
@@ -1,51 +0,0 @@
|
||||
executor:
|
||||
name: linux-docker
|
||||
size: medium
|
||||
steps:
|
||||
- checkout:
|
||||
path: src/electron
|
||||
- run:
|
||||
name: Setup third_party Depot Tools
|
||||
command: |
|
||||
# "depot_tools" has to be checkout into "//third_party/depot_tools" so pylint.py can a "pylintrc" file.
|
||||
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git src/third_party/depot_tools
|
||||
echo 'export PATH="$PATH:'"$PWD"'/src/third_party/depot_tools"' >> $BASH_ENV
|
||||
- run:
|
||||
name: Download GN Binary
|
||||
command: |
|
||||
chromium_revision="$(grep -A1 chromium_version src/electron/DEPS | tr -d '\n' | cut -d\' -f4)"
|
||||
gn_version="$(curl -sL "https://chromium.googlesource.com/chromium/src/+/${chromium_revision}/DEPS?format=TEXT" | base64 -d | grep gn_version | head -n1 | cut -d\' -f4)"
|
||||
|
||||
cipd ensure -ensure-file - -root . \<<-CIPD
|
||||
\$ServiceURL https://chrome-infra-packages.appspot.com/
|
||||
@Subdir src/buildtools/linux64
|
||||
gn/gn/linux-amd64 $gn_version
|
||||
CIPD
|
||||
|
||||
echo 'export CHROMIUM_BUILDTOOLS_PATH="'"$PWD"'/src/buildtools"' >> $BASH_ENV
|
||||
- run:
|
||||
name: Download clang-format Binary
|
||||
command: |
|
||||
chromium_revision="$(grep -A1 chromium_version src/electron/DEPS | tr -d '\n' | cut -d\' -f4)"
|
||||
|
||||
mkdir -p src/buildtools
|
||||
curl -sL "https://chromium.googlesource.com/chromium/src/+/${chromium_revision}/buildtools/DEPS?format=TEXT" | base64 -d > src/buildtools/DEPS
|
||||
|
||||
gclient sync --spec="solutions=[{'name':'src/buildtools','url':None,'deps_file':'DEPS','custom_vars':{'process_deps':True},'managed':False}]"
|
||||
- run:
|
||||
name: Run Lint
|
||||
command: |
|
||||
# gn.py tries to find a gclient root folder starting from the current dir.
|
||||
# When it fails and returns "None" path, the whole script fails. Let's "fix" it.
|
||||
touch .gclient
|
||||
# Another option would be to checkout "buildtools" inside the Electron checkout,
|
||||
# but then we would lint its contents (at least gn format), and it doesn't pass it.
|
||||
|
||||
cd src/electron
|
||||
node script/yarn install --frozen-lockfile
|
||||
node script/yarn lint
|
||||
- run:
|
||||
name: Run Script Typechecker
|
||||
command: |
|
||||
cd src/electron
|
||||
node script/yarn tsc -p tsconfig.script.json
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"name": "@electron/circleci-config",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"fs-extra": "^10.1.0",
|
||||
"js-yaml": "^4.1.0"
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
const fs = require('fs');
|
||||
|
||||
const PARAMS_PATH = '/tmp/pipeline-parameters.json';
|
||||
|
||||
const content = JSON.parse(fs.readFileSync(PARAMS_PATH, 'utf-8'));
|
||||
|
||||
// Choose resource class for linux hosts
|
||||
const currentBranch = process.env.CIRCLE_BRANCH || '';
|
||||
content['large-linux-executor'] = /^pull\/[0-9-]+$/.test(currentBranch) ? '2xlarge' : 'electronjs/aks-linux-large';
|
||||
content['medium-linux-executor'] = /^pull\/[0-9-]+$/.test(currentBranch) ? 'medium' : 'electronjs/aks-linux-medium';
|
||||
|
||||
fs.writeFileSync(PARAMS_PATH, JSON.stringify(content));
|
||||
@@ -1,43 +0,0 @@
|
||||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||
# yarn lockfile v1
|
||||
|
||||
|
||||
argparse@^2.0.1:
|
||||
version "2.0.1"
|
||||
resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38"
|
||||
integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==
|
||||
|
||||
fs-extra@^10.1.0:
|
||||
version "10.1.0"
|
||||
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-10.1.0.tgz#02873cfbc4084dde127eaa5f9905eef2325d1abf"
|
||||
integrity sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==
|
||||
dependencies:
|
||||
graceful-fs "^4.2.0"
|
||||
jsonfile "^6.0.1"
|
||||
universalify "^2.0.0"
|
||||
|
||||
graceful-fs@^4.1.6, graceful-fs@^4.2.0:
|
||||
version "4.2.10"
|
||||
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.10.tgz#147d3a006da4ca3ce14728c7aefc287c367d7a6c"
|
||||
integrity sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==
|
||||
|
||||
js-yaml@^4.1.0:
|
||||
version "4.1.0"
|
||||
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602"
|
||||
integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==
|
||||
dependencies:
|
||||
argparse "^2.0.1"
|
||||
|
||||
jsonfile@^6.0.1:
|
||||
version "6.1.0"
|
||||
resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.1.0.tgz#bc55b2634793c679ec6403094eb13698a6ec0aae"
|
||||
integrity sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==
|
||||
dependencies:
|
||||
universalify "^2.0.0"
|
||||
optionalDependencies:
|
||||
graceful-fs "^4.1.6"
|
||||
|
||||
universalify@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/universalify/-/universalify-2.0.0.tgz#75a4984efedc4b08975c5aeb73f530d02df25717"
|
||||
integrity sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==
|
||||
@@ -1,8 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
mkdir -p ~/.ssh
|
||||
echo "github.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl
|
||||
github.com ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEmKSENjQEezOmxkZMy7opKgwFB9nkt5YRrYMjNuG5N87uRgg6CLrbo5wAdT/y6v0mKV0U2w0WZ2YB/++Tpockg=
|
||||
github.com ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCj7ndNxQowgcQnjshcLrqPEiiphnt+VTTvDP6mHBL9j1aNUkY4Ue1gvwnGLVlOhGeYrnZaMgRK6+PKCUXaDbC7qtbW8gIkhL7aGCsOr/C56SJMy/BCZfxd1nWzAOxSDPgVsmerOBYfNqltV9/hWCqBywINIR+5dIg6JTJ72pcEpEjcYgXkE2YEFXV1JHnsKgbLWNlhScqb2UmyRkQyytRLtL+38TGxkxCflmO+5Z8CSSNY7GidjMIZ7Q4zMjA2n1nGrlTDkzwDCsw+wqFPGQA179cnfGWOWRVruj16z6XyvxvjJwbz0wQZ75XK5tKSb7FNyeIEs4TT4jk+S4dhPeAUC5y+bDYirYgM4GC7uEnztnZyaVWQ7B381AK4Qdrwt51ZqExKbQpTUNn+EjqoTwvqNj4kqx5QUCI0ThS/YkOxJCXmPUWZbhjpCg56i+2aB6CmK2JGhn57K5mj0MNdBXA4/WnwH6XoPWJzK5Nyu2zB3nAZp+S5hpQs+p1vN1/wsjk=" >> ~/.ssh/known_hosts
|
||||
@@ -36,7 +36,6 @@
|
||||
"dbaeumer.vscode-eslint",
|
||||
"shakram02.bash-beautify",
|
||||
"marshallofsound.gnls-electron",
|
||||
"CircleCI.circleci"
|
||||
],
|
||||
"settings": {
|
||||
"editor.tabSize": 2,
|
||||
|
||||
@@ -2,5 +2,4 @@
|
||||
# See docs/development/releasing.md
|
||||
|
||||
APPVEYOR_CLOUD_TOKEN=
|
||||
CIRCLE_TOKEN=
|
||||
ELECTRON_GITHUB_TOKEN=
|
||||
|
||||
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -22,6 +22,7 @@ patches/**/.patches merge=union
|
||||
*.md text eol=lf
|
||||
*.mm text eol=lf
|
||||
*.mojom text eol=lf
|
||||
*.patches text eol=lf
|
||||
*.proto text eol=lf
|
||||
*.py text eol=lf
|
||||
*.ps1 text eol=lf
|
||||
|
||||
@@ -6,6 +6,6 @@ runs:
|
||||
- name: Install Build Tools
|
||||
shell: bash
|
||||
run: |
|
||||
export BUILD_TOOLS_SHA=47d4bb016f47d89938898c794db80b9f98d78ad7
|
||||
export BUILD_TOOLS_SHA=d5b87591842be19058e8d75d2c5b7f1fabe9f450
|
||||
npm i -g @electron/build-tools
|
||||
e auto-update disable
|
||||
@@ -34,6 +34,9 @@ runs:
|
||||
fi
|
||||
azcopy copy --log-level=ERROR \
|
||||
"https://${{ env.AZURE_AKS_CACHE_STORAGE_ACCOUNT }}.file.core.windows.net/${{ env.AZURE_AKS_CACHE_SHARE_NAME }}/${{ env.CACHE_PATH }}?$sas_token" $DEPSHASH.tar
|
||||
env:
|
||||
AZURE_AKS_CACHE_STORAGE_ACCOUNT: f723719aa87a34622b5f7f3
|
||||
AZURE_AKS_CACHE_SHARE_NAME: pvc-f6a4089f-b082-4bee-a3f9-c3e1c0c02d8f
|
||||
- name: Clean SAS Key
|
||||
shell: bash
|
||||
run: rm -f sas-token
|
||||
|
||||
@@ -61,8 +61,6 @@ concurrency:
|
||||
cancel-in-progress: ${{ github.ref != 'refs/heads/main' && !endsWith(github.ref, '-x-y') }}
|
||||
|
||||
env:
|
||||
AZURE_AKS_CACHE_STORAGE_ACCOUNT: ${{ secrets.AZURE_AKS_CACHE_STORAGE_ACCOUNT }}
|
||||
AZURE_AKS_CACHE_SHARE_NAME: ${{ secrets.AZURE_AKS_CACHE_SHARE_NAME }}
|
||||
ELECTRON_ARTIFACTS_BLOB_STORAGE: ${{ secrets.ELECTRON_ARTIFACTS_BLOB_STORAGE }}
|
||||
ELECTRON_RBE_JWT: ${{ secrets.ELECTRON_RBE_JWT }}
|
||||
ELECTRON_GITHUB_TOKEN: ${{ secrets.ELECTRON_GITHUB_TOKEN }}
|
||||
|
||||
@@ -36,8 +36,6 @@ concurrency:
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
AZURE_AKS_CACHE_STORAGE_ACCOUNT: ${{ secrets.AZURE_AKS_CACHE_STORAGE_ACCOUNT }}
|
||||
AZURE_AKS_CACHE_SHARE_NAME: ${{ secrets.AZURE_AKS_CACHE_SHARE_NAME }}
|
||||
ELECTRON_RBE_JWT: ${{ secrets.ELECTRON_RBE_JWT }}
|
||||
GCLIENT_EXTRA_ARGS: ${{ inputs.target-platform == 'macos' && '--custom-var=checkout_mac=True --custom-var=host_os=mac' || '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True' }}
|
||||
ELECTRON_OUT_DIR: Default
|
||||
|
||||
2
DEPS
2
DEPS
@@ -4,7 +4,7 @@ vars = {
|
||||
'chromium_version':
|
||||
'128.0.6573.0',
|
||||
'node_version':
|
||||
'v20.15.0',
|
||||
'v20.15.1',
|
||||
'nan_version':
|
||||
'e14bdcd1f72d62bca1d541b66da43130384ec213',
|
||||
'squirrel.mac_version':
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[](https://electronjs.org)
|
||||
|
||||
[](https://circleci.com/gh/electron/electron/tree/main)
|
||||
[](https://github.com/electron/electron/actions/workflows/build.yml)
|
||||
[](https://ci.appveyor.com/project/electron-bot/electron-ljo26/branch/main)
|
||||
[](https://discord.gg/electronjs)
|
||||
|
||||
|
||||
@@ -145,6 +145,10 @@ Returns `string` - The file name of the download item.
|
||||
disk. If user changes the file name in a prompted download saving dialog, the
|
||||
actual name of saved file will be different.
|
||||
|
||||
#### `downloadItem.getCurrentBytesPerSecond()`
|
||||
|
||||
Returns `Integer` - The current download speed in bytes per second.
|
||||
|
||||
#### `downloadItem.getTotalBytes()`
|
||||
|
||||
Returns `Integer` - The total size in bytes of the download item.
|
||||
@@ -155,6 +159,10 @@ If the size is unknown, it returns 0.
|
||||
|
||||
Returns `Integer` - The received bytes of the download item.
|
||||
|
||||
#### `downloadItem.getPercentComplete()`
|
||||
|
||||
Returns `Integer` - The download completion in percent.
|
||||
|
||||
#### `downloadItem.getContentDisposition()`
|
||||
|
||||
Returns `string` - The Content-Disposition field from the response
|
||||
@@ -184,6 +192,10 @@ Returns `string` - ETag header value.
|
||||
Returns `Double` - Number of seconds since the UNIX epoch when the download was
|
||||
started.
|
||||
|
||||
#### `downloadItem.getEndTime()`
|
||||
|
||||
Returns `Double` - Number of seconds since the UNIX epoch when the download ended.
|
||||
|
||||
### Instance Properties
|
||||
|
||||
#### `downloadItem.savePath`
|
||||
|
||||
@@ -78,8 +78,7 @@ Electron
|
||||
|
||||
## Structure of Other Directories
|
||||
|
||||
* **.circleci** - Config file for CI with CircleCI.
|
||||
* **.github** - GitHub-specific config files including issues templates and CODEOWNERS.
|
||||
* **.github** - GitHub-specific config files including issues templates, CI with GitHub Actions and CODEOWNERS.
|
||||
* **dist** - Temporary directory created by `script/create-dist.py` script
|
||||
when creating a distribution.
|
||||
* **node_modules** - Third party node modules used for building.
|
||||
|
||||
@@ -48,7 +48,7 @@ index 5239bc8ed883a54df206d73c5dc0b70942c4f3df..6a15fcae677b3bda58fc85f705862bbc
|
||||
ArrayPrototypePush(schemes, 'https', 'http');
|
||||
}
|
||||
diff --git a/lib/internal/modules/esm/resolve.js b/lib/internal/modules/esm/resolve.js
|
||||
index b56ad6cc833f00f58bf3925e9fd82a8f5b7b9bd7..8c9e8bfb4e828d044b236a11c0890cb4f0161050 100644
|
||||
index e73a8ad60a13925d6773c32cead8d04ec9d96ee7..52cdb7d5e14a18ed7b1b65e429729cf47dce3f98 100644
|
||||
--- a/lib/internal/modules/esm/resolve.js
|
||||
+++ b/lib/internal/modules/esm/resolve.js
|
||||
@@ -741,6 +741,8 @@ function packageImportsResolve(name, base, conditions) {
|
||||
|
||||
@@ -38,7 +38,7 @@ index 6a15fcae677b3bda58fc85f705862bbcd9feec9d..449131b9af99744c08d62d73f8d124ce
|
||||
const match = RegExpPrototypeExec(DATA_URL_PATTERN, url.pathname);
|
||||
if (!match) {
|
||||
diff --git a/lib/internal/modules/esm/resolve.js b/lib/internal/modules/esm/resolve.js
|
||||
index 8c9e8bfb4e828d044b236a11c0890cb4f0161050..30f6abd5d2d3fb7aceaa6191ebd99642e34d9ee4 100644
|
||||
index 52cdb7d5e14a18ed7b1b65e429729cf47dce3f98..69f73f829706deddc4f328b78af9d58434af647d 100644
|
||||
--- a/lib/internal/modules/esm/resolve.js
|
||||
+++ b/lib/internal/modules/esm/resolve.js
|
||||
@@ -24,7 +24,7 @@ const {
|
||||
|
||||
@@ -15,7 +15,7 @@ to recognize asar files.
|
||||
This reverts commit 9cf2e1f55b8446a7cde23699d00a3be73aa0c8f1.
|
||||
|
||||
diff --git a/lib/internal/modules/esm/resolve.js b/lib/internal/modules/esm/resolve.js
|
||||
index 30f6abd5d2d3fb7aceaa6191ebd99642e34d9ee4..cd5f59a5c27afd74f68c920a6ab5b8bc7992458c 100644
|
||||
index 69f73f829706deddc4f328b78af9d58434af647d..1d53a2a47423150e822bb917b2725d3a6a794814 100644
|
||||
--- a/lib/internal/modules/esm/resolve.js
|
||||
+++ b/lib/internal/modules/esm/resolve.js
|
||||
@@ -36,10 +36,9 @@ const preserveSymlinksMain = getOptionValue('--preserve-symlinks-main');
|
||||
|
||||
@@ -7,8 +7,7 @@ async function checkIfDocOnlyChange () {
|
||||
|
||||
if (prNumber || prURL) {
|
||||
try {
|
||||
// CircleCI doesn't provide the PR number except on forked PRs,
|
||||
// so to cover all cases we just extract it from the PR URL.
|
||||
// extract the PR number from the PR URL.
|
||||
if (!prNumber || isNaN(prNumber)) {
|
||||
if (args.prURL) {
|
||||
prNumber = prURL.split('/').pop();
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
const args = require('minimist')(process.argv.slice(2));
|
||||
const fs = require('node:fs');
|
||||
const got = require('got');
|
||||
const stream = require('node:stream');
|
||||
const { promisify } = require('node:util');
|
||||
|
||||
const pipeline = promisify(stream.pipeline);
|
||||
|
||||
async function downloadArtifact (name, buildNum, dest) {
|
||||
const circleArtifactUrl = `https://circleci.com/api/v1.1/project/github/electron/electron/${args.buildNum}/artifacts?circle-token=${process.env.CIRCLE_TOKEN}`;
|
||||
const responsePromise = got(circleArtifactUrl, {
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Accept: 'application/json'
|
||||
}
|
||||
});
|
||||
const [response, artifacts] = await Promise.all([responsePromise, responsePromise.json()]);
|
||||
if (response.statusCode !== 200) {
|
||||
console.error('Could not fetch circleci artifact list, got status code:', response.statusCode);
|
||||
}
|
||||
const artifactToDownload = artifacts.find(artifact => {
|
||||
return (artifact.path === name);
|
||||
});
|
||||
if (!artifactToDownload) {
|
||||
console.log(`Could not find artifact called ${name} to download for build #${buildNum}.`);
|
||||
process.exit(1);
|
||||
} else {
|
||||
console.log(`Downloading ${artifactToDownload.url}.`);
|
||||
let downloadError = false;
|
||||
await downloadWithRetry(artifactToDownload.url, dest).catch(err => {
|
||||
if (args.verbose) {
|
||||
console.log(`${artifactToDownload.url} could not be successfully downloaded. Error was:`, err);
|
||||
} else {
|
||||
console.log(`${artifactToDownload.url} could not be successfully downloaded.`);
|
||||
}
|
||||
downloadError = true;
|
||||
});
|
||||
if (!downloadError) {
|
||||
console.log(`Successfully downloaded ${name}.`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function downloadWithRetry (url, directory) {
|
||||
let lastError;
|
||||
const downloadURL = `${url}?circle-token=${process.env.CIRCLE_TOKEN}`;
|
||||
for (let i = 0; i < 5; i++) {
|
||||
console.log(`Attempting to download ${url} - attempt #${(i + 1)}`);
|
||||
try {
|
||||
return await downloadFile(downloadURL, directory);
|
||||
} catch (err) {
|
||||
lastError = err;
|
||||
await new Promise(resolve => setTimeout(resolve, 30000));
|
||||
}
|
||||
}
|
||||
throw lastError;
|
||||
}
|
||||
|
||||
function downloadFile (url, directory) {
|
||||
return pipeline(
|
||||
got.stream(url),
|
||||
fs.createWriteStream(directory)
|
||||
);
|
||||
}
|
||||
|
||||
if (!args.name || !args.buildNum || !args.dest) {
|
||||
console.log(`Download CircleCI artifacts.
|
||||
Usage: download-circleci-artifacts.js [--buildNum=CIRCLE_BUILD_NUMBER] [--name=artifactName] [--dest] [--verbose]`);
|
||||
process.exit(0);
|
||||
} else {
|
||||
downloadArtifact(args.name, args.buildNum, args.dest);
|
||||
}
|
||||
@@ -194,6 +194,9 @@ def get_buildtools_executable(name):
|
||||
chromium_platform = 'linux64'
|
||||
else:
|
||||
raise Exception(f"Unsupported platform: {sys.platform}")
|
||||
|
||||
if name == 'clang-format':
|
||||
chromium_platform += '-format'
|
||||
|
||||
path = os.path.join(buildtools, chromium_platform, name)
|
||||
if sys.platform == 'win32':
|
||||
|
||||
@@ -55,7 +55,7 @@ const CPPLINT_FILTERS = [
|
||||
];
|
||||
|
||||
function spawnAndCheckExitCode (cmd, args, opts) {
|
||||
opts = { stdio: 'inherit', ...opts };
|
||||
opts = { stdio: 'inherit', shell: IS_WINDOWS, ...opts };
|
||||
const { error, status, signal } = childProcess.spawnSync(cmd, args, opts);
|
||||
if (error) {
|
||||
// the subprocess failed or timed out
|
||||
@@ -100,9 +100,12 @@ const LINTERS = [{
|
||||
roots: ['shell'],
|
||||
test: filename => filename.endsWith('.cc') || (filename.endsWith('.h') && !isObjCHeader(filename)),
|
||||
run: (opts, filenames) => {
|
||||
const env = {
|
||||
CHROMIUM_BUILDTOOLS_PATH: path.resolve(ELECTRON_ROOT, '..', 'buildtools')
|
||||
};
|
||||
const clangFormatFlags = opts.fix ? ['--fix'] : [];
|
||||
for (const chunk of chunkFilenames(filenames)) {
|
||||
spawnAndCheckExitCode('python3', ['script/run-clang-format.py', ...clangFormatFlags, ...chunk]);
|
||||
spawnAndCheckExitCode('python3', ['script/run-clang-format.py', ...clangFormatFlags, ...chunk], { env });
|
||||
cpplint([`--filter=${CPPLINT_FILTERS.join(',')}`, ...chunk]);
|
||||
}
|
||||
}
|
||||
@@ -111,8 +114,11 @@ const LINTERS = [{
|
||||
roots: ['shell'],
|
||||
test: filename => filename.endsWith('.mm') || (filename.endsWith('.h') && isObjCHeader(filename)),
|
||||
run: (opts, filenames) => {
|
||||
const env = {
|
||||
CHROMIUM_BUILDTOOLS_PATH: path.resolve(ELECTRON_ROOT, '..', 'buildtools')
|
||||
};
|
||||
const clangFormatFlags = opts.fix ? ['--fix'] : [];
|
||||
spawnAndCheckExitCode('python3', ['script/run-clang-format.py', '-r', ...clangFormatFlags, ...filenames]);
|
||||
spawnAndCheckExitCode('python3', ['script/run-clang-format.py', '-r', ...clangFormatFlags, ...filenames], { env });
|
||||
const filter = [...CPPLINT_FILTERS, '-readability/braces'];
|
||||
cpplint(['--extensions=mm,h', `--filter=${filter.join(',')}`, ...filenames]);
|
||||
}
|
||||
@@ -124,7 +130,7 @@ const LINTERS = [{
|
||||
const rcfile = path.join(DEPOT_TOOLS, 'pylintrc-2.17');
|
||||
const args = ['--rcfile=' + rcfile, ...filenames];
|
||||
const env = { PYTHONPATH: path.join(ELECTRON_ROOT, 'script'), ...process.env };
|
||||
spawnAndCheckExitCode('pylint-2.17', args, { env });
|
||||
spawnAndCheckExitCode(IS_WINDOWS ? 'pylint-2.17.bat' : 'pylint-2.17', args, { env });
|
||||
}
|
||||
}, {
|
||||
key: 'javascript',
|
||||
@@ -170,8 +176,6 @@ const LINTERS = [{
|
||||
DEPOT_TOOLS_WIN_TOOLCHAIN: '0',
|
||||
...process.env
|
||||
};
|
||||
// Users may not have depot_tools in PATH.
|
||||
env.PATH = `${env.PATH}${path.delimiter}${DEPOT_TOOLS}`;
|
||||
const args = ['format', filename];
|
||||
if (!opts.fix) args.push('--dry-run');
|
||||
const result = childProcess.spawnSync('gn', args, { env, stdio: 'inherit', shell: true });
|
||||
|
||||
@@ -1,16 +1,6 @@
|
||||
const { appCredentialsFromString, getTokenForRepo } = require('@electron/github-app-auth');
|
||||
const cp = require('node:child_process');
|
||||
|
||||
if (!process.env.CIRCLE_BRANCH) {
|
||||
console.error('Not building for a specific branch, can\'t autopush a patch');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
if (process.env.CIRCLE_PR_NUMBER) {
|
||||
console.error('Building for a forked PR, can\'t autopush a patch');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
async function main () {
|
||||
const token = await getTokenForRepo(
|
||||
{
|
||||
|
||||
@@ -23,7 +23,7 @@ import traceback
|
||||
import tempfile
|
||||
|
||||
from functools import partial
|
||||
from lib.util import get_depot_tools_executable
|
||||
from lib.util import get_buildtools_executable
|
||||
|
||||
DEFAULT_EXTENSIONS = 'c,h,C,H,cpp,hpp,cc,hh,c++,h++,cxx,hxx,mm'
|
||||
DEFAULT_CLANG_FORMAT_IGNORE = '.clang-format-ignore'
|
||||
@@ -134,6 +134,7 @@ def run_clang_format_diff(args, file_name):
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
universal_newlines=True,
|
||||
encoding='utf-8',
|
||||
shell=True) as proc:
|
||||
outs = list(proc.stdout.readlines())
|
||||
errs = list(proc.stderr.readlines())
|
||||
@@ -186,10 +187,7 @@ def colorize(diff_lines):
|
||||
def print_diff(diff_lines, use_color):
|
||||
if use_color:
|
||||
diff_lines = colorize(diff_lines)
|
||||
if sys.version_info[0] < 3:
|
||||
sys.stdout.writelines((l.encode('utf-8') for l in diff_lines))
|
||||
else:
|
||||
sys.stdout.writelines(diff_lines)
|
||||
sys.stdout.writelines(diff_lines)
|
||||
|
||||
|
||||
def print_trouble(prog, message, use_colors):
|
||||
@@ -205,7 +203,7 @@ def main():
|
||||
'--clang-format-executable',
|
||||
metavar='EXECUTABLE',
|
||||
help='path to the clang-format executable',
|
||||
default=get_depot_tools_executable('clang-format'))
|
||||
default=get_buildtools_executable('clang-format'))
|
||||
parser.add_argument(
|
||||
'--extensions',
|
||||
help='comma-separated list of file extensions'
|
||||
|
||||
@@ -149,6 +149,12 @@ void DownloadItem::Cancel() {
|
||||
download_item_->Cancel(true);
|
||||
}
|
||||
|
||||
int64_t DownloadItem::GetCurrentBytesPerSecond() const {
|
||||
if (!CheckAlive())
|
||||
return 0;
|
||||
return download_item_->CurrentSpeed();
|
||||
}
|
||||
|
||||
int64_t DownloadItem::GetReceivedBytes() const {
|
||||
if (!CheckAlive())
|
||||
return 0;
|
||||
@@ -161,6 +167,12 @@ int64_t DownloadItem::GetTotalBytes() const {
|
||||
return download_item_->GetTotalBytes();
|
||||
}
|
||||
|
||||
int DownloadItem::GetPercentComplete() const {
|
||||
if (!CheckAlive())
|
||||
return 0;
|
||||
return download_item_->PercentComplete();
|
||||
}
|
||||
|
||||
std::string DownloadItem::GetMimeType() const {
|
||||
if (!CheckAlive())
|
||||
return "";
|
||||
@@ -248,6 +260,12 @@ double DownloadItem::GetStartTime() const {
|
||||
return download_item_->GetStartTime().InSecondsFSinceUnixEpoch();
|
||||
}
|
||||
|
||||
double DownloadItem::GetEndTime() const {
|
||||
if (!CheckAlive())
|
||||
return 0;
|
||||
return download_item_->GetEndTime().InSecondsFSinceUnixEpoch();
|
||||
}
|
||||
|
||||
// static
|
||||
gin::ObjectTemplateBuilder DownloadItem::GetObjectTemplateBuilder(
|
||||
v8::Isolate* isolate) {
|
||||
@@ -258,8 +276,11 @@ gin::ObjectTemplateBuilder DownloadItem::GetObjectTemplateBuilder(
|
||||
.SetMethod("resume", &DownloadItem::Resume)
|
||||
.SetMethod("canResume", &DownloadItem::CanResume)
|
||||
.SetMethod("cancel", &DownloadItem::Cancel)
|
||||
.SetMethod("getCurrentBytesPerSecond",
|
||||
&DownloadItem::GetCurrentBytesPerSecond)
|
||||
.SetMethod("getReceivedBytes", &DownloadItem::GetReceivedBytes)
|
||||
.SetMethod("getTotalBytes", &DownloadItem::GetTotalBytes)
|
||||
.SetMethod("getPercentComplete", &DownloadItem::GetPercentComplete)
|
||||
.SetMethod("getMimeType", &DownloadItem::GetMimeType)
|
||||
.SetMethod("hasUserGesture", &DownloadItem::HasUserGesture)
|
||||
.SetMethod("getFilename", &DownloadItem::GetFilename)
|
||||
@@ -276,7 +297,8 @@ gin::ObjectTemplateBuilder DownloadItem::GetObjectTemplateBuilder(
|
||||
.SetMethod("getSaveDialogOptions", &DownloadItem::GetSaveDialogOptions)
|
||||
.SetMethod("getLastModifiedTime", &DownloadItem::GetLastModifiedTime)
|
||||
.SetMethod("getETag", &DownloadItem::GetETag)
|
||||
.SetMethod("getStartTime", &DownloadItem::GetStartTime);
|
||||
.SetMethod("getStartTime", &DownloadItem::GetStartTime)
|
||||
.SetMethod("getEndTime", &DownloadItem::GetEndTime);
|
||||
}
|
||||
|
||||
const char* DownloadItem::GetTypeName() {
|
||||
|
||||
@@ -62,8 +62,10 @@ class DownloadItem : public gin::Wrappable<DownloadItem>,
|
||||
void Resume();
|
||||
bool CanResume() const;
|
||||
void Cancel();
|
||||
int64_t GetCurrentBytesPerSecond() const;
|
||||
int64_t GetReceivedBytes() const;
|
||||
int64_t GetTotalBytes() const;
|
||||
int GetPercentComplete() const;
|
||||
std::string GetMimeType() const;
|
||||
bool HasUserGesture() const;
|
||||
std::string GetFilename() const;
|
||||
@@ -76,6 +78,7 @@ class DownloadItem : public gin::Wrappable<DownloadItem>,
|
||||
std::string GetLastModifiedTime() const;
|
||||
std::string GetETag() const;
|
||||
double GetStartTime() const;
|
||||
double GetEndTime() const;
|
||||
|
||||
base::FilePath save_path_;
|
||||
file_dialog::DialogSettings dialog_options_;
|
||||
|
||||
@@ -178,7 +178,7 @@ View::~View() {
|
||||
return;
|
||||
view_->RemoveObserver(this);
|
||||
if (delete_view_)
|
||||
delete view_;
|
||||
view_.ClearAndDelete();
|
||||
}
|
||||
|
||||
void View::ReorderChildView(gin::Handle<View> child, size_t index) {
|
||||
|
||||
@@ -3729,14 +3729,17 @@ void WebContents::SetBackgroundColor(std::optional<SkColor> maybe_color) {
|
||||
type_ == Type::kBrowserView
|
||||
? SK_ColorTRANSPARENT
|
||||
: SK_ColorWHITE);
|
||||
bool is_opaque = SkColorGetA(color) == SK_AlphaOPAQUE;
|
||||
web_contents()->SetPageBaseBackgroundColor(color);
|
||||
|
||||
content::RenderFrameHost* rfh = web_contents()->GetPrimaryMainFrame();
|
||||
if (!rfh)
|
||||
return;
|
||||
|
||||
content::RenderWidgetHostView* rwhv = rfh->GetView();
|
||||
if (rwhv) {
|
||||
rwhv->SetBackgroundColor(color);
|
||||
// RenderWidgetHostView doesn't allow setting an alpha that's not 0 or 255.
|
||||
rwhv->SetBackgroundColor(is_opaque ? color : SK_ColorTRANSPARENT);
|
||||
static_cast<content::RenderWidgetHostViewBase*>(rwhv)
|
||||
->SetContentBackgroundColor(color);
|
||||
}
|
||||
|
||||
@@ -602,6 +602,7 @@ void ElectronBrowserMainParts::PostMainMessageLoopRun() {
|
||||
node_env_->set_trace_sync_io(false);
|
||||
js_env_->DestroyMicrotasksRunner();
|
||||
node::Stop(node_env_.get(), node::StopFlags::kDoNotTerminateIsolate);
|
||||
node_bindings_->set_uv_env(nullptr);
|
||||
node_env_.reset();
|
||||
|
||||
auto default_context_key = ElectronBrowserContext::PartitionKey("", false);
|
||||
|
||||
@@ -155,10 +155,10 @@ class ElectronBrowserMainParts : public content::BrowserMainParts {
|
||||
// Before then, we just exit() without any intermediate steps.
|
||||
std::optional<int> exit_code_;
|
||||
|
||||
std::unique_ptr<NodeBindings> node_bindings_;
|
||||
const std::unique_ptr<NodeBindings> node_bindings_;
|
||||
|
||||
// depends-on: node_bindings_
|
||||
std::unique_ptr<ElectronBindings> electron_bindings_;
|
||||
const std::unique_ptr<ElectronBindings> electron_bindings_;
|
||||
|
||||
// depends-on: node_bindings_
|
||||
std::unique_ptr<JavascriptEnvironment> js_env_;
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
#include "base/command_line.h"
|
||||
#include "base/containers/contains.h"
|
||||
#include "base/containers/map_util.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/strings/stringprintf.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
@@ -149,21 +150,18 @@ void HidChooserContext::RevokeEphemeralDevicePermission(
|
||||
const url::Origin& origin,
|
||||
const device::mojom::HidDeviceInfo& device) {
|
||||
auto it = ephemeral_devices_.find(origin);
|
||||
if (it != ephemeral_devices_.end()) {
|
||||
std::set<std::string>& devices = it->second;
|
||||
for (auto guid = devices.begin(); guid != devices.end();) {
|
||||
DCHECK(base::Contains(devices_, *guid));
|
||||
if (it == ephemeral_devices_.end())
|
||||
return;
|
||||
|
||||
if (devices_[*guid]->physical_device_id != device.physical_device_id) {
|
||||
++guid;
|
||||
continue;
|
||||
}
|
||||
std::set<std::string>& device_guids = it->second;
|
||||
std::erase_if(device_guids, [&](const auto& guid) {
|
||||
auto* device_ptr = base::FindPtrOrNull(devices_, guid);
|
||||
return device_ptr &&
|
||||
device_ptr->physical_device_id == device.physical_device_id;
|
||||
});
|
||||
|
||||
guid = devices.erase(guid);
|
||||
if (devices.empty())
|
||||
ephemeral_devices_.erase(it);
|
||||
}
|
||||
}
|
||||
if (device_guids.empty())
|
||||
ephemeral_devices_.erase(it);
|
||||
}
|
||||
|
||||
bool HidChooserContext::HasDevicePermission(
|
||||
|
||||
@@ -109,7 +109,7 @@ class OffScreenWebContentsView : public content::WebContentsView,
|
||||
raw_ptr<content::WebContents> web_contents_ = nullptr;
|
||||
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
RAW_PTR_EXCLUSION OffScreenView* offScreenView_;
|
||||
RAW_PTR_EXCLUSION OffScreenView* offScreenView_ = nullptr;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
@@ -7,23 +7,29 @@
|
||||
#include <string_view>
|
||||
#include <utility>
|
||||
|
||||
#include "components/content_settings/core/common/content_settings.h"
|
||||
#include "components/webrtc/media_stream_devices_controller.h"
|
||||
#include "content/public/browser/browser_context.h"
|
||||
#include "content/public/browser/render_process_host.h"
|
||||
#include "content/public/browser/web_contents_user_data.h"
|
||||
#include "shell/browser/electron_permission_manager.h"
|
||||
// #include "shell/browser/media/media_stream_devices_controller.h"
|
||||
#include "components/content_settings/core/common/content_settings.h"
|
||||
#include "components/webrtc/media_stream_devices_controller.h"
|
||||
#include "shell/browser/media/media_capture_devices_dispatcher.h"
|
||||
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
#include "chrome/browser/media/webrtc/system_media_capture_permissions_mac.h"
|
||||
#endif
|
||||
|
||||
using blink::mojom::MediaStreamRequestResult;
|
||||
using blink::mojom::MediaStreamType;
|
||||
|
||||
namespace {
|
||||
|
||||
constexpr std::string_view MediaStreamTypeToString(
|
||||
blink::mojom::MediaStreamType type) {
|
||||
switch (type) {
|
||||
case blink::mojom::MediaStreamType::DEVICE_AUDIO_CAPTURE:
|
||||
case MediaStreamType::DEVICE_AUDIO_CAPTURE:
|
||||
return "audio";
|
||||
case blink::mojom::MediaStreamType::DEVICE_VIDEO_CAPTURE:
|
||||
case MediaStreamType::DEVICE_VIDEO_CAPTURE:
|
||||
return "video";
|
||||
default:
|
||||
return "unknown";
|
||||
@@ -48,53 +54,74 @@ namespace {
|
||||
-1 /* kFullDesktopScreenId */);
|
||||
}
|
||||
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
bool SystemMediaPermissionDenied(const content::MediaStreamRequest& request) {
|
||||
if (request.audio_type != MediaStreamType::NO_SERVICE) {
|
||||
const auto system_audio_permission =
|
||||
system_media_permissions::CheckSystemAudioCapturePermission();
|
||||
return system_audio_permission ==
|
||||
system_media_permissions::SystemPermission::kRestricted ||
|
||||
system_audio_permission ==
|
||||
system_media_permissions::SystemPermission::kDenied;
|
||||
}
|
||||
if (request.video_type != MediaStreamType::NO_SERVICE) {
|
||||
const auto system_video_permission =
|
||||
system_media_permissions::CheckSystemVideoCapturePermission();
|
||||
return system_video_permission ==
|
||||
system_media_permissions::SystemPermission::kRestricted ||
|
||||
system_video_permission ==
|
||||
system_media_permissions::SystemPermission::kDenied;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Handles requests for legacy-style `navigator.getUserMedia(...)` calls.
|
||||
// This includes desktop capture through the chromeMediaSource /
|
||||
// chromeMediaSourceId constraints.
|
||||
void HandleUserMediaRequest(const content::MediaStreamRequest& request,
|
||||
content::MediaResponseCallback callback) {
|
||||
blink::mojom::StreamDevicesSetPtr stream_devices_set =
|
||||
blink::mojom::StreamDevicesSet::New();
|
||||
stream_devices_set->stream_devices.emplace_back(
|
||||
blink::mojom::StreamDevices::New());
|
||||
blink::mojom::StreamDevices& devices = *stream_devices_set->stream_devices[0];
|
||||
auto stream_devices_set = blink::mojom::StreamDevicesSet::New();
|
||||
auto devices = blink::mojom::StreamDevices::New();
|
||||
stream_devices_set->stream_devices.emplace_back(std::move(devices));
|
||||
auto& devices_ref = *stream_devices_set->stream_devices[0];
|
||||
|
||||
if (request.audio_type ==
|
||||
blink::mojom::MediaStreamType::GUM_TAB_AUDIO_CAPTURE) {
|
||||
devices.audio_device = blink::MediaStreamDevice(
|
||||
blink::mojom::MediaStreamType::GUM_TAB_AUDIO_CAPTURE, "", "");
|
||||
}
|
||||
if (request.video_type ==
|
||||
blink::mojom::MediaStreamType::GUM_TAB_VIDEO_CAPTURE) {
|
||||
devices.video_device = blink::MediaStreamDevice(
|
||||
blink::mojom::MediaStreamType::GUM_TAB_VIDEO_CAPTURE, "", "");
|
||||
}
|
||||
if (request.audio_type ==
|
||||
blink::mojom::MediaStreamType::GUM_DESKTOP_AUDIO_CAPTURE) {
|
||||
devices.audio_device = blink::MediaStreamDevice(
|
||||
blink::mojom::MediaStreamType::GUM_DESKTOP_AUDIO_CAPTURE, "loopback",
|
||||
"System Audio");
|
||||
}
|
||||
if (request.video_type ==
|
||||
blink::mojom::MediaStreamType::GUM_DESKTOP_VIDEO_CAPTURE) {
|
||||
devices.video_device = blink::MediaStreamDevice(
|
||||
blink::mojom::MediaStreamType::GUM_DESKTOP_VIDEO_CAPTURE,
|
||||
GetScreenId(request.requested_video_device_ids).ToString(), "Screen");
|
||||
if (request.audio_type == MediaStreamType::GUM_TAB_AUDIO_CAPTURE ||
|
||||
request.audio_type == MediaStreamType::GUM_DESKTOP_AUDIO_CAPTURE) {
|
||||
devices_ref.audio_device = blink::MediaStreamDevice(
|
||||
request.audio_type,
|
||||
request.audio_type == MediaStreamType::GUM_DESKTOP_AUDIO_CAPTURE
|
||||
? "loopback"
|
||||
: "",
|
||||
request.audio_type == MediaStreamType::GUM_DESKTOP_AUDIO_CAPTURE
|
||||
? "System Audio"
|
||||
: "");
|
||||
}
|
||||
|
||||
bool empty =
|
||||
!devices.audio_device.has_value() && !devices.video_device.has_value();
|
||||
std::move(callback).Run(
|
||||
*stream_devices_set,
|
||||
empty ? blink::mojom::MediaStreamRequestResult::NO_HARDWARE
|
||||
: blink::mojom::MediaStreamRequestResult::OK,
|
||||
nullptr);
|
||||
if (request.video_type == MediaStreamType::GUM_TAB_VIDEO_CAPTURE ||
|
||||
request.video_type == MediaStreamType::GUM_DESKTOP_VIDEO_CAPTURE) {
|
||||
devices_ref.video_device = blink::MediaStreamDevice(
|
||||
request.video_type,
|
||||
request.video_type == MediaStreamType::GUM_DESKTOP_VIDEO_CAPTURE
|
||||
? GetScreenId(request.requested_video_device_ids).ToString()
|
||||
: "",
|
||||
request.video_type == MediaStreamType::GUM_DESKTOP_VIDEO_CAPTURE
|
||||
? "Screen"
|
||||
: "");
|
||||
}
|
||||
|
||||
bool empty = !devices_ref.audio_device.has_value() &&
|
||||
!devices_ref.video_device.has_value();
|
||||
std::move(callback).Run(*stream_devices_set,
|
||||
empty ? MediaStreamRequestResult::NO_HARDWARE
|
||||
: MediaStreamRequestResult::OK,
|
||||
nullptr);
|
||||
}
|
||||
|
||||
void OnMediaStreamRequestResponse(
|
||||
content::MediaResponseCallback callback,
|
||||
const blink::mojom::StreamDevicesSet& stream_devices_set,
|
||||
blink::mojom::MediaStreamRequestResult result,
|
||||
MediaStreamRequestResult result,
|
||||
bool blocked_by_permissions_policy,
|
||||
ContentSetting audio_setting,
|
||||
ContentSetting video_setting) {
|
||||
@@ -105,31 +132,34 @@ void MediaAccessAllowed(const content::MediaStreamRequest& request,
|
||||
content::MediaResponseCallback callback,
|
||||
bool allowed) {
|
||||
if (allowed) {
|
||||
if (request.video_type ==
|
||||
blink::mojom::MediaStreamType::GUM_DESKTOP_VIDEO_CAPTURE ||
|
||||
request.audio_type ==
|
||||
blink::mojom::MediaStreamType::GUM_DESKTOP_AUDIO_CAPTURE ||
|
||||
request.video_type ==
|
||||
blink::mojom::MediaStreamType::GUM_TAB_VIDEO_CAPTURE ||
|
||||
request.audio_type ==
|
||||
blink::mojom::MediaStreamType::GUM_TAB_AUDIO_CAPTURE) {
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
// If the request was approved, ask for system permissions if needed.
|
||||
// See
|
||||
// chrome/browser/media/webrtc/permission_bubble_media_access_handler.cc.
|
||||
if (SystemMediaPermissionDenied(request)) {
|
||||
std::move(callback).Run(blink::mojom::StreamDevicesSet(),
|
||||
MediaStreamRequestResult::PERMISSION_DENIED,
|
||||
nullptr);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
if (request.video_type == MediaStreamType::GUM_DESKTOP_VIDEO_CAPTURE ||
|
||||
request.audio_type == MediaStreamType::GUM_DESKTOP_AUDIO_CAPTURE ||
|
||||
request.video_type == MediaStreamType::GUM_TAB_VIDEO_CAPTURE ||
|
||||
request.audio_type == MediaStreamType::GUM_TAB_AUDIO_CAPTURE) {
|
||||
HandleUserMediaRequest(request, std::move(callback));
|
||||
} else if (request.video_type ==
|
||||
blink::mojom::MediaStreamType::DEVICE_VIDEO_CAPTURE ||
|
||||
request.audio_type ==
|
||||
blink::mojom::MediaStreamType::DEVICE_AUDIO_CAPTURE) {
|
||||
} else if (request.video_type == MediaStreamType::DEVICE_VIDEO_CAPTURE ||
|
||||
request.audio_type == MediaStreamType::DEVICE_AUDIO_CAPTURE) {
|
||||
webrtc::MediaStreamDevicesController::RequestPermissions(
|
||||
request, MediaCaptureDevicesDispatcher::GetInstance(),
|
||||
base::BindOnce(&OnMediaStreamRequestResponse, std::move(callback)),
|
||||
allowed);
|
||||
} else if (request.video_type ==
|
||||
blink::mojom::MediaStreamType::DISPLAY_VIDEO_CAPTURE ||
|
||||
request.video_type == blink::mojom::MediaStreamType::
|
||||
DISPLAY_VIDEO_CAPTURE_THIS_TAB ||
|
||||
} else if (request.video_type == MediaStreamType::DISPLAY_VIDEO_CAPTURE ||
|
||||
request.video_type ==
|
||||
blink::mojom::MediaStreamType::DISPLAY_VIDEO_CAPTURE_SET ||
|
||||
request.audio_type ==
|
||||
blink::mojom::MediaStreamType::DISPLAY_AUDIO_CAPTURE) {
|
||||
MediaStreamType::DISPLAY_VIDEO_CAPTURE_THIS_TAB ||
|
||||
request.video_type ==
|
||||
MediaStreamType::DISPLAY_VIDEO_CAPTURE_SET ||
|
||||
request.audio_type == MediaStreamType::DISPLAY_AUDIO_CAPTURE) {
|
||||
content::RenderFrameHost* rfh = content::RenderFrameHost::FromID(
|
||||
request.render_process_id, request.render_frame_id);
|
||||
if (!rfh)
|
||||
@@ -144,16 +174,15 @@ void MediaAccessAllowed(const content::MediaStreamRequest& request,
|
||||
return;
|
||||
std::move(split_callback.first)
|
||||
.Run(blink::mojom::StreamDevicesSet(),
|
||||
blink::mojom::MediaStreamRequestResult::NOT_SUPPORTED, nullptr);
|
||||
MediaStreamRequestResult::NOT_SUPPORTED, nullptr);
|
||||
} else {
|
||||
std::move(callback).Run(
|
||||
blink::mojom::StreamDevicesSet(),
|
||||
blink::mojom::MediaStreamRequestResult::NOT_SUPPORTED, nullptr);
|
||||
std::move(callback).Run(blink::mojom::StreamDevicesSet(),
|
||||
MediaStreamRequestResult::NOT_SUPPORTED, nullptr);
|
||||
}
|
||||
} else {
|
||||
std::move(callback).Run(
|
||||
blink::mojom::StreamDevicesSet(),
|
||||
blink::mojom::MediaStreamRequestResult::PERMISSION_DENIED, nullptr);
|
||||
std::move(callback).Run(blink::mojom::StreamDevicesSet(),
|
||||
MediaStreamRequestResult::PERMISSION_DENIED,
|
||||
nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1559,19 +1559,6 @@ describe('app module', () => {
|
||||
});
|
||||
|
||||
ifdescribe(!(process.platform === 'linux' && (process.arch === 'arm64' || process.arch === 'arm')))('sandbox options', () => {
|
||||
// Our ARM tests are run on VSTS rather than CircleCI, and the Docker
|
||||
// setup on VSTS disallows syscalls that Chrome requires for setting up
|
||||
// sandboxing.
|
||||
// See:
|
||||
// - https://docs.docker.com/engine/security/seccomp/#significant-syscalls-blocked-by-the-default-profile
|
||||
// - https://chromium.googlesource.com/chromium/src/+/70.0.3538.124/sandbox/linux/services/credentials.cc#292
|
||||
// - https://github.com/docker/docker-ce/blob/ba7dfc59ccfe97c79ee0d1379894b35417b40bca/components/engine/profiles/seccomp/seccomp_default.go#L497
|
||||
// - https://blog.jessfraz.com/post/how-to-use-new-docker-seccomp-profiles/
|
||||
//
|
||||
// Adding `--cap-add SYS_ADMIN` or `--security-opt seccomp=unconfined`
|
||||
// to the Docker invocation allows the syscalls that Chrome needs, but
|
||||
// are probably more permissive than we'd like.
|
||||
|
||||
let appProcess: cp.ChildProcess = null as any;
|
||||
let server: net.Server = null as any;
|
||||
const socketPath = process.platform === 'win32' ? '\\\\.\\pipe\\electron-mixed-sandbox' : '/tmp/electron-mixed-sandbox';
|
||||
|
||||
@@ -1660,6 +1660,7 @@ describe('BrowserWindow module', () => {
|
||||
w = new BrowserWindow({});
|
||||
expect(w.getBackgroundColor()).to.equal('#FFFFFF');
|
||||
});
|
||||
|
||||
it('returns correct value if backgroundColor is set', () => {
|
||||
const backgroundColor = '#BBAAFF';
|
||||
w.destroy();
|
||||
@@ -1668,6 +1669,7 @@ describe('BrowserWindow module', () => {
|
||||
});
|
||||
expect(w.getBackgroundColor()).to.equal(backgroundColor);
|
||||
});
|
||||
|
||||
it('returns correct value from setBackgroundColor()', () => {
|
||||
const backgroundColor = '#AABBFF';
|
||||
w.destroy();
|
||||
@@ -1675,24 +1677,42 @@ describe('BrowserWindow module', () => {
|
||||
w.setBackgroundColor(backgroundColor);
|
||||
expect(w.getBackgroundColor()).to.equal(backgroundColor);
|
||||
});
|
||||
it('returns correct color with multiple passed formats', () => {
|
||||
|
||||
it('returns correct color with multiple passed formats', async () => {
|
||||
w.destroy();
|
||||
w = new BrowserWindow({});
|
||||
|
||||
w.setBackgroundColor('#AABBFF');
|
||||
expect(w.getBackgroundColor()).to.equal('#AABBFF');
|
||||
await w.loadURL('about:blank');
|
||||
|
||||
w.setBackgroundColor('blueviolet');
|
||||
expect(w.getBackgroundColor()).to.equal('#8A2BE2');
|
||||
const colors = new Map([
|
||||
['blueviolet', '#8A2BE2'],
|
||||
['rgb(255, 0, 185)', '#FF00B9'],
|
||||
['hsl(155, 100%, 50%)', '#00FF95'],
|
||||
['#355E3B', '#355E3B']
|
||||
]);
|
||||
|
||||
w.setBackgroundColor('rgb(255, 0, 185)');
|
||||
expect(w.getBackgroundColor()).to.equal('#FF00B9');
|
||||
for (const [color, hex] of colors) {
|
||||
w.setBackgroundColor(color);
|
||||
expect(w.getBackgroundColor()).to.equal(hex);
|
||||
}
|
||||
});
|
||||
|
||||
w.setBackgroundColor('rgba(245, 40, 145, 0.8)');
|
||||
expect(w.getBackgroundColor()).to.equal('#F52891');
|
||||
it('can set the background color with transparency', async () => {
|
||||
w.destroy();
|
||||
w = new BrowserWindow({});
|
||||
|
||||
w.setBackgroundColor('hsl(155, 100%, 50%)');
|
||||
expect(w.getBackgroundColor()).to.equal('#00FF95');
|
||||
await w.loadURL('about:blank');
|
||||
|
||||
const colors = new Map([
|
||||
['hsl(155, 100%, 50%)', '#00FF95'],
|
||||
['rgba(245, 40, 145, 0.8)', '#F52891'],
|
||||
['#1D1F21d9', '#1F21D9']
|
||||
]);
|
||||
|
||||
for (const [color, hex] of colors) {
|
||||
w.setBackgroundColor(color);
|
||||
expect(w.getBackgroundColor()).to.equal(hex);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -21,10 +21,6 @@ describe('setDisplayMediaRequestHandler', () => {
|
||||
server.close();
|
||||
});
|
||||
|
||||
// FIXME(nornagon): this test fails on our macOS CircleCI runners with the
|
||||
// error message:
|
||||
// [ERROR:video_capture_device_client.cc(659)] error@ OnStart@content/browser/media/capture/desktop_capture_device_mac.cc:98, CGDisplayStreamCreate failed, OS message: Value too large to be stored in data type (84)
|
||||
// This is possibly related to the OS/VM setup that CircleCI uses for macOS.
|
||||
ifit(process.platform !== 'darwin')('works when calling getDisplayMedia', async function () {
|
||||
if ((await desktopCapturer.getSources({ types: ['screen'] })).length === 0) {
|
||||
return this.skip();
|
||||
|
||||
@@ -889,13 +889,21 @@ describe('session module', () => {
|
||||
}
|
||||
});
|
||||
|
||||
const today = Math.floor(Date.now() / 1000);
|
||||
const item = await downloadDone;
|
||||
expect(item.getState()).to.equal('completed');
|
||||
expect(item.getFilename()).to.equal('mock.pdf');
|
||||
expect(item.getMimeType()).to.equal('application/pdf');
|
||||
expect(item.getReceivedBytes()).to.equal(mockPDF.length);
|
||||
expect(item.getTotalBytes()).to.equal(mockPDF.length);
|
||||
expect(item.getPercentComplete()).to.equal(100);
|
||||
expect(item.getCurrentBytesPerSecond()).to.equal(0);
|
||||
expect(item.getContentDisposition()).to.equal(contentDisposition);
|
||||
|
||||
const start = item.getStartTime();
|
||||
const end = item.getEndTime();
|
||||
expect(start).to.be.greaterThan(today);
|
||||
expect(end).to.be.greaterThan(start);
|
||||
});
|
||||
|
||||
it('throws when called with invalid headers', () => {
|
||||
|
||||
@@ -18,11 +18,6 @@ export function getCodesignIdentity () {
|
||||
if (identity === undefined) {
|
||||
const result = cp.spawnSync(path.resolve(__dirname, '../../script/codesign/get-trusted-identity.sh'));
|
||||
if (result.status !== 0 || result.stdout.toString().trim().length === 0) {
|
||||
// Per https://circleci.com/docs/2.0/env-vars:
|
||||
// CIRCLE_PR_NUMBER is only present on forked PRs
|
||||
if (process.env.CI && !process.env.CIRCLE_PR_NUMBER) {
|
||||
throw new Error('No valid signing identity available to run autoUpdater specs');
|
||||
}
|
||||
identity = null;
|
||||
} else {
|
||||
identity = result.stdout.toString().trim();
|
||||
|
||||
@@ -90,8 +90,6 @@ describe('version-bumper', () => {
|
||||
});
|
||||
});
|
||||
|
||||
// On macOS Circle CI we don't have a real git environment due to running
|
||||
// gclient sync on a linux machine. These tests therefore don't run as expected.
|
||||
ifdescribe(!(process.platform === 'linux' && process.arch.indexOf('arm') === 0) && process.platform !== 'darwin')('nextVersion', () => {
|
||||
describe('bump versions', () => {
|
||||
const nightlyPattern = /[0-9.]*(-nightly.(\d{4})(\d{2})(\d{2}))$/g;
|
||||
|
||||
Reference in New Issue
Block a user