mirror of
https://github.com/electron/electron.git
synced 2026-02-19 03:14:51 -05:00
Compare commits
245 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9e14f8d828 | ||
|
|
f797f92716 | ||
|
|
7f6eab8c25 | ||
|
|
b288f3ee59 | ||
|
|
b833c3f02a | ||
|
|
d53f1d8ff4 | ||
|
|
e259dd591f | ||
|
|
daf8d22e07 | ||
|
|
6249f596f9 | ||
|
|
6c1409ae57 | ||
|
|
0d9918cd24 | ||
|
|
bb093817ed | ||
|
|
1de0bb30b1 | ||
|
|
e429b6f745 | ||
|
|
e3a5895c2b | ||
|
|
5951712f2e | ||
|
|
85cb6d9476 | ||
|
|
5029bce65c | ||
|
|
697f468f36 | ||
|
|
9659dab19e | ||
|
|
398e34967f | ||
|
|
9833c7f1e6 | ||
|
|
266b23745b | ||
|
|
65f431ab78 | ||
|
|
5c2a8b9047 | ||
|
|
05abc2bab2 | ||
|
|
c916070300 | ||
|
|
f392f558e0 | ||
|
|
54d920165e | ||
|
|
c3868809df | ||
|
|
e768a1f228 | ||
|
|
217e740791 | ||
|
|
dc065dfa5a | ||
|
|
6a15e168ce | ||
|
|
7084258dd4 | ||
|
|
56c3507ef2 | ||
|
|
650b8e6777 | ||
|
|
7353fa88cd | ||
|
|
50864bcd08 | ||
|
|
e36d79706e | ||
|
|
342ef8e7e1 | ||
|
|
89d09922f7 | ||
|
|
339c30f48b | ||
|
|
6caad0a5f6 | ||
|
|
9d3195bec1 | ||
|
|
3ab4b22460 | ||
|
|
286da15a2c | ||
|
|
4d10825e7a | ||
|
|
ba9b3d4421 | ||
|
|
70bb34ed11 | ||
|
|
e480e29cfc | ||
|
|
2c3a9fd3c5 | ||
|
|
8322c61a0a | ||
|
|
6a058ed6cd | ||
|
|
2f6c4d8d24 | ||
|
|
afd288b660 | ||
|
|
5933cd11cd | ||
|
|
156dbd57ba | ||
|
|
04b6a162ea | ||
|
|
3e92b72aef | ||
|
|
3d139fc424 | ||
|
|
82664bfdcc | ||
|
|
ddccf79f2d | ||
|
|
920391a85d | ||
|
|
c7219bf9e3 | ||
|
|
a4410e20a8 | ||
|
|
d061a0cadf | ||
|
|
e87b0b565a | ||
|
|
16e7e26a2b | ||
|
|
e4fd9da529 | ||
|
|
c519ee59b2 | ||
|
|
da6235ff55 | ||
|
|
8903eecbb6 | ||
|
|
68dfa0440a | ||
|
|
931f4b8dec | ||
|
|
3e177536ba | ||
|
|
2633298855 | ||
|
|
f272c5fb98 | ||
|
|
9ab67cc2f6 | ||
|
|
8035effa1a | ||
|
|
038e261069 | ||
|
|
0d12131f50 | ||
|
|
993d3331fa | ||
|
|
5f78c626d1 | ||
|
|
2021c2e8e9 | ||
|
|
52bc1dc085 | ||
|
|
540d88f809 | ||
|
|
bd17a98386 | ||
|
|
ea76144fa1 | ||
|
|
9a879385c1 | ||
|
|
bd4d0ae2d3 | ||
|
|
fea722b621 | ||
|
|
b0ba1a2113 | ||
|
|
420e834a31 | ||
|
|
8edbefcfa3 | ||
|
|
e21c70a9e0 | ||
|
|
6b86fb4bbb | ||
|
|
81c184ffc1 | ||
|
|
31a753ff7a | ||
|
|
7ff3905120 | ||
|
|
18da367676 | ||
|
|
b029f38750 | ||
|
|
e4bcd82590 | ||
|
|
a3c6dd9767 | ||
|
|
c2540f555c | ||
|
|
a0500a5faa | ||
|
|
ebf09b587b | ||
|
|
41feba221d | ||
|
|
bd900fb10f | ||
|
|
ea3001dd39 | ||
|
|
7294c766ac | ||
|
|
fb9d3ec897 | ||
|
|
75cefdb527 | ||
|
|
9694e7593f | ||
|
|
8d41e6ea9b | ||
|
|
e282ff6e4a | ||
|
|
282ffa10e5 | ||
|
|
72d85e90ac | ||
|
|
2fc89a6b2c | ||
|
|
12bc4dc6c0 | ||
|
|
cdf508a734 | ||
|
|
1dd99250c3 | ||
|
|
d2cb956a75 | ||
|
|
004ca01049 | ||
|
|
ec4ffa99b6 | ||
|
|
844265303c | ||
|
|
aee588b650 | ||
|
|
8f51e8fb5d | ||
|
|
773777f209 | ||
|
|
9437dd3ea8 | ||
|
|
fb5ffd2876 | ||
|
|
2d36065a15 | ||
|
|
e19963b0ac | ||
|
|
9c631ea744 | ||
|
|
9ab77e77b1 | ||
|
|
eb56416cb5 | ||
|
|
703241e1e7 | ||
|
|
0a8ed258da | ||
|
|
7ef5402599 | ||
|
|
a799513b2e | ||
|
|
bf754a3cae | ||
|
|
7120c58297 | ||
|
|
b118c70f77 | ||
|
|
cdafe09ffb | ||
|
|
b428315c6d | ||
|
|
c670e38b4b | ||
|
|
6aa9a003c8 | ||
|
|
2a6ad42113 | ||
|
|
d80c5f8377 | ||
|
|
755f7d5ed0 | ||
|
|
734395bea9 | ||
|
|
75dae2e004 | ||
|
|
b446ce7f22 | ||
|
|
05fba85aa3 | ||
|
|
db11090e58 | ||
|
|
df22e62bf4 | ||
|
|
f8c832d80d | ||
|
|
344aba0838 | ||
|
|
41ba963392 | ||
|
|
43a9f70d19 | ||
|
|
0a7df0ef3d | ||
|
|
38ef9a7690 | ||
|
|
ba3b647fd7 | ||
|
|
76f7bbb0a8 | ||
|
|
22c149812c | ||
|
|
42164d7081 | ||
|
|
3eb94b72ba | ||
|
|
752f2eb124 | ||
|
|
beafbfd511 | ||
|
|
d54645e554 | ||
|
|
0bf53a3876 | ||
|
|
62d4b21819 | ||
|
|
61457c9498 | ||
|
|
c6102b9278 | ||
|
|
72c2b9e862 | ||
|
|
08241669bc | ||
|
|
6e36153799 | ||
|
|
4f76fff978 | ||
|
|
c82ec0c72b | ||
|
|
c57ce31e84 | ||
|
|
32b44aa5c8 | ||
|
|
7032c0d03c | ||
|
|
b9c4b27781 | ||
|
|
8c427253b3 | ||
|
|
ed28ead8ac | ||
|
|
90a7e5acae | ||
|
|
707b9a58cc | ||
|
|
a32705fd30 | ||
|
|
00e3445f8a | ||
|
|
1036d824fe | ||
|
|
587b66acc1 | ||
|
|
040acaaf30 | ||
|
|
dd3fd78e63 | ||
|
|
61ddb1aa07 | ||
|
|
00da7279cb | ||
|
|
7609156ae1 | ||
|
|
66dec24e32 | ||
|
|
433d6c33d8 | ||
|
|
b02918883f | ||
|
|
1cd7419718 | ||
|
|
daecbb90fe | ||
|
|
193e162ec6 | ||
|
|
3759e59bbd | ||
|
|
41b2102d10 | ||
|
|
1bfd3e0631 | ||
|
|
122a2fd177 | ||
|
|
1840d7b7ee | ||
|
|
6cb84ddbfb | ||
|
|
02020fbb63 | ||
|
|
26752d3a06 | ||
|
|
80f34ecd2c | ||
|
|
2f133f5e28 | ||
|
|
150c2bcef9 | ||
|
|
1252f92431 | ||
|
|
c0f9d0eeed | ||
|
|
4ec4efd3e5 | ||
|
|
fb1b5ca4ce | ||
|
|
f826506218 | ||
|
|
62331f5ac1 | ||
|
|
a7d664e3a3 | ||
|
|
62a897b75b | ||
|
|
cc7e80c4e3 | ||
|
|
9f673c859d | ||
|
|
e67ab9a93d | ||
|
|
814ba71dc1 | ||
|
|
cc9e21c260 | ||
|
|
9565b7de74 | ||
|
|
d5912fd05a | ||
|
|
a0dad83ded | ||
|
|
04df5ce492 | ||
|
|
13e601e35c | ||
|
|
a6133e85d1 | ||
|
|
267c0796dd | ||
|
|
b468b5e6e8 | ||
|
|
d89ad1106f | ||
|
|
3885011220 | ||
|
|
3394ee71f0 | ||
|
|
12d7a8ff66 | ||
|
|
e95673b052 | ||
|
|
26131b23b8 | ||
|
|
136762b45f | ||
|
|
d73a937375 | ||
|
|
ddd93529d5 | ||
|
|
e72f4f7f26 | ||
|
|
f350cce64f |
@@ -4,12 +4,8 @@
|
||||
"onCreateCommand": ".devcontainer/on-create-command.sh",
|
||||
"updateContentCommand": ".devcontainer/update-content-command.sh",
|
||||
"workspaceFolder": "/workspaces/gclient/src/electron",
|
||||
"forwardPorts": [8088, 6080, 5901],
|
||||
"forwardPorts": [6080, 5901],
|
||||
"portsAttributes": {
|
||||
"8088": {
|
||||
"label": "Goma Control Panel",
|
||||
"onAutoForward": "silent"
|
||||
},
|
||||
"6080": {
|
||||
"label": "VNC web client (noVNC)",
|
||||
"onAutoForward": "silent"
|
||||
|
||||
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -22,6 +22,7 @@ patches/**/.patches merge=union
|
||||
*.md text eol=lf
|
||||
*.mm text eol=lf
|
||||
*.mojom text eol=lf
|
||||
*.patches text eol=lf
|
||||
*.proto text eol=lf
|
||||
*.py text eol=lf
|
||||
*.ps1 text eol=lf
|
||||
|
||||
3
.github/CODEOWNERS
vendored
3
.github/CODEOWNERS
vendored
@@ -11,6 +11,9 @@ DEPS @electron/wg-upgrades
|
||||
/docs/breaking-changes.md @electron/wg-releases
|
||||
/npm/ @electron/wg-releases
|
||||
/script/release @electron/wg-releases
|
||||
appveyor.yml @electron/wg-releases
|
||||
appveyor-bake.yml @electron/wg-releases
|
||||
appveyor-woa.yml @electron/wg-releases
|
||||
|
||||
# Security WG
|
||||
/lib/browser/devtools.ts @electron/wg-security
|
||||
|
||||
2
.github/actions/build-electron/action.yml
vendored
2
.github/actions/build-electron/action.yml
vendored
@@ -36,7 +36,7 @@ runs:
|
||||
shell: bash
|
||||
if: ${{ inputs.target-arch == 'x64' && inputs.target-platform == 'macos' }}
|
||||
run: |
|
||||
GN_APPENDED_ARGS="$GN_EXTRA_ARGS target_cpu=\"x64\" v8_snapshot_toolchain=\"//build/toolchain/mac:clang_x64\""
|
||||
GN_APPENDED_ARGS="$GN_EXTRA_ARGS v8_snapshot_toolchain=\"//build/toolchain/mac:clang_x64\""
|
||||
echo "GN_EXTRA_ARGS=$GN_APPENDED_ARGS" >> $GITHUB_ENV
|
||||
- name: Build Electron ${{ inputs.step-suffix }}
|
||||
shell: bash
|
||||
|
||||
5
.github/actions/checkout/action.yml
vendored
5
.github/actions/checkout/action.yml
vendored
@@ -61,8 +61,8 @@ runs:
|
||||
echo "cache_exists=false" >> $GITHUB_OUTPUT
|
||||
echo "Cache Does Not Exist for $DEPSHASH"
|
||||
else
|
||||
echo "cache_exists=true" >> $GITHUB_OUTPUT
|
||||
echo "Cache Already Exists for $DEPSHASH, Skipping.."
|
||||
echo "cache_exists=false" >> $GITHUB_OUTPUT
|
||||
echo "Cache Already Exists for $DEPSHASH, Busting cache.."
|
||||
fi
|
||||
- name: Gclient Sync
|
||||
if: steps.check-cache.outputs.cache_exists == 'false'
|
||||
@@ -100,7 +100,6 @@ runs:
|
||||
echo "There were changes to the patches when applying."
|
||||
echo "Check the CI artifacts for a patch you can apply to fix it."
|
||||
echo "======================================================================"
|
||||
cat ../../patches/update-patches.patch
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
6
.github/workflows/build.yml
vendored
6
.github/workflows/build.yml
vendored
@@ -136,7 +136,6 @@ jobs:
|
||||
needs: checkout-macos
|
||||
with:
|
||||
build-runs-on: macos-14-xlarge
|
||||
check-runs-on: macos-14
|
||||
test-runs-on: macos-13
|
||||
target-platform: macos
|
||||
target-arch: x64
|
||||
@@ -155,7 +154,6 @@ jobs:
|
||||
needs: checkout-macos
|
||||
with:
|
||||
build-runs-on: macos-14-xlarge
|
||||
check-runs-on: macos-14
|
||||
test-runs-on: macos-14
|
||||
target-platform: macos
|
||||
target-arch: arm64
|
||||
@@ -174,7 +172,6 @@ jobs:
|
||||
needs: checkout-linux
|
||||
with:
|
||||
build-runs-on: electron-arc-linux-amd64-32core
|
||||
check-runs-on: electron-arc-linux-amd64-8core
|
||||
test-runs-on: electron-arc-linux-amd64-4core
|
||||
build-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}'
|
||||
test-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root --privileged --init"}'
|
||||
@@ -195,7 +192,6 @@ jobs:
|
||||
needs: checkout-linux
|
||||
with:
|
||||
build-runs-on: electron-arc-linux-amd64-32core
|
||||
check-runs-on: electron-arc-linux-amd64-8core
|
||||
test-runs-on: electron-arc-linux-amd64-4core
|
||||
build-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}'
|
||||
test-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root --privileged --init"}'
|
||||
@@ -217,7 +213,6 @@ jobs:
|
||||
needs: checkout-linux
|
||||
with:
|
||||
build-runs-on: electron-arc-linux-amd64-32core
|
||||
check-runs-on: electron-arc-linux-amd64-8core
|
||||
test-runs-on: electron-arc-linux-arm64-4core
|
||||
build-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}'
|
||||
test-container: '{"image":"ghcr.io/electron/test:arm32v7-${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root --privileged --init","volumes":["/home/runner/externals:/mnt/runner-externals"]}'
|
||||
@@ -238,7 +233,6 @@ jobs:
|
||||
needs: checkout-linux
|
||||
with:
|
||||
build-runs-on: electron-arc-linux-amd64-32core
|
||||
check-runs-on: electron-arc-linux-amd64-8core
|
||||
test-runs-on: electron-arc-linux-arm64-4core
|
||||
build-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}'
|
||||
test-container: '{"image":"ghcr.io/electron/test:arm64v8-${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root --privileged --init"}'
|
||||
|
||||
18
.github/workflows/issue-labeled.yml
vendored
18
.github/workflows/issue-labeled.yml
vendored
@@ -8,6 +8,24 @@ permissions: # added using https://github.com/step-security/secure-workflows
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
issue-labeled-with-status:
|
||||
name: status/{confirmed,reviewed} label added
|
||||
if: github.event.label.name == 'status/confirmed' || github.event.label.name == 'status/reviewed'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Generate GitHub App token
|
||||
uses: electron/github-app-auth-action@384fd19694fe7b6dcc9a684746c6976ad78228ae # v1.1.1
|
||||
id: generate-token
|
||||
with:
|
||||
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
|
||||
org: electron
|
||||
- name: Set status
|
||||
uses: dsanders11/project-actions/edit-item@82e99438bd44a14ad18d92d036dbc25cbfb9a8c4 # v1.2.0
|
||||
with:
|
||||
token: ${{ steps.generate-token.outputs.token }}
|
||||
project-number: 90
|
||||
field: Status
|
||||
field-value: ✅ Triaged
|
||||
issue-labeled-blocked:
|
||||
name: blocked/* label added
|
||||
if: startsWith(github.event.label.name, 'blocked/')
|
||||
|
||||
41
.github/workflows/issue-opened.yml
vendored
41
.github/workflows/issue-opened.yml
vendored
@@ -25,3 +25,44 @@ jobs:
|
||||
field-value: ${{ github.event.issue.user.login }}
|
||||
project-number: 90
|
||||
token: ${{ steps.generate-token.outputs.token }}
|
||||
set-labels:
|
||||
if: ${{ contains(github.event.issue.labels.*.name, 'bug :beetle:') }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Generate GitHub App token
|
||||
uses: electron/github-app-auth-action@384fd19694fe7b6dcc9a684746c6976ad78228ae # v1.1.1
|
||||
id: generate-token
|
||||
with:
|
||||
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
|
||||
org: electron
|
||||
- run: npm install mdast-util-from-markdown@2.0.0 unist-util-select@5.1.0
|
||||
- name: Add labels
|
||||
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
|
||||
env:
|
||||
ISSUE_BODY: ${{ github.event.issue.body }}
|
||||
with:
|
||||
github-token: ${{ steps.generate-token.outputs.token }}
|
||||
script: |
|
||||
const { fromMarkdown } = await import('${{ github.workspace }}/node_modules/mdast-util-from-markdown/index.js');
|
||||
const { select } = await import('${{ github.workspace }}/node_modules/unist-util-select/index.js');
|
||||
|
||||
const [ owner, repo ] = '${{ github.repository }}'.split('/');
|
||||
const issue_number = ${{ github.event.issue.number }};
|
||||
|
||||
const tree = fromMarkdown(process.env.ISSUE_BODY);
|
||||
|
||||
const labels = [];
|
||||
|
||||
const gistUrl = select('heading:has(> text[value="Testcase Gist URL"]) + paragraph > text', tree)?.value.trim();
|
||||
if (gistUrl !== undefined && gistUrl.startsWith('https://gist.github.com/')) {
|
||||
labels.push('has-repro-gist');
|
||||
}
|
||||
|
||||
if (labels.length) {
|
||||
await github.rest.issues.addLabels({
|
||||
owner,
|
||||
repo,
|
||||
issue_number,
|
||||
labels,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -15,10 +15,6 @@ on:
|
||||
type: string
|
||||
description: 'What host to run the build'
|
||||
required: true
|
||||
check-runs-on:
|
||||
type: string
|
||||
description: 'What host to run the gn-check'
|
||||
required: true
|
||||
test-runs-on:
|
||||
type: string
|
||||
description: 'What host to run the tests on'
|
||||
@@ -81,7 +77,7 @@ jobs:
|
||||
with:
|
||||
target-platform: ${{ inputs.target-platform }}
|
||||
target-arch: ${{ inputs.target-arch }}
|
||||
check-runs-on: ${{ inputs.check-runs-on }}
|
||||
check-runs-on: ${{ inputs.build-runs-on }}
|
||||
check-container: ${{ inputs.build-container }}
|
||||
gn-build-type: ${{ inputs.gn-build-type }}
|
||||
is-asan: ${{ inputs.is-asan }}
|
||||
|
||||
@@ -15,10 +15,6 @@ on:
|
||||
type: string
|
||||
description: 'What host to run the build'
|
||||
required: true
|
||||
check-runs-on:
|
||||
type: string
|
||||
description: 'What host to run the gn-check'
|
||||
required: true
|
||||
test-runs-on:
|
||||
type: string
|
||||
description: 'What host to run the tests on'
|
||||
@@ -87,7 +83,7 @@ jobs:
|
||||
with:
|
||||
target-platform: ${{ inputs.target-platform }}
|
||||
target-arch: ${{ inputs.target-arch }}
|
||||
check-runs-on: ${{ inputs.check-runs-on }}
|
||||
check-runs-on: ${{ inputs.build-runs-on }}
|
||||
check-container: ${{ inputs.build-container }}
|
||||
gn-build-type: ${{ inputs.gn-build-type }}
|
||||
is-asan: ${{ inputs.is-asan }}
|
||||
|
||||
6
.github/workflows/pipeline-electron-lint.yml
vendored
6
.github/workflows/pipeline-electron-lint.yml
vendored
@@ -53,10 +53,10 @@ jobs:
|
||||
run: |
|
||||
chromium_revision="$(grep -A1 chromium_version src/electron/DEPS | tr -d '\n' | cut -d\' -f4)"
|
||||
|
||||
sha1_path='buildtools/linux64/clang-format.sha1'
|
||||
curl -sL "https://chromium.googlesource.com/chromium/src/+/${chromium_revision}/${sha1_path}?format=TEXT" | base64 -d > "src/${sha1_path}"
|
||||
mkdir -p src/buildtools
|
||||
curl -sL "https://chromium.googlesource.com/chromium/src/+/${chromium_revision}/buildtools/DEPS?format=TEXT" | base64 -d > src/buildtools/DEPS
|
||||
|
||||
download_from_google_storage.py --no_resume --no_auth --bucket chromium-clang-format -s "src/${sha1_path}"
|
||||
gclient sync --spec="solutions=[{'name':'src/buildtools','url':None,'deps_file':'DEPS','custom_vars':{'process_deps':True},'managed':False}]"
|
||||
- name: Run Lint
|
||||
shell: bash
|
||||
run: |
|
||||
|
||||
@@ -82,12 +82,6 @@ jobs:
|
||||
with:
|
||||
path: src/electron
|
||||
fetch-depth: 0
|
||||
- name: Free up space (macOS)
|
||||
if: ${{ inputs.target-platform == 'macos' }}
|
||||
uses: ./src/electron/.github/actions/free-space-macos
|
||||
- name: Check disk space after freeing up space
|
||||
if: ${{ inputs.target-platform == 'macos' }}
|
||||
run: df -h
|
||||
- name: Setup Node.js/npm
|
||||
if: ${{ inputs.target-platform == 'macos' }}
|
||||
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8
|
||||
|
||||
@@ -54,23 +54,6 @@ jobs:
|
||||
with:
|
||||
path: src/electron
|
||||
fetch-depth: 0
|
||||
- name: Cleanup disk space on macOS
|
||||
if: ${{ inputs.target-platform == 'macos' }}
|
||||
shell: bash
|
||||
run: |
|
||||
sudo mkdir -p $TMPDIR/del-target
|
||||
|
||||
tmpify() {
|
||||
if [ -d "$1" ]; then
|
||||
sudo mv "$1" $TMPDIR/del-target/$(echo $1|shasum -a 256|head -n1|cut -d " " -f1)
|
||||
fi
|
||||
}
|
||||
tmpify /Library/Developer/CoreSimulator
|
||||
tmpify ~/Library/Developer/CoreSimulator
|
||||
sudo rm -rf $TMPDIR/del-target
|
||||
- name: Check disk space after freeing up space
|
||||
if: ${{ inputs.target-platform == 'macos' }}
|
||||
run: df -h
|
||||
- name: Install Build Tools
|
||||
uses: ./src/electron/.github/actions/install-build-tools
|
||||
- name: Init Build Tools
|
||||
|
||||
41
.github/workflows/update_appveyor_image.yml
vendored
41
.github/workflows/update_appveyor_image.yml
vendored
@@ -6,22 +6,23 @@ on:
|
||||
schedule:
|
||||
- cron: '0 8 * * 1-5' # runs 8:00 every business day (see https://crontab.guru)
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
bake-appveyor-image:
|
||||
name: Bake AppVeyor Image
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write # to create a new PR with updated Appveyor images
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Generate GitHub App token
|
||||
uses: electron/github-app-auth-action@384fd19694fe7b6dcc9a684746c6976ad78228ae # v1.1.1
|
||||
id: generate-token
|
||||
with:
|
||||
creds: ${{ secrets.APPVEYOR_UPDATER_GH_APP_CREDS }}
|
||||
- name: Checkout
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
with:
|
||||
fetch-depth: 0
|
||||
token: ${{ steps.generate-token.outputs.token }}
|
||||
- name: Yarn install
|
||||
run: |
|
||||
node script/yarn.js install --frozen-lockfile
|
||||
@@ -49,26 +50,24 @@ jobs:
|
||||
diff -w -B appveyor.yml appveyor2.yml > appveyor.diff || true
|
||||
patch -f appveyor.yml < appveyor.diff
|
||||
rm appveyor2.yml appveyor.diff
|
||||
git add appveyor.yml
|
||||
- name: (Optionally) Generate Commit Diff for WOA
|
||||
if: ${{ env.APPVEYOR_IMAGE_VERSION }}
|
||||
run: |
|
||||
diff -w -B appveyor-woa.yml appveyor-woa2.yml > appveyor-woa.diff || true
|
||||
patch -f appveyor-woa.yml < appveyor-woa.diff
|
||||
rm appveyor-woa2.yml appveyor-woa.diff
|
||||
- name: (Optionally) Commit and Pull Request
|
||||
git add appveyor-woa.yml
|
||||
- name: (Optionally) Commit to Branch
|
||||
if: ${{ env.APPVEYOR_IMAGE_VERSION }}
|
||||
uses: peter-evans/create-pull-request@b1ddad2c994a25fbc81a28b3ec0e368bb2021c50 # v6.0.0
|
||||
uses: dsanders11/github-app-commit-action@1dd0a2d22c564461d3f598b6858856e8842d7a16 # v1.1.0
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
commit-message: 'build: update appveyor image to latest version'
|
||||
committer: GitHub <noreply@github.com>
|
||||
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
|
||||
signoff: false
|
||||
branch: bump-appveyor-image
|
||||
delete-branch: true
|
||||
reviewers: electron/wg-releases
|
||||
title: 'build: update appveyor image to latest version'
|
||||
labels: semver/none,no-backport
|
||||
body: |
|
||||
This PR updates appveyor.yml to the latest baked image, ${{ env.APPVEYOR_IMAGE_VERSION }}.
|
||||
Notes: none
|
||||
message: 'build: update appveyor image to latest version'
|
||||
ref: bump-appveyor-image
|
||||
token: ${{ steps.generate-token.outputs.token }}
|
||||
- name: (Optionally) Create Pull Request
|
||||
if: ${{ env.APPVEYOR_IMAGE_VERSION }}
|
||||
run: |
|
||||
printf "This PR updates appveyor.yml to the latest baked image, ${{ env.APPVEYOR_IMAGE_VERSION }}.\n\nNotes: none" | gh pr create --head bump-appveyor-image --label no-backport --label semver/none --title 'build: update appveyor image to latest version' --body-file=-
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
|
||||
|
||||
7
BUILD.gn
7
BUILD.gn
@@ -496,6 +496,7 @@ source_set("electron_lib") {
|
||||
"//ui/native_theme",
|
||||
"//ui/shell_dialogs",
|
||||
"//ui/views",
|
||||
"//ui/views/controls/webview",
|
||||
"//v8",
|
||||
"//v8:v8_libplatform",
|
||||
]
|
||||
@@ -631,7 +632,6 @@ source_set("electron_lib") {
|
||||
"//ui/gtk:gtk_config",
|
||||
"//ui/linux:linux_ui",
|
||||
"//ui/linux:linux_ui_factory",
|
||||
"//ui/views/controls/webview",
|
||||
"//ui/wm",
|
||||
]
|
||||
if (ozone_platform_x11) {
|
||||
@@ -658,9 +658,9 @@ source_set("electron_lib") {
|
||||
libs += [ "dwmapi.lib" ]
|
||||
sources += [ "shell/common/asar/archive_win.cc" ]
|
||||
deps += [
|
||||
"//components/app_launch_prefetch",
|
||||
"//components/crash/core/app:crash_export_thunks",
|
||||
"//ui/native_theme:native_theme_browser",
|
||||
"//ui/views/controls/webview",
|
||||
"//ui/wm",
|
||||
"//ui/wm/public",
|
||||
]
|
||||
@@ -741,6 +741,7 @@ source_set("electron_lib") {
|
||||
"//components/pdf/browser",
|
||||
"//components/pdf/browser:interceptors",
|
||||
"//components/pdf/common:constants",
|
||||
"//components/pdf/common:util",
|
||||
"//components/pdf/renderer",
|
||||
"//pdf",
|
||||
]
|
||||
@@ -852,7 +853,7 @@ if (is_mac) {
|
||||
if (is_asan) {
|
||||
# crashpad_handler requires the ASan runtime at its @executable_path.
|
||||
sources += [ "$root_out_dir/libclang_rt.asan_osx_dynamic.dylib" ]
|
||||
public_deps += [ "//build/config/sanitizers:copy_asan_runtime" ]
|
||||
public_deps += [ "//build/config/sanitizers:copy_sanitizer_runtime" ]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
55
DEPS
55
DEPS
@@ -2,9 +2,9 @@ gclient_gn_args_from = 'src'
|
||||
|
||||
vars = {
|
||||
'chromium_version':
|
||||
'124.0.6367.243',
|
||||
'126.0.6478.183',
|
||||
'node_version':
|
||||
'v20.16.0',
|
||||
'v20.15.1',
|
||||
'nan_version':
|
||||
'e14bdcd1f72d62bca1d541b66da43130384ec213',
|
||||
'squirrel.mac_version':
|
||||
@@ -48,6 +48,9 @@ vars = {
|
||||
# It's only needed to parse the native tests configurations.
|
||||
'checkout_pyyaml': False,
|
||||
|
||||
# Can be used to disable the sysroot hooks.
|
||||
'install_sysroot': True,
|
||||
|
||||
'use_rts': False,
|
||||
|
||||
'mac_xcode_version': 'default',
|
||||
@@ -161,6 +164,54 @@ hooks = [
|
||||
'import os, subprocess; os.chdir(os.path.join("src", "electron")); subprocess.check_call(["python3", "script/lib/npx.py", "yarn@' + (Var("yarn_version")) + '", "install", "--frozen-lockfile"]);',
|
||||
],
|
||||
},
|
||||
{
|
||||
'name': 'sysroot_arm',
|
||||
'pattern': '.',
|
||||
'condition': 'install_sysroot and checkout_linux and checkout_arm',
|
||||
'action': ['python3', 'src/build/linux/sysroot_scripts/install-sysroot.py',
|
||||
'--sysroots-json-path=' + Var('sysroots_json_path'),
|
||||
'--arch=arm'],
|
||||
},
|
||||
{
|
||||
'name': 'sysroot_arm64',
|
||||
'pattern': '.',
|
||||
'condition': 'install_sysroot and checkout_linux and checkout_arm64',
|
||||
'action': ['python3', 'src/build/linux/sysroot_scripts/install-sysroot.py',
|
||||
'--sysroots-json-path=' + Var('sysroots_json_path'),
|
||||
'--arch=arm64'],
|
||||
},
|
||||
{
|
||||
'name': 'sysroot_x86',
|
||||
'pattern': '.',
|
||||
'condition': 'install_sysroot and checkout_linux and (checkout_x86 or checkout_x64)',
|
||||
'action': ['python3', 'src/build/linux/sysroot_scripts/install-sysroot.py',
|
||||
'--sysroots-json-path=' + Var('sysroots_json_path'),
|
||||
'--arch=x86'],
|
||||
},
|
||||
{
|
||||
'name': 'sysroot_mips',
|
||||
'pattern': '.',
|
||||
'condition': 'install_sysroot and checkout_linux and checkout_mips',
|
||||
'action': ['python3', 'src/build/linux/sysroot_scripts/install-sysroot.py',
|
||||
'--sysroots-json-path=' + Var('sysroots_json_path'),
|
||||
'--arch=mips'],
|
||||
},
|
||||
{
|
||||
'name': 'sysroot_mips64',
|
||||
'pattern': '.',
|
||||
'condition': 'install_sysroot and checkout_linux and checkout_mips64',
|
||||
'action': ['python3', 'src/build/linux/sysroot_scripts/install-sysroot.py',
|
||||
'--sysroots-json-path=' + Var('sysroots_json_path'),
|
||||
'--arch=mips64el'],
|
||||
},
|
||||
{
|
||||
'name': 'sysroot_x64',
|
||||
'pattern': '.',
|
||||
'condition': 'install_sysroot and checkout_linux and checkout_x64',
|
||||
'action': ['python3', 'src/build/linux/sysroot_scripts/install-sysroot.py',
|
||||
'--sysroots-json-path=' + Var('sysroots_json_path'),
|
||||
'--arch=x64'],
|
||||
},
|
||||
]
|
||||
|
||||
recursedeps = [
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
version: 1.0.{build}
|
||||
build_cloud: electronhq-16-core
|
||||
image: e-123.0.6312.5
|
||||
image: e-126.0.6445.0
|
||||
environment:
|
||||
GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache
|
||||
ELECTRON_OUT_DIR: Default
|
||||
@@ -95,8 +95,6 @@ for:
|
||||
- git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
|
||||
- ps: New-Item -Name depot_tools\.disable_auto_update -ItemType File
|
||||
- depot_tools\bootstrap\win_tools.bat
|
||||
- ps: |
|
||||
Set-Content -Path $pwd\depot_tools\build_telemetry.cfg -Value '{"user": "info@electronjs.org", "status": "opt-out", "countdown": 10, "version": 1}'
|
||||
- ps: $env:PATH="$pwd\depot_tools;$env:PATH"
|
||||
- ps: >-
|
||||
if (Test-Path -Path "$pwd\src\electron") {
|
||||
@@ -117,13 +115,6 @@ for:
|
||||
$env:RBE_experimental_credentials_helper = $env:RECLIENT_HELPER
|
||||
- ps: >-
|
||||
$env:RBE_experimental_credentials_helper_args = "print"
|
||||
- ps: >-
|
||||
if ($env:ELECTRON_RBE_JWT -eq '') {
|
||||
$env:RBE_fail_early_min_action_count = "0"
|
||||
$env:RBE_fail_early_min_fallback_ratio = "0"
|
||||
$env:RBE_exec_strategy = "local"
|
||||
$env:RBE_remote_update_cache= "false"
|
||||
}
|
||||
- cd ..\..
|
||||
- ps: $env:CHROMIUM_BUILDTOOLS_PATH="$pwd\src\buildtools"
|
||||
- ps: >-
|
||||
@@ -175,8 +166,8 @@ for:
|
||||
if ($env:GN_CONFIG -eq 'release') {
|
||||
# Needed for msdia140.dll on 64-bit windows
|
||||
$env:Path += ";$pwd\third_party\llvm-build\Release+Asserts\bin"
|
||||
autoninja -C out/Default electron:electron_symbols
|
||||
}
|
||||
- if "%GN_CONFIG%"=="release" ( autoninja -C out/Default electron:electron_symbols )
|
||||
- ps: >-
|
||||
if ($env:GN_CONFIG -eq 'release') {
|
||||
python3 electron\script\zip-symbols.py
|
||||
|
||||
13
appveyor.yml
13
appveyor.yml
@@ -29,7 +29,7 @@
|
||||
|
||||
version: 1.0.{build}
|
||||
build_cloud: electronhq-16-core
|
||||
image: e-123.0.6312.5
|
||||
image: e-126.0.6445.0
|
||||
environment:
|
||||
GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache
|
||||
ELECTRON_OUT_DIR: Default
|
||||
@@ -93,8 +93,6 @@ for:
|
||||
- git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
|
||||
- ps: New-Item -Name depot_tools\.disable_auto_update -ItemType File
|
||||
- depot_tools\bootstrap\win_tools.bat
|
||||
- ps: |
|
||||
Set-Content -Path $pwd\depot_tools\build_telemetry.cfg -Value '{"user": "info@electronjs.org", "status": "opt-out", "countdown": 10, "version": 1}'
|
||||
- ps: $env:PATH="$pwd\depot_tools;$env:PATH"
|
||||
- ps: >-
|
||||
if (Test-Path -Path "$pwd\src\electron") {
|
||||
@@ -115,13 +113,6 @@ for:
|
||||
$env:RBE_experimental_credentials_helper = $env:RECLIENT_HELPER
|
||||
- ps: >-
|
||||
$env:RBE_experimental_credentials_helper_args = "print"
|
||||
- ps: >-
|
||||
if ($env:ELECTRON_RBE_JWT -eq '') {
|
||||
$env:RBE_fail_early_min_action_count = "0"
|
||||
$env:RBE_fail_early_min_fallback_ratio = "0"
|
||||
$env:RBE_exec_strategy = "local"
|
||||
$env:RBE_remote_update_cache= "false"
|
||||
}
|
||||
- cd ..\..
|
||||
- ps: $env:CHROMIUM_BUILDTOOLS_PATH="$pwd\src\buildtools"
|
||||
- ps: >-
|
||||
@@ -172,8 +163,8 @@ for:
|
||||
if ($env:GN_CONFIG -eq 'release') {
|
||||
# Needed for msdia140.dll on 64-bit windows
|
||||
$env:Path += ";$pwd\third_party\llvm-build\Release+Asserts\bin"
|
||||
autoninja -C out/Default electron:electron_symbols
|
||||
}
|
||||
- if "%GN_CONFIG%"=="release" ( autoninja -C out/Default electron:electron_symbols )
|
||||
- ps: >-
|
||||
if ($env:GN_CONFIG -eq 'release') {
|
||||
python3 electron\script\zip-symbols.py
|
||||
|
||||
@@ -2,7 +2,7 @@ is_electron_build = true
|
||||
root_extra_deps = [ "//electron" ]
|
||||
|
||||
# Registry of NMVs --> https://github.com/nodejs/node/blob/main/doc/abi_version_registry.json
|
||||
node_module_version = 123
|
||||
node_module_version = 125
|
||||
|
||||
v8_promise_internal_field_count = 1
|
||||
v8_embedder_string = "-electron.0"
|
||||
@@ -50,16 +50,13 @@ is_cfi = false
|
||||
# TODO: fix this once sysroots have been updated.
|
||||
use_qt = false
|
||||
|
||||
# https://chromium-review.googlesource.com/c/chromium/src/+/4365718
|
||||
# TODO(codebytere): fix perfetto incompatibility with Node.js.
|
||||
use_perfetto_client_library = false
|
||||
|
||||
# Disables the builtins PGO for V8
|
||||
v8_builtins_profiling_log_file = ""
|
||||
|
||||
# https://chromium.googlesource.com/chromium/src/+/main/docs/dangling_ptr.md
|
||||
# TODO(vertedinde): hunt down dangling pointers on Linux
|
||||
enable_dangling_raw_ptr_checks = false
|
||||
enable_dangling_raw_ptr_feature_flag = false
|
||||
|
||||
# This flag speeds up the performance of fork/execve on linux systems.
|
||||
# Ref: https://chromium-review.googlesource.com/c/v8/v8/+/4602858
|
||||
@@ -67,3 +64,12 @@ v8_enable_private_mapping_fork_optimization = true
|
||||
|
||||
# Expose public V8 symbols for native modules.
|
||||
v8_expose_public_symbols = true
|
||||
|
||||
# Disables unsafe-buffers-usage plugin due to incompatibilities with our reclient implementation
|
||||
# Ref: https://chromium-review.googlesource.com/c/chromium/src/+/5426599
|
||||
# Ref: https://github.com/electron/electron/commit/8e20f16ea35eeaeb149ae63bad3703d782665f6a
|
||||
clang_unsafe_buffers_paths = ""
|
||||
|
||||
# Disable snapshotting a page when printing for its content to be analyzed for
|
||||
# sensitive content by enterprise users.
|
||||
enterprise_cloud_content_analysis = false
|
||||
|
||||
@@ -94,6 +94,8 @@ static_library("chrome") {
|
||||
"//chrome/browser/ui/exclusive_access/exclusive_access_controller_base.h",
|
||||
"//chrome/browser/ui/exclusive_access/exclusive_access_manager.cc",
|
||||
"//chrome/browser/ui/exclusive_access/exclusive_access_manager.h",
|
||||
"//chrome/browser/ui/exclusive_access/exclusive_access_permission_manager.cc",
|
||||
"//chrome/browser/ui/exclusive_access/exclusive_access_permission_manager.h",
|
||||
"//chrome/browser/ui/exclusive_access/fullscreen_controller.cc",
|
||||
"//chrome/browser/ui/exclusive_access/fullscreen_controller.h",
|
||||
"//chrome/browser/ui/exclusive_access/fullscreen_within_tab_helper.cc",
|
||||
@@ -187,6 +189,9 @@ static_library("chrome") {
|
||||
"//chrome/browser:resource_prefetch_predictor_proto",
|
||||
"//chrome/browser/resource_coordinator:mojo_bindings",
|
||||
"//chrome/browser/web_applications/mojom:mojom_web_apps_enum",
|
||||
"//components/enterprise/buildflags",
|
||||
"//components/enterprise/common/proto:connectors_proto",
|
||||
"//components/safe_browsing/core/browser/db:safebrowsing_proto",
|
||||
"//components/vector_icons:vector_icons",
|
||||
"//ui/snapshot",
|
||||
"//ui/views/controls/webview",
|
||||
@@ -237,7 +242,10 @@ static_library("chrome") {
|
||||
"//chrome/services/util_win:lib",
|
||||
"//components/webapps/common:mojo_bindings",
|
||||
]
|
||||
deps += [ "//chrome/services/util_win/public/mojom" ]
|
||||
deps += [
|
||||
"//chrome/services/util_win/public/mojom",
|
||||
"//components/segmentation_platform/public/proto",
|
||||
]
|
||||
}
|
||||
|
||||
if (is_mac) {
|
||||
@@ -275,6 +283,8 @@ static_library("chrome") {
|
||||
"//chrome/browser/bad_message.h",
|
||||
"//chrome/browser/printing/prefs_util.cc",
|
||||
"//chrome/browser/printing/prefs_util.h",
|
||||
"//chrome/browser/printing/print_compositor_util.cc",
|
||||
"//chrome/browser/printing/print_compositor_util.h",
|
||||
"//chrome/browser/printing/print_job.cc",
|
||||
"//chrome/browser/printing/print_job.h",
|
||||
"//chrome/browser/printing/print_job_manager.cc",
|
||||
@@ -301,6 +311,8 @@ static_library("chrome") {
|
||||
|
||||
if (enable_oop_printing) {
|
||||
sources += [
|
||||
"//chrome/browser/printing/oop_features.cc",
|
||||
"//chrome/browser/printing/oop_features.h",
|
||||
"//chrome/browser/printing/print_backend_service_manager.cc",
|
||||
"//chrome/browser/printing/print_backend_service_manager.h",
|
||||
]
|
||||
@@ -327,6 +339,8 @@ static_library("chrome") {
|
||||
"//chrome/browser/printing/pdf_to_emf_converter.h",
|
||||
"//chrome/browser/printing/printer_xml_parser_impl.cc",
|
||||
"//chrome/browser/printing/printer_xml_parser_impl.h",
|
||||
"//chrome/browser/printing/xps_features.cc",
|
||||
"//chrome/browser/printing/xps_features.h",
|
||||
]
|
||||
deps += [ "//printing:printing_base" ]
|
||||
}
|
||||
@@ -350,8 +364,6 @@ static_library("chrome") {
|
||||
"//chrome/browser/pdf/chrome_pdf_stream_delegate.h",
|
||||
"//chrome/browser/pdf/pdf_extension_util.cc",
|
||||
"//chrome/browser/pdf/pdf_extension_util.h",
|
||||
"//chrome/browser/pdf/pdf_frame_util.cc",
|
||||
"//chrome/browser/pdf/pdf_frame_util.h",
|
||||
"//chrome/browser/pdf/pdf_viewer_stream_manager.cc",
|
||||
"//chrome/browser/pdf/pdf_viewer_stream_manager.h",
|
||||
"//chrome/browser/plugins/pdf_iframe_navigation_throttle.cc",
|
||||
|
||||
@@ -1357,7 +1357,7 @@ Show the app's about panel options. These options can be overridden with `app.se
|
||||
* `credits` string (optional) _macOS_ _Windows_ - Credit information.
|
||||
* `authors` string[] (optional) _Linux_ - List of app authors.
|
||||
* `website` string (optional) _Linux_ - The app's website.
|
||||
* `iconPath` string (optional) _Linux_ _Windows_ - Path to the app's icon in a JPEG or PNG file format. On Linux, will be shown as 64x64 pixels while retaining aspect ratio. On Windows, a 48x48 PNG will result in the best visual quality.
|
||||
* `iconPath` string (optional) _Linux_ _Windows_ - Path to the app's icon in a JPEG or PNG file format. On Linux, will be shown as 64x64 pixels while retaining aspect ratio.
|
||||
|
||||
Set the about panel options. This will override the values defined in the app's `.plist` file on macOS. See the [Apple docs][about-panel-options] for more details. On Linux, values must be set in order to be shown; there are no defaults.
|
||||
|
||||
|
||||
@@ -279,7 +279,7 @@ Aliased to `--debug[=[host:]port`.
|
||||
|
||||
Specify ways of the inspector web socket url exposure.
|
||||
|
||||
By default inspector websocket url is available in stderr and under /json/list endpoint on http://host:port/json/list.
|
||||
By default inspector websocket url is available in stderr and under /json/list endpoint on `http://host:port/json/list`.
|
||||
|
||||
### `--no-deprecation`
|
||||
|
||||
|
||||
@@ -72,7 +72,3 @@ or is being instructed to use an inverted color scheme.
|
||||
|
||||
A `boolean` indicating whether Chromium is in forced colors mode, controlled by system accessibility settings.
|
||||
Currently, Windows high contrast is the only system setting that triggers forced colors mode.
|
||||
|
||||
### `nativeTheme.prefersReducedTransparency` _Readonly_
|
||||
|
||||
A `boolean` that indicates the whether the user has chosen via system accessibility settings to reduce transparency at the OS level.
|
||||
|
||||
@@ -4,7 +4,19 @@
|
||||
|
||||
Process: [Main](../glossary.md#main-process)
|
||||
|
||||
This module protects data stored on disk from being accessed by other applications or users with full disk access.
|
||||
This module adds extra protection to data being stored on disk by using OS-provided cryptography systems. Current
|
||||
security semantics for each platform are outlined below.
|
||||
|
||||
* **macOS**: Encryption keys are stored for your app in [Keychain Access](https://support.apple.com/en-ca/guide/keychain-access/kyca1083/mac) in a way that prevents
|
||||
other applications from loading them without user override. Therefore, content is protected from other users and other apps running in the same userspace.
|
||||
* **Windows**: Encryption keys are generated via [DPAPI](https://learn.microsoft.com/en-us/windows/win32/api/dpapi/nf-dpapi-cryptprotectdata).
|
||||
As per the Windows documentation: "Typically, only a user with the same logon credential as the user who encrypted the data can typically
|
||||
decrypt the data". Therefore, content is protected from other users on the same machine, but not from other apps running in the
|
||||
same userspace.
|
||||
* **Linux**: Encryption keys are generated and stored in a secret store that varies depending on your window manager and system setup. Options currently supported are `kwallet`, `kwallet5`, `kwallet6` and `gnome-libsecret`, but more may be available in future versions of Electron. As such, the
|
||||
security semantics of content protected via the `safeStorage` API vary between window managers and secret stores.
|
||||
* Note that not all Linux setups have an available secret store. If no secret store is available, items stored in using the `safeStorage` API will be unprotected
|
||||
as they are encrypted via hardcoded plaintext password. You can detect when this happens when `safeStorage.getSelectedStorageBackend()` returns `basic_text`.
|
||||
|
||||
Note that on Mac, access to the system Keychain is required and
|
||||
these calls can block the current thread to collect user input.
|
||||
|
||||
@@ -1487,6 +1487,37 @@ is emitted.
|
||||
Returns `string | null` - The absolute file system path where data for this
|
||||
session is persisted on disk. For in memory sessions this returns `null`.
|
||||
|
||||
#### `ses.clearData([options])`
|
||||
|
||||
* `options` Object (optional)
|
||||
* `dataTypes` String[] (optional) - The types of data to clear. By default, this will clear all types of data.
|
||||
* `backgroundFetch` - Background Fetch
|
||||
* `cache` - Cache
|
||||
* `cookies` - Cookies
|
||||
* `downloads` - Downloads
|
||||
* `fileSystems` - File Systems
|
||||
* `indexedDB` - IndexedDB
|
||||
* `localStorage` - Local Storage
|
||||
* `serviceWorkers` - Service Workers
|
||||
* `webSQL` - WebSQL
|
||||
* `origins` String[] (optional) - Clear data for only these origins. Cannot be used with `excludeOrigins`.
|
||||
* `excludeOrigins` String[] (optional) - Clear data for all origins except these ones. Cannot be used with `origins`.
|
||||
* `avoidClosingConnections` boolean (optional) - Skips deleting cookies that would close current network connections. (Default: `false`)
|
||||
* `originMatchingMode` String (optional) - The behavior for matching data to origins.
|
||||
* `third-parties-included` (default) - Storage is matched on origin in first-party contexts and top-level-site in third-party contexts.
|
||||
* `origin-in-all-contexts` - Storage is matched on origin only in all contexts.
|
||||
|
||||
Returns `Promise<void>` - resolves when all data has been cleared.
|
||||
|
||||
Clears various different types of data.
|
||||
|
||||
This method clears more types of data and is more thourough than the
|
||||
`clearStorageData` method.
|
||||
|
||||
**Note:** Cookies are stored at a broader scope than origins. When removing cookies and filtering by `origins` (or `excludeOrigins`), the cookies will be removed at the [registrable domain](https://url.spec.whatwg.org/#host-registrable-domain) level. For example, clearing cookies for the origin `https://really.specific.origin.example.com/` will end up clearing all cookies for `example.com`. Clearing cookies for the origin `https://my.website.example.co.uk/` will end up clearing all cookies for `example.co.uk`.
|
||||
|
||||
For more information, refer to Chromium's [`BrowsingDataRemover` interface](https://source.chromium.org/chromium/chromium/src/+/main:content/public/browser/browsing_data_remover.h).
|
||||
|
||||
### Instance Properties
|
||||
|
||||
The following properties are available on instances of `Session`:
|
||||
|
||||
7
docs/api/structures/window-open-handler-response.md
Normal file
7
docs/api/structures/window-open-handler-response.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# WindowOpenHandlerResponse Object
|
||||
|
||||
* `action` string - Can be `allow` or `deny`. Controls whether new window should be created.
|
||||
* `overrideBrowserWindowOptions` BrowserWindowConstructorOptions (optional) - Allows customization of the created window.
|
||||
* `outlivesOpener` boolean (optional) - By default, child windows are closed when their opener is closed. This can be
|
||||
changed by specifying `outlivesOpener: true`, in which case the opened window will not be closed when its opener is closed.
|
||||
* `createWindow` (options: BrowserWindowConstructorOptions) => WebContents (optional) - If specified, will be called instead of `new BrowserWindow` to create the new child window and event [`did-create-window`](../web-contents.md#event-did-create-window) will not be emitted. Constructed child window should use passed `options` object. This can be used for example to have the new window open as a BrowserView instead of in a separate window.
|
||||
@@ -36,8 +36,9 @@ Process: [Main](../glossary.md#main-process)
|
||||
|
||||
* `options` Object (optional)
|
||||
* `webPreferences` [WebPreferences](structures/web-preferences.md) (optional) - Settings of web page's features.
|
||||
* `webContents` [WebContents](web-contents.md) (optional) - If present, the given WebContents will be adopted by the WebContentsView. A WebContents may only be presented in one WebContentsView at a time.
|
||||
|
||||
Creates an empty WebContentsView.
|
||||
Creates a WebContentsView.
|
||||
|
||||
### Instance Properties
|
||||
|
||||
|
||||
@@ -1286,7 +1286,7 @@ Ignore application menu shortcuts while this web contents is focused.
|
||||
|
||||
#### `contents.setWindowOpenHandler(handler)`
|
||||
|
||||
* `handler` Function\<\{action: 'deny'\} | \{action: 'allow', outlivesOpener?: boolean, overrideBrowserWindowOptions?: BrowserWindowConstructorOptions\}\>
|
||||
* `handler` Function\<[WindowOpenHandlerResponse](structures/window-open-handler-response.md)\>
|
||||
* `details` Object
|
||||
* `url` string - The _resolved_ version of the URL passed to `window.open()`. e.g. opening a window with `window.open('foo')` will yield something like `https://the-origin/the/current/path/foo`.
|
||||
* `frameName` string - Name of the window provided in `window.open()`
|
||||
@@ -1301,11 +1301,8 @@ Ignore application menu shortcuts while this web contents is focused.
|
||||
be set. If no post data is to be sent, the value will be `null`. Only defined
|
||||
when the window is being created by a form that set `target=_blank`.
|
||||
|
||||
Returns `{action: 'deny'} | {action: 'allow', outlivesOpener?: boolean, overrideBrowserWindowOptions?: BrowserWindowConstructorOptions}` - `deny` cancels the creation of the new
|
||||
window. `allow` will allow the new window to be created. Specifying `overrideBrowserWindowOptions` allows customization of the created window.
|
||||
By default, child windows are closed when their opener is closed. This can be
|
||||
changed by specifying `outlivesOpener: true`, in which case the opened window
|
||||
will not be closed when its opener is closed.
|
||||
Returns `WindowOpenHandlerResponse` - When set to `{ action: 'deny' }` cancels the creation of the new
|
||||
window. `{ action: 'allow' }` will allow the new window to be created.
|
||||
Returning an unrecognized value such as a null, undefined, or an object
|
||||
without a recognized 'action' value will result in a console error and have
|
||||
the same effect as returning `{action: 'deny'}`.
|
||||
@@ -1316,6 +1313,26 @@ submitting a form with `<form target="_blank">`. See
|
||||
[`window.open()`](window-open.md) for more details and how to use this in
|
||||
conjunction with `did-create-window`.
|
||||
|
||||
An example showing how to customize the process of new `BrowserWindow` creation to be `BrowserView` attached to main window instead:
|
||||
|
||||
```js
|
||||
const { BrowserView, BrowserWindow } = require('electron')
|
||||
|
||||
const mainWindow = new BrowserWindow()
|
||||
|
||||
mainWindow.webContents.setWindowOpenHandler((details) => {
|
||||
return {
|
||||
action: 'allow',
|
||||
createWindow: (options) => {
|
||||
const browserView = new BrowserView(options)
|
||||
mainWindow.addBrowserView(browserView)
|
||||
browserView.setBounds({ x: 0, y: 0, width: 640, height: 480 })
|
||||
return browserView.webContents
|
||||
}
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
#### `contents.setAudioMuted(muted)`
|
||||
|
||||
* `muted` boolean
|
||||
|
||||
@@ -12,6 +12,25 @@ This document uses the following convention to categorize breaking changes:
|
||||
* **Deprecated:** An API was marked as deprecated. The API will continue to function, but will emit a deprecation warning, and will be removed in a future release.
|
||||
* **Removed:** An API or feature was removed, and is no longer supported by Electron.
|
||||
|
||||
## Planned Breaking API Changes (31.0)
|
||||
|
||||
### Removed: `WebSQL` support
|
||||
|
||||
Chromium has removed support for WebSQL upstream, transitioning it to Android only. See
|
||||
[Chromium's intent to remove discussion](https://groups.google.com/a/chromium.org/g/blink-dev/c/fWYb6evVA-w/m/wGI863zaAAAJ)
|
||||
for more information.
|
||||
|
||||
### Behavior Changed: `nativeImage.toDataURL` will preseve PNG colorspace
|
||||
|
||||
PNG decoder implementation has been changed to preserve colorspace data, the
|
||||
encoded data returned from this function now matches it.
|
||||
|
||||
See [crbug.com/332584706](https://issues.chromium.org/issues/332584706) for more information.
|
||||
|
||||
### Behavior Changed: `window.flashFrame(bool)` will flash dock icon continuously on macOS
|
||||
|
||||
This brings the behavior to parity with Windows and Linux. Prior behavior: The first `flashFrame(true)` bounces the dock icon only once (using the [NSInformationalRequest](https://developer.apple.com/documentation/appkit/nsrequestuserattentiontype/nsinformationalrequest) level) and `flashFrame(false)` does nothing. New behavior: Flash continuously until `flashFrame(false)` is called. This uses the [NSCriticalRequest](https://developer.apple.com/documentation/appkit/nsrequestuserattentiontype/nscriticalrequest) level instead. To explicitly use `NSInformationalRequest` to cause a single dock icon bounce, it is still possible to use [`dock.bounce('informational')`](https://www.electronjs.org/docs/latest/api/dock#dockbouncetype-macos).
|
||||
|
||||
## Planned Breaking API Changes (30.0)
|
||||
|
||||
### Behavior Changed: cross-origin iframes now use Permission Policy to access features
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 4.2 MiB After Width: | Height: | Size: 2.3 MiB |
@@ -125,7 +125,7 @@ in the form included below:
|
||||
]
|
||||
```
|
||||
|
||||
::: info
|
||||
:::info
|
||||
|
||||
For an implementation example, see [`src/resedit.ts`](https://github.com/electron/packager/blob/main/src/resedit.ts)
|
||||
in the Electron Packager code.
|
||||
|
||||
@@ -9,10 +9,11 @@ check out our [Electron Versioning](./electron-versioning.md) doc.
|
||||
|
||||
| Electron | Alpha | Beta | Stable | EOL | Chrome | Node | Supported |
|
||||
| ------- | ----- | ------- | ------ | ------ | ---- | ---- | ---- |
|
||||
| 31.0.0 | 2024-Apr-18 | 2024-May-15 | 2024-Jun-11 | 2025-Jan-07 | M126 | TBD | ✅ |
|
||||
| 32.0.0 | 2024-Jun-14 | 2024-Jul-24 | 2024-Aug-20 | 2025-Mar-04 | M128 | TBD | ✅ |
|
||||
| 31.0.0 | 2024-Apr-18 | 2024-May-15 | 2024-Jun-11 | 2025-Jan-07 | M126 | v20.14 | ✅ |
|
||||
| 30.0.0 | 2024-Feb-22 | 2024-Mar-20 | 2024-Apr-16 | 2024-Oct-15 | M124 | v20.11 | ✅ |
|
||||
| 29.0.0 | 2023-Dec-07 | 2024-Jan-24 | 2024-Feb-20 | 2024-Aug-20 | M122 | v20.9 | ✅ |
|
||||
| 28.0.0 | 2023-Oct-11 | 2023-Nov-06 | 2023-Dec-05 | 2024-Jun-11 | M120 | v18.18 | ✅ |
|
||||
| 28.0.0 | 2023-Oct-11 | 2023-Nov-06 | 2023-Dec-05 | 2024-Jun-11 | M120 | v18.18 | 🚫 |
|
||||
| 27.0.0 | 2023-Aug-17 | 2023-Sep-13 | 2023-Oct-10 | 2024-Apr-16 | M118 | v18.17 | 🚫 |
|
||||
| 26.0.0 | 2023-Jun-01 | 2023-Jun-27 | 2023-Aug-15 | 2024-Feb-20 | M116 | v18.16 | 🚫 |
|
||||
| 25.0.0 | 2023-Apr-10 | 2023-May-02 | 2023-May-30 | 2023-Dec-05 | M114 | v18.15 | 🚫 |
|
||||
@@ -97,12 +98,19 @@ is as follows:
|
||||
|
||||
<img src="https://raw.githubusercontent.com/nodejs/Release/main/schedule.svg?sanitize=true" alt="Releases">
|
||||
|
||||
As a rule, stable branches of Electron do not receive Node.js upgrades after they have been cut.
|
||||
If Electron has recently updated its `main` branch to a new major version of Node.js, the next stable
|
||||
branch to be cut will be released with the new version.
|
||||
|
||||
Stable release lines of Electron will receive minor and patch bumps of Node.js after they are released.
|
||||
Patch bumps to Node.js will be released in patch releases of Electron, and minor bumps to Node.js will result in a minor release of Electron.
|
||||
Security-only release branches will receive security-related changes from Node.js releases, but not the full release.
|
||||
Patch upgrades of Node that contain significant security or bug fixes, and are submitted
|
||||
more than 2 weeks prior to a stable release date, will be accepted into an Electron alpha
|
||||
or beta release branch.
|
||||
|
||||
Minor upgrades of Node that contain significant security or bug fixes, and are submitted
|
||||
more than 2 weeks prior to a stable release date may be accepted into an Electron alpha or
|
||||
beta release branch on a case-by-case basis. These requests will be reviewed and voted on
|
||||
by the [Releases Working Group](https://github.com/electron/governance/tree/main/wg-releases),
|
||||
to ensure minimal disruption for developers who may be consuming alpha or beta releases.
|
||||
|
||||
### Breaking API changes
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ need to be called **before** the app's `ready` event is emitted.
|
||||
With top-level `await` available in Node.js ESM, make sure to `await` every Promise that you need to
|
||||
execute before the `ready` event. Otherwise, your app may be `ready` before your code executes.
|
||||
|
||||
This is particularly important to keep in mind for dynamic ESM import statmements (static imports are unaffected).
|
||||
This is particularly important to keep in mind for dynamic ESM import statements (static imports are unaffected).
|
||||
For example, if `index.mjs` calls `import('./set-up-paths.mjs')` at the top level, the app will
|
||||
likely already be `ready` by the time that dynamic import resolves.
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ You also have to register an Apple Developer account and join the
|
||||
|
||||
Electron apps can be distributed through Mac App Store or outside it. Each way
|
||||
requires different ways of signing and testing. This guide focuses on
|
||||
distribution via Mac App Store, but will also mention other methods.
|
||||
distribution via Mac App Store.
|
||||
|
||||
The following steps describe how to get the certificates from Apple, how to sign
|
||||
Electron apps, and how to test them.
|
||||
@@ -104,26 +104,15 @@ the App Sandbox. The standard darwin build of Electron will fail to launch
|
||||
when run under App Sandbox.
|
||||
|
||||
When signing the app with `@electron/osx-sign`, it will automatically add the
|
||||
necessary entitlements to your app's entitlements, but if you are using custom
|
||||
entitlements, you must ensure App Sandbox capacity is added:
|
||||
necessary entitlements to your app's entitlements.
|
||||
|
||||
```xml
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>com.apple.security.app-sandbox</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
```
|
||||
|
||||
#### Extra steps without `electron-osx-sign`
|
||||
<details>
|
||||
<summary>Extra steps without `electron-osx-sign`</summary>
|
||||
|
||||
If you are signing your app without using `@electron/osx-sign`, you must ensure
|
||||
the app bundle's entitlements have at least following keys:
|
||||
|
||||
```xml
|
||||
```xml title='entitlements.plist'
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
@@ -174,6 +163,7 @@ When using `@electron/osx-sign` the `ElectronTeamID` key will be added
|
||||
automatically by extracting the Team ID from the certificate's name. You may
|
||||
need to manually add this key if `@electron/osx-sign` could not find the correct
|
||||
Team ID.
|
||||
</details>
|
||||
|
||||
### Sign apps for development
|
||||
|
||||
@@ -181,8 +171,14 @@ To sign an app that can run on your development machine, you must sign it with
|
||||
the "Apple Development" certificate and pass the provisioning profile to
|
||||
`@electron/osx-sign`.
|
||||
|
||||
```bash
|
||||
electron-osx-sign YourApp.app --identity='Apple Development' --provisioning-profile=/path/to/yourapp.provisionprofile
|
||||
```js @ts-nocheck
|
||||
const { signAsync } = require('@electron/osx-sign')
|
||||
|
||||
signAsync({
|
||||
app: '/path/to/your.app',
|
||||
identity: 'Apple Development',
|
||||
provisioningProfile: '/path/to/your.provisionprofile'
|
||||
})
|
||||
```
|
||||
|
||||
If you are signing without `@electron/osx-sign`, you must place the provisioning
|
||||
@@ -198,30 +194,16 @@ To sign an app that will be submitted to Mac App Store, you must sign it with
|
||||
the "Apple Distribution" certificate. Note that apps signed with this
|
||||
certificate will not run anywhere, unless it is downloaded from Mac App Store.
|
||||
|
||||
```bash
|
||||
electron-osx-sign YourApp.app --identity='Apple Distribution'
|
||||
```js @ts-nocheck
|
||||
const { signAsync } = require('@electron/osx-sign')
|
||||
|
||||
signAsync({
|
||||
app: 'path/to/your.app',
|
||||
identity: 'Apple Distribution'
|
||||
})
|
||||
```
|
||||
|
||||
### Sign apps for distribution outside the Mac App Store
|
||||
|
||||
If you don't plan to submit the app to Mac App Store, you can sign it the
|
||||
"Developer ID Application" certificate. In this way there is no requirement on
|
||||
App Sandbox, and you should use the normal darwin build of Electron if you don't
|
||||
use App Sandbox.
|
||||
|
||||
```bash
|
||||
electron-osx-sign YourApp.app --identity='Developer ID Application' --no-gatekeeper-assess
|
||||
```
|
||||
|
||||
By passing `--no-gatekeeper-assess`, `@electron/osx-sign` will skip the macOS
|
||||
GateKeeper check as your app usually has not been notarized yet by this step.
|
||||
|
||||
<!-- TODO(zcbenz): Add a chapter about App Notarization -->
|
||||
This guide does not cover [App Notarization][app-notarization], but you might
|
||||
want to do it otherwise Apple may prevent users from using your app outside Mac
|
||||
App Store.
|
||||
|
||||
## Submit Apps to the Mac App Store
|
||||
## Submit apps to the Mac App Store
|
||||
|
||||
After signing the app with the "Apple Distribution" certificate, you can
|
||||
continue to submit it to Mac App Store.
|
||||
@@ -263,10 +245,43 @@ more information.
|
||||
|
||||
### Additional entitlements
|
||||
|
||||
Every app running under the App Sandbox will run under a limited set of permissions,
|
||||
which limits potential damage from malicious code.
|
||||
Depending on which Electron APIs your app uses, you may need to add additional
|
||||
entitlements to your app's entitlements file. Otherwise, the App Sandbox may
|
||||
prevent you from using them.
|
||||
|
||||
Entitlements are specified using a file with format like
|
||||
property list (`.plist`) or XML. You must provide an entitlement file for the
|
||||
application bundle itself and a child entitlement file which basically describes
|
||||
an inheritance of properties, specified for all other enclosing executable files
|
||||
like binaries, frameworks (`.framework`), and dynamically linked libraries (`.dylib`).
|
||||
|
||||
A full list of entitlements is available in the [App Sandbox][app-sandboxing]
|
||||
documentation, but below are a few entitlements you might need for your
|
||||
MAS app.
|
||||
|
||||
With `@electron/osx-sign`, you can set custom entitlements per file as such:
|
||||
|
||||
```js @ts-nocheck
|
||||
const { signAsync } = require('@electron/osx-sign')
|
||||
|
||||
function getEntitlementsForFile (filePath) {
|
||||
if (filePath.startsWith('my-path-1')) {
|
||||
return './my-path-1.plist'
|
||||
} else {
|
||||
return './alternate.plist'
|
||||
}
|
||||
}
|
||||
|
||||
signAsync({
|
||||
optionsForFile: (filePath) => ({
|
||||
// Ensure you return the right entitlements path here based on the file being signed.
|
||||
entitlements: getEntitlementsForFile(filePath)
|
||||
})
|
||||
})
|
||||
```
|
||||
|
||||
#### Network access
|
||||
|
||||
Enable outgoing network connections to allow your app to connect to a server:
|
||||
@@ -342,12 +357,11 @@ Electron uses following cryptographic algorithms:
|
||||
|
||||
[developer-program]: https://developer.apple.com/support/compare-memberships/
|
||||
[@electron/osx-sign]: https://github.com/electron/osx-sign
|
||||
[app-sandboxing]: https://developer.apple.com/app-sandboxing/
|
||||
[app-notarization]: https://developer.apple.com/documentation/security/notarizing_macos_software_before_distribution
|
||||
[submitting-your-app]: https://developer.apple.com/library/mac/documentation/IDEs/Conceptual/AppDistributionGuide/SubmittingYourApp/SubmittingYourApp.html
|
||||
[create-record]: https://help.apple.com/app-store-connect/#/dev2cd126805
|
||||
[app-sandboxing]: https://developer.apple.com/documentation/security/app_sandbox
|
||||
[submitting-your-app]: https://help.apple.com/xcode/mac/current/#/dev067853c94
|
||||
[create-record]: https://developer.apple.com/help/app-store-connect/create-an-app-record/add-a-new-app
|
||||
[apple-transporter]: https://help.apple.com/itc/transporteruserguide/en.lproj/static.html
|
||||
[submit-for-review]: https://developer.apple.com/library/ios/documentation/LanguagesUtilities/Conceptual/iTunesConnect_Guide/Chapters/SubmittingTheApp.html
|
||||
[submit-for-review]: https://developer.apple.com/help/app-store-connect/manage-submissions-to-app-review/submit-for-review
|
||||
[export-compliance]: https://help.apple.com/app-store-connect/#/devc3f64248f
|
||||
[user-selected]: https://developer.apple.com/library/mac/documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/EnablingAppSandbox.html#//apple_ref/doc/uid/TP40011195-CH4-SW6
|
||||
[network-access]: https://developer.apple.com/library/ios/documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/EnablingAppSandbox.html#//apple_ref/doc/uid/TP40011195-CH4-SW9
|
||||
|
||||
@@ -161,7 +161,7 @@ Notifications are sent using `libnotify`, which can show notifications on any
|
||||
desktop environment that follows [Desktop Notifications Specification][notification-spec],
|
||||
including Cinnamon, Enlightenment, Unity, GNOME, and KDE.
|
||||
|
||||
[notification-spec]: https://developer-old.gnome.org/notification-spec/
|
||||
[notification-spec]: https://specifications.freedesktop.org/notification-spec/notification-spec-latest.html
|
||||
[app-user-model-id]: https://learn.microsoft.com/en-us/windows/win32/shell/appids
|
||||
[set-app-user-model-id]: ../api/app.md#appsetappusermodelidid-windows
|
||||
[squirrel-events]: https://github.com/electron/windows-installer/blob/main/README.md#handling-squirrel-events
|
||||
|
||||
@@ -246,7 +246,7 @@ and prevent the use of Node primitives `contextIsolation` **must** also be used.
|
||||
:::info
|
||||
For more information on what `contextIsolation` is and how to enable it please
|
||||
see our dedicated [Context Isolation](context-isolation.md) document.
|
||||
:::info
|
||||
:::
|
||||
|
||||
### 4. Enable process sandboxing
|
||||
|
||||
@@ -259,7 +259,7 @@ content in an unsandboxed process, including the main process, is not advised.
|
||||
:::info
|
||||
For more information on what Process Sandboxing is and how to enable it please
|
||||
see our dedicated [Process Sandboxing](sandbox.md) document.
|
||||
:::info
|
||||
:::
|
||||
|
||||
### 5. Handle session permission requests from remote content
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ at [https://update.electronjs.org](https://update.electronjs.org). Its requireme
|
||||
- Your app runs on macOS or Windows
|
||||
- Your app has a public GitHub repository
|
||||
- Builds are published to [GitHub releases][]
|
||||
- Builds are [code signed][code-signed]
|
||||
- Builds are [code signed][code-signed] **(macOS only)**
|
||||
|
||||
At this point, we'll assume that you have already pushed all your
|
||||
code to a public GitHub repository.
|
||||
|
||||
@@ -10,6 +10,114 @@ The easiest and officially supported one is taking advantage of the built-in
|
||||
[Squirrel](https://github.com/Squirrel) framework and
|
||||
Electron's [autoUpdater](../api/auto-updater.md) module.
|
||||
|
||||
## Using cloud object storage (serverless)
|
||||
|
||||
For a simple serverless update flow, Electron's autoUpdater module can
|
||||
check if updates are available by pointing to a static storage URL
|
||||
containing latest release metadata.
|
||||
|
||||
When a new release is available, this metadata needs to be published to
|
||||
cloud storage alongside the release itself. The metadata format is
|
||||
different for macOS and Windows.
|
||||
|
||||
### Publishing release metadata
|
||||
|
||||
With Electron Forge, you can set up static file storage updates by publishing
|
||||
metadata artifacts from the ZIP Maker (macOS) with `macUpdateManifestBaseUrl`
|
||||
and the Squirrel.Windows Maker (Windows) with `remoteReleases`.
|
||||
|
||||
See Forge's [Auto updating from S3](https://www.electronforge.io/config/publishers/s3#auto-updating-from-s3)
|
||||
guide for an end-to-end example.
|
||||
|
||||
<details>
|
||||
<summary>Manual publishing</summary>
|
||||
|
||||
On macOS, Squirrel.Mac can receive updates by reading a `releases.json` file with the
|
||||
following JSON format:
|
||||
|
||||
```json title='releases.json'
|
||||
{
|
||||
"currentRelease": "1.2.3",
|
||||
"releases": [
|
||||
{
|
||||
"version": "1.2.1",
|
||||
"updateTo": {
|
||||
"version": "1.2.1",
|
||||
"pub_date": "2023-09-18T12:29:53+01:00",
|
||||
"notes": "Theses are some release notes innit",
|
||||
"name": "1.2.1",
|
||||
"url": "https://mycompany.example.com/myapp/releases/myrelease"
|
||||
}
|
||||
},
|
||||
{
|
||||
"version": "1.2.3",
|
||||
"updateTo": {
|
||||
"version": "1.2.3",
|
||||
"pub_date": "2024-09-18T12:29:53+01:00",
|
||||
"notes": "Theses are some more release notes innit",
|
||||
"name": "1.2.3",
|
||||
"url": "https://mycompany.example.com/myapp/releases/myrelease3"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
On Windows, Squirrel.Windows can receive updates by reading from the RELEASES
|
||||
file generated during the build process. This file details the `.nupkg` delta
|
||||
package to update to.
|
||||
|
||||
```plaintext title='RELEASES'
|
||||
B0892F3C7AC91D72A6271FF36905FEF8FE993520 electron-fiddle-0.36.3-full.nupkg 103298365
|
||||
```
|
||||
|
||||
These files should live in the same directory as your release, under a folder
|
||||
structure that is aware of your app's platform and architecture.
|
||||
|
||||
For example:
|
||||
|
||||
```plaintext
|
||||
my-app-updates/
|
||||
├─ darwin/
|
||||
│ ├─ x64/
|
||||
│ │ ├─ my-app-1.0.0-darwin-x64.zip
|
||||
│ │ ├─ my-app-1.1.0-darwin-x64.zip
|
||||
│ │ ├─ RELEASES.json
|
||||
│ ├─ arm64/
|
||||
│ │ ├─ my-app-1.0.0-darwin-arm64.zip
|
||||
│ │ ├─ my-app-1.1.0-darwin-arm64.zip
|
||||
│ │ ├─ RELEASES.json
|
||||
├─ win32/
|
||||
│ ├─ x64/
|
||||
│ │ ├─ my-app-1.0.0-win32-x64.exe
|
||||
│ │ ├─ my-app-1.0.0-win32-x64.nupkg
|
||||
│ │ ├─ my-app-1.1.0-win32-x64.exe
|
||||
│ │ ├─ my-app-1.1.0-win32-x64.nupkg
|
||||
│ │ ├─ RELEASES
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
### Reading release metadata
|
||||
|
||||
The easiest way to consume metadata is by installing [update-electron-app][],
|
||||
a drop-in Node.js module that sets up autoUpdater and prompts the user with
|
||||
a native dialog.
|
||||
|
||||
For static storage updates, point the `updateSource.baseUrl` parameter to
|
||||
the directory containing your release metadata files.
|
||||
|
||||
```js title="main.js" @ts-nocheck
|
||||
const { updateElectronApp, UpdateSourceType } = require('update-electron-app')
|
||||
|
||||
updateElectronApp({
|
||||
updateSource: {
|
||||
type: UpdateSourceType.StaticStorage,
|
||||
baseUrl: `https://my-bucket.s3.amazonaws.com/my-app-updates/${process.platform}/${process.arch}`
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
## Using update.electronjs.org
|
||||
|
||||
The Electron team maintains [update.electronjs.org][], a free and open-source
|
||||
@@ -19,7 +127,7 @@ for Electron apps that meet the following criteria:
|
||||
- App runs on macOS or Windows
|
||||
- App has a public GitHub repository
|
||||
- Builds are published to [GitHub Releases][gh-releases]
|
||||
- Builds are [code-signed](./code-signing.md)
|
||||
- Builds are [code-signed](./code-signing.md) **(macOS only)**
|
||||
|
||||
The easiest way to use this service is by installing [update-electron-app][],
|
||||
a Node.js module preconfigured for use with update.electronjs.org.
|
||||
@@ -151,6 +259,10 @@ server-communication aspect of the process by loading your update from a local d
|
||||
|
||||
:::
|
||||
|
||||
## Update server specification
|
||||
|
||||
A Squirrel-compatible update server has different
|
||||
|
||||
[vercel]: https://vercel.com
|
||||
[hazel]: https://github.com/vercel/hazel
|
||||
[nuts]: https://github.com/GitbookIO/nuts
|
||||
|
||||
@@ -23,8 +23,8 @@ and only allow the capabilities you want to support.
|
||||
[we do not recommend you to use WebViews](../api/webview-tag.md#warning),
|
||||
as this tag undergoes dramatic architectural changes that may affect stability
|
||||
of your application. Consider switching to alternatives, like `iframe` and
|
||||
Electron's `BrowserView`, or an architecture that avoids embedded content
|
||||
by design.
|
||||
Electron's [`WebContentsView`](../api/web-contents-view.md), or an architecture
|
||||
that avoids embedded content by design.
|
||||
|
||||
[WebViews](../api/webview-tag.md) are based on Chromium's WebViews and are not
|
||||
explicitly supported by Electron. We do not guarantee that the WebView API will
|
||||
|
||||
@@ -149,6 +149,7 @@ auto_filenames = {
|
||||
"docs/api/structures/web-preferences.md",
|
||||
"docs/api/structures/web-request-filter.md",
|
||||
"docs/api/structures/web-source.md",
|
||||
"docs/api/structures/window-open-handler-response.md",
|
||||
]
|
||||
|
||||
sandbox_bundle_deps = [
|
||||
|
||||
@@ -159,12 +159,8 @@ filenames = {
|
||||
"shell/browser/osr/osr_web_contents_view_mac.mm",
|
||||
"shell/browser/relauncher_mac.cc",
|
||||
"shell/browser/ui/certificate_trust_mac.mm",
|
||||
"shell/browser/ui/cocoa/delayed_native_view_host.h",
|
||||
"shell/browser/ui/cocoa/delayed_native_view_host.mm",
|
||||
"shell/browser/ui/cocoa/electron_bundle_mover.h",
|
||||
"shell/browser/ui/cocoa/electron_bundle_mover.mm",
|
||||
"shell/browser/ui/cocoa/electron_inspectable_web_contents_view.h",
|
||||
"shell/browser/ui/cocoa/electron_inspectable_web_contents_view.mm",
|
||||
"shell/browser/ui/cocoa/electron_menu_controller.h",
|
||||
"shell/browser/ui/cocoa/electron_menu_controller.mm",
|
||||
"shell/browser/ui/cocoa/electron_native_widget_mac.h",
|
||||
@@ -191,8 +187,6 @@ filenames = {
|
||||
"shell/browser/ui/cocoa/window_buttons_proxy.mm",
|
||||
"shell/browser/ui/drag_util_mac.mm",
|
||||
"shell/browser/ui/file_dialog_mac.mm",
|
||||
"shell/browser/ui/inspectable_web_contents_view_mac.h",
|
||||
"shell/browser/ui/inspectable_web_contents_view_mac.mm",
|
||||
"shell/browser/ui/message_box_mac.mm",
|
||||
"shell/browser/ui/tray_icon_cocoa.h",
|
||||
"shell/browser/ui/tray_icon_cocoa.mm",
|
||||
@@ -208,6 +202,7 @@ filenames = {
|
||||
"shell/common/node_bindings_mac.cc",
|
||||
"shell/common/node_bindings_mac.h",
|
||||
"shell/common/platform_util_mac.mm",
|
||||
"shell/browser/ui/views/inspectable_web_contents_view_mac.mm",
|
||||
]
|
||||
|
||||
lib_sources_views = [
|
||||
@@ -222,8 +217,6 @@ filenames = {
|
||||
"shell/browser/ui/views/electron_views_delegate.h",
|
||||
"shell/browser/ui/views/frameless_view.cc",
|
||||
"shell/browser/ui/views/frameless_view.h",
|
||||
"shell/browser/ui/views/inspectable_web_contents_view_views.cc",
|
||||
"shell/browser/ui/views/inspectable_web_contents_view_views.h",
|
||||
"shell/browser/ui/views/menu_bar.cc",
|
||||
"shell/browser/ui/views/menu_bar.h",
|
||||
"shell/browser/ui/views/menu_delegate.cc",
|
||||
@@ -547,6 +540,7 @@ filenames = {
|
||||
"shell/common/api/electron_api_clipboard.h",
|
||||
"shell/common/api/electron_api_command_line.cc",
|
||||
"shell/common/api/electron_api_environment.cc",
|
||||
"shell/common/api/electron_api_key_weak_map.h",
|
||||
"shell/common/api/electron_api_native_image.cc",
|
||||
"shell/common/api/electron_api_native_image.h",
|
||||
"shell/common/api/electron_api_net.cc",
|
||||
@@ -558,6 +552,8 @@ filenames = {
|
||||
"shell/common/api/electron_bindings.cc",
|
||||
"shell/common/api/electron_bindings.h",
|
||||
"shell/common/api/features.cc",
|
||||
"shell/common/api/object_life_monitor.cc",
|
||||
"shell/common/api/object_life_monitor.h",
|
||||
"shell/common/application_info.cc",
|
||||
"shell/common/application_info.h",
|
||||
"shell/common/asar/archive.cc",
|
||||
@@ -765,8 +761,6 @@ filenames = {
|
||||
"shell/common/extensions/electron_extensions_client.h",
|
||||
"shell/common/gin_converters/extension_converter.cc",
|
||||
"shell/common/gin_converters/extension_converter.h",
|
||||
"shell/renderer/extensions/electron_extensions_dispatcher_delegate.cc",
|
||||
"shell/renderer/extensions/electron_extensions_dispatcher_delegate.h",
|
||||
"shell/renderer/extensions/electron_extensions_renderer_api_provider.cc",
|
||||
"shell/renderer/extensions/electron_extensions_renderer_api_provider.h",
|
||||
"shell/renderer/extensions/electron_extensions_renderer_client.cc",
|
||||
|
||||
@@ -218,6 +218,7 @@ libcxx_headers = [
|
||||
"//third_party/libc++/src/include/__algorithm/shift_right.h",
|
||||
"//third_party/libc++/src/include/__algorithm/shuffle.h",
|
||||
"//third_party/libc++/src/include/__algorithm/sift_down.h",
|
||||
"//third_party/libc++/src/include/__algorithm/simd_utils.h",
|
||||
"//third_party/libc++/src/include/__algorithm/sort.h",
|
||||
"//third_party/libc++/src/include/__algorithm/sort_heap.h",
|
||||
"//third_party/libc++/src/include/__algorithm/stable_partition.h",
|
||||
@@ -382,7 +383,6 @@ libcxx_headers = [
|
||||
"//third_party/libc++/src/include/__format/format_context.h",
|
||||
"//third_party/libc++/src/include/__format/format_error.h",
|
||||
"//third_party/libc++/src/include/__format/format_functions.h",
|
||||
"//third_party/libc++/src/include/__format/format_fwd.h",
|
||||
"//third_party/libc++/src/include/__format/format_parse_context.h",
|
||||
"//third_party/libc++/src/include/__format/format_string.h",
|
||||
"//third_party/libc++/src/include/__format/format_to_n_result.h",
|
||||
@@ -432,21 +432,27 @@ libcxx_headers = [
|
||||
"//third_party/libc++/src/include/__fwd/array.h",
|
||||
"//third_party/libc++/src/include/__fwd/bit_reference.h",
|
||||
"//third_party/libc++/src/include/__fwd/complex.h",
|
||||
"//third_party/libc++/src/include/__fwd/deque.h",
|
||||
"//third_party/libc++/src/include/__fwd/format.h",
|
||||
"//third_party/libc++/src/include/__fwd/fstream.h",
|
||||
"//third_party/libc++/src/include/__fwd/functional.h",
|
||||
"//third_party/libc++/src/include/__fwd/ios.h",
|
||||
"//third_party/libc++/src/include/__fwd/istream.h",
|
||||
"//third_party/libc++/src/include/__fwd/mdspan.h",
|
||||
"//third_party/libc++/src/include/__fwd/memory.h",
|
||||
"//third_party/libc++/src/include/__fwd/memory_resource.h",
|
||||
"//third_party/libc++/src/include/__fwd/ostream.h",
|
||||
"//third_party/libc++/src/include/__fwd/pair.h",
|
||||
"//third_party/libc++/src/include/__fwd/queue.h",
|
||||
"//third_party/libc++/src/include/__fwd/span.h",
|
||||
"//third_party/libc++/src/include/__fwd/sstream.h",
|
||||
"//third_party/libc++/src/include/__fwd/stack.h",
|
||||
"//third_party/libc++/src/include/__fwd/streambuf.h",
|
||||
"//third_party/libc++/src/include/__fwd/string.h",
|
||||
"//third_party/libc++/src/include/__fwd/string_view.h",
|
||||
"//third_party/libc++/src/include/__fwd/subrange.h",
|
||||
"//third_party/libc++/src/include/__fwd/tuple.h",
|
||||
"//third_party/libc++/src/include/__fwd/vector.h",
|
||||
"//third_party/libc++/src/include/__hash_table",
|
||||
"//third_party/libc++/src/include/__ios/fpos.h",
|
||||
"//third_party/libc++/src/include/__iterator/access.h",
|
||||
@@ -703,6 +709,7 @@ libcxx_headers = [
|
||||
"//third_party/libc++/src/include/__thread/thread.h",
|
||||
"//third_party/libc++/src/include/__thread/timed_backoff_policy.h",
|
||||
"//third_party/libc++/src/include/__tree",
|
||||
"//third_party/libc++/src/include/__tuple/find_index.h",
|
||||
"//third_party/libc++/src/include/__tuple/make_tuple_types.h",
|
||||
"//third_party/libc++/src/include/__tuple/pair_like.h",
|
||||
"//third_party/libc++/src/include/__tuple/sfinae_helpers.h",
|
||||
@@ -756,10 +763,7 @@ libcxx_headers = [
|
||||
"//third_party/libc++/src/include/__type_traits/is_constant_evaluated.h",
|
||||
"//third_party/libc++/src/include/__type_traits/is_constructible.h",
|
||||
"//third_party/libc++/src/include/__type_traits/is_convertible.h",
|
||||
"//third_party/libc++/src/include/__type_traits/is_copy_assignable.h",
|
||||
"//third_party/libc++/src/include/__type_traits/is_copy_constructible.h",
|
||||
"//third_party/libc++/src/include/__type_traits/is_core_convertible.h",
|
||||
"//third_party/libc++/src/include/__type_traits/is_default_constructible.h",
|
||||
"//third_party/libc++/src/include/__type_traits/is_destructible.h",
|
||||
"//third_party/libc++/src/include/__type_traits/is_empty.h",
|
||||
"//third_party/libc++/src/include/__type_traits/is_enum.h",
|
||||
@@ -775,17 +779,10 @@ libcxx_headers = [
|
||||
"//third_party/libc++/src/include/__type_traits/is_member_function_pointer.h",
|
||||
"//third_party/libc++/src/include/__type_traits/is_member_object_pointer.h",
|
||||
"//third_party/libc++/src/include/__type_traits/is_member_pointer.h",
|
||||
"//third_party/libc++/src/include/__type_traits/is_move_assignable.h",
|
||||
"//third_party/libc++/src/include/__type_traits/is_move_constructible.h",
|
||||
"//third_party/libc++/src/include/__type_traits/is_nothrow_assignable.h",
|
||||
"//third_party/libc++/src/include/__type_traits/is_nothrow_constructible.h",
|
||||
"//third_party/libc++/src/include/__type_traits/is_nothrow_convertible.h",
|
||||
"//third_party/libc++/src/include/__type_traits/is_nothrow_copy_assignable.h",
|
||||
"//third_party/libc++/src/include/__type_traits/is_nothrow_copy_constructible.h",
|
||||
"//third_party/libc++/src/include/__type_traits/is_nothrow_default_constructible.h",
|
||||
"//third_party/libc++/src/include/__type_traits/is_nothrow_destructible.h",
|
||||
"//third_party/libc++/src/include/__type_traits/is_nothrow_move_assignable.h",
|
||||
"//third_party/libc++/src/include/__type_traits/is_nothrow_move_constructible.h",
|
||||
"//third_party/libc++/src/include/__type_traits/is_null_pointer.h",
|
||||
"//third_party/libc++/src/include/__type_traits/is_object.h",
|
||||
"//third_party/libc++/src/include/__type_traits/is_pod.h",
|
||||
@@ -806,14 +803,9 @@ libcxx_headers = [
|
||||
"//third_party/libc++/src/include/__type_traits/is_trivial.h",
|
||||
"//third_party/libc++/src/include/__type_traits/is_trivially_assignable.h",
|
||||
"//third_party/libc++/src/include/__type_traits/is_trivially_constructible.h",
|
||||
"//third_party/libc++/src/include/__type_traits/is_trivially_copy_assignable.h",
|
||||
"//third_party/libc++/src/include/__type_traits/is_trivially_copy_constructible.h",
|
||||
"//third_party/libc++/src/include/__type_traits/is_trivially_copyable.h",
|
||||
"//third_party/libc++/src/include/__type_traits/is_trivially_default_constructible.h",
|
||||
"//third_party/libc++/src/include/__type_traits/is_trivially_destructible.h",
|
||||
"//third_party/libc++/src/include/__type_traits/is_trivially_lexicographically_comparable.h",
|
||||
"//third_party/libc++/src/include/__type_traits/is_trivially_move_assignable.h",
|
||||
"//third_party/libc++/src/include/__type_traits/is_trivially_move_constructible.h",
|
||||
"//third_party/libc++/src/include/__type_traits/is_trivially_relocatable.h",
|
||||
"//third_party/libc++/src/include/__type_traits/is_unbounded_array.h",
|
||||
"//third_party/libc++/src/include/__type_traits/is_union.h",
|
||||
@@ -970,7 +962,7 @@ libcxx_headers = [
|
||||
"//third_party/libc++/src/include/mdspan",
|
||||
"//third_party/libc++/src/include/memory",
|
||||
"//third_party/libc++/src/include/memory_resource",
|
||||
"//third_party/libc++/src/include/module.modulemap.in",
|
||||
"//third_party/libc++/src/include/module.modulemap",
|
||||
"//third_party/libc++/src/include/mutex",
|
||||
"//third_party/libc++/src/include/new",
|
||||
"//third_party/libc++/src/include/numbers",
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import { EventEmitter } from 'events';
|
||||
import type { BaseWindow as TLWT } from 'electron/main';
|
||||
import { TouchBar } from 'electron/main';
|
||||
|
||||
const { BaseWindow } = process._linkedBinding('electron_browser_base_window') as { BaseWindow: typeof TLWT };
|
||||
|
||||
Object.setPrototypeOf(BaseWindow.prototype, EventEmitter.prototype);
|
||||
@@ -17,10 +15,6 @@ BaseWindow.prototype._init = function (this: TLWT) {
|
||||
}
|
||||
};
|
||||
|
||||
BaseWindow.prototype.setTouchBar = function (touchBar) {
|
||||
(TouchBar as any)._setOnWindow(touchBar, this);
|
||||
};
|
||||
|
||||
// Properties
|
||||
|
||||
Object.defineProperty(BaseWindow.prototype, 'autoHideMenuBar', {
|
||||
|
||||
@@ -4,6 +4,9 @@ const v8Util = process._linkedBinding('electron_common_v8_util');
|
||||
|
||||
export default class BrowserView {
|
||||
#webContentsView: WebContentsView;
|
||||
#ownerWindow: BrowserWindow | null = null;
|
||||
|
||||
#destroyListener: ((e: any) => void) | null = null;
|
||||
|
||||
// AutoResize state
|
||||
#resizeListener: ((...args: any[]) => void) | null = null;
|
||||
@@ -17,6 +20,9 @@ export default class BrowserView {
|
||||
}
|
||||
webPreferences.type = 'browserView';
|
||||
this.#webContentsView = new WebContentsView({ webPreferences });
|
||||
|
||||
this.#destroyListener = this.#onDestroy.bind(this);
|
||||
this.#webContentsView.webContents.once('destroyed', this.#destroyListener);
|
||||
}
|
||||
|
||||
get webContents () {
|
||||
@@ -55,23 +61,39 @@ export default class BrowserView {
|
||||
|
||||
// Internal methods
|
||||
get ownerWindow (): BrowserWindow | null {
|
||||
return !this.webContents.isDestroyed() ? this.webContents.getOwnerBrowserWindow() : null;
|
||||
return this.#ownerWindow;
|
||||
}
|
||||
|
||||
// We can't rely solely on the webContents' owner window because
|
||||
// a webContents can be closed by the user while the BrowserView
|
||||
// remains alive and attached to a BrowserWindow.
|
||||
set ownerWindow (w: BrowserWindow | null) {
|
||||
if (this.webContents.isDestroyed()) return;
|
||||
const oldWindow = this.webContents.getOwnerBrowserWindow();
|
||||
if (oldWindow && this.#resizeListener) {
|
||||
oldWindow.off('resize', this.#resizeListener);
|
||||
if (this.#ownerWindow && this.#resizeListener) {
|
||||
this.#ownerWindow.off('resize', this.#resizeListener);
|
||||
this.#resizeListener = null;
|
||||
}
|
||||
this.webContents._setOwnerWindow(w);
|
||||
|
||||
if (this.webContents && !this.webContents.isDestroyed()) {
|
||||
this.webContents._setOwnerWindow(w);
|
||||
}
|
||||
|
||||
this.#ownerWindow = w;
|
||||
if (w) {
|
||||
this.#lastWindowSize = w.getBounds();
|
||||
w.on('resize', this.#resizeListener = this.#autoResize.bind(this));
|
||||
w.on('closed', () => {
|
||||
this.#ownerWindow = null;
|
||||
this.#destroyListener = null;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
#onDestroy () {
|
||||
// Ensure that if #webContentsView's webContents is destroyed,
|
||||
// the WebContentsView is removed from the view hierarchy.
|
||||
this.#ownerWindow?.contentView.removeChildView(this.webContentsView);
|
||||
}
|
||||
|
||||
#autoHorizontalProportion: {width: number, left: number} | null = null;
|
||||
#autoVerticalProportion: {height: number, top: number} | null = null;
|
||||
#autoResize () {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BaseWindow, WebContents, BrowserView } from 'electron/main';
|
||||
import { BaseWindow, WebContents, TouchBar, BrowserView } from 'electron/main';
|
||||
import type { BrowserWindow as BWT } from 'electron/main';
|
||||
const { BrowserWindow } = process._linkedBinding('electron_browser_window') as { BrowserWindow: typeof BWT };
|
||||
|
||||
@@ -100,6 +100,10 @@ BrowserWindow.fromBrowserView = (browserView: BrowserView) => {
|
||||
return BrowserWindow.fromWebContents(browserView.webContents);
|
||||
};
|
||||
|
||||
BrowserWindow.prototype.setTouchBar = function (touchBar) {
|
||||
(TouchBar as any)._setOnWindow(touchBar, this);
|
||||
};
|
||||
|
||||
// Forwarded to webContents:
|
||||
|
||||
BrowserWindow.prototype.loadURL = function (...args) {
|
||||
@@ -195,7 +199,9 @@ BrowserWindow.prototype.removeBrowserView = function (browserView: BrowserView)
|
||||
};
|
||||
|
||||
BrowserWindow.prototype.getBrowserView = function () {
|
||||
if (this._browserViews.length > 1) { throw new Error('This BrowserWindow has multiple BrowserViews, use getBrowserViews() instead'); }
|
||||
if (this._browserViews.length > 1) {
|
||||
throw new Error('This BrowserWindow has multiple BrowserViews - use getBrowserViews() instead');
|
||||
}
|
||||
return this._browserViews[0] ?? null;
|
||||
};
|
||||
|
||||
@@ -204,7 +210,9 @@ BrowserWindow.prototype.getBrowserViews = function () {
|
||||
};
|
||||
|
||||
BrowserWindow.prototype.setTopBrowserView = function (browserView: BrowserView) {
|
||||
if (browserView.ownerWindow !== this) { throw new Error('Given BrowserView is not attached to the window'); }
|
||||
if (browserView.ownerWindow !== this) {
|
||||
throw new Error('Given BrowserView is not attached to the window');
|
||||
}
|
||||
const idx = this._browserViews.indexOf(browserView);
|
||||
if (idx >= 0) {
|
||||
this.contentView.addChildView(browserView.webContentsView);
|
||||
|
||||
@@ -284,7 +284,7 @@ const escapeItemSymbol = Symbol('escape item');
|
||||
|
||||
class TouchBar extends EventEmitter implements Electron.TouchBar {
|
||||
// Bind a touch bar to a window
|
||||
static _setOnWindow (touchBar: TouchBar | Electron.TouchBarConstructorOptions['items'], window: Electron.BaseWindow) {
|
||||
static _setOnWindow (touchBar: TouchBar | Electron.TouchBarConstructorOptions['items'], window: Electron.BrowserWindow) {
|
||||
if (window._touchBar != null) {
|
||||
window._touchBar._removeFromWindow(window);
|
||||
}
|
||||
@@ -383,7 +383,7 @@ class TouchBar extends EventEmitter implements Electron.TouchBar {
|
||||
return this[escapeItemSymbol];
|
||||
}
|
||||
|
||||
_addToWindow (window: Electron.BaseWindow) {
|
||||
_addToWindow (window: Electron.BrowserWindow) {
|
||||
const { id } = window;
|
||||
|
||||
// Already added to window
|
||||
@@ -439,7 +439,7 @@ class TouchBar extends EventEmitter implements Electron.TouchBar {
|
||||
escapeItemListener(this.escapeItem);
|
||||
}
|
||||
|
||||
_removeFromWindow (window: Electron.BaseWindow) {
|
||||
_removeFromWindow (window: Electron.BrowserWindow) {
|
||||
const removeListeners = this.windowListeners.get(window.id);
|
||||
if (removeListeners != null) removeListeners();
|
||||
}
|
||||
|
||||
@@ -433,14 +433,15 @@ WebContents.prototype.loadURL = function (url, options) {
|
||||
return p;
|
||||
};
|
||||
|
||||
WebContents.prototype.setWindowOpenHandler = function (handler: (details: Electron.HandlerDetails) => ({action: 'deny'} | {action: 'allow', overrideBrowserWindowOptions?: BrowserWindowConstructorOptions, outlivesOpener?: boolean})) {
|
||||
WebContents.prototype.setWindowOpenHandler = function (handler: (details: Electron.HandlerDetails) => Electron.WindowOpenHandlerResponse) {
|
||||
this._windowOpenHandler = handler;
|
||||
};
|
||||
|
||||
WebContents.prototype._callWindowOpenHandler = function (event: Electron.Event, details: Electron.HandlerDetails): {browserWindowConstructorOptions: BrowserWindowConstructorOptions | null, outlivesOpener: boolean} {
|
||||
WebContents.prototype._callWindowOpenHandler = function (event: Electron.Event, details: Electron.HandlerDetails): {browserWindowConstructorOptions: BrowserWindowConstructorOptions | null, outlivesOpener: boolean, createWindow?: Electron.CreateWindowFunction} {
|
||||
const defaultResponse = {
|
||||
browserWindowConstructorOptions: null,
|
||||
outlivesOpener: false
|
||||
outlivesOpener: false,
|
||||
createWindow: undefined
|
||||
};
|
||||
if (!this._windowOpenHandler) {
|
||||
return defaultResponse;
|
||||
@@ -466,7 +467,8 @@ WebContents.prototype._callWindowOpenHandler = function (event: Electron.Event,
|
||||
} else if (response.action === 'allow') {
|
||||
return {
|
||||
browserWindowConstructorOptions: typeof response.overrideBrowserWindowOptions === 'object' ? response.overrideBrowserWindowOptions : null,
|
||||
outlivesOpener: typeof response.outlivesOpener === 'boolean' ? response.outlivesOpener : false
|
||||
outlivesOpener: typeof response.outlivesOpener === 'boolean' ? response.outlivesOpener : false,
|
||||
createWindow: typeof response.createWindow === 'function' ? response.createWindow : undefined
|
||||
};
|
||||
} else {
|
||||
event.preventDefault();
|
||||
@@ -665,13 +667,16 @@ WebContents.prototype._init = function () {
|
||||
postData,
|
||||
overrideBrowserWindowOptions: options || {},
|
||||
windowOpenArgs: details,
|
||||
outlivesOpener: result.outlivesOpener
|
||||
outlivesOpener: result.outlivesOpener,
|
||||
createWindow: result.createWindow
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
let windowOpenOverriddenOptions: BrowserWindowConstructorOptions | null = null;
|
||||
let windowOpenOutlivesOpenerOption: boolean = false;
|
||||
let createWindow: Electron.CreateWindowFunction | undefined;
|
||||
|
||||
this.on('-will-add-new-contents' as any, (event: Electron.Event, url: string, frameName: string, rawFeatures: string, disposition: Electron.HandlerDetails['disposition'], referrer: Electron.Referrer, postData: PostData) => {
|
||||
const postBody = postData ? {
|
||||
data: postData,
|
||||
@@ -696,6 +701,7 @@ WebContents.prototype._init = function () {
|
||||
|
||||
windowOpenOutlivesOpenerOption = result.outlivesOpener;
|
||||
windowOpenOverriddenOptions = result.browserWindowConstructorOptions;
|
||||
createWindow = result.createWindow;
|
||||
if (!event.defaultPrevented) {
|
||||
const secureOverrideWebPreferences = windowOpenOverriddenOptions ? {
|
||||
// Allow setting of backgroundColor as a webPreference even though
|
||||
@@ -725,6 +731,9 @@ WebContents.prototype._init = function () {
|
||||
referrer: Electron.Referrer, rawFeatures: string, postData: PostData) => {
|
||||
const overriddenOptions = windowOpenOverriddenOptions || undefined;
|
||||
const outlivesOpener = windowOpenOutlivesOpenerOption;
|
||||
const windowOpenFunction = createWindow;
|
||||
|
||||
createWindow = undefined;
|
||||
windowOpenOverriddenOptions = null;
|
||||
// false is the default
|
||||
windowOpenOutlivesOpenerOption = false;
|
||||
@@ -747,7 +756,8 @@ WebContents.prototype._init = function () {
|
||||
frameName,
|
||||
features: rawFeatures
|
||||
},
|
||||
outlivesOpener
|
||||
outlivesOpener,
|
||||
createWindow: windowOpenFunction
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -16,16 +16,16 @@ export type WindowOpenArgs = {
|
||||
features: string,
|
||||
}
|
||||
|
||||
const frameNamesToWindow = new Map<string, BrowserWindow>();
|
||||
const registerFrameNameToGuestWindow = (name: string, win: BrowserWindow) => frameNamesToWindow.set(name, win);
|
||||
const frameNamesToWindow = new Map<string, WebContents>();
|
||||
const registerFrameNameToGuestWindow = (name: string, webContents: WebContents) => frameNamesToWindow.set(name, webContents);
|
||||
const unregisterFrameName = (name: string) => frameNamesToWindow.delete(name);
|
||||
const getGuestWindowByFrameName = (name: string) => frameNamesToWindow.get(name);
|
||||
const getGuestWebContentsByFrameName = (name: string) => frameNamesToWindow.get(name);
|
||||
|
||||
/**
|
||||
* `openGuestWindow` is called to create and setup event handling for the new
|
||||
* window.
|
||||
*/
|
||||
export function openGuestWindow ({ embedder, guest, referrer, disposition, postData, overrideBrowserWindowOptions, windowOpenArgs, outlivesOpener }: {
|
||||
export function openGuestWindow ({ embedder, guest, referrer, disposition, postData, overrideBrowserWindowOptions, windowOpenArgs, outlivesOpener, createWindow }: {
|
||||
embedder: WebContents,
|
||||
guest?: WebContents,
|
||||
referrer: Referrer,
|
||||
@@ -34,7 +34,8 @@ export function openGuestWindow ({ embedder, guest, referrer, disposition, postD
|
||||
overrideBrowserWindowOptions?: BrowserWindowConstructorOptions,
|
||||
windowOpenArgs: WindowOpenArgs,
|
||||
outlivesOpener: boolean,
|
||||
}): BrowserWindow | undefined {
|
||||
createWindow?: Electron.CreateWindowFunction
|
||||
}): void {
|
||||
const { url, frameName, features } = windowOpenArgs;
|
||||
const { options: parsedOptions } = parseFeatures(features);
|
||||
const browserWindowOptions = {
|
||||
@@ -48,17 +49,42 @@ export function openGuestWindow ({ embedder, guest, referrer, disposition, postD
|
||||
// To spec, subsequent window.open calls with the same frame name (`target` in
|
||||
// spec parlance) will reuse the previous window.
|
||||
// https://html.spec.whatwg.org/multipage/window-object.html#apis-for-creating-and-navigating-browsing-contexts-by-name
|
||||
const existingWindow = getGuestWindowByFrameName(frameName);
|
||||
if (existingWindow) {
|
||||
if (existingWindow.isDestroyed() || existingWindow.webContents.isDestroyed()) {
|
||||
const existingWebContents = getGuestWebContentsByFrameName(frameName);
|
||||
if (existingWebContents) {
|
||||
if (existingWebContents.isDestroyed()) {
|
||||
// FIXME(t57ser): The webContents is destroyed for some reason, unregister the frame name
|
||||
unregisterFrameName(frameName);
|
||||
} else {
|
||||
existingWindow.loadURL(url);
|
||||
return existingWindow;
|
||||
existingWebContents.loadURL(url);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (createWindow) {
|
||||
const webContents = createWindow({
|
||||
webContents: guest,
|
||||
...browserWindowOptions
|
||||
});
|
||||
|
||||
if (guest != null) {
|
||||
if (webContents !== guest) {
|
||||
throw new Error('Invalid webContents. Created window should be connected to webContents passed with options object.');
|
||||
}
|
||||
|
||||
webContents.loadURL(url, {
|
||||
httpReferrer: referrer,
|
||||
...(postData && {
|
||||
postData,
|
||||
extraHeaders: formatPostDataHeaders(postData as Electron.UploadRawData[])
|
||||
})
|
||||
});
|
||||
|
||||
handleWindowLifecycleEvents({ embedder, frameName, guest, outlivesOpener });
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const window = new BrowserWindow({
|
||||
webContents: guest,
|
||||
...browserWindowOptions
|
||||
@@ -77,11 +103,9 @@ export function openGuestWindow ({ embedder, guest, referrer, disposition, postD
|
||||
});
|
||||
}
|
||||
|
||||
handleWindowLifecycleEvents({ embedder, frameName, guest: window, outlivesOpener });
|
||||
handleWindowLifecycleEvents({ embedder, frameName, guest: window.webContents, outlivesOpener });
|
||||
|
||||
embedder.emit('did-create-window', window, { url, frameName, options: browserWindowOptions, disposition, referrer, postData });
|
||||
|
||||
return window;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -92,12 +116,12 @@ export function openGuestWindow ({ embedder, guest, referrer, disposition, postD
|
||||
*/
|
||||
const handleWindowLifecycleEvents = function ({ embedder, guest, frameName, outlivesOpener }: {
|
||||
embedder: WebContents,
|
||||
guest: BrowserWindow,
|
||||
guest: WebContents,
|
||||
frameName: string,
|
||||
outlivesOpener: boolean
|
||||
}) {
|
||||
const closedByEmbedder = function () {
|
||||
guest.removeListener('closed', closedByUser);
|
||||
guest.removeListener('destroyed', closedByUser);
|
||||
guest.destroy();
|
||||
};
|
||||
|
||||
@@ -110,11 +134,11 @@ const handleWindowLifecycleEvents = function ({ embedder, guest, frameName, outl
|
||||
if (!outlivesOpener) {
|
||||
embedder.once('current-render-view-deleted' as any, closedByEmbedder);
|
||||
}
|
||||
guest.once('closed', closedByUser);
|
||||
guest.once('destroyed', closedByUser);
|
||||
|
||||
if (frameName) {
|
||||
registerFrameNameToGuestWindow(frameName, guest);
|
||||
guest.once('closed', function () {
|
||||
guest.once('destroyed', function () {
|
||||
unregisterFrameName(frameName);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -209,6 +209,22 @@ type ExtraURLLoaderOptions = {
|
||||
headers: Record<string, { name: string, value: string | string[] }>;
|
||||
allowNonHttpProtocols: boolean;
|
||||
}
|
||||
|
||||
function validateHeader (name: any, value: any): void {
|
||||
if (typeof name !== 'string') {
|
||||
throw new TypeError('`name` should be a string in setHeader(name, value)');
|
||||
}
|
||||
if (value == null) {
|
||||
throw new Error('`value` required in setHeader("' + name + '", value)');
|
||||
}
|
||||
if (!isValidHeaderName(name)) {
|
||||
throw new Error(`Invalid header name: '${name}'`);
|
||||
}
|
||||
if (!isValidHeaderValue(value.toString())) {
|
||||
throw new Error(`Invalid value for header '${name}': '${value}'`);
|
||||
}
|
||||
}
|
||||
|
||||
function parseOptions (optionsIn: ClientRequestConstructorOptions | string): NodeJS.CreateURLLoaderOptions & ExtraURLLoaderOptions {
|
||||
// eslint-disable-next-line node/no-deprecated-api
|
||||
const options: any = typeof optionsIn === 'string' ? url.parse(optionsIn) : { ...optionsIn };
|
||||
@@ -275,12 +291,7 @@ function parseOptions (optionsIn: ClientRequestConstructorOptions | string): Nod
|
||||
};
|
||||
const headers: Record<string, string | string[]> = options.headers || {};
|
||||
for (const [name, value] of Object.entries(headers)) {
|
||||
if (!isValidHeaderName(name)) {
|
||||
throw new Error(`Invalid header name: '${name}'`);
|
||||
}
|
||||
if (!isValidHeaderValue(value.toString())) {
|
||||
throw new Error(`Invalid value for header '${name}': '${value}'`);
|
||||
}
|
||||
validateHeader(name, value);
|
||||
const key = name.toLowerCase();
|
||||
urlLoaderOptions.headers[key] = { name, value };
|
||||
}
|
||||
@@ -351,21 +362,10 @@ export class ClientRequest extends Writable implements Electron.ClientRequest {
|
||||
}
|
||||
|
||||
setHeader (name: string, value: string) {
|
||||
if (typeof name !== 'string') {
|
||||
throw new TypeError('`name` should be a string in setHeader(name, value)');
|
||||
}
|
||||
if (value == null) {
|
||||
throw new Error('`value` required in setHeader("' + name + '", value)');
|
||||
}
|
||||
if (this._started || this._firstWrite) {
|
||||
throw new Error('Can\'t set headers after they are sent');
|
||||
}
|
||||
if (!isValidHeaderName(name)) {
|
||||
throw new Error(`Invalid header name: '${name}'`);
|
||||
}
|
||||
if (!isValidHeaderValue(value.toString())) {
|
||||
throw new Error(`Invalid value for header '${name}': '${value}'`);
|
||||
}
|
||||
validateHeader(name, value);
|
||||
|
||||
const key = name.toLowerCase();
|
||||
this._urlLoaderOptions.headers[key] = { name, value };
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Buffer } from 'buffer';
|
||||
import { constants } from 'fs';
|
||||
import { Dirent, constants } from 'fs';
|
||||
import * as path from 'path';
|
||||
import * as util from 'util';
|
||||
|
||||
@@ -46,7 +46,17 @@ process._getOrCreateArchive = getOrCreateArchive;
|
||||
|
||||
const asarRe = /\.asar/i;
|
||||
|
||||
const { getValidatedPath } = __non_webpack_require__('internal/fs/utils');
|
||||
const {
|
||||
getValidatedPath,
|
||||
getOptions,
|
||||
getDirent
|
||||
} = __non_webpack_require__('internal/fs/utils');
|
||||
|
||||
const {
|
||||
validateBoolean,
|
||||
validateFunction
|
||||
} = __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');
|
||||
@@ -78,6 +88,23 @@ const gid = process.getgid?.() ?? 0;
|
||||
|
||||
const fakeTime = new Date();
|
||||
|
||||
function getDirents (p: string, { 0: names, 1: types }: any[][]): Dirent[] {
|
||||
for (let i = 0; i < names.length; i++) {
|
||||
let type = types[i];
|
||||
const info = splitPath(path.join(p, names[i]));
|
||||
if (info.isAsar) {
|
||||
const archive = getOrCreateArchive(info.asarPath);
|
||||
if (!archive) continue;
|
||||
const stats = archive.stat(info.filePath);
|
||||
if (!stats) continue;
|
||||
type = stats.type;
|
||||
}
|
||||
names[i] = getDirent(p, names[i], type);
|
||||
}
|
||||
|
||||
return names;
|
||||
}
|
||||
|
||||
enum AsarFileType {
|
||||
kFile = (constants as any).UV_DIRENT_FILE,
|
||||
kDirectory = (constants as any).UV_DIRENT_DIR,
|
||||
@@ -671,13 +698,27 @@ export const wrapFsWithAsar = (fs: Record<string, any>) => {
|
||||
return (encoding) ? buffer.toString(encoding) : buffer;
|
||||
};
|
||||
|
||||
type ReaddirOptions = { encoding: BufferEncoding | null; withFileTypes?: false, recursive?: false } | undefined | null;
|
||||
type ReaddirCallback = (err: NodeJS.ErrnoException | null, files: string[]) => void;
|
||||
|
||||
const { readdir } = fs;
|
||||
fs.readdir = function (pathArgument: string, options?: { encoding?: string | null; withFileTypes?: boolean } | null, callback?: Function) {
|
||||
const pathInfo = splitPath(pathArgument);
|
||||
if (typeof options === 'function') {
|
||||
callback = options;
|
||||
options = undefined;
|
||||
fs.readdir = function (pathArgument: string, options: ReaddirOptions, callback: ReaddirCallback) {
|
||||
callback = typeof options === 'function' ? options : callback;
|
||||
validateFunction(callback, 'callback');
|
||||
|
||||
options = getOptions(options);
|
||||
pathArgument = getValidatedPath(pathArgument);
|
||||
|
||||
if (options?.recursive != null) {
|
||||
validateBoolean(options?.recursive, 'options.recursive');
|
||||
}
|
||||
|
||||
if (options?.recursive) {
|
||||
nextTick(callback!, [null, readdirSyncRecursive(pathArgument, options)]);
|
||||
return;
|
||||
}
|
||||
|
||||
const pathInfo = splitPath(pathArgument);
|
||||
if (!pathInfo.isAsar) return readdir.apply(this, arguments);
|
||||
const { asarPath, filePath } = pathInfo;
|
||||
|
||||
@@ -714,12 +755,62 @@ export const wrapFsWithAsar = (fs: Record<string, any>) => {
|
||||
nextTick(callback!, [null, files]);
|
||||
};
|
||||
|
||||
fs.promises.readdir = util.promisify(fs.readdir);
|
||||
const { readdir: readdirPromise } = require('fs').promises;
|
||||
fs.promises.readdir = async function (pathArgument: string, options: ReaddirOptions) {
|
||||
options = getOptions(options);
|
||||
pathArgument = getValidatedPath(pathArgument);
|
||||
|
||||
type ReaddirSyncOptions = { encoding: BufferEncoding | null; withFileTypes?: false };
|
||||
if (options?.recursive != null) {
|
||||
validateBoolean(options?.recursive, 'options.recursive');
|
||||
}
|
||||
|
||||
if (options?.recursive) {
|
||||
return readdirRecursive(pathArgument, options);
|
||||
}
|
||||
|
||||
const pathInfo = splitPath(pathArgument);
|
||||
if (!pathInfo.isAsar) return readdirPromise(pathArgument, options);
|
||||
const { asarPath, filePath } = pathInfo;
|
||||
|
||||
const archive = getOrCreateArchive(asarPath);
|
||||
if (!archive) {
|
||||
return Promise.reject(createError(AsarError.INVALID_ARCHIVE, { asarPath }));
|
||||
}
|
||||
|
||||
const files = archive.readdir(filePath);
|
||||
if (!files) {
|
||||
return Promise.reject(createError(AsarError.NOT_FOUND, { asarPath, filePath }));
|
||||
}
|
||||
|
||||
if (options?.withFileTypes) {
|
||||
const dirents = [];
|
||||
for (const file of files) {
|
||||
const childPath = path.join(filePath, file);
|
||||
const stats = archive.stat(childPath);
|
||||
if (!stats) {
|
||||
throw createError(AsarError.NOT_FOUND, { asarPath, filePath: childPath });
|
||||
}
|
||||
dirents.push(new fs.Dirent(file, stats.type));
|
||||
}
|
||||
return Promise.resolve(dirents);
|
||||
}
|
||||
|
||||
return Promise.resolve(files);
|
||||
};
|
||||
|
||||
const { readdirSync } = fs;
|
||||
fs.readdirSync = function (pathArgument: string, options: ReaddirSyncOptions | BufferEncoding | null) {
|
||||
fs.readdirSync = function (pathArgument: string, options: ReaddirOptions) {
|
||||
options = getOptions(options);
|
||||
pathArgument = getValidatedPath(pathArgument);
|
||||
|
||||
if (options?.recursive != null) {
|
||||
validateBoolean(options?.recursive, 'options.recursive');
|
||||
}
|
||||
|
||||
if (options?.recursive) {
|
||||
return readdirSyncRecursive(pathArgument, options);
|
||||
}
|
||||
|
||||
const pathInfo = splitPath(pathArgument);
|
||||
if (!pathInfo.isAsar) return readdirSync.apply(this, arguments);
|
||||
const { asarPath, filePath } = pathInfo;
|
||||
@@ -734,7 +825,7 @@ export const wrapFsWithAsar = (fs: Record<string, any>) => {
|
||||
throw createError(AsarError.NOT_FOUND, { asarPath, filePath });
|
||||
}
|
||||
|
||||
if (options && (options as ReaddirSyncOptions).withFileTypes) {
|
||||
if (options?.withFileTypes) {
|
||||
const dirents = [];
|
||||
for (const file of files) {
|
||||
const childPath = path.join(filePath, file);
|
||||
@@ -750,7 +841,8 @@ export const wrapFsWithAsar = (fs: Record<string, any>) => {
|
||||
return files;
|
||||
};
|
||||
|
||||
const { internalModuleReadJSON } = internalBinding('fs');
|
||||
const binding = internalBinding('fs');
|
||||
const { internalModuleReadJSON, kUsePromises } = binding;
|
||||
internalBinding('fs').internalModuleReadJSON = (pathArgument: string) => {
|
||||
const pathInfo = splitPath(pathArgument);
|
||||
if (!pathInfo.isAsar) return internalModuleReadJSON(pathArgument);
|
||||
@@ -796,6 +888,187 @@ export const wrapFsWithAsar = (fs: Record<string, any>) => {
|
||||
return (stats.type === AsarFileType.kDirectory) ? 1 : 0;
|
||||
};
|
||||
|
||||
async function readdirRecursive (originalPath: string, options: ReaddirOptions) {
|
||||
const result: any[] = [];
|
||||
|
||||
const pathInfo = splitPath(originalPath);
|
||||
let queue: [string, string[]][] = [];
|
||||
const withFileTypes = Boolean(options?.withFileTypes);
|
||||
|
||||
let initialItem = [];
|
||||
if (pathInfo.isAsar) {
|
||||
const archive = getOrCreateArchive(pathInfo.asarPath);
|
||||
if (!archive) return result;
|
||||
const files = archive.readdir(pathInfo.filePath);
|
||||
if (!files) return result;
|
||||
|
||||
// If we're in an asar dir, we need to ensure the result is in the same format as the
|
||||
// native call to readdir withFileTypes i.e. an array of arrays.
|
||||
initialItem = files;
|
||||
if (withFileTypes) {
|
||||
initialItem = [
|
||||
[...initialItem], initialItem.map((p: string) => {
|
||||
return internalBinding('fs').internalModuleStat(path.join(originalPath, p));
|
||||
})
|
||||
];
|
||||
}
|
||||
} else {
|
||||
initialItem = await binding.readdir(
|
||||
path.toNamespacedPath(originalPath),
|
||||
options!.encoding,
|
||||
withFileTypes,
|
||||
kUsePromises
|
||||
);
|
||||
}
|
||||
|
||||
queue = [[originalPath, initialItem]];
|
||||
|
||||
if (withFileTypes) {
|
||||
while (queue.length > 0) {
|
||||
// @ts-expect-error this is a valid array destructure assignment.
|
||||
const { 0: pathArg, 1: readDir } = queue.pop();
|
||||
for (const dirent of getDirents(pathArg, readDir)) {
|
||||
result.push(dirent);
|
||||
if (dirent.isDirectory()) {
|
||||
const direntPath = path.join(pathArg, dirent.name);
|
||||
const info = splitPath(direntPath);
|
||||
let readdirResult;
|
||||
if (info.isAsar) {
|
||||
const archive = getOrCreateArchive(info.asarPath);
|
||||
if (!archive) continue;
|
||||
const files = archive.readdir(info.filePath);
|
||||
if (!files) continue;
|
||||
|
||||
readdirResult = [
|
||||
[...files], files.map((p: string) => {
|
||||
return internalBinding('fs').internalModuleStat(path.join(direntPath, p));
|
||||
})
|
||||
];
|
||||
} else {
|
||||
readdirResult = await binding.readdir(
|
||||
direntPath,
|
||||
options!.encoding,
|
||||
true,
|
||||
kUsePromises
|
||||
);
|
||||
}
|
||||
queue.push([direntPath, readdirResult]);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
while (queue.length > 0) {
|
||||
// @ts-expect-error this is a valid array destructure assignment.
|
||||
const { 0: pathArg, 1: readDir } = queue.pop();
|
||||
for (const ent of readDir) {
|
||||
const direntPath = path.join(pathArg, ent);
|
||||
const stat = internalBinding('fs').internalModuleStat(direntPath);
|
||||
result.push(path.relative(originalPath, direntPath));
|
||||
|
||||
if (stat === 1) {
|
||||
const subPathInfo = splitPath(direntPath);
|
||||
let item = [];
|
||||
if (subPathInfo.isAsar) {
|
||||
const archive = getOrCreateArchive(subPathInfo.asarPath);
|
||||
if (!archive) return;
|
||||
const files = archive.readdir(subPathInfo.filePath);
|
||||
if (!files) return result;
|
||||
item = files;
|
||||
} else {
|
||||
item = await binding.readdir(
|
||||
path.toNamespacedPath(direntPath),
|
||||
options!.encoding,
|
||||
false,
|
||||
kUsePromises
|
||||
);
|
||||
}
|
||||
queue.push([direntPath, item]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function readdirSyncRecursive (basePath: string, options: ReaddirOptions) {
|
||||
const withFileTypes = Boolean(options!.withFileTypes);
|
||||
const encoding = options!.encoding;
|
||||
|
||||
const readdirResults: string[] = [];
|
||||
const pathsQueue = [basePath];
|
||||
|
||||
function read (pathArg: string) {
|
||||
let readdirResult;
|
||||
|
||||
const pathInfo = splitPath(pathArg);
|
||||
if (pathInfo.isAsar) {
|
||||
const { asarPath, filePath } = pathInfo;
|
||||
const archive = getOrCreateArchive(asarPath);
|
||||
if (!archive) return;
|
||||
|
||||
readdirResult = archive.readdir(filePath);
|
||||
if (!readdirResult) return;
|
||||
// If we're in an asar dir, we need to ensure the result is in the same format as the
|
||||
// native call to readdir withFileTypes i.e. an array of arrays.
|
||||
if (withFileTypes) {
|
||||
readdirResult = [
|
||||
[...readdirResult], readdirResult.map((p: string) => {
|
||||
return internalBinding('fs').internalModuleStat(path.join(pathArg, p));
|
||||
})
|
||||
];
|
||||
}
|
||||
} else {
|
||||
readdirResult = binding.readdir(
|
||||
path.toNamespacedPath(pathArg),
|
||||
encoding,
|
||||
withFileTypes
|
||||
);
|
||||
}
|
||||
|
||||
if (readdirResult === undefined) return;
|
||||
|
||||
if (withFileTypes) {
|
||||
const length = readdirResult[0].length;
|
||||
for (let i = 0; i < length; i++) {
|
||||
const resultPath = path.join(pathArg, readdirResult[0][i]);
|
||||
const info = splitPath(resultPath);
|
||||
|
||||
let type = readdirResult[1][i];
|
||||
if (info.isAsar) {
|
||||
const archive = getOrCreateArchive(info.asarPath);
|
||||
if (!archive) return;
|
||||
const stats = archive.stat(info.filePath);
|
||||
if (!stats) continue;
|
||||
type = stats.type;
|
||||
}
|
||||
|
||||
const dirent = getDirent(pathArg, readdirResult[0][i], type);
|
||||
|
||||
readdirResults.push(dirent);
|
||||
if (dirent.isDirectory()) {
|
||||
pathsQueue.push(path.join(dirent.path, dirent.name));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (let i = 0; i < readdirResult.length; i++) {
|
||||
const resultPath = path.join(pathArg, readdirResult[i]);
|
||||
const relativeResultPath = path.relative(basePath, resultPath);
|
||||
const stat = internalBinding('fs').internalModuleStat(resultPath);
|
||||
|
||||
readdirResults.push(relativeResultPath);
|
||||
if (stat === 1) pathsQueue.push(resultPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (let i = 0; i < pathsQueue.length; i++) {
|
||||
read(pathsQueue[i]);
|
||||
}
|
||||
|
||||
return readdirResults;
|
||||
}
|
||||
|
||||
// Calling mkdir for directory inside asar archive should throw ENOTDIR
|
||||
// error, but on Windows it throws ENOENT.
|
||||
if (process.platform === 'win32') {
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
"eslint-plugin-standard": "^4.0.1",
|
||||
"eslint-plugin-unicorn": "^46.0.1",
|
||||
"events": "^3.2.0",
|
||||
"express": "^4.16.4",
|
||||
"express": "^4.19.2",
|
||||
"folder-hash": "^2.1.1",
|
||||
"got": "^11.8.5",
|
||||
"husky": "^8.0.1",
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
cherry-pick-93c3cf1c787f.patch
|
||||
cherry-pick-33051b084850.patch
|
||||
cherry-pick-b845fed99111.patch
|
||||
cherry-pick-771e74ab497d.patch
|
||||
cherry-pick-8f07d39227f6.patch
|
||||
cherry-pick-b3c64851765c.patch
|
||||
cherry-pick-9463ce9cd8d9.patch
|
||||
@@ -1,332 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Antonio Maiorano <amaiorano@google.com>
|
||||
Date: Mon, 10 Jun 2024 10:52:30 -0400
|
||||
Subject: Loop exit restructurizer: don't iterate over uses while mutating them
|
||||
(#6644)
|
||||
|
||||
The SkipBlockWithBranch function does the following:
|
||||
- Splits the block into three blocks with an if-then-endif structure.
|
||||
- Moves most instructions from the original block into the "then" block
|
||||
- If any of those values are used outside the original block, they are
|
||||
propagated through newly-constructed phis in the 'endif' block.
|
||||
|
||||
This algorithm had a bug where the uses of a value were being scanned
|
||||
while the uses were also being updated. In some cases a downstream
|
||||
out-of-block use could be skipped. That results in an invalid module
|
||||
because now the original definition is now in the 'then' block, which
|
||||
does not dominate the downstream out-of-block use.
|
||||
|
||||
Add a test that demonstrates the problem.
|
||||
|
||||
Bug: chromium:339171223
|
||||
Change-Id: Ia34fd7a2fe84de635289f7499772d11866a28e24
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/external/github.com/microsoft/DirectXShaderCompiler/+/5615350
|
||||
Reviewed-by: James Price <jrprice@google.com>
|
||||
Reviewed-by: dan sinclair <dsinclair@google.com>
|
||||
|
||||
diff --git a/lib/Transforms/Scalar/DxilRemoveUnstructuredLoopExits.cpp b/lib/Transforms/Scalar/DxilRemoveUnstructuredLoopExits.cpp
|
||||
index ef6718f0f22ee33e3f16f9801a64c1a6fb6c653a..70e6ccd8ddbaeabdb469710ad8529933f0286abd 100644
|
||||
--- a/lib/Transforms/Scalar/DxilRemoveUnstructuredLoopExits.cpp
|
||||
+++ b/lib/Transforms/Scalar/DxilRemoveUnstructuredLoopExits.cpp
|
||||
@@ -322,24 +322,26 @@ static void SkipBlockWithBranch(BasicBlock *bb, Value *cond, Loop *L,
|
||||
BranchInst::Create(end, body, cond, bb);
|
||||
|
||||
for (Instruction &inst : *body) {
|
||||
- PHINode *phi = nullptr;
|
||||
|
||||
// For each user that's outside of 'body', replace its use of 'inst' with a
|
||||
// phi created in 'end'
|
||||
- for (auto it = inst.user_begin(); it != inst.user_end();) {
|
||||
- Instruction *user_inst = cast<Instruction>(*(it++));
|
||||
- if (user_inst == phi)
|
||||
- continue;
|
||||
+ SmallPtrSet<Instruction *, 8> users_in_other_blocks;
|
||||
+ for (auto *user : inst.users()) {
|
||||
+ Instruction *user_inst = cast<Instruction>(user);
|
||||
if (user_inst->getParent() != body) {
|
||||
- if (!phi) {
|
||||
- phi = PHINode::Create(inst.getType(), 2, "", &*end->begin());
|
||||
- phi->addIncoming(GetDefaultValue(inst.getType()), bb);
|
||||
- phi->addIncoming(&inst, body);
|
||||
- }
|
||||
+ users_in_other_blocks.insert(user_inst);
|
||||
+ }
|
||||
+ }
|
||||
+ if (users_in_other_blocks.size() > 0) {
|
||||
+ auto *phi = PHINode::Create(inst.getType(), 2, "", &*end->begin());
|
||||
+ phi->addIncoming(GetDefaultValue(inst.getType()), bb);
|
||||
+ phi->addIncoming(&inst, body);
|
||||
+
|
||||
+ for (auto *user_inst : users_in_other_blocks) {
|
||||
user_inst->replaceUsesOfWith(&inst, phi);
|
||||
}
|
||||
- } // For each user of inst of body
|
||||
- } // For each inst in body
|
||||
+ }
|
||||
+ } // For each inst in body
|
||||
|
||||
L->addBasicBlockToLoop(body, *LI);
|
||||
L->addBasicBlockToLoop(end, *LI);
|
||||
diff --git a/tools/clang/test/DXC/Passes/DxilRemoveUnstructuredLoopExits/struct_exit_wrap_value_iteration_bug.ll b/tools/clang/test/DXC/Passes/DxilRemoveUnstructuredLoopExits/struct_exit_wrap_value_iteration_bug.ll
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..ee912c929bdc0424959a29d16c3d5c64f885f809
|
||||
--- /dev/null
|
||||
+++ b/tools/clang/test/DXC/Passes/DxilRemoveUnstructuredLoopExits/struct_exit_wrap_value_iteration_bug.ll
|
||||
@@ -0,0 +1,257 @@
|
||||
+; RUN: %dxopt %s -hlsl-passes-resume -loop-unroll,StructurizeLoopExits=1 -S | FileCheck %s
|
||||
+
|
||||
+; The Loop exit structurizer will wrap the definition of %DerivFineX3 in a conditional block.
|
||||
+; Its value will later be propagated into a phi, and that phi replaces all further uses
|
||||
+; of %DerivFineX3.
|
||||
+;
|
||||
+; Tests that a bug is fixed where the code used to iterate through the uses of a value
|
||||
+; while also updating those uses. The old code would fail to update the definition
|
||||
+; of %g.i.2.i3 and the result would be an invalid module: %DerivFineX3 would not dominate
|
||||
+; all its uses.
|
||||
+
|
||||
+
|
||||
+; CHECK: define void @main
|
||||
+; CHECK-NOT: %DerivFineX3
|
||||
+; CHECK: "\01?f@@YAXXZ.exit.i":
|
||||
+; CHECK-NEXT: br i1 true, label %dx.struct_exit.cond_end, label %dx.struct_exit.cond_body
|
||||
+
|
||||
+; CHECK: dx.struct_exit.cond_body:
|
||||
+; CHECK: %DerivFineX3 = call
|
||||
+; CHECK: br label %dx.struct_exit.cond_end
|
||||
+
|
||||
+; CHECK: dx.struct_exit.cond_end:
|
||||
+; CHECK: = phi {{.*}} %DerivFineX3
|
||||
+; CHECK: br
|
||||
+; CHECK-NOT: %DerivFineX3
|
||||
+; CHECK: ret void
|
||||
+
|
||||
+
|
||||
+;
|
||||
+;
|
||||
+; void f() {
|
||||
+; int l_1 = 10;
|
||||
+; for (int l = 0, l_2 = 0; l < 5 && l_2 < 1; l++, l_2++) {
|
||||
+; while (1 < l_1) { }
|
||||
+; }
|
||||
+; }
|
||||
+;
|
||||
+;
|
||||
+; struct tint_symbol {
|
||||
+; float4 value : SV_Target0;
|
||||
+; };
|
||||
+;
|
||||
+; float4 main_inner() {
|
||||
+; float4 g = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
+; bool2 true2 = (true).xx;
|
||||
+; uint2 _e8 = (0u).xx;
|
||||
+; do {
|
||||
+; if (_e8.x != 2u) {
|
||||
+; f();
|
||||
+; float4 _e15 = ddx_fine(g);
|
||||
+; if (_e8[_e8.x] == 2u) {
|
||||
+; g = _e15;
|
||||
+; } else {
|
||||
+; f();
|
||||
+; }
|
||||
+; switch(_e8.x) {
|
||||
+; case 3u: {
|
||||
+; break;
|
||||
+; }
|
||||
+; case 2u: {
|
||||
+; g = _e15;
|
||||
+; break;
|
||||
+; }
|
||||
+; default: {
|
||||
+; g = _e15;
|
||||
+; }
|
||||
+; }
|
||||
+; f();
|
||||
+; }
|
||||
+; } while(!all(true2));
|
||||
+; return g;
|
||||
+;}
|
||||
+;
|
||||
+;tint_symbol main() {
|
||||
+; float4 inner_result = main_inner();
|
||||
+; tint_symbol wrapper_result = (tint_symbol)0;
|
||||
+; wrapper_result.value = inner_result;
|
||||
+; return wrapper_result;
|
||||
+;}
|
||||
+
|
||||
+target datalayout = "e-m:e-p:32:32-i1:32-i8:32-i16:32-i32:32-i64:64-f16:32-f32:32-f64:64-n8:16:32:64"
|
||||
+target triple = "dxil-ms-dx"
|
||||
+
|
||||
+%struct.tint_symbol = type { <4 x float> }
|
||||
+
|
||||
+; Function Attrs: nounwind
|
||||
+define void @main(<4 x float>* noalias) #0 {
|
||||
+entry:
|
||||
+ %1 = alloca [2 x i32], align 4
|
||||
+ %2 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i32 0, i32 0, !dbg !20 ; line:17 col:9
|
||||
+ store i32 0, i32* %2, align 4, !dbg !20 ; line:17 col:9
|
||||
+ %3 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i32 0, i32 1, !dbg !20 ; line:17 col:9
|
||||
+ store i32 0, i32* %3, align 4, !dbg !20 ; line:17 col:9
|
||||
+ br label %do.body.i, !dbg !26 ; line:18 col:3
|
||||
+
|
||||
+do.body.i: ; preds = %do.cond.i, %entry
|
||||
+ %g.i.0.i0 = phi float [ 0.000000e+00, %entry ], [ %g.i.3.i0, %do.cond.i ]
|
||||
+ %g.i.0.i1 = phi float [ 0.000000e+00, %entry ], [ %g.i.3.i1, %do.cond.i ]
|
||||
+ %g.i.0.i2 = phi float [ 0.000000e+00, %entry ], [ %g.i.3.i2, %do.cond.i ]
|
||||
+ %g.i.0.i3 = phi float [ 0.000000e+00, %entry ], [ %g.i.3.i3, %do.cond.i ]
|
||||
+ %4 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i32 0, i32 0, !dbg !27 ; line:19 col:9
|
||||
+ %5 = load i32, i32* %4, align 4, !dbg !27 ; line:19 col:9
|
||||
+ %cmp.i = icmp ne i32 %5, 2, !dbg !28 ; line:19 col:15
|
||||
+ br i1 %cmp.i, label %for.cond.i.i, label %do.cond.i, !dbg !27 ; line:19 col:9
|
||||
+
|
||||
+for.cond.i.i: ; preds = %do.body.i
|
||||
+ br i1 true, label %while.cond.i.i.preheader, label %"\01?f@@YAXXZ.exit.i", !dbg !29 ; line:4 col:3
|
||||
+
|
||||
+while.cond.i.i.preheader: ; preds = %for.cond.i.i
|
||||
+ br label %while.cond.i.i, !dbg !32 ; line:5 col:5
|
||||
+
|
||||
+while.cond.i.i: ; preds = %while.cond.i.i.preheader, %while.cond.i.i
|
||||
+ br label %while.cond.i.i, !dbg !32 ; line:5 col:5
|
||||
+
|
||||
+"\01?f@@YAXXZ.exit.i": ; preds = %for.cond.i.i
|
||||
+ %DerivFineX = call float @dx.op.unary.f32(i32 85, float %g.i.0.i0), !dbg !33 ; line:21 col:21 ; DerivFineX(value)
|
||||
+ %DerivFineX1 = call float @dx.op.unary.f32(i32 85, float %g.i.0.i1), !dbg !33 ; line:21 col:21 ; DerivFineX(value)
|
||||
+ %DerivFineX2 = call float @dx.op.unary.f32(i32 85, float %g.i.0.i2), !dbg !33 ; line:21 col:21 ; DerivFineX(value)
|
||||
+ %DerivFineX3 = call float @dx.op.unary.f32(i32 85, float %g.i.0.i3), !dbg !33 ; line:21 col:21 ; DerivFineX(value)
|
||||
+ %6 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i32 0, i32 0, !dbg !34 ; line:22 col:15
|
||||
+ %7 = load i32, i32* %6, align 4, !dbg !34 ; line:22 col:15
|
||||
+ %8 = getelementptr [2 x i32], [2 x i32]* %1, i32 0, i32 %7, !dbg !35 ; line:22 col:11
|
||||
+ %9 = load i32, i32* %8, !dbg !35, !tbaa !36 ; line:22 col:11
|
||||
+ %cmp6.i = icmp eq i32 %9, 2, !dbg !40 ; line:22 col:22
|
||||
+ br i1 %cmp6.i, label %if.end.i, label %for.cond.i.19.i, !dbg !35 ; line:22 col:11
|
||||
+
|
||||
+for.cond.i.19.i: ; preds = %"\01?f@@YAXXZ.exit.i"
|
||||
+ br i1 true, label %while.cond.i.24.i.preheader, label %if.end.i, !dbg !41 ; line:4 col:3
|
||||
+
|
||||
+while.cond.i.24.i.preheader: ; preds = %for.cond.i.19.i
|
||||
+ br label %while.cond.i.24.i, !dbg !43 ; line:5 col:5
|
||||
+
|
||||
+while.cond.i.24.i: ; preds = %while.cond.i.24.i.preheader, %while.cond.i.24.i
|
||||
+ br label %while.cond.i.24.i, !dbg !43 ; line:5 col:5
|
||||
+
|
||||
+if.end.i: ; preds = %for.cond.i.19.i, %"\01?f@@YAXXZ.exit.i"
|
||||
+ %g.i.1.i0 = phi float [ %DerivFineX, %"\01?f@@YAXXZ.exit.i" ], [ %g.i.0.i0, %for.cond.i.19.i ]
|
||||
+ %g.i.1.i1 = phi float [ %DerivFineX1, %"\01?f@@YAXXZ.exit.i" ], [ %g.i.0.i1, %for.cond.i.19.i ]
|
||||
+ %g.i.1.i2 = phi float [ %DerivFineX2, %"\01?f@@YAXXZ.exit.i" ], [ %g.i.0.i2, %for.cond.i.19.i ]
|
||||
+ %g.i.1.i3 = phi float [ %DerivFineX3, %"\01?f@@YAXXZ.exit.i" ], [ %g.i.0.i3, %for.cond.i.19.i ]
|
||||
+ %10 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i32 0, i32 0, !dbg !44 ; line:27 col:14
|
||||
+ %11 = load i32, i32* %10, align 4, !dbg !44 ; line:27 col:14
|
||||
+ switch i32 %11, label %sw.default.i [
|
||||
+ i32 3, label %for.cond.i.5.i
|
||||
+ i32 2, label %sw.bb.10.i
|
||||
+ ], !dbg !45 ; line:27 col:7
|
||||
+
|
||||
+sw.bb.10.i: ; preds = %if.end.i
|
||||
+ br label %for.cond.i.5.i, !dbg !46 ; line:33 col:11
|
||||
+
|
||||
+sw.default.i: ; preds = %if.end.i
|
||||
+ br label %for.cond.i.5.i, !dbg !47 ; line:38 col:7
|
||||
+
|
||||
+for.cond.i.5.i: ; preds = %if.end.i, %sw.bb.10.i, %sw.default.i
|
||||
+ %g.i.2.i0 = phi float [ %DerivFineX, %sw.default.i ], [ %DerivFineX, %sw.bb.10.i ], [ %g.i.1.i0, %if.end.i ]
|
||||
+ %g.i.2.i1 = phi float [ %DerivFineX1, %sw.default.i ], [ %DerivFineX1, %sw.bb.10.i ], [ %g.i.1.i1, %if.end.i ]
|
||||
+ %g.i.2.i2 = phi float [ %DerivFineX2, %sw.default.i ], [ %DerivFineX2, %sw.bb.10.i ], [ %g.i.1.i2, %if.end.i ]
|
||||
+ %g.i.2.i3 = phi float [ %DerivFineX3, %sw.default.i ], [ %DerivFineX3, %sw.bb.10.i ], [ %g.i.1.i3, %if.end.i ]
|
||||
+ br i1 true, label %while.cond.i.10.i.preheader, label %do.cond.i, !dbg !48 ; line:4 col:3
|
||||
+
|
||||
+while.cond.i.10.i.preheader: ; preds = %for.cond.i.5.i
|
||||
+ br label %while.cond.i.10.i, !dbg !50 ; line:5 col:5
|
||||
+
|
||||
+while.cond.i.10.i: ; preds = %while.cond.i.10.i.preheader, %while.cond.i.10.i
|
||||
+ br label %while.cond.i.10.i, !dbg !50 ; line:5 col:5
|
||||
+
|
||||
+do.cond.i: ; preds = %for.cond.i.5.i, %do.body.i
|
||||
+ %g.i.3.i0 = phi float [ %g.i.0.i0, %do.body.i ], [ %g.i.2.i0, %for.cond.i.5.i ]
|
||||
+ %g.i.3.i1 = phi float [ %g.i.0.i1, %do.body.i ], [ %g.i.2.i1, %for.cond.i.5.i ]
|
||||
+ %g.i.3.i2 = phi float [ %g.i.0.i2, %do.body.i ], [ %g.i.2.i2, %for.cond.i.5.i ]
|
||||
+ %g.i.3.i3 = phi float [ %g.i.0.i3, %do.body.i ], [ %g.i.2.i3, %for.cond.i.5.i ]
|
||||
+ br i1 false, label %do.body.i, label %"\01?main_inner@@YA?AV?$vector@M$03@@XZ.exit", !dbg !51 ; line:41 col:3
|
||||
+
|
||||
+"\01?main_inner@@YA?AV?$vector@M$03@@XZ.exit": ; preds = %do.cond.i
|
||||
+ %g.i.3.i3.lcssa = phi float [ %g.i.3.i3, %do.cond.i ]
|
||||
+ %g.i.3.i2.lcssa = phi float [ %g.i.3.i2, %do.cond.i ]
|
||||
+ %g.i.3.i1.lcssa = phi float [ %g.i.3.i1, %do.cond.i ]
|
||||
+ %g.i.3.i0.lcssa = phi float [ %g.i.3.i0, %do.cond.i ]
|
||||
+ call void @dx.op.storeOutput.f32(i32 5, i32 0, i32 0, i8 0, float %g.i.3.i0.lcssa), !dbg !52 ; line:49 col:10 ; StoreOutput(outputSigId,rowIndex,colIndex,value)
|
||||
+ call void @dx.op.storeOutput.f32(i32 5, i32 0, i32 0, i8 1, float %g.i.3.i1.lcssa), !dbg !52 ; line:49 col:10 ; StoreOutput(outputSigId,rowIndex,colIndex,value)
|
||||
+ call void @dx.op.storeOutput.f32(i32 5, i32 0, i32 0, i8 2, float %g.i.3.i2.lcssa), !dbg !52 ; line:49 col:10 ; StoreOutput(outputSigId,rowIndex,colIndex,value)
|
||||
+ call void @dx.op.storeOutput.f32(i32 5, i32 0, i32 0, i8 3, float %g.i.3.i3.lcssa), !dbg !52 ; line:49 col:10 ; StoreOutput(outputSigId,rowIndex,colIndex,value)
|
||||
+ ret void, !dbg !53 ; line:49 col:3
|
||||
+}
|
||||
+
|
||||
+; Function Attrs: nounwind
|
||||
+declare void @dx.op.storeOutput.f32(i32, i32, i32, i8, float) #0
|
||||
+
|
||||
+; Function Attrs: nounwind readnone
|
||||
+declare float @dx.op.unary.f32(i32, float) #1
|
||||
+
|
||||
+attributes #0 = { nounwind }
|
||||
+attributes #1 = { nounwind readnone }
|
||||
+
|
||||
+!llvm.module.flags = !{!0}
|
||||
+!pauseresume = !{!1}
|
||||
+!llvm.ident = !{!2}
|
||||
+!dx.version = !{!3}
|
||||
+!dx.valver = !{!4}
|
||||
+!dx.shaderModel = !{!5}
|
||||
+!dx.typeAnnotations = !{!6, !9}
|
||||
+!dx.entryPoints = !{!16}
|
||||
+
|
||||
+!0 = !{i32 2, !"Debug Info Version", i32 3}
|
||||
+!1 = !{!"hlsl-dxilemit", !"hlsl-dxilload"}
|
||||
+!2 = !{!"dxc(private) 1.8.0.14549 (main, 0781ded87-dirty)"}
|
||||
+!3 = !{i32 1, i32 0}
|
||||
+!4 = !{i32 1, i32 8}
|
||||
+!5 = !{!"ps", i32 6, i32 0}
|
||||
+!6 = !{i32 0, %struct.tint_symbol undef, !7}
|
||||
+!7 = !{i32 16, !8}
|
||||
+!8 = !{i32 6, !"value", i32 3, i32 0, i32 4, !"SV_Target0", i32 7, i32 9}
|
||||
+!9 = !{i32 1, void (<4 x float>*)* @main, !10}
|
||||
+!10 = !{!11, !13}
|
||||
+!11 = !{i32 0, !12, !12}
|
||||
+!12 = !{}
|
||||
+!13 = !{i32 1, !14, !15}
|
||||
+!14 = !{i32 4, !"SV_Target0", i32 7, i32 9}
|
||||
+!15 = !{i32 0}
|
||||
+!16 = !{void (<4 x float>*)* @main, !"main", !17, null, null}
|
||||
+!17 = !{null, !18, null}
|
||||
+!18 = !{!19}
|
||||
+!19 = !{i32 0, !"SV_Target", i8 9, i8 16, !15, i8 0, i32 1, i8 4, i32 0, i8 0, null}
|
||||
+!20 = !DILocation(line: 17, column: 9, scope: !21, inlinedAt: !24)
|
||||
+!21 = !DISubprogram(name: "main_inner", scope: !22, file: !22, line: 14, type: !23, isLocal: false, isDefinition: true, scopeLine: 14, flags: DIFlagPrototyped, isOptimized: false)
|
||||
+!22 = !DIFile(filename: "s2.hlsl", directory: "")
|
||||
+!23 = !DISubroutineType(types: !12)
|
||||
+!24 = distinct !DILocation(line: 46, column: 25, scope: !25)
|
||||
+!25 = !DISubprogram(name: "main", scope: !22, file: !22, line: 45, type: !23, isLocal: false, isDefinition: true, scopeLine: 45, flags: DIFlagPrototyped, isOptimized: false, function: void (<4 x float>*)* @main)
|
||||
+!26 = !DILocation(line: 18, column: 3, scope: !21, inlinedAt: !24)
|
||||
+!27 = !DILocation(line: 19, column: 9, scope: !21, inlinedAt: !24)
|
||||
+!28 = !DILocation(line: 19, column: 15, scope: !21, inlinedAt: !24)
|
||||
+!29 = !DILocation(line: 4, column: 3, scope: !30, inlinedAt: !31)
|
||||
+!30 = !DISubprogram(name: "f", scope: !22, file: !22, line: 2, type: !23, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: false)
|
||||
+!31 = distinct !DILocation(line: 20, column: 7, scope: !21, inlinedAt: !24)
|
||||
+!32 = !DILocation(line: 5, column: 5, scope: !30, inlinedAt: !31)
|
||||
+!33 = !DILocation(line: 21, column: 21, scope: !21, inlinedAt: !24)
|
||||
+!34 = !DILocation(line: 22, column: 15, scope: !21, inlinedAt: !24)
|
||||
+!35 = !DILocation(line: 22, column: 11, scope: !21, inlinedAt: !24)
|
||||
+!36 = !{!37, !37, i64 0}
|
||||
+!37 = !{!"int", !38, i64 0}
|
||||
+!38 = !{!"omnipotent char", !39, i64 0}
|
||||
+!39 = !{!"Simple C/C++ TBAA"}
|
||||
+!40 = !DILocation(line: 22, column: 22, scope: !21, inlinedAt: !24)
|
||||
+!41 = !DILocation(line: 4, column: 3, scope: !30, inlinedAt: !42)
|
||||
+!42 = distinct !DILocation(line: 25, column: 9, scope: !21, inlinedAt: !24)
|
||||
+!43 = !DILocation(line: 5, column: 5, scope: !30, inlinedAt: !42)
|
||||
+!44 = !DILocation(line: 27, column: 14, scope: !21, inlinedAt: !24)
|
||||
+!45 = !DILocation(line: 27, column: 7, scope: !21, inlinedAt: !24)
|
||||
+!46 = !DILocation(line: 33, column: 11, scope: !21, inlinedAt: !24)
|
||||
+!47 = !DILocation(line: 38, column: 7, scope: !21, inlinedAt: !24)
|
||||
+!48 = !DILocation(line: 4, column: 3, scope: !30, inlinedAt: !49)
|
||||
+!49 = distinct !DILocation(line: 39, column: 7, scope: !21, inlinedAt: !24)
|
||||
+!50 = !DILocation(line: 5, column: 5, scope: !30, inlinedAt: !49)
|
||||
+!51 = !DILocation(line: 41, column: 3, scope: !21, inlinedAt: !24)
|
||||
+!52 = !DILocation(line: 49, column: 10, scope: !25)
|
||||
+!53 = !DILocation(line: 49, column: 3, scope: !25)
|
||||
@@ -1,116 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Antonio Maiorano <amaiorano@google.com>
|
||||
Date: Thu, 20 Jun 2024 14:02:42 -0400
|
||||
Subject: indvars: don't replace a phi when that breaks LCSSA (#6695)
|
||||
|
||||
Induction variable simplification (indvars) tries to rewrite exit
|
||||
values; these appear as phi nodes in loop exit blocks. If the
|
||||
replacement for the phi is still in the loop, then that would break the
|
||||
LCSSA property. Don't do that.
|
||||
|
||||
Add a test for this.
|
||||
|
||||
Bug: chromium:345993680
|
||||
Change-Id: Ib2330afa3c6f47373cb4336cfd00e851044fea3a
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/external/github.com/microsoft/DirectXShaderCompiler/+/5645925
|
||||
Reviewed-by: dan sinclair <dsinclair@chromium.org>
|
||||
Reviewed-by: James Price <jrprice@google.com>
|
||||
|
||||
diff --git a/lib/Transforms/Scalar/IndVarSimplify.cpp b/lib/Transforms/Scalar/IndVarSimplify.cpp
|
||||
index f5b1455d5932b63dfef699991c5eeab38e447a7d..e6ff7b3ab4d81bbb782f0bd0a7b5185a30fd1285 100644
|
||||
--- a/lib/Transforms/Scalar/IndVarSimplify.cpp
|
||||
+++ b/lib/Transforms/Scalar/IndVarSimplify.cpp
|
||||
@@ -24,7 +24,6 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
-#include "llvm/Transforms/Scalar.h"
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/Statistic.h"
|
||||
@@ -41,11 +40,13 @@
|
||||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/IntrinsicInst.h"
|
||||
#include "llvm/IR/LLVMContext.h"
|
||||
+#include "llvm/IR/Module.h"
|
||||
#include "llvm/IR/PatternMatch.h"
|
||||
#include "llvm/IR/Type.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
+#include "llvm/Transforms/Scalar.h"
|
||||
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
|
||||
#include "llvm/Transforms/Utils/Local.h"
|
||||
#include "llvm/Transforms/Utils/SimplifyIndVar.h"
|
||||
@@ -698,6 +699,16 @@ void IndVarSimplify::RewriteLoopExitValues(Loop *L, SCEVExpander &Rewriter) {
|
||||
continue;
|
||||
}
|
||||
|
||||
+ // HLSL Change Begin
|
||||
+ // Avoid breaking LCSSA: Don't replace the PHI if its replacement
|
||||
+ // is defined inside the loop.
|
||||
+ if (auto *ExitValInst = dyn_cast<Instruction>(ExitVal)) {
|
||||
+ if (L->contains(ExitValInst)) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ }
|
||||
+ // HLSL Change End
|
||||
+
|
||||
// Collect all the candidate PHINodes to be rewritten.
|
||||
RewritePhiSet.push_back(
|
||||
RewritePhi(PN, i, ExitVal, HighCost, LCSSASafePhiForRAUW));
|
||||
diff --git a/test/HLSL/passes/indvars/preserve-phi-when-replacement-is-in-loop.ll b/test/HLSL/passes/indvars/preserve-phi-when-replacement-is-in-loop.ll
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..b550ce993837814229f8223a47b2af328cc7c87c
|
||||
--- /dev/null
|
||||
+++ b/test/HLSL/passes/indvars/preserve-phi-when-replacement-is-in-loop.ll
|
||||
@@ -0,0 +1,49 @@
|
||||
+; RUN: opt < %s -indvars -S | FileCheck %s
|
||||
+
|
||||
+; The inner loop (%header1) has a fixed trip count.
|
||||
+; The indvars pass is tempted to delete the phi instruction %hexit,
|
||||
+; and replace its uses with %add3.
|
||||
+; But %hexit is used in %latch0, which is outside the inner loop and
|
||||
+; its exit block. Deleting the phi %hexit would break LCSSA form.
|
||||
+
|
||||
+; CHECK: @main
|
||||
+; CHECK: exit1:
|
||||
+; CHECK-NEXT: %hexit = phi i32 [ %hnext, %header1 ]
|
||||
+; CHECK-NEXT: br label %latch0
|
||||
+
|
||||
+; CHECK: latch0:
|
||||
+
|
||||
+target triple = "dxil-ms-dx"
|
||||
+
|
||||
+define void @main(i32 %arg) {
|
||||
+entry:
|
||||
+ br label %header0
|
||||
+
|
||||
+header0:
|
||||
+ %isgt0 = icmp sgt i32 %arg, 0
|
||||
+ %smax = select i1 %isgt0, i32 %arg, i32 0
|
||||
+ %h0 = add i32 %smax, 1
|
||||
+ %j0 = add i32 %smax, 2
|
||||
+ %doinner = icmp slt i32 %j0, 1
|
||||
+ br i1 %doinner, label %header1.pre, label %latch0
|
||||
+
|
||||
+header1.pre:
|
||||
+ br label %header1
|
||||
+
|
||||
+header1:
|
||||
+ %hi = phi i32 [ %hnext, %header1 ], [ %h0, %header1.pre ]
|
||||
+ %ji = phi i32 [ %jnext, %header1 ], [ %j0, %header1.pre ]
|
||||
+ %add3 = add i32 %smax, 3
|
||||
+ %hnext = add i32 %hi, 1
|
||||
+ %jnext = add nsw i32 %ji, 1 ; the nsw here is essential
|
||||
+ %do1again = icmp slt i32 %ji, %add3
|
||||
+ br i1 %do1again, label %header1, label %exit1
|
||||
+
|
||||
+exit1:
|
||||
+ %hexit = phi i32 [ %hnext, %header1 ]
|
||||
+ br label %latch0
|
||||
+
|
||||
+latch0:
|
||||
+ %useh = phi i32 [ %h0, %header0 ], [ %hexit, %exit1 ]
|
||||
+ br label %header0
|
||||
+}
|
||||
@@ -1,151 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Antonio Maiorano <amaiorano@google.com>
|
||||
Date: Thu, 20 Jun 2024 14:49:58 -0400
|
||||
Subject: Fix crash in scalarrepl-param-hlsl when dynamically indexing a GEP of
|
||||
a constant indexed GEP (#6670)
|
||||
|
||||
When processing global values to determine when to flatten vectors, this
|
||||
pass was only checking the immdiate users of the value for non-dynamic
|
||||
indexing of the vector. But this would fail in the case of a dynamic
|
||||
indexed GEP of a constant indexed GEP (e.g. h[0][a]) because the first
|
||||
level GEP was constant indexed, but not the second. We fix this by
|
||||
checking the full User tree of the value in `hasDynamicVectorIndexing`.
|
||||
|
||||
Bug: chromium:342428008
|
||||
Change-Id: Ibf2ae3a6528cfc9b50634058385c5a45aa1d3b75
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/external/github.com/microsoft/DirectXShaderCompiler/+/5645927
|
||||
Reviewed-by: James Price <jrprice@google.com>
|
||||
Reviewed-by: dan sinclair <dsinclair@chromium.org>
|
||||
|
||||
diff --git a/lib/Transforms/Scalar/ScalarReplAggregatesHLSL.cpp b/lib/Transforms/Scalar/ScalarReplAggregatesHLSL.cpp
|
||||
index 9b843ef0e49e554001b827e30eb6256853d90f5b..b1b38c0ee038dedb2064f5726663992a5bec736b 100644
|
||||
--- a/lib/Transforms/Scalar/ScalarReplAggregatesHLSL.cpp
|
||||
+++ b/lib/Transforms/Scalar/ScalarReplAggregatesHLSL.cpp
|
||||
@@ -1645,6 +1645,10 @@ bool hasDynamicVectorIndexing(Value *V) {
|
||||
}
|
||||
}
|
||||
}
|
||||
+ // Also recursively check the uses of this User to find a possible
|
||||
+ // dynamically indexed GEP of this GEP.
|
||||
+ if (hasDynamicVectorIndexing(U))
|
||||
+ return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
diff --git a/tools/clang/test/DXC/Passes/ScalarReplHLSL/scalarrepl-param-hlsl-dyn-idx-gep-of-const-idx-gep.ll b/tools/clang/test/DXC/Passes/ScalarReplHLSL/scalarrepl-param-hlsl-dyn-idx-gep-of-const-idx-gep.ll
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..04fdea1500e75266a59705a1c2da98a4aef7391c
|
||||
--- /dev/null
|
||||
+++ b/tools/clang/test/DXC/Passes/ScalarReplHLSL/scalarrepl-param-hlsl-dyn-idx-gep-of-const-idx-gep.ll
|
||||
@@ -0,0 +1,111 @@
|
||||
+; RUN: %dxopt %s -hlsl-passes-resume -scalarrepl-param-hlsl -S | FileCheck %s
|
||||
+
|
||||
+; Produced from the following HLSL:
|
||||
+; static int4 g[4] = (int4[4])0;
|
||||
+; static int4 h[4] = (int4[4])0;
|
||||
+;
|
||||
+; [numthreads(1, 1, 1)]
|
||||
+; void main() {
|
||||
+; int a = 0;
|
||||
+; int b = h[0][a];
|
||||
+; h = g;
|
||||
+; }
|
||||
+;
|
||||
+; This was crashing in scalarrepl-param-hlsl because it was attempting to flatten
|
||||
+; global variable 'h' even though it is dynamically indexed. This was not detected
|
||||
+; because the resulting IR was a dynamically indexed GEP of a constant-indexed GEP,
|
||||
+; and the code was only checking the immediate users of 'h':
|
||||
+;
|
||||
+; %1 = getelementptr <4 x i32>, <4 x i32>* getelementptr inbounds ([4 x <4 x i32>], [4 x <4 x i32>]* @h, i32 0, i32 0), i32 0, i32 %0, !dbg !26 ; line:7 col:11
|
||||
+;
|
||||
+; Verify that it does not get flattened
|
||||
+; CHECK: %1 = getelementptr <4 x i32>, <4 x i32>* getelementptr inbounds ([4 x <4 x i32>], [4 x <4 x i32>]* @g, i32 0, i32 0), i32 0, i32 %0
|
||||
+
|
||||
+;
|
||||
+; Buffer Definitions:
|
||||
+;
|
||||
+; cbuffer $Globals
|
||||
+; {
|
||||
+;
|
||||
+; [0 x i8] (type annotation not present)
|
||||
+;
|
||||
+; }
|
||||
+;
|
||||
+;
|
||||
+; Resource Bindings:
|
||||
+;
|
||||
+; Name Type Format Dim ID HLSL Bind Count
|
||||
+; ------------------------------ ---------- ------- ----------- ------- -------------- ------
|
||||
+; $Globals cbuffer NA NA CB0 cb4294967295 1
|
||||
+;
|
||||
+target datalayout = "e-m:e-p:32:32-i1:32-i8:32-i16:32-i32:32-i64:64-f16:32-f32:32-f64:64-n8:16:32:64"
|
||||
+target triple = "dxil-ms-dx"
|
||||
+
|
||||
+%ConstantBuffer = type opaque
|
||||
+
|
||||
+@h = internal global [4 x <4 x i32>] zeroinitializer, align 4
|
||||
+@g = internal global [4 x <4 x i32>] zeroinitializer, align 4
|
||||
+@"$Globals" = external constant %ConstantBuffer
|
||||
+
|
||||
+; Function Attrs: nounwind
|
||||
+define void @main() #0 {
|
||||
+entry:
|
||||
+ %a = alloca i32, align 4
|
||||
+ %b = alloca i32, align 4
|
||||
+ store i32 0, i32* %a, align 4, !dbg !17, !tbaa !21 ; line:6 col:7
|
||||
+ %0 = load i32, i32* %a, align 4, !dbg !25, !tbaa !21 ; line:7 col:16
|
||||
+ %1 = getelementptr <4 x i32>, <4 x i32>* getelementptr inbounds ([4 x <4 x i32>], [4 x <4 x i32>]* @h, i32 0, i32 0), i32 0, i32 %0, !dbg !26 ; line:7 col:11
|
||||
+ %2 = load i32, i32* %1, !dbg !26, !tbaa !21 ; line:7 col:11
|
||||
+ store i32 %2, i32* %b, align 4, !dbg !27, !tbaa !21 ; line:7 col:7
|
||||
+ %3 = bitcast [4 x <4 x i32>]* @h to i8*, !dbg !28 ; line:8 col:7
|
||||
+ %4 = bitcast [4 x <4 x i32>]* @g to i8*, !dbg !28 ; line:8 col:7
|
||||
+ call void @llvm.memcpy.p0i8.p0i8.i64(i8* %3, i8* %4, i64 64, i32 1, i1 false), !dbg !28 ; line:8 col:7
|
||||
+ ret void, !dbg !29 ; line:9 col:1
|
||||
+}
|
||||
+
|
||||
+; Function Attrs: nounwind
|
||||
+declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly, i64, i32, i1) #0
|
||||
+
|
||||
+attributes #0 = { nounwind }
|
||||
+
|
||||
+!llvm.module.flags = !{!0}
|
||||
+!pauseresume = !{!1}
|
||||
+!llvm.ident = !{!2}
|
||||
+!dx.version = !{!3}
|
||||
+!dx.valver = !{!4}
|
||||
+!dx.shaderModel = !{!5}
|
||||
+!dx.typeAnnotations = !{!6}
|
||||
+!dx.entryPoints = !{!10}
|
||||
+!dx.fnprops = !{!14}
|
||||
+!dx.options = !{!15, !16}
|
||||
+
|
||||
+!0 = !{i32 2, !"Debug Info Version", i32 3}
|
||||
+!1 = !{!"hlsl-hlemit", !"hlsl-hlensure"}
|
||||
+!2 = !{!"dxc(private) 1.8.0.4514 (d9bd2a706-dirty)"}
|
||||
+!3 = !{i32 1, i32 0}
|
||||
+!4 = !{i32 1, i32 8}
|
||||
+!5 = !{!"cs", i32 6, i32 0}
|
||||
+!6 = !{i32 1, void ()* @main, !7}
|
||||
+!7 = !{!8}
|
||||
+!8 = !{i32 1, !9, !9}
|
||||
+!9 = !{}
|
||||
+!10 = !{void ()* @main, !"main", null, !11, null}
|
||||
+!11 = !{null, null, !12, null}
|
||||
+!12 = !{!13}
|
||||
+!13 = !{i32 0, %ConstantBuffer* @"$Globals", !"$Globals", i32 0, i32 -1, i32 1, i32 0, null}
|
||||
+!14 = !{void ()* @main, i32 5, i32 1, i32 1, i32 1}
|
||||
+!15 = !{i32 64}
|
||||
+!16 = !{i32 -1}
|
||||
+!17 = !DILocation(line: 6, column: 7, scope: !18)
|
||||
+!18 = !DISubprogram(name: "main", scope: !19, file: !19, line: 5, type: !20, isLocal: false, isDefinition: true, scopeLine: 5, flags: DIFlagPrototyped, isOptimized: false, function: void ()* @main)
|
||||
+!19 = !DIFile(filename: "/mnt/c/Users/amaiorano/Downloads/342428008/standalone_reduced.hlsl", directory: "")
|
||||
+!20 = !DISubroutineType(types: !9)
|
||||
+!21 = !{!22, !22, i64 0}
|
||||
+!22 = !{!"int", !23, i64 0}
|
||||
+!23 = !{!"omnipotent char", !24, i64 0}
|
||||
+!24 = !{!"Simple C/C++ TBAA"}
|
||||
+!25 = !DILocation(line: 7, column: 16, scope: !18)
|
||||
+!26 = !DILocation(line: 7, column: 11, scope: !18)
|
||||
+!27 = !DILocation(line: 7, column: 7, scope: !18)
|
||||
+!28 = !DILocation(line: 8, column: 7, scope: !18)
|
||||
+!29 = !DILocation(line: 9, column: 1, scope: !18)
|
||||
@@ -1,312 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Natalie Chouinard <chouinard@google.com>
|
||||
Date: Fri, 14 Jun 2024 13:29:19 +0000
|
||||
Subject: Fix another UAF in SimplifyCFG (#6680)
|
||||
|
||||
In certain cases of unreachable code, SimplifyCFG could try to replace a
|
||||
phi node with a select where the phi node itself was the select's
|
||||
condition. This resulted in an ASAN use-after-free during SimplifyCFG.
|
||||
|
||||
The test case added isn't quite ideal because by the end of the
|
||||
SimplifyCFG pass, the phi node is restored to its original state both
|
||||
before and after this fix. However, an ASAN build of `dxopt` or
|
||||
`check-clang-dxc` will identify a heap-use-after-free failure in the
|
||||
intermediary steps of this test without this patch and succeeds with it.
|
||||
|
||||
This was also fixed in upstream LLVM:
|
||||
https://github.com/llvm/llvm-project/commit/602ab248335e1540e82667e74fea44b7f042e112
|
||||
|
||||
Bug: 344639860
|
||||
Change-Id: I743e96fb172de867c89cad51805edf96387c04ec
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/external/github.com/microsoft/DirectXShaderCompiler/+/5631796
|
||||
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
|
||||
Reviewed-by: James Price <jrprice@google.com>
|
||||
|
||||
diff --git a/lib/Transforms/Utils/SimplifyCFG.cpp b/lib/Transforms/Utils/SimplifyCFG.cpp
|
||||
index 0d3ba1e00719060c1e71fa238726f0c63bd5b32f..5b364856928af6aab007e958b24f1daea32cd733 100644
|
||||
--- a/lib/Transforms/Utils/SimplifyCFG.cpp
|
||||
+++ b/lib/Transforms/Utils/SimplifyCFG.cpp
|
||||
@@ -1830,6 +1830,14 @@ static bool FoldTwoEntryPHINode(PHINode *PN, const TargetTransformInfo &TTI,
|
||||
isa<ConstantInt>(IfCond))
|
||||
return false;
|
||||
|
||||
+ // HLSL Change Begins: Patching in llvm/llvm-project@602ab24
|
||||
+ // Don't try to fold an unreachable block. For example, the phi node itself
|
||||
+ // can't be the candidate if-condition for a select that we want to form.
|
||||
+ if (auto *IfCondPhiInst = dyn_cast<PHINode>(IfCond))
|
||||
+ if (IfCondPhiInst->getParent() == BB)
|
||||
+ return false;
|
||||
+ // HLSL Change Ends.
|
||||
+
|
||||
// Okay, we found that we can merge this two-entry phi node into a select.
|
||||
// Doing so would require us to fold *all* two entry phi nodes in this block.
|
||||
// At some point this becomes non-profitable (particularly if the target
|
||||
diff --git a/tools/clang/test/DXC/Passes/SimplifyCFG/simplifycfg-uaf-phi-condition.ll b/tools/clang/test/DXC/Passes/SimplifyCFG/simplifycfg-uaf-phi-condition.ll
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..573745a819fd1b51e3163d644088738d5128d30c
|
||||
--- /dev/null
|
||||
+++ b/tools/clang/test/DXC/Passes/SimplifyCFG/simplifycfg-uaf-phi-condition.ll
|
||||
@@ -0,0 +1,263 @@
|
||||
+; RUN: %dxopt %s -hlsl-passes-resume -simplifycfg -S | FileCheck %s
|
||||
+
|
||||
+; The IR below comes from the following HLSL.
|
||||
+; Compiling this HLSL with dxc was resulting in an ASAN use-after-free in
|
||||
+; SimplifyCFG during FoldTwoEntryPHINode because it was deleting a PHI node
|
||||
+; which was itself used as the condition for the select that replaced it.
|
||||
+
|
||||
+; struct a {
|
||||
+; int b[2];
|
||||
+; };
|
||||
+;
|
||||
+; cbuffer cbuffer_c : register(b0) {
|
||||
+; uint4 c[1];
|
||||
+; };
|
||||
+;
|
||||
+; void d(inout a e, inout int f) {
|
||||
+; int n = f;
|
||||
+; int g = asint(c[0].x);
|
||||
+; int s = f;
|
||||
+; bool i = (s >= 0);
|
||||
+; int j = (s * n);
|
||||
+; bool k = (6 > g);
|
||||
+; int l = 0;
|
||||
+; bool q = (s > j);
|
||||
+; while (true) {
|
||||
+; while (true) {
|
||||
+; while (true) {
|
||||
+; if (k) {
|
||||
+; {
|
||||
+; int t[2] = e.b;
|
||||
+; t[g] = n;
|
||||
+; e.b = t;
|
||||
+; }
|
||||
+; }
|
||||
+; e.b[1] = g;
|
||||
+; e.b[0] = s;
|
||||
+; if (q) {
|
||||
+; break;
|
||||
+; }
|
||||
+; }
|
||||
+; switch(j) {
|
||||
+; case 0: {
|
||||
+; break;
|
||||
+; }
|
||||
+; case 9: {
|
||||
+; break;
|
||||
+; }
|
||||
+; default: {
|
||||
+; {
|
||||
+; int u[2] = e.b;
|
||||
+; u[g] = l;
|
||||
+; e.b = u;
|
||||
+; }
|
||||
+; break;
|
||||
+; }
|
||||
+; }
|
||||
+; {
|
||||
+; if (q) { break; }
|
||||
+; }
|
||||
+; }
|
||||
+; {
|
||||
+; int v[2] = e.b;
|
||||
+; v[g] = j;
|
||||
+; e.b = v;
|
||||
+; }
|
||||
+; if (!(i)) {
|
||||
+; break;
|
||||
+; }
|
||||
+; }
|
||||
+; }
|
||||
+;
|
||||
+; [numthreads(1, 1, 1)]
|
||||
+; void main() {
|
||||
+; int o = 0;
|
||||
+; a p = (a)0;
|
||||
+; while (true) {
|
||||
+; bool i = (o < asint(c[0].x));
|
||||
+; if (i) {
|
||||
+; bool r = !(i);
|
||||
+; if (!(r)) {
|
||||
+; return;
|
||||
+; }
|
||||
+; d(p, o);
|
||||
+; }
|
||||
+; o = (o + 1);
|
||||
+; }
|
||||
+; return;
|
||||
+; }
|
||||
+
|
||||
+; Make sure the phi node did not get deleted by simplifycfg
|
||||
+; CHECK: while.body:
|
||||
+; CHECK-NEXT: %o.0 = phi i32 [ 0, %entry ], [ %add, %if.end.6 ]
|
||||
+
|
||||
+;
|
||||
+; Buffer Definitions:
|
||||
+;
|
||||
+; cbuffer cbuffer_c
|
||||
+; {
|
||||
+;
|
||||
+; struct cbuffer_c
|
||||
+; {
|
||||
+;
|
||||
+; uint4 c[1]; ; Offset: 0
|
||||
+;
|
||||
+; } cbuffer_c; ; Offset: 0 Size: 16
|
||||
+;
|
||||
+; }
|
||||
+;
|
||||
+;
|
||||
+; Resource Bindings:
|
||||
+;
|
||||
+; Name Type Format Dim ID HLSL Bind Count
|
||||
+; ------------------------------ ---------- ------- ----------- ------- -------------- ------
|
||||
+; cbuffer_c cbuffer NA NA CB0 cb0 1
|
||||
+;
|
||||
+target datalayout = "e-m:e-p:32:32-i1:32-i8:32-i16:32-i32:32-i64:64-f16:32-f32:32-f64:64-n8:16:32:64"
|
||||
+target triple = "dxil-ms-dx"
|
||||
+
|
||||
+%cbuffer_c = type { [1 x <4 x i32>] }
|
||||
+%dx.types.Handle = type { i8* }
|
||||
+%dx.types.ResourceProperties = type { i32, i32 }
|
||||
+%dx.types.CBufRet.i32 = type { i32, i32, i32, i32 }
|
||||
+%struct.a = type { [2 x i32] }
|
||||
+
|
||||
+@cbuffer_c = external constant %cbuffer_c
|
||||
+@llvm.used = appending global [1 x i8*] [i8* bitcast (%cbuffer_c* @cbuffer_c to i8*)], section "llvm.metadata"
|
||||
+
|
||||
+; Function Attrs: nounwind
|
||||
+define void @main() #0 {
|
||||
+entry:
|
||||
+ %0 = load %cbuffer_c, %cbuffer_c* @cbuffer_c, align 4
|
||||
+ %cbuffer_c8 = call %dx.types.Handle @dx.op.createHandleForLib.cbuffer_c(i32 160, %cbuffer_c %0) ; CreateHandleForLib(Resource)
|
||||
+ %1 = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle %cbuffer_c8, %dx.types.ResourceProperties { i32 13, i32 16 }) ; AnnotateHandle(res,props) resource: CBuffer
|
||||
+ %cbuffer_c = call %dx.types.Handle @dx.op.createHandleForLib.cbuffer_c(i32 160, %cbuffer_c %0) ; CreateHandleForLib(Resource)
|
||||
+ %2 = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle %cbuffer_c, %dx.types.ResourceProperties { i32 13, i32 16 }) ; AnnotateHandle(res,props) resource: CBuffer
|
||||
+ br label %while.body, !dbg !21 ; line:69 col:3
|
||||
+
|
||||
+while.body: ; preds = %if.end.6, %entry
|
||||
+ %o.0 = phi i32 [ 0, %entry ], [ %add, %if.end.6 ]
|
||||
+ %3 = call %dx.types.CBufRet.i32 @dx.op.cbufferLoadLegacy.i32(i32 59, %dx.types.Handle %1, i32 0), !dbg !25 ; line:70 col:25 ; CBufferLoadLegacy(handle,regIndex)
|
||||
+ %4 = extractvalue %dx.types.CBufRet.i32 %3, 0, !dbg !25 ; line:70 col:25
|
||||
+ %cmp = icmp slt i32 %o.0, %4, !dbg !26 ; line:70 col:17
|
||||
+ br i1 %cmp, label %if.then, label %if.end.6, !dbg !27 ; line:71 col:9
|
||||
+
|
||||
+if.then: ; preds = %while.body
|
||||
+ br i1 %cmp, label %if.then.5, label %if.end, !dbg !28 ; line:73 col:11
|
||||
+
|
||||
+if.then.5: ; preds = %if.then
|
||||
+ ret void, !dbg !29 ; line:74 col:9
|
||||
+
|
||||
+if.end: ; preds = %if.then
|
||||
+ %5 = call %dx.types.CBufRet.i32 @dx.op.cbufferLoadLegacy.i32(i32 59, %dx.types.Handle %2, i32 0), !dbg !30 ; line:11 col:17 ; CBufferLoadLegacy(handle,regIndex)
|
||||
+ %6 = extractvalue %dx.types.CBufRet.i32 %5, 0, !dbg !30 ; line:11 col:17
|
||||
+ %cmp.i = icmp sgt i32 %o.0, -1, !dbg !33 ; line:13 col:15
|
||||
+ %mul.i = mul nsw i32 %o.0, %o.0, !dbg !34 ; line:14 col:14
|
||||
+ %cmp1.i = icmp slt i32 %6, 6, !dbg !35 ; line:15 col:15
|
||||
+ %cmp4.i = icmp sgt i32 %o.0, %mul.i, !dbg !36 ; line:17 col:15
|
||||
+ br label %while.body.10.i, !dbg !37 ; line:18 col:3
|
||||
+
|
||||
+while.body.10.i: ; preds = %while.end.27.i, %sw.epilog.i, %if.end.i, %if.end
|
||||
+ br i1 %cmp1.i, label %if.then.i, label %if.end.i, !dbg !38 ; line:21 col:13
|
||||
+
|
||||
+if.then.i: ; preds = %while.body.10.i
|
||||
+ br label %if.end.i, !dbg !39 ; line:27 col:9
|
||||
+
|
||||
+if.end.i: ; preds = %if.then.i, %while.body.10.i
|
||||
+ br i1 %cmp4.i, label %while.end.i, label %while.body.10.i, !dbg !40 ; line:30 col:13
|
||||
+
|
||||
+while.end.i: ; preds = %if.end.i
|
||||
+ switch i32 %mul.i, label %sw.default.i [
|
||||
+ i32 0, label %sw.epilog.i
|
||||
+ i32 9, label %sw.epilog.i
|
||||
+ ], !dbg !41 ; line:34 col:7
|
||||
+
|
||||
+sw.default.i: ; preds = %while.end.i
|
||||
+ br label %sw.epilog.i, !dbg !42 ; line:47 col:11
|
||||
+
|
||||
+sw.epilog.i: ; preds = %sw.default.i, %while.end.i, %while.end.i
|
||||
+ br i1 %cmp4.i, label %while.end.27.i, label %while.body.10.i, !dbg !43 ; line:51 col:13
|
||||
+
|
||||
+while.end.27.i: ; preds = %sw.epilog.i
|
||||
+ br i1 %cmp.i, label %while.body.10.i, label %if.end.6, !dbg !44 ; line:59 col:9
|
||||
+
|
||||
+if.end.6: ; preds = %while.end.27.i, %while.body
|
||||
+ %add = add nsw i32 %o.0, 1, !dbg !45 ; line:78 col:12
|
||||
+ br label %while.body, !dbg !21 ; line:69 col:3
|
||||
+}
|
||||
+
|
||||
+; Function Attrs: nounwind readnone
|
||||
+declare %dx.types.Handle @"dx.hl.createhandle..%dx.types.Handle (i32, %cbuffer_c*, i32)"(i32, %cbuffer_c*, i32) #1
|
||||
+
|
||||
+; Function Attrs: nounwind readnone
|
||||
+declare %dx.types.Handle @"dx.hl.annotatehandle..%dx.types.Handle (i32, %dx.types.Handle, %dx.types.ResourceProperties, %cbuffer_c)"(i32, %dx.types.Handle, %dx.types.ResourceProperties, %cbuffer_c) #1
|
||||
+
|
||||
+; Function Attrs: nounwind readonly
|
||||
+declare %dx.types.CBufRet.i32 @dx.op.cbufferLoadLegacy.i32(i32, %dx.types.Handle, i32) #2
|
||||
+
|
||||
+; Function Attrs: nounwind readonly
|
||||
+declare %dx.types.Handle @dx.op.createHandleForLib.cbuffer_c(i32, %cbuffer_c) #2
|
||||
+
|
||||
+; Function Attrs: nounwind readnone
|
||||
+declare %dx.types.Handle @dx.op.annotateHandle(i32, %dx.types.Handle, %dx.types.ResourceProperties) #1
|
||||
+
|
||||
+attributes #0 = { nounwind }
|
||||
+attributes #1 = { nounwind readnone }
|
||||
+attributes #2 = { nounwind readonly }
|
||||
+
|
||||
+!llvm.module.flags = !{!0}
|
||||
+!pauseresume = !{!1}
|
||||
+!llvm.ident = !{!2}
|
||||
+!dx.version = !{!3}
|
||||
+!dx.valver = !{!4}
|
||||
+!dx.shaderModel = !{!5}
|
||||
+!dx.resources = !{!6}
|
||||
+!dx.typeAnnotations = !{!9, !14}
|
||||
+!dx.entryPoints = !{!18}
|
||||
+
|
||||
+!0 = !{i32 2, !"Debug Info Version", i32 3}
|
||||
+!1 = !{!"hlsl-dxilemit", !"hlsl-dxilload"}
|
||||
+!2 = !{!"dxc(private) 1.8.0.14620 (main, 8408ae882)"}
|
||||
+!3 = !{i32 1, i32 2}
|
||||
+!4 = !{i32 1, i32 8}
|
||||
+!5 = !{!"cs", i32 6, i32 2}
|
||||
+!6 = !{null, null, !7, null}
|
||||
+!7 = !{!8}
|
||||
+!8 = !{i32 0, %cbuffer_c* @cbuffer_c, !"cbuffer_c", i32 0, i32 0, i32 1, i32 16, null}
|
||||
+!9 = !{i32 0, %struct.a undef, !10, %cbuffer_c undef, !12}
|
||||
+!10 = !{i32 20, !11}
|
||||
+!11 = !{i32 6, !"b", i32 3, i32 0, i32 7, i32 4}
|
||||
+!12 = !{i32 16, !13}
|
||||
+!13 = !{i32 6, !"c", i32 3, i32 0, i32 7, i32 5}
|
||||
+!14 = !{i32 1, void ()* @main, !15}
|
||||
+!15 = !{!16}
|
||||
+!16 = !{i32 1, !17, !17}
|
||||
+!17 = !{}
|
||||
+!18 = !{void ()* @main, !"main", null, !6, !19}
|
||||
+!19 = !{i32 4, !20}
|
||||
+!20 = !{i32 1, i32 1, i32 1}
|
||||
+!21 = !DILocation(line: 69, column: 3, scope: !22)
|
||||
+!22 = !DISubprogram(name: "main", scope: !23, file: !23, line: 66, type: !24, isLocal: false, isDefinition: true, scopeLine: 66, flags: DIFlagPrototyped, isOptimized: false, function: void ()* @main)
|
||||
+!23 = !DIFile(filename: "/usr/local/google/home/chouinard/Downloads/standalone.hlsl", directory: "")
|
||||
+!24 = !DISubroutineType(types: !17)
|
||||
+!25 = !DILocation(line: 70, column: 25, scope: !22)
|
||||
+!26 = !DILocation(line: 70, column: 17, scope: !22)
|
||||
+!27 = !DILocation(line: 71, column: 9, scope: !22)
|
||||
+!28 = !DILocation(line: 73, column: 11, scope: !22)
|
||||
+!29 = !DILocation(line: 74, column: 9, scope: !22)
|
||||
+!30 = !DILocation(line: 11, column: 17, scope: !31, inlinedAt: !32)
|
||||
+!31 = !DISubprogram(name: "d", scope: !23, file: !23, line: 9, type: !24, isLocal: false, isDefinition: true, scopeLine: 9, flags: DIFlagPrototyped, isOptimized: false)
|
||||
+!32 = distinct !DILocation(line: 76, column: 7, scope: !22)
|
||||
+!33 = !DILocation(line: 13, column: 15, scope: !31, inlinedAt: !32)
|
||||
+!34 = !DILocation(line: 14, column: 14, scope: !31, inlinedAt: !32)
|
||||
+!35 = !DILocation(line: 15, column: 15, scope: !31, inlinedAt: !32)
|
||||
+!36 = !DILocation(line: 17, column: 15, scope: !31, inlinedAt: !32)
|
||||
+!37 = !DILocation(line: 18, column: 3, scope: !31, inlinedAt: !32)
|
||||
+!38 = !DILocation(line: 21, column: 13, scope: !31, inlinedAt: !32)
|
||||
+!39 = !DILocation(line: 27, column: 9, scope: !31, inlinedAt: !32)
|
||||
+!40 = !DILocation(line: 30, column: 13, scope: !31, inlinedAt: !32)
|
||||
+!41 = !DILocation(line: 34, column: 7, scope: !31, inlinedAt: !32)
|
||||
+!42 = !DILocation(line: 47, column: 11, scope: !31, inlinedAt: !32)
|
||||
+!43 = !DILocation(line: 51, column: 13, scope: !31, inlinedAt: !32)
|
||||
+!44 = !DILocation(line: 59, column: 9, scope: !31, inlinedAt: !32)
|
||||
+!45 = !DILocation(line: 78, column: 12, scope: !22)
|
||||
@@ -1,261 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: David Neto <dneto@google.com>
|
||||
Date: Tue, 16 Jul 2024 16:34:52 -0400
|
||||
Subject: Add CMake option DXC_CODEGEN_EXCEPTIONS_TRAP (#6764)
|
||||
|
||||
When enabled, any hlsl::Exception thrown during code generation and
|
||||
optimization will cause the process to trap.
|
||||
|
||||
Bug: 346618785
|
||||
Change-Id: I9ac966d339ec3090e3455d51a9d7516cc5a3f153
|
||||
|
||||
HLMatrixLower: allow exceptions to propagate out (#6710)
|
||||
|
||||
If an exception is thrown, don't block it in the TempOverloadPool
|
||||
destructor. Allow it to propagate out as a user-visible error.
|
||||
|
||||
Explicitly clear the TempOverloadPool before returning from the
|
||||
HLMatrixLowerPass::runOnModule. In the normal case, when no exception is
|
||||
thrown, that will still verify that all the overloads actually have been
|
||||
lowered, and will assert out if they aren't.
|
||||
|
||||
Bug: 346618785
|
||||
Change-Id: Id421ca324e4d799477a41abb14b966e8f39be482
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/external/github.com/microsoft/DirectXShaderCompiler/+/5715228
|
||||
Reviewed-by: Natalie Chouinard <chouinard@google.com>
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 15097b8473bf9f6c2b6c28ac095936616aa917f6..ac35ebd1a6afd55934da502ddb0e0c286da10db8 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -104,6 +104,9 @@ endif()
|
||||
option(DXC_DISABLE_ALLOCATOR_OVERRIDES "Disable usage of allocator overrides" OFF)
|
||||
mark_as_advanced(DXC_DISABLE_ALLOCATOR_OVERRIDES)
|
||||
|
||||
+option(DXC_CODEGEN_EXCEPTIONS_TRAP "An exception in code generation generates a trap, ending the compiler process" OFF)
|
||||
+mark_as_advanced(DXC_CODEGEN_EXCEPTIONS_TRAP)
|
||||
+
|
||||
# adjust link option to enable debugging from kernel mode; not compatible with incremental linking
|
||||
if(NOT CMAKE_VERSION VERSION_LESS "3.13" AND WIN32 AND NOT CMAKE_C_COMPILER_ARCHITECTURE_ID STREQUAL "ARM64EC")
|
||||
add_link_options(/DEBUGTYPE:CV,FIXUP,PDATA /INCREMENTAL:NO)
|
||||
diff --git a/include/dxc/config.h.cmake b/include/dxc/config.h.cmake
|
||||
index 6d7450323ec864ef5f6e8796c46423d49f278b76..7226ed75a108f63c3c894b59eb7e0dbc5fb66002 100644
|
||||
--- a/include/dxc/config.h.cmake
|
||||
+++ b/include/dxc/config.h.cmake
|
||||
@@ -1,2 +1,4 @@
|
||||
/* Disable overriding memory allocators. */
|
||||
#cmakedefine DXC_DISABLE_ALLOCATOR_OVERRIDES
|
||||
+/* Generate a trap if an hlsl::Exception is thrown during code generation */
|
||||
+#cmakedefine DXC_CODEGEN_EXCEPTIONS_TRAP
|
||||
diff --git a/lib/HLSL/HLMatrixLowerPass.cpp b/lib/HLSL/HLMatrixLowerPass.cpp
|
||||
index d5959eb9335465f67d8e7ef7d7ab4eb720274226..3bb9f65834ecfd0c7a25c8a176f62c124e9967e5 100644
|
||||
--- a/lib/HLSL/HLMatrixLowerPass.cpp
|
||||
+++ b/lib/HLSL/HLMatrixLowerPass.cpp
|
||||
@@ -60,7 +60,12 @@ class TempOverloadPool {
|
||||
public:
|
||||
TempOverloadPool(llvm::Module &Module, const char *BaseName)
|
||||
: Module(Module), BaseName(BaseName) {}
|
||||
- ~TempOverloadPool() { clear(); }
|
||||
+ ~TempOverloadPool() {
|
||||
+ if (!Funcs.empty()) {
|
||||
+ // The flow has thrown an exception. Let that exception
|
||||
+ // propagate out and be reported as a compile error.
|
||||
+ }
|
||||
+ }
|
||||
|
||||
Function *get(FunctionType *Ty);
|
||||
bool contains(FunctionType *Ty) const { return Funcs.count(Ty) != 0; }
|
||||
@@ -248,12 +253,15 @@ bool HLMatrixLowerPass::runOnModule(Module &M) {
|
||||
m_matToVecStubs = nullptr;
|
||||
m_vecToMatStubs = nullptr;
|
||||
|
||||
- // If you hit an assert during TempOverloadPool destruction,
|
||||
+ // If you hit an assert while clearing TempOverloadPool,
|
||||
// it means that either a matrix producer was lowered,
|
||||
// causing a translation stub to be created,
|
||||
// but the consumer of that matrix was never (properly) lowered.
|
||||
// Or the opposite: a matrix consumer was lowered and not its producer.
|
||||
|
||||
+ matToVecStubs.clear();
|
||||
+ vecToMatStubs.clear();
|
||||
+
|
||||
return true;
|
||||
}
|
||||
|
||||
diff --git a/tools/clang/lib/CodeGen/BackendUtil.cpp b/tools/clang/lib/CodeGen/BackendUtil.cpp
|
||||
index 294ca05946eed6d87a3ad4e2b56a641d24065760..1e9adb40f4bae4cada42b5581582d50dc3676594 100644
|
||||
--- a/tools/clang/lib/CodeGen/BackendUtil.cpp
|
||||
+++ b/tools/clang/lib/CodeGen/BackendUtil.cpp
|
||||
@@ -8,6 +8,10 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "clang/CodeGen/BackendUtil.h"
|
||||
+#include "dxc/HLSL/DxilGenerationPass.h" // HLSL Change
|
||||
+#include "dxc/HLSL/HLMatrixLowerPass.h" // HLSL Change
|
||||
+#include "dxc/Support/Global.h" // HLSL Change
|
||||
+#include "dxc/config.h" // HLSL Change
|
||||
#include "clang/Basic/Diagnostic.h"
|
||||
#include "clang/Basic/LangOptions.h"
|
||||
#include "clang/Basic/TargetOptions.h"
|
||||
@@ -41,10 +45,8 @@
|
||||
#include "llvm/Transforms/ObjCARC.h"
|
||||
#include "llvm/Transforms/Scalar.h"
|
||||
#include "llvm/Transforms/Utils/SymbolRewriter.h"
|
||||
+#include <cstdio>
|
||||
#include <memory>
|
||||
-#include "dxc/HLSL/DxilGenerationPass.h" // HLSL Change
|
||||
-#include "dxc/HLSL/HLMatrixLowerPass.h" // HLSL Change
|
||||
-#include "dxc/Support/Global.h" // HLSL Change
|
||||
|
||||
using namespace clang;
|
||||
using namespace llvm;
|
||||
@@ -780,6 +782,13 @@ void clang::EmitBackendOutput(DiagnosticsEngine &Diags,
|
||||
} catch (const ::hlsl::Exception &hlslException) {
|
||||
Diags.Report(Diags.getCustomDiagID(DiagnosticsEngine::Error, "%0\n"))
|
||||
<< StringRef(hlslException.what());
|
||||
+#if defined(DXC_CODEGEN_EXCEPTIONS_TRAP)
|
||||
+ // llvm::errs() doesn't work in release builds on Linux.
|
||||
+ // Use C-style fprintf because it works everywhere.
|
||||
+ fprintf(stderr, "internal codegen error: %s\n", hlslException.what());
|
||||
+ fflush(stderr);
|
||||
+ LLVM_BUILTIN_TRAP;
|
||||
+#endif
|
||||
} // HLSL Change Ends
|
||||
|
||||
// If an optional clang TargetInfo description string was passed in, use it to
|
||||
diff --git a/tools/clang/test/DXC/Passes/HLMatrixLower/dont_crash_on_invalid_cast.ll b/tools/clang/test/DXC/Passes/HLMatrixLower/dont_crash_on_invalid_cast.ll
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..fca52d11595d3ac99dedb28219f0746a26add6c9
|
||||
--- /dev/null
|
||||
+++ b/tools/clang/test/DXC/Passes/HLMatrixLower/dont_crash_on_invalid_cast.ll
|
||||
@@ -0,0 +1,130 @@
|
||||
+; RUN: not %dxopt %s -hlsl-passes-resume -hlmatrixlower -S | FileCheck %s
|
||||
+
|
||||
+
|
||||
+; The HL matrix lowering pass can sometimes throw an exception
|
||||
+; due to an invalid LLVM-level cast<Ty> call. Make sure that
|
||||
+; propagates out to a user-level error.
|
||||
+
|
||||
+; Note: There is still a bug in the compiler here. Not all matrix
|
||||
+; lowerings are covered by the pass.
|
||||
+
|
||||
+; TODO: Fix the underlying bug https://github.com/microsoft/DirectXShaderCompiler/issues/6723
|
||||
+; Once that is fixed, this test changes or should be deleted.
|
||||
+
|
||||
+
|
||||
+; CHECK: Operation failed - error code
|
||||
+
|
||||
+;
|
||||
+; Buffer Definitions:
|
||||
+;
|
||||
+; cbuffer $Globals
|
||||
+; {
|
||||
+;
|
||||
+; [0 x i8] (type annotation not present)
|
||||
+;
|
||||
+; }
|
||||
+;
|
||||
+;
|
||||
+; Resource Bindings:
|
||||
+;
|
||||
+; Name Type Format Dim ID HLSL Bind Count
|
||||
+; ------------------------------ ---------- ------- ----------- ------- -------------- ------
|
||||
+; $Globals cbuffer NA NA CB0 cb4294967295 1
|
||||
+;
|
||||
+target datalayout = "e-m:e-p:32:32-i1:32-i8:32-i16:32-i32:32-i64:64-f16:32-f32:32-f64:64-n8:16:32:64"
|
||||
+target triple = "dxil-ms-dx"
|
||||
+
|
||||
+%ConstantBuffer = type opaque
|
||||
+%class.matrix.float.2.4 = type { [2 x <4 x float>] }
|
||||
+%struct.e = type { [1 x %struct.d], [1 x %struct.d] }
|
||||
+%struct.d = type { %struct.a }
|
||||
+%struct.a = type { float, %class.matrix.float.2.4 }
|
||||
+
|
||||
+@"$Globals" = external constant %ConstantBuffer
|
||||
+@g.0.0.0 = internal global [1 x float] undef, align 4
|
||||
+@g.0.0.1 = internal global [1 x %class.matrix.float.2.4] undef, align 4
|
||||
+@g.1.0.0 = internal global [1 x float] undef, align 4
|
||||
+@g.1.0.1 = internal global [1 x %class.matrix.float.2.4] undef, align 4
|
||||
+
|
||||
+; Function Attrs: nounwind
|
||||
+define void @main() #0 {
|
||||
+entry:
|
||||
+ %h.0.1 = alloca %class.matrix.float.2.4, !dbg !26 ; line:13 col:17
|
||||
+ store float 0.000000e+00, float* getelementptr inbounds ([1 x float], [1 x float]* @g.0.0.0, i32 0, i32 0), !dbg !26 ; line:13 col:17
|
||||
+ %0 = call %class.matrix.float.2.4 @"dx.hl.init.rn.%class.matrix.float.2.4 (i32, <8 x float>)"(i32 0, <8 x float> zeroinitializer) #0, !dbg !26 ; line:13 col:17
|
||||
+ %1 = call %class.matrix.float.2.4 @"dx.hl.cast.rowMatToColMat.%class.matrix.float.2.4 (i32, %class.matrix.float.2.4)"(i32 7, %class.matrix.float.2.4 %0) #0, !dbg !26 ; line:13 col:17
|
||||
+ %2 = call %class.matrix.float.2.4 @"dx.hl.matldst.colStore.%class.matrix.float.2.4 (i32, %class.matrix.float.2.4*, %class.matrix.float.2.4)"(i32 1, %class.matrix.float.2.4* getelementptr inbounds ([1 x %class.matrix.float.2.4], [1 x %class.matrix.float.2.4]* @g.0.0.1, i32 0, i32 0), %class.matrix.float.2.4 %1) #0, !dbg !26 ; line:13 col:17
|
||||
+ store float 0.000000e+00, float* getelementptr inbounds ([1 x float], [1 x float]* @g.1.0.0, i32 0, i32 0), !dbg !26 ; line:13 col:17
|
||||
+ %3 = call %class.matrix.float.2.4 @"dx.hl.init.rn.%class.matrix.float.2.4 (i32, <8 x float>)"(i32 0, <8 x float> zeroinitializer) #0, !dbg !26 ; line:13 col:17
|
||||
+ %4 = call %class.matrix.float.2.4 @"dx.hl.cast.rowMatToColMat.%class.matrix.float.2.4 (i32, %class.matrix.float.2.4)"(i32 7, %class.matrix.float.2.4 %3) #0, !dbg !26 ; line:13 col:17
|
||||
+ %5 = call %class.matrix.float.2.4 @"dx.hl.matldst.colStore.%class.matrix.float.2.4 (i32, %class.matrix.float.2.4*, %class.matrix.float.2.4)"(i32 1, %class.matrix.float.2.4* getelementptr inbounds ([1 x %class.matrix.float.2.4], [1 x %class.matrix.float.2.4]* @g.1.0.1, i32 0, i32 0), %class.matrix.float.2.4 %4) #0, !dbg !26 ; line:13 col:17
|
||||
+ %6 = load float, float* getelementptr inbounds ([1 x float], [1 x float]* @g.1.0.0, i32 0, i32 0), !dbg !32 ; line:17 col:9
|
||||
+ %7 = getelementptr inbounds %class.matrix.float.2.4, %class.matrix.float.2.4* %h.0.1, i32 0, i32 0, i32 0, !dbg !32 ; line:17 col:9
|
||||
+ %8 = load <4 x float>, <4 x float>* getelementptr inbounds ([1 x %class.matrix.float.2.4], [1 x %class.matrix.float.2.4]* @g.1.0.1, i32 0, i32 0, i32 0, i32 0), !dbg !32 ; line:17 col:9
|
||||
+ store <4 x float> %8, <4 x float>* %7, !dbg !32 ; line:17 col:9
|
||||
+ %9 = getelementptr inbounds %class.matrix.float.2.4, %class.matrix.float.2.4* %h.0.1, i32 0, i32 0, i32 1, !dbg !32 ; line:17 col:9
|
||||
+ %10 = load <4 x float>, <4 x float>* getelementptr inbounds ([1 x %class.matrix.float.2.4], [1 x %class.matrix.float.2.4]* @g.1.0.1, i32 0, i32 0, i32 0, i32 1), !dbg !32 ; line:17 col:9
|
||||
+ store <4 x float> %10, <4 x float>* %9, !dbg !32 ; line:17 col:9
|
||||
+ ret void, !dbg !33 ; line:18 col:3
|
||||
+}
|
||||
+
|
||||
+; Function Attrs: nounwind
|
||||
+declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly, i64, i32, i1) #0
|
||||
+
|
||||
+; Function Attrs: nounwind readnone
|
||||
+declare %class.matrix.float.2.4 @"dx.hl.init.rn.%class.matrix.float.2.4 (i32, <8 x float>)"(i32, <8 x float>) #1
|
||||
+
|
||||
+; Function Attrs: nounwind readnone
|
||||
+declare %class.matrix.float.2.4 @"dx.hl.cast.rowMatToColMat.%class.matrix.float.2.4 (i32, %class.matrix.float.2.4)"(i32, %class.matrix.float.2.4) #1
|
||||
+
|
||||
+; Function Attrs: nounwind
|
||||
+declare %class.matrix.float.2.4 @"dx.hl.matldst.colStore.%class.matrix.float.2.4 (i32, %class.matrix.float.2.4*, %class.matrix.float.2.4)"(i32, %class.matrix.float.2.4*, %class.matrix.float.2.4) #0
|
||||
+
|
||||
+attributes #0 = { nounwind }
|
||||
+attributes #1 = { nounwind readnone }
|
||||
+
|
||||
+!llvm.module.flags = !{!0}
|
||||
+!pauseresume = !{!1}
|
||||
+!llvm.ident = !{!2}
|
||||
+!dx.version = !{!3}
|
||||
+!dx.valver = !{!4}
|
||||
+!dx.shaderModel = !{!5}
|
||||
+!dx.typeAnnotations = !{!6, !15}
|
||||
+!dx.entryPoints = !{!19}
|
||||
+!dx.fnprops = !{!23}
|
||||
+!dx.options = !{!24, !25}
|
||||
+
|
||||
+!0 = !{i32 2, !"Debug Info Version", i32 3}
|
||||
+!1 = !{!"hlsl-hlemit", !"hlsl-hlensure"}
|
||||
+!2 = !{!"dxc(private) 1.8.0.4640 (issue-785, 45018c752d)"}
|
||||
+!3 = !{i32 1, i32 0}
|
||||
+!4 = !{i32 1, i32 8}
|
||||
+!5 = !{!"cs", i32 6, i32 0}
|
||||
+!6 = !{i32 0, %struct.e undef, !7, %struct.d undef, !10, %struct.a undef, !11}
|
||||
+!7 = !{i32 152, !8, !9}
|
||||
+!8 = !{i32 6, !"c", i32 3, i32 0}
|
||||
+!9 = !{i32 6, !"f", i32 3, i32 80}
|
||||
+!10 = !{i32 72, !8}
|
||||
+!11 = !{i32 72, !12, !13}
|
||||
+!12 = !{i32 6, !"b", i32 3, i32 0, i32 7, i32 9}
|
||||
+!13 = !{i32 6, !"c", i32 2, !14, i32 3, i32 16, i32 7, i32 9}
|
||||
+!14 = !{i32 2, i32 4, i32 2}
|
||||
+!15 = !{i32 1, void ()* @main, !16}
|
||||
+!16 = !{!17}
|
||||
+!17 = !{i32 1, !18, !18}
|
||||
+!18 = !{}
|
||||
+!19 = !{void ()* @main, !"main", null, !20, null}
|
||||
+!20 = !{null, null, !21, null}
|
||||
+!21 = !{!22}
|
||||
+!22 = !{i32 0, %ConstantBuffer* @"$Globals", !"$Globals", i32 0, i32 -1, i32 1, i32 0, null}
|
||||
+!23 = !{void ()* @main, i32 5, i32 1, i32 1, i32 1}
|
||||
+!24 = !{i32 64}
|
||||
+!25 = !{i32 -1}
|
||||
+!26 = !DILocation(line: 13, column: 17, scope: !27, inlinedAt: !30)
|
||||
+!27 = !DISubprogram(name: "??__Eg@@YAXXZ", scope: !28, file: !28, line: 13, type: !29, isLocal: true, isDefinition: true, scopeLine: 13, flags: DIFlagPrototyped, isOptimized: false)
|
||||
+!28 = !DIFile(filename: "a.hlsl", directory: "")
|
||||
+!29 = !DISubroutineType(types: !18)
|
||||
+!30 = distinct !DILocation(line: 16, scope: !31)
|
||||
+!31 = !DISubprogram(name: "main", scope: !28, file: !28, line: 16, type: !29, isLocal: false, isDefinition: true, scopeLine: 16, flags: DIFlagPrototyped, isOptimized: false, function: void ()* @main)
|
||||
+!32 = !DILocation(line: 17, column: 9, scope: !31)
|
||||
+!33 = !DILocation(line: 18, column: 3, scope: !31)
|
||||
@@ -1,231 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Antonio Maiorano <amaiorano@google.com>
|
||||
Date: Thu, 20 Jun 2024 15:39:00 -0400
|
||||
Subject: Fix instcombine overflow check inserting inst at wrong place (#6679)
|
||||
|
||||
When optimizing an overflow check of an add followed by a compare, the
|
||||
new instruction was being inserted at the compare, and the add removed.
|
||||
This produced invalid IR in cases where there were other uses of the
|
||||
former add between it and the compare. This fix makes sure to insert the
|
||||
new instruction at the old add location, rather than at the compare.
|
||||
|
||||
Note that this was also fixed in LLVM:
|
||||
|
||||
https://github.com/llvm/llvm-project/commit/6f5dca70ed1c030957a45ad91bd295921f17b18d
|
||||
|
||||
Bug: chromium:342545100
|
||||
Change-Id: Iecf758e4465b32371266bbe9879790328f363322
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/external/github.com/microsoft/DirectXShaderCompiler/+/5644335
|
||||
Reviewed-by: dan sinclair <dsinclair@google.com>
|
||||
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
|
||||
|
||||
diff --git a/lib/Transforms/InstCombine/InstCombineCompares.cpp b/lib/Transforms/InstCombine/InstCombineCompares.cpp
|
||||
index 7274304b3de7b110a4fa3a5123ea7215d99935ef..82e7e49003e65846c84e3df2801453fb463aa23e 100644
|
||||
--- a/lib/Transforms/InstCombine/InstCombineCompares.cpp
|
||||
+++ b/lib/Transforms/InstCombine/InstCombineCompares.cpp
|
||||
@@ -2145,6 +2145,12 @@ bool InstCombiner::OptimizeOverflowCheck(OverflowCheckFlavor OCF, Value *LHS,
|
||||
return true;
|
||||
};
|
||||
|
||||
+ // If the overflow check was an add followed by a compare, the insertion point
|
||||
+ // may be pointing to the compare. We want to insert the new instructions
|
||||
+ // before the add in case there are uses of the add between the add and the
|
||||
+ // compare.
|
||||
+ Builder->SetInsertPoint(&OrigI);
|
||||
+
|
||||
switch (OCF) {
|
||||
case OCF_INVALID:
|
||||
llvm_unreachable("bad overflow check kind!");
|
||||
diff --git a/tools/clang/test/DXC/Passes/InstructionCombining/instcombine-opt-overflow-check-inserts-at-add.ll b/tools/clang/test/DXC/Passes/InstructionCombining/instcombine-opt-overflow-check-inserts-at-add.ll
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..70efa00c91c6523867980de0fb9f69c7fcfb318c
|
||||
--- /dev/null
|
||||
+++ b/tools/clang/test/DXC/Passes/InstructionCombining/instcombine-opt-overflow-check-inserts-at-add.ll
|
||||
@@ -0,0 +1,187 @@
|
||||
+; RUN: %dxopt %s -hlsl-passes-resume -instcombine,NoSink=0 -S | FileCheck %s
|
||||
+
|
||||
+; Generated from the following HLSL:
|
||||
+; cbuffer cbuffer_g : register(b0) {
|
||||
+; uint4 g[1];
|
||||
+; };
|
||||
+;
|
||||
+; [numthreads(1, 1, 1)]
|
||||
+; void main() {
|
||||
+; uint a = 2147483648u;
|
||||
+; uint b = (g[0].x | 2651317025u);
|
||||
+; uint c = (b + 2651317025u);
|
||||
+; while (true) {
|
||||
+; bool d = (a > c);
|
||||
+; if (d) {
|
||||
+; break;
|
||||
+; } else {
|
||||
+; while (true) {
|
||||
+; if (!d) {
|
||||
+; return;
|
||||
+; }
|
||||
+; a = b;
|
||||
+; bool e = (d ? d : d);
|
||||
+; if (e) {
|
||||
+; break;
|
||||
+; }
|
||||
+; }
|
||||
+; }
|
||||
+; }
|
||||
+; }
|
||||
+;
|
||||
+; Compiling this was resulting in invalid IR being produced from instcombine.
|
||||
+; Specifically, when optimizing an overflow check of an add followed by a compare,
|
||||
+; the new instruction was being inserted at the compare, and the add removed. This
|
||||
+; broke in cases like this one, where there were other uses of the former add between
|
||||
+; it and the compare. The fix was to make sure to insert the new instruction
|
||||
+; (another add in this case) at the old add rather than at the compare.
|
||||
+
|
||||
+; Make sure the new %add is still in the entry block before its uses.
|
||||
+; CHECK-LABEL: entry
|
||||
+; CHECK: %add = add i32 %or, -1643650271
|
||||
+; CHECK-NEXT: %cmp.2 = icmp sgt i32 %add, -1,
|
||||
+;
|
||||
+; Make sure the new %add is NOT in the loopexit where %cmp was optimized.
|
||||
+; CHECK-LABEL: while.body.loopexit
|
||||
+; CHECK-NEXT: br i1 false, label %if.end.preheader, label %while.end.14
|
||||
+
|
||||
+;
|
||||
+; Buffer Definitions:
|
||||
+;
|
||||
+; cbuffer cbuffer_g
|
||||
+; {
|
||||
+;
|
||||
+; struct cbuffer_g
|
||||
+; {
|
||||
+;
|
||||
+; uint4 g[1]; ; Offset: 0
|
||||
+;
|
||||
+; } cbuffer_g; ; Offset: 0 Size: 16
|
||||
+;
|
||||
+; }
|
||||
+;
|
||||
+;
|
||||
+; Resource Bindings:
|
||||
+;
|
||||
+; Name Type Format Dim ID HLSL Bind Count
|
||||
+; ------------------------------ ---------- ------- ----------- ------- -------------- ------
|
||||
+; cbuffer_g cbuffer NA NA CB0 cb0 1
|
||||
+;
|
||||
+target datalayout = "e-m:e-p:32:32-i1:32-i8:32-i16:32-i32:32-i64:64-f16:32-f32:32-f64:64-n8:16:32:64"
|
||||
+target triple = "dxil-ms-dx"
|
||||
+
|
||||
+%cbuffer_g = type { [1 x <4 x i32>] }
|
||||
+%dx.types.Handle = type { i8* }
|
||||
+%dx.types.ResourceProperties = type { i32, i32 }
|
||||
+%dx.types.CBufRet.i32 = type { i32, i32, i32, i32 }
|
||||
+
|
||||
+@cbuffer_g = external constant %cbuffer_g
|
||||
+@llvm.used = appending global [1 x i8*] [i8* bitcast (%cbuffer_g* @cbuffer_g to i8*)], section "llvm.metadata"
|
||||
+
|
||||
+; Function Attrs: nounwind
|
||||
+define void @main() #0 {
|
||||
+entry:
|
||||
+ %0 = load %cbuffer_g, %cbuffer_g* @cbuffer_g
|
||||
+ %cbuffer_g = call %dx.types.Handle @dx.op.createHandleForLib.cbuffer_g(i32 160, %cbuffer_g %0) ; CreateHandleForLib(Resource)
|
||||
+ %1 = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle %cbuffer_g, %dx.types.ResourceProperties { i32 13, i32 16 }) ; AnnotateHandle(res,props) resource: CBuffer
|
||||
+ %2 = call %dx.types.CBufRet.i32 @dx.op.cbufferLoadLegacy.i32(i32 59, %dx.types.Handle %1, i32 0), !dbg !19 ; line:8 col:13 ; CBufferLoadLegacy(handle,regIndex)
|
||||
+ %3 = extractvalue %dx.types.CBufRet.i32 %2, 0, !dbg !19 ; line:8 col:13
|
||||
+ %or = or i32 %3, -1643650271, !dbg !23 ; line:8 col:20
|
||||
+ %add = add i32 %or, -1643650271, !dbg !24 ; line:9 col:15
|
||||
+ %cmp.2 = icmp ugt i32 -2147483648, %add, !dbg !25 ; line:11 col:17
|
||||
+ %frombool.3 = zext i1 %cmp.2 to i32, !dbg !26 ; line:11 col:10
|
||||
+ %tobool1.4 = icmp eq i32 %frombool.3, 0, !dbg !27 ; line:12 col:9
|
||||
+ %or.cond.6 = and i1 %tobool1.4, %cmp.2, !dbg !27 ; line:12 col:9
|
||||
+ br i1 %or.cond.6, label %if.end.preheader, label %while.end.14, !dbg !27 ; line:12 col:9
|
||||
+
|
||||
+while.body.loopexit: ; preds = %if.end
|
||||
+ %cmp = icmp ugt i32 %or, %add, !dbg !25 ; line:11 col:17
|
||||
+ %frombool = zext i1 %cmp to i32, !dbg !26 ; line:11 col:10
|
||||
+ %tobool1 = icmp eq i32 %frombool, 0, !dbg !27 ; line:12 col:9
|
||||
+ %or.cond = and i1 %tobool1, %cmp, !dbg !27 ; line:12 col:9
|
||||
+ br i1 %or.cond, label %if.end.preheader, label %while.end.14, !dbg !27 ; line:12 col:9
|
||||
+
|
||||
+if.end.preheader: ; preds = %entry, %while.body.loopexit
|
||||
+ %d.0 = phi i32 [ %frombool, %while.body.loopexit ], [ %frombool.3, %entry ]
|
||||
+ br label %if.end, !dbg !28 ; line:19 col:13
|
||||
+
|
||||
+while.body.3: ; preds = %if.end
|
||||
+ %tobool4.old = icmp ne i32 %d.0, 0, !dbg !29 ; line:16 col:14
|
||||
+ br i1 %tobool4.old, label %if.end, label %while.end.14, !dbg !30 ; line:16 col:13
|
||||
+
|
||||
+if.end: ; preds = %if.end.preheader, %while.body.3
|
||||
+ %tobool6 = icmp ne i32 %d.0, 0, !dbg !31 ; line:20 col:19
|
||||
+ %tobool7 = icmp ne i32 %d.0, 0, !dbg !32 ; line:20 col:23
|
||||
+ %tobool8 = icmp ne i32 %d.0, 0, !dbg !33 ; line:20 col:27
|
||||
+ %4 = select i1 %tobool6, i1 %tobool7, i1 %tobool8, !dbg !31 ; line:20 col:19
|
||||
+ br i1 %4, label %while.body.loopexit, label %while.body.3, !dbg !34 ; line:21 col:13
|
||||
+
|
||||
+while.end.14: ; preds = %while.body.loopexit, %while.body.3, %entry
|
||||
+ ret void, !dbg !35 ; line:27 col:1
|
||||
+}
|
||||
+
|
||||
+; Function Attrs: nounwind readnone
|
||||
+declare %dx.types.Handle @"dx.hl.createhandle..%dx.types.Handle (i32, %cbuffer_g*, i32)"(i32, %cbuffer_g*, i32) #1
|
||||
+
|
||||
+; Function Attrs: nounwind readnone
|
||||
+declare %dx.types.Handle @"dx.hl.annotatehandle..%dx.types.Handle (i32, %dx.types.Handle, %dx.types.ResourceProperties, %cbuffer_g)"(i32, %dx.types.Handle, %dx.types.ResourceProperties, %cbuffer_g) #1
|
||||
+
|
||||
+; Function Attrs: nounwind readonly
|
||||
+declare %dx.types.CBufRet.i32 @dx.op.cbufferLoadLegacy.i32(i32, %dx.types.Handle, i32) #2
|
||||
+
|
||||
+; Function Attrs: nounwind readonly
|
||||
+declare %dx.types.Handle @dx.op.createHandleForLib.cbuffer_g(i32, %cbuffer_g) #2
|
||||
+
|
||||
+; Function Attrs: nounwind readnone
|
||||
+declare %dx.types.Handle @dx.op.annotateHandle(i32, %dx.types.Handle, %dx.types.ResourceProperties) #1
|
||||
+
|
||||
+attributes #0 = { nounwind }
|
||||
+attributes #1 = { nounwind readnone }
|
||||
+attributes #2 = { nounwind readonly }
|
||||
+
|
||||
+!llvm.module.flags = !{!0}
|
||||
+!pauseresume = !{!1}
|
||||
+!llvm.ident = !{!2}
|
||||
+!dx.version = !{!3}
|
||||
+!dx.valver = !{!4}
|
||||
+!dx.shaderModel = !{!5}
|
||||
+!dx.resources = !{!6}
|
||||
+!dx.typeAnnotations = !{!9, !12}
|
||||
+!dx.entryPoints = !{!16}
|
||||
+
|
||||
+!0 = !{i32 2, !"Debug Info Version", i32 3}
|
||||
+!1 = !{!"hlsl-dxilemit", !"hlsl-dxilload"}
|
||||
+!2 = !{!"dxc(private) 1.8.0.4514 (d9bd2a706-dirty)"}
|
||||
+!3 = !{i32 1, i32 0}
|
||||
+!4 = !{i32 1, i32 8}
|
||||
+!5 = !{!"cs", i32 6, i32 0}
|
||||
+!6 = !{null, null, !7, null}
|
||||
+!7 = !{!8}
|
||||
+!8 = !{i32 0, %cbuffer_g* @cbuffer_g, !"cbuffer_g", i32 0, i32 0, i32 1, i32 16, null}
|
||||
+!9 = !{i32 0, %cbuffer_g undef, !10}
|
||||
+!10 = !{i32 16, !11}
|
||||
+!11 = !{i32 6, !"g", i32 3, i32 0, i32 7, i32 5}
|
||||
+!12 = !{i32 1, void ()* @main, !13}
|
||||
+!13 = !{!14}
|
||||
+!14 = !{i32 1, !15, !15}
|
||||
+!15 = !{}
|
||||
+!16 = !{void ()* @main, !"main", null, !6, !17}
|
||||
+!17 = !{i32 4, !18}
|
||||
+!18 = !{i32 1, i32 1, i32 1}
|
||||
+!19 = !DILocation(line: 8, column: 13, scope: !20)
|
||||
+!20 = !DISubprogram(name: "main", scope: !21, file: !21, line: 6, type: !22, isLocal: false, isDefinition: true, scopeLine: 6, flags: DIFlagPrototyped, isOptimized: false, function: void ()* @main)
|
||||
+!21 = !DIFile(filename: "/mnt/c/Users/amaiorano/Downloads/342545100/standalone_reduced.hlsl", directory: "")
|
||||
+!22 = !DISubroutineType(types: !15)
|
||||
+!23 = !DILocation(line: 8, column: 20, scope: !20)
|
||||
+!24 = !DILocation(line: 9, column: 15, scope: !20)
|
||||
+!25 = !DILocation(line: 11, column: 17, scope: !20)
|
||||
+!26 = !DILocation(line: 11, column: 10, scope: !20)
|
||||
+!27 = !DILocation(line: 12, column: 9, scope: !20)
|
||||
+!28 = !DILocation(line: 19, column: 13, scope: !20)
|
||||
+!29 = !DILocation(line: 16, column: 14, scope: !20)
|
||||
+!30 = !DILocation(line: 16, column: 13, scope: !20)
|
||||
+!31 = !DILocation(line: 20, column: 19, scope: !20)
|
||||
+!32 = !DILocation(line: 20, column: 23, scope: !20)
|
||||
+!33 = !DILocation(line: 20, column: 27, scope: !20)
|
||||
+!34 = !DILocation(line: 21, column: 13, scope: !20)
|
||||
+!35 = !DILocation(line: 27, column: 1, scope: !20)
|
||||
@@ -1,294 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Natalie Chouinard <chouinard@google.com>
|
||||
Date: Mon, 10 Jun 2024 18:21:40 +0000
|
||||
Subject: Fix LoopDeletion incorrectly updating PHI with multiple duplicate
|
||||
inputs (#6643)
|
||||
|
||||
LoopDeletion was incorrectly updating PHI nodes in the target block when
|
||||
it had duplicate input edges. This happens, for example, when deleting a
|
||||
loop that uses a switch with multiple cases that exit the same way.
|
||||
|
||||
After determining that this was the bug, I found this fix in LLVM:
|
||||
https://reviews.llvm.org/D34516 and applied it here.
|
||||
|
||||
Bug: 340196361
|
||||
Change-Id: I98b150bb9a164466eb84dd3d46f720d5d92ef909
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/external/github.com/microsoft/DirectXShaderCompiler/+/5616791
|
||||
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
|
||||
Reviewed-by: dan sinclair <dsinclair@chromium.org>
|
||||
|
||||
diff --git a/lib/Transforms/Scalar/LoopDeletion.cpp b/lib/Transforms/Scalar/LoopDeletion.cpp
|
||||
index 6c2c1d60548f5a8a7939fee70728e8a34572b648..6cd1fba7c085b6d61dcb23b073358fc4c798e099 100644
|
||||
--- a/lib/Transforms/Scalar/LoopDeletion.cpp
|
||||
+++ b/lib/Transforms/Scalar/LoopDeletion.cpp
|
||||
@@ -195,15 +195,29 @@ bool LoopDeletion::runOnLoop(Loop *L, LPPassManager &LPM) {
|
||||
|
||||
// Rewrite phis in the exit block to get their inputs from
|
||||
// the preheader instead of the exiting block.
|
||||
- BasicBlock *exitingBlock = exitingBlocks[0];
|
||||
BasicBlock::iterator BI = exitBlock->begin();
|
||||
while (PHINode *P = dyn_cast<PHINode>(BI)) {
|
||||
- int j = P->getBasicBlockIndex(exitingBlock);
|
||||
- assert(j >= 0 && "Can't find exiting block in exit block's phi node!");
|
||||
- P->setIncomingBlock(j, preheader);
|
||||
- for (unsigned i = 1; i < exitingBlocks.size(); ++i)
|
||||
- P->removeIncomingValue(exitingBlocks[i]);
|
||||
+ // HLSL Change begin - apply https://reviews.llvm.org/D34516
|
||||
+ // Set the zero'th element of Phi to be from the preheader and remove all
|
||||
+ // other incoming values. Given the loop has dedicated exits, all other
|
||||
+ // incoming values must be from the exiting blocks.
|
||||
+ int PredIndex = 0;
|
||||
+ P->setIncomingBlock(PredIndex, preheader);
|
||||
+ // Removes all incoming values from all other exiting blocks (including
|
||||
+ // duplicate values from an exiting block).
|
||||
+ // Nuke all entries except the zero'th entry which is the preheader entry.
|
||||
+ // NOTE! We need to remove Incoming Values in the reverse order as done
|
||||
+ // below, to keep the indices valid for deletion (removeIncomingValues
|
||||
+ // updates getNumIncomingValues and shifts all values down into the operand
|
||||
+ // being deleted).
|
||||
+ for (unsigned i = 0, e = P->getNumIncomingValues() - 1; i != e; ++i)
|
||||
+ P->removeIncomingValue(e - i, false);
|
||||
+
|
||||
+ assert((P->getNumIncomingValues() == 1 &&
|
||||
+ P->getIncomingBlock(PredIndex) == preheader) &&
|
||||
+ "Should have exactly one value and that's from the preheader!");
|
||||
++BI;
|
||||
+ // HLSL Change end
|
||||
}
|
||||
|
||||
// Update the dominator tree and remove the instructions and blocks that will
|
||||
diff --git a/tools/clang/test/DXC/Passes/DxilLoopDeletion/dxil-loop-deletion-phi-with-duplicate-preds.ll b/tools/clang/test/DXC/Passes/DxilLoopDeletion/dxil-loop-deletion-phi-with-duplicate-preds.ll
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..62736bf2934a5db67ee75386431498f49e101f49
|
||||
--- /dev/null
|
||||
+++ b/tools/clang/test/DXC/Passes/DxilLoopDeletion/dxil-loop-deletion-phi-with-duplicate-preds.ll
|
||||
@@ -0,0 +1,229 @@
|
||||
+; RUN: %dxopt %s -hlsl-passes-resume -dxil-loop-deletion,NoSink=0 -S | FileCheck %s
|
||||
+
|
||||
+; This test was generated from the following HLSL:
|
||||
+;
|
||||
+; cbuffer cbuffer_g : register(b0) {
|
||||
+; uint4 gu4[1];
|
||||
+; };
|
||||
+;
|
||||
+; float4 f() {
|
||||
+; float4 r = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
+; int i = 0;
|
||||
+; int j = 0;
|
||||
+; while (true) {
|
||||
+; float a = asfloat(gu4[0].y);
|
||||
+; int ai = int(a);
|
||||
+; bool b = (j < ai);
|
||||
+; if (j >= ai) {
|
||||
+; break;
|
||||
+; }
|
||||
+; bool c = (i > 0);
|
||||
+; if (c) {
|
||||
+; break;
|
||||
+; } else {
|
||||
+; bool3 b3 = bool3(b.xxx);
|
||||
+; if (b3[i]) {
|
||||
+; switch(i) {
|
||||
+; case 0: return r;
|
||||
+; case -1: return r;
|
||||
+; }
|
||||
+; if (c) {
|
||||
+; break;
|
||||
+; }
|
||||
+; } else {
|
||||
+; r = float4(0.0f, 0.0f, 0.0f, a);
|
||||
+; }
|
||||
+; }
|
||||
+; i = j;
|
||||
+; j = (j + 1);
|
||||
+; }
|
||||
+; r = (0.0f).xxxx;
|
||||
+; return r;
|
||||
+; }
|
||||
+;
|
||||
+; struct return_val {
|
||||
+; float4 value : SV_Target0;
|
||||
+; };
|
||||
+;
|
||||
+; return_val main() {
|
||||
+; float4 inner_result = f();
|
||||
+; return_val wrapper_result = (return_val)0;
|
||||
+; wrapper_result.value = inner_result;
|
||||
+; return wrapper_result;
|
||||
+; }
|
||||
+;
|
||||
+; When compiling the above with dxc, ASAN reported a use-after-free in simplifycfg,
|
||||
+; which originated from a delete during the dxil-loop-deletion pass. This was due
|
||||
+; to a bug in LoopDeletion::runOnLoop that did not properly handle updated PHIs
|
||||
+; with duplicate input preds. After this test runs, the loop should be deleted,
|
||||
+; and the program optimized to simply write out 0s to the cbuffer.
|
||||
+
|
||||
+; CHECK: define void @main
|
||||
+; CHECK-NEXT: entry:
|
||||
+; CHECK-NEXT: call void @dx.op.storeOutput.f32(i32 5, i32 0, i32 0, i8 0, float 0.000000e+00)
|
||||
+; CHECK-NEXT: call void @dx.op.storeOutput.f32(i32 5, i32 0, i32 0, i8 1, float 0.000000e+00)
|
||||
+; CHECK-NEXT: call void @dx.op.storeOutput.f32(i32 5, i32 0, i32 0, i8 2, float 0.000000e+00)
|
||||
+; CHECK-NEXT: call void @dx.op.storeOutput.f32(i32 5, i32 0, i32 0, i8 3, float 0.000000e+00)
|
||||
+; CHECK-NEXT: ret void
|
||||
+
|
||||
+;
|
||||
+; Output signature:
|
||||
+;
|
||||
+; Name Index InterpMode DynIdx
|
||||
+; -------------------- ----- ---------------------- ------
|
||||
+; SV_Target 0
|
||||
+;
|
||||
+; Buffer Definitions:
|
||||
+;
|
||||
+; cbuffer cbuffer_g
|
||||
+; {
|
||||
+;
|
||||
+; struct cbuffer_g
|
||||
+; {
|
||||
+;
|
||||
+; uint4 gu4[1]; ; Offset: 0
|
||||
+;
|
||||
+; } cbuffer_g; ; Offset: 0 Size: 16
|
||||
+;
|
||||
+; }
|
||||
+;
|
||||
+;
|
||||
+; Resource Bindings:
|
||||
+;
|
||||
+; Name Type Format Dim ID HLSL Bind Count
|
||||
+; ------------------------------ ---------- ------- ----------- ------- -------------- ------
|
||||
+; cbuffer_g cbuffer NA NA CB0 cb0 1
|
||||
+;
|
||||
+target datalayout = "e-m:e-p:32:32-i1:32-i8:32-i16:32-i32:32-i64:64-f16:32-f32:32-f64:64-n8:16:32:64"
|
||||
+target triple = "dxil-ms-dx"
|
||||
+
|
||||
+%cbuffer_g = type { [1 x <4 x i32>] }
|
||||
+%dx.types.Handle = type { i8* }
|
||||
+%dx.types.ResourceProperties = type { i32, i32 }
|
||||
+%dx.types.CBufRet.i32 = type { i32, i32, i32, i32 }
|
||||
+%struct.return_val = type { <4 x float> }
|
||||
+
|
||||
+@cbuffer_g = external constant %cbuffer_g
|
||||
+@.hca = internal unnamed_addr constant [3 x i32] [i32 1, i32 1, i32 1]
|
||||
+@llvm.used = appending global [1 x i8*] [i8* bitcast (%cbuffer_g* @cbuffer_g to i8*)], section "llvm.metadata"
|
||||
+
|
||||
+; Function Attrs: nounwind readnone
|
||||
+declare %dx.types.Handle @"dx.hl.createhandle..%dx.types.Handle (i32, %cbuffer_g*, i32)"(i32, %cbuffer_g*, i32) #0
|
||||
+
|
||||
+; Function Attrs: nounwind readnone
|
||||
+declare %dx.types.Handle @"dx.hl.annotatehandle..%dx.types.Handle (i32, %dx.types.Handle, %dx.types.ResourceProperties, %cbuffer_g)"(i32, %dx.types.Handle, %dx.types.ResourceProperties, %cbuffer_g) #0
|
||||
+
|
||||
+; Function Attrs: nounwind
|
||||
+define void @main(<4 x float>* noalias nocapture readnone) #1 {
|
||||
+entry:
|
||||
+ %1 = load %cbuffer_g, %cbuffer_g* @cbuffer_g, align 4, !dbg !25 ; line:45 col:25
|
||||
+ %cbuffer_g = call %dx.types.Handle @dx.op.createHandleForLib.cbuffer_g(i32 160, %cbuffer_g %1), !dbg !25 ; line:45 col:25 ; CreateHandleForLib(Resource)
|
||||
+ %2 = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle %cbuffer_g, %dx.types.ResourceProperties { i32 13, i32 16 }), !dbg !25 ; line:45 col:25 ; AnnotateHandle(res,props) resource: CBuffer
|
||||
+ %3 = call %dx.types.CBufRet.i32 @dx.op.cbufferLoadLegacy.i32(i32 59, %dx.types.Handle %2, i32 0), !dbg !29 ; line:10 col:23 ; CBufferLoadLegacy(handle,regIndex)
|
||||
+ %4 = extractvalue %dx.types.CBufRet.i32 %3, 1, !dbg !29 ; line:10 col:23
|
||||
+ %5 = bitcast i32 %4 to float, !dbg !32 ; line:10 col:15
|
||||
+ %conv.i.6 = fptosi float %5 to i32, !dbg !33 ; line:11 col:18
|
||||
+ %cmp1.i.8 = icmp sgt i32 %conv.i.6, 0, !dbg !34 ; line:13 col:11
|
||||
+ br i1 %cmp1.i.8, label %if.end.i, label %"\01?f@@YA?AV?$vector@M$03@@XZ.exit", !dbg !35 ; line:13 col:9
|
||||
+
|
||||
+if.end.i: ; preds = %entry, %if.end.19.i
|
||||
+ %6 = phi float [ %9, %if.end.19.i ], [ %5, %entry ]
|
||||
+ %j.i.011 = phi i32 [ %add.i, %if.end.19.i ], [ 0, %entry ]
|
||||
+ %r.i.0.i310 = phi float [ %r.i.0.i310, %if.end.19.i ], [ 0.000000e+00, %entry ]
|
||||
+ %i.i.09 = phi i32 [ %j.i.011, %if.end.19.i ], [ 0, %entry ]
|
||||
+ %cmp4.i = icmp sgt i32 %i.i.09, 0, !dbg !36 ; line:16 col:17
|
||||
+ br i1 %cmp4.i, label %"\01?f@@YA?AV?$vector@M$03@@XZ.exit", label %if.then.12.i, !dbg !37 ; line:17 col:9
|
||||
+
|
||||
+if.then.12.i: ; preds = %if.end.i
|
||||
+ switch i32 %i.i.09, label %if.end.19.i [
|
||||
+ i32 0, label %"\01?f@@YA?AV?$vector@M$03@@XZ.exit"
|
||||
+ i32 -1, label %"\01?f@@YA?AV?$vector@M$03@@XZ.exit"
|
||||
+ ], !dbg !38 ; line:22 col:9
|
||||
+
|
||||
+if.end.19.i: ; preds = %if.then.12.i
|
||||
+ %add.i = add nuw nsw i32 %j.i.011, 1, !dbg !39 ; line:34 col:12
|
||||
+ %7 = call %dx.types.CBufRet.i32 @dx.op.cbufferLoadLegacy.i32(i32 59, %dx.types.Handle %2, i32 0), !dbg !29 ; line:10 col:23 ; CBufferLoadLegacy(handle,regIndex)
|
||||
+ %8 = extractvalue %dx.types.CBufRet.i32 %7, 1, !dbg !29 ; line:10 col:23
|
||||
+ %9 = bitcast i32 %8 to float, !dbg !32 ; line:10 col:15
|
||||
+ %conv.i = fptosi float %9 to i32, !dbg !33 ; line:11 col:18
|
||||
+ %cmp.i = icmp slt i32 %add.i, %conv.i, !dbg !40 ; line:12 col:17
|
||||
+ br i1 %cmp.i, label %if.end.i, label %"\01?f@@YA?AV?$vector@M$03@@XZ.exit", !dbg !35 ; line:13 col:9
|
||||
+
|
||||
+"\01?f@@YA?AV?$vector@M$03@@XZ.exit": ; preds = %if.then.12.i, %if.then.12.i, %if.end.i, %if.end.19.i, %entry
|
||||
+ %retval.i.0.i3 = phi float [ 0.000000e+00, %entry ], [ %r.i.0.i310, %if.then.12.i ], [ %r.i.0.i310, %if.then.12.i ], [ 0.000000e+00, %if.end.i ], [ 0.000000e+00, %if.end.19.i ]
|
||||
+ call void @dx.op.storeOutput.f32(i32 5, i32 0, i32 0, i8 0, float 0.000000e+00), !dbg !41 ; line:48 col:10 ; StoreOutput(outputSigId,rowIndex,colIndex,value)
|
||||
+ call void @dx.op.storeOutput.f32(i32 5, i32 0, i32 0, i8 1, float 0.000000e+00), !dbg !41 ; line:48 col:10 ; StoreOutput(outputSigId,rowIndex,colIndex,value)
|
||||
+ call void @dx.op.storeOutput.f32(i32 5, i32 0, i32 0, i8 2, float 0.000000e+00), !dbg !41 ; line:48 col:10 ; StoreOutput(outputSigId,rowIndex,colIndex,value)
|
||||
+ call void @dx.op.storeOutput.f32(i32 5, i32 0, i32 0, i8 3, float %retval.i.0.i3), !dbg !41 ; line:48 col:10 ; StoreOutput(outputSigId,rowIndex,colIndex,value)
|
||||
+ ret void, !dbg !42 ; line:48 col:3
|
||||
+}
|
||||
+
|
||||
+; Function Attrs: nounwind
|
||||
+declare void @dx.op.storeOutput.f32(i32, i32, i32, i8, float) #1
|
||||
+
|
||||
+; Function Attrs: nounwind readonly
|
||||
+declare %dx.types.CBufRet.i32 @dx.op.cbufferLoadLegacy.i32(i32, %dx.types.Handle, i32) #2
|
||||
+
|
||||
+; Function Attrs: nounwind readonly
|
||||
+declare %dx.types.Handle @dx.op.createHandleForLib.cbuffer_g(i32, %cbuffer_g) #2
|
||||
+
|
||||
+; Function Attrs: nounwind readnone
|
||||
+declare %dx.types.Handle @dx.op.annotateHandle(i32, %dx.types.Handle, %dx.types.ResourceProperties) #0
|
||||
+
|
||||
+attributes #0 = { nounwind readnone }
|
||||
+attributes #1 = { nounwind }
|
||||
+attributes #2 = { nounwind readonly }
|
||||
+
|
||||
+!llvm.module.flags = !{!0}
|
||||
+!pauseresume = !{!1}
|
||||
+!llvm.ident = !{!2}
|
||||
+!dx.version = !{!3}
|
||||
+!dx.valver = !{!4}
|
||||
+!dx.shaderModel = !{!5}
|
||||
+!dx.resources = !{!6}
|
||||
+!dx.typeAnnotations = !{!9, !14}
|
||||
+!dx.entryPoints = !{!21}
|
||||
+
|
||||
+!0 = !{i32 2, !"Debug Info Version", i32 3}
|
||||
+!1 = !{!"hlsl-dxilemit", !"hlsl-dxilload"}
|
||||
+!2 = !{!"dxc(private) 1.8.0.4514 (d9bd2a706-dirty)"}
|
||||
+!3 = !{i32 1, i32 5}
|
||||
+!4 = !{i32 1, i32 8}
|
||||
+!5 = !{!"ps", i32 6, i32 5}
|
||||
+!6 = !{null, null, !7, null}
|
||||
+!7 = !{!8}
|
||||
+!8 = !{i32 0, %cbuffer_g* @cbuffer_g, !"cbuffer_g", i32 0, i32 0, i32 1, i32 16, null}
|
||||
+!9 = !{i32 0, %struct.return_val undef, !10, %cbuffer_g undef, !12}
|
||||
+!10 = !{i32 16, !11}
|
||||
+!11 = !{i32 6, !"value", i32 3, i32 0, i32 4, !"SV_Target0", i32 7, i32 9}
|
||||
+!12 = !{i32 16, !13}
|
||||
+!13 = !{i32 6, !"gu4", i32 3, i32 0, i32 7, i32 5}
|
||||
+!14 = !{i32 1, void (<4 x float>*)* @main, !15}
|
||||
+!15 = !{!16, !18}
|
||||
+!16 = !{i32 0, !17, !17}
|
||||
+!17 = !{}
|
||||
+!18 = !{i32 1, !19, !20}
|
||||
+!19 = !{i32 4, !"SV_Target0", i32 7, i32 9}
|
||||
+!20 = !{i32 0}
|
||||
+!21 = !{void (<4 x float>*)* @main, !"main", !22, !6, null}
|
||||
+!22 = !{null, !23, null}
|
||||
+!23 = !{!24}
|
||||
+!24 = !{i32 0, !"SV_Target", i8 9, i8 16, !20, i8 0, i32 1, i8 4, i32 0, i8 0, null}
|
||||
+!25 = !DILocation(line: 45, column: 25, scope: !26)
|
||||
+!26 = !DISubprogram(name: "main", scope: !27, file: !27, line: 44, type: !28, isLocal: false, isDefinition: true, scopeLine: 44, flags: DIFlagPrototyped, isOptimized: false, function: void (<4 x float>*)* @main)
|
||||
+!27 = !DIFile(filename: "/mnt/c/Users/amaiorano/Downloads/340196361/standalone_reduced.hlsl", directory: "")
|
||||
+!28 = !DISubroutineType(types: !17)
|
||||
+!29 = !DILocation(line: 10, column: 23, scope: !30, inlinedAt: !31)
|
||||
+!30 = !DISubprogram(name: "f", scope: !27, file: !27, line: 5, type: !28, isLocal: false, isDefinition: true, scopeLine: 5, flags: DIFlagPrototyped, isOptimized: false)
|
||||
+!31 = distinct !DILocation(line: 45, column: 25, scope: !26)
|
||||
+!32 = !DILocation(line: 10, column: 15, scope: !30, inlinedAt: !31)
|
||||
+!33 = !DILocation(line: 11, column: 18, scope: !30, inlinedAt: !31)
|
||||
+!34 = !DILocation(line: 13, column: 11, scope: !30, inlinedAt: !31)
|
||||
+!35 = !DILocation(line: 13, column: 9, scope: !30, inlinedAt: !31)
|
||||
+!36 = !DILocation(line: 16, column: 17, scope: !30, inlinedAt: !31)
|
||||
+!37 = !DILocation(line: 17, column: 9, scope: !30, inlinedAt: !31)
|
||||
+!38 = !DILocation(line: 22, column: 9, scope: !30, inlinedAt: !31)
|
||||
+!39 = !DILocation(line: 34, column: 12, scope: !30, inlinedAt: !31)
|
||||
+!40 = !DILocation(line: 12, column: 17, scope: !30, inlinedAt: !31)
|
||||
+!41 = !DILocation(line: 48, column: 10, scope: !26)
|
||||
+!42 = !DILocation(line: 48, column: 3, scope: !26)
|
||||
@@ -1 +0,0 @@
|
||||
cherry-pick-5d4df51d1d7d.patch
|
||||
@@ -1,28 +0,0 @@
|
||||
From 5d4df51d1d7d6a290d54111527a4798f10c7ca3c Mon Sep 17 00:00:00 2001
|
||||
From: Shahbaz Youssefi <syoussefi@chromium.org>
|
||||
Date: Thu, 13 Jun 2024 16:54:03 -0400
|
||||
Subject: [PATCH] M126: Vulkan: Disable VK_EXT_shader_stencil_export on SwiftShader
|
||||
|
||||
Bug: chromium:40942995
|
||||
Change-Id: I5035d9b11997a1c7c839d7d62544fecca9fd1f73
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5634418
|
||||
Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
|
||||
---
|
||||
|
||||
diff --git a/src/libANGLE/renderer/vulkan/vk_renderer.cpp b/src/libANGLE/renderer/vulkan/vk_renderer.cpp
|
||||
index 581c84b..f818130 100644
|
||||
--- a/src/libANGLE/renderer/vulkan/vk_renderer.cpp
|
||||
+++ b/src/libANGLE/renderer/vulkan/vk_renderer.cpp
|
||||
@@ -4287,9 +4287,11 @@
|
||||
}
|
||||
#endif // defined(ANGLE_PLATFORM_ANDROID) || defined(ANGLE_PLATFORM_LINUX)
|
||||
|
||||
+ // Disabled on SwiftShader due to http://crbug.com/40942995
|
||||
ANGLE_FEATURE_CONDITION(
|
||||
&mFeatures, supportsShaderStencilExport,
|
||||
- ExtensionFound(VK_EXT_SHADER_STENCIL_EXPORT_EXTENSION_NAME, deviceExtensionNames));
|
||||
+ ExtensionFound(VK_EXT_SHADER_STENCIL_EXPORT_EXTENSION_NAME, deviceExtensionNames) &&
|
||||
+ !isSwiftShader);
|
||||
|
||||
ANGLE_FEATURE_CONDITION(
|
||||
&mFeatures, supportsRenderPassLoadStoreOpNone,
|
||||
@@ -10,7 +10,7 @@ this patch is required to provide ripemd160 support in the nodejs crypto
|
||||
module.
|
||||
|
||||
diff --git a/crypto/digest_extra/digest_extra.c b/crypto/digest_extra/digest_extra.c
|
||||
index 08ed671a8095566e6c87ea846a95c59efdd7f42b..29797fb8f69c23ac427c041d779a013b4a78c02a 100644
|
||||
index f5750354956ed9fa72d45f60ebcd7784ac0920f8..da9a93725154e661decac174491209baebab8d86 100644
|
||||
--- a/crypto/digest_extra/digest_extra.c
|
||||
+++ b/crypto/digest_extra/digest_extra.c
|
||||
@@ -85,6 +85,7 @@ static const struct nid_to_digest nid_to_digest_mapping[] = {
|
||||
|
||||
@@ -20,10 +20,10 @@ index 2ca14efae5ea478f43794a81883b00dfdb1a37b0..d73055fbf39334925ef4b4804bbaca57
|
||||
|
||||
case ssl_open_record_error:
|
||||
diff --git a/ssl/ssl_lib.cc b/ssl/ssl_lib.cc
|
||||
index 98f97ebb28a06dfde00082922a1aff24f8aa154c..8ec11f0e839760ace90bd88e096ffbd17508e224 100644
|
||||
index ec0ee893e58d49890f5545d02b533d07e362309c..b1c1a77c340e7d2c9e2ef21fcf0cc01ed6e15cc0 100644
|
||||
--- a/ssl/ssl_lib.cc
|
||||
+++ b/ssl/ssl_lib.cc
|
||||
@@ -1334,7 +1334,7 @@ int SSL_get_error(const SSL *ssl, int ret_code) {
|
||||
@@ -1340,7 +1340,7 @@ int SSL_get_error(const SSL *ssl, int ret_code) {
|
||||
}
|
||||
|
||||
if (ret_code == 0) {
|
||||
@@ -32,7 +32,7 @@ index 98f97ebb28a06dfde00082922a1aff24f8aa154c..8ec11f0e839760ace90bd88e096ffbd1
|
||||
return SSL_ERROR_ZERO_RETURN;
|
||||
}
|
||||
// An EOF was observed which violates the protocol, and the underlying
|
||||
@@ -2701,13 +2701,7 @@ void *SSL_CTX_get_ex_data(const SSL_CTX *ctx, int idx) {
|
||||
@@ -2707,13 +2707,7 @@ void *SSL_CTX_get_ex_data(const SSL_CTX *ctx, int idx) {
|
||||
return CRYPTO_get_ex_data(&ctx->ex_data, idx);
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,6 @@ allow_disabling_blink_scheduler_throttling_per_renderview.patch
|
||||
hack_plugin_response_interceptor_to_point_to_electron.patch
|
||||
feat_add_support_for_overriding_the_base_spellchecker_download_url.patch
|
||||
feat_enable_offscreen_rendering_with_viz_compositor.patch
|
||||
gpu_notify_when_dxdiag_request_fails.patch
|
||||
feat_allow_embedders_to_add_observers_on_created_hunspell.patch
|
||||
allow_in-process_windows_to_have_different_web_prefs.patch
|
||||
refactor_expose_cursor_changes_to_the_webcontentsobserver.patch
|
||||
@@ -53,7 +52,7 @@ crash_allow_setting_more_options.patch
|
||||
upload_list_add_loadsync_method.patch
|
||||
allow_setting_secondary_label_via_simplemenumodel.patch
|
||||
feat_add_streaming-protocol_registry_to_multibuffer_data_source.patch
|
||||
fix_patch_out_profile_refs_in_accessibility_ui.patch
|
||||
adjust_accessibility_ui_for_electron.patch
|
||||
skip_atk_toolchain_check.patch
|
||||
worker_feat_add_hook_to_notify_script_ready.patch
|
||||
chore_provide_iswebcontentscreationoverridden_with_full_params.patch
|
||||
@@ -83,7 +82,6 @@ fix_non-client_mouse_tracking_and_message_bubbling_on_windows.patch
|
||||
build_make_libcxx_abi_unstable_false_for_electron.patch
|
||||
introduce_ozoneplatform_electron_can_call_x11_property.patch
|
||||
make_gtk_getlibgtk_public.patch
|
||||
build_disable_print_content_analysis.patch
|
||||
custom_protocols_plzserviceworker.patch
|
||||
feat_filter_out_non-shareable_windows_in_the_current_application_in.patch
|
||||
disable_freezing_flags_after_init_in_node.patch
|
||||
@@ -114,9 +112,7 @@ fix_disabling_background_throttling_in_compositor.patch
|
||||
fix_select_the_first_menu_item_when_opened_via_keyboard.patch
|
||||
fix_return_v8_value_from_localframe_requestexecutescript.patch
|
||||
fix_harden_blink_scriptstate_maybefrom.patch
|
||||
chore_add_buildflag_guard_around_new_include.patch
|
||||
fix_use_delegated_generic_capturer_when_available.patch
|
||||
build_remove_ent_content_analysis_assert.patch
|
||||
expose_webblob_path_to_allow_embedders_to_get_file_paths.patch
|
||||
fix_move_autopipsettingshelper_behind_branding_buildflag.patch
|
||||
revert_remove_the_allowaggressivethrottlingwithwebsocket_feature.patch
|
||||
@@ -126,22 +122,12 @@ chore_remove_check_is_test_on_script_injection_tracker.patch
|
||||
fix_restore_original_resize_performance_on_macos.patch
|
||||
feat_allow_code_cache_in_custom_schemes.patch
|
||||
build_run_reclient_cfg_generator_after_chrome.patch
|
||||
fix_suppress_clang_-wimplicit-const-int-float-conversion_in.patch
|
||||
fix_getcursorscreenpoint_wrongly_returns_0_0.patch
|
||||
fix_add_support_for_skipping_first_2_no-op_refreshes_in_thumb_cap.patch
|
||||
refactor_expose_file_system_access_blocklist.patch
|
||||
cherry-pick-013961609785.patch
|
||||
partially_revert_is_newly_created_to_allow_for_browser_initiated.patch
|
||||
feat_add_support_for_missing_dialog_features_to_shell_dialogs.patch
|
||||
revert_fix_ime_prevent_tsf_hang_chromium_window_when_dpi_changed.patch
|
||||
fix_font_face_resolution_when_renderer_is_blocked.patch
|
||||
x11_use_localized_display_label_only_for_browser_process.patch
|
||||
feat_enable_passing_exit_code_on_service_process_crash.patch
|
||||
x11_use_localized_display_label_only_for_browser_process.patch
|
||||
feat_enable_customizing_symbol_color_in_framecaptionbutton.patch
|
||||
cherry-pick-44b7fbf35b10.patch
|
||||
cherry-pick-d54105311590.patch
|
||||
cherry-pick-43b8b682d05c.patch
|
||||
cherry-pick-c5dd8839bfaf.patch
|
||||
cherry-pick-38e4483e47f9.patch
|
||||
cherry-pick-1b9040817119.patch
|
||||
cherry-pick-99cafbf4b4b9.patch
|
||||
cherry-pick-d9f7652c867c.patch
|
||||
|
||||
@@ -10,10 +10,10 @@ This patch makes three changes to Accelerator::GetShortcutText to improve shortc
|
||||
3. Ctrl-Shift-= and Ctrl-Plus show up as such
|
||||
|
||||
diff --git a/ui/base/accelerators/accelerator.cc b/ui/base/accelerators/accelerator.cc
|
||||
index c33829d85745e595e3da8d9913f6e75b05e6c4a9..fa6fe3626b7c5f2b8e8ba9302780650952ecfa47 100644
|
||||
index 3094f8f1b445b639f43573af6f6b5ae5eddf7227..7c8e781cf1502bdb72ffc9f2d7ab2be684f37d5c 100644
|
||||
--- a/ui/base/accelerators/accelerator.cc
|
||||
+++ b/ui/base/accelerators/accelerator.cc
|
||||
@@ -11,6 +11,7 @@
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "base/i18n/rtl.h"
|
||||
#include "base/notreached.h"
|
||||
#include "base/strings/string_util.h"
|
||||
@@ -21,7 +21,7 @@ index c33829d85745e595e3da8d9913f6e75b05e6c4a9..fa6fe3626b7c5f2b8e8ba93027806509
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "build/build_config.h"
|
||||
#include "build/chromeos_buildflags.h"
|
||||
@@ -175,6 +176,11 @@ std::u16string Accelerator::GetShortcutText() const {
|
||||
@@ -183,6 +184,11 @@ std::u16string Accelerator::GetShortcutText() const {
|
||||
#endif
|
||||
|
||||
if (shortcut.empty()) {
|
||||
@@ -33,7 +33,7 @@ index c33829d85745e595e3da8d9913f6e75b05e6c4a9..fa6fe3626b7c5f2b8e8ba93027806509
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
// Our fallback is to try translate the key code to a regular character
|
||||
// unless it is one of digits (VK_0 to VK_9). Some keyboard
|
||||
@@ -198,6 +204,10 @@ std::u16string Accelerator::GetShortcutText() const {
|
||||
@@ -206,6 +212,10 @@ std::u16string Accelerator::GetShortcutText() const {
|
||||
shortcut +=
|
||||
static_cast<std::u16string::value_type>(base::ToUpperASCII(c));
|
||||
#endif
|
||||
@@ -44,7 +44,7 @@ index c33829d85745e595e3da8d9913f6e75b05e6c4a9..fa6fe3626b7c5f2b8e8ba93027806509
|
||||
}
|
||||
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
@@ -382,7 +392,7 @@ std::u16string Accelerator::ApplyLongFormModifiers(
|
||||
@@ -390,7 +400,7 @@ std::u16string Accelerator::ApplyLongFormModifiers(
|
||||
const std::u16string& shortcut) const {
|
||||
std::u16string result = shortcut;
|
||||
|
||||
@@ -53,7 +53,7 @@ index c33829d85745e595e3da8d9913f6e75b05e6c4a9..fa6fe3626b7c5f2b8e8ba93027806509
|
||||
result = ApplyModifierToAcceleratorString(result, IDS_APP_SHIFT_KEY);
|
||||
|
||||
// Note that we use 'else-if' in order to avoid using Ctrl+Alt as a shortcut.
|
||||
@@ -390,7 +400,7 @@ std::u16string Accelerator::ApplyLongFormModifiers(
|
||||
@@ -398,7 +408,7 @@ std::u16string Accelerator::ApplyLongFormModifiers(
|
||||
// more information.
|
||||
if (IsCtrlDown())
|
||||
result = ApplyModifierToAcceleratorString(result, IDS_APP_CTRL_KEY);
|
||||
|
||||
@@ -10,7 +10,7 @@ Allows Electron to restore WER when ELECTRON_DEFAULT_ERROR_MODE is set.
|
||||
This should be upstreamed.
|
||||
|
||||
diff --git a/content/gpu/gpu_main.cc b/content/gpu/gpu_main.cc
|
||||
index c5155af40194660e4a9dc0e5351bdf4f0886265d..c8371a3ac10af6ba57769c1a574ebe8a0c2836b4 100644
|
||||
index bb019363bf40f8f2df7815353784c357254c0132..e994a0e7bbef2f78c642486e84aa0386cab7f794 100644
|
||||
--- a/content/gpu/gpu_main.cc
|
||||
+++ b/content/gpu/gpu_main.cc
|
||||
@@ -264,6 +264,10 @@ int GpuMain(MainFunctionParams parameters) {
|
||||
@@ -24,8 +24,8 @@ index c5155af40194660e4a9dc0e5351bdf4f0886265d..c8371a3ac10af6ba57769c1a574ebe8a
|
||||
// We are experiencing what appear to be memory-stomp issues in the GPU
|
||||
// process. These issues seem to be impacting the task executor and listeners
|
||||
// registered to it. Create the task executor on the heap to guard against
|
||||
@@ -358,7 +362,6 @@ int GpuMain(MainFunctionParams parameters) {
|
||||
const_cast<base::CommandLine*>(&command_line), gpu_preferences);
|
||||
@@ -362,7 +366,6 @@ int GpuMain(MainFunctionParams parameters) {
|
||||
#endif
|
||||
const bool dead_on_arrival = !init_success;
|
||||
|
||||
- auto* client = GetContentClient()->gpu();
|
||||
|
||||
@@ -10,7 +10,7 @@ DidCreateScriptContext is called, not all JS APIs are available in the
|
||||
context, which can cause some preload scripts to trip.
|
||||
|
||||
diff --git a/content/public/renderer/render_frame_observer.h b/content/public/renderer/render_frame_observer.h
|
||||
index 289a8c25f14cad42b9178ce94b11f67870be7434..5b91eadb698eeb5a87c9d0b2edf7e5ccf952555c 100644
|
||||
index 902d84ad70adc9496f3af989465a99b6f44b077a..3ce043eea32c41130aa59ab8570a05b31fdb4de9 100644
|
||||
--- a/content/public/renderer/render_frame_observer.h
|
||||
+++ b/content/public/renderer/render_frame_observer.h
|
||||
@@ -146,6 +146,8 @@ class CONTENT_EXPORT RenderFrameObserver
|
||||
@@ -23,10 +23,10 @@ index 289a8c25f14cad42b9178ce94b11f67870be7434..5b91eadb698eeb5a87c9d0b2edf7e5cc
|
||||
int32_t world_id) {}
|
||||
virtual void DidClearWindowObject() {}
|
||||
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
|
||||
index 0ac529a0b19d0d88b57bbab89f60b888c480051e..07e7daef4c2c2cdeb09ac1522046bcf5a59b5130 100644
|
||||
index 2d7d13fc9f361bc3e4b16e4db008c042f492704a..dc96cd01365491a2384e9d27e384b680c3e86a23 100644
|
||||
--- a/content/renderer/render_frame_impl.cc
|
||||
+++ b/content/renderer/render_frame_impl.cc
|
||||
@@ -4687,6 +4687,12 @@ void RenderFrameImpl::DidCreateScriptContext(v8::Local<v8::Context> context,
|
||||
@@ -4692,6 +4692,12 @@ void RenderFrameImpl::DidCreateScriptContext(v8::Local<v8::Context> context,
|
||||
observer.DidCreateScriptContext(context, world_id);
|
||||
}
|
||||
|
||||
@@ -40,10 +40,10 @@ index 0ac529a0b19d0d88b57bbab89f60b888c480051e..07e7daef4c2c2cdeb09ac1522046bcf5
|
||||
int world_id) {
|
||||
for (auto& observer : observers_)
|
||||
diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h
|
||||
index b32fbb5887cb2719594a85a3177b5872208c1034..6f742235d7d67cc14624debb7378d873ce5ae798 100644
|
||||
index b4e2293651bb0e234aa8119c2afece5faa11a758..37af654883ec39c761cc4fcaab9d22061595d451 100644
|
||||
--- a/content/renderer/render_frame_impl.h
|
||||
+++ b/content/renderer/render_frame_impl.h
|
||||
@@ -642,6 +642,8 @@ class CONTENT_EXPORT RenderFrameImpl
|
||||
@@ -645,6 +645,8 @@ class CONTENT_EXPORT RenderFrameImpl
|
||||
void DidObserveLayoutShift(double score, bool after_input_or_scroll) override;
|
||||
void DidCreateScriptContext(v8::Local<v8::Context> context,
|
||||
int world_id) override;
|
||||
@@ -53,10 +53,10 @@ index b32fbb5887cb2719594a85a3177b5872208c1034..6f742235d7d67cc14624debb7378d873
|
||||
int world_id) override;
|
||||
void DidChangeScrollOffset() override;
|
||||
diff --git a/third_party/blink/public/web/web_local_frame_client.h b/third_party/blink/public/web/web_local_frame_client.h
|
||||
index ace1251d03266e3c5ae75c2059ba8c575725222d..37e0a30d87529e5de27fef40d8e7de0f7c27f0cd 100644
|
||||
index 2bb6e24cf5b83b8f6cf523d648307608ede1b538..1fe4df62e66fd10267e72d91176529fccabe83aa 100644
|
||||
--- a/third_party/blink/public/web/web_local_frame_client.h
|
||||
+++ b/third_party/blink/public/web/web_local_frame_client.h
|
||||
@@ -638,6 +638,9 @@ class BLINK_EXPORT WebLocalFrameClient {
|
||||
@@ -645,6 +645,9 @@ class BLINK_EXPORT WebLocalFrameClient {
|
||||
virtual void DidCreateScriptContext(v8::Local<v8::Context>,
|
||||
int32_t world_id) {}
|
||||
|
||||
@@ -67,10 +67,10 @@ index ace1251d03266e3c5ae75c2059ba8c575725222d..37e0a30d87529e5de27fef40d8e7de0f
|
||||
virtual void WillReleaseScriptContext(v8::Local<v8::Context>,
|
||||
int32_t world_id) {}
|
||||
diff --git a/third_party/blink/renderer/bindings/core/v8/local_window_proxy.cc b/third_party/blink/renderer/bindings/core/v8/local_window_proxy.cc
|
||||
index 2cb0a08954850d229e99bae66fecd4787f20a178..79894ca0d51ed61a178818b38da5c43b63a2dee6 100644
|
||||
index 50352340def787f5c6a382b622c37905ee79302c..97a79a4bfbcdd63ec01b201571fdccf2701ae40b 100644
|
||||
--- a/third_party/blink/renderer/bindings/core/v8/local_window_proxy.cc
|
||||
+++ b/third_party/blink/renderer/bindings/core/v8/local_window_proxy.cc
|
||||
@@ -213,6 +213,7 @@ void LocalWindowProxy::Initialize() {
|
||||
@@ -215,6 +215,7 @@ void LocalWindowProxy::Initialize() {
|
||||
}
|
||||
|
||||
InstallConditionalFeatures();
|
||||
@@ -79,10 +79,10 @@ index 2cb0a08954850d229e99bae66fecd4787f20a178..79894ca0d51ed61a178818b38da5c43b
|
||||
if (World().IsMainWorld()) {
|
||||
probe::DidCreateMainWorldContext(GetFrame());
|
||||
diff --git a/third_party/blink/renderer/core/frame/local_frame_client.h b/third_party/blink/renderer/core/frame/local_frame_client.h
|
||||
index 7a5d4721f7bd3012351f17053e188505f26f1979..4c415c2464fee49581efa307070ffad976b69c76 100644
|
||||
index 69c46beec12f4b5abf530c2fb836d6185ee049f9..e9c0f5c0930929a5f62a34943f7619a368c551e1 100644
|
||||
--- a/third_party/blink/renderer/core/frame/local_frame_client.h
|
||||
+++ b/third_party/blink/renderer/core/frame/local_frame_client.h
|
||||
@@ -305,6 +305,8 @@ class CORE_EXPORT LocalFrameClient : public FrameClient {
|
||||
@@ -306,6 +306,8 @@ class CORE_EXPORT LocalFrameClient : public FrameClient {
|
||||
|
||||
virtual void DidCreateScriptContext(v8::Local<v8::Context>,
|
||||
int32_t world_id) = 0;
|
||||
@@ -92,10 +92,10 @@ index 7a5d4721f7bd3012351f17053e188505f26f1979..4c415c2464fee49581efa307070ffad9
|
||||
int32_t world_id) = 0;
|
||||
virtual bool AllowScriptExtensions() = 0;
|
||||
diff --git a/third_party/blink/renderer/core/frame/local_frame_client_impl.cc b/third_party/blink/renderer/core/frame/local_frame_client_impl.cc
|
||||
index 015daaa60e46a106bf2f36a2bd967c892bc299da..c07e4bc3b7dd937ef14a72506cd6f2299bc511f4 100644
|
||||
index 0cee9fc9642c4a2eac51cc7b57124d9772411b8c..4a2bd06f9f254969419d3ec00a59466f8278814c 100644
|
||||
--- a/third_party/blink/renderer/core/frame/local_frame_client_impl.cc
|
||||
+++ b/third_party/blink/renderer/core/frame/local_frame_client_impl.cc
|
||||
@@ -292,6 +292,13 @@ void LocalFrameClientImpl::DidCreateScriptContext(
|
||||
@@ -293,6 +293,13 @@ void LocalFrameClientImpl::DidCreateScriptContext(
|
||||
web_frame_->Client()->DidCreateScriptContext(context, world_id);
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ index 015daaa60e46a106bf2f36a2bd967c892bc299da..c07e4bc3b7dd937ef14a72506cd6f229
|
||||
v8::Local<v8::Context> context,
|
||||
int32_t world_id) {
|
||||
diff --git a/third_party/blink/renderer/core/frame/local_frame_client_impl.h b/third_party/blink/renderer/core/frame/local_frame_client_impl.h
|
||||
index c522b37b1918902e424f0df6a3eb379b0fd05fa4..0b3054bcb55bd6e731dd42b59c2bc0c24ec29165 100644
|
||||
index a70c4a78a3dc740446b06a44a448760015bc9c24..be9872bdd93755bbf9e2be684cfd37efe9f4a5a8 100644
|
||||
--- a/third_party/blink/renderer/core/frame/local_frame_client_impl.h
|
||||
+++ b/third_party/blink/renderer/core/frame/local_frame_client_impl.h
|
||||
@@ -84,6 +84,8 @@ class CORE_EXPORT LocalFrameClientImpl final : public LocalFrameClient {
|
||||
@@ -123,10 +123,10 @@ index c522b37b1918902e424f0df6a3eb379b0fd05fa4..0b3054bcb55bd6e731dd42b59c2bc0c2
|
||||
int32_t world_id) override;
|
||||
|
||||
diff --git a/third_party/blink/renderer/core/loader/empty_clients.h b/third_party/blink/renderer/core/loader/empty_clients.h
|
||||
index 4ea7eae36fcf1d42cbe639e895d9aca52d20082b..ce529d0edd69ad6542baa83725e18be33d3c2a4a 100644
|
||||
index ec2a8f7d2fc14702686be73e663dfb9632b5b4de..5f3fdd7d03b81c7bf59528af96c550d9f2307835 100644
|
||||
--- a/third_party/blink/renderer/core/loader/empty_clients.h
|
||||
+++ b/third_party/blink/renderer/core/loader/empty_clients.h
|
||||
@@ -411,6 +411,8 @@ class CORE_EXPORT EmptyLocalFrameClient : public LocalFrameClient {
|
||||
@@ -412,6 +412,8 @@ class CORE_EXPORT EmptyLocalFrameClient : public LocalFrameClient {
|
||||
|
||||
void DidCreateScriptContext(v8::Local<v8::Context>,
|
||||
int32_t world_id) override {}
|
||||
|
||||
@@ -6,10 +6,10 @@ Subject: add gin::Converter support for ArrayBufferView
|
||||
This should be upstreamed.
|
||||
|
||||
diff --git a/gin/converter.cc b/gin/converter.cc
|
||||
index f6a93a1f74668e69b425a87c42e05c1adbc5cf54..4934f23d077d4b2a4c376196e37c720471fc88f6 100644
|
||||
index 62209cadaec7314d2d4ec3e63e1bc88394afa4a9..b035bfe1fd16fb6ca8be33bf446ff8578d7cc2a0 100644
|
||||
--- a/gin/converter.cc
|
||||
+++ b/gin/converter.cc
|
||||
@@ -18,6 +18,7 @@
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "v8/include/v8-value.h"
|
||||
|
||||
using v8::ArrayBuffer;
|
||||
@@ -17,7 +17,7 @@ index f6a93a1f74668e69b425a87c42e05c1adbc5cf54..4934f23d077d4b2a4c376196e37c7204
|
||||
using v8::External;
|
||||
using v8::Function;
|
||||
using v8::Int32;
|
||||
@@ -244,6 +245,20 @@ bool Converter<Local<ArrayBuffer>>::FromV8(Isolate* isolate,
|
||||
@@ -246,6 +247,20 @@ bool Converter<Local<ArrayBuffer>>::FromV8(Isolate* isolate,
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ index f6a93a1f74668e69b425a87c42e05c1adbc5cf54..4934f23d077d4b2a4c376196e37c7204
|
||||
Local<External> val) {
|
||||
return val.As<Value>();
|
||||
diff --git a/gin/converter.h b/gin/converter.h
|
||||
index 88ed39f337d5e9a1004d4e270f2bd020251ee518..175817151bfb8c83213767dc42f6ed14777f3cd1 100644
|
||||
index 828e59f4640e84ae9e4517b9ed9bc13b154fa9f2..c3d97c4e46fe47076299e475be7eec74cbc5783c 100644
|
||||
--- a/gin/converter.h
|
||||
+++ b/gin/converter.h
|
||||
@@ -190,6 +190,15 @@ struct GIN_EXPORT Converter<v8::Local<v8::ArrayBuffer> > {
|
||||
|
||||
@@ -8,7 +8,7 @@ decorations in maximized mode where needed, preventing empty space caused
|
||||
by decoration shadows and rounded titlebars around the window while maximized.
|
||||
|
||||
diff --git a/ui/gtk/gtk_ui.cc b/ui/gtk/gtk_ui.cc
|
||||
index ab8f0d6b545b24c28eb427e6d2ef33ef35d22e91..ed3213e73959079e5bc119987da7c31cc07f2f27 100644
|
||||
index 7b81a752ffad229a7bf1917f000b7a45f0828c36..1f08396713155eafc78a1fa9fc8fec22df350a91 100644
|
||||
--- a/ui/gtk/gtk_ui.cc
|
||||
+++ b/ui/gtk/gtk_ui.cc
|
||||
@@ -562,11 +562,12 @@ std::unique_ptr<ui::NavButtonProvider> GtkUi::CreateNavButtonProvider() {
|
||||
@@ -51,7 +51,7 @@ index 0432ea4f5906502a4f6def46ab064292a6628218..e3cbfa3a1ac8c169c429e29c1262d0dd
|
||||
// Objects to notify when the window frame button order changes.
|
||||
base::ObserverList<ui::WindowButtonOrderObserver>::Unchecked
|
||||
diff --git a/ui/gtk/window_frame_provider_gtk.cc b/ui/gtk/window_frame_provider_gtk.cc
|
||||
index 794efdb773422ddc12ccbe013a13aadeb980b487..a60bbd76141f06202343c68e78688a95179b0083 100644
|
||||
index 0b8fa0ec76098e0319b2e853719166d405cd3828..52615c5c119c58f17850454e98d1240b141e8a09 100644
|
||||
--- a/ui/gtk/window_frame_provider_gtk.cc
|
||||
+++ b/ui/gtk/window_frame_provider_gtk.cc
|
||||
@@ -30,20 +30,23 @@ constexpr int kMaxFrameSizeDip = 64;
|
||||
@@ -112,9 +112,9 @@ index 794efdb773422ddc12ccbe013a13aadeb980b487..a60bbd76141f06202343c68e78688a95
|
||||
double opacity = GetOpacityFromContext(context);
|
||||
if (opacity < 1.0) {
|
||||
return true;
|
||||
@@ -206,8 +209,8 @@ void WindowFrameProviderGtk::Asset::CloneFrom(
|
||||
unfocused_bitmap = src.unfocused_bitmap;
|
||||
}
|
||||
@@ -189,8 +192,8 @@ WindowFrameProviderGtk::Asset& WindowFrameProviderGtk::Asset::operator=(
|
||||
|
||||
WindowFrameProviderGtk::Asset::~Asset() = default;
|
||||
|
||||
-WindowFrameProviderGtk::WindowFrameProviderGtk(bool solid_frame, bool tiled)
|
||||
- : solid_frame_(solid_frame), tiled_(tiled) {
|
||||
@@ -123,7 +123,7 @@ index 794efdb773422ddc12ccbe013a13aadeb980b487..a60bbd76141f06202343c68e78688a95
|
||||
GtkSettings* settings = gtk_settings_get_default();
|
||||
// Unretained() is safe since WindowFrameProviderGtk will own the signals.
|
||||
auto callback = base::BindRepeating(&WindowFrameProviderGtk::OnThemeChanged,
|
||||
@@ -325,7 +328,7 @@ void WindowFrameProviderGtk::PaintWindowFrame(gfx::Canvas* canvas,
|
||||
@@ -340,7 +343,7 @@ void WindowFrameProviderGtk::PaintWindowFrame(gfx::Canvas* canvas,
|
||||
|
||||
auto header =
|
||||
PaintHeaderbar({client_bounds_px.width(), top_area_height_px},
|
||||
@@ -132,7 +132,7 @@ index 794efdb773422ddc12ccbe013a13aadeb980b487..a60bbd76141f06202343c68e78688a95
|
||||
image = gfx::ImageSkia::CreateFrom1xBitmap(header);
|
||||
// In GTK4, the headerbar gets clipped by the window.
|
||||
if (GtkCheckVersion(4)) {
|
||||
@@ -352,7 +355,7 @@ void WindowFrameProviderGtk::MaybeUpdateBitmaps(float scale) {
|
||||
@@ -369,7 +372,7 @@ WindowFrameProviderGtk::Asset& WindowFrameProviderGtk::GetOrCreateAsset(
|
||||
|
||||
gfx::Rect frame_bounds_dip(kMaxFrameSizeDip, kMaxFrameSizeDip,
|
||||
2 * kMaxFrameSizeDip, 2 * kMaxFrameSizeDip);
|
||||
@@ -141,20 +141,20 @@ index 794efdb773422ddc12ccbe013a13aadeb980b487..a60bbd76141f06202343c68e78688a95
|
||||
frame_bounds_dip.Inset(-GtkStyleContextGetPadding(focused_context));
|
||||
frame_bounds_dip.Inset(-GtkStyleContextGetBorder(focused_context));
|
||||
gfx::Size bitmap_size(BitmapSizePx(asset), BitmapSizePx(asset));
|
||||
@@ -360,7 +363,7 @@ void WindowFrameProviderGtk::MaybeUpdateBitmaps(float scale) {
|
||||
@@ -377,7 +380,7 @@ WindowFrameProviderGtk::Asset& WindowFrameProviderGtk::GetOrCreateAsset(
|
||||
focused_context, scale);
|
||||
asset.unfocused_bitmap =
|
||||
PaintBitmap(bitmap_size, gfx::RectF(frame_bounds_dip),
|
||||
- DecorationContext(solid_frame_, tiled_, false), scale);
|
||||
+ DecorationContext(solid_frame_, tiled_, maximized_, false), scale);
|
||||
|
||||
// In GTK4, there's no way to obtain the frame thickness from CSS values
|
||||
// directly, so we must determine it experimentally based on the drawn
|
||||
return asset;
|
||||
}
|
||||
diff --git a/ui/gtk/window_frame_provider_gtk.h b/ui/gtk/window_frame_provider_gtk.h
|
||||
index bed28192daffe032fde3a74ca70f1298fb12b1b7..268acade8bd1075f3ce756cdf29bf50905ccb433 100644
|
||||
index 4faaae32a203bfa57f3e61c391dc6917c4a0bf59..94050a0136b78730f607f42991742e0434948d0e 100644
|
||||
--- a/ui/gtk/window_frame_provider_gtk.h
|
||||
+++ b/ui/gtk/window_frame_provider_gtk.h
|
||||
@@ -18,7 +18,7 @@ namespace gtk {
|
||||
@@ -20,7 +20,7 @@ namespace gtk {
|
||||
|
||||
class WindowFrameProviderGtk : public ui::WindowFrameProvider {
|
||||
public:
|
||||
@@ -163,7 +163,7 @@ index bed28192daffe032fde3a74ca70f1298fb12b1b7..268acade8bd1075f3ce756cdf29bf509
|
||||
|
||||
WindowFrameProviderGtk(const WindowFrameProviderGtk&) = delete;
|
||||
WindowFrameProviderGtk& operator=(const WindowFrameProviderGtk&) = delete;
|
||||
@@ -70,6 +70,8 @@ class WindowFrameProviderGtk : public ui::WindowFrameProvider {
|
||||
@@ -65,6 +65,8 @@ class WindowFrameProviderGtk : public ui::WindowFrameProvider {
|
||||
// Input parameters used for drawing.
|
||||
const bool solid_frame_;
|
||||
const bool tiled_;
|
||||
@@ -171,7 +171,7 @@ index bed28192daffe032fde3a74ca70f1298fb12b1b7..268acade8bd1075f3ce756cdf29bf509
|
||||
+ const bool maximized_;
|
||||
|
||||
// Scale-independent metric calculated based on the bitmaps.
|
||||
gfx::Insets frame_thickness_dip_;
|
||||
std::optional<gfx::Insets> frame_thickness_dip_;
|
||||
diff --git a/ui/linux/fallback_linux_ui.cc b/ui/linux/fallback_linux_ui.cc
|
||||
index 8903f9ba950e7878fbd1bfa0cf2a42e0cc9daa21..7d13381eb1d16193bad0be1318e8ed199c6fb845 100644
|
||||
--- a/ui/linux/fallback_linux_ui.cc
|
||||
|
||||
@@ -29,7 +29,7 @@ index 6022a0af4241fe65bd03d7cbf95785e8879dc78e..ec9e4c6ece9014b66e7d65e99cda2b95
|
||||
objects_.clear();
|
||||
platform_representations_.clear();
|
||||
diff --git a/ui/base/clipboard/scoped_clipboard_writer.h b/ui/base/clipboard/scoped_clipboard_writer.h
|
||||
index 08fce03a51ded80c8dfe59f17a438ace21f8daa7..ffbd0cbff14ae7af2d00d5949f6b608e998e0429 100644
|
||||
index 96ba9abb9b7efab79adbf299c6bd3b4f7a4501e1..0916b81ec5b3cb123185b7cff332120ee498fb57 100644
|
||||
--- a/ui/base/clipboard/scoped_clipboard_writer.h
|
||||
+++ b/ui/base/clipboard/scoped_clipboard_writer.h
|
||||
@@ -89,6 +89,10 @@ class COMPONENT_EXPORT(UI_BASE_CLIPBOARD) ScopedClipboardWriter {
|
||||
|
||||
151
patches/chromium/adjust_accessibility_ui_for_electron.patch
Normal file
151
patches/chromium/adjust_accessibility_ui_for_electron.patch
Normal file
@@ -0,0 +1,151 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shelley Vohr <shelley.vohr@gmail.com>
|
||||
Date: Mon, 6 Jul 2020 13:46:06 -0700
|
||||
Subject: Adjust accessibility_ui for Electron
|
||||
|
||||
This tweaks Chrome's Accessibility support at chrome://accessibility
|
||||
to make it usable from Electron by replacing use of the Profile PrefService
|
||||
with Electron's own PrefService in ElectronBrowserContext. It also removes
|
||||
usage of BrowserList and Browser as we subclass related methods and use our
|
||||
WindowList.
|
||||
|
||||
diff --git a/chrome/browser/ui/webui/accessibility/accessibility_ui.cc b/chrome/browser/ui/webui/accessibility/accessibility_ui.cc
|
||||
index aff8a187b6d81172bf5930c6da6bfed4d7989057..5923e39ae94cabd716d845c86db5f84c3c51e2cb 100644
|
||||
--- a/chrome/browser/ui/webui/accessibility/accessibility_ui.cc
|
||||
+++ b/chrome/browser/ui/webui/accessibility/accessibility_ui.cc
|
||||
@@ -43,6 +43,7 @@
|
||||
#include "content/public/browser/web_contents.h"
|
||||
#include "content/public/browser/web_contents_delegate.h"
|
||||
#include "content/public/browser/web_ui_data_source.h"
|
||||
+#include "electron/shell/browser/electron_browser_context.h"
|
||||
#include "ui/accessibility/accessibility_features.h"
|
||||
#include "ui/accessibility/ax_updates_and_events.h"
|
||||
#include "ui/accessibility/platform/ax_platform_node.h"
|
||||
@@ -169,7 +170,7 @@ base::Value::Dict BuildTargetDescriptor(content::RenderViewHost* rvh) {
|
||||
accessibility_mode);
|
||||
}
|
||||
|
||||
-#if !BUILDFLAG(IS_ANDROID)
|
||||
+#if 0
|
||||
base::Value::Dict BuildTargetDescriptor(Browser* browser) {
|
||||
base::Value::Dict target_data;
|
||||
target_data.Set(kSessionIdField, browser->session_id().id());
|
||||
@@ -203,7 +204,7 @@ void HandleAccessibilityRequestCallback(
|
||||
DCHECK(ShouldHandleAccessibilityRequestCallback(path));
|
||||
|
||||
base::Value::Dict data;
|
||||
- PrefService* pref = Profile::FromBrowserContext(current_context)->GetPrefs();
|
||||
+ PrefService* pref = static_cast<electron::ElectronBrowserContext*>(current_context)->prefs();
|
||||
ui::AXMode mode =
|
||||
content::BrowserAccessibilityState::GetInstance()->GetAccessibilityMode();
|
||||
bool is_native_enabled = content::BrowserAccessibilityState::GetInstance()
|
||||
@@ -236,7 +237,7 @@ void HandleAccessibilityRequestCallback(
|
||||
data.Set(kViewsAccessibility, features::IsAccessibilityTreeForViewsEnabled());
|
||||
|
||||
std::string pref_api_type =
|
||||
- pref->GetString(prefs::kShownAccessibilityApiType);
|
||||
+ std::string(pref->GetString(prefs::kShownAccessibilityApiType));
|
||||
bool pref_api_type_supported = false;
|
||||
|
||||
std::vector<ui::AXApiType::Type> supported_api_types =
|
||||
@@ -303,11 +304,11 @@ void HandleAccessibilityRequestCallback(
|
||||
data.Set(kPagesField, std::move(page_list));
|
||||
|
||||
base::Value::List browser_list;
|
||||
-#if !BUILDFLAG(IS_ANDROID)
|
||||
+#if 0
|
||||
for (Browser* browser : *BrowserList::GetInstance()) {
|
||||
browser_list.Append(BuildTargetDescriptor(browser));
|
||||
}
|
||||
-#endif // !BUILDFLAG(IS_ANDROID)
|
||||
+#endif
|
||||
data.Set(kBrowsersField, std::move(browser_list));
|
||||
|
||||
base::Value::List widgets_list;
|
||||
@@ -647,7 +648,8 @@ void AccessibilityUIMessageHandler::SetGlobalString(
|
||||
const std::string value = CheckJSValue(data.FindString(kValueField));
|
||||
|
||||
if (string_name == kApiTypeField) {
|
||||
- PrefService* pref = Profile::FromWebUI(web_ui())->GetPrefs();
|
||||
+ PrefService* pref = static_cast<electron::ElectronBrowserContext*>(
|
||||
+ web_ui()->GetWebContents()->GetBrowserContext())->prefs();
|
||||
pref->SetString(prefs::kShownAccessibilityApiType, value);
|
||||
}
|
||||
}
|
||||
@@ -700,7 +702,8 @@ void AccessibilityUIMessageHandler::RequestWebContentsTree(
|
||||
AXPropertyFilter::ALLOW_EMPTY);
|
||||
AddPropertyFilters(property_filters, deny, AXPropertyFilter::DENY);
|
||||
|
||||
- PrefService* pref = Profile::FromWebUI(web_ui())->GetPrefs();
|
||||
+ PrefService* pref = static_cast<electron::ElectronBrowserContext*>(
|
||||
+ web_contents->GetBrowserContext())->prefs();
|
||||
ui::AXApiType::Type api_type =
|
||||
ui::AXApiType::From(pref->GetString(prefs::kShownAccessibilityApiType));
|
||||
std::string accessibility_contents =
|
||||
@@ -727,6 +730,7 @@ void AccessibilityUIMessageHandler::RequestNativeUITree(
|
||||
AXPropertyFilter::ALLOW_EMPTY);
|
||||
AddPropertyFilters(property_filters, deny, AXPropertyFilter::DENY);
|
||||
|
||||
+#if 0
|
||||
for (Browser* browser : *BrowserList::GetInstance()) {
|
||||
if (browser->session_id().id() == session_id) {
|
||||
base::Value::Dict result = BuildTargetDescriptor(browser);
|
||||
@@ -739,6 +743,7 @@ void AccessibilityUIMessageHandler::RequestNativeUITree(
|
||||
return;
|
||||
}
|
||||
}
|
||||
+#endif
|
||||
#endif // !BUILDFLAG(IS_ANDROID)
|
||||
// No browser with the specified |session_id| was found.
|
||||
base::Value::Dict result;
|
||||
@@ -807,11 +812,13 @@ void AccessibilityUIMessageHandler::StopRecording(
|
||||
}
|
||||
|
||||
ui::AXApiType::Type AccessibilityUIMessageHandler::GetRecordingApiType() {
|
||||
- PrefService* pref = Profile::FromWebUI(web_ui())->GetPrefs();
|
||||
- const std::vector<ui::AXApiType::Type> supported_types =
|
||||
- content::AXInspectFactory::SupportedApis();
|
||||
+ PrefService* pref = static_cast<electron::ElectronBrowserContext*>(
|
||||
+ web_ui()->GetWebContents()->GetBrowserContext())->prefs();
|
||||
ui::AXApiType::Type api_type =
|
||||
ui::AXApiType::From(pref->GetString(prefs::kShownAccessibilityApiType));
|
||||
+
|
||||
+ const std::vector<ui::AXApiType::Type> supported_types =
|
||||
+ content::AXInspectFactory::SupportedApis();
|
||||
// Check to see if it is in the supported types list.
|
||||
if (std::find(supported_types.begin(), supported_types.end(), api_type) ==
|
||||
supported_types.end()) {
|
||||
@@ -881,8 +888,11 @@ void AccessibilityUIMessageHandler::RequestAccessibilityEvents(
|
||||
// static
|
||||
void AccessibilityUIMessageHandler::RegisterProfilePrefs(
|
||||
user_prefs::PrefRegistrySyncable* registry) {
|
||||
+#if 0
|
||||
const std::string_view default_api_type =
|
||||
std::string_view(ui::AXApiType::Type(ui::AXApiType::kBlink));
|
||||
registry->RegisterStringPref(prefs::kShownAccessibilityApiType,
|
||||
std::string(default_api_type));
|
||||
+ registry->RegisterBooleanPref(prefs::kShowInternalAccessibilityTree, false);
|
||||
+#endif
|
||||
}
|
||||
diff --git a/chrome/browser/ui/webui/accessibility/accessibility_ui.h b/chrome/browser/ui/webui/accessibility/accessibility_ui.h
|
||||
index 45dead36d71f1c91e1be607180e548854083304c..79a2742e6b95e9ab8257c0f1af75eeebce8566e9 100644
|
||||
--- a/chrome/browser/ui/webui/accessibility/accessibility_ui.h
|
||||
+++ b/chrome/browser/ui/webui/accessibility/accessibility_ui.h
|
||||
@@ -30,6 +30,8 @@ class ScopedAccessibilityMode;
|
||||
class WebContents;
|
||||
} // namespace content
|
||||
|
||||
+class ElectronAccessibilityUIMessageHandler;
|
||||
+
|
||||
namespace user_prefs {
|
||||
class PrefRegistrySyncable;
|
||||
} // namespace user_prefs
|
||||
@@ -82,6 +84,8 @@ class AccessibilityUIMessageHandler : public content::WebUIMessageHandler {
|
||||
static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
|
||||
|
||||
private:
|
||||
+ friend class ElectronAccessibilityUIMessageHandler;
|
||||
+
|
||||
// Applies `mode` to `web_contents` for the lifetime of the accessibility
|
||||
// UI page.
|
||||
void SetAccessibilityModeForWebContents(content::WebContents* web_contents,
|
||||
@@ -6,7 +6,7 @@ Subject: allow disabling blink scheduler throttling per RenderView
|
||||
This allows us to disable throttling for hidden windows.
|
||||
|
||||
diff --git a/content/browser/renderer_host/navigation_controller_impl_unittest.cc b/content/browser/renderer_host/navigation_controller_impl_unittest.cc
|
||||
index 32b77897ef3669727fe05a1f3603a5f8335ec3cf..f1948d352bd71da5ec17d734e343bfd656d7ed69 100644
|
||||
index 1eb0f9919a29acf9f443f15ef5e7549138d73f7b..070ad96c753bc064c1af48a934a7a3bc7483174b 100644
|
||||
--- a/content/browser/renderer_host/navigation_controller_impl_unittest.cc
|
||||
+++ b/content/browser/renderer_host/navigation_controller_impl_unittest.cc
|
||||
@@ -163,6 +163,12 @@ class MockPageBroadcast : public blink::mojom::PageBroadcast {
|
||||
@@ -23,10 +23,10 @@ index 32b77897ef3669727fe05a1f3603a5f8335ec3cf..f1948d352bd71da5ec17d734e343bfd6
|
||||
return receiver_.BindNewEndpointAndPassDedicatedRemote();
|
||||
}
|
||||
diff --git a/content/browser/renderer_host/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc
|
||||
index 57926e0d557fdb3e8f46a096e335ecb5d1d2e13f..b0438d6077a3323785175424a3701ba4ae5e523d 100644
|
||||
index d39f6f582109e7323372c032048544738372cf41..9ba70f021fd72e5861566e89f40af3edf4dea7e1 100644
|
||||
--- a/content/browser/renderer_host/render_view_host_impl.cc
|
||||
+++ b/content/browser/renderer_host/render_view_host_impl.cc
|
||||
@@ -714,6 +714,11 @@ void RenderViewHostImpl::SetBackgroundOpaque(bool opaque) {
|
||||
@@ -713,6 +713,11 @@ void RenderViewHostImpl::SetBackgroundOpaque(bool opaque) {
|
||||
GetWidget()->GetAssociatedFrameWidget()->SetBackgroundOpaque(opaque);
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ index 57926e0d557fdb3e8f46a096e335ecb5d1d2e13f..b0438d6077a3323785175424a3701ba4
|
||||
return is_active();
|
||||
}
|
||||
diff --git a/content/browser/renderer_host/render_view_host_impl.h b/content/browser/renderer_host/render_view_host_impl.h
|
||||
index a94977d7a76ae9952bbba0efe59a7cb5021a1c84..11c4f890eaeae1329ca5a6634a698aef7a288fb4 100644
|
||||
index 5b4e90e2a9293f6d59e92b16bd461500f8188cc7..b69f66e5cf009a340766c355d9ceea89a20546b2 100644
|
||||
--- a/content/browser/renderer_host/render_view_host_impl.h
|
||||
+++ b/content/browser/renderer_host/render_view_host_impl.h
|
||||
@@ -139,6 +139,7 @@ class CONTENT_EXPORT RenderViewHostImpl
|
||||
@@ -51,20 +51,20 @@ index a94977d7a76ae9952bbba0efe59a7cb5021a1c84..11c4f890eaeae1329ca5a6634a698aef
|
||||
void SendRendererPreferencesToRenderer(
|
||||
const blink::RendererPreferences& preferences);
|
||||
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc
|
||||
index cb9b21a3d3e99558e6892e00e73e550f68571daf..f18a3d6b4287d986c31db3385541cd20db68ecd5 100644
|
||||
index 86c755796f215d3655648af4fa7a6e4eaabd109a..3c9b0864b2b96f6103b0661db3488e970b2886e1 100644
|
||||
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
|
||||
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
|
||||
@@ -553,8 +553,8 @@ void RenderWidgetHostViewAura::ShowImpl(PageVisibilityState page_visibility) {
|
||||
@@ -570,8 +570,8 @@ void RenderWidgetHostViewAura::ShowImpl(PageVisibilityState page_visibility) {
|
||||
// OnShowWithPageVisibility will not call NotifyHostAndDelegateOnWasShown,
|
||||
// which updates `visibility_`, unless the host is hidden. Make sure no update
|
||||
// is needed.
|
||||
- DCHECK(host_->is_hidden() || visibility_ == Visibility::VISIBLE);
|
||||
- CHECK(host_->is_hidden() || visibility_ == Visibility::VISIBLE);
|
||||
- OnShowWithPageVisibility(page_visibility);
|
||||
+ if (host_->is_hidden() || visibility_ == Visibility::VISIBLE)
|
||||
+ OnShowWithPageVisibility(page_visibility);
|
||||
}
|
||||
|
||||
void RenderWidgetHostViewAura::NotifyHostAndDelegateOnWasShown(
|
||||
void RenderWidgetHostViewAura::EnsurePlatformVisibility(
|
||||
diff --git a/content/public/browser/render_view_host.h b/content/public/browser/render_view_host.h
|
||||
index 20ca763ff7f55e8176b77349b41917b11e051ae6..a50c122064b5f0092f57e3d508fb19389b72203b 100644
|
||||
--- a/content/public/browser/render_view_host.h
|
||||
@@ -104,7 +104,7 @@ index ed73a6fe6d146eac904f0aa0d88facf055df503e..4bbc792068db75739a7ceb8ad01c85f9
|
||||
+ SetSchedulerThrottling(bool allowed);
|
||||
};
|
||||
diff --git a/third_party/blink/public/web/web_view.h b/third_party/blink/public/web/web_view.h
|
||||
index c4348be90db209a757f21cbc518e1244fe0954d5..1ee953ad860291cdc1095880f6646d1d05732843 100644
|
||||
index 6dfc5bef7ed4197067f63db2e12de9b1e1478e2e..ab8eb5352a18c514d864d6fd7c64a61e571dce3e 100644
|
||||
--- a/third_party/blink/public/web/web_view.h
|
||||
+++ b/third_party/blink/public/web/web_view.h
|
||||
@@ -376,6 +376,7 @@ class BLINK_EXPORT WebView {
|
||||
@@ -116,10 +116,10 @@ index c4348be90db209a757f21cbc518e1244fe0954d5..1ee953ad860291cdc1095880f6646d1d
|
||||
// Visibility -----------------------------------------------------------
|
||||
|
||||
diff --git a/third_party/blink/renderer/core/exported/web_view_impl.cc b/third_party/blink/renderer/core/exported/web_view_impl.cc
|
||||
index fb042e637c831e3de72d7ed6fd33db9df5976c18..689010902c8508b85208618cc11b922adf10c08e 100644
|
||||
index 173ca5a588d8b9525bd835207358007c120120b0..8db4b77dc968a6f8dd4612deecb7b4ce5ee71eb4 100644
|
||||
--- a/third_party/blink/renderer/core/exported/web_view_impl.cc
|
||||
+++ b/third_party/blink/renderer/core/exported/web_view_impl.cc
|
||||
@@ -2431,6 +2431,10 @@ void WebViewImpl::SetPageLifecycleStateInternal(
|
||||
@@ -2430,6 +2430,10 @@ void WebViewImpl::SetPageLifecycleStateInternal(
|
||||
TRACE_EVENT2("navigation", "WebViewImpl::SetPageLifecycleStateInternal",
|
||||
"old_state", old_state, "new_state", new_state);
|
||||
|
||||
@@ -130,7 +130,7 @@ index fb042e637c831e3de72d7ed6fd33db9df5976c18..689010902c8508b85208618cc11b922a
|
||||
bool storing_in_bfcache = new_state->is_in_back_forward_cache &&
|
||||
!old_state->is_in_back_forward_cache;
|
||||
bool restoring_from_bfcache = !new_state->is_in_back_forward_cache &&
|
||||
@@ -3937,10 +3941,23 @@ PageScheduler* WebViewImpl::Scheduler() const {
|
||||
@@ -3940,10 +3944,23 @@ PageScheduler* WebViewImpl::Scheduler() const {
|
||||
return GetPage()->GetPageScheduler();
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@ index fb042e637c831e3de72d7ed6fd33db9df5976c18..689010902c8508b85208618cc11b922a
|
||||
// Do not throttle if the page should be painting.
|
||||
bool is_visible =
|
||||
diff --git a/third_party/blink/renderer/core/exported/web_view_impl.h b/third_party/blink/renderer/core/exported/web_view_impl.h
|
||||
index db7f1cb1b0f682a20a618b342a9a42add0db9e74..bc2c06fd0e7d02624ad97ab1ebe21ff7b2217c05 100644
|
||||
index d6bfd9b670d03170c2c388bb69b2299ef3fe2286..8684fd118320d26549dbc7d0c5bdbbb4d081e0a3 100644
|
||||
--- a/third_party/blink/renderer/core/exported/web_view_impl.h
|
||||
+++ b/third_party/blink/renderer/core/exported/web_view_impl.h
|
||||
@@ -451,6 +451,7 @@ class CORE_EXPORT WebViewImpl final : public WebView,
|
||||
@@ -166,7 +166,7 @@ index db7f1cb1b0f682a20a618b342a9a42add0db9e74..bc2c06fd0e7d02624ad97ab1ebe21ff7
|
||||
void SetVisibilityState(mojom::blink::PageVisibilityState visibility_state,
|
||||
bool is_initial_state) override;
|
||||
mojom::blink::PageVisibilityState GetVisibilityState() override;
|
||||
@@ -925,6 +926,8 @@ class CORE_EXPORT WebViewImpl final : public WebView,
|
||||
@@ -927,6 +928,8 @@ class CORE_EXPORT WebViewImpl final : public WebView,
|
||||
// If true, we send IPC messages when |preferred_size_| changes.
|
||||
bool send_preferred_size_changes_ = false;
|
||||
|
||||
|
||||
@@ -8,10 +8,10 @@ WebPreferences of in-process child windows, rather than relying on
|
||||
process-level command line switches, as before.
|
||||
|
||||
diff --git a/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc b/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc
|
||||
index 0f386b68028a8398bdf6b851b16e244e5ba918bd..7a9519c2c172178ace67251151363ac0611e8503 100644
|
||||
index 2eb418015552910f6a5bceb117953a563e3b8c07..9974a94a6ae78f36e7baab097e710a79f817e682 100644
|
||||
--- a/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc
|
||||
+++ b/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc
|
||||
@@ -149,6 +149,19 @@ bool StructTraits<blink::mojom::WebPreferencesDataView,
|
||||
@@ -147,6 +147,19 @@ bool StructTraits<blink::mojom::WebPreferencesDataView,
|
||||
out->v8_cache_options = data.v8_cache_options();
|
||||
out->record_whole_document = data.record_whole_document();
|
||||
out->stylus_handwriting_enabled = data.stylus_handwriting_enabled();
|
||||
@@ -32,7 +32,7 @@ index 0f386b68028a8398bdf6b851b16e244e5ba918bd..7a9519c2c172178ace67251151363ac0
|
||||
out->accelerated_video_decode_enabled =
|
||||
data.accelerated_video_decode_enabled();
|
||||
diff --git a/third_party/blink/public/common/web_preferences/web_preferences.h b/third_party/blink/public/common/web_preferences/web_preferences.h
|
||||
index 90a6a0bf5c0e2d21f23badb284292a4f0c90178f..4f1b6acaa503cd085ff607d292ad0d4ee6731a56 100644
|
||||
index a928196b83671b7f9a6fc27f2a8436c89fe3d3e5..ef5ba7b733bfa67158cb631b5b0bb6b28ba8758d 100644
|
||||
--- a/third_party/blink/public/common/web_preferences/web_preferences.h
|
||||
+++ b/third_party/blink/public/common/web_preferences/web_preferences.h
|
||||
@@ -10,6 +10,7 @@
|
||||
@@ -43,7 +43,7 @@ index 90a6a0bf5c0e2d21f23badb284292a4f0c90178f..4f1b6acaa503cd085ff607d292ad0d4e
|
||||
#include "net/nqe/effective_connection_type.h"
|
||||
#include "third_party/blink/public/common/common_export.h"
|
||||
#include "third_party/blink/public/mojom/css/preferred_color_scheme.mojom-shared.h"
|
||||
@@ -425,6 +426,20 @@ struct BLINK_COMMON_EXPORT WebPreferences {
|
||||
@@ -432,6 +433,20 @@ struct BLINK_COMMON_EXPORT WebPreferences {
|
||||
// blocking user's access to the background web content.
|
||||
bool modal_context_menu = true;
|
||||
|
||||
@@ -65,7 +65,7 @@ index 90a6a0bf5c0e2d21f23badb284292a4f0c90178f..4f1b6acaa503cd085ff607d292ad0d4e
|
||||
// chrome, except for the cases where it would require lots of extra work for
|
||||
// the embedder to use the same default value.
|
||||
diff --git a/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h b/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h
|
||||
index 9960a1180a8e64d6e369936ab93aeb3417af5e8a..3f38e6e1289e1387e5fa54268c8efacda8fc3186 100644
|
||||
index ffddf92b78f1bc03f40969bb93260502b0887e8a..7a8f75cb6b501b90df7a1fec2b5a84667250691c 100644
|
||||
--- a/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h
|
||||
+++ b/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h
|
||||
@@ -6,6 +6,7 @@
|
||||
@@ -76,7 +76,7 @@ index 9960a1180a8e64d6e369936ab93aeb3417af5e8a..3f38e6e1289e1387e5fa54268c8efacd
|
||||
#include "mojo/public/cpp/bindings/struct_traits.h"
|
||||
#include "net/nqe/effective_connection_type.h"
|
||||
#include "third_party/blink/public/common/common_export.h"
|
||||
@@ -439,6 +440,52 @@ struct BLINK_COMMON_EXPORT StructTraits<blink::mojom::WebPreferencesDataView,
|
||||
@@ -434,6 +435,52 @@ struct BLINK_COMMON_EXPORT StructTraits<blink::mojom::WebPreferencesDataView,
|
||||
return r.stylus_handwriting_enabled;
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ index 9960a1180a8e64d6e369936ab93aeb3417af5e8a..3f38e6e1289e1387e5fa54268c8efacd
|
||||
return r.cookie_enabled;
|
||||
}
|
||||
diff --git a/third_party/blink/public/mojom/webpreferences/web_preferences.mojom b/third_party/blink/public/mojom/webpreferences/web_preferences.mojom
|
||||
index c3ff064deb240a16f2d9adcb233426fbc4795324..7fd096a61e3dd33de09a25ce2926b010486b2dc2 100644
|
||||
index 2dc2c857784ce482c7437a39e3e12f9a1d15bc55..fd6cf5ca4fbb22450da2c9677dfa806ab3f2aeb9 100644
|
||||
--- a/third_party/blink/public/mojom/webpreferences/web_preferences.mojom
|
||||
+++ b/third_party/blink/public/mojom/webpreferences/web_preferences.mojom
|
||||
@@ -9,6 +9,7 @@ import "third_party/blink/public/mojom/css/preferred_contrast.mojom";
|
||||
@@ -141,7 +141,7 @@ index c3ff064deb240a16f2d9adcb233426fbc4795324..7fd096a61e3dd33de09a25ce2926b010
|
||||
|
||||
enum PointerType {
|
||||
kPointerNone = 1, // 1 << 0
|
||||
@@ -218,6 +219,19 @@ struct WebPreferences {
|
||||
@@ -217,6 +218,19 @@ struct WebPreferences {
|
||||
// If true, stylus handwriting recognition to text input will be available in
|
||||
// editable input fields which are non-password type.
|
||||
bool stylus_handwriting_enabled;
|
||||
|
||||
@@ -6,10 +6,10 @@ Subject: allow new privileges in unsandboxed child processes
|
||||
This allows unsandboxed child process to launch setuid processes on Linux.
|
||||
|
||||
diff --git a/content/browser/child_process_launcher_helper_linux.cc b/content/browser/child_process_launcher_helper_linux.cc
|
||||
index e21cd3f9c447d67299c034e2b9f212f251c5deca..795ad47165f2f02e816f424ce74391a435c61a32 100644
|
||||
index add20a2f81d66e51e1be5a3f3b35ef6b340b4cc3..31a2a14a95540477297943df9b09b1e4659a884d 100644
|
||||
--- a/content/browser/child_process_launcher_helper_linux.cc
|
||||
+++ b/content/browser/child_process_launcher_helper_linux.cc
|
||||
@@ -63,6 +63,15 @@ bool ChildProcessLauncherHelper::BeforeLaunchOnLauncherThread(
|
||||
@@ -64,6 +64,15 @@ bool ChildProcessLauncherHelper::BeforeLaunchOnLauncherThread(
|
||||
options->fds_to_remap.emplace_back(sandbox_fd, GetSandboxFD());
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ This is used by editors to obtain the filesystem path from a dragged file. See
|
||||
documentation at https://electronjs.org/docs/api/file-object
|
||||
|
||||
diff --git a/third_party/blink/renderer/core/fileapi/file.h b/third_party/blink/renderer/core/fileapi/file.h
|
||||
index bb5967988cb69d24af94337b67379f1200a2508b..a935500bbef25a73840931648f3e65e70fc098f4 100644
|
||||
index 3b120f0de6dcd7e584a7882df9ece2a7adcbc368..01b5f3391abb0d8ff76c427fa187f9d6d2523919 100644
|
||||
--- a/third_party/blink/renderer/core/fileapi/file.h
|
||||
+++ b/third_party/blink/renderer/core/fileapi/file.h
|
||||
@@ -220,6 +220,9 @@ class CORE_EXPORT File final : public Blob {
|
||||
|
||||
@@ -15,7 +15,7 @@ Refs changes in:
|
||||
This patch reverts the changes to fix associated crashes in Electron.
|
||||
|
||||
diff --git a/third_party/blink/renderer/core/frame/frame.cc b/third_party/blink/renderer/core/frame/frame.cc
|
||||
index 0a742bbbd5e8e1eb3610cc32f785f779e8907e75..26967019244d409dadf4533405d4d5d27c75b73c 100644
|
||||
index 0e21d9c3194198e7540c7b3a84e8aed691821cbb..c0f5d92f8613ca380295cca7f55456d6fbcd6d1f 100644
|
||||
--- a/third_party/blink/renderer/core/frame/frame.cc
|
||||
+++ b/third_party/blink/renderer/core/frame/frame.cc
|
||||
@@ -125,14 +125,6 @@ bool Frame::Detach(FrameDetachType type) {
|
||||
@@ -49,10 +49,10 @@ index 0a742bbbd5e8e1eb3610cc32f785f779e8907e75..26967019244d409dadf4533405d4d5d2
|
||||
// its owning reference back to our owning LocalFrame.
|
||||
client_->Detached(type);
|
||||
diff --git a/third_party/blink/renderer/core/frame/local_frame.cc b/third_party/blink/renderer/core/frame/local_frame.cc
|
||||
index b89cc3f1dc53bc04793ebd2b4075df6e60193a73..0ba08a946155ee4d04a693cf26840a95f315b9a3 100644
|
||||
index 50edd8bfdb5a6ec6de8d324c7cec09655d8761d1..1b3ee460f8571602c8d1fc22e709ce44d6095d7a 100644
|
||||
--- a/third_party/blink/renderer/core/frame/local_frame.cc
|
||||
+++ b/third_party/blink/renderer/core/frame/local_frame.cc
|
||||
@@ -684,10 +684,6 @@ bool LocalFrame::DetachImpl(FrameDetachType type) {
|
||||
@@ -718,10 +718,6 @@ bool LocalFrame::DetachImpl(FrameDetachType type) {
|
||||
}
|
||||
DCHECK(!view_ || !view_->IsAttached());
|
||||
|
||||
@@ -63,7 +63,7 @@ index b89cc3f1dc53bc04793ebd2b4075df6e60193a73..0ba08a946155ee4d04a693cf26840a95
|
||||
if (!Client())
|
||||
return false;
|
||||
|
||||
@@ -738,6 +734,11 @@ bool LocalFrame::DetachImpl(FrameDetachType type) {
|
||||
@@ -772,6 +768,11 @@ bool LocalFrame::DetachImpl(FrameDetachType type) {
|
||||
DCHECK(!view_->IsAttached());
|
||||
Client()->WillBeDetached();
|
||||
|
||||
|
||||
@@ -6,10 +6,10 @@ Subject: boringssl BUILD.gn
|
||||
Build BoringSSL with some extra functions that nodejs needs.
|
||||
|
||||
diff --git a/third_party/boringssl/BUILD.gn b/third_party/boringssl/BUILD.gn
|
||||
index feaef4bfd7f8c04c32f555ab2c61ec838844e355..ed49c4a14a0cd8c3ff0f7ed9c5dd78b385c623ea 100644
|
||||
index f1b4a1ac248479746a378c85e34845b7703d5867..727940b7c015bedb0a09c06123d9e12cbb039694 100644
|
||||
--- a/third_party/boringssl/BUILD.gn
|
||||
+++ b/third_party/boringssl/BUILD.gn
|
||||
@@ -56,6 +56,21 @@ config("no_asm_config") {
|
||||
@@ -52,6 +52,21 @@ config("no_asm_config") {
|
||||
all_sources = crypto_sources + ssl_sources + pki_sources + pki_internal_headers
|
||||
all_headers = crypto_headers + ssl_headers + pki_headers + pki_internal_headers
|
||||
|
||||
|
||||
@@ -8,10 +8,10 @@ categories in use are known / declared. This patch is required for us
|
||||
to introduce a new Electron category for Electron-specific tracing.
|
||||
|
||||
diff --git a/base/trace_event/builtin_categories.h b/base/trace_event/builtin_categories.h
|
||||
index 5f6efb0e93bced90de5f6735e303feaa48c71df2..f3a31fdee0e9e75d05aa229a7066a520161c7f61 100644
|
||||
index 4c1a949117a070a74285d043ec89a677952fd2c4..a62476b75142705c01c7d2260c93fa7b4342a2b6 100644
|
||||
--- a/base/trace_event/builtin_categories.h
|
||||
+++ b/base/trace_event/builtin_categories.h
|
||||
@@ -82,6 +82,7 @@
|
||||
@@ -87,6 +87,7 @@
|
||||
X("drm") \
|
||||
X("drmcursor") \
|
||||
X("dwrite") \
|
||||
|
||||
@@ -6,10 +6,10 @@ Subject: build: allow electron to use exec_script
|
||||
This is similar to the //build usecase so we're OK adding ourselves here
|
||||
|
||||
diff --git a/.gn b/.gn
|
||||
index afe0b3e90fafb9413cc49198cf3ad5d66d433b54..6b83b22994998ba98895144ec81b4cdff1b0e0db 100644
|
||||
index e6f5cbc9c49f998d63dc8974c5b4789643b2fc87..1df4bbe26fe90eef2dc1a73faaff3c2405993491 100644
|
||||
--- a/.gn
|
||||
+++ b/.gn
|
||||
@@ -167,4 +167,8 @@ exec_script_whitelist =
|
||||
@@ -169,4 +169,8 @@ exec_script_whitelist =
|
||||
|
||||
"//tools/grit/grit_rule.gni",
|
||||
"//tools/gritsettings/BUILD.gn",
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: VerteDinde <vertedinde@electronjs.org>
|
||||
Date: Sun, 1 May 2022 18:01:42 -0700
|
||||
Subject: build: disable print_content_analysis
|
||||
|
||||
Print Content Analysis enables enterprise users to scan to-be-printed
|
||||
pages and documents for sensitive data if the OnPrintEnterpriseConnector
|
||||
policy is enabled. A conversation with the Chromium team confirmed
|
||||
this feature was intended for enterprise Chrome users and not embedders,
|
||||
so we're disabling it to prevent build issues/additional unneeded files.
|
||||
|
||||
This patch can be removed when enable_print_content_analysis can be more
|
||||
easily enabled or disabled by default with buildflags.
|
||||
|
||||
diff --git a/printing/buildflags/buildflags.gni b/printing/buildflags/buildflags.gni
|
||||
index 9382e3ed7dab7fa8992b697759addb43ec55f622..a83508602f5bd5052086d06487e3110409f313af 100644
|
||||
--- a/printing/buildflags/buildflags.gni
|
||||
+++ b/printing/buildflags/buildflags.gni
|
||||
@@ -48,7 +48,7 @@ declare_args() {
|
||||
|
||||
# Enable snapshotting a page when printing for its content to be analyzed for
|
||||
# sensitive content by enterprise users.
|
||||
- enable_print_content_analysis = is_chromeos || is_win || is_linux || is_mac
|
||||
+ enable_print_content_analysis = is_chromeos_ash || is_chromeos_lacros
|
||||
}
|
||||
|
||||
declare_args() {
|
||||
@@ -11,7 +11,7 @@ if we ever align our .pak file generation with Chrome we can remove this
|
||||
patch.
|
||||
|
||||
diff --git a/chrome/BUILD.gn b/chrome/BUILD.gn
|
||||
index 4af5b8d5da1c0ae4c5603f49e3a1dbfec422f55e..d21e450d1ee387a72bbe60141285626042a27a35 100644
|
||||
index c13bf8667c6996ec8ad4a3149993b266cea446bf..da2704e283bbaad9110ca57fb5bef786362c224e 100644
|
||||
--- a/chrome/BUILD.gn
|
||||
+++ b/chrome/BUILD.gn
|
||||
@@ -189,11 +189,16 @@ if (!is_android && !is_mac) {
|
||||
@@ -33,10 +33,10 @@ index 4af5b8d5da1c0ae4c5603f49e3a1dbfec422f55e..d21e450d1ee387a72bbe601412856260
|
||||
"//base",
|
||||
"//build:branding_buildflags",
|
||||
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
|
||||
index 0386b3db3ce09295e4a0b9490c19e85d1e03eb2d..f6d60cc17135dcb7a0125f7c3cc0286307671dff 100644
|
||||
index 0be27cd41b86673d7c8a4a8d7211a19ad8c8e36c..e67d70e81cbad7520616e5d19565d59dde1491c2 100644
|
||||
--- a/chrome/browser/BUILD.gn
|
||||
+++ b/chrome/browser/BUILD.gn
|
||||
@@ -4800,7 +4800,7 @@ static_library("browser") {
|
||||
@@ -4926,7 +4926,7 @@ static_library("browser") {
|
||||
|
||||
# On Windows, the hashes are embedded in //chrome:chrome_initial rather
|
||||
# than here in :chrome_dll.
|
||||
@@ -46,10 +46,10 @@ index 0386b3db3ce09295e4a0b9490c19e85d1e03eb2d..f6d60cc17135dcb7a0125f7c3cc02863
|
||||
sources += [ "certificate_viewer_stub.cc" ]
|
||||
}
|
||||
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn
|
||||
index d058dee3b853d66ccc5727667382b4821d75577b..3dbbbed08ca3221cf4d949a0c536ea104f6b98d2 100644
|
||||
index be760daff67da63b569dd4a523f9d0cef23a38aa..4e56d76c60fccbe5b63c974ffbefe3905f20f112 100644
|
||||
--- a/chrome/test/BUILD.gn
|
||||
+++ b/chrome/test/BUILD.gn
|
||||
@@ -7203,9 +7203,12 @@ test("unit_tests") {
|
||||
@@ -7321,9 +7321,12 @@ test("unit_tests") {
|
||||
"//chrome/browser/safe_browsing/incident_reporting/verifier_test:verifier_test_dll_2",
|
||||
]
|
||||
|
||||
@@ -63,7 +63,7 @@ index d058dee3b853d66ccc5727667382b4821d75577b..3dbbbed08ca3221cf4d949a0c536ea10
|
||||
"//chrome//services/util_win:unit_tests",
|
||||
"//chrome/app:chrome_dll_resources",
|
||||
"//chrome/app:win_unit_tests",
|
||||
@@ -8186,6 +8189,10 @@ test("unit_tests") {
|
||||
@@ -8322,6 +8325,10 @@ test("unit_tests") {
|
||||
"../browser/performance_manager/policies/background_tab_loading_policy_unittest.cc",
|
||||
]
|
||||
|
||||
@@ -74,7 +74,7 @@ index d058dee3b853d66ccc5727667382b4821d75577b..3dbbbed08ca3221cf4d949a0c536ea10
|
||||
sources += [
|
||||
# The importer code is not used on Android.
|
||||
"../common/importer/firefox_importer_utils_unittest.cc",
|
||||
@@ -8255,7 +8262,6 @@ test("unit_tests") {
|
||||
@@ -8398,7 +8405,6 @@ test("unit_tests") {
|
||||
}
|
||||
|
||||
deps += [
|
||||
|
||||
@@ -7,7 +7,7 @@ These are variables we add to the root BUILDCONFIG so that they're available
|
||||
everywhere, without having to import("//electron/.../flags.gni").
|
||||
|
||||
diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn
|
||||
index 26a23e459a62ddb6adff2748a70882aaa091a40a..237827d7a88ace74ec28208b0f879ae8354d7623 100644
|
||||
index b8cac29305c3cfb5fbc0142ae17a4d802b52d80f..1221901b690b5a7a85179d909351c5b6a6fc67bf 100644
|
||||
--- a/build/config/BUILDCONFIG.gn
|
||||
+++ b/build/config/BUILDCONFIG.gn
|
||||
@@ -123,6 +123,9 @@ if (current_os == "") {
|
||||
|
||||
@@ -7,7 +7,7 @@ Build libc++ as static library to compile and pass
|
||||
nan tests
|
||||
|
||||
diff --git a/buildtools/third_party/libc++/BUILD.gn b/buildtools/third_party/libc++/BUILD.gn
|
||||
index d425af65b5ceebfdd718bf08113987e0c0bf7a6c..21b1a753386e4bb265a29d267fc11e241183686b 100644
|
||||
index 30fad21ed77fc063cb14ec109885b9533999c69a..e7060d599f4c84b135a824454f5d260907e5427a 100644
|
||||
--- a/buildtools/third_party/libc++/BUILD.gn
|
||||
+++ b/buildtools/third_party/libc++/BUILD.gn
|
||||
@@ -45,7 +45,11 @@ config("winver") {
|
||||
@@ -32,7 +32,7 @@ index d425af65b5ceebfdd718bf08113987e0c0bf7a6c..21b1a753386e4bb265a29d267fc11e24
|
||||
]
|
||||
if (is_linux) {
|
||||
diff --git a/buildtools/third_party/libc++abi/BUILD.gn b/buildtools/third_party/libc++abi/BUILD.gn
|
||||
index b5c15a0ead70604150a14820d8a829a5aa55f981..f1f984285e39192f5e1a8c5418c13915f5aa110a 100644
|
||||
index bf3db7adc340d82ade8514a19d1bb033ec38538f..c8bcc73d8b1eefbd7851552c1e8431746c1f4b62 100644
|
||||
--- a/buildtools/third_party/libc++abi/BUILD.gn
|
||||
+++ b/buildtools/third_party/libc++abi/BUILD.gn
|
||||
@@ -6,7 +6,7 @@ import("//build/config/android/config.gni")
|
||||
|
||||
@@ -6,14 +6,16 @@ Subject: build: make libcxx_abi_unstable false for electron
|
||||
https://nornagon.medium.com/a-libc-odyssey-973e51649063
|
||||
|
||||
diff --git a/buildtools/third_party/libc++/__config_site b/buildtools/third_party/libc++/__config_site
|
||||
index 1ae42c3a02cf5929b358a6fff3dd523fc24f444e..cc81747b1ad34e3d0b29f45d275be829dd3503ff 100644
|
||||
index de3aaa04f1e2a9081ae821b964b49414cb98b375..f9726605ac2bc9bedac46480d270cd54897cbd1f 100644
|
||||
--- a/buildtools/third_party/libc++/__config_site
|
||||
+++ b/buildtools/third_party/libc++/__config_site
|
||||
@@ -12,7 +12,6 @@
|
||||
// limit for PDBs (https://crbug.com/1327710#c5). To fix this, we set
|
||||
@@ -13,7 +13,9 @@
|
||||
// _LIBCPP_ABI_NAMESPACE to a shorter value.
|
||||
#define _LIBCPP_ABI_NAMESPACE __Cr
|
||||
-#define _LIBCPP_ABI_VERSION 2
|
||||
|
||||
+#if 0
|
||||
#define _LIBCPP_ABI_VERSION 2
|
||||
+#endif
|
||||
|
||||
/* #undef _LIBCPP_ABI_FORCE_ITANIUM */
|
||||
/* #undef _LIBCPP_ABI_FORCE_MICROSOFT */
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Keeley Hammond <vertedinde@electronjs.org>
|
||||
Date: Tue, 1 Aug 2023 11:27:30 -0700
|
||||
Subject: build: remove enterprise content analysis assert
|
||||
|
||||
Chromium is using enterprise content analysis, which is something
|
||||
Electron is not concerned with. Remove this assert before building.
|
||||
This patch can be removed when we decide how we want to handle
|
||||
enterprise content analysis.
|
||||
|
||||
diff --git a/components/enterprise/buildflags/buildflags.gni b/components/enterprise/buildflags/buildflags.gni
|
||||
index fa27ba6cfe55fb2ec53b594e297abfd87831c8fa..1735969ab7b12fb6fffce0b51fd7164522dda755 100644
|
||||
--- a/components/enterprise/buildflags/buildflags.gni
|
||||
+++ b/components/enterprise/buildflags/buildflags.gni
|
||||
@@ -41,4 +41,4 @@ declare_args() {
|
||||
# These two flags are equivalent, but `enable_print_content_analysis` still
|
||||
# needs to exist separately as it lives under //printing which cannot depend
|
||||
# on //components.
|
||||
-assert(enterprise_content_analysis == enable_print_content_analysis)
|
||||
+# assert(enterprise_content_analysis == enable_print_content_analysis)
|
||||
@@ -10,10 +10,10 @@ This can't be upstreamed though may be replaceable later with some upstream refa
|
||||
around reclient config generation.
|
||||
|
||||
diff --git a/buildtools/reclient_cfgs/configure_reclient_cfgs.py b/buildtools/reclient_cfgs/configure_reclient_cfgs.py
|
||||
index 06b75f487e51f4bdef42e7f26c8c803eabd2da60..c6485d888699e2bf10ab16ec2f797dd50855c0cb 100755
|
||||
index 672f5a99575b69469137c5cf086471ec20401916..92fbfcbd119c48c2d8a09628ac4d73fcdb232870 100755
|
||||
--- a/buildtools/reclient_cfgs/configure_reclient_cfgs.py
|
||||
+++ b/buildtools/reclient_cfgs/configure_reclient_cfgs.py
|
||||
@@ -329,4 +329,13 @@ def main():
|
||||
@@ -382,4 +382,13 @@ def main():
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -9,10 +9,10 @@ potentially prevent a window from being created.
|
||||
TODO(loc): this patch is currently broken.
|
||||
|
||||
diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc
|
||||
index 2c985367d1c6268994b9973d3db2e065a80922eb..812708f24cf9e389d5f0a813c406fec082a795b4 100644
|
||||
index 3821695f6561ff8e00d861ce49ea7ff27f5fcd7e..9829a91d59853d74b4fc1fed5032d4d090912987 100644
|
||||
--- a/content/browser/renderer_host/render_frame_host_impl.cc
|
||||
+++ b/content/browser/renderer_host/render_frame_host_impl.cc
|
||||
@@ -8391,6 +8391,7 @@ void RenderFrameHostImpl::CreateNewWindow(
|
||||
@@ -8555,6 +8555,7 @@ void RenderFrameHostImpl::CreateNewWindow(
|
||||
last_committed_origin_, params->window_container_type,
|
||||
params->target_url, params->referrer.To<Referrer>(),
|
||||
params->frame_name, params->disposition, *params->features,
|
||||
@@ -21,10 +21,10 @@ index 2c985367d1c6268994b9973d3db2e065a80922eb..812708f24cf9e389d5f0a813c406fec0
|
||||
&no_javascript_access);
|
||||
|
||||
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
|
||||
index a3074afab886754b4d6a7e9a5f7f6eca6e5d3aa9..45ac0c129cff1187aa14d989470235de4f0419f1 100644
|
||||
index eb1953c745c770a00da2a27d60e31e820af98e49..050126d33d440e19821adfdb365da746dbc16e5b 100644
|
||||
--- a/content/browser/web_contents/web_contents_impl.cc
|
||||
+++ b/content/browser/web_contents/web_contents_impl.cc
|
||||
@@ -4586,6 +4586,12 @@ FrameTree* WebContentsImpl::CreateNewWindow(
|
||||
@@ -4668,6 +4668,12 @@ FrameTree* WebContentsImpl::CreateNewWindow(
|
||||
|
||||
auto* new_contents_impl = new_contents.get();
|
||||
|
||||
@@ -37,7 +37,7 @@ index a3074afab886754b4d6a7e9a5f7f6eca6e5d3aa9..45ac0c129cff1187aa14d989470235de
|
||||
// If the new frame has a name, make sure any SiteInstances that can find
|
||||
// this named frame have proxies for it. Must be called after
|
||||
// SetSessionStorageNamespace, since this calls CreateRenderView, which uses
|
||||
@@ -4627,12 +4633,6 @@ FrameTree* WebContentsImpl::CreateNewWindow(
|
||||
@@ -4709,12 +4715,6 @@ FrameTree* WebContentsImpl::CreateNewWindow(
|
||||
AddWebContentsDestructionObserver(new_contents_impl);
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ index a3074afab886754b4d6a7e9a5f7f6eca6e5d3aa9..45ac0c129cff1187aa14d989470235de
|
||||
new_contents_impl, opener, params.target_url,
|
||||
params.referrer.To<Referrer>(), params.disposition,
|
||||
diff --git a/content/common/frame.mojom b/content/common/frame.mojom
|
||||
index 268f150c1cc987ea020192a86ab886ed206a0064..05856b853112072a18ec16589f2b442f2b1330b2 100644
|
||||
index d72ce84100f584832b22058648e7f21ae8325236..4f010247091564573b1511f163c5d874f2d431b6 100644
|
||||
--- a/content/common/frame.mojom
|
||||
+++ b/content/common/frame.mojom
|
||||
@@ -603,6 +603,10 @@ struct CreateNewWindowParams {
|
||||
@@ -66,10 +66,10 @@ index 268f150c1cc987ea020192a86ab886ed206a0064..05856b853112072a18ec16589f2b442f
|
||||
|
||||
// Operation result when the renderer asks the browser to create a new window.
|
||||
diff --git a/content/public/browser/content_browser_client.cc b/content/public/browser/content_browser_client.cc
|
||||
index 465de2f945f3afff3107ce750a320696c4db920f..6635f7d3932a8cfa133d830860b69915690b91ad 100644
|
||||
index 62fed61bd87f19363fab39b19a1fdad4074970c5..da00f63496d57d3d0a8b66334f8b6efcd6172f85 100644
|
||||
--- a/content/public/browser/content_browser_client.cc
|
||||
+++ b/content/public/browser/content_browser_client.cc
|
||||
@@ -718,6 +718,8 @@ bool ContentBrowserClient::CanCreateWindow(
|
||||
@@ -728,6 +728,8 @@ bool ContentBrowserClient::CanCreateWindow(
|
||||
const std::string& frame_name,
|
||||
WindowOpenDisposition disposition,
|
||||
const blink::mojom::WindowFeatures& features,
|
||||
@@ -79,10 +79,10 @@ index 465de2f945f3afff3107ce750a320696c4db920f..6635f7d3932a8cfa133d830860b69915
|
||||
bool opener_suppressed,
|
||||
bool* no_javascript_access) {
|
||||
diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h
|
||||
index 9e1cf142f77d221aad87cdbc17054f06ce7f28cf..1d5e065aa06bc3175f9abdce25e31864aa06f78d 100644
|
||||
index 406607bd325632892d79f0e5cd3b5fc4b9fe991c..d86c5f709d2c05914800a660fe240768fe8911c6 100644
|
||||
--- a/content/public/browser/content_browser_client.h
|
||||
+++ b/content/public/browser/content_browser_client.h
|
||||
@@ -183,6 +183,7 @@ class NetworkService;
|
||||
@@ -186,6 +186,7 @@ class NetworkService;
|
||||
class TrustedURLLoaderHeaderClient;
|
||||
} // namespace mojom
|
||||
struct ResourceRequest;
|
||||
@@ -90,7 +90,7 @@ index 9e1cf142f77d221aad87cdbc17054f06ce7f28cf..1d5e065aa06bc3175f9abdce25e31864
|
||||
} // namespace network
|
||||
|
||||
namespace sandbox {
|
||||
@@ -1210,6 +1211,8 @@ class CONTENT_EXPORT ContentBrowserClient {
|
||||
@@ -1228,6 +1229,8 @@ class CONTENT_EXPORT ContentBrowserClient {
|
||||
const std::string& frame_name,
|
||||
WindowOpenDisposition disposition,
|
||||
const blink::mojom::WindowFeatures& features,
|
||||
@@ -100,7 +100,7 @@ index 9e1cf142f77d221aad87cdbc17054f06ce7f28cf..1d5e065aa06bc3175f9abdce25e31864
|
||||
bool opener_suppressed,
|
||||
bool* no_javascript_access);
|
||||
diff --git a/content/public/browser/web_contents_delegate.cc b/content/public/browser/web_contents_delegate.cc
|
||||
index a354e100b04423b9793bc17473711fab9ca91c7e..2b03b5b0152678a4f2fa64cabab0dc511cea0f79 100644
|
||||
index f4d46dafea0a08e29ae0690b2e31cd8fc438453e..2e6025fa3f4cecedb6c563eba887463aea634830 100644
|
||||
--- a/content/public/browser/web_contents_delegate.cc
|
||||
+++ b/content/public/browser/web_contents_delegate.cc
|
||||
@@ -30,6 +30,17 @@ namespace content {
|
||||
@@ -118,11 +118,11 @@ index a354e100b04423b9793bc17473711fab9ca91c7e..2b03b5b0152678a4f2fa64cabab0dc51
|
||||
+ params.target_url, new_contents);
|
||||
+}
|
||||
+
|
||||
WebContents* WebContentsDelegate::OpenURLFromTab(WebContents* source,
|
||||
const OpenURLParams& params) {
|
||||
return nullptr;
|
||||
WebContents* WebContentsDelegate::OpenURLFromTab(
|
||||
WebContents* source,
|
||||
const OpenURLParams& params,
|
||||
diff --git a/content/public/browser/web_contents_delegate.h b/content/public/browser/web_contents_delegate.h
|
||||
index c44ef9991cbb07ab2895a28a890466ce1bc8235f..1384a322617b4be4b4ffbda5c44b41ac05bc8977 100644
|
||||
index 7c43ffab6a865952e9cea62db031c7d7e867b10e..a093cac4660c1a3c38fc0baccee40780e0ee47cf 100644
|
||||
--- a/content/public/browser/web_contents_delegate.h
|
||||
+++ b/content/public/browser/web_contents_delegate.h
|
||||
@@ -17,6 +17,7 @@
|
||||
@@ -133,7 +133,7 @@ index c44ef9991cbb07ab2895a28a890466ce1bc8235f..1384a322617b4be4b4ffbda5c44b41ac
|
||||
#include "content/public/browser/eye_dropper.h"
|
||||
#include "content/public/browser/fullscreen_types.h"
|
||||
#include "content/public/browser/invalidate_type.h"
|
||||
@@ -347,6 +348,13 @@ class CONTENT_EXPORT WebContentsDelegate {
|
||||
@@ -355,6 +356,13 @@ class CONTENT_EXPORT WebContentsDelegate {
|
||||
const StoragePartitionConfig& partition_config,
|
||||
SessionStorageNamespace* session_storage_namespace);
|
||||
|
||||
@@ -148,10 +148,10 @@ index c44ef9991cbb07ab2895a28a890466ce1bc8235f..1384a322617b4be4b4ffbda5c44b41ac
|
||||
// typically happens when popups are created.
|
||||
virtual void WebContentsCreated(WebContents* source_contents,
|
||||
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
|
||||
index f362ee7c232419eba8f00422fa5379e6af96eae7..0ac529a0b19d0d88b57bbab89f60b888c480051e 100644
|
||||
index c8113196eeb34e2067b83297577eed4464e8059c..2d7d13fc9f361bc3e4b16e4db008c042f492704a 100644
|
||||
--- a/content/renderer/render_frame_impl.cc
|
||||
+++ b/content/renderer/render_frame_impl.cc
|
||||
@@ -6691,6 +6691,10 @@ WebView* RenderFrameImpl::CreateNewWindow(
|
||||
@@ -6694,6 +6694,10 @@ WebView* RenderFrameImpl::CreateNewWindow(
|
||||
request.HasUserGesture(), GetWebFrame()->IsAdFrame(),
|
||||
GetWebFrame()->IsAdScriptInStack());
|
||||
|
||||
@@ -163,10 +163,10 @@ index f362ee7c232419eba8f00422fa5379e6af96eae7..0ac529a0b19d0d88b57bbab89f60b888
|
||||
// moved on send.
|
||||
bool is_background_tab =
|
||||
diff --git a/content/web_test/browser/web_test_content_browser_client.cc b/content/web_test/browser/web_test_content_browser_client.cc
|
||||
index 6cf5db64b526cd99c7f3f093035e934d1ce5f96f..08869632d8b68ae60d942a20657c33e58fd64e08 100644
|
||||
index d69026ae4fef521c8f1d18919639cde3504e7880..1ccfbdca49b80f1d028ab677a34313507f235ca3 100644
|
||||
--- a/content/web_test/browser/web_test_content_browser_client.cc
|
||||
+++ b/content/web_test/browser/web_test_content_browser_client.cc
|
||||
@@ -512,6 +512,8 @@ bool WebTestContentBrowserClient::CanCreateWindow(
|
||||
@@ -515,6 +515,8 @@ bool WebTestContentBrowserClient::CanCreateWindow(
|
||||
const std::string& frame_name,
|
||||
WindowOpenDisposition disposition,
|
||||
const blink::mojom::WindowFeatures& features,
|
||||
@@ -176,10 +176,10 @@ index 6cf5db64b526cd99c7f3f093035e934d1ce5f96f..08869632d8b68ae60d942a20657c33e5
|
||||
bool opener_suppressed,
|
||||
bool* no_javascript_access) {
|
||||
diff --git a/content/web_test/browser/web_test_content_browser_client.h b/content/web_test/browser/web_test_content_browser_client.h
|
||||
index d1f87a94783603ab7f996d70fde25c483f5578ec..d54efdc990d56df5690c763eec71650b5f121bcb 100644
|
||||
index 53949c3510d0755e608847e174de63f46c8c2363..f6644476d8714fd02480830ebb0f0571de8ea262 100644
|
||||
--- a/content/web_test/browser/web_test_content_browser_client.h
|
||||
+++ b/content/web_test/browser/web_test_content_browser_client.h
|
||||
@@ -90,6 +90,8 @@ class WebTestContentBrowserClient : public ShellContentBrowserClient {
|
||||
@@ -91,6 +91,8 @@ class WebTestContentBrowserClient : public ShellContentBrowserClient {
|
||||
const std::string& frame_name,
|
||||
WindowOpenDisposition disposition,
|
||||
const blink::mojom::WindowFeatures& features,
|
||||
@@ -210,7 +210,7 @@ index 78956238f8d959580e928d2590866b2f4da3d218..806b3337ec8a8ad7c89681857b4e81dc
|
||||
|
||||
} // namespace blink
|
||||
diff --git a/third_party/blink/renderer/core/frame/local_dom_window.cc b/third_party/blink/renderer/core/frame/local_dom_window.cc
|
||||
index 86d62960d31c31caff100bfefda6975b366a3197..813d4713fac7de050d16f81f187ea1e1d12cd473 100644
|
||||
index 22ad72f457bcd70d6448b9313d21c9cad0a4df11..95b5fb46bbf3895428f9d9d3cfdf2ffe269bcc8d 100644
|
||||
--- a/third_party/blink/renderer/core/frame/local_dom_window.cc
|
||||
+++ b/third_party/blink/renderer/core/frame/local_dom_window.cc
|
||||
@@ -2231,6 +2231,8 @@ DOMWindow* LocalDOMWindow::open(v8::Isolate* isolate,
|
||||
|
||||
@@ -1,139 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: John Stiles <johnstiles@google.com>
|
||||
Date: Thu, 28 Mar 2024 00:51:13 +0000
|
||||
Subject: Detect overflow in JPEG image size calculations.
|
||||
|
||||
Bug: 330756841
|
||||
Change-Id: Ib30493152e08fd2347f76de276c5805d6fef9a7d
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5402199
|
||||
Commit-Queue: John Stiles <johnstiles@google.com>
|
||||
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
|
||||
Cr-Commit-Position: refs/heads/main@{#1279376}
|
||||
|
||||
diff --git a/ui/gfx/codec/jpeg_codec.cc b/ui/gfx/codec/jpeg_codec.cc
|
||||
index a4de17094e69b36bb2c34b3b4f70eece9c088cc3..595966d724146df33701b1225e659ec085ca115b 100644
|
||||
--- a/ui/gfx/codec/jpeg_codec.cc
|
||||
+++ b/ui/gfx/codec/jpeg_codec.cc
|
||||
@@ -6,10 +6,12 @@
|
||||
|
||||
#include <setjmp.h>
|
||||
|
||||
+#include <climits>
|
||||
#include <memory>
|
||||
#include <ostream>
|
||||
|
||||
#include "base/notreached.h"
|
||||
+#include "base/numerics/checked_math.h"
|
||||
#include "third_party/skia/include/core/SkBitmap.h"
|
||||
#include "third_party/skia/include/core/SkColorPriv.h"
|
||||
#include "ui/gfx/codec/vector_wstream.h"
|
||||
@@ -244,16 +246,27 @@ bool JPEGCodec::Decode(const unsigned char* input, size_t input_size,
|
||||
|
||||
jpeg_start_decompress(cinfo.get());
|
||||
|
||||
- // FIXME(brettw) we may want to allow the capability for callers to request
|
||||
- // how to align row lengths as we do for the compressor.
|
||||
- int row_read_stride = cinfo->output_width * cinfo->output_components;
|
||||
+ // Confirm that the image width * height * component-size fits within an int.
|
||||
+ // Note that image width and height are unsigned ints (JDIMENSION) in memory,
|
||||
+ // but the file format only holds a uint16.
|
||||
+ base::CheckedNumeric<size_t> checked_output_size = cinfo->output_width;
|
||||
+ checked_output_size *= cinfo->output_components;
|
||||
|
||||
- // Create memory for a decoded image and write decoded lines to the memory
|
||||
- // without conversions same as JPEGCodec::Encode().
|
||||
- int row_write_stride = row_read_stride;
|
||||
- output->resize(row_write_stride * cinfo->output_height);
|
||||
+ // This shouldn't ever overflow a `size_t`; it's multiplying a uint16 by four.
|
||||
+ size_t row_write_stride = checked_output_size.ValueOrDie();
|
||||
|
||||
- for (int row = 0; row < static_cast<int>(cinfo->output_height); row++) {
|
||||
+ // Extremely large JPEGs could overflow here if `size_t` is 32 bits.
|
||||
+ checked_output_size *= cinfo->output_height;
|
||||
+ size_t output_size = checked_output_size.ValueOrDefault(INT_MAX);
|
||||
+ if (output_size >= INT_MAX) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ // Create memory for a decoded image.
|
||||
+ output->resize(output_size);
|
||||
+
|
||||
+ // Write decoded lines to the memory.
|
||||
+ for (unsigned int row = 0; row < cinfo->output_height; row++) {
|
||||
unsigned char* rowptr = &(*output)[row * row_write_stride];
|
||||
if (!jpeg_read_scanlines(cinfo.get(), &rowptr, 1))
|
||||
return false;
|
||||
diff --git a/ui/gfx/codec/jpeg_codec_unittest.cc b/ui/gfx/codec/jpeg_codec_unittest.cc
|
||||
index 9f1bee95e0e476b34382aceffbf6df3bdde095ea..b446fe77896e254820db77afe7ed4e48b8525c79 100644
|
||||
--- a/ui/gfx/codec/jpeg_codec_unittest.cc
|
||||
+++ b/ui/gfx/codec/jpeg_codec_unittest.cc
|
||||
@@ -61,6 +61,53 @@ const uint8_t kTopSitesMigrationTestImage[] =
|
||||
"\xfa\xff\xda\x00\x0c\x03\x01\x00\x02\x11\x03\x11\x00\x3f\x00\xf9"
|
||||
"\xd2\x8a\x28\xaf\xc3\x0f\xf5\x4c\xff\xd9";
|
||||
|
||||
+// This is a copy of the above JPEG, with the Start-of-Frame header manually
|
||||
+// rewritten to indicate an image size of 25000x25000. An image this large would
|
||||
+// require more than 2GB of RAM to decode, so the decoder will reject the image
|
||||
+// as soon as the header is parsed.
|
||||
+const uint8_t kExtremelyLargeTestImage[] =
|
||||
+ "\xff\xd8\xff\xe0\x00\x10\x4a\x46\x49\x46\x00\x01\x01\x00\x00\x01"
|
||||
+ "\x00\x01\x00\x00\xff\xdb\x00\x43\x00\x03\x02\x02\x03\x02\x02\x03"
|
||||
+ "\x03\x03\x03\x04\x03\x03\x04\x05\x08\x05\x05\x04\x04\x05\x0a\x07"
|
||||
+ "\x07\x06\x08\x0c\x0a\x0c\x0c\x0b\x0a\x0b\x0b\x0d\x0e\x12\x10\x0d"
|
||||
+ "\x0e\x11\x0e\x0b\x0b\x10\x16\x10\x11\x13\x14\x15\x15\x15\x0c\x0f"
|
||||
+ "\x17\x18\x16\x14\x18\x12\x14\x15\x14\xff\xdb\x00\x43\x01\x03\x04"
|
||||
+ "\x04\x05\x04\x05\x09\x05\x05\x09\x14\x0d\x0b\x0d\x14\x14\x14\x14"
|
||||
+ "\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14"
|
||||
+ "\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14"
|
||||
+ "\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\xff\xc0"
|
||||
+ "\x00\x11\x08\x61\xa8\x61\xa8\x03\x01\x22\x00\x02\x11\x01\x03\x11"
|
||||
+ // ^^ ^^ ^^ ^^ image size forced to 25000x25000
|
||||
+ "\x01\xff\xc4\x00\x1f\x00\x00\x01\x05\x01\x01\x01\x01\x01\x01\x00"
|
||||
+ "\x00\x00\x00\x00\x00\x00\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09"
|
||||
+ "\x0a\x0b\xff\xc4\x00\xb5\x10\x00\x02\x01\x03\x03\x02\x04\x03\x05"
|
||||
+ "\x05\x04\x04\x00\x00\x01\x7d\x01\x02\x03\x00\x04\x11\x05\x12\x21"
|
||||
+ "\x31\x41\x06\x13\x51\x61\x07\x22\x71\x14\x32\x81\x91\xa1\x08\x23"
|
||||
+ "\x42\xb1\xc1\x15\x52\xd1\xf0\x24\x33\x62\x72\x82\x09\x0a\x16\x17"
|
||||
+ "\x18\x19\x1a\x25\x26\x27\x28\x29\x2a\x34\x35\x36\x37\x38\x39\x3a"
|
||||
+ "\x43\x44\x45\x46\x47\x48\x49\x4a\x53\x54\x55\x56\x57\x58\x59\x5a"
|
||||
+ "\x63\x64\x65\x66\x67\x68\x69\x6a\x73\x74\x75\x76\x77\x78\x79\x7a"
|
||||
+ "\x83\x84\x85\x86\x87\x88\x89\x8a\x92\x93\x94\x95\x96\x97\x98\x99"
|
||||
+ "\x9a\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xb2\xb3\xb4\xb5\xb6\xb7"
|
||||
+ "\xb8\xb9\xba\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xd2\xd3\xd4\xd5"
|
||||
+ "\xd6\xd7\xd8\xd9\xda\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xf1"
|
||||
+ "\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xff\xc4\x00\x1f\x01\x00\x03"
|
||||
+ "\x01\x01\x01\x01\x01\x01\x01\x01\x01\x00\x00\x00\x00\x00\x00\x01"
|
||||
+ "\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\xff\xc4\x00\xb5\x11\x00"
|
||||
+ "\x02\x01\x02\x04\x04\x03\x04\x07\x05\x04\x04\x00\x01\x02\x77\x00"
|
||||
+ "\x01\x02\x03\x11\x04\x05\x21\x31\x06\x12\x41\x51\x07\x61\x71\x13"
|
||||
+ "\x22\x32\x81\x08\x14\x42\x91\xa1\xb1\xc1\x09\x23\x33\x52\xf0\x15"
|
||||
+ "\x62\x72\xd1\x0a\x16\x24\x34\xe1\x25\xf1\x17\x18\x19\x1a\x26\x27"
|
||||
+ "\x28\x29\x2a\x35\x36\x37\x38\x39\x3a\x43\x44\x45\x46\x47\x48\x49"
|
||||
+ "\x4a\x53\x54\x55\x56\x57\x58\x59\x5a\x63\x64\x65\x66\x67\x68\x69"
|
||||
+ "\x6a\x73\x74\x75\x76\x77\x78\x79\x7a\x82\x83\x84\x85\x86\x87\x88"
|
||||
+ "\x89\x8a\x92\x93\x94\x95\x96\x97\x98\x99\x9a\xa2\xa3\xa4\xa5\xa6"
|
||||
+ "\xa7\xa8\xa9\xaa\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xc2\xc3\xc4"
|
||||
+ "\xc5\xc6\xc7\xc8\xc9\xca\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xe2"
|
||||
+ "\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9"
|
||||
+ "\xfa\xff\xda\x00\x0c\x03\x01\x00\x02\x11\x03\x11\x00\x3f\x00\xf9"
|
||||
+ "\xd2\x8a\x28\xaf\xc3\x0f\xf5\x4c\xff\xd9";
|
||||
+
|
||||
} // namespace
|
||||
|
||||
namespace gfx {
|
||||
@@ -211,4 +258,15 @@ TEST(JPEGCodec, ParallelEncoding) {
|
||||
encode_loop.Run();
|
||||
}
|
||||
|
||||
+TEST(JPEGCodec, ExtremelyLargeImage) {
|
||||
+ std::vector<unsigned char> output;
|
||||
+ int outw, outh;
|
||||
+ bool ok = JPEGCodec::Decode(kExtremelyLargeTestImage,
|
||||
+ std::size(kExtremelyLargeTestImage),
|
||||
+ JPEGCodec::FORMAT_RGBA, &output, &outw, &outh);
|
||||
+ EXPECT_FALSE(ok);
|
||||
+ EXPECT_EQ(outw, 25000);
|
||||
+ EXPECT_EQ(outh, 25000);
|
||||
+}
|
||||
+
|
||||
} // namespace gfx
|
||||
@@ -1,84 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Bryant Chandler <bryantchandler@chromium.org>
|
||||
Date: Mon, 24 Jun 2024 17:28:53 +0000
|
||||
Subject: Fix pointer tear down order problem
|
||||
|
||||
Holding a RenderFrameHost* in the `OnceBinding` isn't safe,
|
||||
because the `RenderFrameHost` can be destroyed before the
|
||||
binding. This CL changes the task strategy so that the
|
||||
RenderFrameHost* doesn't need to be bound in a callback.
|
||||
|
||||
Tested using the repro steps in the bug and this change stops
|
||||
it from reproducing.
|
||||
|
||||
Fixed: 347373236
|
||||
Change-Id: Id639f317b0f37a508833aba9fe52ffc5c0ed590c
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5640501
|
||||
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
|
||||
Commit-Queue: Bryant Chandler <bryantchandler@chromium.org>
|
||||
Reviewed-by: Guido Urdaneta <guidou@chromium.org>
|
||||
Cr-Commit-Position: refs/heads/main@{#1318653}
|
||||
|
||||
diff --git a/content/browser/renderer_host/media/media_stream_manager.cc b/content/browser/renderer_host/media/media_stream_manager.cc
|
||||
index 65bee7132f6583cb64d774756423942382c8eed6..2c27db7ee49193cbf91158d576e29bb255378a3e 100644
|
||||
--- a/content/browser/renderer_host/media/media_stream_manager.cc
|
||||
+++ b/content/browser/renderer_host/media/media_stream_manager.cc
|
||||
@@ -2887,25 +2887,19 @@ void MediaStreamManager::GetRawDeviceIdsOpenedForFrame(
|
||||
RenderFrameHost* render_frame_host,
|
||||
blink::mojom::MediaStreamType type,
|
||||
GetRawDeviceIdsOpenedForFrameCallback callback) const {
|
||||
- DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
||||
- CHECK(render_frame_host);
|
||||
- auto collect_all_render_frame_host_ids = base::BindOnce(
|
||||
- [](RenderFrameHost* render_frame_host) {
|
||||
- base::flat_set<GlobalRenderFrameHostId> all_render_frame_host_ids;
|
||||
- render_frame_host->ForEachRenderFrameHost(
|
||||
- [&all_render_frame_host_ids](RenderFrameHost* render_frame_host) {
|
||||
- all_render_frame_host_ids.insert(
|
||||
- render_frame_host->GetGlobalId());
|
||||
- });
|
||||
- return all_render_frame_host_ids;
|
||||
- },
|
||||
- render_frame_host);
|
||||
-
|
||||
- GetUIThreadTaskRunner()->PostTaskAndReplyWithResult(
|
||||
- FROM_HERE, std::move(collect_all_render_frame_host_ids),
|
||||
- base::BindPostTaskToCurrentDefault(
|
||||
- base::BindOnce(&MediaStreamManager::GetRawDeviceIdsOpenedForFrameIds,
|
||||
- base::Unretained(this), type, std::move(callback))));
|
||||
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
||||
+
|
||||
+ base::flat_set<GlobalRenderFrameHostId> all_render_frame_host_ids;
|
||||
+ render_frame_host->ForEachRenderFrameHost(
|
||||
+ [&all_render_frame_host_ids](RenderFrameHost* render_frame_host) {
|
||||
+ all_render_frame_host_ids.insert(render_frame_host->GetGlobalId());
|
||||
+ });
|
||||
+
|
||||
+ GetIOThreadTaskRunner()->PostTask(
|
||||
+ FROM_HERE,
|
||||
+ base::BindOnce(&MediaStreamManager::GetRawDeviceIdsOpenedForFrameIds,
|
||||
+ base::Unretained(this), type, std::move(callback),
|
||||
+ all_render_frame_host_ids));
|
||||
}
|
||||
|
||||
void MediaStreamManager::GetRawDeviceIdsOpenedForFrameIds(
|
||||
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
|
||||
index b0b1d0aea5bf251411d0cab06562fd77d8d7c549..819c73370d6e6fc5e6ab24e78646a206b6a5873d 100644
|
||||
--- a/content/browser/web_contents/web_contents_impl.cc
|
||||
+++ b/content/browser/web_contents/web_contents_impl.cc
|
||||
@@ -10808,12 +10808,9 @@ void WebContentsImpl::GetMediaCaptureRawDeviceIdsOpened(
|
||||
return;
|
||||
}
|
||||
|
||||
- GetIOThreadTaskRunner({})->PostTask(
|
||||
- FROM_HERE,
|
||||
- base::BindOnce(&MediaStreamManager::GetRawDeviceIdsOpenedForFrame,
|
||||
- base::Unretained(media_stream_manager),
|
||||
- GetPrimaryMainFrame(), type,
|
||||
- base::BindPostTaskToCurrentDefault(std::move(callback))));
|
||||
+ media_stream_manager->GetRawDeviceIdsOpenedForFrame(
|
||||
+ GetPrimaryMainFrame(), type,
|
||||
+ base::BindPostTaskToCurrentDefault(std::move(callback)));
|
||||
}
|
||||
|
||||
} // namespace content
|
||||
@@ -1,88 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Johannes Kron <kron@chromium.org>
|
||||
Date: Wed, 19 Jun 2024 20:59:48 +0000
|
||||
Subject: Use BindPostTask() + weak pointer in callback handler
|
||||
|
||||
The callback handler incorrectly accessed member objects directly which may
|
||||
cause UAF. Avoid this by using BindPostTask() together with a weak pointer.
|
||||
|
||||
Fixed: 346898524
|
||||
Change-Id: I9d03d6decfd0212af88d3d0d8d70f83f1081d2e3
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5639016
|
||||
Reviewed-by: Avi Drissman <avi@chromium.org>
|
||||
Reviewed-by: Mark Foltz <mfoltz@chromium.org>
|
||||
Commit-Queue: Johannes Kron <kron@chromium.org>
|
||||
Cr-Commit-Position: refs/heads/main@{#1317142}
|
||||
|
||||
diff --git a/content/browser/media/capture/screen_capture_kit_device_mac.mm b/content/browser/media/capture/screen_capture_kit_device_mac.mm
|
||||
index 4fb3e8eb5f34a7ee9e8b0f22a7c842129cdc31eb..e2710fba1a8d7a4cee6023558898c74706a9c189 100644
|
||||
--- a/content/browser/media/capture/screen_capture_kit_device_mac.mm
|
||||
+++ b/content/browser/media/capture/screen_capture_kit_device_mac.mm
|
||||
@@ -326,13 +326,18 @@ void OnStreamSample(gfx::ScopedInUseIOSurface io_surface,
|
||||
destRectInFrame:dest_rect_in_frame
|
||||
frameRate:requested_capture_format_->
|
||||
frame_rate];
|
||||
+
|
||||
+ __block base::OnceCallback<void()> on_update_configuration_error =
|
||||
+ base::BindPostTask(
|
||||
+ device_task_runner_,
|
||||
+ base::BindOnce(
|
||||
+ &ScreenCaptureKitDeviceMac::OnUpdateConfigurationError,
|
||||
+ weak_factory_.GetWeakPtr()));
|
||||
[stream_
|
||||
updateConfiguration:config
|
||||
completionHandler:^(NSError* _Nullable error) {
|
||||
if (error) {
|
||||
- client()->OnError(
|
||||
- media::VideoCaptureError::kScreenCaptureKitStreamError,
|
||||
- FROM_HERE, "Error on updateConfiguration");
|
||||
+ std::move(on_update_configuration_error).Run();
|
||||
}
|
||||
}];
|
||||
}
|
||||
@@ -361,6 +366,21 @@ void OnStreamError() {
|
||||
FROM_HERE, "Stream delegate called didStopWithError");
|
||||
}
|
||||
}
|
||||
+ void OnUpdateContentFilterCompleted(NSError* _Nullable error) {
|
||||
+ DCHECK(device_task_runner_->RunsTasksInCurrentSequence());
|
||||
+ is_resetting_ = false;
|
||||
+
|
||||
+ if (error) {
|
||||
+ client()->OnError(media::VideoCaptureError::kScreenCaptureKitStreamError,
|
||||
+ FROM_HERE,
|
||||
+ "Error on updateContentFilter (fullscreen window).");
|
||||
+ }
|
||||
+ }
|
||||
+ void OnUpdateConfigurationError() {
|
||||
+ DCHECK(device_task_runner_->RunsTasksInCurrentSequence());
|
||||
+ client()->OnError(media::VideoCaptureError::kScreenCaptureKitStreamError,
|
||||
+ FROM_HERE, "Error on updateConfiguration");
|
||||
+ }
|
||||
|
||||
// IOSurfaceCaptureDeviceBase:
|
||||
void OnStart() override {
|
||||
@@ -411,15 +431,16 @@ void ResetStreamTo(SCWindow* window) override {
|
||||
SCContentFilter* filter =
|
||||
[[SCContentFilter alloc] initWithDesktopIndependentWindow:window];
|
||||
|
||||
+ __block base::OnceCallback<void(NSError*)>
|
||||
+ on_update_content_filter_completed = base::BindPostTask(
|
||||
+ device_task_runner_,
|
||||
+ base::BindOnce(
|
||||
+ &ScreenCaptureKitDeviceMac::OnUpdateContentFilterCompleted,
|
||||
+ weak_factory_.GetWeakPtr()));
|
||||
+
|
||||
[stream_ updateContentFilter:filter
|
||||
completionHandler:^(NSError* _Nullable error) {
|
||||
- is_resetting_ = false;
|
||||
- if (error) {
|
||||
- client()->OnError(
|
||||
- media::VideoCaptureError::kScreenCaptureKitStreamError,
|
||||
- FROM_HERE,
|
||||
- "Error on updateContentFilter (fullscreen window).");
|
||||
- }
|
||||
+ std::move(on_update_content_filter_completed).Run(error);
|
||||
}];
|
||||
}
|
||||
|
||||
@@ -1,264 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Philip Pfaffe <pfaffe@chromium.org>
|
||||
Date: Tue, 18 Jun 2024 10:04:45 +0000
|
||||
Subject: Prevent script injection on reload when racing with a navigation
|
||||
|
||||
DevTools passes the loaderId now when calling Page.reload, in order to
|
||||
prevent accidentally reloading the wrong page when a navigation occurred
|
||||
concurrently. It can still happen that the navigation kicks in in between the reload iniated in the browser and the script injection that happens in the renderer, which would run the injected script on the wrong target. We need to check the loaderId also on the renderer side.
|
||||
|
||||
Fixed: 341136300
|
||||
Change-Id: I891fb37fa10e6789c8697a0f29bf7118788a9319
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5625857
|
||||
Reviewed-by: Andrey Kosyakov <caseq@chromium.org>
|
||||
Commit-Queue: Philip Pfaffe <pfaffe@chromium.org>
|
||||
Cr-Commit-Position: refs/heads/main@{#1316330}
|
||||
|
||||
diff --git a/third_party/blink/renderer/core/inspector/build.gni b/third_party/blink/renderer/core/inspector/build.gni
|
||||
index 2e9feebe066f938506d63d157be65828aa2a27c9..39de006f5f97f9e2a84ee4d38f7bb98e99c41924 100644
|
||||
--- a/third_party/blink/renderer/core/inspector/build.gni
|
||||
+++ b/third_party/blink/renderer/core/inspector/build.gni
|
||||
@@ -138,6 +138,7 @@ blink_core_tests_inspector = [
|
||||
"inspector_emulation_agent_test.cc",
|
||||
"inspector_highlight_test.cc",
|
||||
"inspector_history_test.cc",
|
||||
+ "inspector_page_agent_unittest.cc",
|
||||
"inspector_preload_agent_unittest.cc",
|
||||
"inspector_media_context_impl_unittest.cc",
|
||||
"inspector_session_state_test.cc",
|
||||
diff --git a/third_party/blink/renderer/core/inspector/inspector_page_agent.cc b/third_party/blink/renderer/core/inspector/inspector_page_agent.cc
|
||||
index 1825080b32ab6d7adb86236a389c08caf0b90c5c..f17565a6178c3f47037378faf965cd0f52cb0d26 100644
|
||||
--- a/third_party/blink/renderer/core/inspector/inspector_page_agent.cc
|
||||
+++ b/third_party/blink/renderer/core/inspector/inspector_page_agent.cc
|
||||
@@ -479,6 +479,42 @@ String InspectorPageAgent::CachedResourceTypeJson(
|
||||
return ResourceTypeJson(ToResourceType(cached_resource.GetType()));
|
||||
}
|
||||
|
||||
+InspectorPageAgent::PageReloadScriptInjection::PageReloadScriptInjection(
|
||||
+ InspectorAgentState& agent_state)
|
||||
+ : pending_script_to_evaluate_on_load_once_(&agent_state,
|
||||
+ /*default_value=*/{}),
|
||||
+ target_url_for_pending_script_(&agent_state,
|
||||
+ /*default_value=*/{}) {}
|
||||
+
|
||||
+void InspectorPageAgent::PageReloadScriptInjection::clear() {
|
||||
+ script_to_evaluate_on_load_once_ = {};
|
||||
+ pending_script_to_evaluate_on_load_once_.Set({});
|
||||
+ target_url_for_pending_script_.Set({});
|
||||
+}
|
||||
+
|
||||
+void InspectorPageAgent::PageReloadScriptInjection::SetPending(
|
||||
+ String script,
|
||||
+ const KURL& target_url) {
|
||||
+ pending_script_to_evaluate_on_load_once_.Set(script);
|
||||
+ target_url_for_pending_script_.Set(target_url.GetString().GetString());
|
||||
+}
|
||||
+
|
||||
+void InspectorPageAgent::PageReloadScriptInjection::PromoteToLoadOnce() {
|
||||
+ script_to_evaluate_on_load_once_ =
|
||||
+ pending_script_to_evaluate_on_load_once_.Get();
|
||||
+ target_url_for_active_script_ = target_url_for_pending_script_.Get();
|
||||
+ pending_script_to_evaluate_on_load_once_.Set({});
|
||||
+ target_url_for_pending_script_.Set({});
|
||||
+}
|
||||
+
|
||||
+String InspectorPageAgent::PageReloadScriptInjection::GetScriptForInjection(
|
||||
+ const KURL& target_url) {
|
||||
+ if (target_url_for_active_script_ == target_url.GetString()) {
|
||||
+ return script_to_evaluate_on_load_once_;
|
||||
+ }
|
||||
+ return {};
|
||||
+}
|
||||
+
|
||||
InspectorPageAgent::InspectorPageAgent(
|
||||
InspectedFrames* inspected_frames,
|
||||
Client* client,
|
||||
@@ -495,8 +531,6 @@ InspectorPageAgent::InspectorPageAgent(
|
||||
screencast_enabled_(&agent_state_, /*default_value=*/false),
|
||||
lifecycle_events_enabled_(&agent_state_, /*default_value=*/false),
|
||||
bypass_csp_enabled_(&agent_state_, /*default_value=*/false),
|
||||
- pending_script_to_evaluate_on_load_once_(&agent_state_,
|
||||
- /*default_value=*/String()),
|
||||
scripts_to_evaluate_on_load_(&agent_state_,
|
||||
/*default_value=*/String()),
|
||||
worlds_to_evaluate_on_load_(&agent_state_,
|
||||
@@ -506,7 +540,8 @@ InspectorPageAgent::InspectorPageAgent(
|
||||
/*default_value=*/false),
|
||||
standard_font_size_(&agent_state_, /*default_value=*/0),
|
||||
fixed_font_size_(&agent_state_, /*default_value=*/0),
|
||||
- script_font_families_cbor_(&agent_state_, std::vector<uint8_t>()) {}
|
||||
+ script_font_families_cbor_(&agent_state_, std::vector<uint8_t>()),
|
||||
+ script_injection_on_load_(agent_state_) {}
|
||||
|
||||
void InspectorPageAgent::Restore() {
|
||||
if (enabled_.Get())
|
||||
@@ -545,8 +580,7 @@ protocol::Response InspectorPageAgent::enable() {
|
||||
protocol::Response InspectorPageAgent::disable() {
|
||||
agent_state_.ClearAllFields();
|
||||
pending_isolated_worlds_.clear();
|
||||
- script_to_evaluate_on_load_once_ = String();
|
||||
- pending_script_to_evaluate_on_load_once_.Set(String());
|
||||
+ script_injection_on_load_.clear();
|
||||
instrumenting_agents_->RemoveInspectorPageAgent(this);
|
||||
inspector_resource_content_loader_->Cancel(
|
||||
resource_content_loader_client_id_);
|
||||
@@ -672,8 +706,9 @@ protocol::Response InspectorPageAgent::setAdBlockingEnabled(bool enable) {
|
||||
protocol::Response InspectorPageAgent::reload(
|
||||
Maybe<bool> optional_bypass_cache,
|
||||
Maybe<String> optional_script_to_evaluate_on_load) {
|
||||
- pending_script_to_evaluate_on_load_once_.Set(
|
||||
- optional_script_to_evaluate_on_load.value_or(""));
|
||||
+ script_injection_on_load_.SetPending(
|
||||
+ optional_script_to_evaluate_on_load.value_or(""),
|
||||
+ inspected_frames_->Root()->Loader().GetDocumentLoader()->Url());
|
||||
v8_session_->setSkipAllPauses(true);
|
||||
v8_session_->resume(true /* terminate on resume */);
|
||||
return protocol::Response::Success();
|
||||
@@ -989,7 +1024,9 @@ void InspectorPageAgent::DidCreateMainWorldContext(LocalFrame* frame) {
|
||||
EvaluateScriptOnNewDocument(*frame, key);
|
||||
}
|
||||
|
||||
- if (script_to_evaluate_on_load_once_.empty()) {
|
||||
+ String script = script_injection_on_load_.GetScriptForInjection(
|
||||
+ frame->Loader().GetDocumentLoader()->Url());
|
||||
+ if (script.empty()) {
|
||||
return;
|
||||
}
|
||||
ScriptState* script_state = ToScriptStateForMainWorld(frame);
|
||||
@@ -997,9 +1034,8 @@ void InspectorPageAgent::DidCreateMainWorldContext(LocalFrame* frame) {
|
||||
return;
|
||||
}
|
||||
|
||||
- v8_session_->evaluate(
|
||||
- script_state->GetContext(),
|
||||
- ToV8InspectorStringView(script_to_evaluate_on_load_once_));
|
||||
+ v8_session_->evaluate(script_state->GetContext(),
|
||||
+ ToV8InspectorStringView(script));
|
||||
}
|
||||
|
||||
void InspectorPageAgent::EvaluateScriptOnNewDocument(
|
||||
@@ -1049,9 +1085,7 @@ void InspectorPageAgent::LoadEventFired(LocalFrame* frame) {
|
||||
|
||||
void InspectorPageAgent::WillCommitLoad(LocalFrame*, DocumentLoader* loader) {
|
||||
if (loader->GetFrame() == inspected_frames_->Root()) {
|
||||
- script_to_evaluate_on_load_once_ =
|
||||
- pending_script_to_evaluate_on_load_once_.Get();
|
||||
- pending_script_to_evaluate_on_load_once_.Set(String());
|
||||
+ script_injection_on_load_.PromoteToLoadOnce();
|
||||
}
|
||||
GetFrontend()->frameNavigated(BuildObjectForFrame(loader->GetFrame()),
|
||||
protocol::Page::NavigationTypeEnum::Navigation);
|
||||
diff --git a/third_party/blink/renderer/core/inspector/inspector_page_agent.h b/third_party/blink/renderer/core/inspector/inspector_page_agent.h
|
||||
index 6e6263beee810946d03934e7f707bb49a3177a2f..e7003baa895494bf61ad06f875d825ac9f53aec2 100644
|
||||
--- a/third_party/blink/renderer/core/inspector/inspector_page_agent.h
|
||||
+++ b/third_party/blink/renderer/core/inspector/inspector_page_agent.h
|
||||
@@ -94,6 +94,22 @@ class CORE_EXPORT InspectorPageAgent final
|
||||
kOtherResource
|
||||
};
|
||||
|
||||
+ class CORE_EXPORT PageReloadScriptInjection {
|
||||
+ private:
|
||||
+ String script_to_evaluate_on_load_once_;
|
||||
+ String target_url_for_active_script_;
|
||||
+ InspectorAgentState::String pending_script_to_evaluate_on_load_once_;
|
||||
+ InspectorAgentState::String target_url_for_pending_script_;
|
||||
+
|
||||
+ public:
|
||||
+ explicit PageReloadScriptInjection(InspectorAgentState&);
|
||||
+
|
||||
+ void clear();
|
||||
+ void SetPending(String script, const KURL& target_url);
|
||||
+ void PromoteToLoadOnce();
|
||||
+ String GetScriptForInjection(const KURL& target_url);
|
||||
+ };
|
||||
+
|
||||
static bool CachedResourceContent(const Resource*,
|
||||
String* result,
|
||||
bool* base64_encoded);
|
||||
@@ -307,7 +323,6 @@ class CORE_EXPORT InspectorPageAgent final
|
||||
ad_script_identifiers_;
|
||||
v8_inspector::V8InspectorSession* v8_session_;
|
||||
Client* client_;
|
||||
- String script_to_evaluate_on_load_once_;
|
||||
Member<InspectorResourceContentLoader> inspector_resource_content_loader_;
|
||||
int resource_content_loader_client_id_;
|
||||
InspectorAgentState::Boolean intercept_file_chooser_;
|
||||
@@ -315,7 +330,6 @@ class CORE_EXPORT InspectorPageAgent final
|
||||
InspectorAgentState::Boolean screencast_enabled_;
|
||||
InspectorAgentState::Boolean lifecycle_events_enabled_;
|
||||
InspectorAgentState::Boolean bypass_csp_enabled_;
|
||||
- InspectorAgentState::String pending_script_to_evaluate_on_load_once_;
|
||||
InspectorAgentState::StringMap scripts_to_evaluate_on_load_;
|
||||
InspectorAgentState::StringMap worlds_to_evaluate_on_load_;
|
||||
InspectorAgentState::BooleanMap
|
||||
@@ -323,6 +337,7 @@ class CORE_EXPORT InspectorPageAgent final
|
||||
InspectorAgentState::Integer standard_font_size_;
|
||||
InspectorAgentState::Integer fixed_font_size_;
|
||||
InspectorAgentState::Bytes script_font_families_cbor_;
|
||||
+ PageReloadScriptInjection script_injection_on_load_;
|
||||
};
|
||||
|
||||
} // namespace blink
|
||||
diff --git a/third_party/blink/renderer/core/inspector/inspector_page_agent_unittest.cc b/third_party/blink/renderer/core/inspector/inspector_page_agent_unittest.cc
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..b81f6b4735392f3f542ccbb2a114c2def185be1c
|
||||
--- /dev/null
|
||||
+++ b/third_party/blink/renderer/core/inspector/inspector_page_agent_unittest.cc
|
||||
@@ -0,0 +1,57 @@
|
||||
+// Copyright 2024 The Chromium Authors
|
||||
+// Use of this source code is governed by a BSD-style license that can be
|
||||
+// found in the LICENSE file.
|
||||
+
|
||||
+#include "third_party/blink/renderer/core/inspector/inspector_page_agent.h"
|
||||
+
|
||||
+#include "testing/gtest/include/gtest/gtest.h"
|
||||
+#include "third_party/blink/renderer/core/inspector/inspector_session_state.h"
|
||||
+#include "third_party/blink/renderer/platform/weborigin/kurl.h"
|
||||
+
|
||||
+class PageReloadScriptInjectionTest : public testing::Test {
|
||||
+ protected:
|
||||
+ blink::mojom::blink::DevToolsSessionStatePtr session_state_cookie_;
|
||||
+ blink::InspectorAgentState agent_state_;
|
||||
+ blink::InspectorPageAgent::PageReloadScriptInjection injection_;
|
||||
+ blink::InspectorSessionState state_;
|
||||
+
|
||||
+ public:
|
||||
+ PageReloadScriptInjectionTest()
|
||||
+ : agent_state_("page"),
|
||||
+ injection_(agent_state_),
|
||||
+ state_(session_state_cookie_.Clone()) {}
|
||||
+
|
||||
+ void SetUp() override { agent_state_.InitFrom(&state_); }
|
||||
+};
|
||||
+
|
||||
+TEST_F(PageReloadScriptInjectionTest, PromotesScript) {
|
||||
+ blink::KURL url("http://example.com");
|
||||
+ injection_.SetPending("script", url);
|
||||
+ ASSERT_TRUE(injection_.GetScriptForInjection(url).empty());
|
||||
+ injection_.PromoteToLoadOnce();
|
||||
+ ASSERT_EQ(injection_.GetScriptForInjection(url), "script");
|
||||
+ injection_.PromoteToLoadOnce();
|
||||
+ ASSERT_TRUE(injection_.GetScriptForInjection(url).empty());
|
||||
+}
|
||||
+
|
||||
+TEST_F(PageReloadScriptInjectionTest, ClearsScript) {
|
||||
+ blink::KURL url("http://example.com");
|
||||
+ injection_.SetPending("script", url);
|
||||
+ injection_.clear();
|
||||
+ injection_.PromoteToLoadOnce();
|
||||
+ ASSERT_TRUE(injection_.GetScriptForInjection(url).empty());
|
||||
+
|
||||
+ injection_.SetPending("script", url);
|
||||
+ injection_.PromoteToLoadOnce();
|
||||
+ ASSERT_EQ(injection_.GetScriptForInjection(url), "script");
|
||||
+ injection_.clear();
|
||||
+ ASSERT_TRUE(injection_.GetScriptForInjection(url).empty());
|
||||
+}
|
||||
+
|
||||
+TEST_F(PageReloadScriptInjectionTest, ChecksLoaderId) {
|
||||
+ blink::KURL url("http://example.com");
|
||||
+ blink::KURL url2("about:blank");
|
||||
+ injection_.SetPending("script", url);
|
||||
+ injection_.PromoteToLoadOnce();
|
||||
+ ASSERT_TRUE(injection_.GetScriptForInjection(url2).empty());
|
||||
+}
|
||||
@@ -1,288 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Hiroshige Hayashizaki <hiroshige@chromium.org>
|
||||
Date: Tue, 16 Jul 2024 03:44:29 +0000
|
||||
Subject: Handle ThrottlingURLLoader deletion during throttle calls
|
||||
|
||||
Theoretically `ThrottlingURLLoader` can be deleted during
|
||||
throttle calls and some call sites have already protection
|
||||
for such cases. This CL adds the protection for more call sites.
|
||||
|
||||
This CL also adds more unit tests for cancelling/deleting
|
||||
`ThrottlingURLLoader` during throttle calls.
|
||||
|
||||
(cherry picked from commit c40f8866cfd6438725cc58e5db2d792e6d9f869b)
|
||||
|
||||
Bug: 349342289
|
||||
Change-Id: I80d64be9ba1a3ac920315f5b4012b29c9737e414
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5665925
|
||||
Commit-Queue: Hiroshige Hayashizaki <hiroshige@chromium.org>
|
||||
Reviewed-by: Tsuyoshi Horo <horo@chromium.org>
|
||||
Cr-Original-Commit-Position: refs/heads/main@{#1323986}
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5710951
|
||||
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
|
||||
Reviewed-by: Kouhei Ueno <kouhei@chromium.org>
|
||||
Cr-Commit-Position: refs/branch-heads/6533@{#1515}
|
||||
Cr-Branched-From: 7e0b87ec6b8cb5cb2969e1479fc25776e582721d-refs/heads/main@{#1313161}
|
||||
|
||||
diff --git a/third_party/blink/common/loader/throttling_url_loader.cc b/third_party/blink/common/loader/throttling_url_loader.cc
|
||||
index d2de163172880bd23f7478c6743c2608a5f04d94..28f55e1b3867cbd1ff3817c21c1f648fef4fcbc7 100644
|
||||
--- a/third_party/blink/common/loader/throttling_url_loader.cc
|
||||
+++ b/third_party/blink/common/loader/throttling_url_loader.cc
|
||||
@@ -660,8 +660,12 @@ void ThrottlingURLLoader::OnReceiveResponse(
|
||||
for (auto& entry : throttles_) {
|
||||
auto* throttle = entry.throttle.get();
|
||||
base::Time start = base::Time::Now();
|
||||
+ auto weak_ptr = weak_factory_.GetWeakPtr();
|
||||
throttle->BeforeWillProcessResponse(response_url_, *response_head,
|
||||
&has_pending_restart);
|
||||
+ if (!weak_ptr) {
|
||||
+ return;
|
||||
+ }
|
||||
RecordExecutionTimeHistogram("BeforeWillProcessResponse", start);
|
||||
if (!HandleThrottleResult(throttle)) {
|
||||
return;
|
||||
@@ -681,8 +685,12 @@ void ThrottlingURLLoader::OnReceiveResponse(
|
||||
auto* throttle = entry.throttle.get();
|
||||
bool throttle_deferred = false;
|
||||
base::Time start = base::Time::Now();
|
||||
+ auto weak_ptr = weak_factory_.GetWeakPtr();
|
||||
throttle->WillProcessResponse(response_url_, response_head.get(),
|
||||
&throttle_deferred);
|
||||
+ if (!weak_ptr) {
|
||||
+ return;
|
||||
+ }
|
||||
RecordExecutionTimeHistogram(GetStageNameForHistogram(DEFERRED_RESPONSE),
|
||||
start);
|
||||
if (!HandleThrottleResult(throttle, throttle_deferred, &deferred))
|
||||
@@ -852,7 +860,11 @@ void ThrottlingURLLoader::OnComplete(
|
||||
for (auto& entry : throttles_) {
|
||||
auto* throttle = entry.throttle.get();
|
||||
base::Time start = base::Time::Now();
|
||||
+ auto weak_ptr = weak_factory_.GetWeakPtr();
|
||||
throttle->WillOnCompleteWithError(status);
|
||||
+ if (!weak_ptr) {
|
||||
+ return;
|
||||
+ }
|
||||
RecordExecutionTimeHistogram("WillOnCompleteWithError", start);
|
||||
if (!HandleThrottleResult(throttle)) {
|
||||
return;
|
||||
diff --git a/third_party/blink/common/loader/throttling_url_loader_unittest.cc b/third_party/blink/common/loader/throttling_url_loader_unittest.cc
|
||||
index 2c73705d12445c13067e937b4bfae1c99290da09..a7e037b2dde9390d9cc15d863ed926809f9afccf 100644
|
||||
--- a/third_party/blink/common/loader/throttling_url_loader_unittest.cc
|
||||
+++ b/third_party/blink/common/loader/throttling_url_loader_unittest.cc
|
||||
@@ -338,9 +338,9 @@ class TestURLLoaderThrottle : public blink::URLLoaderThrottle {
|
||||
network::mojom::URLResponseHead* response_head,
|
||||
bool* defer) override {
|
||||
will_process_response_called_++;
|
||||
+ response_url_ = response_url;
|
||||
if (will_process_response_callback_)
|
||||
will_process_response_callback_.Run(delegate_.get(), defer);
|
||||
- response_url_ = response_url;
|
||||
}
|
||||
|
||||
void BeforeWillProcessResponse(
|
||||
@@ -422,6 +422,11 @@ class ThrottlingURLLoaderTest : public testing::Test {
|
||||
factory_.factory_remote().FlushForTesting();
|
||||
}
|
||||
|
||||
+ void ResetLoader() {
|
||||
+ ResetThrottleRawPointer();
|
||||
+ loader_.reset();
|
||||
+ }
|
||||
+
|
||||
void ResetThrottleRawPointer() { throttle_ = nullptr; }
|
||||
|
||||
// Be the first member so it is destroyed last.
|
||||
@@ -467,6 +472,25 @@ TEST_F(ThrottlingURLLoaderTest, CancelBeforeStart) {
|
||||
EXPECT_EQ(1u, client_.on_complete_called());
|
||||
}
|
||||
|
||||
+TEST_F(ThrottlingURLLoaderTest, DeleteBeforeStart) {
|
||||
+ base::RunLoop run_loop;
|
||||
+ throttle_->set_will_start_request_callback(base::BindLambdaForTesting(
|
||||
+ [this, &run_loop](blink::URLLoaderThrottle::Delegate* delegate,
|
||||
+ bool* defer) {
|
||||
+ ResetLoader();
|
||||
+ run_loop.Quit();
|
||||
+ }));
|
||||
+
|
||||
+ CreateLoaderAndStart();
|
||||
+ run_loop.Run();
|
||||
+
|
||||
+ EXPECT_EQ(1u, factory_.create_loader_and_start_called());
|
||||
+
|
||||
+ EXPECT_EQ(0u, client_.on_received_response_called());
|
||||
+ EXPECT_EQ(0u, client_.on_received_redirect_called());
|
||||
+ EXPECT_EQ(0u, client_.on_complete_called());
|
||||
+}
|
||||
+
|
||||
TEST_F(ThrottlingURLLoaderTest, DeferBeforeStart) {
|
||||
throttle_->set_will_start_request_callback(base::BindLambdaForTesting(
|
||||
[](blink::URLLoaderThrottle::Delegate* delegate, bool* defer) {
|
||||
@@ -667,6 +691,88 @@ TEST_F(ThrottlingURLLoaderTest, CancelBeforeRedirect) {
|
||||
EXPECT_EQ(1u, client_.on_complete_called());
|
||||
}
|
||||
|
||||
+TEST_F(ThrottlingURLLoaderTest, DeleteBeforeRedirect) {
|
||||
+ base::RunLoop run_loop;
|
||||
+ throttle_->set_will_redirect_request_callback(base::BindLambdaForTesting(
|
||||
+ [this, &run_loop](
|
||||
+ blink::URLLoaderThrottle::Delegate* delegate, bool* /* defer */,
|
||||
+ std::vector<std::string>* /* removed_headers */,
|
||||
+ net::HttpRequestHeaders* /* modified_headers */,
|
||||
+ net::HttpRequestHeaders* /* modified_cors_exempt_headers */) {
|
||||
+ ResetLoader();
|
||||
+ run_loop.Quit();
|
||||
+ }));
|
||||
+
|
||||
+ CreateLoaderAndStart();
|
||||
+
|
||||
+ factory_.NotifyClientOnReceiveRedirect();
|
||||
+
|
||||
+ run_loop.Run();
|
||||
+
|
||||
+ EXPECT_EQ(0u, client_.on_received_response_called());
|
||||
+ EXPECT_EQ(0u, client_.on_received_redirect_called());
|
||||
+ EXPECT_EQ(0u, client_.on_complete_called());
|
||||
+}
|
||||
+
|
||||
+TEST_F(ThrottlingURLLoaderTest, CancelBeforeWillRedirect) {
|
||||
+ throttle_->set_before_will_redirect_request_callback(
|
||||
+ base::BindLambdaForTesting(
|
||||
+ [](blink::URLLoaderThrottle::Delegate* delegate,
|
||||
+ RestartWithURLReset* restart_with_url_reset,
|
||||
+ std::vector<std::string>* /* removed_headers */,
|
||||
+ net::HttpRequestHeaders* /* modified_headers */,
|
||||
+ net::HttpRequestHeaders* /* modified_cors_exempt_headers */) {
|
||||
+ delegate->CancelWithError(net::ERR_ACCESS_DENIED);
|
||||
+ }));
|
||||
+
|
||||
+ base::RunLoop run_loop;
|
||||
+ client_.set_on_complete_callback(
|
||||
+ base::BindLambdaForTesting([&run_loop](int error) {
|
||||
+ EXPECT_EQ(net::ERR_ACCESS_DENIED, error);
|
||||
+ run_loop.Quit();
|
||||
+ }));
|
||||
+
|
||||
+ CreateLoaderAndStart();
|
||||
+
|
||||
+ factory_.NotifyClientOnReceiveRedirect();
|
||||
+
|
||||
+ run_loop.Run();
|
||||
+
|
||||
+ EXPECT_EQ(1u, throttle_->will_start_request_called());
|
||||
+ EXPECT_EQ(1u, throttle_->will_redirect_request_called());
|
||||
+ EXPECT_EQ(0u, throttle_->before_will_process_response_called());
|
||||
+ EXPECT_EQ(0u, throttle_->will_process_response_called());
|
||||
+
|
||||
+ EXPECT_EQ(0u, client_.on_received_response_called());
|
||||
+ EXPECT_EQ(0u, client_.on_received_redirect_called());
|
||||
+ EXPECT_EQ(1u, client_.on_complete_called());
|
||||
+}
|
||||
+
|
||||
+TEST_F(ThrottlingURLLoaderTest, DeleteBeforeWillRedirect) {
|
||||
+ base::RunLoop run_loop;
|
||||
+ throttle_->set_before_will_redirect_request_callback(
|
||||
+ base::BindLambdaForTesting(
|
||||
+ [this, &run_loop](
|
||||
+ blink::URLLoaderThrottle::Delegate* delegate,
|
||||
+ RestartWithURLReset* restart_with_url_reset,
|
||||
+ std::vector<std::string>* /* removed_headers */,
|
||||
+ net::HttpRequestHeaders* /* modified_headers */,
|
||||
+ net::HttpRequestHeaders* /* modified_cors_exempt_headers */) {
|
||||
+ ResetLoader();
|
||||
+ run_loop.Quit();
|
||||
+ }));
|
||||
+
|
||||
+ CreateLoaderAndStart();
|
||||
+
|
||||
+ factory_.NotifyClientOnReceiveRedirect();
|
||||
+
|
||||
+ run_loop.Run();
|
||||
+
|
||||
+ EXPECT_EQ(0u, client_.on_received_response_called());
|
||||
+ EXPECT_EQ(0u, client_.on_received_redirect_called());
|
||||
+ EXPECT_EQ(0u, client_.on_complete_called());
|
||||
+}
|
||||
+
|
||||
TEST_F(ThrottlingURLLoaderTest, DeferBeforeRedirect) {
|
||||
base::RunLoop run_loop1;
|
||||
throttle_->set_will_redirect_request_callback(base::BindLambdaForTesting(
|
||||
@@ -880,6 +986,77 @@ TEST_F(ThrottlingURLLoaderTest, CancelBeforeResponse) {
|
||||
EXPECT_EQ(1u, client_.on_complete_called());
|
||||
}
|
||||
|
||||
+TEST_F(ThrottlingURLLoaderTest, DeleteBeforeResponse) {
|
||||
+ base::RunLoop run_loop;
|
||||
+ throttle_->set_will_process_response_callback(base::BindLambdaForTesting(
|
||||
+ [this, &run_loop](blink::URLLoaderThrottle::Delegate* delegate,
|
||||
+ bool* defer) {
|
||||
+ ResetLoader();
|
||||
+ run_loop.Quit();
|
||||
+ }));
|
||||
+
|
||||
+ CreateLoaderAndStart();
|
||||
+
|
||||
+ factory_.NotifyClientOnReceiveResponse();
|
||||
+
|
||||
+ run_loop.Run();
|
||||
+
|
||||
+ EXPECT_EQ(0u, client_.on_received_response_called());
|
||||
+ EXPECT_EQ(0u, client_.on_received_redirect_called());
|
||||
+ EXPECT_EQ(0u, client_.on_complete_called());
|
||||
+}
|
||||
+
|
||||
+TEST_F(ThrottlingURLLoaderTest, CancelBeforeWillProcessResponse) {
|
||||
+ throttle_->set_before_will_process_response_callback(
|
||||
+ base::BindLambdaForTesting(
|
||||
+ [](blink::URLLoaderThrottle::Delegate* delegate,
|
||||
+ RestartWithURLReset* restart_with_url_reset) {
|
||||
+ delegate->CancelWithError(net::ERR_ACCESS_DENIED);
|
||||
+ }));
|
||||
+
|
||||
+ base::RunLoop run_loop;
|
||||
+ client_.set_on_complete_callback(
|
||||
+ base::BindLambdaForTesting([&run_loop](int error) {
|
||||
+ EXPECT_EQ(net::ERR_ACCESS_DENIED, error);
|
||||
+ run_loop.Quit();
|
||||
+ }));
|
||||
+
|
||||
+ CreateLoaderAndStart();
|
||||
+
|
||||
+ factory_.NotifyClientOnReceiveResponse();
|
||||
+
|
||||
+ run_loop.Run();
|
||||
+
|
||||
+ EXPECT_EQ(1u, throttle_->will_start_request_called());
|
||||
+ EXPECT_EQ(0u, throttle_->will_redirect_request_called());
|
||||
+ EXPECT_EQ(1u, throttle_->before_will_process_response_called());
|
||||
+ EXPECT_EQ(0u, throttle_->will_process_response_called());
|
||||
+ EXPECT_EQ(0u, client_.on_received_response_called());
|
||||
+ EXPECT_EQ(0u, client_.on_received_redirect_called());
|
||||
+ EXPECT_EQ(1u, client_.on_complete_called());
|
||||
+}
|
||||
+
|
||||
+TEST_F(ThrottlingURLLoaderTest, DeleteBeforeWillProcessResponse) {
|
||||
+ base::RunLoop run_loop;
|
||||
+ throttle_->set_before_will_process_response_callback(
|
||||
+ base::BindLambdaForTesting(
|
||||
+ [this, &run_loop](blink::URLLoaderThrottle::Delegate* delegate,
|
||||
+ RestartWithURLReset* restart_with_url_reset) {
|
||||
+ ResetLoader();
|
||||
+ run_loop.Quit();
|
||||
+ }));
|
||||
+
|
||||
+ CreateLoaderAndStart();
|
||||
+
|
||||
+ factory_.NotifyClientOnReceiveResponse();
|
||||
+
|
||||
+ run_loop.Run();
|
||||
+
|
||||
+ EXPECT_EQ(0u, client_.on_received_response_called());
|
||||
+ EXPECT_EQ(0u, client_.on_received_redirect_called());
|
||||
+ EXPECT_EQ(0u, client_.on_complete_called());
|
||||
+}
|
||||
+
|
||||
TEST_F(ThrottlingURLLoaderTest, DeferBeforeResponse) {
|
||||
base::RunLoop run_loop1;
|
||||
throttle_->set_will_process_response_callback(base::BindRepeating(
|
||||
@@ -1,166 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Yann Dago <ydago@chromium.org>
|
||||
Date: Mon, 8 Jul 2024 16:20:32 +0000
|
||||
Subject: Ensure chrome://policy/test messages ignored when not supported
|
||||
|
||||
It was possible to go to chrome://policy and in the dev tools and send
|
||||
the right message to set test policies even if the policy test page was disabled and/or unavailable because both pages share the same handler.
|
||||
|
||||
Bug: 338248595
|
||||
Change-Id: If689325999cb108b2b71b2821d905e42efd3390d
|
||||
Low-Coverage-Reason: TRIVIAL_CHANGE
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5679162
|
||||
Auto-Submit: Yann Dago <ydago@chromium.org>
|
||||
Reviewed-by: Rohit Rao <rohitrao@chromium.org>
|
||||
Reviewed-by: Sergey Poromov <poromov@chromium.org>
|
||||
Commit-Queue: Rohit Rao <rohitrao@chromium.org>
|
||||
Cr-Commit-Position: refs/heads/main@{#1324277}
|
||||
|
||||
diff --git a/chrome/browser/ui/webui/policy/policy_test_ui_browsertest.cc b/chrome/browser/ui/webui/policy/policy_test_ui_browsertest.cc
|
||||
index e27325a18087c8a01d21111f2fa0dd6e6da60023..a03c639b8654a5cbedccc3c38de4007dba084bf8 100644
|
||||
--- a/chrome/browser/ui/webui/policy/policy_test_ui_browsertest.cc
|
||||
+++ b/chrome/browser/ui/webui/policy/policy_test_ui_browsertest.cc
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "base/test/scoped_feature_list.h"
|
||||
#include "build/build_config.h"
|
||||
#include "build/chromeos_buildflags.h"
|
||||
+#include "chrome/browser/enterprise/browser_management/browser_management_service.h"
|
||||
#include "chrome/browser/enterprise/browser_management/management_service_factory.h"
|
||||
#include "chrome/browser/lifetime/application_lifetime.h"
|
||||
#include "chrome/browser/policy/chrome_browser_policy_connector.h"
|
||||
@@ -270,6 +271,57 @@ class PolicyTestHandlerTest : public PlatformBrowserTest {
|
||||
#endif
|
||||
};
|
||||
|
||||
+IN_PROC_BROWSER_TEST_F(PolicyTestHandlerTest,
|
||||
+ HandleSetLocalTestPoliciesNotSupported) {
|
||||
+ // Ensure chrome://policy/test not supported.
|
||||
+ policy::ScopedManagementServiceOverrideForTesting profile_management(
|
||||
+ policy::ManagementServiceFactory::GetForProfile(GetProfile()),
|
||||
+ policy::EnterpriseManagementAuthority::CLOUD);
|
||||
+ std::unique_ptr<PolicyUIHandler> handler = SetUpHandler();
|
||||
+ const std::string jsonString =
|
||||
+ R"([
|
||||
+ {"level": 0,"scope": 0,"source": 0, "namespace": "chrome",
|
||||
+ "name": "AutofillAddressEnabled","value": false},
|
||||
+ {"level": 1,"scope": 1,"source": 2, "namespace": "chrome",
|
||||
+ "name": "CloudReportingEnabled","value": true}
|
||||
+ ])";
|
||||
+ const std::string revertAppliedPoliciesButtonDisabledJs =
|
||||
+ R"(
|
||||
+ document
|
||||
+ .querySelector('#revert-applied-policies')
|
||||
+ .disabled;
|
||||
+ )";
|
||||
+
|
||||
+ base::Value::List list_args;
|
||||
+
|
||||
+ list_args.Append("setLocalTestPolicies");
|
||||
+ list_args.Append(jsonString);
|
||||
+ list_args.Append("{}");
|
||||
+
|
||||
+ // Open chrome://policy
|
||||
+ ASSERT_TRUE(
|
||||
+ content::NavigateToURL(web_contents(), GURL(chrome::kChromeUIPolicyURL)));
|
||||
+ web_ui()->HandleReceivedMessage("setLocalTestPolicies", list_args);
|
||||
+
|
||||
+ base::RunLoop().RunUntilIdle();
|
||||
+
|
||||
+ const policy::PolicyNamespace chrome_namespace(policy::POLICY_DOMAIN_CHROME,
|
||||
+ std::string());
|
||||
+ policy::PolicyService* policy_service =
|
||||
+ GetProfile()->GetProfilePolicyConnector()->policy_service();
|
||||
+
|
||||
+ // Check policies not applied
|
||||
+ const policy::PolicyMap* policy_map =
|
||||
+ &policy_service->GetPolicies(chrome_namespace);
|
||||
+ ASSERT_TRUE(policy_map);
|
||||
+
|
||||
+ {
|
||||
+ const policy::PolicyMap::Entry* entry =
|
||||
+ policy_map->Get(policy::key::kAutofillAddressEnabled);
|
||||
+ ASSERT_FALSE(entry);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
IN_PROC_BROWSER_TEST_F(PolicyTestHandlerTest,
|
||||
HandleSetAndRevertLocalTestPolicies) {
|
||||
if (!policy::utils::IsPolicyTestingEnabled(/*pref_service=*/nullptr,
|
||||
diff --git a/chrome/browser/ui/webui/policy/policy_ui_handler.cc b/chrome/browser/ui/webui/policy/policy_ui_handler.cc
|
||||
index 0d13979009fc4df379432d5eea1a394607203615..1dc6ecc6bed91115be10021c0661f8d81456161b 100644
|
||||
--- a/chrome/browser/ui/webui/policy/policy_ui_handler.cc
|
||||
+++ b/chrome/browser/ui/webui/policy/policy_ui_handler.cc
|
||||
@@ -49,6 +49,7 @@
|
||||
#include "chrome/browser/ui/chrome_select_file_policy.h"
|
||||
#include "chrome/browser/ui/webui/policy/policy_ui.h"
|
||||
#include "chrome/browser/ui/webui/webui_util.h"
|
||||
+#include "chrome/common/channel_info.h"
|
||||
#include "chrome/grit/branded_strings.h"
|
||||
#include "components/crx_file/id_util.h"
|
||||
#include "components/enterprise/browser/controller/browser_dm_token_storage.h"
|
||||
@@ -69,6 +70,7 @@
|
||||
#include "components/policy/core/common/policy_pref_names.h"
|
||||
#include "components/policy/core/common/policy_scheduler.h"
|
||||
#include "components/policy/core/common/policy_types.h"
|
||||
+#include "components/policy/core/common/policy_utils.h"
|
||||
#include "components/policy/core/common/remote_commands/remote_commands_service.h"
|
||||
#include "components/policy/core/common/schema.h"
|
||||
#include "components/policy/core/common/schema_map.h"
|
||||
@@ -316,6 +318,12 @@ void PolicyUIHandler::HandleCopyPoliciesJson(const base::Value::List& args) {
|
||||
void PolicyUIHandler::HandleSetLocalTestPolicies(
|
||||
const base::Value::List& args) {
|
||||
std::string policies = args[1].GetString();
|
||||
+ AllowJavascript();
|
||||
+
|
||||
+ if (!PolicyUI::ShouldLoadTestPage(Profile::FromWebUI(web_ui()))) {
|
||||
+ ResolveJavascriptCallback(args[0], true);
|
||||
+ return;
|
||||
+ }
|
||||
|
||||
policy::LocalTestPolicyProvider* local_test_provider =
|
||||
static_cast<policy::LocalTestPolicyProvider*>(
|
||||
@@ -338,12 +346,14 @@ void PolicyUIHandler::HandleSetLocalTestPolicies(
|
||||
->UseLocalTestPolicyProvider();
|
||||
|
||||
local_test_provider->LoadJsonPolicies(policies);
|
||||
- AllowJavascript();
|
||||
ResolveJavascriptCallback(args[0], true);
|
||||
}
|
||||
|
||||
void PolicyUIHandler::HandleRevertLocalTestPolicies(
|
||||
const base::Value::List& args) {
|
||||
+ if (!PolicyUI::ShouldLoadTestPage(Profile::FromWebUI(web_ui()))) {
|
||||
+ return;
|
||||
+ }
|
||||
#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_CHROMEOS)
|
||||
Profile::FromWebUI(web_ui())->GetPrefs()->ClearPref(
|
||||
prefs::kUserCloudSigninPolicyResponseFromPolicyTestPage);
|
||||
diff --git a/ios/chrome/browser/webui/ui_bundled/policy/policy_ui_handler.mm b/ios/chrome/browser/webui/ui_bundled/policy/policy_ui_handler.mm
|
||||
index 577caf2012e0cdcdcf5baa4c5a288119da40cabd..94466842c2faeb13fd0ae33ba619362f8a43cd06 100644
|
||||
--- a/ios/chrome/browser/webui/ui_bundled/policy/policy_ui_handler.mm
|
||||
+++ b/ios/chrome/browser/webui/ui_bundled/policy/policy_ui_handler.mm
|
||||
@@ -220,6 +220,12 @@
|
||||
const base::Value::List& args) {
|
||||
std::string json_policies_string = args[1].GetString();
|
||||
|
||||
+ if (!PolicyUI::ShouldLoadTestPage(
|
||||
+ ChromeBrowserState::FromWebUIIOS(web_ui()))) {
|
||||
+ web_ui()->ResolveJavascriptCallback(args[0], true);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
policy::LocalTestPolicyProvider* local_test_provider =
|
||||
static_cast<policy::LocalTestPolicyProvider*>(
|
||||
GetApplicationContext()
|
||||
@@ -238,6 +244,11 @@
|
||||
|
||||
void PolicyUIHandler::HandleRevertLocalTestPolicies(
|
||||
const base::Value::List& args) {
|
||||
+ if (!PolicyUI::ShouldLoadTestPage(
|
||||
+ ChromeBrowserState::FromWebUIIOS(web_ui()))) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
ChromeBrowserState::FromWebUIIOS(web_ui())
|
||||
->GetPolicyConnector()
|
||||
->RevertUseLocalTestPolicyProvider();
|
||||
@@ -1,32 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Rakina Zata Amni <rakina@chromium.org>
|
||||
Date: Wed, 19 Jun 2024 02:49:58 +0000
|
||||
Subject: Destruct controller before referenced WebUI in CreateWebUIIfNeeded
|
||||
|
||||
Reset `controller` first before resetting `web_ui_`, since the
|
||||
controller still has a pointer to `web_ui_`, to avoid referencing to
|
||||
the already deleted `web_ui_` object from `controller`'s destructor.
|
||||
|
||||
Bug: 345640549
|
||||
Change-Id: Ie9c193436b593845d8269605f68bf94bc75beed7
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5624749
|
||||
Commit-Queue: Rakina Zata Amni <rakina@chromium.org>
|
||||
Reviewed-by: Nasko Oskov <nasko@chromium.org>
|
||||
Cr-Commit-Position: refs/heads/main@{#1316830}
|
||||
|
||||
diff --git a/content/browser/renderer_host/navigation_request.cc b/content/browser/renderer_host/navigation_request.cc
|
||||
index 8a9beaf3bfb9fe5eca8ca6675c7c45b4b880db03..85041c38c8d2e84d780948a4dab94013ce39dfbe 100644
|
||||
--- a/content/browser/renderer_host/navigation_request.cc
|
||||
+++ b/content/browser/renderer_host/navigation_request.cc
|
||||
@@ -10268,6 +10268,11 @@ void NavigationRequest::CreateWebUIIfNeeded(RenderFrameHostImpl* frame_host) {
|
||||
bindings() != web_ui_->GetBindings()) {
|
||||
RecordAction(base::UserMetricsAction("ProcessSwapBindingsMismatch_RVHM"));
|
||||
base::WeakPtr<NavigationRequest> self = GetWeakPtr();
|
||||
+ // Reset `controller` first before resetting `web_ui_`, since the controller
|
||||
+ // still has a pointer to `web_ui_`, to avoid referencing to the already
|
||||
+ // deleted `web_ui_` object from `controller`'s destructor. See also
|
||||
+ // https://crbug.com/345640549.
|
||||
+ controller.reset();
|
||||
web_ui_.reset();
|
||||
// Resetting the WebUI may indirectly call content's embedders and delete
|
||||
// `this`. There are no known occurrences of it, so we assume this never
|
||||
@@ -1,37 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: "mark a. foltz" <mfoltz@chromium.org>
|
||||
Date: Mon, 17 Jun 2024 23:07:32 +0000
|
||||
Subject: Retain refptr to shared helper to prevent UAF.
|
||||
|
||||
Capture a reference to the shared helper in the onerror handler to
|
||||
prevent a UAF that can occur when the browser drops the mojo
|
||||
connection.
|
||||
|
||||
Bug: 346692546
|
||||
Change-Id: Ifb264488a6fa8417c134a34d902605d2c141720b
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5634908
|
||||
Reviewed-by: Avi Drissman <avi@chromium.org>
|
||||
Commit-Queue: Mark Foltz <mfoltz@chromium.org>
|
||||
Cr-Commit-Position: refs/heads/main@{#1316145}
|
||||
|
||||
diff --git a/media/audio/mac/audio_loopback_input_mac_impl.mm b/media/audio/mac/audio_loopback_input_mac_impl.mm
|
||||
index 7b301492f17a3f1da96b8ff990f6deeb4a19b6e3..f90c00e668f58c2389e622466422ae7aa237c94d 100644
|
||||
--- a/media/audio/mac/audio_loopback_input_mac_impl.mm
|
||||
+++ b/media/audio/mac/audio_loopback_input_mac_impl.mm
|
||||
@@ -394,12 +394,15 @@ - (void)stream:(SCStream*)stream
|
||||
base::BindRepeating(&SCKAudioInputStream::OnStreamError,
|
||||
base::Unretained(this)));
|
||||
|
||||
+ // Make a local copy of the shared_refptr in case the error handler is called
|
||||
+ // after `this` is destroyed.
|
||||
+ auto local_shared_helper = shared_helper_;
|
||||
[stream_ startCaptureWithCompletionHandler:^(NSError* error) {
|
||||
if (!error) {
|
||||
return;
|
||||
}
|
||||
|
||||
- shared_helper_->OnStreamError(error);
|
||||
+ local_shared_helper->OnStreamError(error);
|
||||
}];
|
||||
}
|
||||
|
||||
@@ -1,159 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Adam Rice <ricea@chromium.org>
|
||||
Date: Thu, 25 Jul 2024 05:28:45 +0000
|
||||
Subject: Don't allocate WebTransportCloseInfo on stack
|
||||
|
||||
blink::WebTransport::OnClosed() was allocating a WebTransportCloseInfo
|
||||
object on the stack. Since it is a garbage-collected object, this is
|
||||
wrong. Allocate it with MakeGarbageCollected<>() instead.
|
||||
|
||||
(cherry picked from commit 84c1481d8a8d5e7f51316b648d1bf71f2ae52122)
|
||||
|
||||
Fixed: 352872238
|
||||
Change-Id: I83484021d5f3f6d49d3c222c8f2dc34219f2d240
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5725413
|
||||
Commit-Queue: Nidhi Jaju <nidhijaju@chromium.org>
|
||||
Reviewed-by: Nidhi Jaju <nidhijaju@chromium.org>
|
||||
Auto-Submit: Adam Rice <ricea@chromium.org>
|
||||
Cr-Original-Commit-Position: refs/heads/main@{#1331525}
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5740536
|
||||
Commit-Queue: Adam Rice <ricea@chromium.org>
|
||||
Cr-Commit-Position: refs/branch-heads/6478@{#1848}
|
||||
Cr-Branched-From: e6143acc03189c5e52959545b110d6d17ecd5286-refs/heads/main@{#1300313}
|
||||
|
||||
diff --git a/third_party/blink/renderer/modules/webtransport/web_transport.cc b/third_party/blink/renderer/modules/webtransport/web_transport.cc
|
||||
index bcfa17448f3051dc2b292aa3e19dbfb915cf692a..4922359605b53c6b9ac5339f6ce6b3613bfe275b 100644
|
||||
--- a/third_party/blink/renderer/modules/webtransport/web_transport.cc
|
||||
+++ b/third_party/blink/renderer/modules/webtransport/web_transport.cc
|
||||
@@ -1092,17 +1092,17 @@ void WebTransport::OnClosed(
|
||||
|
||||
latest_stats_ = ConvertStatsFromMojom(std::move(final_stats));
|
||||
|
||||
- WebTransportCloseInfo idl_close_info;
|
||||
+ auto* idl_close_info = MakeGarbageCollected<WebTransportCloseInfo>();
|
||||
if (close_info) {
|
||||
- idl_close_info.setCloseCode(close_info->code);
|
||||
- idl_close_info.setReason(close_info->reason);
|
||||
+ idl_close_info->setCloseCode(close_info->code);
|
||||
+ idl_close_info->setReason(close_info->reason);
|
||||
}
|
||||
|
||||
v8::Local<v8::Value> error = WebTransportError::Create(
|
||||
isolate, /*stream_error_code=*/std::nullopt, "The session is closed.",
|
||||
WebTransportError::Source::kSession);
|
||||
|
||||
- Cleanup(&idl_close_info, error, /*abruptly=*/false);
|
||||
+ Cleanup(idl_close_info, error, /*abruptly=*/false);
|
||||
}
|
||||
|
||||
void WebTransport::OnOutgoingStreamClosed(uint32_t stream_id) {
|
||||
diff --git a/third_party/blink/renderer/modules/webtransport/web_transport_test.cc b/third_party/blink/renderer/modules/webtransport/web_transport_test.cc
|
||||
index 01f5a0fca58d88e342298e03231dd2263ca5a678..fc05ad637888df648f8692683f8a626c8d6a38dd 100644
|
||||
--- a/third_party/blink/renderer/modules/webtransport/web_transport_test.cc
|
||||
+++ b/third_party/blink/renderer/modules/webtransport/web_transport_test.cc
|
||||
@@ -1959,6 +1959,21 @@ TEST_F(WebTransportTest, OnClosed) {
|
||||
EXPECT_EQ(close_info->reason(), "reason");
|
||||
}
|
||||
|
||||
+// Regression test for https://crbug.com/347710668.
|
||||
+TEST_F(WebTransportTest, ClosedAccessorCalledAfterOnClosed) {
|
||||
+ V8TestingScope scope;
|
||||
+
|
||||
+ auto* web_transport =
|
||||
+ CreateAndConnectSuccessfully(scope, "https://example.com");
|
||||
+
|
||||
+ web_transport->OnClosed(
|
||||
+ network::mojom::blink::WebTransportCloseInfo::New(99, "reason"),
|
||||
+ network::mojom::blink::WebTransportStats::New());
|
||||
+
|
||||
+ // If this doesn't crash then the test passed.
|
||||
+ EXPECT_FALSE(web_transport->closed(scope.GetScriptState()).IsEmpty());
|
||||
+}
|
||||
+
|
||||
TEST_F(WebTransportTest, OnClosedWithNull) {
|
||||
V8TestingScope scope;
|
||||
v8::Isolate* isolate = scope.GetIsolate();
|
||||
diff --git a/third_party/blink/web_tests/external/wpt/webtransport/close.https.any-expected.txt b/third_party/blink/web_tests/external/wpt/webtransport/close.https.any-expected.txt
|
||||
index d4e43edbd19a9eb16f3384c1c95e5c3d1a2f2619..09e2bbddaa40e1cfc192d3adbeb9538e7aeaebfe 100644
|
||||
--- a/third_party/blink/web_tests/external/wpt/webtransport/close.https.any-expected.txt
|
||||
+++ b/third_party/blink/web_tests/external/wpt/webtransport/close.https.any-expected.txt
|
||||
@@ -1,4 +1,5 @@
|
||||
This is a testharness.js-based test.
|
||||
+Harness Error. harness_status.status = 1 , harness_status.message = Unhandled rejection: promise_rejects_dom: function "function() { throw e }" threw object "NetworkError: Failed to execute 'createBidirectionalStream' on 'WebTransport': No connection." that is not a DOMException InvalidStateError: property "code" is equal to 19, expected 11
|
||||
[FAIL] opening unidirectional stream before ready
|
||||
promise_test: Unhandled rejection with value: object "NetworkError: Failed to execute 'createUnidirectionalStream' on 'WebTransport': No connection."
|
||||
[FAIL] opening bidirectional stream before ready
|
||||
diff --git a/third_party/blink/web_tests/external/wpt/webtransport/close.https.any.js b/third_party/blink/web_tests/external/wpt/webtransport/close.https.any.js
|
||||
index 0d8579584fbb21e74595588f663ef21c3b028c63..d69967ba70bb716f8664f973fe83d4158ba6da89 100644
|
||||
--- a/third_party/blink/web_tests/external/wpt/webtransport/close.https.any.js
|
||||
+++ b/third_party/blink/web_tests/external/wpt/webtransport/close.https.any.js
|
||||
@@ -163,3 +163,24 @@ promise_test(async t => {
|
||||
const wt = new WebTransport(webtransport_url('server-close.py'));
|
||||
promise_rejects_dom(t, "InvalidStateError", wt.createBidirectionalStream());
|
||||
}, 'server initiated closure while opening bidirectional stream before ready');
|
||||
+
|
||||
+// Regression test for https://crbug.com/347710668.
|
||||
+promise_test(async t => {
|
||||
+ const wt = new WebTransport(webtransport_url('server-read-then-close.py'));
|
||||
+ add_completion_callback(() => wt.close());
|
||||
+ await wt.ready;
|
||||
+
|
||||
+ const bidi_reader = wt.incomingBidirectionalStreams.getReader();
|
||||
+ const { value: bidi } = await bidi_reader.read();
|
||||
+
|
||||
+ bidi.writable.getWriter().write(new TextEncoder().encode('some data'));
|
||||
+ const reader = bidi.readable.getReader();
|
||||
+ await reader.closed.catch(t.step_func(
|
||||
+ e => assert_true(e instanceof WebTransportError)));
|
||||
+
|
||||
+ // The WebTransport session will already be closed.
|
||||
+ const {reason, closeCode} = await wt.closed;
|
||||
+
|
||||
+ assert_equals(reason, '', 'reason should be default');
|
||||
+ assert_equals(closeCode, 0, 'closeCode should be default');
|
||||
+}, 'reading closed property after close should work');
|
||||
diff --git a/third_party/blink/web_tests/external/wpt/webtransport/close.https.any.serviceworker-expected.txt b/third_party/blink/web_tests/external/wpt/webtransport/close.https.any.serviceworker-expected.txt
|
||||
index d4e43edbd19a9eb16f3384c1c95e5c3d1a2f2619..09e2bbddaa40e1cfc192d3adbeb9538e7aeaebfe 100644
|
||||
--- a/third_party/blink/web_tests/external/wpt/webtransport/close.https.any.serviceworker-expected.txt
|
||||
+++ b/third_party/blink/web_tests/external/wpt/webtransport/close.https.any.serviceworker-expected.txt
|
||||
@@ -1,4 +1,5 @@
|
||||
This is a testharness.js-based test.
|
||||
+Harness Error. harness_status.status = 1 , harness_status.message = Unhandled rejection: promise_rejects_dom: function "function() { throw e }" threw object "NetworkError: Failed to execute 'createBidirectionalStream' on 'WebTransport': No connection." that is not a DOMException InvalidStateError: property "code" is equal to 19, expected 11
|
||||
[FAIL] opening unidirectional stream before ready
|
||||
promise_test: Unhandled rejection with value: object "NetworkError: Failed to execute 'createUnidirectionalStream' on 'WebTransport': No connection."
|
||||
[FAIL] opening bidirectional stream before ready
|
||||
diff --git a/third_party/blink/web_tests/external/wpt/webtransport/close.https.any.sharedworker-expected.txt b/third_party/blink/web_tests/external/wpt/webtransport/close.https.any.sharedworker-expected.txt
|
||||
index d4e43edbd19a9eb16f3384c1c95e5c3d1a2f2619..09e2bbddaa40e1cfc192d3adbeb9538e7aeaebfe 100644
|
||||
--- a/third_party/blink/web_tests/external/wpt/webtransport/close.https.any.sharedworker-expected.txt
|
||||
+++ b/third_party/blink/web_tests/external/wpt/webtransport/close.https.any.sharedworker-expected.txt
|
||||
@@ -1,4 +1,5 @@
|
||||
This is a testharness.js-based test.
|
||||
+Harness Error. harness_status.status = 1 , harness_status.message = Unhandled rejection: promise_rejects_dom: function "function() { throw e }" threw object "NetworkError: Failed to execute 'createBidirectionalStream' on 'WebTransport': No connection." that is not a DOMException InvalidStateError: property "code" is equal to 19, expected 11
|
||||
[FAIL] opening unidirectional stream before ready
|
||||
promise_test: Unhandled rejection with value: object "NetworkError: Failed to execute 'createUnidirectionalStream' on 'WebTransport': No connection."
|
||||
[FAIL] opening bidirectional stream before ready
|
||||
diff --git a/third_party/blink/web_tests/external/wpt/webtransport/close.https.any.worker-expected.txt b/third_party/blink/web_tests/external/wpt/webtransport/close.https.any.worker-expected.txt
|
||||
index d4e43edbd19a9eb16f3384c1c95e5c3d1a2f2619..09e2bbddaa40e1cfc192d3adbeb9538e7aeaebfe 100644
|
||||
--- a/third_party/blink/web_tests/external/wpt/webtransport/close.https.any.worker-expected.txt
|
||||
+++ b/third_party/blink/web_tests/external/wpt/webtransport/close.https.any.worker-expected.txt
|
||||
@@ -1,4 +1,5 @@
|
||||
This is a testharness.js-based test.
|
||||
+Harness Error. harness_status.status = 1 , harness_status.message = Unhandled rejection: promise_rejects_dom: function "function() { throw e }" threw object "NetworkError: Failed to execute 'createBidirectionalStream' on 'WebTransport': No connection." that is not a DOMException InvalidStateError: property "code" is equal to 19, expected 11
|
||||
[FAIL] opening unidirectional stream before ready
|
||||
promise_test: Unhandled rejection with value: object "NetworkError: Failed to execute 'createUnidirectionalStream' on 'WebTransport': No connection."
|
||||
[FAIL] opening bidirectional stream before ready
|
||||
diff --git a/third_party/blink/web_tests/external/wpt/webtransport/handlers/server-read-then-close.py b/third_party/blink/web_tests/external/wpt/webtransport/handlers/server-read-then-close.py
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..7f992e0dcca3ae62277cac0fa39355fce3e57be0
|
||||
--- /dev/null
|
||||
+++ b/third_party/blink/web_tests/external/wpt/webtransport/handlers/server-read-then-close.py
|
||||
@@ -0,0 +1,9 @@
|
||||
+def session_established(session):
|
||||
+ stream_id = session.create_bidirectional_stream()
|
||||
+
|
||||
+
|
||||
+def stream_data_received(session,
|
||||
+ stream_id: int,
|
||||
+ data: bytes,
|
||||
+ stream_ended: bool):
|
||||
+ session.close(None)
|
||||
@@ -1,70 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Charles Kerr <charles@charleskerr.com>
|
||||
Date: Wed, 5 Jul 2023 16:28:30 -0500
|
||||
Subject: chore: add BUILDFLAG guard around new include
|
||||
|
||||
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4628373
|
||||
|
||||
This is an experimental commit; but if it's successful,
|
||||
This patch should be upstreamed and then removed from electron's code.
|
||||
|
||||
diff --git a/chrome/browser/ui/views/frame/browser_view.h b/chrome/browser/ui/views/frame/browser_view.h
|
||||
index 836b5aa54918386346fb7c13b9aadecd254d9013..97f4c56e5fcbdbbcae90b47ec5e42a020f178d94 100644
|
||||
--- a/chrome/browser/ui/views/frame/browser_view.h
|
||||
+++ b/chrome/browser/ui/views/frame/browser_view.h
|
||||
@@ -41,9 +41,7 @@
|
||||
#include "chrome/browser/ui/views/tabs/tab.h"
|
||||
#include "chrome/browser/ui/views/user_education/browser_feature_promo_controller.h"
|
||||
#include "chrome/common/buildflags.h"
|
||||
-#include "components/enterprise/buildflags/buildflags.h"
|
||||
#include "components/infobars/core/infobar_container.h"
|
||||
-#include "components/segmentation_platform/public/result.h"
|
||||
#include "components/user_education/common/feature_promo_controller.h"
|
||||
#include "components/user_education/common/feature_promo_handle.h"
|
||||
#include "components/webapps/browser/banners/app_banner_manager.h"
|
||||
@@ -63,10 +61,15 @@
|
||||
#include "ui/views/widget/widget_observer.h"
|
||||
#include "ui/views/window/client_view.h"
|
||||
|
||||
-#if BUILDFLAG(ENTERPRISE_WATERMARK)
|
||||
+#if 0
|
||||
+#include "components/enterprise/buildflags/buildflags.h"
|
||||
#include "chrome/browser/enterprise/watermark/watermark_view.h"
|
||||
#endif
|
||||
|
||||
+#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
|
||||
+#include "components/segmentation_platform/public/result.h"
|
||||
+#endif
|
||||
+
|
||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
#include "ui/compositor/throughput_tracker.h"
|
||||
#endif
|
||||
@@ -446,7 +449,7 @@ class BrowserView : public BrowserWindow,
|
||||
|
||||
void UpdateWebAppStatusIconsVisiblity();
|
||||
|
||||
-#if BUILDFLAG(ENTERPRISE_WATERMARK)
|
||||
+#if 0
|
||||
// Sets the watermark string to the value specified in text if the view is
|
||||
// not null.
|
||||
void SetWatermarkString(const std::string& text);
|
||||
@@ -726,7 +729,7 @@ class BrowserView : public BrowserWindow,
|
||||
|
||||
// content::WebContentsObserver:
|
||||
void DidFirstVisuallyNonEmptyPaint() override;
|
||||
-#if BUILDFLAG(ENTERPRISE_WATERMARK)
|
||||
+#if 0
|
||||
void DidStartNavigation(
|
||||
content::NavigationHandle* navigation_handle) override;
|
||||
#endif
|
||||
@@ -1191,8 +1194,10 @@ class BrowserView : public BrowserWindow,
|
||||
raw_ptr<views::WebView, AcrossTasksDanglingUntriaged> devtools_web_view_ =
|
||||
nullptr;
|
||||
|
||||
+#if 0
|
||||
// The view that overlays a watermark on the contents container.
|
||||
raw_ptr<enterprise_watermark::WatermarkView> watermark_view_ = nullptr;
|
||||
+#endif
|
||||
|
||||
// The view managing the devtools and contents positions.
|
||||
// Handled by ContentsLayoutManager.
|
||||
@@ -6,7 +6,7 @@ Subject: chore: add electron deps to gitignores
|
||||
Makes things like "git status" quicker when developing electron locally
|
||||
|
||||
diff --git a/.gitignore b/.gitignore
|
||||
index a55c4c5bbbb298bce97fe7c1072e5bca4c032c73..e6ffcfcefd2aa29a0d761051e6169950072a8207 100644
|
||||
index d68701e2ae7ee1c34ceb69eb2b66fb59ee759553..f54a985784cc03e4bfec86ec362c1a75aa286556 100644
|
||||
--- a/.gitignore
|
||||
+++ b/.gitignore
|
||||
@@ -212,6 +212,7 @@ vs-chromium-project.txt
|
||||
@@ -18,7 +18,7 @@ index a55c4c5bbbb298bce97fe7c1072e5bca4c032c73..e6ffcfcefd2aa29a0d761051e6169950
|
||||
/googleurl
|
||||
/gpu/gles2_conform_test
|
||||
diff --git a/third_party/.gitignore b/third_party/.gitignore
|
||||
index 1a18347e45e1e82834efde9718d9bb33531dd234..b0007c4b305dc681dc9cb951c499e7bcbe54d717 100644
|
||||
index 93d81d190c00a50993bdfbac3d3dec1ce17b26c5..7c78ca1483c87b2cfea42e1c35dba82e0a047144 100644
|
||||
--- a/third_party/.gitignore
|
||||
+++ b/third_party/.gitignore
|
||||
@@ -51,7 +51,9 @@
|
||||
@@ -31,7 +31,7 @@ index 1a18347e45e1e82834efde9718d9bb33531dd234..b0007c4b305dc681dc9cb951c499e7bc
|
||||
/espresso/lib/
|
||||
/eyesfree/src
|
||||
/fuchsia-sdk/images
|
||||
@@ -104,6 +106,7 @@
|
||||
@@ -106,6 +108,7 @@
|
||||
/mocha
|
||||
/mockito/src
|
||||
/nacl_sdk_binaries/
|
||||
@@ -39,11 +39,11 @@ index 1a18347e45e1e82834efde9718d9bb33531dd234..b0007c4b305dc681dc9cb951c499e7bc
|
||||
/ninja/ninja*
|
||||
/node/*.tar.gz
|
||||
/node/linux/
|
||||
@@ -149,6 +152,7 @@
|
||||
@@ -151,6 +154,7 @@
|
||||
/soda-win64
|
||||
/speex
|
||||
/sqlite4java/lib/
|
||||
+/squirrel.mac
|
||||
/subresource-filter-ruleset/data/UnindexedRules
|
||||
/subresource-filter-ruleset/data/*
|
||||
/swift-format
|
||||
/swift-toolchain
|
||||
|
||||
@@ -7,10 +7,10 @@ With WCO, allow chromium to handle synthetic mouse events generated for touch
|
||||
actions in the non-client caption area.
|
||||
|
||||
diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc
|
||||
index 90c37ebd4549c825bc0f03945d88828dbadf1559..c3ab16a0923f38080ef753f137a315151194ba30 100644
|
||||
index baa087ba8f78f79a47e71bf7c85c830b040592a7..f9a351307179ee19a56d07730d8245cb58ecce42 100644
|
||||
--- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc
|
||||
+++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc
|
||||
@@ -1220,6 +1220,10 @@ void DesktopWindowTreeHostWin::HandleHeadlessWindowBoundsChanged(
|
||||
@@ -1224,6 +1224,10 @@ void DesktopWindowTreeHostWin::HandleHeadlessWindowBoundsChanged(
|
||||
window()->SetProperty(aura::client::kHeadlessBoundsKey, bounds);
|
||||
}
|
||||
|
||||
@@ -34,10 +34,10 @@ index 8d5b01098915dd8e27ed047fa3a250169157a382..797670a6d0a34f25ee5d6f266bb2a1f5
|
||||
Widget* GetWidget();
|
||||
const Widget* GetWidget() const;
|
||||
diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc
|
||||
index ceb278617bd3621aa70671ac620d0c9969d56a38..577aa886b1ea3d942ae7b2bbca85ea6ae93fea7a 100644
|
||||
index 835b6f72bd788d8e807557f9a17fb189220a695e..3eed15267074a09b375bab3418a28ee506db1f06 100644
|
||||
--- a/ui/views/win/hwnd_message_handler.cc
|
||||
+++ b/ui/views/win/hwnd_message_handler.cc
|
||||
@@ -3128,15 +3128,19 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message,
|
||||
@@ -3132,15 +3132,19 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message,
|
||||
SetMsgHandled(FALSE);
|
||||
// We must let Windows handle the caption buttons if it's drawing them, or
|
||||
// they won't work.
|
||||
|
||||
@@ -7,7 +7,7 @@ This patch comes after Chromium removed the ScopedAllowIO API in favor
|
||||
of explicitly adding ScopedAllowBlocking calls as friends.
|
||||
|
||||
diff --git a/base/threading/thread_restrictions.h b/base/threading/thread_restrictions.h
|
||||
index e9b8366361706dcd5977fe9cdba221026770a3c5..ebc1b54cd7029e4cb87be73f87f4967414b1b0eb 100644
|
||||
index a31e09a5782c866ee3b488c09162af961473e2c6..804d626a8f6032f11662771afcb88fb079705036 100644
|
||||
--- a/base/threading/thread_restrictions.h
|
||||
+++ b/base/threading/thread_restrictions.h
|
||||
@@ -136,6 +136,7 @@ class KeyStorageLinux;
|
||||
@@ -18,7 +18,7 @@ index e9b8366361706dcd5977fe9cdba221026770a3c5..ebc1b54cd7029e4cb87be73f87f49674
|
||||
class Profile;
|
||||
class ProfileImpl;
|
||||
class ScopedAllowBlockingForProfile;
|
||||
@@ -276,6 +277,9 @@ class BackendImpl;
|
||||
@@ -277,6 +278,9 @@ class BackendImpl;
|
||||
class InFlightIO;
|
||||
bool CleanupDirectorySync(const base::FilePath&);
|
||||
} // namespace disk_cache
|
||||
@@ -28,7 +28,7 @@ index e9b8366361706dcd5977fe9cdba221026770a3c5..ebc1b54cd7029e4cb87be73f87f49674
|
||||
namespace enterprise_connectors {
|
||||
class LinuxKeyRotationCommand;
|
||||
} // namespace enterprise_connectors
|
||||
@@ -576,6 +580,7 @@ class BASE_EXPORT [[maybe_unused, nodiscard]] ScopedAllowBlocking {
|
||||
@@ -580,6 +584,7 @@ class BASE_EXPORT [[maybe_unused, nodiscard]] ScopedAllowBlocking {
|
||||
friend class ::DesktopNotificationBalloon;
|
||||
friend class ::FirefoxProfileLock;
|
||||
friend class ::GaiaConfig;
|
||||
@@ -36,7 +36,7 @@ index e9b8366361706dcd5977fe9cdba221026770a3c5..ebc1b54cd7029e4cb87be73f87f49674
|
||||
friend class ::ProfileImpl;
|
||||
friend class ::ScopedAllowBlockingForProfile;
|
||||
friend class ::StartupTabProviderImpl;
|
||||
@@ -615,6 +620,7 @@ class BASE_EXPORT [[maybe_unused, nodiscard]] ScopedAllowBlocking {
|
||||
@@ -620,6 +625,7 @@ class BASE_EXPORT [[maybe_unused, nodiscard]] ScopedAllowBlocking {
|
||||
friend class crosapi::LacrosThreadTypeDelegate;
|
||||
friend class crypto::ScopedAllowBlockingForNSS; // http://crbug.com/59847
|
||||
friend class drive::FakeDriveService;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user