mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
Compare commits
145 Commits
v19.0.2
...
v20.0.0-ni
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4fad376b0e | ||
|
|
60f1e5e008 | ||
|
|
349cd98b0a | ||
|
|
747dfe5851 | ||
|
|
658407df7a | ||
|
|
0893733496 | ||
|
|
f887000d50 | ||
|
|
7dee5179cb | ||
|
|
a71936e395 | ||
|
|
e1ed96b574 | ||
|
|
9901d2f281 | ||
|
|
14f07d7814 | ||
|
|
6f851afab5 | ||
|
|
682d2e3f78 | ||
|
|
b55f9d868a | ||
|
|
ce562b6889 | ||
|
|
015185ad5a | ||
|
|
fb534c927a | ||
|
|
192a7fad0d | ||
|
|
097da1d4ba | ||
|
|
b3530d5df8 | ||
|
|
b5297ea8e2 | ||
|
|
15c931201a | ||
|
|
f91b24deb5 | ||
|
|
d2c3e78117 | ||
|
|
a00544c745 | ||
|
|
160d6923db | ||
|
|
6d5501d0bd | ||
|
|
bfabd67112 | ||
|
|
40c022ad69 | ||
|
|
028a72daac | ||
|
|
6a1748da06 | ||
|
|
0a73f60423 | ||
|
|
f48a921d14 | ||
|
|
f3e0517b6e | ||
|
|
53c3dd68b2 | ||
|
|
283e4826af | ||
|
|
e571417c52 | ||
|
|
a5501d7118 | ||
|
|
0c8c755ffb | ||
|
|
bb146e3deb | ||
|
|
33e9bfd99b | ||
|
|
e864bc44c6 | ||
|
|
64517b36ef | ||
|
|
00021a41b1 | ||
|
|
b53118ca28 | ||
|
|
0c864837af | ||
|
|
fec147a0cb | ||
|
|
841e0a4e0c | ||
|
|
31c2b5703a | ||
|
|
6733279037 | ||
|
|
2d0ad04354 | ||
|
|
5ae234d5e1 | ||
|
|
0f087127de | ||
|
|
b9c0166b49 | ||
|
|
fd191fc50b | ||
|
|
37b7e347fc | ||
|
|
9d4aceb940 | ||
|
|
eee4232069 | ||
|
|
635b3a94c8 | ||
|
|
99791f620b | ||
|
|
8b0af86097 | ||
|
|
f5e874cbcb | ||
|
|
dda8bc3cd1 | ||
|
|
233a39dbc9 | ||
|
|
7658edfa1a | ||
|
|
16f8d713ab | ||
|
|
3d4d39d67b | ||
|
|
b66667b843 | ||
|
|
bfbba9dad6 | ||
|
|
341b7bdf4a | ||
|
|
4c4e02318f | ||
|
|
de2f48b40f | ||
|
|
a9c52926c0 | ||
|
|
bfa5b21044 | ||
|
|
d804cd5de2 | ||
|
|
7038d2d418 | ||
|
|
b8c0ef9713 | ||
|
|
c5b93eaf17 | ||
|
|
2ca46058cd | ||
|
|
3057ff0120 | ||
|
|
48edb2c707 | ||
|
|
56ab3d73c6 | ||
|
|
0287c3f511 | ||
|
|
1c53fc4331 | ||
|
|
c0d442364a | ||
|
|
59dd17f2cf | ||
|
|
e8ed9cb4b5 | ||
|
|
c9fd255093 | ||
|
|
caddc83cfe | ||
|
|
a7a5e7fcfd | ||
|
|
207d4e5823 | ||
|
|
8e2310db31 | ||
|
|
6872306117 | ||
|
|
41c1a7e318 | ||
|
|
9d6e6c45c1 | ||
|
|
f711fe6b57 | ||
|
|
94c2a7671c | ||
|
|
4d4682c0e3 | ||
|
|
7fb1c8faad | ||
|
|
ba8e7b9638 | ||
|
|
75ccec7996 | ||
|
|
68d6d8d451 | ||
|
|
0168aede8e | ||
|
|
a05d9be44f | ||
|
|
f95e565884 | ||
|
|
4615fc53ca | ||
|
|
927ab3104d | ||
|
|
cc3743bd43 | ||
|
|
fcbdaab5e3 | ||
|
|
a72acfc535 | ||
|
|
477aa389e6 | ||
|
|
1ada5d7ddf | ||
|
|
dce6c23b33 | ||
|
|
df34d20a21 | ||
|
|
d309558f64 | ||
|
|
128560c4ac | ||
|
|
bff1a37791 | ||
|
|
fcd7dbfa5c | ||
|
|
58386fbf43 | ||
|
|
09251fe24c | ||
|
|
18db9c551d | ||
|
|
c2449c421c | ||
|
|
e28bde9947 | ||
|
|
f287b0b382 | ||
|
|
204b53e7b8 | ||
|
|
0ac6d74536 | ||
|
|
78a3752ade | ||
|
|
9207c2aa68 | ||
|
|
1864edd287 | ||
|
|
9722ca78b2 | ||
|
|
7612df7687 | ||
|
|
cbd06cd25e | ||
|
|
8c8642634d | ||
|
|
afe0116d59 | ||
|
|
b711860d21 | ||
|
|
929fc8bea5 | ||
|
|
a508dce1bf | ||
|
|
f13f07023f | ||
|
|
aac546368f | ||
|
|
c119b1ebef | ||
|
|
df3cfb663c | ||
|
|
a9296229c8 | ||
|
|
9c3b159b95 | ||
|
|
89c1abd1b3 |
@@ -14,7 +14,7 @@ parameters:
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
upload-to-storage:
|
||||
upload-to-s3:
|
||||
type: string
|
||||
default: '1'
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ parameters:
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
upload-to-storage:
|
||||
upload-to-s3:
|
||||
type: string
|
||||
default: '1'
|
||||
|
||||
@@ -473,13 +473,6 @@ step-install-npm-deps-on-mac: &step-install-npm-deps-on-mac
|
||||
node script/yarn install
|
||||
fi
|
||||
|
||||
step-install-npm-deps: &step-install-npm-deps
|
||||
run:
|
||||
name: Install node_modules
|
||||
command: |
|
||||
cd src/electron
|
||||
node script/yarn install --frozen-lockfile
|
||||
|
||||
# This step handles the differences between the linux "gclient sync"
|
||||
# and the expected state on macOS
|
||||
step-fix-sync: &step-fix-sync
|
||||
@@ -644,9 +637,9 @@ step-electron-publish: &step-electron-publish
|
||||
fi
|
||||
|
||||
cd src/electron
|
||||
if [ "$UPLOAD_TO_STORAGE" == "1" ]; then
|
||||
echo 'Uploading Electron release distribution to Azure'
|
||||
script/release/uploaders/upload.py --verbose --UPLOAD_TO_STORAGE
|
||||
if [ "$UPLOAD_TO_S3" == "1" ]; then
|
||||
echo 'Uploading Electron release distribution to S3'
|
||||
script/release/uploaders/upload.py --verbose --upload_to_s3
|
||||
else
|
||||
echo 'Uploading Electron release distribution to Github releases'
|
||||
script/release/uploaders/upload.py --verbose
|
||||
@@ -661,6 +654,7 @@ step-persist-data-for-tests: &step-persist-data-for-tests
|
||||
- src/out/Default/mksnapshot.zip
|
||||
- src/out/Default/chromedriver.zip
|
||||
- src/out/Default/gen/node_headers
|
||||
- src/out/Default/overlapped-checker
|
||||
- src/out/ffmpeg/ffmpeg.zip
|
||||
- src/electron
|
||||
- src/third_party/electron_node
|
||||
@@ -687,13 +681,6 @@ step-electron-dist-unzip: &step-electron-dist-unzip
|
||||
# passed.
|
||||
unzip -:o dist.zip
|
||||
|
||||
step-ffmpeg-unzip: &step-ffmpeg-unzip
|
||||
run:
|
||||
name: Unzip ffmpeg.zip
|
||||
command: |
|
||||
cd src/out/ffmpeg
|
||||
unzip -:o ffmpeg.zip
|
||||
|
||||
step-mksnapshot-unzip: &step-mksnapshot-unzip
|
||||
run:
|
||||
name: Unzip mksnapshot.zip
|
||||
@@ -722,13 +709,6 @@ step-ffmpeg-build: &step-ffmpeg-build
|
||||
cd src
|
||||
ninja -C out/ffmpeg electron:electron_ffmpeg_zip -j $NUMBER_OF_NINJA_PROCESSES
|
||||
|
||||
step-verify-ffmpeg: &step-verify-ffmpeg
|
||||
run:
|
||||
name: Verify ffmpeg
|
||||
command: |
|
||||
cd src
|
||||
python electron/script/verify-ffmpeg.py --source-root "$PWD" --build-dir out/Default --ffmpeg-path out/ffmpeg
|
||||
|
||||
step-verify-mksnapshot: &step-verify-mksnapshot
|
||||
run:
|
||||
name: Verify mksnapshot
|
||||
@@ -1007,16 +987,9 @@ step-ts-compile: &step-ts-compile
|
||||
run:
|
||||
name: Run TS/JS compile on doc only change
|
||||
command: |
|
||||
cd src/electron
|
||||
node script/yarn create-typescript-definitions
|
||||
node script/yarn tsc -p tsconfig.default_app.json --noEmit
|
||||
for f in build/webpack/*.js
|
||||
do
|
||||
out="${f:29}"
|
||||
if [ "$out" != "base.js" ]; then
|
||||
node script/yarn webpack --config $f --output-filename=$out --output-path=./.tmp --env.mode=development
|
||||
fi
|
||||
done
|
||||
cd src
|
||||
ninja -C out/Default electron:default_app_js -j $NUMBER_OF_NINJA_PROCESSES
|
||||
ninja -C out/Default electron:electron_js2c -j $NUMBER_OF_NINJA_PROCESSES
|
||||
|
||||
# List of all steps.
|
||||
steps-electron-gn-check: &steps-electron-gn-check
|
||||
@@ -1038,58 +1011,41 @@ steps-electron-ts-compile-for-doc-change: &steps-electron-ts-compile-for-doc-cha
|
||||
steps:
|
||||
# Checkout - Copied from steps-checkout
|
||||
- *step-checkout-electron
|
||||
- *step-install-npm-deps
|
||||
- *step-depot-tools-get
|
||||
- *step-depot-tools-add-to-path
|
||||
- *step-restore-brew-cache
|
||||
- *step-install-gnutar-on-mac
|
||||
- *step-install-python2-on-mac
|
||||
- *step-get-more-space-on-mac
|
||||
- *step-setup-goma-for-build
|
||||
- *step-generate-deps-hash
|
||||
- *step-touch-sync-done
|
||||
- maybe-restore-portaled-src-cache
|
||||
- *step-maybe-restore-git-cache
|
||||
- *step-set-git-cache-path
|
||||
# This sync call only runs if .circle-sync-done is an EMPTY file
|
||||
- *step-gclient-sync
|
||||
# These next few steps reset Electron to the correct commit regardless of which cache was restored
|
||||
- run:
|
||||
name: Wipe Electron
|
||||
command: rm -rf src/electron
|
||||
- *step-checkout-electron
|
||||
- *step-run-electron-only-hooks
|
||||
- *step-generate-deps-hash-cleanly
|
||||
- *step-mark-sync-done
|
||||
- *step-minimize-workspace-size-from-checkout
|
||||
|
||||
- *step-depot-tools-add-to-path
|
||||
- *step-setup-env-for-build
|
||||
- *step-wait-for-goma
|
||||
- *step-get-more-space-on-mac
|
||||
- *step-install-npm-deps-on-mac
|
||||
- *step-fix-sync
|
||||
- *step-gn-gen-default
|
||||
|
||||
#Compile ts/js to verify doc change didn't break anything
|
||||
- *step-ts-compile
|
||||
|
||||
steps-native-tests: &steps-native-tests
|
||||
steps:
|
||||
- attach_workspace:
|
||||
at: .
|
||||
- *step-depot-tools-add-to-path
|
||||
- *step-install-python2-on-mac
|
||||
- *step-setup-env-for-build
|
||||
- *step-setup-goma-for-build
|
||||
- *step-wait-for-goma
|
||||
- *step-gn-gen-default
|
||||
|
||||
- run:
|
||||
name: Build tests
|
||||
command: |
|
||||
cd src
|
||||
ninja -C out/Default $BUILD_TARGET
|
||||
- *step-show-goma-stats
|
||||
|
||||
- *step-setup-linux-for-headless-testing
|
||||
- run:
|
||||
name: Run tests
|
||||
command: |
|
||||
mkdir test_results
|
||||
python src/electron/script/native-tests.py run \
|
||||
--config $TESTS_CONFIG \
|
||||
--tests-dir src/out/Default \
|
||||
--output-dir test_results \
|
||||
$TESTS_ARGS
|
||||
|
||||
- store_artifacts:
|
||||
path: test_results
|
||||
destination: test_results # Put it in the root folder.
|
||||
- store_test_results:
|
||||
path: test_results
|
||||
|
||||
steps-verify-ffmpeg: &steps-verify-ffmpeg
|
||||
steps:
|
||||
- attach_workspace:
|
||||
at: .
|
||||
- *step-depot-tools-add-to-path
|
||||
- *step-electron-dist-unzip
|
||||
- *step-ffmpeg-unzip
|
||||
- *step-setup-linux-for-headless-testing
|
||||
|
||||
- *step-verify-ffmpeg
|
||||
- *step-maybe-notify-slack-failure
|
||||
|
||||
steps-tests: &steps-tests
|
||||
steps:
|
||||
- attach_workspace:
|
||||
@@ -1471,7 +1427,7 @@ commands:
|
||||
- *step-electron-build
|
||||
- *step-maybe-electron-dist-strip
|
||||
- step-electron-dist-build:
|
||||
additional-targets: shell_browser_ui_unittests third_party/electron_node:headers electron:hunspell_dictionaries_zip
|
||||
additional-targets: shell_browser_ui_unittests third_party/electron_node:headers third_party/electron_node:overlapped-checker electron:hunspell_dictionaries_zip
|
||||
|
||||
- *step-show-goma-stats
|
||||
|
||||
@@ -1731,7 +1687,7 @@ jobs:
|
||||
environment:
|
||||
<<: *env-linux-2xlarge-release
|
||||
<<: *env-release-build
|
||||
UPLOAD_TO_STORAGE: << pipeline.parameters.upload-to-storage >>
|
||||
UPLOAD_TO_S3: << pipeline.parameters.upload-to-s3 >>
|
||||
<<: *env-ninja-status
|
||||
steps:
|
||||
- run: echo running
|
||||
@@ -1775,7 +1731,7 @@ jobs:
|
||||
<<: *env-release-build
|
||||
<<: *env-32bit-release
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True'
|
||||
UPLOAD_TO_STORAGE: << pipeline.parameters.upload-to-storage >>
|
||||
UPLOAD_TO_S3: << pipeline.parameters.upload-to-s3 >>
|
||||
<<: *env-ninja-status
|
||||
steps:
|
||||
- run: echo running
|
||||
@@ -1828,7 +1784,7 @@ jobs:
|
||||
<<: *env-arm64
|
||||
<<: *env-release-build
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm64=True'
|
||||
UPLOAD_TO_STORAGE: << pipeline.parameters.upload-to-storage >>
|
||||
UPLOAD_TO_S3: << pipeline.parameters.upload-to-s3 >>
|
||||
<<: *env-ninja-status
|
||||
steps:
|
||||
- run: echo running
|
||||
@@ -1869,14 +1825,14 @@ jobs:
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_mac=True --custom-var=host_os=mac'
|
||||
<<: *steps-electron-gn-check
|
||||
|
||||
osx-publish-x64-skip-checkout:
|
||||
osx-publish-x64:
|
||||
executor:
|
||||
name: macos
|
||||
size: macos.x86.medium.gen2
|
||||
environment:
|
||||
<<: *env-mac-large-release
|
||||
<<: *env-release-build
|
||||
UPLOAD_TO_STORAGE: << pipeline.parameters.upload-to-storage >>
|
||||
UPLOAD_TO_S3: << pipeline.parameters.upload-to-s3 >>
|
||||
<<: *env-ninja-status
|
||||
steps:
|
||||
- run: echo running
|
||||
@@ -1890,7 +1846,7 @@ jobs:
|
||||
attach: true
|
||||
checkout: false
|
||||
|
||||
osx-publish-arm64-skip-checkout:
|
||||
osx-publish-arm64:
|
||||
executor:
|
||||
name: macos
|
||||
size: macos.x86.medium.gen2
|
||||
@@ -1898,7 +1854,7 @@ jobs:
|
||||
<<: *env-mac-large-release
|
||||
<<: *env-release-build
|
||||
<<: *env-apple-silicon
|
||||
UPLOAD_TO_STORAGE: << pipeline.parameters.upload-to-storage >>
|
||||
UPLOAD_TO_S3: << pipeline.parameters.upload-to-s3 >>
|
||||
<<: *env-ninja-status
|
||||
steps:
|
||||
- run: echo running
|
||||
@@ -1960,7 +1916,7 @@ jobs:
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_mac=True --custom-var=host_os=mac'
|
||||
<<: *steps-electron-gn-check
|
||||
|
||||
mas-publish-x64-skip-checkout:
|
||||
mas-publish-x64:
|
||||
executor:
|
||||
name: macos
|
||||
size: macos.x86.medium.gen2
|
||||
@@ -1968,7 +1924,7 @@ jobs:
|
||||
<<: *env-mac-large-release
|
||||
<<: *env-mas
|
||||
<<: *env-release-build
|
||||
UPLOAD_TO_STORAGE: << pipeline.parameters.upload-to-storage >>
|
||||
UPLOAD_TO_S3: << pipeline.parameters.upload-to-s3 >>
|
||||
steps:
|
||||
- run: echo running
|
||||
- when:
|
||||
@@ -1981,7 +1937,7 @@ jobs:
|
||||
attach: true
|
||||
checkout: false
|
||||
|
||||
mas-publish-arm64-skip-checkout:
|
||||
mas-publish-arm64:
|
||||
executor:
|
||||
name: macos
|
||||
size: macos.x86.medium.gen2
|
||||
@@ -1989,7 +1945,7 @@ jobs:
|
||||
<<: *env-mac-large-release
|
||||
<<: *env-mas-apple-silicon
|
||||
<<: *env-release-build
|
||||
UPLOAD_TO_STORAGE: << pipeline.parameters.upload-to-storage >>
|
||||
UPLOAD_TO_S3: << pipeline.parameters.upload-to-s3 >>
|
||||
<<: *env-ninja-status
|
||||
steps:
|
||||
- run: echo running
|
||||
@@ -2067,16 +2023,6 @@ jobs:
|
||||
<<: *env-stack-dumping
|
||||
<<: *steps-test-node
|
||||
|
||||
linux-x64-verify-ffmpeg:
|
||||
executor:
|
||||
name: linux-docker
|
||||
size: medium
|
||||
environment:
|
||||
<<: *env-linux-medium
|
||||
<<: *env-headless-testing
|
||||
<<: *env-send-slack-notifications
|
||||
<<: *steps-verify-ffmpeg
|
||||
|
||||
linux-arm-testing-tests:
|
||||
executor: linux-arm
|
||||
environment:
|
||||
@@ -2133,17 +2079,6 @@ jobs:
|
||||
<<: *env-apple-silicon
|
||||
<<: *steps-tests
|
||||
|
||||
# Layer 4: Summary.
|
||||
linux-release-summary:
|
||||
executor:
|
||||
name: linux-docker
|
||||
size: medium
|
||||
environment:
|
||||
<<: *env-linux-medium
|
||||
<<: *env-send-slack-notifications
|
||||
steps:
|
||||
- *step-maybe-notify-slack-success
|
||||
|
||||
# List all workflows
|
||||
workflows:
|
||||
docs-only:
|
||||
@@ -2169,19 +2104,19 @@ workflows:
|
||||
when: << pipeline.parameters.run-macos-publish >>
|
||||
jobs:
|
||||
- mac-checkout
|
||||
- osx-publish-x64-skip-checkout:
|
||||
- osx-publish-x64:
|
||||
requires:
|
||||
- mac-checkout
|
||||
context: release-env
|
||||
- mas-publish-x64-skip-checkout:
|
||||
- mas-publish-x64:
|
||||
requires:
|
||||
- mac-checkout
|
||||
context: release-env
|
||||
- osx-publish-arm64-skip-checkout:
|
||||
- osx-publish-arm64:
|
||||
requires:
|
||||
- mac-checkout
|
||||
context: release-env
|
||||
- mas-publish-arm64-skip-checkout:
|
||||
- mas-publish-arm64:
|
||||
requires:
|
||||
- mac-checkout
|
||||
context: release-env
|
||||
|
||||
14
BUILD.gn
14
BUILD.gn
@@ -79,6 +79,13 @@ if (is_linux) {
|
||||
]
|
||||
}
|
||||
|
||||
# Generates electron_gtk_stubs.h header which contains
|
||||
# stubs for extracting function ptrs from the gtk library.
|
||||
# Function signatures for which stubs are required should be
|
||||
# declared in electron_gtk.sigs, currently this file contains
|
||||
# signatures for the functions used with native file chooser
|
||||
# implementation. In future, this file can be extended to contain
|
||||
# gtk4 stubs to switch gtk version in runtime.
|
||||
generate_stubs("electron_gtk_stubs") {
|
||||
sigs = [ "shell/browser/ui/electron_gtk.sigs" ]
|
||||
extra_header = "shell/browser/ui/electron_gtk.fragment"
|
||||
@@ -359,6 +366,7 @@ source_set("electron_lib") {
|
||||
"shell/common/api:mojo",
|
||||
"//base:base_static",
|
||||
"//base/allocator:buildflags",
|
||||
"//chrome:strings",
|
||||
"//chrome/app:command_ids",
|
||||
"//chrome/app/resources:platform_locale_settings",
|
||||
"//components/autofill/core/common:features",
|
||||
@@ -903,7 +911,10 @@ if (is_mac) {
|
||||
assert(defined(invoker.helper_name_suffix))
|
||||
|
||||
output_name = electron_helper_name + invoker.helper_name_suffix
|
||||
deps = [ ":electron_framework+link" ]
|
||||
deps = [
|
||||
":electron_framework+link",
|
||||
"//base/allocator:early_zone_registration_mac",
|
||||
]
|
||||
if (!is_mas_build) {
|
||||
deps += [ "//sandbox/mac:seatbelt" ]
|
||||
}
|
||||
@@ -1063,6 +1074,7 @@ if (is_mac) {
|
||||
":electron_app_plist",
|
||||
":electron_app_resources",
|
||||
":electron_fuses",
|
||||
"//base/allocator:early_zone_registration_mac",
|
||||
"//electron/buildflags",
|
||||
]
|
||||
if (is_mas_build) {
|
||||
|
||||
2
DEPS
2
DEPS
@@ -2,7 +2,7 @@ gclient_gn_args_from = 'src'
|
||||
|
||||
vars = {
|
||||
'chromium_version':
|
||||
'102.0.5005.63',
|
||||
'102.0.4999.0',
|
||||
'node_version':
|
||||
'v16.14.2',
|
||||
'nan_version':
|
||||
|
||||
@@ -1 +1 @@
|
||||
19.0.2
|
||||
20.0.0-nightly.20220504
|
||||
24
appveyor.yml
24
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_STORAGE" Set it to '1' upload a release to the Azure bucket.
|
||||
# - "UPLOAD_TO_S3" Set it to '1' upload a release to the S3 bucket.
|
||||
# Otherwise the release will be uploaded to the Github Releases.
|
||||
# (The value is only checked if "ELECTRON_RELEASE" is defined.)
|
||||
#
|
||||
@@ -23,10 +23,6 @@
|
||||
# https://www.appveyor.com/docs/build-configuration/#secure-variables
|
||||
# https://www.appveyor.com/docs/build-configuration/#custom-environment-variables
|
||||
|
||||
# Uncomment these lines to enable RDP
|
||||
#on_finish:
|
||||
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
||||
|
||||
version: 1.0.{build}
|
||||
build_cloud: electron-16-core
|
||||
image: vs2019bt-16.16.11
|
||||
@@ -184,16 +180,19 @@ build_script:
|
||||
- python %LOCAL_GOMA_DIR%\goma_ctl.py stat
|
||||
- python3 electron/build/profile_toolchain.py --output-json=out/Default/windows_toolchain_profile.json
|
||||
- 7z a node_headers.zip out\Default\gen\node_headers
|
||||
# Temporarily disable symbol generation on 32-bit Windows due to failures
|
||||
- ps: >-
|
||||
if ($env:GN_CONFIG -eq 'release') {
|
||||
if ($env:GN_CONFIG -eq 'release' -And $env:TARGET_ARCH -ne 'ia32') {
|
||||
# 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') {
|
||||
python electron\script\zip-symbols.py
|
||||
appveyor-retry appveyor PushArtifact out/Default/symbols.zip
|
||||
if ($env:TARGET_ARCH -ne 'ia32') {
|
||||
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.
|
||||
@@ -230,9 +229,9 @@ deploy_script:
|
||||
- cd electron
|
||||
- ps: >-
|
||||
if (Test-Path Env:\ELECTRON_RELEASE) {
|
||||
if (Test-Path Env:\UPLOAD_TO_STORAGE) {
|
||||
Write-Output "Uploading Electron release distribution to azure"
|
||||
& python script\release\uploaders\upload.py --verbose --upload_to_storage
|
||||
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
|
||||
} else {
|
||||
Write-Output "Uploading Electron release distribution to github releases"
|
||||
& python script\release\uploaders\upload.py --verbose
|
||||
@@ -241,6 +240,8 @@ 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:
|
||||
# Uncomment this lines to enable RDP
|
||||
#- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
||||
- cd ..
|
||||
- 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)
|
||||
@@ -255,4 +256,5 @@ on_finish:
|
||||
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 )
|
||||
|
||||
@@ -2,7 +2,7 @@ is_electron_build = true
|
||||
root_extra_deps = [ "//electron" ]
|
||||
|
||||
# Registry of NMVs --> https://github.com/nodejs/node/blob/master/doc/abi_version_registry.json
|
||||
node_module_version = 106
|
||||
node_module_version = 107
|
||||
|
||||
v8_promise_internal_field_count = 1
|
||||
v8_embedder_string = "-electron.0"
|
||||
@@ -21,9 +21,6 @@ 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
|
||||
|
||||
@@ -32,9 +29,16 @@ dawn_enable_vulkan_validation_layers = false
|
||||
# See https://chromium-review.googlesource.com/c/chromium/src/+/2774898.
|
||||
enable_pseudolocales = false
|
||||
|
||||
is_cfi = false
|
||||
|
||||
# Make application name configurable at runtime for cookie crypto
|
||||
allow_runtime_configurable_key_storage = true
|
||||
|
||||
# CET shadow stack is incompatible with v8, until v8 is CET compliant
|
||||
# enabling this flag causes main process crashes where CET is enabled
|
||||
# Ref: https://source.chromium.org/chromium/chromium/src/+/45fba672185aae233e75d6ddc81ea1e0b30db050:v8/BUILD.gn;l=357
|
||||
enable_cet_shadow_stack = false
|
||||
|
||||
# For similar reasons, disable CFI, which is not well supported in V8.
|
||||
# Chromium doesn't have any problems with this because they do not run
|
||||
# V8 in the browser process.
|
||||
# Ref: https://source.chromium.org/chromium/chromium/src/+/45fba672185aae233e75d6ddc81ea1e0b30db050:v8/BUILD.gn;l=281
|
||||
is_cfi = false
|
||||
|
||||
@@ -484,6 +484,7 @@ 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()`.
|
||||
@@ -495,12 +496,35 @@ 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:
|
||||
@@ -582,6 +606,10 @@ You should seek to use the `steal` option as sparingly as possible.
|
||||
|
||||
Hides all application windows without minimizing them.
|
||||
|
||||
### `app.isHidden()` _macOS_
|
||||
|
||||
Returns `boolean` - `true` if the application—including all of its windows—is hidden (e.g. with `Command-H`), `false` otherwise.
|
||||
|
||||
### `app.show()` _macOS_
|
||||
|
||||
Shows application windows after they were hidden. Does not automatically focus
|
||||
@@ -609,7 +637,6 @@ Returns `string` - The current application directory.
|
||||
* `~/Library/Application Support` on macOS
|
||||
* `userData` The directory for storing your app's configuration files, which by
|
||||
default it is the `appData` directory appended with your app's name.
|
||||
* `cache`
|
||||
* `temp` Temporary directory.
|
||||
* `exe` The current executable file.
|
||||
* `module` The `libchromiumcontent` library.
|
||||
@@ -961,6 +988,13 @@ 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)
|
||||
|
||||
@@ -968,14 +1002,19 @@ 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.
|
||||
console.log(additionalData)
|
||||
// Expected output: '{"myKey":"myValue"}'
|
||||
console.log(JSON.stringify(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...
|
||||
|
||||
@@ -11,6 +11,9 @@ relative to its owning window. It is meant to be an alternative to the
|
||||
|
||||
Process: [Main](../glossary.md#main-process)
|
||||
|
||||
This module cannot be used until the `ready` event of the `app`
|
||||
module is emitted.
|
||||
|
||||
### Example
|
||||
|
||||
```javascript
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
|
||||
Process: [Main](../glossary.md#main-process)
|
||||
|
||||
This module cannot be used until the `ready` event of the `app`
|
||||
module is emitted.
|
||||
|
||||
```javascript
|
||||
// In the main process.
|
||||
const { BrowserWindow } = require('electron')
|
||||
|
||||
@@ -35,7 +35,7 @@ page you load in your renderer executes code in this world.
|
||||
|
||||
When `contextIsolation` is enabled in your `webPreferences` (this is the default behavior since Electron 12.0.0), your `preload` scripts run in an
|
||||
"Isolated World". You can read more about context isolation and what it affects in the
|
||||
[security](../tutorial/security.md#3-enable-context-isolation-for-remote-content) docs.
|
||||
[security](../tutorial/security.md#3-enable-context-isolation) docs.
|
||||
|
||||
## Methods
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@ The `safeStorage` module has the following methods:
|
||||
|
||||
Returns `boolean` - Whether encryption 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 Linux, returns true if 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)`
|
||||
|
||||
@@ -372,7 +372,7 @@ value.
|
||||
In Electron 12, `contextIsolation` will be enabled by default. To restore
|
||||
the previous behavior, `contextIsolation: false` must be specified in WebPreferences.
|
||||
|
||||
We [recommend having contextIsolation enabled](tutorial/security.md#3-enable-context-isolation-for-remote-content) for the security of your application.
|
||||
We [recommend having contextIsolation enabled](tutorial/security.md#3-enable-context-isolation) for the security of your application.
|
||||
|
||||
Another implication is that `require()` cannot be used in the renderer process unless
|
||||
`nodeIntegration` is `true` and `contextIsolation` is `false`.
|
||||
|
||||
@@ -22,12 +22,11 @@ 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 | v16.14 | ✅ |
|
||||
| 20.0.0 | 2022-May-26 | 2022-Jun-21 | 2022-Aug-02 | M104 | TBD | ✅ |
|
||||
| 19.0.0 | 2022-Mar-31 | 2022-Apr-26 | 2022-May-24 | M102 | TBD | ✅ |
|
||||
|
||||
**Notes:**
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ inAppPurchase.getProducts(PRODUCT_IDS).then(products => {
|
||||
console.log(`The price of ${product.localizedTitle} is ${product.formattedPrice}.`)
|
||||
})
|
||||
|
||||
// Ask the user which product he/she wants to purchase.
|
||||
// Ask the user which product they want to purchase.
|
||||
const selectedProduct = products[0]
|
||||
const selectedQuantity = 1
|
||||
|
||||
|
||||
@@ -131,6 +131,7 @@ 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>
|
||||
@@ -426,6 +427,7 @@ 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>
|
||||
|
||||
@@ -99,7 +99,7 @@ You should at least follow these steps to improve the security of your applicati
|
||||
|
||||
1. [Only load secure content](#1-only-load-secure-content)
|
||||
2. [Disable the Node.js integration in all renderers that display remote content](#2-do-not-enable-nodejs-integration-for-remote-content)
|
||||
3. [Enable context isolation in all renderers that display remote content](#3-enable-context-isolation-for-remote-content)
|
||||
3. [Enable context isolation in all renderers](#3-enable-context-isolation)
|
||||
4. [Enable process sandboxing](#4-enable-process-sandboxing)
|
||||
5. [Use `ses.setPermissionRequestHandler()` in all sessions that load remote content](#5-handle-session-permission-requests-from-remote-content)
|
||||
6. [Do not disable `webSecurity`](#6-do-not-disable-websecurity)
|
||||
@@ -225,7 +225,7 @@ do consume Node.js modules or features. Preload scripts continue to have access
|
||||
to `require` and other Node.js features, allowing developers to expose a custom
|
||||
API to remotely loaded content via the [contextBridge API](../api/context-bridge.md).
|
||||
|
||||
### 3. Enable Context Isolation for remote content
|
||||
### 3. Enable Context Isolation
|
||||
|
||||
:::info
|
||||
This recommendation is the default behavior in Electron since 12.0.0.
|
||||
|
||||
@@ -54,6 +54,8 @@ template("electron_extra_paks") {
|
||||
])
|
||||
output = "${invoker.output_dir}/resources.pak"
|
||||
sources = [
|
||||
"$root_gen_dir/chrome/browser_resources.pak",
|
||||
"$root_gen_dir/chrome/common_resources.pak",
|
||||
"$root_gen_dir/chrome/dev_ui_browser_resources.pak",
|
||||
"$root_gen_dir/components/components_resources.pak",
|
||||
"$root_gen_dir/content/browser/resources/media/media_internals_resources.pak",
|
||||
@@ -65,10 +67,13 @@ 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 = [
|
||||
"//chrome/browser:dev_ui_browser_resources",
|
||||
"//chrome/browser:resources",
|
||||
"//chrome/common:resources",
|
||||
"//components/resources",
|
||||
"//content:content_resources",
|
||||
"//content:dev_ui_content_resources",
|
||||
@@ -172,22 +177,26 @@ template("electron_paks") {
|
||||
}
|
||||
|
||||
source_patterns = [
|
||||
"${root_gen_dir}/chrome/locale_settings_",
|
||||
"${root_gen_dir}/chrome/platform_locale_settings_",
|
||||
"${root_gen_dir}/chrome/generated_resources_",
|
||||
"${root_gen_dir}/components/strings/components_locale_settings_",
|
||||
"${root_gen_dir}/components/strings/components_strings_",
|
||||
"${root_gen_dir}/device/bluetooth/strings/bluetooth_strings_",
|
||||
"${root_gen_dir}/services/strings/services_strings_",
|
||||
"${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_",
|
||||
"${root_gen_dir}/ui/strings/ui_strings_",
|
||||
]
|
||||
deps = [
|
||||
"//chrome/app:generated_resources",
|
||||
"//chrome/app/resources:locale_settings",
|
||||
"//chrome/app/resources:platform_locale_settings",
|
||||
"//components/strings:components_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",
|
||||
|
||||
@@ -11,15 +11,8 @@
|
||||
<output filename="electron_resources.pak" type="data_package" />
|
||||
</outputs>
|
||||
<release seq="1" allow_pseudo="false">
|
||||
<messages fallback_to_english="true">
|
||||
<!-- TODO(deepak1556): Add translations,
|
||||
check https://www.chromium.org/developers/design-documents/ui-localization -->
|
||||
<part file="electron_strings.grdp" />
|
||||
</messages>
|
||||
<includes>
|
||||
<include name="IDR_CONTENT_SHELL_DEVTOOLS_DISCOVERY_PAGE" file="${target_gen_dir}/shell_devtools_discovery_page.html" use_base_dir="false" type="BINDATA" />
|
||||
<include name="IDR_PDF_MANIFEST" file="../chrome/browser/resources/pdf/manifest.json" type="BINDATA" />
|
||||
<include name="IDR_CRYPTOTOKEN_MANIFEST" file="../chrome/browser/resources/cryptotoken/manifest.json" type="BINDATA" />
|
||||
</includes>
|
||||
</release>
|
||||
</grit>
|
||||
|
||||
@@ -1,163 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<grit-part>
|
||||
<!-- Windows Caption Buttons -->
|
||||
<message name="IDS_APP_ACCNAME_CLOSE" desc="The accessible name for the Close button.">
|
||||
Close
|
||||
</message>
|
||||
<message name="IDS_APP_ACCNAME_MINIMIZE" desc="The accessible name for the Minimize button.">
|
||||
Minimize
|
||||
</message>
|
||||
<message name="IDS_APP_ACCNAME_MAXIMIZE" desc="The accessible name for the Maximize button.">
|
||||
Maximize
|
||||
</message>
|
||||
<message name="IDS_APP_ACCNAME_RESTORE" desc="The accessible name for the Restore button.">
|
||||
Restore
|
||||
</message>
|
||||
|
||||
<!-- Printing Service -->
|
||||
<message name="IDS_UTILITY_PROCESS_PRINTING_SERVICE_NAME" desc="The name of the utility process used for printing conversions.">
|
||||
Printing Service
|
||||
</message>
|
||||
<message name="IDS_PRINT_INVALID_PRINTER_SETTINGS" desc="Message to display when selected printer is not reachable or its settings are invalid.">
|
||||
The selected printer is not available or not installed correctly. <ph name="BR"><br></ph> Check your printer or try selecting another printer.
|
||||
</message>
|
||||
<message name="IDS_DEFAULT_PRINT_DOCUMENT_TITLE" desc="Default title for a print document">
|
||||
Untitled Document
|
||||
</message>
|
||||
<message name="IDS_UTILITY_PROCESS_PRINT_BACKEND_SERVICE_NAME" desc="The name of the utility process used for backend interactions with printer drivers.">
|
||||
Print Backend Service
|
||||
</message>
|
||||
|
||||
<!-- Desktop Capturer API -->
|
||||
<message name="IDS_DESKTOP_MEDIA_PICKER_SINGLE_SCREEN_NAME" desc="Name for screens in the desktop media picker UI when there is only one monitor.">
|
||||
Entire Screen
|
||||
</message>
|
||||
<message name="IDS_DESKTOP_MEDIA_PICKER_MULTIPLE_SCREEN_NAME" desc="Name for screens in the desktop media picker UI when there are multiple monitors.">
|
||||
{SCREEN_INDEX, plural, =1{Screen #} other{Screen #}}
|
||||
</message>
|
||||
|
||||
<!-- File Select Helper-->
|
||||
<message name="IDS_IMAGE_FILES" desc="The description of the image file extensions in the select file dialog.">
|
||||
Image Files
|
||||
</message>
|
||||
<message name="IDS_AUDIO_FILES" desc="The description of the audio file extensions in the select file dialog.">
|
||||
Audio Files
|
||||
</message>
|
||||
<message name="IDS_VIDEO_FILES" desc="The description of the video file extensions in the select file dialog.">
|
||||
Video Files
|
||||
</message>
|
||||
<message name="IDS_CUSTOM_FILES" desc="The description of the custom file extensions in the select file dialog.">
|
||||
Custom Files
|
||||
</message>
|
||||
<message name="IDS_DEFAULT_DOWNLOAD_FILENAME" desc="Default name for downloaded files when we have no idea what they could be.">
|
||||
download
|
||||
</message>
|
||||
|
||||
<!-- Picture-in-Picture -->
|
||||
<if expr="is_macosx">
|
||||
<message name="IDS_PICTURE_IN_PICTURE_TITLE_TEXT" desc="Title of the Picture-in-Picture window. This appears in the system tray and window header.">
|
||||
Picture in Picture
|
||||
</message>
|
||||
</if>
|
||||
<if expr="not is_macosx">
|
||||
<message name="IDS_PICTURE_IN_PICTURE_TITLE_TEXT" desc="Title of the Picture-in-Picture window. This appears in the system tray and window header.">
|
||||
Picture in picture
|
||||
</message>
|
||||
</if>
|
||||
<message name="IDS_PICTURE_IN_PICTURE_PAUSE_CONTROL_TEXT" desc="Text label of the pause control button. The button appears when the user hovers over the Picture-in-Picture window and the video is currently playing.">
|
||||
Pause
|
||||
</message>
|
||||
<message name="IDS_PICTURE_IN_PICTURE_PLAY_CONTROL_TEXT" desc="Text label of the play control button. The button appears when the user hovers over the Picture-in-Picture window and the video is currently paused.">
|
||||
Play
|
||||
</message>
|
||||
<message name="IDS_PICTURE_IN_PICTURE_REPLAY_CONTROL_TEXT" desc="Text label of the replay control button. The button appears when the user hovers over the Picture-in-Picture window and the video is ended.">
|
||||
Play from the beginning
|
||||
</message>
|
||||
<message name="IDS_PICTURE_IN_PICTURE_BACK_TO_TAB_CONTROL_TEXT" desc="Text label of the back to tab control button. The button appears when the user hovers over the Picture-in-Picture window.">
|
||||
Back to video player
|
||||
</message>
|
||||
<message name="IDS_PICTURE_IN_PICTURE_MUTE_CONTROL_TEXT" desc="Text label of the mute control button. The button appears when the user hovers over the Picture-in-Picture window and the video is currently unmuted.">
|
||||
Mute
|
||||
</message>
|
||||
<message name="IDS_PICTURE_IN_PICTURE_UNMUTE_CONTROL_TEXT" desc="Text label of the mute control button. The button appears when the user hovers over the Picture-in-Picture window and the video is currently muted.">
|
||||
Unmute
|
||||
</message>
|
||||
<message name="IDS_PICTURE_IN_PICTURE_SKIP_AD_CONTROL_TEXT" desc="Text label of the skip ad control button. The button appears when the user hovers over the Picture-in-Picture window.">
|
||||
Skip Ad
|
||||
</message>
|
||||
<message name="IDS_PICTURE_IN_PICTURE_MUTE_MICROPHONE_TEXT" desc="Text label of the mute microphone control button. The button appears when the user hovers over the Picture-in-Picture window.">
|
||||
Mute microphone
|
||||
</message>
|
||||
<message name="IDS_PICTURE_IN_PICTURE_UNMUTE_MICROPHONE_TEXT" desc="Text label of the unmute microphone control button. The button appears when the user hovers over the Picture-in-Picture window.">
|
||||
Unmute microphone
|
||||
</message>
|
||||
<message name="IDS_PICTURE_IN_PICTURE_TURN_ON_CAMERA_TEXT" desc="Text label of the turn on camera control button. The button appears when the user hovers over the Picture-in-Picture window.">
|
||||
Turn on camera
|
||||
</message>
|
||||
<message name="IDS_PICTURE_IN_PICTURE_TURN_OFF_CAMERA_TEXT" desc="Text label of the turn off camera control button. The button appears when the user hovers over the Picture-in-Picture window.">
|
||||
Turn off camera
|
||||
</message>
|
||||
<message name="IDS_PICTURE_IN_PICTURE_HANG_UP_TEXT" desc="Text label of the hang up control button. The button appears when the user hovers over the Picture-in-Picture window.">
|
||||
Hang up
|
||||
</message>
|
||||
<message name="IDS_PICTURE_IN_PICTURE_CLOSE_CONTROL_TEXT" desc="Text label of the close control button. The button appears when the user hovers over the Picture-in-Picture window.">
|
||||
Close
|
||||
</message>
|
||||
<message name="IDS_PICTURE_IN_PICTURE_RESIZE_HANDLE_TEXT" desc="Text label of the resize handle. The button appears when the user hovers over the Picture-in-Picture window.">
|
||||
Resize
|
||||
</message>
|
||||
<message name="IDS_PICTURE_IN_PICTURE_PLAY_PAUSE_CONTROL_ACCESSIBLE_TEXT" desc="Accessible text label used for the controls button in the Picture-in-Picture window. The button toggles between play and pause controls.">
|
||||
Toggle video to play or pause
|
||||
</message>
|
||||
<message name="IDS_PICTURE_IN_PICTURE_MUTE_CONTROL_ACCESSIBLE_TEXT" desc="Accessible text label used for the controls button in the Picture-in-Picture window. The button toggles mute state.">
|
||||
Toggle mute
|
||||
</message>
|
||||
<message name="IDS_PICTURE_IN_PICTURE_NEXT_TRACK_CONTROL_ACCESSIBLE_TEXT" desc="Accessible text label used for the controls button in the Picture-in-Picture window. The button invokes next track action.">
|
||||
Next track
|
||||
</message>
|
||||
<message name="IDS_PICTURE_IN_PICTURE_PREVIOUS_TRACK_CONTROL_ACCESSIBLE_TEXT" desc="Accessible text label used for the controls button in the Picture-in-Picture window. The button invokes previous track action.">
|
||||
Previous track
|
||||
</message>
|
||||
<message name="IDS_SPELLCHECK_DICTIONARY" use_name_for_id="true">
|
||||
en-US
|
||||
</message>
|
||||
<message name="IDS_ACCEPT_LANGUAGES" use_name_for_id="true">
|
||||
en-US,en
|
||||
</message>
|
||||
<if expr="is_win">
|
||||
<message name="IDS_UTILITY_PROCESS_UTILITY_WIN_NAME" desc="The name of the utility process used to handle Windows utility operations.">
|
||||
Windows Utilities
|
||||
</message>
|
||||
</if>
|
||||
<message name="IDS_DOWNLOAD_MORE_ACTIONS"
|
||||
desc="Tooltip of a button on the downloads page that shows a menu with actions like 'Open downloads folder' or 'Clear all'">
|
||||
More actions
|
||||
</message>
|
||||
<!-- Badging -->
|
||||
<message name="IDS_SATURATED_BADGE_CONTENT" desc="The content to display when the application's badge is too large to display to indicate that the badge is more than a given maximum. This string should be as short as possible, preferably only one character beyond the content">
|
||||
<ph name="MAXIMUM_VALUE">$1<ex>99</ex></ph>+
|
||||
</message>
|
||||
<message name="IDS_BADGE_UNREAD_NOTIFICATIONS_SATURATED" desc="The accessibility text which will be read by a screen reader when the notification count is too large to display (e.g. greater than 99).">
|
||||
{MAX_UNREAD_NOTIFICATIONS, plural, =1 {More than 1 unread notification} other {More than # unread notifications}}
|
||||
</message>
|
||||
<message name="IDS_BADGE_UNREAD_NOTIFICATIONS_UNSPECIFIED" desc="The accessibility text which will be read by a screen reader when there are some unspecified number of notifications, or user attention is required">
|
||||
Unread Notifications
|
||||
</message>
|
||||
<message name="IDS_BADGE_UNREAD_NOTIFICATIONS" desc="The accessibility text which will be read by a screen reader when there are notifcatications">
|
||||
{UNREAD_NOTIFICATIONS, plural, =1 {1 Unread Notification} other {# Unread Notifications}}
|
||||
</message>
|
||||
<message name="IDS_HID_CHOOSER_ITEM_WITHOUT_NAME" desc="User option displaying the device IDs for a Human Interface Device (HID) without a device name.">
|
||||
Unknown Device (<ph name="DEVICE_ID">$1<ex>1234:abcd</ex></ph>) </message>
|
||||
<if expr="is_win">
|
||||
<then>
|
||||
<message name="IDS_AX_UNLABELED_IMAGE_ROLE_DESCRIPTION" desc="Accessibility role description for a graphic (image) on a web page or PDF that does not have a description for blind users." is_accessibility_with_no_ui="true">
|
||||
Unlabeled graphic
|
||||
</message>
|
||||
</then>
|
||||
<else>
|
||||
<message name="IDS_AX_UNLABELED_IMAGE_ROLE_DESCRIPTION" desc="Accessibility role description for an image on a web page or PDF that does not have a description for blind users." is_accessibility_with_no_ui="true">
|
||||
Unlabeled image
|
||||
</message>
|
||||
</else>
|
||||
</if>
|
||||
</grit-part>
|
||||
@@ -78,19 +78,6 @@ 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 });
|
||||
@@ -256,15 +243,6 @@ 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.2",
|
||||
"version": "20.0.0-nightly.20220504",
|
||||
"repository": "https://github.com/electron/electron",
|
||||
"description": "Build cross platform desktop apps with JavaScript, HTML, and CSS",
|
||||
"devDependencies": {
|
||||
|
||||
@@ -21,15 +21,11 @@ resource_file_conflict.patch
|
||||
scroll_bounce_flag.patch
|
||||
mas_blink_no_private_api.patch
|
||||
mas_no_private_api.patch
|
||||
mas-cfisobjc.patch
|
||||
mas-cgdisplayusesforcetogray.patch
|
||||
mas-audiodeviceduck.patch
|
||||
mas_disable_remote_layer.patch
|
||||
mas_disable_remote_accessibility.patch
|
||||
mas_disable_custom_window_frame.patch
|
||||
mas_avoid_usage_of_abort_report_np.patch
|
||||
mas_avoid_usage_of_pthread_fchdir_np.patch
|
||||
mas_avoid_usage_of_setapplicationisdaemon_and.patch
|
||||
mas_avoid_usage_of_private_macos_apis.patch
|
||||
mas_use_public_apis_to_determine_if_a_font_is_a_system_font.patch
|
||||
chrome_key_systems.patch
|
||||
add_didinstallconditionalfeatures.patch
|
||||
@@ -58,7 +54,6 @@ feat_add_set_theme_source_to_allow_apps_to.patch
|
||||
add_webmessageportconverter_entangleandinjectmessageportchannel.patch
|
||||
ignore_rc_check.patch
|
||||
remove_usage_of_incognito_apis_in_the_spellchecker.patch
|
||||
chore_use_electron_resources_not_chrome_for_spellchecker.patch
|
||||
allow_disabling_blink_scheduler_throttling_per_renderview.patch
|
||||
hack_plugin_response_interceptor_to_point_to_electron.patch
|
||||
feat_add_support_for_overriding_the_base_spellchecker_download_url.patch
|
||||
@@ -80,7 +75,6 @@ skip_atk_toolchain_check.patch
|
||||
worker_feat_add_hook_to_notify_script_ready.patch
|
||||
chore_provide_iswebcontentscreationoverridden_with_full_params.patch
|
||||
fix_properly_honor_printing_page_ranges.patch
|
||||
fix_use_electron_generated_resources.patch
|
||||
chore_expose_v8_initialization_isolate_callbacks.patch
|
||||
export_gin_v8platform_pageallocator_for_usage_outside_of_the_gin.patch
|
||||
fix_export_zlib_symbols.patch
|
||||
@@ -102,12 +96,11 @@ 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_adapt_exclusive_access_for_electron_needs.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,6 +108,3 @@ 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 f217de19126feeeafee01b2be31ced936696ce20..95966ce7f0eeb0a7f2822bef69b540ac6bfe298d 100644
|
||||
index 596dc721842c707844a771d64337e9cf0d82bfcc..b9eea3470139e1833b2b23d3b535b11235e2bc8e 100644
|
||||
--- a/content/renderer/render_frame_impl.cc
|
||||
+++ b/content/renderer/render_frame_impl.cc
|
||||
@@ -4489,6 +4489,12 @@ void RenderFrameImpl::DidCreateScriptContext(v8::Local<v8::Context> context,
|
||||
@@ -4465,6 +4465,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 f36d04ff77481bd30e0de3f6d45c54dfece4067c..d30f569cd68716b9e963cf0fb5da3f7e65cc215a 100644
|
||||
index bca4cbb2b2ba84fe58b5cfeaf190add5803e27c9..b6c9dd3a2a1c9b6667c563d5da86ccb4871ae81f 100644
|
||||
--- a/third_party/blink/renderer/core/frame/local_frame_client.h
|
||||
+++ b/third_party/blink/renderer/core/frame/local_frame_client.h
|
||||
@@ -303,6 +303,8 @@ class CORE_EXPORT LocalFrameClient : public FrameClient {
|
||||
@@ -301,6 +301,8 @@ class CORE_EXPORT LocalFrameClient : public FrameClient {
|
||||
|
||||
virtual void DidCreateScriptContext(v8::Local<v8::Context>,
|
||||
int32_t world_id) = 0;
|
||||
@@ -92,7 +92,7 @@ index f36d04ff77481bd30e0de3f6d45c54dfece4067c..d30f569cd68716b9e963cf0fb5da3f7e
|
||||
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 5a83dcdf50acc27da2b1fbb3e515cb4316305a3a..86f31acc40a2dd296c34f3ecf5ef6ccd97cbc18c 100644
|
||||
index b690ada2d46146b6da38cbb2c688f249ae558464..b03774140883c5bb7de6358f3df95ab8774b9dc7 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 5a83dcdf50acc27da2b1fbb3e515cb4316305a3a..86f31acc40a2dd296c34f3ecf5ef6ccd
|
||||
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 ac81fdc1ac99ca02458a10c0d258b846a8a9955e..ed838db2474790437ff4b57e23a1e289afce4d47 100644
|
||||
index 420d82ed07017deba3298c5454666c09240dd23d..15407fb95dcf25875eb76a41fe1834c1f0a53528 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 ac81fdc1ac99ca02458a10c0d258b846a8a9955e..ed838db2474790437ff4b57e23a1e289
|
||||
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 aab6a77b18f83adeac065083f83b94b7ff251282..0d0e272a162be8d1bee9e0122e3e7a59b0ad32a3 100644
|
||||
index 8087d1f62e9b1a8ac33a9e92c10a7cb8b8363e08..845c3329674d99dd385316dbfd1287fa3566a60e 100644
|
||||
--- a/third_party/blink/renderer/core/loader/empty_clients.h
|
||||
+++ b/third_party/blink/renderer/core/loader/empty_clients.h
|
||||
@@ -359,6 +359,8 @@ class CORE_EXPORT EmptyLocalFrameClient : public LocalFrameClient {
|
||||
@@ -357,6 +357,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 a9267b633e126f057e914b895f280ed658ff279d..179b5449f53c2d7b9024fb08fe1b1f6c03c6d5b0 100644
|
||||
index 32df5050f5a66c4b4f0981d3777a3b5a4fac9629..d8d9982bc6bd6e472677707b326a5dafa9b7fcf5 100644
|
||||
--- a/content/browser/renderer_host/render_view_host_impl.cc
|
||||
+++ b/content/browser/renderer_host/render_view_host_impl.cc
|
||||
@@ -665,6 +665,11 @@ void RenderViewHostImpl::SetBackgroundOpaque(bool opaque) {
|
||||
@@ -660,6 +660,11 @@ void RenderViewHostImpl::SetBackgroundOpaque(bool opaque) {
|
||||
GetWidget()->GetAssociatedFrameWidget()->SetBackgroundOpaque(opaque);
|
||||
}
|
||||
|
||||
@@ -22,11 +22,11 @@ index a9267b633e126f057e914b895f280ed658ff279d..179b5449f53c2d7b9024fb08fe1b1f6c
|
||||
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 3f0df3df3dd74ced71869ce01abf7b159387b8f4..85b169530a21bcfc016d1439a71d35378077774d 100644
|
||||
index a099eed10dd061994bff696519099c3ef7437a46..a1f1e9b55272e70b4acd5d1f1515fba7d91538fa 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 IsRenderViewLiveForTesting() const override;
|
||||
bool IsRenderViewLive() const override;
|
||||
void WriteIntoTrace(perfetto::TracedProto<TraceProto> context) const override;
|
||||
|
||||
+ void SetSchedulerThrottling(bool allowed) override;
|
||||
@@ -34,7 +34,7 @@ index 3f0df3df3dd74ced71869ce01abf7b159387b8f4..85b169530a21bcfc016d1439a71d3537
|
||||
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 3b01b3419c4361d5d75ad1c37e5baa3a1967bd09..35c82d931242a1180091267c18e0255840acc5ce 100644
|
||||
index a6fe708878eb9afba9a68e0be71ba2c0b2a84d7d..5cc81ceb44d0a8baee3ebcc63aa4137b1e9ef08e 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 39bfc2200e924d0c589cfd07f085f182ef6853a6..bddff6d5ad3f6d08c4dc48e66ebc5319b1a5ec28 100644
|
||||
index befd736a9cf362514b9a2ee475dc4a814c85a87b..24b2617f56673a3075697802cf5b574b0c766610 100644
|
||||
--- a/third_party/blink/public/mojom/page/page.mojom
|
||||
+++ b/third_party/blink/public/mojom/page/page.mojom
|
||||
@@ -108,4 +108,7 @@ interface PageBroadcast {
|
||||
@@ -97,4 +97,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 39bfc2200e924d0c589cfd07f085f182ef6853a6..bddff6d5ad3f6d08c4dc48e66ebc5319
|
||||
+ SetSchedulerThrottling(bool allowed);
|
||||
};
|
||||
diff --git a/third_party/blink/public/web/web_view.h b/third_party/blink/public/web/web_view.h
|
||||
index 5e4032ccf916f969cd669af7d983becddb57c72b..a858c9f2fa609ae756a2e70d0362f2de372dd5be 100644
|
||||
index a1427a6a95583ae853284b97cab77d577172e60e..4645764213c82e73532f7c61ed03f919f8241393 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 5e4032ccf916f969cd669af7d983becddb57c72b..a858c9f2fa609ae756a2e70d0362f2de
|
||||
// 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 6504c73f614bebad7b899c8b76c4b3034b7dab7a..f76a0ee0778d7b4e4df69a4c43b4a6bfdc89294d 100644
|
||||
index d7b5e40a26026b7f4640c2f405fadab4a800e267..b2a2e38397fdf3e9bb52c4532a1d14463ed4110d 100644
|
||||
--- a/third_party/blink/renderer/core/exported/web_view_impl.cc
|
||||
+++ b/third_party/blink/renderer/core/exported/web_view_impl.cc
|
||||
@@ -3689,6 +3689,13 @@ PageScheduler* WebViewImpl::Scheduler() const {
|
||||
@@ -3688,6 +3688,13 @@ PageScheduler* WebViewImpl::Scheduler() const {
|
||||
return GetPage()->GetPageScheduler();
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ index 6504c73f614bebad7b899c8b76c4b3034b7dab7a..f76a0ee0778d7b4e4df69a4c43b4a6bf
|
||||
void WebViewImpl::SetVisibilityState(
|
||||
mojom::blink::PageVisibilityState visibility_state,
|
||||
bool is_initial_state) {
|
||||
@@ -3700,7 +3707,8 @@ void WebViewImpl::SetVisibilityState(
|
||||
@@ -3699,7 +3706,8 @@ void WebViewImpl::SetVisibilityState(
|
||||
}
|
||||
GetPage()->SetVisibilityState(visibility_state, is_initial_state);
|
||||
GetPage()->GetPageScheduler()->SetPageVisible(
|
||||
@@ -113,10 +113,10 @@ index 6504c73f614bebad7b899c8b76c4b3034b7dab7a..f76a0ee0778d7b4e4df69a4c43b4a6bf
|
||||
|
||||
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 5c9609a6a8d1e18981ac14ad5321fa82c3eb38e0..0a2564a8e45210ba58438e95caa70d01fac22aee 100644
|
||||
index 08a54c62b7f4eeb6a8b0e0cb192723e1aecad915..1eeb122ac5db86c53d328a308dc2b7a4a5ca9fed 100644
|
||||
--- a/third_party/blink/renderer/core/exported/web_view_impl.h
|
||||
+++ b/third_party/blink/renderer/core/exported/web_view_impl.h
|
||||
@@ -420,6 +420,7 @@ class CORE_EXPORT WebViewImpl final : public WebView,
|
||||
@@ -419,6 +419,7 @@ class CORE_EXPORT WebViewImpl final : public WebView,
|
||||
LocalDOMWindow* PagePopupWindow() const;
|
||||
|
||||
PageScheduler* Scheduler() const override;
|
||||
@@ -124,7 +124,7 @@ index 5c9609a6a8d1e18981ac14ad5321fa82c3eb38e0..0a2564a8e45210ba58438e95caa70d01
|
||||
void SetVisibilityState(mojom::blink::PageVisibilityState visibility_state,
|
||||
bool is_initial_state) override;
|
||||
mojom::blink::PageVisibilityState GetVisibilityState() override;
|
||||
@@ -855,6 +856,8 @@ class CORE_EXPORT WebViewImpl final : public WebView,
|
||||
@@ -854,6 +855,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 a519c49a01987feab4dadbc4ba48b73e943fa404..c8d2a65cb428e85c33675668cc106f0af124dfee 100644
|
||||
index 0396836ad4ae67e26b6920afbcd702ccb24d391e..f207eda80b6cd1d3a739cc27499691ad1ac8e13e 100644
|
||||
--- a/third_party/blink/renderer/core/frame/frame.cc
|
||||
+++ b/third_party/blink/renderer/core/frame/frame.cc
|
||||
@@ -123,14 +123,6 @@ bool Frame::Detach(FrameDetachType type) {
|
||||
@@ -122,14 +122,6 @@ bool Frame::Detach(FrameDetachType type) {
|
||||
|
||||
DCHECK(!IsDetached());
|
||||
|
||||
@@ -33,7 +33,7 @@ index a519c49a01987feab4dadbc4ba48b73e943fa404..c8d2a65cb428e85c33675668cc106f0a
|
||||
if (type == FrameDetachType::kRemove) {
|
||||
if (provisional_frame_) {
|
||||
provisional_frame_->Detach(FrameDetachType::kRemove);
|
||||
@@ -154,6 +146,14 @@ bool Frame::Detach(FrameDetachType type) {
|
||||
@@ -153,6 +145,14 @@ bool Frame::Detach(FrameDetachType type) {
|
||||
GetWindowProxyManager()->ClearForSwap();
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ index a519c49a01987feab4dadbc4ba48b73e943fa404..c8d2a65cb428e85c33675668cc106f0a
|
||||
// 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 3efc0a04ae3fa60dce4aeb9a296c8dd1bb43320a..5dac7c18f39abefcc318ba2a7b8fad449189d0b6 100644
|
||||
index b95ed440737ccdf32607c90831d13a482315d515..73f7aeee21f0116e46dad91cb9a088ab5adda6e3 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) {
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: VerteDinde <vertedinde@electronjs.org>
|
||||
Date: Sun, 1 May 2022 18:01:42 -0700
|
||||
Subject: build: disable print_content_analysis
|
||||
|
||||
Print Content Analysis enables enterprise users to scan to-be-printed
|
||||
pages and documents for sensitive data if the OnPrintEnterpriseConnector
|
||||
policy is enabled. A conversation with the Chromium team confirmed
|
||||
this feature was intended for enterprise Chrome users and not embedders,
|
||||
so we're disabling it to prevent build issues/additional unneeded files.
|
||||
|
||||
This patch can be removed when enable_print_content_analysis can be more
|
||||
easily enabled or disabled by default with buildflags.
|
||||
|
||||
diff --git a/printing/buildflags/buildflags.gni b/printing/buildflags/buildflags.gni
|
||||
index 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 948d05358b89895faa97a7d383bfac66a45464a8..43859d267010103daf80525a5af0f312a577411c 100644
|
||||
index 02e4b0e27f4a0d3409327ba929f78b129dc06385..dce624825dc8e9e545c15a0cb0427aa33877aa3e 100644
|
||||
--- a/chrome/browser/BUILD.gn
|
||||
+++ b/chrome/browser/BUILD.gn
|
||||
@@ -4560,7 +4560,7 @@ static_library("browser") {
|
||||
@@ -4552,7 +4552,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 948d05358b89895faa97a7d383bfac66a45464a8..43859d267010103daf80525a5af0f312
|
||||
sources += [ "certificate_viewer_stub.cc" ]
|
||||
}
|
||||
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn
|
||||
index 641f52eb7952858738a6623b480f767261e5d009..6d0c624ea62a9125ef7e5579da197de2327a12ff 100644
|
||||
index 060e49987d27be37afb2b85e658525d4edc08df6..3333bb6be0d07eff9d4ef5aea446c44c00b3d3af 100644
|
||||
--- a/chrome/test/BUILD.gn
|
||||
+++ b/chrome/test/BUILD.gn
|
||||
@@ -6002,7 +6002,6 @@ test("unit_tests") {
|
||||
@@ -5995,7 +5995,6 @@ test("unit_tests") {
|
||||
|
||||
deps += [
|
||||
"//chrome:other_version",
|
||||
@@ -57,7 +57,7 @@ index 641f52eb7952858738a6623b480f767261e5d009..6d0c624ea62a9125ef7e5579da197de2
|
||||
"//chrome//services/util_win:unit_tests",
|
||||
"//chrome/app:chrome_dll_resources",
|
||||
"//chrome/browser:chrome_process_finder",
|
||||
@@ -6025,6 +6024,10 @@ test("unit_tests") {
|
||||
@@ -6018,6 +6017,10 @@ test("unit_tests") {
|
||||
"//ui/resources",
|
||||
]
|
||||
|
||||
@@ -68,7 +68,7 @@ index 641f52eb7952858738a6623b480f767261e5d009..6d0c624ea62a9125ef7e5579da197de2
|
||||
ldflags = [
|
||||
"/DELAYLOAD:api-ms-win-core-winrt-error-l1-1-0.dll",
|
||||
"/DELAYLOAD:api-ms-win-core-winrt-l1-1-0.dll",
|
||||
@@ -6712,7 +6715,6 @@ test("unit_tests") {
|
||||
@@ -6706,7 +6709,6 @@ test("unit_tests") {
|
||||
}
|
||||
|
||||
deps += [
|
||||
@@ -76,7 +76,7 @@ index 641f52eb7952858738a6623b480f767261e5d009..6d0c624ea62a9125ef7e5579da197de2
|
||||
"//chrome/browser:cart_db_content_proto",
|
||||
"//chrome/browser:coupon_db_content_proto",
|
||||
"//chrome/browser/media/router:test_support",
|
||||
@@ -6760,6 +6762,11 @@ test("unit_tests") {
|
||||
@@ -6754,6 +6756,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 ec886101b6e5347bdd832684a5c3b2cc3179c657..0287e414f4020147ddee297f7c1447c32a118905 100644
|
||||
index 9b08d7bbbda75390813ff07e0dc83bb9d16992a6..b47dc4a90a0294c5d7e73f01c496fd2b4f621400 100644
|
||||
--- a/content/browser/renderer_host/render_frame_host_impl.cc
|
||||
+++ b/content/browser/renderer_host/render_frame_host_impl.cc
|
||||
@@ -6943,6 +6943,7 @@ void RenderFrameHostImpl::CreateNewWindow(
|
||||
@@ -6939,6 +6939,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 ec886101b6e5347bdd832684a5c3b2cc3179c657..0287e414f4020147ddee297f7c1447c3
|
||||
&no_javascript_access);
|
||||
|
||||
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
|
||||
index 335e70179a03ee379082525bb4c7d596983bd633..faa795be3a6cbc7ae13d9a42a1bdbd01ac0406a9 100644
|
||||
index d0092176fd24acb0657819d666e4f76ec65012ec..df03de0a810bbce796d5bc421b92000e02dbd449 100644
|
||||
--- a/content/browser/web_contents/web_contents_impl.cc
|
||||
+++ b/content/browser/web_contents/web_contents_impl.cc
|
||||
@@ -3947,6 +3947,14 @@ FrameTree* WebContentsImpl::CreateNewWindow(
|
||||
@@ -3943,6 +3943,14 @@ FrameTree* WebContentsImpl::CreateNewWindow(
|
||||
}
|
||||
auto* new_contents_impl = new_contents.get();
|
||||
|
||||
@@ -39,7 +39,7 @@ index 335e70179a03ee379082525bb4c7d596983bd633..faa795be3a6cbc7ae13d9a42a1bdbd01
|
||||
new_contents_impl->GetController().SetSessionStorageNamespace(
|
||||
partition_config, session_storage_namespace);
|
||||
|
||||
@@ -3991,12 +3999,6 @@ FrameTree* WebContentsImpl::CreateNewWindow(
|
||||
@@ -3987,12 +3995,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 9bbc7cf6d9542a3f013313e0c497839da2beb9d1..c01e06b08b1cca7a663e30476a551904ce9c6db8 100644
|
||||
index f132199113778f6b50972419b61a187e6272300c..7bb1680553c405a9016cfd67eca5fa3c6439b692 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 9bbc7cf6d9542a3f013313e0c497839da2beb9d1..c01e06b08b1cca7a663e30476a551904
|
||||
const OpenURLParams& params) {
|
||||
return nullptr;
|
||||
diff --git a/content/public/browser/web_contents_delegate.h b/content/public/browser/web_contents_delegate.h
|
||||
index 04aa4d993b331396ee20464f6e1d2da10c91c834..2556c044b6e28501a5fac9b0040e623b8f35f497 100644
|
||||
index 85335ff06c87ea3986360fad18df6cf01a4a7cca..eeafde1fa6067804665954525eafdd482d8eb3f3 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 04aa4d993b331396ee20464f6e1d2da10c91c834..2556c044b6e28501a5fac9b0040e623b
|
||||
// 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 89b07508aef80680a847c106fea0e2fa58ff964b..6630af3583a6bac6135d46644280d6444fe981b8 100644
|
||||
index f7fbc40e8df8b996d6079f2e691771529ca42497..5580f245477b713d0f1f92ca9d15de847c4f8c92 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 2e2ba228a7f179b7cf9c43434bd20ca20b1f1af6..de9f95426ad2dcc99bc4961a0e57539d287408e4 100644
|
||||
index 00af75f5295251fb19c874d2b7d877c4a53f7f12..c0042534907dfca1789b8dde2ffa11956d3e029e 100644
|
||||
--- a/third_party/blink/renderer/core/frame/local_dom_window.cc
|
||||
+++ b/third_party/blink/renderer/core/frame/local_dom_window.cc
|
||||
@@ -2074,6 +2074,7 @@ DOMWindow* LocalDOMWindow::open(v8::Isolate* isolate,
|
||||
@@ -2076,6 +2076,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 7548e63c57dc8463cb59614122e32c574ae17437..a9e1c335e3fae4fa795059c9b28bd5d404184c2e 100644
|
||||
index 70ee9049e3cb73f55bed81c3e08037df2f4c9e07..8d230826aaf867d9046a6b9ac93a60f4750e52be 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 add5ba98f4409460b93aa2f8c49eb49a1f59470a..4b77c71375a7375e168c9bee93a73c3af6fe1252 100644
|
||||
index b9309e1cbc4a8b701534aa8be2827c40d98d6678..c1b1bfc8333e93456178842db392eabff96bf4c9 100644
|
||||
--- a/content/browser/web_contents/web_contents_impl.cc
|
||||
+++ b/content/browser/web_contents/web_contents_impl.cc
|
||||
@@ -3895,8 +3895,7 @@ FrameTree* WebContentsImpl::CreateNewWindow(
|
||||
@@ -3891,8 +3891,7 @@ FrameTree* WebContentsImpl::CreateNewWindow(
|
||||
|
||||
if (delegate_ && delegate_->IsWebContentsCreationOverridden(
|
||||
source_site_instance, params.window_container_type,
|
||||
@@ -260,7 +260,7 @@ index add5ba98f4409460b93aa2f8c49eb49a1f59470a..4b77c71375a7375e168c9bee93a73c3a
|
||||
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 c01e06b08b1cca7a663e30476a551904ce9c6db8..9f50a8721560f734270308776f2f37ad49a8cb91 100644
|
||||
index 7bb1680553c405a9016cfd67eca5fa3c6439b692..3aa2cca04340098859e1072eaa80a46a8e0463b1 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 c01e06b08b1cca7a663e30476a551904ce9c6db8..9f50a8721560f734270308776f2f37ad
|
||||
}
|
||||
|
||||
diff --git a/content/public/browser/web_contents_delegate.h b/content/public/browser/web_contents_delegate.h
|
||||
index 2556c044b6e28501a5fac9b0040e623b8f35f497..4c6cd654551b2f5cfd59a5271a8d95a9e6862d3c 100644
|
||||
index eeafde1fa6067804665954525eafdd482d8eb3f3..b17f371aa489a5b61c28fbcd316b19815f072df9 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 {
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Samuel Attard <sattard@slack-corp.com>
|
||||
Date: Wed, 23 Oct 2019 14:17:18 -0700
|
||||
Subject: chore: use electron resources not chrome for spellchecker
|
||||
|
||||
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 af2fd82cbc458b396107a161d9c3dd31077e57a7..948d05358b89895faa97a7d383bfac66a45464a8 100644
|
||||
--- a/chrome/browser/BUILD.gn
|
||||
+++ b/chrome/browser/BUILD.gn
|
||||
@@ -7182,6 +7182,7 @@ static_library("browser") {
|
||||
deps += [
|
||||
"//components/spellcheck/browser",
|
||||
"//components/spellcheck/common",
|
||||
+ "//electron:resources",
|
||||
]
|
||||
|
||||
if (!is_android) {
|
||||
diff --git a/chrome/browser/spellchecker/spellcheck_factory.cc b/chrome/browser/spellchecker/spellcheck_factory.cc
|
||||
index 7c3b6a69acb16186add5d467dbc22360d90d46d4..703e2ce60f4f35f9c71e8b503ffd62f9ea8f365a 100644
|
||||
--- a/chrome/browser/spellchecker/spellcheck_factory.cc
|
||||
+++ b/chrome/browser/spellchecker/spellcheck_factory.cc
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "build/build_config.h"
|
||||
#include "chrome/browser/profiles/incognito_helpers.h"
|
||||
#include "chrome/browser/spellchecker/spellcheck_service.h"
|
||||
-#include "chrome/grit/locale_settings.h"
|
||||
+#include "electron/grit/electron_resources.h"
|
||||
#include "components/keyed_service/content/browser_context_dependency_manager.h"
|
||||
#include "components/pref_registry/pref_registry_syncable.h"
|
||||
#include "components/prefs/pref_service.h"
|
||||
diff --git a/components/language/core/browser/BUILD.gn b/components/language/core/browser/BUILD.gn
|
||||
index fdba4ca90882656d6ba369dae48d5dfc13991cb8..fb3b759362275aafd4ed01a7865a4dd0dfaad727 100644
|
||||
--- a/components/language/core/browser/BUILD.gn
|
||||
+++ b/components/language/core/browser/BUILD.gn
|
||||
@@ -30,6 +30,7 @@ static_library("browser") {
|
||||
"//components/pref_registry",
|
||||
"//components/prefs",
|
||||
"//components/strings",
|
||||
+ "//electron:resources",
|
||||
"//ui/base",
|
||||
]
|
||||
}
|
||||
diff --git a/components/language/core/browser/language_prefs.cc b/components/language/core/browser/language_prefs.cc
|
||||
index 26f86d67c32b2a022698ae5ea5509912d2ccfacb..d48844d49308d67ee7bfa823335c7443173badbe 100644
|
||||
--- a/components/language/core/browser/language_prefs.cc
|
||||
+++ b/components/language/core/browser/language_prefs.cc
|
||||
@@ -22,7 +22,7 @@
|
||||
#include "components/pref_registry/pref_registry_syncable.h"
|
||||
#include "components/prefs/pref_service.h"
|
||||
#include "components/prefs/scoped_user_pref_update.h"
|
||||
-#include "components/strings/grit/components_locale_settings.h"
|
||||
+#include "electron/grit/electron_resources.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
|
||||
namespace language {
|
||||
@@ -1,53 +0,0 @@
|
||||
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,
|
||||
@@ -82,18 +82,9 @@ index 1e4a652634fbde2ca9a256baca840bbc5a0e001f..546f5bc3a2f79035f0eec196d9e704b8
|
||||
const Source& GetSource(int index) const override;
|
||||
DesktopMediaList::Type GetMediaListType() const override;
|
||||
diff --git a/chrome/browser/media/webrtc/native_desktop_media_list.cc b/chrome/browser/media/webrtc/native_desktop_media_list.cc
|
||||
index 6d8c9d940bb4488ffedc1eb8c543c065bb3953c9..2026b926eee56f6b235963b23ab86b2743eaed90 100644
|
||||
index 6d8c9d940bb4488ffedc1eb8c543c065bb3953c9..d5092cb0245a4b8dc26073741f0bc6657b943bdd 100644
|
||||
--- a/chrome/browser/media/webrtc/native_desktop_media_list.cc
|
||||
+++ b/chrome/browser/media/webrtc/native_desktop_media_list.cc
|
||||
@@ -18,7 +18,7 @@
|
||||
#include "build/build_config.h"
|
||||
#include "build/chromeos_buildflags.h"
|
||||
#include "chrome/browser/media/webrtc/desktop_media_list.h"
|
||||
-#include "chrome/grit/generated_resources.h"
|
||||
+#include "electron/grit/electron_resources.h"
|
||||
#include "content/public/browser/browser_task_traits.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
#include "content/public/common/content_features.h"
|
||||
@@ -127,8 +127,9 @@ BOOL CALLBACK AllHwndCollector(HWND hwnd, LPARAM param) {
|
||||
#endif // BUILDFLAG(IS_WIN)
|
||||
|
||||
|
||||
@@ -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 09f72f1fbd7b782c5bf52245482b358103f0c243..80d9fd40efed1edc90e7bdf1db534acb876206ca 100644
|
||||
index 927e182bbba7a3700fd20c8c964da7cc162c4210..f099940c5b8fd92c04401cfbd231c04cb413d286 100644
|
||||
--- a/content/browser/renderer_host/render_process_host_impl.cc
|
||||
+++ b/content/browser/renderer_host/render_process_host_impl.cc
|
||||
@@ -198,6 +198,7 @@
|
||||
@@ -197,6 +197,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 09f72f1fbd7b782c5bf52245482b358103f0c243..80d9fd40efed1edc90e7bdf1db534acb
|
||||
#include "ui/gl/gl_switches.h"
|
||||
#include "url/gurl.h"
|
||||
#include "url/origin.h"
|
||||
@@ -3219,6 +3220,7 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer(
|
||||
@@ -3213,6 +3214,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 c289c888bc9d74d3f696714650b65aa373be27b4..aad7ec5ed0b6f6ab5cdfe0d7902d952c7c9e36c6 100644
|
||||
index cd286b4925b3d2d9e74caecee759360488f2b8ba..0bc714a78e58719824ffeba8ced7854474fa6e92 100644
|
||||
--- a/content/browser/renderer_host/navigator.cc
|
||||
+++ b/content/browser/renderer_host/navigator.cc
|
||||
@@ -1286,6 +1286,7 @@ void Navigator::RecordNavigationMetrics(
|
||||
@@ -1177,6 +1177,7 @@ void Navigator::RecordNavigationMetrics(
|
||||
.InMilliseconds());
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ index c289c888bc9d74d3f696714650b65aa373be27b4..aad7ec5ed0b6f6ab5cdfe0d7902d952c
|
||||
// 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 &&
|
||||
@@ -1332,6 +1333,7 @@ void Navigator::RecordNavigationMetrics(
|
||||
@@ -1223,6 +1224,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 95966ce7f0eeb0a7f2822bef69b540ac6bfe298d..34c2bdc5d4dda2fb0bdf2a8c3e5f8f9a5e11b977 100644
|
||||
index b9eea3470139e1833b2b23d3b535b11235e2bc8e..fbc1f6d8387e33cb7daafc96b7514897f067f008 100644
|
||||
--- a/content/renderer/render_frame_impl.cc
|
||||
+++ b/content/renderer/render_frame_impl.cc
|
||||
@@ -2398,7 +2398,7 @@ const blink::WebView* RenderFrameImpl::GetWebView() const {
|
||||
@@ -2377,7 +2377,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 f06a04983571623b542dba11933c4c95c3dcf398..606573a33573884baa173b796e1870b8defcda2a 100644
|
||||
index 98268925da14d61256f8dee3aa899f17ce7acaf6..1abdc204e278383818dc073f96c90e91ec1f3fb9 100644
|
||||
--- a/services/network/network_context.cc
|
||||
+++ b/services/network/network_context.cc
|
||||
@@ -1407,6 +1407,13 @@ void NetworkContext::SetNetworkConditions(
|
||||
@@ -1404,6 +1404,13 @@ void NetworkContext::SetNetworkConditions(
|
||||
std::move(network_conditions));
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ index f06a04983571623b542dba11933c4c95c3dcf398..606573a33573884baa173b796e1870b8
|
||||
// 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 2cd8707b120deb41683e13def5d446fd3bf93afe..c654d54cbb1427e700d918a94390c022b5b1cb14 100644
|
||||
index 58671094857cdfe5d853c8a284d51bc1b8a09660..7af71839aa1bc970370a91cd35f3cbefe06e67e5 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 f76a0ee0778d7b4e4df69a4c43b4a6bfdc89294d..45baa4d62cb4e5aebedebba993ddbc9f06711d35 100644
|
||||
index b2a2e38397fdf3e9bb52c4532a1d14463ed4110d..9f0f209f279cc3dbe35efc12eb1e51449dfda470 100644
|
||||
--- a/third_party/blink/renderer/core/exported/web_view_impl.cc
|
||||
+++ b/third_party/blink/renderer/core/exported/web_view_impl.cc
|
||||
@@ -159,6 +159,7 @@
|
||||
@@ -160,6 +160,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 f76a0ee0778d7b4e4df69a4c43b4a6bfdc89294d..45baa4d62cb4e5aebedebba993ddbc9f
|
||||
#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"
|
||||
@@ -1776,6 +1777,7 @@ void WebView::ApplyWebPreferences(const web_pref::WebPreferences& prefs,
|
||||
@@ -1777,6 +1778,7 @@ void WebView::ApplyWebPreferences(const web_pref::WebPreferences& prefs,
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
web_view_impl->SetMaximumLegibleScale(
|
||||
prefs.default_maximum_page_scale_factor);
|
||||
|
||||
@@ -1,348 +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 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);
|
||||
@@ -0,0 +1,600 @@
|
||||
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 4e38e0f49054cef3fd1a712c89608ce39003edeb..427882f8ed0d85c6e4170b213c3a3678b60a62df 100644
|
||||
index df92bab44402330869b44aa76bb40fc20e33b16a..2b3fbaee17c0a8bb7b04cd4c4edb13626dd1bb27 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 12e115cd6a128d8d150abc786d4d38b1d5119d91..b6320de28750333bee7ee83393849f4eb0a956ac 100644
|
||||
index c5fb29b30b9c5b7483998c567ed9a479d8743939..dc10d78315f76a3914ccd6e2e99af97fa909918b 100644
|
||||
--- a/ui/gfx/ca_layer_params.h
|
||||
+++ b/ui/gfx/ca_layer_params.h
|
||||
@@ -6,6 +6,7 @@
|
||||
@@ -632,7 +632,7 @@ index 12e115cd6a128d8d150abc786d4d38b1d5119d91..b6320de28750333bee7ee83393849f4e
|
||||
#include "ui/gfx/geometry/size.h"
|
||||
#include "ui/gfx/gfx_export.h"
|
||||
|
||||
@@ -51,6 +52,8 @@ struct GFX_EXPORT CALayerParams {
|
||||
@@ -41,6 +42,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 a15e3c4bed344364f9c43e3f0b5c494d58dff789..24e3b291f8c25de2a0b82184fd731538b6586f86 100644
|
||||
index 87868727a78223baef9ffd2591f49fced240ef4e..f6a6ff28f33e2d1c065f2abeb96733b2d28a6ea1 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_outermost_main_frame == request.is_outermost_main_frame &&
|
||||
is_main_frame == request.is_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 2ff43cc1ef683707001bf22c9b030bf6e7223e0f..cfaf9170666f04407adb5738ce6723900d234735 100644
|
||||
index 8b9a7b36f53a4cfcd159ac18c06d1724072013c8..ef0191bae8a07e531ae129cf32b22f4930c5e266 100644
|
||||
--- a/services/network/public/cpp/resource_request.h
|
||||
+++ b/services/network/public/cpp/resource_request.h
|
||||
@@ -158,6 +158,7 @@ struct COMPONENT_EXPORT(NETWORK_CPP_BASE) ResourceRequest {
|
||||
@@ -156,6 +156,7 @@ struct COMPONENT_EXPORT(NETWORK_CPP_BASE) ResourceRequest {
|
||||
bool do_not_prompt_for_login = false;
|
||||
bool is_outermost_main_frame = false;
|
||||
bool is_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 4f2740ebf2dc4bee423cdbb72cae128f28a03f12..d3f531429598b3666aaba655356155c470e8b645 100644
|
||||
index 1fcf54cac11c38352e14774cd08bcaa162443e9c..5356da11391d52a8f9aaa57a27616cee6dc0f2b6 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_outermost_main_frame = data.is_outermost_main_frame();
|
||||
out->is_main_frame = data.is_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 069768e7ca727fc2ad8f5379900ad4a959a87f4f..3e6bc18564e2a3cdbac9af686636f75d64082464 100644
|
||||
index 3a1c5bd943c110514e4da06491190476d6e6de38..6a80fb16242865d398bcbcd380893ccc9a3fe167 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 069768e7ca727fc2ad8f5379900ad4a959a87f4f..3e6bc18564e2a3cdbac9af686636f75d
|
||||
return request.previews_state;
|
||||
}
|
||||
diff --git a/services/network/public/mojom/url_request.mojom b/services/network/public/mojom/url_request.mojom
|
||||
index ef3e8e68621402db5a97977f49ac74c438b0a563..aa1c1bcf7ca30adde4c25ed9bd8ed8a70eb919e0 100644
|
||||
index 79b5d03ded03ced9e6ff4d17d10935004bfb0062..923883fd010f9621c790dd5381a7e1f0cb36e740 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 c79ad06ecb80ea431bf48c16e413286c768e2316..2a5cce5b467e79df1f34d7318862fd16134b74c3 100644
|
||||
index 4c11fd542a66f514a6c36e684a34d0a62053c1f4..6852fd470c79e2fb041bf57a01e2b0b913cb94db 100644
|
||||
--- a/services/network/url_loader.cc
|
||||
+++ b/services/network/url_loader.cc
|
||||
@@ -469,6 +469,7 @@ URLLoader::URLLoader(
|
||||
@@ -123,7 +123,7 @@ index c79ad06ecb80ea431bf48c16e413286c768e2316..2a5cce5b467e79df1f34d7318862fd16
|
||||
url_request_->SetResponseHeadersCallback(base::BindRepeating(
|
||||
&URLLoader::SetRawResponseHeaders, base::Unretained(this)));
|
||||
}
|
||||
@@ -1427,6 +1428,19 @@ void URLLoader::OnResponseStarted(net::URLRequest* url_request, int net_error) {
|
||||
@@ -1411,6 +1412,19 @@ void URLLoader::OnResponseStarted(net::URLRequest* url_request, int net_error) {
|
||||
}
|
||||
|
||||
response_ = BuildResponseHead();
|
||||
@@ -144,7 +144,7 @@ index c79ad06ecb80ea431bf48c16e413286c768e2316..2a5cce5b467e79df1f34d7318862fd16
|
||||
|
||||
// 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 e235b3cc8657e081063709f6d2cd6e0b2e99f2b2..15b77b8648b905711df8551b1645b14dd7d6fd87 100644
|
||||
index 53822d17b20f4e6d163d0dc84eea6c455254a5f7..c494a63b0c1dcb39120e8aabc84a60ebbf2ff224 100644
|
||||
--- a/services/network/url_loader.h
|
||||
+++ b/services/network/url_loader.h
|
||||
@@ -502,6 +502,8 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) URLLoader
|
||||
|
||||
@@ -1,874 +0,0 @@
|
||||
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 2a29af8d9aa67768ec521e87190174397a25b722..7a5ce3038427756c26e38c91c5b3211a9a8999dd 100644
|
||||
index 07355cb194bd429a693e587072d11432d6c0888a..b74b4209931c6acd6bc2e93a100c3e65a834ead9 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,
|
||||
|
||||
@@ -1,22 +1,20 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shelley Vohr <shelley.vohr@gmail.com>
|
||||
Date: Mon, 25 Oct 2021 21:45:57 +0200
|
||||
Subject: fix: adapt exclusive_access for electron needs
|
||||
Subject: fix: patch out permissions checks in exclusive_access
|
||||
|
||||
This patch is necessary in order to properly enable
|
||||
navigator.keyboard.{(un)?lock}() functionality. We don't have a concept
|
||||
of PermissionManager nor of a Profile, so this would not affect usage of
|
||||
the API.
|
||||
|
||||
We also need to ensure that NotifyExclusiveTabAccessLost is called
|
||||
on all platforms in FullscreenController::ExitFullscreenModeInternal()
|
||||
and not just macOS, since Electron's native window impls report state
|
||||
change fairly instantly as well, and so pressing escape won't work on
|
||||
Linux or Windows to un-fullscreen in some circumstances without this
|
||||
change.
|
||||
We might consider potentially using our own permissions handler,
|
||||
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 467fed776d390e1a10075d62dab75fd8a6789627..d6f3c20fabee755373add6ee1e5722c106204e42 100644
|
||||
index 41cd193087f8d4f246993e96da96ea0523ab50ed..96cd17afad81037ce94ca3ea3583ebbbdd7f157b 100644
|
||||
--- a/chrome/browser/ui/exclusive_access/fullscreen_controller.cc
|
||||
+++ b/chrome/browser/ui/exclusive_access/fullscreen_controller.cc
|
||||
@@ -16,12 +16,16 @@
|
||||
@@ -36,7 +34,7 @@ index 467fed776d390e1a10075d62dab75fd8a6789627..d6f3c20fabee755373add6ee1e5722c1
|
||||
#include "chrome/common/chrome_switches.h"
|
||||
#include "content/public/browser/navigation_details.h"
|
||||
#include "content/public/browser/navigation_entry.h"
|
||||
@@ -164,6 +168,7 @@ void FullscreenController::EnterFullscreenModeForTab(
|
||||
@@ -159,6 +163,7 @@ void FullscreenController::EnterFullscreenModeForTab(
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -44,7 +42,7 @@ index 467fed776d390e1a10075d62dab75fd8a6789627..d6f3c20fabee755373add6ee1e5722c1
|
||||
if (base::FeatureList::IsEnabled(
|
||||
blink::features::kWindowPlacementFullscreenCompanionWindow)) {
|
||||
if (!popunder_preventer_)
|
||||
@@ -171,6 +176,7 @@ void FullscreenController::EnterFullscreenModeForTab(
|
||||
@@ -166,6 +171,7 @@ void FullscreenController::EnterFullscreenModeForTab(
|
||||
else
|
||||
popunder_preventer_->WillActivateWebContents(web_contents);
|
||||
}
|
||||
@@ -52,7 +50,7 @@ index 467fed776d390e1a10075d62dab75fd8a6789627..d6f3c20fabee755373add6ee1e5722c1
|
||||
|
||||
// Keep the current state. |SetTabWithExclusiveAccess| may change the return
|
||||
// value of |IsWindowFullscreenForTabOrPending|.
|
||||
@@ -220,7 +226,9 @@ void FullscreenController::EnterFullscreenModeForTab(
|
||||
@@ -218,7 +224,9 @@ void FullscreenController::EnterFullscreenModeForTab(
|
||||
}
|
||||
|
||||
void FullscreenController::ExitFullscreenModeForTab(WebContents* web_contents) {
|
||||
@@ -62,7 +60,7 @@ index 467fed776d390e1a10075d62dab75fd8a6789627..d6f3c20fabee755373add6ee1e5722c1
|
||||
|
||||
if (MaybeToggleFullscreenWithinTab(web_contents, false)) {
|
||||
// During tab capture of fullscreen-within-tab views, the browser window
|
||||
@@ -275,11 +283,13 @@ void FullscreenController::ExitFullscreenModeForTab(WebContents* web_contents) {
|
||||
@@ -263,11 +271,13 @@ void FullscreenController::ExitFullscreenModeForTab(WebContents* web_contents) {
|
||||
void FullscreenController::FullscreenTabOpeningPopup(
|
||||
content::WebContents* opener,
|
||||
content::WebContents* popup) {
|
||||
@@ -76,7 +74,7 @@ index 467fed776d390e1a10075d62dab75fd8a6789627..d6f3c20fabee755373add6ee1e5722c1
|
||||
}
|
||||
|
||||
void FullscreenController::OnTabDeactivated(
|
||||
@@ -429,17 +439,15 @@ void FullscreenController::EnterFullscreenModeInternal(
|
||||
@@ -417,13 +427,9 @@ 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.
|
||||
@@ -92,49 +90,27 @@ index 467fed776d390e1a10075d62dab75fd8a6789627..d6f3c20fabee755373add6ee1e5722c1
|
||||
#endif
|
||||
|
||||
toggled_into_fullscreen_ = true;
|
||||
+#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(
|
||||
@@ -436,6 +442,7 @@ void FullscreenController::EnterFullscreenModeInternal(
|
||||
url = extension_caused_fullscreen_;
|
||||
}
|
||||
|
||||
+#if 0
|
||||
if (option == TAB && display_id != display::kInvalidDisplayId) {
|
||||
if (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.
|
||||
@@ -466,6 +475,7 @@ void FullscreenController::EnterFullscreenModeInternal(
|
||||
GetDisplayId(WebContents::FromRenderFrameHost(requesting_frame));
|
||||
@@ -449,6 +456,7 @@ void FullscreenController::EnterFullscreenModeInternal(
|
||||
display_id = display::kInvalidDisplayId;
|
||||
}
|
||||
}
|
||||
+#endif
|
||||
|
||||
if (option == BROWSER)
|
||||
base::RecordAction(base::UserMetricsAction("ToggleFullscreen"));
|
||||
@@ -492,12 +502,12 @@ void FullscreenController::ExitFullscreenModeInternal() {
|
||||
|
||||
RecordExitingUMA();
|
||||
toggled_into_fullscreen_ = false;
|
||||
-#if BUILDFLAG(IS_MAC)
|
||||
- // Mac windows report a state change instantly, and so we must also clear
|
||||
+
|
||||
+ // Electron native windows report a state change instantly, and so we must also clear
|
||||
// state_prior_to_tab_fullscreen_ to match them else other logic using
|
||||
// state_prior_to_tab_fullscreen_ will be incorrect.
|
||||
NotifyTabExclusiveAccessLost();
|
||||
-#endif
|
||||
+
|
||||
exclusive_access_manager()->context()->ExitFullscreen();
|
||||
extension_caused_fullscreen_ = GURL();
|
||||
|
||||
diff --git a/chrome/browser/ui/exclusive_access/fullscreen_controller.h b/chrome/browser/ui/exclusive_access/fullscreen_controller.h
|
||||
index 58a1ff5fb9fecd8c85905045ba43f43f0c63c2bb..15f868ac651c05eae6505adb80f2b4573a1166ef 100644
|
||||
index 7bd40f52ef5f6b04a7ea114ec4d18c8a98ec6d42..fb04fed5cc1e2e255c9e67c180fababe1fbb3fe0 100644
|
||||
--- a/chrome/browser/ui/exclusive_access/fullscreen_controller.h
|
||||
+++ b/chrome/browser/ui/exclusive_access/fullscreen_controller.h
|
||||
@@ -224,10 +224,12 @@ class FullscreenController : public ExclusiveAccessControllerBase {
|
||||
@@ -222,10 +222,12 @@ class FullscreenController : public ExclusiveAccessControllerBase {
|
||||
// Used in testing to set the state to tab fullscreen.
|
||||
bool is_tab_fullscreen_for_testing_ = false;
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shelley Vohr <shelley.vohr@gmail.com>
|
||||
Date: Thu, 24 Sep 2020 11:10:41 -0700
|
||||
Subject: fix: use electron generated resources
|
||||
|
||||
This patch fixes a few instances where we need to use Electron generated
|
||||
resources for IDS strings, or the IDs will be wrong and cause DCHECKS
|
||||
as they will loaded as empty strings.
|
||||
|
||||
* IDS_UTILITY_PROCESS_UTILITY_WIN_NAME on Windows
|
||||
* IDR_PDF_MANIFEST on Linux
|
||||
* IDS_UTILITY_PROCESS_PRINTING_SERVICE_NAME on Windows
|
||||
|
||||
diff --git a/chrome/browser/pdf/pdf_extension_util.cc b/chrome/browser/pdf/pdf_extension_util.cc
|
||||
index 441c28828328b72b625db10c5dca85f1f2349482..17973b511994cf32da051d144fc893a87fbb1d0c 100644
|
||||
--- a/chrome/browser/pdf/pdf_extension_util.cc
|
||||
+++ b/chrome/browser/pdf/pdf_extension_util.cc
|
||||
@@ -11,8 +11,7 @@
|
||||
#include "build/chromeos_buildflags.h"
|
||||
#include "chrome/browser/browser_process.h"
|
||||
#include "chrome/common/chrome_content_client.h"
|
||||
-#include "chrome/grit/browser_resources.h"
|
||||
-#include "chrome/grit/generated_resources.h"
|
||||
+#include "electron/grit/electron_resources.h"
|
||||
#include "components/strings/grit/components_strings.h"
|
||||
#include "components/zoom/page_zoom_constants.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
diff --git a/chrome/browser/printing/printing_service.cc b/chrome/browser/printing/printing_service.cc
|
||||
index 6d18517898c11c6a628cec2eade57fe845827b3d..a21f52e8a3c6f80d69b27faae4b77700fdd09e35 100644
|
||||
--- a/chrome/browser/printing/printing_service.cc
|
||||
+++ b/chrome/browser/printing/printing_service.cc
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "chrome/browser/printing/printing_service.h"
|
||||
|
||||
#include "base/no_destructor.h"
|
||||
-#include "chrome/grit/generated_resources.h"
|
||||
+#include "electron/grit/electron_resources.h"
|
||||
#include "chrome/services/printing/public/mojom/printing_service.mojom.h"
|
||||
#include "content/public/browser/service_process_host.h"
|
||||
|
||||
diff --git a/chrome/browser/win/icon_reader_service.cc b/chrome/browser/win/icon_reader_service.cc
|
||||
index d5497a7e26cdb66c7c074bc509e2bfec7d7875cd..62d2f555253eef903bd04ff1a0ad37d1470309e0 100644
|
||||
--- a/chrome/browser/win/icon_reader_service.cc
|
||||
+++ b/chrome/browser/win/icon_reader_service.cc
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include "chrome/browser/win/icon_reader_service.h"
|
||||
|
||||
-#include "chrome/grit/generated_resources.h"
|
||||
+#include "electron/grit/electron_resources.h"
|
||||
#include "chrome/services/util_win/public/mojom/util_read_icon.mojom.h"
|
||||
#include "content/public/browser/service_process_host.h"
|
||||
|
||||
@@ -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 b17180351e6e693352fcda973bdc23da79d8bfac..307ea58a72fe05f283b2cdfd6027625f96c5a99b 100644
|
||||
index 390ac74f01b5080880dcab65537a22fb7ef0cc41..103dc143f6310a2b9f0a834f7d25cf32207bea86 100644
|
||||
--- a/content/browser/renderer_host/render_frame_host_manager.cc
|
||||
+++ b/content/browser/renderer_host/render_frame_host_manager.cc
|
||||
@@ -3167,6 +3167,9 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest(
|
||||
@@ -3180,6 +3180,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 6bd25626dc999438316c2084442a29389d4154fb..bc27370e73d3061dfacbd96a3b8cf576b94e3d9b 100755
|
||||
index 694a67b7a0f622c7a8bfc1d46148398140d51384..00b588b268aa059ff84adbbc6ae266aa67e174b1 100755
|
||||
--- a/tools/clang/scripts/update.py
|
||||
+++ b/tools/clang/scripts/update.py
|
||||
@@ -298,6 +298,8 @@ def GetDefaultHostOs():
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jeremy Apthorp <nornagon@nornagon.net>
|
||||
Date: Thu, 20 Sep 2018 17:49:31 -0700
|
||||
Subject: mas: avoid usage of AudioDeviceDuck
|
||||
|
||||
Removes usage of the AudioDeviceDuck private API.
|
||||
|
||||
diff --git a/media/audio/mac/audio_low_latency_input_mac.cc b/media/audio/mac/audio_low_latency_input_mac.cc
|
||||
index 0e842caf7b6487d94978c7b68fb5b222e330581f..5eafcd163ee1a05203a5eb76592a449f5a84e71f 100644
|
||||
--- a/media/audio/mac/audio_low_latency_input_mac.cc
|
||||
+++ b/media/audio/mac/audio_low_latency_input_mac.cc
|
||||
@@ -34,19 +34,23 @@
|
||||
|
||||
namespace {
|
||||
extern "C" {
|
||||
+#ifndef MAS_BUILD
|
||||
// See:
|
||||
// https://trac.webkit.org/browser/webkit/trunk/Source/WebCore/PAL/pal/spi/cf/CoreAudioSPI.h?rev=228264
|
||||
OSStatus AudioDeviceDuck(AudioDeviceID inDevice,
|
||||
Float32 inDuckedLevel,
|
||||
const AudioTimeStamp* __nullable inStartTime,
|
||||
Float32 inRampDuration) __attribute__((weak_import));
|
||||
+#endif
|
||||
}
|
||||
|
||||
void UndoDucking(AudioDeviceID output_device_id) {
|
||||
+#ifndef MAS_BUILD
|
||||
if (AudioDeviceDuck != nullptr) {
|
||||
// Ramp the volume back up over half a second.
|
||||
AudioDeviceDuck(output_device_id, 1.0, nullptr, 0.5);
|
||||
}
|
||||
+#endif
|
||||
}
|
||||
|
||||
} // namespace
|
||||
@@ -1,44 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jeremy Apthorp <nornagon@nornagon.net>
|
||||
Date: Thu, 20 Sep 2018 17:49:20 -0700
|
||||
Subject: mas: avoid usage of _CFIsObjC
|
||||
|
||||
Removes usage of the _CFIsObjC private API.
|
||||
|
||||
diff --git a/base/mac/foundation_util.mm b/base/mac/foundation_util.mm
|
||||
index 61641e1ad8a47a4910918ff61523a23854745b81..d4a3e2282256f5a43235b40b4c9f46caa725c507 100644
|
||||
--- a/base/mac/foundation_util.mm
|
||||
+++ b/base/mac/foundation_util.mm
|
||||
@@ -30,12 +30,6 @@
|
||||
#if !BUILDFLAG(IS_IOS)
|
||||
CFTypeID SecACLGetTypeID();
|
||||
CFTypeID SecTrustedApplicationGetTypeID();
|
||||
-// The NSFont/CTFont toll-free bridging is broken before 10.15.
|
||||
-// http://www.openradar.me/15341349 rdar://15341349
|
||||
-//
|
||||
-// TODO(https://crbug.com/1076527): This is fixed in 10.15. When 10.15 is the
|
||||
-// minimum OS for Chromium, remove this SPI declaration.
|
||||
-Boolean _CFIsObjC(CFTypeID typeID, CFTypeRef obj);
|
||||
#endif
|
||||
} // extern "C"
|
||||
|
||||
@@ -316,8 +310,7 @@ void SetBaseBundleID(const char* new_base_bundle_id) {
|
||||
const_cast<NSFont*>(reinterpret_cast<const NSFont*>(cf_val));
|
||||
DCHECK(!cf_val ||
|
||||
CTFontGetTypeID() == CFGetTypeID(cf_val) ||
|
||||
- (_CFIsObjC(CTFontGetTypeID(), cf_val) &&
|
||||
- [ns_val isKindOfClass:[NSFont class]]));
|
||||
+ ([ns_val isKindOfClass:[NSFont class]]));
|
||||
return ns_val;
|
||||
}
|
||||
|
||||
@@ -388,9 +381,6 @@ CTFontRef NSToCFCast(NSFont* ns_val) {
|
||||
return (CTFontRef)(cf_val);
|
||||
}
|
||||
|
||||
- if (!_CFIsObjC(CTFontGetTypeID(), cf_val))
|
||||
- return NULL;
|
||||
-
|
||||
id<NSObject> ns_val = reinterpret_cast<id>(const_cast<void*>(cf_val));
|
||||
if ([ns_val isKindOfClass:[NSFont class]]) {
|
||||
return (CTFontRef)(cf_val);
|
||||
@@ -1,35 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Samuel Attard <sattard@slack-corp.com>
|
||||
Date: Mon, 4 Mar 2019 14:43:36 -0800
|
||||
Subject: mas: avoid usage of abort_report_np
|
||||
|
||||
Disable usage of the private API abort_report_np in MAS builds.
|
||||
|
||||
diff --git a/sandbox/mac/sandbox_logging.cc b/sandbox/mac/sandbox_logging.cc
|
||||
index 702224dce1871c07b07f6882e46d14fe532d6ed2..797cb6646171486797a5e5fbbb1b187e3a9f81d4 100644
|
||||
--- a/sandbox/mac/sandbox_logging.cc
|
||||
+++ b/sandbox/mac/sandbox_logging.cc
|
||||
@@ -32,9 +32,11 @@
|
||||
}
|
||||
#endif
|
||||
|
||||
+#if !defined(MAS_BUILD)
|
||||
extern "C" {
|
||||
void abort_report_np(const char*, ...);
|
||||
}
|
||||
+#endif
|
||||
|
||||
namespace sandbox {
|
||||
|
||||
@@ -104,9 +106,11 @@ void SendAslLog(Level level, const char* message) {
|
||||
asl_set(asl_message.get(), ASL_KEY_MSG, message);
|
||||
asl_send(asl_client.get(), asl_message.get());
|
||||
|
||||
+#if !defined(MAS_BUILD)
|
||||
if (level == Level::FATAL) {
|
||||
abort_report_np(message);
|
||||
}
|
||||
+#endif
|
||||
}
|
||||
|
||||
// |error| is strerror(errno) when a P* logging function is called. Pass
|
||||
233
patches/chromium/mas_avoid_usage_of_private_macos_apis.patch
Normal file
233
patches/chromium/mas_avoid_usage_of_private_macos_apis.patch
Normal file
@@ -0,0 +1,233 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Samuel Attard <sattard@slack-corp.com>
|
||||
Date: Mon, 4 Mar 2019 14:43:36 -0800
|
||||
Subject: mas: avoid usage of private macOS APIs
|
||||
|
||||
Disable usage of the following private APIs in MAS builds:
|
||||
* abort_report_np
|
||||
* pthread_fchdir_np
|
||||
* pthread_chdir_np
|
||||
* SetApplicationIsDaemon
|
||||
* _LSSetApplicationLaunchServicesServerConnectionStatus
|
||||
* AreDeviceAndUserJoinedToDomain
|
||||
* _CFIsObjC
|
||||
* AudioDeviceDuck
|
||||
|
||||
diff --git a/base/enterprise_util_mac.mm b/base/enterprise_util_mac.mm
|
||||
index bbb851e1cafb37ebaa67e4577598fab25c90fde6..6ab12e5505b5ba545e7e0cc8c93d3ba9a6d0bacc 100644
|
||||
--- a/base/enterprise_util_mac.mm
|
||||
+++ b/base/enterprise_util_mac.mm
|
||||
@@ -168,6 +168,13 @@ MacDeviceManagementStateNew IsDeviceRegisteredWithManagementNew() {
|
||||
DeviceUserDomainJoinState AreDeviceAndUserJoinedToDomain() {
|
||||
static DeviceUserDomainJoinState state = [] {
|
||||
DeviceUserDomainJoinState state{false, false};
|
||||
+#if defined(MAS_BUILD)
|
||||
+ return state;
|
||||
+ }();
|
||||
+
|
||||
+ return state;
|
||||
+}
|
||||
+#else
|
||||
|
||||
@autoreleasepool {
|
||||
ODSession* session = [ODSession defaultSession];
|
||||
@@ -274,5 +281,6 @@ DeviceUserDomainJoinState AreDeviceAndUserJoinedToDomain() {
|
||||
|
||||
return state;
|
||||
}
|
||||
+#endif
|
||||
|
||||
} // namespace base
|
||||
diff --git a/base/mac/foundation_util.mm b/base/mac/foundation_util.mm
|
||||
index 61641e1ad8a47a4910918ff61523a23854745b81..d4a3e2282256f5a43235b40b4c9f46caa725c507 100644
|
||||
--- a/base/mac/foundation_util.mm
|
||||
+++ b/base/mac/foundation_util.mm
|
||||
@@ -30,12 +30,6 @@
|
||||
#if !BUILDFLAG(IS_IOS)
|
||||
CFTypeID SecACLGetTypeID();
|
||||
CFTypeID SecTrustedApplicationGetTypeID();
|
||||
-// The NSFont/CTFont toll-free bridging is broken before 10.15.
|
||||
-// http://www.openradar.me/15341349 rdar://15341349
|
||||
-//
|
||||
-// TODO(https://crbug.com/1076527): This is fixed in 10.15. When 10.15 is the
|
||||
-// minimum OS for Chromium, remove this SPI declaration.
|
||||
-Boolean _CFIsObjC(CFTypeID typeID, CFTypeRef obj);
|
||||
#endif
|
||||
} // extern "C"
|
||||
|
||||
@@ -316,8 +310,7 @@ void SetBaseBundleID(const char* new_base_bundle_id) {
|
||||
const_cast<NSFont*>(reinterpret_cast<const NSFont*>(cf_val));
|
||||
DCHECK(!cf_val ||
|
||||
CTFontGetTypeID() == CFGetTypeID(cf_val) ||
|
||||
- (_CFIsObjC(CTFontGetTypeID(), cf_val) &&
|
||||
- [ns_val isKindOfClass:[NSFont class]]));
|
||||
+ ([ns_val isKindOfClass:[NSFont class]]));
|
||||
return ns_val;
|
||||
}
|
||||
|
||||
@@ -388,9 +381,6 @@ CTFontRef NSToCFCast(NSFont* ns_val) {
|
||||
return (CTFontRef)(cf_val);
|
||||
}
|
||||
|
||||
- if (!_CFIsObjC(CTFontGetTypeID(), cf_val))
|
||||
- return NULL;
|
||||
-
|
||||
id<NSObject> ns_val = reinterpret_cast<id>(const_cast<void*>(cf_val));
|
||||
if ([ns_val isKindOfClass:[NSFont class]]) {
|
||||
return (CTFontRef)(cf_val);
|
||||
diff --git a/base/process/launch_mac.cc b/base/process/launch_mac.cc
|
||||
index 184cfa25dbc6cfa2a32be3f8d964ea359254f807..c9bfc4d8ca1408206244305d7634dcd51e99377c 100644
|
||||
--- a/base/process/launch_mac.cc
|
||||
+++ b/base/process/launch_mac.cc
|
||||
@@ -26,8 +26,10 @@ extern "C" {
|
||||
// descriptor. libpthread only exposes a syscall wrapper starting in
|
||||
// macOS 10.12, but the system call dates back to macOS 10.5. On older OSes,
|
||||
// the syscall is issued directly.
|
||||
+#if !defined(MAS_BUILD)
|
||||
int pthread_chdir_np(const char* dir) API_AVAILABLE(macosx(10.12));
|
||||
int pthread_fchdir_np(int fd) API_AVAILABLE(macosx(10.12));
|
||||
+#endif
|
||||
|
||||
int responsibility_spawnattrs_setdisclaim(posix_spawnattr_t attrs, int disclaim)
|
||||
API_AVAILABLE(macosx(10.14));
|
||||
@@ -96,21 +98,29 @@ class PosixSpawnFileActions {
|
||||
};
|
||||
|
||||
int ChangeCurrentThreadDirectory(const char* path) {
|
||||
+ #if defined(MAS_BUILD)
|
||||
+ return syscall(SYS___pthread_chdir, path);
|
||||
+ #else
|
||||
if (__builtin_available(macOS 10.12, *)) {
|
||||
return pthread_chdir_np(path);
|
||||
} else {
|
||||
return syscall(SYS___pthread_chdir, path);
|
||||
}
|
||||
+ #endif
|
||||
}
|
||||
|
||||
// The recommended way to unset a per-thread cwd is to set a new value to an
|
||||
// invalid file descriptor, per libpthread-218.1.3/private/private.h.
|
||||
int ResetCurrentThreadDirectory() {
|
||||
+ #if defined(MAS_BUILD)
|
||||
+ return syscall(SYS___pthread_fchdir, -1);
|
||||
+ #else
|
||||
if (__builtin_available(macOS 10.12, *)) {
|
||||
return pthread_fchdir_np(-1);
|
||||
} else {
|
||||
return syscall(SYS___pthread_fchdir, -1);
|
||||
}
|
||||
+ #endif
|
||||
}
|
||||
|
||||
struct GetAppOutputOptions {
|
||||
@@ -230,11 +240,13 @@ Process LaunchProcess(const std::vector<std::string>& argv,
|
||||
file_actions.Inherit(STDERR_FILENO);
|
||||
}
|
||||
|
||||
+#if 0
|
||||
if (options.disclaim_responsibility) {
|
||||
if (__builtin_available(macOS 10.14, *)) {
|
||||
DPSXCHECK(responsibility_spawnattrs_setdisclaim(attr.get(), 1));
|
||||
}
|
||||
}
|
||||
+#endif
|
||||
|
||||
std::vector<char*> argv_cstr;
|
||||
argv_cstr.reserve(argv.size() + 1);
|
||||
diff --git a/media/audio/mac/audio_low_latency_input_mac.cc b/media/audio/mac/audio_low_latency_input_mac.cc
|
||||
index 0e842caf7b6487d94978c7b68fb5b222e330581f..5eafcd163ee1a05203a5eb76592a449f5a84e71f 100644
|
||||
--- a/media/audio/mac/audio_low_latency_input_mac.cc
|
||||
+++ b/media/audio/mac/audio_low_latency_input_mac.cc
|
||||
@@ -34,19 +34,23 @@
|
||||
|
||||
namespace {
|
||||
extern "C" {
|
||||
+#ifndef MAS_BUILD
|
||||
// See:
|
||||
// https://trac.webkit.org/browser/webkit/trunk/Source/WebCore/PAL/pal/spi/cf/CoreAudioSPI.h?rev=228264
|
||||
OSStatus AudioDeviceDuck(AudioDeviceID inDevice,
|
||||
Float32 inDuckedLevel,
|
||||
const AudioTimeStamp* __nullable inStartTime,
|
||||
Float32 inRampDuration) __attribute__((weak_import));
|
||||
+#endif
|
||||
}
|
||||
|
||||
void UndoDucking(AudioDeviceID output_device_id) {
|
||||
+#ifndef MAS_BUILD
|
||||
if (AudioDeviceDuck != nullptr) {
|
||||
// Ramp the volume back up over half a second.
|
||||
AudioDeviceDuck(output_device_id, 1.0, nullptr, 0.5);
|
||||
}
|
||||
+#endif
|
||||
}
|
||||
|
||||
} // namespace
|
||||
diff --git a/sandbox/mac/sandbox_logging.cc b/sandbox/mac/sandbox_logging.cc
|
||||
index 702224dce1871c07b07f6882e46d14fe532d6ed2..797cb6646171486797a5e5fbbb1b187e3a9f81d4 100644
|
||||
--- a/sandbox/mac/sandbox_logging.cc
|
||||
+++ b/sandbox/mac/sandbox_logging.cc
|
||||
@@ -32,9 +32,11 @@
|
||||
}
|
||||
#endif
|
||||
|
||||
+#if !defined(MAS_BUILD)
|
||||
extern "C" {
|
||||
void abort_report_np(const char*, ...);
|
||||
}
|
||||
+#endif
|
||||
|
||||
namespace sandbox {
|
||||
|
||||
@@ -104,9 +106,11 @@ void SendAslLog(Level level, const char* message) {
|
||||
asl_set(asl_message.get(), ASL_KEY_MSG, message);
|
||||
asl_send(asl_client.get(), asl_message.get());
|
||||
|
||||
+#if !defined(MAS_BUILD)
|
||||
if (level == Level::FATAL) {
|
||||
abort_report_np(message);
|
||||
}
|
||||
+#endif
|
||||
}
|
||||
|
||||
// |error| is strerror(errno) when a P* logging function is called. Pass
|
||||
diff --git a/sandbox/mac/system_services.cc b/sandbox/mac/system_services.cc
|
||||
index 9f5261425162791668c2d15b7ffba091f831d652..c37f3dc05cb8372c7a6c4caef7a280b6f2f48e98 100644
|
||||
--- a/sandbox/mac/system_services.cc
|
||||
+++ b/sandbox/mac/system_services.cc
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include "base/mac/mac_logging.h"
|
||||
|
||||
+#if !defined(MAS_BUILD)
|
||||
extern "C" {
|
||||
OSStatus SetApplicationIsDaemon(Boolean isDaemon);
|
||||
void _LSSetApplicationLaunchServicesServerConnectionStatus(
|
||||
@@ -19,10 +20,12 @@ void _LSSetApplicationLaunchServicesServerConnectionStatus(
|
||||
// https://github.com/WebKit/webkit/commit/8da694b0b3febcc262653d01a45e946ce91845ed.
|
||||
void _CSCheckFixDisable() API_AVAILABLE(macosx(10.15));
|
||||
} // extern "C"
|
||||
+#endif
|
||||
|
||||
namespace sandbox {
|
||||
|
||||
void DisableLaunchServices() {
|
||||
+ #if !defined(MAS_BUILD)
|
||||
// Allow the process to continue without a LaunchServices ASN. The
|
||||
// INIT_Process function in HIServices will abort if it cannot connect to
|
||||
// launchservicesd to get an ASN. By setting this flag, HIServices skips
|
||||
@@ -36,12 +39,15 @@ void DisableLaunchServices() {
|
||||
0, ^bool(CFDictionaryRef options) {
|
||||
return false;
|
||||
});
|
||||
+ #endif
|
||||
}
|
||||
|
||||
void DisableCoreServicesCheckFix() {
|
||||
+#if !defined(MAS_BUILD)
|
||||
if (__builtin_available(macOS 10.15, *)) {
|
||||
_CSCheckFixDisable();
|
||||
}
|
||||
+#endif
|
||||
}
|
||||
|
||||
} // namespace sandbox
|
||||
@@ -1,66 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Samuel Attard <sattard@slack-corp.com>
|
||||
Date: Mon, 4 Mar 2019 14:46:48 -0800
|
||||
Subject: mas: avoid usage of pthread_fchdir_np
|
||||
|
||||
Disable usage of pthread_fchdir_np and pthread_chdir_np in MAS builds.
|
||||
|
||||
diff --git a/base/process/launch_mac.cc b/base/process/launch_mac.cc
|
||||
index 184cfa25dbc6cfa2a32be3f8d964ea359254f807..c9bfc4d8ca1408206244305d7634dcd51e99377c 100644
|
||||
--- a/base/process/launch_mac.cc
|
||||
+++ b/base/process/launch_mac.cc
|
||||
@@ -26,8 +26,10 @@ extern "C" {
|
||||
// descriptor. libpthread only exposes a syscall wrapper starting in
|
||||
// macOS 10.12, but the system call dates back to macOS 10.5. On older OSes,
|
||||
// the syscall is issued directly.
|
||||
+#if !defined(MAS_BUILD)
|
||||
int pthread_chdir_np(const char* dir) API_AVAILABLE(macosx(10.12));
|
||||
int pthread_fchdir_np(int fd) API_AVAILABLE(macosx(10.12));
|
||||
+#endif
|
||||
|
||||
int responsibility_spawnattrs_setdisclaim(posix_spawnattr_t attrs, int disclaim)
|
||||
API_AVAILABLE(macosx(10.14));
|
||||
@@ -96,21 +98,29 @@ class PosixSpawnFileActions {
|
||||
};
|
||||
|
||||
int ChangeCurrentThreadDirectory(const char* path) {
|
||||
+ #if defined(MAS_BUILD)
|
||||
+ return syscall(SYS___pthread_chdir, path);
|
||||
+ #else
|
||||
if (__builtin_available(macOS 10.12, *)) {
|
||||
return pthread_chdir_np(path);
|
||||
} else {
|
||||
return syscall(SYS___pthread_chdir, path);
|
||||
}
|
||||
+ #endif
|
||||
}
|
||||
|
||||
// The recommended way to unset a per-thread cwd is to set a new value to an
|
||||
// invalid file descriptor, per libpthread-218.1.3/private/private.h.
|
||||
int ResetCurrentThreadDirectory() {
|
||||
+ #if defined(MAS_BUILD)
|
||||
+ return syscall(SYS___pthread_fchdir, -1);
|
||||
+ #else
|
||||
if (__builtin_available(macOS 10.12, *)) {
|
||||
return pthread_fchdir_np(-1);
|
||||
} else {
|
||||
return syscall(SYS___pthread_fchdir, -1);
|
||||
}
|
||||
+ #endif
|
||||
}
|
||||
|
||||
struct GetAppOutputOptions {
|
||||
@@ -230,11 +240,13 @@ Process LaunchProcess(const std::vector<std::string>& argv,
|
||||
file_actions.Inherit(STDERR_FILENO);
|
||||
}
|
||||
|
||||
+#if 0
|
||||
if (options.disclaim_responsibility) {
|
||||
if (__builtin_available(macOS 10.14, *)) {
|
||||
DPSXCHECK(responsibility_spawnattrs_setdisclaim(attr.get(), 1));
|
||||
}
|
||||
}
|
||||
+#endif
|
||||
|
||||
std::vector<char*> argv_cstr;
|
||||
argv_cstr.reserve(argv.size() + 1);
|
||||
@@ -1,50 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Samuel Attard <sattard@slack-corp.com>
|
||||
Date: Mon, 4 Mar 2019 14:51:45 -0800
|
||||
Subject: mas: avoid usage of SetApplicationIsDaemon and
|
||||
_LSSetApplicationLaunchServicesServerConnectionStatus
|
||||
|
||||
Disable usage of SetApplicationIsDaemon and
|
||||
_LSSetApplicationLaunchServicesServerConnectionStatus in MAS builds
|
||||
|
||||
diff --git a/sandbox/mac/system_services.cc b/sandbox/mac/system_services.cc
|
||||
index 9f5261425162791668c2d15b7ffba091f831d652..c37f3dc05cb8372c7a6c4caef7a280b6f2f48e98 100644
|
||||
--- a/sandbox/mac/system_services.cc
|
||||
+++ b/sandbox/mac/system_services.cc
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include "base/mac/mac_logging.h"
|
||||
|
||||
+#if !defined(MAS_BUILD)
|
||||
extern "C" {
|
||||
OSStatus SetApplicationIsDaemon(Boolean isDaemon);
|
||||
void _LSSetApplicationLaunchServicesServerConnectionStatus(
|
||||
@@ -19,10 +20,12 @@ void _LSSetApplicationLaunchServicesServerConnectionStatus(
|
||||
// https://github.com/WebKit/webkit/commit/8da694b0b3febcc262653d01a45e946ce91845ed.
|
||||
void _CSCheckFixDisable() API_AVAILABLE(macosx(10.15));
|
||||
} // extern "C"
|
||||
+#endif
|
||||
|
||||
namespace sandbox {
|
||||
|
||||
void DisableLaunchServices() {
|
||||
+ #if !defined(MAS_BUILD)
|
||||
// Allow the process to continue without a LaunchServices ASN. The
|
||||
// INIT_Process function in HIServices will abort if it cannot connect to
|
||||
// launchservicesd to get an ASN. By setting this flag, HIServices skips
|
||||
@@ -36,12 +39,15 @@ void DisableLaunchServices() {
|
||||
0, ^bool(CFDictionaryRef options) {
|
||||
return false;
|
||||
});
|
||||
+ #endif
|
||||
}
|
||||
|
||||
void DisableCoreServicesCheckFix() {
|
||||
+#if !defined(MAS_BUILD)
|
||||
if (__builtin_available(macOS 10.15, *)) {
|
||||
_CSCheckFixDisable();
|
||||
}
|
||||
+#endif
|
||||
}
|
||||
|
||||
} // namespace sandbox
|
||||
@@ -167,7 +167,7 @@ index 961c759eca96ffc0ffcf40cfdaf42388f47d9c2b..18c77a5520ea2ae7cfee4eea3ed01fa8
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
diff --git a/ui/base/BUILD.gn b/ui/base/BUILD.gn
|
||||
index 028a97becd88fb12481b1de0395c7c81857d3af3..4491be85cb82f050cc70c24e933e841a08b9123f 100644
|
||||
index 244b208e6a7872ea4d25fcf74a78abc9248a9ac3..45bafcaaa10641ca3a8306a6685ee9ed730d1e02 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 c93aedbce83c398a55c478df60d5ba6dd5324a0b..dfa1983e5605d14e44efae3c1418b4e53c392333 100644
|
||||
index d4051a7a8755c7b10d4df3746cb2857471f07c45..de04616893d1c97e3607eb5a4b942733ae597b05 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 c93aedbce83c398a55c478df60d5ba6dd5324a0b..dfa1983e5605d14e44efae3c1418b4e5
|
||||
@class NSView;
|
||||
|
||||
namespace remote_cocoa {
|
||||
@@ -452,11 +454,13 @@ class VIEWS_EXPORT NativeWidgetMacNSWindowHost
|
||||
@@ -449,11 +451,13 @@ class VIEWS_EXPORT NativeWidgetMacNSWindowHost
|
||||
mojo::AssociatedRemote<remote_cocoa::mojom::NativeWidgetNSWindow>
|
||||
remote_ns_window_remote_;
|
||||
|
||||
@@ -233,10 +233,10 @@ index c93aedbce83c398a55c478df60d5ba6dd5324a0b..dfa1983e5605d14e44efae3c1418b4e5
|
||||
// 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 1c4c4a774e4d5e199ae50e8df4499a497d3b0674..b2265079021d10e2944b9474fafe32ccca95d3de 100644
|
||||
index c9294c5358401da716b6d8d2846e20e9a04f4e2d..c9a3cdee33e3aa8bfbfa9c6678c2828a94b90061 100644
|
||||
--- a/ui/views/cocoa/native_widget_mac_ns_window_host.mm
|
||||
+++ b/ui/views/cocoa/native_widget_mac_ns_window_host.mm
|
||||
@@ -296,14 +296,22 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
|
||||
@@ -297,14 +297,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 1c4c4a774e4d5e199ae50e8df4499a497d3b0674..b2265079021d10e2944b9474fafe32cc
|
||||
}
|
||||
|
||||
remote_cocoa::mojom::NativeWidgetNSWindow*
|
||||
@@ -1287,6 +1295,7 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
|
||||
@@ -1288,6 +1296,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 1c4c4a774e4d5e199ae50e8df4499a497d3b0674..b2265079021d10e2944b9474fafe32cc
|
||||
remote_window_accessible_ =
|
||||
ui::RemoteAccessibility::GetRemoteElementFromToken(window_token);
|
||||
remote_view_accessible_ =
|
||||
@@ -1294,14 +1303,17 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
|
||||
@@ -1295,14 +1304,17 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
|
||||
[remote_view_accessible_ setWindowUIElement:remote_window_accessible_.get()];
|
||||
[remote_view_accessible_
|
||||
setTopLevelUIElement:remote_window_accessible_.get()];
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: VerteDinde <khammond@slack-corp.com>
|
||||
Date: Tue, 19 Oct 2021 16:56:25 -0700
|
||||
Subject: fix: mas gate private enterprise APIs
|
||||
|
||||
Beginning in Electron 15.2.0, Chromium moved several formerly public
|
||||
APIs into the AreDeviceAndUserJoinedToDomain method. Using these APIs
|
||||
in a MAS build will result in rejection from the Apple Store. This
|
||||
patch gates those APIs to non-MAS builds to comply with Apple
|
||||
Store requirements, and returns the default state for MAS builds.
|
||||
|
||||
diff --git a/base/enterprise_util_mac.mm b/base/enterprise_util_mac.mm
|
||||
index bbb851e1cafb37ebaa67e4577598fab25c90fde6..6ab12e5505b5ba545e7e0cc8c93d3ba9a6d0bacc 100644
|
||||
--- a/base/enterprise_util_mac.mm
|
||||
+++ b/base/enterprise_util_mac.mm
|
||||
@@ -168,6 +168,13 @@ MacDeviceManagementStateNew IsDeviceRegisteredWithManagementNew() {
|
||||
DeviceUserDomainJoinState AreDeviceAndUserJoinedToDomain() {
|
||||
static DeviceUserDomainJoinState state = [] {
|
||||
DeviceUserDomainJoinState state{false, false};
|
||||
+#if defined(MAS_BUILD)
|
||||
+ return state;
|
||||
+ }();
|
||||
+
|
||||
+ return state;
|
||||
+}
|
||||
+#else
|
||||
|
||||
@autoreleasepool {
|
||||
ODSession* session = [ODSession defaultSession];
|
||||
@@ -274,5 +281,6 @@ DeviceUserDomainJoinState AreDeviceAndUserJoinedToDomain() {
|
||||
|
||||
return state;
|
||||
}
|
||||
+#endif
|
||||
|
||||
} // namespace base
|
||||
@@ -122,7 +122,7 @@ index c15f3a631292b538698625328fb429ee3c9964f5..37e038753ecf1b82ec92c06b2c0729b5
|
||||
}
|
||||
|
||||
diff --git a/device/bluetooth/bluetooth_adapter_mac.mm b/device/bluetooth/bluetooth_adapter_mac.mm
|
||||
index d342eb4e9fc94de4365d86c2d1af4b85a8bf63a3..012f9ce97d9ed6b00deb718a88f432e053cb3bd1 100644
|
||||
index 3f7dce0281f7b5a540d7b9377ef14a8a6aa9a2fa..11d8419791f3e45d5242081422d452d4fc703833 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 ecc38d1584570c46826084054f0a3249f9e2eb92..f06a04983571623b542dba11933c4c95c3dcf398 100644
|
||||
index e9a56db142f5f31e567bff7414db110f600fc7f2..98268925da14d61256f8dee3aa899f17ce7acaf6 100644
|
||||
--- a/services/network/network_context.cc
|
||||
+++ b/services/network/network_context.cc
|
||||
@@ -128,6 +128,11 @@
|
||||
@@ -127,6 +127,11 @@
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
#include "url/gurl.h"
|
||||
|
||||
@@ -22,7 +22,7 @@ index ecc38d1584570c46826084054f0a3249f9e2eb92..f06a04983571623b542dba11933c4c95
|
||||
#if BUILDFLAG(IS_CT_SUPPORTED)
|
||||
#include "components/certificate_transparency/chrome_ct_policy_enforcer.h"
|
||||
#include "components/certificate_transparency/chrome_require_ct_delegate.h"
|
||||
@@ -436,6 +441,91 @@ bool GetFullDataFilePath(
|
||||
@@ -435,6 +440,91 @@ bool GetFullDataFilePath(
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -114,7 +114,7 @@ index ecc38d1584570c46826084054f0a3249f9e2eb92..f06a04983571623b542dba11933c4c95
|
||||
constexpr uint32_t NetworkContext::kMaxOutstandingRequestsPerProcess;
|
||||
|
||||
NetworkContext::PendingCertVerify::PendingCertVerify() = default;
|
||||
@@ -733,6 +823,13 @@ void NetworkContext::SetClient(
|
||||
@@ -732,6 +822,13 @@ void NetworkContext::SetClient(
|
||||
client_.Bind(std::move(client));
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ index ecc38d1584570c46826084054f0a3249f9e2eb92..f06a04983571623b542dba11933c4c95
|
||||
void NetworkContext::CreateURLLoaderFactory(
|
||||
mojo::PendingReceiver<mojom::URLLoaderFactory> receiver,
|
||||
mojom::URLLoaderFactoryParamsPtr params) {
|
||||
@@ -2301,6 +2398,9 @@ URLRequestContextOwner NetworkContext::MakeURLRequestContext(
|
||||
@@ -2298,6 +2395,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 ecc38d1584570c46826084054f0a3249f9e2eb92..f06a04983571623b542dba11933c4c95
|
||||
|
||||
builder.SetCertVerifier(IgnoreErrorsCertVerifier::MaybeWrapCertVerifier(
|
||||
diff --git a/services/network/network_context.h b/services/network/network_context.h
|
||||
index 994712b56fb25fbfa7559ac034cfd7e1c76597de..2cd8707b120deb41683e13def5d446fd3bf93afe 100644
|
||||
index 53e3f293150e725cd1261f09a8f9bfcb5371a76c..58671094857cdfe5d853c8a284d51bc1b8a09660 100644
|
||||
--- a/services/network/network_context.h
|
||||
+++ b/services/network/network_context.h
|
||||
@@ -109,6 +109,7 @@ class URLMatcher;
|
||||
@@ -108,6 +108,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 b74b4c2028ccb22349253960b9aa6c5bfe87579c..396377fd4041cced3c68f8d57c8f868098bb8923 100644
|
||||
index b769a06dc9443317a1073738c6fd38816ebeb186..20a697be32f7e27a9fa33d0225c94520aa5ebf2e 100644
|
||||
--- a/content/browser/renderer_host/render_process_host_impl.cc
|
||||
+++ b/content/browser/renderer_host/render_process_host_impl.cc
|
||||
@@ -2088,7 +2088,8 @@ void RenderProcessHostImpl::CreateNotificationService(
|
||||
@@ -2083,7 +2083,8 @@ void RenderProcessHostImpl::CreateNotificationService(
|
||||
document_url = rfh->GetLastCommittedURL();
|
||||
|
||||
storage_partition_impl_->GetPlatformNotificationContext()->CreateService(
|
||||
|
||||
@@ -8,50 +8,11 @@ chrome's generated resources for our own. This updates the #include so that we
|
||||
don't get errors for Chrome's generated resources, which are non-existent
|
||||
because we don't generate them in our build.
|
||||
|
||||
diff --git a/chrome/browser/ui/views/overlay/back_to_tab_image_button.cc b/chrome/browser/ui/views/overlay/back_to_tab_image_button.cc
|
||||
index 7bc8d118f87b91baf1c3bd1d34374996ab1d3638..2d2c1c86f311b07f0c2b09d5a4c082cc5599600c 100644
|
||||
--- a/chrome/browser/ui/views/overlay/back_to_tab_image_button.cc
|
||||
+++ b/chrome/browser/ui/views/overlay/back_to_tab_image_button.cc
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "chrome/browser/ui/views/overlay/back_to_tab_image_button.h"
|
||||
|
||||
#include "chrome/browser/ui/color/chrome_color_id.h"
|
||||
-#include "chrome/grit/generated_resources.h"
|
||||
+#include "electron/grit/electron_resources.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "ui/base/metadata/metadata_impl_macros.h"
|
||||
#include "ui/base/models/image_model.h"
|
||||
diff --git a/chrome/browser/ui/views/overlay/back_to_tab_label_button.cc b/chrome/browser/ui/views/overlay/back_to_tab_label_button.cc
|
||||
index d566dbf99ea1164c6a8407026a9839218a6ba1fb..239cd53d70c547c79214988a82efdc8c472d553c 100644
|
||||
--- a/chrome/browser/ui/views/overlay/back_to_tab_label_button.cc
|
||||
+++ b/chrome/browser/ui/views/overlay/back_to_tab_label_button.cc
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "chrome/browser/ui/views/overlay/back_to_tab_label_button.h"
|
||||
|
||||
#include "chrome/browser/ui/color/chrome_color_id.h"
|
||||
-#include "chrome/grit/generated_resources.h"
|
||||
+#include "electron/grit/electron_resources.h"
|
||||
#include "third_party/skia/include/core/SkColor.h"
|
||||
#include "ui/base/cursor/cursor.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
diff --git a/chrome/browser/ui/views/overlay/close_image_button.cc b/chrome/browser/ui/views/overlay/close_image_button.cc
|
||||
index a3d9c0f03c8ade2553bad5721d4e15e6fd658074..b3b043cbf9144013bf7903121575b31b348ea87e 100644
|
||||
--- a/chrome/browser/ui/views/overlay/close_image_button.cc
|
||||
+++ b/chrome/browser/ui/views/overlay/close_image_button.cc
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include "build/chromeos_buildflags.h"
|
||||
#include "chrome/browser/ui/color/chrome_color_id.h"
|
||||
-#include "chrome/grit/generated_resources.h"
|
||||
+#include "electron/grit/electron_resources.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "ui/base/metadata/metadata_impl_macros.h"
|
||||
#include "ui/base/models/image_model.h"
|
||||
diff --git a/chrome/browser/ui/views/overlay/document_overlay_window_views.cc b/chrome/browser/ui/views/overlay/document_overlay_window_views.cc
|
||||
index 3309906bcae27ba89d73ce4fba49843a10cd31f6..9f828f70606238186b35b5e1ca8751134eaf3c33 100644
|
||||
index 3309906bcae27ba89d73ce4fba49843a10cd31f6..987917a440480130d35f34f85c27ff7c27632fd9 100644
|
||||
--- a/chrome/browser/ui/views/overlay/document_overlay_window_views.cc
|
||||
+++ b/chrome/browser/ui/views/overlay/document_overlay_window_views.cc
|
||||
@@ -15,24 +15,28 @@
|
||||
@@ -15,15 +15,19 @@
|
||||
#include "base/timer/timer.h"
|
||||
#include "build/build_config.h"
|
||||
#include "chrome/app/vector_icons/vector_icons.h"
|
||||
@@ -71,16 +32,6 @@ index 3309906bcae27ba89d73ce4fba49843a10cd31f6..9f828f70606238186b35b5e1ca875113
|
||||
#include "chrome/browser/ui/views/overlay/back_to_tab_image_button.h"
|
||||
#include "chrome/browser/ui/views/overlay/close_image_button.h"
|
||||
#include "chrome/browser/ui/views/overlay/resize_handle_button.h"
|
||||
-#include "chrome/grit/generated_resources.h"
|
||||
#include "components/omnibox/browser/location_bar_model_impl.h"
|
||||
#include "components/vector_icons/vector_icons.h"
|
||||
#include "content/public/browser/document_picture_in_picture_window_controller.h"
|
||||
#include "content/public/browser/picture_in_picture_window_controller.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
+#include "electron/grit/electron_resources.h"
|
||||
#include "content/public/common/content_constants.h"
|
||||
#include "media/base/media_switches.h"
|
||||
#include "media/base/video_util.h"
|
||||
@@ -57,7 +61,7 @@
|
||||
#include "ui/aura/window.h"
|
||||
#endif
|
||||
@@ -161,24 +112,11 @@ index b2b178ccadce82f8d4ec8e5a6dafe1c67bcecd74..603d82a461c4c443ac26c85a46fbd866
|
||||
|
||||
// OverlayWindowViews
|
||||
bool ControlsHitTestContainsPoint(const gfx::Point& point) override;
|
||||
diff --git a/chrome/browser/ui/views/overlay/hang_up_button.cc b/chrome/browser/ui/views/overlay/hang_up_button.cc
|
||||
index 75bfe0f7a4d759f677cad5c365fa7f98121d54de..cb251381f1c77ad01d4906132f3d68865aaace10 100644
|
||||
--- a/chrome/browser/ui/views/overlay/hang_up_button.cc
|
||||
+++ b/chrome/browser/ui/views/overlay/hang_up_button.cc
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include "chrome/browser/ui/color/chrome_color_id.h"
|
||||
#include "chrome/browser/ui/views/overlay/constants.h"
|
||||
-#include "chrome/grit/generated_resources.h"
|
||||
+#include "electron/grit/electron_resources.h"
|
||||
#include "components/vector_icons/vector_icons.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "ui/base/metadata/metadata_impl_macros.h"
|
||||
diff --git a/chrome/browser/ui/views/overlay/overlay_window_views.cc b/chrome/browser/ui/views/overlay/overlay_window_views.cc
|
||||
index 850b34e3b40f7ff1848c66158976db079e0853bd..105dbc3661eb2710b2f10ca6584e85c36ad14705 100644
|
||||
index 850b34e3b40f7ff1848c66158976db079e0853bd..74178fd4752e9c469d50ccafda61157acd9edd56 100644
|
||||
--- a/chrome/browser/ui/views/overlay/overlay_window_views.cc
|
||||
+++ b/chrome/browser/ui/views/overlay/overlay_window_views.cc
|
||||
@@ -14,13 +14,15 @@
|
||||
@@ -14,9 +14,11 @@
|
||||
#include "base/time/time.h"
|
||||
#include "base/timer/timer.h"
|
||||
#include "build/build_config.h"
|
||||
@@ -186,15 +124,10 @@ index 850b34e3b40f7ff1848c66158976db079e0853bd..105dbc3661eb2710b2f10ca6584e85c3
|
||||
#include "chrome/browser/profiles/profile.h"
|
||||
#include "chrome/browser/ui/browser.h"
|
||||
#include "chrome/browser/ui/browser_finder.h"
|
||||
-#include "chrome/grit/generated_resources.h"
|
||||
+#endif
|
||||
#include "chrome/grit/generated_resources.h"
|
||||
#include "components/vector_icons/vector_icons.h"
|
||||
#include "content/public/browser/picture_in_picture_window_controller.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
+#include "electron/grit/electron_resources.h"
|
||||
#include "ui/base/hit_test.h"
|
||||
#include "ui/display/display.h"
|
||||
#include "ui/display/screen.h"
|
||||
@@ -36,7 +38,7 @@
|
||||
#include "ui/aura/window.h"
|
||||
#endif
|
||||
@@ -204,86 +137,8 @@ index 850b34e3b40f7ff1848c66158976db079e0853bd..105dbc3661eb2710b2f10ca6584e85c3
|
||||
#include "chrome/browser/shell_integration_win.h"
|
||||
#include "ui/aura/window.h"
|
||||
#include "ui/aura/window_tree_host.h"
|
||||
diff --git a/chrome/browser/ui/views/overlay/playback_image_button.cc b/chrome/browser/ui/views/overlay/playback_image_button.cc
|
||||
index cb1621a9deefcec601d7537e2cc2fbd24e5f7f64..2d74ab12e1eaf77a6f9dde13e894172d6835e061 100644
|
||||
--- a/chrome/browser/ui/views/overlay/playback_image_button.cc
|
||||
+++ b/chrome/browser/ui/views/overlay/playback_image_button.cc
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "chrome/app/vector_icons/vector_icons.h"
|
||||
#include "chrome/browser/ui/color/chrome_color_id.h"
|
||||
#include "chrome/browser/ui/views/overlay/constants.h"
|
||||
-#include "chrome/grit/generated_resources.h"
|
||||
+#include "electron/grit/electron_resources.h"
|
||||
#include "components/vector_icons/vector_icons.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "ui/base/metadata/metadata_impl_macros.h"
|
||||
diff --git a/chrome/browser/ui/views/overlay/resize_handle_button.cc b/chrome/browser/ui/views/overlay/resize_handle_button.cc
|
||||
index 8bf217b9b0c2bd22d6940c24c58eccb9865c5286..91f061a1243135db475371dda00c2fe054f4e8e3 100644
|
||||
--- a/chrome/browser/ui/views/overlay/resize_handle_button.cc
|
||||
+++ b/chrome/browser/ui/views/overlay/resize_handle_button.cc
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include "chrome/app/vector_icons/vector_icons.h"
|
||||
#include "chrome/browser/ui/color/chrome_color_id.h"
|
||||
-#include "chrome/grit/generated_resources.h"
|
||||
+#include "electron/grit/electron_resources.h"
|
||||
#include "ui/base/hit_test.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "ui/base/metadata/metadata_impl_macros.h"
|
||||
diff --git a/chrome/browser/ui/views/overlay/skip_ad_label_button.cc b/chrome/browser/ui/views/overlay/skip_ad_label_button.cc
|
||||
index 51c7db1bfbd3c03b9cb2786c8c7482b33e3aca0b..2890f7420d2fd258f84019963eab6c9606e228db 100644
|
||||
--- a/chrome/browser/ui/views/overlay/skip_ad_label_button.cc
|
||||
+++ b/chrome/browser/ui/views/overlay/skip_ad_label_button.cc
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "chrome/browser/ui/views/overlay/skip_ad_label_button.h"
|
||||
|
||||
#include "chrome/browser/ui/color/chrome_color_id.h"
|
||||
-#include "chrome/grit/generated_resources.h"
|
||||
+#include "electron/grit/electron_resources.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "ui/base/metadata/metadata_impl_macros.h"
|
||||
#include "ui/gfx/color_palette.h"
|
||||
diff --git a/chrome/browser/ui/views/overlay/toggle_camera_button.cc b/chrome/browser/ui/views/overlay/toggle_camera_button.cc
|
||||
index 20b82ff4dcf7fef3315b2b47bb480446509c6541..244a50e57b6c12680405c92f0ecbdbdb8bcfcb4f 100644
|
||||
--- a/chrome/browser/ui/views/overlay/toggle_camera_button.cc
|
||||
+++ b/chrome/browser/ui/views/overlay/toggle_camera_button.cc
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include "chrome/browser/ui/color/chrome_color_id.h"
|
||||
#include "chrome/browser/ui/views/overlay/constants.h"
|
||||
-#include "chrome/grit/generated_resources.h"
|
||||
+#include "electron/grit/electron_resources.h"
|
||||
#include "components/vector_icons/vector_icons.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "ui/base/metadata/metadata_impl_macros.h"
|
||||
diff --git a/chrome/browser/ui/views/overlay/toggle_microphone_button.cc b/chrome/browser/ui/views/overlay/toggle_microphone_button.cc
|
||||
index 1a1edb6321490fdbf5cd347cb3d2cb9a6a5b1080..1e959cf1c8fe356ab4427e4bf4f8da1028f4575f 100644
|
||||
--- a/chrome/browser/ui/views/overlay/toggle_microphone_button.cc
|
||||
+++ b/chrome/browser/ui/views/overlay/toggle_microphone_button.cc
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include "chrome/browser/ui/color/chrome_color_id.h"
|
||||
#include "chrome/browser/ui/views/overlay/constants.h"
|
||||
-#include "chrome/grit/generated_resources.h"
|
||||
+#include "electron/grit/electron_resources.h"
|
||||
#include "components/vector_icons/vector_icons.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "ui/base/metadata/metadata_impl_macros.h"
|
||||
diff --git a/chrome/browser/ui/views/overlay/track_image_button.cc b/chrome/browser/ui/views/overlay/track_image_button.cc
|
||||
index 5e136488b37887e9523ac04a9ff4ccdfaf96c104..24899f4c2b6fe66b96a6728bf747f1aad66f20a9 100644
|
||||
--- a/chrome/browser/ui/views/overlay/track_image_button.cc
|
||||
+++ b/chrome/browser/ui/views/overlay/track_image_button.cc
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include "chrome/app/vector_icons/vector_icons.h"
|
||||
#include "chrome/browser/ui/color/chrome_color_id.h"
|
||||
-#include "chrome/grit/generated_resources.h"
|
||||
+#include "electron/grit/electron_resources.h"
|
||||
#include "components/vector_icons/vector_icons.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "ui/base/metadata/metadata_impl_macros.h"
|
||||
diff --git a/chrome/browser/ui/views/overlay/video_overlay_window_views.cc b/chrome/browser/ui/views/overlay/video_overlay_window_views.cc
|
||||
index c24fdd1360e582293a8b21b2f29dc6bc02b564c9..24bb07ae2efaad2e7f5957a73585885168349109 100644
|
||||
index c24fdd1360e582293a8b21b2f29dc6bc02b564c9..b9b2b4aa7d168cd7a83c36edbe4f7dc30565c921 100644
|
||||
--- a/chrome/browser/ui/views/overlay/video_overlay_window_views.cc
|
||||
+++ b/chrome/browser/ui/views/overlay/video_overlay_window_views.cc
|
||||
@@ -15,9 +15,11 @@
|
||||
@@ -298,18 +153,6 @@ index c24fdd1360e582293a8b21b2f29dc6bc02b564c9..24bb07ae2efaad2e7f5957a735858851
|
||||
#include "chrome/browser/ui/color/chrome_color_id.h"
|
||||
#include "chrome/browser/ui/views/overlay/back_to_tab_image_button.h"
|
||||
#include "chrome/browser/ui/views/overlay/back_to_tab_label_button.h"
|
||||
@@ -29,10 +31,10 @@
|
||||
#include "chrome/browser/ui/views/overlay/toggle_camera_button.h"
|
||||
#include "chrome/browser/ui/views/overlay/toggle_microphone_button.h"
|
||||
#include "chrome/browser/ui/views/overlay/track_image_button.h"
|
||||
-#include "chrome/grit/generated_resources.h"
|
||||
#include "components/vector_icons/vector_icons.h"
|
||||
#include "content/public/browser/video_picture_in_picture_window_controller.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
+#include "electron/grit/electron_resources.h"
|
||||
#include "media/base/media_switches.h"
|
||||
#include "media/base/video_util.h"
|
||||
#include "third_party/skia/include/core/SkColor.h"
|
||||
@@ -56,7 +58,7 @@
|
||||
#include "ui/aura/window.h"
|
||||
#endif
|
||||
|
||||
@@ -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 13c1a8c9760fa0f286c6c5adc8f74fdae910ab50..b7a967642ff059c97f55002a9a0962709d806959 100644
|
||||
index d1a9c517a69bcc79a4b42f8eb8b6fcc3cea2f4da..04569140589c25d37bad2cd5ff979cfc6b1f3f43 100644
|
||||
--- a/ui/color/color_id.h
|
||||
+++ b/ui/color/color_id.h
|
||||
@@ -128,6 +128,16 @@
|
||||
@@ -125,6 +125,16 @@
|
||||
E_CPONLY(kColorOverlayScrollbarStrokeHoveredDark) \
|
||||
E_CPONLY(kColorOverlayScrollbarStrokeHoveredLight) \
|
||||
E_CPONLY(kColorProgressBar) \
|
||||
@@ -28,7 +28,7 @@ index 13c1a8c9760fa0f286c6c5adc8f74fdae910ab50..b7a967642ff059c97f55002a9a096270
|
||||
E_CPONLY(kColorSeparator) \
|
||||
E_CPONLY(kColorShadowBase) \
|
||||
E_CPONLY(kColorShadowValueAmbientShadowElevationSixteen) \
|
||||
@@ -180,6 +190,7 @@
|
||||
@@ -177,6 +187,7 @@
|
||||
E_CPONLY(kColorTreeNodeForeground) \
|
||||
E_CPONLY(kColorTreeNodeForegroundSelectedFocused) \
|
||||
E_CPONLY(kColorTreeNodeForegroundSelectedUnfocused) \
|
||||
@@ -37,10 +37,10 @@ index 13c1a8c9760fa0f286c6c5adc8f74fdae910ab50..b7a967642ff059c97f55002a9a096270
|
||||
|
||||
#if BUILDFLAG(IS_CHROMEOS)
|
||||
diff --git a/ui/color/ui_color_mixer.cc b/ui/color/ui_color_mixer.cc
|
||||
index 3e44d34fe1317822c340ebbcc895d7d8b55bed0b..be1737a96058c29d03645cc00999b6d7fc315f48 100644
|
||||
index b404ef6063c3a6c542565de46458b7401f129963..ce6fca0516d91b8acfe5fe6bc89bc09ae03a17d6 100644
|
||||
--- a/ui/color/ui_color_mixer.cc
|
||||
+++ b/ui/color/ui_color_mixer.cc
|
||||
@@ -148,6 +148,17 @@ void AddUiColorMixer(ColorProvider* provider,
|
||||
@@ -143,6 +143,17 @@ void AddUiColorMixer(ColorProvider* provider,
|
||||
SetAlpha(GetColorWithMaxContrast(kColorOverlayScrollbarFillHoveredLight),
|
||||
gfx::kGoogleGreyAlpha500);
|
||||
mixer[kColorProgressBar] = {kColorAccent};
|
||||
@@ -58,7 +58,7 @@ index 3e44d34fe1317822c340ebbcc895d7d8b55bed0b..be1737a96058c29d03645cc00999b6d7
|
||||
mixer[kColorSeparator] = {kColorMidground};
|
||||
mixer[kColorShadowBase] = {dark_mode ? SK_ColorBLACK : gfx::kGoogleGrey800};
|
||||
mixer[kColorShadowValueAmbientShadowElevationThree] =
|
||||
@@ -223,6 +234,7 @@ void AddUiColorMixer(ColorProvider* provider,
|
||||
@@ -218,6 +229,7 @@ void AddUiColorMixer(ColorProvider* provider,
|
||||
mixer[kColorTreeNodeForegroundSelectedFocused] = {kColorTreeNodeForeground};
|
||||
mixer[kColorTreeNodeForegroundSelectedUnfocused] = {
|
||||
kColorTreeNodeForegroundSelectedFocused};
|
||||
|
||||
@@ -10,21 +10,8 @@ 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_backend_service_manager.cc b/chrome/browser/printing/print_backend_service_manager.cc
|
||||
index 27eb7cf1480e7a56ab6b7d010cdee65c72e62c10..76d265b8de17244ed9d3727f1bebe730a224cd56 100644
|
||||
--- a/chrome/browser/printing/print_backend_service_manager.cc
|
||||
+++ b/chrome/browser/printing/print_backend_service_manager.cc
|
||||
@@ -18,7 +18,7 @@
|
||||
#include "base/unguessable_token.h"
|
||||
#include "build/build_config.h"
|
||||
#include "chrome/browser/browser_process.h"
|
||||
-#include "chrome/grit/generated_resources.h"
|
||||
+#include "electron/grit/electron_resources.h"
|
||||
#include "chrome/services/printing/public/mojom/print_backend_service.mojom.h"
|
||||
#include "components/crash/core/common/crash_keys.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
diff --git a/chrome/browser/printing/print_job.cc b/chrome/browser/printing/print_job.cc
|
||||
index 6408cbee8b5a8e45c4276ed966b57c1e61ad1137..e951c41a1bd92a33e32f6835841d3935a05dde53 100644
|
||||
index 8d40bbf98d4d58704f118cb42039b0956a9f6639..06196c0fa02012a5faa82471bd39fac087918f54 100644
|
||||
--- a/chrome/browser/printing/print_job.cc
|
||||
+++ b/chrome/browser/printing/print_job.cc
|
||||
@@ -89,6 +89,7 @@ bool PrintWithReducedRasterization(PrefService* prefs) {
|
||||
@@ -43,7 +30,7 @@ index 6408cbee8b5a8e45c4276ed966b57c1e61ad1137..e951c41a1bd92a33e32f6835841d3935
|
||||
|
||||
#endif // BUILDFLAG(IS_WIN)
|
||||
|
||||
@@ -360,8 +362,10 @@ void PrintJob::StartPdfToEmfConversion(
|
||||
@@ -356,8 +358,10 @@ void PrintJob::StartPdfToEmfConversion(
|
||||
|
||||
const PrintSettings& settings = document()->settings();
|
||||
|
||||
@@ -55,7 +42,7 @@ index 6408cbee8b5a8e45c4276ed966b57c1e61ad1137..e951c41a1bd92a33e32f6835841d3935
|
||||
|
||||
using RenderMode = PdfRenderSettings::Mode;
|
||||
RenderMode mode = print_with_reduced_rasterization
|
||||
@@ -451,8 +455,10 @@ void PrintJob::StartPdfToPostScriptConversion(
|
||||
@@ -447,8 +451,10 @@ void PrintJob::StartPdfToPostScriptConversion(
|
||||
if (ps_level2) {
|
||||
mode = PdfRenderSettings::Mode::POSTSCRIPT_LEVEL2;
|
||||
} else {
|
||||
@@ -67,8 +54,22 @@ index 6408cbee8b5a8e45c4276ed966b57c1e61ad1137..e951c41a1bd92a33e32f6835841d3935
|
||||
? 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 86770178101d411bdf84617678c65a4a29ddbb5c..16e1fe8fc650fba441bcc7e467d58e0071dbc945 100644
|
||||
index f989f040cb9ff6df001225057202fb1653ade9fc..8a7dd2a4c4e9f5c778a8a35658cb55883ea5fae5 100644
|
||||
--- a/chrome/browser/printing/print_job_worker.cc
|
||||
+++ b/chrome/browser/printing/print_job_worker.cc
|
||||
@@ -20,7 +20,6 @@
|
||||
@@ -83,11 +84,11 @@ index 86770178101d411bdf84617678c65a4a29ddbb5c..16e1fe8fc650fba441bcc7e467d58e00
|
||||
#include "content/public/browser/global_routing_id.h"
|
||||
#include "content/public/browser/render_frame_host.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
+#include "electron/grit/electron_resources.h"
|
||||
+#include "chrome/grit/generated_resources.h"
|
||||
#include "printing/backend/print_backend.h"
|
||||
#include "printing/buildflags/buildflags.h"
|
||||
#include "printing/mojom/print.mojom.h"
|
||||
@@ -229,16 +229,21 @@ void PrintJobWorker::UpdatePrintSettings(base::Value::Dict new_settings,
|
||||
@@ -230,16 +230,21 @@ void PrintJobWorker::UpdatePrintSettings(base::Value new_settings,
|
||||
#endif // BUILDFLAG(IS_LINUX) && defined(USE_CUPS)
|
||||
}
|
||||
|
||||
@@ -113,10 +114,10 @@ index 86770178101d411bdf84617678c65a4a29ddbb5c..16e1fe8fc650fba441bcc7e467d58e00
|
||||
|
||||
#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 dd27bbf387718d6abda5080e7d2c609cd0eaff17..8837cf2aeaa2f87d51be8d00aa356c8a2c5e15c7 100644
|
||||
index 02dfcad0c6b208f7df4d2b10112739554f6ab75c..0774aa95ee1521b0e76fe72d8d9e8de4540f0ff1 100644
|
||||
--- a/chrome/browser/printing/print_job_worker_oop.cc
|
||||
+++ b/chrome/browser/printing/print_job_worker_oop.cc
|
||||
@@ -345,7 +345,7 @@ void PrintJobWorkerOop::OnFailure() {
|
||||
@@ -331,7 +331,7 @@ void PrintJobWorkerOop::OnFailure() {
|
||||
}
|
||||
|
||||
void PrintJobWorkerOop::ShowErrorDialog() {
|
||||
@@ -126,7 +127,7 @@ index dd27bbf387718d6abda5080e7d2c609cd0eaff17..8837cf2aeaa2f87d51be8d00aa356c8a
|
||||
|
||||
void PrintJobWorkerOop::UnregisterServiceManagerClient() {
|
||||
diff --git a/chrome/browser/printing/print_view_manager_base.cc b/chrome/browser/printing/print_view_manager_base.cc
|
||||
index fb69efbfa8e355f8389abf9490cf338e70f16c7b..52099b2312b042b0afdd5ee3d2df5c66ea25df8b 100644
|
||||
index 3a3f733c45e08e461a74d2458172c38ec0e572bf..ae520ae7e671183887a4703c3b1071921e7cabb4 100644
|
||||
--- a/chrome/browser/printing/print_view_manager_base.cc
|
||||
+++ b/chrome/browser/printing/print_view_manager_base.cc
|
||||
@@ -30,10 +30,10 @@
|
||||
@@ -142,15 +143,15 @@ index fb69efbfa8e355f8389abf9490cf338e70f16c7b..52099b2312b042b0afdd5ee3d2df5c66
|
||||
#include "components/prefs/pref_service.h"
|
||||
#include "components/printing/browser/print_composite_client.h"
|
||||
#include "components/printing/browser/print_manager_utils.h"
|
||||
@@ -48,6 +48,7 @@
|
||||
#include "content/public/browser/render_frame_host.h"
|
||||
@@ -49,6 +49,7 @@
|
||||
#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 "chrome/grit/generated_resources.h"
|
||||
#include "mojo/public/cpp/system/buffer.h"
|
||||
#include "printing/buildflags/buildflags.h"
|
||||
#include "printing/metafile_skia.h"
|
||||
@@ -87,6 +88,8 @@ using PrintSettingsCallback =
|
||||
@@ -88,6 +89,8 @@ using PrintSettingsCallback =
|
||||
base::OnceCallback<void(std::unique_ptr<PrinterQuery>)>;
|
||||
|
||||
void ShowWarningMessageBox(const std::u16string& message) {
|
||||
@@ -159,7 +160,7 @@ index fb69efbfa8e355f8389abf9490cf338e70f16c7b..52099b2312b042b0afdd5ee3d2df5c66
|
||||
// Runs always on the UI thread.
|
||||
static bool is_dialog_shown = false;
|
||||
if (is_dialog_shown)
|
||||
@@ -95,6 +98,7 @@ void ShowWarningMessageBox(const std::u16string& message) {
|
||||
@@ -96,6 +99,7 @@ void ShowWarningMessageBox(const std::u16string& message) {
|
||||
base::AutoReset<bool> auto_reset(&is_dialog_shown, true);
|
||||
|
||||
chrome::ShowWarningMessageBox(nullptr, std::u16string(), message);
|
||||
@@ -167,7 +168,7 @@ index fb69efbfa8e355f8389abf9490cf338e70f16c7b..52099b2312b042b0afdd5ee3d2df5c66
|
||||
}
|
||||
|
||||
#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
||||
@@ -192,7 +196,9 @@ void UpdatePrintSettingsReplyOnIO(
|
||||
@@ -193,7 +197,9 @@ void UpdatePrintSettingsReplyOnIO(
|
||||
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
|
||||
DCHECK(printer_query);
|
||||
mojom::PrintPagesParamsPtr params = CreateEmptyPrintPagesParamsPtr();
|
||||
@@ -178,7 +179,7 @@ index fb69efbfa8e355f8389abf9490cf338e70f16c7b..52099b2312b042b0afdd5ee3d2df5c66
|
||||
RenderParamsFromPrintSettings(printer_query->settings(),
|
||||
params->params.get());
|
||||
params->params->document_cookie = printer_query->cookie();
|
||||
@@ -245,6 +251,7 @@ void ScriptedPrintReplyOnIO(
|
||||
@@ -246,6 +252,7 @@ void ScriptedPrintReplyOnIO(
|
||||
mojom::PrintManagerHost::ScriptedPrintCallback callback) {
|
||||
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
|
||||
mojom::PrintPagesParamsPtr params = CreateEmptyPrintPagesParamsPtr();
|
||||
@@ -186,7 +187,7 @@ index fb69efbfa8e355f8389abf9490cf338e70f16c7b..52099b2312b042b0afdd5ee3d2df5c66
|
||||
if (printer_query->last_status() == mojom::ResultCode::kSuccess &&
|
||||
printer_query->settings().dpi()) {
|
||||
RenderParamsFromPrintSettings(printer_query->settings(),
|
||||
@@ -254,8 +261,9 @@ void ScriptedPrintReplyOnIO(
|
||||
@@ -255,8 +262,9 @@ void ScriptedPrintReplyOnIO(
|
||||
}
|
||||
bool has_valid_cookie = params->params->document_cookie;
|
||||
bool has_dpi = !params->params->dpi.IsEmpty();
|
||||
@@ -197,7 +198,7 @@ index fb69efbfa8e355f8389abf9490cf338e70f16c7b..52099b2312b042b0afdd5ee3d2df5c66
|
||||
|
||||
if (has_dpi && has_valid_cookie) {
|
||||
queue->QueuePrinterQuery(std::move(printer_query));
|
||||
@@ -293,12 +301,14 @@ PrintViewManagerBase::PrintViewManagerBase(content::WebContents* web_contents)
|
||||
@@ -294,12 +302,14 @@ PrintViewManagerBase::PrintViewManagerBase(content::WebContents* web_contents)
|
||||
: PrintManager(web_contents),
|
||||
queue_(g_browser_process->print_job_manager()->queue()) {
|
||||
DCHECK(queue_);
|
||||
@@ -212,29 +213,30 @@ index fb69efbfa8e355f8389abf9490cf338e70f16c7b..52099b2312b042b0afdd5ee3d2df5c66
|
||||
}
|
||||
|
||||
PrintViewManagerBase::~PrintViewManagerBase() {
|
||||
@@ -306,7 +316,10 @@ PrintViewManagerBase::~PrintViewManagerBase() {
|
||||
@@ -307,7 +317,10 @@ PrintViewManagerBase::~PrintViewManagerBase() {
|
||||
DisconnectFromCurrentPrintJob();
|
||||
}
|
||||
|
||||
-bool PrintViewManagerBase::PrintNow(content::RenderFrameHost* rfh) {
|
||||
+bool PrintViewManagerBase::PrintNow(content::RenderFrameHost* rfh,
|
||||
+ bool silent,
|
||||
+ base::Value::Dict settings,
|
||||
+ base::Value 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()`.
|
||||
@@ -332,6 +345,9 @@ bool PrintViewManagerBase::PrintNow(content::RenderFrameHost* rfh) {
|
||||
@@ -333,7 +346,9 @@ bool PrintViewManagerBase::PrintNow(content::RenderFrameHost* rfh) {
|
||||
#endif
|
||||
|
||||
SetPrintingRFH(rfh);
|
||||
- GetPrintRenderFrame(rfh)->PrintRequestedPages();
|
||||
+ callback_ = std::move(callback);
|
||||
+
|
||||
+ GetPrintRenderFrame(rfh)->PrintRequestedPages(silent, std::move(settings));
|
||||
|
||||
#if BUILDFLAG(ENABLE_PRINT_CONTENT_ANALYSIS)
|
||||
enterprise_connectors::ContentAnalysisDelegate::Data scanning_data;
|
||||
@@ -500,7 +516,8 @@ void PrintViewManagerBase::GetDefaultPrintSettingsReply(
|
||||
for (auto& observer : GetObservers())
|
||||
observer.OnPrintNow(rfh);
|
||||
@@ -486,7 +501,8 @@ void PrintViewManagerBase::GetDefaultPrintSettingsReply(
|
||||
void PrintViewManagerBase::ScriptedPrintReply(
|
||||
ScriptedPrintCallback callback,
|
||||
int process_id,
|
||||
@@ -244,7 +246,7 @@ index fb69efbfa8e355f8389abf9490cf338e70f16c7b..52099b2312b042b0afdd5ee3d2df5c66
|
||||
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
||||
|
||||
#if BUILDFLAG(ENABLE_OOP_PRINTING)
|
||||
@@ -513,16 +530,19 @@ void PrintViewManagerBase::ScriptedPrintReply(
|
||||
@@ -499,16 +515,19 @@ void PrintViewManagerBase::ScriptedPrintReply(
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -268,7 +270,7 @@ index fb69efbfa8e355f8389abf9490cf338e70f16c7b..52099b2312b042b0afdd5ee3d2df5c66
|
||||
}
|
||||
|
||||
void PrintViewManagerBase::NavigationStopped() {
|
||||
@@ -638,11 +658,14 @@ void PrintViewManagerBase::DidPrintDocument(
|
||||
@@ -624,11 +643,14 @@ void PrintViewManagerBase::DidPrintDocument(
|
||||
void PrintViewManagerBase::GetDefaultPrintSettings(
|
||||
GetDefaultPrintSettingsCallback callback) {
|
||||
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
||||
@@ -283,8 +285,8 @@ index fb69efbfa8e355f8389abf9490cf338e70f16c7b..52099b2312b042b0afdd5ee3d2df5c66
|
||||
#if BUILDFLAG(ENABLE_OOP_PRINTING)
|
||||
if (printing::features::kEnableOopPrintDriversJobPrint.Get() &&
|
||||
!service_manager_client_id_.has_value()) {
|
||||
@@ -672,18 +695,20 @@ void PrintViewManagerBase::UpdatePrintSettings(
|
||||
base::Value::Dict job_settings,
|
||||
@@ -658,18 +680,20 @@ void PrintViewManagerBase::UpdatePrintSettings(
|
||||
base::Value job_settings,
|
||||
UpdatePrintSettingsCallback callback) {
|
||||
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
||||
+#if 0 // Printing is always enabled.
|
||||
@@ -295,7 +297,7 @@ index fb69efbfa8e355f8389abf9490cf338e70f16c7b..52099b2312b042b0afdd5ee3d2df5c66
|
||||
}
|
||||
-
|
||||
+#endif
|
||||
if (!job_settings.FindInt(kSettingPrinterType)) {
|
||||
if (!job_settings.FindIntKey(kSettingPrinterType)) {
|
||||
UpdatePrintSettingsReply(std::move(callback),
|
||||
CreateEmptyPrintPagesParamsPtr(), false);
|
||||
return;
|
||||
@@ -305,15 +307,15 @@ index fb69efbfa8e355f8389abf9490cf338e70f16c7b..52099b2312b042b0afdd5ee3d2df5c66
|
||||
content::BrowserContext* context =
|
||||
web_contents() ? web_contents()->GetBrowserContext() : nullptr;
|
||||
PrefService* prefs =
|
||||
@@ -693,6 +718,7 @@ void PrintViewManagerBase::UpdatePrintSettings(
|
||||
@@ -679,6 +703,7 @@ void PrintViewManagerBase::UpdatePrintSettings(
|
||||
if (value > 0)
|
||||
job_settings.Set(kSettingRasterizePdfDpi, value);
|
||||
job_settings.SetIntKey(kSettingRasterizePdfDpi, value);
|
||||
}
|
||||
+#endif
|
||||
|
||||
auto callback_wrapper =
|
||||
base::BindOnce(&PrintViewManagerBase::UpdatePrintSettingsReply,
|
||||
@@ -718,14 +744,14 @@ void PrintViewManagerBase::ScriptedPrint(mojom::ScriptedPrintParamsPtr params,
|
||||
@@ -704,14 +729,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);
|
||||
@@ -330,7 +332,7 @@ index fb69efbfa8e355f8389abf9490cf338e70f16c7b..52099b2312b042b0afdd5ee3d2df5c66
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -748,7 +774,6 @@ void PrintViewManagerBase::PrintingFailed(int32_t cookie) {
|
||||
@@ -734,7 +759,6 @@ void PrintViewManagerBase::PrintingFailed(int32_t cookie) {
|
||||
PrintManager::PrintingFailed(cookie);
|
||||
|
||||
#if !BUILDFLAG(IS_ANDROID) // Android does not implement this function.
|
||||
@@ -338,7 +340,7 @@ index fb69efbfa8e355f8389abf9490cf338e70f16c7b..52099b2312b042b0afdd5ee3d2df5c66
|
||||
#endif
|
||||
|
||||
ReleasePrinterQuery();
|
||||
@@ -763,6 +788,11 @@ void PrintViewManagerBase::RemoveObserver(Observer& observer) {
|
||||
@@ -749,6 +773,11 @@ void PrintViewManagerBase::RemoveObserver(Observer& observer) {
|
||||
}
|
||||
|
||||
void PrintViewManagerBase::ShowInvalidPrinterSettingsError() {
|
||||
@@ -350,7 +352,7 @@ index fb69efbfa8e355f8389abf9490cf338e70f16c7b..52099b2312b042b0afdd5ee3d2df5c66
|
||||
base::ThreadTaskRunnerHandle::Get()->PostTask(
|
||||
FROM_HERE, base::BindOnce(&ShowWarningMessageBox,
|
||||
l10n_util::GetStringUTF16(
|
||||
@@ -773,10 +803,12 @@ void PrintViewManagerBase::RenderFrameHostStateChanged(
|
||||
@@ -759,10 +788,12 @@ void PrintViewManagerBase::RenderFrameHostStateChanged(
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
content::RenderFrameHost::LifecycleState /*old_state*/,
|
||||
content::RenderFrameHost::LifecycleState new_state) {
|
||||
@@ -363,7 +365,7 @@ index fb69efbfa8e355f8389abf9490cf338e70f16c7b..52099b2312b042b0afdd5ee3d2df5c66
|
||||
}
|
||||
|
||||
void PrintViewManagerBase::DidStartLoading() {
|
||||
@@ -836,6 +868,11 @@ void PrintViewManagerBase::OnJobDone() {
|
||||
@@ -822,6 +853,11 @@ void PrintViewManagerBase::OnJobDone() {
|
||||
ReleasePrintJob();
|
||||
}
|
||||
|
||||
@@ -375,7 +377,7 @@ index fb69efbfa8e355f8389abf9490cf338e70f16c7b..52099b2312b042b0afdd5ee3d2df5c66
|
||||
void PrintViewManagerBase::OnFailed() {
|
||||
TerminatePrintJob(true);
|
||||
}
|
||||
@@ -893,7 +930,10 @@ bool PrintViewManagerBase::CreateNewPrintJob(
|
||||
@@ -883,7 +919,10 @@ bool PrintViewManagerBase::CreateNewPrintJob(
|
||||
|
||||
// Disconnect the current |print_job_|.
|
||||
auto weak_this = weak_ptr_factory_.GetWeakPtr();
|
||||
@@ -387,7 +389,7 @@ index fb69efbfa8e355f8389abf9490cf338e70f16c7b..52099b2312b042b0afdd5ee3d2df5c66
|
||||
if (!weak_this)
|
||||
return false;
|
||||
|
||||
@@ -972,6 +1012,13 @@ void PrintViewManagerBase::ReleasePrintJob() {
|
||||
@@ -965,6 +1004,13 @@ void PrintViewManagerBase::ReleasePrintJob() {
|
||||
UnregisterSystemPrintClient();
|
||||
#endif
|
||||
|
||||
@@ -401,7 +403,7 @@ index fb69efbfa8e355f8389abf9490cf338e70f16c7b..52099b2312b042b0afdd5ee3d2df5c66
|
||||
if (!print_job_)
|
||||
return;
|
||||
|
||||
@@ -1021,7 +1068,7 @@ bool PrintViewManagerBase::RunInnerMessageLoop() {
|
||||
@@ -1014,7 +1060,7 @@ bool PrintViewManagerBase::RunInnerMessageLoop() {
|
||||
}
|
||||
|
||||
bool PrintViewManagerBase::OpportunisticallyCreatePrintJob(int cookie) {
|
||||
@@ -410,20 +412,11 @@ index fb69efbfa8e355f8389abf9490cf338e70f16c7b..52099b2312b042b0afdd5ee3d2df5c66
|
||||
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 48895e0f8a846aeb725e306c7f22ac159d5d96a7..027794e38f86ab1905c5cdd95140b2cb1e5c5653 100644
|
||||
index 3a4cfa1e44d781a94030dec6992ffd6f6391020f..d14804d02cc61b6f75d47893f6dd61ddde6cd552 100644
|
||||
--- a/chrome/browser/printing/print_view_manager_base.h
|
||||
+++ b/chrome/browser/printing/print_view_manager_base.h
|
||||
@@ -41,6 +41,8 @@ namespace printing {
|
||||
@@ -37,6 +37,8 @@ namespace printing {
|
||||
class PrintQueriesQueue;
|
||||
class PrinterQuery;
|
||||
|
||||
@@ -432,19 +425,19 @@ index 48895e0f8a846aeb725e306c7f22ac159d5d96a7..027794e38f86ab1905c5cdd95140b2cb
|
||||
// Base class for managing the print commands for a WebContents.
|
||||
class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
|
||||
public:
|
||||
@@ -62,7 +64,10 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
|
||||
@@ -58,7 +60,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::Dict settings = {},
|
||||
+ base::Value settings = {},
|
||||
+ CompletionCallback callback = {});
|
||||
|
||||
#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
||||
// Prints the document in `print_data` with settings specified in
|
||||
@@ -110,6 +115,7 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
|
||||
@@ -106,6 +111,7 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
|
||||
ScriptedPrintCallback callback) override;
|
||||
void ShowInvalidPrinterSettingsError() override;
|
||||
void PrintingFailed(int32_t cookie) override;
|
||||
@@ -452,7 +445,7 @@ index 48895e0f8a846aeb725e306c7f22ac159d5d96a7..027794e38f86ab1905c5cdd95140b2cb
|
||||
|
||||
// Adds and removes observers for `PrintViewManagerBase` events. The order in
|
||||
// which notifications are sent to observers is undefined. Observers must be
|
||||
@@ -231,7 +237,8 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
|
||||
@@ -207,7 +213,8 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
|
||||
// Runs `callback` with `params` to reply to ScriptedPrint().
|
||||
void ScriptedPrintReply(ScriptedPrintCallback callback,
|
||||
int process_id,
|
||||
@@ -462,7 +455,7 @@ index 48895e0f8a846aeb725e306c7f22ac159d5d96a7..027794e38f86ab1905c5cdd95140b2cb
|
||||
|
||||
// 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
|
||||
@@ -297,9 +304,15 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
|
||||
@@ -262,9 +269,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;
|
||||
|
||||
@@ -479,7 +472,7 @@ index 48895e0f8a846aeb725e306c7f22ac159d5d96a7..027794e38f86ab1905c5cdd95140b2cb
|
||||
// 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 016e0d8fcc575bfa77323d8600d5daba152abbc6..dfb856f57767e24c0ec495c94e515afbb83e19ea 100644
|
||||
index 879004c790d57b28e7a816ebf560971876c17168..334509d3ab45af4bb7877f656ca5aca7ee1bce00 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(
|
||||
@@ -487,25 +480,25 @@ index 016e0d8fcc575bfa77323d8600d5daba152abbc6..dfb856f57767e24c0ec495c94e515afb
|
||||
FakePrintRenderFrame::~FakePrintRenderFrame() = default;
|
||||
|
||||
-void FakePrintRenderFrame::PrintRequestedPages() {}
|
||||
+void FakePrintRenderFrame::PrintRequestedPages(bool /*silent*/, ::base::Value::Dict /*settings*/) {}
|
||||
+void FakePrintRenderFrame::PrintRequestedPages(bool /*silent*/, ::base::Value /*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 3c95ee5c0d169f677947427a6ace55b4bfe80277..63ba8aca503968d0409b63b991a9276228d60d4a 100644
|
||||
index 10f46664d8337d6be2fac24d9a6933429f3b2c2b..6de833f2da3ae85cf0752284146974f2026ab174 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
|
||||
@@ -25,7 +25,7 @@ class FakePrintRenderFrame : public mojom::PrintRenderFrame {
|
||||
@@ -24,7 +24,7 @@ class FakePrintRenderFrame : public mojom::PrintRenderFrame {
|
||||
|
||||
private:
|
||||
// printing::mojom::PrintRenderFrame:
|
||||
- void PrintRequestedPages() override;
|
||||
+ void PrintRequestedPages(bool silent, ::base::Value::Dict settings) override;
|
||||
+ void PrintRequestedPages(bool silent, ::base::Value 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 3ba45e77f66531bc6b81717eb9c7d3faca1e9fa9..41271d3fe390dd16d1c2b9839ac32013f495df51 100644
|
||||
index 66810a2a5f0c77ba107c71d2abaef8692bda0fea..cd6103af4571f82f11652a3c7ecf0e534428dc49 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(
|
||||
@@ -554,7 +547,7 @@ index 3ba45e77f66531bc6b81717eb9c7d3faca1e9fa9..41271d3fe390dd16d1c2b9839ac32013
|
||||
|
||||
void PdfPrintManager::ShowInvalidPrinterSettingsError() {
|
||||
diff --git a/components/printing/common/print.mojom b/components/printing/common/print.mojom
|
||||
index 156b987aa9cafb69c04bed483aa78f26baa9cd97..3d3f2cb97b59a6e46bf0c16dd2355aa8e21ec5da 100644
|
||||
index 6cd585d597315940be144506b9bb819137a7981e..8ea9c38a46460edd237f003ddd7362240a02887e 100644
|
||||
--- a/components/printing/common/print.mojom
|
||||
+++ b/components/printing/common/print.mojom
|
||||
@@ -275,7 +275,7 @@ interface PrintPreviewUI {
|
||||
@@ -562,11 +555,11 @@ index 156b987aa9cafb69c04bed483aa78f26baa9cd97..3d3f2cb97b59a6e46bf0c16dd2355aa8
|
||||
// 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.DictionaryValue settings);
|
||||
+ PrintRequestedPages(bool silent, mojo_base.mojom.DeprecatedDictionaryValue 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
|
||||
@@ -348,7 +348,7 @@ interface PrintManagerHost {
|
||||
@@ -342,7 +342,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]
|
||||
@@ -576,10 +569,10 @@ index 156b987aa9cafb69c04bed483aa78f26baa9cd97..3d3f2cb97b59a6e46bf0c16dd2355aa8
|
||||
// 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 e0ecf8f3f09dafe44a5220117281a08e38a61bef..edbaa28ec4ffd22b6afa332365c5dc51c33de31e 100644
|
||||
index 36852ff8edee8da4ca43cf84c316f1f0eaff9fe0..7be102bae492701cddefc1623af4fe8bdd9963fa 100644
|
||||
--- a/components/printing/renderer/print_render_frame_helper.cc
|
||||
+++ b/components/printing/renderer/print_render_frame_helper.cc
|
||||
@@ -41,6 +41,7 @@
|
||||
@@ -40,6 +40,7 @@
|
||||
#include "printing/metafile_skia.h"
|
||||
#include "printing/mojom/print.mojom.h"
|
||||
#include "printing/print_job_constants.h"
|
||||
@@ -587,26 +580,26 @@ index e0ecf8f3f09dafe44a5220117281a08e38a61bef..edbaa28ec4ffd22b6afa332365c5dc51
|
||||
#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"
|
||||
@@ -1276,7 +1277,8 @@ void PrintRenderFrameHelper::ScriptedPrint(bool user_initiated) {
|
||||
@@ -1264,7 +1265,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::Value::Dict() /* new_settings */);
|
||||
+ false /* silent */, base::DictionaryValue() /* new_settings */);
|
||||
if (!weak_this)
|
||||
return;
|
||||
|
||||
@@ -1307,7 +1309,7 @@ void PrintRenderFrameHelper::BindPrintRenderFrameReceiver(
|
||||
@@ -1295,7 +1297,7 @@ void PrintRenderFrameHelper::BindPrintRenderFrameReceiver(
|
||||
receivers_.Add(this, std::move(receiver));
|
||||
}
|
||||
|
||||
-void PrintRenderFrameHelper::PrintRequestedPages() {
|
||||
+void PrintRenderFrameHelper::PrintRequestedPages(bool silent, base::Value::Dict settings) {
|
||||
+void PrintRenderFrameHelper::PrintRequestedPages(bool silent, base::Value settings) {
|
||||
ScopedIPC scoped_ipc(weak_ptr_factory_.GetWeakPtr());
|
||||
if (ipc_nesting_level_ > kAllowedIpcDepthForPrint)
|
||||
return;
|
||||
@@ -1322,7 +1324,7 @@ void PrintRenderFrameHelper::PrintRequestedPages() {
|
||||
@@ -1310,7 +1312,7 @@ void PrintRenderFrameHelper::PrintRequestedPages() {
|
||||
// plugin node and print that instead.
|
||||
auto plugin = delegate_->GetPdfElement(frame);
|
||||
|
||||
@@ -615,17 +608,17 @@ index e0ecf8f3f09dafe44a5220117281a08e38a61bef..edbaa28ec4ffd22b6afa332365c5dc51
|
||||
|
||||
if (!render_frame_gone_)
|
||||
frame->DispatchAfterPrintEvent();
|
||||
@@ -1353,7 +1355,8 @@ void PrintRenderFrameHelper::PrintForSystemDialog() {
|
||||
@@ -1341,7 +1343,8 @@ void PrintRenderFrameHelper::PrintForSystemDialog() {
|
||||
}
|
||||
|
||||
Print(frame, print_preview_context_.source_node(),
|
||||
- PrintRequestType::kRegular);
|
||||
+ PrintRequestType::kRegular, false,
|
||||
+ base::Value::Dict());
|
||||
+ base::DictionaryValue());
|
||||
if (!render_frame_gone_)
|
||||
print_preview_context_.DispatchAfterPrintEvent();
|
||||
// WARNING: |this| may be gone at this point. Do not do any more work here and
|
||||
@@ -1402,6 +1405,8 @@ void PrintRenderFrameHelper::PrintPreview(base::Value settings) {
|
||||
@@ -1390,6 +1393,8 @@ void PrintRenderFrameHelper::PrintPreview(base::Value settings) {
|
||||
if (ipc_nesting_level_ > kAllowedIpcDepthForPrint)
|
||||
return;
|
||||
|
||||
@@ -634,37 +627,37 @@ index e0ecf8f3f09dafe44a5220117281a08e38a61bef..edbaa28ec4ffd22b6afa332365c5dc51
|
||||
print_preview_context_.OnPrintPreview();
|
||||
|
||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
@@ -2008,7 +2013,8 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) {
|
||||
@@ -1942,7 +1947,8 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) {
|
||||
return;
|
||||
|
||||
Print(duplicate_node.GetDocument().GetFrame(), duplicate_node,
|
||||
- PrintRequestType::kRegular);
|
||||
+ PrintRequestType::kRegular, false /* silent */,
|
||||
+ base::Value::Dict() /* new_settings */);
|
||||
+ base::DictionaryValue() /* new_settings */);
|
||||
// Check if |this| is still valid.
|
||||
if (!weak_this)
|
||||
return;
|
||||
@@ -2023,7 +2029,9 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) {
|
||||
@@ -1957,7 +1963,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::Dict settings) {
|
||||
+ base::Value settings) {
|
||||
// If still not finished with earlier print request simply ignore.
|
||||
if (prep_frame_view_)
|
||||
return;
|
||||
@@ -2031,7 +2039,7 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame,
|
||||
@@ -1965,7 +1973,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, std::move(settings))) {
|
||||
+ if (!CalculateNumberOfPages(frame, node, &expected_page_count, base::Value::AsDictionaryValue(settings))) {
|
||||
DidFinishPrinting(FAIL_PRINT_INIT);
|
||||
return; // Failed to init print page settings.
|
||||
}
|
||||
@@ -2050,8 +2058,15 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame,
|
||||
@@ -1984,8 +1992,15 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame,
|
||||
print_pages_params_->params->print_scaling_option;
|
||||
|
||||
auto self = weak_ptr_factory_.GetWeakPtr();
|
||||
@@ -681,7 +674,7 @@ index e0ecf8f3f09dafe44a5220117281a08e38a61bef..edbaa28ec4ffd22b6afa332365c5dc51
|
||||
// Check if |this| is still valid.
|
||||
if (!self)
|
||||
return;
|
||||
@@ -2300,36 +2315,52 @@ void PrintRenderFrameHelper::IPCProcessed() {
|
||||
@@ -2233,36 +2248,51 @@ void PrintRenderFrameHelper::IPCProcessed() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -691,10 +684,10 @@ index e0ecf8f3f09dafe44a5220117281a08e38a61bef..edbaa28ec4ffd22b6afa332365c5dc51
|
||||
- GetPrintManagerHost()->GetDefaultPrintSettings(&settings.params);
|
||||
+bool PrintRenderFrameHelper::InitPrintSettings(
|
||||
+ bool fit_to_paper_size,
|
||||
+ base::Value::Dict new_settings) {
|
||||
+ const base::DictionaryValue& new_settings) {
|
||||
+ mojom::PrintPagesParamsPtr settings;
|
||||
+
|
||||
+ if (new_settings.empty()) {
|
||||
+ if (new_settings.DictEmpty()) {
|
||||
+ settings = mojom::PrintPagesParams::New();
|
||||
+ settings->params = mojom::PrintParams::New();
|
||||
+ GetPrintManagerHost()->GetDefaultPrintSettings(&settings->params);
|
||||
@@ -702,8 +695,7 @@ index e0ecf8f3f09dafe44a5220117281a08e38a61bef..edbaa28ec4ffd22b6afa332365c5dc51
|
||||
+ bool canceled = false;
|
||||
+ int cookie =
|
||||
+ print_pages_params_ ? print_pages_params_->params->document_cookie : 0;
|
||||
+ GetPrintManagerHost()->UpdatePrintSettings(
|
||||
+ cookie, std::move(new_settings), &settings, &canceled);
|
||||
+ GetPrintManagerHost()->UpdatePrintSettings(cookie, new_settings.Clone(), &settings, &canceled);
|
||||
+ if (canceled)
|
||||
+ return false;
|
||||
+ }
|
||||
@@ -738,15 +730,15 @@ index e0ecf8f3f09dafe44a5220117281a08e38a61bef..edbaa28ec4ffd22b6afa332365c5dc51
|
||||
+ blink::WebLocalFrame* frame,
|
||||
+ const blink::WebNode& node,
|
||||
+ uint32_t* number_of_pages,
|
||||
+ base::Value::Dict settings) {
|
||||
+ const base::DictionaryValue& settings) {
|
||||
DCHECK(frame);
|
||||
bool fit_to_paper_size = !IsPrintingPdfFrame(frame, node);
|
||||
- if (!InitPrintSettings(fit_to_paper_size)) {
|
||||
+ if (!InitPrintSettings(fit_to_paper_size, std::move(settings))) {
|
||||
+ if (!InitPrintSettings(fit_to_paper_size, settings)) {
|
||||
notify_browser_of_print_failure_ = false;
|
||||
GetPrintManagerHost()->ShowInvalidPrinterSettingsError();
|
||||
return false;
|
||||
@@ -2454,7 +2485,7 @@ mojom::PrintPagesParamsPtr PrintRenderFrameHelper::GetPrintSettingsFromUser(
|
||||
@@ -2406,7 +2436,7 @@ mojom::PrintPagesParamsPtr PrintRenderFrameHelper::GetPrintSettingsFromUser(
|
||||
std::move(params),
|
||||
base::BindOnce(
|
||||
[](base::OnceClosure quit_closure, mojom::PrintPagesParamsPtr* output,
|
||||
@@ -755,7 +747,7 @@ index e0ecf8f3f09dafe44a5220117281a08e38a61bef..edbaa28ec4ffd22b6afa332365c5dc51
|
||||
*output = std::move(input);
|
||||
std::move(quit_closure).Run();
|
||||
},
|
||||
@@ -2705,18 +2736,7 @@ void PrintRenderFrameHelper::RequestPrintPreview(PrintPreviewRequestType type,
|
||||
@@ -2657,18 +2687,7 @@ void PrintRenderFrameHelper::RequestPrintPreview(PrintPreviewRequestType type,
|
||||
}
|
||||
|
||||
bool PrintRenderFrameHelper::CheckForCancel() {
|
||||
@@ -776,60 +768,60 @@ index e0ecf8f3f09dafe44a5220117281a08e38a61bef..edbaa28ec4ffd22b6afa332365c5dc51
|
||||
|
||||
bool PrintRenderFrameHelper::PreviewPageRendered(
|
||||
diff --git a/components/printing/renderer/print_render_frame_helper.h b/components/printing/renderer/print_render_frame_helper.h
|
||||
index 15c367bd66706c915fdb95faf483429a8b31eb4c..ba2d5decbad2195c63efa4a5e23c60df7de69441 100644
|
||||
index cd26f9ecf888c2a321890edd378ee0f8843a7f6c..958794f95fe8830b7e494340fbd53b0e92a498e3 100644
|
||||
--- a/components/printing/renderer/print_render_frame_helper.h
|
||||
+++ b/components/printing/renderer/print_render_frame_helper.h
|
||||
@@ -254,7 +254,7 @@ class PrintRenderFrameHelper
|
||||
@@ -257,7 +257,7 @@ class PrintRenderFrameHelper
|
||||
mojo::PendingAssociatedReceiver<mojom::PrintRenderFrame> receiver);
|
||||
|
||||
// printing::mojom::PrintRenderFrame:
|
||||
- void PrintRequestedPages() override;
|
||||
+ void PrintRequestedPages(bool silent, base::Value::Dict settings) override;
|
||||
+ void PrintRequestedPages(bool silent, base::Value settings) override;
|
||||
#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
||||
void PrintForSystemDialog() override;
|
||||
void SetPrintPreviewUI(
|
||||
@@ -325,7 +325,9 @@ class PrintRenderFrameHelper
|
||||
@@ -324,7 +324,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::Dict settings);
|
||||
+ base::Value settings);
|
||||
|
||||
// Notification when printing is done - signal tear-down/free resources.
|
||||
void DidFinishPrinting(PrintingResult result);
|
||||
@@ -334,12 +336,14 @@ class PrintRenderFrameHelper
|
||||
@@ -333,12 +335,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,
|
||||
+ base::Value::Dict new_settings);
|
||||
+ const base::DictionaryValue& 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,
|
||||
+ base::Value::Dict settings);
|
||||
+ const base::DictionaryValue& 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 8a8fcefa9da92a044f5bdf6a2f242048b325d442..6dae33514675d6843736b2c9a767a4b72cb103fa 100644
|
||||
index d0ef2181c649afe110c3c466a565a01cf6ae63a9..2daf9f02d41e04930fc4dad6d36ccbf3006dc175 100644
|
||||
--- a/printing/printing_context.cc
|
||||
+++ b/printing/printing_context.cc
|
||||
@@ -117,7 +117,6 @@ mojom::ResultCode PrintingContext::UsePdfSettings() {
|
||||
@@ -119,7 +119,6 @@ mojom::ResultCode PrintingContext::UsePdfSettings() {
|
||||
|
||||
mojom::ResultCode PrintingContext::UpdatePrintSettings(
|
||||
base::Value::Dict job_settings) {
|
||||
base::Value job_settings) {
|
||||
- ResetSettings();
|
||||
{
|
||||
std::unique_ptr<PrintSettings> settings =
|
||||
PrintSettingsFromJobSettings(job_settings);
|
||||
PrintSettingsFromJobSettings(job_settings.GetDict());
|
||||
diff --git a/printing/printing_context.h b/printing/printing_context.h
|
||||
index 2c8ef23f7cb75a743fa18e3c613f7c719988028c..265005d6d51f861aa7ccd7e0eba7809b3c652dae 100644
|
||||
index 3f36303105b7979a1a771bf26b42596abe5b3cce..52f740bb832db4a8d76431d9bc77cab10bb7e0c7 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 faa795be3a6cbc7ae13d9a42a1bdbd01ac0406a9..add5ba98f4409460b93aa2f8c49eb49a1f59470a 100644
|
||||
index df03de0a810bbce796d5bc421b92000e02dbd449..b9309e1cbc4a8b701534aa8be2827c40d98d6678 100644
|
||||
--- a/content/browser/web_contents/web_contents_impl.cc
|
||||
+++ b/content/browser/web_contents/web_contents_impl.cc
|
||||
@@ -4523,6 +4523,11 @@ TextInputManager* WebContentsImpl::GetTextInputManager() {
|
||||
@@ -4519,6 +4519,11 @@ TextInputManager* WebContentsImpl::GetTextInputManager() {
|
||||
return text_input_manager_.get();
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ index faa795be3a6cbc7ae13d9a42a1bdbd01ac0406a9..add5ba98f4409460b93aa2f8c49eb49a
|
||||
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 7ad2648933434282c5bdd3fd5d9187d86e142b60..2a29af8d9aa67768ec521e87190174397a25b722 100644
|
||||
index 80aeacf4ad593a7d40dae6c9096ab0c700ab22d8..07355cb194bd429a693e587072d11432d6c0888a 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 49ce51acb678886e0c679caa42e616400ab3bd48..760d97e8614195c8106b07b8477cf91a5dbebc15 100644
|
||||
index 460442d9c0f894f78b29b33c027320511511dbcc..30068c219aa497892e10290be0fe5734ded8b23c 100644
|
||||
--- a/base/callback_helpers.h
|
||||
+++ b/base/callback_helpers.h
|
||||
@@ -96,6 +96,22 @@ class OnceCallbackHolder final {
|
||||
@@ -95,6 +95,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 15bada83dc4bc3fda72600e6325917faeba4e60f..d0004dfce5c8ad3c3318755318385144e296055d 100644
|
||||
index 24b18a620f3e60ed26dddfaa5d3133b5ede972fe..0377f156a23182d1a65fe5ef82f3f5203b98aed0 100644
|
||||
--- a/content/renderer/render_thread_impl.cc
|
||||
+++ b/content/renderer/render_thread_impl.cc
|
||||
@@ -1321,7 +1321,7 @@ bool RenderThreadImpl::IsLcdTextEnabled() {
|
||||
@@ -1320,7 +1320,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 396377fd4041cced3c68f8d57c8f868098bb8923..09f72f1fbd7b782c5bf52245482b358103f0c243 100644
|
||||
index 20a697be32f7e27a9fa33d0225c94520aa5ebf2e..927e182bbba7a3700fd20c8c964da7cc162c4210 100644
|
||||
--- a/content/browser/renderer_host/render_process_host_impl.cc
|
||||
+++ b/content/browser/renderer_host/render_process_host_impl.cc
|
||||
@@ -1791,9 +1791,15 @@ bool RenderProcessHostImpl::Init() {
|
||||
@@ -1786,9 +1786,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 4b77c71375a7375e168c9bee93a73c3af6fe1252..1e23962ccb7cf99c5bff122ce0eb0e05086f4a89 100644
|
||||
index c1b1bfc8333e93456178842db392eabff96bf4c9..1eee3bf88b5566b07cdb4f33fc03bf3d904ec6b9 100644
|
||||
--- a/content/browser/web_contents/web_contents_impl.cc
|
||||
+++ b/content/browser/web_contents/web_contents_impl.cc
|
||||
@@ -3061,6 +3061,13 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params,
|
||||
@@ -3057,6 +3057,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 4b77c71375a7375e168c9bee93a73c3af6fe1252..1e23962ccb7cf99c5bff122ce0eb0e05
|
||||
WebContentsViewDelegate* delegate =
|
||||
GetContentClient()->browser()->GetWebContentsViewDelegate(this);
|
||||
|
||||
@@ -3071,6 +3078,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params,
|
||||
@@ -3067,6 +3074,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 0287e414f4020147ddee297f7c1447c32a118905..781793ae5cb461b7451b5c448465ba5b41aa805d 100644
|
||||
index b47dc4a90a0294c5d7e73f01c496fd2b4f621400..cf02dbe536eec67b77c85ceb73d285fcbde025fc 100644
|
||||
--- a/content/browser/renderer_host/render_frame_host_impl.cc
|
||||
+++ b/content/browser/renderer_host/render_frame_host_impl.cc
|
||||
@@ -6326,6 +6326,15 @@ void RenderFrameHostImpl::EnterFullscreen(
|
||||
@@ -6324,6 +6324,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 340b9635325e3e5dd0fa693fbfb0b4b976aef84e..a2193d3270e4995df506e751e1912975e19b2083 100644
|
||||
index dbde0706007b8f202fcca5fc05562979617b0183..2adea2c2edabf3c401e9dcd228f1d57c08066059 100644
|
||||
--- a/content/renderer/renderer_blink_platform_impl.cc
|
||||
+++ b/content/renderer/renderer_blink_platform_impl.cc
|
||||
@@ -954,6 +954,12 @@ void RendererBlinkPlatformImpl::WillStopWorkerThread() {
|
||||
@@ -949,6 +949,12 @@ void RendererBlinkPlatformImpl::WillStopWorkerThread() {
|
||||
WorkerThreadRegistry::Instance()->WillStopCurrentWorkerThread();
|
||||
}
|
||||
|
||||
@@ -43,10 +43,10 @@ index 340b9635325e3e5dd0fa693fbfb0b4b976aef84e..a2193d3270e4995df506e751e1912975
|
||||
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 213b0b9c28974aecbdd2dd1297dfa21cd716a337..f77763977aee112b854ade93b59172247599a16b 100644
|
||||
index e7d0d3e7c08c2f6e83726e7fa2557847d148a0ed..c6e0a728150db2b5af41e12304c88d57e51faa43 100644
|
||||
--- a/content/renderer/renderer_blink_platform_impl.h
|
||||
+++ b/content/renderer/renderer_blink_platform_impl.h
|
||||
@@ -209,6 +209,7 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl {
|
||||
@@ -208,6 +208,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 213b0b9c28974aecbdd2dd1297dfa21cd716a337..f77763977aee112b854ade93b5917224
|
||||
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 3ad783e681872f6273147121802c66d31a66e2ea..dbb1e8466b57551b5c32d156d6e3b079bf9415ac 100644
|
||||
index 0825226fae036b1e5503b66dabe4bd92ad6ee9bb..3cbb1ed9ef65cb9044a76b0a1686f6ab019c87b5 100644
|
||||
--- a/third_party/blink/public/platform/platform.h
|
||||
+++ b/third_party/blink/public/platform/platform.h
|
||||
@@ -720,6 +720,7 @@ class BLINK_PLATFORM_EXPORT Platform {
|
||||
@@ -714,6 +714,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 3ad783e681872f6273147121802c66d31a66e2ea..dbb1e8466b57551b5c32d156d6e3b079
|
||||
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 265e4bed408747b5b22d2e930bc64fb2cb2c3b25..892b3e58443f1a82a6a41c6d52df7d2d701b377d 100644
|
||||
index 68c38d2045c7c23650bd56717081bb001a4e690e..e0e08d4bdf9521ed5c1940d31665d1b675119f0d 100644
|
||||
--- a/third_party/blink/renderer/core/workers/worker_thread.cc
|
||||
+++ b/third_party/blink/renderer/core/workers/worker_thread.cc
|
||||
@@ -734,6 +734,12 @@ void WorkerThread::PrepareForShutdownOnWorkerThread() {
|
||||
@@ -732,6 +732,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 a2193d3270e4995df506e751e1912975e19b2083..56ad3e79d6fcd0673bbb27fa9f87a3f603f5ae51 100644
|
||||
index 2adea2c2edabf3c401e9dcd228f1d57c08066059..7c76b39ea82dd600b72288cccc571660b653b150 100644
|
||||
--- a/content/renderer/renderer_blink_platform_impl.cc
|
||||
+++ b/content/renderer/renderer_blink_platform_impl.cc
|
||||
@@ -966,6 +966,12 @@ void RendererBlinkPlatformImpl::WorkerContextCreated(
|
||||
@@ -961,6 +961,12 @@ void RendererBlinkPlatformImpl::WorkerContextCreated(
|
||||
worker);
|
||||
}
|
||||
|
||||
@@ -52,10 +52,10 @@ index a2193d3270e4995df506e751e1912975e19b2083..56ad3e79d6fcd0673bbb27fa9f87a3f6
|
||||
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 f77763977aee112b854ade93b59172247599a16b..f3518973a5e071bf428d928f20255c208cf4d0b9 100644
|
||||
index c6e0a728150db2b5af41e12304c88d57e51faa43..7fa7dab64506ddc60e27096412ea7e93608a3394 100644
|
||||
--- a/content/renderer/renderer_blink_platform_impl.h
|
||||
+++ b/content/renderer/renderer_blink_platform_impl.h
|
||||
@@ -209,6 +209,8 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl {
|
||||
@@ -208,6 +208,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 f77763977aee112b854ade93b59172247599a16b..f3518973a5e071bf428d928f20255c20
|
||||
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 dbb1e8466b57551b5c32d156d6e3b079bf9415ac..05bd0c6411d25bbf48af6593026c3e9f0a816f38 100644
|
||||
index 3cbb1ed9ef65cb9044a76b0a1686f6ab019c87b5..c7694b4a89c16d02f946598bcf66aa3d241af83e 100644
|
||||
--- a/third_party/blink/public/platform/platform.h
|
||||
+++ b/third_party/blink/public/platform/platform.h
|
||||
@@ -720,6 +720,8 @@ class BLINK_PLATFORM_EXPORT Platform {
|
||||
@@ -714,6 +714,8 @@ class BLINK_PLATFORM_EXPORT Platform {
|
||||
virtual void DidStartWorkerThread() {}
|
||||
virtual void WillStopWorkerThread() {}
|
||||
virtual void WorkerContextCreated(const v8::Local<v8::Context>& worker) {}
|
||||
|
||||
@@ -7,10 +7,10 @@ This adds GN build files for Node, so we don't have to build with GYP.
|
||||
|
||||
diff --git a/BUILD.gn b/BUILD.gn
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..bd5788caa61305fd9af8f9d7f8f1937a224fda83
|
||||
index 0000000000000000000000000000000000000000..4afca42d22ee702af50da92aa08c1de897891424
|
||||
--- /dev/null
|
||||
+++ b/BUILD.gn
|
||||
@@ -0,0 +1,394 @@
|
||||
@@ -0,0 +1,403 @@
|
||||
+import("//electron/build/asar.gni")
|
||||
+import("//v8/gni/v8.gni")
|
||||
+
|
||||
@@ -192,6 +192,15 @@ index 0000000000000000000000000000000000000000..bd5788caa61305fd9af8f9d7f8f1937a
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+executable("overlapped-checker") {
|
||||
+ sources = []
|
||||
+ if (is_win) {
|
||||
+ sources += [ "test/overlapped-checker/main_win.c" ]
|
||||
+ } else {
|
||||
+ sources += [ "test/overlapped-checker/main_unix.c" ]
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+component("node_lib") {
|
||||
+ deps = [
|
||||
+ ":node_js2c",
|
||||
|
||||
@@ -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_attribute_for_older_msvc_versions.patch
|
||||
fix_build_deprecated_attirbute_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 988c907d964a258bb3184698ad3ccaee18560e2c..90b20e8f1acb304e52a0628c4abee5ffe8665d8e 100644
|
||||
index fec387d31eb5842f4fb0ff617f10b2254c0ee260..2385ccc74d41c10a3f61179f31073062250afcdc 100644
|
||||
--- a/BUILD.gn
|
||||
+++ b/BUILD.gn
|
||||
@@ -605,7 +605,7 @@ config("internal_config") {
|
||||
@@ -606,7 +606,7 @@ config("internal_config") {
|
||||
":cppgc_header_features",
|
||||
]
|
||||
|
||||
@@ -21,7 +21,7 @@ index 988c907d964a258bb3184698ad3ccaee18560e2c..90b20e8f1acb304e52a0628c4abee5ff
|
||||
defines += [ "BUILDING_V8_SHARED" ]
|
||||
}
|
||||
|
||||
@@ -5827,7 +5827,7 @@ if (current_toolchain == v8_generator_toolchain) {
|
||||
@@ -5826,7 +5826,7 @@ if (current_toolchain == v8_generator_toolchain) {
|
||||
"src/interpreter/bytecodes.h",
|
||||
]
|
||||
|
||||
@@ -30,7 +30,7 @@ index 988c907d964a258bb3184698ad3ccaee18560e2c..90b20e8f1acb304e52a0628c4abee5ff
|
||||
|
||||
deps = [
|
||||
":v8_libbase",
|
||||
@@ -5865,6 +5865,8 @@ if (current_toolchain == v8_snapshot_toolchain) {
|
||||
@@ -5864,6 +5864,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 a0ab21d71a378a6bcd5bb0afb111d77d3d9f0c4d..c348999f6a4110c16a539c5e661088db8f7637ed 100644
|
||||
index d22910b209c614162363938accfc86696719ad12..22af6bf24d672817bf620b9411d1b678b7a9800f 100644
|
||||
--- a/src/api/api.cc
|
||||
+++ b/src/api/api.cc
|
||||
@@ -9099,7 +9099,7 @@ void Isolate::SetPromiseRejectCallback(PromiseRejectCallback callback) {
|
||||
@@ -9115,7 +9115,7 @@ void Isolate::SetPromiseRejectCallback(PromiseRejectCallback callback) {
|
||||
}
|
||||
|
||||
void Isolate::PerformMicrotaskCheckpoint() {
|
||||
@@ -19,10 +19,10 @@ index a0ab21d71a378a6bcd5bb0afb111d77d3d9f0c4d..c348999f6a4110c16a539c5e661088db
|
||||
isolate->default_microtask_queue()->PerformCheckpoint(this);
|
||||
}
|
||||
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
|
||||
index 02eefd9e4fdc78e9e3947e3972c10f822ea62e83..b651e60bba9712422b3f4e9b1cfe3a25b4c37337 100644
|
||||
index 509ee8574736261307d9e270b7151197c6988649..00532d4dedf67c0764ca574b40e10ff0ce184762 100644
|
||||
--- a/src/heap/heap.cc
|
||||
+++ b/src/heap/heap.cc
|
||||
@@ -6205,9 +6205,9 @@ void Heap::TearDown() {
|
||||
@@ -6200,9 +6200,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 191748a226e67d61f3678b966be1043259e6acac..4669c2b669044e32d2fe69b3a846675203278a93 100644
|
||||
index 1310890fbec222c0edfda08ec962292d39aca8d1..5ff12eaa98887826b9a962c41f69480ca1d9dd3a 100644
|
||||
--- a/BUILD.gn
|
||||
+++ b/BUILD.gn
|
||||
@@ -605,6 +605,10 @@ config("internal_config") {
|
||||
@@ -606,6 +606,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 90b20e8f1acb304e52a0628c4abee5ffe8665d8e..191748a226e67d61f3678b966be1043259e6acac 100644
|
||||
index 2385ccc74d41c10a3f61179f31073062250afcdc..1310890fbec222c0edfda08ec962292d39aca8d1 100644
|
||||
--- a/BUILD.gn
|
||||
+++ b/BUILD.gn
|
||||
@@ -5839,7 +5839,6 @@ if (current_toolchain == v8_generator_toolchain) {
|
||||
@@ -5838,7 +5838,6 @@ if (current_toolchain == v8_generator_toolchain) {
|
||||
|
||||
if (current_toolchain == v8_snapshot_toolchain) {
|
||||
v8_executable("mksnapshot") {
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
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]] attribute for older msvc versions
|
||||
Subject: fix: usage of c++ [[deprecated]] attirbute for older msvc versions
|
||||
|
||||
This attribute can only be used in all contexts in Visual Studio 2019
|
||||
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.
|
||||
|
||||
diff --git a/include/v8config.h b/include/v8config.h
|
||||
index 77fd65c6c5b7d8c0a7fe7a37c40e17ce66f49ce6..644f921f970d214b4d93b1e4c384e7475740b485 100644
|
||||
index 77fd65c6c5b7d8c0a7fe7a37c40e17ce66f49ce6..010b3633546601ba70a55aeb8e8fc503ef79e2f5 100644
|
||||
--- a/include/v8config.h
|
||||
+++ b/include/v8config.h
|
||||
@@ -454,10 +454,13 @@ path. Add it with -I<path> to the command line
|
||||
@@ -17,7 +20,7 @@ index 77fd65c6c5b7d8c0a7fe7a37c40e17ce66f49ce6..644f921f970d214b4d93b1e4c384e747
|
||||
// A macro (V8_DEPRECATED) to mark classes or functions as deprecated.
|
||||
#if defined(V8_DEPRECATION_WARNINGS)
|
||||
-# define V8_DEPRECATED(message) [[deprecated(message)]]
|
||||
+# if !defined(__clang__) && defined(_MSC_VER) && _MSC_VER < 1920
|
||||
+# if defined(_MSC_VER) && _MSC_VER <= 1900
|
||||
+# define V8_DEPRECATED(message) __declspec(deprecated(message))
|
||||
+# else
|
||||
+# define V8_DEPRECATED(message) [[deprecated(message)]]
|
||||
@@ -25,12 +28,12 @@ index 77fd65c6c5b7d8c0a7fe7a37c40e17ce66f49ce6..644f921f970d214b4d93b1e4c384e747
|
||||
#else
|
||||
# define V8_DEPRECATED(message)
|
||||
#endif
|
||||
@@ -465,13 +468,17 @@ path. Add it with -I<path> to the command line
|
||||
@@ -465,7 +468,11 @@ 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(__clang__) && defined(_MSC_VER) && _MSC_VER < 1920
|
||||
+# if defined(_MSC_VER) && _MSC_VER <= 1900
|
||||
+# define V8_DEPRECATE_SOON(message) __declspec(deprecated(message))
|
||||
+# else
|
||||
+# define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
|
||||
@@ -38,10 +41,3 @@ index 77fd65c6c5b7d8c0a7fe7a37c40e17ce66f49ce6..644f921f970d214b4d93b1e4c384e747
|
||||
#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 dd59d5d6afc7c8e0b309d4e8928cd2bb7e682884..f3445a71aa02683dc40221b2eee1a80071629fef 100644
|
||||
index 7c6dec2b52514085a731f78a551370d54912b5e9..2e8332b9fa6a6a3f55e78f29f710afa02c268b99 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,7 +20,12 @@ let anErrorOccurred = false;
|
||||
function next (done) {
|
||||
const file = files.shift();
|
||||
if (!file) return done();
|
||||
const key = filenameToKey(file);
|
||||
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 [containerName, ...keyPath] = key.split('/');
|
||||
const blobKey = keyPath.join('/');
|
||||
|
||||
@@ -21,6 +21,8 @@ LINUX_BINARIES = [
|
||||
'libGLESv2.so',
|
||||
'libffmpeg.so',
|
||||
'libvk_swiftshader.so',
|
||||
'swiftshader/libEGL.so',
|
||||
'swiftshader/libGLESv2.so',
|
||||
]
|
||||
|
||||
verbose_mode = False
|
||||
@@ -51,6 +53,17 @@ 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
|
||||
|
||||
40
script/lib/s3put.js
Normal file
40
script/lib/s3put.js
Normal file
@@ -0,0 +1,40 @@
|
||||
/* 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
|
||||
from lib.config import is_verbose_mode, s3_config
|
||||
|
||||
ELECTRON_DIR = os.path.abspath(
|
||||
os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
|
||||
@@ -156,9 +156,26 @@ def get_electron_version():
|
||||
return 'v' + f.read().strip()
|
||||
|
||||
def store_artifact(prefix, key_prefix, files):
|
||||
# Azure Storage
|
||||
# Legacy S3 Bucket
|
||||
s3put(prefix, key_prefix, files)
|
||||
# New AZ 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([
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
"async-hooks/test-crypto-randomBytes",
|
||||
"parallel/test-bootstrap-modules",
|
||||
"parallel/test-child-process-fork-exec-path",
|
||||
"parallel/test-child-process-stdio-overlapped",
|
||||
"parallel/test-cli-node-print-help",
|
||||
"parallel/test-cluster-bind-privileged-port",
|
||||
"parallel/test-cluster-shared-handle-bind-privileged-port",
|
||||
|
||||
@@ -55,7 +55,7 @@ const getCustomOptions = () => {
|
||||
async function main () {
|
||||
const options = args.default ? defaultOptions : getCustomOptions();
|
||||
|
||||
const testChild = cp.spawn('python3', options, {
|
||||
const testChild = cp.spawn('python', 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-storage'] = '0';
|
||||
buildRequest.parameters['upload-to-s3'] = '0';
|
||||
} else {
|
||||
buildRequest.parameters['upload-to-storage'] = '1';
|
||||
buildRequest.parameters['upload-to-s3'] = '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_STORAGE = 1;
|
||||
environmentVariables.UPLOAD_TO_S3 = 1;
|
||||
}
|
||||
|
||||
const requestOpts = {
|
||||
|
||||
@@ -1,25 +1,34 @@
|
||||
const got = require('got');
|
||||
const url = require('url');
|
||||
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'
|
||||
});
|
||||
|
||||
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 {
|
||||
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();
|
||||
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);
|
||||
}
|
||||
});
|
||||
});
|
||||
} catch (err) {
|
||||
if (attempts > 1) {
|
||||
console.error('Failed to get URL hash for', targetUrl, 'we will retry', err);
|
||||
|
||||
@@ -78,6 +78,8 @@ 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);
|
||||
}
|
||||
@@ -128,8 +130,9 @@ function assetsForVersion (version, validatingRelease) {
|
||||
`electron-${version}-mas-arm64-dsym-snapshot.zip`,
|
||||
`electron-${version}-mas-arm64-symbols.zip`,
|
||||
`electron-${version}-mas-arm64.zip`,
|
||||
`electron-${version}-win32-ia32-pdb.zip`,
|
||||
`electron-${version}-win32-ia32-symbols.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.zip`,
|
||||
`electron-${version}-win32-x64-pdb.zip`,
|
||||
`electron-${version}-win32-x64-symbols.zip`,
|
||||
@@ -192,6 +195,15 @@ 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, 'headers/dist', [index_json])
|
||||
store_artifact(OUT_DIR, 'atom-shell/dist', [index_json])
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
@@ -29,7 +29,7 @@ def main():
|
||||
]
|
||||
|
||||
if args.target_dir is None:
|
||||
store_artifact(directory, 'headers/dist/{0}'.format(args.version),
|
||||
store_artifact(directory, 'atom-shell/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, 'headers/dist/{0}'.format(version),
|
||||
store_artifact(GEN_DIR, 'atom-shell/dist/{0}'.format(version),
|
||||
glob.glob('node-*.tar.gz'))
|
||||
store_artifact(GEN_DIR, 'headers/dist/{0}'.format(version),
|
||||
store_artifact(GEN_DIR, 'atom-shell/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, 'headers/dist/{0}'.format(version), [node_lib])
|
||||
store_artifact(DIST_DIR, 'atom-shell/dist/{0}'.format(version), [node_lib])
|
||||
|
||||
# Upload the iojs.lib.
|
||||
store_artifact(DIST_DIR, 'headers/dist/{0}'.format(version), [iojs_lib])
|
||||
store_artifact(DIST_DIR, 'atom-shell/dist/{0}'.format(version), [iojs_lib])
|
||||
|
||||
# Upload the v4 node.lib.
|
||||
store_artifact(DIST_DIR, 'headers/dist/{0}'.format(version),
|
||||
store_artifact(DIST_DIR, 'atom-shell/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 symbols/:symbol_name/:hash/:symbol
|
||||
# The file upload needs to be atom-shell/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, 'symbols',
|
||||
store_artifact(SYMBOLS_DIR, 'atom-shell/symbols',
|
||||
files)
|
||||
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ def main():
|
||||
args = parse_args()
|
||||
if args.verbose:
|
||||
enable_verbose_mode()
|
||||
if args.upload_to_storage:
|
||||
if args.upload_to_s3:
|
||||
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_storage:
|
||||
if not args.upload_to_s3:
|
||||
assert release['exists'], \
|
||||
'Release does not exist; cannot upload to GitHub!'
|
||||
assert tag_exists == args.overwrite, \
|
||||
@@ -76,9 +76,10 @@ def main():
|
||||
shutil.copy2(os.path.join(OUT_DIR, 'dist.zip'), electron_zip)
|
||||
upload_electron(release, electron_zip, args)
|
||||
if get_target_arch() != 'mips64el':
|
||||
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 (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)
|
||||
if PLATFORM == 'darwin':
|
||||
if get_platform_key() == 'darwin' and get_target_arch() == 'x64':
|
||||
api_path = os.path.join(ELECTRON_DIR, 'electron-api.json')
|
||||
@@ -95,9 +96,10 @@ 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':
|
||||
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)
|
||||
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)
|
||||
elif PLATFORM == 'linux':
|
||||
debug_zip = os.path.join(OUT_DIR, DEBUG_NAME)
|
||||
shutil.copy2(os.path.join(OUT_DIR, 'debug.zip'), debug_zip)
|
||||
@@ -146,7 +148,7 @@ def main():
|
||||
OUT_DIR, 'hunspell_dictionaries.zip')
|
||||
upload_electron(release, hunspell_dictionaries_zip, args)
|
||||
|
||||
if not tag_exists and not args.upload_to_storage:
|
||||
if not tag_exists and not args.upload_to_s3:
|
||||
# Upload symbols to symbol server.
|
||||
run_python_upload_script('upload-symbols.py')
|
||||
if PLATFORM == 'win32':
|
||||
@@ -172,9 +174,9 @@ def parse_args():
|
||||
parser.add_argument('-p', '--publish-release',
|
||||
help='Publish the release',
|
||||
action='store_true')
|
||||
parser.add_argument('-s', '--upload_to_storage',
|
||||
help='Upload assets to azure bucket',
|
||||
dest='upload_to_storage',
|
||||
parser.add_argument('-s', '--upload_to_s3',
|
||||
help='Upload assets to s3 bucket',
|
||||
dest='upload_to_s3',
|
||||
action='store_true',
|
||||
default=False,
|
||||
required=False)
|
||||
@@ -228,7 +230,7 @@ def _zero_zip_date_time(zip_):
|
||||
ZIP64_EXTRA_HEADER = 0x0001
|
||||
zip64_extra_struct = Struct("<HHQQ")
|
||||
# ZIP64.
|
||||
# When a ZIP64 extra field is present his 8byte length
|
||||
# When a ZIP64 extra field is present this 8byte length
|
||||
# will override the 4byte length defined in canonical zips.
|
||||
# This is in the form:
|
||||
# - 0x0001 (header_id)
|
||||
@@ -340,10 +342,9 @@ def upload_electron(release, file_path, args):
|
||||
except NonZipFileError:
|
||||
pass
|
||||
|
||||
# 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,
|
||||
# if upload_to_s3 is set, skip github upload.
|
||||
if args.upload_to_s3:
|
||||
key_prefix = 'electron-artifacts/{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)
|
||||
@@ -368,7 +369,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 = 'checksums-scratchpad/{0}'.format(version)
|
||||
key_prefix = 'atom-shell/tmp/{0}'.format(version)
|
||||
sha256 = hashlib.sha256()
|
||||
with open(file_path, 'rb') as f:
|
||||
sha256.update(f.read())
|
||||
|
||||
@@ -14,3 +14,4 @@ const handleTerminationSignal = (signal) =>
|
||||
|
||||
handleTerminationSignal('SIGINT');
|
||||
handleTerminationSignal('SIGTERM');
|
||||
handleTerminationSignal('SIGUSR2');
|
||||
|
||||
@@ -69,6 +69,8 @@ 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,6 +69,8 @@ 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,6 +69,8 @@ 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,6 +69,8 @@ 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,6 +65,8 @@ 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,6 +66,8 @@ 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,6 +66,8 @@ 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
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user