mirror of
https://github.com/electron/electron.git
synced 2026-02-26 03:01:17 -05:00
Compare commits
48 Commits
v19.0.0-be
...
v19.0.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
42266d2bf0 | ||
|
|
44b5c72f67 | ||
|
|
96e1c7ec92 | ||
|
|
0206a9b7ed | ||
|
|
10ad6f8295 | ||
|
|
23c18be06f | ||
|
|
cc4565bb41 | ||
|
|
9d1c53a7e4 | ||
|
|
c7cd23c069 | ||
|
|
f9dc5b52d0 | ||
|
|
aca4b543d5 | ||
|
|
c2a11cef63 | ||
|
|
85a7498bd6 | ||
|
|
b0c255b72c | ||
|
|
2d91a03b36 | ||
|
|
424fd85b1a | ||
|
|
ad48ccbb9b | ||
|
|
2ea9be3ade | ||
|
|
52a9566f28 | ||
|
|
4ecaae9555 | ||
|
|
21b8200170 | ||
|
|
2b6cd3458f | ||
|
|
00e747ac24 | ||
|
|
082b06cf4e | ||
|
|
b07e17a3bb | ||
|
|
49ee456797 | ||
|
|
85063322e9 | ||
|
|
633d2961eb | ||
|
|
4f0592101b | ||
|
|
8797485564 | ||
|
|
c3746dc439 | ||
|
|
d5dadd0d4a | ||
|
|
da62dd2721 | ||
|
|
c945629872 | ||
|
|
536a17f5ed | ||
|
|
433765cd73 | ||
|
|
870110fd52 | ||
|
|
8ce14231fb | ||
|
|
de09ba2c51 | ||
|
|
290b548b15 | ||
|
|
3df4dcc591 | ||
|
|
c33d65c1d9 | ||
|
|
ddb0b1b4c4 | ||
|
|
14d3e369ae | ||
|
|
9f66268fab | ||
|
|
577b2ba44b | ||
|
|
7e35b91f4d | ||
|
|
04f2b2e2e3 |
@@ -14,7 +14,7 @@ parameters:
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
upload-to-s3:
|
||||
upload-to-storage:
|
||||
type: string
|
||||
default: '1'
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ parameters:
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
upload-to-s3:
|
||||
upload-to-storage:
|
||||
type: string
|
||||
default: '1'
|
||||
|
||||
@@ -41,9 +41,8 @@ executors:
|
||||
parameters:
|
||||
size:
|
||||
description: "Docker executor size"
|
||||
default: 2xlarge+
|
||||
type: enum
|
||||
enum: ["medium", "xlarge", "2xlarge+"]
|
||||
enum: ["medium", "xlarge", "2xlarge"]
|
||||
docker:
|
||||
- image: ghcr.io/electron/build:e6bebd08a51a0d78ec23e5b3fd7e7c0846412328
|
||||
resource_class: << parameters.size >>
|
||||
@@ -52,12 +51,11 @@ executors:
|
||||
parameters:
|
||||
size:
|
||||
description: "macOS executor size"
|
||||
default: macos.x86.medium.gen2
|
||||
type: enum
|
||||
enum: ["macos.x86.medium.gen2", "large"]
|
||||
xcode:
|
||||
description: "xcode version"
|
||||
default: "12.4.0"
|
||||
default: 13.3.0
|
||||
type: enum
|
||||
enum: ["12.4.0", "13.3.0"]
|
||||
|
||||
@@ -639,9 +637,9 @@ step-electron-publish: &step-electron-publish
|
||||
fi
|
||||
|
||||
cd src/electron
|
||||
if [ "$UPLOAD_TO_S3" == "1" ]; then
|
||||
echo 'Uploading Electron release distribution to S3'
|
||||
script/release/uploaders/upload.py --verbose --upload_to_s3
|
||||
if [ "$UPLOAD_TO_STORAGE" == "1" ]; then
|
||||
echo 'Uploading Electron release distribution to Azure'
|
||||
script/release/uploaders/upload.py --verbose --UPLOAD_TO_STORAGE
|
||||
else
|
||||
echo 'Uploading Electron release distribution to Github releases'
|
||||
script/release/uploaders/upload.py --verbose
|
||||
@@ -1622,7 +1620,9 @@ commands:
|
||||
jobs:
|
||||
# Layer 0: Docs. Standalone.
|
||||
ts-compile-doc-change:
|
||||
executor: linux-docker
|
||||
executor:
|
||||
name: linux-docker
|
||||
size: medium
|
||||
environment:
|
||||
<<: *env-linux-2xlarge
|
||||
<<: *env-testing-build
|
||||
@@ -1645,32 +1645,10 @@ jobs:
|
||||
save-git-cache: true
|
||||
checkout-to-create-src-cache: true
|
||||
|
||||
linux-checkout-for-native-tests:
|
||||
executor: linux-docker
|
||||
environment:
|
||||
<<: *env-linux-2xlarge
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_pyyaml=True'
|
||||
steps:
|
||||
- electron-build:
|
||||
persist: false
|
||||
build: false
|
||||
checkout: true
|
||||
persist-checkout: true
|
||||
|
||||
linux-checkout-for-native-tests-with-no-patches:
|
||||
executor: linux-docker
|
||||
environment:
|
||||
<<: *env-linux-2xlarge
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=apply_patches=False --custom-var=checkout_pyyaml=True'
|
||||
steps:
|
||||
- electron-build:
|
||||
persist: false
|
||||
build: false
|
||||
checkout: true
|
||||
persist-checkout: true
|
||||
|
||||
mac-checkout:
|
||||
executor: linux-docker
|
||||
executor:
|
||||
name: linux-docker
|
||||
size: xlarge
|
||||
environment:
|
||||
<<: *env-linux-2xlarge
|
||||
<<: *env-testing-build
|
||||
@@ -1703,7 +1681,9 @@ jobs:
|
||||
|
||||
# Layer 2: Builds.
|
||||
linux-x64-testing:
|
||||
executor: linux-docker
|
||||
executor:
|
||||
name: linux-docker
|
||||
size: xlarge
|
||||
environment:
|
||||
<<: *env-global
|
||||
<<: *env-testing-build
|
||||
@@ -1717,7 +1697,9 @@ jobs:
|
||||
use-out-cache: false
|
||||
|
||||
linux-x64-testing-asan:
|
||||
executor: linux-docker
|
||||
executor:
|
||||
name: linux-docker
|
||||
size: 2xlarge
|
||||
environment:
|
||||
<<: *env-global
|
||||
<<: *env-testing-build
|
||||
@@ -1733,7 +1715,9 @@ jobs:
|
||||
build-nonproprietary-ffmpeg: false
|
||||
|
||||
linux-x64-testing-no-run-as-node:
|
||||
executor: linux-docker
|
||||
executor:
|
||||
name: linux-docker
|
||||
size: xlarge
|
||||
environment:
|
||||
<<: *env-linux-2xlarge
|
||||
<<: *env-testing-build
|
||||
@@ -1756,25 +1740,14 @@ jobs:
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True'
|
||||
<<: *steps-electron-gn-check
|
||||
|
||||
linux-x64-release:
|
||||
executor: linux-docker
|
||||
environment:
|
||||
<<: *env-linux-2xlarge-release
|
||||
<<: *env-release-build
|
||||
<<: *env-send-slack-notifications
|
||||
<<: *env-ninja-status
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True'
|
||||
steps:
|
||||
- electron-build:
|
||||
persist: true
|
||||
checkout: true
|
||||
|
||||
linux-x64-publish:
|
||||
executor: linux-docker
|
||||
executor:
|
||||
name: linux-docker
|
||||
size: 2xlarge
|
||||
environment:
|
||||
<<: *env-linux-2xlarge-release
|
||||
<<: *env-release-build
|
||||
UPLOAD_TO_S3: << pipeline.parameters.upload-to-s3 >>
|
||||
UPLOAD_TO_STORAGE: << pipeline.parameters.upload-to-storage >>
|
||||
<<: *env-ninja-status
|
||||
steps:
|
||||
- run: echo running
|
||||
@@ -1790,7 +1763,9 @@ jobs:
|
||||
|
||||
|
||||
linux-arm-testing:
|
||||
executor: linux-docker
|
||||
executor:
|
||||
name: linux-docker
|
||||
size: 2xlarge
|
||||
environment:
|
||||
<<: *env-global
|
||||
<<: *env-arm
|
||||
@@ -1806,29 +1781,17 @@ jobs:
|
||||
checkout-and-assume-cache: true
|
||||
use-out-cache: false
|
||||
|
||||
linux-arm-release:
|
||||
executor: linux-docker
|
||||
environment:
|
||||
<<: *env-linux-2xlarge-release
|
||||
<<: *env-arm
|
||||
<<: *env-release-build
|
||||
<<: *env-send-slack-notifications
|
||||
<<: *env-ninja-status
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True'
|
||||
steps:
|
||||
- electron-build:
|
||||
persist: false
|
||||
checkout: true
|
||||
|
||||
linux-arm-publish:
|
||||
executor: linux-docker
|
||||
executor:
|
||||
name: linux-docker
|
||||
size: 2xlarge
|
||||
environment:
|
||||
<<: *env-linux-2xlarge-release
|
||||
<<: *env-arm
|
||||
<<: *env-release-build
|
||||
<<: *env-32bit-release
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True'
|
||||
UPLOAD_TO_S3: << pipeline.parameters.upload-to-s3 >>
|
||||
UPLOAD_TO_STORAGE: << pipeline.parameters.upload-to-storage >>
|
||||
<<: *env-ninja-status
|
||||
steps:
|
||||
- run: echo running
|
||||
@@ -1843,7 +1806,9 @@ jobs:
|
||||
checkout: true
|
||||
|
||||
linux-arm64-testing:
|
||||
executor: linux-docker
|
||||
executor:
|
||||
name: linux-docker
|
||||
size: 2xlarge
|
||||
environment:
|
||||
<<: *env-global
|
||||
<<: *env-arm64
|
||||
@@ -1870,28 +1835,16 @@ jobs:
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True'
|
||||
<<: *steps-electron-gn-check
|
||||
|
||||
linux-arm64-release:
|
||||
executor: linux-docker
|
||||
environment:
|
||||
<<: *env-linux-2xlarge-release
|
||||
<<: *env-arm64
|
||||
<<: *env-release-build
|
||||
<<: *env-send-slack-notifications
|
||||
<<: *env-ninja-status
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True'
|
||||
steps:
|
||||
- electron-build:
|
||||
persist: false
|
||||
checkout: true
|
||||
|
||||
linux-arm64-publish:
|
||||
executor: linux-docker
|
||||
executor:
|
||||
name: linux-docker
|
||||
size: 2xlarge
|
||||
environment:
|
||||
<<: *env-linux-2xlarge-release
|
||||
<<: *env-arm64
|
||||
<<: *env-release-build
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm64=True'
|
||||
UPLOAD_TO_S3: << pipeline.parameters.upload-to-s3 >>
|
||||
UPLOAD_TO_STORAGE: << pipeline.parameters.upload-to-storage >>
|
||||
<<: *env-ninja-status
|
||||
steps:
|
||||
- run: echo running
|
||||
@@ -1908,7 +1861,7 @@ jobs:
|
||||
osx-testing-x64:
|
||||
executor:
|
||||
name: macos
|
||||
xcode: "13.3.0"
|
||||
size: macos.x86.medium.gen2
|
||||
environment:
|
||||
<<: *env-mac-large
|
||||
<<: *env-testing-build
|
||||
@@ -1925,7 +1878,7 @@ jobs:
|
||||
osx-testing-x64-gn-check:
|
||||
executor:
|
||||
name: macos
|
||||
xcode: "13.3.0"
|
||||
size: macos.x86.medium.gen2
|
||||
environment:
|
||||
<<: *env-machine-mac
|
||||
<<: *env-testing-build
|
||||
@@ -1935,11 +1888,11 @@ jobs:
|
||||
osx-publish-x64-skip-checkout:
|
||||
executor:
|
||||
name: macos
|
||||
xcode: "13.3.0"
|
||||
size: macos.x86.medium.gen2
|
||||
environment:
|
||||
<<: *env-mac-large-release
|
||||
<<: *env-release-build
|
||||
UPLOAD_TO_S3: << pipeline.parameters.upload-to-s3 >>
|
||||
UPLOAD_TO_STORAGE: << pipeline.parameters.upload-to-storage >>
|
||||
<<: *env-ninja-status
|
||||
steps:
|
||||
- run: echo running
|
||||
@@ -1956,12 +1909,12 @@ jobs:
|
||||
osx-publish-arm64-skip-checkout:
|
||||
executor:
|
||||
name: macos
|
||||
xcode: "13.3.0"
|
||||
size: macos.x86.medium.gen2
|
||||
environment:
|
||||
<<: *env-mac-large-release
|
||||
<<: *env-release-build
|
||||
<<: *env-apple-silicon
|
||||
UPLOAD_TO_S3: << pipeline.parameters.upload-to-s3 >>
|
||||
UPLOAD_TO_STORAGE: << pipeline.parameters.upload-to-storage >>
|
||||
<<: *env-ninja-status
|
||||
steps:
|
||||
- run: echo running
|
||||
@@ -1978,7 +1931,7 @@ jobs:
|
||||
osx-testing-arm64:
|
||||
executor:
|
||||
name: macos
|
||||
xcode: "13.3.0"
|
||||
size: macos.x86.medium.gen2
|
||||
environment:
|
||||
<<: *env-mac-large
|
||||
<<: *env-testing-build
|
||||
@@ -1997,7 +1950,7 @@ jobs:
|
||||
mas-testing-x64:
|
||||
executor:
|
||||
name: macos
|
||||
xcode: "13.3.0"
|
||||
size: macos.x86.medium.gen2
|
||||
environment:
|
||||
<<: *env-mac-large
|
||||
<<: *env-mas
|
||||
@@ -2015,7 +1968,7 @@ jobs:
|
||||
mas-testing-x64-gn-check:
|
||||
executor:
|
||||
name: macos
|
||||
xcode: "13.3.0"
|
||||
size: macos.x86.medium.gen2
|
||||
environment:
|
||||
<<: *env-machine-mac
|
||||
<<: *env-mas
|
||||
@@ -2026,12 +1979,12 @@ jobs:
|
||||
mas-publish-x64-skip-checkout:
|
||||
executor:
|
||||
name: macos
|
||||
xcode: "13.3.0"
|
||||
size: macos.x86.medium.gen2
|
||||
environment:
|
||||
<<: *env-mac-large-release
|
||||
<<: *env-mas
|
||||
<<: *env-release-build
|
||||
UPLOAD_TO_S3: << pipeline.parameters.upload-to-s3 >>
|
||||
UPLOAD_TO_STORAGE: << pipeline.parameters.upload-to-storage >>
|
||||
steps:
|
||||
- run: echo running
|
||||
- when:
|
||||
@@ -2047,12 +2000,12 @@ jobs:
|
||||
mas-publish-arm64-skip-checkout:
|
||||
executor:
|
||||
name: macos
|
||||
xcode: "13.3.0"
|
||||
size: macos.x86.medium.gen2
|
||||
environment:
|
||||
<<: *env-mac-large-release
|
||||
<<: *env-mas-apple-silicon
|
||||
<<: *env-release-build
|
||||
UPLOAD_TO_S3: << pipeline.parameters.upload-to-s3 >>
|
||||
UPLOAD_TO_STORAGE: << pipeline.parameters.upload-to-storage >>
|
||||
<<: *env-ninja-status
|
||||
steps:
|
||||
- run: echo running
|
||||
@@ -2069,7 +2022,7 @@ jobs:
|
||||
mas-testing-arm64:
|
||||
executor:
|
||||
name: macos
|
||||
xcode: "13.3.0"
|
||||
size: macos.x86.medium.gen2
|
||||
environment:
|
||||
<<: *env-mac-large
|
||||
<<: *env-testing-build
|
||||
@@ -2086,41 +2039,6 @@ jobs:
|
||||
attach: true
|
||||
|
||||
# Layer 3: Tests.
|
||||
linux-x64-unittests:
|
||||
executor: linux-docker
|
||||
environment:
|
||||
<<: *env-linux-2xlarge
|
||||
<<: *env-unittests
|
||||
<<: *env-headless-testing
|
||||
<<: *steps-native-tests
|
||||
|
||||
linux-x64-disabled-unittests:
|
||||
executor: linux-docker
|
||||
environment:
|
||||
<<: *env-linux-2xlarge
|
||||
<<: *env-unittests
|
||||
<<: *env-headless-testing
|
||||
TESTS_ARGS: '--only-disabled-tests'
|
||||
<<: *steps-native-tests
|
||||
|
||||
linux-x64-chromium-unittests:
|
||||
executor: linux-docker
|
||||
environment:
|
||||
<<: *env-linux-2xlarge
|
||||
<<: *env-unittests
|
||||
<<: *env-headless-testing
|
||||
TESTS_ARGS: '--include-disabled-tests'
|
||||
<<: *steps-native-tests
|
||||
|
||||
linux-x64-browsertests:
|
||||
executor: linux-docker
|
||||
environment:
|
||||
<<: *env-linux-2xlarge
|
||||
<<: *env-browsertests
|
||||
<<: *env-testing-build
|
||||
<<: *env-headless-testing
|
||||
<<: *steps-native-tests
|
||||
|
||||
linux-x64-testing-tests:
|
||||
executor:
|
||||
name: linux-docker
|
||||
@@ -2156,23 +2074,15 @@ jobs:
|
||||
<<: *steps-test-nan
|
||||
|
||||
linux-x64-testing-node:
|
||||
executor: linux-docker
|
||||
executor:
|
||||
name: linux-docker
|
||||
size: xlarge
|
||||
environment:
|
||||
<<: *env-linux-medium
|
||||
<<: *env-headless-testing
|
||||
<<: *env-stack-dumping
|
||||
<<: *steps-test-node
|
||||
|
||||
linux-x64-release-tests:
|
||||
executor:
|
||||
name: linux-docker
|
||||
size: medium
|
||||
environment:
|
||||
<<: *env-linux-medium
|
||||
<<: *env-headless-testing
|
||||
<<: *env-send-slack-notifications
|
||||
<<: *steps-tests
|
||||
|
||||
linux-x64-verify-ffmpeg:
|
||||
executor:
|
||||
name: linux-docker
|
||||
@@ -2202,7 +2112,10 @@ jobs:
|
||||
<<: *steps-tests
|
||||
|
||||
osx-testing-x64-tests:
|
||||
executor: macos
|
||||
executor:
|
||||
name: macos
|
||||
xcode: 12.4.0
|
||||
size: macos.x86.medium.gen2
|
||||
environment:
|
||||
<<: *env-mac-large
|
||||
<<: *env-stack-dumping
|
||||
@@ -2218,7 +2131,10 @@ jobs:
|
||||
<<: *steps-tests
|
||||
|
||||
mas-testing-x64-tests:
|
||||
executor: macos
|
||||
executor:
|
||||
name: macos
|
||||
xcode: 12.4.0
|
||||
size: macos.x86.medium.gen2
|
||||
environment:
|
||||
<<: *env-mac-large
|
||||
<<: *env-stack-dumping
|
||||
|
||||
2
DEPS
2
DEPS
@@ -2,7 +2,7 @@ gclient_gn_args_from = 'src'
|
||||
|
||||
vars = {
|
||||
'chromium_version':
|
||||
'102.0.4999.0',
|
||||
'102.0.5005.61',
|
||||
'node_version':
|
||||
'v16.14.2',
|
||||
'nan_version':
|
||||
|
||||
@@ -1 +1 @@
|
||||
19.0.0-beta.3
|
||||
19.0.0
|
||||
44
appveyor.yml
44
appveyor.yml
@@ -11,7 +11,7 @@
|
||||
# - "TARGET_ARCH" Choose from {'ia32', 'x64', 'arm', 'arm64', 'mips64el'}.
|
||||
# Is used in some publishing scripts, but does NOT affect the Electron binary.
|
||||
# Must match 'target_cpu' passed to "GN_EXTRA_ARGS" and "NPM_CONFIG_ARCH" value.
|
||||
# - "UPLOAD_TO_S3" Set it to '1' upload a release to the S3 bucket.
|
||||
# - "UPLOAD_TO_STORAGE" Set it to '1' upload a release to the Azure bucket.
|
||||
# Otherwise the release will be uploaded to the Github Releases.
|
||||
# (The value is only checked if "ELECTRON_RELEASE" is defined.)
|
||||
#
|
||||
@@ -183,34 +183,21 @@ build_script:
|
||||
- ninja -C out/Default third_party/electron_node:headers
|
||||
- python %LOCAL_GOMA_DIR%\goma_ctl.py stat
|
||||
- python3 electron/build/profile_toolchain.py --output-json=out/Default/windows_toolchain_profile.json
|
||||
- appveyor PushArtifact out/Default/windows_toolchain_profile.json
|
||||
- appveyor PushArtifact out/Default/dist.zip
|
||||
- appveyor PushArtifact out/Default/shell_browser_ui_unittests.exe
|
||||
- appveyor PushArtifact out/Default/chromedriver.zip
|
||||
- appveyor PushArtifact out/ffmpeg/ffmpeg.zip
|
||||
- 7z a node_headers.zip out\Default\gen\node_headers
|
||||
- appveyor PushArtifact node_headers.zip
|
||||
- appveyor PushArtifact out/Default/mksnapshot.zip
|
||||
- appveyor PushArtifact out/Default/hunspell_dictionaries.zip
|
||||
- appveyor PushArtifact out/Default/electron.lib
|
||||
# Temporarily disable symbol generation on 32-bit Windows due to failures
|
||||
- ps: >-
|
||||
if ($env:GN_CONFIG -eq 'release' -And $env:TARGET_ARCH -ne 'ia32') {
|
||||
if ($env:GN_CONFIG -eq 'release') {
|
||||
# Needed for msdia140.dll on 64-bit windows
|
||||
$env:Path += ";$pwd\third_party\llvm-build\Release+Asserts\bin"
|
||||
ninja -C out/Default electron:electron_symbols
|
||||
}
|
||||
- ps: >-
|
||||
if ($env:GN_CONFIG -eq 'release') {
|
||||
if ($env:TARGET_ARCH -ne 'ia32') {
|
||||
python electron\script\zip-symbols.py
|
||||
appveyor-retry appveyor PushArtifact out/Default/symbols.zip
|
||||
}
|
||||
python electron\script\zip-symbols.py
|
||||
appveyor-retry appveyor PushArtifact out/Default/symbols.zip
|
||||
} else {
|
||||
# It's useful to have pdb files when debugging testing builds that are
|
||||
# built on CI.
|
||||
7z a pdb.zip out\Default\*.pdb
|
||||
appveyor-retry appveyor PushArtifact pdb.zip
|
||||
}
|
||||
- python electron/script/zip_manifests/check-zip-manifest.py out/Default/dist.zip electron/script/zip_manifests/dist_zip.win.%TARGET_ARCH%.manifest
|
||||
test_script:
|
||||
@@ -239,14 +226,13 @@ test_script:
|
||||
- echo "Done verifying mksnapshot"
|
||||
- if "%RUN_TESTS%"=="true" ( echo Verifying chromedriver & python electron\script\verify-chromedriver.py --build-dir out\Default --source-root %cd% )
|
||||
- echo "Done verifying chromedriver"
|
||||
- if exist %cd%\electron.log ( appveyor-retry appveyor PushArtifact %cd%\electron.log )
|
||||
deploy_script:
|
||||
- cd electron
|
||||
- ps: >-
|
||||
if (Test-Path Env:\ELECTRON_RELEASE) {
|
||||
if (Test-Path Env:\UPLOAD_TO_S3) {
|
||||
Write-Output "Uploading Electron release distribution to s3"
|
||||
& python script\release\uploaders\upload.py --verbose --upload_to_s3
|
||||
if (Test-Path Env:\UPLOAD_TO_STORAGE) {
|
||||
Write-Output "Uploading Electron release distribution to azure"
|
||||
& python script\release\uploaders\upload.py --verbose --upload_to_storage
|
||||
} else {
|
||||
Write-Output "Uploading Electron release distribution to github releases"
|
||||
& python script\release\uploaders\upload.py --verbose
|
||||
@@ -255,4 +241,18 @@ deploy_script:
|
||||
node script/release/ci-release-build.js --job=electron-woa-testing --ci=VSTS --armTest --appveyorJobId=$env:APPVEYOR_JOB_ID $env:APPVEYOR_REPO_BRANCH
|
||||
}
|
||||
on_finish:
|
||||
- if exist src\electron\electron.log ( appveyor-retry appveyor PushArtifact src\electron\electron.log )
|
||||
- cd ..
|
||||
- if exist out\Default\windows_toolchain_profile.json ( appveyor-retry appveyor PushArtifact out\Default\windows_toolchain_profile.json )
|
||||
- if exist out\Default\dist.zip (appveyor-retry appveyor PushArtifact out\Default\dist.zip)
|
||||
- if exist out\Default\shell_browser_ui_unittests.exe (appveyor-retry appveyor PushArtifact out\Default\shell_browser_ui_unittests.exe)
|
||||
- if exist out\Default\chromedriver.zip (appveyor-retry appveyor PushArtifact out\Default\chromedriver.zip)
|
||||
- if exist out\ffmpeg\ffmpeg.zip (appveyor-retry appveyor PushArtifact out\ffmpeg\ffmpeg.zip)
|
||||
- if exist node_headers.zip (appveyor-retry appveyor PushArtifact node_headers.zip)
|
||||
- if exist out\Default\mksnapshot.zip (appveyor-retry appveyor PushArtifact out\Default\mksnapshot.zip)
|
||||
- if exist out\Default\hunspell_dictionaries.zip (appveyor-retry appveyor PushArtifact out\Default\hunspell_dictionaries.zip)
|
||||
- if exist out\Default\electron.lib (appveyor-retry appveyor PushArtifact out\Default\electron.lib)
|
||||
- ps: >-
|
||||
if ((Test-Path "pdb.zip") -And ($env:GN_CONFIG -ne 'release')) {
|
||||
appveyor-retry appveyor PushArtifact pdb.zip
|
||||
}
|
||||
- if exist electron\electron.log ( appveyor-retry appveyor PushArtifact electron\electron.log )
|
||||
|
||||
@@ -21,6 +21,9 @@ proprietary_codecs = true
|
||||
ffmpeg_branding = "Chrome"
|
||||
|
||||
enable_basic_printing = true
|
||||
|
||||
# Removes DLLs from the build, which are only meant to be used for Chromium development.
|
||||
# See https://github.com/electron/electron/pull/17985
|
||||
angle_enable_vulkan_validation_layers = false
|
||||
dawn_enable_vulkan_validation_layers = false
|
||||
|
||||
|
||||
@@ -484,7 +484,6 @@ Returns:
|
||||
* `argv` string[] - An array of the second instance's command line arguments
|
||||
* `workingDirectory` string - The second instance's working directory
|
||||
* `additionalData` unknown - A JSON object of additional data passed from the second instance
|
||||
* `ackCallback` unknown - A function that can be used to send data back to the second instance
|
||||
|
||||
This event will be emitted inside the primary instance of your application
|
||||
when a second instance has been executed and calls `app.requestSingleInstanceLock()`.
|
||||
@@ -496,35 +495,12 @@ non-minimized.
|
||||
|
||||
**Note:** If the second instance is started by a different user than the first, the `argv` array will not include the arguments.
|
||||
|
||||
**Note:** `ackCallback` allows the user to send data back to the
|
||||
second instance during the `app.requestSingleInstanceLock()` flow.
|
||||
This callback can be used for cases where the second instance
|
||||
needs to obtain additional information from the first instance
|
||||
before quitting.
|
||||
|
||||
Currently, the limit on the message size is kMaxMessageLength,
|
||||
or around 32kB. To be safe, keep the amount of data passed to 31kB at most.
|
||||
|
||||
In order to call the callback, `event.preventDefault()` must be called, first.
|
||||
If the callback is not called in either case, `null` will be sent back.
|
||||
If `event.preventDefault()` is not called, but `ackCallback` is called
|
||||
by the user in the event, then the behaviour is undefined.
|
||||
|
||||
This event is guaranteed to be emitted after the `ready` event of `app`
|
||||
gets emitted.
|
||||
|
||||
**Note:** Extra command line arguments might be added by Chromium,
|
||||
such as `--original-process-start-time`.
|
||||
|
||||
### Event: 'first-instance-ack'
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `additionalData` unknown - A JSON object of additional data passed from the first instance, in response to the first instance's `second-instance` event.
|
||||
|
||||
This event will be emitted within the second instance during the call to `app.requestSingleInstanceLock()`, when the first instance calls the `ackCallback` provided by the `second-instance` event handler.
|
||||
|
||||
## Methods
|
||||
|
||||
The `app` object has the following methods:
|
||||
@@ -985,13 +961,6 @@ starts:
|
||||
const { app } = require('electron')
|
||||
let myWindow = null
|
||||
|
||||
app.on('first-instance-ack', (event, additionalData) => {
|
||||
// Print out the ack received from the first instance.
|
||||
// Note this event handler must come before the requestSingleInstanceLock call.
|
||||
// Expected output: '{"myAckKey":"myAckValue"}'
|
||||
console.log(JSON.stringify(additionalData))
|
||||
})
|
||||
|
||||
const additionalData = { myKey: 'myValue' }
|
||||
const gotTheLock = app.requestSingleInstanceLock(additionalData)
|
||||
|
||||
@@ -999,19 +968,14 @@ if (!gotTheLock) {
|
||||
app.quit()
|
||||
} else {
|
||||
app.on('second-instance', (event, commandLine, workingDirectory, additionalData) => {
|
||||
// We must call preventDefault if we're sending back data.
|
||||
event.preventDefault()
|
||||
// Print out data received from the second instance.
|
||||
// Expected output: '{"myKey":"myValue"}'
|
||||
console.log(JSON.stringify(additionalData))
|
||||
console.log(additionalData)
|
||||
|
||||
// Someone tried to run a second instance, we should focus our window.
|
||||
if (myWindow) {
|
||||
if (myWindow.isMinimized()) myWindow.restore()
|
||||
myWindow.focus()
|
||||
}
|
||||
const ackData = { myAckKey: 'myAckValue' }
|
||||
ackCallback(ackData)
|
||||
})
|
||||
|
||||
// Create myWindow, load the rest of the app, etc...
|
||||
|
||||
@@ -18,8 +18,8 @@ The `safeStorage` module has the following methods:
|
||||
|
||||
Returns `boolean` - Whether encryption is available.
|
||||
|
||||
On Linux, returns true if the secret key is
|
||||
available. On MacOS, returns true if Keychain is available.
|
||||
On Linux, returns true if the app has emitted the `ready` event and the secret key is available.
|
||||
On MacOS, returns true if Keychain is available.
|
||||
On Windows, returns true once the app has emitted the `ready` event.
|
||||
|
||||
### `safeStorage.encryptString(plainText)`
|
||||
|
||||
@@ -22,11 +22,12 @@ check out our [Electron Versioning](./electron-versioning.md) doc.
|
||||
| 12.0.0 | -- | 2020-Nov-19 | 2021-Mar-02 | M89 | v14.16 | 🚫 |
|
||||
| 13.0.0 | -- | 2021-Mar-04 | 2021-May-25 | M91 | v14.16 | 🚫 |
|
||||
| 14.0.0 | -- | 2021-May-27 | 2021-Aug-31 | M93 | v14.17 | 🚫 |
|
||||
| 15.0.0 | 2021-Jul-20 | 2021-Sep-01 | 2021-Sep-21 | M94 | v16.5 | ✅ |
|
||||
| 16.0.0 | 2021-Sep-23 | 2021-Oct-20 | 2021-Nov-16 | M96 | v16.9 | ✅ |
|
||||
| 15.0.0 | 2021-Jul-20 | 2021-Sep-01 | 2021-Sep-21 | M94 | v16.5 | 🚫 |
|
||||
| 16.0.0 | 2021-Sep-23 | 2021-Oct-20 | 2021-Nov-16 | M96 | v16.9 | 🚫 |
|
||||
| 17.0.0 | 2021-Nov-18 | 2022-Jan-06 | 2022-Feb-01 | M98 | v16.13 | ✅ |
|
||||
| 18.0.0 | 2022-Feb-03 | 2022-Mar-03 | 2022-Mar-29 | M100 | v16.13 | ✅ |
|
||||
| 19.0.0 | 2022-Mar-31 | 2022-Apr-26 | 2022-May-24 | M102 | TBD | ✅ |
|
||||
| 19.0.0 | 2022-Mar-31 | 2022-Apr-26 | 2022-May-24 | M102 | v16.14 | ✅ |
|
||||
| 20.0.0 | 2022-May-26 | 2022-Jun-21 | 2022-Aug-02 | M104 | TBD | ✅ |
|
||||
|
||||
**Notes:**
|
||||
|
||||
|
||||
@@ -131,7 +131,6 @@ folder of your project:
|
||||
<meta charset="UTF-8">
|
||||
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
|
||||
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'">
|
||||
<meta http-equiv="X-Content-Security-Policy" content="default-src 'self'; script-src 'self'">
|
||||
<title>Hello World!</title>
|
||||
</head>
|
||||
<body>
|
||||
@@ -427,7 +426,6 @@ window.addEventListener('DOMContentLoaded', () => {
|
||||
<meta charset="UTF-8">
|
||||
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
|
||||
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'">
|
||||
<meta http-equiv="X-Content-Security-Policy" content="default-src 'self'; script-src 'self'">
|
||||
<title>Hello World!</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -65,7 +65,6 @@ template("electron_extra_paks") {
|
||||
"$root_gen_dir/net/net_resources.pak",
|
||||
"$root_gen_dir/third_party/blink/public/resources/blink_resources.pak",
|
||||
"$root_gen_dir/third_party/blink/public/resources/inspector_overlay_resources.pak",
|
||||
"$root_gen_dir/ui/resources/webui_resources.pak",
|
||||
"$target_gen_dir/electron_resources.pak",
|
||||
]
|
||||
deps = [
|
||||
@@ -178,6 +177,7 @@ template("electron_paks") {
|
||||
"${root_gen_dir}/third_party/blink/public/strings/blink_accessibility_strings_",
|
||||
"${root_gen_dir}/third_party/blink/public/strings/blink_strings_",
|
||||
"${root_gen_dir}/device/bluetooth/strings/bluetooth_strings_",
|
||||
"${root_gen_dir}/extensions/strings/extensions_strings_",
|
||||
"${root_gen_dir}/services/strings/services_strings_",
|
||||
"${root_gen_dir}/ui/strings/app_locale_settings_",
|
||||
"${root_gen_dir}/ui/strings/ax_strings_",
|
||||
@@ -187,6 +187,7 @@ template("electron_paks") {
|
||||
"//chrome/app/resources:platform_locale_settings",
|
||||
"//components/strings:components_strings",
|
||||
"//device/bluetooth/strings",
|
||||
"//extensions/strings",
|
||||
"//services/strings",
|
||||
"//third_party/blink/public/strings",
|
||||
"//third_party/blink/public/strings:accessibility_strings",
|
||||
|
||||
@@ -78,6 +78,19 @@ export function openGuestWindow ({ event, embedder, guest, referrer, disposition
|
||||
...browserWindowOptions
|
||||
});
|
||||
|
||||
if (!guest) {
|
||||
// When we open a new window from a link (via OpenURLFromTab),
|
||||
// the browser process is responsible for initiating navigation
|
||||
// in the new window.
|
||||
window.loadURL(url, {
|
||||
httpReferrer: referrer,
|
||||
...(postData && {
|
||||
postData,
|
||||
extraHeaders: formatPostDataHeaders(postData as Electron.UploadRawData[])
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
handleWindowLifecycleEvents({ embedder, frameName, guest: window, outlivesOpener });
|
||||
|
||||
embedder.emit('did-create-window', window, { url, frameName, options: browserWindowOptions, disposition, referrer, postData });
|
||||
@@ -243,6 +256,15 @@ export function makeWebPreferences ({ embedder, secureOverrideWebPreferences = {
|
||||
};
|
||||
}
|
||||
|
||||
function formatPostDataHeaders (postData: PostData) {
|
||||
if (!postData) return;
|
||||
|
||||
const { contentType, boundary } = parseContentTypeFormat(postData);
|
||||
if (boundary != null) { return `content-type: ${contentType}; boundary=${boundary}`; }
|
||||
|
||||
return `content-type: ${contentType}`;
|
||||
}
|
||||
|
||||
const MULTIPART_CONTENT_TYPE = 'multipart/form-data';
|
||||
const URL_ENCODED_CONTENT_TYPE = 'application/x-www-form-urlencoded';
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "electron",
|
||||
"version": "19.0.0-beta.3",
|
||||
"version": "19.0.0",
|
||||
"repository": "https://github.com/electron/electron",
|
||||
"description": "Build cross platform desktop apps with JavaScript, HTML, and CSS",
|
||||
"devDependencies": {
|
||||
|
||||
@@ -102,12 +102,12 @@ chore_do_not_use_chrome_windows_in_cryptotoken_webrequestsender.patch
|
||||
process_singleton.patch
|
||||
fix_expose_decrementcapturercount_in_web_contents_impl.patch
|
||||
add_ui_scopedcliboardwriter_writeunsaferawdata.patch
|
||||
feat_add_data_parameter_to_processsingleton.patch
|
||||
mas_gate_private_enterprise_APIs.patch
|
||||
load_v8_snapshot_in_browser_process.patch
|
||||
fix_patch_out_permissions_checks_in_exclusive_access.patch
|
||||
fix_aspect_ratio_with_max_size.patch
|
||||
fix_dont_delete_SerialPortManager_on_main_thread.patch
|
||||
feat_add_data_transfer_to_requestsingleinstancelock.patch
|
||||
fix_crash_when_saving_edited_pdf_files.patch
|
||||
port_autofill_colors_to_the_color_pipeline.patch
|
||||
build_disable_partition_alloc_on_mac.patch
|
||||
@@ -115,3 +115,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
|
||||
feat_move_firstpartysets_to_content_browser_client.patch
|
||||
custom_protocols_plzserviceworker.patch
|
||||
|
||||
@@ -23,10 +23,10 @@ index eb6f4c87c4479d5f4fb8e3f85a231fb9cc744a63..11298b413021b4d438195482db253a93
|
||||
int32_t world_id) {}
|
||||
virtual void DidClearWindowObject() {}
|
||||
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
|
||||
index 596dc721842c707844a771d64337e9cf0d82bfcc..b9eea3470139e1833b2b23d3b535b11235e2bc8e 100644
|
||||
index f217de19126feeeafee01b2be31ced936696ce20..95966ce7f0eeb0a7f2822bef69b540ac6bfe298d 100644
|
||||
--- a/content/renderer/render_frame_impl.cc
|
||||
+++ b/content/renderer/render_frame_impl.cc
|
||||
@@ -4465,6 +4465,12 @@ void RenderFrameImpl::DidCreateScriptContext(v8::Local<v8::Context> context,
|
||||
@@ -4489,6 +4489,12 @@ void RenderFrameImpl::DidCreateScriptContext(v8::Local<v8::Context> context,
|
||||
observer.DidCreateScriptContext(context, world_id);
|
||||
}
|
||||
|
||||
@@ -79,10 +79,10 @@ index a6ba8411384855c82712960375bc949c5c2bd522..fc86ca807c9c1bda9236160580b09415
|
||||
if (World().IsMainWorld()) {
|
||||
GetFrame()->Loader().DispatchDidClearWindowObjectInMainWorld();
|
||||
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 bca4cbb2b2ba84fe58b5cfeaf190add5803e27c9..b6c9dd3a2a1c9b6667c563d5da86ccb4871ae81f 100644
|
||||
index f36d04ff77481bd30e0de3f6d45c54dfece4067c..d30f569cd68716b9e963cf0fb5da3f7e65cc215a 100644
|
||||
--- a/third_party/blink/renderer/core/frame/local_frame_client.h
|
||||
+++ b/third_party/blink/renderer/core/frame/local_frame_client.h
|
||||
@@ -301,6 +301,8 @@ class CORE_EXPORT LocalFrameClient : public FrameClient {
|
||||
@@ -303,6 +303,8 @@ class CORE_EXPORT LocalFrameClient : public FrameClient {
|
||||
|
||||
virtual void DidCreateScriptContext(v8::Local<v8::Context>,
|
||||
int32_t world_id) = 0;
|
||||
@@ -92,7 +92,7 @@ index bca4cbb2b2ba84fe58b5cfeaf190add5803e27c9..b6c9dd3a2a1c9b6667c563d5da86ccb4
|
||||
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 b690ada2d46146b6da38cbb2c688f249ae558464..b03774140883c5bb7de6358f3df95ab8774b9dc7 100644
|
||||
index 5a83dcdf50acc27da2b1fbb3e515cb4316305a3a..86f31acc40a2dd296c34f3ecf5ef6ccd97cbc18c 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
|
||||
@@ -275,6 +275,13 @@ void LocalFrameClientImpl::DidCreateScriptContext(
|
||||
@@ -110,7 +110,7 @@ index b690ada2d46146b6da38cbb2c688f249ae558464..b03774140883c5bb7de6358f3df95ab8
|
||||
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 420d82ed07017deba3298c5454666c09240dd23d..15407fb95dcf25875eb76a41fe1834c1f0a53528 100644
|
||||
index ac81fdc1ac99ca02458a10c0d258b846a8a9955e..ed838db2474790437ff4b57e23a1e289afce4d47 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
|
||||
@@ -80,6 +80,8 @@ class CORE_EXPORT LocalFrameClientImpl final : public LocalFrameClient {
|
||||
@@ -123,10 +123,10 @@ index 420d82ed07017deba3298c5454666c09240dd23d..15407fb95dcf25875eb76a41fe1834c1
|
||||
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 8087d1f62e9b1a8ac33a9e92c10a7cb8b8363e08..845c3329674d99dd385316dbfd1287fa3566a60e 100644
|
||||
index aab6a77b18f83adeac065083f83b94b7ff251282..0d0e272a162be8d1bee9e0122e3e7a59b0ad32a3 100644
|
||||
--- a/third_party/blink/renderer/core/loader/empty_clients.h
|
||||
+++ b/third_party/blink/renderer/core/loader/empty_clients.h
|
||||
@@ -357,6 +357,8 @@ class CORE_EXPORT EmptyLocalFrameClient : public LocalFrameClient {
|
||||
@@ -359,6 +359,8 @@ class CORE_EXPORT EmptyLocalFrameClient : public LocalFrameClient {
|
||||
|
||||
void DidCreateScriptContext(v8::Local<v8::Context>,
|
||||
int32_t world_id) override {}
|
||||
|
||||
@@ -6,10 +6,10 @@ Subject: allow disabling blink scheduler throttling per RenderView
|
||||
This allows us to disable throttling for hidden windows.
|
||||
|
||||
diff --git a/content/browser/renderer_host/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc
|
||||
index 32df5050f5a66c4b4f0981d3777a3b5a4fac9629..d8d9982bc6bd6e472677707b326a5dafa9b7fcf5 100644
|
||||
index a9267b633e126f057e914b895f280ed658ff279d..179b5449f53c2d7b9024fb08fe1b1f6c03c6d5b0 100644
|
||||
--- a/content/browser/renderer_host/render_view_host_impl.cc
|
||||
+++ b/content/browser/renderer_host/render_view_host_impl.cc
|
||||
@@ -660,6 +660,11 @@ void RenderViewHostImpl::SetBackgroundOpaque(bool opaque) {
|
||||
@@ -665,6 +665,11 @@ void RenderViewHostImpl::SetBackgroundOpaque(bool opaque) {
|
||||
GetWidget()->GetAssociatedFrameWidget()->SetBackgroundOpaque(opaque);
|
||||
}
|
||||
|
||||
@@ -22,11 +22,11 @@ index 32df5050f5a66c4b4f0981d3777a3b5a4fac9629..d8d9982bc6bd6e472677707b326a5daf
|
||||
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 a099eed10dd061994bff696519099c3ef7437a46..a1f1e9b55272e70b4acd5d1f1515fba7d91538fa 100644
|
||||
index 3f0df3df3dd74ced71869ce01abf7b159387b8f4..85b169530a21bcfc016d1439a71d35378077774d 100644
|
||||
--- a/content/browser/renderer_host/render_view_host_impl.h
|
||||
+++ b/content/browser/renderer_host/render_view_host_impl.h
|
||||
@@ -137,6 +137,7 @@ class CONTENT_EXPORT RenderViewHostImpl
|
||||
bool IsRenderViewLive() const override;
|
||||
bool IsRenderViewLiveForTesting() const override;
|
||||
void WriteIntoTrace(perfetto::TracedProto<TraceProto> context) const override;
|
||||
|
||||
+ void SetSchedulerThrottling(bool allowed) override;
|
||||
@@ -34,7 +34,7 @@ index a099eed10dd061994bff696519099c3ef7437a46..a1f1e9b55272e70b4acd5d1f1515fba7
|
||||
void SendRendererPreferencesToRenderer(
|
||||
const blink::RendererPreferences& preferences);
|
||||
diff --git a/content/public/browser/render_view_host.h b/content/public/browser/render_view_host.h
|
||||
index a6fe708878eb9afba9a68e0be71ba2c0b2a84d7d..5cc81ceb44d0a8baee3ebcc63aa4137b1e9ef08e 100644
|
||||
index 3b01b3419c4361d5d75ad1c37e5baa3a1967bd09..35c82d931242a1180091267c18e0255840acc5ce 100644
|
||||
--- a/content/public/browser/render_view_host.h
|
||||
+++ b/content/public/browser/render_view_host.h
|
||||
@@ -80,6 +80,9 @@ class CONTENT_EXPORT RenderViewHost {
|
||||
@@ -61,10 +61,10 @@ index fd145f0aa562d6b63fb1d3a8a9241ae1aa1ce7a0..54d30fb9db8b48b94abdb815c487f618
|
||||
// ADDING NEW FUNCTIONS? Please keep private functions alphabetized and put
|
||||
// it in the same order in the .cc file as it was in the header.
|
||||
diff --git a/third_party/blink/public/mojom/page/page.mojom b/third_party/blink/public/mojom/page/page.mojom
|
||||
index befd736a9cf362514b9a2ee475dc4a814c85a87b..24b2617f56673a3075697802cf5b574b0c766610 100644
|
||||
index 39bfc2200e924d0c589cfd07f085f182ef6853a6..bddff6d5ad3f6d08c4dc48e66ebc5319b1a5ec28 100644
|
||||
--- a/third_party/blink/public/mojom/page/page.mojom
|
||||
+++ b/third_party/blink/public/mojom/page/page.mojom
|
||||
@@ -97,4 +97,7 @@ interface PageBroadcast {
|
||||
@@ -108,4 +108,7 @@ interface PageBroadcast {
|
||||
|
||||
// Sent to whole page, but should only be used by the main frame.
|
||||
SetPageBaseBackgroundColor(skia.mojom.SkColor? color);
|
||||
@@ -73,7 +73,7 @@ index befd736a9cf362514b9a2ee475dc4a814c85a87b..24b2617f56673a3075697802cf5b574b
|
||||
+ SetSchedulerThrottling(bool allowed);
|
||||
};
|
||||
diff --git a/third_party/blink/public/web/web_view.h b/third_party/blink/public/web/web_view.h
|
||||
index a1427a6a95583ae853284b97cab77d577172e60e..4645764213c82e73532f7c61ed03f919f8241393 100644
|
||||
index 5e4032ccf916f969cd669af7d983becddb57c72b..a858c9f2fa609ae756a2e70d0362f2de372dd5be 100644
|
||||
--- a/third_party/blink/public/web/web_view.h
|
||||
+++ b/third_party/blink/public/web/web_view.h
|
||||
@@ -364,6 +364,7 @@ class WebView {
|
||||
@@ -85,10 +85,10 @@ index a1427a6a95583ae853284b97cab77d577172e60e..4645764213c82e73532f7c61ed03f919
|
||||
// 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 d7b5e40a26026b7f4640c2f405fadab4a800e267..b2a2e38397fdf3e9bb52c4532a1d14463ed4110d 100644
|
||||
index 6504c73f614bebad7b899c8b76c4b3034b7dab7a..f76a0ee0778d7b4e4df69a4c43b4a6bfdc89294d 100644
|
||||
--- a/third_party/blink/renderer/core/exported/web_view_impl.cc
|
||||
+++ b/third_party/blink/renderer/core/exported/web_view_impl.cc
|
||||
@@ -3688,6 +3688,13 @@ PageScheduler* WebViewImpl::Scheduler() const {
|
||||
@@ -3689,6 +3689,13 @@ PageScheduler* WebViewImpl::Scheduler() const {
|
||||
return GetPage()->GetPageScheduler();
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ index d7b5e40a26026b7f4640c2f405fadab4a800e267..b2a2e38397fdf3e9bb52c4532a1d1446
|
||||
void WebViewImpl::SetVisibilityState(
|
||||
mojom::blink::PageVisibilityState visibility_state,
|
||||
bool is_initial_state) {
|
||||
@@ -3699,7 +3706,8 @@ void WebViewImpl::SetVisibilityState(
|
||||
@@ -3700,7 +3707,8 @@ void WebViewImpl::SetVisibilityState(
|
||||
}
|
||||
GetPage()->SetVisibilityState(visibility_state, is_initial_state);
|
||||
GetPage()->GetPageScheduler()->SetPageVisible(
|
||||
@@ -113,10 +113,10 @@ index d7b5e40a26026b7f4640c2f405fadab4a800e267..b2a2e38397fdf3e9bb52c4532a1d1446
|
||||
|
||||
mojom::blink::PageVisibilityState WebViewImpl::GetVisibilityState() {
|
||||
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 08a54c62b7f4eeb6a8b0e0cb192723e1aecad915..1eeb122ac5db86c53d328a308dc2b7a4a5ca9fed 100644
|
||||
index 5c9609a6a8d1e18981ac14ad5321fa82c3eb38e0..0a2564a8e45210ba58438e95caa70d01fac22aee 100644
|
||||
--- a/third_party/blink/renderer/core/exported/web_view_impl.h
|
||||
+++ b/third_party/blink/renderer/core/exported/web_view_impl.h
|
||||
@@ -419,6 +419,7 @@ class CORE_EXPORT WebViewImpl final : public WebView,
|
||||
@@ -420,6 +420,7 @@ class CORE_EXPORT WebViewImpl final : public WebView,
|
||||
LocalDOMWindow* PagePopupWindow() const;
|
||||
|
||||
PageScheduler* Scheduler() const override;
|
||||
@@ -124,7 +124,7 @@ index 08a54c62b7f4eeb6a8b0e0cb192723e1aecad915..1eeb122ac5db86c53d328a308dc2b7a4
|
||||
void SetVisibilityState(mojom::blink::PageVisibilityState visibility_state,
|
||||
bool is_initial_state) override;
|
||||
mojom::blink::PageVisibilityState GetVisibilityState() override;
|
||||
@@ -854,6 +855,8 @@ class CORE_EXPORT WebViewImpl final : public WebView,
|
||||
@@ -855,6 +856,8 @@ class CORE_EXPORT WebViewImpl final : public WebView,
|
||||
// If true, we send IPC messages when |preferred_size_| changes.
|
||||
bool send_preferred_size_changes_ = false;
|
||||
|
||||
|
||||
@@ -15,10 +15,10 @@ 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 0396836ad4ae67e26b6920afbcd702ccb24d391e..f207eda80b6cd1d3a739cc27499691ad1ac8e13e 100644
|
||||
index a519c49a01987feab4dadbc4ba48b73e943fa404..c8d2a65cb428e85c33675668cc106f0af124dfee 100644
|
||||
--- a/third_party/blink/renderer/core/frame/frame.cc
|
||||
+++ b/third_party/blink/renderer/core/frame/frame.cc
|
||||
@@ -122,14 +122,6 @@ bool Frame::Detach(FrameDetachType type) {
|
||||
@@ -123,14 +123,6 @@ bool Frame::Detach(FrameDetachType type) {
|
||||
|
||||
DCHECK(!IsDetached());
|
||||
|
||||
@@ -33,7 +33,7 @@ index 0396836ad4ae67e26b6920afbcd702ccb24d391e..f207eda80b6cd1d3a739cc27499691ad
|
||||
if (type == FrameDetachType::kRemove) {
|
||||
if (provisional_frame_) {
|
||||
provisional_frame_->Detach(FrameDetachType::kRemove);
|
||||
@@ -153,6 +145,14 @@ bool Frame::Detach(FrameDetachType type) {
|
||||
@@ -154,6 +146,14 @@ bool Frame::Detach(FrameDetachType type) {
|
||||
GetWindowProxyManager()->ClearForSwap();
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ index 0396836ad4ae67e26b6920afbcd702ccb24d391e..f207eda80b6cd1d3a739cc27499691ad
|
||||
// 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 b95ed440737ccdf32607c90831d13a482315d515..73f7aeee21f0116e46dad91cb9a088ab5adda6e3 100644
|
||||
index 3efc0a04ae3fa60dce4aeb9a296c8dd1bb43320a..5dac7c18f39abefcc318ba2a7b8fad449189d0b6 100644
|
||||
--- a/third_party/blink/renderer/core/frame/local_frame.cc
|
||||
+++ b/third_party/blink/renderer/core/frame/local_frame.cc
|
||||
@@ -543,10 +543,6 @@ bool LocalFrame::DetachImpl(FrameDetachType type) {
|
||||
|
||||
28
patches/chromium/build_disable_print_content_analysis.patch
Normal file
28
patches/chromium/build_disable_print_content_analysis.patch
Normal file
@@ -0,0 +1,28 @@
|
||||
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 559ac76d4e4b9d9c1824c4da186a6b0f7619fcca..72855e0c5fadb286b67144b34ff71f45e1434c73 100644
|
||||
--- a/printing/buildflags/buildflags.gni
|
||||
+++ b/printing/buildflags/buildflags.gni
|
||||
@@ -36,8 +36,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_ash || is_chromeos_lacros || is_win || is_linux || is_mac
|
||||
+ enable_print_content_analysis = is_chromeos_ash || is_chromeos_lacros
|
||||
}
|
||||
|
||||
declare_args() {
|
||||
@@ -33,10 +33,10 @@ index 3c40d999a9545051e91a9f0ad3bf7ca2a95d80c4..b5a20be5e22238e7e1969bdaf52c0b05
|
||||
"//base",
|
||||
"//build:branding_buildflags",
|
||||
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
|
||||
index bd16a798301785507629f24726c1cec636956fe2..86ab85c51a0a6192f1ea040007966464439465ab 100644
|
||||
index 948d05358b89895faa97a7d383bfac66a45464a8..43859d267010103daf80525a5af0f312a577411c 100644
|
||||
--- a/chrome/browser/BUILD.gn
|
||||
+++ b/chrome/browser/BUILD.gn
|
||||
@@ -4552,7 +4552,7 @@ static_library("browser") {
|
||||
@@ -4560,7 +4560,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 bd16a798301785507629f24726c1cec636956fe2..86ab85c51a0a6192f1ea040007966464
|
||||
sources += [ "certificate_viewer_stub.cc" ]
|
||||
}
|
||||
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn
|
||||
index 060e49987d27be37afb2b85e658525d4edc08df6..3333bb6be0d07eff9d4ef5aea446c44c00b3d3af 100644
|
||||
index 641f52eb7952858738a6623b480f767261e5d009..6d0c624ea62a9125ef7e5579da197de2327a12ff 100644
|
||||
--- a/chrome/test/BUILD.gn
|
||||
+++ b/chrome/test/BUILD.gn
|
||||
@@ -5995,7 +5995,6 @@ test("unit_tests") {
|
||||
@@ -6002,7 +6002,6 @@ test("unit_tests") {
|
||||
|
||||
deps += [
|
||||
"//chrome:other_version",
|
||||
@@ -57,7 +57,7 @@ index 060e49987d27be37afb2b85e658525d4edc08df6..3333bb6be0d07eff9d4ef5aea446c44c
|
||||
"//chrome//services/util_win:unit_tests",
|
||||
"//chrome/app:chrome_dll_resources",
|
||||
"//chrome/browser:chrome_process_finder",
|
||||
@@ -6018,6 +6017,10 @@ test("unit_tests") {
|
||||
@@ -6025,6 +6024,10 @@ test("unit_tests") {
|
||||
"//ui/resources",
|
||||
]
|
||||
|
||||
@@ -68,7 +68,7 @@ index 060e49987d27be37afb2b85e658525d4edc08df6..3333bb6be0d07eff9d4ef5aea446c44c
|
||||
ldflags = [
|
||||
"/DELAYLOAD:api-ms-win-core-winrt-error-l1-1-0.dll",
|
||||
"/DELAYLOAD:api-ms-win-core-winrt-l1-1-0.dll",
|
||||
@@ -6706,7 +6709,6 @@ test("unit_tests") {
|
||||
@@ -6712,7 +6715,6 @@ test("unit_tests") {
|
||||
}
|
||||
|
||||
deps += [
|
||||
@@ -76,7 +76,7 @@ index 060e49987d27be37afb2b85e658525d4edc08df6..3333bb6be0d07eff9d4ef5aea446c44c
|
||||
"//chrome/browser:cart_db_content_proto",
|
||||
"//chrome/browser:coupon_db_content_proto",
|
||||
"//chrome/browser/media/router:test_support",
|
||||
@@ -6754,6 +6756,11 @@ test("unit_tests") {
|
||||
@@ -6760,6 +6762,11 @@ test("unit_tests") {
|
||||
if (is_chromeos) {
|
||||
deps += [ "//ui/chromeos" ]
|
||||
}
|
||||
|
||||
@@ -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 9b08d7bbbda75390813ff07e0dc83bb9d16992a6..b47dc4a90a0294c5d7e73f01c496fd2b4f621400 100644
|
||||
index ec886101b6e5347bdd832684a5c3b2cc3179c657..0287e414f4020147ddee297f7c1447c32a118905 100644
|
||||
--- a/content/browser/renderer_host/render_frame_host_impl.cc
|
||||
+++ b/content/browser/renderer_host/render_frame_host_impl.cc
|
||||
@@ -6939,6 +6939,7 @@ void RenderFrameHostImpl::CreateNewWindow(
|
||||
@@ -6943,6 +6943,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 9b08d7bbbda75390813ff07e0dc83bb9d16992a6..b47dc4a90a0294c5d7e73f01c496fd2b
|
||||
&no_javascript_access);
|
||||
|
||||
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
|
||||
index d0092176fd24acb0657819d666e4f76ec65012ec..df03de0a810bbce796d5bc421b92000e02dbd449 100644
|
||||
index 335e70179a03ee379082525bb4c7d596983bd633..faa795be3a6cbc7ae13d9a42a1bdbd01ac0406a9 100644
|
||||
--- a/content/browser/web_contents/web_contents_impl.cc
|
||||
+++ b/content/browser/web_contents/web_contents_impl.cc
|
||||
@@ -3943,6 +3943,14 @@ FrameTree* WebContentsImpl::CreateNewWindow(
|
||||
@@ -3947,6 +3947,14 @@ FrameTree* WebContentsImpl::CreateNewWindow(
|
||||
}
|
||||
auto* new_contents_impl = new_contents.get();
|
||||
|
||||
@@ -39,7 +39,7 @@ index d0092176fd24acb0657819d666e4f76ec65012ec..df03de0a810bbce796d5bc421b92000e
|
||||
new_contents_impl->GetController().SetSessionStorageNamespace(
|
||||
partition_config, session_storage_namespace);
|
||||
|
||||
@@ -3987,12 +3995,6 @@ FrameTree* WebContentsImpl::CreateNewWindow(
|
||||
@@ -3991,12 +3999,6 @@ FrameTree* WebContentsImpl::CreateNewWindow(
|
||||
AddWebContentsDestructionObserver(new_contents_impl);
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ index ae3dda4b9b40bb0d4c1a10eaedda9270d3543a8b..9b988bb631ab759739ae01c918efb1d5
|
||||
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 f132199113778f6b50972419b61a187e6272300c..7bb1680553c405a9016cfd67eca5fa3c6439b692 100644
|
||||
index 9bbc7cf6d9542a3f013313e0c497839da2beb9d1..c01e06b08b1cca7a663e30476a551904ce9c6db8 100644
|
||||
--- a/content/public/browser/web_contents_delegate.cc
|
||||
+++ b/content/public/browser/web_contents_delegate.cc
|
||||
@@ -26,6 +26,17 @@ namespace content {
|
||||
@@ -124,7 +124,7 @@ index f132199113778f6b50972419b61a187e6272300c..7bb1680553c405a9016cfd67eca5fa3c
|
||||
const OpenURLParams& params) {
|
||||
return nullptr;
|
||||
diff --git a/content/public/browser/web_contents_delegate.h b/content/public/browser/web_contents_delegate.h
|
||||
index 85335ff06c87ea3986360fad18df6cf01a4a7cca..eeafde1fa6067804665954525eafdd482d8eb3f3 100644
|
||||
index 04aa4d993b331396ee20464f6e1d2da10c91c834..2556c044b6e28501a5fac9b0040e623b8f35f497 100644
|
||||
--- a/content/public/browser/web_contents_delegate.h
|
||||
+++ b/content/public/browser/web_contents_delegate.h
|
||||
@@ -16,6 +16,7 @@
|
||||
@@ -150,7 +150,7 @@ index 85335ff06c87ea3986360fad18df6cf01a4a7cca..eeafde1fa6067804665954525eafdd48
|
||||
// typically happens when popups are created.
|
||||
virtual void WebContentsCreated(WebContents* source_contents,
|
||||
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
|
||||
index f7fbc40e8df8b996d6079f2e691771529ca42497..5580f245477b713d0f1f92ca9d15de847c4f8c92 100644
|
||||
index 89b07508aef80680a847c106fea0e2fa58ff964b..6630af3583a6bac6135d46644280d6444fe981b8 100644
|
||||
--- a/content/renderer/render_view_impl.cc
|
||||
+++ b/content/renderer/render_view_impl.cc
|
||||
@@ -33,6 +33,7 @@
|
||||
@@ -220,10 +220,10 @@ index 84d32491a56528a84b4395fba1d54cdbb38d522b..09998a83c449ef8cd9f360fbcdcf7edc
|
||||
|
||||
} // 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 00af75f5295251fb19c874d2b7d877c4a53f7f12..c0042534907dfca1789b8dde2ffa11956d3e029e 100644
|
||||
index 2e2ba228a7f179b7cf9c43434bd20ca20b1f1af6..de9f95426ad2dcc99bc4961a0e57539d287408e4 100644
|
||||
--- a/third_party/blink/renderer/core/frame/local_dom_window.cc
|
||||
+++ b/third_party/blink/renderer/core/frame/local_dom_window.cc
|
||||
@@ -2076,6 +2076,7 @@ DOMWindow* LocalDOMWindow::open(v8::Isolate* isolate,
|
||||
@@ -2074,6 +2074,7 @@ DOMWindow* LocalDOMWindow::open(v8::Isolate* isolate,
|
||||
|
||||
WebWindowFeatures window_features =
|
||||
GetWindowFeaturesFromString(features, incumbent_window);
|
||||
|
||||
@@ -108,7 +108,7 @@ index 6688ba8ba2fb7d930773144cdbc43f1f6fa2b685..22015c7b9b50e1264551ce226757f90e
|
||||
}
|
||||
|
||||
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
|
||||
index 70ee9049e3cb73f55bed81c3e08037df2f4c9e07..8d230826aaf867d9046a6b9ac93a60f4750e52be 100644
|
||||
index 7548e63c57dc8463cb59614122e32c574ae17437..a9e1c335e3fae4fa795059c9b28bd5d404184c2e 100644
|
||||
--- a/chrome/browser/ui/browser.cc
|
||||
+++ b/chrome/browser/ui/browser.cc
|
||||
@@ -1786,12 +1786,11 @@ bool Browser::IsWebContentsCreationOverridden(
|
||||
@@ -246,10 +246,10 @@ index c6bd5c19f8a7ceec17c9e32af5296a9617f3a619..02199b439fba7fdc617b7f7980d958b7
|
||||
void AddNewContents(content::WebContents* source,
|
||||
std::unique_ptr<content::WebContents> new_contents,
|
||||
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
|
||||
index b9309e1cbc4a8b701534aa8be2827c40d98d6678..c1b1bfc8333e93456178842db392eabff96bf4c9 100644
|
||||
index add5ba98f4409460b93aa2f8c49eb49a1f59470a..4b77c71375a7375e168c9bee93a73c3af6fe1252 100644
|
||||
--- a/content/browser/web_contents/web_contents_impl.cc
|
||||
+++ b/content/browser/web_contents/web_contents_impl.cc
|
||||
@@ -3891,8 +3891,7 @@ FrameTree* WebContentsImpl::CreateNewWindow(
|
||||
@@ -3895,8 +3895,7 @@ FrameTree* WebContentsImpl::CreateNewWindow(
|
||||
|
||||
if (delegate_ && delegate_->IsWebContentsCreationOverridden(
|
||||
source_site_instance, params.window_container_type,
|
||||
@@ -260,7 +260,7 @@ index b9309e1cbc4a8b701534aa8be2827c40d98d6678..c1b1bfc8333e93456178842db392eabf
|
||||
static_cast<WebContentsImpl*>(delegate_->CreateCustomWebContents(
|
||||
opener, source_site_instance, is_new_browsing_instance,
|
||||
diff --git a/content/public/browser/web_contents_delegate.cc b/content/public/browser/web_contents_delegate.cc
|
||||
index 7bb1680553c405a9016cfd67eca5fa3c6439b692..3aa2cca04340098859e1072eaa80a46a8e0463b1 100644
|
||||
index c01e06b08b1cca7a663e30476a551904ce9c6db8..9f50a8721560f734270308776f2f37ad49a8cb91 100644
|
||||
--- a/content/public/browser/web_contents_delegate.cc
|
||||
+++ b/content/public/browser/web_contents_delegate.cc
|
||||
@@ -134,8 +134,7 @@ bool WebContentsDelegate::IsWebContentsCreationOverridden(
|
||||
@@ -274,7 +274,7 @@ index 7bb1680553c405a9016cfd67eca5fa3c6439b692..3aa2cca04340098859e1072eaa80a46a
|
||||
}
|
||||
|
||||
diff --git a/content/public/browser/web_contents_delegate.h b/content/public/browser/web_contents_delegate.h
|
||||
index eeafde1fa6067804665954525eafdd482d8eb3f3..b17f371aa489a5b61c28fbcd316b19815f072df9 100644
|
||||
index 2556c044b6e28501a5fac9b0040e623b8f35f497..4c6cd654551b2f5cfd59a5271a8d95a9e6862d3c 100644
|
||||
--- a/content/public/browser/web_contents_delegate.h
|
||||
+++ b/content/public/browser/web_contents_delegate.h
|
||||
@@ -317,8 +317,7 @@ class CONTENT_EXPORT WebContentsDelegate {
|
||||
|
||||
@@ -7,10 +7,10 @@ spellchecker uses a few IDS_ resources. We need to load these from
|
||||
Electrons grit header instead of Chromes
|
||||
|
||||
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
|
||||
index 02e4b0e27f4a0d3409327ba929f78b129dc06385..bd16a798301785507629f24726c1cec636956fe2 100644
|
||||
index af2fd82cbc458b396107a161d9c3dd31077e57a7..948d05358b89895faa97a7d383bfac66a45464a8 100644
|
||||
--- a/chrome/browser/BUILD.gn
|
||||
+++ b/chrome/browser/BUILD.gn
|
||||
@@ -7164,6 +7164,7 @@ static_library("browser") {
|
||||
@@ -7182,6 +7182,7 @@ static_library("browser") {
|
||||
deps += [
|
||||
"//components/spellcheck/browser",
|
||||
"//components/spellcheck/common",
|
||||
|
||||
53
patches/chromium/custom_protocols_plzserviceworker.patch
Normal file
53
patches/chromium/custom_protocols_plzserviceworker.patch
Normal file
@@ -0,0 +1,53 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: deepak1556 <hop2deep@gmail.com>
|
||||
Date: Fri, 20 May 2022 00:29:34 +0900
|
||||
Subject: custom_protocols_plzserviceworker.patch
|
||||
|
||||
Allow registering custom protocols to handle service worker main script fetching with PlzServiceWorker.
|
||||
|
||||
Refs https://bugs.chromium.org/p/chromium/issues/detail?id=996511
|
||||
|
||||
diff --git a/content/browser/service_worker/service_worker_context_wrapper.cc b/content/browser/service_worker/service_worker_context_wrapper.cc
|
||||
index f827745b9800d4f11a17e405b0eb22601d7e4dd4..0cecbfb2a6fd3daa71338c94bda4b1f45eb51d5e 100644
|
||||
--- a/content/browser/service_worker/service_worker_context_wrapper.cc
|
||||
+++ b/content/browser/service_worker/service_worker_context_wrapper.cc
|
||||
@@ -1591,6 +1591,28 @@ ServiceWorkerContextWrapper::GetLoaderFactoryForBrowserInitiatedRequest(
|
||||
loader_factory_bundle_info =
|
||||
context()->loader_factory_bundle_for_update_check()->Clone();
|
||||
|
||||
+ // Give the embedder a chance to register custom schemes that can
|
||||
+ // handle loading the service worker main script.
|
||||
+ // Previous registration triggered by
|
||||
+ // ServiceWorkerContextWrapper::CreateNonNetworkPendingURLLoaderFactoryBundleForUpdateCheck
|
||||
+ // happens early on browser startup before the JS in the main process
|
||||
+ // is run by the embedder.
|
||||
+ auto* factory_bundle = static_cast<blink::PendingURLLoaderFactoryBundle*>(
|
||||
+ loader_factory_bundle_info.get());
|
||||
+ ContentBrowserClient::NonNetworkURLLoaderFactoryMap non_network_factories;
|
||||
+ GetContentClient()
|
||||
+ ->browser()
|
||||
+ ->RegisterNonNetworkServiceWorkerUpdateURLLoaderFactories(
|
||||
+ storage_partition_->browser_context(), &non_network_factories);
|
||||
+ for (auto& pair : non_network_factories) {
|
||||
+ const std::string& scheme = pair.first;
|
||||
+ mojo::PendingRemote<network::mojom::URLLoaderFactory>& factory_remote =
|
||||
+ pair.second;
|
||||
+
|
||||
+ factory_bundle->pending_scheme_specific_factories().emplace(
|
||||
+ scheme, std::move(factory_remote));
|
||||
+ }
|
||||
+
|
||||
if (base::FeatureList::IsEnabled(
|
||||
features::kEnableServiceWorkersForChromeUntrusted) &&
|
||||
scope.scheme_piece() == kChromeUIUntrustedScheme) {
|
||||
@@ -1611,9 +1633,7 @@ ServiceWorkerContextWrapper::GetLoaderFactoryForBrowserInitiatedRequest(
|
||||
browser_context(), scope_origin)) {
|
||||
config->RegisterURLDataSource(browser_context());
|
||||
|
||||
- static_cast<blink::PendingURLLoaderFactoryBundle*>(
|
||||
- loader_factory_bundle_info.get())
|
||||
- ->pending_scheme_specific_factories()
|
||||
+ factory_bundle->pending_scheme_specific_factories()
|
||||
.emplace(kChromeUIUntrustedScheme,
|
||||
CreateWebUIServiceWorkerLoaderFactory(
|
||||
browser_context(), kChromeUIUntrustedScheme,
|
||||
@@ -240,10 +240,10 @@ index 8cd9a960ca1de81857af60daa91596c1dbb17786..7455afe4d81eac31fe3792a4459834a7
|
||||
sandbox::policy::switches::kGpuSandboxAllowSysVShm,
|
||||
sandbox::policy::switches::kGpuSandboxFailuresFatal,
|
||||
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
|
||||
index 927e182bbba7a3700fd20c8c964da7cc162c4210..f099940c5b8fd92c04401cfbd231c04cb413d286 100644
|
||||
index 09f72f1fbd7b782c5bf52245482b358103f0c243..80d9fd40efed1edc90e7bdf1db534acb876206ca 100644
|
||||
--- a/content/browser/renderer_host/render_process_host_impl.cc
|
||||
+++ b/content/browser/renderer_host/render_process_host_impl.cc
|
||||
@@ -197,6 +197,7 @@
|
||||
@@ -198,6 +198,7 @@
|
||||
#include "ui/accessibility/accessibility_switches.h"
|
||||
#include "ui/base/ui_base_switches.h"
|
||||
#include "ui/display/display_switches.h"
|
||||
@@ -251,7 +251,7 @@ index 927e182bbba7a3700fd20c8c964da7cc162c4210..f099940c5b8fd92c04401cfbd231c04c
|
||||
#include "ui/gl/gl_switches.h"
|
||||
#include "url/gurl.h"
|
||||
#include "url/origin.h"
|
||||
@@ -3213,6 +3214,7 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer(
|
||||
@@ -3219,6 +3220,7 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer(
|
||||
// Propagate the following switches to the renderer command line (along
|
||||
// with any associated values) if present in the browser command line.
|
||||
static const char* const kSwitchNames[] = {
|
||||
|
||||
@@ -24,10 +24,10 @@ This patch temporarily disables the metrics so we can have green CI, and we
|
||||
should continue seeking for a real fix.
|
||||
|
||||
diff --git a/content/browser/renderer_host/navigator.cc b/content/browser/renderer_host/navigator.cc
|
||||
index cd286b4925b3d2d9e74caecee759360488f2b8ba..0bc714a78e58719824ffeba8ced7854474fa6e92 100644
|
||||
index c289c888bc9d74d3f696714650b65aa373be27b4..aad7ec5ed0b6f6ab5cdfe0d7902d952c7c9e36c6 100644
|
||||
--- a/content/browser/renderer_host/navigator.cc
|
||||
+++ b/content/browser/renderer_host/navigator.cc
|
||||
@@ -1177,6 +1177,7 @@ void Navigator::RecordNavigationMetrics(
|
||||
@@ -1286,6 +1286,7 @@ void Navigator::RecordNavigationMetrics(
|
||||
.InMilliseconds());
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ index cd286b4925b3d2d9e74caecee759360488f2b8ba..0bc714a78e58719824ffeba8ced78544
|
||||
// If this is a same-process navigation and we have timestamps for unload
|
||||
// durations, fill those metrics out as well.
|
||||
if (params.unload_start && params.unload_end &&
|
||||
@@ -1223,6 +1224,7 @@ void Navigator::RecordNavigationMetrics(
|
||||
@@ -1332,6 +1333,7 @@ void Navigator::RecordNavigationMetrics(
|
||||
first_before_unload_start_time)
|
||||
.InMilliseconds());
|
||||
}
|
||||
|
||||
@@ -11,10 +11,10 @@ This regressed in https://chromium-review.googlesource.com/c/chromium/src/+/2572
|
||||
Upstream: https://chromium-review.googlesource.com/c/chromium/src/+/2598393
|
||||
|
||||
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
|
||||
index b9eea3470139e1833b2b23d3b535b11235e2bc8e..fbc1f6d8387e33cb7daafc96b7514897f067f008 100644
|
||||
index 95966ce7f0eeb0a7f2822bef69b540ac6bfe298d..34c2bdc5d4dda2fb0bdf2a8c3e5f8f9a5e11b977 100644
|
||||
--- a/content/renderer/render_frame_impl.cc
|
||||
+++ b/content/renderer/render_frame_impl.cc
|
||||
@@ -2377,7 +2377,7 @@ const blink::WebView* RenderFrameImpl::GetWebView() const {
|
||||
@@ -2398,7 +2398,7 @@ const blink::WebView* RenderFrameImpl::GetWebView() const {
|
||||
}
|
||||
|
||||
const blink::web_pref::WebPreferences& RenderFrameImpl::GetBlinkPreferences() {
|
||||
|
||||
@@ -33,10 +33,10 @@ index 14c71cc69388da46f62d9835e2a06fef0870da02..9481ea08401ae29ae9c1d960491b05b3
|
||||
|
||||
} // namespace net
|
||||
diff --git a/services/network/network_context.cc b/services/network/network_context.cc
|
||||
index 98268925da14d61256f8dee3aa899f17ce7acaf6..1abdc204e278383818dc073f96c90e91ec1f3fb9 100644
|
||||
index f06a04983571623b542dba11933c4c95c3dcf398..606573a33573884baa173b796e1870b8defcda2a 100644
|
||||
--- a/services/network/network_context.cc
|
||||
+++ b/services/network/network_context.cc
|
||||
@@ -1404,6 +1404,13 @@ void NetworkContext::SetNetworkConditions(
|
||||
@@ -1407,6 +1407,13 @@ void NetworkContext::SetNetworkConditions(
|
||||
std::move(network_conditions));
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ index 98268925da14d61256f8dee3aa899f17ce7acaf6..1abdc204e278383818dc073f96c90e91
|
||||
// This may only be called on NetworkContexts created with the constructor
|
||||
// that calls MakeURLRequestContext().
|
||||
diff --git a/services/network/network_context.h b/services/network/network_context.h
|
||||
index 58671094857cdfe5d853c8a284d51bc1b8a09660..7af71839aa1bc970370a91cd35f3cbefe06e67e5 100644
|
||||
index 2cd8707b120deb41683e13def5d446fd3bf93afe..c654d54cbb1427e700d918a94390c022b5b1cb14 100644
|
||||
--- a/services/network/network_context.h
|
||||
+++ b/services/network/network_context.h
|
||||
@@ -302,6 +302,7 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) NetworkContext
|
||||
|
||||
@@ -12,10 +12,10 @@ Ideally we could add an embedder observer pattern here but that can be
|
||||
done in future work.
|
||||
|
||||
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 b2a2e38397fdf3e9bb52c4532a1d14463ed4110d..9f0f209f279cc3dbe35efc12eb1e51449dfda470 100644
|
||||
index f76a0ee0778d7b4e4df69a4c43b4a6bfdc89294d..45baa4d62cb4e5aebedebba993ddbc9f06711d35 100644
|
||||
--- a/third_party/blink/renderer/core/exported/web_view_impl.cc
|
||||
+++ b/third_party/blink/renderer/core/exported/web_view_impl.cc
|
||||
@@ -160,6 +160,7 @@
|
||||
@@ -159,6 +159,7 @@
|
||||
#include "third_party/blink/renderer/core/timing/window_performance.h"
|
||||
#include "third_party/blink/renderer/platform/fonts/font_cache.h"
|
||||
#include "third_party/blink/renderer/platform/fonts/generic_font_family_settings.h"
|
||||
@@ -23,7 +23,7 @@ index b2a2e38397fdf3e9bb52c4532a1d14463ed4110d..9f0f209f279cc3dbe35efc12eb1e5144
|
||||
#include "third_party/blink/renderer/platform/graphics/image.h"
|
||||
#include "third_party/blink/renderer/platform/graphics/paint/cull_rect.h"
|
||||
#include "third_party/blink/renderer/platform/graphics/paint/paint_record_builder.h"
|
||||
@@ -1777,6 +1778,7 @@ void WebView::ApplyWebPreferences(const web_pref::WebPreferences& prefs,
|
||||
@@ -1776,6 +1777,7 @@ void WebView::ApplyWebPreferences(const web_pref::WebPreferences& prefs,
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
web_view_impl->SetMaximumLegibleScale(
|
||||
prefs.default_maximum_page_scale_factor);
|
||||
|
||||
@@ -0,0 +1,348 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Raymond Zhao <raymondzhao@microsoft.com>
|
||||
Date: Tue, 7 Sep 2021 14:54:25 -0700
|
||||
Subject: feat: Add data parameter to ProcessSingleton
|
||||
|
||||
This patch adds an additional_data parameter to the constructor of
|
||||
ProcessSingleton, so that the second instance can send additional
|
||||
data over to the first instance while requesting the ProcessSingleton
|
||||
lock.
|
||||
|
||||
On the Electron side, we then expose an extra parameter to the
|
||||
app.requestSingleInstanceLock API so that users can pass in a JSON
|
||||
object for the second instance to send to the first instance.
|
||||
|
||||
diff --git a/chrome/browser/process_singleton.h b/chrome/browser/process_singleton.h
|
||||
index 5a64220aaf1309832dc0ad543e353de67fe0a779..e75c4f0d7cf1cac2e5862eb858800359e2001eb6 100644
|
||||
--- a/chrome/browser/process_singleton.h
|
||||
+++ b/chrome/browser/process_singleton.h
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "base/files/file_path.h"
|
||||
#include "base/memory/ref_counted.h"
|
||||
#include "base/process/process.h"
|
||||
+#include "base/containers/span.h"
|
||||
#include "ui/gfx/native_widget_types.h"
|
||||
|
||||
#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_ANDROID)
|
||||
@@ -99,22 +100,25 @@ class ProcessSingleton {
|
||||
// handled within the current browser instance or false if the remote process
|
||||
// should handle it (i.e., because the current process is shutting down).
|
||||
using NotificationCallback =
|
||||
- base::RepeatingCallback<bool(const base::CommandLine& command_line,
|
||||
- const base::FilePath& current_directory)>;
|
||||
+ base::RepeatingCallback<bool(const base::CommandLine& command_line,
|
||||
+ const base::FilePath& current_directory,
|
||||
+ const std::vector<const uint8_t> additional_data)>;
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
ProcessSingleton(const std::string& program_name,
|
||||
const base::FilePath& user_data_dir,
|
||||
+ const base::span<const uint8_t> additional_data,
|
||||
bool is_sandboxed,
|
||||
const NotificationCallback& notification_callback);
|
||||
#else
|
||||
ProcessSingleton(const base::FilePath& user_data_dir,
|
||||
+ const base::span<const uint8_t> additional_data,
|
||||
const NotificationCallback& notification_callback);
|
||||
+#endif
|
||||
|
||||
ProcessSingleton(const ProcessSingleton&) = delete;
|
||||
ProcessSingleton& operator=(const ProcessSingleton&) = delete;
|
||||
|
||||
-#endif
|
||||
~ProcessSingleton();
|
||||
|
||||
// Notify another process, if available. Otherwise sets ourselves as the
|
||||
@@ -177,7 +181,10 @@ class ProcessSingleton {
|
||||
#endif
|
||||
|
||||
private:
|
||||
- NotificationCallback notification_callback_; // Handler for notifications.
|
||||
+ // A callback to run when the first instance receives data from the second.
|
||||
+ NotificationCallback notification_callback_;
|
||||
+ // Custom data to pass to the other instance during notify.
|
||||
+ base::span<const uint8_t> additional_data_;
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
bool EscapeVirtualization(const base::FilePath& user_data_dir);
|
||||
diff --git a/chrome/browser/process_singleton_posix.cc b/chrome/browser/process_singleton_posix.cc
|
||||
index be2c417c07a4206fac4a9a6c03e516fd0493c942..9a1f7b80e9ec538977f9b492829646a62d2a67cd 100644
|
||||
--- a/chrome/browser/process_singleton_posix.cc
|
||||
+++ b/chrome/browser/process_singleton_posix.cc
|
||||
@@ -612,6 +612,7 @@ class ProcessSingleton::LinuxWatcher
|
||||
// |reader| is for sending back ACK message.
|
||||
void HandleMessage(const std::string& current_dir,
|
||||
const std::vector<std::string>& argv,
|
||||
+ const std::vector<const uint8_t> additional_data,
|
||||
SocketReader* reader);
|
||||
|
||||
private:
|
||||
@@ -666,13 +667,16 @@ void ProcessSingleton::LinuxWatcher::StartListening(int socket) {
|
||||
}
|
||||
|
||||
void ProcessSingleton::LinuxWatcher::HandleMessage(
|
||||
- const std::string& current_dir, const std::vector<std::string>& argv,
|
||||
+ const std::string& current_dir,
|
||||
+ const std::vector<std::string>& argv,
|
||||
+ const std::vector<const uint8_t> additional_data,
|
||||
SocketReader* reader) {
|
||||
DCHECK(ui_task_runner_->BelongsToCurrentThread());
|
||||
DCHECK(reader);
|
||||
|
||||
if (parent_->notification_callback_.Run(base::CommandLine(argv),
|
||||
- base::FilePath(current_dir))) {
|
||||
+ base::FilePath(current_dir),
|
||||
+ std::move(additional_data))) {
|
||||
// Send back "ACK" message to prevent the client process from starting up.
|
||||
reader->FinishWithACK(kACKToken, std::size(kACKToken) - 1);
|
||||
} else {
|
||||
@@ -720,7 +724,8 @@ void ProcessSingleton::LinuxWatcher::SocketReader::
|
||||
}
|
||||
}
|
||||
|
||||
- // Validate the message. The shortest message is kStartToken\0x\0x
|
||||
+ // Validate the message. The shortest message kStartToken\0\00
|
||||
+ // The shortest message with additional data is kStartToken\0\00\00\0.
|
||||
const size_t kMinMessageLength = std::size(kStartToken) + 4;
|
||||
if (bytes_read_ < kMinMessageLength) {
|
||||
buf_[bytes_read_] = 0;
|
||||
@@ -750,10 +755,28 @@ void ProcessSingleton::LinuxWatcher::SocketReader::
|
||||
tokens.erase(tokens.begin());
|
||||
tokens.erase(tokens.begin());
|
||||
|
||||
+ size_t num_args;
|
||||
+ base::StringToSizeT(tokens[0], &num_args);
|
||||
+ std::vector<std::string> command_line(tokens.begin() + 1, tokens.begin() + 1 + num_args);
|
||||
+
|
||||
+ std::vector<const uint8_t> additional_data;
|
||||
+ if (tokens.size() >= 3 + num_args) {
|
||||
+ size_t additional_data_size;
|
||||
+ base::StringToSizeT(tokens[1 + num_args], &additional_data_size);
|
||||
+ std::string remaining_args = base::JoinString(
|
||||
+ base::make_span(tokens.begin() + 2 + num_args, tokens.end()),
|
||||
+ std::string(1, kTokenDelimiter));
|
||||
+ const uint8_t* additional_data_bits =
|
||||
+ reinterpret_cast<const uint8_t*>(remaining_args.c_str());
|
||||
+ additional_data = std::vector<const uint8_t>(
|
||||
+ additional_data_bits, additional_data_bits + additional_data_size);
|
||||
+ }
|
||||
+
|
||||
// Return to the UI thread to handle opening a new browser tab.
|
||||
ui_task_runner_->PostTask(
|
||||
FROM_HERE, base::BindOnce(&ProcessSingleton::LinuxWatcher::HandleMessage,
|
||||
- parent_, current_dir, tokens, this));
|
||||
+ parent_, current_dir, command_line,
|
||||
+ std::move(additional_data), this));
|
||||
fd_watch_controller_.reset();
|
||||
|
||||
// LinuxWatcher::HandleMessage() is in charge of destroying this SocketReader
|
||||
@@ -782,8 +805,10 @@ void ProcessSingleton::LinuxWatcher::SocketReader::FinishWithACK(
|
||||
//
|
||||
ProcessSingleton::ProcessSingleton(
|
||||
const base::FilePath& user_data_dir,
|
||||
+ const base::span<const uint8_t> additional_data,
|
||||
const NotificationCallback& notification_callback)
|
||||
: notification_callback_(notification_callback),
|
||||
+ additional_data_(additional_data),
|
||||
current_pid_(base::GetCurrentProcId()),
|
||||
watcher_(new LinuxWatcher(this)) {
|
||||
socket_path_ = user_data_dir.Append(chrome::kSingletonSocketFilename);
|
||||
@@ -902,7 +927,8 @@ ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcessWithTimeout(
|
||||
sizeof(socket_timeout));
|
||||
|
||||
// Found another process, prepare our command line
|
||||
- // format is "START\0<current dir>\0<argv[0]>\0...\0<argv[n]>".
|
||||
+ // format is "START\0<current-dir>\0<n-args>\0<argv[0]>\0...\0<argv[n]>
|
||||
+ // \0<additional-data-length>\0<additional-data>".
|
||||
std::string to_send(kStartToken);
|
||||
to_send.push_back(kTokenDelimiter);
|
||||
|
||||
@@ -912,11 +938,21 @@ ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcessWithTimeout(
|
||||
to_send.append(current_dir.value());
|
||||
|
||||
const std::vector<std::string>& argv = cmd_line.argv();
|
||||
+ to_send.push_back(kTokenDelimiter);
|
||||
+ to_send.append(base::NumberToString(argv.size()));
|
||||
for (auto it = argv.begin(); it != argv.end(); ++it) {
|
||||
to_send.push_back(kTokenDelimiter);
|
||||
to_send.append(*it);
|
||||
}
|
||||
|
||||
+ size_t data_to_send_size = additional_data_.size_bytes();
|
||||
+ if (data_to_send_size) {
|
||||
+ to_send.push_back(kTokenDelimiter);
|
||||
+ to_send.append(base::NumberToString(data_to_send_size));
|
||||
+ to_send.push_back(kTokenDelimiter);
|
||||
+ to_send.append(reinterpret_cast<const char*>(additional_data_.data()), data_to_send_size);
|
||||
+ }
|
||||
+
|
||||
// Send the message
|
||||
if (!WriteToSocket(socket.fd(), to_send.data(), to_send.length())) {
|
||||
// Try to kill the other process, because it might have been dead.
|
||||
diff --git a/chrome/browser/process_singleton_win.cc b/chrome/browser/process_singleton_win.cc
|
||||
index ec725b44296266bea1a51aea889463a0bba8449c..beb2925f2fd7a1a93435bf4b1a40b5c71b49e449 100644
|
||||
--- a/chrome/browser/process_singleton_win.cc
|
||||
+++ b/chrome/browser/process_singleton_win.cc
|
||||
@@ -80,10 +80,12 @@ BOOL CALLBACK BrowserWindowEnumeration(HWND window, LPARAM param) {
|
||||
|
||||
bool ParseCommandLine(const COPYDATASTRUCT* cds,
|
||||
base::CommandLine* parsed_command_line,
|
||||
- base::FilePath* current_directory) {
|
||||
+ base::FilePath* current_directory,
|
||||
+ std::vector<const uint8_t>* parsed_additional_data) {
|
||||
// We should have enough room for the shortest command (min_message_size)
|
||||
// and also be a multiple of wchar_t bytes. The shortest command
|
||||
- // possible is L"START\0\0" (empty current directory and command line).
|
||||
+ // possible is L"START\0\0" (empty command line, current directory,
|
||||
+ // and additional data).
|
||||
static const int min_message_size = 7;
|
||||
if (cds->cbData < min_message_size * sizeof(wchar_t) ||
|
||||
cds->cbData % sizeof(wchar_t) != 0) {
|
||||
@@ -133,6 +135,37 @@ bool ParseCommandLine(const COPYDATASTRUCT* cds,
|
||||
const std::wstring cmd_line =
|
||||
msg.substr(second_null + 1, third_null - second_null);
|
||||
*parsed_command_line = base::CommandLine::FromString(cmd_line);
|
||||
+
|
||||
+ const std::wstring::size_type fourth_null =
|
||||
+ msg.find_first_of(L'\0', third_null + 1);
|
||||
+ if (fourth_null == std::wstring::npos ||
|
||||
+ fourth_null == msg.length()) {
|
||||
+ // No additional data was provided.
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ // Get length of the additional data.
|
||||
+ const std::wstring additional_data_length_string =
|
||||
+ msg.substr(third_null + 1, fourth_null - third_null);
|
||||
+ size_t additional_data_length;
|
||||
+ base::StringToSizeT(additional_data_length_string, &additional_data_length);
|
||||
+
|
||||
+ const std::wstring::size_type fifth_null =
|
||||
+ msg.find_first_of(L'\0', fourth_null + 1);
|
||||
+ if (fifth_null == std::wstring::npos ||
|
||||
+ fifth_null == msg.length()) {
|
||||
+ LOG(WARNING) << "Invalid format for start command, we need a string in 6 "
|
||||
+ "parts separated by NULLs";
|
||||
+ }
|
||||
+
|
||||
+ // Get the actual additional data.
|
||||
+ const std::wstring additional_data =
|
||||
+ msg.substr(fourth_null + 1, fifth_null - fourth_null);
|
||||
+ const uint8_t* additional_data_bytes =
|
||||
+ reinterpret_cast<const uint8_t*>(additional_data.c_str());
|
||||
+ *parsed_additional_data = std::vector<const uint8_t>(additional_data_bytes,
|
||||
+ additional_data_bytes + additional_data_length);
|
||||
+
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -154,13 +187,14 @@ bool ProcessLaunchNotification(
|
||||
|
||||
base::CommandLine parsed_command_line(base::CommandLine::NO_PROGRAM);
|
||||
base::FilePath current_directory;
|
||||
- if (!ParseCommandLine(cds, &parsed_command_line, ¤t_directory)) {
|
||||
+ std::vector<const uint8_t> additional_data;
|
||||
+ if (!ParseCommandLine(cds, &parsed_command_line, ¤t_directory, &additional_data)) {
|
||||
*result = TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
- *result = notification_callback.Run(parsed_command_line, current_directory) ?
|
||||
- TRUE : FALSE;
|
||||
+ *result = notification_callback.Run(parsed_command_line,
|
||||
+ current_directory, std::move(additional_data)) ? TRUE : FALSE;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -261,9 +295,11 @@ bool ProcessSingleton::EscapeVirtualization(
|
||||
ProcessSingleton::ProcessSingleton(
|
||||
const std::string& program_name,
|
||||
const base::FilePath& user_data_dir,
|
||||
+ const base::span<const uint8_t> additional_data,
|
||||
bool is_app_sandboxed,
|
||||
const NotificationCallback& notification_callback)
|
||||
: notification_callback_(notification_callback),
|
||||
+ additional_data_(additional_data),
|
||||
program_name_(program_name),
|
||||
is_app_sandboxed_(is_app_sandboxed),
|
||||
is_virtualized_(false),
|
||||
@@ -290,7 +326,7 @@ ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcess() {
|
||||
return PROCESS_NONE;
|
||||
}
|
||||
|
||||
- switch (chrome::AttemptToNotifyRunningChrome(remote_window_)) {
|
||||
+ switch (chrome::AttemptToNotifyRunningChrome(remote_window_, additional_data_)) {
|
||||
case chrome::NOTIFY_SUCCESS:
|
||||
return PROCESS_NOTIFIED;
|
||||
case chrome::NOTIFY_FAILED:
|
||||
diff --git a/chrome/browser/win/chrome_process_finder.cc b/chrome/browser/win/chrome_process_finder.cc
|
||||
index b64ed1d155a30582e48c9cdffcee9d0f25a53a6a..cfdb2d75532d270e3dd548eb7475a6cdbddf1016 100644
|
||||
--- a/chrome/browser/win/chrome_process_finder.cc
|
||||
+++ b/chrome/browser/win/chrome_process_finder.cc
|
||||
@@ -36,7 +36,9 @@ HWND FindRunningChromeWindow(const base::FilePath& user_data_dir) {
|
||||
return base::win::MessageWindow::FindWindow(user_data_dir.value());
|
||||
}
|
||||
|
||||
-NotifyChromeResult AttemptToNotifyRunningChrome(HWND remote_window) {
|
||||
+NotifyChromeResult AttemptToNotifyRunningChrome(
|
||||
+ HWND remote_window,
|
||||
+ const base::span<const uint8_t> additional_data) {
|
||||
TRACE_EVENT0("startup", "AttemptToNotifyRunningChrome");
|
||||
|
||||
DCHECK(remote_window);
|
||||
@@ -50,7 +52,8 @@ NotifyChromeResult AttemptToNotifyRunningChrome(HWND remote_window) {
|
||||
}
|
||||
|
||||
// Send the command line to the remote chrome window.
|
||||
- // Format is "START\0<<<current directory>>>\0<<<commandline>>>".
|
||||
+ // Format is
|
||||
+ // "START\0<current-directory>\0<command-line>\0<additional-data-length>\0<additional-data>".
|
||||
std::wstring to_send(L"START\0", 6); // want the NULL in the string.
|
||||
base::FilePath cur_dir;
|
||||
if (!base::GetCurrentDirectory(&cur_dir)) {
|
||||
@@ -64,6 +67,22 @@ NotifyChromeResult AttemptToNotifyRunningChrome(HWND remote_window) {
|
||||
base::CommandLine::ForCurrentProcess()->GetCommandLineString());
|
||||
to_send.append(L"\0", 1); // Null separator.
|
||||
|
||||
+ size_t additional_data_size = additional_data.size_bytes();
|
||||
+ if (additional_data_size) {
|
||||
+ // Send over the size, because the reinterpret cast to wchar_t could
|
||||
+ // add padding.
|
||||
+ to_send.append(base::UTF8ToWide(base::NumberToString(additional_data_size)));
|
||||
+ to_send.append(L"\0", 1); // Null separator.
|
||||
+
|
||||
+ size_t padded_size = additional_data_size / sizeof(wchar_t);
|
||||
+ if (additional_data_size % sizeof(wchar_t) != 0) {
|
||||
+ padded_size++;
|
||||
+ }
|
||||
+ to_send.append(reinterpret_cast<const wchar_t*>(additional_data.data()),
|
||||
+ padded_size);
|
||||
+ to_send.append(L"\0", 1); // Null separator.
|
||||
+ }
|
||||
+
|
||||
// Allow the current running browser window to make itself the foreground
|
||||
// window (otherwise it will just flash in the taskbar).
|
||||
::AllowSetForegroundWindow(process_id);
|
||||
diff --git a/chrome/browser/win/chrome_process_finder.h b/chrome/browser/win/chrome_process_finder.h
|
||||
index 5516673cee019f6060077091e59498bf9038cd6e..8edea5079b46c2cba67833114eb9c21d85cfc22d 100644
|
||||
--- a/chrome/browser/win/chrome_process_finder.h
|
||||
+++ b/chrome/browser/win/chrome_process_finder.h
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
+#include "base/containers/span.h"
|
||||
#include "base/time/time.h"
|
||||
|
||||
namespace base {
|
||||
@@ -27,7 +28,9 @@ HWND FindRunningChromeWindow(const base::FilePath& user_data_dir);
|
||||
// Attempts to send the current command line to an already running instance of
|
||||
// Chrome via a WM_COPYDATA message.
|
||||
// Returns true if a running Chrome is found and successfully notified.
|
||||
-NotifyChromeResult AttemptToNotifyRunningChrome(HWND remote_window);
|
||||
+NotifyChromeResult AttemptToNotifyRunningChrome(
|
||||
+ HWND remote_window,
|
||||
+ const base::span<const uint8_t> additional_data);
|
||||
|
||||
// Changes the notification timeout to |new_timeout|, returns the old timeout.
|
||||
base::TimeDelta SetNotificationTimeoutForTesting(base::TimeDelta new_timeout);
|
||||
@@ -1,600 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Raymond Zhao <raymondzhao@microsoft.com>
|
||||
Date: Tue, 7 Sep 2021 14:54:25 -0700
|
||||
Subject: feat: Add data transfer mechanism to requestSingleInstanceLock flow
|
||||
|
||||
This patch adds code that allows for the second instance to send
|
||||
additional data to the first instance, and for the first instance
|
||||
to send additional data back to the second instance, during the
|
||||
app.requestSingleInstanceLock call.
|
||||
|
||||
Firstly, this patch adds an additional_data parameter
|
||||
to the constructor of ProcessSingleton, so that the second instance
|
||||
can send additional data over to the first instance
|
||||
while requesting the ProcessSingleton lock.
|
||||
|
||||
Then, we add additional processing to the second-instance event, both
|
||||
so the first instance can receive additional data from the second
|
||||
instance, but also so the second instance can send back additional
|
||||
data to the first instance if needed.
|
||||
|
||||
diff --git a/chrome/browser/process_singleton.h b/chrome/browser/process_singleton.h
|
||||
index 5a64220aaf1309832dc0ad543e353de67fe0a779..5b701b1361707b610ed60c344e441e67ca701362 100644
|
||||
--- a/chrome/browser/process_singleton.h
|
||||
+++ b/chrome/browser/process_singleton.h
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "base/files/file_path.h"
|
||||
#include "base/memory/ref_counted.h"
|
||||
#include "base/process/process.h"
|
||||
+#include "base/containers/span.h"
|
||||
#include "ui/gfx/native_widget_types.h"
|
||||
|
||||
#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_ANDROID)
|
||||
@@ -93,6 +94,9 @@ class ProcessSingleton {
|
||||
|
||||
static constexpr int kNumNotifyResults = LAST_VALUE + 1;
|
||||
|
||||
+ using NotificationAckCallback =
|
||||
+ base::RepeatingCallback<void(const base::span<const uint8_t>* ack_data)>;
|
||||
+
|
||||
// Implement this callback to handle notifications from other processes. The
|
||||
// callback will receive the command line and directory with which the other
|
||||
// Chrome process was launched. Return true if the command line will be
|
||||
@@ -100,21 +104,27 @@ class ProcessSingleton {
|
||||
// should handle it (i.e., because the current process is shutting down).
|
||||
using NotificationCallback =
|
||||
base::RepeatingCallback<bool(const base::CommandLine& command_line,
|
||||
- const base::FilePath& current_directory)>;
|
||||
+ const base::FilePath& current_directory,
|
||||
+ const std::vector<uint8_t> additional_data,
|
||||
+ const NotificationAckCallback& ack_callback)>;
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
ProcessSingleton(const std::string& program_name,
|
||||
const base::FilePath& user_data_dir,
|
||||
+ const base::span<const uint8_t> additional_data,
|
||||
bool is_sandboxed,
|
||||
- const NotificationCallback& notification_callback);
|
||||
+ const NotificationCallback& notification_callback,
|
||||
+ const NotificationAckCallback& ack_notification_callback);
|
||||
#else
|
||||
ProcessSingleton(const base::FilePath& user_data_dir,
|
||||
- const NotificationCallback& notification_callback);
|
||||
+ const base::span<const uint8_t> additional_data,
|
||||
+ const NotificationCallback& notification_callback,
|
||||
+ const NotificationAckCallback& ack_notification_callback);
|
||||
+#endif
|
||||
|
||||
ProcessSingleton(const ProcessSingleton&) = delete;
|
||||
ProcessSingleton& operator=(const ProcessSingleton&) = delete;
|
||||
|
||||
-#endif
|
||||
~ProcessSingleton();
|
||||
|
||||
// Notify another process, if available. Otherwise sets ourselves as the
|
||||
@@ -177,7 +187,13 @@ class ProcessSingleton {
|
||||
#endif
|
||||
|
||||
private:
|
||||
- NotificationCallback notification_callback_; // Handler for notifications.
|
||||
+ // A callback to run when the first instance receives data from the second.
|
||||
+ NotificationCallback notification_callback_;
|
||||
+ // A callback to run when the second instance
|
||||
+ // receives an acknowledgement from the first.
|
||||
+ NotificationAckCallback notification_ack_callback_;
|
||||
+ // Custom data to pass to the other instance during notify.
|
||||
+ base::span<const uint8_t> additional_data_;
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
bool EscapeVirtualization(const base::FilePath& user_data_dir);
|
||||
@@ -190,6 +206,7 @@ class ProcessSingleton {
|
||||
HANDLE lock_file_;
|
||||
base::FilePath user_data_dir_;
|
||||
ShouldKillRemoteProcessCallback should_kill_remote_process_callback_;
|
||||
+ HANDLE ack_pipe_;
|
||||
#elif BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_ANDROID)
|
||||
// Return true if the given pid is one of our child processes.
|
||||
// Assumes that the current pid is the root of all pids of the current
|
||||
diff --git a/chrome/browser/process_singleton_posix.cc b/chrome/browser/process_singleton_posix.cc
|
||||
index be2c417c07a4206fac4a9a6c03e516fd0493c942..78f74b0b21242553b6af98628dc48190f7d1137d 100644
|
||||
--- a/chrome/browser/process_singleton_posix.cc
|
||||
+++ b/chrome/browser/process_singleton_posix.cc
|
||||
@@ -146,7 +146,7 @@ const char kACKToken[] = "ACK";
|
||||
const char kShutdownToken[] = "SHUTDOWN";
|
||||
const char kTokenDelimiter = '\0';
|
||||
const int kMaxMessageLength = 32 * 1024;
|
||||
-const int kMaxACKMessageLength = std::size(kShutdownToken) - 1;
|
||||
+const int kMaxACKMessageLength = kMaxMessageLength;
|
||||
|
||||
bool g_disable_prompt = false;
|
||||
bool g_skip_is_chrome_process_check = false;
|
||||
@@ -612,6 +612,7 @@ class ProcessSingleton::LinuxWatcher
|
||||
// |reader| is for sending back ACK message.
|
||||
void HandleMessage(const std::string& current_dir,
|
||||
const std::vector<std::string>& argv,
|
||||
+ const std::vector<uint8_t> additional_data,
|
||||
SocketReader* reader);
|
||||
|
||||
private:
|
||||
@@ -636,6 +637,9 @@ class ProcessSingleton::LinuxWatcher
|
||||
// The ProcessSingleton that owns us.
|
||||
ProcessSingleton* const parent_;
|
||||
|
||||
+ bool ack_callback_called_ = false;
|
||||
+ void AckCallback(SocketReader* reader, const base::span<const uint8_t>* response);
|
||||
+
|
||||
std::set<std::unique_ptr<SocketReader>, base::UniquePtrComparator> readers_;
|
||||
};
|
||||
|
||||
@@ -666,16 +670,21 @@ void ProcessSingleton::LinuxWatcher::StartListening(int socket) {
|
||||
}
|
||||
|
||||
void ProcessSingleton::LinuxWatcher::HandleMessage(
|
||||
- const std::string& current_dir, const std::vector<std::string>& argv,
|
||||
+ const std::string& current_dir,
|
||||
+ const std::vector<std::string>& argv,
|
||||
+ const std::vector<uint8_t> additional_data,
|
||||
SocketReader* reader) {
|
||||
DCHECK(ui_task_runner_->BelongsToCurrentThread());
|
||||
DCHECK(reader);
|
||||
|
||||
- if (parent_->notification_callback_.Run(base::CommandLine(argv),
|
||||
- base::FilePath(current_dir))) {
|
||||
- // Send back "ACK" message to prevent the client process from starting up.
|
||||
- reader->FinishWithACK(kACKToken, std::size(kACKToken) - 1);
|
||||
- } else {
|
||||
+ auto wrapped_ack_callback =
|
||||
+ base::BindRepeating(&ProcessSingleton::LinuxWatcher::AckCallback,
|
||||
+ base::Unretained(this), reader);
|
||||
+ ack_callback_called_ = false;
|
||||
+ if (!parent_->notification_callback_.Run(base::CommandLine(argv),
|
||||
+ base::FilePath(current_dir),
|
||||
+ std::move(additional_data),
|
||||
+ wrapped_ack_callback)) {
|
||||
LOG(WARNING) << "Not handling interprocess notification as browser"
|
||||
" is shutting down";
|
||||
// Send back "SHUTDOWN" message, so that the client process can start up
|
||||
@@ -685,6 +694,22 @@ void ProcessSingleton::LinuxWatcher::HandleMessage(
|
||||
}
|
||||
}
|
||||
|
||||
+void ProcessSingleton::LinuxWatcher::AckCallback(
|
||||
+ SocketReader* reader,
|
||||
+ const base::span<const uint8_t>* response) {
|
||||
+ // Send back "ACK" message to prevent the client process from starting up.
|
||||
+ if (!ack_callback_called_) {
|
||||
+ ack_callback_called_ = true;
|
||||
+ std::string ack_message;
|
||||
+ ack_message.append(kACKToken, std::size(kACKToken) - 1);
|
||||
+ if (response && response->size_bytes()) {
|
||||
+ ack_message.append(reinterpret_cast<const char*>(response->data()),
|
||||
+ response->size_bytes());
|
||||
+ }
|
||||
+ reader->FinishWithACK(ack_message.c_str(), ack_message.size());
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
void ProcessSingleton::LinuxWatcher::RemoveSocketReader(SocketReader* reader) {
|
||||
DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
||||
DCHECK(reader);
|
||||
@@ -720,7 +745,8 @@ void ProcessSingleton::LinuxWatcher::SocketReader::
|
||||
}
|
||||
}
|
||||
|
||||
- // Validate the message. The shortest message is kStartToken\0x\0x
|
||||
+ // Validate the message. The shortest message kStartToken\0\00
|
||||
+ // The shortest message with additional data is kStartToken\0\00\00\0.
|
||||
const size_t kMinMessageLength = std::size(kStartToken) + 4;
|
||||
if (bytes_read_ < kMinMessageLength) {
|
||||
buf_[bytes_read_] = 0;
|
||||
@@ -750,10 +776,28 @@ void ProcessSingleton::LinuxWatcher::SocketReader::
|
||||
tokens.erase(tokens.begin());
|
||||
tokens.erase(tokens.begin());
|
||||
|
||||
+ size_t num_args;
|
||||
+ base::StringToSizeT(tokens[0], &num_args);
|
||||
+ std::vector<std::string> command_line(tokens.begin() + 1, tokens.begin() + 1 + num_args);
|
||||
+
|
||||
+ std::vector<uint8_t> additional_data;
|
||||
+ if (tokens.size() >= 3 + num_args) {
|
||||
+ size_t additional_data_size;
|
||||
+ base::StringToSizeT(tokens[1 + num_args], &additional_data_size);
|
||||
+ std::string remaining_args = base::JoinString(
|
||||
+ base::make_span(tokens.begin() + 2 + num_args, tokens.end()),
|
||||
+ std::string(1, kTokenDelimiter));
|
||||
+ const uint8_t* additional_data_bits =
|
||||
+ reinterpret_cast<const uint8_t*>(remaining_args.c_str());
|
||||
+ additional_data = std::vector<uint8_t>(additional_data_bits,
|
||||
+ additional_data_bits + additional_data_size);
|
||||
+ }
|
||||
+
|
||||
// Return to the UI thread to handle opening a new browser tab.
|
||||
ui_task_runner_->PostTask(
|
||||
FROM_HERE, base::BindOnce(&ProcessSingleton::LinuxWatcher::HandleMessage,
|
||||
- parent_, current_dir, tokens, this));
|
||||
+ parent_, current_dir, command_line,
|
||||
+ std::move(additional_data), this));
|
||||
fd_watch_controller_.reset();
|
||||
|
||||
// LinuxWatcher::HandleMessage() is in charge of destroying this SocketReader
|
||||
@@ -782,8 +826,12 @@ void ProcessSingleton::LinuxWatcher::SocketReader::FinishWithACK(
|
||||
//
|
||||
ProcessSingleton::ProcessSingleton(
|
||||
const base::FilePath& user_data_dir,
|
||||
- const NotificationCallback& notification_callback)
|
||||
+ const base::span<const uint8_t> additional_data,
|
||||
+ const NotificationCallback& notification_callback,
|
||||
+ const NotificationAckCallback& notification_ack_callback)
|
||||
: notification_callback_(notification_callback),
|
||||
+ notification_ack_callback_(notification_ack_callback),
|
||||
+ additional_data_(additional_data),
|
||||
current_pid_(base::GetCurrentProcId()),
|
||||
watcher_(new LinuxWatcher(this)) {
|
||||
socket_path_ = user_data_dir.Append(chrome::kSingletonSocketFilename);
|
||||
@@ -902,7 +950,8 @@ ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcessWithTimeout(
|
||||
sizeof(socket_timeout));
|
||||
|
||||
// Found another process, prepare our command line
|
||||
- // format is "START\0<current dir>\0<argv[0]>\0...\0<argv[n]>".
|
||||
+ // format is "START\0<current-dir>\0<n-args>\0<argv[0]>\0...\0<argv[n]>
|
||||
+ // \0<additional-data-length>\0<additional-data>".
|
||||
std::string to_send(kStartToken);
|
||||
to_send.push_back(kTokenDelimiter);
|
||||
|
||||
@@ -912,11 +961,21 @@ ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcessWithTimeout(
|
||||
to_send.append(current_dir.value());
|
||||
|
||||
const std::vector<std::string>& argv = cmd_line.argv();
|
||||
+ to_send.push_back(kTokenDelimiter);
|
||||
+ to_send.append(base::NumberToString(argv.size()));
|
||||
for (auto it = argv.begin(); it != argv.end(); ++it) {
|
||||
to_send.push_back(kTokenDelimiter);
|
||||
to_send.append(*it);
|
||||
}
|
||||
|
||||
+ size_t data_to_send_size = additional_data_.size_bytes();
|
||||
+ if (data_to_send_size) {
|
||||
+ to_send.push_back(kTokenDelimiter);
|
||||
+ to_send.append(base::NumberToString(data_to_send_size));
|
||||
+ to_send.push_back(kTokenDelimiter);
|
||||
+ to_send.append(reinterpret_cast<const char*>(additional_data_.data()), data_to_send_size);
|
||||
+ }
|
||||
+
|
||||
// Send the message
|
||||
if (!WriteToSocket(socket.fd(), to_send.data(), to_send.length())) {
|
||||
// Try to kill the other process, because it might have been dead.
|
||||
@@ -958,6 +1017,17 @@ ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcessWithTimeout(
|
||||
linux_ui->NotifyWindowManagerStartupComplete();
|
||||
#endif
|
||||
|
||||
+ size_t ack_data_len = len - (std::size(kACKToken) - 1);
|
||||
+ if (ack_data_len) {
|
||||
+ const uint8_t* raw_ack_data =
|
||||
+ reinterpret_cast<const uint8_t*>(buf + std::size(kACKToken) - 1);
|
||||
+ base::span<const uint8_t> ack_data =
|
||||
+ base::make_span(raw_ack_data, raw_ack_data + ack_data_len);
|
||||
+ notification_ack_callback_.Run(&ack_data);
|
||||
+ } else {
|
||||
+ notification_ack_callback_.Run(nullptr);
|
||||
+ }
|
||||
+
|
||||
// Assume the other process is handling the request.
|
||||
return PROCESS_NOTIFIED;
|
||||
}
|
||||
diff --git a/chrome/browser/process_singleton_win.cc b/chrome/browser/process_singleton_win.cc
|
||||
index ec725b44296266bea1a51aea889463a0bba8449c..a3d4dd1efc950033855a1f2783f941384b249a5d 100644
|
||||
--- a/chrome/browser/process_singleton_win.cc
|
||||
+++ b/chrome/browser/process_singleton_win.cc
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "base/time/time.h"
|
||||
+#include "base/timer/timer.h"
|
||||
#include "base/trace_event/base_tracing.h"
|
||||
#include "base/win/registry.h"
|
||||
#include "base/win/scoped_handle.h"
|
||||
@@ -45,6 +46,14 @@
|
||||
namespace {
|
||||
|
||||
const char kLockfile[] = "lockfile";
|
||||
+const LPCWSTR kPipeName = L"\\\\.\\pipe\\electronAckPipe";
|
||||
+const DWORD kPipeTimeout = 10000;
|
||||
+const DWORD kMaxMessageLength = 32 * 1024;
|
||||
+
|
||||
+std::unique_ptr<std::vector<uint8_t>> g_ack_data;
|
||||
+base::OneShotTimer g_ack_timer;
|
||||
+HANDLE g_write_ack_pipe;
|
||||
+bool g_write_ack_callback_called = false;
|
||||
|
||||
// A helper class that acquires the given |mutex| while the AutoLockMutex is in
|
||||
// scope.
|
||||
@@ -80,10 +89,12 @@ BOOL CALLBACK BrowserWindowEnumeration(HWND window, LPARAM param) {
|
||||
|
||||
bool ParseCommandLine(const COPYDATASTRUCT* cds,
|
||||
base::CommandLine* parsed_command_line,
|
||||
- base::FilePath* current_directory) {
|
||||
+ base::FilePath* current_directory,
|
||||
+ std::vector<uint8_t>* parsed_additional_data) {
|
||||
// We should have enough room for the shortest command (min_message_size)
|
||||
// and also be a multiple of wchar_t bytes. The shortest command
|
||||
- // possible is L"START\0\0" (empty current directory and command line).
|
||||
+ // possible is L"START\0\0" (empty command line, current directory,
|
||||
+ // and additional data).
|
||||
static const int min_message_size = 7;
|
||||
if (cds->cbData < min_message_size * sizeof(wchar_t) ||
|
||||
cds->cbData % sizeof(wchar_t) != 0) {
|
||||
@@ -133,11 +144,82 @@ bool ParseCommandLine(const COPYDATASTRUCT* cds,
|
||||
const std::wstring cmd_line =
|
||||
msg.substr(second_null + 1, third_null - second_null);
|
||||
*parsed_command_line = base::CommandLine::FromString(cmd_line);
|
||||
+
|
||||
+ const std::wstring::size_type fourth_null =
|
||||
+ msg.find_first_of(L'\0', third_null + 1);
|
||||
+ if (fourth_null == std::wstring::npos ||
|
||||
+ fourth_null == msg.length()) {
|
||||
+ // No additional data was provided.
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ // Get length of the additional data.
|
||||
+ const std::wstring additional_data_length_string =
|
||||
+ msg.substr(third_null + 1, fourth_null - third_null);
|
||||
+ size_t additional_data_length;
|
||||
+ base::StringToSizeT(additional_data_length_string, &additional_data_length);
|
||||
+
|
||||
+ const std::wstring::size_type fifth_null =
|
||||
+ msg.find_first_of(L'\0', fourth_null + 1);
|
||||
+ if (fifth_null == std::wstring::npos ||
|
||||
+ fifth_null == msg.length()) {
|
||||
+ LOG(WARNING) << "Invalid format for start command, we need a string in 6 "
|
||||
+ "parts separated by NULLs";
|
||||
+ }
|
||||
+
|
||||
+ // Get the actual additional data.
|
||||
+ const std::wstring additional_data =
|
||||
+ msg.substr(fourth_null + 1, fifth_null - fourth_null);
|
||||
+ const uint8_t* additional_data_bytes =
|
||||
+ reinterpret_cast<const uint8_t*>(additional_data.c_str());
|
||||
+ *parsed_additional_data = std::vector<uint8_t>(additional_data_bytes,
|
||||
+ additional_data_bytes + additional_data_length);
|
||||
+
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
+void StoreAck(const base::span<const uint8_t>* ack_data) {
|
||||
+ if (ack_data) {
|
||||
+ g_ack_data = std::make_unique<std::vector<uint8_t>>(ack_data->begin(),
|
||||
+ ack_data->end());
|
||||
+ } else {
|
||||
+ g_ack_data = nullptr;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void SendBackAck() {
|
||||
+ // This is the first instance sending the ack back to the second instance.
|
||||
+ if (!g_write_ack_callback_called) {
|
||||
+ g_write_ack_callback_called = true;
|
||||
+ const uint8_t* data_buffer = nullptr;
|
||||
+ DWORD data_to_send_size = 0;
|
||||
+ if (g_ack_data) {
|
||||
+ data_buffer = g_ack_data->data();
|
||||
+ DWORD ack_data_size = g_ack_data->size() * sizeof(uint8_t);
|
||||
+ data_to_send_size = (ack_data_size < kMaxMessageLength) ? ack_data_size : kMaxMessageLength;
|
||||
+ }
|
||||
+
|
||||
+ ::ConnectNamedPipe(g_write_ack_pipe, NULL);
|
||||
+
|
||||
+ DWORD bytes_written = 0;
|
||||
+ ::WriteFile(g_write_ack_pipe,
|
||||
+ (LPCVOID)data_buffer,
|
||||
+ data_to_send_size,
|
||||
+ &bytes_written,
|
||||
+ NULL);
|
||||
+ DCHECK(bytes_written == data_to_send_size);
|
||||
+
|
||||
+ ::FlushFileBuffers(g_write_ack_pipe);
|
||||
+ ::DisconnectNamedPipe(g_write_ack_pipe);
|
||||
+
|
||||
+ if (g_ack_data) {
|
||||
+ g_ack_data.reset();
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
bool ProcessLaunchNotification(
|
||||
const ProcessSingleton::NotificationCallback& notification_callback,
|
||||
UINT message,
|
||||
@@ -151,16 +233,23 @@ bool ProcessLaunchNotification(
|
||||
|
||||
// Handle the WM_COPYDATA message from another process.
|
||||
const COPYDATASTRUCT* cds = reinterpret_cast<COPYDATASTRUCT*>(lparam);
|
||||
-
|
||||
base::CommandLine parsed_command_line(base::CommandLine::NO_PROGRAM);
|
||||
base::FilePath current_directory;
|
||||
- if (!ParseCommandLine(cds, &parsed_command_line, ¤t_directory)) {
|
||||
+ std::vector<uint8_t> additional_data;
|
||||
+ if (!ParseCommandLine(cds, &parsed_command_line, ¤t_directory,
|
||||
+ &additional_data)) {
|
||||
*result = TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
- *result = notification_callback.Run(parsed_command_line, current_directory) ?
|
||||
- TRUE : FALSE;
|
||||
+ g_write_ack_callback_called = false;
|
||||
+ *result = notification_callback.Run(parsed_command_line, current_directory,
|
||||
+ std::move(additional_data),
|
||||
+ base::BindRepeating(&StoreAck))
|
||||
+ ? TRUE
|
||||
+ : FALSE;
|
||||
+ g_ack_timer.Start(FROM_HERE, base::Seconds(0),
|
||||
+ base::BindOnce(&SendBackAck));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -261,9 +350,13 @@ bool ProcessSingleton::EscapeVirtualization(
|
||||
ProcessSingleton::ProcessSingleton(
|
||||
const std::string& program_name,
|
||||
const base::FilePath& user_data_dir,
|
||||
+ const base::span<const uint8_t> additional_data,
|
||||
bool is_app_sandboxed,
|
||||
- const NotificationCallback& notification_callback)
|
||||
+ const NotificationCallback& notification_callback,
|
||||
+ const NotificationAckCallback& notification_ack_callback)
|
||||
: notification_callback_(notification_callback),
|
||||
+ notification_ack_callback_(notification_ack_callback),
|
||||
+ additional_data_(additional_data),
|
||||
program_name_(program_name),
|
||||
is_app_sandboxed_(is_app_sandboxed),
|
||||
is_virtualized_(false),
|
||||
@@ -278,6 +371,37 @@ ProcessSingleton::~ProcessSingleton() {
|
||||
::CloseHandle(lock_file_);
|
||||
}
|
||||
|
||||
+void ReadAck(const ProcessSingleton::NotificationAckCallback& ack_callback) {
|
||||
+ // We are reading the ack from the first instance.
|
||||
+ // First, wait for the pipe.
|
||||
+ ::WaitNamedPipe(kPipeName, NMPWAIT_USE_DEFAULT_WAIT);
|
||||
+
|
||||
+ HANDLE read_ack_pipe = ::CreateFile(kPipeName,
|
||||
+ GENERIC_READ,
|
||||
+ FILE_SHARE_READ,
|
||||
+ NULL,
|
||||
+ OPEN_EXISTING,
|
||||
+ FILE_ATTRIBUTE_NORMAL,
|
||||
+ NULL);
|
||||
+ CHECK(read_ack_pipe != INVALID_HANDLE_VALUE);
|
||||
+
|
||||
+ DWORD bytes_read;
|
||||
+ uint8_t read_ack_buffer[kMaxMessageLength];
|
||||
+ ::ReadFile(read_ack_pipe,
|
||||
+ (LPVOID)read_ack_buffer,
|
||||
+ kMaxMessageLength,
|
||||
+ &bytes_read,
|
||||
+ NULL);
|
||||
+
|
||||
+ if (!bytes_read) {
|
||||
+ ack_callback.Run(nullptr);
|
||||
+ } else {
|
||||
+ base::span<const uint8_t> out_span(read_ack_buffer, read_ack_buffer + bytes_read);
|
||||
+ ack_callback.Run(&out_span);
|
||||
+ }
|
||||
+ ::CloseHandle(read_ack_pipe);
|
||||
+}
|
||||
+
|
||||
// Code roughly based on Mozilla.
|
||||
ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcess() {
|
||||
TRACE_EVENT0("startup", "ProcessSingleton::NotifyOtherProcess");
|
||||
@@ -290,8 +414,9 @@ ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcess() {
|
||||
return PROCESS_NONE;
|
||||
}
|
||||
|
||||
- switch (chrome::AttemptToNotifyRunningChrome(remote_window_)) {
|
||||
+ switch (chrome::AttemptToNotifyRunningChrome(remote_window_, additional_data_)) {
|
||||
case chrome::NOTIFY_SUCCESS:
|
||||
+ ReadAck(notification_ack_callback_);
|
||||
return PROCESS_NOTIFIED;
|
||||
case chrome::NOTIFY_FAILED:
|
||||
remote_window_ = NULL;
|
||||
@@ -429,6 +554,18 @@ bool ProcessSingleton::Create() {
|
||||
<< "Lock file can not be created! Error code: " << error;
|
||||
|
||||
if (lock_file_ != INVALID_HANDLE_VALUE) {
|
||||
+ // We are the first instance. Create a pipe to send out ack data.
|
||||
+ ack_pipe_ = ::CreateNamedPipe(kPipeName,
|
||||
+ PIPE_ACCESS_OUTBOUND,
|
||||
+ PIPE_TYPE_BYTE | PIPE_REJECT_REMOTE_CLIENTS,
|
||||
+ PIPE_UNLIMITED_INSTANCES,
|
||||
+ kMaxMessageLength,
|
||||
+ 0,
|
||||
+ kPipeTimeout,
|
||||
+ NULL);
|
||||
+ CHECK(ack_pipe_ != INVALID_HANDLE_VALUE);
|
||||
+ g_write_ack_pipe = ack_pipe_;
|
||||
+
|
||||
// Set the window's title to the path of our user data directory so
|
||||
// other Chrome instances can decide if they should forward to us.
|
||||
TRACE_EVENT0("startup", "ProcessSingleton::Create:CreateWindow");
|
||||
@@ -456,6 +593,7 @@ bool ProcessSingleton::Create() {
|
||||
}
|
||||
|
||||
void ProcessSingleton::Cleanup() {
|
||||
+ ::CloseHandle(ack_pipe_);
|
||||
}
|
||||
|
||||
void ProcessSingleton::OverrideShouldKillRemoteProcessCallbackForTesting(
|
||||
diff --git a/chrome/browser/win/chrome_process_finder.cc b/chrome/browser/win/chrome_process_finder.cc
|
||||
index b64ed1d155a30582e48c9cdffcee9d0f25a53a6a..ce851d09d501ebcc6d6c4065e746e869d5275b2b 100644
|
||||
--- a/chrome/browser/win/chrome_process_finder.cc
|
||||
+++ b/chrome/browser/win/chrome_process_finder.cc
|
||||
@@ -36,9 +36,10 @@ HWND FindRunningChromeWindow(const base::FilePath& user_data_dir) {
|
||||
return base::win::MessageWindow::FindWindow(user_data_dir.value());
|
||||
}
|
||||
|
||||
-NotifyChromeResult AttemptToNotifyRunningChrome(HWND remote_window) {
|
||||
+NotifyChromeResult AttemptToNotifyRunningChrome(
|
||||
+ HWND remote_window,
|
||||
+ const base::span<const uint8_t> additional_data) {
|
||||
TRACE_EVENT0("startup", "AttemptToNotifyRunningChrome");
|
||||
-
|
||||
DCHECK(remote_window);
|
||||
DWORD process_id = 0;
|
||||
DWORD thread_id = GetWindowThreadProcessId(remote_window, &process_id);
|
||||
@@ -50,7 +51,8 @@ NotifyChromeResult AttemptToNotifyRunningChrome(HWND remote_window) {
|
||||
}
|
||||
|
||||
// Send the command line to the remote chrome window.
|
||||
- // Format is "START\0<<<current directory>>>\0<<<commandline>>>".
|
||||
+ // Format is
|
||||
+ // "START\0<current-directory>\0<command-line>\0<additional-data-length>\0<additional-data>".
|
||||
std::wstring to_send(L"START\0", 6); // want the NULL in the string.
|
||||
base::FilePath cur_dir;
|
||||
if (!base::GetCurrentDirectory(&cur_dir)) {
|
||||
@@ -64,6 +66,22 @@ NotifyChromeResult AttemptToNotifyRunningChrome(HWND remote_window) {
|
||||
base::CommandLine::ForCurrentProcess()->GetCommandLineString());
|
||||
to_send.append(L"\0", 1); // Null separator.
|
||||
|
||||
+ size_t additional_data_size = additional_data.size_bytes();
|
||||
+ if (additional_data_size) {
|
||||
+ // Send over the size, because the reinterpret cast to wchar_t could
|
||||
+ // add padding.
|
||||
+ to_send.append(base::UTF8ToWide(base::NumberToString(additional_data_size)));
|
||||
+ to_send.append(L"\0", 1); // Null separator.
|
||||
+
|
||||
+ size_t padded_size = additional_data_size / sizeof(wchar_t);
|
||||
+ if (additional_data_size % sizeof(wchar_t) != 0) {
|
||||
+ padded_size++;
|
||||
+ }
|
||||
+ to_send.append(reinterpret_cast<const wchar_t*>(additional_data.data()),
|
||||
+ padded_size);
|
||||
+ to_send.append(L"\0", 1); // Null separator.
|
||||
+ }
|
||||
+
|
||||
// Allow the current running browser window to make itself the foreground
|
||||
// window (otherwise it will just flash in the taskbar).
|
||||
::AllowSetForegroundWindow(process_id);
|
||||
diff --git a/chrome/browser/win/chrome_process_finder.h b/chrome/browser/win/chrome_process_finder.h
|
||||
index 5516673cee019f6060077091e59498bf9038cd6e..8edea5079b46c2cba67833114eb9c21d85cfc22d 100644
|
||||
--- a/chrome/browser/win/chrome_process_finder.h
|
||||
+++ b/chrome/browser/win/chrome_process_finder.h
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
+#include "base/containers/span.h"
|
||||
#include "base/time/time.h"
|
||||
|
||||
namespace base {
|
||||
@@ -27,7 +28,9 @@ HWND FindRunningChromeWindow(const base::FilePath& user_data_dir);
|
||||
// Attempts to send the current command line to an already running instance of
|
||||
// Chrome via a WM_COPYDATA message.
|
||||
// Returns true if a running Chrome is found and successfully notified.
|
||||
-NotifyChromeResult AttemptToNotifyRunningChrome(HWND remote_window);
|
||||
+NotifyChromeResult AttemptToNotifyRunningChrome(
|
||||
+ HWND remote_window,
|
||||
+ const base::span<const uint8_t> additional_data);
|
||||
|
||||
// Changes the notification timeout to |new_timeout|, returns the old timeout.
|
||||
base::TimeDelta SetNotificationTimeoutForTesting(base::TimeDelta new_timeout);
|
||||
@@ -503,7 +503,7 @@ index 583e3e2525c753a0962d481fc67a3582df75d0e9..9416ec929bebcff7f07088e635376ef2
|
||||
waiting_on_draw_ack_ = true;
|
||||
|
||||
diff --git a/components/viz/service/frame_sinks/root_compositor_frame_sink_impl.cc b/components/viz/service/frame_sinks/root_compositor_frame_sink_impl.cc
|
||||
index df92bab44402330869b44aa76bb40fc20e33b16a..2b3fbaee17c0a8bb7b04cd4c4edb13626dd1bb27 100644
|
||||
index 4e38e0f49054cef3fd1a712c89608ce39003edeb..427882f8ed0d85c6e4170b213c3a3678b60a62df 100644
|
||||
--- a/components/viz/service/frame_sinks/root_compositor_frame_sink_impl.cc
|
||||
+++ b/components/viz/service/frame_sinks/root_compositor_frame_sink_impl.cc
|
||||
@@ -84,7 +84,8 @@ RootCompositorFrameSinkImpl::Create(
|
||||
@@ -621,7 +621,7 @@ index 80bff73a5886e8e79d7d91de5e27bc747fcfce02..8bc43d1359fa2551713992d6ccb73949
|
||||
raw_ptr<Layer> root_layer_ = nullptr;
|
||||
|
||||
diff --git a/ui/gfx/ca_layer_params.h b/ui/gfx/ca_layer_params.h
|
||||
index c5fb29b30b9c5b7483998c567ed9a479d8743939..dc10d78315f76a3914ccd6e2e99af97fa909918b 100644
|
||||
index 12e115cd6a128d8d150abc786d4d38b1d5119d91..b6320de28750333bee7ee83393849f4eb0a956ac 100644
|
||||
--- a/ui/gfx/ca_layer_params.h
|
||||
+++ b/ui/gfx/ca_layer_params.h
|
||||
@@ -6,6 +6,7 @@
|
||||
@@ -632,7 +632,7 @@ index c5fb29b30b9c5b7483998c567ed9a479d8743939..dc10d78315f76a3914ccd6e2e99af97f
|
||||
#include "ui/gfx/geometry/size.h"
|
||||
#include "ui/gfx/gfx_export.h"
|
||||
|
||||
@@ -41,6 +42,8 @@ struct GFX_EXPORT CALayerParams {
|
||||
@@ -51,6 +52,8 @@ struct GFX_EXPORT CALayerParams {
|
||||
gfx::ScopedRefCountedIOSurfaceMachPort io_surface_mach_port;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -17,43 +17,43 @@ headers, moving forward we should find a way in upstream to provide
|
||||
access to these headers for loader clients created on the browser process.
|
||||
|
||||
diff --git a/services/network/public/cpp/resource_request.cc b/services/network/public/cpp/resource_request.cc
|
||||
index 87868727a78223baef9ffd2591f49fced240ef4e..f6a6ff28f33e2d1c065f2abeb96733b2d28a6ea1 100644
|
||||
index a15e3c4bed344364f9c43e3f0b5c494d58dff789..24e3b291f8c25de2a0b82184fd731538b6586f86 100644
|
||||
--- a/services/network/public/cpp/resource_request.cc
|
||||
+++ b/services/network/public/cpp/resource_request.cc
|
||||
@@ -233,6 +233,7 @@ bool ResourceRequest::EqualsForTesting(const ResourceRequest& request) const {
|
||||
do_not_prompt_for_login == request.do_not_prompt_for_login &&
|
||||
is_main_frame == request.is_main_frame &&
|
||||
is_outermost_main_frame == request.is_outermost_main_frame &&
|
||||
transition_type == request.transition_type &&
|
||||
+ report_raw_headers == request.report_raw_headers &&
|
||||
previews_state == request.previews_state &&
|
||||
upgrade_if_insecure == request.upgrade_if_insecure &&
|
||||
is_revalidating == request.is_revalidating &&
|
||||
diff --git a/services/network/public/cpp/resource_request.h b/services/network/public/cpp/resource_request.h
|
||||
index 8b9a7b36f53a4cfcd159ac18c06d1724072013c8..ef0191bae8a07e531ae129cf32b22f4930c5e266 100644
|
||||
index 2ff43cc1ef683707001bf22c9b030bf6e7223e0f..cfaf9170666f04407adb5738ce6723900d234735 100644
|
||||
--- a/services/network/public/cpp/resource_request.h
|
||||
+++ b/services/network/public/cpp/resource_request.h
|
||||
@@ -156,6 +156,7 @@ struct COMPONENT_EXPORT(NETWORK_CPP_BASE) ResourceRequest {
|
||||
@@ -158,6 +158,7 @@ struct COMPONENT_EXPORT(NETWORK_CPP_BASE) ResourceRequest {
|
||||
bool do_not_prompt_for_login = false;
|
||||
bool is_main_frame = false;
|
||||
bool is_outermost_main_frame = false;
|
||||
int transition_type = 0;
|
||||
+ bool report_raw_headers = false;
|
||||
int previews_state = 0;
|
||||
bool upgrade_if_insecure = false;
|
||||
bool is_revalidating = false;
|
||||
diff --git a/services/network/public/cpp/url_request_mojom_traits.cc b/services/network/public/cpp/url_request_mojom_traits.cc
|
||||
index 1fcf54cac11c38352e14774cd08bcaa162443e9c..5356da11391d52a8f9aaa57a27616cee6dc0f2b6 100644
|
||||
index 4f2740ebf2dc4bee423cdbb72cae128f28a03f12..d3f531429598b3666aaba655356155c470e8b645 100644
|
||||
--- a/services/network/public/cpp/url_request_mojom_traits.cc
|
||||
+++ b/services/network/public/cpp/url_request_mojom_traits.cc
|
||||
@@ -209,6 +209,7 @@ bool StructTraits<
|
||||
out->do_not_prompt_for_login = data.do_not_prompt_for_login();
|
||||
out->is_main_frame = data.is_main_frame();
|
||||
out->is_outermost_main_frame = data.is_outermost_main_frame();
|
||||
out->transition_type = data.transition_type();
|
||||
+ out->report_raw_headers = data.report_raw_headers();
|
||||
out->previews_state = data.previews_state();
|
||||
out->upgrade_if_insecure = data.upgrade_if_insecure();
|
||||
out->is_revalidating = data.is_revalidating();
|
||||
diff --git a/services/network/public/cpp/url_request_mojom_traits.h b/services/network/public/cpp/url_request_mojom_traits.h
|
||||
index 3a1c5bd943c110514e4da06491190476d6e6de38..6a80fb16242865d398bcbcd380893ccc9a3fe167 100644
|
||||
index 069768e7ca727fc2ad8f5379900ad4a959a87f4f..3e6bc18564e2a3cdbac9af686636f75d64082464 100644
|
||||
--- a/services/network/public/cpp/url_request_mojom_traits.h
|
||||
+++ b/services/network/public/cpp/url_request_mojom_traits.h
|
||||
@@ -269,6 +269,9 @@ struct COMPONENT_EXPORT(NETWORK_CPP_BASE)
|
||||
@@ -67,7 +67,7 @@ index 3a1c5bd943c110514e4da06491190476d6e6de38..6a80fb16242865d398bcbcd380893ccc
|
||||
return request.previews_state;
|
||||
}
|
||||
diff --git a/services/network/public/mojom/url_request.mojom b/services/network/public/mojom/url_request.mojom
|
||||
index 79b5d03ded03ced9e6ff4d17d10935004bfb0062..923883fd010f9621c790dd5381a7e1f0cb36e740 100644
|
||||
index ef3e8e68621402db5a97977f49ac74c438b0a563..aa1c1bcf7ca30adde4c25ed9bd8ed8a70eb919e0 100644
|
||||
--- a/services/network/public/mojom/url_request.mojom
|
||||
+++ b/services/network/public/mojom/url_request.mojom
|
||||
@@ -312,6 +312,9 @@ struct URLRequest {
|
||||
@@ -103,7 +103,7 @@ index 4c4cc16db82d7434573f7740855fbe72d68815e6..f71290800b6bb51a39b1f86be36f02d6
|
||||
string mime_type;
|
||||
|
||||
diff --git a/services/network/url_loader.cc b/services/network/url_loader.cc
|
||||
index 4c11fd542a66f514a6c36e684a34d0a62053c1f4..6852fd470c79e2fb041bf57a01e2b0b913cb94db 100644
|
||||
index c79ad06ecb80ea431bf48c16e413286c768e2316..2a5cce5b467e79df1f34d7318862fd16134b74c3 100644
|
||||
--- a/services/network/url_loader.cc
|
||||
+++ b/services/network/url_loader.cc
|
||||
@@ -469,6 +469,7 @@ URLLoader::URLLoader(
|
||||
@@ -123,7 +123,7 @@ index 4c11fd542a66f514a6c36e684a34d0a62053c1f4..6852fd470c79e2fb041bf57a01e2b0b9
|
||||
url_request_->SetResponseHeadersCallback(base::BindRepeating(
|
||||
&URLLoader::SetRawResponseHeaders, base::Unretained(this)));
|
||||
}
|
||||
@@ -1411,6 +1412,19 @@ void URLLoader::OnResponseStarted(net::URLRequest* url_request, int net_error) {
|
||||
@@ -1427,6 +1428,19 @@ void URLLoader::OnResponseStarted(net::URLRequest* url_request, int net_error) {
|
||||
}
|
||||
|
||||
response_ = BuildResponseHead();
|
||||
@@ -144,7 +144,7 @@ index 4c11fd542a66f514a6c36e684a34d0a62053c1f4..6852fd470c79e2fb041bf57a01e2b0b9
|
||||
|
||||
// Parse and remove the Trust Tokens response headers, if any are expected,
|
||||
diff --git a/services/network/url_loader.h b/services/network/url_loader.h
|
||||
index 53822d17b20f4e6d163d0dc84eea6c455254a5f7..c494a63b0c1dcb39120e8aabc84a60ebbf2ff224 100644
|
||||
index e235b3cc8657e081063709f6d2cd6e0b2e99f2b2..15b77b8648b905711df8551b1645b14dd7d6fd87 100644
|
||||
--- a/services/network/url_loader.h
|
||||
+++ b/services/network/url_loader.h
|
||||
@@ -502,6 +502,8 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) URLLoader
|
||||
|
||||
@@ -0,0 +1,874 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: VerteDinde <keeleymhammond@gmail.com>
|
||||
Date: Sun, 8 May 2022 17:21:12 -0700
|
||||
Subject: feat: replace ad-hoc SetPublicFirstPartySets calls with method in
|
||||
ContentBrowserClient
|
||||
|
||||
Cherry-picked from upstream Chromium. This patch can be removed when the
|
||||
fix is inherited from the next Chromium roll backport.
|
||||
|
||||
This essentially requires
|
||||
embedders to indicate whether they will
|
||||
(maybe asynchronously) call SetPublicFirstPartySets during startup, or
|
||||
not. This makes it easier to initialize First-Party Sets properly, since
|
||||
it is now done via a pull-based interface rather than a push-based
|
||||
interface (which would require code in every embedder in order to
|
||||
set up the First-Party Sets backend). Now, there is a single place (in
|
||||
content) that handles every embedder that won't need to explicitly call
|
||||
SetPublicFirstPartySets at some point (e.g. after initializing
|
||||
Component Updater, in Chrome's case).
|
||||
|
||||
Bug: 1321908
|
||||
Change-Id: I47eaaaf77e548079e1bd6360fd573e877aa79b32
|
||||
Reviewed-on:
|
||||
https://chromium-review.googlesource.com/c/chromium/src/+/3623985
|
||||
Reviewed-by: Avi Drissman <avi@chromium.org>
|
||||
Commit-Queue: Chris Fredrickson <cfredric@chromium.org>
|
||||
Cr-Commit-Position: refs/heads/main@{#999047}
|
||||
|
||||
Patch-Filename:
|
||||
feat_move_firstpartysets_to_content_browser_client.patch
|
||||
|
||||
diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc
|
||||
index e07874dc5a2fab83dff0a07d35aeb0cad7a1a67c..9f635870282f0f2a9b8bfaaa59e34f91675dcda3 100644
|
||||
--- a/chrome/browser/chrome_browser_main.cc
|
||||
+++ b/chrome/browser/chrome_browser_main.cc
|
||||
@@ -1601,10 +1601,6 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() {
|
||||
// called inside PostProfileInit and depends on it.
|
||||
if (!parsed_command_line().HasSwitch(switches::kDisableComponentUpdate)) {
|
||||
component_updater::RegisterComponentsForUpdate();
|
||||
- } else {
|
||||
- // Initialize First-Party Sets even if component updater is disabled.
|
||||
- content::FirstPartySetsHandler::GetInstance()->SetPublicFirstPartySets(
|
||||
- base::File());
|
||||
}
|
||||
|
||||
// TODO(stevenjb): Move WIN and MACOSX specific code to appropriate Parts.
|
||||
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
|
||||
index 3943c32ab29e785f401c2a5b31f1f6ed832514f0..939c28a029418bc353795aa1a007508680f42e57 100644
|
||||
--- a/chrome/browser/chrome_content_browser_client.cc
|
||||
+++ b/chrome/browser/chrome_content_browser_client.cc
|
||||
@@ -6462,6 +6462,12 @@ bool ChromeContentBrowserClient::IsFirstPartySetsEnabled() {
|
||||
return local_state->GetBoolean(first_party_sets::kFirstPartySetsEnabled);
|
||||
}
|
||||
|
||||
+bool ChromeContentBrowserClient::WillProvidePublicFirstPartySets() {
|
||||
+ return !base::CommandLine::ForCurrentProcess()->HasSwitch(
|
||||
+ switches::kDisableComponentUpdate) &&
|
||||
+ base::FeatureList::IsEnabled(features::kFirstPartySets);
|
||||
+}
|
||||
+
|
||||
base::Value::Dict ChromeContentBrowserClient::GetFirstPartySetsOverrides() {
|
||||
if (!g_browser_process) {
|
||||
// If browser process doesn't exist (e.g. in minimal mode on Android),
|
||||
diff --git a/chrome/browser/chrome_content_browser_client.h b/chrome/browser/chrome_content_browser_client.h
|
||||
index f0415a5099cdf181ab620fb6400db4f524c2c892..016b8276feeb6c35c88bc779ae84eea38d66f57d 100644
|
||||
--- a/chrome/browser/chrome_content_browser_client.h
|
||||
+++ b/chrome/browser/chrome_content_browser_client.h
|
||||
@@ -772,6 +772,7 @@ class ChromeContentBrowserClient : public content::ContentBrowserClient {
|
||||
|
||||
bool IsFindInPageDisabledForOrigin(const url::Origin& origin) override;
|
||||
bool IsFirstPartySetsEnabled() override;
|
||||
+ bool WillProvidePublicFirstPartySets() override;
|
||||
base::Value::Dict GetFirstPartySetsOverrides() override;
|
||||
|
||||
bool ShouldPreconnectNavigation(
|
||||
diff --git a/content/browser/first_party_sets/first_party_set_parser.cc b/content/browser/first_party_sets/first_party_set_parser.cc
|
||||
index b03570f072f407a1d2c6a58646db0f48a845429d..3ac5c0d206c7910e5ae653004e96780c14c8315d 100644
|
||||
--- a/content/browser/first_party_sets/first_party_set_parser.cc
|
||||
+++ b/content/browser/first_party_sets/first_party_set_parser.cc
|
||||
@@ -323,4 +323,4 @@ FirstPartySetParser::ParseSetsFromEnterprisePolicy(
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
-} // namespace content
|
||||
+} // namespace content
|
||||
\ No newline at end of file
|
||||
diff --git a/content/browser/first_party_sets/first_party_set_parser.h b/content/browser/first_party_sets/first_party_set_parser.h
|
||||
index 491a8b508ef0d093f37608d2fde615427b9319df..3f33b1604fecbff0d4db8739ad138d95223b579c 100644
|
||||
--- a/content/browser/first_party_sets/first_party_set_parser.h
|
||||
+++ b/content/browser/first_party_sets/first_party_set_parser.h
|
||||
@@ -102,4 +102,4 @@ class CONTENT_EXPORT FirstPartySetParser {
|
||||
|
||||
} // namespace content
|
||||
|
||||
-#endif // CONTENT_BROWSER_FIRST_PARTY_SETS_FIRST_PARTY_SET_PARSER_H_
|
||||
+#endif // CONTENT_BROWSER_FIRST_PARTY_SETS_FIRST_PARTY_SET_PARSER_H_
|
||||
\ No newline at end of file
|
||||
diff --git a/content/browser/first_party_sets/first_party_sets_handler_impl.cc b/content/browser/first_party_sets/first_party_sets_handler_impl.cc
|
||||
index e5d277236b6393d35e8cf5a69c7f6d16f3394582..bb6840eecabfab9e9f0ae6b0fdc4e4436d1ea3b1 100644
|
||||
--- a/content/browser/first_party_sets/first_party_sets_handler_impl.cc
|
||||
+++ b/content/browser/first_party_sets/first_party_sets_handler_impl.cc
|
||||
@@ -74,7 +74,8 @@ FirstPartySetsHandler* FirstPartySetsHandler::GetInstance() {
|
||||
// static
|
||||
FirstPartySetsHandlerImpl* FirstPartySetsHandlerImpl::GetInstance() {
|
||||
static base::NoDestructor<FirstPartySetsHandlerImpl> instance(
|
||||
- GetContentClient()->browser()->IsFirstPartySetsEnabled());
|
||||
+ GetContentClient()->browser()->IsFirstPartySetsEnabled(),
|
||||
+ GetContentClient()->browser()->WillProvidePublicFirstPartySets());
|
||||
return instance.get();
|
||||
}
|
||||
|
||||
@@ -89,8 +90,12 @@ FirstPartySetsHandler::ValidateEnterprisePolicy(
|
||||
policy, /*out_sets=*/nullptr);
|
||||
}
|
||||
|
||||
-FirstPartySetsHandlerImpl::FirstPartySetsHandlerImpl(bool enabled)
|
||||
- : enabled_(enabled) {
|
||||
+FirstPartySetsHandlerImpl::FirstPartySetsHandlerImpl(
|
||||
+ bool enabled,
|
||||
+ bool embedder_will_provide_public_sets)
|
||||
+ : enabled_(enabled),
|
||||
+ embedder_will_provide_public_sets_(enabled &&
|
||||
+ embedder_will_provide_public_sets) {
|
||||
sets_loader_ = std::make_unique<FirstPartySetsLoader>(
|
||||
base::BindOnce(&FirstPartySetsHandlerImpl::SetCompleteSets,
|
||||
// base::Unretained(this) is safe here because
|
||||
@@ -112,12 +117,23 @@ void FirstPartySetsHandlerImpl::Init(const base::FilePath& user_data_dir,
|
||||
const std::string& flag_value,
|
||||
SetsReadyOnceCallback on_sets_ready) {
|
||||
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
||||
+ DCHECK(!initialized_);
|
||||
+ DCHECK(persisted_sets_path_.empty());
|
||||
+ DCHECK(on_sets_ready_.is_null());
|
||||
+
|
||||
+ initialized_ = true;
|
||||
on_sets_ready_ = std::move(on_sets_ready);
|
||||
SetPersistedSets(user_data_dir);
|
||||
- SetManuallySpecifiedSet(flag_value);
|
||||
|
||||
- if (!IsEnabled())
|
||||
+ if (IsEnabled()) {
|
||||
+ DCHECK(!on_sets_ready_.is_null());
|
||||
+ sets_loader_->SetManuallySpecifiedSet(flag_value);
|
||||
+ if (!embedder_will_provide_public_sets_) {
|
||||
+ sets_loader_->SetComponentSets(base::File());
|
||||
+ }
|
||||
+ } else {
|
||||
SetCompleteSets({});
|
||||
+ }
|
||||
}
|
||||
|
||||
bool FirstPartySetsHandlerImpl::IsEnabled() const {
|
||||
@@ -127,16 +143,17 @@ bool FirstPartySetsHandlerImpl::IsEnabled() const {
|
||||
|
||||
void FirstPartySetsHandlerImpl::SetPublicFirstPartySets(base::File sets_file) {
|
||||
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
||||
- if (!IsEnabled()) {
|
||||
- sets_loader_->DisposeFile(std::move(sets_file));
|
||||
- return;
|
||||
- }
|
||||
+ DCHECK(enabled_);
|
||||
+ DCHECK(embedder_will_provide_public_sets_);
|
||||
sets_loader_->SetComponentSets(std::move(sets_file));
|
||||
}
|
||||
|
||||
void FirstPartySetsHandlerImpl::ResetForTesting() {
|
||||
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
||||
+ initialized_ = false;
|
||||
enabled_ = GetContentClient()->browser()->IsFirstPartySetsEnabled();
|
||||
+ embedder_will_provide_public_sets_ =
|
||||
+ GetContentClient()->browser()->WillProvidePublicFirstPartySets();
|
||||
|
||||
// Initializes the `sets_loader_` member with a callback to SetCompleteSets
|
||||
// and the result of content::GetFirstPartySetsOverrides.
|
||||
@@ -153,19 +170,16 @@ void FirstPartySetsHandlerImpl::ResetForTesting() {
|
||||
raw_persisted_sets_ = absl::nullopt;
|
||||
}
|
||||
|
||||
-void FirstPartySetsHandlerImpl::SetManuallySpecifiedSet(
|
||||
- const std::string& flag_value) {
|
||||
- DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
||||
- if (!IsEnabled())
|
||||
- return;
|
||||
- sets_loader_->SetManuallySpecifiedSet(flag_value);
|
||||
-}
|
||||
-
|
||||
void FirstPartySetsHandlerImpl::SetPersistedSets(
|
||||
const base::FilePath& user_data_dir) {
|
||||
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
||||
+ DCHECK(!raw_persisted_sets_.has_value());
|
||||
+ DCHECK(persisted_sets_path_.empty());
|
||||
if (user_data_dir.empty()) {
|
||||
VLOG(1) << "Empty path. Failed loading serialized First-Party Sets file.";
|
||||
+ // We have to continue, in case the embedder has enabled FPS but has not
|
||||
+ // provided a directory to store persisted sets.
|
||||
+ OnReadPersistedSetsFile("");
|
||||
return;
|
||||
}
|
||||
persisted_sets_path_ = user_data_dir.Append(kPersistedFirstPartySetsFileName);
|
||||
@@ -184,19 +198,36 @@ void FirstPartySetsHandlerImpl::SetPersistedSets(
|
||||
void FirstPartySetsHandlerImpl::OnReadPersistedSetsFile(
|
||||
const std::string& raw_persisted_sets) {
|
||||
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
||||
- DCHECK(!persisted_sets_path_.empty());
|
||||
+ DCHECK(!raw_persisted_sets_.has_value());
|
||||
raw_persisted_sets_ = raw_persisted_sets;
|
||||
UmaHistogramTimes(
|
||||
- "Cookie.FirstPartySets.InitializationDuration.ReadPersistedSets",
|
||||
+ "Cookie.FirstPartySets.InitializationDuration.ReadPersistedSets2",
|
||||
construction_timer_.Elapsed());
|
||||
- ClearSiteDataOnChangedSetsIfReady();
|
||||
+
|
||||
+ if (sets_.has_value()) {
|
||||
+ ClearSiteDataOnChangedSets();
|
||||
+
|
||||
+ if (IsEnabled()) {
|
||||
+ DCHECK(!on_sets_ready_.is_null());
|
||||
+ std::move(on_sets_ready_).Run(sets_.value());
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
|
||||
void FirstPartySetsHandlerImpl::SetCompleteSets(
|
||||
base::flat_map<net::SchemefulSite, net::SchemefulSite> sets) {
|
||||
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
||||
+ DCHECK(!sets_.has_value());
|
||||
sets_ = std::move(sets);
|
||||
- ClearSiteDataOnChangedSetsIfReady();
|
||||
+
|
||||
+ if (raw_persisted_sets_.has_value()) {
|
||||
+ ClearSiteDataOnChangedSets();
|
||||
+
|
||||
+ if (IsEnabled()) {
|
||||
+ DCHECK(!on_sets_ready_.is_null());
|
||||
+ std::move(on_sets_ready_).Run(sets_.value());
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
|
||||
// static
|
||||
@@ -229,10 +260,10 @@ base::flat_set<net::SchemefulSite> FirstPartySetsHandlerImpl::ComputeSetsDiff(
|
||||
return result;
|
||||
}
|
||||
|
||||
-void FirstPartySetsHandlerImpl::ClearSiteDataOnChangedSetsIfReady() {
|
||||
+void FirstPartySetsHandlerImpl::ClearSiteDataOnChangedSets() const {
|
||||
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
||||
- if (!raw_persisted_sets_.has_value() || !sets_.has_value())
|
||||
- return;
|
||||
+ DCHECK(sets_.has_value());
|
||||
+ DCHECK(raw_persisted_sets_.has_value());
|
||||
|
||||
base::flat_set<net::SchemefulSite> diff =
|
||||
ComputeSetsDiff(FirstPartySetParser::DeserializeFirstPartySets(
|
||||
@@ -241,14 +272,13 @@ void FirstPartySetsHandlerImpl::ClearSiteDataOnChangedSetsIfReady() {
|
||||
|
||||
// TODO(shuuran@chromium.org): Implement site state clearing.
|
||||
|
||||
- if (!on_sets_ready_.is_null() && IsEnabledAndReady())
|
||||
- std::move(on_sets_ready_).Run(sets_.value());
|
||||
-
|
||||
- base::ThreadPool::PostTask(
|
||||
- FROM_HERE, {base::MayBlock(), base::TaskPriority::BEST_EFFORT},
|
||||
- base::BindOnce(
|
||||
- &MaybeWriteSetsToDisk, persisted_sets_path_,
|
||||
- FirstPartySetParser::SerializeFirstPartySets(sets_.value())));
|
||||
+ if (!persisted_sets_path_.empty()) {
|
||||
+ base::ThreadPool::PostTask(
|
||||
+ FROM_HERE, {base::MayBlock(), base::TaskPriority::BEST_EFFORT},
|
||||
+ base::BindOnce(
|
||||
+ &MaybeWriteSetsToDisk, persisted_sets_path_,
|
||||
+ FirstPartySetParser::SerializeFirstPartySets(sets_.value())));
|
||||
+ }
|
||||
}
|
||||
|
||||
bool FirstPartySetsHandlerImpl::IsEnabledAndReady() const {
|
||||
@@ -256,4 +286,4 @@ bool FirstPartySetsHandlerImpl::IsEnabledAndReady() const {
|
||||
return IsEnabled() && sets_.has_value();
|
||||
}
|
||||
|
||||
-} // namespace content
|
||||
+} // namespace content
|
||||
\ No newline at end of file
|
||||
diff --git a/content/browser/first_party_sets/first_party_sets_handler_impl.h b/content/browser/first_party_sets/first_party_sets_handler_impl.h
|
||||
index a60adcd16b5b8911965f9a22c2e70b5044150758..829cd96245cbe39eeddecf2e0403f2ba1ab88793 100644
|
||||
--- a/content/browser/first_party_sets/first_party_sets_handler_impl.h
|
||||
+++ b/content/browser/first_party_sets/first_party_sets_handler_impl.h
|
||||
@@ -55,10 +55,9 @@ class CONTENT_EXPORT FirstPartySetsHandlerImpl : public FirstPartySetsHandler {
|
||||
// persisted sets, since we may still need to clear data from a previous
|
||||
// invocation of Chromium which had First-Party Sets enabled.
|
||||
//
|
||||
- // TODO(https://crbug.com/1309188): Init() should be called in the
|
||||
- // BrowserMainLoop::PreMainMessageLoopRun(). But just in case it's
|
||||
- // accidentally called from other places, make sure it's no-op for the
|
||||
- // following calls.
|
||||
+ // If First-Party Sets is enabled, `on_sets_ready` must not be null.
|
||||
+ //
|
||||
+ // Must be called exactly once.
|
||||
void Init(const base::FilePath& user_data_dir,
|
||||
const std::string& flag_value,
|
||||
SetsReadyOnceCallback on_sets_ready);
|
||||
@@ -78,6 +77,11 @@ class CONTENT_EXPORT FirstPartySetsHandlerImpl : public FirstPartySetsHandler {
|
||||
enabled_ = enabled;
|
||||
}
|
||||
|
||||
+ void SetEmbedderWillProvidePublicSetsForTesting(bool will_provide) {
|
||||
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
||||
+ embedder_will_provide_public_sets_ = enabled_ && will_provide;
|
||||
+ }
|
||||
+
|
||||
// Compares the map `old_sets` to `current_sets` and returns the set of sites
|
||||
// that: 1) were in `old_sets` but are no longer in `current_sets`, i.e. leave
|
||||
// the FPSs; or, 2) mapped to a different owner site.
|
||||
@@ -92,41 +96,38 @@ class CONTENT_EXPORT FirstPartySetsHandlerImpl : public FirstPartySetsHandler {
|
||||
private:
|
||||
friend class base::NoDestructor<FirstPartySetsHandlerImpl>;
|
||||
|
||||
- explicit FirstPartySetsHandlerImpl(bool enabled);
|
||||
+ FirstPartySetsHandlerImpl(bool enabled,
|
||||
+ bool embedder_will_provide_public_sets);
|
||||
|
||||
// This method reads the persisted First-Party Sets from the file under
|
||||
- // `user_data_dir`.
|
||||
+ // `user_data_dir`. Must be called exactly once.
|
||||
void SetPersistedSets(const base::FilePath& user_data_dir);
|
||||
|
||||
- // Stores the read persisted sets in `raw_persisted_sets_`.
|
||||
+ // Stores the read persisted sets in `raw_persisted_sets_`. Must be called
|
||||
+ // exactly once.
|
||||
void OnReadPersistedSetsFile(const std::string& raw_persisted_sets);
|
||||
|
||||
- // Parses and sets the First-Party Set that was provided via the
|
||||
- // `kUseFirstPartySet` flag/switch.
|
||||
- //
|
||||
- // Has no effect if `kFirstPartySets` is disabled, or
|
||||
- // `SetPublicFirstPartySets` is not called.
|
||||
- void SetManuallySpecifiedSet(const std::string& flag_value);
|
||||
-
|
||||
- // Sets the current First-Party Sets data.
|
||||
+ // Sets the current First-Party Sets data. Must be called exactly once.
|
||||
void SetCompleteSets(FlattenedSets sets);
|
||||
|
||||
- // Checks the required inputs have been received, and if so:
|
||||
+ // Does the following:
|
||||
// 1) computes the diff between the `sets_` and the parsed
|
||||
// `raw_persisted_sets_`;
|
||||
// 2) clears the site data of the set of sites based on the diff;
|
||||
- // 3) calls `on_sets_ready_` if conditions are met;
|
||||
- // 4) writes the current First-Party Sets to the file in
|
||||
+ // 3) writes the current First-Party Sets to the file in
|
||||
// `persisted_sets_path_`.
|
||||
//
|
||||
// TODO(shuuran@chromium.org): Implement the code to clear site state.
|
||||
- void ClearSiteDataOnChangedSetsIfReady();
|
||||
+ void ClearSiteDataOnChangedSets() const;
|
||||
|
||||
// Returns true if:
|
||||
// * First-Party Sets are enabled;
|
||||
// * `sets_` is ready to be used.
|
||||
bool IsEnabledAndReady() const;
|
||||
|
||||
+ // Whether Init has been called already or not.
|
||||
+ bool initialized_ = false;
|
||||
+
|
||||
// Represents the mapping of site -> site, where keys are members of sets, and
|
||||
// values are owners of the sets. Owners are explicitly represented as members
|
||||
// of the set.
|
||||
@@ -144,6 +145,7 @@ class CONTENT_EXPORT FirstPartySetsHandlerImpl : public FirstPartySetsHandler {
|
||||
base::FilePath persisted_sets_path_ GUARDED_BY_CONTEXT(sequence_checker_);
|
||||
|
||||
bool enabled_ GUARDED_BY_CONTEXT(sequence_checker_);
|
||||
+ bool embedder_will_provide_public_sets_ GUARDED_BY_CONTEXT(sequence_checker_);
|
||||
|
||||
// We use a OnceCallback to ensure we only pass along the sets once
|
||||
// during Chrome's lifetime (modulo reconfiguring the network service).
|
||||
@@ -160,4 +162,4 @@ class CONTENT_EXPORT FirstPartySetsHandlerImpl : public FirstPartySetsHandler {
|
||||
|
||||
} // namespace content
|
||||
|
||||
-#endif // CONTENT_BROWSER_FIRST_PARTY_SETS_FIRST_PARTY_SETS_HANDLER_IMPL_H_
|
||||
+#endif // CONTENT_BROWSER_FIRST_PARTY_SETS_FIRST_PARTY_SETS_HANDLER_IMPL_H_
|
||||
\ No newline at end of file
|
||||
diff --git a/content/browser/first_party_sets/first_party_sets_handler_impl_unittest.cc b/content/browser/first_party_sets/first_party_sets_handler_impl_unittest.cc
|
||||
index 0c0eeda67a8a4bdc9876f5ad3fe78c06c4f18b5d..3e92801eb25e339e6b3a43b5fadab8f1b78b23f9 100644
|
||||
--- a/content/browser/first_party_sets/first_party_sets_handler_impl_unittest.cc
|
||||
+++ b/content/browser/first_party_sets/first_party_sets_handler_impl_unittest.cc
|
||||
@@ -367,14 +367,6 @@ TEST_F(FirstPartySetsHandlerImplDisabledTest, IgnoresValid) {
|
||||
FAIL(); // Should not be called.
|
||||
}));
|
||||
|
||||
- // Set required inputs to be able to receive the merged sets from
|
||||
- // FirstPartySetsLoader.
|
||||
- const std::string input =
|
||||
- "{\"owner\": \"https://example.test\",\"members\": "
|
||||
- "[\"https://aaaa.test\"]}";
|
||||
- ASSERT_TRUE(base::JSONReader::Read(input));
|
||||
- SetPublicFirstPartySetsAndWait(input);
|
||||
-
|
||||
env().RunUntilIdle();
|
||||
|
||||
// TODO(shuuran@chromium.org): test site state is cleared.
|
||||
@@ -397,9 +389,6 @@ TEST_F(FirstPartySetsHandlerImplDisabledTest,
|
||||
FAIL(); // Should not be called.
|
||||
}));
|
||||
|
||||
- SetPublicFirstPartySetsAndWait(R"({"owner": "https://example.test", )"
|
||||
- R"("members": ["https://member.test"]})");
|
||||
-
|
||||
EXPECT_EQ(
|
||||
FirstPartySetsHandlerImpl::GetInstance()->GetSetsIfEnabledAndReady(),
|
||||
absl::nullopt);
|
||||
@@ -413,11 +402,6 @@ class FirstPartySetsHandlerImplEnabledTest
|
||||
};
|
||||
|
||||
TEST_F(FirstPartySetsHandlerImplEnabledTest, PersistedSetsNotReady) {
|
||||
- const std::string input = R"({"owner": "https://foo.test", )"
|
||||
- R"("members": ["https://member2.test"]})";
|
||||
- ASSERT_TRUE(base::JSONReader::Read(input));
|
||||
- SetPublicFirstPartySetsAndWait(input);
|
||||
-
|
||||
// Empty `user_data_dir` will fail loading persisted sets.
|
||||
FirstPartySetsHandlerImpl::GetInstance()->Init(
|
||||
/*user_data_dir=*/{},
|
||||
@@ -431,6 +415,8 @@ TEST_F(FirstPartySetsHandlerImplEnabledTest, PersistedSetsNotReady) {
|
||||
}
|
||||
|
||||
TEST_F(FirstPartySetsHandlerImplEnabledTest, PublicFirstPartySetsNotReady) {
|
||||
+ FirstPartySetsHandlerImpl::GetInstance()
|
||||
+ ->SetEmbedderWillProvidePublicSetsForTesting(true);
|
||||
ASSERT_TRUE(base::WriteFile(persisted_sets_path_, "{}"));
|
||||
|
||||
// Persisted sets are expected to be loaded with the provided path.
|
||||
@@ -447,6 +433,8 @@ TEST_F(FirstPartySetsHandlerImplEnabledTest, PublicFirstPartySetsNotReady) {
|
||||
|
||||
TEST_F(FirstPartySetsHandlerImplEnabledTest,
|
||||
Successful_PersistedSetsFileNotExist) {
|
||||
+ FirstPartySetsHandlerImpl::GetInstance()
|
||||
+ ->SetEmbedderWillProvidePublicSetsForTesting(true);
|
||||
const std::string input = R"({"owner": "https://foo.test", )"
|
||||
R"("members": ["https://member2.test"]})";
|
||||
ASSERT_TRUE(base::JSONReader::Read(input));
|
||||
@@ -479,6 +467,8 @@ TEST_F(FirstPartySetsHandlerImplEnabledTest,
|
||||
}
|
||||
|
||||
TEST_F(FirstPartySetsHandlerImplEnabledTest, Successful_PersistedSetsEmpty) {
|
||||
+ FirstPartySetsHandlerImpl::GetInstance()
|
||||
+ ->SetEmbedderWillProvidePublicSetsForTesting(true);
|
||||
ASSERT_TRUE(base::WriteFile(persisted_sets_path_, "{}"));
|
||||
|
||||
const std::string input = R"({"owner": "https://foo.test", )"
|
||||
@@ -514,6 +504,8 @@ TEST_F(FirstPartySetsHandlerImplEnabledTest, Successful_PersistedSetsEmpty) {
|
||||
|
||||
TEST_F(FirstPartySetsHandlerImplEnabledTest,
|
||||
GetSetsIfEnabledAndReady_AfterSetsReady) {
|
||||
+ FirstPartySetsHandlerImpl::GetInstance()
|
||||
+ ->SetEmbedderWillProvidePublicSetsForTesting(true);
|
||||
ASSERT_TRUE(base::WriteFile(persisted_sets_path_, "{}"));
|
||||
|
||||
const std::string input = R"({"owner": "https://example.test", )"
|
||||
@@ -549,6 +541,8 @@ TEST_F(FirstPartySetsHandlerImplEnabledTest,
|
||||
|
||||
TEST_F(FirstPartySetsHandlerImplEnabledTest,
|
||||
GetSetsIfEnabledAndReady_BeforeSetsReady) {
|
||||
+ FirstPartySetsHandlerImpl::GetInstance()
|
||||
+ ->SetEmbedderWillProvidePublicSetsForTesting(true);
|
||||
ASSERT_TRUE(base::WriteFile(persisted_sets_path_, "{}"));
|
||||
|
||||
// Call GetSetsIfEnabledAndReady before the sets are ready.
|
||||
diff --git a/content/browser/first_party_sets/first_party_sets_loader.cc b/content/browser/first_party_sets/first_party_sets_loader.cc
|
||||
index 52acedfde41b85acfc9246121ccfd6e63290270e..c229815ff14160c4f325fb51473e3b4baf5a9891 100644
|
||||
--- a/content/browser/first_party_sets/first_party_sets_loader.cc
|
||||
+++ b/content/browser/first_party_sets/first_party_sets_loader.cc
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "base/strings/string_split.h"
|
||||
#include "base/task/thread_pool.h"
|
||||
#include "base/values.h"
|
||||
+#include "content/browser/first_party_sets/addition_overlaps_union_find.h"
|
||||
#include "content/browser/first_party_sets/first_party_set_parser.h"
|
||||
#include "net/base/schemeful_site.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
@@ -66,6 +67,37 @@ std::string ReadSetsFile(base::File sets_file) {
|
||||
return base::ReadStreamToString(file.get(), &raw_sets) ? raw_sets : "";
|
||||
}
|
||||
|
||||
+// Creates a set of SchemefulSites present with the given list of SingleSets.
|
||||
+base::flat_set<net::SchemefulSite> FlattenSingleSetList(
|
||||
+ const std::vector<content::FirstPartySetsLoader::SingleSet>& sets) {
|
||||
+ std::vector<net::SchemefulSite> sites;
|
||||
+ for (const content::FirstPartySetsLoader::SingleSet& set : sets) {
|
||||
+ sites.push_back(set.first);
|
||||
+ sites.insert(sites.end(), set.second.begin(), set.second.end());
|
||||
+ }
|
||||
+ return sites;
|
||||
+}
|
||||
+
|
||||
+// Populates the `policy_set_overlaps` out-parameter by checking
|
||||
+// `existing_sets`. If `site` is equal to an existing site e in `sets`, then
|
||||
+// `policy_set_index` will be added to the list of set indices at
|
||||
+// `policy_set_overlaps`[e].
|
||||
+void AddIfPolicySetOverlaps(
|
||||
+ const net::SchemefulSite& site,
|
||||
+ size_t policy_set_index,
|
||||
+ FirstPartySetsLoader::FlattenedSets existing_sets,
|
||||
+ base::flat_map<net::SchemefulSite, base::flat_set<size_t>>&
|
||||
+ policy_set_overlaps) {
|
||||
+ // Check `site` for membership in `existing_sets`.
|
||||
+ if (auto it = existing_sets.find(site); it != existing_sets.end()) {
|
||||
+ // Add the index of `site`'s policy set to the list of policy set indices
|
||||
+ // that also overlap with site_owner.
|
||||
+ auto [site_and_sets, inserted] =
|
||||
+ policy_set_overlaps.insert({it->second, {}});
|
||||
+ site_and_sets->second.insert(policy_set_index);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
} // namespace
|
||||
|
||||
FirstPartySetsLoader::FirstPartySetsLoader(
|
||||
@@ -89,7 +121,7 @@ void FirstPartySetsLoader::SetManuallySpecifiedSet(
|
||||
manually_specified_set_ = {CanonicalizeSet(base::SplitString(
|
||||
flag_value, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY))};
|
||||
UmaHistogramTimes(
|
||||
- "Cookie.FirstPartySets.InitializationDuration.ReadCommandLineSet",
|
||||
+ "Cookie.FirstPartySets.InitializationDuration.ReadCommandLineSet2",
|
||||
construction_timer_.Elapsed());
|
||||
|
||||
MaybeFinishLoading();
|
||||
@@ -127,7 +159,7 @@ void FirstPartySetsLoader::OnReadSetsFile(const std::string& raw_sets) {
|
||||
|
||||
component_sets_parse_progress_ = Progress::kFinished;
|
||||
UmaHistogramTimes(
|
||||
- "Cookie.FirstPartySets.InitializationDuration.ReadComponentSets",
|
||||
+ "Cookie.FirstPartySets.InitializationDuration.ReadComponentSets2",
|
||||
construction_timer_.Elapsed());
|
||||
MaybeFinishLoading();
|
||||
}
|
||||
@@ -144,33 +176,141 @@ void FirstPartySetsLoader::DisposeFile(base::File sets_file) {
|
||||
}
|
||||
}
|
||||
|
||||
+std::vector<FirstPartySetsLoader::SingleSet>
|
||||
+FirstPartySetsLoader::NormalizeAdditionSets(
|
||||
+ const FlattenedSets& existing_sets,
|
||||
+ const std::vector<SingleSet>& addition_sets) {
|
||||
+ // Create a mapping from an owner site in `existing_sets` to all policy sets
|
||||
+ // that intersect with the set that it owns.
|
||||
+ base::flat_map<net::SchemefulSite, base::flat_set<size_t>>
|
||||
+ policy_set_overlaps;
|
||||
+ for (size_t set_idx = 0; set_idx < addition_sets.size(); set_idx++) {
|
||||
+ const net::SchemefulSite& owner = addition_sets[set_idx].first;
|
||||
+ AddIfPolicySetOverlaps(owner, set_idx, existing_sets, policy_set_overlaps);
|
||||
+ for (const net::SchemefulSite& member : addition_sets[set_idx].second) {
|
||||
+ AddIfPolicySetOverlaps(member, set_idx, existing_sets,
|
||||
+ policy_set_overlaps);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ AdditionOverlapsUnionFind union_finder(addition_sets.size());
|
||||
+ for (auto& [public_site, policy_set_indices] : policy_set_overlaps) {
|
||||
+ // Union together all overlapping policy sets to determine which one will
|
||||
+ // take ownership.
|
||||
+ for (size_t representative : policy_set_indices) {
|
||||
+ union_finder.Union(*policy_set_indices.begin(), representative);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // The union-find data structure now knows which policy set should be given
|
||||
+ // the role of representative for each entry in policy_set_overlaps.
|
||||
+ // AdditionOverlapsUnionFind::SetsMapping returns a map from representative
|
||||
+ // index to list of its children.
|
||||
+ std::vector<SingleSet> normalized_additions;
|
||||
+ for (auto& [rep, children] : union_finder.SetsMapping()) {
|
||||
+ SingleSet normalized = addition_sets[rep];
|
||||
+ for (size_t child_set_idx : children) {
|
||||
+ // Update normalized to absorb the child_set_idx-th addition set.
|
||||
+ const SingleSet& child_set = addition_sets[child_set_idx];
|
||||
+ normalized.second.insert(child_set.first);
|
||||
+ normalized.second.insert(child_set.second.begin(),
|
||||
+ child_set.second.end());
|
||||
+ }
|
||||
+ normalized_additions.push_back(normalized);
|
||||
+ }
|
||||
+ return normalized_additions;
|
||||
+}
|
||||
+
|
||||
void FirstPartySetsLoader::ApplyManuallySpecifiedSet() {
|
||||
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
||||
- DCHECK_EQ(component_sets_parse_progress_, Progress::kFinished);
|
||||
- DCHECK(manually_specified_set_.has_value());
|
||||
+ DCHECK(HasAllInputs());
|
||||
if (!manually_specified_set_.value().has_value())
|
||||
return;
|
||||
+ ApplyReplacementOverrides({manually_specified_set_->value()});
|
||||
+ RemoveAllSingletons();
|
||||
+}
|
||||
+
|
||||
+void FirstPartySetsLoader::ApplyReplacementOverrides(
|
||||
+ const std::vector<SingleSet>& override_sets) {
|
||||
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
||||
+ DCHECK(HasAllInputs());
|
||||
+
|
||||
+ base::flat_set<net::SchemefulSite> all_override_sites =
|
||||
+ FlattenSingleSetList(override_sets);
|
||||
+
|
||||
+ // Erase the intersection between |sets_| and the list of |override_sets| and
|
||||
+ // any members whose owner was in the intersection.
|
||||
+ base::EraseIf(
|
||||
+ sets_, [&all_override_sites](
|
||||
+ const std::pair<net::SchemefulSite, net::SchemefulSite>& p) {
|
||||
+ return all_override_sites.contains(p.first) ||
|
||||
+ all_override_sites.contains(p.second);
|
||||
+ });
|
||||
+
|
||||
+ // Next, we must add each site in the override_sets to |sets_|.
|
||||
+ for (auto& [owner, members] : override_sets) {
|
||||
+ sets_.emplace(owner, owner);
|
||||
+ for (const net::SchemefulSite& member : members) {
|
||||
+ sets_.emplace(member, owner);
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void FirstPartySetsLoader::ApplyAdditionOverrides(
|
||||
+ const std::vector<SingleSet>& new_sets) {
|
||||
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
||||
+ DCHECK(HasAllInputs());
|
||||
+
|
||||
+ if (new_sets.empty())
|
||||
+ return;
|
||||
|
||||
- const net::SchemefulSite& manual_owner =
|
||||
- manually_specified_set_.value()->first;
|
||||
- const base::flat_set<net::SchemefulSite>& manual_members =
|
||||
- manually_specified_set_.value()->second;
|
||||
+ std::vector<SingleSet> normalized_additions =
|
||||
+ NormalizeAdditionSets(sets_, new_sets);
|
||||
|
||||
- const auto was_manually_provided =
|
||||
- [&manual_members, &manual_owner](const net::SchemefulSite& site) {
|
||||
- return site == manual_owner || manual_members.contains(site);
|
||||
- };
|
||||
+ FlattenedSets flattened_additions;
|
||||
+ for (const auto& [owner, members] : normalized_additions) {
|
||||
+ for (const net::SchemefulSite& member : members)
|
||||
+ flattened_additions.emplace(member, owner);
|
||||
+ flattened_additions.emplace(owner, owner);
|
||||
+ }
|
||||
|
||||
- // Erase the intersection between the manually-specified set and the
|
||||
- // CU-supplied set, and any members whose owner was in the intersection.
|
||||
- base::EraseIf(sets_, [&was_manually_provided](const auto& p) {
|
||||
- return was_manually_provided(p.first) || was_manually_provided(p.second);
|
||||
- });
|
||||
+ // Identify intersections between addition sets and existing sets. This will
|
||||
+ // be used to reparent existing sets if they intersect with an addition set.
|
||||
+ //
|
||||
+ // Since we reparent every member of an existing set (regardless of whether
|
||||
+ // the intersection was via one of its members or its owner), we just keep
|
||||
+ // track of the set itself, via its owner.
|
||||
+ base::flat_map<net::SchemefulSite, net::SchemefulSite> owners_in_intersection;
|
||||
+ for (const auto& [site, owner] : flattened_additions) {
|
||||
+ // Found an overlap with an existing set. Add the existing owner to the
|
||||
+ // map.
|
||||
+ if (auto it = sets_.find(site); it != sets_.end()) {
|
||||
+ owners_in_intersection[it->second] = owner;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // Update the (site, owner) mappings in sets_ such that if owner is in the
|
||||
+ // intersection, then the site is mapped to owners_in_intersection[owner].
|
||||
+ //
|
||||
+ // This reparents existing sets to their owner given by the normalized
|
||||
+ // addition sets.
|
||||
+ for (auto& [site, owner] : sets_) {
|
||||
+ if (auto owner_entry = owners_in_intersection.find(owner);
|
||||
+ owner_entry != owners_in_intersection.end()) {
|
||||
+ owner = owner_entry->second;
|
||||
+ }
|
||||
+ }
|
||||
|
||||
- // Now remove singleton sets. We already removed any sites that were part
|
||||
- // of the intersection, or whose owner was part of the intersection. This
|
||||
- // leaves sites that *are* owners, which no longer have any (other)
|
||||
- // members.
|
||||
+ // Since the intersection between sets_ and flattened_additions has already
|
||||
+ // been updated above, we can insert flattened_additions into sets_ without
|
||||
+ // affecting any existing mappings in sets_.
|
||||
+ sets_.insert(flattened_additions.begin(), flattened_additions.end());
|
||||
+}
|
||||
+
|
||||
+void FirstPartySetsLoader::RemoveAllSingletons() {
|
||||
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
||||
+ // Now remove singleton sets, which are sets that just contain sites that
|
||||
+ // *are* owners, but no longer have any (other) members.
|
||||
std::set<net::SchemefulSite> owners_with_members;
|
||||
for (const auto& it : sets_) {
|
||||
if (it.first != it.second)
|
||||
@@ -179,21 +319,29 @@ void FirstPartySetsLoader::ApplyManuallySpecifiedSet() {
|
||||
base::EraseIf(sets_, [&owners_with_members](const auto& p) {
|
||||
return p.first == p.second && !base::Contains(owners_with_members, p.first);
|
||||
});
|
||||
+}
|
||||
|
||||
- // Next, we must add the manually-added set to the parsed value.
|
||||
- for (const net::SchemefulSite& member : manual_members) {
|
||||
- sets_.emplace(member, manual_owner);
|
||||
- }
|
||||
- sets_.emplace(manual_owner, manual_owner);
|
||||
+void FirstPartySetsLoader::ApplyAllPolicyOverrides() {
|
||||
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
||||
+ DCHECK(HasAllInputs());
|
||||
+ ApplyReplacementOverrides(policy_overrides_.replacements);
|
||||
+ ApplyAdditionOverrides(policy_overrides_.additions);
|
||||
+ RemoveAllSingletons();
|
||||
}
|
||||
|
||||
void FirstPartySetsLoader::MaybeFinishLoading() {
|
||||
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
||||
- if (component_sets_parse_progress_ != Progress::kFinished ||
|
||||
- !manually_specified_set_.has_value())
|
||||
+ if (!HasAllInputs())
|
||||
return;
|
||||
ApplyManuallySpecifiedSet();
|
||||
+ ApplyAllPolicyOverrides();
|
||||
std::move(on_load_complete_).Run(std::move(sets_));
|
||||
}
|
||||
|
||||
-} // namespace content
|
||||
+bool FirstPartySetsLoader::HasAllInputs() const {
|
||||
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
||||
+ return component_sets_parse_progress_ == Progress::kFinished &&
|
||||
+ manually_specified_set_.has_value();
|
||||
+}
|
||||
+
|
||||
+} // namespace content
|
||||
\ No newline at end of file
|
||||
diff --git a/content/browser/first_party_sets/first_party_sets_loader.h b/content/browser/first_party_sets/first_party_sets_loader.h
|
||||
index c27d2300c4c3533df91a8e814e89827bbd7d72ae..8588fe5f9922b36c9fe8e16ac16d02ccf00c8723 100644
|
||||
--- a/content/browser/first_party_sets/first_party_sets_loader.h
|
||||
+++ b/content/browser/first_party_sets/first_party_sets_loader.h
|
||||
@@ -57,6 +57,19 @@ class CONTENT_EXPORT FirstPartySetsLoader {
|
||||
// Close the file on thread pool that allows blocking.
|
||||
void DisposeFile(base::File sets_file);
|
||||
|
||||
+ // Handles addition sets which overlap by intersecting with the same existing
|
||||
+ // set, known as a transitive-overlap.
|
||||
+ //
|
||||
+ // This uses a Union-Find algorithm to select the earliest-provided addition
|
||||
+ // set as the representative of all other addition sets that
|
||||
+ // transitively-overlap with it.
|
||||
+ //
|
||||
+ // The "earliest-provided" tie-breaker is determined using a set's index in
|
||||
+ // `addition_sets`.
|
||||
+ static std::vector<SingleSet> NormalizeAdditionSets(
|
||||
+ const FlattenedSets& existing_sets,
|
||||
+ const std::vector<SingleSet>& addition_sets);
|
||||
+
|
||||
private:
|
||||
// Parses the contents of `raw_sets` as a collection of First-Party Set
|
||||
// declarations, and assigns to `sets_`.
|
||||
@@ -67,10 +80,42 @@ class CONTENT_EXPORT FirstPartySetsLoader {
|
||||
// `SetManuallySpecifiedSet`, and the public sets via `SetComponentSets`.
|
||||
void ApplyManuallySpecifiedSet();
|
||||
|
||||
+ // Removes the intersection between `sets_` and `override_sets` from the
|
||||
+ // `sets_` member variable, and then adds the `override_sets` into `sets_`.
|
||||
+ void ApplyReplacementOverrides(const std::vector<SingleSet>& override_sets);
|
||||
+
|
||||
+ // Updates the intersection between `sets_` and `override_sets` within the
|
||||
+ // `sets_` member variable, and then adds the `override_sets` into
|
||||
+ // `sets_`.
|
||||
+ //
|
||||
+ // The applied update ensures that invariants of First-Party Sets are
|
||||
+ // maintained, and that all sets in sets_ are disjoint.
|
||||
+ //
|
||||
+ // This will add in the `override_sets` into `sets_` without removing
|
||||
+ // any existing sites from the list of First-Party Sets.
|
||||
+ void ApplyAdditionOverrides(const std::vector<SingleSet>& override_sets);
|
||||
+
|
||||
+ // Removes all singletons (owners that have no members) from sets_.
|
||||
+ void RemoveAllSingletons();
|
||||
+
|
||||
+ // Applies the First-Party Sets overrides provided by policy.
|
||||
+ //
|
||||
+ // Must not be called until the loader has already received the public sets
|
||||
+ // via `SetComponentSets` and the CLI-provided sets have been applied to
|
||||
+ // `sets_`.
|
||||
+ //
|
||||
+ // Applies "Replacement" overrides before applying "Addition" overrides.
|
||||
+ void ApplyAllPolicyOverrides();
|
||||
+
|
||||
// Checks the required inputs have been received, and if so, invokes the
|
||||
// callback `on_load_complete_`, after merging sets appropriately.
|
||||
void MaybeFinishLoading();
|
||||
|
||||
+ // Returns true if all sources are present (Component Updater sets, CLI set,
|
||||
+ // and Policy sets). The Policy sets are provided at construction time, so
|
||||
+ // this effectively checks that the other two sources are ready.
|
||||
+ bool HasAllInputs() const;
|
||||
+
|
||||
// Represents the mapping of site -> site, where keys are members of sets,
|
||||
// and values are owners of the sets (explicitly including an entry of owner
|
||||
// -> owner).
|
||||
@@ -117,4 +162,4 @@ class CONTENT_EXPORT FirstPartySetsLoader {
|
||||
|
||||
} // namespace content
|
||||
|
||||
-#endif // CONTENT_BROWSER_FIRST_PARTY_SETS_FIRST_PARTY_SETS_LOADER_H_
|
||||
+#endif // CONTENT_BROWSER_FIRST_PARTY_SETS_FIRST_PARTY_SETS_LOADER_H_
|
||||
\ No newline at end of file
|
||||
diff --git a/content/public/browser/content_browser_client.cc b/content/public/browser/content_browser_client.cc
|
||||
index 16fb4946cb3ea2d097e8ed05bb340cc3f0782ed6..b751bf43d41a149579047faeec958646ecc3a5e0 100644
|
||||
--- a/content/public/browser/content_browser_client.cc
|
||||
+++ b/content/public/browser/content_browser_client.cc
|
||||
@@ -1327,6 +1327,10 @@ bool ContentBrowserClient::IsFirstPartySetsEnabled() {
|
||||
return base::FeatureList::IsEnabled(features::kFirstPartySets);
|
||||
}
|
||||
|
||||
+bool ContentBrowserClient::WillProvidePublicFirstPartySets() {
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
base::Value::Dict ContentBrowserClient::GetFirstPartySetsOverrides() {
|
||||
return base::Value::Dict();
|
||||
}
|
||||
diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h
|
||||
index 4db1e6c2dbea27249ca15d5660b7fcd8c6736ad1..8aac2a95a3ac66f0b0c180f46ec29ca7341a1d4c 100644
|
||||
--- a/content/public/browser/content_browser_client.h
|
||||
+++ b/content/public/browser/content_browser_client.h
|
||||
@@ -2227,6 +2227,16 @@ class CONTENT_EXPORT ContentBrowserClient {
|
||||
// should not change in a single browser session.
|
||||
virtual bool IsFirstPartySetsEnabled();
|
||||
|
||||
+ // Returns true iff the embedder will provide a list of First-Party Sets via
|
||||
+ // content::FirstPartySetsHandler::SetPublicFirstPartySets during startup, at
|
||||
+ // some point. If `IsFirstPartySetsEnabled()` returns false, this method will
|
||||
+ // still be called, but its return value will be ignored.
|
||||
+ //
|
||||
+ // If this method returns false but `IsFirstPartySetsEnabled()` returns true
|
||||
+ // (e.g. in tests), an empty list will be used instead of waiting for the
|
||||
+ // embedder to call content::FirstPartySetsHandler::SetPublicFirstPartySets.
|
||||
+ virtual bool WillProvidePublicFirstPartySets();
|
||||
+
|
||||
// Returns a base::Value::Dict containing the value of the First-Party Sets
|
||||
// Overrides enterprise policy.
|
||||
// If the policy was not present or it was invalid, this returns an empty
|
||||
diff --git a/content/public/browser/first_party_sets_handler.h b/content/public/browser/first_party_sets_handler.h
|
||||
index 8bd62717732a4afe1e8c02fd5ceb39bd1790e3e0..3ff5dea5612fe3329c7c612818f1436a980ea9e3 100644
|
||||
--- a/content/public/browser/first_party_sets_handler.h
|
||||
+++ b/content/public/browser/first_party_sets_handler.h
|
||||
@@ -72,7 +72,9 @@ class CONTENT_EXPORT FirstPartySetsHandler {
|
||||
//
|
||||
// Embedder should call this method as early as possible during browser
|
||||
// startup if First-Party Sets are enabled, since no First-Party Sets queries
|
||||
- // are answered until initialization is complete.
|
||||
+ // are answered until initialization is complete. Must not be called if
|
||||
+ // `ContentBrowserClient::WillProvidePublicFirstPartySets` returns false or
|
||||
+ // `ContentBrowserClient::IsFrstpartySetsEnabled` returns false.
|
||||
virtual void SetPublicFirstPartySets(base::File sets_file) = 0;
|
||||
|
||||
// Resets the state on the instance for testing.
|
||||
diff --git a/content/shell/browser/shell_browser_main_parts.cc b/content/shell/browser/shell_browser_main_parts.cc
|
||||
index 89040432c9f56d8285d8e9f59e1e0280abc25199..bd412789695f49253f67f237b2a92b8dee298e7a 100644
|
||||
--- a/content/shell/browser/shell_browser_main_parts.cc
|
||||
+++ b/content/shell/browser/shell_browser_main_parts.cc
|
||||
@@ -189,8 +189,6 @@ int ShellBrowserMainParts::PreMainMessageLoopRun() {
|
||||
net::NetModule::SetResourceProvider(PlatformResourceProvider);
|
||||
ShellDevToolsManagerDelegate::StartHttpHandler(browser_context_.get());
|
||||
InitializeMessageLoopContext();
|
||||
- // The First-Party Sets feature always expects to be initialized
|
||||
- FirstPartySetsHandler::GetInstance()->SetPublicFirstPartySets(base::File());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ we invoke it in order to expose contents.decrementCapturerCount([stayHidden, sta
|
||||
to users. We should try to upstream this.
|
||||
|
||||
diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h
|
||||
index 07355cb194bd429a693e587072d11432d6c0888a..b74b4209931c6acd6bc2e93a100c3e65a834ead9 100644
|
||||
index 2a29af8d9aa67768ec521e87190174397a25b722..7a5ce3038427756c26e38c91c5b3211a9a8999dd 100644
|
||||
--- a/content/browser/web_contents/web_contents_impl.h
|
||||
+++ b/content/browser/web_contents/web_contents_impl.h
|
||||
@@ -1828,7 +1828,7 @@ class CONTENT_EXPORT WebContentsImpl : public WebContents,
|
||||
|
||||
@@ -14,7 +14,7 @@ but it's not strictly necessary for this API to work to spec.
|
||||
Profile check has been upstreamed at https://chromium-review.googlesource.com/c/chromium/src/+/3247196
|
||||
|
||||
diff --git a/chrome/browser/ui/exclusive_access/fullscreen_controller.cc b/chrome/browser/ui/exclusive_access/fullscreen_controller.cc
|
||||
index 41cd193087f8d4f246993e96da96ea0523ab50ed..96cd17afad81037ce94ca3ea3583ebbbdd7f157b 100644
|
||||
index 467fed776d390e1a10075d62dab75fd8a6789627..5992117c90fbff008cf2f6a914f85c90ea117e47 100644
|
||||
--- a/chrome/browser/ui/exclusive_access/fullscreen_controller.cc
|
||||
+++ b/chrome/browser/ui/exclusive_access/fullscreen_controller.cc
|
||||
@@ -16,12 +16,16 @@
|
||||
@@ -34,7 +34,7 @@ index 41cd193087f8d4f246993e96da96ea0523ab50ed..96cd17afad81037ce94ca3ea3583ebbb
|
||||
#include "chrome/common/chrome_switches.h"
|
||||
#include "content/public/browser/navigation_details.h"
|
||||
#include "content/public/browser/navigation_entry.h"
|
||||
@@ -159,6 +163,7 @@ void FullscreenController::EnterFullscreenModeForTab(
|
||||
@@ -164,6 +168,7 @@ void FullscreenController::EnterFullscreenModeForTab(
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ index 41cd193087f8d4f246993e96da96ea0523ab50ed..96cd17afad81037ce94ca3ea3583ebbb
|
||||
if (base::FeatureList::IsEnabled(
|
||||
blink::features::kWindowPlacementFullscreenCompanionWindow)) {
|
||||
if (!popunder_preventer_)
|
||||
@@ -166,6 +171,7 @@ void FullscreenController::EnterFullscreenModeForTab(
|
||||
@@ -171,6 +176,7 @@ void FullscreenController::EnterFullscreenModeForTab(
|
||||
else
|
||||
popunder_preventer_->WillActivateWebContents(web_contents);
|
||||
}
|
||||
@@ -50,7 +50,7 @@ index 41cd193087f8d4f246993e96da96ea0523ab50ed..96cd17afad81037ce94ca3ea3583ebbb
|
||||
|
||||
// Keep the current state. |SetTabWithExclusiveAccess| may change the return
|
||||
// value of |IsWindowFullscreenForTabOrPending|.
|
||||
@@ -218,7 +224,9 @@ void FullscreenController::EnterFullscreenModeForTab(
|
||||
@@ -220,7 +226,9 @@ void FullscreenController::EnterFullscreenModeForTab(
|
||||
}
|
||||
|
||||
void FullscreenController::ExitFullscreenModeForTab(WebContents* web_contents) {
|
||||
@@ -60,7 +60,7 @@ index 41cd193087f8d4f246993e96da96ea0523ab50ed..96cd17afad81037ce94ca3ea3583ebbb
|
||||
|
||||
if (MaybeToggleFullscreenWithinTab(web_contents, false)) {
|
||||
// During tab capture of fullscreen-within-tab views, the browser window
|
||||
@@ -263,11 +271,13 @@ void FullscreenController::ExitFullscreenModeForTab(WebContents* web_contents) {
|
||||
@@ -275,11 +283,13 @@ void FullscreenController::ExitFullscreenModeForTab(WebContents* web_contents) {
|
||||
void FullscreenController::FullscreenTabOpeningPopup(
|
||||
content::WebContents* opener,
|
||||
content::WebContents* popup) {
|
||||
@@ -74,7 +74,7 @@ index 41cd193087f8d4f246993e96da96ea0523ab50ed..96cd17afad81037ce94ca3ea3583ebbb
|
||||
}
|
||||
|
||||
void FullscreenController::OnTabDeactivated(
|
||||
@@ -417,13 +427,9 @@ void FullscreenController::EnterFullscreenModeInternal(
|
||||
@@ -429,17 +439,15 @@ void FullscreenController::EnterFullscreenModeInternal(
|
||||
// Do not enter fullscreen mode if disallowed by pref. This prevents the user
|
||||
// from manually entering fullscreen mode and also disables kiosk mode on
|
||||
// desktop platforms.
|
||||
@@ -90,16 +90,22 @@ index 41cd193087f8d4f246993e96da96ea0523ab50ed..96cd17afad81037ce94ca3ea3583ebbb
|
||||
#endif
|
||||
|
||||
toggled_into_fullscreen_ = true;
|
||||
@@ -436,6 +442,7 @@ void FullscreenController::EnterFullscreenModeInternal(
|
||||
+#if 0
|
||||
bool entering_tab_fullscreen = option == TAB && !tab_fullscreen_;
|
||||
+#endif
|
||||
GURL url;
|
||||
if (option == TAB) {
|
||||
url = GetRequestingOrigin();
|
||||
@@ -449,6 +457,7 @@ void FullscreenController::EnterFullscreenModeInternal(
|
||||
url = extension_caused_fullscreen_;
|
||||
}
|
||||
|
||||
+#if 0
|
||||
if (display_id != display::kInvalidDisplayId) {
|
||||
if (option == TAB && display_id != display::kInvalidDisplayId) {
|
||||
// Check, but do not prompt, for permission to request a specific screen.
|
||||
// Sites generally need permission to get the display id in the first place.
|
||||
@@ -449,6 +456,7 @@ void FullscreenController::EnterFullscreenModeInternal(
|
||||
display_id = display::kInvalidDisplayId;
|
||||
@@ -466,6 +475,7 @@ void FullscreenController::EnterFullscreenModeInternal(
|
||||
GetDisplayId(WebContents::FromRenderFrameHost(requesting_frame));
|
||||
}
|
||||
}
|
||||
+#endif
|
||||
@@ -107,10 +113,10 @@ index 41cd193087f8d4f246993e96da96ea0523ab50ed..96cd17afad81037ce94ca3ea3583ebbb
|
||||
if (option == BROWSER)
|
||||
base::RecordAction(base::UserMetricsAction("ToggleFullscreen"));
|
||||
diff --git a/chrome/browser/ui/exclusive_access/fullscreen_controller.h b/chrome/browser/ui/exclusive_access/fullscreen_controller.h
|
||||
index 7bd40f52ef5f6b04a7ea114ec4d18c8a98ec6d42..fb04fed5cc1e2e255c9e67c180fababe1fbb3fe0 100644
|
||||
index 58a1ff5fb9fecd8c85905045ba43f43f0c63c2bb..15f868ac651c05eae6505adb80f2b4573a1166ef 100644
|
||||
--- a/chrome/browser/ui/exclusive_access/fullscreen_controller.h
|
||||
+++ b/chrome/browser/ui/exclusive_access/fullscreen_controller.h
|
||||
@@ -222,10 +222,12 @@ class FullscreenController : public ExclusiveAccessControllerBase {
|
||||
@@ -224,10 +224,12 @@ class FullscreenController : public ExclusiveAccessControllerBase {
|
||||
// Used in testing to set the state to tab fullscreen.
|
||||
bool is_tab_fullscreen_for_testing_ = false;
|
||||
|
||||
|
||||
@@ -6,10 +6,10 @@ Subject: frame_host_manager.patch
|
||||
Allows embedder to intercept site instances created by chromium.
|
||||
|
||||
diff --git a/content/browser/renderer_host/render_frame_host_manager.cc b/content/browser/renderer_host/render_frame_host_manager.cc
|
||||
index 390ac74f01b5080880dcab65537a22fb7ef0cc41..103dc143f6310a2b9f0a834f7d25cf32207bea86 100644
|
||||
index b17180351e6e693352fcda973bdc23da79d8bfac..307ea58a72fe05f283b2cdfd6027625f96c5a99b 100644
|
||||
--- a/content/browser/renderer_host/render_frame_host_manager.cc
|
||||
+++ b/content/browser/renderer_host/render_frame_host_manager.cc
|
||||
@@ -3180,6 +3180,9 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest(
|
||||
@@ -3167,6 +3167,9 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest(
|
||||
request->ResetStateForSiteInstanceChange();
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ If removing this patch causes no sync failures, it's safe to delete :+1:
|
||||
Ref https://chromium-review.googlesource.com/c/chromium/src/+/2953903
|
||||
|
||||
diff --git a/tools/clang/scripts/update.py b/tools/clang/scripts/update.py
|
||||
index 694a67b7a0f622c7a8bfc1d46148398140d51384..00b588b268aa059ff84adbbc6ae266aa67e174b1 100755
|
||||
index 6bd25626dc999438316c2084442a29389d4154fb..bc27370e73d3061dfacbd96a3b8cf576b94e3d9b 100755
|
||||
--- a/tools/clang/scripts/update.py
|
||||
+++ b/tools/clang/scripts/update.py
|
||||
@@ -298,6 +298,8 @@ def GetDefaultHostOs():
|
||||
|
||||
@@ -167,7 +167,7 @@ index 961c759eca96ffc0ffcf40cfdaf42388f47d9c2b..18c77a5520ea2ae7cfee4eea3ed01fa8
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
diff --git a/ui/base/BUILD.gn b/ui/base/BUILD.gn
|
||||
index 244b208e6a7872ea4d25fcf74a78abc9248a9ac3..45bafcaaa10641ca3a8306a6685ee9ed730d1e02 100644
|
||||
index 028a97becd88fb12481b1de0395c7c81857d3af3..4491be85cb82f050cc70c24e933e841a08b9123f 100644
|
||||
--- a/ui/base/BUILD.gn
|
||||
+++ b/ui/base/BUILD.gn
|
||||
@@ -319,6 +319,13 @@ component("base") {
|
||||
@@ -205,7 +205,7 @@ index e7adfee3210ec723c687adfcc4bee8827ef643e7..25a924a47eeb30d783ef83dbb4896c4b
|
||||
+
|
||||
#endif // UI_BASE_COCOA_REMOTE_ACCESSIBILITY_API_H_
|
||||
diff --git a/ui/views/cocoa/native_widget_mac_ns_window_host.h b/ui/views/cocoa/native_widget_mac_ns_window_host.h
|
||||
index d4051a7a8755c7b10d4df3746cb2857471f07c45..de04616893d1c97e3607eb5a4b942733ae597b05 100644
|
||||
index c93aedbce83c398a55c478df60d5ba6dd5324a0b..dfa1983e5605d14e44efae3c1418b4e53c392333 100644
|
||||
--- a/ui/views/cocoa/native_widget_mac_ns_window_host.h
|
||||
+++ b/ui/views/cocoa/native_widget_mac_ns_window_host.h
|
||||
@@ -31,7 +31,9 @@
|
||||
@@ -218,7 +218,7 @@ index d4051a7a8755c7b10d4df3746cb2857471f07c45..de04616893d1c97e3607eb5a4b942733
|
||||
@class NSView;
|
||||
|
||||
namespace remote_cocoa {
|
||||
@@ -449,11 +451,13 @@ class VIEWS_EXPORT NativeWidgetMacNSWindowHost
|
||||
@@ -452,11 +454,13 @@ class VIEWS_EXPORT NativeWidgetMacNSWindowHost
|
||||
mojo::AssociatedRemote<remote_cocoa::mojom::NativeWidgetNSWindow>
|
||||
remote_ns_window_remote_;
|
||||
|
||||
@@ -233,10 +233,10 @@ index d4051a7a8755c7b10d4df3746cb2857471f07c45..de04616893d1c97e3607eb5a4b942733
|
||||
// Used to force the NSApplication's focused accessibility element to be the
|
||||
// views::Views accessibility tree when the NSView for this is focused.
|
||||
diff --git a/ui/views/cocoa/native_widget_mac_ns_window_host.mm b/ui/views/cocoa/native_widget_mac_ns_window_host.mm
|
||||
index c9294c5358401da716b6d8d2846e20e9a04f4e2d..c9a3cdee33e3aa8bfbfa9c6678c2828a94b90061 100644
|
||||
index 1c4c4a774e4d5e199ae50e8df4499a497d3b0674..b2265079021d10e2944b9474fafe32ccca95d3de 100644
|
||||
--- a/ui/views/cocoa/native_widget_mac_ns_window_host.mm
|
||||
+++ b/ui/views/cocoa/native_widget_mac_ns_window_host.mm
|
||||
@@ -297,14 +297,22 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
|
||||
@@ -296,14 +296,22 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
|
||||
NativeWidgetMacNSWindowHost::GetNativeViewAccessibleForNSView() const {
|
||||
if (in_process_ns_window_bridge_)
|
||||
return in_process_ns_window_bridge_->ns_view();
|
||||
@@ -259,7 +259,7 @@ index c9294c5358401da716b6d8d2846e20e9a04f4e2d..c9a3cdee33e3aa8bfbfa9c6678c2828a
|
||||
}
|
||||
|
||||
remote_cocoa::mojom::NativeWidgetNSWindow*
|
||||
@@ -1288,6 +1296,7 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
|
||||
@@ -1287,6 +1295,7 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
|
||||
void NativeWidgetMacNSWindowHost::SetRemoteAccessibilityTokens(
|
||||
const std::vector<uint8_t>& window_token,
|
||||
const std::vector<uint8_t>& view_token) {
|
||||
@@ -267,7 +267,7 @@ index c9294c5358401da716b6d8d2846e20e9a04f4e2d..c9a3cdee33e3aa8bfbfa9c6678c2828a
|
||||
remote_window_accessible_ =
|
||||
ui::RemoteAccessibility::GetRemoteElementFromToken(window_token);
|
||||
remote_view_accessible_ =
|
||||
@@ -1295,14 +1304,17 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
|
||||
@@ -1294,14 +1303,17 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
|
||||
[remote_view_accessible_ setWindowUIElement:remote_window_accessible_.get()];
|
||||
[remote_view_accessible_
|
||||
setTopLevelUIElement:remote_window_accessible_.get()];
|
||||
|
||||
@@ -122,7 +122,7 @@ index c15f3a631292b538698625328fb429ee3c9964f5..37e038753ecf1b82ec92c06b2c0729b5
|
||||
}
|
||||
|
||||
diff --git a/device/bluetooth/bluetooth_adapter_mac.mm b/device/bluetooth/bluetooth_adapter_mac.mm
|
||||
index 3f7dce0281f7b5a540d7b9377ef14a8a6aa9a2fa..11d8419791f3e45d5242081422d452d4fc703833 100644
|
||||
index d342eb4e9fc94de4365d86c2d1af4b85a8bf63a3..012f9ce97d9ed6b00deb718a88f432e053cb3bd1 100644
|
||||
--- a/device/bluetooth/bluetooth_adapter_mac.mm
|
||||
+++ b/device/bluetooth/bluetooth_adapter_mac.mm
|
||||
@@ -42,6 +42,7 @@
|
||||
|
||||
@@ -7,10 +7,10 @@ This adds a callback from the network service that's used to implement
|
||||
session.setCertificateVerifyCallback.
|
||||
|
||||
diff --git a/services/network/network_context.cc b/services/network/network_context.cc
|
||||
index e9a56db142f5f31e567bff7414db110f600fc7f2..98268925da14d61256f8dee3aa899f17ce7acaf6 100644
|
||||
index ecc38d1584570c46826084054f0a3249f9e2eb92..f06a04983571623b542dba11933c4c95c3dcf398 100644
|
||||
--- a/services/network/network_context.cc
|
||||
+++ b/services/network/network_context.cc
|
||||
@@ -127,6 +127,11 @@
|
||||
@@ -128,6 +128,11 @@
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
#include "url/gurl.h"
|
||||
|
||||
@@ -22,7 +22,7 @@ index e9a56db142f5f31e567bff7414db110f600fc7f2..98268925da14d61256f8dee3aa899f17
|
||||
#if BUILDFLAG(IS_CT_SUPPORTED)
|
||||
#include "components/certificate_transparency/chrome_ct_policy_enforcer.h"
|
||||
#include "components/certificate_transparency/chrome_require_ct_delegate.h"
|
||||
@@ -435,6 +440,91 @@ bool GetFullDataFilePath(
|
||||
@@ -436,6 +441,91 @@ bool GetFullDataFilePath(
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -114,7 +114,7 @@ index e9a56db142f5f31e567bff7414db110f600fc7f2..98268925da14d61256f8dee3aa899f17
|
||||
constexpr uint32_t NetworkContext::kMaxOutstandingRequestsPerProcess;
|
||||
|
||||
NetworkContext::PendingCertVerify::PendingCertVerify() = default;
|
||||
@@ -732,6 +822,13 @@ void NetworkContext::SetClient(
|
||||
@@ -733,6 +823,13 @@ void NetworkContext::SetClient(
|
||||
client_.Bind(std::move(client));
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ index e9a56db142f5f31e567bff7414db110f600fc7f2..98268925da14d61256f8dee3aa899f17
|
||||
void NetworkContext::CreateURLLoaderFactory(
|
||||
mojo::PendingReceiver<mojom::URLLoaderFactory> receiver,
|
||||
mojom::URLLoaderFactoryParamsPtr params) {
|
||||
@@ -2298,6 +2395,9 @@ URLRequestContextOwner NetworkContext::MakeURLRequestContext(
|
||||
@@ -2301,6 +2398,9 @@ URLRequestContextOwner NetworkContext::MakeURLRequestContext(
|
||||
std::move(cert_verifier));
|
||||
cert_verifier = base::WrapUnique(cert_verifier_with_trust_anchors_);
|
||||
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||
@@ -139,10 +139,10 @@ index e9a56db142f5f31e567bff7414db110f600fc7f2..98268925da14d61256f8dee3aa899f17
|
||||
|
||||
builder.SetCertVerifier(IgnoreErrorsCertVerifier::MaybeWrapCertVerifier(
|
||||
diff --git a/services/network/network_context.h b/services/network/network_context.h
|
||||
index 53e3f293150e725cd1261f09a8f9bfcb5371a76c..58671094857cdfe5d853c8a284d51bc1b8a09660 100644
|
||||
index 994712b56fb25fbfa7559ac034cfd7e1c76597de..2cd8707b120deb41683e13def5d446fd3bf93afe 100644
|
||||
--- a/services/network/network_context.h
|
||||
+++ b/services/network/network_context.h
|
||||
@@ -108,6 +108,7 @@ class URLMatcher;
|
||||
@@ -109,6 +109,7 @@ class URLMatcher;
|
||||
|
||||
namespace network {
|
||||
class CertVerifierWithTrustAnchors;
|
||||
|
||||
@@ -130,10 +130,10 @@ index 69f000e5cd25c6d89c88238873f638923bafdf0e..4f0068a92a0e99e2b34f105954689c7b
|
||||
const GURL& document_url,
|
||||
mojo::PendingReceiver<blink::mojom::NotificationService> receiver);
|
||||
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
|
||||
index b769a06dc9443317a1073738c6fd38816ebeb186..20a697be32f7e27a9fa33d0225c94520aa5ebf2e 100644
|
||||
index b74b4c2028ccb22349253960b9aa6c5bfe87579c..396377fd4041cced3c68f8d57c8f868098bb8923 100644
|
||||
--- a/content/browser/renderer_host/render_process_host_impl.cc
|
||||
+++ b/content/browser/renderer_host/render_process_host_impl.cc
|
||||
@@ -2083,7 +2083,8 @@ void RenderProcessHostImpl::CreateNotificationService(
|
||||
@@ -2088,7 +2088,8 @@ void RenderProcessHostImpl::CreateNotificationService(
|
||||
document_url = rfh->GetLastCommittedURL();
|
||||
|
||||
storage_partition_impl_->GetPlatformNotificationContext()->CreateService(
|
||||
|
||||
@@ -8,10 +8,10 @@ needed in chromium but our autofill implementation uses them. This patch can be
|
||||
our autofill implementation to work like Chromium's.
|
||||
|
||||
diff --git a/ui/color/color_id.h b/ui/color/color_id.h
|
||||
index d1a9c517a69bcc79a4b42f8eb8b6fcc3cea2f4da..04569140589c25d37bad2cd5ff979cfc6b1f3f43 100644
|
||||
index 13c1a8c9760fa0f286c6c5adc8f74fdae910ab50..b7a967642ff059c97f55002a9a0962709d806959 100644
|
||||
--- a/ui/color/color_id.h
|
||||
+++ b/ui/color/color_id.h
|
||||
@@ -125,6 +125,16 @@
|
||||
@@ -128,6 +128,16 @@
|
||||
E_CPONLY(kColorOverlayScrollbarStrokeHoveredDark) \
|
||||
E_CPONLY(kColorOverlayScrollbarStrokeHoveredLight) \
|
||||
E_CPONLY(kColorProgressBar) \
|
||||
@@ -28,7 +28,7 @@ index d1a9c517a69bcc79a4b42f8eb8b6fcc3cea2f4da..04569140589c25d37bad2cd5ff979cfc
|
||||
E_CPONLY(kColorSeparator) \
|
||||
E_CPONLY(kColorShadowBase) \
|
||||
E_CPONLY(kColorShadowValueAmbientShadowElevationSixteen) \
|
||||
@@ -177,6 +187,7 @@
|
||||
@@ -180,6 +190,7 @@
|
||||
E_CPONLY(kColorTreeNodeForeground) \
|
||||
E_CPONLY(kColorTreeNodeForegroundSelectedFocused) \
|
||||
E_CPONLY(kColorTreeNodeForegroundSelectedUnfocused) \
|
||||
@@ -37,10 +37,10 @@ index d1a9c517a69bcc79a4b42f8eb8b6fcc3cea2f4da..04569140589c25d37bad2cd5ff979cfc
|
||||
|
||||
#if BUILDFLAG(IS_CHROMEOS)
|
||||
diff --git a/ui/color/ui_color_mixer.cc b/ui/color/ui_color_mixer.cc
|
||||
index b404ef6063c3a6c542565de46458b7401f129963..ce6fca0516d91b8acfe5fe6bc89bc09ae03a17d6 100644
|
||||
index 3e44d34fe1317822c340ebbcc895d7d8b55bed0b..be1737a96058c29d03645cc00999b6d7fc315f48 100644
|
||||
--- a/ui/color/ui_color_mixer.cc
|
||||
+++ b/ui/color/ui_color_mixer.cc
|
||||
@@ -143,6 +143,17 @@ void AddUiColorMixer(ColorProvider* provider,
|
||||
@@ -148,6 +148,17 @@ void AddUiColorMixer(ColorProvider* provider,
|
||||
SetAlpha(GetColorWithMaxContrast(kColorOverlayScrollbarFillHoveredLight),
|
||||
gfx::kGoogleGreyAlpha500);
|
||||
mixer[kColorProgressBar] = {kColorAccent};
|
||||
@@ -58,7 +58,7 @@ index b404ef6063c3a6c542565de46458b7401f129963..ce6fca0516d91b8acfe5fe6bc89bc09a
|
||||
mixer[kColorSeparator] = {kColorMidground};
|
||||
mixer[kColorShadowBase] = {dark_mode ? SK_ColorBLACK : gfx::kGoogleGrey800};
|
||||
mixer[kColorShadowValueAmbientShadowElevationThree] =
|
||||
@@ -218,6 +229,7 @@ void AddUiColorMixer(ColorProvider* provider,
|
||||
@@ -223,6 +234,7 @@ void AddUiColorMixer(ColorProvider* provider,
|
||||
mixer[kColorTreeNodeForegroundSelectedFocused] = {kColorTreeNodeForeground};
|
||||
mixer[kColorTreeNodeForegroundSelectedUnfocused] = {
|
||||
kColorTreeNodeForegroundSelectedFocused};
|
||||
|
||||
@@ -11,7 +11,7 @@ majority of changes originally come from these PRs:
|
||||
This patch also fixes callback for manual user cancellation and success.
|
||||
|
||||
diff --git a/chrome/browser/printing/print_job.cc b/chrome/browser/printing/print_job.cc
|
||||
index 8d40bbf98d4d58704f118cb42039b0956a9f6639..06196c0fa02012a5faa82471bd39fac087918f54 100644
|
||||
index 6408cbee8b5a8e45c4276ed966b57c1e61ad1137..e951c41a1bd92a33e32f6835841d3935a05dde53 100644
|
||||
--- a/chrome/browser/printing/print_job.cc
|
||||
+++ b/chrome/browser/printing/print_job.cc
|
||||
@@ -89,6 +89,7 @@ bool PrintWithReducedRasterization(PrefService* prefs) {
|
||||
@@ -30,7 +30,7 @@ index 8d40bbf98d4d58704f118cb42039b0956a9f6639..06196c0fa02012a5faa82471bd39fac0
|
||||
|
||||
#endif // BUILDFLAG(IS_WIN)
|
||||
|
||||
@@ -356,8 +358,10 @@ void PrintJob::StartPdfToEmfConversion(
|
||||
@@ -360,8 +362,10 @@ void PrintJob::StartPdfToEmfConversion(
|
||||
|
||||
const PrintSettings& settings = document()->settings();
|
||||
|
||||
@@ -42,7 +42,7 @@ index 8d40bbf98d4d58704f118cb42039b0956a9f6639..06196c0fa02012a5faa82471bd39fac0
|
||||
|
||||
using RenderMode = PdfRenderSettings::Mode;
|
||||
RenderMode mode = print_with_reduced_rasterization
|
||||
@@ -447,8 +451,10 @@ void PrintJob::StartPdfToPostScriptConversion(
|
||||
@@ -451,8 +455,10 @@ void PrintJob::StartPdfToPostScriptConversion(
|
||||
if (ps_level2) {
|
||||
mode = PdfRenderSettings::Mode::POSTSCRIPT_LEVEL2;
|
||||
} else {
|
||||
@@ -54,22 +54,8 @@ index 8d40bbf98d4d58704f118cb42039b0956a9f6639..06196c0fa02012a5faa82471bd39fac0
|
||||
? PdfRenderSettings::Mode::POSTSCRIPT_LEVEL3_WITH_TYPE42_FONTS
|
||||
: PdfRenderSettings::Mode::POSTSCRIPT_LEVEL3;
|
||||
}
|
||||
diff --git a/chrome/browser/printing/print_job.h b/chrome/browser/printing/print_job.h
|
||||
index 650c78f16c812170aeda99d75300ff88f47347a0..c33ce445a23f97a744db3a4ac30ef471c359553b 100644
|
||||
--- a/chrome/browser/printing/print_job.h
|
||||
+++ b/chrome/browser/printing/print_job.h
|
||||
@@ -261,6 +261,9 @@ class JobEventDetails : public base::RefCountedThreadSafe<JobEventDetails> {
|
||||
public:
|
||||
// Event type.
|
||||
enum Type {
|
||||
+ // Print... dialog box has been closed with CANCEL button.
|
||||
+ USER_INIT_CANCELED,
|
||||
+
|
||||
// A new document started printing.
|
||||
NEW_DOC,
|
||||
|
||||
diff --git a/chrome/browser/printing/print_job_worker.cc b/chrome/browser/printing/print_job_worker.cc
|
||||
index f989f040cb9ff6df001225057202fb1653ade9fc..9430feb1d90667bbdbbb2c9f419936c9fb679dca 100644
|
||||
index 86770178101d411bdf84617678c65a4a29ddbb5c..16e1fe8fc650fba441bcc7e467d58e0071dbc945 100644
|
||||
--- a/chrome/browser/printing/print_job_worker.cc
|
||||
+++ b/chrome/browser/printing/print_job_worker.cc
|
||||
@@ -20,7 +20,6 @@
|
||||
@@ -88,7 +74,7 @@ index f989f040cb9ff6df001225057202fb1653ade9fc..9430feb1d90667bbdbbb2c9f419936c9
|
||||
#include "printing/backend/print_backend.h"
|
||||
#include "printing/buildflags/buildflags.h"
|
||||
#include "printing/mojom/print.mojom.h"
|
||||
@@ -230,16 +230,21 @@ void PrintJobWorker::UpdatePrintSettings(base::Value new_settings,
|
||||
@@ -229,16 +229,21 @@ void PrintJobWorker::UpdatePrintSettings(base::Value::Dict new_settings,
|
||||
#endif // BUILDFLAG(IS_LINUX) && defined(USE_CUPS)
|
||||
}
|
||||
|
||||
@@ -114,10 +100,10 @@ index f989f040cb9ff6df001225057202fb1653ade9fc..9430feb1d90667bbdbbb2c9f419936c9
|
||||
|
||||
#if BUILDFLAG(IS_CHROMEOS)
|
||||
diff --git a/chrome/browser/printing/print_job_worker_oop.cc b/chrome/browser/printing/print_job_worker_oop.cc
|
||||
index 02dfcad0c6b208f7df4d2b10112739554f6ab75c..0774aa95ee1521b0e76fe72d8d9e8de4540f0ff1 100644
|
||||
index dd27bbf387718d6abda5080e7d2c609cd0eaff17..8837cf2aeaa2f87d51be8d00aa356c8a2c5e15c7 100644
|
||||
--- a/chrome/browser/printing/print_job_worker_oop.cc
|
||||
+++ b/chrome/browser/printing/print_job_worker_oop.cc
|
||||
@@ -331,7 +331,7 @@ void PrintJobWorkerOop::OnFailure() {
|
||||
@@ -345,7 +345,7 @@ void PrintJobWorkerOop::OnFailure() {
|
||||
}
|
||||
|
||||
void PrintJobWorkerOop::ShowErrorDialog() {
|
||||
@@ -127,7 +113,7 @@ index 02dfcad0c6b208f7df4d2b10112739554f6ab75c..0774aa95ee1521b0e76fe72d8d9e8de4
|
||||
|
||||
void PrintJobWorkerOop::UnregisterServiceManagerClient() {
|
||||
diff --git a/chrome/browser/printing/print_view_manager_base.cc b/chrome/browser/printing/print_view_manager_base.cc
|
||||
index 3a3f733c45e08e461a74d2458172c38ec0e572bf..2c04243257e72825a7fa6d8956045cb4a81d835e 100644
|
||||
index fb69efbfa8e355f8389abf9490cf338e70f16c7b..52099b2312b042b0afdd5ee3d2df5c66ea25df8b 100644
|
||||
--- a/chrome/browser/printing/print_view_manager_base.cc
|
||||
+++ b/chrome/browser/printing/print_view_manager_base.cc
|
||||
@@ -30,10 +30,10 @@
|
||||
@@ -143,15 +129,15 @@ index 3a3f733c45e08e461a74d2458172c38ec0e572bf..2c04243257e72825a7fa6d8956045cb4
|
||||
#include "components/prefs/pref_service.h"
|
||||
#include "components/printing/browser/print_composite_client.h"
|
||||
#include "components/printing/browser/print_manager_utils.h"
|
||||
@@ -49,6 +49,7 @@
|
||||
@@ -48,6 +48,7 @@
|
||||
#include "content/public/browser/render_frame_host.h"
|
||||
#include "content/public/browser/render_process_host.h"
|
||||
#include "content/public/browser/render_view_host.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
+#include "electron/grit/electron_resources.h"
|
||||
#include "mojo/public/cpp/system/buffer.h"
|
||||
#include "printing/buildflags/buildflags.h"
|
||||
#include "printing/metafile_skia.h"
|
||||
@@ -88,6 +89,8 @@ using PrintSettingsCallback =
|
||||
@@ -87,6 +88,8 @@ using PrintSettingsCallback =
|
||||
base::OnceCallback<void(std::unique_ptr<PrinterQuery>)>;
|
||||
|
||||
void ShowWarningMessageBox(const std::u16string& message) {
|
||||
@@ -160,7 +146,7 @@ index 3a3f733c45e08e461a74d2458172c38ec0e572bf..2c04243257e72825a7fa6d8956045cb4
|
||||
// Runs always on the UI thread.
|
||||
static bool is_dialog_shown = false;
|
||||
if (is_dialog_shown)
|
||||
@@ -96,6 +99,7 @@ void ShowWarningMessageBox(const std::u16string& message) {
|
||||
@@ -95,6 +98,7 @@ void ShowWarningMessageBox(const std::u16string& message) {
|
||||
base::AutoReset<bool> auto_reset(&is_dialog_shown, true);
|
||||
|
||||
chrome::ShowWarningMessageBox(nullptr, std::u16string(), message);
|
||||
@@ -168,7 +154,7 @@ index 3a3f733c45e08e461a74d2458172c38ec0e572bf..2c04243257e72825a7fa6d8956045cb4
|
||||
}
|
||||
|
||||
#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
||||
@@ -193,7 +197,9 @@ void UpdatePrintSettingsReplyOnIO(
|
||||
@@ -192,7 +196,9 @@ void UpdatePrintSettingsReplyOnIO(
|
||||
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
|
||||
DCHECK(printer_query);
|
||||
mojom::PrintPagesParamsPtr params = CreateEmptyPrintPagesParamsPtr();
|
||||
@@ -179,7 +165,7 @@ index 3a3f733c45e08e461a74d2458172c38ec0e572bf..2c04243257e72825a7fa6d8956045cb4
|
||||
RenderParamsFromPrintSettings(printer_query->settings(),
|
||||
params->params.get());
|
||||
params->params->document_cookie = printer_query->cookie();
|
||||
@@ -246,6 +252,7 @@ void ScriptedPrintReplyOnIO(
|
||||
@@ -245,6 +251,7 @@ void ScriptedPrintReplyOnIO(
|
||||
mojom::PrintManagerHost::ScriptedPrintCallback callback) {
|
||||
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
|
||||
mojom::PrintPagesParamsPtr params = CreateEmptyPrintPagesParamsPtr();
|
||||
@@ -187,7 +173,7 @@ index 3a3f733c45e08e461a74d2458172c38ec0e572bf..2c04243257e72825a7fa6d8956045cb4
|
||||
if (printer_query->last_status() == mojom::ResultCode::kSuccess &&
|
||||
printer_query->settings().dpi()) {
|
||||
RenderParamsFromPrintSettings(printer_query->settings(),
|
||||
@@ -255,8 +262,9 @@ void ScriptedPrintReplyOnIO(
|
||||
@@ -254,8 +261,9 @@ void ScriptedPrintReplyOnIO(
|
||||
}
|
||||
bool has_valid_cookie = params->params->document_cookie;
|
||||
bool has_dpi = !params->params->dpi.IsEmpty();
|
||||
@@ -198,7 +184,7 @@ index 3a3f733c45e08e461a74d2458172c38ec0e572bf..2c04243257e72825a7fa6d8956045cb4
|
||||
|
||||
if (has_dpi && has_valid_cookie) {
|
||||
queue->QueuePrinterQuery(std::move(printer_query));
|
||||
@@ -294,12 +302,14 @@ PrintViewManagerBase::PrintViewManagerBase(content::WebContents* web_contents)
|
||||
@@ -293,12 +301,14 @@ PrintViewManagerBase::PrintViewManagerBase(content::WebContents* web_contents)
|
||||
: PrintManager(web_contents),
|
||||
queue_(g_browser_process->print_job_manager()->queue()) {
|
||||
DCHECK(queue_);
|
||||
@@ -213,30 +199,29 @@ index 3a3f733c45e08e461a74d2458172c38ec0e572bf..2c04243257e72825a7fa6d8956045cb4
|
||||
}
|
||||
|
||||
PrintViewManagerBase::~PrintViewManagerBase() {
|
||||
@@ -307,7 +317,10 @@ PrintViewManagerBase::~PrintViewManagerBase() {
|
||||
@@ -306,7 +316,10 @@ PrintViewManagerBase::~PrintViewManagerBase() {
|
||||
DisconnectFromCurrentPrintJob();
|
||||
}
|
||||
|
||||
-bool PrintViewManagerBase::PrintNow(content::RenderFrameHost* rfh) {
|
||||
+bool PrintViewManagerBase::PrintNow(content::RenderFrameHost* rfh,
|
||||
+ bool silent,
|
||||
+ base::Value settings,
|
||||
+ base::Value::Dict settings,
|
||||
+ CompletionCallback callback) {
|
||||
// Remember the ID for `rfh`, to enable checking that the `RenderFrameHost`
|
||||
// is still valid after a possible inner message loop runs in
|
||||
// `DisconnectFromCurrentPrintJob()`.
|
||||
@@ -333,7 +346,9 @@ bool PrintViewManagerBase::PrintNow(content::RenderFrameHost* rfh) {
|
||||
@@ -332,6 +345,9 @@ bool PrintViewManagerBase::PrintNow(content::RenderFrameHost* rfh) {
|
||||
#endif
|
||||
|
||||
SetPrintingRFH(rfh);
|
||||
- GetPrintRenderFrame(rfh)->PrintRequestedPages();
|
||||
+ callback_ = std::move(callback);
|
||||
+
|
||||
+ GetPrintRenderFrame(rfh)->PrintRequestedPages(silent, std::move(settings));
|
||||
|
||||
for (auto& observer : GetObservers())
|
||||
observer.OnPrintNow(rfh);
|
||||
@@ -486,7 +501,8 @@ void PrintViewManagerBase::GetDefaultPrintSettingsReply(
|
||||
#if BUILDFLAG(ENABLE_PRINT_CONTENT_ANALYSIS)
|
||||
enterprise_connectors::ContentAnalysisDelegate::Data scanning_data;
|
||||
@@ -500,7 +516,8 @@ void PrintViewManagerBase::GetDefaultPrintSettingsReply(
|
||||
void PrintViewManagerBase::ScriptedPrintReply(
|
||||
ScriptedPrintCallback callback,
|
||||
int process_id,
|
||||
@@ -246,7 +231,7 @@ index 3a3f733c45e08e461a74d2458172c38ec0e572bf..2c04243257e72825a7fa6d8956045cb4
|
||||
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
||||
|
||||
#if BUILDFLAG(ENABLE_OOP_PRINTING)
|
||||
@@ -499,16 +515,19 @@ void PrintViewManagerBase::ScriptedPrintReply(
|
||||
@@ -513,16 +530,19 @@ void PrintViewManagerBase::ScriptedPrintReply(
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -270,7 +255,7 @@ index 3a3f733c45e08e461a74d2458172c38ec0e572bf..2c04243257e72825a7fa6d8956045cb4
|
||||
}
|
||||
|
||||
void PrintViewManagerBase::NavigationStopped() {
|
||||
@@ -624,11 +643,14 @@ void PrintViewManagerBase::DidPrintDocument(
|
||||
@@ -638,11 +658,14 @@ void PrintViewManagerBase::DidPrintDocument(
|
||||
void PrintViewManagerBase::GetDefaultPrintSettings(
|
||||
GetDefaultPrintSettingsCallback callback) {
|
||||
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
||||
@@ -285,8 +270,8 @@ index 3a3f733c45e08e461a74d2458172c38ec0e572bf..2c04243257e72825a7fa6d8956045cb4
|
||||
#if BUILDFLAG(ENABLE_OOP_PRINTING)
|
||||
if (printing::features::kEnableOopPrintDriversJobPrint.Get() &&
|
||||
!service_manager_client_id_.has_value()) {
|
||||
@@ -658,18 +680,20 @@ void PrintViewManagerBase::UpdatePrintSettings(
|
||||
base::Value job_settings,
|
||||
@@ -672,18 +695,20 @@ void PrintViewManagerBase::UpdatePrintSettings(
|
||||
base::Value::Dict job_settings,
|
||||
UpdatePrintSettingsCallback callback) {
|
||||
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
||||
+#if 0 // Printing is always enabled.
|
||||
@@ -297,7 +282,7 @@ index 3a3f733c45e08e461a74d2458172c38ec0e572bf..2c04243257e72825a7fa6d8956045cb4
|
||||
}
|
||||
-
|
||||
+#endif
|
||||
if (!job_settings.FindIntKey(kSettingPrinterType)) {
|
||||
if (!job_settings.FindInt(kSettingPrinterType)) {
|
||||
UpdatePrintSettingsReply(std::move(callback),
|
||||
CreateEmptyPrintPagesParamsPtr(), false);
|
||||
return;
|
||||
@@ -307,15 +292,15 @@ index 3a3f733c45e08e461a74d2458172c38ec0e572bf..2c04243257e72825a7fa6d8956045cb4
|
||||
content::BrowserContext* context =
|
||||
web_contents() ? web_contents()->GetBrowserContext() : nullptr;
|
||||
PrefService* prefs =
|
||||
@@ -679,6 +703,7 @@ void PrintViewManagerBase::UpdatePrintSettings(
|
||||
@@ -693,6 +718,7 @@ void PrintViewManagerBase::UpdatePrintSettings(
|
||||
if (value > 0)
|
||||
job_settings.SetIntKey(kSettingRasterizePdfDpi, value);
|
||||
job_settings.Set(kSettingRasterizePdfDpi, value);
|
||||
}
|
||||
+#endif
|
||||
|
||||
auto callback_wrapper =
|
||||
base::BindOnce(&PrintViewManagerBase::UpdatePrintSettingsReply,
|
||||
@@ -704,14 +729,14 @@ void PrintViewManagerBase::ScriptedPrint(mojom::ScriptedPrintParamsPtr params,
|
||||
@@ -718,14 +744,14 @@ void PrintViewManagerBase::ScriptedPrint(mojom::ScriptedPrintParamsPtr params,
|
||||
// didn't happen for some reason.
|
||||
bad_message::ReceivedBadMessage(
|
||||
render_process_host, bad_message::PVMB_SCRIPTED_PRINT_FENCED_FRAME);
|
||||
@@ -332,7 +317,7 @@ index 3a3f733c45e08e461a74d2458172c38ec0e572bf..2c04243257e72825a7fa6d8956045cb4
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -734,7 +759,6 @@ void PrintViewManagerBase::PrintingFailed(int32_t cookie) {
|
||||
@@ -748,7 +774,6 @@ void PrintViewManagerBase::PrintingFailed(int32_t cookie) {
|
||||
PrintManager::PrintingFailed(cookie);
|
||||
|
||||
#if !BUILDFLAG(IS_ANDROID) // Android does not implement this function.
|
||||
@@ -340,7 +325,7 @@ index 3a3f733c45e08e461a74d2458172c38ec0e572bf..2c04243257e72825a7fa6d8956045cb4
|
||||
#endif
|
||||
|
||||
ReleasePrinterQuery();
|
||||
@@ -749,6 +773,11 @@ void PrintViewManagerBase::RemoveObserver(Observer& observer) {
|
||||
@@ -763,6 +788,11 @@ void PrintViewManagerBase::RemoveObserver(Observer& observer) {
|
||||
}
|
||||
|
||||
void PrintViewManagerBase::ShowInvalidPrinterSettingsError() {
|
||||
@@ -352,7 +337,7 @@ index 3a3f733c45e08e461a74d2458172c38ec0e572bf..2c04243257e72825a7fa6d8956045cb4
|
||||
base::ThreadTaskRunnerHandle::Get()->PostTask(
|
||||
FROM_HERE, base::BindOnce(&ShowWarningMessageBox,
|
||||
l10n_util::GetStringUTF16(
|
||||
@@ -759,10 +788,12 @@ void PrintViewManagerBase::RenderFrameHostStateChanged(
|
||||
@@ -773,10 +803,12 @@ void PrintViewManagerBase::RenderFrameHostStateChanged(
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
content::RenderFrameHost::LifecycleState /*old_state*/,
|
||||
content::RenderFrameHost::LifecycleState new_state) {
|
||||
@@ -365,7 +350,7 @@ index 3a3f733c45e08e461a74d2458172c38ec0e572bf..2c04243257e72825a7fa6d8956045cb4
|
||||
}
|
||||
|
||||
void PrintViewManagerBase::DidStartLoading() {
|
||||
@@ -822,6 +853,11 @@ void PrintViewManagerBase::OnJobDone() {
|
||||
@@ -836,6 +868,11 @@ void PrintViewManagerBase::OnJobDone() {
|
||||
ReleasePrintJob();
|
||||
}
|
||||
|
||||
@@ -377,7 +362,7 @@ index 3a3f733c45e08e461a74d2458172c38ec0e572bf..2c04243257e72825a7fa6d8956045cb4
|
||||
void PrintViewManagerBase::OnFailed() {
|
||||
TerminatePrintJob(true);
|
||||
}
|
||||
@@ -883,7 +919,10 @@ bool PrintViewManagerBase::CreateNewPrintJob(
|
||||
@@ -893,7 +930,10 @@ bool PrintViewManagerBase::CreateNewPrintJob(
|
||||
|
||||
// Disconnect the current |print_job_|.
|
||||
auto weak_this = weak_ptr_factory_.GetWeakPtr();
|
||||
@@ -389,7 +374,7 @@ index 3a3f733c45e08e461a74d2458172c38ec0e572bf..2c04243257e72825a7fa6d8956045cb4
|
||||
if (!weak_this)
|
||||
return false;
|
||||
|
||||
@@ -965,6 +1004,13 @@ void PrintViewManagerBase::ReleasePrintJob() {
|
||||
@@ -972,6 +1012,13 @@ void PrintViewManagerBase::ReleasePrintJob() {
|
||||
UnregisterSystemPrintClient();
|
||||
#endif
|
||||
|
||||
@@ -403,7 +388,7 @@ index 3a3f733c45e08e461a74d2458172c38ec0e572bf..2c04243257e72825a7fa6d8956045cb4
|
||||
if (!print_job_)
|
||||
return;
|
||||
|
||||
@@ -1014,7 +1060,7 @@ bool PrintViewManagerBase::RunInnerMessageLoop() {
|
||||
@@ -1021,7 +1068,7 @@ bool PrintViewManagerBase::RunInnerMessageLoop() {
|
||||
}
|
||||
|
||||
bool PrintViewManagerBase::OpportunisticallyCreatePrintJob(int cookie) {
|
||||
@@ -412,11 +397,20 @@ index 3a3f733c45e08e461a74d2458172c38ec0e572bf..2c04243257e72825a7fa6d8956045cb4
|
||||
return true;
|
||||
|
||||
if (!cookie) {
|
||||
@@ -1129,7 +1176,7 @@ void PrintViewManagerBase::SendPrintingEnabled(bool enabled,
|
||||
}
|
||||
|
||||
void PrintViewManagerBase::CompletePrintNow(content::RenderFrameHost* rfh) {
|
||||
- GetPrintRenderFrame(rfh)->PrintRequestedPages();
|
||||
+ GetPrintRenderFrame(rfh)->PrintRequestedPages(/*silent=*/true, /*job_settings=*/base::Value::Dict());
|
||||
|
||||
for (auto& observer : GetObservers())
|
||||
observer.OnPrintNow(rfh);
|
||||
diff --git a/chrome/browser/printing/print_view_manager_base.h b/chrome/browser/printing/print_view_manager_base.h
|
||||
index 3a4cfa1e44d781a94030dec6992ffd6f6391020f..d14804d02cc61b6f75d47893f6dd61ddde6cd552 100644
|
||||
index 48895e0f8a846aeb725e306c7f22ac159d5d96a7..027794e38f86ab1905c5cdd95140b2cb1e5c5653 100644
|
||||
--- a/chrome/browser/printing/print_view_manager_base.h
|
||||
+++ b/chrome/browser/printing/print_view_manager_base.h
|
||||
@@ -37,6 +37,8 @@ namespace printing {
|
||||
@@ -41,6 +41,8 @@ namespace printing {
|
||||
class PrintQueriesQueue;
|
||||
class PrinterQuery;
|
||||
|
||||
@@ -425,19 +419,19 @@ index 3a4cfa1e44d781a94030dec6992ffd6f6391020f..d14804d02cc61b6f75d47893f6dd61dd
|
||||
// Base class for managing the print commands for a WebContents.
|
||||
class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
|
||||
public:
|
||||
@@ -58,7 +60,10 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
|
||||
@@ -62,7 +64,10 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
|
||||
// Prints the current document immediately. Since the rendering is
|
||||
// asynchronous, the actual printing will not be completed on the return of
|
||||
// this function. Returns false if printing is impossible at the moment.
|
||||
- virtual bool PrintNow(content::RenderFrameHost* rfh);
|
||||
+ virtual bool PrintNow(content::RenderFrameHost* rfh,
|
||||
+ bool silent = true,
|
||||
+ base::Value settings = {},
|
||||
+ base::Value::Dict settings = {},
|
||||
+ CompletionCallback callback = {});
|
||||
|
||||
#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
||||
// Prints the document in `print_data` with settings specified in
|
||||
@@ -106,6 +111,7 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
|
||||
@@ -110,6 +115,7 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
|
||||
ScriptedPrintCallback callback) override;
|
||||
void ShowInvalidPrinterSettingsError() override;
|
||||
void PrintingFailed(int32_t cookie) override;
|
||||
@@ -445,7 +439,7 @@ index 3a4cfa1e44d781a94030dec6992ffd6f6391020f..d14804d02cc61b6f75d47893f6dd61dd
|
||||
|
||||
// Adds and removes observers for `PrintViewManagerBase` events. The order in
|
||||
// which notifications are sent to observers is undefined. Observers must be
|
||||
@@ -207,7 +213,8 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
|
||||
@@ -231,7 +237,8 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
|
||||
// Runs `callback` with `params` to reply to ScriptedPrint().
|
||||
void ScriptedPrintReply(ScriptedPrintCallback callback,
|
||||
int process_id,
|
||||
@@ -455,7 +449,7 @@ index 3a4cfa1e44d781a94030dec6992ffd6f6391020f..d14804d02cc61b6f75d47893f6dd61dd
|
||||
|
||||
// Requests the RenderView to render all the missing pages for the print job.
|
||||
// No-op if no print job is pending. Returns true if at least one page has
|
||||
@@ -262,9 +269,15 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
|
||||
@@ -297,9 +304,15 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
|
||||
// The current RFH that is printing with a system printing dialog.
|
||||
raw_ptr<content::RenderFrameHost> printing_rfh_ = nullptr;
|
||||
|
||||
@@ -472,7 +466,7 @@ index 3a4cfa1e44d781a94030dec6992ffd6f6391020f..d14804d02cc61b6f75d47893f6dd61dd
|
||||
// This means we are _blocking_ until all the necessary pages have been
|
||||
// rendered or the print settings are being loaded.
|
||||
diff --git a/chrome/browser/ui/webui/print_preview/fake_print_render_frame.cc b/chrome/browser/ui/webui/print_preview/fake_print_render_frame.cc
|
||||
index 879004c790d57b28e7a816ebf560971876c17168..334509d3ab45af4bb7877f656ca5aca7ee1bce00 100644
|
||||
index 016e0d8fcc575bfa77323d8600d5daba152abbc6..dfb856f57767e24c0ec495c94e515afbb83e19ea 100644
|
||||
--- a/chrome/browser/ui/webui/print_preview/fake_print_render_frame.cc
|
||||
+++ b/chrome/browser/ui/webui/print_preview/fake_print_render_frame.cc
|
||||
@@ -20,7 +20,7 @@ FakePrintRenderFrame::FakePrintRenderFrame(
|
||||
@@ -480,25 +474,25 @@ index 879004c790d57b28e7a816ebf560971876c17168..334509d3ab45af4bb7877f656ca5aca7
|
||||
FakePrintRenderFrame::~FakePrintRenderFrame() = default;
|
||||
|
||||
-void FakePrintRenderFrame::PrintRequestedPages() {}
|
||||
+void FakePrintRenderFrame::PrintRequestedPages(bool /*silent*/, ::base::Value /*settings*/) {}
|
||||
+void FakePrintRenderFrame::PrintRequestedPages(bool /*silent*/, ::base::Value::Dict /*settings*/) {}
|
||||
|
||||
void FakePrintRenderFrame::PrintForSystemDialog() {}
|
||||
|
||||
diff --git a/chrome/browser/ui/webui/print_preview/fake_print_render_frame.h b/chrome/browser/ui/webui/print_preview/fake_print_render_frame.h
|
||||
index 10f46664d8337d6be2fac24d9a6933429f3b2c2b..6de833f2da3ae85cf0752284146974f2026ab174 100644
|
||||
index 3c95ee5c0d169f677947427a6ace55b4bfe80277..63ba8aca503968d0409b63b991a9276228d60d4a 100644
|
||||
--- a/chrome/browser/ui/webui/print_preview/fake_print_render_frame.h
|
||||
+++ b/chrome/browser/ui/webui/print_preview/fake_print_render_frame.h
|
||||
@@ -24,7 +24,7 @@ class FakePrintRenderFrame : public mojom::PrintRenderFrame {
|
||||
@@ -25,7 +25,7 @@ class FakePrintRenderFrame : public mojom::PrintRenderFrame {
|
||||
|
||||
private:
|
||||
// printing::mojom::PrintRenderFrame:
|
||||
- void PrintRequestedPages() override;
|
||||
+ void PrintRequestedPages(bool silent, ::base::Value settings) override;
|
||||
+ void PrintRequestedPages(bool silent, ::base::Value::Dict settings) override;
|
||||
void PrintForSystemDialog() override;
|
||||
void SetPrintPreviewUI(
|
||||
mojo::PendingAssociatedRemote<mojom::PrintPreviewUI> preview) override;
|
||||
diff --git a/components/printing/browser/print_to_pdf/pdf_print_manager.cc b/components/printing/browser/print_to_pdf/pdf_print_manager.cc
|
||||
index 66810a2a5f0c77ba107c71d2abaef8692bda0fea..cd6103af4571f82f11652a3c7ecf0e534428dc49 100644
|
||||
index 3ba45e77f66531bc6b81717eb9c7d3faca1e9fa9..41271d3fe390dd16d1c2b9839ac32013f495df51 100644
|
||||
--- a/components/printing/browser/print_to_pdf/pdf_print_manager.cc
|
||||
+++ b/components/printing/browser/print_to_pdf/pdf_print_manager.cc
|
||||
@@ -116,7 +116,8 @@ void PdfPrintManager::PrintToPdf(
|
||||
@@ -547,7 +541,7 @@ index 66810a2a5f0c77ba107c71d2abaef8692bda0fea..cd6103af4571f82f11652a3c7ecf0e53
|
||||
|
||||
void PdfPrintManager::ShowInvalidPrinterSettingsError() {
|
||||
diff --git a/components/printing/common/print.mojom b/components/printing/common/print.mojom
|
||||
index 6cd585d597315940be144506b9bb819137a7981e..8ea9c38a46460edd237f003ddd7362240a02887e 100644
|
||||
index 156b987aa9cafb69c04bed483aa78f26baa9cd97..3d3f2cb97b59a6e46bf0c16dd2355aa8e21ec5da 100644
|
||||
--- a/components/printing/common/print.mojom
|
||||
+++ b/components/printing/common/print.mojom
|
||||
@@ -275,7 +275,7 @@ interface PrintPreviewUI {
|
||||
@@ -555,11 +549,11 @@ index 6cd585d597315940be144506b9bb819137a7981e..8ea9c38a46460edd237f003ddd736224
|
||||
// Tells the RenderFrame to switch the CSS to print media type, render every
|
||||
// requested page, and then switch back the CSS to display media type.
|
||||
- PrintRequestedPages();
|
||||
+ PrintRequestedPages(bool silent, mojo_base.mojom.DeprecatedDictionaryValue settings);
|
||||
+ PrintRequestedPages(bool silent, mojo_base.mojom.DictionaryValue settings);
|
||||
|
||||
// Tells the RenderFrame to switch the CSS to print media type, render every
|
||||
// requested page using the print preview document's frame/node, and then
|
||||
@@ -342,7 +342,7 @@ interface PrintManagerHost {
|
||||
@@ -348,7 +348,7 @@ interface PrintManagerHost {
|
||||
// Request the print settings from the user. This step is about showing
|
||||
// UI to the user to select the final print settings.
|
||||
[Sync]
|
||||
@@ -569,10 +563,10 @@ index 6cd585d597315940be144506b9bb819137a7981e..8ea9c38a46460edd237f003ddd736224
|
||||
// Tells the browser that there are invalid printer settings.
|
||||
ShowInvalidPrinterSettingsError();
|
||||
diff --git a/components/printing/renderer/print_render_frame_helper.cc b/components/printing/renderer/print_render_frame_helper.cc
|
||||
index 36852ff8edee8da4ca43cf84c316f1f0eaff9fe0..7be102bae492701cddefc1623af4fe8bdd9963fa 100644
|
||||
index e0ecf8f3f09dafe44a5220117281a08e38a61bef..edbaa28ec4ffd22b6afa332365c5dc51c33de31e 100644
|
||||
--- a/components/printing/renderer/print_render_frame_helper.cc
|
||||
+++ b/components/printing/renderer/print_render_frame_helper.cc
|
||||
@@ -40,6 +40,7 @@
|
||||
@@ -41,6 +41,7 @@
|
||||
#include "printing/metafile_skia.h"
|
||||
#include "printing/mojom/print.mojom.h"
|
||||
#include "printing/print_job_constants.h"
|
||||
@@ -580,26 +574,26 @@ index 36852ff8edee8da4ca43cf84c316f1f0eaff9fe0..7be102bae492701cddefc1623af4fe8b
|
||||
#include "printing/units.h"
|
||||
#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
|
||||
#include "third_party/blink/public/common/associated_interfaces/associated_interface_registry.h"
|
||||
@@ -1264,7 +1265,8 @@ void PrintRenderFrameHelper::ScriptedPrint(bool user_initiated) {
|
||||
@@ -1276,7 +1277,8 @@ void PrintRenderFrameHelper::ScriptedPrint(bool user_initiated) {
|
||||
if (!weak_this)
|
||||
return;
|
||||
|
||||
- Print(web_frame, blink::WebNode(), PrintRequestType::kScripted);
|
||||
+ Print(web_frame, blink::WebNode(), PrintRequestType::kScripted,
|
||||
+ false /* silent */, base::DictionaryValue() /* new_settings */);
|
||||
+ false /* silent */, base::Value::Dict() /* new_settings */);
|
||||
if (!weak_this)
|
||||
return;
|
||||
|
||||
@@ -1295,7 +1297,7 @@ void PrintRenderFrameHelper::BindPrintRenderFrameReceiver(
|
||||
@@ -1307,7 +1309,7 @@ void PrintRenderFrameHelper::BindPrintRenderFrameReceiver(
|
||||
receivers_.Add(this, std::move(receiver));
|
||||
}
|
||||
|
||||
-void PrintRenderFrameHelper::PrintRequestedPages() {
|
||||
+void PrintRenderFrameHelper::PrintRequestedPages(bool silent, base::Value settings) {
|
||||
+void PrintRenderFrameHelper::PrintRequestedPages(bool silent, base::Value::Dict settings) {
|
||||
ScopedIPC scoped_ipc(weak_ptr_factory_.GetWeakPtr());
|
||||
if (ipc_nesting_level_ > kAllowedIpcDepthForPrint)
|
||||
return;
|
||||
@@ -1310,7 +1312,7 @@ void PrintRenderFrameHelper::PrintRequestedPages() {
|
||||
@@ -1322,7 +1324,7 @@ void PrintRenderFrameHelper::PrintRequestedPages() {
|
||||
// plugin node and print that instead.
|
||||
auto plugin = delegate_->GetPdfElement(frame);
|
||||
|
||||
@@ -608,17 +602,17 @@ index 36852ff8edee8da4ca43cf84c316f1f0eaff9fe0..7be102bae492701cddefc1623af4fe8b
|
||||
|
||||
if (!render_frame_gone_)
|
||||
frame->DispatchAfterPrintEvent();
|
||||
@@ -1341,7 +1343,8 @@ void PrintRenderFrameHelper::PrintForSystemDialog() {
|
||||
@@ -1353,7 +1355,8 @@ void PrintRenderFrameHelper::PrintForSystemDialog() {
|
||||
}
|
||||
|
||||
Print(frame, print_preview_context_.source_node(),
|
||||
- PrintRequestType::kRegular);
|
||||
+ PrintRequestType::kRegular, false,
|
||||
+ base::DictionaryValue());
|
||||
+ base::Value::Dict());
|
||||
if (!render_frame_gone_)
|
||||
print_preview_context_.DispatchAfterPrintEvent();
|
||||
// WARNING: |this| may be gone at this point. Do not do any more work here and
|
||||
@@ -1390,6 +1393,8 @@ void PrintRenderFrameHelper::PrintPreview(base::Value settings) {
|
||||
@@ -1402,6 +1405,8 @@ void PrintRenderFrameHelper::PrintPreview(base::Value settings) {
|
||||
if (ipc_nesting_level_ > kAllowedIpcDepthForPrint)
|
||||
return;
|
||||
|
||||
@@ -627,37 +621,37 @@ index 36852ff8edee8da4ca43cf84c316f1f0eaff9fe0..7be102bae492701cddefc1623af4fe8b
|
||||
print_preview_context_.OnPrintPreview();
|
||||
|
||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
@@ -1942,7 +1947,8 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) {
|
||||
@@ -2008,7 +2013,8 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) {
|
||||
return;
|
||||
|
||||
Print(duplicate_node.GetDocument().GetFrame(), duplicate_node,
|
||||
- PrintRequestType::kRegular);
|
||||
+ PrintRequestType::kRegular, false /* silent */,
|
||||
+ base::DictionaryValue() /* new_settings */);
|
||||
+ base::Value::Dict() /* new_settings */);
|
||||
// Check if |this| is still valid.
|
||||
if (!weak_this)
|
||||
return;
|
||||
@@ -1957,7 +1963,9 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) {
|
||||
@@ -2023,7 +2029,9 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) {
|
||||
|
||||
void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame,
|
||||
const blink::WebNode& node,
|
||||
- PrintRequestType print_request_type) {
|
||||
+ PrintRequestType print_request_type,
|
||||
+ bool silent,
|
||||
+ base::Value settings) {
|
||||
+ base::Value::Dict settings) {
|
||||
// If still not finished with earlier print request simply ignore.
|
||||
if (prep_frame_view_)
|
||||
return;
|
||||
@@ -1965,7 +1973,7 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame,
|
||||
@@ -2031,7 +2039,7 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame,
|
||||
FrameReference frame_ref(frame);
|
||||
|
||||
uint32_t expected_page_count = 0;
|
||||
- if (!CalculateNumberOfPages(frame, node, &expected_page_count)) {
|
||||
+ if (!CalculateNumberOfPages(frame, node, &expected_page_count, base::Value::AsDictionaryValue(settings))) {
|
||||
+ if (!CalculateNumberOfPages(frame, node, &expected_page_count, std::move(settings))) {
|
||||
DidFinishPrinting(FAIL_PRINT_INIT);
|
||||
return; // Failed to init print page settings.
|
||||
}
|
||||
@@ -1984,8 +1992,15 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame,
|
||||
@@ -2050,8 +2058,15 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame,
|
||||
print_pages_params_->params->print_scaling_option;
|
||||
|
||||
auto self = weak_ptr_factory_.GetWeakPtr();
|
||||
@@ -674,7 +668,7 @@ index 36852ff8edee8da4ca43cf84c316f1f0eaff9fe0..7be102bae492701cddefc1623af4fe8b
|
||||
// Check if |this| is still valid.
|
||||
if (!self)
|
||||
return;
|
||||
@@ -2233,36 +2248,51 @@ void PrintRenderFrameHelper::IPCProcessed() {
|
||||
@@ -2300,36 +2315,52 @@ void PrintRenderFrameHelper::IPCProcessed() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -684,10 +678,10 @@ index 36852ff8edee8da4ca43cf84c316f1f0eaff9fe0..7be102bae492701cddefc1623af4fe8b
|
||||
- GetPrintManagerHost()->GetDefaultPrintSettings(&settings.params);
|
||||
+bool PrintRenderFrameHelper::InitPrintSettings(
|
||||
+ bool fit_to_paper_size,
|
||||
+ const base::DictionaryValue& new_settings) {
|
||||
+ base::Value::Dict new_settings) {
|
||||
+ mojom::PrintPagesParamsPtr settings;
|
||||
+
|
||||
+ if (new_settings.DictEmpty()) {
|
||||
+ if (new_settings.empty()) {
|
||||
+ settings = mojom::PrintPagesParams::New();
|
||||
+ settings->params = mojom::PrintParams::New();
|
||||
+ GetPrintManagerHost()->GetDefaultPrintSettings(&settings->params);
|
||||
@@ -695,7 +689,8 @@ index 36852ff8edee8da4ca43cf84c316f1f0eaff9fe0..7be102bae492701cddefc1623af4fe8b
|
||||
+ bool canceled = false;
|
||||
+ int cookie =
|
||||
+ print_pages_params_ ? print_pages_params_->params->document_cookie : 0;
|
||||
+ GetPrintManagerHost()->UpdatePrintSettings(cookie, new_settings.Clone(), &settings, &canceled);
|
||||
+ GetPrintManagerHost()->UpdatePrintSettings(
|
||||
+ cookie, std::move(new_settings), &settings, &canceled);
|
||||
+ if (canceled)
|
||||
+ return false;
|
||||
+ }
|
||||
@@ -730,15 +725,15 @@ index 36852ff8edee8da4ca43cf84c316f1f0eaff9fe0..7be102bae492701cddefc1623af4fe8b
|
||||
+ blink::WebLocalFrame* frame,
|
||||
+ const blink::WebNode& node,
|
||||
+ uint32_t* number_of_pages,
|
||||
+ const base::DictionaryValue& settings) {
|
||||
+ base::Value::Dict settings) {
|
||||
DCHECK(frame);
|
||||
bool fit_to_paper_size = !IsPrintingPdfFrame(frame, node);
|
||||
- if (!InitPrintSettings(fit_to_paper_size)) {
|
||||
+ if (!InitPrintSettings(fit_to_paper_size, settings)) {
|
||||
+ if (!InitPrintSettings(fit_to_paper_size, std::move(settings))) {
|
||||
notify_browser_of_print_failure_ = false;
|
||||
GetPrintManagerHost()->ShowInvalidPrinterSettingsError();
|
||||
return false;
|
||||
@@ -2406,7 +2436,7 @@ mojom::PrintPagesParamsPtr PrintRenderFrameHelper::GetPrintSettingsFromUser(
|
||||
@@ -2454,7 +2485,7 @@ mojom::PrintPagesParamsPtr PrintRenderFrameHelper::GetPrintSettingsFromUser(
|
||||
std::move(params),
|
||||
base::BindOnce(
|
||||
[](base::OnceClosure quit_closure, mojom::PrintPagesParamsPtr* output,
|
||||
@@ -747,7 +742,7 @@ index 36852ff8edee8da4ca43cf84c316f1f0eaff9fe0..7be102bae492701cddefc1623af4fe8b
|
||||
*output = std::move(input);
|
||||
std::move(quit_closure).Run();
|
||||
},
|
||||
@@ -2657,18 +2687,7 @@ void PrintRenderFrameHelper::RequestPrintPreview(PrintPreviewRequestType type,
|
||||
@@ -2705,18 +2736,7 @@ void PrintRenderFrameHelper::RequestPrintPreview(PrintPreviewRequestType type,
|
||||
}
|
||||
|
||||
bool PrintRenderFrameHelper::CheckForCancel() {
|
||||
@@ -768,60 +763,60 @@ index 36852ff8edee8da4ca43cf84c316f1f0eaff9fe0..7be102bae492701cddefc1623af4fe8b
|
||||
|
||||
bool PrintRenderFrameHelper::PreviewPageRendered(
|
||||
diff --git a/components/printing/renderer/print_render_frame_helper.h b/components/printing/renderer/print_render_frame_helper.h
|
||||
index cd26f9ecf888c2a321890edd378ee0f8843a7f6c..958794f95fe8830b7e494340fbd53b0e92a498e3 100644
|
||||
index 15c367bd66706c915fdb95faf483429a8b31eb4c..ba2d5decbad2195c63efa4a5e23c60df7de69441 100644
|
||||
--- a/components/printing/renderer/print_render_frame_helper.h
|
||||
+++ b/components/printing/renderer/print_render_frame_helper.h
|
||||
@@ -257,7 +257,7 @@ class PrintRenderFrameHelper
|
||||
@@ -254,7 +254,7 @@ class PrintRenderFrameHelper
|
||||
mojo::PendingAssociatedReceiver<mojom::PrintRenderFrame> receiver);
|
||||
|
||||
// printing::mojom::PrintRenderFrame:
|
||||
- void PrintRequestedPages() override;
|
||||
+ void PrintRequestedPages(bool silent, base::Value settings) override;
|
||||
+ void PrintRequestedPages(bool silent, base::Value::Dict settings) override;
|
||||
#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
||||
void PrintForSystemDialog() override;
|
||||
void SetPrintPreviewUI(
|
||||
@@ -324,7 +324,9 @@ class PrintRenderFrameHelper
|
||||
@@ -325,7 +325,9 @@ class PrintRenderFrameHelper
|
||||
// WARNING: |this| may be gone after this method returns.
|
||||
void Print(blink::WebLocalFrame* frame,
|
||||
const blink::WebNode& node,
|
||||
- PrintRequestType print_request_type);
|
||||
+ PrintRequestType print_request_type,
|
||||
+ bool silent,
|
||||
+ base::Value settings);
|
||||
+ base::Value::Dict settings);
|
||||
|
||||
// Notification when printing is done - signal tear-down/free resources.
|
||||
void DidFinishPrinting(PrintingResult result);
|
||||
@@ -333,12 +335,14 @@ class PrintRenderFrameHelper
|
||||
@@ -334,12 +336,14 @@ class PrintRenderFrameHelper
|
||||
|
||||
// Initialize print page settings with default settings.
|
||||
// Used only for native printing workflow.
|
||||
- bool InitPrintSettings(bool fit_to_paper_size);
|
||||
+ bool InitPrintSettings(bool fit_to_paper_size,
|
||||
+ const base::DictionaryValue& settings);
|
||||
+ base::Value::Dict new_settings);
|
||||
|
||||
// Calculate number of pages in source document.
|
||||
bool CalculateNumberOfPages(blink::WebLocalFrame* frame,
|
||||
const blink::WebNode& node,
|
||||
- uint32_t* number_of_pages);
|
||||
+ uint32_t* number_of_pages,
|
||||
+ const base::DictionaryValue& settings);
|
||||
+ base::Value::Dict settings);
|
||||
|
||||
#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
||||
// Set options for print preset from source PDF document.
|
||||
diff --git a/printing/printing_context.cc b/printing/printing_context.cc
|
||||
index d0ef2181c649afe110c3c466a565a01cf6ae63a9..2daf9f02d41e04930fc4dad6d36ccbf3006dc175 100644
|
||||
index 8a8fcefa9da92a044f5bdf6a2f242048b325d442..6dae33514675d6843736b2c9a767a4b72cb103fa 100644
|
||||
--- a/printing/printing_context.cc
|
||||
+++ b/printing/printing_context.cc
|
||||
@@ -119,7 +119,6 @@ mojom::ResultCode PrintingContext::UsePdfSettings() {
|
||||
@@ -117,7 +117,6 @@ mojom::ResultCode PrintingContext::UsePdfSettings() {
|
||||
|
||||
mojom::ResultCode PrintingContext::UpdatePrintSettings(
|
||||
base::Value job_settings) {
|
||||
base::Value::Dict job_settings) {
|
||||
- ResetSettings();
|
||||
{
|
||||
std::unique_ptr<PrintSettings> settings =
|
||||
PrintSettingsFromJobSettings(job_settings.GetDict());
|
||||
PrintSettingsFromJobSettings(job_settings);
|
||||
diff --git a/printing/printing_context.h b/printing/printing_context.h
|
||||
index 3f36303105b7979a1a771bf26b42596abe5b3cce..52f740bb832db4a8d76431d9bc77cab10bb7e0c7 100644
|
||||
index 2c8ef23f7cb75a743fa18e3c613f7c719988028c..265005d6d51f861aa7ccd7e0eba7809b3c652dae 100644
|
||||
--- a/printing/printing_context.h
|
||||
+++ b/printing/printing_context.h
|
||||
@@ -170,6 +170,9 @@ class COMPONENT_EXPORT(PRINTING) PrintingContext {
|
||||
|
||||
@@ -43,10 +43,10 @@ index 7cda66952e0d3a67c32791ad3c7d7de8df03f876..8cb3a596593c52e776d546d25fb07800
|
||||
|
||||
void RenderWidgetHostImpl::ShowContextMenuAtPoint(
|
||||
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
|
||||
index df03de0a810bbce796d5bc421b92000e02dbd449..b9309e1cbc4a8b701534aa8be2827c40d98d6678 100644
|
||||
index faa795be3a6cbc7ae13d9a42a1bdbd01ac0406a9..add5ba98f4409460b93aa2f8c49eb49a1f59470a 100644
|
||||
--- a/content/browser/web_contents/web_contents_impl.cc
|
||||
+++ b/content/browser/web_contents/web_contents_impl.cc
|
||||
@@ -4519,6 +4519,11 @@ TextInputManager* WebContentsImpl::GetTextInputManager() {
|
||||
@@ -4523,6 +4523,11 @@ TextInputManager* WebContentsImpl::GetTextInputManager() {
|
||||
return text_input_manager_.get();
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ index df03de0a810bbce796d5bc421b92000e02dbd449..b9309e1cbc4a8b701534aa8be2827c40
|
||||
RenderWidgetHostImpl* render_widget_host) {
|
||||
return render_widget_host == GetMainFrame()->GetRenderWidgetHost();
|
||||
diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h
|
||||
index 80aeacf4ad593a7d40dae6c9096ab0c700ab22d8..07355cb194bd429a693e587072d11432d6c0888a 100644
|
||||
index 7ad2648933434282c5bdd3fd5d9187d86e142b60..2a29af8d9aa67768ec521e87190174397a25b722 100644
|
||||
--- a/content/browser/web_contents/web_contents_impl.h
|
||||
+++ b/content/browser/web_contents/web_contents_impl.h
|
||||
@@ -962,6 +962,7 @@ class CONTENT_EXPORT WebContentsImpl : public WebContents,
|
||||
|
||||
@@ -12,10 +12,10 @@ should be removed as soon as those have been updated. Patching because
|
||||
every instance is a FTBFS that prevents testing any one instance's fix.
|
||||
|
||||
diff --git a/base/callback_helpers.h b/base/callback_helpers.h
|
||||
index 460442d9c0f894f78b29b33c027320511511dbcc..30068c219aa497892e10290be0fe5734ded8b23c 100644
|
||||
index 49ce51acb678886e0c679caa42e616400ab3bd48..760d97e8614195c8106b07b8477cf91a5dbebc15 100644
|
||||
--- a/base/callback_helpers.h
|
||||
+++ b/base/callback_helpers.h
|
||||
@@ -95,6 +95,22 @@ class OnceCallbackHolder final {
|
||||
@@ -96,6 +96,22 @@ class OnceCallbackHolder final {
|
||||
|
||||
} // namespace internal
|
||||
|
||||
|
||||
@@ -6,10 +6,10 @@ Subject: scroll_bounce_flag.patch
|
||||
Patch to make scrollBounce option work.
|
||||
|
||||
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc
|
||||
index 24b18a620f3e60ed26dddfaa5d3133b5ede972fe..0377f156a23182d1a65fe5ef82f3f5203b98aed0 100644
|
||||
index 15bada83dc4bc3fda72600e6325917faeba4e60f..d0004dfce5c8ad3c3318755318385144e296055d 100644
|
||||
--- a/content/renderer/render_thread_impl.cc
|
||||
+++ b/content/renderer/render_thread_impl.cc
|
||||
@@ -1320,7 +1320,7 @@ bool RenderThreadImpl::IsLcdTextEnabled() {
|
||||
@@ -1321,7 +1321,7 @@ bool RenderThreadImpl::IsLcdTextEnabled() {
|
||||
}
|
||||
|
||||
bool RenderThreadImpl::IsElasticOverscrollEnabled() {
|
||||
|
||||
@@ -22,10 +22,10 @@ However, the patch would need to be reviewed by the security team, as it
|
||||
does touch a security-sensitive class.
|
||||
|
||||
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
|
||||
index 20a697be32f7e27a9fa33d0225c94520aa5ebf2e..927e182bbba7a3700fd20c8c964da7cc162c4210 100644
|
||||
index 396377fd4041cced3c68f8d57c8f868098bb8923..09f72f1fbd7b782c5bf52245482b358103f0c243 100644
|
||||
--- a/content/browser/renderer_host/render_process_host_impl.cc
|
||||
+++ b/content/browser/renderer_host/render_process_host_impl.cc
|
||||
@@ -1786,9 +1786,15 @@ bool RenderProcessHostImpl::Init() {
|
||||
@@ -1791,9 +1791,15 @@ bool RenderProcessHostImpl::Init() {
|
||||
std::unique_ptr<SandboxedProcessLauncherDelegate> sandbox_delegate =
|
||||
std::make_unique<RendererSandboxedProcessLauncherDelegateWin>(
|
||||
cmd_line.get(), IsJitDisabled());
|
||||
|
||||
@@ -9,10 +9,10 @@ is needed for OSR.
|
||||
Originally landed in https://github.com/electron/libchromiumcontent/pull/226.
|
||||
|
||||
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
|
||||
index c1b1bfc8333e93456178842db392eabff96bf4c9..1eee3bf88b5566b07cdb4f33fc03bf3d904ec6b9 100644
|
||||
index 4b77c71375a7375e168c9bee93a73c3af6fe1252..1e23962ccb7cf99c5bff122ce0eb0e05086f4a89 100644
|
||||
--- a/content/browser/web_contents/web_contents_impl.cc
|
||||
+++ b/content/browser/web_contents/web_contents_impl.cc
|
||||
@@ -3057,6 +3057,13 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params,
|
||||
@@ -3061,6 +3061,13 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params,
|
||||
site_instance.get(), params.renderer_initiated_creation,
|
||||
params.main_frame_name, GetOpener(), primary_main_frame_policy);
|
||||
|
||||
@@ -26,7 +26,7 @@ index c1b1bfc8333e93456178842db392eabff96bf4c9..1eee3bf88b5566b07cdb4f33fc03bf3d
|
||||
WebContentsViewDelegate* delegate =
|
||||
GetContentClient()->browser()->GetWebContentsViewDelegate(this);
|
||||
|
||||
@@ -3067,6 +3074,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params,
|
||||
@@ -3071,6 +3078,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params,
|
||||
view_.reset(CreateWebContentsView(this, delegate,
|
||||
&render_view_host_delegate_view_));
|
||||
}
|
||||
|
||||
@@ -14,10 +14,10 @@ Note that we also need to manually update embedder's
|
||||
`api::WebContents::IsFullscreenForTabOrPending` value.
|
||||
|
||||
diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc
|
||||
index b47dc4a90a0294c5d7e73f01c496fd2b4f621400..cf02dbe536eec67b77c85ceb73d285fcbde025fc 100644
|
||||
index 0287e414f4020147ddee297f7c1447c32a118905..781793ae5cb461b7451b5c448465ba5b41aa805d 100644
|
||||
--- a/content/browser/renderer_host/render_frame_host_impl.cc
|
||||
+++ b/content/browser/renderer_host/render_frame_host_impl.cc
|
||||
@@ -6324,6 +6324,15 @@ void RenderFrameHostImpl::EnterFullscreen(
|
||||
@@ -6326,6 +6326,15 @@ void RenderFrameHostImpl::EnterFullscreen(
|
||||
notified_instances.insert(parent_site_instance);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,10 +26,10 @@ index eb8968c2a86102d0d3a21f07c394f1c360083c6c..025ef3f70a5ae34faf8c6013fbfba171
|
||||
// An empty URL is returned if the URL is not overriden.
|
||||
virtual GURL OverrideFlashEmbedWithHTML(const GURL& url);
|
||||
diff --git a/content/renderer/renderer_blink_platform_impl.cc b/content/renderer/renderer_blink_platform_impl.cc
|
||||
index dbde0706007b8f202fcca5fc05562979617b0183..2adea2c2edabf3c401e9dcd228f1d57c08066059 100644
|
||||
index 340b9635325e3e5dd0fa693fbfb0b4b976aef84e..a2193d3270e4995df506e751e1912975e19b2083 100644
|
||||
--- a/content/renderer/renderer_blink_platform_impl.cc
|
||||
+++ b/content/renderer/renderer_blink_platform_impl.cc
|
||||
@@ -949,6 +949,12 @@ void RendererBlinkPlatformImpl::WillStopWorkerThread() {
|
||||
@@ -954,6 +954,12 @@ void RendererBlinkPlatformImpl::WillStopWorkerThread() {
|
||||
WorkerThreadRegistry::Instance()->WillStopCurrentWorkerThread();
|
||||
}
|
||||
|
||||
@@ -43,10 +43,10 @@ index dbde0706007b8f202fcca5fc05562979617b0183..2adea2c2edabf3c401e9dcd228f1d57c
|
||||
const v8::Local<v8::Context>& worker) {
|
||||
GetContentClient()->renderer()->DidInitializeWorkerContextOnWorkerThread(
|
||||
diff --git a/content/renderer/renderer_blink_platform_impl.h b/content/renderer/renderer_blink_platform_impl.h
|
||||
index e7d0d3e7c08c2f6e83726e7fa2557847d148a0ed..c6e0a728150db2b5af41e12304c88d57e51faa43 100644
|
||||
index 213b0b9c28974aecbdd2dd1297dfa21cd716a337..f77763977aee112b854ade93b59172247599a16b 100644
|
||||
--- a/content/renderer/renderer_blink_platform_impl.h
|
||||
+++ b/content/renderer/renderer_blink_platform_impl.h
|
||||
@@ -208,6 +208,7 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl {
|
||||
@@ -209,6 +209,7 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl {
|
||||
void DidStartWorkerThread() override;
|
||||
void WillStopWorkerThread() override;
|
||||
void WorkerContextCreated(const v8::Local<v8::Context>& worker) override;
|
||||
@@ -55,10 +55,10 @@ index e7d0d3e7c08c2f6e83726e7fa2557847d148a0ed..c6e0a728150db2b5af41e12304c88d57
|
||||
const blink::WebSecurityOrigin& script_origin) override;
|
||||
blink::ProtocolHandlerSecurityLevel GetProtocolHandlerSecurityLevel()
|
||||
diff --git a/third_party/blink/public/platform/platform.h b/third_party/blink/public/platform/platform.h
|
||||
index 0825226fae036b1e5503b66dabe4bd92ad6ee9bb..3cbb1ed9ef65cb9044a76b0a1686f6ab019c87b5 100644
|
||||
index 3ad783e681872f6273147121802c66d31a66e2ea..dbb1e8466b57551b5c32d156d6e3b079bf9415ac 100644
|
||||
--- a/third_party/blink/public/platform/platform.h
|
||||
+++ b/third_party/blink/public/platform/platform.h
|
||||
@@ -714,6 +714,7 @@ class BLINK_PLATFORM_EXPORT Platform {
|
||||
@@ -720,6 +720,7 @@ class BLINK_PLATFORM_EXPORT Platform {
|
||||
virtual void DidStartWorkerThread() {}
|
||||
virtual void WillStopWorkerThread() {}
|
||||
virtual void WorkerContextCreated(const v8::Local<v8::Context>& worker) {}
|
||||
@@ -67,10 +67,10 @@ index 0825226fae036b1e5503b66dabe4bd92ad6ee9bb..3cbb1ed9ef65cb9044a76b0a1686f6ab
|
||||
const WebSecurityOrigin& script_origin) {
|
||||
return false;
|
||||
diff --git a/third_party/blink/renderer/core/workers/worker_thread.cc b/third_party/blink/renderer/core/workers/worker_thread.cc
|
||||
index 68c38d2045c7c23650bd56717081bb001a4e690e..e0e08d4bdf9521ed5c1940d31665d1b675119f0d 100644
|
||||
index 265e4bed408747b5b22d2e930bc64fb2cb2c3b25..892b3e58443f1a82a6a41c6d52df7d2d701b377d 100644
|
||||
--- a/third_party/blink/renderer/core/workers/worker_thread.cc
|
||||
+++ b/third_party/blink/renderer/core/workers/worker_thread.cc
|
||||
@@ -732,6 +732,12 @@ void WorkerThread::PrepareForShutdownOnWorkerThread() {
|
||||
@@ -734,6 +734,12 @@ void WorkerThread::PrepareForShutdownOnWorkerThread() {
|
||||
nested_runner_->QuitNow();
|
||||
}
|
||||
|
||||
|
||||
@@ -35,10 +35,10 @@ index 025ef3f70a5ae34faf8c6013fbfba171c7f501ac..cea3f3dc05f91927f4ee8be5eec85ec2
|
||||
// from the worker thread.
|
||||
virtual void WillDestroyWorkerContextOnWorkerThread(
|
||||
diff --git a/content/renderer/renderer_blink_platform_impl.cc b/content/renderer/renderer_blink_platform_impl.cc
|
||||
index 2adea2c2edabf3c401e9dcd228f1d57c08066059..7c76b39ea82dd600b72288cccc571660b653b150 100644
|
||||
index a2193d3270e4995df506e751e1912975e19b2083..56ad3e79d6fcd0673bbb27fa9f87a3f603f5ae51 100644
|
||||
--- a/content/renderer/renderer_blink_platform_impl.cc
|
||||
+++ b/content/renderer/renderer_blink_platform_impl.cc
|
||||
@@ -961,6 +961,12 @@ void RendererBlinkPlatformImpl::WorkerContextCreated(
|
||||
@@ -966,6 +966,12 @@ void RendererBlinkPlatformImpl::WorkerContextCreated(
|
||||
worker);
|
||||
}
|
||||
|
||||
@@ -52,10 +52,10 @@ index 2adea2c2edabf3c401e9dcd228f1d57c08066059..7c76b39ea82dd600b72288cccc571660
|
||||
const blink::WebSecurityOrigin& script_origin) {
|
||||
return GetContentClient()->renderer()->AllowScriptExtensionForServiceWorker(
|
||||
diff --git a/content/renderer/renderer_blink_platform_impl.h b/content/renderer/renderer_blink_platform_impl.h
|
||||
index c6e0a728150db2b5af41e12304c88d57e51faa43..7fa7dab64506ddc60e27096412ea7e93608a3394 100644
|
||||
index f77763977aee112b854ade93b59172247599a16b..f3518973a5e071bf428d928f20255c208cf4d0b9 100644
|
||||
--- a/content/renderer/renderer_blink_platform_impl.h
|
||||
+++ b/content/renderer/renderer_blink_platform_impl.h
|
||||
@@ -208,6 +208,8 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl {
|
||||
@@ -209,6 +209,8 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl {
|
||||
void DidStartWorkerThread() override;
|
||||
void WillStopWorkerThread() override;
|
||||
void WorkerContextCreated(const v8::Local<v8::Context>& worker) override;
|
||||
@@ -65,10 +65,10 @@ index c6e0a728150db2b5af41e12304c88d57e51faa43..7fa7dab64506ddc60e27096412ea7e93
|
||||
bool AllowScriptExtensionForServiceWorker(
|
||||
const blink::WebSecurityOrigin& script_origin) override;
|
||||
diff --git a/third_party/blink/public/platform/platform.h b/third_party/blink/public/platform/platform.h
|
||||
index 3cbb1ed9ef65cb9044a76b0a1686f6ab019c87b5..c7694b4a89c16d02f946598bcf66aa3d241af83e 100644
|
||||
index dbb1e8466b57551b5c32d156d6e3b079bf9415ac..05bd0c6411d25bbf48af6593026c3e9f0a816f38 100644
|
||||
--- a/third_party/blink/public/platform/platform.h
|
||||
+++ b/third_party/blink/public/platform/platform.h
|
||||
@@ -714,6 +714,8 @@ class BLINK_PLATFORM_EXPORT Platform {
|
||||
@@ -720,6 +720,8 @@ class BLINK_PLATFORM_EXPORT Platform {
|
||||
virtual void DidStartWorkerThread() {}
|
||||
virtual void WillStopWorkerThread() {}
|
||||
virtual void WorkerContextCreated(const v8::Local<v8::Context>& worker) {}
|
||||
|
||||
@@ -2,3 +2,4 @@ build_add_gn_config.patch
|
||||
fix_ensure_that_self_is_retained_until_the_racsignal_is_complete.patch
|
||||
fix_use_kseccschecknestedcode_kseccsstrictvalidate_in_the_sec.patch
|
||||
feat_add_new_squirrel_mac_bundle_installation_method_behind_flag.patch
|
||||
refactor_use_posix_spawn_instead_of_nstask_so_we_can_disclaim_the.patch
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Samuel Attard <samuel.r.attard@gmail.com>
|
||||
Date: Mon, 28 Mar 2022 02:36:39 -0700
|
||||
Subject: refactor: use posix_spawn instead of NSTask so we can disclaim the
|
||||
spawned ShipIt executable
|
||||
|
||||
This ensures that if the ShipIt executable is hotswapped it doesn't inherit TCC permissions
|
||||
|
||||
diff --git a/Squirrel/ShipIt-main.m b/Squirrel/ShipIt-main.m
|
||||
index db246534e176f9c3ea2dd8b1c8659378fdc2435d..2c515ffdd67052a08ee8155c0e46b57e9721a0e5 100644
|
||||
--- a/Squirrel/ShipIt-main.m
|
||||
+++ b/Squirrel/ShipIt-main.m
|
||||
@@ -13,6 +13,9 @@
|
||||
#import <ReactiveObjC/RACSignal+Operations.h>
|
||||
#import <ReactiveObjC/RACScheduler.h>
|
||||
|
||||
+#include <spawn.h>
|
||||
+#include <sys/wait.h>
|
||||
+
|
||||
#import "NSError+SQRLVerbosityExtensions.h"
|
||||
#import "RACSignal+SQRLTransactionExtensions.h"
|
||||
#import "SQRLInstaller.h"
|
||||
@@ -20,6 +23,20 @@
|
||||
#import "SQRLTerminationListener.h"
|
||||
#import "SQRLShipItRequest.h"
|
||||
|
||||
+extern char **environ;
|
||||
+
|
||||
+int responsibility_spawnattrs_setdisclaim(posix_spawnattr_t attrs, int disclaim)
|
||||
+__attribute__((availability(macos,introduced=10.14),weak_import));
|
||||
+
|
||||
+#define CHECK_ERR(expr) \
|
||||
+ { \
|
||||
+ int err = (expr); \
|
||||
+ if (err) { \
|
||||
+ fprintf(stderr, "%s: %s", #expr, strerror(err)); \
|
||||
+ exit(err); \
|
||||
+ } \
|
||||
+ }
|
||||
+
|
||||
// The maximum number of times ShipIt should run the same installation state, in
|
||||
// an attempt to update.
|
||||
//
|
||||
@@ -136,11 +153,37 @@ static void installRequest(RACSignal *readRequestSignal, NSString *applicationId
|
||||
NSString *exe = NSProcessInfo.processInfo.arguments[0];
|
||||
NSLog(@"Launching new ShipIt at %@ with instructions to launch %@", exe, bundleURL);
|
||||
|
||||
- NSTask *task = [[NSTask alloc] init];
|
||||
- [task setLaunchPath: exe];
|
||||
- [task setArguments: @[launchSignal, bundleURL.path]];
|
||||
- [task launch];
|
||||
- [task waitUntilExit];
|
||||
+ posix_spawnattr_t attr;
|
||||
+ CHECK_ERR(posix_spawnattr_init(&attr));
|
||||
+
|
||||
+ if (@available(macOS 10.14, *)) {
|
||||
+ // Disclaim TCC responsibilities
|
||||
+ if (responsibility_spawnattrs_setdisclaim)
|
||||
+ CHECK_ERR(responsibility_spawnattrs_setdisclaim(&attr, 1));
|
||||
+ }
|
||||
+
|
||||
+ pid_t pid = 0;
|
||||
+
|
||||
+ const char* launchPath = [exe fileSystemRepresentation];
|
||||
+ const char* signal = [launchSignal fileSystemRepresentation];
|
||||
+ const char* path = [bundleURL.path fileSystemRepresentation];
|
||||
+ const char* args[] = { launchPath, signal, path, 0 };
|
||||
+ int status = posix_spawn(&pid, [exe UTF8String], NULL, &attr, (char *const*)args, environ);
|
||||
+ if (status == 0) {
|
||||
+ NSLog(@"New ShipIt pid: %i", pid);
|
||||
+ do {
|
||||
+ if (waitpid(pid, &status, 0) != -1) {
|
||||
+ NSLog(@"ShipIt status %d", WEXITSTATUS(status));
|
||||
+ } else {
|
||||
+ perror("waitpid");
|
||||
+ exit(1);
|
||||
+ }
|
||||
+ } while (!WIFEXITED(status) && !WIFSIGNALED(status));
|
||||
+ } else {
|
||||
+ NSLog(@"posix_spawn: %s", strerror(status));
|
||||
+ }
|
||||
+
|
||||
+ posix_spawnattr_destroy(&attr);
|
||||
|
||||
NSLog(@"New ShipIt exited");
|
||||
} else {
|
||||
@@ -172,7 +215,13 @@ int main(int argc, const char * argv[]) {
|
||||
});
|
||||
|
||||
if (argc < 3) {
|
||||
- NSLog(@"Missing launchd job label or state path for ShipIt");
|
||||
+ NSLog(@"Missing launchd job label or state path for ShipIt (%d)", argc);
|
||||
+ if (argc >= 1) {
|
||||
+ NSLog(@"Arg 1: {%s}", argv[0]);
|
||||
+ }
|
||||
+ if (argc >= 2) {
|
||||
+ NSLog(@"Arg 2: {%s}", argv[1]);
|
||||
+ }
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,6 @@ dcheck.patch
|
||||
export_symbols_needed_for_windows_build.patch
|
||||
workaround_an_undefined_symbol_error.patch
|
||||
do_not_export_private_v8_symbols_on_windows.patch
|
||||
fix_build_deprecated_attirbute_for_older_msvc_versions.patch
|
||||
fix_build_deprecated_attribute_for_older_msvc_versions.patch
|
||||
fix_disable_implies_dcheck_for_node_stream_array_buffers.patch
|
||||
revert_fix_cppgc_removed_deleted_cstors_in_cppheapcreateparams.patch
|
||||
|
||||
@@ -9,10 +9,10 @@ necessary for native modules to load.
|
||||
Also, some fixes relating to mksnapshot on ARM.
|
||||
|
||||
diff --git a/BUILD.gn b/BUILD.gn
|
||||
index fec387d31eb5842f4fb0ff617f10b2254c0ee260..2385ccc74d41c10a3f61179f31073062250afcdc 100644
|
||||
index 988c907d964a258bb3184698ad3ccaee18560e2c..90b20e8f1acb304e52a0628c4abee5ffe8665d8e 100644
|
||||
--- a/BUILD.gn
|
||||
+++ b/BUILD.gn
|
||||
@@ -606,7 +606,7 @@ config("internal_config") {
|
||||
@@ -605,7 +605,7 @@ config("internal_config") {
|
||||
":cppgc_header_features",
|
||||
]
|
||||
|
||||
@@ -21,7 +21,7 @@ index fec387d31eb5842f4fb0ff617f10b2254c0ee260..2385ccc74d41c10a3f61179f31073062
|
||||
defines += [ "BUILDING_V8_SHARED" ]
|
||||
}
|
||||
|
||||
@@ -5826,7 +5826,7 @@ if (current_toolchain == v8_generator_toolchain) {
|
||||
@@ -5827,7 +5827,7 @@ if (current_toolchain == v8_generator_toolchain) {
|
||||
"src/interpreter/bytecodes.h",
|
||||
]
|
||||
|
||||
@@ -30,7 +30,7 @@ index fec387d31eb5842f4fb0ff617f10b2254c0ee260..2385ccc74d41c10a3f61179f31073062
|
||||
|
||||
deps = [
|
||||
":v8_libbase",
|
||||
@@ -5864,6 +5864,8 @@ if (current_toolchain == v8_snapshot_toolchain) {
|
||||
@@ -5865,6 +5865,8 @@ if (current_toolchain == v8_snapshot_toolchain) {
|
||||
|
||||
configs = [ ":internal_config" ]
|
||||
|
||||
|
||||
@@ -6,10 +6,10 @@ Subject: dcheck.patch
|
||||
https://github.com/auchenberg/volkswagen
|
||||
|
||||
diff --git a/src/api/api.cc b/src/api/api.cc
|
||||
index d22910b209c614162363938accfc86696719ad12..22af6bf24d672817bf620b9411d1b678b7a9800f 100644
|
||||
index a0ab21d71a378a6bcd5bb0afb111d77d3d9f0c4d..c348999f6a4110c16a539c5e661088db8f7637ed 100644
|
||||
--- a/src/api/api.cc
|
||||
+++ b/src/api/api.cc
|
||||
@@ -9115,7 +9115,7 @@ void Isolate::SetPromiseRejectCallback(PromiseRejectCallback callback) {
|
||||
@@ -9099,7 +9099,7 @@ void Isolate::SetPromiseRejectCallback(PromiseRejectCallback callback) {
|
||||
}
|
||||
|
||||
void Isolate::PerformMicrotaskCheckpoint() {
|
||||
@@ -19,10 +19,10 @@ index d22910b209c614162363938accfc86696719ad12..22af6bf24d672817bf620b9411d1b678
|
||||
isolate->default_microtask_queue()->PerformCheckpoint(this);
|
||||
}
|
||||
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
|
||||
index 509ee8574736261307d9e270b7151197c6988649..00532d4dedf67c0764ca574b40e10ff0ce184762 100644
|
||||
index 02eefd9e4fdc78e9e3947e3972c10f822ea62e83..b651e60bba9712422b3f4e9b1cfe3a25b4c37337 100644
|
||||
--- a/src/heap/heap.cc
|
||||
+++ b/src/heap/heap.cc
|
||||
@@ -6200,9 +6200,9 @@ void Heap::TearDown() {
|
||||
@@ -6205,9 +6205,9 @@ void Heap::TearDown() {
|
||||
void Heap::AddGCPrologueCallback(v8::Isolate::GCCallbackWithData callback,
|
||||
GCType gc_type, void* data) {
|
||||
DCHECK_NOT_NULL(callback);
|
||||
|
||||
@@ -12,10 +12,10 @@ This patch can be safely removed if, when it is removed, `node.lib` does not
|
||||
contain any standard C++ library exports (e.g. `std::ostringstream`).
|
||||
|
||||
diff --git a/BUILD.gn b/BUILD.gn
|
||||
index 1310890fbec222c0edfda08ec962292d39aca8d1..5ff12eaa98887826b9a962c41f69480ca1d9dd3a 100644
|
||||
index 191748a226e67d61f3678b966be1043259e6acac..4669c2b669044e32d2fe69b3a846675203278a93 100644
|
||||
--- a/BUILD.gn
|
||||
+++ b/BUILD.gn
|
||||
@@ -606,6 +606,10 @@ config("internal_config") {
|
||||
@@ -605,6 +605,10 @@ config("internal_config") {
|
||||
":cppgc_header_features",
|
||||
]
|
||||
|
||||
|
||||
@@ -6,10 +6,10 @@ Subject: expose_mksnapshot.patch
|
||||
Needed in order to target mksnapshot for mksnapshot zip.
|
||||
|
||||
diff --git a/BUILD.gn b/BUILD.gn
|
||||
index 2385ccc74d41c10a3f61179f31073062250afcdc..1310890fbec222c0edfda08ec962292d39aca8d1 100644
|
||||
index 90b20e8f1acb304e52a0628c4abee5ffe8665d8e..191748a226e67d61f3678b966be1043259e6acac 100644
|
||||
--- a/BUILD.gn
|
||||
+++ b/BUILD.gn
|
||||
@@ -5838,7 +5838,6 @@ if (current_toolchain == v8_generator_toolchain) {
|
||||
@@ -5839,7 +5839,6 @@ if (current_toolchain == v8_generator_toolchain) {
|
||||
|
||||
if (current_toolchain == v8_snapshot_toolchain) {
|
||||
v8_executable("mksnapshot") {
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Deepak Mohan <hop2deep@gmail.com>
|
||||
Date: Tue, 28 Jan 2020 15:48:03 -0800
|
||||
Subject: fix: usage of c++ [[deprecated]] attirbute for older msvc versions
|
||||
Subject: fix: usage of c++ [[deprecated]] attribute for older msvc versions
|
||||
|
||||
VS 2015 update 3 has a bug where [[deprecated]] attribute cannot
|
||||
be applied to constructor declarations, this is fixed in 2017 and
|
||||
higher versions, but native module compiling with this version
|
||||
will have an issue.
|
||||
This attribute can only be used in all contexts in Visual Studio 2019
|
||||
|
||||
diff --git a/include/v8config.h b/include/v8config.h
|
||||
index 77fd65c6c5b7d8c0a7fe7a37c40e17ce66f49ce6..010b3633546601ba70a55aeb8e8fc503ef79e2f5 100644
|
||||
index 77fd65c6c5b7d8c0a7fe7a37c40e17ce66f49ce6..644f921f970d214b4d93b1e4c384e7475740b485 100644
|
||||
--- a/include/v8config.h
|
||||
+++ b/include/v8config.h
|
||||
@@ -454,10 +454,13 @@ path. Add it with -I<path> to the command line
|
||||
@@ -20,7 +17,7 @@ index 77fd65c6c5b7d8c0a7fe7a37c40e17ce66f49ce6..010b3633546601ba70a55aeb8e8fc503
|
||||
// A macro (V8_DEPRECATED) to mark classes or functions as deprecated.
|
||||
#if defined(V8_DEPRECATION_WARNINGS)
|
||||
-# define V8_DEPRECATED(message) [[deprecated(message)]]
|
||||
+# if defined(_MSC_VER) && _MSC_VER <= 1900
|
||||
+# if !defined(__clang__) && defined(_MSC_VER) && _MSC_VER < 1920
|
||||
+# define V8_DEPRECATED(message) __declspec(deprecated(message))
|
||||
+# else
|
||||
+# define V8_DEPRECATED(message) [[deprecated(message)]]
|
||||
@@ -28,12 +25,12 @@ index 77fd65c6c5b7d8c0a7fe7a37c40e17ce66f49ce6..010b3633546601ba70a55aeb8e8fc503
|
||||
#else
|
||||
# define V8_DEPRECATED(message)
|
||||
#endif
|
||||
@@ -465,7 +468,11 @@ path. Add it with -I<path> to the command line
|
||||
@@ -465,13 +468,17 @@ path. Add it with -I<path> to the command line
|
||||
|
||||
// A macro (V8_DEPRECATE_SOON) to make it easier to see what will be deprecated.
|
||||
#if defined(V8_IMMINENT_DEPRECATION_WARNINGS)
|
||||
-# define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
|
||||
+# if defined(_MSC_VER) && _MSC_VER <= 1900
|
||||
+# if !defined(__clang__) && defined(_MSC_VER) && _MSC_VER < 1920
|
||||
+# define V8_DEPRECATE_SOON(message) __declspec(deprecated(message))
|
||||
+# else
|
||||
+# define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
|
||||
@@ -41,3 +38,10 @@ index 77fd65c6c5b7d8c0a7fe7a37c40e17ce66f49ce6..010b3633546601ba70a55aeb8e8fc503
|
||||
#else
|
||||
# define V8_DEPRECATE_SOON(message)
|
||||
#endif
|
||||
|
||||
|
||||
-#if defined(__GNUC__) && !defined(__clang__) && (__GNUC__ < 6)
|
||||
+#if !defined(__clang__) && (defined(__GNUC__) && __GNUC__ < 6) || (defined(_MSC_VER) && _MSC_VER < 1920)
|
||||
# define V8_ENUM_DEPRECATED(message)
|
||||
# define V8_ENUM_DEPRECATE_SOON(message)
|
||||
#else
|
||||
@@ -18,7 +18,7 @@ This patch can be removed when streams support rab/gsab, or
|
||||
when support is synchronized across both v8 and node.
|
||||
|
||||
diff --git a/src/objects/js-array-buffer.cc b/src/objects/js-array-buffer.cc
|
||||
index 7c6dec2b52514085a731f78a551370d54912b5e9..2e8332b9fa6a6a3f55e78f29f710afa02c268b99 100644
|
||||
index dd59d5d6afc7c8e0b309d4e8928cd2bb7e682884..f3445a71aa02683dc40221b2eee1a80071629fef 100644
|
||||
--- a/src/objects/js-array-buffer.cc
|
||||
+++ b/src/objects/js-array-buffer.cc
|
||||
@@ -72,9 +72,9 @@ void JSArrayBuffer::Attach(std::shared_ptr<BackingStore> backing_store) {
|
||||
|
||||
@@ -20,12 +20,7 @@ let anErrorOccurred = false;
|
||||
function next (done) {
|
||||
const file = files.shift();
|
||||
if (!file) return done();
|
||||
let key = filenameToKey(file);
|
||||
// TODO: When we drop s3put, migrate the key to not include atom-shell in the callsites
|
||||
key = key.replace('atom-shell/dist/', 'headers/dist/');
|
||||
key = key.replace('atom-shell/symbols/', 'symbols/');
|
||||
key = key.replace('atom-shell/tmp/', 'checksums-scratchpad/');
|
||||
key = key.replace('electron-artifacts/', 'release-builds/');
|
||||
const key = filenameToKey(file);
|
||||
|
||||
const [containerName, ...keyPath] = key.split('/');
|
||||
const blobKey = keyPath.join('/');
|
||||
|
||||
@@ -21,8 +21,6 @@ LINUX_BINARIES = [
|
||||
'libGLESv2.so',
|
||||
'libffmpeg.so',
|
||||
'libvk_swiftshader.so',
|
||||
'swiftshader/libEGL.so',
|
||||
'swiftshader/libGLESv2.so',
|
||||
]
|
||||
|
||||
verbose_mode = False
|
||||
@@ -53,17 +51,6 @@ def get_env_var(name):
|
||||
return value
|
||||
|
||||
|
||||
def s3_config():
|
||||
config = (get_env_var('S3_BUCKET'),
|
||||
get_env_var('S3_ACCESS_KEY'),
|
||||
get_env_var('S3_SECRET_KEY'))
|
||||
message = ('Error: Please set the $ELECTRON_S3_BUCKET, '
|
||||
'$ELECTRON_S3_ACCESS_KEY, and '
|
||||
'$ELECTRON_S3_SECRET_KEY environment variables')
|
||||
assert all(len(c) for c in config), message
|
||||
return config
|
||||
|
||||
|
||||
def enable_verbose_mode():
|
||||
print('Running in verbose mode')
|
||||
global verbose_mode
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
/* eslint-disable camelcase */
|
||||
const AWS = require('aws-sdk');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
AWS.config.update({ region: 'us-west-2' });
|
||||
const s3 = new AWS.S3({ apiVersion: '2006-03-01' });
|
||||
|
||||
const args = require('minimist')(process.argv.slice(2));
|
||||
|
||||
let { bucket, prefix = '/', key_prefix = '', grant, _: files } = args;
|
||||
if (prefix && !prefix.endsWith(path.sep)) prefix = path.resolve(prefix) + path.sep;
|
||||
|
||||
function filenameToKey (file) {
|
||||
file = path.resolve(file);
|
||||
if (file.startsWith(prefix)) file = file.substr(prefix.length - 1);
|
||||
return key_prefix + (path.sep === '\\' ? file.replace(/\\/g, '/') : file);
|
||||
}
|
||||
|
||||
let anErrorOccurred = false;
|
||||
function next (done) {
|
||||
const file = files.shift();
|
||||
if (!file) return done();
|
||||
const key = filenameToKey(file);
|
||||
console.log(`Uploading '${file}' to bucket '${bucket}' with key '${key}'...`);
|
||||
s3.upload({
|
||||
Bucket: bucket,
|
||||
Key: key,
|
||||
Body: fs.createReadStream(file),
|
||||
ACL: grant
|
||||
}, (err, data) => {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
anErrorOccurred = true;
|
||||
}
|
||||
next(done);
|
||||
});
|
||||
}
|
||||
next(() => {
|
||||
process.exit(anErrorOccurred ? 1 : 0);
|
||||
});
|
||||
@@ -15,7 +15,7 @@ except ImportError:
|
||||
from urllib2 import urlopen
|
||||
import zipfile
|
||||
|
||||
from lib.config import is_verbose_mode, s3_config
|
||||
from lib.config import is_verbose_mode
|
||||
|
||||
ELECTRON_DIR = os.path.abspath(
|
||||
os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
|
||||
@@ -156,26 +156,9 @@ def get_electron_version():
|
||||
return 'v' + f.read().strip()
|
||||
|
||||
def store_artifact(prefix, key_prefix, files):
|
||||
# Legacy S3 Bucket
|
||||
s3put(prefix, key_prefix, files)
|
||||
# New AZ Storage
|
||||
# Azure Storage
|
||||
azput(prefix, key_prefix, files)
|
||||
|
||||
def s3put(prefix, key_prefix, files):
|
||||
bucket, access_key, secret_key = s3_config()
|
||||
env = os.environ.copy()
|
||||
env['AWS_ACCESS_KEY_ID'] = access_key
|
||||
env['AWS_SECRET_ACCESS_KEY'] = secret_key
|
||||
output = execute([
|
||||
'node',
|
||||
os.path.join(os.path.dirname(__file__), 's3put.js'),
|
||||
'--bucket', bucket,
|
||||
'--prefix', prefix,
|
||||
'--key_prefix', key_prefix,
|
||||
'--grant', 'public-read',
|
||||
] + files, env)
|
||||
print(output)
|
||||
|
||||
def azput(prefix, key_prefix, files):
|
||||
env = os.environ.copy()
|
||||
output = execute([
|
||||
|
||||
@@ -55,7 +55,7 @@ const getCustomOptions = () => {
|
||||
async function main () {
|
||||
const options = args.default ? defaultOptions : getCustomOptions();
|
||||
|
||||
const testChild = cp.spawn('python', options, {
|
||||
const testChild = cp.spawn('python3', options, {
|
||||
env: {
|
||||
...process.env,
|
||||
ELECTRON_RUN_AS_NODE: 'true',
|
||||
|
||||
@@ -62,9 +62,9 @@ async function circleCIcall (targetBranch, workflowName, options) {
|
||||
parameters: {}
|
||||
};
|
||||
if (options.ghRelease) {
|
||||
buildRequest.parameters['upload-to-s3'] = '0';
|
||||
buildRequest.parameters['upload-to-storage'] = '0';
|
||||
} else {
|
||||
buildRequest.parameters['upload-to-s3'] = '1';
|
||||
buildRequest.parameters['upload-to-storage'] = '1';
|
||||
}
|
||||
buildRequest.parameters[`run-${workflowName}`] = true;
|
||||
if (options.arch) {
|
||||
@@ -205,7 +205,7 @@ async function callAppVeyor (targetBranch, job, options) {
|
||||
};
|
||||
|
||||
if (!options.ghRelease) {
|
||||
environmentVariables.UPLOAD_TO_S3 = 1;
|
||||
environmentVariables.UPLOAD_TO_STORAGE = 1;
|
||||
}
|
||||
|
||||
const requestOpts = {
|
||||
|
||||
@@ -1,34 +1,25 @@
|
||||
const AWS = require('aws-sdk');
|
||||
|
||||
const lambda = new AWS.Lambda({
|
||||
credentials: {
|
||||
accessKeyId: process.env.AWS_LAMBDA_EXECUTE_KEY,
|
||||
secretAccessKey: process.env.AWS_LAMBDA_EXECUTE_SECRET
|
||||
},
|
||||
region: 'us-east-1'
|
||||
});
|
||||
const got = require('got');
|
||||
const url = require('url');
|
||||
|
||||
module.exports = async function getUrlHash (targetUrl, algorithm = 'sha256', attempts = 3) {
|
||||
const options = {
|
||||
code: process.env.ELECTRON_ARTIFACT_HASHER_FUNCTION_KEY,
|
||||
targetUrl,
|
||||
algorithm
|
||||
};
|
||||
const search = new url.URLSearchParams(options);
|
||||
const functionUrl = url.format({
|
||||
protocol: 'https:',
|
||||
hostname: 'electron-artifact-hasher.azurewebsites.net',
|
||||
pathname: '/api/HashArtifact',
|
||||
search: search.toString()
|
||||
});
|
||||
try {
|
||||
return new Promise((resolve, reject) => {
|
||||
lambda.invoke({
|
||||
FunctionName: 'hasher',
|
||||
Payload: JSON.stringify({
|
||||
targetUrl,
|
||||
algorithm
|
||||
})
|
||||
}, (err, data) => {
|
||||
if (err) return reject(err);
|
||||
try {
|
||||
const response = JSON.parse(data.Payload);
|
||||
if (response.statusCode !== 200) return reject(new Error('non-200 status code received from hasher function'));
|
||||
if (!response.hash) return reject(new Error('Successful lambda call but failed to get valid hash'));
|
||||
resolve(response.hash);
|
||||
} catch (err) {
|
||||
return reject(err);
|
||||
}
|
||||
});
|
||||
});
|
||||
const resp = await got(functionUrl);
|
||||
if (resp.statusCode !== 200) throw new Error('non-200 status code received from hasher function');
|
||||
if (!resp.body) throw new Error('Successful lambda call but failed to get valid hash');
|
||||
|
||||
return resp.body.trim();
|
||||
} catch (err) {
|
||||
if (attempts > 1) {
|
||||
console.error('Failed to get URL hash for', targetUrl, 'we will retry', err);
|
||||
|
||||
@@ -78,8 +78,6 @@ async function validateReleaseAssets (release, validatingRelease) {
|
||||
console.log(`${fail} error verifyingShasums`, err);
|
||||
});
|
||||
}
|
||||
const s3RemoteFiles = s3RemoteFilesForVersion(release.tag_name);
|
||||
await verifyShasumsForRemoteFiles(s3RemoteFiles, true);
|
||||
const azRemoteFiles = azRemoteFilesForVersion(release.tag_name);
|
||||
await verifyShasumsForRemoteFiles(azRemoteFiles, true);
|
||||
}
|
||||
@@ -130,9 +128,8 @@ function assetsForVersion (version, validatingRelease) {
|
||||
`electron-${version}-mas-arm64-dsym-snapshot.zip`,
|
||||
`electron-${version}-mas-arm64-symbols.zip`,
|
||||
`electron-${version}-mas-arm64.zip`,
|
||||
// TODO(jkleinsc) Symbol generation on 32-bit Windows is temporarily disabled due to failures
|
||||
// `electron-${version}-win32-ia32-pdb.zip`,
|
||||
// `electron-${version}-win32-ia32-symbols.zip`,
|
||||
`electron-${version}-win32-ia32-pdb.zip`,
|
||||
`electron-${version}-win32-ia32-symbols.zip`,
|
||||
`electron-${version}-win32-ia32.zip`,
|
||||
`electron-${version}-win32-x64-pdb.zip`,
|
||||
`electron-${version}-win32-x64-symbols.zip`,
|
||||
@@ -195,15 +192,6 @@ const cloudStoreFilePaths = (version) => [
|
||||
'SHASUMS256.txt'
|
||||
];
|
||||
|
||||
function s3RemoteFilesForVersion (version) {
|
||||
const bucket = 'https://gh-contractor-zcbenz.s3.amazonaws.com/';
|
||||
const versionPrefix = `${bucket}atom-shell/dist/${version}/`;
|
||||
return cloudStoreFilePaths(version).map((filePath) => ({
|
||||
file: filePath,
|
||||
url: `${versionPrefix}${filePath}`
|
||||
}));
|
||||
}
|
||||
|
||||
function azRemoteFilesForVersion (version) {
|
||||
const azCDN = 'https://artifacts.electronjs.org/headers/';
|
||||
const versionPrefix = `${azCDN}dist/${version}/`;
|
||||
|
||||
@@ -59,7 +59,7 @@ def main():
|
||||
with open(index_json, "wb") as f:
|
||||
f.write(new_content)
|
||||
|
||||
store_artifact(OUT_DIR, 'atom-shell/dist', [index_json])
|
||||
store_artifact(OUT_DIR, 'headers/dist', [index_json])
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
@@ -29,7 +29,7 @@ def main():
|
||||
]
|
||||
|
||||
if args.target_dir is None:
|
||||
store_artifact(directory, 'atom-shell/dist/{0}'.format(args.version),
|
||||
store_artifact(directory, 'headers/dist/{0}'.format(args.version),
|
||||
checksums)
|
||||
else:
|
||||
copy_files(checksums, args.target_dir)
|
||||
|
||||
@@ -45,9 +45,9 @@ def upload_node(version):
|
||||
versioned_header_tar = header_tar.format(version)
|
||||
shutil.copy2(generated_tar, os.path.join(GEN_DIR, versioned_header_tar))
|
||||
|
||||
store_artifact(GEN_DIR, 'atom-shell/dist/{0}'.format(version),
|
||||
store_artifact(GEN_DIR, 'headers/dist/{0}'.format(version),
|
||||
glob.glob('node-*.tar.gz'))
|
||||
store_artifact(GEN_DIR, 'atom-shell/dist/{0}'.format(version),
|
||||
store_artifact(GEN_DIR, 'headers/dist/{0}'.format(version),
|
||||
glob.glob('iojs-*.tar.gz'))
|
||||
|
||||
if PLATFORM == 'win32':
|
||||
@@ -73,13 +73,13 @@ def upload_node(version):
|
||||
shutil.copy2(electron_lib, v4_node_lib)
|
||||
|
||||
# Upload the node.lib.
|
||||
store_artifact(DIST_DIR, 'atom-shell/dist/{0}'.format(version), [node_lib])
|
||||
store_artifact(DIST_DIR, 'headers/dist/{0}'.format(version), [node_lib])
|
||||
|
||||
# Upload the iojs.lib.
|
||||
store_artifact(DIST_DIR, 'atom-shell/dist/{0}'.format(version), [iojs_lib])
|
||||
store_artifact(DIST_DIR, 'headers/dist/{0}'.format(version), [iojs_lib])
|
||||
|
||||
# Upload the v4 node.lib.
|
||||
store_artifact(DIST_DIR, 'atom-shell/dist/{0}'.format(version),
|
||||
store_artifact(DIST_DIR, 'headers/dist/{0}'.format(version),
|
||||
[v4_node_lib])
|
||||
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ def main():
|
||||
|
||||
files += glob.glob(SYMBOLS_DIR + '/*/*/*.src.zip')
|
||||
|
||||
# The file upload needs to be atom-shell/symbols/:symbol_name/:hash/:symbol
|
||||
# The file upload needs to be symbols/:symbol_name/:hash/:symbol
|
||||
os.chdir(SYMBOLS_DIR)
|
||||
files = [os.path.relpath(f, os.getcwd()) for f in files]
|
||||
|
||||
@@ -84,7 +84,7 @@ def run_symstore(pdb, dest, product):
|
||||
|
||||
|
||||
def upload_symbols(files):
|
||||
store_artifact(SYMBOLS_DIR, 'atom-shell/symbols',
|
||||
store_artifact(SYMBOLS_DIR, 'symbols',
|
||||
files)
|
||||
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ def main():
|
||||
args = parse_args()
|
||||
if args.verbose:
|
||||
enable_verbose_mode()
|
||||
if args.upload_to_s3:
|
||||
if args.upload_to_storage:
|
||||
utcnow = datetime.datetime.utcnow()
|
||||
args.upload_timestamp = utcnow.strftime('%Y%m%d')
|
||||
|
||||
@@ -64,7 +64,7 @@ def main():
|
||||
if not release['draft']:
|
||||
tag_exists = True
|
||||
|
||||
if not args.upload_to_s3:
|
||||
if not args.upload_to_storage:
|
||||
assert release['exists'], \
|
||||
'Release does not exist; cannot upload to GitHub!'
|
||||
assert tag_exists == args.overwrite, \
|
||||
@@ -76,10 +76,9 @@ def main():
|
||||
shutil.copy2(os.path.join(OUT_DIR, 'dist.zip'), electron_zip)
|
||||
upload_electron(release, electron_zip, args)
|
||||
if get_target_arch() != 'mips64el':
|
||||
if get_target_arch() != 'ia32' or PLATFORM != 'win32':
|
||||
symbols_zip = os.path.join(OUT_DIR, SYMBOLS_NAME)
|
||||
shutil.copy2(os.path.join(OUT_DIR, 'symbols.zip'), symbols_zip)
|
||||
upload_electron(release, symbols_zip, args)
|
||||
symbols_zip = os.path.join(OUT_DIR, SYMBOLS_NAME)
|
||||
shutil.copy2(os.path.join(OUT_DIR, 'symbols.zip'), symbols_zip)
|
||||
upload_electron(release, symbols_zip, args)
|
||||
if PLATFORM == 'darwin':
|
||||
if get_platform_key() == 'darwin' and get_target_arch() == 'x64':
|
||||
api_path = os.path.join(ELECTRON_DIR, 'electron-api.json')
|
||||
@@ -96,10 +95,9 @@ def main():
|
||||
shutil.copy2(os.path.join(OUT_DIR, 'dsym-snapshot.zip'), dsym_snaphot_zip)
|
||||
upload_electron(release, dsym_snaphot_zip, args)
|
||||
elif PLATFORM == 'win32':
|
||||
if get_target_arch() != 'ia32':
|
||||
pdb_zip = os.path.join(OUT_DIR, PDB_NAME)
|
||||
shutil.copy2(os.path.join(OUT_DIR, 'pdb.zip'), pdb_zip)
|
||||
upload_electron(release, pdb_zip, args)
|
||||
pdb_zip = os.path.join(OUT_DIR, PDB_NAME)
|
||||
shutil.copy2(os.path.join(OUT_DIR, 'pdb.zip'), pdb_zip)
|
||||
upload_electron(release, pdb_zip, args)
|
||||
elif PLATFORM == 'linux':
|
||||
debug_zip = os.path.join(OUT_DIR, DEBUG_NAME)
|
||||
shutil.copy2(os.path.join(OUT_DIR, 'debug.zip'), debug_zip)
|
||||
@@ -148,7 +146,7 @@ def main():
|
||||
OUT_DIR, 'hunspell_dictionaries.zip')
|
||||
upload_electron(release, hunspell_dictionaries_zip, args)
|
||||
|
||||
if not tag_exists and not args.upload_to_s3:
|
||||
if not tag_exists and not args.upload_to_storage:
|
||||
# Upload symbols to symbol server.
|
||||
run_python_upload_script('upload-symbols.py')
|
||||
if PLATFORM == 'win32':
|
||||
@@ -174,9 +172,9 @@ def parse_args():
|
||||
parser.add_argument('-p', '--publish-release',
|
||||
help='Publish the release',
|
||||
action='store_true')
|
||||
parser.add_argument('-s', '--upload_to_s3',
|
||||
help='Upload assets to s3 bucket',
|
||||
dest='upload_to_s3',
|
||||
parser.add_argument('-s', '--upload_to_storage',
|
||||
help='Upload assets to azure bucket',
|
||||
dest='upload_to_storage',
|
||||
action='store_true',
|
||||
default=False,
|
||||
required=False)
|
||||
@@ -342,9 +340,10 @@ def upload_electron(release, file_path, args):
|
||||
except NonZipFileError:
|
||||
pass
|
||||
|
||||
# if upload_to_s3 is set, skip github upload.
|
||||
if args.upload_to_s3:
|
||||
key_prefix = 'electron-artifacts/{0}_{1}'.format(args.version,
|
||||
# if upload_to_storage is set, skip github upload.
|
||||
# todo (vertedinde): migrate this variable to upload_to_storage
|
||||
if args.upload_to_storage:
|
||||
key_prefix = 'release-builds/{0}_{1}'.format(args.version,
|
||||
args.upload_timestamp)
|
||||
store_artifact(os.path.dirname(file_path), key_prefix, [file_path])
|
||||
upload_sha256_checksum(args.version, file_path, key_prefix)
|
||||
@@ -369,7 +368,7 @@ def upload_io_to_github(release, filename, filepath, version):
|
||||
def upload_sha256_checksum(version, file_path, key_prefix=None):
|
||||
checksum_path = '{}.sha256sum'.format(file_path)
|
||||
if key_prefix is None:
|
||||
key_prefix = 'atom-shell/tmp/{0}'.format(version)
|
||||
key_prefix = 'checksums-scratchpad/{0}'.format(version)
|
||||
sha256 = hashlib.sha256()
|
||||
with open(file_path, 'rb') as f:
|
||||
sha256.update(f.read())
|
||||
|
||||
@@ -69,8 +69,6 @@ locales/zh-TW.pak
|
||||
resources.pak
|
||||
resources/default_app.asar
|
||||
snapshot_blob.bin
|
||||
swiftshader/libEGL.so
|
||||
swiftshader/libGLESv2.so
|
||||
vk_swiftshader_icd.json
|
||||
v8_context_snapshot.bin
|
||||
version
|
||||
|
||||
@@ -69,8 +69,6 @@ locales/zh-TW.pak
|
||||
resources.pak
|
||||
resources/default_app.asar
|
||||
snapshot_blob.bin
|
||||
swiftshader/libEGL.so
|
||||
swiftshader/libGLESv2.so
|
||||
vk_swiftshader_icd.json
|
||||
v8_context_snapshot.bin
|
||||
version
|
||||
|
||||
@@ -69,8 +69,6 @@ locales/zh-TW.pak
|
||||
resources.pak
|
||||
resources/default_app.asar
|
||||
snapshot_blob.bin
|
||||
swiftshader/libEGL.so
|
||||
swiftshader/libGLESv2.so
|
||||
vk_swiftshader_icd.json
|
||||
v8_context_snapshot.bin
|
||||
version
|
||||
|
||||
@@ -69,8 +69,6 @@ locales/zh-TW.pak
|
||||
resources.pak
|
||||
resources/default_app.asar
|
||||
snapshot_blob.bin
|
||||
swiftshader/libEGL.so
|
||||
swiftshader/libGLESv2.so
|
||||
vk_swiftshader_icd.json
|
||||
v8_context_snapshot.bin
|
||||
version
|
||||
|
||||
@@ -65,8 +65,6 @@ locales/zh-TW.pak
|
||||
resources.pak
|
||||
resources/default_app.asar
|
||||
snapshot_blob.bin
|
||||
swiftshader/libEGL.dll
|
||||
swiftshader/libGLESv2.dll
|
||||
vk_swiftshader_icd.json
|
||||
vk_swiftshader.dll
|
||||
vulkan-1.dll
|
||||
|
||||
@@ -66,8 +66,6 @@ locales/zh-TW.pak
|
||||
resources.pak
|
||||
resources/default_app.asar
|
||||
snapshot_blob.bin
|
||||
swiftshader/libEGL.dll
|
||||
swiftshader/libGLESv2.dll
|
||||
vk_swiftshader_icd.json
|
||||
vk_swiftshader.dll
|
||||
vulkan-1.dll
|
||||
|
||||
@@ -66,8 +66,6 @@ locales/zh-TW.pak
|
||||
resources.pak
|
||||
resources/default_app.asar
|
||||
snapshot_blob.bin
|
||||
swiftshader/libEGL.dll
|
||||
swiftshader/libGLESv2.dll
|
||||
vk_swiftshader_icd.json
|
||||
vk_swiftshader.dll
|
||||
vulkan-1.dll
|
||||
|
||||
@@ -519,24 +519,21 @@ bool NotificationCallbackWrapper(
|
||||
const base::RepeatingCallback<
|
||||
void(const base::CommandLine& command_line,
|
||||
const base::FilePath& current_directory,
|
||||
const std::vector<uint8_t> additional_data,
|
||||
const ProcessSingleton::NotificationAckCallback& ack_callback)>&
|
||||
callback,
|
||||
const std::vector<const uint8_t> additional_data)>& callback,
|
||||
const base::CommandLine& cmd,
|
||||
const base::FilePath& cwd,
|
||||
const std::vector<uint8_t> additional_data,
|
||||
const ProcessSingleton::NotificationAckCallback& ack_callback) {
|
||||
const std::vector<const uint8_t> additional_data) {
|
||||
// Make sure the callback is called after app gets ready.
|
||||
if (Browser::Get()->is_ready()) {
|
||||
callback.Run(cmd, cwd, std::move(additional_data), ack_callback);
|
||||
callback.Run(cmd, cwd, std::move(additional_data));
|
||||
} else {
|
||||
scoped_refptr<base::SingleThreadTaskRunner> task_runner(
|
||||
base::ThreadTaskRunnerHandle::Get());
|
||||
|
||||
// Make a copy of the span so that the data isn't lost.
|
||||
task_runner->PostTask(
|
||||
FROM_HERE, base::BindOnce(base::IgnoreResult(callback), cmd, cwd,
|
||||
std::move(additional_data), ack_callback));
|
||||
task_runner->PostTask(FROM_HERE,
|
||||
base::BindOnce(base::IgnoreResult(callback), cmd, cwd,
|
||||
std::move(additional_data)));
|
||||
}
|
||||
// ProcessSingleton needs to know whether current process is quiting.
|
||||
return !Browser::Get()->is_shutting_down();
|
||||
@@ -1083,54 +1080,15 @@ std::string App::GetLocaleCountryCode() {
|
||||
return region.size() == 2 ? region : std::string();
|
||||
}
|
||||
|
||||
void App::OnFirstInstanceAck(
|
||||
const base::span<const uint8_t>* first_instance_data) {
|
||||
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
|
||||
v8::Locker locker(isolate);
|
||||
v8::HandleScope handle_scope(isolate);
|
||||
base::Value data_to_send;
|
||||
if (first_instance_data) {
|
||||
// Don't send back the local directly, because it might be empty.
|
||||
v8::Local<v8::Value> data_local;
|
||||
data_local = DeserializeV8Value(isolate, *first_instance_data);
|
||||
if (!data_local.IsEmpty()) {
|
||||
gin::ConvertFromV8(isolate, data_local, &data_to_send);
|
||||
}
|
||||
}
|
||||
Emit("first-instance-ack", data_to_send);
|
||||
}
|
||||
|
||||
// This function handles the user calling
|
||||
// the callback parameter sent out by the second-instance event.
|
||||
static void AckCallbackWrapper(
|
||||
const ProcessSingleton::NotificationAckCallback& ack_callback,
|
||||
gin::Arguments* args) {
|
||||
blink::CloneableMessage ack_message;
|
||||
args->GetNext(&ack_message);
|
||||
if (!ack_message.encoded_message.empty()) {
|
||||
ack_callback.Run(&ack_message.encoded_message);
|
||||
} else {
|
||||
ack_callback.Run(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
void App::OnSecondInstance(
|
||||
const base::CommandLine& cmd,
|
||||
const base::FilePath& cwd,
|
||||
const std::vector<uint8_t> additional_data,
|
||||
const ProcessSingleton::NotificationAckCallback& ack_callback) {
|
||||
void App::OnSecondInstance(const base::CommandLine& cmd,
|
||||
const base::FilePath& cwd,
|
||||
const std::vector<const uint8_t> additional_data) {
|
||||
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
|
||||
v8::Locker locker(isolate);
|
||||
v8::HandleScope handle_scope(isolate);
|
||||
v8::Local<v8::Value> data_value =
|
||||
DeserializeV8Value(isolate, std::move(additional_data));
|
||||
auto cb = base::BindRepeating(&AckCallbackWrapper, ack_callback);
|
||||
bool prevent_default =
|
||||
Emit("second-instance", cmd.argv(), cwd, data_value, cb);
|
||||
if (!prevent_default) {
|
||||
// Call the callback ourselves, and send back nothing.
|
||||
ack_callback.Run(nullptr);
|
||||
}
|
||||
Emit("second-instance", cmd.argv(), cwd, data_value);
|
||||
}
|
||||
|
||||
bool App::HasSingleInstanceLock() const {
|
||||
@@ -1151,9 +1109,6 @@ bool App::RequestSingleInstanceLock(gin::Arguments* args) {
|
||||
base::CreateDirectoryAndGetError(user_dir, nullptr);
|
||||
|
||||
auto cb = base::BindRepeating(&App::OnSecondInstance, base::Unretained(this));
|
||||
auto wrapped_cb = base::BindRepeating(NotificationCallbackWrapper, cb);
|
||||
auto ack_cb =
|
||||
base::BindRepeating(&App::OnFirstInstanceAck, base::Unretained(this));
|
||||
|
||||
blink::CloneableMessage additional_data_message;
|
||||
args->GetNext(&additional_data_message);
|
||||
@@ -1162,10 +1117,11 @@ bool App::RequestSingleInstanceLock(gin::Arguments* args) {
|
||||
IsSandboxEnabled(base::CommandLine::ForCurrentProcess());
|
||||
process_singleton_ = std::make_unique<ProcessSingleton>(
|
||||
program_name, user_dir, additional_data_message.encoded_message,
|
||||
app_is_sandboxed, wrapped_cb, ack_cb);
|
||||
app_is_sandboxed, base::BindRepeating(NotificationCallbackWrapper, cb));
|
||||
#else
|
||||
process_singleton_ = std::make_unique<ProcessSingleton>(
|
||||
user_dir, additional_data_message.encoded_message, wrapped_cb, ack_cb);
|
||||
user_dir, additional_data_message.encoded_message,
|
||||
base::BindRepeating(NotificationCallbackWrapper, cb));
|
||||
#endif
|
||||
|
||||
switch (process_singleton_->NotifyOtherProcessOrCreate()) {
|
||||
|
||||
@@ -193,12 +193,9 @@ class App : public ElectronBrowserClient::Delegate,
|
||||
void SetDesktopName(const std::string& desktop_name);
|
||||
std::string GetLocale();
|
||||
std::string GetLocaleCountryCode();
|
||||
void OnFirstInstanceAck(const base::span<const uint8_t>* first_instance_data);
|
||||
void OnSecondInstance(
|
||||
const base::CommandLine& cmd,
|
||||
const base::FilePath& cwd,
|
||||
const std::vector<uint8_t> additional_data,
|
||||
const ProcessSingleton::NotificationAckCallback& ack_callback);
|
||||
void OnSecondInstance(const base::CommandLine& cmd,
|
||||
const base::FilePath& cwd,
|
||||
const std::vector<const uint8_t> additional_data);
|
||||
bool HasSingleInstanceLock() const;
|
||||
bool RequestSingleInstanceLock(gin::Arguments* args);
|
||||
void ReleaseSingleInstanceLock();
|
||||
|
||||
@@ -31,12 +31,24 @@ void SetElectronCryptoReady(bool ready) {
|
||||
#endif
|
||||
|
||||
bool IsEncryptionAvailable() {
|
||||
#if BUILDFLAG(IS_LINUX)
|
||||
// Calling IsEncryptionAvailable() before the app is ready results in a crash
|
||||
// on Linux.
|
||||
// Refs: https://github.com/electron/electron/issues/32206.
|
||||
if (!Browser::Get()->is_ready())
|
||||
return false;
|
||||
#endif
|
||||
return OSCrypt::IsEncryptionAvailable();
|
||||
}
|
||||
|
||||
v8::Local<v8::Value> EncryptString(v8::Isolate* isolate,
|
||||
const std::string& plaintext) {
|
||||
if (!OSCrypt::IsEncryptionAvailable()) {
|
||||
if (!IsEncryptionAvailable()) {
|
||||
if (!Browser::Get()->is_ready()) {
|
||||
gin_helper::ErrorThrower(isolate).ThrowError(
|
||||
"safeStorage cannot be used before app is ready");
|
||||
return v8::Local<v8::Value>();
|
||||
}
|
||||
gin_helper::ErrorThrower(isolate).ThrowError(
|
||||
"Error while decrypting the ciphertext provided to "
|
||||
"safeStorage.decryptString. "
|
||||
@@ -59,7 +71,12 @@ v8::Local<v8::Value> EncryptString(v8::Isolate* isolate,
|
||||
}
|
||||
|
||||
std::string DecryptString(v8::Isolate* isolate, v8::Local<v8::Value> buffer) {
|
||||
if (!OSCrypt::IsEncryptionAvailable()) {
|
||||
if (!IsEncryptionAvailable()) {
|
||||
if (!Browser::Get()->is_ready()) {
|
||||
gin_helper::ErrorThrower(isolate).ThrowError(
|
||||
"safeStorage cannot be used before app is ready");
|
||||
return "";
|
||||
}
|
||||
gin_helper::ErrorThrower(isolate).ThrowError(
|
||||
"Error while decrypting the ciphertext provided to "
|
||||
"safeStorage.decryptString. "
|
||||
|
||||
@@ -1510,7 +1510,7 @@ void WebContents::HandleNewRenderFrame(
|
||||
|
||||
auto* web_frame = WebFrameMain::FromRenderFrameHost(render_frame_host);
|
||||
if (web_frame)
|
||||
web_frame->Connect();
|
||||
web_frame->MaybeSetupMojoConnection();
|
||||
}
|
||||
|
||||
void WebContents::OnBackgroundColorChanged() {
|
||||
@@ -2593,7 +2593,7 @@ bool WebContents::IsCurrentlyAudible() {
|
||||
|
||||
#if BUILDFLAG(ENABLE_PRINTING)
|
||||
void WebContents::OnGetDefaultPrinter(
|
||||
base::Value print_settings,
|
||||
base::Value::Dict print_settings,
|
||||
printing::CompletionCallback print_callback,
|
||||
std::u16string device_name,
|
||||
bool silent,
|
||||
@@ -2623,7 +2623,7 @@ void WebContents::OnGetDefaultPrinter(
|
||||
return;
|
||||
}
|
||||
|
||||
print_settings.SetStringKey(printing::kSettingDeviceName, printer_name);
|
||||
print_settings.Set(printing::kSettingDeviceName, printer_name);
|
||||
|
||||
auto* print_view_manager =
|
||||
PrintViewManagerElectron::FromWebContents(web_contents());
|
||||
@@ -2642,7 +2642,7 @@ void WebContents::OnGetDefaultPrinter(
|
||||
void WebContents::Print(gin::Arguments* args) {
|
||||
gin_helper::Dictionary options =
|
||||
gin::Dictionary::CreateEmpty(args->isolate());
|
||||
base::Value settings(base::Value::Type::DICTIONARY);
|
||||
base::Value::Dict settings;
|
||||
|
||||
if (args->Length() >= 1 && !args->GetNext(&options)) {
|
||||
gin_helper::ErrorThrower(args->isolate())
|
||||
@@ -2663,8 +2663,7 @@ void WebContents::Print(gin::Arguments* args) {
|
||||
|
||||
bool print_background = false;
|
||||
options.Get("printBackground", &print_background);
|
||||
settings.SetBoolKey(printing::kSettingShouldPrintBackgrounds,
|
||||
print_background);
|
||||
settings.Set(printing::kSettingShouldPrintBackgrounds, print_background);
|
||||
|
||||
// Set custom margin settings
|
||||
gin_helper::Dictionary margins =
|
||||
@@ -2673,28 +2672,26 @@ void WebContents::Print(gin::Arguments* args) {
|
||||
printing::mojom::MarginType margin_type =
|
||||
printing::mojom::MarginType::kDefaultMargins;
|
||||
margins.Get("marginType", &margin_type);
|
||||
settings.SetIntKey(printing::kSettingMarginsType,
|
||||
static_cast<int>(margin_type));
|
||||
settings.Set(printing::kSettingMarginsType, static_cast<int>(margin_type));
|
||||
|
||||
if (margin_type == printing::mojom::MarginType::kCustomMargins) {
|
||||
base::Value custom_margins(base::Value::Type::DICTIONARY);
|
||||
base::Value::Dict custom_margins;
|
||||
int top = 0;
|
||||
margins.Get("top", &top);
|
||||
custom_margins.SetIntKey(printing::kSettingMarginTop, top);
|
||||
custom_margins.Set(printing::kSettingMarginTop, top);
|
||||
int bottom = 0;
|
||||
margins.Get("bottom", &bottom);
|
||||
custom_margins.SetIntKey(printing::kSettingMarginBottom, bottom);
|
||||
custom_margins.Set(printing::kSettingMarginBottom, bottom);
|
||||
int left = 0;
|
||||
margins.Get("left", &left);
|
||||
custom_margins.SetIntKey(printing::kSettingMarginLeft, left);
|
||||
custom_margins.Set(printing::kSettingMarginLeft, left);
|
||||
int right = 0;
|
||||
margins.Get("right", &right);
|
||||
custom_margins.SetIntKey(printing::kSettingMarginRight, right);
|
||||
settings.SetPath(printing::kSettingMarginsCustom,
|
||||
std::move(custom_margins));
|
||||
custom_margins.Set(printing::kSettingMarginRight, right);
|
||||
settings.Set(printing::kSettingMarginsCustom, std::move(custom_margins));
|
||||
}
|
||||
} else {
|
||||
settings.SetIntKey(
|
||||
settings.Set(
|
||||
printing::kSettingMarginsType,
|
||||
static_cast<int>(printing::mojom::MarginType::kDefaultMargins));
|
||||
}
|
||||
@@ -2704,12 +2701,12 @@ void WebContents::Print(gin::Arguments* args) {
|
||||
options.Get("color", &print_color);
|
||||
auto const color_model = print_color ? printing::mojom::ColorModel::kColor
|
||||
: printing::mojom::ColorModel::kGray;
|
||||
settings.SetIntKey(printing::kSettingColor, static_cast<int>(color_model));
|
||||
settings.Set(printing::kSettingColor, static_cast<int>(color_model));
|
||||
|
||||
// Is the orientation landscape or portrait.
|
||||
bool landscape = false;
|
||||
options.Get("landscape", &landscape);
|
||||
settings.SetBoolKey(printing::kSettingLandscape, landscape);
|
||||
settings.Set(printing::kSettingLandscape, landscape);
|
||||
|
||||
// We set the default to the system's default printer and only update
|
||||
// if at the Chromium level if the user overrides.
|
||||
@@ -2724,21 +2721,21 @@ void WebContents::Print(gin::Arguments* args) {
|
||||
|
||||
int scale_factor = 100;
|
||||
options.Get("scaleFactor", &scale_factor);
|
||||
settings.SetIntKey(printing::kSettingScaleFactor, scale_factor);
|
||||
settings.Set(printing::kSettingScaleFactor, scale_factor);
|
||||
|
||||
int pages_per_sheet = 1;
|
||||
options.Get("pagesPerSheet", &pages_per_sheet);
|
||||
settings.SetIntKey(printing::kSettingPagesPerSheet, pages_per_sheet);
|
||||
settings.Set(printing::kSettingPagesPerSheet, pages_per_sheet);
|
||||
|
||||
// True if the user wants to print with collate.
|
||||
bool collate = true;
|
||||
options.Get("collate", &collate);
|
||||
settings.SetBoolKey(printing::kSettingCollate, collate);
|
||||
settings.Set(printing::kSettingCollate, collate);
|
||||
|
||||
// The number of individual copies to print
|
||||
int copies = 1;
|
||||
options.Get("copies", &copies);
|
||||
settings.SetIntKey(printing::kSettingCopies, copies);
|
||||
settings.Set(printing::kSettingCopies, copies);
|
||||
|
||||
// Strings to be printed as headers and footers if requested by the user.
|
||||
std::string header;
|
||||
@@ -2747,53 +2744,52 @@ void WebContents::Print(gin::Arguments* args) {
|
||||
options.Get("footer", &footer);
|
||||
|
||||
if (!(header.empty() && footer.empty())) {
|
||||
settings.SetBoolKey(printing::kSettingHeaderFooterEnabled, true);
|
||||
settings.Set(printing::kSettingHeaderFooterEnabled, true);
|
||||
|
||||
settings.SetStringKey(printing::kSettingHeaderFooterTitle, header);
|
||||
settings.SetStringKey(printing::kSettingHeaderFooterURL, footer);
|
||||
settings.Set(printing::kSettingHeaderFooterTitle, header);
|
||||
settings.Set(printing::kSettingHeaderFooterURL, footer);
|
||||
} else {
|
||||
settings.SetBoolKey(printing::kSettingHeaderFooterEnabled, false);
|
||||
settings.Set(printing::kSettingHeaderFooterEnabled, false);
|
||||
}
|
||||
|
||||
// We don't want to allow the user to enable these settings
|
||||
// but we need to set them or a CHECK is hit.
|
||||
settings.SetIntKey(printing::kSettingPrinterType,
|
||||
static_cast<int>(printing::mojom::PrinterType::kLocal));
|
||||
settings.SetBoolKey(printing::kSettingShouldPrintSelectionOnly, false);
|
||||
settings.SetBoolKey(printing::kSettingRasterizePdf, false);
|
||||
settings.Set(printing::kSettingPrinterType,
|
||||
static_cast<int>(printing::mojom::PrinterType::kLocal));
|
||||
settings.Set(printing::kSettingShouldPrintSelectionOnly, false);
|
||||
settings.Set(printing::kSettingRasterizePdf, false);
|
||||
|
||||
// Set custom page ranges to print
|
||||
std::vector<gin_helper::Dictionary> page_ranges;
|
||||
if (options.Get("pageRanges", &page_ranges)) {
|
||||
base::Value page_range_list(base::Value::Type::LIST);
|
||||
base::Value::List page_range_list;
|
||||
for (auto& range : page_ranges) {
|
||||
int from, to;
|
||||
if (range.Get("from", &from) && range.Get("to", &to)) {
|
||||
base::Value range(base::Value::Type::DICTIONARY);
|
||||
base::Value::Dict range;
|
||||
// Chromium uses 1-based page ranges, so increment each by 1.
|
||||
range.SetIntKey(printing::kSettingPageRangeFrom, from + 1);
|
||||
range.SetIntKey(printing::kSettingPageRangeTo, to + 1);
|
||||
range.Set(printing::kSettingPageRangeFrom, from + 1);
|
||||
range.Set(printing::kSettingPageRangeTo, to + 1);
|
||||
page_range_list.Append(std::move(range));
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (!page_range_list.GetListDeprecated().empty())
|
||||
settings.SetPath(printing::kSettingPageRange, std::move(page_range_list));
|
||||
if (!page_range_list.empty())
|
||||
settings.Set(printing::kSettingPageRange, std::move(page_range_list));
|
||||
}
|
||||
|
||||
// Duplex type user wants to use.
|
||||
printing::mojom::DuplexMode duplex_mode =
|
||||
printing::mojom::DuplexMode::kSimplex;
|
||||
options.Get("duplexMode", &duplex_mode);
|
||||
settings.SetIntKey(printing::kSettingDuplexMode,
|
||||
static_cast<int>(duplex_mode));
|
||||
settings.Set(printing::kSettingDuplexMode, static_cast<int>(duplex_mode));
|
||||
|
||||
// We've already done necessary parameter sanitization at the
|
||||
// JS level, so we can simply pass this through.
|
||||
base::Value media_size(base::Value::Type::DICTIONARY);
|
||||
if (options.Get("mediaSize", &media_size))
|
||||
settings.SetKey(printing::kSettingMediaSize, std::move(media_size));
|
||||
settings.Set(printing::kSettingMediaSize, std::move(media_size));
|
||||
|
||||
// Set custom dots per inch (dpi)
|
||||
gin_helper::Dictionary dpi_settings;
|
||||
@@ -2801,13 +2797,13 @@ void WebContents::Print(gin::Arguments* args) {
|
||||
if (options.Get("dpi", &dpi_settings)) {
|
||||
int horizontal = 72;
|
||||
dpi_settings.Get("horizontal", &horizontal);
|
||||
settings.SetIntKey(printing::kSettingDpiHorizontal, horizontal);
|
||||
settings.Set(printing::kSettingDpiHorizontal, horizontal);
|
||||
int vertical = 72;
|
||||
dpi_settings.Get("vertical", &vertical);
|
||||
settings.SetIntKey(printing::kSettingDpiVertical, vertical);
|
||||
settings.Set(printing::kSettingDpiVertical, vertical);
|
||||
} else {
|
||||
settings.SetIntKey(printing::kSettingDpiHorizontal, dpi);
|
||||
settings.SetIntKey(printing::kSettingDpiVertical, dpi);
|
||||
settings.Set(printing::kSettingDpiHorizontal, dpi);
|
||||
settings.Set(printing::kSettingDpiVertical, dpi);
|
||||
}
|
||||
|
||||
print_task_runner_->PostTaskAndReplyWithResult(
|
||||
|
||||
@@ -222,7 +222,7 @@ class WebContents : public ExclusiveAccessContext,
|
||||
void HandleNewRenderFrame(content::RenderFrameHost* render_frame_host);
|
||||
|
||||
#if BUILDFLAG(ENABLE_PRINTING)
|
||||
void OnGetDefaultPrinter(base::Value print_settings,
|
||||
void OnGetDefaultPrinter(base::Value::Dict print_settings,
|
||||
printing::CompletionCallback print_callback,
|
||||
std::u16string device_name,
|
||||
bool silent,
|
||||
|
||||
@@ -96,13 +96,15 @@ void WebFrameMain::Destroyed() {
|
||||
void WebFrameMain::MarkRenderFrameDisposed() {
|
||||
render_frame_ = nullptr;
|
||||
render_frame_disposed_ = true;
|
||||
TeardownMojoConnection();
|
||||
}
|
||||
|
||||
void WebFrameMain::UpdateRenderFrameHost(content::RenderFrameHost* rfh) {
|
||||
// Should only be called when swapping frames.
|
||||
render_frame_disposed_ = false;
|
||||
render_frame_ = rfh;
|
||||
renderer_api_.reset();
|
||||
TeardownMojoConnection();
|
||||
MaybeSetupMojoConnection();
|
||||
}
|
||||
|
||||
bool WebFrameMain::CheckRenderFrame() const {
|
||||
@@ -182,20 +184,30 @@ void WebFrameMain::Send(v8::Isolate* isolate,
|
||||
}
|
||||
|
||||
const mojo::Remote<mojom::ElectronRenderer>& WebFrameMain::GetRendererApi() {
|
||||
if (!renderer_api_) {
|
||||
pending_receiver_ = renderer_api_.BindNewPipeAndPassReceiver();
|
||||
if (render_frame_->IsRenderFrameCreated()) {
|
||||
render_frame_->GetRemoteInterfaces()->GetInterface(
|
||||
std::move(pending_receiver_));
|
||||
}
|
||||
renderer_api_.set_disconnect_handler(base::BindOnce(
|
||||
&WebFrameMain::OnRendererConnectionError, weak_factory_.GetWeakPtr()));
|
||||
}
|
||||
MaybeSetupMojoConnection();
|
||||
return renderer_api_;
|
||||
}
|
||||
|
||||
void WebFrameMain::OnRendererConnectionError() {
|
||||
void WebFrameMain::MaybeSetupMojoConnection() {
|
||||
if (!renderer_api_) {
|
||||
pending_receiver_ = renderer_api_.BindNewPipeAndPassReceiver();
|
||||
renderer_api_.set_disconnect_handler(base::BindOnce(
|
||||
&WebFrameMain::OnRendererConnectionError, weak_factory_.GetWeakPtr()));
|
||||
}
|
||||
// Wait for RenderFrame to be created in renderer before accessing remote.
|
||||
if (pending_receiver_ && render_frame_->IsRenderFrameCreated()) {
|
||||
render_frame_->GetRemoteInterfaces()->GetInterface(
|
||||
std::move(pending_receiver_));
|
||||
}
|
||||
}
|
||||
|
||||
void WebFrameMain::TeardownMojoConnection() {
|
||||
renderer_api_.reset();
|
||||
pending_receiver_.reset();
|
||||
}
|
||||
|
||||
void WebFrameMain::OnRendererConnectionError() {
|
||||
TeardownMojoConnection();
|
||||
}
|
||||
|
||||
void WebFrameMain::PostMessage(v8::Isolate* isolate,
|
||||
@@ -315,13 +327,6 @@ std::vector<content::RenderFrameHost*> WebFrameMain::FramesInSubtree() const {
|
||||
return frame_hosts;
|
||||
}
|
||||
|
||||
void WebFrameMain::Connect() {
|
||||
if (pending_receiver_) {
|
||||
render_frame_->GetRemoteInterfaces()->GetInterface(
|
||||
std::move(pending_receiver_));
|
||||
}
|
||||
}
|
||||
|
||||
void WebFrameMain::DOMContentLoaded() {
|
||||
Emit("dom-ready");
|
||||
}
|
||||
|
||||
@@ -82,6 +82,9 @@ class WebFrameMain : public gin::Wrappable<WebFrameMain>,
|
||||
void UpdateRenderFrameHost(content::RenderFrameHost* rfh);
|
||||
|
||||
const mojo::Remote<mojom::ElectronRenderer>& GetRendererApi();
|
||||
void MaybeSetupMojoConnection();
|
||||
void TeardownMojoConnection();
|
||||
void OnRendererConnectionError();
|
||||
|
||||
// WebFrameMain can outlive its RenderFrameHost pointer so we need to check
|
||||
// whether its been disposed of prior to accessing it.
|
||||
@@ -112,8 +115,6 @@ class WebFrameMain : public gin::Wrappable<WebFrameMain>,
|
||||
std::vector<content::RenderFrameHost*> Frames() const;
|
||||
std::vector<content::RenderFrameHost*> FramesInSubtree() const;
|
||||
|
||||
void OnRendererConnectionError();
|
||||
void Connect();
|
||||
void DOMContentLoaded();
|
||||
|
||||
mojo::Remote<mojom::ElectronRenderer> renderer_api_;
|
||||
|
||||
@@ -314,26 +314,32 @@ Browser::LoginItemSettings Browser::GetLoginItemSettings(
|
||||
return settings;
|
||||
}
|
||||
|
||||
// Some logic here copied from GetLoginItemForApp in base/mac/mac_util.mm
|
||||
void RemoveFromLoginItems() {
|
||||
#pragma clang diagnostic push // https://crbug.com/1154377
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
// logic to find the login item copied from GetLoginItemForApp in
|
||||
// base/mac/mac_util.mm
|
||||
base::ScopedCFTypeRef<LSSharedFileListRef> login_items(
|
||||
LSSharedFileListCreate(NULL, kLSSharedFileListSessionLoginItems, NULL));
|
||||
if (!login_items.get()) {
|
||||
LOG(ERROR) << "Couldn't get a Login Items list.";
|
||||
return;
|
||||
}
|
||||
|
||||
base::scoped_nsobject<NSArray> login_items_array(
|
||||
base::mac::CFToNSCast(LSSharedFileListCopySnapshot(login_items, NULL)));
|
||||
NSURL* url = [NSURL fileURLWithPath:[base::mac::MainBundle() bundlePath]];
|
||||
for (NSUInteger i = 0; i < [login_items_array count]; ++i) {
|
||||
for (id login_item in login_items_array.get()) {
|
||||
LSSharedFileListItemRef item =
|
||||
reinterpret_cast<LSSharedFileListItemRef>(login_items_array[i]);
|
||||
reinterpret_cast<LSSharedFileListItemRef>(login_item);
|
||||
|
||||
// kLSSharedFileListDoNotMountVolumes is used so that we don't trigger
|
||||
// mounting when it's not expected by a user. Just listing the login
|
||||
// items should not cause any side-effects.
|
||||
base::ScopedCFTypeRef<CFErrorRef> error;
|
||||
CFURLRef item_url_ref =
|
||||
LSSharedFileListItemCopyResolvedURL(item, 0, error.InitializeInto());
|
||||
base::ScopedCFTypeRef<CFURLRef> item_url_ref(
|
||||
LSSharedFileListItemCopyResolvedURL(
|
||||
item, kLSSharedFileListDoNotMountVolumes, error.InitializeInto()));
|
||||
|
||||
if (!error && item_url_ref) {
|
||||
base::ScopedCFTypeRef<CFURLRef> item_url(item_url_ref);
|
||||
if (CFEqual(item_url, url)) {
|
||||
|
||||
@@ -1333,6 +1333,11 @@ void ElectronBrowserClient::
|
||||
DCHECK(browser_context);
|
||||
DCHECK(factories);
|
||||
|
||||
auto* protocol_registry =
|
||||
ProtocolRegistry::FromBrowserContext(browser_context);
|
||||
protocol_registry->RegisterURLLoaderFactories(factories,
|
||||
false /* allow_file_access */);
|
||||
|
||||
#if BUILDFLAG(ENABLE_EXTENSIONS)
|
||||
factories->emplace(
|
||||
extensions::kExtensionScheme,
|
||||
|
||||
@@ -417,11 +417,6 @@ int ElectronBrowserMainParts::PreMainMessageLoopRun() {
|
||||
// url::Add*Scheme are not threadsafe, this helps prevent data races.
|
||||
url::LockSchemeRegistries();
|
||||
|
||||
// The First-Party Sets feature always expects to be initialized
|
||||
// CL: https://chromium-review.googlesource.com/c/chromium/src/+/3448551
|
||||
content::FirstPartySetsHandler::GetInstance()->SetPublicFirstPartySets(
|
||||
base::File());
|
||||
|
||||
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
||||
extensions_client_ = std::make_unique<ElectronExtensionsClient>();
|
||||
extensions::ExtensionsClient::Set(extensions_client_.get());
|
||||
|
||||
@@ -335,22 +335,32 @@ bool ElectronPermissionManager::CheckDevicePermission(
|
||||
static_cast<content::PermissionType>(
|
||||
WebContentsPermissionHelper::PermissionType::SERIAL)) {
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
if (device->FindStringKey(kDeviceInstanceIdKey) ==
|
||||
granted_device.FindStringKey(kDeviceInstanceIdKey))
|
||||
const auto* instance_id = device->FindStringKey(kDeviceInstanceIdKey);
|
||||
const auto* port_instance_id =
|
||||
granted_device.FindStringKey(kDeviceInstanceIdKey);
|
||||
if (instance_id && port_instance_id &&
|
||||
*instance_id == *port_instance_id)
|
||||
return true;
|
||||
#else
|
||||
const auto* serial_number =
|
||||
granted_device.FindStringKey(kSerialNumberKey);
|
||||
const auto* port_serial_number =
|
||||
device->FindStringKey(kSerialNumberKey);
|
||||
if (device->FindIntKey(kVendorIdKey) !=
|
||||
granted_device.FindIntKey(kVendorIdKey) ||
|
||||
device->FindIntKey(kProductIdKey) !=
|
||||
granted_device.FindIntKey(kProductIdKey) ||
|
||||
*device->FindStringKey(kSerialNumberKey) !=
|
||||
*granted_device.FindStringKey(kSerialNumberKey)) {
|
||||
(serial_number && port_serial_number &&
|
||||
*port_serial_number != *serial_number)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
if (*device->FindStringKey(kUsbDriverKey) !=
|
||||
*granted_device.FindStringKey(kUsbDriverKey)) {
|
||||
const auto* usb_driver_key = device->FindStringKey(kUsbDriverKey);
|
||||
const auto* port_usb_driver_key =
|
||||
granted_device.FindStringKey(kUsbDriverKey);
|
||||
if (usb_driver_key && port_usb_driver_key &&
|
||||
*usb_driver_key != *port_usb_driver_key) {
|
||||
continue;
|
||||
}
|
||||
#endif // BUILDFLAG(IS_MAC)
|
||||
|
||||
@@ -506,6 +506,7 @@ void NativeWindowMac::Focus(bool focus) {
|
||||
[[NSApplication sharedApplication] activateIgnoringOtherApps:NO];
|
||||
[window_ makeKeyAndOrderFront:nil];
|
||||
} else {
|
||||
[window_ orderOut:nil];
|
||||
[window_ orderBack:nil];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -296,6 +296,7 @@ bool NativeWindowViews::PreHandleMSG(UINT message,
|
||||
&prevent_default);
|
||||
if (prevent_default) {
|
||||
::GetWindowRect(hwnd, reinterpret_cast<RECT*>(l_param));
|
||||
pending_bounds_change_.reset();
|
||||
return true; // Tells Windows that the Sizing is handled.
|
||||
}
|
||||
return false;
|
||||
@@ -334,6 +335,7 @@ bool NativeWindowViews::PreHandleMSG(UINT message,
|
||||
NotifyWindowWillMove(dpi_bounds, &prevent_default);
|
||||
if (!movable_ || prevent_default) {
|
||||
::GetWindowRect(hwnd, reinterpret_cast<RECT*>(l_param));
|
||||
pending_bounds_change_.reset();
|
||||
return true; // Tells Windows that the Move is handled. If not true,
|
||||
// frameless windows can be moved using
|
||||
// -webkit-app-region: drag elements.
|
||||
|
||||
@@ -397,7 +397,7 @@ void OffScreenRenderWidgetHostView::ResetFallbackToFirstNavigationSurface() {
|
||||
|
||||
void OffScreenRenderWidgetHostView::InitAsPopup(
|
||||
content::RenderWidgetHostView* parent_host_view,
|
||||
const gfx::Rect& pos,
|
||||
const gfx::Rect& bounds,
|
||||
const gfx::Rect& anchor_rect) {
|
||||
DCHECK_EQ(parent_host_view_, parent_host_view);
|
||||
DCHECK_EQ(widget_type_, content::WidgetType::kPopup);
|
||||
@@ -411,13 +411,10 @@ void OffScreenRenderWidgetHostView::InitAsPopup(
|
||||
base::BindRepeating(&OffScreenRenderWidgetHostView::OnPopupPaint,
|
||||
parent_host_view_->weak_ptr_factory_.GetWeakPtr());
|
||||
|
||||
popup_position_ = pos;
|
||||
popup_position_ = bounds;
|
||||
|
||||
ResizeRootLayer(false);
|
||||
ResizeRootLayer(true);
|
||||
SetPainting(parent_host_view_->IsPainting());
|
||||
if (video_consumer_) {
|
||||
video_consumer_->SizeChanged();
|
||||
}
|
||||
Show();
|
||||
}
|
||||
|
||||
@@ -688,13 +685,8 @@ void OffScreenRenderWidgetHostView::OnPaint(const gfx::Rect& damage_rect,
|
||||
|
||||
gfx::Size OffScreenRenderWidgetHostView::SizeInPixels() {
|
||||
float sf = GetDeviceScaleFactor();
|
||||
if (IsPopupWidget()) {
|
||||
return gfx::ToFlooredSize(
|
||||
gfx::ConvertSizeToPixels(popup_position_.size(), sf));
|
||||
} else {
|
||||
return gfx::ToFlooredSize(
|
||||
gfx::ConvertSizeToPixels(GetViewBounds().size(), sf));
|
||||
}
|
||||
return gfx::ToFlooredSize(
|
||||
gfx::ConvertSizeToPixels(GetViewBounds().size(), sf));
|
||||
}
|
||||
|
||||
void OffScreenRenderWidgetHostView::CompositeFrame(
|
||||
@@ -995,7 +987,7 @@ void OffScreenRenderWidgetHostView::ResizeRootLayer(bool force) {
|
||||
display::Screen::GetScreen()->GetDisplayNearestView(GetNativeView());
|
||||
const float scaleFactor = display.device_scale_factor();
|
||||
float sf = GetDeviceScaleFactor();
|
||||
const bool scaleFactorDidChange = scaleFactor != sf;
|
||||
const bool sf_did_change = scaleFactor != sf;
|
||||
|
||||
// Initialize a screen_infos_ struct as needed, to cache the scale factor.
|
||||
if (screen_infos_.screen_infos.empty()) {
|
||||
@@ -1003,14 +995,9 @@ void OffScreenRenderWidgetHostView::ResizeRootLayer(bool force) {
|
||||
}
|
||||
screen_infos_.mutable_current().device_scale_factor = scaleFactor;
|
||||
|
||||
gfx::Size size;
|
||||
if (!IsPopupWidget())
|
||||
size = GetViewBounds().size();
|
||||
else
|
||||
size = popup_position_.size();
|
||||
gfx::Size size = GetViewBounds().size();
|
||||
|
||||
if (!force && !scaleFactorDidChange &&
|
||||
size == GetRootLayer()->bounds().size())
|
||||
if (!force && !sf_did_change && size == GetRootLayer()->bounds().size())
|
||||
return;
|
||||
|
||||
GetRootLayer()->SetBounds(gfx::Rect(size));
|
||||
|
||||
@@ -121,7 +121,7 @@ class OffScreenRenderWidgetHostView : public content::RenderWidgetHostViewBase,
|
||||
|
||||
void ResetFallbackToFirstNavigationSurface() override;
|
||||
void InitAsPopup(content::RenderWidgetHostView* parent_host_view,
|
||||
const gfx::Rect& pos,
|
||||
const gfx::Rect& bounds,
|
||||
const gfx::Rect& anchor_rect) override;
|
||||
void UpdateCursor(const content::WebCursor&) override;
|
||||
void SetIsLoading(bool is_loading) override;
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "media/base/limits.h"
|
||||
#include "media/base/video_frame_metadata.h"
|
||||
#include "media/capture/mojom/video_capture_buffer.mojom.h"
|
||||
#include "media/capture/mojom/video_capture_types.mojom.h"
|
||||
@@ -13,6 +14,21 @@
|
||||
#include "shell/browser/osr/osr_render_widget_host_view.h"
|
||||
#include "ui/gfx/skbitmap_operations.h"
|
||||
|
||||
namespace {
|
||||
|
||||
bool IsValidMinAndMaxFrameSize(gfx::Size min_frame_size,
|
||||
gfx::Size max_frame_size) {
|
||||
// Returns true if
|
||||
// 0 < |min_frame_size| <= |max_frame_size| <= media::limits::kMaxDimension.
|
||||
return 0 < min_frame_size.width() && 0 < min_frame_size.height() &&
|
||||
min_frame_size.width() <= max_frame_size.width() &&
|
||||
min_frame_size.height() <= max_frame_size.height() &&
|
||||
max_frame_size.width() <= media::limits::kMaxDimension &&
|
||||
max_frame_size.height() <= media::limits::kMaxDimension;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace electron {
|
||||
|
||||
OffScreenVideoConsumer::OffScreenVideoConsumer(
|
||||
@@ -21,11 +37,11 @@ OffScreenVideoConsumer::OffScreenVideoConsumer(
|
||||
: callback_(callback),
|
||||
view_(view),
|
||||
video_capturer_(view->CreateVideoCapturer()) {
|
||||
video_capturer_->SetResolutionConstraints(view_->SizeInPixels(),
|
||||
view_->SizeInPixels(), true);
|
||||
video_capturer_->SetAutoThrottlingEnabled(false);
|
||||
video_capturer_->SetMinSizeChangePeriod(base::TimeDelta());
|
||||
video_capturer_->SetFormat(media::PIXEL_FORMAT_ARGB);
|
||||
|
||||
SizeChanged(view_->SizeInPixels());
|
||||
SetFrameRate(view_->GetFrameRate());
|
||||
}
|
||||
|
||||
@@ -43,9 +59,10 @@ void OffScreenVideoConsumer::SetFrameRate(int frame_rate) {
|
||||
video_capturer_->SetMinCapturePeriod(base::Seconds(1) / frame_rate);
|
||||
}
|
||||
|
||||
void OffScreenVideoConsumer::SizeChanged() {
|
||||
video_capturer_->SetResolutionConstraints(view_->SizeInPixels(),
|
||||
view_->SizeInPixels(), true);
|
||||
void OffScreenVideoConsumer::SizeChanged(const gfx::Size& size_in_pixels) {
|
||||
DCHECK(IsValidMinAndMaxFrameSize(size_in_pixels, size_in_pixels));
|
||||
video_capturer_->SetResolutionConstraints(size_in_pixels, size_in_pixels,
|
||||
true);
|
||||
video_capturer_->RequestRefreshFrame();
|
||||
}
|
||||
|
||||
@@ -58,9 +75,7 @@ void OffScreenVideoConsumer::OnFrameCaptured(
|
||||
auto& data_region = data->get_read_only_shmem_region();
|
||||
|
||||
if (!CheckContentRect(content_rect)) {
|
||||
gfx::Size view_size = view_->SizeInPixels();
|
||||
video_capturer_->SetResolutionConstraints(view_size, view_size, true);
|
||||
video_capturer_->RequestRefreshFrame();
|
||||
SizeChanged(view_->SizeInPixels());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ class OffScreenVideoConsumer : public viz::mojom::FrameSinkVideoConsumer {
|
||||
|
||||
void SetActive(bool active);
|
||||
void SetFrameRate(int frame_rate);
|
||||
void SizeChanged();
|
||||
void SizeChanged(const gfx::Size& size_in_pixels);
|
||||
|
||||
private:
|
||||
// viz::mojom::FrameSinkVideoConsumer implementation.
|
||||
|
||||
@@ -50,8 +50,8 @@ END
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 19,0,0,3
|
||||
PRODUCTVERSION 19,0,0,3
|
||||
FILEVERSION 19,0,0,0
|
||||
PRODUCTVERSION 19,0,0,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
|
||||
@@ -3,4 +3,5 @@ void gtk_native_dialog_set_modal(GtkNativeDialog* self, gboolean modal);
|
||||
void gtk_native_dialog_show(GtkNativeDialog* self);
|
||||
void gtk_native_dialog_hide(GtkNativeDialog* self);
|
||||
gint gtk_native_dialog_run(GtkNativeDialog* self);
|
||||
void gtk_native_dialog_destroy(GtkNativeDialog* self);
|
||||
void gtk_native_dialog_destroy(GtkNativeDialog* self);
|
||||
GType gtk_native_dialog_get_type(void);
|
||||
@@ -190,9 +190,9 @@
|
||||
gfx::ScreenPointFromNSPoint([event locationInWindow]),
|
||||
ui::EventFlagsFromModifiers([event modifierFlags]));
|
||||
|
||||
// Pass click to superclass to show menu. Custom mouseUp handler won't be
|
||||
// invoked.
|
||||
if (menuController_) {
|
||||
// Pass click to superclass to show menu if one exists and has a non-zero
|
||||
// number of items. Custom mouseUp handler won't be invoked in this case.
|
||||
if (menuController_ && [[menuController_ menu] numberOfItems] > 0) {
|
||||
[self handleClickNotifications:event];
|
||||
[super mouseDown:event];
|
||||
} else {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user