mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
Compare commits
116 Commits
v38.0.0-be
...
v39.0.0-ni
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8ab5ac9069 | ||
|
|
27a8cc531b | ||
|
|
26ffc8505c | ||
|
|
3b0f35a7e8 | ||
|
|
8769d5ba9e | ||
|
|
7f8b7c3873 | ||
|
|
8bf4260e3e | ||
|
|
7a13c6f175 | ||
|
|
678fb400fd | ||
|
|
8806499904 | ||
|
|
637a504e28 | ||
|
|
40cdfdb1d1 | ||
|
|
4ca10a1056 | ||
|
|
9d05454dc7 | ||
|
|
0e862bba61 | ||
|
|
4232ed2814 | ||
|
|
e7683bdd25 | ||
|
|
bdaf3b9a2b | ||
|
|
5c98e3609f | ||
|
|
2cfccac074 | ||
|
|
03aad28412 | ||
|
|
25e2459f31 | ||
|
|
18af498cf1 | ||
|
|
9f43503b3e | ||
|
|
ecb1eb0b5d | ||
|
|
2c916cfa33 | ||
|
|
4c9ab8765b | ||
|
|
051f78dd1d | ||
|
|
c796a74467 | ||
|
|
0d0cbaf7b4 | ||
|
|
63c452dcc7 | ||
|
|
f6407b4949 | ||
|
|
06d7a51a58 | ||
|
|
2255bb620a | ||
|
|
084c6ef549 | ||
|
|
01faaa30ea | ||
|
|
c569d5e4ba | ||
|
|
670da27305 | ||
|
|
5f901174c5 | ||
|
|
b39a1fb877 | ||
|
|
2156ccb577 | ||
|
|
9e2f7065a0 | ||
|
|
51bfe07da9 | ||
|
|
4699761649 | ||
|
|
26e1bda335 | ||
|
|
cf871bce4e | ||
|
|
39cca586f6 | ||
|
|
2f4a070c39 | ||
|
|
2b098408a8 | ||
|
|
fa844268ec | ||
|
|
a29a72c3ab | ||
|
|
4601aeccde | ||
|
|
31b18c9830 | ||
|
|
895bf9103e | ||
|
|
bf51d345c8 | ||
|
|
6eef170d9a | ||
|
|
31725b4a86 | ||
|
|
ec748eb915 | ||
|
|
5feb91e2f4 | ||
|
|
5128ebeddb | ||
|
|
389927dce8 | ||
|
|
67afc10b75 | ||
|
|
f570e6967f | ||
|
|
09ab71de43 | ||
|
|
21b325b034 | ||
|
|
cc9ca4bee2 | ||
|
|
17dba93587 | ||
|
|
603cafad7e | ||
|
|
09f269426e | ||
|
|
3bbb82b42b | ||
|
|
a9504abde9 | ||
|
|
9f3636ffe2 | ||
|
|
4a89068fb7 | ||
|
|
137d4ec329 | ||
|
|
624d085632 | ||
|
|
600b6b3315 | ||
|
|
9e67bd3508 | ||
|
|
909fd3d55a | ||
|
|
f2429c31c1 | ||
|
|
fbb83be785 | ||
|
|
1eab19fc7c | ||
|
|
02f2feabe6 | ||
|
|
712262597d | ||
|
|
31bc5ca903 | ||
|
|
03a02fc31e | ||
|
|
5ef6897bc7 | ||
|
|
bc585b6a3f | ||
|
|
4c460df0a4 | ||
|
|
cf193b279b | ||
|
|
655037fbdf | ||
|
|
07338bb1cf | ||
|
|
fb0b77b731 | ||
|
|
499e987c77 | ||
|
|
f7138344d8 | ||
|
|
b9248e6782 | ||
|
|
af39dcfb09 | ||
|
|
d347632046 | ||
|
|
4f69c5835e | ||
|
|
fa15332587 | ||
|
|
e299a1d098 | ||
|
|
c2302960a8 | ||
|
|
5e862f398e | ||
|
|
61c245761c | ||
|
|
7c55b24be2 | ||
|
|
4af248f2b6 | ||
|
|
69e9b653ba | ||
|
|
4dccccadbb | ||
|
|
79cd6a2614 | ||
|
|
2ba8fe9140 | ||
|
|
b21c4b0f88 | ||
|
|
f50ad3d022 | ||
|
|
7a274a711c | ||
|
|
bc499ffb8a | ||
|
|
0a74e91580 | ||
|
|
035879357e | ||
|
|
e4c37e4b38 |
10
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
10
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
@@ -58,6 +58,16 @@ body:
|
||||
label: Last Known Working Electron version
|
||||
description: What is the last version of Electron this worked in, if applicable?
|
||||
placeholder: 16.0.0
|
||||
- type: dropdown
|
||||
attributes:
|
||||
label: Does the issue also appear in Chromium / Google Chrome?
|
||||
description: If it does, please report the issue in the [Chromium issue tracker](https://issues.chromium.org/issues), not against Electron. Electron will inherit the fix once Chromium resolves the issue.
|
||||
options:
|
||||
- I don't know how to test
|
||||
- "Yes"
|
||||
- "No"
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Expected Behavior
|
||||
|
||||
13
.github/actions/build-electron/action.yml
vendored
13
.github/actions/build-electron/action.yml
vendored
@@ -47,6 +47,11 @@ runs:
|
||||
- name: Add Clang problem matcher
|
||||
shell: bash
|
||||
run: echo "::add-matcher::src/electron/.github/problem-matchers/clang.json"
|
||||
- name: Enable long paths for Windows
|
||||
shell: powershell
|
||||
if: ${{ inputs.target-platform == 'win' }}
|
||||
run: |
|
||||
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1 -Type DWord
|
||||
- name: Build Electron ${{ inputs.step-suffix }}
|
||||
shell: bash
|
||||
run: |
|
||||
@@ -149,6 +154,14 @@ runs:
|
||||
cd src
|
||||
e build --target electron:electron_chromedriver -j $NUMBER_OF_NINJA_PROCESSES
|
||||
e build --target electron:electron_chromedriver_zip
|
||||
|
||||
if [ "${{ inputs.is-asan }}" != "true" ]; then
|
||||
target_os=${{ inputs.target-platform == 'macos' && 'mac' || inputs.target-platform }}
|
||||
if [ "${{ inputs.artifact-platform }}" = "mas" ]; then
|
||||
target_os="${target_os}_mas"
|
||||
fi
|
||||
electron/script/zip_manifests/check-zip-manifest.py out/Default/chromedriver.zip electron/script/zip_manifests/chromedriver_zip.$target_os.${{ inputs.target-arch }}.manifest
|
||||
fi
|
||||
- name: Build Node.js headers ${{ inputs.step-suffix }}
|
||||
shell: bash
|
||||
run: |
|
||||
|
||||
5
.github/actions/free-space-macos/action.yml
vendored
5
.github/actions/free-space-macos/action.yml
vendored
@@ -6,6 +6,8 @@ runs:
|
||||
- name: Free Space on MacOS
|
||||
shell: bash
|
||||
run: |
|
||||
echo "Disk usage before cleanup:"
|
||||
df -h
|
||||
sudo mkdir -p $TMPDIR/del-target
|
||||
|
||||
tmpify() {
|
||||
@@ -73,4 +75,5 @@ runs:
|
||||
|
||||
# lipo off some huge binaries arm64 versions to save space
|
||||
strip_universal_deep $(xcode-select -p)/../SharedFrameworks
|
||||
# strip_arm_deep /System/Volumes/Data/Library/Developer/CommandLineTools/usr
|
||||
# strip_arm_deep /System/Volumes/Data/Library/Developer/CommandLineTools/usr
|
||||
sudo mdutil -a -i off
|
||||
|
||||
@@ -36,8 +36,12 @@ runs:
|
||||
echo "SAS Token not found; exiting src cache download early..."
|
||||
exit 1
|
||||
else
|
||||
sas_token=$(jq -r '.sasToken' sas-token)
|
||||
account_name=$(jq -r '.accountName' sas-token)
|
||||
echo "const fs = require('fs');" > gettoken.js
|
||||
echo "const fileContents = fs.readFileSync('sas-token', 'utf8');" >> gettoken.js
|
||||
echo "const token = JSON.parse(fileContents);" >> gettoken.js
|
||||
echo "console.log(token[process.argv[2]])" >> gettoken.js
|
||||
sas_token=$(node ./gettoken.js sasToken)
|
||||
account_name=$(node ./gettoken.js accountName)
|
||||
if [ "${{ inputs.target-platform }}" = "win" ]; then
|
||||
azcopy copy --log-level=ERROR \
|
||||
"https://$account_name.file.core.windows.net/${{ env.AZURE_AKS_WIN_CACHE_SHARE_NAME }}/${{ env.CACHE_PATH }}?$sas_token" $DEPSHASH.tar
|
||||
|
||||
4
.github/actions/ssh-debug/action.yml
vendored
4
.github/actions/ssh-debug/action.yml
vendored
@@ -6,10 +6,10 @@ inputs:
|
||||
required: true
|
||||
default: 'false'
|
||||
timeout:
|
||||
description: 'SSH session timeout in seconds'
|
||||
description: 'SSH session timeout in minutes'
|
||||
required: false
|
||||
type: number
|
||||
default: 3600
|
||||
default: 60
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
|
||||
128
.github/actions/ssh-debug/setup-ssh.sh
vendored
128
.github/actions/ssh-debug/setup-ssh.sh
vendored
@@ -1,20 +1,44 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
if [ "${TUNNEL}" != "true" ]; then
|
||||
get_authorized_keys() {
|
||||
if [ -z "$AUTHORIZED_USERS" ] || ! echo "$AUTHORIZED_USERS" | grep -q "\b$GITHUB_ACTOR\b"; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
api_response=$(curl -s "https://api.github.com/users/$GITHUB_ACTOR/keys")
|
||||
|
||||
if echo "$api_response" | jq -e 'type == "object" and has("message")' >/dev/null; then
|
||||
error_msg=$(echo "$api_response" | jq -r '.message')
|
||||
echo "Error: $error_msg"
|
||||
return 1
|
||||
else
|
||||
echo "$api_response" | jq -r '.[].key'
|
||||
fi
|
||||
}
|
||||
|
||||
authorized_keys=$(get_authorized_keys "$GITHUB_ACTOR")
|
||||
|
||||
if [ -n "$authorized_keys" ]; then
|
||||
echo "Configured SSH key(s) for user: $GITHUB_ACTOR"
|
||||
else
|
||||
echo "Error: User '$GITHUB_ACTOR' is not authorized to access this debug session."
|
||||
echo "Authorized users: $AUTHORIZED_USERS"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$TUNNEL" != "true" ]; then
|
||||
echo "SSH tunneling is disabled. Set enable-tunnel: true to enable remote access."
|
||||
echo "Local SSH server would be available on localhost:2222 if this were a local environment."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo ::group::Configuring Tunnel
|
||||
|
||||
echo "SSH tunneling enabled. Setting up remote access..."
|
||||
|
||||
EXTERNAL_DEPS="curl jq ssh-keygen"
|
||||
|
||||
for dep in $EXTERNAL_DEPS; do
|
||||
if ! command -v "${dep}" > /dev/null 2>&1; then
|
||||
echo "Command ${dep} not installed on the system!" >&2
|
||||
if ! command -v "$dep" > /dev/null 2>&1; then
|
||||
echo "Command $dep not installed on the system!" >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
@@ -24,21 +48,22 @@ cd "$GITHUB_ACTION_PATH"
|
||||
bashrc_path=$(pwd)/bashrc
|
||||
|
||||
# Source `bashrc` to auto start tmux on SSH login.
|
||||
if ! grep -q "${bashrc_path}" ~/.bash_profile; then
|
||||
if ! grep -q "$bashrc_path" ~/.bash_profile; then
|
||||
echo >> ~/.bash_profile # On macOS runner there's no newline at the end of the file
|
||||
echo "source \"${bashrc_path}\"" >> ~/.bash_profile
|
||||
echo "source \"$bashrc_path\"" >> ~/.bash_profile
|
||||
fi
|
||||
|
||||
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
|
||||
ARCH=$(uname -m)
|
||||
|
||||
if [ "${ARCH}" = "x86_64" ]; then
|
||||
if [ "$ARCH" = "x86_64" ]; then
|
||||
ARCH="amd64"
|
||||
elif [ "${ARCH}" = "aarch64" ]; then
|
||||
elif [ "$ARCH" = "aarch64" ]; then
|
||||
ARCH="arm64"
|
||||
fi
|
||||
|
||||
if [ "${OS}" = "darwin" ] && ! command -v tmux > /dev/null 2>&1; then
|
||||
# Install tmux on macOS runners if not present.
|
||||
if [ "$OS" = "darwin" ] && ! command -v tmux > /dev/null 2>&1; then
|
||||
echo "Installing tmux..."
|
||||
brew install tmux
|
||||
fi
|
||||
@@ -46,80 +71,47 @@ fi
|
||||
if [ "$OS" = "darwin" ]; then
|
||||
cloudflared_url="https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-${OS}-${ARCH}.tgz"
|
||||
echo "Downloading \`cloudflared\` from <$cloudflared_url>..."
|
||||
curl --location --silent --output cloudflared.tgz "${cloudflared_url}"
|
||||
curl --location --silent --output cloudflared.tgz "$cloudflared_url"
|
||||
tar xf cloudflared.tgz
|
||||
rm cloudflared.tgz
|
||||
else
|
||||
cloudflared_url="https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-${OS}-${ARCH}"
|
||||
echo "Downloading \`cloudflared\` from <$cloudflared_url>..."
|
||||
curl --location --silent --output cloudflared "$cloudflared_url"
|
||||
fi
|
||||
|
||||
chmod +x cloudflared
|
||||
|
||||
echo "Setting up SSH key for authorized user: $GITHUB_ACTOR"
|
||||
echo "$authorized_keys" > authorized_keys
|
||||
|
||||
echo 'Creating SSH server key...'
|
||||
ssh-keygen -q -f ssh_host_rsa_key -N ''
|
||||
|
||||
echo 'Creating SSH server config...'
|
||||
sed "s,\$PWD,${PWD},;s,\$USER,${USER}," sshd_config.template > sshd_config
|
||||
sed "s,\$PWD,$PWD,;s,\$USER,$USER," sshd_config.template > sshd_config
|
||||
|
||||
echo 'Starting SSH server...'
|
||||
sudo /usr/sbin/sshd -f sshd_config -D &
|
||||
/usr/sbin/sshd -f sshd_config -D &
|
||||
sshd_pid=$!
|
||||
|
||||
echo "SSH server started successfully (PID: ${sshd_pid})"
|
||||
|
||||
echo 'Starting tmux session...'
|
||||
(cd "${GITHUB_WORKSPACE}" && tmux new-session -d -s debug)
|
||||
(cd "$GITHUB_WORKSPACE" && tmux new-session -d -s debug)
|
||||
|
||||
mkdir ~/.cloudflared
|
||||
CLEAN_TUNNEL_CERT=$(printf '%s\n' "${CLOUDFLARE_TUNNEL_CERT}" | tr -d '\r' | sed '/^[[:space:]]*$/d')
|
||||
|
||||
echo "${CLEAN_TUNNEL_CERT}" > ~/.cloudflared/cert.pem
|
||||
|
||||
CLEAN_USER_CA_CERT=$(printf '%s\n' "${CLOUDFLARE_USER_CA_CERT}" | tr -d '\r' | sed '/^[[:space:]]*$/d')
|
||||
|
||||
echo "${CLEAN_USER_CA_CERT}" | sudo tee /etc/ssh/ca.pub > /dev/null
|
||||
sudo chmod 644 /etc/ssh/ca.pub
|
||||
|
||||
random_suffix=$(openssl rand -hex 5 | cut -c1-10)
|
||||
tunnel_name="${GITHUB_SHA}-${GITHUB_RUN_ID}-${random_suffix}"
|
||||
tunnel_url="${tunnel_name}.${CLOUDFLARE_TUNNEL_HOSTNAME}"
|
||||
|
||||
if ./cloudflared tunnel list | grep -q "${tunnel_name}"; then
|
||||
echo "Deleting existing tunnel: ${tunnel_name}"
|
||||
./cloudflared tunnel delete ${tunnel_name}
|
||||
fi
|
||||
|
||||
echo "Creating new cloudflare tunnel: ${tunnel_name}"
|
||||
./cloudflared tunnel create ${tunnel_name}
|
||||
|
||||
credentials_file=$(find ~/.cloudflared -name "*.json" | head -n 1)
|
||||
if [ -z "${credentials_file}" ]; then
|
||||
echo "Error: Could not find tunnel credentials file"
|
||||
#if no cloudflare tunnel token is provided, exit
|
||||
if [ -z "$CLOUDFLARE_TUNNEL_TOKEN" ]; then
|
||||
echo "Error: required CLOUDFLARE_TUNNEL_TOKEN not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Found credentials file: ${credentials_file}"
|
||||
echo 'Starting Cloudflare tunnel...'
|
||||
|
||||
echo 'Creating tunnel configuration...'
|
||||
cat > tunnel_config.yml << EOF
|
||||
tunnel: ${tunnel_name}
|
||||
credentials-file: ${credentials_file}
|
||||
|
||||
ingress:
|
||||
- hostname: ${tunnel_url}
|
||||
service: ssh://localhost:2222
|
||||
- service: http_status:404
|
||||
EOF
|
||||
|
||||
echo 'Setting up DNS routing for tunnel...'
|
||||
./cloudflared tunnel route dns ${tunnel_name} ${tunnel_url}
|
||||
|
||||
echo 'Running cloudflare tunnel...'
|
||||
./cloudflared tunnel --no-autoupdate --config tunnel_config.yml run 2>&1 | tee cloudflared.log | sed -u 's/^/cloudflared: /' &
|
||||
./cloudflared tunnel --no-autoupdate run --token "$CLOUDFLARE_TUNNEL_TOKEN" 2>&1 | tee cloudflared.log | sed -u 's/^/cloudflared: /' &
|
||||
cloudflared_pid=$!
|
||||
|
||||
echo ::endgroup::
|
||||
|
||||
echo ::notice title=SSH Debug Session Ready::ssh ${tunnel_url}
|
||||
url="$TUNNEL_HOSTNAME"
|
||||
|
||||
public_key=$(cut -d' ' -f1,2 < ssh_host_rsa_key.pub)
|
||||
|
||||
(
|
||||
echo ' '
|
||||
@@ -127,20 +119,22 @@ echo ::notice title=SSH Debug Session Ready::ssh ${tunnel_url}
|
||||
echo '🔗 SSH Debug Session Ready!'
|
||||
echo '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'
|
||||
echo ' '
|
||||
echo '📋 Infra WG can copy and run this command to connect:'
|
||||
echo '📋 Copy and run this command to connect:'
|
||||
echo ' '
|
||||
echo "ssh ${tunnel_url}"
|
||||
if [ -n "$TUNNEL_HOSTNAME" ]; then
|
||||
echo "ssh-keygen -R action-ssh-debug && echo 'action-ssh-debug $public_key' >> ~/.ssh/known_hosts && ssh -o ProxyCommand='cloudflared access tcp --hostname $url' runner@action-ssh-debug"
|
||||
else
|
||||
echo "ssh-keygen -R action-ssh-debug && echo 'action-ssh-debug $public_key' >> ~/.ssh/known_hosts && ssh -o ProxyCommand='cloudflared access tcp --hostname $url' runner@action-ssh-debug"
|
||||
fi
|
||||
echo ' '
|
||||
echo "⏰ Session expires automatically in ${TIMEOUT} seconds"
|
||||
echo "⏰ Session expires automatically in $TIMEOUT minutes"
|
||||
echo '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'
|
||||
echo ' '
|
||||
echo ' '
|
||||
) | cat
|
||||
|
||||
echo ::group::Starting Background Session
|
||||
echo 'Starting SSH session in background...'
|
||||
./ssh-session.sh "${sshd_pid}" "${cloudflared_pid}" "${TIMEOUT}" "${tunnel_name}" &
|
||||
./ssh-session.sh "$sshd_pid" "$cloudflared_pid" $TIMEOUT &
|
||||
|
||||
echo 'SSH session is running in background. GitHub Action will continue.'
|
||||
echo 'Session will auto-cleanup after timeout or when processes end.'
|
||||
echo ::endgroup::
|
||||
|
||||
51
.github/actions/ssh-debug/ssh-session.sh
vendored
51
.github/actions/ssh-debug/ssh-session.sh
vendored
@@ -2,51 +2,20 @@
|
||||
|
||||
SSHD_PID=$1
|
||||
CLOUDFLARED_PID=$2
|
||||
SESSION_TIMEOUT=${3:-10000}
|
||||
TUNNEL_NAME=$4
|
||||
|
||||
cleanup() {
|
||||
# Kill processes.
|
||||
for pid in "$SLEEP_PID" "$SSHD_PID" "$CLOUDFLARED_PID"; do
|
||||
if [ -n "$pid" ] && kill -0 "$pid" 2>/dev/null; then
|
||||
kill "$pid" 2>/dev/null || true
|
||||
fi
|
||||
done
|
||||
|
||||
# Clean up tunnel.
|
||||
if [ -n "$TUNNEL_NAME" ]; then
|
||||
cd "$GITHUB_ACTION_PATH"
|
||||
./cloudflared tunnel delete "$TUNNEL_NAME" 2>/dev/null || {
|
||||
echo "Failed to delete tunnel"
|
||||
}
|
||||
fi
|
||||
|
||||
echo "Session ended at $(date)"
|
||||
exit 0
|
||||
}
|
||||
|
||||
# Trap signals to ensure cleanup.
|
||||
trap cleanup SIGTERM SIGINT SIGQUIT SIGHUP EXIT
|
||||
SESSION_TIMEOUT=${3:-3600}
|
||||
|
||||
# Wait for timeout or until processes die.
|
||||
sleep "$SESSION_TIMEOUT" &
|
||||
SLEEP_PID=$!
|
||||
|
||||
# Monitor processes
|
||||
while kill -0 "$SLEEP_PID" 2>/dev/null; do
|
||||
# Check SSH daemon.
|
||||
if ! kill -0 "$SSHD_PID" 2>/dev/null; then
|
||||
echo "SSH daemon died at $(date)"
|
||||
break
|
||||
fi
|
||||
|
||||
# Check cloudflared,
|
||||
if ! kill -0 "$CLOUDFLARED_PID" 2>/dev/null; then
|
||||
echo "Cloudflared died at $(date)"
|
||||
break
|
||||
fi
|
||||
|
||||
sleep 10
|
||||
# Monitor if SSH or cloudflared dies early.
|
||||
while kill -0 "$SSHD_PID" 2>/dev/null && kill -0 "$CLOUDFLARED_PID" 2>/dev/null && kill -0 "$SLEEP_PID" 2>/dev/null; do
|
||||
sleep 10
|
||||
done
|
||||
|
||||
cleanup
|
||||
# Cleanup.
|
||||
kill "$SLEEP_PID" 2>/dev/null || true
|
||||
kill "$SSHD_PID" 2>/dev/null || true
|
||||
kill "$CLOUDFLARED_PID" 2>/dev/null || true
|
||||
|
||||
echo "SSH session ended"
|
||||
|
||||
24
.github/actions/ssh-debug/sshd_config.template
vendored
24
.github/actions/ssh-debug/sshd_config.template
vendored
@@ -2,24 +2,8 @@ Port 2222
|
||||
HostKey $PWD/ssh_host_rsa_key
|
||||
PidFile $PWD/sshd.pid
|
||||
|
||||
# Connection settings
|
||||
ClientAliveInterval 30
|
||||
ClientAliveCountMax 10
|
||||
MaxStartups 10
|
||||
LoginGraceTime 120
|
||||
# Only allow single user
|
||||
AllowUsers $USER
|
||||
|
||||
# Allow TCP forwarding for tunneling
|
||||
AllowTcpForwarding yes
|
||||
|
||||
# Try to prevent timeouts
|
||||
TCPKeepAlive yes
|
||||
|
||||
# Security
|
||||
TrustedUserCAKeys /etc/ssh/ca.pub
|
||||
PubkeyAuthentication yes
|
||||
PasswordAuthentication no
|
||||
|
||||
AuthorizedPrincipalsCommand /bin/bash -c "echo '%t %k' | ssh-keygen -L -f - | grep -A1 Principals"
|
||||
AuthorizedPrincipalsCommandUser nobody
|
||||
|
||||
PubkeyAcceptedKeyTypes ssh-rsa,ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,rsa-sha2-512-cert-v01@openssh.com
|
||||
# Only allow those keys
|
||||
AuthorizedKeysFile $PWD/authorized_keys
|
||||
|
||||
12
.github/workflows/audit-branch-ci.yml
vendored
12
.github/workflows/audit-branch-ci.yml
vendored
@@ -15,7 +15,11 @@ jobs:
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- run: npm install @actions/cache @electron/fiddle-core
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
||||
with:
|
||||
node-version: 22.17.x
|
||||
- run: npm install @actions/cache@4.0.3 @electron/fiddle-core@2.0.1
|
||||
- uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
|
||||
id: audit-errors
|
||||
with:
|
||||
@@ -29,7 +33,7 @@ jobs:
|
||||
// Only want the most recent workflow run that wasn't skipped or cancelled
|
||||
const isValidWorkflowRun = (run) => !['skipped', 'cancelled'].includes(run.conclusion);
|
||||
|
||||
const versions = await ElectronVersions.create(undefined, { ignoreCache: true });
|
||||
const versions = await ElectronVersions.create({ ignoreCache: true });
|
||||
const branches = versions.supportedMajors.map((branch) => `${branch}-x-y`);
|
||||
|
||||
for (const branch of ["main", ...branches]) {
|
||||
@@ -101,7 +105,6 @@ jobs:
|
||||
}
|
||||
|
||||
if (runsWithErrors.length > 0) {
|
||||
core.setOutput('errorsFound', true);
|
||||
core.summary.addHeading('⚠️ Runs with Errors');
|
||||
core.summary.addTable([
|
||||
[
|
||||
@@ -128,6 +131,7 @@ jobs:
|
||||
|
||||
// Set this as failed so it's easy to scan runs to find failures
|
||||
if (runsWithErrors.find((run) => !run.isStale)) {
|
||||
core.setOutput('errorsFound', true);
|
||||
process.exitCode = 1;
|
||||
}
|
||||
} else {
|
||||
@@ -137,7 +141,7 @@ jobs:
|
||||
await core.summary.write();
|
||||
- name: Send Slack message if errors
|
||||
if: ${{ always() && steps.audit-errors.outputs.errorsFound && github.ref == 'refs/heads/main' }}
|
||||
uses: slackapi/slack-github-action@b0fa283ad8fea605de13dc3f449259339835fc52 # v2.1.0
|
||||
uses: slackapi/slack-github-action@91efab103c0de0a537f72a35f6b8cda0ee76bf0a # v2.1.1
|
||||
with:
|
||||
payload: |
|
||||
link: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
|
||||
|
||||
7
.github/workflows/build.yml
vendored
7
.github/workflows/build.yml
vendored
@@ -28,11 +28,6 @@ on:
|
||||
description: 'Skip lint check'
|
||||
default: false
|
||||
required: false
|
||||
enable-ssh:
|
||||
description: 'Enable SSH debugging'
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
@@ -232,7 +227,6 @@ jobs:
|
||||
gn-build-type: testing
|
||||
generate-symbols: false
|
||||
upload-to-storage: '0'
|
||||
enable-ssh: ${{ inputs.enable-ssh || false }}
|
||||
secrets: inherit
|
||||
|
||||
macos-arm64:
|
||||
@@ -251,7 +245,6 @@ jobs:
|
||||
gn-build-type: testing
|
||||
generate-symbols: false
|
||||
upload-to-storage: '0'
|
||||
enable-ssh: ${{ inputs.enable-ssh || false }}
|
||||
secrets: inherit
|
||||
|
||||
linux-x64:
|
||||
|
||||
2
.github/workflows/issue-labeled.yml
vendored
2
.github/workflows/issue-labeled.yml
vendored
@@ -72,7 +72,7 @@ jobs:
|
||||
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
|
||||
- name: Create comment
|
||||
if: ${{ steps.check-for-comment.outputs.SHOULD_COMMENT }}
|
||||
uses: actions-cool/issues-helper@a610082f8ac0cf03e357eb8dd0d5e2ba075e017e # v3.6.0
|
||||
uses: actions-cool/issues-helper@50068f49b7b2b3857270ead65e2d02e4459b022c # v3.6.2
|
||||
with:
|
||||
actions: 'create-comment'
|
||||
token: ${{ steps.generate-token.outputs.token }}
|
||||
|
||||
2
.github/workflows/issue-opened.yml
vendored
2
.github/workflows/issue-opened.yml
vendored
@@ -134,7 +134,7 @@ jobs:
|
||||
}
|
||||
- name: Create unsupported major comment
|
||||
if: ${{ steps.add-labels.outputs.unsupportedMajor }}
|
||||
uses: actions-cool/issues-helper@a610082f8ac0cf03e357eb8dd0d5e2ba075e017e # v3.6.0
|
||||
uses: actions-cool/issues-helper@50068f49b7b2b3857270ead65e2d02e4459b022c # v3.6.2
|
||||
with:
|
||||
actions: 'create-comment'
|
||||
token: ${{ steps.generate-token.outputs.token }}
|
||||
|
||||
@@ -54,11 +54,6 @@ on:
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
enable-ssh:
|
||||
description: 'Enable SSH debugging'
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
concurrency:
|
||||
group: electron-build-and-test-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ github.ref_protected == true && github.run_id || github.ref }}
|
||||
@@ -81,8 +76,7 @@ jobs:
|
||||
gn-build-type: ${{ inputs.gn-build-type }}
|
||||
generate-symbols: ${{ inputs.generate-symbols }}
|
||||
upload-to-storage: ${{ inputs.upload-to-storage }}
|
||||
is-asan: ${{ inputs.is-asan }}
|
||||
enable-ssh: ${{ inputs.enable-ssh }}
|
||||
is-asan: ${{ inputs.is-asan}}
|
||||
secrets: inherit
|
||||
test:
|
||||
uses: ./.github/workflows/pipeline-segment-electron-test.yml
|
||||
@@ -92,6 +86,5 @@ jobs:
|
||||
target-platform: ${{ inputs.target-platform }}
|
||||
test-runs-on: ${{ inputs.test-runs-on }}
|
||||
test-container: ${{ inputs.test-container }}
|
||||
is-asan: ${{ inputs.is-asan }}
|
||||
enable-ssh: ${{ inputs.enable-ssh }}
|
||||
is-asan: ${{ inputs.is-asan}}
|
||||
secrets: inherit
|
||||
|
||||
@@ -58,11 +58,7 @@ on:
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
enable-ssh:
|
||||
description: 'Enable SSH debugging'
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
|
||||
concurrency:
|
||||
group: electron-build-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ inputs.target-variant }}-${{ inputs.is-asan }}-${{ github.ref_protected == true && github.run_id || github.ref }}
|
||||
@@ -100,16 +96,14 @@ jobs:
|
||||
fetch-depth: 0
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
- name: Setup SSH Debugging
|
||||
if: ${{ inputs.target-platform == 'macos' && (inputs.enable-ssh || env.ACTIONS_STEP_DEBUG == 'true') }}
|
||||
if: ${{ inputs.target-platform == 'macos' && env.ACTIONS_STEP_DEBUG == 'true' }}
|
||||
uses: ./src/electron/.github/actions/ssh-debug
|
||||
with:
|
||||
tunnel: 'true'
|
||||
env:
|
||||
CLOUDFLARE_TUNNEL_CERT: ${{ secrets.CLOUDFLARE_TUNNEL_CERT }}
|
||||
CLOUDFLARE_TUNNEL_HOSTNAME: ${{ vars.CLOUDFLARE_TUNNEL_HOSTNAME }}
|
||||
CLOUDFLARE_USER_CA_CERT: ${{ secrets.CLOUDFLARE_USER_CA_CERT }}
|
||||
CLOUDFLARE_TUNNEL_TOKEN: ${{ secrets.CLOUDFLARE_TUNNEL_TOKEN }}
|
||||
TUNNEL_HOSTNAME: ${{ secrets.CLOUDFLARED_SSH_HOSTNAME }}
|
||||
AUTHORIZED_USERS: ${{ secrets.SSH_DEBUG_AUTHORIZED_USERS }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Free up space (macOS)
|
||||
if: ${{ inputs.target-platform == 'macos' }}
|
||||
uses: ./src/electron/.github/actions/free-space-macos
|
||||
|
||||
@@ -25,11 +25,6 @@ on:
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
enable-ssh:
|
||||
description: 'Enable SSH debugging'
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
concurrency:
|
||||
group: electron-test-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ inputs.is-asan }}-${{ github.ref_protected == true && github.run_id || github.ref }}
|
||||
@@ -109,6 +104,8 @@ jobs:
|
||||
"'kTCCServiceCamera','/usr/local/opt/runner/provisioner/provisioner',1,2,4,1,NULL,NULL,0,'UNUSED',NULL,0,1687786159"
|
||||
"'kTCCServiceBluetoothAlways','/usr/local/opt/runner/provisioner/provisioner',1,2,4,1,NULL,NULL,0,'UNUSED',NULL,0,1687786159"
|
||||
"'kTCCServiceAppleEvents','/usr/local/opt/runner/provisioner/provisioner',1,2,4,1,NULL,NULL,0,'UNUSED',NULL,0,1687786159"
|
||||
"'kTCCServiceCamera','/opt/hca/hosted-compute-agent',1,2,4,1,NULL,NULL,0,'UNUSED',NULL,0,1687786159"
|
||||
"'kTCCServiceBluetoothAlways','/opt/hca/hosted-compute-agent',1,2,4,1,NULL,NULL,0,'UNUSED',NULL,0,1687786159"
|
||||
)
|
||||
for values in "${userValuesArray[@]}"; do
|
||||
# Sonoma and higher have a few extra values
|
||||
@@ -131,16 +128,14 @@ jobs:
|
||||
fetch-depth: 0
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
- name: Setup SSH Debugging
|
||||
if: ${{ inputs.target-platform == 'macos' && (inputs.enable-ssh || env.ACTIONS_STEP_DEBUG == 'true') }}
|
||||
if: ${{ inputs.target-platform == 'macos' && env.ACTIONS_STEP_DEBUG == 'true' }}
|
||||
uses: ./src/electron/.github/actions/ssh-debug
|
||||
with:
|
||||
tunnel: 'true'
|
||||
env:
|
||||
CLOUDFLARE_TUNNEL_CERT: ${{ secrets.CLOUDFLARE_TUNNEL_CERT }}
|
||||
CLOUDFLARE_TUNNEL_HOSTNAME: ${{ vars.CLOUDFLARE_TUNNEL_HOSTNAME }}
|
||||
CLOUDFLARE_USER_CA_CERT: ${{ secrets.CLOUDFLARE_USER_CA_CERT }}
|
||||
CLOUDFLARE_TUNNEL_TOKEN: ${{ secrets.CLOUDFLARE_TUNNEL_TOKEN }}
|
||||
TUNNEL_HOSTNAME: ${{ secrets.CLOUDFLARED_SSH_HOSTNAME }}
|
||||
AUTHORIZED_USERS: ${{ secrets.SSH_DEBUG_AUTHORIZED_USERS }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Install Dependencies
|
||||
uses: ./src/electron/.github/actions/install-dependencies
|
||||
- name: Set Chromium Git Cookie
|
||||
|
||||
2
.github/workflows/pull-request-labeled.yml
vendored
2
.github/workflows/pull-request-labeled.yml
vendored
@@ -13,7 +13,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Trigger Slack workflow
|
||||
uses: slackapi/slack-github-action@b0fa283ad8fea605de13dc3f449259339835fc52 # v2.1.0
|
||||
uses: slackapi/slack-github-action@91efab103c0de0a537f72a35f6b8cda0ee76bf0a # v2.1.1
|
||||
with:
|
||||
webhook: ${{ secrets.BACKPORT_REQUESTED_SLACK_WEBHOOK_URL }}
|
||||
webhook-type: webhook-trigger
|
||||
|
||||
2
.github/workflows/scorecards.yml
vendored
2
.github/workflows/scorecards.yml
vendored
@@ -50,6 +50,6 @@ jobs:
|
||||
|
||||
# Upload the results to GitHub's code scanning dashboard.
|
||||
- name: "Upload to code-scanning"
|
||||
uses: github/codeql-action/upload-sarif@ce28f5bb42b7a9f2c824e633a3f6ee835bab6858 # v3.29.0
|
||||
uses: github/codeql-action/upload-sarif@51f77329afa6477de8c49fc9c7046c15b9a4e79d # v3.29.5
|
||||
with:
|
||||
sarif_file: results.sarif
|
||||
|
||||
@@ -67,10 +67,6 @@ template("mac_xib_bundle_data") {
|
||||
ibtool_flags = [
|
||||
"--minimum-deployment-target",
|
||||
mac_deployment_target,
|
||||
|
||||
# TODO(rsesek): Enable this once all the bots are on Xcode 7+.
|
||||
# "--target-device",
|
||||
# "mac",
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@@ -121,7 +121,6 @@ if ((globalThis.process || binding.process).argv.includes("--profile-electron-in
|
||||
'electron/main$': electronAPIFile,
|
||||
'electron/renderer$': electronAPIFile,
|
||||
'electron/common$': electronAPIFile,
|
||||
'electron/utility$': electronAPIFile,
|
||||
// Force timers to resolve to our dependency that doesn't use window.postMessage
|
||||
timers: path.resolve(electronRoot, 'node_modules', 'timers-browserify', 'main.js')
|
||||
},
|
||||
@@ -144,9 +143,7 @@ if ((globalThis.process || binding.process).argv.includes("--profile-electron-in
|
||||
transpileOnly: onlyPrintingGraph,
|
||||
ignoreDiagnostics: [
|
||||
// File '{0}' is not under 'rootDir' '{1}'.
|
||||
6059,
|
||||
// Private field '{0}' must be declared in an enclosing class.
|
||||
1111
|
||||
6059
|
||||
]
|
||||
}
|
||||
}]
|
||||
|
||||
@@ -142,8 +142,6 @@ static_library("chrome") {
|
||||
"//chrome/browser/ui/views/overlay/toggle_camera_button.h",
|
||||
"//chrome/browser/ui/views/overlay/toggle_microphone_button.cc",
|
||||
"//chrome/browser/ui/views/overlay/toggle_microphone_button.h",
|
||||
"//chrome/browser/ui/views/overlay/video_overlay_window_native_widget_mac.h",
|
||||
"//chrome/browser/ui/views/overlay/video_overlay_window_native_widget_mac.mm",
|
||||
"//chrome/browser/ui/views/overlay/video_overlay_window_views.cc",
|
||||
"//chrome/browser/ui/views/overlay/video_overlay_window_views.h",
|
||||
"//chrome/browser/ui/views/picture_in_picture/picture_in_picture_bounds_change_animation.cc",
|
||||
@@ -280,6 +278,8 @@ static_library("chrome") {
|
||||
"//chrome/browser/process_singleton_mac.mm",
|
||||
"//chrome/browser/ui/views/eye_dropper/eye_dropper_view_mac.h",
|
||||
"//chrome/browser/ui/views/eye_dropper/eye_dropper_view_mac.mm",
|
||||
"//chrome/browser/ui/views/overlay/video_overlay_window_native_widget_mac.h",
|
||||
"//chrome/browser/ui/views/overlay/video_overlay_window_native_widget_mac.mm",
|
||||
]
|
||||
deps += [ ":system_media_capture_permissions_mac_conflict" ]
|
||||
}
|
||||
@@ -502,15 +502,17 @@ source_set("chrome_spellchecker") {
|
||||
]
|
||||
}
|
||||
|
||||
# These sources create an object file conflict with one in |:chrome|, so they
|
||||
# must live in a separate target.
|
||||
# Conflicting sources:
|
||||
# //chrome/browser/media/webrtc/system_media_capture_permissions_stats_mac.mm
|
||||
# //chrome/browser/permissions/system/system_media_capture_permissions_mac.mm
|
||||
source_set("system_media_capture_permissions_mac_conflict") {
|
||||
sources = [
|
||||
"//chrome/browser/permissions/system/system_media_capture_permissions_mac.h",
|
||||
"//chrome/browser/permissions/system/system_media_capture_permissions_mac.mm",
|
||||
]
|
||||
deps = [ "//chrome/common" ]
|
||||
if (is_mac) {
|
||||
# These sources create an object file conflict with one in |:chrome|, so they
|
||||
# must live in a separate target.
|
||||
# Conflicting sources:
|
||||
# //chrome/browser/media/webrtc/system_media_capture_permissions_stats_mac.mm
|
||||
# //chrome/browser/permissions/system/system_media_capture_permissions_mac.mm
|
||||
source_set("system_media_capture_permissions_mac_conflict") {
|
||||
sources = [
|
||||
"//chrome/browser/permissions/system/system_media_capture_permissions_mac.h",
|
||||
"//chrome/browser/permissions/system/system_media_capture_permissions_mac.mm",
|
||||
]
|
||||
deps = [ "//chrome/common" ]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -331,6 +331,22 @@ Affects the default output directory of [v8.setHeapSnapshotNearHeapLimit](https:
|
||||
|
||||
Disable exposition of [Navigator API][] on the global scope from Node.js.
|
||||
|
||||
## Chromium Flags
|
||||
|
||||
There isn't a documented list of all Chromium switches, but there are a few ways to find them.
|
||||
|
||||
The easiest way is through Chromium's flags page, which you can access at `about://flags`. These flags don't directly match switch names, but they show up in the process's command-line arguments.
|
||||
|
||||
To see these arguments, enable a flag in `about://flags`, then go to `about://version` in Chromium. You'll find a list of command-line arguments, including `--flag-switches-begin --your --list --flag-switches-end`, which contains the list of your flag enabled switches.
|
||||
|
||||
Most flags are included as part of `--enable-features=`, but some are standalone switches, like `--enable-experimental-web-platform-features`.
|
||||
|
||||
A complete list of flags exists in [Chromium's flag metadata page](https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/flag-metadata.json), but this list includes platform, environment and GPU specific, expired and potentially non-functional flags, so many of them might not always work in every situation.
|
||||
|
||||
Keep in mind that standalone switches can sometimes be split into individual features, so there's no fully complete list of switches.
|
||||
|
||||
Finally, you'll need to ensure that the version of Chromium in Electron matches the version of the browser you're using to cross-reference the switches.
|
||||
|
||||
[app]: app.md
|
||||
[append-switch]: command-line.md#commandlineappendswitchswitch-value
|
||||
[debugging-main-process]: ../tutorial/debugging-main-process.md
|
||||
|
||||
@@ -125,13 +125,13 @@ Options:
|
||||
* `kioclient5`
|
||||
* `kioclient`
|
||||
|
||||
### `ELECTRON_OZONE_PLATFORM_HINT` _Linux_ _Deprecated_
|
||||
### `ELECTRON_OZONE_PLATFORM_HINT` _Linux_
|
||||
|
||||
Selects the preferred platform backend used on Linux. `auto` selects Wayland if possible, X11 otherwise.
|
||||
Selects the preferred platform backend used on Linux. The default one is `x11`. `auto` selects Wayland if possible, X11 otherwise.
|
||||
|
||||
Options:
|
||||
|
||||
* `auto` (Default)
|
||||
* `auto`
|
||||
* `wayland`
|
||||
* `x11`
|
||||
|
||||
|
||||
195
docs/api/structures/color-space.md
Normal file
195
docs/api/structures/color-space.md
Normal file
@@ -0,0 +1,195 @@
|
||||
# ColorSpace Object
|
||||
|
||||
* `primaries` string - The color primaries of the color space. Can be one of the following values:
|
||||
* `bt709` - BT709 primaries (also used for sRGB)
|
||||
* `bt470m` - BT470M primaries
|
||||
* `bt470bg` - BT470BG primaries
|
||||
* `smpte170m` - SMPTE170M primaries
|
||||
* `smpte240m` - SMPTE240M primaries
|
||||
* `film` - Film primaries
|
||||
* `bt2020` - BT2020 primaries
|
||||
* `smptest428-1` - SMPTEST428-1 primaries
|
||||
* `smptest431-2` - SMPTEST431-2 primaries
|
||||
* `p3` - P3 primaries
|
||||
* `xyz-d50` - XYZ D50 primaries
|
||||
* `adobe-rgb` - Adobe RGB primaries
|
||||
* `apple-generic-rgb` - Apple Generic RGB primaries
|
||||
* `wide-gamut-color-spin` - Wide Gamut Color Spin primaries
|
||||
* `ebu-3213-e` - EBU 3213-E primaries
|
||||
* `custom` - Custom primaries
|
||||
* `invalid` - Invalid primaries
|
||||
|
||||
* `transfer` string - The transfer function of the color space. Can be one of the following values:
|
||||
* `bt709` - BT709 transfer function
|
||||
* `bt709-apple` - BT709 Apple transfer function
|
||||
* `gamma18` - Gamma 1.8 transfer function
|
||||
* `gamma22` - Gamma 2.2 transfer function
|
||||
* `gamma24` - Gamma 2.4 transfer function
|
||||
* `gamma28` - Gamma 2.8 transfer function
|
||||
* `smpte170m` - SMPTE170M transfer function
|
||||
* `smpte240m` - SMPTE240M transfer function
|
||||
* `linear` - Linear transfer function
|
||||
* `log` - Log transfer function
|
||||
* `log-sqrt` - Log Square Root transfer function
|
||||
* `iec61966-2-4` - IEC61966-2-4 transfer function
|
||||
* `bt1361-ecg` - BT1361 ECG transfer function
|
||||
* `srgb` - sRGB transfer function
|
||||
* `bt2020-10` - BT2020-10 transfer function
|
||||
* `bt2020-12` - BT2020-12 transfer function
|
||||
* `pq` - PQ (Perceptual Quantizer) transfer function
|
||||
* `smptest428-1` - SMPTEST428-1 transfer function
|
||||
* `hlg` - HLG (Hybrid Log-Gamma) transfer function
|
||||
* `srgb-hdr` - sRGB HDR transfer function
|
||||
* `linear-hdr` - Linear HDR transfer function
|
||||
* `custom` - Custom transfer function
|
||||
* `custom-hdr` - Custom HDR transfer function
|
||||
* `scrgb-linear-80-nits` - scRGB Linear 80 nits transfer function
|
||||
* `invalid` - Invalid transfer function
|
||||
|
||||
* `matrix` string - The color matrix of the color space. Can be one of the following values:
|
||||
* `rgb` - RGB matrix
|
||||
* `bt709` - BT709 matrix
|
||||
* `fcc` - FCC matrix
|
||||
* `bt470bg` - BT470BG matrix
|
||||
* `smpte170m` - SMPTE170M matrix
|
||||
* `smpte240m` - SMPTE240M matrix
|
||||
* `ycocg` - YCoCg matrix
|
||||
* `bt2020-ncl` - BT2020 NCL matrix
|
||||
* `ydzdx` - YDzDx matrix
|
||||
* `gbr` - GBR matrix
|
||||
* `invalid` - Invalid matrix
|
||||
|
||||
* `range` string - The color range of the color space. Can be one of the following values:
|
||||
* `limited` - Limited color range (RGB values ranging from 16 to 235)
|
||||
* `full` - Full color range (RGB values from 0 to 255)
|
||||
* `derived` - Range defined by the transfer function and matrix
|
||||
* `invalid` - Invalid range
|
||||
|
||||
## Common `ColorSpace` definitions
|
||||
|
||||
### Standard Color Spaces
|
||||
|
||||
**sRGB**:
|
||||
|
||||
```js
|
||||
const cs = {
|
||||
primaries: 'bt709',
|
||||
transfer: 'srgb',
|
||||
matrix: 'rgb',
|
||||
range: 'full'
|
||||
}
|
||||
```
|
||||
|
||||
**Display P3**:
|
||||
|
||||
```js
|
||||
const cs = {
|
||||
primaries: 'p3',
|
||||
transfer: 'srgb',
|
||||
matrix: 'rgb',
|
||||
range: 'full'
|
||||
}
|
||||
```
|
||||
|
||||
**XYZ D50**:
|
||||
|
||||
```js
|
||||
const cs = {
|
||||
primaries: 'xyz-d50',
|
||||
transfer: 'linear',
|
||||
matrix: 'rgb',
|
||||
range: 'full'
|
||||
}
|
||||
```
|
||||
|
||||
### HDR Color Spaces
|
||||
|
||||
**Extended sRGB** (extends sRGB to all real values):
|
||||
|
||||
```js
|
||||
const cs = {
|
||||
primaries: 'bt709',
|
||||
transfer: 'srgb-hdr',
|
||||
matrix: 'rgb',
|
||||
range: 'full'
|
||||
}
|
||||
```
|
||||
|
||||
**scRGB Linear** (linear transfer function for all real values):
|
||||
|
||||
```js
|
||||
const cs = {
|
||||
primaries: 'bt709',
|
||||
transfer: 'linear-hdr',
|
||||
matrix: 'rgb',
|
||||
range: 'full'
|
||||
}
|
||||
```
|
||||
|
||||
**scRGB Linear 80 Nits** (with an SDR white level of 80 nits):
|
||||
|
||||
```js
|
||||
const cs = {
|
||||
primaries: 'bt709',
|
||||
transfer: 'scrgb-linear-80-nits',
|
||||
matrix: 'rgb',
|
||||
range: 'full'
|
||||
}
|
||||
```
|
||||
|
||||
**HDR10** (BT.2020 primaries with PQ transfer function):
|
||||
|
||||
```js
|
||||
const cs = {
|
||||
primaries: 'bt2020',
|
||||
transfer: 'pq',
|
||||
matrix: 'rgb',
|
||||
range: 'full'
|
||||
}
|
||||
```
|
||||
|
||||
**HLG** (BT.2020 primaries with HLG transfer function):
|
||||
|
||||
```js
|
||||
const cs = {
|
||||
primaries: 'bt2020',
|
||||
transfer: 'hlg',
|
||||
matrix: 'rgb',
|
||||
range: 'full'
|
||||
}
|
||||
```
|
||||
|
||||
### Video Color Spaces
|
||||
|
||||
**Rec. 601** (SDTV):
|
||||
|
||||
```js
|
||||
const cs = {
|
||||
primaries: 'smpte170m',
|
||||
transfer: 'smpte170m',
|
||||
matrix: 'smpte170m',
|
||||
range: 'limited'
|
||||
}
|
||||
```
|
||||
|
||||
**Rec. 709** (HDTV):
|
||||
|
||||
```js
|
||||
const cs = {
|
||||
primaries: 'bt709',
|
||||
transfer: 'bt709',
|
||||
matrix: 'bt709',
|
||||
range: 'limited'
|
||||
}
|
||||
```
|
||||
|
||||
**JPEG** (typical color space for JPEG images):
|
||||
|
||||
```js
|
||||
const cs = {
|
||||
primaries: 'bt709',
|
||||
transfer: 'srgb',
|
||||
matrix: 'smpte170m',
|
||||
range: 'full'
|
||||
}
|
||||
```
|
||||
@@ -1,17 +1,35 @@
|
||||
# USBDevice Object
|
||||
|
||||
* `configuration` Object (optional) - A [USBConfiguration](https://developer.mozilla.org/en-US/docs/Web/API/USBConfiguration) object containing information about the currently selected configuration of a USB device.
|
||||
* `configurationValue` Integer - the configuration value of this configuration.
|
||||
* `configurationName` string - the name provided by the device to describe this configuration.
|
||||
* `interfaces` Object[] - An array of [USBInterface](https://developer.mozilla.org/en-US/docs/Web/API/USBInterface) objects containing information about an interface provided by the USB device.
|
||||
* `interfaceNumber` Integer - the interface number of this interface.
|
||||
* `alternate` Object - the currently selected alternative configuration of this interface.
|
||||
* `alternateSetting` Integer - the alternate setting number of this interface.
|
||||
* `interfaceClass` Integer - the class of this interface. See [USB.org](https://www.usb.org/defined-class-codes) for class code descriptions.
|
||||
* `interfaceSubclass` Integer - the subclass of this interface.
|
||||
* `interfaceProtocol` Integer - the protocol supported by this interface.
|
||||
* `interfaceName` string (optional) - the name of the interface, if one is provided by the device.
|
||||
* `endpoints` Object[] - an array containing instances of the [USBEndpoint interface](https://developer.mozilla.org/en-US/docs/Web/API/USBEndpoint) describing each of the endpoints that are part of this interface.
|
||||
* `endpointNumber` Integer - this endpoint's "endpoint number" which is a value from 1 to 15.
|
||||
* `direction` string - the direction in which this endpoint transfers data - can be either 'in' or 'out'.
|
||||
* `type` string - the type of this endpoint - can be either 'bulk', 'interrupt', or 'isochronous'.
|
||||
* `packetSize` Integer - the size of the packets that data sent through this endpoint will be divided into.
|
||||
* `alternates` Object[] - an array containing instances of the [USBAlternateInterface](https://developer.mozilla.org/en-US/docs/Web/API/USBAlternateInterface) interface describing each of the alternative configurations possible for this interface.
|
||||
* `configurations` Object[] - An array of [USBConfiguration](https://developer.mozilla.org/en-US/docs/Web/API/USBConfiguration) interfaces for controlling a paired USB device.
|
||||
* `deviceClass` Integer - The device class for the communication interface supported by the device.
|
||||
* `deviceId` string - Unique identifier for the device.
|
||||
* `vendorId` Integer - The USB vendor ID.
|
||||
* `productId` Integer - The USB product ID.
|
||||
* `productName` string (optional) - Name of the device.
|
||||
* `serialNumber` string (optional) - The USB device serial number.
|
||||
* `manufacturerName` string (optional) - The manufacturer name of the device.
|
||||
* `usbVersionMajor` Integer - The USB protocol major version supported by the device
|
||||
* `usbVersionMinor` Integer - The USB protocol minor version supported by the device
|
||||
* `usbVersionSubminor` Integer - The USB protocol subminor version supported by the device
|
||||
* `deviceClass` Integer - The device class for the communication interface supported by the device
|
||||
* `deviceSubclass` Integer - The device subclass for the communication interface supported by the device
|
||||
* `deviceProtocol` Integer - The device protocol for the communication interface supported by the device
|
||||
* `deviceProtocol` Integer - The device protocol for the communication interface supported by the device.
|
||||
* `deviceSubclass` Integer - The device subclass for the communication interface supported by the device.
|
||||
* `deviceVersionMajor` Integer - The major version number of the device as defined by the device manufacturer.
|
||||
* `deviceVersionMinor` Integer - The minor version number of the device as defined by the device manufacturer.
|
||||
* `deviceVersionSubminor` Integer - The subminor version number of the device as defined by the device manufacturer.
|
||||
* `manufacturerName` string (optional) - The manufacturer name of the device.
|
||||
* `productId` Integer - The USB product ID.
|
||||
* `productName` string (optional) - Name of the device.
|
||||
* `serialNumber` string (optional) - The USB device serial number.
|
||||
* `usbVersionMajor` Integer - The USB protocol major version supported by the device.
|
||||
* `usbVersionMinor` Integer - The USB protocol minor version supported by the device.
|
||||
* `usbVersionSubminor` Integer - The USB protocol subminor version supported by the device.
|
||||
* `vendorId` Integer - The USB vendor ID.
|
||||
|
||||
@@ -14,14 +14,6 @@ This document uses the following convention to categorize breaking changes:
|
||||
|
||||
## Planned Breaking API Changes (38.0)
|
||||
|
||||
### Deprecated: `ELECTRON_OZONE_PLATFORM_HINT` environment variable
|
||||
|
||||
The default value of the `--ozone-plaftform` flag [changed to `auto`](https://chromium-review.googlesource.com/c/chromium/src/+/6775426).
|
||||
|
||||
You should use the `XDG_SESSION_TYPE=wayland` environment variable instead to use Wayland.
|
||||
|
||||
This environment variable will be [removed soon](https://chromium-review.googlesource.com/c/chromium/src/+/6819616).
|
||||
|
||||
### Removed: macOS 11 support
|
||||
|
||||
macOS 11 (Big Sur) is no longer supported by [Chromium](https://chromium-review.googlesource.com/c/chromium/src/+/6594615).
|
||||
@@ -45,6 +37,23 @@ The `webFrame.findFrameByRoutingId(routingId)` function will be removed.
|
||||
|
||||
You should use `webFrame.findFrameByToken(frameToken)` instead.
|
||||
|
||||
### Behavior Changed: window.open popups are always resizable
|
||||
|
||||
Per current [WHATWG spec](https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-open-dev), the `window.open` API will now always create a resizable popup window.
|
||||
|
||||
To restore previous behavior:
|
||||
|
||||
```js
|
||||
webContents.setWindowOpenHandler((details) => {
|
||||
return {
|
||||
action: 'allow',
|
||||
overrideBrowserWindowOptions: {
|
||||
resizable: details.features.includes('resizable=yes')
|
||||
}
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
## Planned Breaking API Changes (37.0)
|
||||
|
||||
### Utility Process unhandled rejection behavior change
|
||||
|
||||
@@ -74,46 +74,22 @@ describe('keyboard input', () => {
|
||||
Furthermore, WebdriverIO allows you to access Electron APIs to get static information about your application:
|
||||
|
||||
```js @ts-nocheck
|
||||
import { browser, $, expect } from '@wdio/globals'
|
||||
import { browser } from '@wdio/globals'
|
||||
|
||||
describe('when the make smaller button is clicked', () => {
|
||||
it('should decrease the window height and width by 10 pixels', async () => {
|
||||
const boundsBefore = await browser.electron.browserWindow('getBounds')
|
||||
expect(boundsBefore.width).toEqual(210)
|
||||
expect(boundsBefore.height).toEqual(310)
|
||||
|
||||
await $('.make-smaller').click()
|
||||
const boundsAfter = await browser.electron.browserWindow('getBounds')
|
||||
expect(boundsAfter.width).toEqual(200)
|
||||
expect(boundsAfter.height).toEqual(300)
|
||||
})
|
||||
})
|
||||
```
|
||||
|
||||
or to retrieve other Electron process information:
|
||||
|
||||
```js @ts-nocheck
|
||||
import fs from 'node:fs'
|
||||
import path from 'node:path'
|
||||
|
||||
import { browser, expect } from '@wdio/globals'
|
||||
|
||||
const packageJson = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'package.json'), { encoding: 'utf-8' }))
|
||||
const { name, version } = packageJson
|
||||
|
||||
describe('electron APIs', () => {
|
||||
it('should retrieve app metadata through the electron API', async () => {
|
||||
const appName = await browser.electron.app('getName')
|
||||
expect(appName).toEqual(name)
|
||||
const appVersion = await browser.electron.app('getVersion')
|
||||
expect(appVersion).toEqual(version)
|
||||
})
|
||||
|
||||
it('should pass args through to the launched application', async () => {
|
||||
// custom args are set in the wdio.conf.js file as they need to be set before WDIO starts
|
||||
const argv = await browser.electron.mainProcess('argv')
|
||||
expect(argv).toContain('--foo')
|
||||
expect(argv).toContain('--bar=baz')
|
||||
describe('trigger message modal', async () => {
|
||||
it('message modal can be triggered from a test', async () => {
|
||||
await browser.electron.execute(
|
||||
(electron, param1, param2, param3) => {
|
||||
const appWindow = electron.BrowserWindow.getFocusedWindow()
|
||||
electron.dialog.showMessageBox(appWindow, {
|
||||
message: 'Hello World!',
|
||||
detail: `${param1} + ${param2} + ${param3} = ${param1 + param2 + param3}`
|
||||
})
|
||||
},
|
||||
1,
|
||||
2,
|
||||
3
|
||||
)
|
||||
})
|
||||
})
|
||||
```
|
||||
@@ -206,7 +182,7 @@ npm install --save-dev @playwright/test
|
||||
```
|
||||
|
||||
:::caution Dependencies
|
||||
This tutorial was written with `@playwright/test@1.41.1`. Check out
|
||||
This tutorial was written with `@playwright/test@1.52.0`. Check out
|
||||
[Playwright's releases][playwright-releases] page to learn about
|
||||
changes that might affect the code below.
|
||||
:::
|
||||
@@ -218,10 +194,10 @@ To point this API to your Electron app, you can pass the path to your main proce
|
||||
entry point (here, it is `main.js`).
|
||||
|
||||
```js {5} @ts-nocheck
|
||||
const { test, _electron: electron } = require('@playwright/test')
|
||||
import { test, _electron as electron } from '@playwright/test'
|
||||
|
||||
test('launch app', async () => {
|
||||
const electronApp = await electron.launch({ args: ['main.js'] })
|
||||
const electronApp = await electron.launch({ args: ['.'] })
|
||||
// close app
|
||||
await electronApp.close()
|
||||
})
|
||||
@@ -231,10 +207,10 @@ After that, you will access to an instance of Playwright's `ElectronApp` class.
|
||||
is a powerful class that has access to main process modules for example:
|
||||
|
||||
```js {5-10} @ts-nocheck
|
||||
const { test, _electron: electron } = require('@playwright/test')
|
||||
import { test, _electron as electron } from '@playwright/test'
|
||||
|
||||
test('get isPackaged', async () => {
|
||||
const electronApp = await electron.launch({ args: ['main.js'] })
|
||||
const electronApp = await electron.launch({ args: ['.'] })
|
||||
const isPackaged = await electronApp.evaluate(async ({ app }) => {
|
||||
// This runs in Electron's main process, parameter here is always
|
||||
// the result of the require('electron') in the main app script.
|
||||
@@ -250,10 +226,10 @@ It can also create individual [Page][playwright-page] objects from Electron Brow
|
||||
For example, to grab the first BrowserWindow and save a screenshot:
|
||||
|
||||
```js {6-7} @ts-nocheck
|
||||
const { test, _electron: electron } = require('@playwright/test')
|
||||
import { test, _electron as electron } from '@playwright/test'
|
||||
|
||||
test('save screenshot', async () => {
|
||||
const electronApp = await electron.launch({ args: ['main.js'] })
|
||||
const electronApp = await electron.launch({ args: ['.'] })
|
||||
const window = await electronApp.firstWindow()
|
||||
await window.screenshot({ path: 'intro.png' })
|
||||
// close app
|
||||
@@ -265,7 +241,7 @@ Putting all this together using the Playwright test-runner, let's create a `exam
|
||||
test file with a single test and assertion:
|
||||
|
||||
```js title='example.spec.js' @ts-nocheck
|
||||
const { test, expect, _electron: electron } = require('@playwright/test')
|
||||
import { test, expect, _electron as electron } from '@playwright/test'
|
||||
|
||||
test('example test', async () => {
|
||||
const electronApp = await electron.launch({ args: ['.'] })
|
||||
|
||||
@@ -82,6 +82,7 @@ auto_filenames = {
|
||||
"docs/api/structures/browser-window-options.md",
|
||||
"docs/api/structures/certificate-principal.md",
|
||||
"docs/api/structures/certificate.md",
|
||||
"docs/api/structures/color-space.md",
|
||||
"docs/api/structures/cookie.md",
|
||||
"docs/api/structures/cpu-usage.md",
|
||||
"docs/api/structures/crash-report.md",
|
||||
|
||||
@@ -204,7 +204,7 @@ delete process.appCodeLoaded;
|
||||
if (packagePath) {
|
||||
// Finally load app's main.js and transfer control to C++.
|
||||
if ((packageJson.type === 'module' && !mainStartupScript.endsWith('.cjs')) || mainStartupScript.endsWith('.mjs')) {
|
||||
const { runEntryPointWithESMLoader } = __non_webpack_require__('internal/modules/run_main') as typeof import('@node/lib/internal/modules/run_main');
|
||||
const { runEntryPointWithESMLoader } = __non_webpack_require__('internal/modules/run_main');
|
||||
const main = (require('url') as typeof url).pathToFileURL(path.join(packagePath, mainStartupScript));
|
||||
runEntryPointWithESMLoader(async (cascadedLoader: any) => {
|
||||
try {
|
||||
|
||||
@@ -91,6 +91,12 @@ export function parseFeatures (features: string) {
|
||||
delete parsed[key];
|
||||
}
|
||||
|
||||
// Per spec - https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-open-dev
|
||||
// windows are always resizable.
|
||||
if (parsed.resizable !== undefined) {
|
||||
delete parsed.resizable;
|
||||
}
|
||||
|
||||
if (parsed.left !== undefined) parsed.x = parsed.left;
|
||||
if (parsed.top !== undefined) parsed.y = parsed.top;
|
||||
|
||||
|
||||
@@ -52,20 +52,20 @@ const {
|
||||
getValidatedPath,
|
||||
getOptions,
|
||||
getDirent
|
||||
} = __non_webpack_require__('internal/fs/utils') as typeof import('@node/lib/internal/fs/utils');
|
||||
} = __non_webpack_require__('internal/fs/utils');
|
||||
|
||||
const {
|
||||
assignFunctionName
|
||||
} = __non_webpack_require__('internal/util') as typeof import('@node/lib/internal/util');
|
||||
} = __non_webpack_require__('internal/util');
|
||||
|
||||
const {
|
||||
validateBoolean,
|
||||
validateFunction
|
||||
} = __non_webpack_require__('internal/validators') as typeof import('@node/lib/internal/validators');
|
||||
} = __non_webpack_require__('internal/validators');
|
||||
|
||||
// In the renderer node internals use the node global URL but we do not set that to be
|
||||
// the global URL instance. We need to do instanceof checks against the internal URL impl
|
||||
const { URL: NodeURL } = __non_webpack_require__('internal/url') as typeof import('@node/lib/internal/url');
|
||||
const { URL: NodeURL } = __non_webpack_require__('internal/url');
|
||||
|
||||
// Separate asar package's path from full path.
|
||||
const splitPath = (archivePathOrBuffer: string | Buffer | URL) => {
|
||||
@@ -745,8 +745,8 @@ export const wrapFsWithAsar = (fs: Record<string, any>) => {
|
||||
const stat = internalBinding('fs').internalModuleStat(resultPath);
|
||||
|
||||
context.readdirResults.push(dirent);
|
||||
if (dirent!.isDirectory() || stat === 1) {
|
||||
context.pathsQueue.push(path.join(dirent!.path, dirent!.name));
|
||||
if (dirent.isDirectory() || stat === 1) {
|
||||
context.pathsQueue.push(path.join(dirent.path, dirent.name));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -857,13 +857,13 @@ export const wrapFsWithAsar = (fs: Record<string, any>) => {
|
||||
const { readdir } = fs;
|
||||
fs.readdir = function (pathArgument: string, options: ReaddirOptions, callback: ReaddirCallback) {
|
||||
callback = typeof options === 'function' ? options : callback;
|
||||
validateFunction(callback, 'callback')!;
|
||||
validateFunction(callback, 'callback');
|
||||
|
||||
options = getOptions(options);
|
||||
pathArgument = getValidatedPath(pathArgument);
|
||||
|
||||
if (options?.recursive != null) {
|
||||
validateBoolean(options?.recursive, 'options.recursive')!;
|
||||
validateBoolean(options?.recursive, 'options.recursive');
|
||||
}
|
||||
|
||||
if (options?.recursive) {
|
||||
@@ -914,7 +914,7 @@ export const wrapFsWithAsar = (fs: Record<string, any>) => {
|
||||
pathArgument = getValidatedPath(pathArgument);
|
||||
|
||||
if (options?.recursive != null) {
|
||||
validateBoolean(options?.recursive, 'options.recursive')!;
|
||||
validateBoolean(options?.recursive, 'options.recursive');
|
||||
}
|
||||
|
||||
if (options?.recursive) {
|
||||
@@ -957,7 +957,7 @@ export const wrapFsWithAsar = (fs: Record<string, any>) => {
|
||||
pathArgument = getValidatedPath(pathArgument);
|
||||
|
||||
if (options?.recursive != null) {
|
||||
validateBoolean(options?.recursive, 'options.recursive')!;
|
||||
validateBoolean(options?.recursive, 'options.recursive');
|
||||
}
|
||||
|
||||
if (options?.recursive) {
|
||||
|
||||
@@ -65,9 +65,9 @@ require('@electron/internal/renderer/common-init');
|
||||
|
||||
if (nodeIntegration) {
|
||||
// Export node bindings to global.
|
||||
const { makeRequireFunction } = __non_webpack_require__('internal/modules/helpers') as typeof import('@node/lib/internal/modules/helpers');
|
||||
const { makeRequireFunction } = __non_webpack_require__('internal/modules/helpers');
|
||||
global.module = new Module('electron/js2c/renderer_init');
|
||||
global.require = makeRequireFunction(global.module) as NodeRequire;
|
||||
global.require = makeRequireFunction(global.module);
|
||||
|
||||
// Set the __filename to the path of html file if it is file: protocol.
|
||||
if (window.location.protocol === 'file:') {
|
||||
@@ -150,7 +150,7 @@ if (cjsPreloads.length) {
|
||||
}
|
||||
}
|
||||
if (esmPreloads.length) {
|
||||
const { runEntryPointWithESMLoader } = __non_webpack_require__('internal/modules/run_main') as typeof import('@node/lib/internal/modules/run_main');
|
||||
const { runEntryPointWithESMLoader } = __non_webpack_require__('internal/modules/run_main');
|
||||
|
||||
runEntryPointWithESMLoader(async (cascadedLoader: any) => {
|
||||
// Load the preload scripts.
|
||||
|
||||
@@ -36,7 +36,7 @@ parentPort.on('removeListener', (name: string) => {
|
||||
});
|
||||
|
||||
// Finally load entry script.
|
||||
const { runEntryPointWithESMLoader } = __non_webpack_require__('internal/modules/run_main') as typeof import('@node/lib/internal/modules/run_main');
|
||||
const { runEntryPointWithESMLoader } = __non_webpack_require__('internal/modules/run_main');
|
||||
const mainEntry = pathToFileURL(entryScript);
|
||||
|
||||
runEntryPointWithESMLoader(async (cascadedLoader: any) => {
|
||||
|
||||
@@ -13,9 +13,9 @@ require('@electron/internal/common/init');
|
||||
const { hasSwitch, getSwitchValue } = process._linkedBinding('electron_common_command_line');
|
||||
|
||||
// Export node bindings to global.
|
||||
const { makeRequireFunction } = __non_webpack_require__('internal/modules/helpers') as typeof import('@node/lib/internal/modules/helpers');
|
||||
const { makeRequireFunction } = __non_webpack_require__('internal/modules/helpers');
|
||||
global.module = new Module('electron/js2c/worker_init');
|
||||
global.require = makeRequireFunction(global.module) as NodeRequire;
|
||||
global.require = makeRequireFunction(global.module);
|
||||
|
||||
// See WebWorkerObserver::WorkerScriptReadyForEvaluation.
|
||||
if ((globalThis as any).blinkfetch) {
|
||||
|
||||
@@ -9,15 +9,16 @@
|
||||
"@electron/docs-parser": "^2.0.0",
|
||||
"@electron/fiddle-core": "^1.3.4",
|
||||
"@electron/github-app-auth": "^2.2.1",
|
||||
"@electron/lint-roller": "^3.1.1",
|
||||
"@electron/lint-roller": "^3.1.2",
|
||||
"@electron/typescript-definitions": "^9.1.2",
|
||||
"@octokit/rest": "^20.0.2",
|
||||
"@octokit/rest": "^20.1.2",
|
||||
"@primer/octicons": "^10.0.0",
|
||||
"@types/minimist": "^1.2.5",
|
||||
"@types/node": "^22.7.7",
|
||||
"@types/semver": "^7.5.8",
|
||||
"@types/stream-json": "^1.7.7",
|
||||
"@types/temp": "^0.9.4",
|
||||
"@types/webpack-env": "^1.18.5",
|
||||
"@typescript-eslint/eslint-plugin": "^8.32.1",
|
||||
"@typescript-eslint/parser": "^8.7.0",
|
||||
"buffer": "^6.0.3",
|
||||
@@ -33,7 +34,7 @@
|
||||
"eslint-plugin-node": "^11.1.0",
|
||||
"eslint-plugin-promise": "^6.6.0",
|
||||
"events": "^3.2.0",
|
||||
"folder-hash": "^2.1.1",
|
||||
"folder-hash": "^4.1.1",
|
||||
"got": "^11.8.5",
|
||||
"husky": "^9.1.7",
|
||||
"lint-staged": "^16.1.0",
|
||||
@@ -43,7 +44,7 @@
|
||||
"pre-flight": "^2.0.0",
|
||||
"process": "^0.11.10",
|
||||
"remark-cli": "^12.0.1",
|
||||
"remark-preset-lint-markdown-style-guide": "^4.0.0",
|
||||
"remark-preset-lint-markdown-style-guide": "^6.0.1",
|
||||
"semver": "^7.6.3",
|
||||
"stream-json": "^1.8.0",
|
||||
"tap-xunit": "^2.4.1",
|
||||
|
||||
@@ -11,7 +11,7 @@ We can fix this by allowing the C++ implementation of legacyMainResolve to use
|
||||
a fileExists function that does take Asar into account.
|
||||
|
||||
diff --git a/lib/internal/modules/esm/resolve.js b/lib/internal/modules/esm/resolve.js
|
||||
index e3afd30ba1f591d0298793bc42fd7166a4219bce..408dc96307d7f52f92db41004b358051a81c627c 100644
|
||||
index 7572bfc34d4c21b2ad618a68c4a2026400ad7338..5ce696a4e50d8d8bbe311340d665b3bdc330327f 100644
|
||||
--- a/lib/internal/modules/esm/resolve.js
|
||||
+++ b/lib/internal/modules/esm/resolve.js
|
||||
@@ -28,14 +28,13 @@ const { BuiltinModule } = require('internal/bootstrap/realm');
|
||||
|
||||
@@ -77,20 +77,18 @@ index 8d98d50395cf7fbbaf9ae30387727bff5c6cd550..ed3b3c02bbdac78c163d589557651618
|
||||
// Check if the ESM initiating import CJS is being required by the same CJS module.
|
||||
if (cjsModule?.[kIsExecuting]) {
|
||||
diff --git a/lib/internal/modules/esm/resolve.js b/lib/internal/modules/esm/resolve.js
|
||||
index 859b6bfedac4bbee2df054f9ebca7cbaaed45f18..5aa946f66c71beff0b7a43c30638ab28a1a5dfc0 100644
|
||||
index 859b6bfedac4bbee2df054f9ebca7cbaaed45f18..a609671e64e3b159f6f00d4f69cde2039cc0bc38 100644
|
||||
--- a/lib/internal/modules/esm/resolve.js
|
||||
+++ b/lib/internal/modules/esm/resolve.js
|
||||
@@ -750,6 +750,9 @@ function packageImportsResolve(name, base, conditions) {
|
||||
@@ -750,6 +750,7 @@ function packageImportsResolve(name, base, conditions) {
|
||||
throw importNotDefined(name, packageJSONUrl, base);
|
||||
}
|
||||
|
||||
+const electronTypes = [
|
||||
+ 'electron', 'electron/main', 'electron/common', 'electron/renderer', 'electron/utility'
|
||||
+];
|
||||
+const electronTypes = ['electron', 'electron/main', 'electron/common', 'electron/renderer'];
|
||||
|
||||
/**
|
||||
* Resolves a package specifier to a URL.
|
||||
@@ -764,6 +767,11 @@ function packageResolve(specifier, base, conditions) {
|
||||
@@ -764,6 +765,11 @@ function packageResolve(specifier, base, conditions) {
|
||||
return new URL('node:' + specifier);
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ index 3334818153068468967baa5adc1ed2382592ec76..ab4c8a4d00f1813e72f1ea8349850b40
|
||||
const result = dataURLProcessor(url);
|
||||
if (result === 'failure') {
|
||||
diff --git a/lib/internal/modules/esm/resolve.js b/lib/internal/modules/esm/resolve.js
|
||||
index 5aa946f66c71beff0b7a43c30638ab28a1a5dfc0..e3afd30ba1f591d0298793bc42fd7166a4219bce 100644
|
||||
index a609671e64e3b159f6f00d4f69cde2039cc0bc38..7572bfc34d4c21b2ad618a68c4a2026400ad7338 100644
|
||||
--- a/lib/internal/modules/esm/resolve.js
|
||||
+++ b/lib/internal/modules/esm/resolve.js
|
||||
@@ -25,7 +25,7 @@ const {
|
||||
|
||||
@@ -65,10 +65,6 @@ async function main () {
|
||||
platformFlags.push(`-isysroot ${path.resolve(sdkPath, sdkToUse)}`);
|
||||
}
|
||||
|
||||
// TODO(ckerr) this is cribbed from read obj/electron/electron_app.ninja.
|
||||
// Maybe it would be better to have this script literally open up that
|
||||
// file and pull cflags_cc from it instead of using bespoke code here?
|
||||
// I think it's unlikely to work; but if it does, it would be more futureproof
|
||||
const cxxflags = [
|
||||
'-std=c++20',
|
||||
'-Wno-trigraphs',
|
||||
@@ -128,7 +124,7 @@ async function main () {
|
||||
return process.exit(installStatus !== 0 ? installStatus : signal);
|
||||
}
|
||||
|
||||
const onlyTests = args.only && args.only.split(',');
|
||||
const onlyTests = args.only?.split(',');
|
||||
|
||||
const DISABLED_TESTS = new Set([
|
||||
'nannew-test.js',
|
||||
|
||||
@@ -1,106 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
|
||||
from lib.native_tests import TestsList, Verbosity, DisabledTestsPolicy
|
||||
|
||||
|
||||
class Command:
|
||||
LIST = 'list'
|
||||
RUN = 'run'
|
||||
|
||||
|
||||
def parse_args():
|
||||
parser = argparse.ArgumentParser(description='Run Google Test binaries')
|
||||
|
||||
parser.add_argument('command',
|
||||
choices=[Command.LIST, Command.RUN],
|
||||
help='command to execute')
|
||||
|
||||
parser.add_argument('-b', '--binary', nargs='+', required=False,
|
||||
help='binaries to run')
|
||||
parser.add_argument('-c', '--config', required=True,
|
||||
help='path to a tests config')
|
||||
parser.add_argument('-t', '--tests-dir', required=False,
|
||||
help='path to a directory with test binaries')
|
||||
parser.add_argument('-o', '--output-dir', required=False,
|
||||
help='path to a folder to save tests results')
|
||||
|
||||
disabled_tests = parser.add_mutually_exclusive_group()
|
||||
disabled_tests.add_argument('--only-disabled-tests',
|
||||
dest='disabled_tests_policy',
|
||||
action='store_const',
|
||||
const=DisabledTestsPolicy.ONLY,
|
||||
help='run disabled tests only')
|
||||
disabled_tests.add_argument('--include-disabled-tests',
|
||||
dest='disabled_tests_policy',
|
||||
action='store_const',
|
||||
const=DisabledTestsPolicy.INCLUDE,
|
||||
help='if disabled tests should be run as well')
|
||||
parser.set_defaults(disabled_tests_policy=DisabledTestsPolicy.DISABLE)
|
||||
|
||||
verbosity = parser.add_mutually_exclusive_group()
|
||||
verbosity.add_argument('-v', '--verbosity', required=False,
|
||||
default=Verbosity.CHATTY,
|
||||
choices=Verbosity.get_all(),
|
||||
help='set verbosity level')
|
||||
verbosity.add_argument('-q', '--quiet', required=False, action='store_const',
|
||||
const=Verbosity.ERRORS, dest='verbosity',
|
||||
help='suppress stdout from test binaries')
|
||||
verbosity.add_argument('-qq', '--quiet-quiet',
|
||||
# https://youtu.be/bXd-zZLV2i0?t=41s
|
||||
required=False, action='store_const',
|
||||
const=Verbosity.SILENT, dest='verbosity',
|
||||
help='suppress stdout and stderr from test binaries')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
# Additional checks.
|
||||
if args.command == Command.RUN and args.tests_dir is None:
|
||||
parser.error("specify a path to a dir with test binaries via --tests-dir")
|
||||
|
||||
# Absolutize and check paths.
|
||||
# 'config' must exist and be a file.
|
||||
args.config = os.path.abspath(args.config)
|
||||
if not os.path.isfile(args.config):
|
||||
parser.error(f"file '{args.config}' doesn't exist")
|
||||
|
||||
# 'tests_dir' must exist and be a directory.
|
||||
if args.tests_dir is not None:
|
||||
args.tests_dir = os.path.abspath(args.tests_dir)
|
||||
if not os.path.isdir(args.tests_dir):
|
||||
parser.error(f"directory '{args.tests_dir}' doesn't exist")
|
||||
|
||||
# 'output_dir' must exist and be a directory.
|
||||
if args.output_dir is not None:
|
||||
args.output_dir = os.path.abspath(args.output_dir)
|
||||
if not os.path.isdir(args.output_dir):
|
||||
parser.error(f"directory '{args.output_dir}' doesn't exist")
|
||||
|
||||
return args
|
||||
|
||||
|
||||
def main():
|
||||
args = parse_args()
|
||||
tests_list = TestsList(args.config, args.tests_dir)
|
||||
|
||||
if args.command == Command.LIST:
|
||||
all_binaries_names = tests_list.get_for_current_platform()
|
||||
print('\n'.join(all_binaries_names))
|
||||
return 0
|
||||
|
||||
if args.command == Command.RUN:
|
||||
if args.binary is not None:
|
||||
return tests_list.run(args.binary, args.output_dir, args.verbosity,
|
||||
args.disabled_tests_policy)
|
||||
|
||||
return tests_list.run_all(args.output_dir, args.verbosity,
|
||||
args.disabled_tests_policy)
|
||||
|
||||
raise AssertionError(f"unexpected command '{args.command}'")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
||||
@@ -73,6 +73,7 @@ async function main () {
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
console.log(`All ${DISABLED_TESTS.length} disabled specs exist.`);
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -136,6 +136,20 @@ new Promise<string>((resolve, reject) => {
|
||||
|
||||
return release;
|
||||
})
|
||||
.then(async (release) => {
|
||||
const gnArgs = await fs.promises.readFile(path.resolve(ELECTRON_DIR, 'build/args/all.gn'), 'utf8');
|
||||
|
||||
const abiVersionLine = gnArgs.split('\n').find((line) => line.startsWith('node_module_version = '));
|
||||
const abiVersion = abiVersionLine ? abiVersionLine.split('=')[1].trim() : null;
|
||||
if (!abiVersion) {
|
||||
throw new Error('Could not find node_module_version in GN args');
|
||||
}
|
||||
|
||||
const abiVersionFile = path.join(tempDir, 'abi_version');
|
||||
await fs.promises.writeFile(abiVersionFile, abiVersion);
|
||||
|
||||
return release;
|
||||
})
|
||||
.then(async (release) => {
|
||||
const currentBranch = await getCurrentBranch();
|
||||
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
{
|
||||
"bullseye_amd64": {
|
||||
"Key": "20250129T203412Z-2",
|
||||
"Sha256Sum": "f89d7f27fdff95336d20c899c795f70f16ba488205f7f493b0d118cbf89dea59",
|
||||
"Sha256Sum": "986ffe8f444b650c38de1786a930516bf9447ec7003a6c367de4aade8ebdb186",
|
||||
"SysrootDir": "debian_bullseye_amd64-sysroot",
|
||||
"Tarball": "debian_bullseye_amd64_sysroot.tar.xz",
|
||||
"URL": "https://dev-cdn.electronjs.org/linux-sysroots"
|
||||
},
|
||||
"bullseye_arm64": {
|
||||
"Key": "20250129T203412Z-2",
|
||||
"Sha256Sum": "68164118871fddfe9212aa22364fe9c015023ab68a76af6910a319a800246d58",
|
||||
"Sha256Sum": "6be0900393d73e69518f0996807dbc542c0d47cab1c4903c9d188347f945114a",
|
||||
"SysrootDir": "debian_bullseye_arm64-sysroot",
|
||||
"Tarball": "debian_bullseye_arm64_sysroot.tar.xz",
|
||||
"URL": "https://dev-cdn.electronjs.org/linux-sysroots"
|
||||
@@ -22,37 +22,44 @@
|
||||
},
|
||||
"bullseye_armhf": {
|
||||
"Key": "20250129T203412Z-2",
|
||||
"Sha256Sum": "409047dc2431e4fa4499facc5ca13a74e1941f7b85e414b6e1b4298bc6caca1a",
|
||||
"Sha256Sum": "060631cd0583b5204c646d41a5fbbe6080fd7a822feefba01900bd8e41a67b13",
|
||||
"SysrootDir": "debian_bullseye_armhf-sysroot",
|
||||
"Tarball": "debian_bullseye_armhf_sysroot.tar.xz",
|
||||
"URL": "https://dev-cdn.electronjs.org/linux-sysroots"
|
||||
},
|
||||
"bullseye_i386": {
|
||||
"Key": "20250129T203412Z-2",
|
||||
"Sha256Sum": "1ae04410396ac2a46c60f112c7eb8e47d39cb73579f99d75ba81fb1b08ef1c08",
|
||||
"Sha256Sum": "a6b63543ac2a57f477a6ea54b1e36dc8bfeb2f19c963866f79b1b2a93ed43a6e",
|
||||
"SysrootDir": "debian_bullseye_i386-sysroot",
|
||||
"Tarball": "debian_bullseye_i386_sysroot.tar.xz",
|
||||
"URL": "https://dev-cdn.electronjs.org/linux-sysroots"
|
||||
},
|
||||
"bullseye_mips64el": {
|
||||
"Key": "20250129T203412Z-2",
|
||||
"Sha256Sum": "3b6d3383614bbed33a6580ab7c15a55b92cd2d400617bd956c0ab3e5cd3873d2",
|
||||
"Sha256Sum": "814ccd5d9524020b23a16a5a581644ca8ba2f1e3515a1ddcbb62e938d4f4e0b0",
|
||||
"SysrootDir": "debian_bullseye_mips64el-sysroot",
|
||||
"Tarball": "debian_bullseye_mips64el_sysroot.tar.xz",
|
||||
"URL": "https://dev-cdn.electronjs.org/linux-sysroots"
|
||||
},
|
||||
"bullseye_mipsel": {
|
||||
"Key": "20250129T203412Z-2",
|
||||
"Sha256Sum": "9922c66285fa037aaddb4afd4bb13eaaa65fdd889b35d94c61fb4e4076c228f0",
|
||||
"Sha256Sum": "7f3218966b7bc636409a0f3d5104d9046b03faf660847f9026df9ce2c9775d53",
|
||||
"SysrootDir": "debian_bullseye_mipsel-sysroot",
|
||||
"Tarball": "debian_bullseye_mipsel_sysroot.tar.xz",
|
||||
"URL": "https://dev-cdn.electronjs.org/linux-sysroots"
|
||||
},
|
||||
"bullseye_ppc64el": {
|
||||
"Key": "20250129T203412Z-2",
|
||||
"Sha256Sum": "370e28ad70f2edca39fad2f16dd23e315b67728d61c327cda42d32300b06812c",
|
||||
"Sha256Sum": "bdab0a372cf5bfdc154226cc5ed72d417096c725085d193509d1f12e0debec66",
|
||||
"SysrootDir": "debian_bullseye_ppc64el-sysroot",
|
||||
"Tarball": "debian_bullseye_ppc64el_sysroot.tar.xz",
|
||||
"URL": "https://dev-cdn.electronjs.org/linux-sysroots"
|
||||
},
|
||||
"trixie_riscv64": {
|
||||
"Key": "20250129T203412Z-2",
|
||||
"Sha256Sum": "2183652af753225da2371d7bccddcb0269ee388e4508ed1fdeb810cb05cba898",
|
||||
"SysrootDir": "debian_trixie_riscv64-sysroot",
|
||||
"Tarball": "debian_trixie_riscv64_sysroot.tar.xz",
|
||||
"URL": "https://dev-cdn.electronjs.org/linux-sysroots"
|
||||
}
|
||||
}
|
||||
}
|
||||
5
script/zip_manifests/chromedriver_zip.linux.arm.manifest
Normal file
5
script/zip_manifests/chromedriver_zip.linux.arm.manifest
Normal file
@@ -0,0 +1,5 @@
|
||||
chromedriver
|
||||
chromedriver.debug
|
||||
gen/electron/buildflags/buildflags.h
|
||||
LICENSE
|
||||
LICENSES.chromium.html
|
||||
@@ -0,0 +1,5 @@
|
||||
chromedriver
|
||||
chromedriver.debug
|
||||
gen/electron/buildflags/buildflags.h
|
||||
LICENSE
|
||||
LICENSES.chromium.html
|
||||
5
script/zip_manifests/chromedriver_zip.linux.x64.manifest
Normal file
5
script/zip_manifests/chromedriver_zip.linux.x64.manifest
Normal file
@@ -0,0 +1,5 @@
|
||||
chromedriver
|
||||
chromedriver.debug
|
||||
gen/electron/buildflags/buildflags.h
|
||||
LICENSE
|
||||
LICENSES.chromium.html
|
||||
5
script/zip_manifests/chromedriver_zip.linux.x86.manifest
Normal file
5
script/zip_manifests/chromedriver_zip.linux.x86.manifest
Normal file
@@ -0,0 +1,5 @@
|
||||
chromedriver
|
||||
chromedriver.debug
|
||||
gen/electron/buildflags/buildflags.h
|
||||
LICENSE
|
||||
LICENSES.chromium.html
|
||||
6
script/zip_manifests/chromedriver_zip.mac.arm64.manifest
Normal file
6
script/zip_manifests/chromedriver_zip.mac.arm64.manifest
Normal file
@@ -0,0 +1,6 @@
|
||||
chromedriver
|
||||
icudtl.dat
|
||||
libffmpeg.dylib
|
||||
gen/electron/buildflags/buildflags.h
|
||||
LICENSE
|
||||
LICENSES.chromium.html
|
||||
6
script/zip_manifests/chromedriver_zip.mac.x64.manifest
Normal file
6
script/zip_manifests/chromedriver_zip.mac.x64.manifest
Normal file
@@ -0,0 +1,6 @@
|
||||
chromedriver
|
||||
icudtl.dat
|
||||
libffmpeg.dylib
|
||||
gen/electron/buildflags/buildflags.h
|
||||
LICENSE
|
||||
LICENSES.chromium.html
|
||||
@@ -0,0 +1,6 @@
|
||||
chromedriver
|
||||
icudtl.dat
|
||||
libffmpeg.dylib
|
||||
gen/electron/buildflags/buildflags.h
|
||||
LICENSE
|
||||
LICENSES.chromium.html
|
||||
@@ -0,0 +1,6 @@
|
||||
chromedriver
|
||||
icudtl.dat
|
||||
libffmpeg.dylib
|
||||
gen/electron/buildflags/buildflags.h
|
||||
LICENSE
|
||||
LICENSES.chromium.html
|
||||
6
script/zip_manifests/chromedriver_zip.win.arm64.manifest
Normal file
6
script/zip_manifests/chromedriver_zip.win.arm64.manifest
Normal file
@@ -0,0 +1,6 @@
|
||||
chromedriver.exe
|
||||
icudtl.dat
|
||||
ffmpeg.dll
|
||||
gen/electron/buildflags/buildflags.h
|
||||
LICENSE
|
||||
LICENSES.chromium.html
|
||||
6
script/zip_manifests/chromedriver_zip.win.x64.manifest
Normal file
6
script/zip_manifests/chromedriver_zip.win.x64.manifest
Normal file
@@ -0,0 +1,6 @@
|
||||
chromedriver.exe
|
||||
icudtl.dat
|
||||
ffmpeg.dll
|
||||
gen/electron/buildflags/buildflags.h
|
||||
LICENSE
|
||||
LICENSES.chromium.html
|
||||
6
script/zip_manifests/chromedriver_zip.win.x86.manifest
Normal file
6
script/zip_manifests/chromedriver_zip.win.x86.manifest
Normal file
@@ -0,0 +1,6 @@
|
||||
chromedriver.exe
|
||||
icudtl.dat
|
||||
ffmpeg.dll
|
||||
gen/electron/buildflags/buildflags.h
|
||||
LICENSE
|
||||
LICENSES.chromium.html
|
||||
@@ -214,10 +214,8 @@ int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t* cmd, int) {
|
||||
return crashpad_status;
|
||||
}
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
// access ui native theme here to prevent blocking calls later
|
||||
base::win::AllowDarkModeForApp(true);
|
||||
#endif
|
||||
|
||||
#if defined(ARCH_CPU_32_BITS)
|
||||
// Intentionally crash if converting to a fiber failed.
|
||||
|
||||
@@ -1159,8 +1159,7 @@ void App::DisableDomainBlockingFor3DAPIs(gin_helper::ErrorThrower thrower) {
|
||||
|
||||
bool App::IsAccessibilitySupportEnabled() {
|
||||
auto* ax_state = content::BrowserAccessibilityState::GetInstance();
|
||||
auto mode = ax_state->GetAccessibilityMode();
|
||||
return mode.has_mode(ui::kAXModeComplete.flags());
|
||||
return ax_state->GetAccessibilityMode() == ui::kAXModeComplete;
|
||||
}
|
||||
|
||||
void App::SetAccessibilitySupportEnabled(gin_helper::ErrorThrower thrower,
|
||||
|
||||
@@ -2023,21 +2023,16 @@ SkRegion* WebContents::draggable_region() {
|
||||
|
||||
void WebContents::DidStartNavigation(
|
||||
content::NavigationHandle* navigation_handle) {
|
||||
base::AutoReset<bool> resetter(&is_safe_to_delete_, false);
|
||||
EmitNavigationEvent("did-start-navigation", navigation_handle);
|
||||
}
|
||||
|
||||
void WebContents::DidRedirectNavigation(
|
||||
content::NavigationHandle* navigation_handle) {
|
||||
base::AutoReset<bool> resetter(&is_safe_to_delete_, false);
|
||||
EmitNavigationEvent("did-redirect-navigation", navigation_handle);
|
||||
}
|
||||
|
||||
void WebContents::ReadyToCommitNavigation(
|
||||
content::NavigationHandle* navigation_handle) {
|
||||
base::AutoReset<bool> resetter(&is_safe_to_delete_, false);
|
||||
EmitNavigationEvent("-ready-to-commit-navigation", navigation_handle);
|
||||
|
||||
// Don't focus content in an inactive window.
|
||||
if (!owner_window())
|
||||
return;
|
||||
@@ -2380,7 +2375,7 @@ void WebContents::LoadURL(const GURL& url,
|
||||
// http://crbug.com/347742.
|
||||
auto& ctrl_impl = static_cast<content::NavigationControllerImpl&>(
|
||||
web_contents()->GetController());
|
||||
if (!is_safe_to_delete_ || ctrl_impl.in_navigate_to_pending_entry()) {
|
||||
if (ctrl_impl.in_navigate_to_pending_entry()) {
|
||||
Emit("did-fail-load", static_cast<int>(net::ERR_FAILED),
|
||||
net::ErrorToShortString(net::ERR_FAILED), url.possibly_invalid_spec(),
|
||||
true);
|
||||
|
||||
@@ -858,9 +858,6 @@ class WebContents final : public ExclusiveAccessContext,
|
||||
const scoped_refptr<base::TaskRunner> print_task_runner_;
|
||||
#endif
|
||||
|
||||
// Track navigation state in order to avoid potential re-entrancy crashes.
|
||||
bool is_safe_to_delete_ = true;
|
||||
|
||||
// Stores the frame that's currently in fullscreen, nullptr if there is none.
|
||||
raw_ptr<content::RenderFrameHost> fullscreen_frame_ = nullptr;
|
||||
|
||||
|
||||
@@ -197,32 +197,40 @@ bool Browser::RemoveAsDefaultProtocolClient(const std::string& protocol,
|
||||
return false;
|
||||
|
||||
NSString* protocol_ns = [NSString stringWithUTF8String:protocol.c_str()];
|
||||
CFStringRef protocol_cf = base::apple::NSToCFPtrCast(protocol_ns);
|
||||
// TODO(codebytere): Use -[NSWorkspace URLForApplicationToOpenURL:] instead
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
CFArrayRef bundleList = LSCopyAllHandlersForURLScheme(protocol_cf);
|
||||
#pragma clang diagnostic pop
|
||||
if (!bundleList) {
|
||||
NSURL* protocol_url =
|
||||
[NSURL URLWithString:[protocol_ns stringByAppendingString:@":"]];
|
||||
|
||||
if (!protocol_url)
|
||||
return false;
|
||||
}
|
||||
// On macOS, we can't query the default, but the handlers list seems to put
|
||||
// Apple's defaults first, so we'll use the first option that isn't our bundle
|
||||
CFStringRef other = nil;
|
||||
for (CFIndex i = 0; i < CFArrayGetCount(bundleList); ++i) {
|
||||
other =
|
||||
base::apple::CFCast<CFStringRef>(CFArrayGetValueAtIndex(bundleList, i));
|
||||
if (![identifier isEqualToString:(__bridge NSString*)other]) {
|
||||
|
||||
// Get all applications that can handle this URL scheme.
|
||||
NSArray<NSURL*>* app_urls =
|
||||
[[NSWorkspace sharedWorkspace] URLsForApplicationsToOpenURL:protocol_url];
|
||||
|
||||
if (app_urls.count == 0)
|
||||
return false;
|
||||
|
||||
// Find the first application that isn't our bundle.
|
||||
NSString* other_bundle_id = nil;
|
||||
for (NSURL* app_url in app_urls) {
|
||||
NSBundle* app_bundle = [NSBundle bundleWithURL:app_url];
|
||||
NSString* app_identifier = [app_bundle bundleIdentifier];
|
||||
|
||||
if (app_identifier && ![identifier isEqualToString:app_identifier]) {
|
||||
other_bundle_id = app_identifier;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// No other app was found set it to none instead of setting it back to itself.
|
||||
if ([identifier isEqualToString:(__bridge NSString*)other]) {
|
||||
other = base::apple::NSToCFPtrCast(@"None");
|
||||
// No other app was found, set it to none instead of setting it back to
|
||||
// itself.
|
||||
if (!other_bundle_id) {
|
||||
other_bundle_id = @"None";
|
||||
}
|
||||
|
||||
OSStatus return_code = LSSetDefaultHandlerForURLScheme(protocol_cf, other);
|
||||
OSStatus return_code = LSSetDefaultHandlerForURLScheme(
|
||||
base::apple::NSToCFPtrCast(protocol_ns),
|
||||
base::apple::NSToCFPtrCast(other_bundle_id));
|
||||
return return_code == noErr;
|
||||
}
|
||||
|
||||
@@ -252,21 +260,28 @@ bool Browser::IsDefaultProtocolClient(const std::string& protocol,
|
||||
return false;
|
||||
|
||||
NSString* protocol_ns = [NSString stringWithUTF8String:protocol.c_str()];
|
||||
NSURL* protocol_url =
|
||||
[NSURL URLWithString:[protocol_ns stringByAppendingString:@":"]];
|
||||
|
||||
// TODO(codebytere): Use -[NSWorkspace URLForApplicationToOpenURL:] instead
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
base::apple::ScopedCFTypeRef<CFStringRef> bundleId(
|
||||
LSCopyDefaultHandlerForURLScheme(
|
||||
base::apple::NSToCFPtrCast(protocol_ns)));
|
||||
#pragma clang diagnostic pop
|
||||
if (!bundleId)
|
||||
if (!protocol_url)
|
||||
return false;
|
||||
|
||||
NSURL* default_app_url =
|
||||
[[NSWorkspace sharedWorkspace] URLForApplicationToOpenURL:protocol_url];
|
||||
|
||||
if (!default_app_url)
|
||||
return false;
|
||||
|
||||
NSBundle* default_app_bundle = [NSBundle bundleWithURL:default_app_url];
|
||||
NSString* default_bundle_id = [default_app_bundle bundleIdentifier];
|
||||
|
||||
if (!default_bundle_id)
|
||||
return false;
|
||||
|
||||
// Ensure the comparison is case-insensitive
|
||||
// as LS does not persist the case of the bundle id.
|
||||
NSComparisonResult result = [base::apple::CFToNSPtrCast(bundleId.get())
|
||||
caseInsensitiveCompare:identifier];
|
||||
// as bundle IDs should be compared case-insensitively
|
||||
NSComparisonResult result =
|
||||
[default_bundle_id caseInsensitiveCompare:identifier];
|
||||
return result == NSOrderedSame;
|
||||
}
|
||||
|
||||
|
||||
@@ -1308,44 +1308,30 @@ void NativeWindowMac::UpdateVibrancyRadii(bool fullscreen) {
|
||||
|
||||
if (vibrantView != nil && !vibrancy_type_.empty()) {
|
||||
const bool no_rounded_corner = !HasStyleMask(NSWindowStyleMaskTitled);
|
||||
const int macos_version = base::mac::MacOSMajorVersion();
|
||||
const bool modal = is_modal();
|
||||
|
||||
// If the window is modal, its corners are rounded on macOS >= 11 or higher
|
||||
// unless the user has explicitly passed noRoundedCorners.
|
||||
bool should_round_modal =
|
||||
!no_rounded_corner && macos_version >= 11 && modal;
|
||||
// If the window is modal, its corners are rounded unless
|
||||
// the user has explicitly passed |roundedCorners: false|.
|
||||
bool should_round_modal = !no_rounded_corner && is_modal();
|
||||
// If the window is nonmodal, its corners are rounded if it is frameless and
|
||||
// the user hasn't passed noRoundedCorners.
|
||||
bool should_round_nonmodal = !no_rounded_corner && !modal && !has_frame();
|
||||
// the user hasn't passed |roundedCorners: false|.
|
||||
bool should_round_nonmodal =
|
||||
!no_rounded_corner && !is_modal() && !has_frame();
|
||||
|
||||
if (should_round_nonmodal || should_round_modal) {
|
||||
CGFloat radius;
|
||||
if (fullscreen) {
|
||||
radius = 0.0f;
|
||||
} else if (macos_version >= 11) {
|
||||
radius = 9.0f;
|
||||
} else {
|
||||
// Smaller corner radius on versions prior to Big Sur.
|
||||
radius = 5.0f;
|
||||
}
|
||||
|
||||
CGFloat radius = fullscreen ? 0.0f : 9.0f;
|
||||
CGFloat dimension = 2 * radius + 1;
|
||||
NSSize size = NSMakeSize(dimension, dimension);
|
||||
NSImage* maskImage = [NSImage imageWithSize:size
|
||||
flipped:NO
|
||||
drawingHandler:^BOOL(NSRect rect) {
|
||||
NSBezierPath* bezierPath = [NSBezierPath
|
||||
bezierPathWithRoundedRect:rect
|
||||
xRadius:radius
|
||||
yRadius:radius];
|
||||
[[NSColor blackColor] set];
|
||||
[bezierPath fill];
|
||||
return YES;
|
||||
}];
|
||||
NSImage* maskImage =
|
||||
[NSImage imageWithSize:NSMakeSize(dimension, dimension)
|
||||
flipped:NO
|
||||
drawingHandler:^BOOL(NSRect rect) {
|
||||
[[NSBezierPath bezierPathWithRoundedRect:rect
|
||||
xRadius:radius
|
||||
yRadius:radius] fill];
|
||||
return YES;
|
||||
}];
|
||||
|
||||
[maskImage setCapInsets:NSEdgeInsetsMake(radius, radius, radius, radius)];
|
||||
[maskImage setResizingMode:NSImageResizingModeStretch];
|
||||
maskImage.capInsets = NSEdgeInsetsMake(radius, radius, radius, radius);
|
||||
maskImage.resizingMode = NSImageResizingModeStretch;
|
||||
[vibrantView setMaskImage:maskImage];
|
||||
[window_ setCornerMask:maskImage];
|
||||
}
|
||||
|
||||
@@ -33,7 +33,6 @@ std::string PluginUtils::GetExtensionIdForMimeType(
|
||||
base::flat_map<std::string, std::string>
|
||||
PluginUtils::GetMimeTypeToExtensionIdMap(
|
||||
content::BrowserContext* browser_context) {
|
||||
base::flat_map<std::string, std::string> mime_type_to_extension_id_map;
|
||||
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
||||
const auto& allowed_extension_ids = MimeTypesHandler::GetMIMETypeAllowlist();
|
||||
if (allowed_extension_ids.empty())
|
||||
@@ -42,6 +41,8 @@ PluginUtils::GetMimeTypeToExtensionIdMap(
|
||||
const extensions::ExtensionSet& enabled_extensions =
|
||||
extensions::ExtensionRegistry::Get(browser_context)->enabled_extensions();
|
||||
|
||||
base::flat_map<std::string, std::string> mime_type_to_extension_id_map;
|
||||
|
||||
// Go through the white-listed extensions and try to use them to intercept
|
||||
// the URL request.
|
||||
for (const std::string& id : allowed_extension_ids) {
|
||||
|
||||
@@ -81,7 +81,6 @@ bool IsDeviceNameValid(const std::u16string& device_name) {
|
||||
|
||||
namespace {
|
||||
|
||||
#if BUILDFLAG(ENABLE_PDF_VIEWER)
|
||||
// Duplicated from chrome/browser/printing/print_view_manager_common.cc
|
||||
content::RenderFrameHost* GetFullPagePlugin(content::WebContents* contents) {
|
||||
content::RenderFrameHost* full_page_plugin = nullptr;
|
||||
@@ -100,7 +99,6 @@ content::RenderFrameHost* GetFullPagePlugin(content::WebContents* contents) {
|
||||
#endif // BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
||||
return full_page_plugin;
|
||||
}
|
||||
#endif // BUILDFLAG(ENABLE_PDF_VIEWER)
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -121,7 +119,7 @@ content::RenderFrameHost* GetRenderFrameHostToUse(
|
||||
if (pdf_rfh) {
|
||||
return pdf_rfh;
|
||||
}
|
||||
#endif // BUILDFLAG(ENABLE_PDF_VIEWER)
|
||||
#endif // BUILDFLAG(ENABLE_PDF)
|
||||
auto* focused_frame = contents->GetFocusedFrame();
|
||||
return (focused_frame && focused_frame->HasSelection())
|
||||
? focused_frame
|
||||
|
||||
@@ -98,6 +98,98 @@ base::Value UsbChooserContext::DeviceInfoToValue(
|
||||
device_value.Set("deviceVersionMinor", device_info.device_version_minor);
|
||||
device_value.Set("deviceVersionSubminor",
|
||||
device_info.device_version_subminor);
|
||||
|
||||
bool has_active_configuration = false;
|
||||
base::Value::List configuration_list;
|
||||
for (const auto& configuration : device_info.configurations) {
|
||||
base::Value::Dict configuration_value;
|
||||
configuration_value.Set("configurationValue",
|
||||
configuration->configuration_value);
|
||||
configuration_value.Set("configurationName",
|
||||
configuration->configuration_name
|
||||
? *configuration->configuration_name
|
||||
: std::u16string_view());
|
||||
|
||||
for (const auto& interface : configuration->interfaces) {
|
||||
base::Value::Dict interface_value;
|
||||
interface_value.Set("interfaceNumber", interface->interface_number);
|
||||
|
||||
base::Value::List alternate_list;
|
||||
for (const auto& alternate : interface->alternates) {
|
||||
base::Value::Dict alternate_value;
|
||||
alternate_value.Set("alternateSetting", alternate->alternate_setting);
|
||||
alternate_value.Set("interfaceClass", alternate->class_code);
|
||||
alternate_value.Set("interfaceSubclass", alternate->subclass_code);
|
||||
alternate_value.Set("interfaceProtocol", alternate->protocol_code);
|
||||
alternate_value.Set("interfaceName", alternate->interface_name
|
||||
? *alternate->interface_name
|
||||
: std::u16string_view());
|
||||
|
||||
base::Value::List endpoint_list;
|
||||
for (const auto& endpoint : alternate->endpoints) {
|
||||
base::Value::Dict endpoint_value;
|
||||
endpoint_value.Set("endpointNumber", endpoint->endpoint_number);
|
||||
|
||||
bool inbound = endpoint->direction ==
|
||||
device::mojom::UsbTransferDirection::INBOUND;
|
||||
endpoint_value.Set("direction", inbound ? "in" : "out");
|
||||
|
||||
std::string type;
|
||||
switch (endpoint->type) {
|
||||
case device::mojom::UsbTransferType::ISOCHRONOUS:
|
||||
type = "isochronous";
|
||||
break;
|
||||
case device::mojom::UsbTransferType::BULK:
|
||||
type = "bulk";
|
||||
break;
|
||||
case device::mojom::UsbTransferType::INTERRUPT:
|
||||
type = "interrupt";
|
||||
break;
|
||||
default:
|
||||
NOTREACHED() << "Unknown USB transfer type: "
|
||||
<< static_cast<int>(endpoint->type);
|
||||
}
|
||||
endpoint_value.Set("type", type);
|
||||
endpoint_value.Set("packetSize",
|
||||
static_cast<int>(endpoint->packet_size));
|
||||
endpoint_list.Append(std::move(endpoint_value));
|
||||
}
|
||||
|
||||
alternate_value.Set("endpoints", base::Value(std::move(endpoint_list)));
|
||||
|
||||
if (alternate->alternate_setting == 0) {
|
||||
auto active_alternate_value = alternate_value.Clone();
|
||||
interface_value.Set("alternate", std::move(active_alternate_value));
|
||||
}
|
||||
|
||||
alternate_list.Append(std::move(alternate_value));
|
||||
}
|
||||
|
||||
interface_value.Set("alternates", std::move(alternate_list));
|
||||
|
||||
configuration_value.Set("interfaces",
|
||||
base::Value(std::move(interface_value)));
|
||||
}
|
||||
|
||||
if (device_info.active_configuration &&
|
||||
device_info.active_configuration ==
|
||||
configuration->configuration_value) {
|
||||
auto active_configuration_value = configuration_value.Clone();
|
||||
has_active_configuration = true;
|
||||
configuration_value.Set("configuration",
|
||||
std::move(active_configuration_value));
|
||||
}
|
||||
|
||||
configuration_list.Append(std::move(configuration_value));
|
||||
}
|
||||
|
||||
device_value.Set("configurations", std::move(configuration_list));
|
||||
|
||||
// Set value for "configuration" to null if no active configuration.
|
||||
if (!has_active_configuration) {
|
||||
device_value.Set("configuration", base::Value());
|
||||
}
|
||||
|
||||
return base::Value(std::move(device_value));
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "shell/common/gin_helper/dictionary.h"
|
||||
#include "ui/display/display.h"
|
||||
#include "ui/display/screen.h"
|
||||
#include "ui/gfx/color_space.h"
|
||||
#include "ui/gfx/geometry/insets.h"
|
||||
#include "ui/gfx/geometry/point.h"
|
||||
#include "ui/gfx/geometry/point_f.h"
|
||||
@@ -233,4 +234,363 @@ bool Converter<WrappedSkColor>::FromV8(v8::Isolate* isolate,
|
||||
return true;
|
||||
}
|
||||
|
||||
v8::Local<v8::Value> Converter<gfx::ColorSpace>::ToV8(
|
||||
v8::Isolate* isolate,
|
||||
const gfx::ColorSpace& val) {
|
||||
auto dict = gin_helper::Dictionary::CreateEmpty(isolate);
|
||||
|
||||
// Convert primaries to string
|
||||
std::string primaries;
|
||||
switch (val.GetPrimaryID()) {
|
||||
case gfx::ColorSpace::PrimaryID::BT709:
|
||||
primaries = "bt709";
|
||||
break;
|
||||
case gfx::ColorSpace::PrimaryID::BT470M:
|
||||
primaries = "bt470m";
|
||||
break;
|
||||
case gfx::ColorSpace::PrimaryID::BT470BG:
|
||||
primaries = "bt470bg";
|
||||
break;
|
||||
case gfx::ColorSpace::PrimaryID::SMPTE170M:
|
||||
primaries = "smpte170m";
|
||||
break;
|
||||
case gfx::ColorSpace::PrimaryID::SMPTE240M:
|
||||
primaries = "smpte240m";
|
||||
break;
|
||||
case gfx::ColorSpace::PrimaryID::FILM:
|
||||
primaries = "film";
|
||||
break;
|
||||
case gfx::ColorSpace::PrimaryID::BT2020:
|
||||
primaries = "bt2020";
|
||||
break;
|
||||
case gfx::ColorSpace::PrimaryID::SMPTEST428_1:
|
||||
primaries = "smptest428-1";
|
||||
break;
|
||||
case gfx::ColorSpace::PrimaryID::SMPTEST431_2:
|
||||
primaries = "smptest431-2";
|
||||
break;
|
||||
case gfx::ColorSpace::PrimaryID::P3:
|
||||
primaries = "p3";
|
||||
break;
|
||||
case gfx::ColorSpace::PrimaryID::XYZ_D50:
|
||||
primaries = "xyz-d50";
|
||||
break;
|
||||
case gfx::ColorSpace::PrimaryID::ADOBE_RGB:
|
||||
primaries = "adobe-rgb";
|
||||
break;
|
||||
case gfx::ColorSpace::PrimaryID::APPLE_GENERIC_RGB:
|
||||
primaries = "apple-generic-rgb";
|
||||
break;
|
||||
case gfx::ColorSpace::PrimaryID::WIDE_GAMUT_COLOR_SPIN:
|
||||
primaries = "wide-gamut-color-spin";
|
||||
break;
|
||||
case gfx::ColorSpace::PrimaryID::CUSTOM:
|
||||
primaries = "custom";
|
||||
break;
|
||||
case gfx::ColorSpace::PrimaryID::EBU_3213_E:
|
||||
primaries = "ebu-3213-e";
|
||||
break;
|
||||
case gfx::ColorSpace::PrimaryID::INVALID:
|
||||
primaries = "invalid";
|
||||
break;
|
||||
}
|
||||
|
||||
// Convert transfer function to string
|
||||
std::string transfer;
|
||||
switch (val.GetTransferID()) {
|
||||
case gfx::ColorSpace::TransferID::BT709:
|
||||
transfer = "bt709";
|
||||
break;
|
||||
case gfx::ColorSpace::TransferID::BT709_APPLE:
|
||||
transfer = "bt709-apple";
|
||||
break;
|
||||
case gfx::ColorSpace::TransferID::GAMMA18:
|
||||
transfer = "gamma18";
|
||||
break;
|
||||
case gfx::ColorSpace::TransferID::GAMMA22:
|
||||
transfer = "gamma22";
|
||||
break;
|
||||
case gfx::ColorSpace::TransferID::GAMMA24:
|
||||
transfer = "gamma24";
|
||||
break;
|
||||
case gfx::ColorSpace::TransferID::GAMMA28:
|
||||
transfer = "gamma28";
|
||||
break;
|
||||
case gfx::ColorSpace::TransferID::SMPTE170M:
|
||||
transfer = "smpte170m";
|
||||
break;
|
||||
case gfx::ColorSpace::TransferID::SMPTE240M:
|
||||
transfer = "smpte240m";
|
||||
break;
|
||||
case gfx::ColorSpace::TransferID::LINEAR:
|
||||
transfer = "linear";
|
||||
break;
|
||||
case gfx::ColorSpace::TransferID::LOG:
|
||||
transfer = "log";
|
||||
break;
|
||||
case gfx::ColorSpace::TransferID::LOG_SQRT:
|
||||
transfer = "log-sqrt";
|
||||
break;
|
||||
case gfx::ColorSpace::TransferID::IEC61966_2_4:
|
||||
transfer = "iec61966-2-4";
|
||||
break;
|
||||
case gfx::ColorSpace::TransferID::BT1361_ECG:
|
||||
transfer = "bt1361-ecg";
|
||||
break;
|
||||
case gfx::ColorSpace::TransferID::SRGB:
|
||||
transfer = "srgb";
|
||||
break;
|
||||
case gfx::ColorSpace::TransferID::BT2020_10:
|
||||
transfer = "bt2020-10";
|
||||
break;
|
||||
case gfx::ColorSpace::TransferID::BT2020_12:
|
||||
transfer = "bt2020-12";
|
||||
break;
|
||||
case gfx::ColorSpace::TransferID::PQ:
|
||||
transfer = "pq";
|
||||
break;
|
||||
case gfx::ColorSpace::TransferID::SMPTEST428_1:
|
||||
transfer = "smptest428-1";
|
||||
break;
|
||||
case gfx::ColorSpace::TransferID::HLG:
|
||||
transfer = "hlg";
|
||||
break;
|
||||
case gfx::ColorSpace::TransferID::SRGB_HDR:
|
||||
transfer = "srgb-hdr";
|
||||
break;
|
||||
case gfx::ColorSpace::TransferID::LINEAR_HDR:
|
||||
transfer = "linear-hdr";
|
||||
break;
|
||||
case gfx::ColorSpace::TransferID::CUSTOM:
|
||||
transfer = "custom";
|
||||
break;
|
||||
case gfx::ColorSpace::TransferID::CUSTOM_HDR:
|
||||
transfer = "custom-hdr";
|
||||
break;
|
||||
case gfx::ColorSpace::TransferID::SCRGB_LINEAR_80_NITS:
|
||||
transfer = "scrgb-linear-80-nits";
|
||||
break;
|
||||
case gfx::ColorSpace::TransferID::INVALID:
|
||||
transfer = "invalid";
|
||||
break;
|
||||
}
|
||||
|
||||
// Convert matrix to string
|
||||
std::string matrix;
|
||||
switch (val.GetMatrixID()) {
|
||||
case gfx::ColorSpace::MatrixID::RGB:
|
||||
matrix = "rgb";
|
||||
break;
|
||||
case gfx::ColorSpace::MatrixID::BT709:
|
||||
matrix = "bt709";
|
||||
break;
|
||||
case gfx::ColorSpace::MatrixID::FCC:
|
||||
matrix = "fcc";
|
||||
break;
|
||||
case gfx::ColorSpace::MatrixID::BT470BG:
|
||||
matrix = "bt470bg";
|
||||
break;
|
||||
case gfx::ColorSpace::MatrixID::SMPTE170M:
|
||||
matrix = "smpte170m";
|
||||
break;
|
||||
case gfx::ColorSpace::MatrixID::SMPTE240M:
|
||||
matrix = "smpte240m";
|
||||
break;
|
||||
case gfx::ColorSpace::MatrixID::YCOCG:
|
||||
matrix = "ycocg";
|
||||
break;
|
||||
case gfx::ColorSpace::MatrixID::BT2020_NCL:
|
||||
matrix = "bt2020-ncl";
|
||||
break;
|
||||
case gfx::ColorSpace::MatrixID::YDZDX:
|
||||
matrix = "ydzdx";
|
||||
break;
|
||||
case gfx::ColorSpace::MatrixID::GBR:
|
||||
matrix = "gbr";
|
||||
break;
|
||||
case gfx::ColorSpace::MatrixID::INVALID:
|
||||
matrix = "invalid";
|
||||
break;
|
||||
}
|
||||
|
||||
// Convert range to string
|
||||
std::string range;
|
||||
switch (val.GetRangeID()) {
|
||||
case gfx::ColorSpace::RangeID::LIMITED:
|
||||
range = "limited";
|
||||
break;
|
||||
case gfx::ColorSpace::RangeID::FULL:
|
||||
range = "full";
|
||||
break;
|
||||
case gfx::ColorSpace::RangeID::DERIVED:
|
||||
range = "derived";
|
||||
break;
|
||||
case gfx::ColorSpace::RangeID::INVALID:
|
||||
range = "invalid";
|
||||
break;
|
||||
}
|
||||
|
||||
dict.Set("primaries", primaries);
|
||||
dict.Set("transfer", transfer);
|
||||
dict.Set("matrix", matrix);
|
||||
dict.Set("range", range);
|
||||
|
||||
return dict.GetHandle();
|
||||
}
|
||||
|
||||
bool Converter<gfx::ColorSpace>::FromV8(v8::Isolate* isolate,
|
||||
v8::Local<v8::Value> val,
|
||||
gfx::ColorSpace* out) {
|
||||
gin::Dictionary dict(isolate);
|
||||
if (!gin::ConvertFromV8(isolate, val, &dict))
|
||||
return false;
|
||||
|
||||
std::string primaries_str, transfer_str, matrix_str, range_str;
|
||||
|
||||
// Default values if not specified
|
||||
gfx::ColorSpace::PrimaryID primaries = gfx::ColorSpace::PrimaryID::BT709;
|
||||
gfx::ColorSpace::TransferID transfer = gfx::ColorSpace::TransferID::SRGB;
|
||||
gfx::ColorSpace::MatrixID matrix = gfx::ColorSpace::MatrixID::RGB;
|
||||
gfx::ColorSpace::RangeID range = gfx::ColorSpace::RangeID::FULL;
|
||||
|
||||
// Get primaries
|
||||
if (dict.Get("primaries", &primaries_str)) {
|
||||
if (primaries_str == "bt709")
|
||||
primaries = gfx::ColorSpace::PrimaryID::BT709;
|
||||
else if (primaries_str == "bt470m")
|
||||
primaries = gfx::ColorSpace::PrimaryID::BT470M;
|
||||
else if (primaries_str == "bt470bg")
|
||||
primaries = gfx::ColorSpace::PrimaryID::BT470BG;
|
||||
else if (primaries_str == "smpte170m")
|
||||
primaries = gfx::ColorSpace::PrimaryID::SMPTE170M;
|
||||
else if (primaries_str == "smpte240m")
|
||||
primaries = gfx::ColorSpace::PrimaryID::SMPTE240M;
|
||||
else if (primaries_str == "film")
|
||||
primaries = gfx::ColorSpace::PrimaryID::FILM;
|
||||
else if (primaries_str == "bt2020")
|
||||
primaries = gfx::ColorSpace::PrimaryID::BT2020;
|
||||
else if (primaries_str == "smptest428-1")
|
||||
primaries = gfx::ColorSpace::PrimaryID::SMPTEST428_1;
|
||||
else if (primaries_str == "smptest431-2")
|
||||
primaries = gfx::ColorSpace::PrimaryID::SMPTEST431_2;
|
||||
else if (primaries_str == "p3")
|
||||
primaries = gfx::ColorSpace::PrimaryID::P3;
|
||||
else if (primaries_str == "xyz-d50")
|
||||
primaries = gfx::ColorSpace::PrimaryID::XYZ_D50;
|
||||
else if (primaries_str == "adobe-rgb")
|
||||
primaries = gfx::ColorSpace::PrimaryID::ADOBE_RGB;
|
||||
else if (primaries_str == "apple-generic-rgb")
|
||||
primaries = gfx::ColorSpace::PrimaryID::APPLE_GENERIC_RGB;
|
||||
else if (primaries_str == "wide-gamut-color-spin")
|
||||
primaries = gfx::ColorSpace::PrimaryID::WIDE_GAMUT_COLOR_SPIN;
|
||||
else if (primaries_str == "ebu-3213-e")
|
||||
primaries = gfx::ColorSpace::PrimaryID::EBU_3213_E;
|
||||
|
||||
if (primaries_str == "custom") {
|
||||
gin_helper::ErrorThrower(isolate).ThrowTypeError(
|
||||
"'custom' not supported.");
|
||||
return false;
|
||||
} else {
|
||||
primaries = gfx::ColorSpace::PrimaryID::INVALID;
|
||||
}
|
||||
}
|
||||
|
||||
// Get transfer
|
||||
if (dict.Get("transfer", &transfer_str)) {
|
||||
if (transfer_str == "bt709")
|
||||
transfer = gfx::ColorSpace::TransferID::BT709;
|
||||
else if (transfer_str == "bt709-apple")
|
||||
transfer = gfx::ColorSpace::TransferID::BT709_APPLE;
|
||||
else if (transfer_str == "gamma18")
|
||||
transfer = gfx::ColorSpace::TransferID::GAMMA18;
|
||||
else if (transfer_str == "gamma22")
|
||||
transfer = gfx::ColorSpace::TransferID::GAMMA22;
|
||||
else if (transfer_str == "gamma24")
|
||||
transfer = gfx::ColorSpace::TransferID::GAMMA24;
|
||||
else if (transfer_str == "gamma28")
|
||||
transfer = gfx::ColorSpace::TransferID::GAMMA28;
|
||||
else if (transfer_str == "smpte170m")
|
||||
transfer = gfx::ColorSpace::TransferID::SMPTE170M;
|
||||
else if (transfer_str == "smpte240m")
|
||||
transfer = gfx::ColorSpace::TransferID::SMPTE240M;
|
||||
else if (transfer_str == "linear")
|
||||
transfer = gfx::ColorSpace::TransferID::LINEAR;
|
||||
else if (transfer_str == "log")
|
||||
transfer = gfx::ColorSpace::TransferID::LOG;
|
||||
else if (transfer_str == "log-sqrt")
|
||||
transfer = gfx::ColorSpace::TransferID::LOG_SQRT;
|
||||
else if (transfer_str == "iec61966-2-4")
|
||||
transfer = gfx::ColorSpace::TransferID::IEC61966_2_4;
|
||||
else if (transfer_str == "bt1361-ecg")
|
||||
transfer = gfx::ColorSpace::TransferID::BT1361_ECG;
|
||||
else if (transfer_str == "srgb")
|
||||
transfer = gfx::ColorSpace::TransferID::SRGB;
|
||||
else if (transfer_str == "bt2020-10")
|
||||
transfer = gfx::ColorSpace::TransferID::BT2020_10;
|
||||
else if (transfer_str == "bt2020-12")
|
||||
transfer = gfx::ColorSpace::TransferID::BT2020_12;
|
||||
else if (transfer_str == "pq")
|
||||
transfer = gfx::ColorSpace::TransferID::PQ;
|
||||
else if (transfer_str == "smptest428-1")
|
||||
transfer = gfx::ColorSpace::TransferID::SMPTEST428_1;
|
||||
else if (transfer_str == "hlg")
|
||||
transfer = gfx::ColorSpace::TransferID::HLG;
|
||||
else if (transfer_str == "srgb-hdr")
|
||||
transfer = gfx::ColorSpace::TransferID::SRGB_HDR;
|
||||
else if (transfer_str == "linear-hdr")
|
||||
transfer = gfx::ColorSpace::TransferID::LINEAR_HDR;
|
||||
else if (transfer_str == "scrgb-linear-80-nits")
|
||||
transfer = gfx::ColorSpace::TransferID::SCRGB_LINEAR_80_NITS;
|
||||
|
||||
if (transfer_str == "custom" || transfer_str == "custom-hdr") {
|
||||
gin_helper::ErrorThrower(isolate).ThrowTypeError(
|
||||
"'custom', 'custom-hdr' not supported.");
|
||||
return false;
|
||||
} else {
|
||||
primaries = gfx::ColorSpace::PrimaryID::INVALID;
|
||||
}
|
||||
}
|
||||
|
||||
// Get matrix
|
||||
if (dict.Get("matrix", &matrix_str)) {
|
||||
if (matrix_str == "rgb")
|
||||
matrix = gfx::ColorSpace::MatrixID::RGB;
|
||||
else if (matrix_str == "bt709")
|
||||
matrix = gfx::ColorSpace::MatrixID::BT709;
|
||||
else if (matrix_str == "fcc")
|
||||
matrix = gfx::ColorSpace::MatrixID::FCC;
|
||||
else if (matrix_str == "bt470bg")
|
||||
matrix = gfx::ColorSpace::MatrixID::BT470BG;
|
||||
else if (matrix_str == "smpte170m")
|
||||
matrix = gfx::ColorSpace::MatrixID::SMPTE170M;
|
||||
else if (matrix_str == "smpte240m")
|
||||
matrix = gfx::ColorSpace::MatrixID::SMPTE240M;
|
||||
else if (matrix_str == "ycocg")
|
||||
matrix = gfx::ColorSpace::MatrixID::YCOCG;
|
||||
else if (matrix_str == "bt2020-ncl")
|
||||
matrix = gfx::ColorSpace::MatrixID::BT2020_NCL;
|
||||
else if (matrix_str == "ydzdx")
|
||||
matrix = gfx::ColorSpace::MatrixID::YDZDX;
|
||||
else if (matrix_str == "gbr")
|
||||
matrix = gfx::ColorSpace::MatrixID::GBR;
|
||||
else
|
||||
matrix = gfx::ColorSpace::MatrixID::INVALID;
|
||||
}
|
||||
|
||||
// Get range
|
||||
if (dict.Get("range", &range_str)) {
|
||||
if (range_str == "limited")
|
||||
range = gfx::ColorSpace::RangeID::LIMITED;
|
||||
else if (range_str == "full")
|
||||
range = gfx::ColorSpace::RangeID::FULL;
|
||||
else if (range_str == "derived")
|
||||
range = gfx::ColorSpace::RangeID::DERIVED;
|
||||
else
|
||||
range = gfx::ColorSpace::RangeID::INVALID;
|
||||
}
|
||||
|
||||
*out = gfx::ColorSpace(primaries, transfer, matrix, range);
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace gin
|
||||
|
||||
@@ -18,6 +18,7 @@ class PointF;
|
||||
class Size;
|
||||
class Rect;
|
||||
class Insets;
|
||||
class ColorSpace;
|
||||
enum class ResizeEdge;
|
||||
} // namespace gfx
|
||||
|
||||
@@ -87,6 +88,15 @@ struct Converter<WrappedSkColor> {
|
||||
WrappedSkColor* out);
|
||||
};
|
||||
|
||||
template <>
|
||||
struct Converter<gfx::ColorSpace> {
|
||||
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
|
||||
const gfx::ColorSpace& val);
|
||||
static bool FromV8(v8::Isolate* isolate,
|
||||
v8::Local<v8::Value> val,
|
||||
gfx::ColorSpace* out);
|
||||
};
|
||||
|
||||
} // namespace gin
|
||||
|
||||
#endif // ELECTRON_SHELL_COMMON_GIN_CONVERTERS_GFX_CONVERTER_H_
|
||||
|
||||
@@ -342,7 +342,7 @@ void ShowItemInFolder(const base::FilePath& full_path) {
|
||||
|
||||
void OpenPath(const base::FilePath& full_path, OpenCallback callback) {
|
||||
// This is async, so we don't care about the return value.
|
||||
XDGOpen(full_path.DirName(), full_path.value(), false, std::move(callback));
|
||||
XDGOpen(full_path.DirName(), full_path.value(), true, std::move(callback));
|
||||
}
|
||||
|
||||
void OpenFolder(const base::FilePath& full_path) {
|
||||
|
||||
@@ -256,41 +256,6 @@ describe('utilityProcess module', () => {
|
||||
await once(child, 'exit');
|
||||
expect(log).to.equal(pathToFileURL(fixtureFile) + '\n');
|
||||
});
|
||||
|
||||
it('import \'electron/lol\' should throw', async () => {
|
||||
const child = utilityProcess.fork(path.join(fixturesPath, 'electron-modules', 'import-lol.mjs'), [], {
|
||||
stdio: ['ignore', 'ignore', 'pipe']
|
||||
});
|
||||
let stderr = '';
|
||||
child.stderr!.on('data', (data) => { stderr += data.toString('utf8'); });
|
||||
const [code] = await once(child, 'exit');
|
||||
expect(code).to.equal(1);
|
||||
expect(stderr).to.match(/Error \[ERR_MODULE_NOT_FOUND\]/);
|
||||
});
|
||||
|
||||
it('import \'electron/main\' should not throw', async () => {
|
||||
const child = utilityProcess.fork(path.join(fixturesPath, 'electron-modules', 'import-main.mjs'));
|
||||
const [code] = await once(child, 'exit');
|
||||
expect(code).to.equal(0);
|
||||
});
|
||||
|
||||
it('import \'electron/renderer\' should not throw', async () => {
|
||||
const child = utilityProcess.fork(path.join(fixturesPath, 'electron-modules', 'import-renderer.mjs'));
|
||||
const [code] = await once(child, 'exit');
|
||||
expect(code).to.equal(0);
|
||||
});
|
||||
|
||||
it('import \'electron/common\' should not throw', async () => {
|
||||
const child = utilityProcess.fork(path.join(fixturesPath, 'electron-modules', 'import-common.mjs'));
|
||||
const [code] = await once(child, 'exit');
|
||||
expect(code).to.equal(0);
|
||||
});
|
||||
|
||||
it('import \'electron/utility\' should not throw', async () => {
|
||||
const child = utilityProcess.fork(path.join(fixturesPath, 'electron-modules', 'import-utility.mjs'));
|
||||
const [code] = await once(child, 'exit');
|
||||
expect(code).to.equal(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe('pid property', () => {
|
||||
|
||||
@@ -484,7 +484,7 @@ describe('webContents module', () => {
|
||||
}
|
||||
});
|
||||
|
||||
it('fails if loadURL is called inside did-start-loading', (done) => {
|
||||
it('fails if loadURL is called inside a non-reentrant critical section', (done) => {
|
||||
w.webContents.once('did-fail-load', (_event, _errorCode, _errorDescription, validatedURL) => {
|
||||
expect(validatedURL).to.contain('blank.html');
|
||||
done();
|
||||
@@ -497,49 +497,6 @@ describe('webContents module', () => {
|
||||
w.loadURL('data:text/html,<h1>HELLO</h1>');
|
||||
});
|
||||
|
||||
it('fails if loadurl is called after the navigation is ready to commit', () => {
|
||||
w.webContents.once('did-fail-load', (_event, _errorCode, _errorDescription, validatedURL) => {
|
||||
expect(validatedURL).to.contain('blank.html');
|
||||
});
|
||||
|
||||
// @ts-expect-error internal-only event.
|
||||
w.webContents.once('-ready-to-commit-navigation', () => {
|
||||
w.loadURL(`file://${fixturesPath}/pages/blank.html`);
|
||||
});
|
||||
|
||||
w.loadURL('data:text/html,<h1>HELLO</h1>');
|
||||
});
|
||||
|
||||
it('fails if loadURL is called inside did-redirect-navigation', (done) => {
|
||||
const server = http.createServer((req, res) => {
|
||||
if (req.url === '/302') {
|
||||
res.statusCode = 302;
|
||||
res.setHeader('Location', '/200');
|
||||
res.end();
|
||||
} else if (req.url === '/200') {
|
||||
res.end('ok');
|
||||
} else {
|
||||
res.end();
|
||||
}
|
||||
});
|
||||
|
||||
w.webContents.once('did-fail-load', (_event, _errorCode, _errorDescription, validatedURL) => {
|
||||
expect(validatedURL).to.contain('blank.html');
|
||||
server.close();
|
||||
done();
|
||||
});
|
||||
|
||||
listen(server).then(({ url }) => {
|
||||
w.webContents.once('did-redirect-navigation', () => {
|
||||
w.loadURL(`file://${fixturesPath}/pages/blank.html`);
|
||||
});
|
||||
w.loadURL(`${url}/302`);
|
||||
}).catch(e => {
|
||||
server.close();
|
||||
done(e);
|
||||
});
|
||||
});
|
||||
|
||||
it('sets appropriate error information on rejection', async () => {
|
||||
let err: any;
|
||||
try {
|
||||
|
||||
@@ -1273,6 +1273,16 @@ describe('chromium features', () => {
|
||||
});
|
||||
}
|
||||
|
||||
it('is always resizable', async () => {
|
||||
const w = new BrowserWindow({ show: false });
|
||||
w.loadFile(path.resolve(__dirname, 'fixtures', 'blank.html'));
|
||||
w.webContents.executeJavaScript(`
|
||||
{ b = window.open('about:blank', '', 'resizable=no,show=no'); null }
|
||||
`);
|
||||
const [, popup] = await once(app, 'browser-window-created') as [any, BrowserWindow];
|
||||
expect(popup.isResizable()).to.be.true();
|
||||
});
|
||||
|
||||
// FIXME(zcbenz): This test is making the spec runner hang on exit on Windows.
|
||||
ifit(process.platform !== 'win32')('disables node integration when it is disabled on the parent window', async () => {
|
||||
const windowUrl = url.pathToFileURL(path.join(fixturesPath, 'pages', 'window-opener-no-node-integration.html'));
|
||||
@@ -3096,7 +3106,7 @@ describe('iframe using HTML fullscreen API while window is OS-fullscreened', ()
|
||||
});
|
||||
});
|
||||
|
||||
ifdescribe(process.platform !== 'darwin' || process.arch !== 'arm64')('navigator.serial', () => {
|
||||
describe('navigator.serial', () => {
|
||||
let w: BrowserWindow;
|
||||
before(async () => {
|
||||
w = new BrowserWindow({
|
||||
@@ -3120,6 +3130,7 @@ ifdescribe(process.platform !== 'darwin' || process.arch !== 'arm64')('navigator
|
||||
});
|
||||
|
||||
it('does not return a port if select-serial-port event is not defined', async () => {
|
||||
// Take screenshot to verify the test is running
|
||||
w.loadFile(path.join(fixturesPath, 'pages', 'blank.html'));
|
||||
const port = await getPorts();
|
||||
expect(port).to.equal(notFoundError);
|
||||
@@ -3636,7 +3647,7 @@ ifdescribe((process.platform !== 'linux' || app.isUnityRunning()))('navigator.se
|
||||
});
|
||||
});
|
||||
|
||||
ifdescribe(process.platform !== 'darwin' || process.arch !== 'arm64')('navigator.bluetooth', () => {
|
||||
describe('navigator.bluetooth', () => {
|
||||
let w: BrowserWindow;
|
||||
before(async () => {
|
||||
w = new BrowserWindow({
|
||||
|
||||
@@ -65,32 +65,6 @@ describe('esm', () => {
|
||||
expect(result.code).to.equal(0);
|
||||
expect(result.stdout).to.equal('Exit with app, ready: false');
|
||||
});
|
||||
|
||||
it('import \'electron/lol\' should throw', async () => {
|
||||
const result = await runFixture(path.resolve(fixturePath, 'electron-modules', 'import-lol.mjs'));
|
||||
expect(result.code).to.equal(1);
|
||||
expect(result.stderr).to.match(/Error \[ERR_MODULE_NOT_FOUND\]/);
|
||||
});
|
||||
|
||||
it('import \'electron/main\' should not throw', async () => {
|
||||
const result = await runFixture(path.resolve(fixturePath, 'electron-modules', 'import-main.mjs'));
|
||||
expect(result.code).to.equal(0);
|
||||
});
|
||||
|
||||
it('import \'electron/renderer\' should not throw', async () => {
|
||||
const result = await runFixture(path.resolve(fixturePath, 'electron-modules', 'import-renderer.mjs'));
|
||||
expect(result.code).to.equal(0);
|
||||
});
|
||||
|
||||
it('import \'electron/common\' should not throw', async () => {
|
||||
const result = await runFixture(path.resolve(fixturePath, 'electron-modules', 'import-common.mjs'));
|
||||
expect(result.code).to.equal(0);
|
||||
});
|
||||
|
||||
it('import \'electron/utility\' should not throw', async () => {
|
||||
const result = await runFixture(path.resolve(fixturePath, 'electron-modules', 'import-utility.mjs'));
|
||||
expect(result.code).to.equal(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe('renderer process', () => {
|
||||
@@ -239,43 +213,5 @@ describe('esm', () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('electron modules', () => {
|
||||
it('import \'electron/lol\' should throw', async () => {
|
||||
const [, error] = await loadWindowWithPreload('import { ipcRenderer } from "electron/lol";', {
|
||||
sandbox: false
|
||||
});
|
||||
expect(error).to.not.equal(null);
|
||||
expect(error?.message).to.match(/Cannot find package 'electron'/);
|
||||
});
|
||||
|
||||
it('import \'electron/main\' should not throw', async () => {
|
||||
const [, error] = await loadWindowWithPreload('import { ipcRenderer } from "electron/main";', {
|
||||
sandbox: false
|
||||
});
|
||||
expect(error).to.equal(null);
|
||||
});
|
||||
|
||||
it('import \'electron/renderer\' should not throw', async () => {
|
||||
const [, error] = await loadWindowWithPreload('import { ipcRenderer } from "electron/renderer";', {
|
||||
sandbox: false
|
||||
});
|
||||
expect(error).to.equal(null);
|
||||
});
|
||||
|
||||
it('import \'electron/common\' should not throw', async () => {
|
||||
const [, error] = await loadWindowWithPreload('import { ipcRenderer } from "electron/common";', {
|
||||
sandbox: false
|
||||
});
|
||||
expect(error).to.equal(null);
|
||||
});
|
||||
|
||||
it('import \'electron/utility\' should not throw', async () => {
|
||||
const [, error] = await loadWindowWithPreload('import { ipcRenderer } from "electron/utility";', {
|
||||
sandbox: false
|
||||
});
|
||||
expect(error).to.equal(null);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
import { net } from 'electron/common';
|
||||
|
||||
process.exit(net !== undefined ? 0 : 1);
|
||||
@@ -1,3 +0,0 @@
|
||||
import { net } from 'electron/lol';
|
||||
|
||||
process.exit(net !== undefined ? 0 : 1);
|
||||
@@ -1,3 +0,0 @@
|
||||
import { net } from 'electron/main';
|
||||
|
||||
process.exit(net !== undefined ? 0 : 1);
|
||||
@@ -1,3 +0,0 @@
|
||||
import { net } from 'electron/renderer';
|
||||
|
||||
process.exit(net !== undefined ? 0 : 1);
|
||||
@@ -1,3 +0,0 @@
|
||||
import { net } from 'electron/utility';
|
||||
|
||||
process.exit(net !== undefined ? 0 : 1);
|
||||
@@ -1,3 +0,0 @@
|
||||
const { net } = require('electron/common');
|
||||
|
||||
process.exit(net !== undefined ? 0 : 1);
|
||||
@@ -1,3 +0,0 @@
|
||||
const { net } = require('electron/lol');
|
||||
|
||||
process.exit(net !== undefined ? 0 : 1);
|
||||
@@ -1,3 +0,0 @@
|
||||
const { net } = require('electron/main');
|
||||
|
||||
process.exit(net !== undefined ? 0 : 1);
|
||||
@@ -1,3 +0,0 @@
|
||||
const { net } = require('electron/renderer');
|
||||
|
||||
process.exit(net !== undefined ? 0 : 1);
|
||||
@@ -1,3 +0,0 @@
|
||||
const { net } = require('electron/utility');
|
||||
|
||||
process.exit(net !== undefined ? 0 : 1);
|
||||
@@ -1,8 +0,0 @@
|
||||
process.on('uncaughtException', (err) => {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
const { net } = await import('electron/common');
|
||||
|
||||
process.exit(net !== undefined ? 0 : 1);
|
||||
@@ -1,8 +0,0 @@
|
||||
process.on('uncaughtException', (err) => {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
const { net } = await import('electron/lol');
|
||||
|
||||
process.exit(net !== undefined ? 0 : 1);
|
||||
@@ -1,8 +0,0 @@
|
||||
process.on('uncaughtException', (err) => {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
const { net } = await import('electron/main');
|
||||
|
||||
process.exit(net !== undefined ? 0 : 1);
|
||||
@@ -1,8 +0,0 @@
|
||||
process.on('uncaughtException', (err) => {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
const { net } = await import('electron/renderer');
|
||||
|
||||
process.exit(net !== undefined ? 0 : 1);
|
||||
@@ -1,8 +0,0 @@
|
||||
process.on('uncaughtException', (err) => {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
const { net } = await import('electron/utility');
|
||||
|
||||
process.exit(net !== undefined ? 0 : 1);
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BrowserWindow, utilityProcess } from 'electron/main';
|
||||
import { BrowserWindow } from 'electron/main';
|
||||
|
||||
import { expect } from 'chai';
|
||||
|
||||
@@ -82,8 +82,6 @@ describe('modules support', () => {
|
||||
});
|
||||
|
||||
describe('require(\'electron/...\')', () => {
|
||||
const utilityProcessFixturesPath = path.resolve(__dirname, 'fixtures', 'api', 'utility-process', 'electron-modules');
|
||||
|
||||
it('require(\'electron/lol\') should throw in the main process', () => {
|
||||
expect(() => {
|
||||
require('electron/lol');
|
||||
@@ -96,17 +94,6 @@ describe('modules support', () => {
|
||||
await expect(w.webContents.executeJavaScript('{ require(\'electron/lol\'); null }')).to.eventually.be.rejected();
|
||||
});
|
||||
|
||||
it('require(\'electron/lol\') should throw in the utility process', async () => {
|
||||
const child = utilityProcess.fork(path.join(utilityProcessFixturesPath, 'require-lol.js'), [], {
|
||||
stdio: ['ignore', 'ignore', 'pipe']
|
||||
});
|
||||
let stderr = '';
|
||||
child.stderr!.on('data', (data) => { stderr += data.toString('utf8'); });
|
||||
const [code] = await once(child, 'exit');
|
||||
expect(code).to.equal(1);
|
||||
expect(stderr).to.match(/Cannot find module 'electron\/lol'/);
|
||||
});
|
||||
|
||||
it('require(\'electron\') should not throw in the main process', () => {
|
||||
expect(() => {
|
||||
require('electron');
|
||||
@@ -131,12 +118,6 @@ describe('modules support', () => {
|
||||
await expect(w.webContents.executeJavaScript('{ require(\'electron/main\'); null }')).to.be.fulfilled();
|
||||
});
|
||||
|
||||
it('require(\'electron/main\') should not throw in the utility process', async () => {
|
||||
const child = utilityProcess.fork(path.join(utilityProcessFixturesPath, 'require-main.js'));
|
||||
const [code] = await once(child, 'exit');
|
||||
expect(code).to.equal(0);
|
||||
});
|
||||
|
||||
it('require(\'electron/renderer\') should not throw in the main process', () => {
|
||||
expect(() => {
|
||||
require('electron/renderer');
|
||||
@@ -149,12 +130,6 @@ describe('modules support', () => {
|
||||
await expect(w.webContents.executeJavaScript('{ require(\'electron/renderer\'); null }')).to.be.fulfilled();
|
||||
});
|
||||
|
||||
it('require(\'electron/renderer\') should not throw in the utility process', async () => {
|
||||
const child = utilityProcess.fork(path.join(utilityProcessFixturesPath, 'require-renderer.js'));
|
||||
const [code] = await once(child, 'exit');
|
||||
expect(code).to.equal(0);
|
||||
});
|
||||
|
||||
it('require(\'electron/common\') should not throw in the main process', () => {
|
||||
expect(() => {
|
||||
require('electron/common');
|
||||
@@ -166,30 +141,6 @@ describe('modules support', () => {
|
||||
w.loadURL('about:blank');
|
||||
await expect(w.webContents.executeJavaScript('{ require(\'electron/common\'); null }')).to.be.fulfilled();
|
||||
});
|
||||
|
||||
it('require(\'electron/common\') should not throw in the utility process', async () => {
|
||||
const child = utilityProcess.fork(path.join(utilityProcessFixturesPath, 'require-common.js'));
|
||||
const [code] = await once(child, 'exit');
|
||||
expect(code).to.equal(0);
|
||||
});
|
||||
|
||||
it('require(\'electron/utility\') should not throw in the main process', () => {
|
||||
expect(() => {
|
||||
require('electron/utility');
|
||||
}).to.not.throw();
|
||||
});
|
||||
|
||||
it('require(\'electron/utility\') should not throw in the renderer process', async () => {
|
||||
const w = new BrowserWindow({ show: false, webPreferences: { nodeIntegration: true, contextIsolation: false } });
|
||||
w.loadURL('about:blank');
|
||||
await expect(w.webContents.executeJavaScript('{ require(\'electron/utility\'); null }')).to.be.fulfilled();
|
||||
});
|
||||
|
||||
it('require(\'electron/utility\') should not throw in the utility process', async () => {
|
||||
const child = utilityProcess.fork(path.join(utilityProcessFixturesPath, 'require-utility.js'));
|
||||
const [code] = await once(child, 'exit');
|
||||
expect(code).to.equal(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe('coffeescript', () => {
|
||||
|
||||
@@ -16,8 +16,7 @@
|
||||
"outDir": "ts-gen",
|
||||
"typeRoots" : ["./node_modules/@types", "./spec/node_modules/@types"],
|
||||
"paths": {
|
||||
"@electron/internal/*": ["lib/*"],
|
||||
"@node/*": ["../third_party/electron_node/*"]
|
||||
"@electron/internal/*": ["lib/*"]
|
||||
}
|
||||
},
|
||||
"exclude": [
|
||||
|
||||
2
typings/internal-ambient.d.ts
vendored
2
typings/internal-ambient.d.ts
vendored
@@ -1,5 +1,3 @@
|
||||
/// <reference types="webpack/module" />
|
||||
|
||||
declare const BUILDFLAG: (flag: boolean) => boolean;
|
||||
|
||||
declare namespace NodeJS {
|
||||
|
||||
Reference in New Issue
Block a user