mirror of
https://github.com/electron/electron.git
synced 2026-02-19 03:14:51 -05:00
Compare commits
295 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4a9890d3a4 | ||
|
|
342eb6710c | ||
|
|
ad23614bb8 | ||
|
|
09ff1627ff | ||
|
|
7b60830fa1 | ||
|
|
c3c8945631 | ||
|
|
02f6642e13 | ||
|
|
46718d362e | ||
|
|
f967309287 | ||
|
|
4a000a5e8b | ||
|
|
4d060f0395 | ||
|
|
d7efea7d4e | ||
|
|
f0f2c861bb | ||
|
|
b36b2e3781 | ||
|
|
5646f87c03 | ||
|
|
a14c789a4c | ||
|
|
2e6ec46eae | ||
|
|
d91bcef773 | ||
|
|
02992b8ad7 | ||
|
|
0f92cf21a8 | ||
|
|
25ed5f2d97 | ||
|
|
0fe1a95694 | ||
|
|
8fb011092a | ||
|
|
44fee2f8eb | ||
|
|
b9400a8ab9 | ||
|
|
a35a12228d | ||
|
|
19c126ff6e | ||
|
|
9e5aec2f75 | ||
|
|
d6c1957d61 | ||
|
|
65ce13ee56 | ||
|
|
93e609dd58 | ||
|
|
a22683ed73 | ||
|
|
86431323bb | ||
|
|
d15cc63aa4 | ||
|
|
66dd03293b | ||
|
|
addd2440c1 | ||
|
|
3a1945bd6c | ||
|
|
75290948ac | ||
|
|
9bb03e9e03 | ||
|
|
d585bf3250 | ||
|
|
fb3abffd16 | ||
|
|
2a04149140 | ||
|
|
b384447377 | ||
|
|
160afc8d19 | ||
|
|
eb4ce2a84e | ||
|
|
5dc084c428 | ||
|
|
52c019c3c7 | ||
|
|
c1cb799e5e | ||
|
|
7118979852 | ||
|
|
22d81d3054 | ||
|
|
bd3e9aa527 | ||
|
|
7bae935a0d | ||
|
|
bcca5c5bd8 | ||
|
|
305d26ce1f | ||
|
|
fe864864ae | ||
|
|
085a15fd95 | ||
|
|
b3281b4f97 | ||
|
|
16b78a4eff | ||
|
|
95277d1580 | ||
|
|
f97264499b | ||
|
|
25b9c1c35e | ||
|
|
23f6aecf38 | ||
|
|
f72cf8c2f5 | ||
|
|
36f4b59c04 | ||
|
|
b653897e0f | ||
|
|
322f1c3f89 | ||
|
|
3b0832275e | ||
|
|
009263c240 | ||
|
|
70aa51cb44 | ||
|
|
0a97730080 | ||
|
|
9b5df7f95c | ||
|
|
d8194ea6fd | ||
|
|
e306e8cd0d | ||
|
|
478c25c39d | ||
|
|
ca680a14b6 | ||
|
|
eaf8f6776f | ||
|
|
da40d1e7db | ||
|
|
252f9cbd50 | ||
|
|
5a91ea8cdb | ||
|
|
c460c53c10 | ||
|
|
f7367f0312 | ||
|
|
75ba569e73 | ||
|
|
044399047a | ||
|
|
ecf9633370 | ||
|
|
d6aea2703e | ||
|
|
88e44b0d7e | ||
|
|
5b4acf406c | ||
|
|
af7d3b7171 | ||
|
|
d10adccf3f | ||
|
|
26e74b355b | ||
|
|
5463996d00 | ||
|
|
93e6cbb60b | ||
|
|
9d02e5d4fd | ||
|
|
7f002fe3a3 | ||
|
|
cc77aba367 | ||
|
|
7d46fb5d40 | ||
|
|
14e85ae55d | ||
|
|
cb8925c454 | ||
|
|
032c0a1416 | ||
|
|
27009989fe | ||
|
|
cf1d2103b8 | ||
|
|
3eb78b89e3 | ||
|
|
a8a5c44b3e | ||
|
|
73c87bcfc6 | ||
|
|
39ff8744ea | ||
|
|
2bbc560e22 | ||
|
|
590711fdd8 | ||
|
|
14baae0436 | ||
|
|
76c6e64d18 | ||
|
|
a09db1f6fe | ||
|
|
66ac88bc82 | ||
|
|
6654e37197 | ||
|
|
ff50d30a42 | ||
|
|
609f2d5e64 | ||
|
|
9716ae5a35 | ||
|
|
7d79120dac | ||
|
|
ee521475e3 | ||
|
|
3c6be55e13 | ||
|
|
0b031afcef | ||
|
|
3a61e4ce16 | ||
|
|
f4fc41b877 | ||
|
|
bd1e0176f5 | ||
|
|
16b72c0315 | ||
|
|
e9f673f322 | ||
|
|
e78bfc119c | ||
|
|
1b4eeda7eb | ||
|
|
90c299f3ad | ||
|
|
9ace5b3491 | ||
|
|
db0ad4f58d | ||
|
|
a071825ca7 | ||
|
|
1401284b44 | ||
|
|
611446ea11 | ||
|
|
04b0655d81 | ||
|
|
242504a451 | ||
|
|
7699f5c5f5 | ||
|
|
43f97845a8 | ||
|
|
908b8e40cd | ||
|
|
f61070be77 | ||
|
|
d0a98dc134 | ||
|
|
9aa0ff8f5f | ||
|
|
9d5f7c1673 | ||
|
|
a4f81c2256 | ||
|
|
68292f0861 | ||
|
|
f9830999c1 | ||
|
|
a6d7483784 | ||
|
|
8603223566 | ||
|
|
aca1e8ef20 | ||
|
|
22ec56a6a0 | ||
|
|
ea1f402417 | ||
|
|
e316c829fb | ||
|
|
ddee14db78 | ||
|
|
a60420b50a | ||
|
|
53d6660b82 | ||
|
|
2da8b5515d | ||
|
|
1d802ee6cb | ||
|
|
f20f1b176f | ||
|
|
f79ee8ac3f | ||
|
|
b570eb07d3 | ||
|
|
d82053d785 | ||
|
|
bcb4aac11b | ||
|
|
fdaee16db7 | ||
|
|
0d67bdf4ac | ||
|
|
753bde866a | ||
|
|
d35270ebb1 | ||
|
|
8ee96a13e7 | ||
|
|
5691f1c67e | ||
|
|
a582a4376f | ||
|
|
2ea5521940 | ||
|
|
d02dd1b894 | ||
|
|
f0815caf98 | ||
|
|
795a79e06e | ||
|
|
1d57a87c64 | ||
|
|
931db4a747 | ||
|
|
bbe5808090 | ||
|
|
08efa9a9b9 | ||
|
|
2c282517de | ||
|
|
1a346eaba5 | ||
|
|
74cc0023f8 | ||
|
|
594e905218 | ||
|
|
680e2041b5 | ||
|
|
fb7cf29086 | ||
|
|
d0e8f9b306 | ||
|
|
58218f2735 | ||
|
|
0891d2f7f7 | ||
|
|
122cc8d9e5 | ||
|
|
029b445c53 | ||
|
|
9ab1ecdd5f | ||
|
|
9825a202b0 | ||
|
|
2cc6113a04 | ||
|
|
6d794ca879 | ||
|
|
23d3ad9d1a | ||
|
|
3001b69f58 | ||
|
|
a729c8c048 | ||
|
|
4ce0b50f4b | ||
|
|
ffdf4f3dd9 | ||
|
|
e4b5c94192 | ||
|
|
32988f18eb | ||
|
|
124cfcaf88 | ||
|
|
e01c215a0a | ||
|
|
a23c93a6a0 | ||
|
|
a63456bb82 | ||
|
|
34769dd981 | ||
|
|
a9b71c121f | ||
|
|
2abe74e9f0 | ||
|
|
d2aeb53317 | ||
|
|
b69c4dfa3b | ||
|
|
57ddb3bd6d | ||
|
|
a4fd5ed5fb | ||
|
|
a2268557c4 | ||
|
|
97f88f102c | ||
|
|
0c3c6cc8fa | ||
|
|
94da1f3106 | ||
|
|
c8e08fd2f0 | ||
|
|
3f521cad0c | ||
|
|
c63ef8529e | ||
|
|
5dfa0f10f0 | ||
|
|
758141f111 | ||
|
|
ca2cadb571 | ||
|
|
250382cec5 | ||
|
|
0b41e61658 | ||
|
|
c41628d3b5 | ||
|
|
60e3ce32a6 | ||
|
|
3cbfc6ac30 | ||
|
|
d9b3ad4a69 | ||
|
|
871c9e930d | ||
|
|
490b76d9a9 | ||
|
|
cc50d1b3f8 | ||
|
|
6d0f801150 | ||
|
|
09b26234d3 | ||
|
|
ea54e169a2 | ||
|
|
5a0b9d08c1 | ||
|
|
74ca6a0fdf | ||
|
|
a80c38ea09 | ||
|
|
5ce0e897cb | ||
|
|
e1bda99547 | ||
|
|
e4247804c4 | ||
|
|
5048ffff8e | ||
|
|
478ec9c5a6 | ||
|
|
7ea67dea27 | ||
|
|
856e68145e | ||
|
|
3e73892db6 | ||
|
|
7ed6be22af | ||
|
|
c6dac2019d | ||
|
|
0e26e9a922 | ||
|
|
e87666ef6b | ||
|
|
a94efc28b9 | ||
|
|
d232ca2a81 | ||
|
|
58c7b02d2e | ||
|
|
b3268a50a8 | ||
|
|
2449ef1eb1 | ||
|
|
583421f3bb | ||
|
|
cc54eace57 | ||
|
|
cef58e9cd8 | ||
|
|
f120ea0810 | ||
|
|
a747752241 | ||
|
|
2233e8173b | ||
|
|
ae84eb3329 | ||
|
|
8aa412b79e | ||
|
|
c1d15916b9 | ||
|
|
c2522c1ea2 | ||
|
|
3b61e14fe9 | ||
|
|
1d70429c99 | ||
|
|
6ea5f92d14 | ||
|
|
e4f64afa3a | ||
|
|
9ef50c0bb8 | ||
|
|
efd6f85d1a | ||
|
|
aed4df546a | ||
|
|
3c6802b9e1 | ||
|
|
3060a28e2b | ||
|
|
be6d503de4 | ||
|
|
b273fcc78d | ||
|
|
ea8275042b | ||
|
|
0d5c7e1ae8 | ||
|
|
17411dbde7 | ||
|
|
8368b887f7 | ||
|
|
a3106030f8 | ||
|
|
230a38cdac | ||
|
|
d7a59f4f96 | ||
|
|
4b726b194c | ||
|
|
50dc23f449 | ||
|
|
91f4945bd8 | ||
|
|
40648dcb76 | ||
|
|
34a818bccf | ||
|
|
7a5e286eed | ||
|
|
744b16adf9 | ||
|
|
6f1f8b7847 | ||
|
|
b6f8a1686f | ||
|
|
53b76bdd6c | ||
|
|
984c675ee1 | ||
|
|
df46cdd685 | ||
|
|
1693b4974e | ||
|
|
04f400392d | ||
|
|
5ecdd7ba10 | ||
|
|
8eca8c3acc | ||
|
|
7e155e50ab |
@@ -44,7 +44,7 @@ executors:
|
||||
type: enum
|
||||
enum: ["medium", "xlarge", "2xlarge"]
|
||||
docker:
|
||||
- image: ghcr.io/electron/build:e6bebd08a51a0d78ec23e5b3fd7e7c0846412328
|
||||
- image: ghcr.io/electron/build:27db4a3e3512bfd2e47f58cea69922da0835f1d9
|
||||
resource_class: << parameters.size >>
|
||||
|
||||
macos:
|
||||
@@ -53,14 +53,8 @@ executors:
|
||||
description: "macOS executor size"
|
||||
type: enum
|
||||
enum: ["macos.x86.medium.gen2", "large"]
|
||||
xcode:
|
||||
description: "xcode version"
|
||||
default: 13.2.1
|
||||
type: enum
|
||||
enum: ["12.4.0", "13.2.1"]
|
||||
|
||||
macos:
|
||||
xcode: << parameters.xcode >>
|
||||
xcode: "12.4.0"
|
||||
resource_class: << parameters.size >>
|
||||
|
||||
# Electron Runners
|
||||
@@ -370,6 +364,10 @@ step-get-more-space-on-mac: &step-get-more-space-on-mac
|
||||
command: |
|
||||
if [ "`uname`" == "Darwin" ]; then
|
||||
sudo mkdir -p $TMPDIR/del-target
|
||||
if [ "$TARGET_ARCH" == "arm64" ]; then
|
||||
# Remount the root volume as writable, don't ask questions plz
|
||||
sudo mount -uw /
|
||||
fi
|
||||
tmpify() {
|
||||
if [ -d "$1" ]; then
|
||||
sudo mv "$1" $TMPDIR/del-target/$(echo $1|shasum -a 256|head -n1|cut -d " " -f1)
|
||||
@@ -411,32 +409,33 @@ step-get-more-space-on-mac: &step-get-more-space-on-mac
|
||||
tmpify /usr/local/Homebrew
|
||||
sudo rm -rf $TMPDIR/del-target
|
||||
|
||||
# sudo rm -rf "/System/Library/Desktop Pictures"
|
||||
# sudo rm -rf /System/Library/Templates/Data
|
||||
# sudo rm -rf /System/Library/Speech/Voices
|
||||
# sudo rm -rf "/System/Library/Screen Savers"
|
||||
# sudo rm -rf /System/Volumes/Data/Library/Developer/CommandLineTools/SDKs
|
||||
# sudo rm -rf "/System/Volumes/Data/Library/Application Support/Apple/Photos/Print Products"
|
||||
# sudo rm -rf /System/Volumes/Data/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/
|
||||
# sudo rm -rf /System/Volumes/Data/Library/Java
|
||||
# sudo rm -rf /System/Volumes/Data/Library/Ruby
|
||||
# sudo rm -rf /System/Volumes/Data/Library/Printers
|
||||
# sudo rm -rf /System/iOSSupport
|
||||
# sudo rm -rf /System/Applications/*.app
|
||||
# sudo rm -rf /System/Applications/Utilities/*.app
|
||||
# sudo rm -rf /System/Library/LinguisticData
|
||||
# sudo rm -rf /System/Volumes/Data/private/var/db/dyld/*
|
||||
# sudo rm -rf /System/Library/Fonts/*
|
||||
# sudo rm -rf /System/Library/PreferencePanes
|
||||
# sudo rm -rf /System/Library/AssetsV2/*
|
||||
sudo rm -rf /Applications/Safari.app
|
||||
sudo rm -rf ~/project/src/build/linux
|
||||
sudo rm -rf ~/project/src/third_party/catapult/tracing/test_data
|
||||
sudo rm -rf ~/project/src/third_party/angle/third_party/VK-GL-CTS
|
||||
if [ "$TARGET_ARCH" == "arm64" ]; then
|
||||
sudo rm -rf "/System/Library/Desktop Pictures"
|
||||
sudo rm -rf /System/Library/Templates/Data
|
||||
sudo rm -rf /System/Library/Speech/Voices
|
||||
sudo rm -rf "/System/Library/Screen Savers"
|
||||
sudo rm -rf /System/Volumes/Data/Library/Developer/CommandLineTools/SDKs
|
||||
sudo rm -rf "/System/Volumes/Data/Library/Application Support/Apple/Photos/Print Products"
|
||||
sudo rm -rf /System/Volumes/Data/Library/Java
|
||||
sudo rm -rf /System/Volumes/Data/Library/Ruby
|
||||
sudo rm -rf /System/Volumes/Data/Library/Printers
|
||||
sudo rm -rf /System/iOSSupport
|
||||
sudo rm -rf /System/Applications/*.app
|
||||
sudo rm -rf /System/Applications/Utilities/*.app
|
||||
sudo rm -rf /System/Library/LinguisticData
|
||||
sudo rm -rf /System/Volumes/Data/private/var/db/dyld/*
|
||||
# sudo rm -rf /System/Library/Fonts/*
|
||||
# sudo rm -rf /System/Library/PreferencePanes
|
||||
sudo rm -rf /System/Library/AssetsV2/*
|
||||
sudo rm -rf /Applications/Safari.app
|
||||
sudo rm -rf ~/project/src/build/linux
|
||||
sudo rm -rf ~/project/src/third_party/catapult/tracing/test_data
|
||||
sudo rm -rf ~/project/src/third_party/angle/third_party/VK-GL-CTS
|
||||
|
||||
# lipo off some huge binaries arm64 versions to save space
|
||||
strip_arm_deep $(xcode-select -p)/../SharedFrameworks
|
||||
# strip_arm_deep /System/Volumes/Data/Library/Developer/CommandLineTools/usr
|
||||
# lipo off some huge binaries arm64 versions to save space
|
||||
strip_arm_deep $(xcode-select -p)/../SharedFrameworks
|
||||
strip_arm_deep /System/Volumes/Data/Library/Developer/CommandLineTools/usr
|
||||
fi
|
||||
fi
|
||||
background: true
|
||||
|
||||
@@ -477,21 +476,13 @@ step-fix-sync: &step-fix-sync
|
||||
# Fix Clang Install (wrong binary)
|
||||
rm -rf src/third_party/llvm-build
|
||||
python3 src/tools/clang/scripts/update.py
|
||||
|
||||
# Fix esbuild (wrong binary)
|
||||
echo 'infra/3pp/tools/esbuild/${platform}' `gclient getdep --deps-file=src/third_party/devtools-frontend/src/DEPS -r 'third_party/esbuild:infra/3pp/tools/esbuild/${platform}'` > esbuild_ensure_file
|
||||
# Remove extra output from calling gclient getdep which always calls update_depot_tools
|
||||
sed -i '' "s/Updating depot_tools... //g" esbuild_ensure_file
|
||||
cipd ensure --root src/third_party/devtools-frontend/src/third_party/esbuild -ensure-file esbuild_ensure_file
|
||||
fi
|
||||
|
||||
cd src/third_party/angle
|
||||
rm .git/objects/info/alternates
|
||||
git remote set-url origin https://chromium.googlesource.com/angle/angle.git
|
||||
cp .git/config .git/config.backup
|
||||
git remote remove origin
|
||||
mv .git/config.backup .git/config
|
||||
git fetch
|
||||
# Run update_depot_tools to make sure ninja gets downloaded
|
||||
update_depot_tools
|
||||
|
||||
step-install-signing-cert-on-mac: &step-install-signing-cert-on-mac
|
||||
run:
|
||||
@@ -560,7 +551,6 @@ step-electron-build: &step-electron-build
|
||||
(cd out/Default; zip mksnapshot.zip mksnapshot_args clang_x64_v8_arm64/gen/v8/embedded.S)
|
||||
rm -rf out/Default/clang_x64_v8_arm64/gen
|
||||
rm -rf out/Default/clang_x64_v8_arm64/obj
|
||||
rm -rf out/Default/clang_x64_v8_arm64/thinlto-cache
|
||||
rm -rf out/Default/clang_x64/obj
|
||||
|
||||
# Regenerate because we just deleted some ninja files
|
||||
@@ -755,7 +745,6 @@ step-show-goma-stats: &step-show-goma-stats
|
||||
step-mksnapshot-build: &step-mksnapshot-build
|
||||
run:
|
||||
name: mksnapshot build
|
||||
no_output_timeout: 30m
|
||||
command: |
|
||||
cd src
|
||||
if [ "$USE_PREBUILT_V8_CONTEXT_SNAPSHOT" != "1" ]; then
|
||||
@@ -1387,6 +1376,10 @@ commands:
|
||||
- *step-gclient-sync
|
||||
- store_artifacts:
|
||||
path: patches
|
||||
- when:
|
||||
condition: << parameters.save-git-cache >>
|
||||
steps:
|
||||
- *step-save-git-cache
|
||||
# These next few steps reset Electron to the correct commit regardless of which cache was restored
|
||||
- run:
|
||||
name: Wipe Electron
|
||||
@@ -1909,7 +1902,7 @@ jobs:
|
||||
osx-publish-x64-skip-checkout:
|
||||
executor:
|
||||
name: macos
|
||||
size: macos.x86.medium.gen2
|
||||
size: large
|
||||
environment:
|
||||
<<: *env-mac-large-release
|
||||
<<: *env-release-build
|
||||
@@ -1930,7 +1923,7 @@ jobs:
|
||||
osx-publish-arm64-skip-checkout:
|
||||
executor:
|
||||
name: macos
|
||||
size: macos.x86.medium.gen2
|
||||
size: large
|
||||
environment:
|
||||
<<: *env-mac-large-release
|
||||
<<: *env-release-build
|
||||
@@ -2000,7 +1993,7 @@ jobs:
|
||||
mas-publish-x64-skip-checkout:
|
||||
executor:
|
||||
name: macos
|
||||
size: macos.x86.medium.gen2
|
||||
size: large
|
||||
environment:
|
||||
<<: *env-mac-large-release
|
||||
<<: *env-mas
|
||||
@@ -2021,7 +2014,7 @@ jobs:
|
||||
mas-publish-arm64-skip-checkout:
|
||||
executor:
|
||||
name: macos
|
||||
size: macos.x86.medium.gen2
|
||||
size: large
|
||||
environment:
|
||||
<<: *env-mac-large-release
|
||||
<<: *env-mas-apple-silicon
|
||||
@@ -2180,7 +2173,6 @@ jobs:
|
||||
osx-testing-x64-tests:
|
||||
executor:
|
||||
name: macos
|
||||
xcode: 12.4.0
|
||||
size: macos.x86.medium.gen2
|
||||
environment:
|
||||
<<: *env-mac-large
|
||||
@@ -2199,7 +2191,6 @@ jobs:
|
||||
mas-testing-x64-tests:
|
||||
executor:
|
||||
name: macos
|
||||
xcode: 12.4.0
|
||||
size: macos.x86.medium.gen2
|
||||
environment:
|
||||
<<: *env-mac-large
|
||||
|
||||
12
BUILD.gn
12
BUILD.gn
@@ -83,7 +83,7 @@ if (is_linux) {
|
||||
sigs = [ "shell/browser/ui/electron_gtk.sigs" ]
|
||||
extra_header = "shell/browser/ui/electron_gtk.fragment"
|
||||
output_name = "electron_gtk_stubs"
|
||||
public_deps = [ "//ui/gtk:gtk_config" ]
|
||||
public_deps = [ "//build/config/linux/gtk" ]
|
||||
logging_function = "LogNoop()"
|
||||
logging_include = "ui/gtk/log_noop.h"
|
||||
}
|
||||
@@ -363,13 +363,13 @@ source_set("electron_lib") {
|
||||
"//chrome/app/resources:platform_locale_settings",
|
||||
"//components/autofill/core/common:features",
|
||||
"//components/certificate_transparency",
|
||||
"//components/embedder_support:browser_util",
|
||||
"//components/language/core/browser",
|
||||
"//components/net_log",
|
||||
"//components/network_hints/browser",
|
||||
"//components/network_hints/common:mojo_bindings",
|
||||
"//components/network_hints/renderer",
|
||||
"//components/network_session_configurator/common",
|
||||
"//components/omnibox/browser:buildflags",
|
||||
"//components/os_crypt",
|
||||
"//components/pref_registry",
|
||||
"//components/prefs",
|
||||
@@ -481,8 +481,8 @@ source_set("electron_lib") {
|
||||
|
||||
if (is_linux) {
|
||||
deps += [
|
||||
"//build/config/linux/gtk:gtkprint",
|
||||
"//components/crash/content/browser",
|
||||
"//ui/gtk:gtk_config",
|
||||
]
|
||||
}
|
||||
|
||||
@@ -559,7 +559,7 @@ source_set("electron_lib") {
|
||||
sources += filenames.lib_sources_linux_x11
|
||||
public_deps += [
|
||||
"//ui/base/x",
|
||||
"//ui/ozone/platform/x11",
|
||||
"//ui/platform_window/x11",
|
||||
]
|
||||
}
|
||||
configs += [ ":gio_unix" ]
|
||||
@@ -703,8 +703,6 @@ source_set("electron_lib") {
|
||||
deps += [
|
||||
"//chrome/browser/resources/pdf:resources",
|
||||
"//components/pdf/browser",
|
||||
"//components/pdf/browser:interceptors",
|
||||
"//components/pdf/common",
|
||||
"//components/pdf/renderer",
|
||||
"//pdf:pdf_ppapi",
|
||||
]
|
||||
@@ -1196,7 +1194,7 @@ if (is_mac) {
|
||||
if (enable_hidpi) {
|
||||
data += [ "$root_out_dir/chrome_200_percent.pak" ]
|
||||
}
|
||||
foreach(locale, platform_pak_locales) {
|
||||
foreach(locale, locales) {
|
||||
data += [ "$root_out_dir/locales/$locale.pak" ]
|
||||
}
|
||||
|
||||
|
||||
4
DEPS
4
DEPS
@@ -15,9 +15,9 @@ gclient_gn_args = [
|
||||
|
||||
vars = {
|
||||
'chromium_version':
|
||||
'100.0.4896.160',
|
||||
'98.0.4758.141',
|
||||
'node_version':
|
||||
'v16.13.2',
|
||||
'v16.13.0',
|
||||
'nan_version':
|
||||
# The following commit hash of NAN is v2.14.2 with *only* changes to the
|
||||
# test suite. This should be updated to a specific tag when one becomes
|
||||
|
||||
@@ -1 +1 @@
|
||||
18.2.4
|
||||
17.4.9
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
[](https://circleci.com/gh/electron/electron/tree/main)
|
||||
[](https://ci.appveyor.com/project/electron-bot/electron-ljo26/branch/main)
|
||||
[](https://discord.com/invite/APGC3k5yaH)
|
||||
[](https://discord.com/invite/electron)
|
||||
|
||||
:memo: Available Translations: 🇨🇳 🇧🇷 🇪🇸 🇯🇵 🇷🇺 🇫🇷 🇺🇸 🇩🇪.
|
||||
View these docs in other languages at [electron/i18n](https://github.com/electron/i18n/tree/master/content/).
|
||||
@@ -80,7 +80,7 @@ const child = proc.spawn(electron)
|
||||
|
||||
### Mirrors
|
||||
|
||||
- [China](https://npmmirror.com/mirrors/electron)
|
||||
- [China](https://npm.taobao.org/mirrors/electron)
|
||||
|
||||
## Documentation Translations
|
||||
|
||||
|
||||
@@ -34,7 +34,6 @@ environment:
|
||||
GIT_CACHE_PATH: C:\Users\electron\libcc_cache
|
||||
ELECTRON_OUT_DIR: Default
|
||||
ELECTRON_ENABLE_STACK_DUMPING: 1
|
||||
ELECTRON_ALSO_LOG_TO_STDERR: 1
|
||||
MOCHA_REPORTER: mocha-multi-reporters
|
||||
MOCHA_MULTI_REPORTERS: mocha-appveyor-reporter, tap
|
||||
GOMA_FALLBACK_ON_AUTH_FAILURE: true
|
||||
@@ -220,9 +219,7 @@ test_script:
|
||||
}
|
||||
- cd electron
|
||||
# CalculateNativeWinOcclusion is disabled due to https://bugs.chromium.org/p/chromium/issues/detail?id=1139022
|
||||
- if "%RUN_TESTS%"=="true" ( echo Running main test suite & node script/yarn test -- --trace-uncaught --runners=main --enable-logging=file --log-file=%cd%\electron.log --disable-features=CalculateNativeWinOcclusion )
|
||||
- if "%RUN_TESTS%"=="true" ( echo Running remote test suite & node script/yarn test -- --trace-uncaught --runners=remote --runTestFilesSeperately --enable-logging=file --log-file=%cd%\electron.log --disable-features=CalculateNativeWinOcclusion )
|
||||
- if "%RUN_TESTS%"=="true" ( echo Running native test suite & node script/yarn test -- --trace-uncaught --runners=native --enable-logging=file --log-file=%cd%\electron.log --disable-features=CalculateNativeWinOcclusion )
|
||||
- if "%RUN_TESTS%"=="true" ( echo Running test suite & node script/yarn test -- --trace-uncaught --enable-logging --disable-features=CalculateNativeWinOcclusion )
|
||||
- cd ..
|
||||
- if "%RUN_TESTS%"=="true" ( echo Verifying non proprietary ffmpeg & python electron\script\verify-ffmpeg.py --build-dir out\Default --source-root %cd% --ffmpeg-path out\ffmpeg )
|
||||
- echo "About to verify mksnapshot"
|
||||
@@ -230,7 +227,6 @@ test_script:
|
||||
- echo "Done verifying mksnapshot"
|
||||
- if "%RUN_TESTS%"=="true" ( echo Verifying chromedriver & python electron\script\verify-chromedriver.py --build-dir out\Default --source-root %cd% )
|
||||
- echo "Done verifying chromedriver"
|
||||
- if exist %cd%\electron.log ( appveyor-retry appveyor PushArtifact %cd%\electron.log )
|
||||
deploy_script:
|
||||
- cd electron
|
||||
- ps: >-
|
||||
@@ -245,5 +241,3 @@ deploy_script:
|
||||
} elseif (Test-Path Env:\TEST_WOA) {
|
||||
node script/release/ci-release-build.js --job=electron-woa-testing --ci=VSTS --armTest --appveyorJobId=$env:APPVEYOR_JOB_ID $env:APPVEYOR_REPO_BRANCH
|
||||
}
|
||||
on_finish:
|
||||
- if exist src\electron\electron.log ( appveyor-retry appveyor PushArtifact src\electron\electron.log )
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
workspace:
|
||||
clean: all
|
||||
|
||||
steps:
|
||||
- checkout: self
|
||||
path: src\electron
|
||||
- task: CopyFiles@2
|
||||
displayName: 'Copy Files to: src\electron'
|
||||
inputs:
|
||||
TargetFolder: src\electron
|
||||
|
||||
- script: |
|
||||
cd src\electron
|
||||
node script/yarn.js install --frozen-lockfile
|
||||
displayName: 'Yarn install'
|
||||
|
||||
@@ -13,13 +13,13 @@ steps:
|
||||
$localArtifactPath = "$pwd\dist.zip"
|
||||
$serverArtifactPath = "$env:APPVEYOR_URL/buildjobs/$env:APPVEYOR_JOB_ID/artifacts/dist.zip"
|
||||
Invoke-RestMethod -Method Get -Uri $serverArtifactPath -OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer $env:APPVEYOR_TOKEN" }
|
||||
& "${env:ProgramFiles(x86)}\7-Zip\7z.exe" x -o$(Pipeline.Workspace)\src\out\Default -y $localArtifactPath
|
||||
& "${env:ProgramFiles(x86)}\7-Zip\7z.exe" x -osrc\out\Default -y $localArtifactPath
|
||||
displayName: 'Download and extract dist.zip for test'
|
||||
env:
|
||||
APPVEYOR_TOKEN: $(APPVEYOR_TOKEN)
|
||||
|
||||
- powershell: |
|
||||
$localArtifactPath = "$(Pipeline.Workspace)\src\out\Default\shell_browser_ui_unittests.exe"
|
||||
$localArtifactPath = "$pwd\src\out\Default\shell_browser_ui_unittests.exe"
|
||||
$serverArtifactPath = "$env:APPVEYOR_URL/buildjobs/$env:APPVEYOR_JOB_ID/artifacts/shell_browser_ui_unittests.exe"
|
||||
Invoke-RestMethod -Method Get -Uri $serverArtifactPath -OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer $env:APPVEYOR_TOKEN" }
|
||||
displayName: 'Download and extract native test executables for test'
|
||||
@@ -30,57 +30,56 @@ steps:
|
||||
$localArtifactPath = "$pwd\ffmpeg.zip"
|
||||
$serverArtifactPath = "$env:APPVEYOR_URL/buildjobs/$env:APPVEYOR_JOB_ID/artifacts/ffmpeg.zip"
|
||||
Invoke-RestMethod -Method Get -Uri $serverArtifactPath -OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer $env:APPVEYOR_TOKEN" }
|
||||
& "${env:ProgramFiles(x86)}\7-Zip\7z.exe" x -o$(Pipeline.Workspace)\src\out\ffmpeg $localArtifactPath
|
||||
& "${env:ProgramFiles(x86)}\7-Zip\7z.exe" x -osrc\out\ffmpeg $localArtifactPath
|
||||
displayName: 'Download and extract ffmpeg.zip for test'
|
||||
env:
|
||||
APPVEYOR_TOKEN: $(APPVEYOR_TOKEN)
|
||||
|
||||
- powershell: |
|
||||
$localArtifactPath = "$(Pipeline.Workspace)\src\node_headers.zip"
|
||||
$localArtifactPath = "$pwd\src\node_headers.zip"
|
||||
$serverArtifactPath = "$env:APPVEYOR_URL/buildjobs/$env:APPVEYOR_JOB_ID/artifacts/node_headers.zip"
|
||||
Invoke-RestMethod -Method Get -Uri $serverArtifactPath -OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer $env:APPVEYOR_TOKEN" }
|
||||
cd $(Pipeline.Workspace)\src
|
||||
cd src
|
||||
& "${env:ProgramFiles(x86)}\7-Zip\7z.exe" x -y node_headers.zip
|
||||
displayName: 'Download node headers for test'
|
||||
env:
|
||||
APPVEYOR_TOKEN: $(APPVEYOR_TOKEN)
|
||||
|
||||
- powershell: |
|
||||
$localArtifactPath = "$(Pipeline.Workspace)\src\out\Default\electron.lib"
|
||||
$localArtifactPath = "$pwd\src\out\Default\electron.lib"
|
||||
$serverArtifactPath = "$env:APPVEYOR_URL/buildjobs/$env:APPVEYOR_JOB_ID/artifacts/electron.lib"
|
||||
Invoke-RestMethod -Method Get -Uri $serverArtifactPath -OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer $env:APPVEYOR_TOKEN" }
|
||||
displayName: 'Download electron.lib for test'
|
||||
env:
|
||||
APPVEYOR_TOKEN: $(APPVEYOR_TOKEN)
|
||||
|
||||
# Uncomment the following block if pdb files are needed to debug issues
|
||||
# - powershell: |
|
||||
# try {
|
||||
# $localArtifactPath = "$(Pipeline.Workspace)\src\pdb.zip"
|
||||
# $serverArtifactPath = "$env:APPVEYOR_URL/buildjobs/$env:APPVEYOR_JOB_ID/artifacts/pdb.zip"
|
||||
# Invoke-RestMethod -Method Get -Uri $serverArtifactPath -OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer $env:APPVEYOR_TOKEN" }
|
||||
# cd $(Pipeline.Workspace)\src
|
||||
# & "${env:ProgramFiles(x86)}\7-Zip\7z.exe" x -y pdb.zip
|
||||
# } catch {
|
||||
# Write-Host "There was an exception encountered while downloading pdb files:" $_.Exception.Message
|
||||
# } finally {
|
||||
# $global:LASTEXITCODE = 0
|
||||
# }
|
||||
# displayName: 'Download pdb files for detailed stacktraces'
|
||||
# env:
|
||||
# APPVEYOR_TOKEN: $(APPVEYOR_TOKEN)
|
||||
- powershell: |
|
||||
try {
|
||||
$localArtifactPath = "$pwd\src\pdb.zip"
|
||||
$serverArtifactPath = "$env:APPVEYOR_URL/buildjobs/$env:APPVEYOR_JOB_ID/artifacts/pdb.zip"
|
||||
Invoke-RestMethod -Method Get -Uri $serverArtifactPath -OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer $env:APPVEYOR_TOKEN" }
|
||||
cd src
|
||||
& "${env:ProgramFiles(x86)}\7-Zip\7z.exe" x -y pdb.zip
|
||||
} catch {
|
||||
Write-Host "There was an exception encountered while downloading pdb files:" $_.Exception.Message
|
||||
} finally {
|
||||
$global:LASTEXITCODE = 0
|
||||
}
|
||||
displayName: 'Download pdb files for detailed stacktraces'
|
||||
env:
|
||||
APPVEYOR_TOKEN: $(APPVEYOR_TOKEN)
|
||||
|
||||
- powershell: |
|
||||
New-Item $(Pipeline.Workspace)\src\out\Default\gen\node_headers\Release -Type directory
|
||||
Copy-Item -path $(Pipeline.Workspace)\src\out\Default\electron.lib -destination $(Pipeline.Workspace)\src\out\Default\gen\node_headers\Release\node.lib
|
||||
New-Item src\out\Default\gen\node_headers\Release -Type directory
|
||||
Copy-Item -path src\out\Default\electron.lib -destination src\out\Default\gen\node_headers\Release\node.lib
|
||||
displayName: 'Setup node headers'
|
||||
|
||||
- script: |
|
||||
cd $(Pipeline.Workspace)\src
|
||||
cd src
|
||||
set npm_config_nodedir=%cd%\out\Default\gen\node_headers
|
||||
set npm_config_arch=arm64
|
||||
cd electron
|
||||
node script/yarn test --runners=main --enable-logging --disable-features=CalculateNativeWinOcclusion
|
||||
node script/yarn test --runners=main --runTestFilesSeperately --enable-logging --disable-features=CalculateNativeWinOcclusion
|
||||
displayName: 'Run Electron Main process tests'
|
||||
env:
|
||||
ELECTRON_ENABLE_STACK_DUMPING: true
|
||||
@@ -91,7 +90,7 @@ steps:
|
||||
MOCHA_REPORTER: mocha-multi-reporters
|
||||
|
||||
- script: |
|
||||
cd $(Pipeline.Workspace)\src
|
||||
cd src
|
||||
set npm_config_nodedir=%cd%\out\Default\gen\node_headers
|
||||
set npm_config_arch=arm64
|
||||
cd electron
|
||||
@@ -103,17 +102,17 @@ steps:
|
||||
ELECTRON_TEST_RESULTS_DIR: junit
|
||||
MOCHA_MULTI_REPORTERS: 'mocha-junit-reporter, tap'
|
||||
MOCHA_REPORTER: mocha-multi-reporters
|
||||
condition: succeededOrFailed()
|
||||
condition: always()
|
||||
|
||||
- task: PublishTestResults@2
|
||||
displayName: 'Publish Test Results'
|
||||
inputs:
|
||||
testResultsFiles: '*.xml'
|
||||
searchFolder: '$(Pipeline.Workspace)/src/junit/'
|
||||
searchFolder: '$(System.DefaultWorkingDirectory)/src/junit/'
|
||||
condition: always()
|
||||
|
||||
- script: |
|
||||
cd $(Pipeline.Workspace)\src
|
||||
cd src
|
||||
echo "Verifying non proprietary ffmpeg"
|
||||
python electron\script\verify-ffmpeg.py --build-dir out\Default --source-root %cd% --ffmpeg-path out\ffmpeg
|
||||
displayName: 'Verify ffmpeg'
|
||||
|
||||
@@ -2,9 +2,10 @@ 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 = 103
|
||||
node_module_version = 101
|
||||
|
||||
v8_promise_internal_field_count = 1
|
||||
v8_typed_array_max_size_in_heap = 0
|
||||
v8_embedder_string = "-electron.0"
|
||||
|
||||
# TODO: this breaks mksnapshot
|
||||
@@ -13,9 +14,6 @@ v8_enable_snapshot_native_code_counters = false
|
||||
# TODO(codebytere): remove when Node.js handles https://chromium-review.googlesource.com/c/v8/v8/+/3211575
|
||||
v8_scriptormodule_legacy_lifetime = true
|
||||
|
||||
# we use this api
|
||||
v8_enable_javascript_promise_hooks = true
|
||||
|
||||
enable_cdm_host_verification = false
|
||||
proprietary_codecs = true
|
||||
ffmpeg_branding = "Chrome"
|
||||
|
||||
@@ -53,8 +53,8 @@ static_library("chrome") {
|
||||
"//chrome/browser/predictors/resolve_host_client_impl.cc",
|
||||
"//chrome/browser/predictors/resolve_host_client_impl.h",
|
||||
"//chrome/browser/process_singleton.h",
|
||||
"//chrome/browser/process_singleton_internal.cc",
|
||||
"//chrome/browser/process_singleton_internal.h",
|
||||
"//chrome/browser/ui/browser_dialogs.cc",
|
||||
"//chrome/browser/ui/browser_dialogs.h",
|
||||
"//chrome/browser/ui/exclusive_access/exclusive_access_bubble_type.cc",
|
||||
"//chrome/browser/ui/exclusive_access/exclusive_access_bubble_type.h",
|
||||
"//chrome/browser/ui/exclusive_access/exclusive_access_controller_base.cc",
|
||||
@@ -140,6 +140,10 @@ static_library("chrome") {
|
||||
"//components/optimization_guide/proto:optimization_guide_proto",
|
||||
]
|
||||
|
||||
if (enable_basic_printing && is_win) {
|
||||
deps += [ "//chrome/common:cloud_print_utility_mojom" ]
|
||||
}
|
||||
|
||||
if (is_linux) {
|
||||
sources += [ "//chrome/browser/icon_loader_auralinux.cc" ]
|
||||
if (use_ozone) {
|
||||
@@ -239,6 +243,8 @@ static_library("chrome") {
|
||||
sources += [
|
||||
"//chrome/browser/printing/pdf_to_emf_converter.cc",
|
||||
"//chrome/browser/printing/pdf_to_emf_converter.h",
|
||||
"//chrome/utility/printing_handler.cc",
|
||||
"//chrome/utility/printing_handler.h",
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -253,12 +259,8 @@ static_library("chrome") {
|
||||
"//chrome/browser/ui/views/overlay/close_image_button.cc",
|
||||
"//chrome/browser/ui/views/overlay/close_image_button.h",
|
||||
"//chrome/browser/ui/views/overlay/constants.h",
|
||||
"//chrome/browser/ui/views/overlay/document_overlay_window_views.cc",
|
||||
"//chrome/browser/ui/views/overlay/document_overlay_window_views.h",
|
||||
"//chrome/browser/ui/views/overlay/hang_up_button.cc",
|
||||
"//chrome/browser/ui/views/overlay/hang_up_button.h",
|
||||
"//chrome/browser/ui/views/overlay/overlay_window_image_button.cc",
|
||||
"//chrome/browser/ui/views/overlay/overlay_window_image_button.h",
|
||||
"//chrome/browser/ui/views/overlay/overlay_window_views.cc",
|
||||
"//chrome/browser/ui/views/overlay/overlay_window_views.h",
|
||||
"//chrome/browser/ui/views/overlay/playback_image_button.cc",
|
||||
@@ -273,14 +275,11 @@ static_library("chrome") {
|
||||
"//chrome/browser/ui/views/overlay/toggle_microphone_button.h",
|
||||
"//chrome/browser/ui/views/overlay/track_image_button.cc",
|
||||
"//chrome/browser/ui/views/overlay/track_image_button.h",
|
||||
"//chrome/browser/ui/views/overlay/video_overlay_window_views.cc",
|
||||
"//chrome/browser/ui/views/overlay/video_overlay_window_views.h",
|
||||
]
|
||||
|
||||
deps += [
|
||||
"//chrome/app/vector_icons",
|
||||
"//components/vector_icons:vector_icons",
|
||||
"//ui/views/controls/webview",
|
||||
]
|
||||
}
|
||||
|
||||
@@ -298,21 +297,11 @@ static_library("chrome") {
|
||||
|
||||
if (enable_pdf_viewer) {
|
||||
sources += [
|
||||
"//chrome/browser/pdf/chrome_pdf_stream_delegate.cc",
|
||||
"//chrome/browser/pdf/chrome_pdf_stream_delegate.h",
|
||||
"//chrome/browser/pdf/pdf_extension_util.cc",
|
||||
"//chrome/browser/pdf/pdf_extension_util.h",
|
||||
"//chrome/browser/pdf/pdf_frame_util.cc",
|
||||
"//chrome/browser/pdf/pdf_frame_util.h",
|
||||
"//chrome/browser/plugins/pdf_iframe_navigation_throttle.cc",
|
||||
"//chrome/browser/plugins/pdf_iframe_navigation_throttle.h",
|
||||
"//chrome/renderer/pepper/chrome_pdf_print_client.cc",
|
||||
"//chrome/renderer/pepper/chrome_pdf_print_client.h",
|
||||
]
|
||||
deps += [
|
||||
"//components/pdf/browser",
|
||||
"//components/pdf/renderer",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -340,6 +329,15 @@ source_set("plugins") {
|
||||
"//chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.cc",
|
||||
"//chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.h",
|
||||
]
|
||||
deps += [
|
||||
"//media:media_buildflags",
|
||||
"//ppapi/buildflags",
|
||||
"//ppapi/proxy:ipc",
|
||||
"//services/device/public/mojom",
|
||||
]
|
||||
if (enable_pdf_viewer) {
|
||||
deps += [ "//components/pdf/browser" ]
|
||||
}
|
||||
|
||||
# renderer side
|
||||
sources += [
|
||||
@@ -350,18 +348,17 @@ source_set("plugins") {
|
||||
"//chrome/renderer/pepper/pepper_shared_memory_message_filter.cc",
|
||||
"//chrome/renderer/pepper/pepper_shared_memory_message_filter.h",
|
||||
]
|
||||
|
||||
if (enable_pdf_viewer) {
|
||||
deps += [ "//components/pdf/renderer" ]
|
||||
}
|
||||
deps += [
|
||||
"//components/strings",
|
||||
"//media:media_buildflags",
|
||||
"//ppapi/buildflags",
|
||||
"//ppapi/host",
|
||||
"//ppapi/proxy",
|
||||
"//ppapi/proxy:ipc",
|
||||
"//ppapi/shared_impl",
|
||||
"//services/device/public/mojom",
|
||||
"//skia",
|
||||
"//storage/browser",
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { shell } from 'electron/common';
|
||||
import { app, dialog, BrowserWindow, ipcMain } from 'electron/main';
|
||||
import { app, dialog, BrowserWindow, shell, ipcMain } from 'electron';
|
||||
import * as path from 'path';
|
||||
import * as url from 'url';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as electron from 'electron/main';
|
||||
import * as electron from 'electron';
|
||||
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
@@ -92,7 +92,7 @@ function loadApplicationPackage (packagePath: string) {
|
||||
try {
|
||||
packageJson = require(packageJsonPath);
|
||||
} catch (e) {
|
||||
showErrorMessage(`Unable to parse ${packageJsonPath}\n\n${(e as Error).message}`);
|
||||
showErrorMessage(`Unable to parse ${packageJsonPath}\n\n${e.message}`);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ function loadApplicationPackage (packagePath: string) {
|
||||
const filePath = Module._resolveFilename(packagePath, module, true);
|
||||
app.setAppPath(appPath || path.dirname(filePath));
|
||||
} catch (e) {
|
||||
showErrorMessage(`Unable to find Electron app at ${packagePath}\n\n${(e as Error).message}`);
|
||||
showErrorMessage(`Unable to find Electron app at ${packagePath}\n\n${e.message}`);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ function loadApplicationPackage (packagePath: string) {
|
||||
Module._load(packagePath, module, true);
|
||||
} catch (e) {
|
||||
console.error('App threw an error during load');
|
||||
console.error((e as Error).stack || e);
|
||||
console.error(e.stack || e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ipcRenderer, contextBridge } from 'electron/renderer';
|
||||
import { ipcRenderer, contextBridge } from 'electron';
|
||||
|
||||
const policy = window.trustedTypes.createPolicy('electron-default-app', {
|
||||
// we trust the SVG contents
|
||||
|
||||
@@ -106,6 +106,7 @@ These individual tutorials expand on topics discussed in the guide above.
|
||||
* [`File` Object](api/file-object.md)
|
||||
* [`<webview>` Tag](api/webview-tag.md)
|
||||
* [`window.open` Function](api/window-open.md)
|
||||
* [`BrowserWindowProxy` Object](api/browser-window-proxy.md)
|
||||
|
||||
### Modules for the Main Process:
|
||||
|
||||
|
||||
@@ -484,7 +484,6 @@ Returns:
|
||||
* `argv` string[] - An array of the second instance's command line arguments
|
||||
* `workingDirectory` string - The second instance's working directory
|
||||
* `additionalData` unknown - A JSON object of additional data passed from the second instance
|
||||
* `ackCallback` unknown - A function that can be used to send data back to the second instance
|
||||
|
||||
This event will be emitted inside the primary instance of your application
|
||||
when a second instance has been executed and calls `app.requestSingleInstanceLock()`.
|
||||
@@ -496,35 +495,12 @@ non-minimized.
|
||||
|
||||
**Note:** If the second instance is started by a different user than the first, the `argv` array will not include the arguments.
|
||||
|
||||
**Note:** `ackCallback` allows the user to send data back to the
|
||||
second instance during the `app.requestSingleInstanceLock()` flow.
|
||||
This callback can be used for cases where the second instance
|
||||
needs to obtain additional information from the first instance
|
||||
before quitting.
|
||||
|
||||
Currently, the limit on the message size is kMaxMessageLength,
|
||||
or around 32kB. To be safe, keep the amount of data passed to 31kB at most.
|
||||
|
||||
In order to call the callback, `event.preventDefault()` must be called, first.
|
||||
If the callback is not called in either case, `null` will be sent back.
|
||||
If `event.preventDefault()` is not called, but `ackCallback` is called
|
||||
by the user in the event, then the behaviour is undefined.
|
||||
|
||||
This event is guaranteed to be emitted after the `ready` event of `app`
|
||||
gets emitted.
|
||||
|
||||
**Note:** Extra command line arguments might be added by Chromium,
|
||||
such as `--original-process-start-time`.
|
||||
|
||||
### Event: 'first-instance-ack'
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `additionalData` unknown - A JSON object of additional data passed from the first instance, in response to the first instance's `second-instance` event.
|
||||
|
||||
This event will be emitted within the second instance during the call to `app.requestSingleInstanceLock()`, when the first instance calls the `ackCallback` provided by the `second-instance` event handler.
|
||||
|
||||
## Methods
|
||||
|
||||
The `app` object has the following methods:
|
||||
@@ -861,8 +837,6 @@ Returns `Object`:
|
||||
|
||||
* `categories` [JumpListCategory[]](structures/jump-list-category.md) | `null` - Array of `JumpListCategory` objects.
|
||||
|
||||
Returns `string`
|
||||
|
||||
Sets or removes a custom Jump List for the application, and returns one of the
|
||||
following strings:
|
||||
|
||||
@@ -985,33 +959,21 @@ 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)
|
||||
|
||||
if (!gotTheLock) {
|
||||
app.quit()
|
||||
} else {
|
||||
app.on('second-instance', (event, commandLine, workingDirectory, additionalData, ackCallback) => {
|
||||
// We must call preventDefault if we're sending back data.
|
||||
event.preventDefault()
|
||||
app.on('second-instance', (event, commandLine, workingDirectory, additionalData) => {
|
||||
// Print out data received from the second instance.
|
||||
// Expected output: '{"myKey":"myValue"}'
|
||||
console.log(JSON.stringify(additionalData))
|
||||
console.log(additionalData)
|
||||
|
||||
// Someone tried to run a second instance, we should focus our window.
|
||||
if (myWindow) {
|
||||
if (myWindow.isMinimized()) myWindow.restore()
|
||||
myWindow.focus()
|
||||
}
|
||||
const ackData = { myAckKey: 'myAckValue' }
|
||||
ackCallback(ackData)
|
||||
})
|
||||
|
||||
// Create myWindow, load the rest of the app, etc...
|
||||
|
||||
@@ -70,31 +70,5 @@ The `bounds` of this BrowserView instance as `Object`.
|
||||
|
||||
#### `view.setBackgroundColor(color)` _Experimental_
|
||||
|
||||
* `color` string - Color in Hex, RGB, ARGB, HSL, HSLA or named CSS color format. The alpha channel is
|
||||
optional for the hex type.
|
||||
|
||||
Examples of valid `color` values:
|
||||
|
||||
* Hex
|
||||
* #fff (RGB)
|
||||
* #ffff (ARGB)
|
||||
* #ffffff (RRGGBB)
|
||||
* #ffffffff (AARRGGBB)
|
||||
* RGB
|
||||
* rgb\(([\d]+),\s*([\d]+),\s*([\d]+)\)
|
||||
* e.g. rgb(255, 255, 255)
|
||||
* RGBA
|
||||
* rgba\(([\d]+),\s*([\d]+),\s*([\d]+),\s*([\d.]+)\)
|
||||
* e.g. rgba(255, 255, 255, 1.0)
|
||||
* HSL
|
||||
* hsl\((-?[\d.]+),\s*([\d.]+)%,\s*([\d.]+)%\)
|
||||
* e.g. hsl(200, 20%, 50%)
|
||||
* HSLA
|
||||
* hsla\((-?[\d.]+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)
|
||||
* e.g. hsla(200, 20%, 50%, 0.5)
|
||||
* Color name
|
||||
* Options are listed in [SkParseColor.cpp](https://source.chromium.org/chromium/chromium/src/+/main:third_party/skia/src/utils/SkParseColor.cpp;l=11-152;drc=eea4bf52cb0d55e2a39c828b017c80a5ee054148)
|
||||
* Similar to CSS Color Module Level 3 keywords, but case-sensitive.
|
||||
* e.g. `blueviolet` or `red`
|
||||
|
||||
**Note:** Hex format with alpha takes `AARRGGBB` or `ARGB`, _not_ `RRGGBBA` or `RGA`.
|
||||
* `color` string - Color in `#aarrggbb` or `#argb` form. The alpha channel is
|
||||
optional.
|
||||
|
||||
54
docs/api/browser-window-proxy.md
Normal file
54
docs/api/browser-window-proxy.md
Normal file
@@ -0,0 +1,54 @@
|
||||
## Class: BrowserWindowProxy
|
||||
|
||||
> Manipulate the child browser window
|
||||
|
||||
Process: [Renderer](../glossary.md#renderer-process)<br />
|
||||
_This class is not exported from the `'electron'` module. It is only available as a return value of other methods in the Electron API._
|
||||
|
||||
The `BrowserWindowProxy` object is returned from `window.open` and provides
|
||||
limited functionality with the child window.
|
||||
|
||||
### Instance Methods
|
||||
|
||||
The `BrowserWindowProxy` object has the following instance methods:
|
||||
|
||||
#### `win.blur()`
|
||||
|
||||
Removes focus from the child window.
|
||||
|
||||
#### `win.close()`
|
||||
|
||||
Forcefully closes the child window without calling its unload event.
|
||||
|
||||
#### `win.eval(code)`
|
||||
|
||||
* `code` string
|
||||
|
||||
Evaluates the code in the child window.
|
||||
|
||||
#### `win.focus()`
|
||||
|
||||
Focuses the child window (brings the window to front).
|
||||
|
||||
#### `win.print()`
|
||||
|
||||
Invokes the print dialog on the child window.
|
||||
|
||||
#### `win.postMessage(message, targetOrigin)`
|
||||
|
||||
* `message` any
|
||||
* `targetOrigin` string
|
||||
|
||||
Sends a message to the child window with the specified origin or `*` for no
|
||||
origin preference.
|
||||
|
||||
In addition to these methods, the child window implements `window.opener` object
|
||||
with no properties and a single method.
|
||||
|
||||
### Instance Properties
|
||||
|
||||
The `BrowserWindowProxy` object has the following instance properties:
|
||||
|
||||
#### `win.closed`
|
||||
|
||||
A `boolean` that is set to true after the child window gets closed.
|
||||
@@ -66,18 +66,6 @@ win.loadURL('https://github.com')
|
||||
Note that even for apps that use `ready-to-show` event, it is still recommended
|
||||
to set `backgroundColor` to make app feel more native.
|
||||
|
||||
Some examples of valid `backgroundColor` values include:
|
||||
|
||||
```js
|
||||
const win = new BrowserWindow()
|
||||
win.setBackgroundColor('hsl(230, 100%, 50%)')
|
||||
win.setBackgroundColor('rgb(255, 145, 145)')
|
||||
win.setBackgroundColor('#ff00a3')
|
||||
win.setBackgroundColor('blueviolet')
|
||||
```
|
||||
|
||||
For more information about these color types see valid options in [win.setBackgroundColor](browser-window.md#winsetbackgroundcolorbackgroundcolor).
|
||||
|
||||
## Parent and child windows
|
||||
|
||||
By using `parent` option, you can create child windows:
|
||||
@@ -211,7 +199,9 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
|
||||
* `enableLargerThanScreen` boolean (optional) - Enable the window to be resized larger
|
||||
than screen. Only relevant for macOS, as other OSes allow
|
||||
larger-than-screen windows by default. Default is `false`.
|
||||
* `backgroundColor` string (optional) - The window's background color in Hex, RGB, RGBA, HSL, HSLA or named CSS color format. Alpha in #AARRGGBB format is supported if `transparent` is set to `true`. Default is `#FFF` (white). See [win.setBackgroundColor](browser-window.md#winsetbackgroundcolorbackgroundcolor) for more information.
|
||||
* `backgroundColor` string (optional) - Window's background color as a hexadecimal value,
|
||||
like `#66CD00` or `#FFF` or `#80FFFFFF` (alpha in #AARRGGBB format is supported if
|
||||
`transparent` is set to `true`). Default is `#FFF` (white).
|
||||
* `hasShadow` boolean (optional) - Whether window should have a shadow. Default is `true`.
|
||||
* `opacity` number (optional) - Set the initial opacity of the window, between 0.0 (fully
|
||||
transparent) and 1.0 (fully opaque). This is only implemented on Windows and macOS.
|
||||
@@ -351,6 +341,9 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
|
||||
[Chrome Content Scripts][chrome-content-scripts]. You can access this
|
||||
context in the dev tools by selecting the 'Electron Isolated Context'
|
||||
entry in the combo box at the top of the Console tab.
|
||||
* `nativeWindowOpen` boolean (optional) - Whether to use native
|
||||
`window.open()`. Defaults to `true`. Child windows will always have node
|
||||
integration disabled unless `nodeIntegrationInSubFrames` is true.
|
||||
* `webviewTag` boolean (optional) - Whether to enable the [`<webview>` tag](webview-tag.md).
|
||||
Defaults to `false`. **Note:** The
|
||||
`preload` script configured for the `<webview>` will have node integration
|
||||
@@ -398,7 +391,7 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
|
||||
contain the layout of the document—without requiring scrolling. Enabling
|
||||
this will cause the `preferred-size-changed` event to be emitted on the
|
||||
`WebContents` when the preferred size changes. Default is `false`.
|
||||
* `titleBarOverlay` Object | Boolean (optional) - When using a frameless window in conjunction with `win.setWindowButtonVisibility(true)` on macOS or using a `titleBarStyle` so that the standard window controls ("traffic lights" on macOS) are visible, this property enables the Window Controls Overlay [JavaScript APIs][overlay-javascript-apis] and [CSS Environment Variables][overlay-css-env-vars]. Specifying `true` will result in an overlay with default system colors. Default is `false`.
|
||||
* `titleBarOverlay` Object | Boolean (optional) - When using a frameless window in conjuction with `win.setWindowButtonVisibility(true)` on macOS or using a `titleBarStyle` so that the standard window controls ("traffic lights" on macOS) are visible, this property enables the Window Controls Overlay [JavaScript APIs][overlay-javascript-apis] and [CSS Environment Variables][overlay-css-env-vars]. Specifying `true` will result in an overlay with default system colors. Default is `false`.
|
||||
* `color` String (optional) _Windows_ - The CSS color of the Window Controls Overlay when enabled. Default is the system color.
|
||||
* `symbolColor` String (optional) _Windows_ - The CSS color of the symbols on the Window Controls Overlay when enabled. Default is the system color.
|
||||
* `height` Integer (optional) _macOS_ _Windows_ - The height of the title bar and Window Controls Overlay in pixels. Default is system height.
|
||||
@@ -1002,33 +995,12 @@ APIs like `win.setSize`.
|
||||
|
||||
#### `win.setBackgroundColor(backgroundColor)`
|
||||
|
||||
* `backgroundColor` string - Color in Hex, RGB, RGBA, HSL, HSLA or named CSS color format. The alpha channel is optional for the hex type.
|
||||
* `backgroundColor` string - Window's background color as a hexadecimal value,
|
||||
like `#66CD00` or `#FFF` or `#80FFFFFF` (alpha is supported if `transparent`
|
||||
is `true`). Default is `#FFF` (white).
|
||||
|
||||
Examples of valid `backgroundColor` values:
|
||||
|
||||
* Hex
|
||||
* #fff (shorthand RGB)
|
||||
* #ffff (shorthand ARGB)
|
||||
* #ffffff (RGB)
|
||||
* #ffffffff (ARGB)
|
||||
* RGB
|
||||
* rgb\(([\d]+),\s*([\d]+),\s*([\d]+)\)
|
||||
* e.g. rgb(255, 255, 255)
|
||||
* RGBA
|
||||
* rgba\(([\d]+),\s*([\d]+),\s*([\d]+),\s*([\d.]+)\)
|
||||
* e.g. rgba(255, 255, 255, 1.0)
|
||||
* HSL
|
||||
* hsl\((-?[\d.]+),\s*([\d.]+)%,\s*([\d.]+)%\)
|
||||
* e.g. hsl(200, 20%, 50%)
|
||||
* HSLA
|
||||
* hsla\((-?[\d.]+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)
|
||||
* e.g. hsla(200, 20%, 50%, 0.5)
|
||||
* Color name
|
||||
* Options are listed in [SkParseColor.cpp](https://source.chromium.org/chromium/chromium/src/+/main:third_party/skia/src/utils/SkParseColor.cpp;l=11-152;drc=eea4bf52cb0d55e2a39c828b017c80a5ee054148)
|
||||
* Similar to CSS Color Module Level 3 keywords, but case-sensitive.
|
||||
* e.g. `blueviolet` or `red`
|
||||
|
||||
Sets the background color of the window. See [Setting `backgroundColor`](#setting-the-backgroundcolor-property).
|
||||
Sets the background color of the window. See [Setting
|
||||
`backgroundColor`](#setting-the-backgroundcolor-property).
|
||||
|
||||
#### `win.previewFile(path[, displayName])` _macOS_
|
||||
|
||||
@@ -1072,11 +1044,8 @@ Returns [`Rectangle`](structures/rectangle.md) - The `bounds` of the window as `
|
||||
|
||||
#### `win.getBackgroundColor()`
|
||||
|
||||
Returns `string` - Gets the background color of the window in Hex (`#RRGGBB`) format.
|
||||
|
||||
See [Setting `backgroundColor`](#setting-the-backgroundcolor-property).
|
||||
|
||||
**Note:** The alpha value is _not_ returned alongside the red, green, and blue values.
|
||||
Returns `string` - Gets the background color of the window. See [Setting
|
||||
`backgroundColor`](#setting-the-backgroundcolor-property).
|
||||
|
||||
#### `win.setContentBounds(bounds[, animate])`
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@ Or use a 3rd party hosted solution:
|
||||
* [Backtrace](https://backtrace.io/electron/)
|
||||
* [Sentry](https://docs.sentry.io/clients/electron)
|
||||
* [BugSplat](https://www.bugsplat.com/docs/platforms/electron)
|
||||
* [Bugsnag](https://docs.bugsnag.com/platforms/electron/)
|
||||
|
||||
Crash reports are stored temporarily before being uploaded in a directory
|
||||
underneath the app's user data directory, called 'Crashpad'. You can override
|
||||
|
||||
@@ -28,7 +28,7 @@ When `informational` is passed, the dock icon will bounce for one second.
|
||||
However, the request remains active until either the application becomes active
|
||||
or the request is canceled.
|
||||
|
||||
**Note:** This method can only be used while the app is not focused; when the app is focused it will return -1.
|
||||
**Nota Bene:** This method can only be used while the app is not focused; when the app is focused it will return -1.
|
||||
|
||||
#### `dock.cancelBounce(id)` _macOS_
|
||||
|
||||
|
||||
@@ -99,7 +99,6 @@ Only `chrome.storage.local` is supported; `chrome.storage.sync` and
|
||||
The following methods of `chrome.tabs` are supported:
|
||||
|
||||
- `chrome.tabs.sendMessage`
|
||||
- `chrome.tabs.reload`
|
||||
- `chrome.tabs.executeScript`
|
||||
- `chrome.tabs.update` (partial support)
|
||||
- supported properties: `url`, `muted`.
|
||||
|
||||
@@ -80,25 +80,3 @@ An `Integer` indicating the HTTP protocol major version number.
|
||||
An `Integer` indicating the HTTP protocol minor version number.
|
||||
|
||||
[event-emitter]: https://nodejs.org/api/events.html#events_class_eventemitter
|
||||
|
||||
#### `response.rawHeaders`
|
||||
|
||||
A `string[]` containing the raw HTTP response headers exactly as they were
|
||||
received. The keys and values are in the same list. It is not a list of
|
||||
tuples. So, the even-numbered offsets are key values, and the odd-numbered
|
||||
offsets are the associated values. Header names are not lowercased, and
|
||||
duplicates are not merged.
|
||||
|
||||
```javascript
|
||||
// Prints something like:
|
||||
//
|
||||
// [ 'user-agent',
|
||||
// 'this is invalid because there can be only one',
|
||||
// 'User-Agent',
|
||||
// 'curl/7.22.0',
|
||||
// 'Host',
|
||||
// '127.0.0.1:8000',
|
||||
// 'ACCEPT',
|
||||
// '*/*' ]
|
||||
console.log(request.rawHeaders)
|
||||
```
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
---
|
||||
title: "ipcMain"
|
||||
description: "Communicate asynchronously from the main process to renderer processes."
|
||||
slug: ipc-main
|
||||
hide_title: false
|
||||
---
|
||||
|
||||
# ipcMain
|
||||
|
||||
> Communicate asynchronously from the main process to renderer processes.
|
||||
@@ -9,7 +16,9 @@ process, it handles asynchronous and synchronous messages sent from a renderer
|
||||
process (web page). Messages sent from a renderer will be emitted to this
|
||||
module.
|
||||
|
||||
## Sending Messages
|
||||
For usage examples, check out the [IPC tutorial].
|
||||
|
||||
## Sending messages
|
||||
|
||||
It is also possible to send messages from the main process to the renderer
|
||||
process, see [webContents.send][web-contents-send] for more information.
|
||||
@@ -21,36 +30,6 @@ process, see [webContents.send][web-contents-send] for more information.
|
||||
coming from frames that aren't the main frame (e.g. iframes) whereas
|
||||
`event.sender.send(...)` will always send to the main frame.
|
||||
|
||||
An example of sending and handling messages between the render and main
|
||||
processes:
|
||||
|
||||
```javascript
|
||||
// In main process.
|
||||
const { ipcMain } = require('electron')
|
||||
ipcMain.on('asynchronous-message', (event, arg) => {
|
||||
console.log(arg) // prints "ping"
|
||||
event.reply('asynchronous-reply', 'pong')
|
||||
})
|
||||
|
||||
ipcMain.on('synchronous-message', (event, arg) => {
|
||||
console.log(arg) // prints "ping"
|
||||
event.returnValue = 'pong'
|
||||
})
|
||||
```
|
||||
|
||||
```javascript
|
||||
// In renderer process (web page).
|
||||
// NB. Electron APIs are only accessible from preload, unless contextIsolation is disabled.
|
||||
// See https://www.electronjs.org/docs/tutorial/process-model#preload-scripts for more details.
|
||||
const { ipcRenderer } = require('electron')
|
||||
console.log(ipcRenderer.sendSync('synchronous-message', 'ping')) // prints "pong"
|
||||
|
||||
ipcRenderer.on('asynchronous-reply', (event, arg) => {
|
||||
console.log(arg) // prints "pong"
|
||||
})
|
||||
ipcRenderer.send('asynchronous-message', 'ping')
|
||||
```
|
||||
|
||||
## Methods
|
||||
|
||||
The `ipcMain` module has the following method to listen for events:
|
||||
@@ -59,7 +38,7 @@ The `ipcMain` module has the following method to listen for events:
|
||||
|
||||
* `channel` string
|
||||
* `listener` Function
|
||||
* `event` IpcMainEvent
|
||||
* `event` [IpcMainEvent][ipc-main-event]
|
||||
* `...args` any[]
|
||||
|
||||
Listens to `channel`, when a new message arrives `listener` would be called with
|
||||
@@ -69,7 +48,7 @@ Listens to `channel`, when a new message arrives `listener` would be called with
|
||||
|
||||
* `channel` string
|
||||
* `listener` Function
|
||||
* `event` IpcMainEvent
|
||||
* `event` [IpcMainEvent][ipc-main-event]
|
||||
* `...args` any[]
|
||||
|
||||
Adds a one time `listener` function for the event. This `listener` is invoked
|
||||
@@ -93,8 +72,8 @@ Removes listeners of the specified `channel`.
|
||||
### `ipcMain.handle(channel, listener)`
|
||||
|
||||
* `channel` string
|
||||
* `listener` Function<Promise\<void> | any>
|
||||
* `event` IpcMainInvokeEvent
|
||||
* `listener` Function<Promise\<void> | any>
|
||||
* `event` [IpcMainInvokeEvent][ipc-main-invoke-event]
|
||||
* `...args` any[]
|
||||
|
||||
Adds a handler for an `invoke`able IPC. This handler will be called whenever a
|
||||
@@ -104,14 +83,14 @@ If `listener` returns a Promise, the eventual result of the promise will be
|
||||
returned as a reply to the remote caller. Otherwise, the return value of the
|
||||
listener will be used as the value of the reply.
|
||||
|
||||
```js
|
||||
// Main process
|
||||
```js title='Main Process'
|
||||
ipcMain.handle('my-invokable-ipc', async (event, ...args) => {
|
||||
const result = await somePromise(...args)
|
||||
return result
|
||||
})
|
||||
```
|
||||
|
||||
// Renderer process
|
||||
```js title='Renderer Process'
|
||||
async () => {
|
||||
const result = await ipcRenderer.invoke('my-invokable-ipc', arg1, arg2)
|
||||
// ...
|
||||
@@ -130,7 +109,7 @@ provided to the renderer process. Please refer to
|
||||
### `ipcMain.handleOnce(channel, listener)`
|
||||
|
||||
* `channel` string
|
||||
* `listener` Function<Promise\<void> | any>
|
||||
* `listener` Function<Promise\<void> | any>
|
||||
* `event` IpcMainInvokeEvent
|
||||
* `...args` any[]
|
||||
|
||||
@@ -146,13 +125,16 @@ Removes any handler for `channel`, if present.
|
||||
## IpcMainEvent object
|
||||
|
||||
The documentation for the `event` object passed to the `callback` can be found
|
||||
in the [`ipc-main-event`](structures/ipc-main-event.md) structure docs.
|
||||
in the [`ipc-main-event`][ipc-main-event] structure docs.
|
||||
|
||||
## IpcMainInvokeEvent object
|
||||
|
||||
The documentation for the `event` object passed to `handle` callbacks can be
|
||||
found in the [`ipc-main-invoke-event`](structures/ipc-main-invoke-event.md)
|
||||
found in the [`ipc-main-invoke-event`][ipc-main-invoke-event]
|
||||
structure docs.
|
||||
|
||||
[IPC tutorial]: ../tutorial/ipc.md
|
||||
[event-emitter]: https://nodejs.org/api/events.html#events_class_eventemitter
|
||||
[web-contents-send]: web-contents.md#contentssendchannel-args
|
||||
[web-contents-send]: ../api/web-contents.md#contentssendchannel-args
|
||||
[ipc-main-event]:../api/structures/ipc-main-event.md
|
||||
[ipc-main-invoke-event]:../api/structures/ipc-main-invoke-event.md
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
---
|
||||
title: "ipcRenderer"
|
||||
description: "Communicate asynchronously from a renderer process to the main process."
|
||||
slug: ipc-renderer
|
||||
hide_title: false
|
||||
---
|
||||
|
||||
# ipcRenderer
|
||||
|
||||
> Communicate asynchronously from a renderer process to the main process.
|
||||
@@ -9,7 +16,7 @@ methods so you can send synchronous and asynchronous messages from the render
|
||||
process (web page) to the main process. You can also receive replies from the
|
||||
main process.
|
||||
|
||||
See [ipcMain](ipc-main.md) for code examples.
|
||||
See [IPC tutorial](../tutorial/ipc.md) for code examples.
|
||||
|
||||
## Methods
|
||||
|
||||
@@ -70,7 +77,7 @@ throw an exception.
|
||||
> them. Attempting to send such objects over IPC will result in an error.
|
||||
|
||||
The main process handles it by listening for `channel` with the
|
||||
[`ipcMain`](ipc-main.md) module.
|
||||
[`ipcMain`](./ipc-main.md) module.
|
||||
|
||||
If you need to transfer a [`MessagePort`][] to the main process, use [`ipcRenderer.postMessage`](#ipcrendererpostmessagechannel-message-transfer).
|
||||
|
||||
@@ -98,7 +105,7 @@ throw an exception.
|
||||
> them. Attempting to send such objects over IPC will result in an error.
|
||||
|
||||
The main process should listen for `channel` with
|
||||
[`ipcMain.handle()`](ipc-main.md#ipcmainhandlechannel-listener).
|
||||
[`ipcMain.handle()`](./ipc-main.md#ipcmainhandlechannel-listener).
|
||||
|
||||
For example:
|
||||
|
||||
@@ -124,11 +131,11 @@ If you do not need a response to the message, consider using [`ipcRenderer.send`
|
||||
* `channel` string
|
||||
* `...args` any[]
|
||||
|
||||
Returns `any` - The value sent back by the [`ipcMain`](ipc-main.md) handler.
|
||||
Returns `any` - The value sent back by the [`ipcMain`](./ipc-main.md) handler.
|
||||
|
||||
Send a message to the main process via `channel` and expect a result
|
||||
synchronously. Arguments will be serialized with the [Structured Clone
|
||||
Algorithm][SCA], just like [`window.postMessage`][], so prototype chains will not be
|
||||
Algorithm][SCA], just like [`window.postMessage`], so prototype chains will not be
|
||||
included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will
|
||||
throw an exception.
|
||||
|
||||
@@ -140,13 +147,13 @@ throw an exception.
|
||||
> Electron's IPC to the main process, as the main process would have no way to decode
|
||||
> them. Attempting to send such objects over IPC will result in an error.
|
||||
|
||||
The main process handles it by listening for `channel` with [`ipcMain`](ipc-main.md) module,
|
||||
The main process handles it by listening for `channel` with [`ipcMain`](./ipc-main.md) module,
|
||||
and replies by setting `event.returnValue`.
|
||||
|
||||
> :warning: **WARNING**: Sending a synchronous message will block the whole
|
||||
> renderer process until the reply is received, so use this method only as a
|
||||
> last resort. It's much better to use the asynchronous version,
|
||||
> [`invoke()`](ipc-renderer.md#ipcrendererinvokechannel-args).
|
||||
> [`invoke()`](./ipc-renderer.md#ipcrendererinvokechannel-args).
|
||||
|
||||
### `ipcRenderer.postMessage(channel, message, [transfer])`
|
||||
|
||||
@@ -158,7 +165,7 @@ Send a message to the main process, optionally transferring ownership of zero
|
||||
or more [`MessagePort`][] objects.
|
||||
|
||||
The transferred `MessagePort` objects will be available in the main process as
|
||||
[`MessagePortMain`](message-port-main.md) objects by accessing the `ports`
|
||||
[`MessagePortMain`](./message-port-main.md) objects by accessing the `ports`
|
||||
property of the emitted event.
|
||||
|
||||
For example:
|
||||
@@ -197,7 +204,7 @@ the host page instead of the main process.
|
||||
## Event object
|
||||
|
||||
The documentation for the `event` object passed to the `callback` can be found
|
||||
in the [`ipc-renderer-event`](structures/ipc-renderer-event.md) structure docs.
|
||||
in the [`ipc-renderer-event`](./structures/ipc-renderer-event.md) structure docs.
|
||||
|
||||
[event-emitter]: https://nodejs.org/api/events.html#events_class_eventemitter
|
||||
[SCA]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm
|
||||
|
||||
@@ -14,7 +14,7 @@ See [`Menu`](menu.md) for examples.
|
||||
* `menuItem` MenuItem
|
||||
* `browserWindow` [BrowserWindow](browser-window.md) | undefined - This will not be defined if no window is open.
|
||||
* `event` [KeyboardEvent](structures/keyboard-event.md)
|
||||
* `role` string (optional) - Can be `undo`, `redo`, `cut`, `copy`, `paste`, `pasteAndMatchStyle`, `delete`, `selectAll`, `reload`, `forceReload`, `toggleDevTools`, `resetZoom`, `zoomIn`, `zoomOut`, `toggleSpellChecker`, `togglefullscreen`, `window`, `minimize`, `close`, `help`, `about`, `services`, `hide`, `hideOthers`, `unhide`, `quit`, 'showSubstitutions', 'toggleSmartQuotes', 'toggleSmartDashes', 'toggleTextReplacement', `startSpeaking`, `stopSpeaking`, `zoom`, `front`, `appMenu`, `fileMenu`, `editMenu`, `viewMenu`, `shareMenu`, `recentDocuments`, `toggleTabBar`, `selectNextTab`, `selectPreviousTab`, `mergeAllWindows`, `clearRecentDocuments`, `moveTabToNewWindow` or `windowMenu` - Define the action of the menu item, when specified the
|
||||
* `role` string (optional) - Can be `undo`, `redo`, `cut`, `copy`, `paste`, `pasteAndMatchStyle`, `delete`, `selectAll`, `reload`, `forceReload`, `toggleDevTools`, `resetZoom`, `zoomIn`, `zoomOut`, `toggleSpellChecker`, `togglefullscreen`, `window`, `minimize`, `close`, `help`, `about`, `services`, `hide`, `hideOthers`, `unhide`, `quit`, `startSpeaking`, `stopSpeaking`, `zoom`, `front`, `appMenu`, `fileMenu`, `editMenu`, `viewMenu`, `shareMenu`, `recentDocuments`, `toggleTabBar`, `selectNextTab`, `selectPreviousTab`, `mergeAllWindows`, `clearRecentDocuments`, `moveTabToNewWindow` or `windowMenu` - Define the action of the menu item, when specified the
|
||||
`click` property will be ignored. See [roles](#roles).
|
||||
* `type` string (optional) - Can be `normal`, `separator`, `submenu`, `checkbox` or
|
||||
`radio`.
|
||||
@@ -100,10 +100,6 @@ The following additional roles are available on _macOS_:
|
||||
* `hide` - Map to the `hide` action.
|
||||
* `hideOthers` - Map to the `hideOtherApplications` action.
|
||||
* `unhide` - Map to the `unhideAllApplications` action.
|
||||
* `showSubstitutions` - Map to the `orderFrontSubstitutionsPanel` action.
|
||||
* `toggleSmartQuotes` - Map to the `toggleAutomaticQuoteSubstitution` action.
|
||||
* `toggleSmartDashes` - Map to the `toggleAutomaticDashSubstitution` action.
|
||||
* `toggleTextReplacement` - Map to the `toggleAutomaticTextReplacement` action.
|
||||
* `startSpeaking` - Map to the `startSpeaking` action.
|
||||
* `stopSpeaking` - Map to the `stopSpeaking` action.
|
||||
* `front` - Map to the `arrangeInFront` action.
|
||||
@@ -124,7 +120,7 @@ When specifying a `role` on macOS, `label` and `accelerator` are the only
|
||||
options that will affect the menu item. All other options will be ignored.
|
||||
Lowercase `role`, e.g. `toggledevtools`, is still supported.
|
||||
|
||||
**Note:** The `enabled` and `visibility` properties are not available for top-level menu items in the tray on macOS.
|
||||
**Nota Bene:** The `enabled` and `visibility` properties are not available for top-level menu items in the tray on macOS.
|
||||
|
||||
### Instance Properties
|
||||
|
||||
|
||||
@@ -7,3 +7,17 @@
|
||||
the `enctype` attribute of the submitted HTML form.
|
||||
* `boundary` string (optional) - The boundary used to separate multiple parts of
|
||||
the message. Only valid when `contentType` is `multipart/form-data`.
|
||||
|
||||
Note that keys starting with `--` are not currently supported. For example, this will errantly submit as `multipart/form-data` when `nativeWindowOpen` is set to `false` in webPreferences:
|
||||
|
||||
```html
|
||||
<form
|
||||
target="_blank"
|
||||
method="POST"
|
||||
enctype="application/x-www-form-urlencoded"
|
||||
action="https://postman-echo.com/post"
|
||||
>
|
||||
<input type="text" name="--theKey">
|
||||
<input type="submit">
|
||||
</form>
|
||||
```
|
||||
|
||||
@@ -84,7 +84,7 @@ that contains the user information dictionary sent along with the notification.
|
||||
|
||||
### `systemPreferences.subscribeNotification(event, callback)` _macOS_
|
||||
|
||||
* `event` string | null
|
||||
* `event` string
|
||||
* `callback` Function
|
||||
* `event` string
|
||||
* `userInfo` Record<string, unknown>
|
||||
@@ -109,11 +109,9 @@ example values of `event` are:
|
||||
* `AppleColorPreferencesChangedNotification`
|
||||
* `AppleShowScrollBarsSettingChanged`
|
||||
|
||||
If `event` is null, the `NSDistributedNotificationCenter` doesn’t use it as criteria for delivery to the observer. See [docs](https://developer.apple.com/documentation/foundation/nsnotificationcenter/1411723-addobserverforname?language=objc) for more information.
|
||||
|
||||
### `systemPreferences.subscribeLocalNotification(event, callback)` _macOS_
|
||||
|
||||
* `event` string | null
|
||||
* `event` string
|
||||
* `callback` Function
|
||||
* `event` string
|
||||
* `userInfo` Record<string, unknown>
|
||||
@@ -124,11 +122,9 @@ Returns `number` - The ID of this subscription
|
||||
Same as `subscribeNotification`, but uses `NSNotificationCenter` for local defaults.
|
||||
This is necessary for events such as `NSUserDefaultsDidChangeNotification`.
|
||||
|
||||
If `event` is null, the `NSNotificationCenter` doesn’t use it as criteria for delivery to the observer. See [docs](https://developer.apple.com/documentation/foundation/nsnotificationcenter/1411723-addobserverforname?language=objc) for more information.
|
||||
|
||||
### `systemPreferences.subscribeWorkspaceNotification(event, callback)` _macOS_
|
||||
|
||||
* `event` string | null
|
||||
* `event` string
|
||||
* `callback` Function
|
||||
* `event` string
|
||||
* `userInfo` Record<string, unknown>
|
||||
@@ -139,8 +135,6 @@ Returns `number` - The ID of this subscription
|
||||
Same as `subscribeNotification`, but uses `NSWorkspace.sharedWorkspace.notificationCenter`.
|
||||
This is necessary for events such as `NSWorkspaceDidActivateApplicationNotification`.
|
||||
|
||||
If `event` is null, the `NSWorkspaceNotificationCenter` doesn’t use it as criteria for delivery to the observer. See [docs](https://developer.apple.com/documentation/foundation/nsnotificationcenter/1411723-addobserverforname?language=objc) for more information.
|
||||
|
||||
### `systemPreferences.unsubscribeNotification(id)` _macOS_
|
||||
|
||||
* `id` Integer
|
||||
|
||||
@@ -290,7 +290,7 @@ Returns:
|
||||
* `frameProcessId` Integer
|
||||
* `frameRoutingId` Integer
|
||||
|
||||
Emitted when a server side redirect occurs during navigation. For example a 302
|
||||
Emitted as a server side redirect occurs during navigation. For example a 302
|
||||
redirect.
|
||||
|
||||
This event will be emitted after `did-start-navigation` and always before the
|
||||
@@ -508,23 +508,6 @@ Returns:
|
||||
|
||||
Emitted when the user is requesting to change the zoom level using the mouse wheel.
|
||||
|
||||
#### Event: 'blur'
|
||||
|
||||
Emitted when the `WebContents` loses focus.
|
||||
|
||||
#### Event: 'focus'
|
||||
|
||||
Emitted when the `WebContents` gains focus.
|
||||
|
||||
Note that on macOS, having focus means the `WebContents` is the first responder
|
||||
of window, so switching focus between windows would not trigger the `focus` and
|
||||
`blur` events of `WebContents`, as the first responder of each window is not
|
||||
changed.
|
||||
|
||||
The `focus` and `blur` events of `WebContents` should only be used to detect
|
||||
focus change between different `WebContents` and `BrowserView` in the same
|
||||
window.
|
||||
|
||||
#### Event: 'devtools-opened'
|
||||
|
||||
Emitted when DevTools is opened.
|
||||
|
||||
@@ -98,7 +98,6 @@ Some examples of valid `urls`:
|
||||
* `resourceType` string - Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`, `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
|
||||
* `referrer` string
|
||||
* `timestamp` Double
|
||||
* `uploadData` [UploadData[]](structures/upload-data.md) (optional)
|
||||
* `requestHeaders` Record<string, string>
|
||||
* `callback` Function
|
||||
* `beforeSendResponse` Object
|
||||
|
||||
@@ -12,6 +12,10 @@ useful for app sub-windows that act as preference panels, or similar, as the
|
||||
parent can render to the sub-window directly, as if it were a `div` in the
|
||||
parent. This is the same behavior as in the browser.
|
||||
|
||||
When `nativeWindowOpen` is set to false, `window.open` instead results in the
|
||||
creation of a [`BrowserWindowProxy`](browser-window-proxy.md), a light wrapper
|
||||
around `BrowserWindow`.
|
||||
|
||||
Electron pairs this native Chrome `Window` with a BrowserWindow under the hood.
|
||||
You can take advantage of all the customization available when creating a
|
||||
BrowserWindow in the main process by using `webContents.setWindowOpenHandler()`
|
||||
@@ -30,7 +34,7 @@ because it is invoked in the main process.
|
||||
* `frameName` string (optional)
|
||||
* `features` string (optional)
|
||||
|
||||
Returns [`Window`](https://developer.mozilla.org/en-US/docs/Web/API/Window) | null
|
||||
Returns [`BrowserWindowProxy`](browser-window-proxy.md) | [`Window`](https://developer.mozilla.org/en-US/docs/Web/API/Window)
|
||||
|
||||
`features` is a comma-separated key-value list, following the standard format of
|
||||
the browser. Electron will parse `BrowserWindowConstructorOptions` out of this
|
||||
@@ -104,3 +108,33 @@ mainWindow.webContents.setWindowOpenHandler(({ url }) => {
|
||||
const childWindow = window.open('', 'modal')
|
||||
childWindow.document.write('<h1>Hello</h1>')
|
||||
```
|
||||
|
||||
### `BrowserWindowProxy` example
|
||||
|
||||
```javascript
|
||||
|
||||
// main.js
|
||||
const mainWindow = new BrowserWindow({
|
||||
webPreferences: { nativeWindowOpen: false }
|
||||
})
|
||||
|
||||
mainWindow.webContents.setWindowOpenHandler(({ url }) => {
|
||||
if (url.startsWith('https://github.com/')) {
|
||||
return { action: 'allow' }
|
||||
}
|
||||
return { action: 'deny' }
|
||||
})
|
||||
|
||||
mainWindow.webContents.on('did-create-window', (childWindow) => {
|
||||
// For example...
|
||||
childWindow.webContents.on('will-navigate', (e) => {
|
||||
e.preventDefault()
|
||||
})
|
||||
})
|
||||
```
|
||||
|
||||
```javascript
|
||||
// renderer.js
|
||||
const windowProxy = window.open('https://github.com/', null, 'minimizable=false')
|
||||
windowProxy.postMessage('hi', '*')
|
||||
```
|
||||
|
||||
@@ -12,44 +12,6 @@ This document uses the following convention to categorize breaking changes:
|
||||
* **Deprecated:** An API was marked as deprecated. The API will continue to function, but will emit a deprecation warning, and will be removed in a future release.
|
||||
* **Removed:** An API or feature was removed, and is no longer supported by Electron.
|
||||
|
||||
## Planned Breaking API Changes (20.0)
|
||||
|
||||
### Default Changed: renderers without `nodeIntegration: true` are sandboxed by default
|
||||
|
||||
Previously, renderers that specified a preload script defaulted to being
|
||||
unsandboxed. This meant that by default, preload scripts had access to Node.js.
|
||||
In Electron 20, this default has changed. Beginning in Electron 20, renderers
|
||||
will be sandboxed by default, unless `nodeIntegration: true` or `sandbox: false`
|
||||
is specified.
|
||||
|
||||
If your preload scripts do not depend on Node, no action is needed. If your
|
||||
preload scripts _do_ depend on Node, either refactor them to remove Node usage
|
||||
from the renderer, or explicitly specify `sandbox: false` for the relevant
|
||||
renderers.
|
||||
|
||||
### Removed: `skipTaskbar` on Linux
|
||||
|
||||
On X11, `skipTaskbar` sends a `_NET_WM_STATE_SKIP_TASKBAR` message to the X11
|
||||
window manager. There is not a direct equivalent for Wayland, and the known
|
||||
workarounds have unacceptable tradeoffs (e.g. Window.is_skip_taskbar in GNOME
|
||||
requires unsafe mode), so Electron is unable to support this feature on Linux.
|
||||
|
||||
## Planned Breaking API Changes (19.0)
|
||||
|
||||
*None (yet)*
|
||||
|
||||
## Planned Breaking API Changes (18.0)
|
||||
|
||||
### Removed: `nativeWindowOpen`
|
||||
|
||||
Prior to Electron 15, `window.open` was by default shimmed to use
|
||||
`BrowserWindowProxy`. This meant that `window.open('about:blank')` did not work
|
||||
to open synchronously scriptable child windows, among other incompatibilities.
|
||||
Since Electron 15, `nativeWindowOpen` has been enabled by default.
|
||||
|
||||
See the documentation for [window.open in Electron](api/window-open.md)
|
||||
for more details.
|
||||
|
||||
## Planned Breaking API Changes (17.0)
|
||||
|
||||
### Removed: `desktopCapturer.getSources` in the renderer
|
||||
|
||||
@@ -131,7 +131,7 @@ $ gn gen out/Release --args="import(\"//electron/build/args/release.gn\")"
|
||||
Also you shouldn't have to run `gn gen` again—if you want to change the build arguments, you can run `gn args out/Testing` to bring up an editor. To see the list of available build configuration options, run `gn args out/Testing --list`.
|
||||
|
||||
**To build, run `ninja` with the `electron` target:**
|
||||
Note: This will also take a while and probably heat up your lap.
|
||||
Nota Bene: This will also take a while and probably heat up your lap.
|
||||
|
||||
For the testing configuration:
|
||||
|
||||
|
||||
@@ -15,17 +15,7 @@ Follow the guidelines below for building **Electron itself** on Linux, for the p
|
||||
* [clang](https://clang.llvm.org/get_started.html) 3.4 or later.
|
||||
* Development headers of GTK 3 and libnotify.
|
||||
|
||||
On Ubuntu >= 20.04, install the following libraries:
|
||||
|
||||
```sh
|
||||
$ sudo apt-get install build-essential clang libdbus-1-dev libgtk-3-dev \
|
||||
libnotify-dev libasound2-dev libcap-dev \
|
||||
libcups2-dev libxtst-dev \
|
||||
libxss1 libnss3-dev gcc-multilib g++-multilib curl \
|
||||
gperf bison python3-dbusmock openjdk-8-jre
|
||||
```
|
||||
|
||||
On Ubuntu < 20.04, install the following libraries:
|
||||
On Ubuntu, install the following libraries:
|
||||
|
||||
```sh
|
||||
$ sudo apt-get install build-essential clang libdbus-1-dev libgtk-3-dev \
|
||||
|
||||
@@ -35,28 +35,6 @@ base::debug::StackTrace().Print();
|
||||
|
||||
This will allow you to observe call chains and identify potential issue areas.
|
||||
|
||||
## Breakpoint Debugging
|
||||
|
||||
> Note that this will increase the size of the build significantly, taking up around 50G of disk space
|
||||
|
||||
Write the following file to `electron/.git/info/exclude/debug.gn`
|
||||
|
||||
```gn
|
||||
import("//electron/build/args/testing.gn")
|
||||
is_debug = true
|
||||
symbol_level = 2
|
||||
forbid_non_component_debug_builds = false
|
||||
```
|
||||
|
||||
Then execute:
|
||||
|
||||
```sh
|
||||
$ gn gen out/Debug --args="import(\"//electron/.git/info/exclude/debug.gn\") $GN_EXTRA_ARGS"
|
||||
$ ninja -C out/Debug electron
|
||||
```
|
||||
|
||||
Now you can use `LLDB` for breakpoint debugging.
|
||||
|
||||
## Platform-Specific Debugging
|
||||
<!-- TODO(@codebytere): add debugging file for Linux-->
|
||||
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
</head>
|
||||
<body>
|
||||
<div>
|
||||
<div>
|
||||
<h1>Asynchronous messages</h1>
|
||||
<i>Supports: Win, macOS, Linux <span>|</span> Process: Both</i>
|
||||
<div>
|
||||
<div>
|
||||
<button id="async-msg">Ping</button>
|
||||
<span id="async-reply"></span>
|
||||
</div>
|
||||
<p>Using <code>ipc</code> to send messages between processes asynchronously is the preferred method since it will return when finished without blocking other operations in the same process.</p>
|
||||
|
||||
<p>This example sends a "ping" from this process (renderer) to the main process. The main process then replies with "pong".</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
// You can also require other files to run in this process
|
||||
require('./renderer.js')
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,29 +0,0 @@
|
||||
const { app, BrowserWindow, ipcMain } = require('electron')
|
||||
|
||||
let mainWindow = null
|
||||
|
||||
function createWindow () {
|
||||
const windowOptions = {
|
||||
width: 600,
|
||||
height: 400,
|
||||
title: 'Asynchronous messages',
|
||||
webPreferences: {
|
||||
nodeIntegration: true
|
||||
}
|
||||
}
|
||||
|
||||
mainWindow = new BrowserWindow(windowOptions)
|
||||
mainWindow.loadFile('index.html')
|
||||
|
||||
mainWindow.on('closed', () => {
|
||||
mainWindow = null
|
||||
})
|
||||
}
|
||||
|
||||
app.whenReady().then(() => {
|
||||
createWindow()
|
||||
})
|
||||
|
||||
ipcMain.on('asynchronous-message', (event, arg) => {
|
||||
event.sender.send('asynchronous-reply', 'pong')
|
||||
})
|
||||
@@ -1,12 +0,0 @@
|
||||
const { ipcRenderer } = require('electron')
|
||||
|
||||
const asyncMsgBtn = document.getElementById('async-msg')
|
||||
|
||||
asyncMsgBtn.addEventListener('click', () => {
|
||||
ipcRenderer.send('asynchronous-message', 'ping')
|
||||
})
|
||||
|
||||
ipcRenderer.on('asynchronous-reply', (event, arg) => {
|
||||
const message = `Asynchronous message reply: ${arg}`
|
||||
document.getElementById('async-reply').innerHTML = message
|
||||
})
|
||||
@@ -1,27 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
</head>
|
||||
<body>
|
||||
<div>
|
||||
<div>
|
||||
<h1>Synchronous messages</h1>
|
||||
<i>Supports: Win, macOS, Linux <span>|</span> Process: Both</i>
|
||||
<div>
|
||||
<div>
|
||||
<button id="sync-msg">Ping</button>
|
||||
<span id="sync-reply"></span>
|
||||
</div>
|
||||
<p>You can use the <code>ipc</code> module to send synchronous messages between processes as well, but note that the synchronous nature of this method means that it <b>will block</b> other operations while completing its task.</p>
|
||||
|
||||
<p>This example sends a synchronous message, "ping", from this process (renderer) to the main process. The main process then replies with "pong".</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
// You can also require other files to run in this process
|
||||
require('./renderer.js')
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,29 +0,0 @@
|
||||
const { app, BrowserWindow, ipcMain } = require('electron')
|
||||
|
||||
let mainWindow = null
|
||||
|
||||
function createWindow () {
|
||||
const windowOptions = {
|
||||
width: 600,
|
||||
height: 400,
|
||||
title: 'Synchronous Messages',
|
||||
webPreferences: {
|
||||
nodeIntegration: true
|
||||
}
|
||||
}
|
||||
|
||||
mainWindow = new BrowserWindow(windowOptions)
|
||||
mainWindow.loadFile('index.html')
|
||||
|
||||
mainWindow.on('closed', () => {
|
||||
mainWindow = null
|
||||
})
|
||||
}
|
||||
|
||||
app.whenReady().then(() => {
|
||||
createWindow()
|
||||
})
|
||||
|
||||
ipcMain.on('synchronous-message', (event, arg) => {
|
||||
event.returnValue = 'pong'
|
||||
})
|
||||
@@ -1,9 +0,0 @@
|
||||
const { ipcRenderer } = require('electron')
|
||||
|
||||
const syncMsgBtn = document.getElementById('sync-msg')
|
||||
|
||||
syncMsgBtn.addEventListener('click', () => {
|
||||
const reply = ipcRenderer.sendSync('synchronous-message', 'ping')
|
||||
const message = `Synchronous message reply: ${reply}`
|
||||
document.getElementById('sync-reply').innerHTML = message
|
||||
})
|
||||
@@ -1,4 +1,4 @@
|
||||
const {app, BrowserWindow, ipcMain, dialog} = require('electron')
|
||||
const {app, BrowserWindow, ipcMain,dialog} = require('electron')
|
||||
const path = require('path')
|
||||
|
||||
async function handleFileOpen() {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const {app, BrowserWindow, Menu, ipcMain} = require('electron')
|
||||
const {app, BrowserWindow, Menu} = require('electron')
|
||||
const path = require('path')
|
||||
|
||||
function createWindow () {
|
||||
|
||||
@@ -73,7 +73,7 @@ url = ELECTRON_MIRROR + ELECTRON_CUSTOM_DIR + '/' + ELECTRON_CUSTOM_FILENAME
|
||||
For instance, to use the China CDN mirror:
|
||||
|
||||
```shell
|
||||
ELECTRON_MIRROR="https://npmmirror.com/mirrors/electron/"
|
||||
ELECTRON_MIRROR="https://cdn.npm.taobao.org/dist/electron/"
|
||||
```
|
||||
|
||||
By default, `ELECTRON_CUSTOM_DIR` is set to `v$VERSION`. To change the format,
|
||||
@@ -83,12 +83,12 @@ resolves to `version-5.0.0`, `{{ version }}` resolves to `5.0.0`, and
|
||||
use the China non-CDN mirror:
|
||||
|
||||
```shell
|
||||
ELECTRON_MIRROR="https://npmmirror.com/mirrors/electron/"
|
||||
ELECTRON_MIRROR="https://npm.taobao.org/mirrors/electron/"
|
||||
ELECTRON_CUSTOM_DIR="{{ version }}"
|
||||
```
|
||||
|
||||
The above configuration will download from URLs such as
|
||||
`https://npmmirror.com/mirrors/electron/8.0.0/electron-v8.0.0-linux-x64.zip`.
|
||||
`https://npm.taobao.org/mirrors/electron/8.0.0/electron-v8.0.0-linux-x64.zip`.
|
||||
|
||||
If your mirror serves artifacts with different checksums to the official
|
||||
Electron release you may have to set `electron_use_remote_checksums=1` to
|
||||
|
||||
@@ -413,7 +413,7 @@ function createWindow () {
|
||||
```
|
||||
|
||||
For the purposes of the tutorial, it's important to note that the `click` handler
|
||||
sends a message (either `1` or `-1`) to the renderer process through the `update-counter` channel.
|
||||
sends a message (either `1` or `-1`) to the renderer process through the `counter` channel.
|
||||
|
||||
```javascript
|
||||
click: () => mainWindow.webContents.send('update-counter', -1)
|
||||
|
||||
@@ -10,7 +10,7 @@ for answers to questions,
|
||||
or to join in discussion with other developers who use Electron,
|
||||
you can interact with the community in these locations:
|
||||
|
||||
* [Electron's Discord server](https://discord.com/invite/APGC3k5yaH) has channels for:
|
||||
* [`Electron's Discord`](https://discord.com/invite/electron) has channels for:
|
||||
* Getting help
|
||||
* Ecosystem apps like [Electron Forge](https://github.com/electron-userland/electron-forge) and [Electron Fiddle](https://github.com/electron/fiddle)
|
||||
* Sharing ideas with other Electron app developers
|
||||
@@ -70,10 +70,10 @@ until the maintainers feel the maintenance burden is too high to continue doing
|
||||
|
||||
### Currently supported versions
|
||||
|
||||
* 18.x.y
|
||||
* 17.x.y
|
||||
* 16.x.y
|
||||
* 15.x.y
|
||||
* 14.x.y
|
||||
|
||||
### End-of-life
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
Being based on Chromium, Electron requires a display driver to function.
|
||||
If Chromium can't find a display driver, Electron will fail to launch -
|
||||
and therefore not executing any of your tests, regardless of how you are running
|
||||
them. Testing Electron-based apps on Travis, CircleCI, Jenkins or similar Systems
|
||||
them. Testing Electron-based apps on Travis, Circle, Jenkins or similar Systems
|
||||
requires therefore a little bit of configuration. In essence, we need to use
|
||||
a virtual display driver.
|
||||
|
||||
@@ -49,9 +49,10 @@ install:
|
||||
|
||||
For Jenkins, a [Xvfb plugin is available](https://wiki.jenkins-ci.org/display/JENKINS/Xvfb+Plugin).
|
||||
|
||||
### CircleCI
|
||||
### Circle CI
|
||||
|
||||
CircleCI is awesome and has Xvfb and `$DISPLAY` already set up, so no further configuration is required.
|
||||
Circle CI is awesome and has Xvfb and `$DISPLAY`
|
||||
[already set up, so no further configuration is required](https://circleci.com/docs/environment#browsers).
|
||||
|
||||
### AppVeyor
|
||||
|
||||
|
||||
@@ -175,9 +175,9 @@ template("electron_paks") {
|
||||
source_patterns = [
|
||||
"${root_gen_dir}/chrome/platform_locale_settings_",
|
||||
"${root_gen_dir}/components/strings/components_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_",
|
||||
@@ -187,21 +187,21 @@ template("electron_paks") {
|
||||
"//chrome/app/resources:platform_locale_settings",
|
||||
"//components/strings:components_strings",
|
||||
"//device/bluetooth/strings",
|
||||
"//extensions/strings",
|
||||
"//services/strings",
|
||||
"//third_party/blink/public/strings",
|
||||
"//third_party/blink/public/strings:accessibility_strings",
|
||||
"//ui/strings:app_locale_settings",
|
||||
"//ui/strings:ax_strings",
|
||||
"//ui/strings:ui_strings",
|
||||
]
|
||||
|
||||
input_locales = platform_pak_locales
|
||||
input_locales = locales
|
||||
output_dir = "${invoker.output_dir}/locales"
|
||||
|
||||
if (is_mac) {
|
||||
output_locales = locales_as_mac_outputs
|
||||
} else {
|
||||
output_locales = platform_pak_locales
|
||||
output_locales = locales
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -145,16 +145,4 @@
|
||||
</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>
|
||||
|
||||
@@ -5,6 +5,7 @@ auto_filenames = {
|
||||
"docs/api/app.md",
|
||||
"docs/api/auto-updater.md",
|
||||
"docs/api/browser-view.md",
|
||||
"docs/api/browser-window-proxy.md",
|
||||
"docs/api/browser-window.md",
|
||||
"docs/api/client-request.md",
|
||||
"docs/api/clipboard.md",
|
||||
@@ -228,6 +229,7 @@ auto_filenames = {
|
||||
"lib/browser/devtools.ts",
|
||||
"lib/browser/guest-view-manager.ts",
|
||||
"lib/browser/guest-window-manager.ts",
|
||||
"lib/browser/guest-window-proxy.ts",
|
||||
"lib/browser/init.ts",
|
||||
"lib/browser/ipc-main-impl.ts",
|
||||
"lib/browser/ipc-main-internal-utils.ts",
|
||||
|
||||
@@ -386,6 +386,8 @@ filenames = {
|
||||
"shell/browser/file_select_helper.cc",
|
||||
"shell/browser/file_select_helper.h",
|
||||
"shell/browser/file_select_helper_mac.mm",
|
||||
"shell/browser/font/electron_font_access_delegate.cc",
|
||||
"shell/browser/font/electron_font_access_delegate.h",
|
||||
"shell/browser/font_defaults.cc",
|
||||
"shell/browser/font_defaults.h",
|
||||
"shell/browser/hid/electron_hid_delegate.cc",
|
||||
@@ -679,6 +681,8 @@ filenames = {
|
||||
]
|
||||
|
||||
lib_sources_extensions = [
|
||||
"shell/browser/extensions/api/i18n/i18n_api.cc",
|
||||
"shell/browser/extensions/api/i18n/i18n_api.h",
|
||||
"shell/browser/extensions/api/cryptotoken_private/cryptotoken_private_api.cc",
|
||||
"shell/browser/extensions/api/cryptotoken_private/cryptotoken_private_api.h",
|
||||
"shell/browser/extensions/api/management/electron_management_api_delegate.cc",
|
||||
|
||||
@@ -35,7 +35,7 @@ const spawnUpdate = function (args: string[], detached: boolean, callback: Funct
|
||||
spawnedArgs = args || [];
|
||||
}
|
||||
} catch (error1) {
|
||||
error = error1 as Error;
|
||||
error = error1;
|
||||
|
||||
// Shouldn't happen, but still guard it.
|
||||
process.nextTick(function () {
|
||||
|
||||
@@ -5,8 +5,7 @@ const isWindows = process.platform === 'win32';
|
||||
const isLinux = process.platform === 'linux';
|
||||
|
||||
type RoleId = 'about' | 'close' | 'copy' | 'cut' | 'delete' | 'forcereload' | 'front' | 'help' | 'hide' | 'hideothers' | 'minimize' |
|
||||
'paste' | 'pasteandmatchstyle' | 'quit' | 'redo' | 'reload' | 'resetzoom' | 'selectall' | 'services' | 'recentdocuments' | 'clearrecentdocuments' |
|
||||
'showsubstitutions' | 'togglesmartquotes' | 'togglesmartdashes' | 'toggletextreplacement' | 'startspeaking' | 'stopspeaking' |
|
||||
'paste' | 'pasteandmatchstyle' | 'quit' | 'redo' | 'reload' | 'resetzoom' | 'selectall' | 'services' | 'recentdocuments' | 'clearrecentdocuments' | 'startspeaking' | 'stopspeaking' |
|
||||
'toggledevtools' | 'togglefullscreen' | 'undo' | 'unhide' | 'window' | 'zoom' | 'zoomin' | 'zoomout' | 'togglespellchecker' |
|
||||
'appmenu' | 'filemenu' | 'editmenu' | 'viewmenu' | 'windowmenu' | 'sharemenu'
|
||||
interface Role {
|
||||
@@ -134,18 +133,6 @@ export const roleList: Record<RoleId, Role> = {
|
||||
clearrecentdocuments: {
|
||||
label: 'Clear Menu'
|
||||
},
|
||||
showsubstitutions: {
|
||||
label: 'Show Substitutions'
|
||||
},
|
||||
togglesmartquotes: {
|
||||
label: 'Smart Quotes'
|
||||
},
|
||||
togglesmartdashes: {
|
||||
label: 'Smart Dashes'
|
||||
},
|
||||
toggletextreplacement: {
|
||||
label: 'Text Replacement'
|
||||
},
|
||||
startspeaking: {
|
||||
label: 'Start Speaking'
|
||||
},
|
||||
@@ -250,16 +237,6 @@ export const roleList: Record<RoleId, Role> = {
|
||||
{ role: 'delete' },
|
||||
{ role: 'selectAll' },
|
||||
{ type: 'separator' },
|
||||
{
|
||||
label: 'Substitutions',
|
||||
submenu: [
|
||||
{ role: 'showSubstitutions' },
|
||||
{ type: 'separator' },
|
||||
{ role: 'toggleSmartQuotes' },
|
||||
{ role: 'toggleSmartDashes' },
|
||||
{ role: 'toggleTextReplacement' }
|
||||
]
|
||||
},
|
||||
{
|
||||
label: 'Speech',
|
||||
submenu: [
|
||||
|
||||
@@ -61,25 +61,24 @@ class IncomingMessage extends Readable {
|
||||
const filteredHeaders: Record<string, string | string[]> = {};
|
||||
const { rawHeaders } = this._responseHead;
|
||||
rawHeaders.forEach(header => {
|
||||
const keyLowerCase = header.key.toLowerCase();
|
||||
if (Object.prototype.hasOwnProperty.call(filteredHeaders, keyLowerCase) &&
|
||||
discardableDuplicateHeaders.has(keyLowerCase)) {
|
||||
if (Object.prototype.hasOwnProperty.call(filteredHeaders, header.key) &&
|
||||
discardableDuplicateHeaders.has(header.key)) {
|
||||
// do nothing with discardable duplicate headers
|
||||
} else {
|
||||
if (keyLowerCase === 'set-cookie') {
|
||||
if (header.key === 'set-cookie') {
|
||||
// keep set-cookie as an array per Node.js rules
|
||||
// see https://nodejs.org/api/http.html#http_message_headers
|
||||
if (Object.prototype.hasOwnProperty.call(filteredHeaders, keyLowerCase)) {
|
||||
(filteredHeaders[keyLowerCase] as string[]).push(header.value);
|
||||
if (Object.prototype.hasOwnProperty.call(filteredHeaders, header.key)) {
|
||||
(filteredHeaders[header.key] as string[]).push(header.value);
|
||||
} else {
|
||||
filteredHeaders[keyLowerCase] = [header.value];
|
||||
filteredHeaders[header.key] = [header.value];
|
||||
}
|
||||
} else {
|
||||
// for non-cookie headers, the values are joined together with ', '
|
||||
if (Object.prototype.hasOwnProperty.call(filteredHeaders, keyLowerCase)) {
|
||||
filteredHeaders[keyLowerCase] += `, ${header.value}`;
|
||||
if (Object.prototype.hasOwnProperty.call(filteredHeaders, header.key)) {
|
||||
filteredHeaders[header.key] += `, ${header.value}`;
|
||||
} else {
|
||||
filteredHeaders[keyLowerCase] = header.value;
|
||||
filteredHeaders[header.key] = header.value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -87,15 +86,6 @@ class IncomingMessage extends Readable {
|
||||
return filteredHeaders;
|
||||
}
|
||||
|
||||
get rawHeaders () {
|
||||
const rawHeadersArr: string[] = [];
|
||||
const { rawHeaders } = this._responseHead;
|
||||
rawHeaders.forEach(header => {
|
||||
rawHeadersArr.push(header.key, header.value);
|
||||
});
|
||||
return rawHeadersArr;
|
||||
}
|
||||
|
||||
get httpVersion () {
|
||||
return `${this.httpVersionMajor}.${this.httpVersionMinor}`;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { app, ipcMain, session, webFrameMain, deprecate } from 'electron/main';
|
||||
import { app, ipcMain, session, deprecate, webFrameMain } from 'electron/main';
|
||||
import type { BrowserWindowConstructorOptions, LoadURLOptions } from 'electron/main';
|
||||
|
||||
import * as url from 'url';
|
||||
@@ -500,6 +500,7 @@ WebContents.prototype._callWindowOpenHandler = function (event: Electron.Event,
|
||||
if (!this._windowOpenHandler) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const response = this._windowOpenHandler(details);
|
||||
|
||||
if (typeof response !== 'object') {
|
||||
@@ -560,10 +561,6 @@ const loggingEnabled = () => {
|
||||
|
||||
// Add JavaScript wrappers for WebContents class.
|
||||
WebContents.prototype._init = function () {
|
||||
const prefs = this.getLastWebPreferences() || {};
|
||||
if (!prefs.nodeIntegration && (prefs.preload != null || prefs.preloadURL != null) && prefs.sandbox == null) {
|
||||
deprecate.log('The default sandbox option for windows without nodeIntegration is changing. Presently, by default, when a window has a preload script, it defaults to being unsandboxed. In Electron 20, this default will be changing, and all windows that have nodeIntegration: false (which is the default) will be sandboxed by default. If your preload script doesn\'t use Node, no action is needed. If your preload script does use Node, either refactor it to move Node usage to the main process, or specify sandbox: false in your WebPreferences.');
|
||||
}
|
||||
// Read off the ID at construction time, so that it's accessible even after
|
||||
// the underlying C++ WebContents is destroyed.
|
||||
const id = this.id;
|
||||
@@ -656,7 +653,15 @@ WebContents.prototype._init = function () {
|
||||
postBody,
|
||||
disposition
|
||||
};
|
||||
const options = this._callWindowOpenHandler(event, details);
|
||||
|
||||
let options;
|
||||
try {
|
||||
options = this._callWindowOpenHandler(event, details);
|
||||
} catch (err) {
|
||||
event.preventDefault();
|
||||
throw err;
|
||||
}
|
||||
|
||||
if (!event.defaultPrevented) {
|
||||
openGuestWindow({
|
||||
event,
|
||||
@@ -684,7 +689,16 @@ WebContents.prototype._init = function () {
|
||||
referrer,
|
||||
postBody
|
||||
};
|
||||
windowOpenOverriddenOptions = this._callWindowOpenHandler(event, details);
|
||||
|
||||
let result;
|
||||
try {
|
||||
result = this._callWindowOpenHandler(event, details);
|
||||
} catch (err) {
|
||||
event.preventDefault();
|
||||
throw err;
|
||||
}
|
||||
|
||||
windowOpenOverriddenOptions = result;
|
||||
if (!event.defaultPrevented) {
|
||||
const secureOverrideWebPreferences = windowOpenOverriddenOptions ? {
|
||||
// Allow setting of backgroundColor as a webPreference even though
|
||||
@@ -697,8 +711,8 @@ WebContents.prototype._init = function () {
|
||||
// TODO(zcbenz): The features string is parsed twice: here where it is
|
||||
// passed to C++, and in |makeBrowserWindowOptions| later where it is
|
||||
// not actually used since the WebContents is created here.
|
||||
// We should be able to remove the latter once the |new-window| event
|
||||
// is removed.
|
||||
// We should be able to remove the latter once the |nativeWindowOpen|
|
||||
// option is removed.
|
||||
const { webPreferences: parsedWebPreferences } = parseFeatures(rawFeatures);
|
||||
// Parameters should keep same with |makeBrowserWindowOptions|.
|
||||
const webPreferences = makeWebPreferences({
|
||||
@@ -710,7 +724,8 @@ WebContents.prototype._init = function () {
|
||||
}
|
||||
});
|
||||
|
||||
// Create a new browser window for "window.open"
|
||||
// Create a new browser window for the native implementation of
|
||||
// "window.open", used in sandbox and nativeWindowOpen mode.
|
||||
this.on('-add-new-contents' as any, (event: ElectronInternal.Event, webContents: Electron.WebContents, disposition: string,
|
||||
_userGesture: boolean, _left: number, _top: number, _width: number, _height: number, url: string, frameName: string,
|
||||
referrer: Electron.Referrer, rawFeatures: string, postData: PostData) => {
|
||||
@@ -738,6 +753,11 @@ WebContents.prototype._init = function () {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
const prefs = this.getLastWebPreferences() || {};
|
||||
if (prefs.nativeWindowOpen === false) {
|
||||
deprecate.log('Deprecation Warning: Disabling nativeWindowOpen is deprecated. The nativeWindowOpen option will be removed in Electron 18.');
|
||||
}
|
||||
}
|
||||
|
||||
this.on('login', (event, ...args) => {
|
||||
|
||||
@@ -31,7 +31,7 @@ export const setDefaultApplicationMenu = () => {
|
||||
{
|
||||
label: 'Community Discussions',
|
||||
click: async () => {
|
||||
await shell.openExternal('https://discord.com/invite/APGC3k5yaH');
|
||||
await shell.openExternal('https://discord.gg/electron');
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -56,6 +56,7 @@ function makeWebPreferences (embedder: Electron.WebContents, params: Record<stri
|
||||
const inheritedWebPreferences = new Map([
|
||||
['contextIsolation', true],
|
||||
['javascript', false],
|
||||
['nativeWindowOpen', true],
|
||||
['nodeIntegration', false],
|
||||
['sandbox', true],
|
||||
['nodeIntegrationInSubFrames', false],
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
/**
|
||||
* Create and minimally track guest windows at the direction of the renderer
|
||||
* (via window.open). Here, "guest" roughly means "child" — it's not necessarily
|
||||
* emblematic of its process status; both in-process (same-origin) and
|
||||
* out-of-process (cross-origin) are created here. "Embedder" roughly means
|
||||
* "parent."
|
||||
* emblematic of its process status; both in-process (same-origin
|
||||
* nativeWindowOpen) and out-of-process (cross-origin nativeWindowOpen and
|
||||
* BrowserWindowProxy) are created here. "Embedder" roughly means "parent."
|
||||
*/
|
||||
import { BrowserWindow } from 'electron/main';
|
||||
import type { BrowserWindowConstructorOptions, Referrer, WebContents, LoadURLOptions } from 'electron/main';
|
||||
import { parseFeatures } from '@electron/internal/browser/parse-features-string';
|
||||
import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
|
||||
|
||||
type PostData = LoadURLOptions['postData']
|
||||
export type WindowOpenArgs = {
|
||||
@@ -22,12 +23,13 @@ const unregisterFrameName = (name: string) => frameNamesToWindow.delete(name);
|
||||
const getGuestWindowByFrameName = (name: string) => frameNamesToWindow.get(name);
|
||||
|
||||
/**
|
||||
* `openGuestWindow` is called to create and setup event handling for the new
|
||||
* window.
|
||||
* `openGuestWindow` is called for both implementations of window.open
|
||||
* (BrowserWindowProxy and nativeWindowOpen) to create and setup event handling
|
||||
* for the new window.
|
||||
*
|
||||
* Until its removal in 12.0.0, the `new-window` event is fired, allowing the
|
||||
* user to preventDefault() on the passed event (which ends up calling
|
||||
* DestroyWebContents).
|
||||
* DestroyWebContents in the nativeWindowOpen code path).
|
||||
*/
|
||||
export function openGuestWindow ({ event, embedder, guest, referrer, disposition, postData, overrideBrowserWindowOptions, windowOpenArgs }: {
|
||||
event: { sender: WebContents, defaultPrevented: boolean },
|
||||
@@ -76,6 +78,22 @@ export function openGuestWindow ({ event, embedder, guest, referrer, disposition
|
||||
webContents: guest,
|
||||
...browserWindowOptions
|
||||
});
|
||||
if (!guest) {
|
||||
// We should only call `loadURL` if the webContents was constructed by us in
|
||||
// the case of BrowserWindowProxy (non-sandboxed, nativeWindowOpen: false),
|
||||
// as navigating to the url when creating the window from an existing
|
||||
// webContents is not necessary (it will navigate there anyway).
|
||||
// This can also happen if we enter this function from OpenURLFromTab, in
|
||||
// which case 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 });
|
||||
|
||||
@@ -100,7 +118,9 @@ const handleWindowLifecycleEvents = function ({ embedder, guest, frameName }: {
|
||||
guest.destroy();
|
||||
};
|
||||
|
||||
const cachedGuestId = guest.webContents.id;
|
||||
const closedByUser = function () {
|
||||
embedder._sendInternal(`${IPC_MESSAGES.GUEST_WINDOW_MANAGER_WINDOW_CLOSED}_${cachedGuestId}`);
|
||||
embedder.removeListener('current-render-view-deleted' as any, closedByEmbedder);
|
||||
};
|
||||
embedder.once('current-render-view-deleted' as any, closedByEmbedder);
|
||||
@@ -175,6 +195,7 @@ function emitDeprecatedNewWindowEvent ({ event, embedder, guest, windowOpenArgs,
|
||||
const securityWebPreferences: { [key: string]: boolean } = {
|
||||
contextIsolation: true,
|
||||
javascript: false,
|
||||
nativeWindowOpen: true,
|
||||
nodeIntegration: false,
|
||||
sandbox: true,
|
||||
webviewTag: false,
|
||||
@@ -196,10 +217,10 @@ function makeBrowserWindowOptions ({ embedder, features, overrideOptions }: {
|
||||
height: 600,
|
||||
...parsedOptions,
|
||||
...overrideOptions,
|
||||
// Note that for normal code path an existing WebContents created by
|
||||
// Chromium will be used, with web preferences parsed in the
|
||||
// |-will-add-new-contents| event.
|
||||
// The |webPreferences| here is only used by the |new-window| event.
|
||||
// Note that for |nativeWindowOpen: true| the WebContents is created in
|
||||
// |api::WebContents::WebContentsCreatedWithFullParams|, with prefs
|
||||
// parsed in the |-will-add-new-contents| event.
|
||||
// The |webPreferences| here is only used by |nativeWindowOpen: false|.
|
||||
webPreferences: makeWebPreferences({
|
||||
embedder,
|
||||
insecureParsedWebPreferences: parsedWebPreferences,
|
||||
@@ -224,6 +245,7 @@ export function makeWebPreferences ({ embedder, secureOverrideWebPreferences = {
|
||||
}
|
||||
return map;
|
||||
}, {} as Electron.WebPreferences));
|
||||
const openerId = parentWebPreferences.nativeWindowOpen ? null : embedder.id;
|
||||
|
||||
return {
|
||||
...parsedWebPreferences,
|
||||
@@ -231,10 +253,22 @@ export function makeWebPreferences ({ embedder, secureOverrideWebPreferences = {
|
||||
// ability to change important security options but allow main (via
|
||||
// setWindowOpenHandler) to change them.
|
||||
...securityWebPreferencesFromParent,
|
||||
...secureOverrideWebPreferences
|
||||
...secureOverrideWebPreferences,
|
||||
// Sets correct openerId here to give correct options to 'new-window' event handler
|
||||
// TODO: Figure out another way to pass this?
|
||||
openerId
|
||||
};
|
||||
}
|
||||
|
||||
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';
|
||||
|
||||
|
||||
213
lib/browser/guest-window-proxy.ts
Normal file
213
lib/browser/guest-window-proxy.ts
Normal file
@@ -0,0 +1,213 @@
|
||||
/**
|
||||
* Manage guest windows when using the default BrowserWindowProxy version of the
|
||||
* renderer's window.open (i.e. nativeWindowOpen off). This module mostly
|
||||
* consists of marshaling IPC requests from the BrowserWindowProxy to the
|
||||
* WebContents.
|
||||
*/
|
||||
import { webContents, BrowserWindow } from 'electron/main';
|
||||
import type { WebContents } from 'electron/main';
|
||||
import { ipcMainInternal } from '@electron/internal/browser/ipc-main-internal';
|
||||
import * as ipcMainUtils from '@electron/internal/browser/ipc-main-internal-utils';
|
||||
import { openGuestWindow } from '@electron/internal/browser/guest-window-manager';
|
||||
import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
|
||||
|
||||
const { isSameOrigin } = process._linkedBinding('electron_common_v8_util');
|
||||
|
||||
const getGuestWindow = function (guestContents: WebContents) {
|
||||
let guestWindow = BrowserWindow.fromWebContents(guestContents);
|
||||
if (guestWindow == null) {
|
||||
const hostContents = guestContents.hostWebContents;
|
||||
if (hostContents != null) {
|
||||
guestWindow = BrowserWindow.fromWebContents(hostContents);
|
||||
}
|
||||
}
|
||||
if (!guestWindow) {
|
||||
throw new Error('getGuestWindow failed');
|
||||
}
|
||||
return guestWindow;
|
||||
};
|
||||
|
||||
const isChildWindow = function (sender: WebContents, target: WebContents) {
|
||||
return target.getLastWebPreferences()!.openerId === sender.id;
|
||||
};
|
||||
|
||||
const isRelatedWindow = function (sender: WebContents, target: WebContents) {
|
||||
return isChildWindow(sender, target) || isChildWindow(target, sender);
|
||||
};
|
||||
|
||||
const isScriptableWindow = function (sender: WebContents, target: WebContents) {
|
||||
return (
|
||||
isRelatedWindow(sender, target) &&
|
||||
isSameOrigin(sender.getURL(), target.getURL())
|
||||
);
|
||||
};
|
||||
|
||||
const isNodeIntegrationEnabled = function (sender: WebContents) {
|
||||
return sender.getLastWebPreferences()!.nodeIntegration === true;
|
||||
};
|
||||
|
||||
// Checks whether |sender| can access the |target|:
|
||||
const canAccessWindow = function (sender: WebContents, target: WebContents) {
|
||||
return (
|
||||
isChildWindow(sender, target) ||
|
||||
isScriptableWindow(sender, target) ||
|
||||
isNodeIntegrationEnabled(sender)
|
||||
);
|
||||
};
|
||||
|
||||
// Routed window.open messages with raw options
|
||||
ipcMainInternal.on(
|
||||
IPC_MESSAGES.GUEST_WINDOW_MANAGER_WINDOW_OPEN,
|
||||
(
|
||||
event,
|
||||
url: string,
|
||||
frameName: string,
|
||||
features: string
|
||||
) => {
|
||||
// This should only be allowed for senders that have nativeWindowOpen: false
|
||||
const lastWebPreferences = event.sender.getLastWebPreferences()!;
|
||||
if (lastWebPreferences.nativeWindowOpen || lastWebPreferences.sandbox) {
|
||||
event.returnValue = null;
|
||||
throw new Error(
|
||||
'GUEST_WINDOW_MANAGER_WINDOW_OPEN denied: expected native window.open'
|
||||
);
|
||||
}
|
||||
|
||||
const referrer: Electron.Referrer = { url: '', policy: 'strict-origin-when-cross-origin' };
|
||||
const browserWindowOptions = event.sender._callWindowOpenHandler(event, { url, frameName, features, disposition: 'new-window', referrer });
|
||||
if (event.defaultPrevented) {
|
||||
event.returnValue = null;
|
||||
return;
|
||||
}
|
||||
const guest = openGuestWindow({
|
||||
event,
|
||||
embedder: event.sender,
|
||||
referrer,
|
||||
disposition: 'new-window',
|
||||
overrideBrowserWindowOptions: browserWindowOptions!,
|
||||
windowOpenArgs: {
|
||||
url: url || 'about:blank',
|
||||
frameName: frameName || '',
|
||||
features: features || ''
|
||||
}
|
||||
});
|
||||
|
||||
event.returnValue = guest ? guest.webContents.id : null;
|
||||
}
|
||||
);
|
||||
|
||||
type IpcHandler<T, Event> = (event: Event, guestContents: Electron.WebContents, ...args: any[]) => T;
|
||||
const makeSafeHandler = function<T, Event> (handler: IpcHandler<T, Event>) {
|
||||
return (event: Event, guestId: number, ...args: any[]) => {
|
||||
// Access webContents via electron to prevent circular require.
|
||||
const guestContents = webContents.fromId(guestId);
|
||||
if (!guestContents) {
|
||||
throw new Error(`Invalid guestId: ${guestId}`);
|
||||
}
|
||||
|
||||
return handler(event, guestContents as Electron.WebContents, ...args);
|
||||
};
|
||||
};
|
||||
|
||||
const handleMessage = function (channel: string, handler: IpcHandler<any, Electron.IpcMainInvokeEvent>) {
|
||||
ipcMainInternal.handle(channel, makeSafeHandler(handler));
|
||||
};
|
||||
|
||||
const handleMessageSync = function (channel: string, handler: IpcHandler<any, ElectronInternal.IpcMainInternalEvent>) {
|
||||
ipcMainUtils.handleSync(channel, makeSafeHandler(handler));
|
||||
};
|
||||
|
||||
type ContentsCheck = (contents: WebContents, guestContents: WebContents) => boolean;
|
||||
const securityCheck = function (contents: WebContents, guestContents: WebContents, check: ContentsCheck) {
|
||||
if (!check(contents, guestContents)) {
|
||||
console.error(
|
||||
`Blocked ${contents.getURL()} from accessing guestId: ${guestContents.id}`
|
||||
);
|
||||
throw new Error(`Access denied to guestId: ${guestContents.id}`);
|
||||
}
|
||||
};
|
||||
|
||||
const windowMethods = new Set(['destroy', 'focus', 'blur']);
|
||||
|
||||
handleMessage(
|
||||
IPC_MESSAGES.GUEST_WINDOW_MANAGER_WINDOW_METHOD,
|
||||
(event, guestContents, method, ...args) => {
|
||||
securityCheck(event.sender, guestContents, canAccessWindow);
|
||||
|
||||
if (!windowMethods.has(method)) {
|
||||
console.error(
|
||||
`Blocked ${event.senderFrame.url} from calling method: ${method}`
|
||||
);
|
||||
throw new Error(`Invalid method: ${method}`);
|
||||
}
|
||||
|
||||
return (getGuestWindow(guestContents) as any)[method](...args);
|
||||
}
|
||||
);
|
||||
|
||||
handleMessage(
|
||||
IPC_MESSAGES.GUEST_WINDOW_MANAGER_WINDOW_POSTMESSAGE,
|
||||
(event, guestContents, message, targetOrigin, sourceOrigin) => {
|
||||
if (targetOrigin == null) {
|
||||
targetOrigin = '*';
|
||||
}
|
||||
|
||||
// The W3C does not seem to have word on how postMessage should work when the
|
||||
// origins do not match, so we do not do |canAccessWindow| check here since
|
||||
// postMessage across origins is useful and not harmful.
|
||||
securityCheck(event.sender, guestContents, isRelatedWindow);
|
||||
|
||||
if (
|
||||
targetOrigin === '*' ||
|
||||
isSameOrigin(guestContents.getURL(), targetOrigin)
|
||||
) {
|
||||
const sourceId = event.sender.id;
|
||||
guestContents._sendInternal(
|
||||
IPC_MESSAGES.GUEST_WINDOW_POSTMESSAGE,
|
||||
sourceId,
|
||||
message,
|
||||
sourceOrigin
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
const webContentsMethodsAsync = new Set([
|
||||
'loadURL',
|
||||
'executeJavaScript',
|
||||
'print'
|
||||
]);
|
||||
|
||||
handleMessage(
|
||||
IPC_MESSAGES.GUEST_WINDOW_MANAGER_WEB_CONTENTS_METHOD,
|
||||
(event, guestContents, method, ...args) => {
|
||||
securityCheck(event.sender, guestContents, canAccessWindow);
|
||||
|
||||
if (!webContentsMethodsAsync.has(method)) {
|
||||
console.error(
|
||||
`Blocked ${event.sender.getURL()} from calling method: ${method}`
|
||||
);
|
||||
throw new Error(`Invalid method: ${method}`);
|
||||
}
|
||||
|
||||
return (guestContents as any)[method](...args);
|
||||
}
|
||||
);
|
||||
|
||||
const webContentsMethodsSync = new Set(['getURL']);
|
||||
|
||||
handleMessageSync(
|
||||
IPC_MESSAGES.GUEST_WINDOW_MANAGER_WEB_CONTENTS_METHOD,
|
||||
(event, guestContents, method, ...args) => {
|
||||
securityCheck(event.sender, guestContents, canAccessWindow);
|
||||
|
||||
if (!webContentsMethodsSync.has(method)) {
|
||||
console.error(
|
||||
`Blocked ${event.sender.getURL()} from calling method: ${method}`
|
||||
);
|
||||
throw new Error(`Invalid method: ${method}`);
|
||||
}
|
||||
|
||||
return (guestContents as any)[method](...args);
|
||||
}
|
||||
);
|
||||
@@ -78,6 +78,7 @@ require('@electron/internal/browser/rpc-server');
|
||||
|
||||
// Load the guest view manager.
|
||||
require('@electron/internal/browser/guest-view-manager');
|
||||
require('@electron/internal/browser/guest-window-proxy');
|
||||
|
||||
// Now we try to load app's package.json.
|
||||
const v8Util = process._linkedBinding('electron_common_v8_util');
|
||||
|
||||
@@ -15,7 +15,7 @@ export class IpcMainImpl extends EventEmitter {
|
||||
try {
|
||||
e._reply(await Promise.resolve(fn(e, ...args)));
|
||||
} catch (err) {
|
||||
e._throw(err as Error);
|
||||
e._throw(err);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -18,6 +18,13 @@ export const enum IPC_MESSAGES {
|
||||
GUEST_VIEW_MANAGER_PROPERTY_GET = 'GUEST_VIEW_MANAGER_PROPERTY_GET',
|
||||
GUEST_VIEW_MANAGER_PROPERTY_SET = 'GUEST_VIEW_MANAGER_PROPERTY_SET',
|
||||
|
||||
GUEST_WINDOW_MANAGER_WINDOW_OPEN = 'GUEST_WINDOW_MANAGER_WINDOW_OPEN',
|
||||
GUEST_WINDOW_MANAGER_WINDOW_CLOSED = 'GUEST_WINDOW_MANAGER_WINDOW_CLOSED',
|
||||
GUEST_WINDOW_MANAGER_WINDOW_POSTMESSAGE = 'GUEST_WINDOW_MANAGER_WINDOW_POSTMESSAGE',
|
||||
GUEST_WINDOW_MANAGER_WINDOW_METHOD = 'GUEST_WINDOW_MANAGER_WINDOW_METHOD',
|
||||
GUEST_WINDOW_MANAGER_WEB_CONTENTS_METHOD = 'GUEST_WINDOW_MANAGER_WEB_CONTENTS_METHOD',
|
||||
GUEST_WINDOW_POSTMESSAGE = 'GUEST_WINDOW_POSTMESSAGE',
|
||||
|
||||
RENDERER_WEB_FRAME_METHOD = 'RENDERER_WEB_FRAME_METHOD',
|
||||
|
||||
INSPECTOR_CONFIRM = 'INSPECTOR_CONFIRM',
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
// Rip global off of window (which is also global) so that webpack doesn't
|
||||
// auto replace it with a looped reference to this file
|
||||
const _global = typeof globalThis !== 'undefined' ? globalThis.global : (self || window).global;
|
||||
const _global = typeof globalThis !== 'undefined' ? globalThis.global : (self as any || window as any).global as NodeJS.Global;
|
||||
const process = _global.process;
|
||||
const Buffer = _global.Buffer;
|
||||
|
||||
|
||||
@@ -12,7 +12,9 @@ const v8Util = process._linkedBinding('electron_common_v8_util');
|
||||
const nodeIntegration = mainFrame.getWebPreference('nodeIntegration');
|
||||
const webviewTag = mainFrame.getWebPreference('webviewTag');
|
||||
const isHiddenPage = mainFrame.getWebPreference('hiddenPage');
|
||||
const nativeWindowOpen = mainFrame.getWebPreference('nativeWindowOpen') || process.sandboxed;
|
||||
const isWebView = mainFrame.getWebPreference('isWebView');
|
||||
const openerId = mainFrame.getWebPreference('openerId');
|
||||
|
||||
// ElectronApiServiceImpl will look for the "ipcNative" hidden object when
|
||||
// invoking the 'onMessage' callback.
|
||||
@@ -42,7 +44,7 @@ switch (window.location.protocol) {
|
||||
default: {
|
||||
// Override default web functions.
|
||||
const { windowSetup } = require('@electron/internal/renderer/window-setup') as typeof windowSetupModule;
|
||||
windowSetup(isWebView, isHiddenPage);
|
||||
windowSetup(isWebView, openerId, isHiddenPage, nativeWindowOpen);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { webFrame } from 'electron';
|
||||
import { ipcRendererInternal } from '@electron/internal/renderer/ipc-renderer-internal';
|
||||
import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
|
||||
|
||||
const { mainFrame: webFrame } = process._linkedBinding('electron_renderer_web_frame');
|
||||
|
||||
let shouldLog: boolean | null = null;
|
||||
|
||||
const { platform, execPath, env } = process;
|
||||
|
||||
@@ -1,10 +1,249 @@
|
||||
import { ipcRendererInternal } from '@electron/internal/renderer/ipc-renderer-internal';
|
||||
import * as ipcRendererUtils from '@electron/internal/renderer/ipc-renderer-internal-utils';
|
||||
import { internalContextBridge } from '@electron/internal/renderer/api/context-bridge';
|
||||
import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
|
||||
|
||||
const { contextIsolationEnabled } = internalContextBridge;
|
||||
|
||||
export const windowSetup = (isWebView: boolean, isHiddenPage: boolean) => {
|
||||
// This file implements the following APIs over the ctx bridge:
|
||||
// - window.open()
|
||||
// - window.opener.blur()
|
||||
// - window.opener.close()
|
||||
// - window.opener.eval()
|
||||
// - window.opener.focus()
|
||||
// - window.opener.location
|
||||
// - window.opener.print()
|
||||
// - window.opener.closed
|
||||
// - window.opener.postMessage()
|
||||
// - window.history.back()
|
||||
// - window.history.forward()
|
||||
// - window.history.go()
|
||||
// - window.history.length
|
||||
// - window.prompt()
|
||||
// - document.hidden
|
||||
// - document.visibilityState
|
||||
|
||||
// Helper function to resolve relative url.
|
||||
const resolveURL = (url: string, base: string) => new URL(url, base).href;
|
||||
|
||||
// Use this method to ensure values expected as strings in the main process
|
||||
// are convertible to strings in the renderer process. This ensures exceptions
|
||||
// converting values to strings are thrown in this process.
|
||||
const toString = (value: any) => {
|
||||
return value != null ? `${value}` : value;
|
||||
};
|
||||
|
||||
const windowProxies = new Map<number, BrowserWindowProxy>();
|
||||
|
||||
const getOrCreateProxy = (guestId: number): SafelyBoundBrowserWindowProxy => {
|
||||
let proxy = windowProxies.get(guestId);
|
||||
if (proxy == null) {
|
||||
proxy = new BrowserWindowProxy(guestId);
|
||||
windowProxies.set(guestId, proxy);
|
||||
}
|
||||
return proxy.getSafe();
|
||||
};
|
||||
|
||||
const removeProxy = (guestId: number) => {
|
||||
windowProxies.delete(guestId);
|
||||
};
|
||||
|
||||
type LocationProperties = 'hash' | 'href' | 'host' | 'hostname' | 'origin' | 'pathname' | 'port' | 'protocol' | 'search'
|
||||
|
||||
class LocationProxy {
|
||||
@LocationProxy.ProxyProperty public hash!: string;
|
||||
@LocationProxy.ProxyProperty public href!: string;
|
||||
@LocationProxy.ProxyProperty public host!: string;
|
||||
@LocationProxy.ProxyProperty public hostname!: string;
|
||||
@LocationProxy.ProxyProperty public origin!: string;
|
||||
@LocationProxy.ProxyProperty public pathname!: string;
|
||||
@LocationProxy.ProxyProperty public port!: string;
|
||||
@LocationProxy.ProxyProperty public protocol!: string;
|
||||
@LocationProxy.ProxyProperty public search!: URLSearchParams;
|
||||
|
||||
private guestId: number;
|
||||
|
||||
/**
|
||||
* Beware: This decorator will have the _prototype_ as the `target`. It defines properties
|
||||
* commonly found in URL on the LocationProxy.
|
||||
*/
|
||||
private static ProxyProperty<T> (target: LocationProxy, propertyKey: LocationProperties) {
|
||||
Object.defineProperty(target, propertyKey, {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
get: function (this: LocationProxy): T | string {
|
||||
const guestURL = this.getGuestURL();
|
||||
const value = guestURL ? guestURL[propertyKey] : '';
|
||||
return value === undefined ? '' : value;
|
||||
},
|
||||
set: function (this: LocationProxy, newVal: T) {
|
||||
const guestURL = this.getGuestURL();
|
||||
if (guestURL) {
|
||||
// TypeScript doesn't want us to assign to read-only variables.
|
||||
// It's right, that's bad, but we're doing it anyway.
|
||||
(guestURL as any)[propertyKey] = newVal;
|
||||
|
||||
return this._invokeWebContentsMethod('loadURL', guestURL.toString());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public getSafe = () => {
|
||||
const that = this;
|
||||
return {
|
||||
get href () { return that.href; },
|
||||
set href (newValue) { that.href = newValue; },
|
||||
get hash () { return that.hash; },
|
||||
set hash (newValue) { that.hash = newValue; },
|
||||
get host () { return that.host; },
|
||||
set host (newValue) { that.host = newValue; },
|
||||
get hostname () { return that.hostname; },
|
||||
set hostname (newValue) { that.hostname = newValue; },
|
||||
get origin () { return that.origin; },
|
||||
set origin (newValue) { that.origin = newValue; },
|
||||
get pathname () { return that.pathname; },
|
||||
set pathname (newValue) { that.pathname = newValue; },
|
||||
get port () { return that.port; },
|
||||
set port (newValue) { that.port = newValue; },
|
||||
get protocol () { return that.protocol; },
|
||||
set protocol (newValue) { that.protocol = newValue; },
|
||||
get search () { return that.search; },
|
||||
set search (newValue) { that.search = newValue; }
|
||||
};
|
||||
}
|
||||
|
||||
constructor (guestId: number) {
|
||||
// eslint will consider the constructor "useless"
|
||||
// unless we assign them in the body. It's fine, that's what
|
||||
// TS would do anyway.
|
||||
this.guestId = guestId;
|
||||
this.getGuestURL = this.getGuestURL.bind(this);
|
||||
}
|
||||
|
||||
public toString (): string {
|
||||
return this.href;
|
||||
}
|
||||
|
||||
private getGuestURL (): URL | null {
|
||||
const maybeURL = this._invokeWebContentsMethodSync('getURL') as string;
|
||||
|
||||
// When there's no previous frame the url will be blank, so account for that here
|
||||
// to prevent url parsing errors on an empty string.
|
||||
const urlString = maybeURL !== '' ? maybeURL : 'about:blank';
|
||||
try {
|
||||
return new URL(urlString);
|
||||
} catch (e) {
|
||||
console.error('LocationProxy: failed to parse string', urlString, e);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private _invokeWebContentsMethod (method: string, ...args: any[]) {
|
||||
return ipcRendererInternal.invoke(IPC_MESSAGES.GUEST_WINDOW_MANAGER_WEB_CONTENTS_METHOD, this.guestId, method, ...args);
|
||||
}
|
||||
|
||||
private _invokeWebContentsMethodSync (method: string, ...args: any[]) {
|
||||
return ipcRendererUtils.invokeSync(IPC_MESSAGES.GUEST_WINDOW_MANAGER_WEB_CONTENTS_METHOD, this.guestId, method, ...args);
|
||||
}
|
||||
}
|
||||
|
||||
interface SafelyBoundBrowserWindowProxy {
|
||||
location: WindowProxy['location'];
|
||||
blur: WindowProxy['blur'];
|
||||
close: WindowProxy['close'];
|
||||
eval: typeof eval; // eslint-disable-line no-eval
|
||||
focus: WindowProxy['focus'];
|
||||
print: WindowProxy['print'];
|
||||
postMessage: WindowProxy['postMessage'];
|
||||
closed: boolean;
|
||||
}
|
||||
|
||||
class BrowserWindowProxy {
|
||||
public closed: boolean = false
|
||||
|
||||
private _location: LocationProxy
|
||||
private guestId: number
|
||||
|
||||
// TypeScript doesn't allow getters/accessors with different types,
|
||||
// so for now, we'll have to make do with an "any" in the mix.
|
||||
// https://github.com/Microsoft/TypeScript/issues/2521
|
||||
public get location (): LocationProxy | any {
|
||||
return this._location.getSafe();
|
||||
}
|
||||
|
||||
public set location (url: string | any) {
|
||||
url = resolveURL(url, this.location.href);
|
||||
this._invokeWebContentsMethod('loadURL', url);
|
||||
}
|
||||
|
||||
constructor (guestId: number) {
|
||||
this.guestId = guestId;
|
||||
this._location = new LocationProxy(guestId);
|
||||
|
||||
ipcRendererInternal.once(`${IPC_MESSAGES.GUEST_WINDOW_MANAGER_WINDOW_CLOSED}_${guestId}`, () => {
|
||||
removeProxy(guestId);
|
||||
this.closed = true;
|
||||
});
|
||||
}
|
||||
|
||||
public getSafe = (): SafelyBoundBrowserWindowProxy => {
|
||||
const that = this;
|
||||
return {
|
||||
postMessage: this.postMessage,
|
||||
blur: this.blur,
|
||||
close: this.close,
|
||||
focus: this.focus,
|
||||
print: this.print,
|
||||
eval: this.eval,
|
||||
get location () {
|
||||
return that.location;
|
||||
},
|
||||
set location (url: string | any) {
|
||||
that.location = url;
|
||||
},
|
||||
get closed () {
|
||||
return that.closed;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public close = () => {
|
||||
this._invokeWindowMethod('destroy');
|
||||
}
|
||||
|
||||
public focus = () => {
|
||||
this._invokeWindowMethod('focus');
|
||||
}
|
||||
|
||||
public blur = () => {
|
||||
this._invokeWindowMethod('blur');
|
||||
}
|
||||
|
||||
public print = () => {
|
||||
this._invokeWebContentsMethod('print');
|
||||
}
|
||||
|
||||
public postMessage = (message: any, targetOrigin: string) => {
|
||||
ipcRendererInternal.invoke(IPC_MESSAGES.GUEST_WINDOW_MANAGER_WINDOW_POSTMESSAGE, this.guestId, message, toString(targetOrigin), window.location.origin);
|
||||
}
|
||||
|
||||
public eval = (code: string) => {
|
||||
this._invokeWebContentsMethod('executeJavaScript', code);
|
||||
}
|
||||
|
||||
private _invokeWindowMethod (method: string, ...args: any[]) {
|
||||
return ipcRendererInternal.invoke(IPC_MESSAGES.GUEST_WINDOW_MANAGER_WINDOW_METHOD, this.guestId, method, ...args);
|
||||
}
|
||||
|
||||
private _invokeWebContentsMethod (method: string, ...args: any[]) {
|
||||
return ipcRendererInternal.invoke(IPC_MESSAGES.GUEST_WINDOW_MANAGER_WEB_CONTENTS_METHOD, this.guestId, method, ...args);
|
||||
}
|
||||
}
|
||||
|
||||
export const windowSetup = (
|
||||
isWebView: boolean, openerId: number, isHiddenPage: boolean, usesNativeWindowOpen: boolean) => {
|
||||
if (!process.sandboxed && !isWebView) {
|
||||
// Override default window.close.
|
||||
window.close = function () {
|
||||
@@ -13,12 +252,72 @@ export const windowSetup = (isWebView: boolean, isHiddenPage: boolean) => {
|
||||
if (contextIsolationEnabled) internalContextBridge.overrideGlobalValueFromIsolatedWorld(['close'], window.close);
|
||||
}
|
||||
|
||||
if (!usesNativeWindowOpen) {
|
||||
// TODO(MarshallOfSound): Make compatible with ctx isolation without hole-punch
|
||||
// Make the browser window or guest view emit "new-window" event.
|
||||
window.open = function (url?: string, frameName?: string, features?: string) {
|
||||
if (url != null && url !== '') {
|
||||
url = resolveURL(url, location.href);
|
||||
}
|
||||
const guestId = ipcRendererInternal.sendSync(IPC_MESSAGES.GUEST_WINDOW_MANAGER_WINDOW_OPEN, url, toString(frameName), toString(features));
|
||||
if (guestId != null) {
|
||||
return getOrCreateProxy(guestId) as any as WindowProxy;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
if (contextIsolationEnabled) internalContextBridge.overrideGlobalValueWithDynamicPropsFromIsolatedWorld(['open'], window.open);
|
||||
}
|
||||
|
||||
// If this window uses nativeWindowOpen, but its opener window does not, we
|
||||
// need to proxy window.opener in order to let the page communicate with its
|
||||
// opener.
|
||||
// Additionally, windows opened from a nativeWindowOpen child of a
|
||||
// non-nativeWindowOpen parent will initially have their WebPreferences
|
||||
// copied from their opener before having them updated, meaning openerId is
|
||||
// initially incorrect. We detect this situation by checking for
|
||||
// window.opener, which will be non-null for a natively-opened child, so we
|
||||
// can ignore the openerId in that case, since it's incorrectly copied from
|
||||
// the parent. This is, uh, confusing, so here's a diagram that will maybe
|
||||
// help?
|
||||
//
|
||||
// [ grandparent window ] --> [ parent window ] --> [ child window ]
|
||||
// n.W.O = false n.W.O = true n.W.O = true
|
||||
// id = 1 id = 2 id = 3
|
||||
// openerId = 0 openerId = 1 openerId = 1 <- !!wrong!!
|
||||
// opener = null opener = null opener = [parent window]
|
||||
if (openerId && !window.opener) {
|
||||
window.opener = getOrCreateProxy(openerId);
|
||||
if (contextIsolationEnabled) internalContextBridge.overrideGlobalValueWithDynamicPropsFromIsolatedWorld(['opener'], window.opener);
|
||||
}
|
||||
|
||||
// But we do not support prompt().
|
||||
window.prompt = function () {
|
||||
throw new Error('prompt() is and will not be supported.');
|
||||
};
|
||||
if (contextIsolationEnabled) internalContextBridge.overrideGlobalValueFromIsolatedWorld(['prompt'], window.prompt);
|
||||
|
||||
if (!usesNativeWindowOpen || openerId) {
|
||||
ipcRendererInternal.on(IPC_MESSAGES.GUEST_WINDOW_POSTMESSAGE, function (
|
||||
_event, sourceId: number, message: any, sourceOrigin: string
|
||||
) {
|
||||
// Manually dispatch event instead of using postMessage because we also need to
|
||||
// set event.source.
|
||||
//
|
||||
// Why any? We can't construct a MessageEvent and we can't
|
||||
// use `as MessageEvent` because you're not supposed to override
|
||||
// data, origin, and source
|
||||
const event: any = document.createEvent('Event');
|
||||
event.initEvent('message', false, false);
|
||||
|
||||
event.data = message;
|
||||
event.origin = sourceOrigin;
|
||||
event.source = getOrCreateProxy(sourceId);
|
||||
|
||||
window.dispatchEvent(event as MessageEvent);
|
||||
});
|
||||
}
|
||||
|
||||
if (isWebView) {
|
||||
// Webview `document.visibilityState` tracks window visibility (and ignores
|
||||
// the actual <webview> element visibility) for backwards compatibility.
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@electron/get": "^1.13.0",
|
||||
"@types/node": "^16.11.26",
|
||||
"@types/node": "^14.6.2",
|
||||
"extract-zip": "^1.0.3"
|
||||
},
|
||||
"engines": {
|
||||
|
||||
12
package.json
12
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "electron",
|
||||
"version": "18.2.4",
|
||||
"version": "17.4.9",
|
||||
"repository": "https://github.com/electron/electron",
|
||||
"description": "Build cross platform desktop apps with JavaScript, HTML, and CSS",
|
||||
"devDependencies": {
|
||||
@@ -15,12 +15,12 @@
|
||||
"@types/chai": "^4.2.12",
|
||||
"@types/chai-as-promised": "^7.1.3",
|
||||
"@types/dirty-chai": "^2.0.2",
|
||||
"@types/express": "^4.17.13",
|
||||
"@types/express": "^4.17.7",
|
||||
"@types/fs-extra": "^9.0.1",
|
||||
"@types/klaw": "^3.0.1",
|
||||
"@types/minimist": "^1.2.0",
|
||||
"@types/mocha": "^7.0.2",
|
||||
"@types/node": "^16.11.26",
|
||||
"@types/node": "^14.6.2",
|
||||
"@types/semver": "^7.3.3",
|
||||
"@types/send": "^0.14.5",
|
||||
"@types/split": "^1.0.0",
|
||||
@@ -28,11 +28,11 @@
|
||||
"@types/temp": "^0.8.34",
|
||||
"@types/uuid": "^3.4.6",
|
||||
"@types/webpack": "^4.41.21",
|
||||
"@types/webpack-env": "^1.16.3",
|
||||
"@types/webpack-env": "^1.15.2",
|
||||
"@typescript-eslint/eslint-plugin": "^4.4.1",
|
||||
"@typescript-eslint/parser": "^4.4.1",
|
||||
"asar": "^3.1.0",
|
||||
"aws-sdk": "^2.814.0",
|
||||
"aws-sdk": "^2.727.1",
|
||||
"check-for-leaks": "^1.2.1",
|
||||
"colors": "1.4.0",
|
||||
"dotenv-safe": "^4.0.4",
|
||||
@@ -68,7 +68,7 @@
|
||||
"timers-browserify": "1.4.2",
|
||||
"ts-loader": "^8.0.2",
|
||||
"ts-node": "6.2.0",
|
||||
"typescript": "^4.5.5",
|
||||
"typescript": "^4.1.3",
|
||||
"webpack": "^4.43.0",
|
||||
"webpack-cli": "^3.3.12",
|
||||
"wrapper-webpack-plugin": "^2.1.0"
|
||||
|
||||
9
patches/angle/.patches
Normal file
9
patches/angle/.patches
Normal file
@@ -0,0 +1,9 @@
|
||||
cherry-pick-d27d9d059b51.patch
|
||||
m100_fix_crash_when_pausing_xfb_then_deleting_a_buffer.patch
|
||||
cherry-pick-d49484c21e3c.patch
|
||||
cherry-pick-a602a068e022.patch
|
||||
cherry-pick-a4f71e40e571.patch
|
||||
cherry-pick-9768648fffc9.patch
|
||||
cherry-pick-03aa5ae75c29.patch
|
||||
cherry-pick-801b904aea7d.patch
|
||||
cherry-pick-6661eb4900da.patch
|
||||
76
patches/angle/cherry-pick-03aa5ae75c29.patch
Normal file
76
patches/angle/cherry-pick-03aa5ae75c29.patch
Normal file
@@ -0,0 +1,76 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Geoff Lang <geofflang@google.com>
|
||||
Date: Wed, 1 Jun 2022 11:22:42 -0400
|
||||
Subject: M102: Ignore eglBind/ReleaseTexImage calls for lost contexts.
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
eglBindTexImage and eglReleaseTexImage no-op when no context is
|
||||
current. Extend this to lost contexts to match the behaviour of making
|
||||
a GL call on a lost context.
|
||||
|
||||
This avoids potential unexpected bad accesses in the backends.
|
||||
|
||||
Bug: chromium:1316578
|
||||
Change-Id: I7b309c297e0c803019720733dee2950abb4c4b5f
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3683869
|
||||
Reviewed-by: Jamie Madill <jmadill@chromium.org>
|
||||
Reviewed-by: Alexis Hétu <sugoi@google.com>
|
||||
Reviewed-by: Alexis Hétu <sugoi@chromium.org>
|
||||
Commit-Queue: Geoff Lang <geofflang@chromium.org>
|
||||
(cherry picked from commit bfab7e60a15dc6f72e34406d3f2a3996cd8d0be2)
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3691180
|
||||
|
||||
diff --git a/src/libANGLE/validationEGL.cpp b/src/libANGLE/validationEGL.cpp
|
||||
index 7d2d43afa2cacf4445c528209b1fba6c1c6485c4..49d92219af76cbc8049f5c29a60fba3b26459bd0 100644
|
||||
--- a/src/libANGLE/validationEGL.cpp
|
||||
+++ b/src/libANGLE/validationEGL.cpp
|
||||
@@ -4762,7 +4762,7 @@ bool ValidateBindTexImage(const ValidationContext *val,
|
||||
}
|
||||
|
||||
gl::Context *context = val->eglThread->getContext();
|
||||
- if (context)
|
||||
+ if (context && !context->isContextLost())
|
||||
{
|
||||
gl::TextureType type = egl_gl::EGLTextureTargetToTextureType(surface->getTextureTarget());
|
||||
gl::Texture *textureObject = context->getTextureByType(type);
|
||||
diff --git a/src/libGLESv2/egl_stubs.cpp b/src/libGLESv2/egl_stubs.cpp
|
||||
index fa37ae68e8e87aefd111440463611f737665691b..0b9d155d0d74f5b6b60667243d03182cc8b4d442 100644
|
||||
--- a/src/libGLESv2/egl_stubs.cpp
|
||||
+++ b/src/libGLESv2/egl_stubs.cpp
|
||||
@@ -61,7 +61,7 @@ EGLBoolean BindTexImage(Thread *thread, Display *display, Surface *eglSurface, E
|
||||
GetDisplayIfValid(display), EGL_FALSE);
|
||||
|
||||
gl::Context *context = thread->getContext();
|
||||
- if (context)
|
||||
+ if (context && !context->isContextLost())
|
||||
{
|
||||
gl::TextureType type =
|
||||
egl_gl::EGLTextureTargetToTextureType(eglSurface->getTextureTarget());
|
||||
@@ -569,15 +569,18 @@ EGLBoolean ReleaseTexImage(Thread *thread, Display *display, Surface *eglSurface
|
||||
{
|
||||
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglReleaseTexImage",
|
||||
GetDisplayIfValid(display), EGL_FALSE);
|
||||
- gl::Texture *texture = eglSurface->getBoundTexture();
|
||||
-
|
||||
- if (texture)
|
||||
+ gl::Context *context = thread->getContext();
|
||||
+ if (context && !context->isContextLost())
|
||||
{
|
||||
- ANGLE_EGL_TRY_RETURN(thread, eglSurface->releaseTexImage(thread->getContext(), buffer),
|
||||
- "eglReleaseTexImage", GetSurfaceIfValid(display, eglSurface),
|
||||
- EGL_FALSE);
|
||||
- }
|
||||
+ gl::Texture *texture = eglSurface->getBoundTexture();
|
||||
|
||||
+ if (texture)
|
||||
+ {
|
||||
+ ANGLE_EGL_TRY_RETURN(thread, eglSurface->releaseTexImage(thread->getContext(), buffer),
|
||||
+ "eglReleaseTexImage", GetSurfaceIfValid(display, eglSurface),
|
||||
+ EGL_FALSE);
|
||||
+ }
|
||||
+ }
|
||||
thread->setSuccess();
|
||||
return EGL_TRUE;
|
||||
}
|
||||
27
patches/angle/cherry-pick-6661eb4900da.patch
Normal file
27
patches/angle/cherry-pick-6661eb4900da.patch
Normal file
@@ -0,0 +1,27 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jamie Madill <jmadill@chromium.org>
|
||||
Date: Mon, 2 May 2022 15:42:23 -0400
|
||||
Subject: Fix validation cache when deleting a Transform Feedback.
|
||||
|
||||
Bug: chromium:1320024
|
||||
Change-Id: I76ef85a3c65c663c138d8caebd4ef2c0da53cd4f
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3621780
|
||||
Commit-Queue: Jamie Madill <jmadill@chromium.org>
|
||||
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
|
||||
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
|
||||
(cherry picked from commit 84e42c3b04da9e2c9d93d35bb6f2b1830fef22f4)
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3650697
|
||||
Reviewed-by: Geoff Lang <geofflang@chromium.org>
|
||||
|
||||
diff --git a/src/libANGLE/Context.cpp b/src/libANGLE/Context.cpp
|
||||
index 141d106c8ea4c92ecf1e01b3fa7c3bf11ba7d5d3..e74d323b833d66e2891eaf77deb4225d98766036 100644
|
||||
--- a/src/libANGLE/Context.cpp
|
||||
+++ b/src/libANGLE/Context.cpp
|
||||
@@ -3020,6 +3020,7 @@ void Context::detachTransformFeedback(TransformFeedbackID transformFeedback)
|
||||
if (mState.removeTransformFeedbackBinding(this, transformFeedback))
|
||||
{
|
||||
bindTransformFeedback(GL_TRANSFORM_FEEDBACK, {0});
|
||||
+ mStateCache.onActiveTransformFeedbackChange(this);
|
||||
}
|
||||
}
|
||||
|
||||
238
patches/angle/cherry-pick-801b904aea7d.patch
Normal file
238
patches/angle/cherry-pick-801b904aea7d.patch
Normal file
@@ -0,0 +1,238 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jamie Madill <jmadill@chromium.org>
|
||||
Date: Fri, 20 May 2022 10:26:15 -0400
|
||||
Subject: D3D: Fix race condition with parallel shader compile.
|
||||
|
||||
Bug: chromium:1317673
|
||||
Change-Id: I0fb7c9a66248852e41e8700e80c295393ef941e8
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3651153
|
||||
Reviewed-by: Jie A Chen <jie.a.chen@intel.com>
|
||||
Reviewed-by: Lingfeng Yang <lfy@google.com>
|
||||
Commit-Queue: Jamie Madill <jmadill@chromium.org>
|
||||
(cherry picked from commit 4a20c9143abbf29c649cf643182735e8952089e3)
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3691050
|
||||
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
|
||||
|
||||
diff --git a/src/libANGLE/renderer/d3d/ProgramD3D.cpp b/src/libANGLE/renderer/d3d/ProgramD3D.cpp
|
||||
index 59fe34fc46a1bfbc7b4be1aad6ad84b6da303b5b..3256357a80d69739661ec1fd32220d3037145875 100644
|
||||
--- a/src/libANGLE/renderer/d3d/ProgramD3D.cpp
|
||||
+++ b/src/libANGLE/renderer/d3d/ProgramD3D.cpp
|
||||
@@ -1687,12 +1687,6 @@ class ProgramD3D::GetVertexExecutableTask : public ProgramD3D::GetExecutableTask
|
||||
angle::Result run() override
|
||||
{
|
||||
ANGLE_TRACE_EVENT0("gpu.angle", "ProgramD3D::GetVertexExecutableTask::run");
|
||||
- if (!mProgram->mState.getAttachedShader(gl::ShaderType::Vertex))
|
||||
- {
|
||||
- return angle::Result::Continue;
|
||||
- }
|
||||
-
|
||||
- mProgram->updateCachedInputLayoutFromShader();
|
||||
|
||||
ANGLE_TRY(mProgram->getVertexExecutableForCachedInputLayout(this, &mExecutable, &mInfoLog));
|
||||
|
||||
@@ -2147,6 +2141,11 @@ std::unique_ptr<LinkEvent> ProgramD3D::link(const gl::Context *context,
|
||||
|
||||
linkResources(resources);
|
||||
|
||||
+ if (mState.getAttachedShader(gl::ShaderType::Vertex))
|
||||
+ {
|
||||
+ updateCachedInputLayoutFromShader();
|
||||
+ }
|
||||
+
|
||||
return compileProgramExecutables(context, infoLog);
|
||||
}
|
||||
}
|
||||
diff --git a/src/tests/gl_tests/ParallelShaderCompileTest.cpp b/src/tests/gl_tests/ParallelShaderCompileTest.cpp
|
||||
index bcd88ef01308759085c8244ad2058efe68686f2b..a98aff540c642617bba366b2e238519942d7e349 100644
|
||||
--- a/src/tests/gl_tests/ParallelShaderCompileTest.cpp
|
||||
+++ b/src/tests/gl_tests/ParallelShaderCompileTest.cpp
|
||||
@@ -58,9 +58,10 @@ class ParallelShaderCompileTest : public ANGLETest
|
||||
Task(int id) : mID(id) {}
|
||||
virtual ~Task() {}
|
||||
|
||||
- virtual bool compile() = 0;
|
||||
- virtual bool isCompileCompleted() = 0;
|
||||
- virtual bool link() = 0;
|
||||
+ virtual bool compile() = 0;
|
||||
+ virtual bool isCompileCompleted() = 0;
|
||||
+ virtual bool link() = 0;
|
||||
+ virtual void postLink() {}
|
||||
virtual void runAndVerify(ParallelShaderCompileTest *test) = 0;
|
||||
|
||||
bool isLinkCompleted()
|
||||
@@ -71,7 +72,7 @@ class ParallelShaderCompileTest : public ANGLETest
|
||||
}
|
||||
|
||||
protected:
|
||||
- std::string insertRandomString(const std::string &source)
|
||||
+ static std::string InsertRandomString(const std::string &source)
|
||||
{
|
||||
RNG rng;
|
||||
std::ostringstream ostream;
|
||||
@@ -80,7 +81,7 @@ class ParallelShaderCompileTest : public ANGLETest
|
||||
return ostream.str();
|
||||
}
|
||||
|
||||
- GLuint CompileShader(GLenum type, const std::string &source)
|
||||
+ static GLuint CompileShader(GLenum type, const std::string &source)
|
||||
{
|
||||
GLuint shader = glCreateShader(type);
|
||||
|
||||
@@ -90,7 +91,14 @@ class ParallelShaderCompileTest : public ANGLETest
|
||||
return shader;
|
||||
}
|
||||
|
||||
- bool checkShader(GLuint shader)
|
||||
+ static void RecompileShader(GLuint shader, const std::string &source)
|
||||
+ {
|
||||
+ const char *sourceArray[1] = {source.c_str()};
|
||||
+ glShaderSource(shader, 1, sourceArray, nullptr);
|
||||
+ glCompileShader(shader);
|
||||
+ }
|
||||
+
|
||||
+ static bool CheckShader(GLuint shader)
|
||||
{
|
||||
GLint compileResult;
|
||||
glGetShaderiv(shader, GL_COMPILE_STATUS, &compileResult);
|
||||
@@ -129,7 +137,7 @@ class ParallelShaderCompileTest : public ANGLETest
|
||||
TaskRunner() {}
|
||||
~TaskRunner() {}
|
||||
|
||||
- void run(ParallelShaderCompileTest *test)
|
||||
+ void run(ParallelShaderCompileTest *test, unsigned int pollInterval)
|
||||
{
|
||||
|
||||
std::vector<std::unique_ptr<T>> compileTasks;
|
||||
@@ -151,6 +159,7 @@ class ParallelShaderCompileTest : public ANGLETest
|
||||
if (task->isCompileCompleted())
|
||||
{
|
||||
bool isLinking = task->link();
|
||||
+ task->postLink();
|
||||
ASSERT_TRUE(isLinking);
|
||||
linkTasks.push_back(std::move(task));
|
||||
compileTasks.erase(compileTasks.begin() + i);
|
||||
@@ -158,7 +167,10 @@ class ParallelShaderCompileTest : public ANGLETest
|
||||
}
|
||||
++i;
|
||||
}
|
||||
- angle::Sleep(kPollInterval);
|
||||
+ if (pollInterval != 0)
|
||||
+ {
|
||||
+ angle::Sleep(pollInterval);
|
||||
+ }
|
||||
}
|
||||
|
||||
while (!linkTasks.empty())
|
||||
@@ -173,9 +185,16 @@ class ParallelShaderCompileTest : public ANGLETest
|
||||
linkTasks.erase(linkTasks.begin() + i);
|
||||
continue;
|
||||
}
|
||||
+ else
|
||||
+ {
|
||||
+ task->postLink();
|
||||
+ }
|
||||
++i;
|
||||
}
|
||||
- angle::Sleep(kPollInterval);
|
||||
+ if (pollInterval != 0)
|
||||
+ {
|
||||
+ angle::Sleep(pollInterval);
|
||||
+ }
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -192,9 +211,9 @@ class ParallelShaderCompileTest : public ANGLETest
|
||||
bool compile() override
|
||||
{
|
||||
mVertexShader =
|
||||
- CompileShader(GL_VERTEX_SHADER, insertRandomString(essl1_shaders::vs::Simple()));
|
||||
+ CompileShader(GL_VERTEX_SHADER, InsertRandomString(essl1_shaders::vs::Simple()));
|
||||
mFragmentShader = CompileShader(GL_FRAGMENT_SHADER,
|
||||
- insertRandomString(essl1_shaders::fs::UniformColor()));
|
||||
+ InsertRandomString(essl1_shaders::fs::UniformColor()));
|
||||
return (mVertexShader != 0 && mFragmentShader != 0);
|
||||
}
|
||||
|
||||
@@ -213,7 +232,7 @@ class ParallelShaderCompileTest : public ANGLETest
|
||||
bool link() override
|
||||
{
|
||||
mProgram = 0;
|
||||
- if (checkShader(mVertexShader) && checkShader(mFragmentShader))
|
||||
+ if (CheckShader(mVertexShader) && CheckShader(mFragmentShader))
|
||||
{
|
||||
mProgram = glCreateProgram();
|
||||
glAttachShader(mProgram, mVertexShader);
|
||||
@@ -244,10 +263,25 @@ class ParallelShaderCompileTest : public ANGLETest
|
||||
ASSERT_GL_NO_ERROR();
|
||||
}
|
||||
|
||||
+ protected:
|
||||
+ void recompile()
|
||||
+ {
|
||||
+ RecompileShader(mVertexShader, essl1_shaders::vs::Simple());
|
||||
+ RecompileShader(mFragmentShader, essl1_shaders::fs::UniformColor());
|
||||
+ }
|
||||
+
|
||||
private:
|
||||
- GLColor mColor;
|
||||
GLuint mVertexShader;
|
||||
GLuint mFragmentShader;
|
||||
+ GLColor mColor;
|
||||
+ };
|
||||
+
|
||||
+ class ClearColorWithDrawRecompile : public ClearColorWithDraw
|
||||
+ {
|
||||
+ public:
|
||||
+ ClearColorWithDrawRecompile(int taskID) : ClearColorWithDraw(taskID) {}
|
||||
+
|
||||
+ void postLink() override { recompile(); }
|
||||
};
|
||||
|
||||
class ImageLoadStore : public Task
|
||||
@@ -268,7 +302,7 @@ void main()
|
||||
imageStore(uImage_2, ivec2(gl_LocalInvocationID.xy), value);
|
||||
})";
|
||||
|
||||
- mShader = CompileShader(GL_COMPUTE_SHADER, insertRandomString(kCSSource));
|
||||
+ mShader = CompileShader(GL_COMPUTE_SHADER, InsertRandomString(kCSSource));
|
||||
return mShader != 0;
|
||||
}
|
||||
|
||||
@@ -282,7 +316,7 @@ void main()
|
||||
bool link() override
|
||||
{
|
||||
mProgram = 0;
|
||||
- if (checkShader(mShader))
|
||||
+ if (CheckShader(mShader))
|
||||
{
|
||||
mProgram = glCreateProgram();
|
||||
glAttachShader(mProgram, mShader);
|
||||
@@ -370,7 +404,18 @@ TEST_P(ParallelShaderCompileTest, LinkAndDrawManyPrograms)
|
||||
ANGLE_SKIP_TEST_IF(!ensureParallelShaderCompileExtensionAvailable());
|
||||
|
||||
TaskRunner<ClearColorWithDraw> runner;
|
||||
- runner.run(this);
|
||||
+ runner.run(this, kPollInterval);
|
||||
+}
|
||||
+
|
||||
+// Tests no crash in case that the Shader starts another compile while the Program being attached
|
||||
+// to is still linking.
|
||||
+// crbug.com/1317673
|
||||
+TEST_P(ParallelShaderCompileTest, LinkProgramAndRecompileShader)
|
||||
+{
|
||||
+ ANGLE_SKIP_TEST_IF(!ensureParallelShaderCompileExtensionAvailable());
|
||||
+
|
||||
+ TaskRunner<ClearColorWithDrawRecompile> runner;
|
||||
+ runner.run(this, 0);
|
||||
}
|
||||
|
||||
class ParallelShaderCompileTestES31 : public ParallelShaderCompileTest
|
||||
@@ -389,7 +434,7 @@ TEST_P(ParallelShaderCompileTestES31, LinkAndDispatchManyPrograms)
|
||||
ANGLE_SKIP_TEST_IF(!ensureParallelShaderCompileExtensionAvailable());
|
||||
|
||||
TaskRunner<ImageLoadStore> runner;
|
||||
- runner.run(this);
|
||||
+ runner.run(this, kPollInterval);
|
||||
}
|
||||
|
||||
ANGLE_INSTANTIATE_TEST_ES2(ParallelShaderCompileTest);
|
||||
26
patches/angle/cherry-pick-9768648fffc9.patch
Normal file
26
patches/angle/cherry-pick-9768648fffc9.patch
Normal file
@@ -0,0 +1,26 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: SeongHwan Park <ggabu423@gmail.com>
|
||||
Date: Tue, 31 May 2022 02:41:32 +0900
|
||||
Subject: Fix to invalidate cache when binding Transform Feedback.
|
||||
|
||||
Bug: chromium:1330379
|
||||
Change-Id: I091116286ac511c50f9abcffa4d3cf350be920b4
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3677115
|
||||
Commit-Queue: Jamie Madill <jmadill@chromium.org>
|
||||
Reviewed-by: Jamie Madill <jmadill@chromium.org>
|
||||
(cherry picked from commit d96cee6685099f6bcc392a4d20d28c8ec484673a)
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3691799
|
||||
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
|
||||
|
||||
diff --git a/src/libANGLE/Context.cpp b/src/libANGLE/Context.cpp
|
||||
index 6b4d8d826ef3518ad11b1b39c78634f05d464b39..141d106c8ea4c92ecf1e01b3fa7c3bf11ba7d5d3 100644
|
||||
--- a/src/libANGLE/Context.cpp
|
||||
+++ b/src/libANGLE/Context.cpp
|
||||
@@ -1306,6 +1306,7 @@ void Context::bindTransformFeedback(GLenum target, TransformFeedbackID transform
|
||||
TransformFeedback *transformFeedback =
|
||||
checkTransformFeedbackAllocation(transformFeedbackHandle);
|
||||
mState.setTransformFeedbackBinding(this, transformFeedback);
|
||||
+ mStateCache.onActiveTransformFeedbackChange(this);
|
||||
}
|
||||
|
||||
void Context::bindProgramPipeline(ProgramPipelineID pipelineHandle)
|
||||
58
patches/angle/cherry-pick-a4f71e40e571.patch
Normal file
58
patches/angle/cherry-pick-a4f71e40e571.patch
Normal file
@@ -0,0 +1,58 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Geoff Lang <geofflang@google.com>
|
||||
Date: Fri, 1 Apr 2022 11:38:17 -0400
|
||||
Subject: Fix CheckedNumeric using the wrong type.
|
||||
|
||||
Validation for glBufferSubData checks that the buffer is large enough
|
||||
for size+offset but verifies they fit in a size_t which is a different
|
||||
type than the deduced type for size+offset on 32-bit systems.
|
||||
|
||||
Use decltype to ensure that we always verify there is no overflow on the
|
||||
correct type.
|
||||
|
||||
Bug: chromium:1298867
|
||||
Change-Id: I82f534b2d227d3273a763e626ebeae068dc918dc
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3563515
|
||||
Reviewed-by: Jamie Madill <jmadill@chromium.org>
|
||||
Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
|
||||
Commit-Queue: Geoff Lang <geofflang@chromium.org>
|
||||
(cherry picked from commit c458b5add432c3da98ef370680518d0af7e4d4e3)
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3630020
|
||||
|
||||
diff --git a/src/libANGLE/validationES2.cpp b/src/libANGLE/validationES2.cpp
|
||||
index 947bed25cad67a0182a0396e635f2e52f5cd5704..cbe932a6d2131322d6dbb3c17a0cd05af551e462 100644
|
||||
--- a/src/libANGLE/validationES2.cpp
|
||||
+++ b/src/libANGLE/validationES2.cpp
|
||||
@@ -3620,7 +3620,7 @@ bool ValidateBufferSubData(const Context *context,
|
||||
}
|
||||
|
||||
// Check for possible overflow of size + offset
|
||||
- angle::CheckedNumeric<size_t> checkedSize(size);
|
||||
+ angle::CheckedNumeric<decltype(size + offset)> checkedSize(size);
|
||||
checkedSize += offset;
|
||||
if (!checkedSize.IsValid())
|
||||
{
|
||||
diff --git a/src/tests/gl_tests/BufferDataTest.cpp b/src/tests/gl_tests/BufferDataTest.cpp
|
||||
index 325ba67bc6997afbdadf80ccbd994ec8b3ce9521..b993f95c1d8e103f24054f21853fb326c2e12112 100644
|
||||
--- a/src/tests/gl_tests/BufferDataTest.cpp
|
||||
+++ b/src/tests/gl_tests/BufferDataTest.cpp
|
||||
@@ -824,6 +824,19 @@ TEST_P(BufferDataTest, MapWriteArrayBufferDataDrawArrays)
|
||||
EXPECT_GL_NO_ERROR();
|
||||
}
|
||||
|
||||
+// Verify that buffer sub data uploads are properly validated within the buffer size range on 32-bit
|
||||
+// systems.
|
||||
+TEST_P(BufferDataTest, BufferSizeValidation32Bit)
|
||||
+{
|
||||
+ GLBuffer buffer;
|
||||
+ glBindBuffer(GL_ARRAY_BUFFER, buffer);
|
||||
+ glBufferData(GL_ARRAY_BUFFER, 100, nullptr, GL_STATIC_DRAW);
|
||||
+
|
||||
+ GLubyte data = 0;
|
||||
+ glBufferSubData(GL_ARRAY_BUFFER, std::numeric_limits<uint32_t>::max(), 1, &data);
|
||||
+ EXPECT_GL_ERROR(GL_INVALID_VALUE);
|
||||
+}
|
||||
+
|
||||
// Tests a null crash bug caused by copying from null back-end buffer pointer
|
||||
// when calling bufferData again after drawing without calling bufferData in D3D11.
|
||||
TEST_P(BufferDataTestES3, DrawWithNotCallingBufferData)
|
||||
31
patches/angle/cherry-pick-a602a068e022.patch
Normal file
31
patches/angle/cherry-pick-a602a068e022.patch
Normal file
@@ -0,0 +1,31 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jamie Madill <jmadill@chromium.org>
|
||||
Date: Tue, 19 Apr 2022 17:01:20 -0400
|
||||
Subject: Fix validate state cache after XFB buffer deleted.
|
||||
|
||||
Bug: chromium:1317650
|
||||
Change-Id: Iec9f1167c3b2957091dd0f4ef3efcfcd7c4bf3c0
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3594250
|
||||
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
|
||||
Auto-Submit: Jamie Madill <jmadill@chromium.org>
|
||||
Commit-Queue: Jamie Madill <jmadill@chromium.org>
|
||||
(cherry picked from commit 4efc4ee6830a8a53a0daf9daa3c7aa835db4220f)
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3621779
|
||||
Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com>
|
||||
|
||||
diff --git a/src/libANGLE/State.cpp b/src/libANGLE/State.cpp
|
||||
index ae245e4abdf9818d6aec83e4badad9811ed492b3..e9635038a1d4cc0ab5211b94c22d44f353388d64 100644
|
||||
--- a/src/libANGLE/State.cpp
|
||||
+++ b/src/libANGLE/State.cpp
|
||||
@@ -2174,10 +2174,7 @@ angle::Result State::detachBuffer(Context *context, const Buffer *buffer)
|
||||
if (curTransformFeedback)
|
||||
{
|
||||
ANGLE_TRY(curTransformFeedback->detachBuffer(context, bufferID));
|
||||
- if (isTransformFeedbackActiveUnpaused())
|
||||
- {
|
||||
- context->getStateCache().onActiveTransformFeedbackChange(context);
|
||||
- }
|
||||
+ context->getStateCache().onActiveTransformFeedbackChange(context);
|
||||
}
|
||||
|
||||
if (getVertexArray()->detachBuffer(context, bufferID))
|
||||
100
patches/angle/cherry-pick-d27d9d059b51.patch
Normal file
100
patches/angle/cherry-pick-d27d9d059b51.patch
Normal file
@@ -0,0 +1,100 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Charlie Lao <cclao@google.com>
|
||||
Date: Tue, 15 Mar 2022 09:39:36 -0700
|
||||
Subject: Vulkan: Update mCurrentElementArrayBuffersync based on dirty bit
|
||||
|
||||
M96 merge issues:
|
||||
ContextVk.cpp:
|
||||
ContextVk::setupIndexedDraw: vertexArrayVk/getVertexArray() isn't present in M96
|
||||
ContextVk::syncState: M96 uses mVertexArray instead of vertexArrayVk
|
||||
VertexArrayVk.cpp:
|
||||
VertexArrayVk::updateCurrentElementArrayBuffer doesn't exist in M9
|
||||
Created it and kept M96 logic for retrieving buffer/offset
|
||||
|
||||
The previous fix crrev.com/c/3513553 has run into corner case that
|
||||
requires more follow up change crrev.com/c/3522565. But with that, there
|
||||
is report that now we are hitting assertion in
|
||||
handleDirtyGraphicsIndexBuffer(). This becomes a bit fragile This new
|
||||
fix relies on the DIRTY_BIT_INDEX_BUFFER dirty bit and should be more
|
||||
reliable as long as the dirty bit is set properly (if not, then we have
|
||||
other bug that it won't even send down vulkan command to bind the
|
||||
correct element buffer). We could further optimize the code path and
|
||||
create a fast path for most common usages in the future.
|
||||
|
||||
Bug: chromium:1299261
|
||||
Change-Id: Ifa8f86d431798c9ca4c128ed71a3e9e0a3537ccb
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3526021
|
||||
Commit-Queue: Charlie Lao <cclao@google.com>
|
||||
(cherry picked from commit 349636a05a3577a127adb6c79a1e947890bbe462)
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3605834
|
||||
Reviewed-by: Achuith Bhandarkar <achuith@chromium.org>
|
||||
Reviewed-by: Charlie Lao <cclao@google.com>
|
||||
|
||||
diff --git a/src/libANGLE/renderer/vulkan/ContextVk.cpp b/src/libANGLE/renderer/vulkan/ContextVk.cpp
|
||||
index aa1e5fa793e98a284b3d5dbda58778b8c2f1eeef..d9f6bcd54943bd211f1dc2b1ea149c21a79979a0 100644
|
||||
--- a/src/libANGLE/renderer/vulkan/ContextVk.cpp
|
||||
+++ b/src/libANGLE/renderer/vulkan/ContextVk.cpp
|
||||
@@ -1062,6 +1062,17 @@ angle::Result ContextVk::setupIndexedDraw(const gl::Context *context,
|
||||
mGraphicsDirtyBits.set(DIRTY_BIT_INDEX_BUFFER);
|
||||
mLastIndexBufferOffset = indices;
|
||||
}
|
||||
+
|
||||
+ // When you draw with LineLoop mode or GL_UNSIGNED_BYTE type, we may allocate its own
|
||||
+ // element buffer and modify mCurrentElementArrayBuffer. When we switch out of that draw
|
||||
+ // mode, we must reset mCurrentElementArrayBuffer back to the vertexArray's element buffer.
|
||||
+ // Since in either case we set DIRTY_BIT_INDEX_BUFFER dirty bit, we use this bit to re-sync
|
||||
+ // mCurrentElementArrayBuffer.
|
||||
+ if (mGraphicsDirtyBits[DIRTY_BIT_INDEX_BUFFER])
|
||||
+ {
|
||||
+ mVertexArray->updateCurrentElementArrayBuffer();
|
||||
+ }
|
||||
+
|
||||
if (shouldConvertUint8VkIndexType(indexType) && mGraphicsDirtyBits[DIRTY_BIT_INDEX_BUFFER])
|
||||
{
|
||||
ANGLE_VK_PERF_WARNING(this, GL_DEBUG_SEVERITY_LOW,
|
||||
diff --git a/src/libANGLE/renderer/vulkan/VertexArrayVk.cpp b/src/libANGLE/renderer/vulkan/VertexArrayVk.cpp
|
||||
index eb401bfd8c1ccfc750d34b46e95d97c54a5a0fac..fd6fcf4c339f7d189217545e10c4c808e103f671 100644
|
||||
--- a/src/libANGLE/renderer/vulkan/VertexArrayVk.cpp
|
||||
+++ b/src/libANGLE/renderer/vulkan/VertexArrayVk.cpp
|
||||
@@ -454,6 +454,17 @@ angle::Result VertexArrayVk::convertVertexBufferCPU(ContextVk *contextVk,
|
||||
return angle::Result::Continue;
|
||||
}
|
||||
|
||||
+void VertexArrayVk::updateCurrentElementArrayBuffer()
|
||||
+{
|
||||
+ ASSERT(mState.getElementArrayBuffer() != nullptr);
|
||||
+ ASSERT(mState.getElementArrayBuffer()->getSize() > 0);
|
||||
+ gl::Buffer *bufferGL = mState.getElementArrayBuffer();
|
||||
+ BufferVk *bufferVk = vk::GetImpl(bufferGL);
|
||||
+ mCurrentElementArrayBuffer =
|
||||
+ &bufferVk->getBufferAndOffset(&mCurrentElementArrayBufferOffset);
|
||||
+
|
||||
+}
|
||||
+
|
||||
angle::Result VertexArrayVk::syncState(const gl::Context *context,
|
||||
const gl::VertexArray::DirtyBits &dirtyBits,
|
||||
gl::VertexArray::DirtyAttribBitsArray *attribBits,
|
||||
@@ -479,9 +490,7 @@ angle::Result VertexArrayVk::syncState(const gl::Context *context,
|
||||
{
|
||||
// Note that just updating buffer data may still result in a new
|
||||
// vk::BufferHelper allocation.
|
||||
- BufferVk *bufferVk = vk::GetImpl(bufferGL);
|
||||
- mCurrentElementArrayBuffer =
|
||||
- &bufferVk->getBufferAndOffset(&mCurrentElementArrayBufferOffset);
|
||||
+ updateCurrentElementArrayBuffer();
|
||||
}
|
||||
else
|
||||
{
|
||||
diff --git a/src/libANGLE/renderer/vulkan/VertexArrayVk.h b/src/libANGLE/renderer/vulkan/VertexArrayVk.h
|
||||
index c198265bf8ba2017a13fce558826862f450218b5..0b98a9ed46b7cd4b9588973c74b0bbaf9172ab6c 100644
|
||||
--- a/src/libANGLE/renderer/vulkan/VertexArrayVk.h
|
||||
+++ b/src/libANGLE/renderer/vulkan/VertexArrayVk.h
|
||||
@@ -34,6 +34,8 @@ class VertexArrayVk : public VertexArrayImpl
|
||||
|
||||
angle::Result updateActiveAttribInfo(ContextVk *contextVk);
|
||||
|
||||
+ void updateCurrentElementArrayBuffer();
|
||||
+
|
||||
angle::Result updateDefaultAttrib(ContextVk *contextVk,
|
||||
size_t attribIndex,
|
||||
VkBuffer bufferHandle,
|
||||
33
patches/angle/cherry-pick-d49484c21e3c.patch
Normal file
33
patches/angle/cherry-pick-d49484c21e3c.patch
Normal file
@@ -0,0 +1,33 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jamie Madill <jmadill@chromium.org>
|
||||
Date: Mon, 11 Apr 2022 12:29:00 -0400
|
||||
Subject: Add error check on resuming XFB with deleted buffer.
|
||||
|
||||
Bug: chromium:1313905
|
||||
Change-Id: I22c6f6400b05ca32c922fba9a3b9d4b5841ca8b8
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3578378
|
||||
Auto-Submit: Jamie Madill <jmadill@chromium.org>
|
||||
Reviewed-by: Geoff Lang <geofflang@chromium.org>
|
||||
Commit-Queue: Jamie Madill <jmadill@chromium.org>
|
||||
(cherry picked from commit 5c85fd4e11a3835a0719223a7cedb978d309da21)
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3594103
|
||||
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
|
||||
|
||||
diff --git a/src/libANGLE/validationES3.cpp b/src/libANGLE/validationES3.cpp
|
||||
index 6fd5489332361c50c160228b089ec6108303f363..8d2f294b3a766b1cc3fff1472726503a11df0bcb 100644
|
||||
--- a/src/libANGLE/validationES3.cpp
|
||||
+++ b/src/libANGLE/validationES3.cpp
|
||||
@@ -4287,6 +4287,13 @@ bool ValidateResumeTransformFeedback(const Context *context, angle::EntryPoint e
|
||||
return false;
|
||||
}
|
||||
|
||||
+ if (!ValidateProgramExecutableXFBBuffersPresent(context,
|
||||
+ context->getState().getProgramExecutable()))
|
||||
+ {
|
||||
+ context->validationError(entryPoint, GL_INVALID_OPERATION, kTransformFeedbackBufferMissing);
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jamie Madill <jmadill@chromium.org>
|
||||
Date: Mon, 14 Mar 2022 10:37:31 -0400
|
||||
Subject: Fix crash when pausing XFB then deleting a buffer.
|
||||
|
||||
Fix is to validate XFB buffer bindings even if we're paused.
|
||||
This is undefined behaviour so we can use any non-crashing solution.
|
||||
|
||||
Bug: chromium:1305190
|
||||
Change-Id: Ib95404cdb13adbde7f34d6cc77473a8b3cbf1de7
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3522283
|
||||
Reviewed-by: Geoff Lang <geofflang@chromium.org>
|
||||
Commit-Queue: Jamie Madill <jmadill@chromium.org>
|
||||
(cherry picked from commit 708ce9cfd63bc8eab7c48987612a2dedce78c69a)
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3594105
|
||||
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
|
||||
|
||||
diff --git a/src/libANGLE/validationES.cpp b/src/libANGLE/validationES.cpp
|
||||
index e0281742d46d709f5f20a9d472256c5e475b627a..4cd36918f485f51cef2d6532a90bb8583b2861ab 100644
|
||||
--- a/src/libANGLE/validationES.cpp
|
||||
+++ b/src/libANGLE/validationES.cpp
|
||||
@@ -4087,7 +4087,7 @@ const char *ValidateDrawStates(const Context *context)
|
||||
}
|
||||
}
|
||||
|
||||
- if (state.isTransformFeedbackActiveUnpaused())
|
||||
+ if (state.isTransformFeedbackActive())
|
||||
{
|
||||
if (!ValidateProgramExecutableXFBBuffersPresent(context, executable))
|
||||
{
|
||||
diff --git a/src/tests/gl_tests/TransformFeedbackTest.cpp b/src/tests/gl_tests/TransformFeedbackTest.cpp
|
||||
index c93cd02406390471f24005b61c7cf3e4703700a9..d495f8bf7ffe917cc6722a05c92ac2fa71d0376b 100644
|
||||
--- a/src/tests/gl_tests/TransformFeedbackTest.cpp
|
||||
+++ b/src/tests/gl_tests/TransformFeedbackTest.cpp
|
||||
@@ -3902,6 +3902,25 @@ void main()
|
||||
EXPECT_GL_NO_ERROR();
|
||||
}
|
||||
|
||||
+// Same as the above, with a paused transform feedback.
|
||||
+TEST_P(TransformFeedbackTest, DeletePausedTransformFeedbackBuffer)
|
||||
+{
|
||||
+ ANGLE_GL_PROGRAM_TRANSFORM_FEEDBACK(testProgram, essl1_shaders::vs::Simple(),
|
||||
+ essl1_shaders::fs::Green(), {"gl_Position"},
|
||||
+ GL_INTERLEAVED_ATTRIBS);
|
||||
+ glUseProgram(testProgram);
|
||||
+
|
||||
+ GLBuffer buffer;
|
||||
+ glBindBuffer(GL_PIXEL_UNPACK_BUFFER, buffer);
|
||||
+ glBufferData(GL_PIXEL_UNPACK_BUFFER, 3, nullptr, GL_STATIC_DRAW);
|
||||
+ glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, buffer);
|
||||
+
|
||||
+ glBeginTransformFeedback(GL_POINTS);
|
||||
+ glPauseTransformFeedback();
|
||||
+ buffer.reset();
|
||||
+ glDrawArrays(GL_POINTS, 0, 1);
|
||||
+}
|
||||
+
|
||||
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(TransformFeedbackTest);
|
||||
ANGLE_INSTANTIATE_TEST_ES3(TransformFeedbackTest);
|
||||
|
||||
@@ -82,7 +82,7 @@ index a3fb077b9b9e66d1bc524fd7987622e73aa4776a..852b76bea69988e0b3ac76a17b603128
|
||||
|
||||
void EVP_MD_do_all(void (*callback)(const EVP_MD *cipher, const char *name,
|
||||
diff --git a/include/openssl/digest.h b/include/openssl/digest.h
|
||||
index 6e889993edc1caa7e10670529dd270c337b5ae4c..f61f7e5009a9b4f5630cda2c3a5a21b44e5b88d8 100644
|
||||
index fa7616896b6cc7422dc0171db29316f20fb25de8..6c19a0f0d454bef1abf16ebfeef380a53fb21e5c 100644
|
||||
--- a/include/openssl/digest.h
|
||||
+++ b/include/openssl/digest.h
|
||||
@@ -90,6 +90,9 @@ OPENSSL_EXPORT const EVP_MD *EVP_blake2b256(void);
|
||||
|
||||
@@ -48,6 +48,7 @@ worker_context_will_destroy.patch
|
||||
frame_host_manager.patch
|
||||
crashpad_pid_check.patch
|
||||
network_service_allow_remote_certificate_verification_logic.patch
|
||||
put_back_deleted_colors_for_autofill.patch
|
||||
disable_color_correct_rendering.patch
|
||||
add_contentgpuclient_precreatemessageloop_callback.patch
|
||||
picture-in-picture.patch
|
||||
@@ -90,6 +91,7 @@ webview_fullscreen.patch
|
||||
disable_unload_metrics.patch
|
||||
fix_add_check_for_sandbox_then_result.patch
|
||||
extend_apply_webpreferences.patch
|
||||
make_include_of_stack_trace_h_unconditional.patch
|
||||
build_libc_as_static_library.patch
|
||||
build_do_not_depend_on_packed_resource_integrity.patch
|
||||
refactor_restore_base_adaptcallbackforrepeating.patch
|
||||
@@ -102,20 +104,48 @@ chore_do_not_use_chrome_windows_in_cryptotoken_webrequestsender.patch
|
||||
process_singleton.patch
|
||||
fix_expose_decrementcapturercount_in_web_contents_impl.patch
|
||||
add_ui_scopedcliboardwriter_writeunsaferawdata.patch
|
||||
feat_add_data_parameter_to_processsingleton.patch
|
||||
mas_gate_private_enterprise_APIs.patch
|
||||
load_v8_snapshot_in_browser_process.patch
|
||||
fix_patch_out_permissions_checks_in_exclusive_access.patch
|
||||
fix_aspect_ratio_with_max_size.patch
|
||||
fix_dont_delete_SerialPortManager_on_main_thread.patch
|
||||
feat_add_data_transfer_to_requestsingleinstancelock.patch
|
||||
fix_crash_when_saving_edited_pdf_files.patch
|
||||
port_autofill_colors_to_the_color_pipeline.patch
|
||||
cherry-pick-f5101995acd2.patch
|
||||
fix_don_t_restore_maximized_windows_when_calling_showinactive.patch
|
||||
build_disable_partition_alloc_on_mac.patch
|
||||
fix_non-client_mouse_tracking_and_message_bubbling_on_windows.patch
|
||||
remove_incorrect_width_height_adjustments.patch
|
||||
set_dpi_correctly_during_main_window_creation.patch
|
||||
introduce_ozoneplatform_electron_can_call_x11_property.patch
|
||||
revert_motionmark_avoid_unnecessary_ipc_on_mac.patch
|
||||
cherry-pick-a1dc371d6680.patch
|
||||
cherry-pick-1665a1d16d46.patch
|
||||
use-after-free_of_id_and_idref_attributes.patch
|
||||
fix_--without-valid_build.patch
|
||||
cherry-pick-4d26949260aa.patch
|
||||
skia_renderer_use_rectf_intersect_in_applyscissor.patch
|
||||
cherry-pick-1a31e2110440.patch
|
||||
cherry-pick-5cb934a23ddf.patch
|
||||
use_iserrordocument_to_prevent_bfcacheing_of_interstitials_and.patch
|
||||
cherry-pick-5ff02e4d7368.patch
|
||||
cherry-pick-5361d836aeb1.patch
|
||||
cherry-pick-5be8e065f43e.patch
|
||||
cherry-pick-12ba78f3fa7a.patch
|
||||
reland_fix_noopener_case_for_user_activation_consumption.patch
|
||||
fsa_pass_file_ownership_to_worker_for_async_fsarfd_file_operations.patch
|
||||
merge_to_m100_don_t_use_getoriginalopener_to_get_opener_s_origin_on.patch
|
||||
cherry-pick-ec0cce63f47d.patch
|
||||
cherry-pick-99c3f3bfd507.patch
|
||||
cherry-pick-f1504440487f.patch
|
||||
cherry-pick-21139756239b.patch
|
||||
cherry-pick-919b1ffe1fe7.patch
|
||||
cherry-pick-2782c7bc5bbe.patch
|
||||
cherry-pick-f1dd785e021e.patch
|
||||
cherry-pick-f3d01ff794dc.patch
|
||||
cherry-pick-b03797bdb1df.patch
|
||||
posix_replace_doubleforkandexec_with_forkandspawn.patch
|
||||
cherry-pick-22c61cfae5d1.patch
|
||||
post_media_log_destruction_to_avoid_destruction.patch
|
||||
add_stop_method_to_batchingmedialog.patch
|
||||
make_gtk_getlibgtk_public.patch
|
||||
cherry-pick-cf64617c1cc5.patch
|
||||
cherry-pick-e2b8856012e0.patch
|
||||
cherry-pick-6b66a45021a0.patch
|
||||
fix_xkb_keysym_reverse_look_up_for_lacros.patch
|
||||
|
||||
@@ -10,7 +10,7 @@ This patch makes three changes to Accelerator::GetShortcutText to improve shortc
|
||||
3. Ctrl-Shift-= and Ctrl-Plus show up as such
|
||||
|
||||
diff --git a/ui/base/accelerators/accelerator.cc b/ui/base/accelerators/accelerator.cc
|
||||
index 2468b2c5881821d6f8e24a0e7c42243427b384ad..7e44c97edabf5ae012ff4f84d1404d8f223a13fe 100644
|
||||
index be0df3662e3a1528fb88d5c723da49e5a29ac2b9..64a5eda05be16b3b6e1a0ceaa2b3a6884ca37268 100644
|
||||
--- a/ui/base/accelerators/accelerator.cc
|
||||
+++ b/ui/base/accelerators/accelerator.cc
|
||||
@@ -11,6 +11,7 @@
|
||||
@@ -30,7 +30,7 @@ index 2468b2c5881821d6f8e24a0e7c42243427b384ad..7e44c97edabf5ae012ff4f84d1404d8f
|
||||
+ if (shifted_char) {
|
||||
+ shortcut += *shifted_char;
|
||||
+ } else {
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
#if defined(OS_WIN)
|
||||
// Our fallback is to try translate the key code to a regular character
|
||||
// unless it is one of digits (VK_0 to VK_9). Some keyboard
|
||||
@@ -261,6 +267,10 @@ std::u16string Accelerator::GetShortcutText() const {
|
||||
@@ -43,7 +43,7 @@ index 2468b2c5881821d6f8e24a0e7c42243427b384ad..7e44c97edabf5ae012ff4f84d1404d8f
|
||||
+ base::StringPrintf("F%d", key_code_ - VKEY_F1 + 1));
|
||||
}
|
||||
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
#if defined(OS_MAC)
|
||||
@@ -451,7 +461,7 @@ std::u16string Accelerator::ApplyLongFormModifiers(
|
||||
const std::u16string& shortcut) const {
|
||||
std::u16string result = shortcut;
|
||||
@@ -63,7 +63,7 @@ index 2468b2c5881821d6f8e24a0e7c42243427b384ad..7e44c97edabf5ae012ff4f84d1404d8f
|
||||
|
||||
if (IsCmdDown()) {
|
||||
diff --git a/ui/base/accelerators/accelerator.h b/ui/base/accelerators/accelerator.h
|
||||
index e0d9df439d120c0a47f55666b3818c7ba6796e70..283c6283f5aeaae1a5436e5fbb17ce2db4a9034e 100644
|
||||
index 5cdb2f160beae4d7787eb84d5013280ee9464446..76bd4369faa5d43d8a99ea51ed012857d6bff293 100644
|
||||
--- a/ui/base/accelerators/accelerator.h
|
||||
+++ b/ui/base/accelerators/accelerator.h
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
@@ -10,10 +10,10 @@ Allows Electron to restore WER when ELECTRON_DEFAULT_ERROR_MODE is set.
|
||||
This should be upstreamed.
|
||||
|
||||
diff --git a/content/gpu/gpu_main.cc b/content/gpu/gpu_main.cc
|
||||
index 9f840287967b50ec1db3a9d27973429ab231a486..731a279e395a8762a25a115665bff99be428de3d 100644
|
||||
index cdd437ad553493535015fd93d19aa29843e10c38..99b285b46c2193d0526fac8b706073213fa0846e 100644
|
||||
--- a/content/gpu/gpu_main.cc
|
||||
+++ b/content/gpu/gpu_main.cc
|
||||
@@ -239,6 +239,10 @@ int GpuMain(MainFunctionParams parameters) {
|
||||
@@ -237,6 +237,10 @@ int GpuMain(MainFunctionParams parameters) {
|
||||
// to the GpuProcessHost once the GpuServiceImpl has started.
|
||||
viz::GpuServiceImpl::InstallPreInitializeLogHandler();
|
||||
|
||||
@@ -24,7 +24,7 @@ index 9f840287967b50ec1db3a9d27973429ab231a486..731a279e395a8762a25a115665bff99b
|
||||
// We are experiencing what appear to be memory-stomp issues in the GPU
|
||||
// process. These issues seem to be impacting the task executor and listeners
|
||||
// registered to it. Create the task executor on the heap to guard against
|
||||
@@ -345,7 +349,6 @@ int GpuMain(MainFunctionParams parameters) {
|
||||
@@ -343,7 +347,6 @@ int GpuMain(MainFunctionParams parameters) {
|
||||
GpuProcess gpu_process(io_thread_priority);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ DidCreateScriptContext is called, not all JS APIs are available in the
|
||||
context, which can cause some preload scripts to trip.
|
||||
|
||||
diff --git a/content/public/renderer/render_frame_observer.h b/content/public/renderer/render_frame_observer.h
|
||||
index a92e09dc651a5f1a9bbae2572fad32233afcd46c..f99b652dda817b62615d2b3f00b4ae4b438ec44d 100644
|
||||
index f6d262f1bf7aa77c2a63f4a4c3351be0fe2ab3fd..52db2e1948fd7752b88d5a692748053491594c2d 100644
|
||||
--- a/content/public/renderer/render_frame_observer.h
|
||||
+++ b/content/public/renderer/render_frame_observer.h
|
||||
@@ -129,6 +129,8 @@ class CONTENT_EXPORT RenderFrameObserver : public IPC::Listener,
|
||||
@@ -23,10 +23,10 @@ index a92e09dc651a5f1a9bbae2572fad32233afcd46c..f99b652dda817b62615d2b3f00b4ae4b
|
||||
int32_t world_id) {}
|
||||
virtual void DidClearWindowObject() {}
|
||||
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
|
||||
index 4473c5e812a4a598f3e2f2bb06f78def5791af24..44c0ec9815aafd61182fd18a9d125e185d7196bc 100644
|
||||
index 584ae29be139c9be347e4fa9f920a2cc84baf00a..c7a5f0916cf8ba6db6fa85537c140024a92ff24d 100644
|
||||
--- a/content/renderer/render_frame_impl.cc
|
||||
+++ b/content/renderer/render_frame_impl.cc
|
||||
@@ -4455,6 +4455,12 @@ void RenderFrameImpl::DidCreateScriptContext(v8::Local<v8::Context> context,
|
||||
@@ -4515,6 +4515,12 @@ void RenderFrameImpl::DidCreateScriptContext(v8::Local<v8::Context> context,
|
||||
observer.DidCreateScriptContext(context, world_id);
|
||||
}
|
||||
|
||||
@@ -40,10 +40,10 @@ index 4473c5e812a4a598f3e2f2bb06f78def5791af24..44c0ec9815aafd61182fd18a9d125e18
|
||||
int world_id) {
|
||||
for (auto& observer : observers_)
|
||||
diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h
|
||||
index 21b90bbb8fe8ddc03eb20538be423a5396d18eb3..f9c735038f733d990783dd66ffe8c74f824c78f2 100644
|
||||
index 1b582c1736db20dab712ee7875f37c2140bd7d45..efab4f51e56e6e179fb832b1cf47d7f4a348e6c7 100644
|
||||
--- a/content/renderer/render_frame_impl.h
|
||||
+++ b/content/renderer/render_frame_impl.h
|
||||
@@ -597,6 +597,8 @@ class CONTENT_EXPORT RenderFrameImpl
|
||||
@@ -602,6 +602,8 @@ class CONTENT_EXPORT RenderFrameImpl
|
||||
blink::WebLocalFrameClient::LazyLoadBehavior lazy_load_behavior) override;
|
||||
void DidCreateScriptContext(v8::Local<v8::Context> context,
|
||||
int world_id) override;
|
||||
@@ -53,10 +53,10 @@ index 21b90bbb8fe8ddc03eb20538be423a5396d18eb3..f9c735038f733d990783dd66ffe8c74f
|
||||
int world_id) override;
|
||||
void DidChangeScrollOffset() override;
|
||||
diff --git a/third_party/blink/public/web/web_local_frame_client.h b/third_party/blink/public/web/web_local_frame_client.h
|
||||
index 3d6e0c0395ff7c92d8908c5151b467beec3a7516..2fadd6d9b2e3747eacea08973d8d3c7aa9c15f26 100644
|
||||
index 994841c02b0472e5239d9b73a07b2592a39df8be..ad19a3cddf200f6600a04c1136fd21218d496ba8 100644
|
||||
--- a/third_party/blink/public/web/web_local_frame_client.h
|
||||
+++ b/third_party/blink/public/web/web_local_frame_client.h
|
||||
@@ -599,6 +599,9 @@ class BLINK_EXPORT WebLocalFrameClient {
|
||||
@@ -596,6 +596,9 @@ class BLINK_EXPORT WebLocalFrameClient {
|
||||
virtual void DidCreateScriptContext(v8::Local<v8::Context>,
|
||||
int32_t world_id) {}
|
||||
|
||||
@@ -67,10 +67,10 @@ index 3d6e0c0395ff7c92d8908c5151b467beec3a7516..2fadd6d9b2e3747eacea08973d8d3c7a
|
||||
virtual void WillReleaseScriptContext(v8::Local<v8::Context>,
|
||||
int32_t world_id) {}
|
||||
diff --git a/third_party/blink/renderer/bindings/core/v8/local_window_proxy.cc b/third_party/blink/renderer/bindings/core/v8/local_window_proxy.cc
|
||||
index aa4b510137d60e6fb924f4f1a6554fe06c19ad75..816b6260020a6cbb6880b0eed197743ccd9002f5 100644
|
||||
index 29e255dc75a1d54211dc6059801d3c16b7cefdca..044195c7d77be5ff4abe9d2a71ddbbf2076b2efd 100644
|
||||
--- a/third_party/blink/renderer/bindings/core/v8/local_window_proxy.cc
|
||||
+++ b/third_party/blink/renderer/bindings/core/v8/local_window_proxy.cc
|
||||
@@ -205,6 +205,7 @@ void LocalWindowProxy::Initialize() {
|
||||
@@ -214,6 +214,7 @@ void LocalWindowProxy::Initialize() {
|
||||
}
|
||||
|
||||
InstallConditionalFeatures();
|
||||
@@ -79,10 +79,10 @@ index aa4b510137d60e6fb924f4f1a6554fe06c19ad75..816b6260020a6cbb6880b0eed197743c
|
||||
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 0dda1f7cd77c47f7e61ba48dd20429c13679b543..2f73aacda1bafe07775213e232eda56c4b33325b 100644
|
||||
index c28bc5f4d285ab2db1b0501ad8663c4f948f3ddc..327c04b40460fc033ca7f4e4f838608cfc6c0ba3 100644
|
||||
--- a/third_party/blink/renderer/core/frame/local_frame_client.h
|
||||
+++ b/third_party/blink/renderer/core/frame/local_frame_client.h
|
||||
@@ -308,6 +308,8 @@ class CORE_EXPORT LocalFrameClient : public FrameClient {
|
||||
@@ -311,6 +311,8 @@ class CORE_EXPORT LocalFrameClient : public FrameClient {
|
||||
|
||||
virtual void DidCreateScriptContext(v8::Local<v8::Context>,
|
||||
int32_t world_id) = 0;
|
||||
@@ -92,7 +92,7 @@ index 0dda1f7cd77c47f7e61ba48dd20429c13679b543..2f73aacda1bafe07775213e232eda56c
|
||||
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 5297ad63f1c76240d57a64cc5ea64cbf8c7e1b95..006da6072db12da1632f9d45ecb5710136573641 100644
|
||||
index 0922aaf1a5f076ed4544b6870ac3674b023c428b..ff8ccf56eaafe36fe4de08a448789b13033e8604 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
|
||||
@@ -274,6 +274,13 @@ void LocalFrameClientImpl::DidCreateScriptContext(
|
||||
@@ -110,7 +110,7 @@ index 5297ad63f1c76240d57a64cc5ea64cbf8c7e1b95..006da6072db12da1632f9d45ecb57101
|
||||
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 708414fca139eb8328e425d909a48ca97038e442..48b2a0e129ec166ebd4c9bbd32330b0cc43dbeb2 100644
|
||||
index 59dd5662dccea2e570b93e7bbdc59fded301979c..30d7bafbf5877d71868fbdec9abbcacacd4b72a8 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
|
||||
@@ -78,6 +78,8 @@ class CORE_EXPORT LocalFrameClientImpl final : public LocalFrameClient {
|
||||
@@ -123,10 +123,10 @@ index 708414fca139eb8328e425d909a48ca97038e442..48b2a0e129ec166ebd4c9bbd32330b0c
|
||||
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 4b639069d5d9173f0c35fe7656356031ba424a61..3da6699b40bf4f91e6d76a37e5fa8f680f7a7850 100644
|
||||
index 4fa74cc53ddd7557dc5b9e9e6c7ed16214f049b9..cf1e3e898f3b4c9461ed700e0776856689b4c65b 100644
|
||||
--- a/third_party/blink/renderer/core/loader/empty_clients.h
|
||||
+++ b/third_party/blink/renderer/core/loader/empty_clients.h
|
||||
@@ -357,6 +357,8 @@ class CORE_EXPORT EmptyLocalFrameClient : public LocalFrameClient {
|
||||
@@ -356,6 +356,8 @@ class CORE_EXPORT EmptyLocalFrameClient : public LocalFrameClient {
|
||||
|
||||
void DidCreateScriptContext(v8::Local<v8::Context>,
|
||||
int32_t world_id) override {}
|
||||
|
||||
107
patches/chromium/add_stop_method_to_batchingmedialog.patch
Normal file
107
patches/chromium/add_stop_method_to_batchingmedialog.patch
Normal file
@@ -0,0 +1,107 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Ted Meyer <tmathmeyer@chromium.org>
|
||||
Date: Wed, 8 Jun 2022 04:33:20 +0000
|
||||
Subject: Add Stop method to BatchingMediaLog
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Now that ~MediaLog is posted for a later destruction due to garbage
|
||||
collector ownership of CodecLogger, it's possible for the
|
||||
SendQueuedMediaEvents call from ~BatchingMediaLog to reference
|
||||
InspectorMediaEventHandler::inspector_context_ after it has been freed.
|
||||
|
||||
This fix forces BatchingMediaLog to shut down it's logging capabilities
|
||||
when the destruction call is caused by the garbage collector deletion
|
||||
phase
|
||||
|
||||
R=liberato
|
||||
|
||||
(cherry picked from commit 1bbfaf23cd8a1e977cb445a82a4caae107632a59)
|
||||
|
||||
Bug: 1333333
|
||||
Change-Id: I0bdca72a71177c4c5a6a9dc692aad3de4c25f4e2
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3689639
|
||||
Commit-Queue: Ted (Chromium) Meyer <tmathmeyer@chromium.org>
|
||||
Reviewed-by: Eugene Zemtsov <eugene@chromium.org>
|
||||
Cr-Original-Commit-Position: refs/heads/main@{#1011247}
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3694435
|
||||
Auto-Submit: Ted (Chromium) Meyer <tmathmeyer@chromium.org>
|
||||
Reviewed-by: Eugene Zemtsov <ezemtsov@google.com>
|
||||
Commit-Queue: Eugene Zemtsov <eugene@chromium.org>
|
||||
Cr-Commit-Position: refs/branch-heads/5060@{#672}
|
||||
Cr-Branched-From: b83393d0f4038aeaf67f970a024d8101df7348d1-refs/heads/main@{#1002911}
|
||||
|
||||
diff --git a/content/renderer/media/batching_media_log.cc b/content/renderer/media/batching_media_log.cc
|
||||
index ea5ba3c2e9c876b78f582cb56fb60c42d5a21ffb..148298783fc226bc376d01b152e53532c21b8c99 100644
|
||||
--- a/content/renderer/media/batching_media_log.cc
|
||||
+++ b/content/renderer/media/batching_media_log.cc
|
||||
@@ -75,6 +75,11 @@ BatchingMediaLog::~BatchingMediaLog() {
|
||||
SendQueuedMediaEvents();
|
||||
}
|
||||
|
||||
+void BatchingMediaLog::Stop() {
|
||||
+ base::AutoLock lock(lock_);
|
||||
+ event_handlers_.clear();
|
||||
+}
|
||||
+
|
||||
void BatchingMediaLog::OnWebMediaPlayerDestroyedLocked() {
|
||||
base::AutoLock lock(lock_);
|
||||
for (const auto& handler : event_handlers_)
|
||||
diff --git a/content/renderer/media/batching_media_log.h b/content/renderer/media/batching_media_log.h
|
||||
index eb757a4ca922bd5456d0e436d10cc540ee9134ae..6c2df688caee4d2fc17e973cdad12f20342e56fe 100644
|
||||
--- a/content/renderer/media/batching_media_log.h
|
||||
+++ b/content/renderer/media/batching_media_log.h
|
||||
@@ -45,6 +45,8 @@ class CONTENT_EXPORT BatchingMediaLog : public media::MediaLog {
|
||||
|
||||
~BatchingMediaLog() override;
|
||||
|
||||
+ void Stop() override;
|
||||
+
|
||||
// Will reset |last_ipc_send_time_| with the value of NowTicks().
|
||||
void SetTickClockForTesting(const base::TickClock* tick_clock);
|
||||
|
||||
diff --git a/media/base/media_log.cc b/media/base/media_log.cc
|
||||
index 6cb08ed64cb3fe9e6910e4c24c7f0280b050fc15..e3f8f22fed1c12f3466c3ebaa42a67ac1009f6b1 100644
|
||||
--- a/media/base/media_log.cc
|
||||
+++ b/media/base/media_log.cc
|
||||
@@ -48,6 +48,9 @@ std::string MediaLog::GetErrorMessageLocked() {
|
||||
return "";
|
||||
}
|
||||
|
||||
+// Default implementation.
|
||||
+void MediaLog::Stop() {}
|
||||
+
|
||||
void MediaLog::AddMessage(MediaLogMessageLevel level, std::string message) {
|
||||
std::unique_ptr<MediaLogRecord> record(
|
||||
CreateRecord(MediaLogRecord::Type::kMessage));
|
||||
diff --git a/media/base/media_log.h b/media/base/media_log.h
|
||||
index b6cf2bf451650509dbef318f07d04a4679bb257d..f8d3f481abdd410bbaefbc007a0f4fa79fe426cb 100644
|
||||
--- a/media/base/media_log.h
|
||||
+++ b/media/base/media_log.h
|
||||
@@ -126,6 +126,10 @@ class MEDIA_EXPORT MediaLog {
|
||||
// even if this occurs, in the "won't crash" sense.
|
||||
virtual std::unique_ptr<MediaLog> Clone();
|
||||
|
||||
+ // Can be used for stopping a MediaLog during a garbage-collected destruction
|
||||
+ // sequence.
|
||||
+ virtual void Stop();
|
||||
+
|
||||
protected:
|
||||
// Ensures only subclasses and factories (e.g. Clone()) can create MediaLog.
|
||||
MediaLog();
|
||||
diff --git a/third_party/blink/renderer/modules/webcodecs/codec_logger.cc b/third_party/blink/renderer/modules/webcodecs/codec_logger.cc
|
||||
index 32698e3778ca40b2e0ef26f020269f9a2b0f9cb9..c9775d3da9ad4f0513a341f6fb2c56d0a337e2ee 100644
|
||||
--- a/third_party/blink/renderer/modules/webcodecs/codec_logger.cc
|
||||
+++ b/third_party/blink/renderer/modules/webcodecs/codec_logger.cc
|
||||
@@ -70,7 +70,9 @@ CodecLogger::~CodecLogger() {
|
||||
// media logs must be posted for destruction, since they can cause the
|
||||
// garbage collector to trigger an immediate cleanup and delete the owning
|
||||
// instance of |CodecLogger|.
|
||||
- task_runner_->DeleteSoon(FROM_HERE, std::move(parent_media_log_));
|
||||
+ if (parent_media_log_) {
|
||||
+ task_runner_->DeleteSoon(FROM_HERE, std::move(parent_media_log_));
|
||||
+ }
|
||||
}
|
||||
|
||||
void CodecLogger::Neuter() {
|
||||
@@ -8,12 +8,12 @@ was removed as part of the Raw Clipboard API scrubbing.
|
||||
https://bugs.chromium.org/p/chromium/issues/detail?id=1217643
|
||||
|
||||
diff --git a/ui/base/clipboard/scoped_clipboard_writer.cc b/ui/base/clipboard/scoped_clipboard_writer.cc
|
||||
index 3009acd40eee36bc3d4dd8642f0ce5e6476da973..1d52ce84184a3ca94e4e0f04d331bf56d75e07d0 100644
|
||||
index 153f169d2cdef6f8a726c188283a5bc1b7395fa3..3a5d9ab8dafacafb1025e1cb8c157e8a82078424 100644
|
||||
--- a/ui/base/clipboard/scoped_clipboard_writer.cc
|
||||
+++ b/ui/base/clipboard/scoped_clipboard_writer.cc
|
||||
@@ -227,6 +227,16 @@ void ScopedClipboardWriter::WriteEncodedDataTransferEndpointForTesting(
|
||||
@@ -212,6 +212,16 @@ void ScopedClipboardWriter::WriteData(const std::u16string& format,
|
||||
}
|
||||
}
|
||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
|
||||
+void ScopedClipboardWriter::WriteUnsafeRawData(const std::u16string& format,
|
||||
+ mojo_base::BigBuffer data) {
|
||||
@@ -29,10 +29,10 @@ index 3009acd40eee36bc3d4dd8642f0ce5e6476da973..1d52ce84184a3ca94e4e0f04d331bf56
|
||||
objects_.clear();
|
||||
platform_representations_.clear();
|
||||
diff --git a/ui/base/clipboard/scoped_clipboard_writer.h b/ui/base/clipboard/scoped_clipboard_writer.h
|
||||
index c47909313da0d7cd8a2b3cd670327011af66e3fb..0d259c21507f38124dfa46aceeacfda76cfd4a38 100644
|
||||
index 879acd4f6f0101a6da3af58d78eeda877ea41a4a..4d4149b6aa34c7073804994cb1c03368830c736d 100644
|
||||
--- a/ui/base/clipboard/scoped_clipboard_writer.h
|
||||
+++ b/ui/base/clipboard/scoped_clipboard_writer.h
|
||||
@@ -84,6 +84,10 @@ class COMPONENT_EXPORT(UI_BASE_CLIPBOARD) ScopedClipboardWriter {
|
||||
@@ -80,6 +80,10 @@ class COMPONENT_EXPORT(UI_BASE_CLIPBOARD) ScopedClipboardWriter {
|
||||
// This is only used to write custom format data.
|
||||
void WriteData(const std::u16string& format, mojo_base::BigBuffer data);
|
||||
|
||||
@@ -42,4 +42,4 @@ index c47909313da0d7cd8a2b3cd670327011af66e3fb..0d259c21507f38124dfa46aceeacfda7
|
||||
+
|
||||
void WriteImage(const SkBitmap& bitmap);
|
||||
|
||||
#if BUILDFLAG(IS_CHROMEOS_LACROS)
|
||||
// Mark the data to be written as confidential.
|
||||
|
||||
@@ -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 56c08919ab626a8a7b3bcb892ee94cdee2a106fc..b85bdf4ed574a149a6502e8d21e54f2ee80777a5 100644
|
||||
index 2d918fcf473d6ce399dde0413da0b1d7444c32c0..29f53b668d6c8f50d901bf214d19ae08d765944d 100644
|
||||
--- a/content/browser/renderer_host/render_view_host_impl.cc
|
||||
+++ b/content/browser/renderer_host/render_view_host_impl.cc
|
||||
@@ -647,6 +647,11 @@ void RenderViewHostImpl::SetBackgroundOpaque(bool opaque) {
|
||||
@@ -633,6 +633,11 @@ void RenderViewHostImpl::SetBackgroundOpaque(bool opaque) {
|
||||
GetWidget()->GetAssociatedFrameWidget()->SetBackgroundOpaque(opaque);
|
||||
}
|
||||
|
||||
@@ -22,10 +22,10 @@ index 56c08919ab626a8a7b3bcb892ee94cdee2a106fc..b85bdf4ed574a149a6502e8d21e54f2e
|
||||
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 9e32df9f5fd765895c8470c3922a62f754e7d409..9bac2321d65d9e54ce88fffafd72a74803ed2c87 100644
|
||||
index c2d024d09dda8b221cc588e784cb2d31c273d0ff..c0fd9c5400acf32c89a477797c4d9c45662fb14c 100644
|
||||
--- a/content/browser/renderer_host/render_view_host_impl.h
|
||||
+++ b/content/browser/renderer_host/render_view_host_impl.h
|
||||
@@ -135,6 +135,7 @@ class CONTENT_EXPORT RenderViewHostImpl
|
||||
@@ -136,6 +136,7 @@ class CONTENT_EXPORT RenderViewHostImpl
|
||||
bool IsRenderViewLive() override;
|
||||
void WriteIntoTrace(perfetto::TracedValue context) override;
|
||||
|
||||
@@ -48,7 +48,7 @@ index 787077d71c04d571aa825bec0a549c5fad2b8574..4b05b80802ba97a46eed60e509b503fc
|
||||
// This interface should only be implemented inside content.
|
||||
friend class RenderViewHostImpl;
|
||||
diff --git a/content/renderer/render_view_impl.h b/content/renderer/render_view_impl.h
|
||||
index 4e8d36420d6edc1725a840e1b9f123041d21abe4..dd198cb7bf02e509833c6b4c7d8e5d65d20d46dc 100644
|
||||
index 975757f5e878004180f155583712ad48de781ef6..3dad0b314f0d4e7f93e8b727f2ef875ce9d4762e 100644
|
||||
--- a/content/renderer/render_view_impl.h
|
||||
+++ b/content/renderer/render_view_impl.h
|
||||
@@ -152,6 +152,8 @@ class CONTENT_EXPORT RenderViewImpl : public blink::WebViewClient,
|
||||
@@ -61,7 +61,7 @@ index 4e8d36420d6edc1725a840e1b9f123041d21abe4..dd198cb7bf02e509833c6b4c7d8e5d65
|
||||
// ADDING NEW FUNCTIONS? Please keep private functions alphabetized and put
|
||||
// it in the same order in the .cc file as it was in the header.
|
||||
diff --git a/third_party/blink/public/mojom/page/page.mojom b/third_party/blink/public/mojom/page/page.mojom
|
||||
index befd736a9cf362514b9a2ee475dc4a814c85a87b..24b2617f56673a3075697802cf5b574b0c766610 100644
|
||||
index b7c6ba65551acd31c96be06c3d7595f28b6855b0..21ce5fe263f8a47281b21c45c7bda9eff1cb17b5 100644
|
||||
--- a/third_party/blink/public/mojom/page/page.mojom
|
||||
+++ b/third_party/blink/public/mojom/page/page.mojom
|
||||
@@ -97,4 +97,7 @@ interface PageBroadcast {
|
||||
@@ -85,10 +85,10 @@ index 14d4a00293ab0b11e733676844ce483992d6cd8e..c6c2dbb9dddd1eaa21e8c7b276d871a3
|
||||
// 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 b9d5a13bcdf981064f9970fdb8017fed5f93b35e..182f70b2b3bd9cbc6548d4c17caad797e5dad0ce 100644
|
||||
index 567ea9b7bd78a229b113ae11849f3e86942c92d6..d525df56c4e33a19431b2980a932956cb1986865 100644
|
||||
--- a/third_party/blink/renderer/core/exported/web_view_impl.cc
|
||||
+++ b/third_party/blink/renderer/core/exported/web_view_impl.cc
|
||||
@@ -3668,6 +3668,13 @@ PageScheduler* WebViewImpl::Scheduler() const {
|
||||
@@ -3667,6 +3667,13 @@ PageScheduler* WebViewImpl::Scheduler() const {
|
||||
return GetPage()->GetPageScheduler();
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ index b9d5a13bcdf981064f9970fdb8017fed5f93b35e..182f70b2b3bd9cbc6548d4c17caad797
|
||||
void WebViewImpl::SetVisibilityState(
|
||||
mojom::blink::PageVisibilityState visibility_state,
|
||||
bool is_initial_state) {
|
||||
@@ -3679,7 +3686,8 @@ void WebViewImpl::SetVisibilityState(
|
||||
@@ -3678,7 +3685,8 @@ void WebViewImpl::SetVisibilityState(
|
||||
}
|
||||
GetPage()->SetVisibilityState(visibility_state, is_initial_state);
|
||||
GetPage()->GetPageScheduler()->SetPageVisible(
|
||||
@@ -113,10 +113,10 @@ index b9d5a13bcdf981064f9970fdb8017fed5f93b35e..182f70b2b3bd9cbc6548d4c17caad797
|
||||
|
||||
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 5107ef421138e136b20b25b7bbcc1f0bb246bb66..043266205142e59f88c4c2f2ae6b58bb009f2d9c 100644
|
||||
index 63e97c417f1709438319956d9f2ed2f845e950c0..80904ef8478952f38a326fe1cebbff06ff7e25ab 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 5107ef421138e136b20b25b7bbcc1f0bb246bb66..043266205142e59f88c4c2f2ae6b58bb
|
||||
void SetVisibilityState(mojom::blink::PageVisibilityState visibility_state,
|
||||
bool is_initial_state) override;
|
||||
mojom::blink::PageVisibilityState GetVisibilityState() override;
|
||||
@@ -857,6 +858,8 @@ class CORE_EXPORT WebViewImpl final : public WebView,
|
||||
@@ -855,6 +856,8 @@ class CORE_EXPORT WebViewImpl final : public WebView,
|
||||
// If true, we send IPC messages when |preferred_size_| changes.
|
||||
bool send_preferred_size_changes_ = false;
|
||||
|
||||
|
||||
@@ -8,19 +8,21 @@ WebPreferences of in-process child windows, rather than relying on
|
||||
process-level command line switches, as before.
|
||||
|
||||
diff --git a/third_party/blink/common/web_preferences/web_preferences.cc b/third_party/blink/common/web_preferences/web_preferences.cc
|
||||
index 30e237f886b41bdf528b2a0e81054d15fb323f1f..43f7920cf6ff12d8a48ddef5440814a42266e8c5 100644
|
||||
index 6356025f24855b789b0fdb492ca61232bc6d8000..37b08cb04db0cc16636cfa9db6cc91f050cc85ab 100644
|
||||
--- a/third_party/blink/common/web_preferences/web_preferences.cc
|
||||
+++ b/third_party/blink/common/web_preferences/web_preferences.cc
|
||||
@@ -145,6 +145,20 @@ WebPreferences::WebPreferences()
|
||||
@@ -144,6 +144,22 @@ WebPreferences::WebPreferences()
|
||||
fake_no_alloc_direct_call_for_testing_enabled(false),
|
||||
v8_cache_options(blink::mojom::V8CacheOptions::kDefault),
|
||||
record_whole_document(false),
|
||||
+ // Begin Electron-specific WebPreferences.
|
||||
+ opener_id(0),
|
||||
+ context_isolation(false),
|
||||
+ is_webview(false),
|
||||
+ hidden_page(false),
|
||||
+ offscreen(false),
|
||||
+ preload(base::FilePath::StringType()),
|
||||
+ native_window_open(false),
|
||||
+ node_integration(false),
|
||||
+ node_integration_in_worker(false),
|
||||
+ node_integration_in_sub_frames(false),
|
||||
@@ -33,7 +35,7 @@ index 30e237f886b41bdf528b2a0e81054d15fb323f1f..43f7920cf6ff12d8a48ddef5440814a4
|
||||
accelerated_video_decode_enabled(false),
|
||||
animation_policy(
|
||||
diff --git a/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc b/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc
|
||||
index d278453a261fe2dd3bacce433e35d50879b555a7..140f8d6273d944bfe36831d27aef757d89240b56 100644
|
||||
index 98391c17bc6c3371919966e9caf09efbcc94cec6..c4f9f01aaf44a14e13b285fa0f6287f068c5e401 100644
|
||||
--- a/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc
|
||||
+++ b/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc
|
||||
@@ -22,6 +22,10 @@ bool StructTraits<blink::mojom::WebPreferencesDataView,
|
||||
@@ -47,15 +49,17 @@ index d278453a261fe2dd3bacce433e35d50879b555a7..140f8d6273d944bfe36831d27aef757d
|
||||
!data.ReadLazyFrameLoadingDistanceThresholdsPx(
|
||||
&out->lazy_frame_loading_distance_thresholds_px) ||
|
||||
!data.ReadLazyImageLoadingDistanceThresholdsPx(
|
||||
@@ -151,6 +155,19 @@ bool StructTraits<blink::mojom::WebPreferencesDataView,
|
||||
@@ -156,6 +160,21 @@ bool StructTraits<blink::mojom::WebPreferencesDataView,
|
||||
data.fake_no_alloc_direct_call_for_testing_enabled();
|
||||
out->v8_cache_options = data.v8_cache_options();
|
||||
out->record_whole_document = data.record_whole_document();
|
||||
+ // Begin Electron-specific WebPreferences.
|
||||
+ out->opener_id = data.opener_id();
|
||||
+ out->context_isolation = data.context_isolation();
|
||||
+ out->is_webview = data.is_webview();
|
||||
+ out->hidden_page = data.hidden_page();
|
||||
+ out->offscreen = data.offscreen();
|
||||
+ out->native_window_open = data.native_window_open();
|
||||
+ out->node_integration = data.node_integration();
|
||||
+ out->node_integration_in_worker = data.node_integration_in_worker();
|
||||
+ out->node_integration_in_sub_frames = data.node_integration_in_sub_frames();
|
||||
@@ -68,7 +72,7 @@ index d278453a261fe2dd3bacce433e35d50879b555a7..140f8d6273d944bfe36831d27aef757d
|
||||
out->accelerated_video_decode_enabled =
|
||||
data.accelerated_video_decode_enabled();
|
||||
diff --git a/third_party/blink/public/common/web_preferences/web_preferences.h b/third_party/blink/public/common/web_preferences/web_preferences.h
|
||||
index 8509f720c5afb816c6cbb2313dd566a24236a790..b9f0f79d96c58a7769939610bb72f8b2bcd3be94 100644
|
||||
index 9eefe05ffbd6f78a869e2a7449a8fa7c7d456dda..3f84267ed1d7158b168709270be6a01da7dcfa31 100644
|
||||
--- a/third_party/blink/public/common/web_preferences/web_preferences.h
|
||||
+++ b/third_party/blink/public/common/web_preferences/web_preferences.h
|
||||
@@ -10,6 +10,7 @@
|
||||
@@ -79,17 +83,19 @@ index 8509f720c5afb816c6cbb2313dd566a24236a790..b9f0f79d96c58a7769939610bb72f8b2
|
||||
#include "net/nqe/effective_connection_type.h"
|
||||
#include "third_party/blink/public/common/common_export.h"
|
||||
#include "third_party/blink/public/mojom/css/preferred_color_scheme.mojom-shared.h"
|
||||
@@ -160,6 +161,22 @@ struct BLINK_COMMON_EXPORT WebPreferences {
|
||||
@@ -161,6 +162,24 @@ struct BLINK_COMMON_EXPORT WebPreferences {
|
||||
blink::mojom::V8CacheOptions v8_cache_options;
|
||||
bool record_whole_document;
|
||||
|
||||
+ // Begin Electron-specific WebPreferences.
|
||||
+ std::vector<base::FilePath> preloads;
|
||||
+ int opener_id;
|
||||
+ bool context_isolation;
|
||||
+ bool is_webview;
|
||||
+ bool hidden_page;
|
||||
+ bool offscreen;
|
||||
+ base::FilePath preload;
|
||||
+ bool native_window_open;
|
||||
+ bool node_integration;
|
||||
+ bool node_integration_in_worker;
|
||||
+ bool node_integration_in_sub_frames;
|
||||
@@ -103,7 +109,7 @@ index 8509f720c5afb816c6cbb2313dd566a24236a790..b9f0f79d96c58a7769939610bb72f8b2
|
||||
// only controls whether or not the "document.cookie" field is properly
|
||||
// connected to the backing store, for instance if you wanted to be able to
|
||||
diff --git a/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h b/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h
|
||||
index a6291be3e953ceaee1d996e4b30a6ae78916bc7a..c3baf95c5d9b6a6ace56bcde9e1dc8179f18eaa0 100644
|
||||
index 5124059d0df902d3879f2c96d001472a10c2ead1..b9a3e3ed17bb227f1e5ec868880a19ef19331b07 100644
|
||||
--- a/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h
|
||||
+++ b/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h
|
||||
@@ -6,6 +6,7 @@
|
||||
@@ -114,7 +120,7 @@ index a6291be3e953ceaee1d996e4b30a6ae78916bc7a..c3baf95c5d9b6a6ace56bcde9e1dc817
|
||||
#include "mojo/public/cpp/bindings/struct_traits.h"
|
||||
#include "net/nqe/effective_connection_type.h"
|
||||
#include "third_party/blink/public/common/common_export.h"
|
||||
@@ -441,6 +442,60 @@ struct BLINK_COMMON_EXPORT StructTraits<blink::mojom::WebPreferencesDataView,
|
||||
@@ -446,6 +447,68 @@ struct BLINK_COMMON_EXPORT StructTraits<blink::mojom::WebPreferencesDataView,
|
||||
return r.record_whole_document;
|
||||
}
|
||||
|
||||
@@ -123,6 +129,10 @@ index a6291be3e953ceaee1d996e4b30a6ae78916bc7a..c3baf95c5d9b6a6ace56bcde9e1dc817
|
||||
+ return r.preloads;
|
||||
+ }
|
||||
+
|
||||
+ static int opener_id(const blink::web_pref::WebPreferences& r) {
|
||||
+ return r.opener_id;
|
||||
+ }
|
||||
+
|
||||
+ static bool context_isolation(const blink::web_pref::WebPreferences& r) {
|
||||
+ return r.context_isolation;
|
||||
+ }
|
||||
@@ -143,6 +153,10 @@ index a6291be3e953ceaee1d996e4b30a6ae78916bc7a..c3baf95c5d9b6a6ace56bcde9e1dc817
|
||||
+ return r.preload;
|
||||
+ }
|
||||
+
|
||||
+ static bool native_window_open(const blink::web_pref::WebPreferences& r) {
|
||||
+ return r.native_window_open;
|
||||
+ }
|
||||
+
|
||||
+ static bool node_integration(const blink::web_pref::WebPreferences& r) {
|
||||
+ return r.node_integration;
|
||||
+ }
|
||||
@@ -176,7 +190,7 @@ index a6291be3e953ceaee1d996e4b30a6ae78916bc7a..c3baf95c5d9b6a6ace56bcde9e1dc817
|
||||
return r.cookie_enabled;
|
||||
}
|
||||
diff --git a/third_party/blink/public/mojom/webpreferences/web_preferences.mojom b/third_party/blink/public/mojom/webpreferences/web_preferences.mojom
|
||||
index 96dd9fd56e44e66c5ea24d9df7c6cbff25409d6c..e0d113b4dee6a72f350b8494448f516be01d0468 100644
|
||||
index 1f0ca7565e7df7bb535bb8c779929f6202273471..3fe9e1089c0cceaa7c6f6e7dff4dac9fc55d2ca2 100644
|
||||
--- a/third_party/blink/public/mojom/webpreferences/web_preferences.mojom
|
||||
+++ b/third_party/blink/public/mojom/webpreferences/web_preferences.mojom
|
||||
@@ -10,6 +10,7 @@ import "third_party/blink/public/mojom/v8_cache_options.mojom";
|
||||
@@ -187,17 +201,19 @@ index 96dd9fd56e44e66c5ea24d9df7c6cbff25409d6c..e0d113b4dee6a72f350b8494448f516b
|
||||
|
||||
enum PointerType {
|
||||
kPointerNone = 1, // 1 << 0
|
||||
@@ -212,6 +213,22 @@ struct WebPreferences {
|
||||
@@ -213,6 +214,24 @@ struct WebPreferences {
|
||||
V8CacheOptions v8_cache_options;
|
||||
bool record_whole_document;
|
||||
|
||||
+ // Begin Electron-specific WebPreferences.
|
||||
+ array<mojo_base.mojom.FilePath> preloads;
|
||||
+ int32 opener_id;
|
||||
+ bool context_isolation;
|
||||
+ bool is_webview;
|
||||
+ bool hidden_page;
|
||||
+ bool offscreen;
|
||||
+ mojo_base.mojom.FilePath preload;
|
||||
+ bool native_window_open;
|
||||
+ bool node_integration;
|
||||
+ bool node_integration_in_worker;
|
||||
+ bool node_integration_in_sub_frames;
|
||||
|
||||
@@ -6,7 +6,7 @@ Subject: allow new privileges in unsandboxed child processes
|
||||
This allows unsandboxed renderers to launch setuid processes on Linux.
|
||||
|
||||
diff --git a/content/browser/child_process_launcher_helper_linux.cc b/content/browser/child_process_launcher_helper_linux.cc
|
||||
index f60ad777ab7698a4518d3b1b61ade29e7c618a3a..c7781bdb49f8a92aa9ee1d8dd1af03fa9cf2dfe3 100644
|
||||
index bbc1d4d057291cc4a3c65287309a22897179a47e..6318b1f2251670d5dd975fde695ee2438c456a0f 100644
|
||||
--- a/content/browser/child_process_launcher_helper_linux.cc
|
||||
+++ b/content/browser/child_process_launcher_helper_linux.cc
|
||||
@@ -53,6 +53,18 @@ bool ChildProcessLauncherHelper::BeforeLaunchOnLauncherThread(
|
||||
|
||||
@@ -7,10 +7,10 @@ This is used by editors to obtain the filesystem path from a dragged file. See
|
||||
documentation at https://electronjs.org/docs/api/file-object
|
||||
|
||||
diff --git a/third_party/blink/renderer/core/fileapi/file.h b/third_party/blink/renderer/core/fileapi/file.h
|
||||
index 72d6b7e109779c9785130ebb0e1e23202c5bc68d..e12c4acfd87f1d698d7c8c8459e7231ee03789fd 100644
|
||||
index d70a95cc9b28674dd4ac925e9f1aca481e60c34b..fa9d21a20e77867a7d596e0df4ec143edb871f27 100644
|
||||
--- a/third_party/blink/renderer/core/fileapi/file.h
|
||||
+++ b/third_party/blink/renderer/core/fileapi/file.h
|
||||
@@ -212,6 +212,9 @@ class CORE_EXPORT File final : public Blob {
|
||||
@@ -191,6 +191,9 @@ class CORE_EXPORT File final : public Blob {
|
||||
}
|
||||
const String& name() const { return name_; }
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ Refs changes in:
|
||||
This patch reverts the changes to fix associated crashes in Electron.
|
||||
|
||||
diff --git a/third_party/blink/renderer/core/frame/frame.cc b/third_party/blink/renderer/core/frame/frame.cc
|
||||
index 09e6436422169ac05d5f0561f12984c86dc7af5e..7b2263f4c7fa2dffbaf5b630f4d5a83d9b68f9a5 100644
|
||||
index 1b022bf6b37982e6321120951de5d8dcc10ecf6a..5cd7cf680244383e466106801103871b3bba8796 100644
|
||||
--- a/third_party/blink/renderer/core/frame/frame.cc
|
||||
+++ b/third_party/blink/renderer/core/frame/frame.cc
|
||||
@@ -122,14 +122,6 @@ bool Frame::Detach(FrameDetachType type) {
|
||||
@@ -33,7 +33,7 @@ index 09e6436422169ac05d5f0561f12984c86dc7af5e..7b2263f4c7fa2dffbaf5b630f4d5a83d
|
||||
if (type == FrameDetachType::kRemove) {
|
||||
if (provisional_frame_) {
|
||||
provisional_frame_->Detach(FrameDetachType::kRemove);
|
||||
@@ -153,6 +145,14 @@ bool Frame::Detach(FrameDetachType type) {
|
||||
@@ -152,6 +144,14 @@ bool Frame::Detach(FrameDetachType type) {
|
||||
GetWindowProxyManager()->ClearForSwap();
|
||||
}
|
||||
|
||||
@@ -49,10 +49,10 @@ index 09e6436422169ac05d5f0561f12984c86dc7af5e..7b2263f4c7fa2dffbaf5b630f4d5a83d
|
||||
// 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 db69148e0756ed36bcf3a04f1ace69cc166261a6..bcf072a6d8bc46e5c71d9ef3f248b6af69693ac9 100644
|
||||
index e4fa7685539aa22e6bf55bf768aa1f055e1dbdf3..96334220264cdf0afb2014500aeb90001b6fae72 100644
|
||||
--- a/third_party/blink/renderer/core/frame/local_frame.cc
|
||||
+++ b/third_party/blink/renderer/core/frame/local_frame.cc
|
||||
@@ -538,10 +538,6 @@ bool LocalFrame::DetachImpl(FrameDetachType type) {
|
||||
@@ -533,10 +533,6 @@ bool LocalFrame::DetachImpl(FrameDetachType type) {
|
||||
}
|
||||
DCHECK(!view_ || !view_->IsAttached());
|
||||
|
||||
@@ -63,7 +63,7 @@ index db69148e0756ed36bcf3a04f1ace69cc166261a6..bcf072a6d8bc46e5c71d9ef3f248b6af
|
||||
if (!Client())
|
||||
return false;
|
||||
|
||||
@@ -587,6 +583,11 @@ bool LocalFrame::DetachImpl(FrameDetachType type) {
|
||||
@@ -582,6 +578,11 @@ bool LocalFrame::DetachImpl(FrameDetachType type) {
|
||||
DCHECK(!view_->IsAttached());
|
||||
Client()->WillBeDetached();
|
||||
|
||||
|
||||
@@ -6,10 +6,10 @@ Subject: boringssl BUILD.gn
|
||||
Build BoringSSL with some extra functions that nodejs needs.
|
||||
|
||||
diff --git a/third_party/boringssl/BUILD.gn b/third_party/boringssl/BUILD.gn
|
||||
index f222ae94a5a10ced84e41ef84560af46a910577f..c18d26de9a63befca3c77fe5ecd93975a016797f 100644
|
||||
index 91ce539f2cdf3c17645126088ecb00e36befd1b8..8e1d78fdb56372836cea73e35cb4e03059cf5ec5 100644
|
||||
--- a/third_party/boringssl/BUILD.gn
|
||||
+++ b/third_party/boringssl/BUILD.gn
|
||||
@@ -44,6 +44,20 @@ config("no_asm_config") {
|
||||
@@ -47,6 +47,20 @@ config("no_asm_config") {
|
||||
|
||||
all_sources = crypto_sources + ssl_sources
|
||||
all_headers = crypto_headers + ssl_headers
|
||||
|
||||
@@ -10,7 +10,7 @@ breakpad independently, as a "browser" process. This patches
|
||||
crash annotation.
|
||||
|
||||
diff --git a/components/crash/core/app/breakpad_linux.cc b/components/crash/core/app/breakpad_linux.cc
|
||||
index 43f6d476f3ee2759cf41c492f932522994e7ddec..8df14f416ee321e1259433715a61fa6025207d80 100644
|
||||
index f55fd1c92770de6b8bce1fc46a047c79228d451e..5b308900ae8e9d49d711a1638e40c22d1d45af80 100644
|
||||
--- a/components/crash/core/app/breakpad_linux.cc
|
||||
+++ b/components/crash/core/app/breakpad_linux.cc
|
||||
@@ -718,8 +718,13 @@ bool CrashDone(const MinidumpDescriptor& minidump,
|
||||
@@ -29,7 +29,7 @@ index 43f6d476f3ee2759cf41c492f932522994e7ddec..8df14f416ee321e1259433715a61fa60
|
||||
info.distro = base::g_linux_distro;
|
||||
info.distro_length = my_strlen(base::g_linux_distro);
|
||||
info.upload = upload;
|
||||
@@ -2025,8 +2030,13 @@ void InitCrashReporter(const std::string& process_type) {
|
||||
@@ -2026,8 +2031,13 @@ void InitCrashReporter(const std::string& process_type) {
|
||||
process_type == kWebViewSingleProcessType ||
|
||||
process_type == kBrowserProcessType ||
|
||||
#endif
|
||||
|
||||
@@ -8,10 +8,10 @@ categories in use are known / declared. This patch is required for us
|
||||
to introduce a new Electron category for Electron-specific tracing.
|
||||
|
||||
diff --git a/base/trace_event/builtin_categories.h b/base/trace_event/builtin_categories.h
|
||||
index 107516329273ee4a6cc49433b69f307b1264362b..0c9555a04233d07a186e34ada8b7615095854950 100644
|
||||
index f6f346bbc56d4a1f8693330b010fd4b3c2d28628..981eaef314d8ff0301e8d008927d02fc8a12ae54 100644
|
||||
--- a/base/trace_event/builtin_categories.h
|
||||
+++ b/base/trace_event/builtin_categories.h
|
||||
@@ -78,6 +78,7 @@
|
||||
@@ -77,6 +77,7 @@
|
||||
X("drmcursor") \
|
||||
X("dwrite") \
|
||||
X("DXVA_Decoding") \
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: VerteDinde <vertedinde@electronjs.org>
|
||||
Date: Tue, 1 Mar 2022 12:07:25 -0800
|
||||
Date: Tue, 1 Mar 2022 16:02:22 -0800
|
||||
Subject: build: disable partition alloc on mac
|
||||
|
||||
Enabling partition alloc caused a crash when spawning
|
||||
@@ -9,15 +9,15 @@ and can be removed when the crash in fork is resolved.
|
||||
Related issue: https://github.com/electron/electron/issues/32718
|
||||
|
||||
diff --git a/base/allocator/allocator.gni b/base/allocator/allocator.gni
|
||||
index 8fa0c36007a0ae0e4553709d27a8231efb08459b..3c4f93fc98b5002572adc78cb9a21b3e78c9f3e0 100644
|
||||
index 2c35e82ec5ad94840cc894cc55bb90e7c4c00d4f..af34f85f686f61a1d4dc2ee1248af4d0b61e4cb6 100644
|
||||
--- a/base/allocator/allocator.gni
|
||||
+++ b/base/allocator/allocator.gni
|
||||
@@ -20,7 +20,7 @@ _disable_partition_alloc = is_component_build || (is_win && is_debug)
|
||||
@@ -18,7 +18,7 @@ _is_using_sanitizers = is_asan || is_hwasan || is_lsan || is_tsan || is_msan
|
||||
# - Windows: debug CRT is not compatible, see below.
|
||||
_disable_partition_alloc = is_component_build || (is_win && is_debug)
|
||||
_is_partition_alloc_platform =
|
||||
- is_android || is_win || is_mac || is_linux || is_chromeos ||
|
||||
+ is_android || is_win || is_linux || is_chromeos ||
|
||||
# TODO(crbug.com/1278780): Allow x64 once compatible with safe-stack.
|
||||
(is_fuchsia && target_cpu == "arm64")
|
||||
|
||||
# - NaCl: No plans to support it.
|
||||
# - iOS: not done yet.
|
||||
-_is_partition_alloc_platform = !is_nacl && !is_ios
|
||||
+_is_partition_alloc_platform = !is_nacl && !is_ios && !is_mac
|
||||
|
||||
# Under Windows Debug the allocator shim is not compatible with CRT.
|
||||
# NaCl in particular does seem to link some binaries statically
|
||||
|
||||
@@ -11,7 +11,7 @@ if we ever align our .pak file generation with Chrome we can remove this
|
||||
patch.
|
||||
|
||||
diff --git a/chrome/BUILD.gn b/chrome/BUILD.gn
|
||||
index f2c4feac76e96575de3627b7e8f2373b4fb30411..f5fa6b21594c97a08d1aefd790a4846d9b3e1a45 100644
|
||||
index 473af396e95a4e67242c3775866fdcd4ce1f4d41..8fa395626b972e53a4c7abaef94609e5a662eaab 100644
|
||||
--- a/chrome/BUILD.gn
|
||||
+++ b/chrome/BUILD.gn
|
||||
@@ -171,11 +171,16 @@ if (!is_android && !is_mac) {
|
||||
@@ -19,7 +19,7 @@ index f2c4feac76e96575de3627b7e8f2373b4fb30411..f5fa6b21594c97a08d1aefd790a4846d
|
||||
]
|
||||
|
||||
+ if (!is_electron_build) {
|
||||
+ deps = [
|
||||
+ deps += [
|
||||
+ ":packed_resources_integrity",
|
||||
+ ]
|
||||
+ }
|
||||
@@ -33,23 +33,23 @@ index f2c4feac76e96575de3627b7e8f2373b4fb30411..f5fa6b21594c97a08d1aefd790a4846d
|
||||
"//base",
|
||||
"//build:branding_buildflags",
|
||||
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
|
||||
index 492cd8e11e28e0b427aca227665295a3052af765..760d2171c5083820fbbf66ce5d7d3c80930b9e88 100644
|
||||
index 834601238cf5f62f7a43b5a2ccc7a743b85efbfe..d032c1b60fdff2d000f497399ea287a09afd97f0 100644
|
||||
--- a/chrome/browser/BUILD.gn
|
||||
+++ b/chrome/browser/BUILD.gn
|
||||
@@ -4501,7 +4501,7 @@ static_library("browser") {
|
||||
@@ -4522,7 +4522,7 @@ static_library("browser") {
|
||||
|
||||
# On Windows, the hashes are embedded in //chrome:chrome_initial rather
|
||||
# than here in :chrome_dll.
|
||||
- if (!is_win) {
|
||||
+ if (!is_win && !is_electron_build) {
|
||||
deps += [ "//chrome:packed_resources_integrity" ]
|
||||
sources += [ "certificate_viewer_stub.cc" ]
|
||||
}
|
||||
|
||||
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn
|
||||
index 028d269850e66db444591cda7005a0f8434193e9..cc0d14cd9798c6bbee80581c95eb8281ce7fb6ba 100644
|
||||
index 19387561ba18f2f9bf3a6ef42fc32b9adc7ac375..9c6ae050454f6e0c5032f3aea43e4123e06f3ff3 100644
|
||||
--- a/chrome/test/BUILD.gn
|
||||
+++ b/chrome/test/BUILD.gn
|
||||
@@ -5722,7 +5722,6 @@ test("unit_tests") {
|
||||
@@ -5529,7 +5529,6 @@ test("unit_tests") {
|
||||
|
||||
deps += [
|
||||
"//chrome:other_version",
|
||||
@@ -57,7 +57,7 @@ index 028d269850e66db444591cda7005a0f8434193e9..cc0d14cd9798c6bbee80581c95eb8281
|
||||
"//chrome//services/util_win:unit_tests",
|
||||
"//chrome/app:chrome_dll_resources",
|
||||
"//chrome/browser:chrome_process_finder",
|
||||
@@ -5745,6 +5744,10 @@ test("unit_tests") {
|
||||
@@ -5552,6 +5551,10 @@ test("unit_tests") {
|
||||
"//ui/resources",
|
||||
]
|
||||
|
||||
@@ -68,7 +68,7 @@ index 028d269850e66db444591cda7005a0f8434193e9..cc0d14cd9798c6bbee80581c95eb8281
|
||||
ldflags = [
|
||||
"/DELAYLOAD:api-ms-win-core-winrt-error-l1-1-0.dll",
|
||||
"/DELAYLOAD:api-ms-win-core-winrt-l1-1-0.dll",
|
||||
@@ -6438,7 +6441,6 @@ test("unit_tests") {
|
||||
@@ -6243,7 +6246,6 @@ test("unit_tests") {
|
||||
}
|
||||
|
||||
deps += [
|
||||
@@ -76,7 +76,7 @@ index 028d269850e66db444591cda7005a0f8434193e9..cc0d14cd9798c6bbee80581c95eb8281
|
||||
"//chrome/browser:cart_db_content_proto",
|
||||
"//chrome/browser:coupon_db_content_proto",
|
||||
"//chrome/browser/media/router:test_support",
|
||||
@@ -6483,6 +6485,11 @@ test("unit_tests") {
|
||||
@@ -6284,6 +6286,11 @@ test("unit_tests") {
|
||||
"//ui/native_theme:test_support",
|
||||
"//ui/webui/resources/js/browser_command:mojo_bindings",
|
||||
]
|
||||
|
||||
@@ -7,10 +7,10 @@ Build libc++ as static library to compile and pass
|
||||
nan tests
|
||||
|
||||
diff --git a/buildtools/third_party/libc++/BUILD.gn b/buildtools/third_party/libc++/BUILD.gn
|
||||
index 7915346430db72d18474d7a011b8dc7637c3f281..cd736d988f9c5e37dc24c724268fe115e00914d9 100644
|
||||
index 48f0bdb17e0a35f6e4d6fa236cd6077910ac76c6..5c95b14441c5604bc14418e4bbaf3df877652b2a 100644
|
||||
--- a/buildtools/third_party/libc++/BUILD.gn
|
||||
+++ b/buildtools/third_party/libc++/BUILD.gn
|
||||
@@ -44,7 +44,11 @@ config("winver") {
|
||||
@@ -41,7 +41,11 @@ config("winver") {
|
||||
if (libcxx_is_shared) {
|
||||
_libcxx_target_type = "shared_library"
|
||||
} else {
|
||||
@@ -23,7 +23,7 @@ index 7915346430db72d18474d7a011b8dc7637c3f281..cd736d988f9c5e37dc24c724268fe115
|
||||
}
|
||||
target(_libcxx_target_type, "libc++") {
|
||||
# Most things that need to depend on libc++ should do so via the implicit
|
||||
@@ -52,6 +56,7 @@ target(_libcxx_target_type, "libc++") {
|
||||
@@ -49,6 +53,7 @@ target(_libcxx_target_type, "libc++") {
|
||||
# need to explicitly depend on libc++.
|
||||
visibility = [
|
||||
"//build/config:common_deps",
|
||||
@@ -32,7 +32,7 @@ index 7915346430db72d18474d7a011b8dc7637c3f281..cd736d988f9c5e37dc24c724268fe115
|
||||
]
|
||||
if (is_linux && !is_chromeos) {
|
||||
diff --git a/buildtools/third_party/libc++abi/BUILD.gn b/buildtools/third_party/libc++abi/BUILD.gn
|
||||
index 40f1285f14c0843405e0ee51879b8742285a006d..5be895d3e36df53a5960006a1513f1322400fd23 100644
|
||||
index 1b0bea340d6e8aec153add6f184e382172916f8b..f5a8193e6b72f4cc039b95783be7d254b93911d8 100644
|
||||
--- a/buildtools/third_party/libc++abi/BUILD.gn
|
||||
+++ b/buildtools/third_party/libc++abi/BUILD.gn
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
@@ -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 36a8fa8d3e981707e6688379813560ba94209ab3..e36a19c847912b007a94464321bb83b15bdcdafd 100644
|
||||
index 7cb5a62e40953f7cb99ba8225551004649110d9f..6ebceb4b5c47ada6d228ef00825b10fb7326d78c 100644
|
||||
--- a/content/browser/renderer_host/render_frame_host_impl.cc
|
||||
+++ b/content/browser/renderer_host/render_frame_host_impl.cc
|
||||
@@ -6706,6 +6706,7 @@ void RenderFrameHostImpl::CreateNewWindow(
|
||||
@@ -6626,6 +6626,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 36a8fa8d3e981707e6688379813560ba94209ab3..e36a19c847912b007a94464321bb83b1
|
||||
&no_javascript_access);
|
||||
|
||||
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
|
||||
index 2b2d267bcaac7eaaf63055d2108e03835f94ea3d..b406cd71133062618258a7d56e69b5e258687e12 100644
|
||||
index 031ae3493232e571abb96533f379fa0265fa299c..495f2f355984a304e71fe0b2f2fe670bdc8bc833 100644
|
||||
--- a/content/browser/web_contents/web_contents_impl.cc
|
||||
+++ b/content/browser/web_contents/web_contents_impl.cc
|
||||
@@ -3934,6 +3934,14 @@ FrameTree* WebContentsImpl::CreateNewWindow(
|
||||
@@ -3868,6 +3868,14 @@ FrameTree* WebContentsImpl::CreateNewWindow(
|
||||
}
|
||||
auto* new_contents_impl = new_contents.get();
|
||||
|
||||
@@ -37,9 +37,9 @@ index 2b2d267bcaac7eaaf63055d2108e03835f94ea3d..b406cd71133062618258a7d56e69b5e2
|
||||
+ }
|
||||
+
|
||||
new_contents_impl->GetController().SetSessionStorageNamespace(
|
||||
partition_config, session_storage_namespace);
|
||||
partition_id, session_storage_namespace);
|
||||
|
||||
@@ -3976,12 +3984,6 @@ FrameTree* WebContentsImpl::CreateNewWindow(
|
||||
@@ -3910,12 +3918,6 @@ FrameTree* WebContentsImpl::CreateNewWindow(
|
||||
AddWebContentsDestructionObserver(new_contents_impl);
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ index 2b2d267bcaac7eaaf63055d2108e03835f94ea3d..b406cd71133062618258a7d56e69b5e2
|
||||
new_contents_impl, opener, params.target_url,
|
||||
params.referrer.To<Referrer>(), params.disposition,
|
||||
diff --git a/content/common/frame.mojom b/content/common/frame.mojom
|
||||
index ace032dc2ffac27fbdddee5a4b13c3c3e36ba5ae..80f7dd56fdaa94a9880995b2b5393af0414eef29 100644
|
||||
index afd57b6d28f8280d8b140370a36d9ca6ec17b774..da44b637ee5fdf371974f322aaf1a07ba8c018d7 100644
|
||||
--- a/content/common/frame.mojom
|
||||
+++ b/content/common/frame.mojom
|
||||
@@ -550,6 +550,10 @@ struct CreateNewWindowParams {
|
||||
@@ -68,10 +68,10 @@ index ace032dc2ffac27fbdddee5a4b13c3c3e36ba5ae..80f7dd56fdaa94a9880995b2b5393af0
|
||||
|
||||
// Operation result when the renderer asks the browser to create a new window.
|
||||
diff --git a/content/public/browser/content_browser_client.cc b/content/public/browser/content_browser_client.cc
|
||||
index a0a9f51b7e62b13f62467f14e3e9245cb6fc8d84..329cbc6f8c822c6f6deac4f341baec41228dca7b 100644
|
||||
index 491c969c55e64267aef2bd78dee96663bca567ee..7a8349a4d1f97b33ffb8391226fbc204c181640f 100644
|
||||
--- a/content/public/browser/content_browser_client.cc
|
||||
+++ b/content/public/browser/content_browser_client.cc
|
||||
@@ -577,6 +577,8 @@ bool ContentBrowserClient::CanCreateWindow(
|
||||
@@ -570,6 +570,8 @@ bool ContentBrowserClient::CanCreateWindow(
|
||||
const std::string& frame_name,
|
||||
WindowOpenDisposition disposition,
|
||||
const blink::mojom::WindowFeatures& features,
|
||||
@@ -81,7 +81,7 @@ index a0a9f51b7e62b13f62467f14e3e9245cb6fc8d84..329cbc6f8c822c6f6deac4f341baec41
|
||||
bool opener_suppressed,
|
||||
bool* no_javascript_access) {
|
||||
diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h
|
||||
index 3bbb6a39eeb719b94d0e212ea8da5051ff55d441..ceb2bb900e122840505aa8d3911923cffc9a907e 100644
|
||||
index 2591d560ddbecf5a1bd5cd458394825e6d1ba8e8..f44bb9899f2ab9e3cd72386abe78e330af714fe5 100644
|
||||
--- a/content/public/browser/content_browser_client.h
|
||||
+++ b/content/public/browser/content_browser_client.h
|
||||
@@ -169,6 +169,7 @@ class NetworkService;
|
||||
@@ -92,7 +92,7 @@ index 3bbb6a39eeb719b94d0e212ea8da5051ff55d441..ceb2bb900e122840505aa8d3911923cf
|
||||
} // namespace network
|
||||
|
||||
namespace sandbox {
|
||||
@@ -960,6 +961,8 @@ class CONTENT_EXPORT ContentBrowserClient {
|
||||
@@ -940,6 +941,8 @@ class CONTENT_EXPORT ContentBrowserClient {
|
||||
const std::string& frame_name,
|
||||
WindowOpenDisposition disposition,
|
||||
const blink::mojom::WindowFeatures& features,
|
||||
@@ -102,10 +102,10 @@ index 3bbb6a39eeb719b94d0e212ea8da5051ff55d441..ceb2bb900e122840505aa8d3911923cf
|
||||
bool opener_suppressed,
|
||||
bool* no_javascript_access);
|
||||
diff --git a/content/public/browser/web_contents_delegate.cc b/content/public/browser/web_contents_delegate.cc
|
||||
index f132199113778f6b50972419b61a187e6272300c..7bb1680553c405a9016cfd67eca5fa3c6439b692 100644
|
||||
index 2c87b891defb55771fd7686cb88971cd158c801f..a583c64b44b7add0b46ce25b4112563dd1b7e7b1 100644
|
||||
--- a/content/public/browser/web_contents_delegate.cc
|
||||
+++ b/content/public/browser/web_contents_delegate.cc
|
||||
@@ -26,6 +26,17 @@ namespace content {
|
||||
@@ -27,6 +27,17 @@ namespace content {
|
||||
|
||||
WebContentsDelegate::WebContentsDelegate() = default;
|
||||
|
||||
@@ -124,7 +124,7 @@ index f132199113778f6b50972419b61a187e6272300c..7bb1680553c405a9016cfd67eca5fa3c
|
||||
const OpenURLParams& params) {
|
||||
return nullptr;
|
||||
diff --git a/content/public/browser/web_contents_delegate.h b/content/public/browser/web_contents_delegate.h
|
||||
index f889d0bf33cf218a68bf5a9422aecaed23fa260a..3330876f623e5b2cb600b1ce1fd10b3375568613 100644
|
||||
index f04506bf8b64fef533d6cd9d2b609e5779c4382f..b0f14ef097c9178aa25bf04d19fff362fabfcf11 100644
|
||||
--- a/content/public/browser/web_contents_delegate.h
|
||||
+++ b/content/public/browser/web_contents_delegate.h
|
||||
@@ -16,6 +16,7 @@
|
||||
@@ -135,8 +135,8 @@ index f889d0bf33cf218a68bf5a9422aecaed23fa260a..3330876f623e5b2cb600b1ce1fd10b33
|
||||
#include "content/public/browser/eye_dropper.h"
|
||||
#include "content/public/browser/invalidate_type.h"
|
||||
#include "content/public/browser/media_stream_request.h"
|
||||
@@ -339,6 +340,13 @@ class CONTENT_EXPORT WebContentsDelegate {
|
||||
const StoragePartitionConfig& partition_config,
|
||||
@@ -344,6 +345,13 @@ class CONTENT_EXPORT WebContentsDelegate {
|
||||
const StoragePartitionId& partition_id,
|
||||
SessionStorageNamespace* session_storage_namespace);
|
||||
|
||||
+ virtual void WebContentsCreatedWithFullParams(
|
||||
@@ -150,10 +150,10 @@ index f889d0bf33cf218a68bf5a9422aecaed23fa260a..3330876f623e5b2cb600b1ce1fd10b33
|
||||
// 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 83517883144a77a0c775ce2d146b4e85ef79ea97..aa65517a568aa0b324b2c8cca8f60bb532ba085a 100644
|
||||
index 9eb0bc6d5460f640dc95cc170c9808b8e3f5fb16..190b517cea51bd3eae29695ba45efb22c4c82877 100644
|
||||
--- a/content/renderer/render_view_impl.cc
|
||||
+++ b/content/renderer/render_view_impl.cc
|
||||
@@ -32,6 +32,7 @@
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "third_party/blink/public/platform/impression_conversions.h"
|
||||
#include "third_party/blink/public/platform/modules/video_capture/web_video_capture_impl_manager.h"
|
||||
#include "third_party/blink/public/platform/url_conversion.h"
|
||||
@@ -161,7 +161,7 @@ index 83517883144a77a0c775ce2d146b4e85ef79ea97..aa65517a568aa0b324b2c8cca8f60bb5
|
||||
#include "third_party/blink/public/web/modules/mediastream/web_media_stream_device_observer.h"
|
||||
#include "third_party/blink/public/web/web_frame_widget.h"
|
||||
#include "third_party/blink/public/web/web_local_frame.h"
|
||||
@@ -291,6 +292,10 @@ WebView* RenderViewImpl::CreateView(
|
||||
@@ -290,6 +291,10 @@ WebView* RenderViewImpl::CreateView(
|
||||
params->impression = blink::ConvertWebImpressionToImpression(*impression);
|
||||
}
|
||||
|
||||
@@ -173,10 +173,10 @@ index 83517883144a77a0c775ce2d146b4e85ef79ea97..aa65517a568aa0b324b2c8cca8f60bb5
|
||||
/*is_opener_navigation=*/false, request.HasUserGesture(),
|
||||
// `openee_can_access_opener_origin` only matters for opener navigations,
|
||||
diff --git a/content/web_test/browser/web_test_content_browser_client.cc b/content/web_test/browser/web_test_content_browser_client.cc
|
||||
index 54b62065d148ab860a49dc03daaf7680ff00d778..3008d3efe89585a562ae55734938b10ef8b0074e 100644
|
||||
index 99d4577526d64e4a73591be4b5bb4d67826abb1a..213db9dc65d10d70b6e02ee3b9b95d38bd951ba3 100644
|
||||
--- a/content/web_test/browser/web_test_content_browser_client.cc
|
||||
+++ b/content/web_test/browser/web_test_content_browser_client.cc
|
||||
@@ -440,6 +440,8 @@ bool WebTestContentBrowserClient::CanCreateWindow(
|
||||
@@ -439,6 +439,8 @@ bool WebTestContentBrowserClient::CanCreateWindow(
|
||||
const std::string& frame_name,
|
||||
WindowOpenDisposition disposition,
|
||||
const blink::mojom::WindowFeatures& features,
|
||||
@@ -186,7 +186,7 @@ index 54b62065d148ab860a49dc03daaf7680ff00d778..3008d3efe89585a562ae55734938b10e
|
||||
bool opener_suppressed,
|
||||
bool* no_javascript_access) {
|
||||
diff --git a/content/web_test/browser/web_test_content_browser_client.h b/content/web_test/browser/web_test_content_browser_client.h
|
||||
index d4eb4d482b2641585d501131c64b90cc9dbcfd18..132a5d86279b9a2cb4364b9c6d3e89e12d55052e 100644
|
||||
index 76254db8ed262aa105eb9782c533fe6b25324828..3e757eb86ab685901dedde45f21b818438ec4827 100644
|
||||
--- a/content/web_test/browser/web_test_content_browser_client.h
|
||||
+++ b/content/web_test/browser/web_test_content_browser_client.h
|
||||
@@ -80,6 +80,8 @@ class WebTestContentBrowserClient : public ShellContentBrowserClient {
|
||||
@@ -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 030cc373443766b6485a888f5627885f535e06fc..7bc60b17a0f1aeb208f6d7d85cd6fa537c44c54a 100644
|
||||
index 324322b9c1096cfd201ac33b279dcbd5a1d56e5d..e1ad20b728028c0ec9de4290afdef17e61df2c85 100644
|
||||
--- a/third_party/blink/renderer/core/frame/local_dom_window.cc
|
||||
+++ b/third_party/blink/renderer/core/frame/local_dom_window.cc
|
||||
@@ -2050,6 +2050,7 @@ DOMWindow* LocalDOMWindow::open(v8::Isolate* isolate,
|
||||
@@ -2070,6 +2070,7 @@ DOMWindow* LocalDOMWindow::open(v8::Isolate* isolate,
|
||||
|
||||
WebWindowFeatures window_features =
|
||||
GetWindowFeaturesFromString(features, incumbent_window);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Xiaocheng Hu <xiaochengh@chromium.org>
|
||||
Date: Mon, 18 Apr 2022 01:14:45 +0000
|
||||
Date: Mon, 25 Apr 2022 20:57:43 +0000
|
||||
Subject: Sanitize DragData markup before inserting it into document
|
||||
|
||||
(cherry picked from commit 5164a0fe3391283663e1196cf4576ec233985e89)
|
||||
@@ -10,13 +10,14 @@ Change-Id: I8a0ddfb983d12c185f7e943d3d5277788199b011
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3579670
|
||||
Quick-Run: Xiaocheng Hu <xiaochengh@chromium.org>
|
||||
Auto-Submit: Xiaocheng Hu <xiaochengh@chromium.org>
|
||||
Reviewed-by: Kent Tamura <tkent@chromium.org>
|
||||
Commit-Queue: Kent Tamura <tkent@chromium.org>
|
||||
Cr-Original-Commit-Position: refs/heads/main@{#991324}
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3588887
|
||||
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
|
||||
Cr-Commit-Position: refs/branch-heads/4951@{#831}
|
||||
Cr-Branched-From: 27de6227ca357da0d57ae2c7b18da170c4651438-refs/heads/main@{#982481}
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3589799
|
||||
Reviewed-by: Achuith Bhandarkar <achuith@chromium.org>
|
||||
Owners-Override: Achuith Bhandarkar <achuith@chromium.org>
|
||||
Commit-Queue: Roger Felipe Zanoni da Silva <rzanoni@google.com>
|
||||
Cr-Commit-Position: refs/branch-heads/4664@{#1602}
|
||||
Cr-Branched-From: 24dc4ee75e01a29d390d43c9c264372a169273a7-refs/heads/main@{#929512}
|
||||
|
||||
diff --git a/third_party/blink/renderer/core/page/drag_data.cc b/third_party/blink/renderer/core/page/drag_data.cc
|
||||
index 2ce56b1fefe016ac34a1a3011a595fab342abfa5..4fb86bc645386ee806544ee3647b0a333cd8afc4 100644
|
||||
118
patches/chromium/cherry-pick-1665a1d16d46.patch
Normal file
118
patches/chromium/cherry-pick-1665a1d16d46.patch
Normal file
@@ -0,0 +1,118 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: "msw@chromium.org" <msw@chromium.org>
|
||||
Date: Tue, 1 Feb 2022 21:16:10 +0000
|
||||
Subject: Reland "Make web cursor size limits match on browser and renderer"
|
||||
|
||||
This reverts commit 38a8343085e53889eba48fcff78a6c2295927333.
|
||||
|
||||
Reason for revert: Fix without regressing https://crbug.com/1292426
|
||||
(Increased WebCursor limit 128->150px to support DevToolsEyeDropper)
|
||||
|
||||
Original change's description:
|
||||
> Revert "Make web cursor size limits match on browser and renderer"
|
||||
>
|
||||
> This reverts commit 868b44dd8b4a1a3b9698f561ca17f75e4ec78dd2.
|
||||
>
|
||||
> Reason for revert: https://crbug.com/1292426
|
||||
>
|
||||
> Original change's description:
|
||||
> > Make web cursor size limits match on browser and renderer
|
||||
> >
|
||||
> > Use NSCursor arrowCursor on Mac for ui::mojom::CursorType::kNull.
|
||||
> > (i.e. when WebCursor is constructed with an overly large custom cursor)
|
||||
> >
|
||||
> > Bug: 1246188
|
||||
> > Test: Automated unit tests and WPTs
|
||||
> > Change-Id: I89627fa13cba96b755b8f80adbc91cfc865b6b1b
|
||||
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3413912
|
||||
> > Reviewed-by: Henrique Ferreiro <hferreiro@igalia.com>
|
||||
> > Reviewed-by: Charlie Harrison <csharrison@chromium.org>
|
||||
> > Commit-Queue: Mike Wasserman <msw@chromium.org>
|
||||
> > Auto-Submit: Mike Wasserman <msw@chromium.org>
|
||||
> > Cr-Commit-Position: refs/heads/main@{#964378}
|
||||
>
|
||||
> Bug: 1246188
|
||||
> Change-Id: Id7b3b88e65c012993537ce96c2b5064b7b76646e
|
||||
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3428347
|
||||
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
|
||||
> Commit-Queue: Mike Wasserman <msw@chromium.org>
|
||||
> Cr-Commit-Position: refs/heads/main@{#965475}
|
||||
|
||||
Fixed: 1246188
|
||||
Bug: 1292426
|
||||
Change-Id: I5a490603c3e21e17f3136a3d792a18429eb3f633
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3428624
|
||||
Auto-Submit: Mike Wasserman <msw@chromium.org>
|
||||
Reviewed-by: Charlie Harrison <csharrison@chromium.org>
|
||||
Commit-Queue: Mike Wasserman <msw@chromium.org>
|
||||
Reviewed-by: Henrique Ferreiro <hferreiro@igalia.com>
|
||||
Cr-Commit-Position: refs/heads/main@{#965857}
|
||||
|
||||
diff --git a/content/common/cursors/webcursor.cc b/content/common/cursors/webcursor.cc
|
||||
index c8b6b9d3f75d0cac98cc4ab8e71b68117837c1dc..4c80616e41e6ba5b171ae09d06d7f4110589f70a 100644
|
||||
--- a/content/common/cursors/webcursor.cc
|
||||
+++ b/content/common/cursors/webcursor.cc
|
||||
@@ -22,16 +22,19 @@ WebCursor::WebCursor(const ui::Cursor& cursor) {
|
||||
WebCursor::WebCursor(const WebCursor& other) = default;
|
||||
|
||||
bool WebCursor::SetCursor(const ui::Cursor& cursor) {
|
||||
- static constexpr int kMaxSize = 1024;
|
||||
+ // This value is just large enough to accommodate:
|
||||
+ // - kMaximumCursorSize in Blink's EventHandler
|
||||
+ // - kCursorSize in Chrome's DevToolsEyeDropper
|
||||
+ static constexpr int kMaximumCursorSize = 150;
|
||||
if (cursor.image_scale_factor() < 0.01f ||
|
||||
cursor.image_scale_factor() > 100.f ||
|
||||
(cursor.type() == ui::mojom::CursorType::kCustom &&
|
||||
- (cursor.custom_bitmap().width() > kMaxSize ||
|
||||
- cursor.custom_bitmap().height() > kMaxSize ||
|
||||
+ (cursor.custom_bitmap().width() > kMaximumCursorSize ||
|
||||
+ cursor.custom_bitmap().height() > kMaximumCursorSize ||
|
||||
cursor.custom_bitmap().width() / cursor.image_scale_factor() >
|
||||
- kMaxSize ||
|
||||
+ kMaximumCursorSize ||
|
||||
cursor.custom_bitmap().height() / cursor.image_scale_factor() >
|
||||
- kMaxSize))) {
|
||||
+ kMaximumCursorSize))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
diff --git a/content/common/cursors/webcursor_mac.mm b/content/common/cursors/webcursor_mac.mm
|
||||
index f85c421f8581abe191738eaee133004b729a817d..fdc70bdff2ddc517f3e341dd16263ae89d8b153f 100644
|
||||
--- a/content/common/cursors/webcursor_mac.mm
|
||||
+++ b/content/common/cursors/webcursor_mac.mm
|
||||
@@ -265,6 +265,7 @@ - (CrCoreCursorType)_coreCursorType {
|
||||
case ui::mojom::CursorType::kCustom:
|
||||
return CreateCustomCursor(cursor_);
|
||||
case ui::mojom::CursorType::kNull:
|
||||
+ return [NSCursor arrowCursor];
|
||||
case ui::mojom::CursorType::kDndNone:
|
||||
case ui::mojom::CursorType::kDndMove:
|
||||
case ui::mojom::CursorType::kDndCopy:
|
||||
diff --git a/content/common/cursors/webcursor_unittest.cc b/content/common/cursors/webcursor_unittest.cc
|
||||
index 8f53ffa052f1f60d4eedccca5a4bc32941966963..9b2d8dec85e73b73108f40bca90237b4465e5043 100644
|
||||
--- a/content/common/cursors/webcursor_unittest.cc
|
||||
+++ b/content/common/cursors/webcursor_unittest.cc
|
||||
@@ -122,11 +122,11 @@ TEST(WebCursorTest, SetCursor) {
|
||||
|
||||
// SetCursor should return false when the image width is too large.
|
||||
cursor.set_image_scale_factor(1.f);
|
||||
- cursor.set_custom_bitmap(CreateTestBitmap(1025, 3));
|
||||
+ cursor.set_custom_bitmap(CreateTestBitmap(151, 3));
|
||||
EXPECT_FALSE(webcursor.SetCursor(cursor));
|
||||
|
||||
// SetCursor should return false when the image height is too large.
|
||||
- cursor.set_custom_bitmap(CreateTestBitmap(3, 1025));
|
||||
+ cursor.set_custom_bitmap(CreateTestBitmap(3, 151));
|
||||
EXPECT_FALSE(webcursor.SetCursor(cursor));
|
||||
|
||||
// SetCursor should return false when the scaled image width is too large.
|
||||
@@ -136,7 +136,7 @@ TEST(WebCursorTest, SetCursor) {
|
||||
|
||||
// SetCursor should return false when the scaled image height is too large.
|
||||
cursor.set_image_scale_factor(0.1f);
|
||||
- cursor.set_custom_bitmap(CreateTestBitmap(5, 200));
|
||||
+ cursor.set_custom_bitmap(CreateTestBitmap(5, 20));
|
||||
EXPECT_FALSE(webcursor.SetCursor(cursor));
|
||||
}
|
||||
|
||||
62
patches/chromium/cherry-pick-1a31e2110440.patch
Normal file
62
patches/chromium/cherry-pick-1a31e2110440.patch
Normal file
@@ -0,0 +1,62 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Anders Hartvoll Ruud <andruud@chromium.org>
|
||||
Date: Tue, 5 Apr 2022 20:44:33 +0000
|
||||
Subject: Disallow CSS-wide keywords for StylePropertyMap.set
|
||||
|
||||
We don't support this properly, and the spec does not handle CSS-keywords
|
||||
either. Disallow it until we can add proper support for this.
|
||||
|
||||
(cherry picked from commit 02e4b18febb37de8baea718bc2f62cfb5fe56e23)
|
||||
|
||||
Fixed: 1292905
|
||||
Bug: 1310761
|
||||
Change-Id: Ieb3d20edfea72c2ccb0928536fdfd86d10aad1a9
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3551609
|
||||
Reviewed-by: Rune Lillesveen <futhark@chromium.org>
|
||||
Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org>
|
||||
Cr-Original-Commit-Position: refs/heads/main@{#986411}
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3572186
|
||||
Commit-Queue: Srinivas Sista <srinivassista@chromium.org>
|
||||
Auto-Submit: Srinivas Sista <srinivassista@chromium.org>
|
||||
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
|
||||
Cr-Commit-Position: refs/branch-heads/4896@{#1041}
|
||||
Cr-Branched-From: 1f63ff4bc27570761b35ffbc7f938f6586f7bee8-refs/heads/main@{#972766}
|
||||
|
||||
diff --git a/third_party/blink/renderer/build/scripts/core/css/templates/cssom_keywords.cc.tmpl b/third_party/blink/renderer/build/scripts/core/css/templates/cssom_keywords.cc.tmpl
|
||||
index 925272d4967a33043cc3a53bd7de448ab03ca805..75597baf3aae8e9a1981153353202fb3e35b7850 100644
|
||||
--- a/third_party/blink/renderer/build/scripts/core/css/templates/cssom_keywords.cc.tmpl
|
||||
+++ b/third_party/blink/renderer/build/scripts/core/css/templates/cssom_keywords.cc.tmpl
|
||||
@@ -20,8 +20,10 @@ bool CSSOMKeywords::ValidKeywordForProperty(CSSPropertyID id,
|
||||
return false;
|
||||
}
|
||||
|
||||
- if (css_parsing_utils::IsCSSWideKeyword(valueID))
|
||||
- return true;
|
||||
+ if (css_parsing_utils::IsCSSWideKeyword(valueID)) {
|
||||
+ // TODO(crbug.com/1310761): Support CSS-wide keywords in custom props.
|
||||
+ return id != CSSPropertyID::kVariable;
|
||||
+ }
|
||||
|
||||
switch (id) {
|
||||
{% for property in properties if property.keywordIDs and 'Keyword' in property.typedom_types %}
|
||||
diff --git a/third_party/blink/web_tests/external/wpt/css/css-typed-om/set-css-wide-in-custom-property-crash.html b/third_party/blink/web_tests/external/wpt/css/css-typed-om/set-css-wide-in-custom-property-crash.html
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..bc977c9889889bd8a35eccc48ac28e25871b1ec9
|
||||
--- /dev/null
|
||||
+++ b/third_party/blink/web_tests/external/wpt/css/css-typed-om/set-css-wide-in-custom-property-crash.html
|
||||
@@ -0,0 +1,15 @@
|
||||
+<!DOCTYPE html>
|
||||
+<title>Don't crash when setting a CSS-wide keyword on a custom property</title>
|
||||
+<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-set">
|
||||
+<link rel="help" href="https://crbug.com/1310761<">
|
||||
+<div id="target">
|
||||
+ Don't crash
|
||||
+</div>
|
||||
+<script>
|
||||
+ for (let keyword of ['initial', 'inherit', 'unset', 'revert', 'revert-layer']) {
|
||||
+ try {
|
||||
+ target.attributeStyleMap.set('--x', new CSSKeywordValue(keyword));
|
||||
+ } catch (e) {
|
||||
+ }
|
||||
+ }
|
||||
+</script>
|
||||
114
patches/chromium/cherry-pick-21139756239b.patch
Normal file
114
patches/chromium/cherry-pick-21139756239b.patch
Normal file
@@ -0,0 +1,114 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Ari Chivukula <arichiv@chromium.org>
|
||||
Date: Tue, 17 May 2022 18:17:07 +0000
|
||||
Subject: {M102 PICK} [IndexedDB] Use-After-Free Fix
|
||||
|
||||
We can't guarantee order in the task the constructor dispatches the same
|
||||
way we could before due to all the async changes. Let's be sure all the
|
||||
objects exist before using them now. Long term, we need to address
|
||||
ownership of the idb context.
|
||||
|
||||
Bug: 1324864, 1218100
|
||||
Change-Id: Id5753297a4c966432028a1e7e063c5f1bed6f619
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3646994
|
||||
Reviewed-by: Ayu Ishii <ayui@chromium.org>
|
||||
Commit-Queue: Srinivas Sista <srinivassista@chromium.org>
|
||||
Cr-Commit-Position: refs/branch-heads/5005@{#812}
|
||||
Cr-Branched-From: 5b4d9450fee01f821b6400e947b3839727643a71-refs/heads/main@{#992738}
|
||||
|
||||
diff --git a/content/browser/indexed_db/indexed_db_context_impl.cc b/content/browser/indexed_db/indexed_db_context_impl.cc
|
||||
index 6a7d303385aaf9bd8e0581c580ab328096ef5950..3afb1edf4cdc0baef105b680ec82007c66b40940 100644
|
||||
--- a/content/browser/indexed_db/indexed_db_context_impl.cc
|
||||
+++ b/content/browser/indexed_db/indexed_db_context_impl.cc
|
||||
@@ -167,38 +167,32 @@ IndexedDBContextImpl::IndexedDBContextImpl(
|
||||
std::move(quota_client_remote),
|
||||
storage::QuotaClientType::kIndexedDatabase,
|
||||
{blink::mojom::StorageType::kTemporary});
|
||||
+ IDBTaskRunner()->PostTask(
|
||||
+ FROM_HERE, base::BindOnce(&IndexedDBContextImpl::BindPipesOnIDBSequence,
|
||||
+ weak_factory_.GetWeakPtr(),
|
||||
+ std::move(quota_client_receiver),
|
||||
+ std::move(blob_storage_context),
|
||||
+ std::move(file_system_access_context)));
|
||||
+}
|
||||
|
||||
- // This is safe because the IndexedDBContextImpl must be destructed on the
|
||||
- // IDBTaskRunner, and this task will always happen before that.
|
||||
- idb_task_runner_->PostTask(
|
||||
- FROM_HERE,
|
||||
- base::BindOnce(
|
||||
- [](mojo::Remote<storage::mojom::BlobStorageContext>*
|
||||
- blob_storage_context,
|
||||
- mojo::Remote<storage::mojom::FileSystemAccessContext>*
|
||||
- file_system_access_context,
|
||||
- mojo::Receiver<storage::mojom::QuotaClient>* quota_client_receiver,
|
||||
- mojo::PendingRemote<storage::mojom::BlobStorageContext>
|
||||
- pending_blob_storage_context,
|
||||
- mojo::PendingRemote<storage::mojom::FileSystemAccessContext>
|
||||
- pending_file_system_access_context,
|
||||
- mojo::PendingReceiver<storage::mojom::QuotaClient>
|
||||
- quota_client_pending_receiver) {
|
||||
- quota_client_receiver->Bind(
|
||||
- std::move(quota_client_pending_receiver));
|
||||
- if (pending_blob_storage_context) {
|
||||
- blob_storage_context->Bind(
|
||||
- std::move(pending_blob_storage_context));
|
||||
- }
|
||||
- if (pending_file_system_access_context) {
|
||||
- file_system_access_context->Bind(
|
||||
- std::move(pending_file_system_access_context));
|
||||
- }
|
||||
- },
|
||||
- &blob_storage_context_, &file_system_access_context_,
|
||||
- "a_client_receiver_, std::move(blob_storage_context),
|
||||
- std::move(file_system_access_context),
|
||||
- std::move(quota_client_receiver)));
|
||||
+void IndexedDBContextImpl::BindPipesOnIDBSequence(
|
||||
+ mojo::PendingReceiver<storage::mojom::QuotaClient>
|
||||
+ pending_quota_client_receiver,
|
||||
+ mojo::PendingRemote<storage::mojom::BlobStorageContext>
|
||||
+ pending_blob_storage_context,
|
||||
+ mojo::PendingRemote<storage::mojom::FileSystemAccessContext>
|
||||
+ pending_file_system_access_context) {
|
||||
+ DCHECK(IDBTaskRunner()->RunsTasksInCurrentSequence());
|
||||
+ if (pending_quota_client_receiver) {
|
||||
+ quota_client_receiver_.Bind(std::move(pending_quota_client_receiver));
|
||||
+ }
|
||||
+ if (pending_blob_storage_context) {
|
||||
+ blob_storage_context_.Bind(std::move(pending_blob_storage_context));
|
||||
+ }
|
||||
+ if (pending_file_system_access_context) {
|
||||
+ file_system_access_context_.Bind(
|
||||
+ std::move(pending_file_system_access_context));
|
||||
+ }
|
||||
}
|
||||
|
||||
void IndexedDBContextImpl::Bind(
|
||||
diff --git a/content/browser/indexed_db/indexed_db_context_impl.h b/content/browser/indexed_db/indexed_db_context_impl.h
|
||||
index 4b874b244778d831e0fa8ca3bbfd7e751897923e..ad2f984e130ece867c0f0dc7ca9ae52b8ec12ae9 100644
|
||||
--- a/content/browser/indexed_db/indexed_db_context_impl.h
|
||||
+++ b/content/browser/indexed_db/indexed_db_context_impl.h
|
||||
@@ -224,6 +224,14 @@ class CONTENT_EXPORT IndexedDBContextImpl
|
||||
|
||||
~IndexedDBContextImpl() override;
|
||||
|
||||
+ void BindPipesOnIDBSequence(
|
||||
+ mojo::PendingReceiver<storage::mojom::QuotaClient>
|
||||
+ pending_quota_client_receiver,
|
||||
+ mojo::PendingRemote<storage::mojom::BlobStorageContext>
|
||||
+ pending_blob_storage_context,
|
||||
+ mojo::PendingRemote<storage::mojom::FileSystemAccessContext>
|
||||
+ pending_file_system_access_context);
|
||||
+
|
||||
// Binds receiver on bucket retrieval to ensure that a bucket always exists
|
||||
// for a storage key.
|
||||
void BindIndexedDBWithBucket(
|
||||
@@ -282,6 +290,8 @@ class CONTENT_EXPORT IndexedDBContextImpl
|
||||
mojo::Receiver<storage::mojom::QuotaClient> quota_client_receiver_;
|
||||
const std::unique_ptr<storage::FilesystemProxy> filesystem_proxy_;
|
||||
|
||||
+ // weak_factory_->GetWeakPtr() may be used on any thread, but the resulting
|
||||
+ // pointer must only be checked/used on idb_task_runner_.
|
||||
base::WeakPtrFactory<IndexedDBContextImpl> weak_factory_{this};
|
||||
};
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user