sha
stringlengths 40
40
| author
stringclasses 155
values | date
stringlengths 19
19
| commit_message
stringlengths 24
9.22k
| git_diff
stringlengths 110
332k
⌀ | type
stringclasses 9
values |
|---|---|---|---|---|---|
aaae2abf20dfd3d5c6c550f4e131bbbc7dc3a46c
|
github-actions[bot]
|
2023-08-02 10:23:21
|
build: update appveyor image to latest version e-117.0.5911.0. (#39318)
build: update appveyor image to latest version
Co-authored-by: jkleinsc <[email protected]>
|
diff --git a/appveyor-woa.yml b/appveyor-woa.yml
index bf8ffa907e..6478bc1656 100644
--- a/appveyor-woa.yml
+++ b/appveyor-woa.yml
@@ -29,7 +29,7 @@
version: 1.0.{build}
build_cloud: electronhq-16-core
-image: e-117.0.5897.0
+image: e-117.0.5911.0
environment:
GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache
ELECTRON_OUT_DIR: Default
@@ -205,32 +205,7 @@ for:
on_finish:
# Uncomment this lines to enable RDP
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
- - ps: |
- cd C:\projects\src
- $missing_artifacts = $false
- if ($env:SHOULD_SKIP_ARTIFACT_VALIDATION -eq 'true') {
- Write-warning "Skipping artifact validation for doc-only PR"
- } else {
- $artifacts_to_upload = @('dist.zip','windows_toolchain_profile.json','shell_browser_ui_unittests.exe','chromedriver.zip','ffmpeg.zip','node_headers.zip','mksnapshot.zip','electron.lib','hunspell_dictionaries.zip')
- foreach($artifact_name in $artifacts_to_upload) {
- if ($artifact_name -eq 'ffmpeg.zip') {
- $artifact_file = "out\ffmpeg\ffmpeg.zip"
- } elseif ($artifact_name -eq 'node_headers.zip') {
- $artifact_file = $artifact_name
- } else {
- $artifact_file = "out\Default\$artifact_name"
- }
- if (Test-Path $artifact_file) {
- appveyor-retry appveyor PushArtifact $artifact_file
- } else {
- Write-warning "$artifact_name is missing and cannot be added to artifacts"
- $missing_artifacts = $true
- }
- }
- if ($missing_artifacts) {
- throw "Build failed due to missing artifacts"
- }
- }
+ - ps: "cd C:\\projects\\src\n$missing_artifacts = $false\nif ($env:SHOULD_SKIP_ARTIFACT_VALIDATION -eq 'true') {\n Write-warning \"Skipping artifact validation for doc-only PR\"\n} else {\n $artifacts_to_upload = @('dist.zip','windows_toolchain_profile.json','shell_browser_ui_unittests.exe','chromedriver.zip','ffmpeg.zip','node_headers.zip','mksnapshot.zip','electron.lib','hunspell_dictionaries.zip')\n foreach($artifact_name in $artifacts_to_upload) {\n if ($artifact_name -eq 'ffmpeg.zip') {\n $artifact_file = \"out\\ffmpeg\\ffmpeg.zip\"\n } elseif ($artifact_name -eq 'node_headers.zip') {\n $artifact_file = $artifact_name\n } else {\n $artifact_file = \"out\\Default\\$artifact_name\"\n }\n if (Test-Path $artifact_file) {\n appveyor-retry appveyor PushArtifact $artifact_file \n } else {\n Write-warning \"$artifact_name is missing and cannot be added to artifacts\"\n $missing_artifacts = $true\n }\n }\n if ($missing_artifacts) {\n throw \"Build failed due to missing artifacts\"\n }\n}\n"
- ps: >-
if ((Test-Path "pdb.zip") -And ($env:GN_CONFIG -ne 'release')) {
appveyor-retry appveyor PushArtifact pdb.zip
diff --git a/appveyor.yml b/appveyor.yml
index 85ac52b756..4ced279751 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -29,7 +29,7 @@
version: 1.0.{build}
build_cloud: electronhq-16-core
-image: e-117.0.5897.0
+image: e-117.0.5911.0
environment:
GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache
ELECTRON_OUT_DIR: Default
@@ -203,33 +203,7 @@ for:
on_finish:
# Uncomment this lines to enable RDP
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
- - ps: |
- cd C:\projects\src
- $missing_artifacts = $false
-
- if ($env:SHOULD_SKIP_ARTIFACT_VALIDATION -eq 'true') {
- Write-warning "Skipping artifact validation for doc-only PR"
- } else {
- $artifacts_to_upload = @('dist.zip','windows_toolchain_profile.json','shell_browser_ui_unittests.exe','chromedriver.zip','ffmpeg.zip','node_headers.zip','mksnapshot.zip','electron.lib','hunspell_dictionaries.zip')
- foreach($artifact_name in $artifacts_to_upload) {
- if ($artifact_name -eq 'ffmpeg.zip') {
- $artifact_file = "out\ffmpeg\ffmpeg.zip"
- } elseif ($artifact_name -eq 'node_headers.zip') {
- $artifact_file = $artifact_name
- } else {
- $artifact_file = "out\Default\$artifact_name"
- }
- if (Test-Path $artifact_file) {
- appveyor-retry appveyor PushArtifact $artifact_file
- } else {
- Write-warning "$artifact_name is missing and cannot be added to artifacts"
- $missing_artifacts = $true
- }
- }
- if ($missing_artifacts) {
- throw "Build failed due to missing artifacts"
- }
- }
+ - ps: "cd C:\\projects\\src\n$missing_artifacts = $false\n\nif ($env:SHOULD_SKIP_ARTIFACT_VALIDATION -eq 'true') {\n Write-warning \"Skipping artifact validation for doc-only PR\"\n} else {\n $artifacts_to_upload = @('dist.zip','windows_toolchain_profile.json','shell_browser_ui_unittests.exe','chromedriver.zip','ffmpeg.zip','node_headers.zip','mksnapshot.zip','electron.lib','hunspell_dictionaries.zip')\n foreach($artifact_name in $artifacts_to_upload) {\n if ($artifact_name -eq 'ffmpeg.zip') {\n $artifact_file = \"out\\ffmpeg\\ffmpeg.zip\"\n } elseif ($artifact_name -eq 'node_headers.zip') {\n $artifact_file = $artifact_name\n } else {\n $artifact_file = \"out\\Default\\$artifact_name\"\n }\n if (Test-Path $artifact_file) {\n appveyor-retry appveyor PushArtifact $artifact_file \n } else {\n Write-warning \"$artifact_name is missing and cannot be added to artifacts\"\n $missing_artifacts = $true\n }\n }\n if ($missing_artifacts) {\n throw \"Build failed due to missing artifacts\"\n }\n}\n"
- ps: >-
if ((Test-Path "pdb.zip") -And ($env:GN_CONFIG -ne 'release')) {
appveyor-retry appveyor PushArtifact pdb.zip
|
build
|
69df09dc90e990a6282992b1d25ac694a0187dc8
|
Orko Garai
|
2024-09-05 14:07:10
|
fix: Launch apps with XDG_ACTIVATION_TOKEN in ozone/wayland (#43480)
* fix: Launch apps with XDG_ACTIVATION_TOKEN in ozone/wayland
Ensure apps are launched with the activation token received from
xdg_activation_v1 protocol.
* add focus_launched_process option
|
diff --git a/shell/common/platform_util_linux.cc b/shell/common/platform_util_linux.cc
index bfa76da244..820135237e 100644
--- a/shell/common/platform_util_linux.cc
+++ b/shell/common/platform_util_linux.cc
@@ -23,6 +23,7 @@
#include "base/posix/eintr_wrapper.h"
#include "base/process/kill.h"
#include "base/process/launch.h"
+#include "base/run_loop.h"
#include "base/strings/escape.h"
#include "base/strings/string_util.h"
#include "base/threading/thread_restrictions.h"
@@ -270,8 +271,21 @@ std::string GetErrorDescription(int error_code) {
bool XDGUtil(const std::vector<std::string>& argv,
const base::FilePath& working_directory,
const bool wait_for_exit,
+ const bool focus_launched_process,
platform_util::OpenCallback callback) {
base::LaunchOptions options;
+ if (focus_launched_process) {
+ base::RunLoop run_loop(base::RunLoop::Type::kNestableTasksAllowed);
+ base::RepeatingClosure quit_loop = run_loop.QuitClosure();
+ base::nix::CreateLaunchOptionsWithXdgActivation(base::BindOnce(
+ [](base::RepeatingClosure quit_loop, base::LaunchOptions* options_out,
+ base::LaunchOptions options) {
+ *options_out = std::move(options);
+ std::move(quit_loop).Run();
+ },
+ std::move(quit_loop), &options));
+ run_loop.Run();
+ }
options.current_directory = working_directory;
options.allow_new_privs = true;
// xdg-open can fall back on mailcap which eventually might plumb through
@@ -303,11 +317,12 @@ bool XDGOpen(const base::FilePath& working_directory,
const bool wait_for_exit,
platform_util::OpenCallback callback) {
return XDGUtil({"xdg-open", path}, working_directory, wait_for_exit,
- std::move(callback));
+ /*focus_launched_process=*/true, std::move(callback));
}
bool XDGEmail(const std::string& email, const bool wait_for_exit) {
return XDGUtil({"xdg-email", email}, base::FilePath(), wait_for_exit,
+ /*focus_launched_process=*/true,
platform_util::OpenCallback());
}
@@ -376,7 +391,8 @@ bool MoveItemToTrash(const base::FilePath& full_path, bool delete_on_fail) {
argv = {"gio", "trash", filename};
}
- return XDGUtil(argv, base::FilePath(), true, platform_util::OpenCallback());
+ return XDGUtil(argv, base::FilePath(), true, /*focus_launched_process=*/false,
+ platform_util::OpenCallback());
}
namespace internal {
|
fix
|
39b24aed923a98559181ae6e0a64cda7c2cd91e7
|
Shelley Vohr
|
2024-10-29 13:22:26
|
refactor: move node ofs script to electron (#44425)
* refactor: move node ofs script to electron
* chore: remove empty file
|
diff --git a/BUILD.gn b/BUILD.gn
index e3dfade4da..a4a552b784 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -1534,7 +1534,7 @@ copy("node_gypi_headers") {
action("node_version_header") {
inputs = [ "$node_dir/src/node_version.h" ]
outputs = [ "$node_headers_dir/include/node/node_version.h" ]
- script = "script/generate_node_version_header.py"
+ script = "script/node/generate_node_version_header.py"
args = rebase_path(inputs) + rebase_path(outputs)
if (node_module_version != "") {
args += [ "$node_module_version" ]
diff --git a/patches/node/build_add_gn_build_files.patch b/patches/node/build_add_gn_build_files.patch
index 6197fab911..1cb0332f0c 100644
--- a/patches/node/build_add_gn_build_files.patch
+++ b/patches/node/build_add_gn_build_files.patch
@@ -11,7 +11,7 @@ really in 20/21. We have to wait until 22 is released to be able to
build with upstream GN files.
diff --git a/BUILD.gn b/BUILD.gn
-index 1ed186b597eece7c34cb69c8e1e20870555a040d..2ce1e8a7dcca2ba153d387d11970c72b5f43c167 100644
+index 1ed186b597eece7c34cb69c8e1e20870555a040d..e36168f0a051ca2fa2fc024aadcf5375b860105e 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -1,14 +1,406 @@
@@ -113,7 +113,7 @@ index 1ed186b597eece7c34cb69c8e1e20870555a040d..2ce1e8a7dcca2ba153d387d11970c72b
+}
+
+action("node_js2c_original_fs") {
-+ script = "tools/generate_original_fs.py"
++ script = "//electron/script/node/generate_original_fs.py"
+ inputs = fs_files
+ outputs = []
+ foreach(file, fs_files + original_fs_files) {
@@ -2384,30 +2384,6 @@ index 0000000000000000000000000000000000000000..37c16859003e61636fe2f1a4040b1e90
+ f.write(FILENAMES_JSON_HEADER)
+ f.write(json.dumps(out, sort_keys=True, indent=2, separators=(',', ': ')))
+ f.write('\n')
-diff --git a/tools/generate_original_fs.py b/tools/generate_original_fs.py
-new file mode 100644
-index 0000000000000000000000000000000000000000..5259e6a7a1fd6b21df69dc461dee67d95800c2c8
---- /dev/null
-+++ b/tools/generate_original_fs.py
-@@ -0,0 +1,18 @@
-+import os
-+import sys
-+
-+node_root_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
-+out_dir = sys.argv[1]
-+fs_files = sys.argv[2:]
-+
-+for fs_file in fs_files:
-+ with open(os.path.join(node_root_dir, fs_file), 'r') as f:
-+ contents = f.read()
-+ original_fs_file = fs_file.replace('internal/fs/', 'internal/original-fs/').replace('lib/fs.js', 'lib/original-fs.js').replace('lib/fs/', 'lib/original-fs/')
-+
-+ with open(os.path.join(out_dir, fs_file), 'w') as original_f:
-+ original_f.write(contents)
-+
-+ with open(os.path.join(out_dir, original_fs_file), 'w') as transformed_f:
-+ transformed_contents = contents.replace('internal/fs/', 'internal/original-fs/').replace('require(\'fs', 'require(\'original-fs')
-+ transformed_f.write(transformed_contents)
diff --git a/tools/install.py b/tools/install.py
index b132c7bf26c02886a7ab341a1973bf449744ba0f..757e3e60a7be01fac55c5fbb010dbbae00b1bfca 100755
--- a/tools/install.py
diff --git a/script/generate_node_version_header.py b/script/generate_node_version_header.py
deleted file mode 100755
index ab9bba7cd3..0000000000
--- a/script/generate_node_version_header.py
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/usr/bin/env python3
-import re
-import sys
-
-node_version_file = sys.argv[1]
-out_file = sys.argv[2]
-NMV = None
-if len(sys.argv) > 3:
- NMV = sys.argv[3]
-
-with open(node_version_file, 'r', encoding='utf-8') as in_file, \
- open(out_file, 'w', encoding='utf-8') as out_file:
- changed = False
- contents = in_file.read()
- new_contents = re.sub(
- r'^#define NODE_MODULE_VERSION [0-9]+$',
- '#define NODE_MODULE_VERSION ' + NMV,
- contents,
- flags=re.MULTILINE)
-
- changed = contents != new_contents
-
- if not changed and NMV is not None:
- raise Exception("Did not modify the NMV from nodes value, this value MUST "
- "differ from node")
-
- out_file.writelines(new_contents)
diff --git a/script/node/generate_node_version_header.py b/script/node/generate_node_version_header.py
new file mode 100755
index 0000000000..112d059eda
--- /dev/null
+++ b/script/node/generate_node_version_header.py
@@ -0,0 +1,25 @@
+#!/usr/bin/python3
+
+import re
+import sys
+
+node_version_file = sys.argv[1]
+out_file = sys.argv[2]
+NMV = None
+if len(sys.argv) > 3:
+ NMV = sys.argv[3]
+
+with open(node_version_file, 'r', encoding='utf-8') as in_file:
+ with open(out_file, 'w', encoding='utf-8') as out_file:
+ changed = False
+ contents = in_file.read()
+ new_contents = re.sub(r'^#define NODE_MODULE_VERSION [0-9]+$',
+ '#define NODE_MODULE_VERSION ' + NMV,
+ contents, flags=re.MULTILINE)
+
+ changed = contents != new_contents
+
+ if not changed and NMV is not None:
+ raise Exception('NMV must differ from current value in Node.js')
+
+ out_file.writelines(new_contents)
diff --git a/script/node/generate_original_fs.py b/script/node/generate_original_fs.py
new file mode 100644
index 0000000000..c2a54ac7ab
--- /dev/null
+++ b/script/node/generate_original_fs.py
@@ -0,0 +1,28 @@
+#!/usr/bin/python3
+
+import os
+import sys
+
+NODE_ROOT_DIR = "../../third_party/electron_node"
+out_dir = sys.argv[1]
+fs_files = sys.argv[2:]
+
+for fs_file in fs_files:
+ with open(os.path.join(NODE_ROOT_DIR, fs_file), 'r',
+ encoding='utf-8') as f:
+ contents = f.read()
+ original_fs_file = fs_file.replace('internal/fs/',
+ 'internal/original-fs/').replace('lib/fs.js',
+ 'lib/original-fs.js').replace('lib/fs/',
+ 'lib/original-fs/')
+
+ with open(os.path.join(out_dir, fs_file), 'w', encoding='utf-8'
+ ) as original_f:
+ original_f.write(contents)
+
+ with open(os.path.join(out_dir, original_fs_file), 'w',
+ encoding='utf-8') as transformed_f:
+ transformed_contents = contents.replace('internal/fs/',
+ 'internal/original-fs/').replace('require(\'fs',
+ 'require(\'original-fs')
+ transformed_f.write(transformed_contents)
|
refactor
|
cbe3cb770aa3f2dad92340546e3fbdecd742ed03
|
Shelley Vohr
|
2024-10-16 19:15:21
|
fix: Linux crash after `webContents.print()` with no parent window (#44246)
fix: Linux crash after print with no parent window
|
diff --git a/patches/chromium/printing.patch b/patches/chromium/printing.patch
index d02dd3b348..4f89505424 100644
--- a/patches/chromium/printing.patch
+++ b/patches/chromium/printing.patch
@@ -926,3 +926,23 @@ index 1e15568ad872c01c7c588ced81897f8dc229247a..ca528863a2dab2f437bbe95b343ccd33
namespace sandbox::policy {
base::FilePath GetCanonicalPath(const base::FilePath& path) {
+diff --git a/ui/gtk/gtk_util.cc b/ui/gtk/gtk_util.cc
+index d86fbcf969f2fa0d176ead903703ab612e5464c2..6b963ea8401d20e655d068a69105586814bab320 100644
+--- a/ui/gtk/gtk_util.cc
++++ b/ui/gtk/gtk_util.cc
+@@ -227,9 +227,13 @@ aura::Window* GetAuraTransientParent(GtkWidget* dialog) {
+ }
+
+ void ClearAuraTransientParent(GtkWidget* dialog, aura::Window* parent) {
++ if (!parent || !parent->GetHost()) {
++ return;
++ }
++
+ g_object_set_data(G_OBJECT(dialog), kAuraTransientParent, nullptr);
+- GtkUi::GetPlatform()->ClearTransientFor(
+- parent->GetHost()->GetAcceleratedWidget());
++ gfx::AcceleratedWidget parent_id = parent->GetHost()->GetAcceleratedWidget();
++ GtkUi::GetPlatform()->ClearTransientFor(parent_id);
+ }
+
+ base::OnceClosure DisableHostInputHandling(GtkWidget* dialog,
|
fix
|
d5ce1387cef63574e72939a5e968b0f8b7d36b76
|
George Xu
|
2022-11-29 22:22:09
|
docs: change pull request template to include mentions of templates and examples (#36474)
|
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index 3551177321..462b8b2d47 100644
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -1,4 +1,5 @@
#### Description of Change
+
<!--
Thank you for your Pull Request. Please provide a description above and review
the requirements below.
@@ -12,7 +13,7 @@ Contributors guide: https://github.com/electron/electron/blob/main/CONTRIBUTING.
- [ ] PR description included and stakeholders cc'd
- [ ] `npm test` passes
- [ ] tests are [changed or added](https://github.com/electron/electron/blob/main/docs/development/testing.md)
-- [ ] relevant documentation is changed or added
+- [ ] relevant documentation, tutorials, templates and examples are changed or added
- [ ] [PR release notes](https://github.com/electron/clerk/blob/master/README.md) describe the change in a way relevant to app developers, and are [capitalized, punctuated, and past tense](https://github.com/electron/clerk/blob/master/README.md#examples).
#### Release Notes
|
docs
|
92c5ff30a711abcff0ad2076d0949bd8f057adaa
|
Cheng Zhao
|
2024-02-07 07:23:17
|
build: add flag for setting vendor version (#41247)
|
diff --git a/buildflags/BUILD.gn b/buildflags/BUILD.gn
index 18ac3e42de..ef00ad27f6 100644
--- a/buildflags/BUILD.gn
+++ b/buildflags/BUILD.gn
@@ -14,4 +14,15 @@ buildflag_header("buildflags") {
"ENABLE_BUILTIN_SPELLCHECKER=$enable_builtin_spellchecker",
"OVERRIDE_LOCATION_PROVIDER=$enable_fake_location_provider",
]
+
+ if (electron_vendor_version != "") {
+ result = string_split(electron_vendor_version, ":")
+ flags += [
+ "HAS_VENDOR_VERSION=true",
+ "VENDOR_VERSION_NAME=\"${result[0]}\"",
+ "VENDOR_VERSION_VALUE=\"${result[1]}\"",
+ ]
+ } else {
+ flags += [ "HAS_VENDOR_VERSION=false" ]
+ }
}
diff --git a/buildflags/buildflags.gni b/buildflags/buildflags.gni
index 1c5cb8dfd3..801732cb25 100644
--- a/buildflags/buildflags.gni
+++ b/buildflags/buildflags.gni
@@ -21,4 +21,10 @@ declare_args() {
# Packagers and vendor builders should set this in gn args to avoid running
# the script that reads git tag.
override_electron_version = ""
+
+ # Define an extra item that will show in process.versions, the value must
+ # be in the format of "key:value".
+ # Packagers and vendor builders can set this in gn args to attach extra info
+ # about the build in the binary.
+ electron_vendor_version = ""
}
diff --git a/shell/common/node_bindings.cc b/shell/common/node_bindings.cc
index 22d08a9629..2ef6c3d790 100644
--- a/shell/common/node_bindings.cc
+++ b/shell/common/node_bindings.cc
@@ -942,6 +942,10 @@ void OnNodePreload(node::Environment* env,
if (dict.Get("versions", &versions)) {
versions.SetReadOnly(ELECTRON_PROJECT_NAME, ELECTRON_VERSION_STRING);
versions.SetReadOnly("chrome", CHROME_VERSION_STRING);
+#if BUILDFLAG(HAS_VENDOR_VERSION)
+ versions.SetReadOnly(BUILDFLAG(VENDOR_VERSION_NAME),
+ BUILDFLAG(VENDOR_VERSION_VALUE));
+#endif
}
// Execute lib/node/init.ts.
|
build
|
1cf194faae12592c1963040a7fd94085bae1852e
|
Kilian Valkhof
|
2024-04-23 11:29:14
|
docs: correct the return value for canceled showSaveDialog (#41926)
|
diff --git a/docs/api/dialog.md b/docs/api/dialog.md
index 414ed39b64..bb731cd236 100644
--- a/docs/api/dialog.md
+++ b/docs/api/dialog.md
@@ -174,7 +174,7 @@ dialog.showOpenDialog(mainWindow, {
* `dontAddToRecent` _Windows_ - Do not add the item being saved to the recent documents list.
* `securityScopedBookmarks` boolean (optional) _macOS_ _mas_ - Create a [security scoped bookmark](https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16) when packaged for the Mac App Store. If this option is enabled and the file doesn't already exist a blank file will be created at the chosen path.
-Returns `string | undefined`, the path of the file chosen by the user; if the dialog is cancelled it returns `undefined`.
+Returns `string`, the path of the file chosen by the user; if the dialog is cancelled it returns an empty string.
The `browserWindow` argument allows the dialog to attach itself to a parent window, making it modal.
@@ -207,7 +207,7 @@ The `filters` specifies an array of file types that can be displayed, see
Returns `Promise<Object>` - Resolve with an object containing the following:
* `canceled` boolean - whether or not the dialog was canceled.
-* `filePath` string (optional) - If the dialog is canceled, this will be `undefined`.
+* `filePath` string - If the dialog is canceled, this will be an empty string.
* `bookmark` string (optional) _macOS_ _mas_ - Base64 encoded string which contains the security scoped bookmark data for the saved file. `securityScopedBookmarks` must be enabled for this to be present. (For return values, see [table here](#bookmarks-array).)
The `browserWindow` argument allows the dialog to attach itself to a parent window, making it modal.
|
docs
|
c6102b9278c81dfed3de3011f93d547921c41263
|
Jeremy Rose
|
2024-03-28 09:38:16
|
docs: add missing headers option to ClientRequest options (#41723)
|
diff --git a/docs/api/client-request.md b/docs/api/client-request.md
index 440a775267..7e2637d207 100644
--- a/docs/api/client-request.md
+++ b/docs/api/client-request.md
@@ -17,6 +17,8 @@ following properties:
method.
* `url` string (optional) - The request URL. Must be provided in the absolute
form with the protocol scheme specified as http or https.
+ * `headers` Record<string, string | string[]> (optional) - Headers to be sent
+ with the request.
* `session` Session (optional) - The [`Session`](session.md) instance with
which the request is associated.
* `partition` string (optional) - The name of the [`partition`](session.md)
diff --git a/spec/api-net-spec.ts b/spec/api-net-spec.ts
index 1a92186742..c743632abc 100644
--- a/spec/api-net-spec.ts
+++ b/spec/api-net-spec.ts
@@ -935,12 +935,11 @@ describe('net module', () => {
response.end();
});
const serverUrl = url.parse(serverUrlUnparsed);
- const options = {
+ const urlRequest = net.request({
port: serverUrl.port ? parseInt(serverUrl.port, 10) : undefined,
hostname: '127.0.0.1',
headers: { [customHeaderName]: customHeaderValue }
- };
- const urlRequest = net.request(options);
+ });
const response = await getResponse(urlRequest);
expect(response.statusCode).to.be.equal(200);
await collectStreamBody(response);
|
docs
|
7f34b0e6f54b9ec8ea4d3ff8cb7d9911ade0fbeb
|
Charles Kerr
|
2024-08-23 14:53:01
|
chore: remove unused method asar::ClearArchives() (#43442)
chore: remove unused asar::ClearArchives()
last use removed in Jun 2021 (b1d1ac65, #29293)
|
diff --git a/shell/common/asar/asar_util.cc b/shell/common/asar/asar_util.cc
index 7a9cb32b8d..a2076217b6 100644
--- a/shell/common/asar/asar_util.cc
+++ b/shell/common/asar/asar_util.cc
@@ -77,13 +77,6 @@ std::shared_ptr<Archive> GetOrCreateAsarArchive(const base::FilePath& path) {
return nullptr;
}
-void ClearArchives() {
- base::AutoLock auto_lock(GetArchiveCacheLock());
- ArchiveMap& map = GetArchiveCache();
-
- map.clear();
-}
-
bool GetAsarArchivePath(const base::FilePath& full_path,
base::FilePath* asar_path,
base::FilePath* relative_path,
diff --git a/shell/common/asar/asar_util.h b/shell/common/asar/asar_util.h
index 31b4cf9990..ee148f26d1 100644
--- a/shell/common/asar/asar_util.h
+++ b/shell/common/asar/asar_util.h
@@ -20,9 +20,6 @@ struct IntegrityPayload;
// Gets or creates and caches a new Archive from the path.
std::shared_ptr<Archive> GetOrCreateAsarArchive(const base::FilePath& path);
-// Destroy cached Archive objects.
-void ClearArchives();
-
// Separates the path to Archive out.
bool GetAsarArchivePath(const base::FilePath& full_path,
base::FilePath* asar_path,
|
chore
|
4a695d07c616a8f02c17f5ad7f6a5f05ea20c877
|
Charles Kerr
|
2024-11-27 10:40:39
|
fix: misc-use-internal-linkage warnings (#44843)
* refactor: misc-use-internal-linkage warnings in context bridge
move impl functions into anonymous namespace so that they're not visible
to other compilation units:
- ExposeAPIInWorld()
- IsCalledFromMainWorld()
- OverrideGlobalPropertyFromIsolatedWorld()
- OverrideGlobalValueFromIsolatedWorld()
- TraceKeyPath()
* refactor: misc-use-internal-linkage warnings in skia util
move impl details into anonymous namespace so that they're not visible
to other compilation units:
- struct ScaleFactorPair
- kScaleFactorPairs[]
- GetScaleFactorFromPath()
- AddImageSkiaRepFromPath()
* refactor: misc-use-internal-linkage warnings in printing util
move impl details into anonymous namespace so that they're not visible
to other compilation units:
- GetFullPagePlugin()
* refactor: misc-use-internal-linkage warnings in blijnk converter
move impl details into anonymous namespace so that they're not visible
to other compilation units:
- GetKeyLocationCode()
- ModifiersToArray()
* refactor: misc-use-internal-linkage warnings in extrension system
move impl details into anonymous namespace so that they're not visible
to other compilation units:
- ParseManifest()
* refactor: misc-use-internal-linkage warnings in skia util
move impl details into anonymous namespace so that they're not visible
to other compilation units:
- GetFrameTokenMap()
- GetFrameTreeNodeIdMap()
* refactor: misc-use-internal-linkage warnings in electron_api_utility_process.cc
move impl details into anonymous namespace so that they're not visible
to other compilation units:
- GetAllUtilityProcessWrappers()
* refactor: misc-use-internal-linkage warnings in electron_api_menu
move impl details into anonymous namespace so that they're not visible
to other compilation units:
- InvokeBoolMethod()
* refactor: misc-use-internal-linkage warnings in platform util
move impl details into anonymous namespace so that they're not visible
to other compilation units:
- struct TrashItemResult
- TrashItemOnBlockingThread()
|
diff --git a/shell/browser/api/electron_api_menu.cc b/shell/browser/api/electron_api_menu.cc
index 9a87c9e193..daef73495b 100644
--- a/shell/browser/api/electron_api_menu.cc
+++ b/shell/browser/api/electron_api_menu.cc
@@ -70,6 +70,8 @@ Menu::~Menu() {
}
}
+namespace {
+
bool InvokeBoolMethod(const Menu* menu,
const char* method,
int command_id,
@@ -84,6 +86,8 @@ bool InvokeBoolMethod(const Menu* menu,
return gin::ConvertFromV8(isolate, val, &ret) ? ret : default_value;
}
+} // namespace
+
bool Menu::IsCommandIdChecked(int command_id) const {
return InvokeBoolMethod(this, "_isCommandIdChecked", command_id);
}
diff --git a/shell/browser/api/electron_api_utility_process.cc b/shell/browser/api/electron_api_utility_process.cc
index de128ddd52..a40d84ea94 100644
--- a/shell/browser/api/electron_api_utility_process.cc
+++ b/shell/browser/api/electron_api_utility_process.cc
@@ -44,6 +44,8 @@
namespace electron {
+namespace {
+
base::IDMap<api::UtilityProcessWrapper*, base::ProcessId>&
GetAllUtilityProcessWrappers() {
static base::NoDestructor<
@@ -52,6 +54,8 @@ GetAllUtilityProcessWrappers() {
return *s_all_utility_process_wrappers;
}
+} // namespace
+
namespace api {
gin::WrapperInfo UtilityProcessWrapper::kWrapperInfo = {
diff --git a/shell/browser/api/electron_api_web_frame_main.cc b/shell/browser/api/electron_api_web_frame_main.cc
index ac9653a762..a5cde1af50 100644
--- a/shell/browser/api/electron_api_web_frame_main.cc
+++ b/shell/browser/api/electron_api_web_frame_main.cc
@@ -100,6 +100,8 @@ using FrameTreeNodeIdMap = std::unordered_map<content::FrameTreeNodeId,
using FrameTokenMap =
std::map<content::GlobalRenderFrameHostToken, WebFrameMain*>;
+namespace {
+
FrameTreeNodeIdMap& GetFrameTreeNodeIdMap() {
static base::NoDestructor<FrameTreeNodeIdMap> instance;
return *instance;
@@ -109,6 +111,8 @@ FrameTokenMap& GetFrameTokenMap() {
return *instance;
}
+} // namespace
+
// static
WebFrameMain* WebFrameMain::FromFrameTreeNodeId(
content::FrameTreeNodeId frame_tree_node_id) {
diff --git a/shell/browser/extensions/electron_extension_system.cc b/shell/browser/extensions/electron_extension_system.cc
index be4edd66ee..46ce51da00 100644
--- a/shell/browser/extensions/electron_extension_system.cc
+++ b/shell/browser/extensions/electron_extension_system.cc
@@ -87,6 +87,8 @@ void ElectronExtensionSystem::InitForRegularProfile(bool extensions_enabled) {
management_policy_ = std::make_unique<ManagementPolicy>();
}
+namespace {
+
std::unique_ptr<base::Value::Dict> ParseManifest(
const std::string_view manifest_contents) {
JSONStringValueDeserializer deserializer(manifest_contents);
@@ -100,6 +102,8 @@ std::unique_ptr<base::Value::Dict> ParseManifest(
return std::make_unique<base::Value::Dict>(std::move(*manifest).TakeDict());
}
+} // namespace
+
void ElectronExtensionSystem::LoadComponentExtensions() {
std::string utf8_error;
#if BUILDFLAG(ENABLE_PDF_VIEWER)
diff --git a/shell/browser/printing/printing_utils.cc b/shell/browser/printing/printing_utils.cc
index 5f1d4fb549..852a0c6dba 100644
--- a/shell/browser/printing/printing_utils.cc
+++ b/shell/browser/printing/printing_utils.cc
@@ -79,6 +79,8 @@ bool IsDeviceNameValid(const std::u16string& device_name) {
#endif
}
+namespace {
+
// Duplicated from chrome/browser/printing/print_view_manager_common.cc
content::RenderFrameHost* GetFullPagePlugin(content::WebContents* contents) {
content::RenderFrameHost* full_page_plugin = nullptr;
@@ -98,6 +100,8 @@ content::RenderFrameHost* GetFullPagePlugin(content::WebContents* contents) {
return full_page_plugin;
}
+} // namespace
+
// Pick the right RenderFrameHost based on the WebContents.
// Modified from chrome/browser/printing/print_view_manager_common.cc
content::RenderFrameHost* GetRenderFrameHostToUse(
diff --git a/shell/common/gin_converters/blink_converter.cc b/shell/common/gin_converters/blink_converter.cc
index 5098599e98..f4f012d07f 100644
--- a/shell/common/gin_converters/blink_converter.cc
+++ b/shell/common/gin_converters/blink_converter.cc
@@ -201,6 +201,8 @@ struct Converter<blink::WebInputEvent::Modifiers> {
}
};
+namespace {
+
std::vector<std::string_view> ModifiersToArray(int modifiers) {
std::vector<std::string_view> modifier_strings;
@@ -211,6 +213,8 @@ std::vector<std::string_view> ModifiersToArray(int modifiers) {
return modifier_strings;
}
+} // namespace
+
blink::WebInputEvent::Type GetWebInputEventType(v8::Isolate* isolate,
v8::Local<v8::Value> val) {
blink::WebInputEvent::Type type = blink::WebInputEvent::Type::kUndefined;
@@ -301,6 +305,8 @@ bool Converter<blink::WebKeyboardEvent>::FromV8(v8::Isolate* isolate,
return true;
}
+namespace {
+
int GetKeyLocationCode(const blink::WebInputEvent& key) {
// https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/events/keyboard_event.h;l=46;drc=1ff6437e65b183e673b7b4f25060b74dc2ba5c37
enum KeyLocationCode {
@@ -319,6 +325,8 @@ int GetKeyLocationCode(const blink::WebInputEvent& key) {
return kDomKeyLocationStandard;
}
+} // namespace
+
v8::Local<v8::Value> Converter<blink::WebKeyboardEvent>::ToV8(
v8::Isolate* isolate,
const blink::WebKeyboardEvent& in) {
diff --git a/shell/common/platform_util.cc b/shell/common/platform_util.cc
index 7d4b34baeb..4c6326ca1e 100644
--- a/shell/common/platform_util.cc
+++ b/shell/common/platform_util.cc
@@ -13,6 +13,8 @@
namespace platform_util {
+namespace {
+
struct TrashItemResult {
bool success;
std::string error;
@@ -24,6 +26,8 @@ TrashItemResult TrashItemOnBlockingThread(const base::FilePath& full_path) {
return {success, error};
}
+} // namespace
+
void TrashItem(const base::FilePath& full_path,
base::OnceCallback<void(bool, const std::string&)> callback) {
// XXX: is continue_on_shutdown right?
diff --git a/shell/common/skia_util.cc b/shell/common/skia_util.cc
index 9e37c54053..c8b7236794 100644
--- a/shell/common/skia_util.cc
+++ b/shell/common/skia_util.cc
@@ -29,6 +29,8 @@
namespace electron::util {
+namespace {
+
struct ScaleFactorPair {
const char* name;
float scale;
@@ -55,6 +57,22 @@ float GetScaleFactorFromPath(const base::FilePath& path) {
return 1.0f;
}
+bool AddImageSkiaRepFromPath(gfx::ImageSkia* image,
+ const base::FilePath& path,
+ double scale_factor) {
+ std::string file_contents;
+ {
+ electron::ScopedAllowBlockingForElectron allow_blocking;
+ if (!asar::ReadFileToString(path, &file_contents))
+ return false;
+ }
+
+ return AddImageSkiaRepFromBuffer(image, base::as_byte_span(file_contents), 0,
+ 0, scale_factor);
+}
+
+} // namespace
+
bool AddImageSkiaRepFromPNG(gfx::ImageSkia* image,
const base::span<const uint8_t> data,
double scale_factor) {
@@ -114,20 +132,6 @@ bool AddImageSkiaRepFromBuffer(gfx::ImageSkia* image,
return true;
}
-bool AddImageSkiaRepFromPath(gfx::ImageSkia* image,
- const base::FilePath& path,
- double scale_factor) {
- std::string file_contents;
- {
- electron::ScopedAllowBlockingForElectron allow_blocking;
- if (!asar::ReadFileToString(path, &file_contents))
- return false;
- }
-
- return AddImageSkiaRepFromBuffer(image, base::as_byte_span(file_contents), 0,
- 0, scale_factor);
-}
-
bool PopulateImageSkiaRepsFromPath(gfx::ImageSkia* image,
const base::FilePath& path) {
bool succeed = false;
diff --git a/shell/renderer/api/electron_api_context_bridge.cc b/shell/renderer/api/electron_api_context_bridge.cc
index 384eb4b336..41f1db8279 100644
--- a/shell/renderer/api/electron_api_context_bridge.cc
+++ b/shell/renderer/api/electron_api_context_bridge.cc
@@ -659,6 +659,8 @@ v8::MaybeLocal<v8::Object> CreateProxyForAPI(
}
}
+namespace {
+
void ExposeAPIInWorld(v8::Isolate* isolate,
const int world_id,
const std::string& key,
@@ -819,6 +821,8 @@ bool IsCalledFromMainWorld(v8::Isolate* isolate) {
return isolate->GetCurrentContext() == main_context;
}
+} // namespace
+
} // namespace api
} // namespace electron
|
fix
|
d73a937375dae309673fdb33606a970c93e44d57
|
github-actions[bot]
|
2024-02-22 11:10:52
|
build: update appveyor image to latest version-e-123.0.6312.5 (#41408)
build: update appveyor image to latest version
Co-authored-by: jkleinsc <[email protected]>
|
diff --git a/appveyor-woa.yml b/appveyor-woa.yml
index 3723dc5505..010181979a 100644
--- a/appveyor-woa.yml
+++ b/appveyor-woa.yml
@@ -29,7 +29,7 @@
version: 1.0.{build}
build_cloud: electronhq-16-core
-image: e-123.0.6296.0
+image: e-123.0.6312.5
environment:
GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache
ELECTRON_OUT_DIR: Default
diff --git a/appveyor.yml b/appveyor.yml
index 49520ced9a..edc76ac397 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -29,7 +29,7 @@
version: 1.0.{build}
build_cloud: electronhq-16-core
-image: e-123.0.6296.0
+image: e-123.0.6312.5
environment:
GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache
ELECTRON_OUT_DIR: Default
|
build
|
1835c0ab6c7773e48715874457a08fb897dfebf5
|
Charles Kerr
|
2024-11-04 15:12:23
|
docs: capitalize POSIX and Windows correctly (#44546)
* docs: capitalize POSIX correctly
* docs: capitalize Windows correctly
|
diff --git a/docs/api/app.md b/docs/api/app.md
index d465922ce8..856734574b 100755
--- a/docs/api/app.md
+++ b/docs/api/app.md
@@ -416,7 +416,7 @@ Returns:
* `launch-failed` - Process never successfully launched
* `integrity-failure` - Windows code integrity checks failed
* `exitCode` number - The exit code for the process
- (e.g. status from waitpid if on posix, from GetExitCodeProcess on Windows).
+ (e.g. status from waitpid if on POSIX, from GetExitCodeProcess on Windows).
* `serviceName` string (optional) - The non-localized name of the process.
* `name` string (optional) - The name of the process.
Examples for utility: `Audio Service`, `Content Decryption Module Service`, `Network Service`, `Video Capture`, etc.
diff --git a/docs/api/command-line-switches.md b/docs/api/command-line-switches.md
index 3909d9ed30..67e6ddfd45 100644
--- a/docs/api/command-line-switches.md
+++ b/docs/api/command-line-switches.md
@@ -38,7 +38,7 @@ Without `*` prefix the URL has to match exactly.
### --disable-ntlm-v2
-Disables NTLM v2 for posix platforms, no effect elsewhere.
+Disables NTLM v2 for POSIX platforms, no effect elsewhere.
### --disable-http-cache
diff --git a/docs/api/shell.md b/docs/api/shell.md
index afbb966cc0..1008b73c16 100644
--- a/docs/api/shell.md
+++ b/docs/api/shell.md
@@ -36,7 +36,7 @@ Open the given file in the desktop's default manner.
### `shell.openExternal(url[, options])`
-* `url` string - Max 2081 characters on windows.
+* `url` string - Max 2081 characters on Windows.
* `options` Object (optional)
* `activate` boolean (optional) _macOS_ - `true` to bring the opened application to the foreground. The default is `true`.
* `workingDirectory` string (optional) _Windows_ - The working directory.
diff --git a/docs/api/utility-process.md b/docs/api/utility-process.md
index f503fa9387..bed1dd23f7 100644
--- a/docs/api/utility-process.md
+++ b/docs/api/utility-process.md
@@ -147,7 +147,7 @@ child process terminates.
Returns:
* `code` number - Contains the exit code for
-the process obtained from waitpid on posix, or GetExitCodeProcess on windows.
+the process obtained from waitpid on POSIX, or GetExitCodeProcess on Windows.
Emitted after the child process ends.
|
docs
|
687767139065860dcde89e0ceac65c79eb1b84b5
|
Charles Kerr
|
2024-08-05 08:24:27
|
fix: gin_helper::MicrotasksScope instantiation (#43185)
|
diff --git a/shell/browser/api/electron_api_auto_updater.cc b/shell/browser/api/electron_api_auto_updater.cc
index d24db3c319..2d870bba83 100644
--- a/shell/browser/api/electron_api_auto_updater.cc
+++ b/shell/browser/api/electron_api_auto_updater.cc
@@ -46,9 +46,9 @@ void AutoUpdater::OnError(const std::string& message) {
gin::StringToV8(isolate, message),
};
- gin_helper::MicrotasksScope microtasks_scope(
+ gin_helper::MicrotasksScope microtasks_scope{
isolate, wrapper->GetCreationContextChecked()->GetMicrotaskQueue(),
- true);
+ true, v8::MicrotasksScope::kRunMicrotasks};
node::MakeCallback(isolate, wrapper, "emit", args.size(), args.data(),
{0, 0});
diff --git a/shell/common/api/electron_bindings.cc b/shell/common/api/electron_bindings.cc
index 2d9d7f72ce..acae6ba083 100644
--- a/shell/common/api/electron_bindings.cc
+++ b/shell/common/api/electron_bindings.cc
@@ -237,8 +237,9 @@ void ElectronBindings::DidReceiveMemoryDump(
v8::HandleScope handle_scope(isolate);
v8::Local<v8::Context> local_context =
v8::Local<v8::Context>::New(isolate, context);
- gin_helper::MicrotasksScope microtasks_scope(
- isolate, local_context->GetMicrotaskQueue(), true);
+ gin_helper::MicrotasksScope microtasks_scope{
+ isolate, local_context->GetMicrotaskQueue(), true,
+ v8::MicrotasksScope::kRunMicrotasks};
v8::Context::Scope context_scope(local_context);
if (!success) {
diff --git a/shell/common/gin_helper/callback.h b/shell/common/gin_helper/callback.h
index a4f41b9511..7187cc61db 100644
--- a/shell/common/gin_helper/callback.h
+++ b/shell/common/gin_helper/callback.h
@@ -50,8 +50,9 @@ struct V8FunctionInvoker<v8::Local<v8::Value>(ArgTypes...)> {
return v8::Null(isolate);
v8::Local<v8::Function> holder = function.NewHandle(isolate);
v8::Local<v8::Context> context = holder->GetCreationContextChecked();
- gin_helper::MicrotasksScope microtasks_scope(
- isolate, context->GetMicrotaskQueue(), true);
+ gin_helper::MicrotasksScope microtasks_scope{
+ isolate, context->GetMicrotaskQueue(), true,
+ v8::MicrotasksScope::kRunMicrotasks};
v8::Context::Scope context_scope(context);
std::vector<v8::Local<v8::Value>> args{
gin::ConvertToV8(isolate, std::forward<ArgTypes>(raw))...};
@@ -75,8 +76,9 @@ struct V8FunctionInvoker<void(ArgTypes...)> {
return;
v8::Local<v8::Function> holder = function.NewHandle(isolate);
v8::Local<v8::Context> context = holder->GetCreationContextChecked();
- gin_helper::MicrotasksScope microtasks_scope(
- isolate, context->GetMicrotaskQueue(), true);
+ gin_helper::MicrotasksScope microtasks_scope{
+ isolate, context->GetMicrotaskQueue(), true,
+ v8::MicrotasksScope::kRunMicrotasks};
v8::Context::Scope context_scope(context);
std::vector<v8::Local<v8::Value>> args{
gin::ConvertToV8(isolate, std::forward<ArgTypes>(raw))...};
@@ -99,8 +101,9 @@ struct V8FunctionInvoker<ReturnType(ArgTypes...)> {
return ret;
v8::Local<v8::Function> holder = function.NewHandle(isolate);
v8::Local<v8::Context> context = holder->GetCreationContextChecked();
- gin_helper::MicrotasksScope microtasks_scope(
- isolate, context->GetMicrotaskQueue(), true);
+ gin_helper::MicrotasksScope microtasks_scope{
+ isolate, context->GetMicrotaskQueue(), true,
+ v8::MicrotasksScope::kRunMicrotasks};
v8::Context::Scope context_scope(context);
std::vector<v8::Local<v8::Value>> args{
gin::ConvertToV8(isolate, std::forward<ArgTypes>(raw))...};
diff --git a/shell/common/gin_helper/event_emitter_caller.cc b/shell/common/gin_helper/event_emitter_caller.cc
index c18c2a7895..124a300cb4 100644
--- a/shell/common/gin_helper/event_emitter_caller.cc
+++ b/shell/common/gin_helper/event_emitter_caller.cc
@@ -24,8 +24,9 @@ v8::Local<v8::Value> CallMethodWithArgs(v8::Isolate* isolate,
}
// Perform microtask checkpoint after running JavaScript.
- gin_helper::MicrotasksScope microtasks_scope(
- isolate, obj->GetCreationContextChecked()->GetMicrotaskQueue(), true);
+ gin_helper::MicrotasksScope microtasks_scope{
+ isolate, obj->GetCreationContextChecked()->GetMicrotaskQueue(), true,
+ v8::MicrotasksScope::kRunMicrotasks};
// node::MakeCallback will also run pending tasks in Node.js.
v8::MaybeLocal<v8::Value> ret = node::MakeCallback(
diff --git a/shell/common/gin_helper/function_template.h b/shell/common/gin_helper/function_template.h
index 3cc8bf025f..0737c8b474 100644
--- a/shell/common/gin_helper/function_template.h
+++ b/shell/common/gin_helper/function_template.h
@@ -267,9 +267,10 @@ class Invoker<std::index_sequence<indices...>, ArgTypes...>
template <typename ReturnType>
void DispatchToCallback(
base::RepeatingCallback<ReturnType(ArgTypes...)> callback) {
- gin_helper::MicrotasksScope microtasks_scope(
+ gin_helper::MicrotasksScope microtasks_scope{
args_->isolate(),
- args_->GetHolderCreationContext()->GetMicrotaskQueue(), true);
+ args_->GetHolderCreationContext()->GetMicrotaskQueue(), true,
+ v8::MicrotasksScope::kRunMicrotasks};
args_->Return(
callback.Run(std::move(ArgumentHolder<indices, ArgTypes>::value)...));
}
@@ -278,9 +279,10 @@ class Invoker<std::index_sequence<indices...>, ArgTypes...>
// expression to foo. As a result, we must specialize the case of Callbacks
// that have the void return type.
void DispatchToCallback(base::RepeatingCallback<void(ArgTypes...)> callback) {
- gin_helper::MicrotasksScope microtasks_scope(
+ gin_helper::MicrotasksScope microtasks_scope{
args_->isolate(),
- args_->GetHolderCreationContext()->GetMicrotaskQueue(), true);
+ args_->GetHolderCreationContext()->GetMicrotaskQueue(), true,
+ v8::MicrotasksScope::kRunMicrotasks};
callback.Run(std::move(ArgumentHolder<indices, ArgTypes>::value)...);
}
diff --git a/shell/common/gin_helper/microtasks_scope.h b/shell/common/gin_helper/microtasks_scope.h
index aff5a3f6ea..69c52552fd 100644
--- a/shell/common/gin_helper/microtasks_scope.h
+++ b/shell/common/gin_helper/microtasks_scope.h
@@ -16,11 +16,10 @@ namespace gin_helper {
// In the render process creates a v8::MicrotasksScope.
class MicrotasksScope {
public:
- explicit MicrotasksScope(v8::Isolate* isolate,
- v8::MicrotaskQueue* microtask_queue,
- bool ignore_browser_checkpoint = false,
- v8::MicrotasksScope::Type scope_type =
- v8::MicrotasksScope::kRunMicrotasks);
+ MicrotasksScope(v8::Isolate* isolate,
+ v8::MicrotaskQueue* microtask_queue,
+ bool ignore_browser_checkpoint,
+ v8::MicrotasksScope::Type scope_type);
~MicrotasksScope();
// disable copy
diff --git a/shell/common/gin_helper/promise.cc b/shell/common/gin_helper/promise.cc
index 5282f803e1..9fef990ab6 100644
--- a/shell/common/gin_helper/promise.cc
+++ b/shell/common/gin_helper/promise.cc
@@ -30,8 +30,9 @@ PromiseBase& PromiseBase::operator=(PromiseBase&&) = default;
v8::Maybe<bool> PromiseBase::Reject() {
v8::HandleScope handle_scope(isolate());
- gin_helper::MicrotasksScope microtasks_scope(
- isolate(), GetContext()->GetMicrotaskQueue());
+ gin_helper::MicrotasksScope microtasks_scope{
+ isolate(), GetContext()->GetMicrotaskQueue(), false,
+ v8::MicrotasksScope::kRunMicrotasks};
v8::Context::Scope context_scope(GetContext());
return GetInner()->Reject(GetContext(), v8::Undefined(isolate()));
@@ -39,8 +40,9 @@ v8::Maybe<bool> PromiseBase::Reject() {
v8::Maybe<bool> PromiseBase::Reject(v8::Local<v8::Value> except) {
v8::HandleScope handle_scope(isolate());
- gin_helper::MicrotasksScope microtasks_scope(
- isolate(), GetContext()->GetMicrotaskQueue());
+ gin_helper::MicrotasksScope microtasks_scope{
+ isolate(), GetContext()->GetMicrotaskQueue(), false,
+ v8::MicrotasksScope::kRunMicrotasks};
v8::Context::Scope context_scope(GetContext());
return GetInner()->Reject(GetContext(), except);
@@ -49,8 +51,9 @@ v8::Maybe<bool> PromiseBase::Reject(v8::Local<v8::Value> except) {
v8::Maybe<bool> PromiseBase::RejectWithErrorMessage(
const std::string_view message) {
v8::HandleScope handle_scope(isolate());
- gin_helper::MicrotasksScope microtasks_scope(
- isolate(), GetContext()->GetMicrotaskQueue());
+ gin_helper::MicrotasksScope microtasks_scope{
+ isolate(), GetContext()->GetMicrotaskQueue(), false,
+ v8::MicrotasksScope::kRunMicrotasks};
v8::Context::Scope context_scope(GetContext());
v8::Local<v8::Value> error =
@@ -92,8 +95,9 @@ v8::Local<v8::Promise> Promise<void>::ResolvedPromise(v8::Isolate* isolate) {
v8::Maybe<bool> Promise<void>::Resolve() {
v8::HandleScope handle_scope(isolate());
- gin_helper::MicrotasksScope microtasks_scope(
- isolate(), GetContext()->GetMicrotaskQueue());
+ gin_helper::MicrotasksScope microtasks_scope{
+ isolate(), GetContext()->GetMicrotaskQueue(), false,
+ v8::MicrotasksScope::kRunMicrotasks};
v8::Context::Scope context_scope(GetContext());
return GetInner()->Resolve(GetContext(), v8::Undefined(isolate()));
diff --git a/shell/common/gin_helper/promise.h b/shell/common/gin_helper/promise.h
index ff23cc1ce8..e46c5991ee 100644
--- a/shell/common/gin_helper/promise.h
+++ b/shell/common/gin_helper/promise.h
@@ -123,8 +123,9 @@ class Promise : public PromiseBase {
v8::Maybe<bool> Resolve(const RT& value) {
gin_helper::Locker locker(isolate());
v8::HandleScope handle_scope(isolate());
- gin_helper::MicrotasksScope microtasks_scope(
- isolate(), GetContext()->GetMicrotaskQueue());
+ gin_helper::MicrotasksScope microtasks_scope{
+ isolate(), GetContext()->GetMicrotaskQueue(), false,
+ v8::MicrotasksScope::kRunMicrotasks};
v8::Context::Scope context_scope(GetContext());
return GetInner()->Resolve(GetContext(),
diff --git a/shell/common/node_bindings.cc b/shell/common/node_bindings.cc
index cf7f754b08..fb1326d95d 100644
--- a/shell/common/node_bindings.cc
+++ b/shell/common/node_bindings.cc
@@ -285,7 +285,7 @@ void ErrorMessageListener(v8::Local<v8::Message> message,
node::Environment* env = node::Environment::GetCurrent(isolate);
if (env) {
gin_helper::MicrotasksScope microtasks_scope(
- isolate, env->context()->GetMicrotaskQueue(),
+ isolate, env->context()->GetMicrotaskQueue(), false,
v8::MicrotasksScope::kDoNotRunMicrotasks);
// Emit the after() hooks now that the exception has been handled.
// Analogous to node/lib/internal/process/execution.js#L176-L180
diff --git a/shell/common/v8_value_serializer.cc b/shell/common/v8_value_serializer.cc
index 5420adb4db..96251a149a 100644
--- a/shell/common/v8_value_serializer.cc
+++ b/shell/common/v8_value_serializer.cc
@@ -34,9 +34,9 @@ class V8Serializer : public v8::ValueSerializer::Delegate {
~V8Serializer() override = default;
bool Serialize(v8::Local<v8::Value> value, blink::CloneableMessage* out) {
- gin_helper::MicrotasksScope microtasks_scope(
- isolate_, isolate_->GetCurrentContext()->GetMicrotaskQueue(),
- v8::MicrotasksScope::kDoNotRunMicrotasks);
+ gin_helper::MicrotasksScope microtasks_scope{
+ isolate_, isolate_->GetCurrentContext()->GetMicrotaskQueue(), false,
+ v8::MicrotasksScope::kDoNotRunMicrotasks};
WriteBlinkEnvelope(19);
serializer_.WriteHeader();
diff --git a/shell/renderer/api/electron_api_spell_check_client.cc b/shell/renderer/api/electron_api_spell_check_client.cc
index 07ab0115c8..6d8cb4dd8a 100644
--- a/shell/renderer/api/electron_api_spell_check_client.cc
+++ b/shell/renderer/api/electron_api_spell_check_client.cc
@@ -221,9 +221,9 @@ void SpellCheckClient::SpellCheckWords(const SpellCheckScope& scope,
DCHECK(!scope.spell_check_.IsEmpty());
auto context = isolate_->GetCurrentContext();
- gin_helper::MicrotasksScope microtasks_scope(
- isolate_, context->GetMicrotaskQueue(),
- v8::MicrotasksScope::kDoNotRunMicrotasks);
+ gin_helper::MicrotasksScope microtasks_scope{
+ isolate_, context->GetMicrotaskQueue(), false,
+ v8::MicrotasksScope::kDoNotRunMicrotasks};
v8::Local<v8::FunctionTemplate> templ = gin_helper::CreateFunctionTemplate(
isolate_, base::BindRepeating(&SpellCheckClient::OnSpellCheckDone,
diff --git a/shell/renderer/electron_sandboxed_renderer_client.cc b/shell/renderer/electron_sandboxed_renderer_client.cc
index 50f03c641c..8568ec59b8 100644
--- a/shell/renderer/electron_sandboxed_renderer_client.cc
+++ b/shell/renderer/electron_sandboxed_renderer_client.cc
@@ -204,9 +204,9 @@ void ElectronSandboxedRendererClient::WillReleaseScriptContext(
return;
auto* isolate = context->GetIsolate();
- gin_helper::MicrotasksScope microtasks_scope(
- isolate, context->GetMicrotaskQueue(),
- v8::MicrotasksScope::kDoNotRunMicrotasks);
+ gin_helper::MicrotasksScope microtasks_scope{
+ isolate, context->GetMicrotaskQueue(), false,
+ v8::MicrotasksScope::kDoNotRunMicrotasks};
v8::HandleScope handle_scope(isolate);
v8::Context::Scope context_scope(context);
InvokeEmitProcessEvent(context, "exit");
@@ -223,9 +223,9 @@ void ElectronSandboxedRendererClient::EmitProcessEvent(
v8::HandleScope handle_scope{isolate};
v8::Local<v8::Context> context = GetContext(frame, isolate);
- gin_helper::MicrotasksScope microtasks_scope(
- isolate, context->GetMicrotaskQueue(),
- v8::MicrotasksScope::kDoNotRunMicrotasks);
+ gin_helper::MicrotasksScope microtasks_scope{
+ isolate, context->GetMicrotaskQueue(), false,
+ v8::MicrotasksScope::kDoNotRunMicrotasks};
v8::Context::Scope context_scope(context);
InvokeEmitProcessEvent(context, event_name);
|
fix
|
b4ec363b3ddfccc094e9ff2016b66a87294e0e84
|
John Kleinschmidt
|
2023-05-30 12:35:25
|
feat: add USB protected classes handler (#38263)
* feat: add USB protected classes handler
* chore: apply review suggestions
Co-authored-by: Charles Kerr <[email protected]>
* chore: update docs
* chore: apply review suggestions
* update doc per suggestion
---------
Co-authored-by: Charles Kerr <[email protected]>
|
diff --git a/docs/api/session.md b/docs/api/session.md
index e6248afd37..334a2a4e4d 100644
--- a/docs/api/session.md
+++ b/docs/api/session.md
@@ -1091,6 +1091,55 @@ app.whenReady().then(() => {
})
```
+#### `ses.setUSBProtectedClassesHandler(handler)`
+
+* `handler` Function\<string[]> | null
+ * `details` Object
+ * `protectedClasses` string[] - The current list of protected USB classes. Possible class values are:
+ * `audio`
+ * `audio-video`
+ * `hid`
+ * `mass-storage`
+ * `smart-card`
+ * `video`
+ * `wireless`
+
+Sets the handler which can be used to override which [USB classes are protected](https://wicg.github.io/webusb/#usbinterface-interface).
+The return value for the handler is a string array of USB classes which should be considered protected (eg not available in the renderer). Valid values for the array are:
+
+* `audio`
+* `audio-video`
+* `hid`
+* `mass-storage`
+* `smart-card`
+* `video`
+* `wireless`
+
+Returning an empty string array from the handler will allow all USB classes; returning the passed in array will maintain the default list of protected USB classes (this is also the default behavior if a handler is not defined).
+To clear the handler, call `setUSBProtectedClassesHandler(null)`.
+
+```javascript
+const { app, BrowserWindow } = require('electron')
+
+let win = null
+
+app.whenReady().then(() => {
+ win = new BrowserWindow()
+
+ win.webContents.session.setUSBProtectedClassesHandler((details) => {
+ // Allow all classes:
+ // return []
+ // Keep the current set of protected classes:
+ // return details.protectedClasses
+ // Selectively remove classes:
+ return details.protectedClasses.filter((usbClass) => {
+ // Exclude classes except for audio classes
+ return usbClass.indexOf('audio') === -1
+ })
+ })
+})
+```
+
#### `ses.setBluetoothPairingHandler(handler)` _Windows_ _Linux_
* `handler` Function | null
diff --git a/docs/fiddles/features/web-usb/main.js b/docs/fiddles/features/web-usb/main.js
index fda4b3c734..4ebe41e36d 100644
--- a/docs/fiddles/features/web-usb/main.js
+++ b/docs/fiddles/features/web-usb/main.js
@@ -51,6 +51,13 @@ function createWindow () {
}
})
+ mainWindow.webContents.session.setUSBProtectedClassesHandler((details) => {
+ return details.protectedClasses.filter((usbClass) => {
+ // Exclude classes except for audio classes
+ return usbClass.indexOf('audio') === -1
+ })
+ })
+
mainWindow.loadFile('index.html')
}
diff --git a/docs/tutorial/devices.md b/docs/tutorial/devices.md
index be153d51da..64f360e22f 100644
--- a/docs/tutorial/devices.md
+++ b/docs/tutorial/devices.md
@@ -142,6 +142,8 @@ Electron provides several APIs for working with the WebUSB API:
`setDevicePermissionHandler`.
* [`ses.setPermissionCheckHandler(handler)`](../api/session.md#sessetpermissioncheckhandlerhandler)
can be used to disable USB access for specific origins.
+* [`ses.setUSBProtectedClassesHandler](../api/session.md#sessetusbprotectedclasseshandlerhandler)
+ can be used to allow usage of [protected USB classes](https://wicg.github.io/webusb/#usbinterface-interface) that are not available by default.
### Example
diff --git a/shell/browser/api/electron_api_session.cc b/shell/browser/api/electron_api_session.cc
index 691fcf92c2..b05b0f0159 100644
--- a/shell/browser/api/electron_api_session.cc
+++ b/shell/browser/api/electron_api_session.cc
@@ -74,6 +74,7 @@
#include "shell/common/gin_converters/gurl_converter.h"
#include "shell/common/gin_converters/media_converter.h"
#include "shell/common/gin_converters/net_converter.h"
+#include "shell/common/gin_converters/usb_protected_classes_converter.h"
#include "shell/common/gin_converters/value_converter.h"
#include "shell/common/gin_helper/dictionary.h"
#include "shell/common/gin_helper/object_template_builder.h"
@@ -699,6 +700,18 @@ void Session::SetDevicePermissionHandler(v8::Local<v8::Value> val,
permission_manager->SetDevicePermissionHandler(handler);
}
+void Session::SetUSBProtectedClassesHandler(v8::Local<v8::Value> val,
+ gin::Arguments* args) {
+ ElectronPermissionManager::ProtectedUSBHandler handler;
+ if (!(val->IsNull() || gin::ConvertFromV8(args->isolate(), val, &handler))) {
+ args->ThrowTypeError("Must pass null or function");
+ return;
+ }
+ auto* permission_manager = static_cast<ElectronPermissionManager*>(
+ browser_context()->GetPermissionControllerDelegate());
+ permission_manager->SetProtectedUSBHandler(handler);
+}
+
void Session::SetBluetoothPairingHandler(v8::Local<v8::Value> val,
gin::Arguments* args) {
ElectronPermissionManager::BluetoothPairingHandler handler;
@@ -1294,6 +1307,8 @@ void Session::FillObjectTemplate(v8::Isolate* isolate,
&Session::SetDisplayMediaRequestHandler)
.SetMethod("setDevicePermissionHandler",
&Session::SetDevicePermissionHandler)
+ .SetMethod("setUSBProtectedClassesHandler",
+ &Session::SetUSBProtectedClassesHandler)
.SetMethod("setBluetoothPairingHandler",
&Session::SetBluetoothPairingHandler)
.SetMethod("clearHostResolverCache", &Session::ClearHostResolverCache)
diff --git a/shell/browser/api/electron_api_session.h b/shell/browser/api/electron_api_session.h
index e50ae7ed52..1111017430 100644
--- a/shell/browser/api/electron_api_session.h
+++ b/shell/browser/api/electron_api_session.h
@@ -118,6 +118,8 @@ class Session : public gin::Wrappable<Session>,
gin::Arguments* args);
void SetDevicePermissionHandler(v8::Local<v8::Value> val,
gin::Arguments* args);
+ void SetUSBProtectedClassesHandler(v8::Local<v8::Value> val,
+ gin::Arguments* args);
void SetBluetoothPairingHandler(v8::Local<v8::Value> val,
gin::Arguments* args);
v8::Local<v8::Promise> ClearHostResolverCache(gin::Arguments* args);
diff --git a/shell/browser/electron_permission_manager.cc b/shell/browser/electron_permission_manager.cc
index 26596a3f85..96ff863b78 100644
--- a/shell/browser/electron_permission_manager.cc
+++ b/shell/browser/electron_permission_manager.cc
@@ -25,6 +25,7 @@
#include "shell/browser/web_contents_preferences.h"
#include "shell/common/gin_converters/content_converter.h"
#include "shell/common/gin_converters/frame_converter.h"
+#include "shell/common/gin_converters/usb_protected_classes_converter.h"
#include "shell/common/gin_converters/value_converter.h"
#include "shell/common/gin_helper/event_emitter_caller.h"
#include "third_party/blink/public/common/permissions/permission_utils.h"
@@ -130,6 +131,11 @@ void ElectronPermissionManager::SetDevicePermissionHandler(
device_permission_handler_ = handler;
}
+void ElectronPermissionManager::SetProtectedUSBHandler(
+ const ProtectedUSBHandler& handler) {
+ protected_usb_handler_ = handler;
+}
+
void ElectronPermissionManager::SetBluetoothPairingHandler(
const BluetoothPairingHandler& handler) {
bluetooth_pairing_handler_ = handler;
@@ -362,6 +368,21 @@ void ElectronPermissionManager::RevokeDevicePermission(
browser_context->RevokeDevicePermission(origin, device, permission);
}
+ElectronPermissionManager::USBProtectedClasses
+ElectronPermissionManager::CheckProtectedUSBClasses(
+ const USBProtectedClasses& classes) const {
+ if (protected_usb_handler_.is_null()) {
+ return classes;
+ } else {
+ v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
+ v8::HandleScope scope(isolate);
+ v8::Local<v8::Object> details = gin::DataObjectBuilder(isolate)
+ .Set("protectedClasses", classes)
+ .Build();
+ return protected_usb_handler_.Run(details);
+ }
+}
+
blink::mojom::PermissionStatus
ElectronPermissionManager::GetPermissionStatusForCurrentDocument(
blink::PermissionType permission,
diff --git a/shell/browser/electron_permission_manager.h b/shell/browser/electron_permission_manager.h
index c87a214928..fd7b146022 100644
--- a/shell/browser/electron_permission_manager.h
+++ b/shell/browser/electron_permission_manager.h
@@ -35,6 +35,8 @@ class ElectronPermissionManager : public content::PermissionControllerDelegate {
ElectronPermissionManager& operator=(const ElectronPermissionManager&) =
delete;
+ using USBProtectedClasses = std::vector<uint8_t>;
+
using StatusCallback =
base::OnceCallback<void(blink::mojom::PermissionStatus)>;
using StatusesCallback = base::OnceCallback<void(
@@ -52,6 +54,10 @@ class ElectronPermissionManager : public content::PermissionControllerDelegate {
using DeviceCheckHandler =
base::RepeatingCallback<bool(const v8::Local<v8::Object>&)>;
+
+ using ProtectedUSBHandler = base::RepeatingCallback<USBProtectedClasses(
+ const v8::Local<v8::Object>&)>;
+
using BluetoothPairingHandler =
base::RepeatingCallback<void(gin_helper::Dictionary, PairCallback)>;
@@ -59,6 +65,7 @@ class ElectronPermissionManager : public content::PermissionControllerDelegate {
void SetPermissionRequestHandler(const RequestHandler& handler);
void SetPermissionCheckHandler(const CheckHandler& handler);
void SetDevicePermissionHandler(const DeviceCheckHandler& handler);
+ void SetProtectedUSBHandler(const ProtectedUSBHandler& handler);
void SetBluetoothPairingHandler(const BluetoothPairingHandler& handler);
// content::PermissionControllerDelegate:
@@ -109,6 +116,9 @@ class ElectronPermissionManager : public content::PermissionControllerDelegate {
const base::Value& object,
ElectronBrowserContext* browser_context) const;
+ USBProtectedClasses CheckProtectedUSBClasses(
+ const USBProtectedClasses& classes) const;
+
protected:
void OnPermissionResponse(int request_id,
int permission_id,
@@ -159,6 +169,7 @@ class ElectronPermissionManager : public content::PermissionControllerDelegate {
RequestHandler request_handler_;
CheckHandler check_handler_;
DeviceCheckHandler device_permission_handler_;
+ ProtectedUSBHandler protected_usb_handler_;
BluetoothPairingHandler bluetooth_pairing_handler_;
PendingRequestsMap pending_requests_;
diff --git a/shell/browser/usb/electron_usb_delegate.cc b/shell/browser/usb/electron_usb_delegate.cc
index 15a97b5bc1..9baf621c66 100644
--- a/shell/browser/usb/electron_usb_delegate.cc
+++ b/shell/browser/usb/electron_usb_delegate.cc
@@ -152,37 +152,9 @@ void ElectronUsbDelegate::AdjustProtectedInterfaceClasses(
const url::Origin& origin,
content::RenderFrameHost* frame,
std::vector<uint8_t>& classes) {
- // Isolated Apps have unrestricted access to any USB interface class.
- if (frame &&
- frame->GetWebExposedIsolationLevel() >=
- content::WebExposedIsolationLevel::kMaybeIsolatedApplication) {
- // TODO(https://crbug.com/1236706): Should the list of interface classes the
- // app expects to claim be encoded in the Web App Manifest?
- classes.clear();
- return;
- }
-
-#if BUILDFLAG(ENABLE_EXTENSIONS)
- // Don't enforce protected interface classes for Chrome Apps since the
- // chrome.usb API has no such restriction.
- if (origin.scheme() == extensions::kExtensionScheme) {
- auto* extension_registry =
- extensions::ExtensionRegistry::Get(browser_context);
- if (extension_registry) {
- const extensions::Extension* extension =
- extension_registry->enabled_extensions().GetByID(origin.host());
- if (extension && extension->is_platform_app()) {
- classes.clear();
- return;
- }
- }
- }
-
- if (origin.scheme() == extensions::kExtensionScheme &&
- base::Contains(kSmartCardPrivilegedExtensionIds, origin.host())) {
- base::Erase(classes, device::mojom::kUsbSmartCardClass);
- }
-#endif // BUILDFLAG(ENABLE_EXTENSIONS)
+ auto* permission_manager = static_cast<ElectronPermissionManager*>(
+ browser_context->GetPermissionControllerDelegate());
+ classes = permission_manager->CheckProtectedUSBClasses(classes);
}
std::unique_ptr<UsbChooser> ElectronUsbDelegate::RunChooser(
diff --git a/shell/common/gin_converters/usb_protected_classes_converter.h b/shell/common/gin_converters/usb_protected_classes_converter.h
new file mode 100644
index 0000000000..d4db86b597
--- /dev/null
+++ b/shell/common/gin_converters/usb_protected_classes_converter.h
@@ -0,0 +1,66 @@
+// Copyright (c) 2022 Microsoft, Inc.
+// Use of this source code is governed by the MIT license that can be
+// found in the LICENSE file.
+
+#ifndef ELECTRON_SHELL_COMMON_GIN_CONVERTERS_USB_PROTECTED_CLASSES_CONVERTER_H_
+#define ELECTRON_SHELL_COMMON_GIN_CONVERTERS_USB_PROTECTED_CLASSES_CONVERTER_H_
+
+#include <string>
+#include <string_view>
+#include <utility>
+#include <vector>
+
+#include "gin/converter.h"
+#include "services/device/public/mojom/usb_device.mojom-forward.h"
+#include "shell/browser/electron_permission_manager.h"
+
+namespace gin {
+
+static auto constexpr ClassMapping =
+ std::array<std::pair<uint8_t, std::string_view>, 7>{
+ {{device::mojom::kUsbAudioClass, "audio"},
+ {device::mojom::kUsbHidClass, "hid"},
+ {device::mojom::kUsbMassStorageClass, "mass-storage"},
+ {device::mojom::kUsbSmartCardClass, "smart-card"},
+ {device::mojom::kUsbVideoClass, "video"},
+ {device::mojom::kUsbAudioVideoClass, "audio-video"},
+ {device::mojom::kUsbWirelessClass, "wireless"}}};
+
+template <>
+struct Converter<electron::ElectronPermissionManager::USBProtectedClasses> {
+ static v8::Local<v8::Value> ToV8(
+ v8::Isolate* isolate,
+ const electron::ElectronPermissionManager::USBProtectedClasses& classes) {
+ std::vector<std::string> class_strings;
+ class_strings.reserve(std::size(classes));
+ for (const auto& itr : classes) {
+ for (const auto& [usb_class, name] : ClassMapping) {
+ if (usb_class == itr)
+ class_strings.emplace_back(name);
+ }
+ }
+ return gin::ConvertToV8(isolate, class_strings);
+ }
+
+ static bool FromV8(
+ v8::Isolate* isolate,
+ v8::Local<v8::Value> val,
+ electron::ElectronPermissionManager::USBProtectedClasses* out) {
+ std::vector<std::string> class_strings;
+ if (ConvertFromV8(isolate, val, &class_strings)) {
+ out->reserve(std::size(class_strings));
+ for (const auto& itr : class_strings) {
+ for (const auto& [usb_class, name] : ClassMapping) {
+ if (name == itr)
+ out->emplace_back(usb_class);
+ }
+ }
+ return true;
+ }
+ return false;
+ }
+};
+
+} // namespace gin
+
+#endif // ELECTRON_SHELL_COMMON_GIN_CONVERTERS_USB_PROTECTED_CLASSES_CONVERTER_H_
|
feat
|
c75e193a3e4683b1d55e56152dcef92e93d5eb56
|
Athul Iddya
|
2023-08-17 11:26:49
|
fix: use tiled edges to calculate frame inset sizes in Linux (#39523)
Adapt to the window frame size calculation changes in CL 3970920 by
setting the inset sizes to 0 for tiled edges.
|
diff --git a/shell/browser/ui/views/client_frame_view_linux.cc b/shell/browser/ui/views/client_frame_view_linux.cc
index 9a52533a5a..04a41383e5 100644
--- a/shell/browser/ui/views/client_frame_view_linux.cc
+++ b/shell/browser/ui/views/client_frame_view_linux.cc
@@ -150,7 +150,13 @@ void ClientFrameViewLinux::Init(NativeWindowViews* window,
}
gfx::Insets ClientFrameViewLinux::GetBorderDecorationInsets() const {
- return frame_provider_->GetFrameThicknessDip();
+ const auto insets = frame_provider_->GetFrameThicknessDip();
+ // We shouldn't draw frame decorations for the tiled edges.
+ // See https://wayland.app/protocols/xdg-shell#xdg_toplevel:enum:state
+ return gfx::Insets::TLBR(tiled_edges().top ? 0 : insets.top(),
+ tiled_edges().left ? 0 : insets.left(),
+ tiled_edges().bottom ? 0 : insets.bottom(),
+ tiled_edges().right ? 0 : insets.right());
}
gfx::Insets ClientFrameViewLinux::GetInputInsets() const {
|
fix
|
a5b433988433adb9481e90a80cd7642041b6f8ed
|
Alice Zhao
|
2024-12-12 07:56:27
|
fix: add missing index arg in `navigationHistory.canGoToOffset` (#44989)
fix: add missing arg
|
diff --git a/lib/browser/api/web-contents.ts b/lib/browser/api/web-contents.ts
index cc5f376e93..2e37f43917 100644
--- a/lib/browser/api/web-contents.ts
+++ b/lib/browser/api/web-contents.ts
@@ -514,9 +514,9 @@ WebContents.prototype.canGoForward = function () {
};
const canGoToOffsetDeprecated = deprecate.warnOnce('webContents.canGoToOffset', 'webContents.navigationHistory.canGoToOffset');
-WebContents.prototype.canGoToOffset = function () {
+WebContents.prototype.canGoToOffset = function (index: number) {
canGoToOffsetDeprecated();
- return this._canGoToOffset();
+ return this._canGoToOffset(index);
};
const clearHistoryDeprecated = deprecate.warnOnce('webContents.clearHistory', 'webContents.navigationHistory.clear');
diff --git a/typings/internal-electron.d.ts b/typings/internal-electron.d.ts
index b213b031a6..0f2cc17c28 100644
--- a/typings/internal-electron.d.ts
+++ b/typings/internal-electron.d.ts
@@ -93,7 +93,7 @@ declare namespace Electron {
_historyLength(): number;
_canGoBack(): boolean;
_canGoForward(): boolean;
- _canGoToOffset(): boolean;
+ _canGoToOffset(index: number): boolean;
_goBack(): void;
_goForward(): void;
_goToOffset(index: number): void;
|
fix
|
ac074a554804f9041f07260def59cbb576d663a0
|
Shelley Vohr
|
2024-07-05 11:36:44
|
refactor: run Windows `SelectFileDialog` out of process (#42758)
* refactor: run Windows SelectFileDialog out of process
* fix: add missing IS_WIN guard
* refactor: use upstream SelectFileDialogFactory
* fix: build chrome/services/util_win/public/mojom target
|
diff --git a/chromium_src/BUILD.gn b/chromium_src/BUILD.gn
index 5b6c16ff56..026260adbb 100644
--- a/chromium_src/BUILD.gn
+++ b/chromium_src/BUILD.gn
@@ -156,9 +156,13 @@ static_library("chrome") {
"//chrome/browser/ui/frame/window_frame_util.h",
"//chrome/browser/win/chrome_process_finder.cc",
"//chrome/browser/win/chrome_process_finder.h",
+ "//chrome/browser/win/chrome_select_file_dialog_factory.cc",
+ "//chrome/browser/win/chrome_select_file_dialog_factory.h",
"//chrome/browser/win/titlebar_config.cc",
"//chrome/browser/win/titlebar_config.h",
"//chrome/browser/win/titlebar_config.h",
+ "//chrome/browser/win/util_win_service.cc",
+ "//chrome/browser/win/util_win_service.h",
"//chrome/child/v8_crashpad_support_win.cc",
"//chrome/child/v8_crashpad_support_win.h",
]
@@ -241,6 +245,7 @@ static_library("chrome") {
"//components/webapps/common:mojo_bindings",
]
deps += [
+ "//chrome/services/util_win/public/mojom",
"//components/compose/core/browser:mojo_bindings",
"//components/segmentation_platform/public/proto",
]
diff --git a/shell/browser/electron_browser_main_parts.cc b/shell/browser/electron_browser_main_parts.cc
index de442f2dfb..0b89745111 100644
--- a/shell/browser/electron_browser_main_parts.cc
+++ b/shell/browser/electron_browser_main_parts.cc
@@ -96,6 +96,7 @@
#endif
#if BUILDFLAG(IS_WIN)
+#include "chrome/browser/win/chrome_select_file_dialog_factory.h"
#include "ui/base/l10n/l10n_util_win.h"
#include "ui/gfx/system_fonts_win.h"
#include "ui/strings/grit/app_locale_settings.h"
@@ -486,6 +487,11 @@ int ElectronBrowserMainParts::PreMainMessageLoopRun() {
fake_browser_process_->PreMainMessageLoopRun();
+#if BUILDFLAG(IS_WIN)
+ ui::SelectFileDialog::SetFactory(
+ std::make_unique<ChromeSelectFileDialogFactory>());
+#endif
+
return GetExitCode();
}
diff --git a/shell/utility/electron_content_utility_client.cc b/shell/utility/electron_content_utility_client.cc
index 83c385b2d6..85b3c7bcef 100644
--- a/shell/utility/electron_content_utility_client.cc
+++ b/shell/utility/electron_content_utility_client.cc
@@ -20,7 +20,9 @@
#if BUILDFLAG(IS_WIN)
#include "chrome/services/util_win/public/mojom/util_read_icon.mojom.h"
+#include "chrome/services/util_win/public/mojom/util_win.mojom.h"
#include "chrome/services/util_win/util_read_icon.h"
+#include "chrome/services/util_win/util_win_impl.h"
#endif // BUILDFLAG(IS_WIN)
#if BUILDFLAG(ENABLE_PRINTING)
@@ -55,6 +57,9 @@ auto RunWindowsIconReader(
mojo::PendingReceiver<chrome::mojom::UtilReadIcon> receiver) {
return std::make_unique<UtilReadIcon>(std::move(receiver));
}
+auto RunWindowsUtility(mojo::PendingReceiver<chrome::mojom::UtilWin> receiver) {
+ return std::make_unique<UtilWinImpl>(std::move(receiver));
+}
#endif
#if BUILDFLAG(ENABLE_PRINTING)
@@ -109,6 +114,7 @@ void ElectronContentUtilityClient::RegisterMainThreadServices(
mojo::ServiceFactory& services) {
#if BUILDFLAG(IS_WIN)
services.Add(RunWindowsIconReader);
+ services.Add(RunWindowsUtility);
#endif
#if BUILDFLAG(ENABLE_PRINTING)
|
refactor
|
b118c70f77e35b145fa201c37b98e9336f3cedd3
|
Shelley Vohr
|
2024-04-17 12:04:47
|
refactor: fold silent print into settings (#41873)
* refactor: fold silent print into settings
* chore: feedback
|
diff --git a/patches/chromium/printing.patch b/patches/chromium/printing.patch
index 2b4cefe8f9..7d60e586cd 100644
--- a/patches/chromium/printing.patch
+++ b/patches/chromium/printing.patch
@@ -91,20 +91,10 @@ index 0d8a53178e8d509a573ffdaadf2c4cec670522ac..8e7f9b92beb317888a5a3acb3bc2fa29
: PdfRenderSettings::Mode::POSTSCRIPT_LEVEL3;
}
diff --git a/chrome/browser/printing/print_view_manager_base.cc b/chrome/browser/printing/print_view_manager_base.cc
-index 261742ba789809e4dc65530fff25554d10c59b75..40a7529c7b069a3b705705354bdb41ec593554a1 100644
+index 261742ba789809e4dc65530fff25554d10c59b75..12bc3f84b0279c9eb2f1fc5cfe5ea1546ba174ca 100644
--- a/chrome/browser/printing/print_view_manager_base.cc
+++ b/chrome/browser/printing/print_view_manager_base.cc
-@@ -25,7 +25,9 @@
- #include "chrome/browser/bad_message.h"
- #include "chrome/browser/browser_process.h"
- #include "chrome/browser/printing/print_compositor_util.h"
-+#if 0 // Electron does not use Chrome error dialogs
- #include "chrome/browser/printing/print_error_dialog.h"
-+#endif
- #include "chrome/browser/printing/print_job.h"
- #include "chrome/browser/printing/print_job_manager.h"
- #include "chrome/browser/printing/print_view_manager_common.h"
-@@ -86,6 +88,20 @@ namespace printing {
+@@ -86,6 +86,20 @@ namespace printing {
namespace {
@@ -125,31 +115,31 @@ index 261742ba789809e4dc65530fff25554d10c59b75..40a7529c7b069a3b705705354bdb41ec
void OnDidGetDefaultPrintSettings(
scoped_refptr<PrintQueriesQueue> queue,
bool want_pdf_settings,
-@@ -94,9 +110,11 @@ void OnDidGetDefaultPrintSettings(
+@@ -94,9 +108,9 @@ void OnDidGetDefaultPrintSettings(
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
if (printer_query->last_status() != mojom::ResultCode::kSuccess) {
-+#if 0 // Electron does not use Chrome error dialogs
- if (!want_pdf_settings) {
+- if (!want_pdf_settings) {
++#if 0 // Electron does not use Chromium error dialogs
ShowPrintErrorDialogForInvalidPrinterError();
- }
+- }
+#endif
std::move(callback).Run(nullptr);
return;
}
-@@ -106,9 +124,11 @@ void OnDidGetDefaultPrintSettings(
+@@ -106,9 +120,9 @@ void OnDidGetDefaultPrintSettings(
params->document_cookie = printer_query->cookie();
if (!PrintMsgPrintParamsIsValid(*params)) {
-+#if 0 // Electron does not use Chrome error dialogs
- if (!want_pdf_settings) {
+- if (!want_pdf_settings) {
++#if 0 // Electron does not use Chromium error dialogs
ShowPrintErrorDialogForInvalidPrinterError();
- }
+- }
+#endif
std::move(callback).Run(nullptr);
return;
}
-@@ -120,11 +140,15 @@ void OnDidGetDefaultPrintSettings(
+@@ -120,11 +134,15 @@ void OnDidGetDefaultPrintSettings(
void OnDidScriptedPrint(
scoped_refptr<PrintQueriesQueue> queue,
std::unique_ptr<PrinterQuery> printer_query,
@@ -166,26 +156,24 @@ index 261742ba789809e4dc65530fff25554d10c59b75..40a7529c7b069a3b705705354bdb41ec
std::move(callback).Run(nullptr);
return;
}
-@@ -181,9 +205,11 @@ PrintViewManagerBase::PrintViewManagerBase(content::WebContents* web_contents)
+@@ -181,9 +199,11 @@ PrintViewManagerBase::PrintViewManagerBase(content::WebContents* web_contents)
: PrintManager(web_contents),
queue_(g_browser_process->print_job_manager()->queue()) {
DCHECK(queue_);
-+#if 0 // Printing is always enabled.
++#if 0
Profile* profile =
Profile::FromBrowserContext(web_contents->GetBrowserContext());
-- printing_enabled_.Init(prefs::kPrintingEnabled, profile->GetPrefs());
-+ printing_enabled_.Init(prefs::kPrintingEnabled, profile->GetPrefs());
+ printing_enabled_.Init(prefs::kPrintingEnabled, profile->GetPrefs());
+#endif
}
PrintViewManagerBase::~PrintViewManagerBase() {
-@@ -207,12 +233,17 @@ void PrintViewManagerBase::DisableThirdPartyBlocking() {
+@@ -207,12 +227,16 @@ void PrintViewManagerBase::DisableThirdPartyBlocking() {
}
#endif // BUILDFLAG(IS_WIN) && BUILDFLAG(GOOGLE_CHROME_BRANDING)
-bool PrintViewManagerBase::PrintNow(content::RenderFrameHost* rfh) {
+bool PrintViewManagerBase::PrintNow(content::RenderFrameHost* rfh,
-+ bool silent,
+ base::Value::Dict settings,
+ CompletionCallback callback) {
if (!StartPrintCommon(rfh)) {
@@ -195,11 +183,11 @@ index 261742ba789809e4dc65530fff25554d10c59b75..40a7529c7b069a3b705705354bdb41ec
- GetPrintRenderFrame(rfh)->PrintRequestedPages();
+ callback_ = std::move(callback);
+
-+ GetPrintRenderFrame(rfh)->PrintRequestedPages(silent, std::move(settings));
++ GetPrintRenderFrame(rfh)->PrintRequestedPages(std::move(settings));
for (auto& observer : GetTestObservers()) {
observer.OnPrintNow(rfh);
-@@ -341,12 +372,13 @@ void PrintViewManagerBase::OnDidUpdatePrintableArea(
+@@ -341,12 +365,13 @@ void PrintViewManagerBase::OnDidUpdatePrintableArea(
}
PRINTER_LOG(EVENT) << "Paper printable area updated for vendor id "
<< print_settings->requested_media().vendor_id;
@@ -214,7 +202,7 @@ index 261742ba789809e4dc65530fff25554d10c59b75..40a7529c7b069a3b705705354bdb41ec
base::Value::Dict job_settings,
std::unique_ptr<PrintSettings> print_settings,
UpdatePrintSettingsCallback callback) {
-@@ -354,7 +386,8 @@ void PrintViewManagerBase::CompleteUpdatePrintSettings(
+@@ -354,7 +379,8 @@ void PrintViewManagerBase::CompleteUpdatePrintSettings(
settings->pages = GetPageRangesFromJobSettings(job_settings);
settings->params = mojom::PrintParams::New();
RenderParamsFromPrintSettings(*print_settings, settings->params.get());
@@ -224,7 +212,7 @@ index 261742ba789809e4dc65530fff25554d10c59b75..40a7529c7b069a3b705705354bdb41ec
if (!PrintMsgPrintParamsIsValid(*settings->params)) {
mojom::PrinterType printer_type = static_cast<mojom::PrinterType>(
*job_settings.FindInt(kSettingPrinterType));
-@@ -366,6 +399,10 @@ void PrintViewManagerBase::CompleteUpdatePrintSettings(
+@@ -366,6 +392,10 @@ void PrintViewManagerBase::CompleteUpdatePrintSettings(
return;
}
@@ -235,49 +223,19 @@ index 261742ba789809e4dc65530fff25554d10c59b75..40a7529c7b069a3b705705354bdb41ec
set_cookie(settings->params->document_cookie);
std::move(callback).Run(std::move(settings));
}
-@@ -652,10 +689,12 @@ void PrintViewManagerBase::DidPrintDocument(
- void PrintViewManagerBase::GetDefaultPrintSettings(
- GetDefaultPrintSettingsCallback callback) {
- DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
-+#if 0 // Printing is always enabled.
- if (!GetPrintingEnabledBooleanPref()) {
- GetDefaultPrintSettingsReply(std::move(callback), nullptr);
- return;
- }
-+#endif
-
- content::RenderFrameHost* render_frame_host = GetCurrentTargetFrame();
- if (base::FeatureList::IsEnabled(kCheckPrintRfhIsActive) &&
-@@ -715,10 +754,12 @@ void PrintViewManagerBase::UpdatePrintSettings(
- base::Value::Dict job_settings,
- UpdatePrintSettingsCallback callback) {
- DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
-+#if 0 // Printing is always enabled.
- if (!GetPrintingEnabledBooleanPref()) {
- std::move(callback).Run(nullptr);
- return;
- }
-+#endif
-
- std::optional<int> printer_type_value =
- job_settings.FindInt(kSettingPrinterType);
-@@ -729,6 +770,7 @@ void PrintViewManagerBase::UpdatePrintSettings(
-
- mojom::PrinterType printer_type =
- static_cast<mojom::PrinterType>(*printer_type_value);
-+#if 0 // Printing is always enabled.
- if (printer_type != mojom::PrinterType::kExtension &&
- printer_type != mojom::PrinterType::kPdf &&
- printer_type != mojom::PrinterType::kLocal) {
-@@ -748,6 +790,7 @@ void PrintViewManagerBase::UpdatePrintSettings(
+@@ -739,10 +769,7 @@ void PrintViewManagerBase::UpdatePrintSettings(
+ // `job_settings` does not yet contain the rasterized PDF dpi, so if the user
+ // has the print preference set, fetch it for use in
+ // `PrintSettingsFromJobSettings()`.
+- content::BrowserContext* context =
+- web_contents() ? web_contents()->GetBrowserContext() : nullptr;
+- PrefService* prefs =
+- context ? Profile::FromBrowserContext(context)->GetPrefs() : nullptr;
++ PrefService* prefs = nullptr;
+ if (prefs && prefs->HasPrefPath(prefs::kPrintRasterizePdfDpi)) {
+ int value = prefs->GetInteger(prefs::kPrintRasterizePdfDpi);
if (value > 0)
- job_settings.Set(kSettingRasterizePdfDpi, value);
- }
-+#endif // Printing is always enabled.
-
- std::unique_ptr<PrintSettings> print_settings =
- PrintSettingsFromJobSettings(job_settings);
-@@ -767,7 +810,21 @@ void PrintViewManagerBase::UpdatePrintSettings(
+@@ -767,7 +794,21 @@ void PrintViewManagerBase::UpdatePrintSettings(
}
}
@@ -300,7 +258,7 @@ index 261742ba789809e4dc65530fff25554d10c59b75..40a7529c7b069a3b705705354bdb41ec
// TODO(crbug.com/1424368): Remove this if the printable areas can be made
// fully available from `PrintBackend::GetPrinterSemanticCapsAndDefaults()`
// for in-browser queries.
-@@ -789,8 +846,6 @@ void PrintViewManagerBase::UpdatePrintSettings(
+@@ -789,8 +830,6 @@ void PrintViewManagerBase::UpdatePrintSettings(
}
#endif
@@ -309,7 +267,7 @@ index 261742ba789809e4dc65530fff25554d10c59b75..40a7529c7b069a3b705705354bdb41ec
}
void PrintViewManagerBase::SetAccessibilityTree(
-@@ -806,7 +861,7 @@ void PrintViewManagerBase::SetAccessibilityTree(
+@@ -806,7 +845,7 @@ void PrintViewManagerBase::SetAccessibilityTree(
void PrintViewManagerBase::IsPrintingEnabled(
IsPrintingEnabledCallback callback) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
@@ -318,24 +276,21 @@ index 261742ba789809e4dc65530fff25554d10c59b75..40a7529c7b069a3b705705354bdb41ec
}
void PrintViewManagerBase::ScriptedPrint(mojom::ScriptedPrintParamsPtr params,
-@@ -857,6 +912,7 @@ void PrintViewManagerBase::PrintingFailed(int32_t cookie,
-
- PrintManager::PrintingFailed(cookie, reason);
-
-+#if 0 // Electron does not use Chromium error dialogs
- // `PrintingFailed()` can occur because asynchronous compositing results
- // don't complete until after a print job has already failed and been
+@@ -862,11 +901,9 @@ void PrintViewManagerBase::PrintingFailed(int32_t cookie,
// destroyed. In such cases the error notification to the user will
-@@ -866,7 +922,7 @@ void PrintViewManagerBase::PrintingFailed(int32_t cookie,
- print_job_->document()->cookie() == cookie) {
+ // have already been displayed, and a second message should not be
+ // shown.
+- if (print_job_ && print_job_->document() &&
+- print_job_->document()->cookie() == cookie) {
++#if 0 // Electron does not use Chromium error dialogs
ShowPrintErrorDialogForGenericError();
- }
+- }
-
+#endif
ReleasePrinterQuery();
}
-@@ -878,15 +934,24 @@ void PrintViewManagerBase::RemoveTestObserver(TestObserver& observer) {
+@@ -878,15 +915,24 @@ void PrintViewManagerBase::RemoveTestObserver(TestObserver& observer) {
test_observers_.RemoveObserver(&observer);
}
@@ -360,7 +315,16 @@ index 261742ba789809e4dc65530fff25554d10c59b75..40a7529c7b069a3b705705354bdb41ec
}
void PrintViewManagerBase::RenderFrameDeleted(
-@@ -942,7 +1007,12 @@ void PrintViewManagerBase::OnJobDone() {
+@@ -925,7 +971,7 @@ void PrintViewManagerBase::SystemDialogCancelled() {
+ #endif
+
+ bool PrintViewManagerBase::GetPrintingEnabledBooleanPref() const {
+- return printing_enabled_.GetValue();
++ return true;
+ }
+
+ void PrintViewManagerBase::OnDocDone(int job_id, PrintedDocument* document) {
+@@ -942,7 +988,12 @@ void PrintViewManagerBase::OnJobDone() {
// Printing is done, we don't need it anymore.
// print_job_->is_job_pending() may still be true, depending on the order
// of object registration.
@@ -374,19 +338,19 @@ index 261742ba789809e4dc65530fff25554d10c59b75..40a7529c7b069a3b705705354bdb41ec
ReleasePrintJob();
}
-@@ -951,9 +1021,10 @@ void PrintViewManagerBase::OnCanceling() {
+@@ -951,9 +1002,9 @@ void PrintViewManagerBase::OnCanceling() {
}
void PrintViewManagerBase::OnFailed() {
+- if (!canceling_job_)
+#if 0 // Electron does not use Chromium error dialogs
- if (!canceling_job_)
ShowPrintErrorDialogForGenericError();
-
+#endif
TerminatePrintJob(true);
}
-@@ -963,7 +1034,7 @@ bool PrintViewManagerBase::RenderAllMissingPagesNow() {
+@@ -963,7 +1014,7 @@ bool PrintViewManagerBase::RenderAllMissingPagesNow() {
// Is the document already complete?
if (print_job_->document() && print_job_->document()->IsComplete()) {
@@ -395,7 +359,7 @@ index 261742ba789809e4dc65530fff25554d10c59b75..40a7529c7b069a3b705705354bdb41ec
return true;
}
-@@ -1016,7 +1087,10 @@ bool PrintViewManagerBase::SetupNewPrintJob(
+@@ -1016,7 +1067,10 @@ bool PrintViewManagerBase::SetupNewPrintJob(
// Disconnect the current `print_job_`.
auto weak_this = weak_ptr_factory_.GetWeakPtr();
@@ -407,7 +371,7 @@ index 261742ba789809e4dc65530fff25554d10c59b75..40a7529c7b069a3b705705354bdb41ec
if (!weak_this)
return false;
-@@ -1036,7 +1110,7 @@ bool PrintViewManagerBase::SetupNewPrintJob(
+@@ -1036,7 +1090,7 @@ bool PrintViewManagerBase::SetupNewPrintJob(
#endif
print_job_->AddObserver(*this);
@@ -416,7 +380,7 @@ index 261742ba789809e4dc65530fff25554d10c59b75..40a7529c7b069a3b705705354bdb41ec
return true;
}
-@@ -1104,6 +1178,11 @@ void PrintViewManagerBase::ReleasePrintJob() {
+@@ -1104,6 +1158,11 @@ void PrintViewManagerBase::ReleasePrintJob() {
}
#endif
@@ -428,7 +392,7 @@ index 261742ba789809e4dc65530fff25554d10c59b75..40a7529c7b069a3b705705354bdb41ec
if (!print_job_)
return;
-@@ -1111,7 +1190,7 @@ void PrintViewManagerBase::ReleasePrintJob() {
+@@ -1111,7 +1170,7 @@ void PrintViewManagerBase::ReleasePrintJob() {
// printing_rfh_ should only ever point to a RenderFrameHost with a live
// RenderFrame.
DCHECK(rfh->IsRenderFrameLive());
@@ -437,7 +401,7 @@ index 261742ba789809e4dc65530fff25554d10c59b75..40a7529c7b069a3b705705354bdb41ec
}
print_job_->RemoveObserver(*this);
-@@ -1153,7 +1232,7 @@ bool PrintViewManagerBase::RunInnerMessageLoop() {
+@@ -1153,7 +1212,7 @@ bool PrintViewManagerBase::RunInnerMessageLoop() {
}
bool PrintViewManagerBase::OpportunisticallyCreatePrintJob(int cookie) {
@@ -446,7 +410,7 @@ index 261742ba789809e4dc65530fff25554d10c59b75..40a7529c7b069a3b705705354bdb41ec
return true;
if (!cookie) {
-@@ -1307,6 +1386,8 @@ void PrintViewManagerBase::CompleteScriptedPrint(
+@@ -1307,6 +1366,8 @@ void PrintViewManagerBase::CompleteScriptedPrint(
auto callback_wrapper = base::BindOnce(
&PrintViewManagerBase::ScriptedPrintReply, weak_ptr_factory_.GetWeakPtr(),
std::move(callback), render_process_host->GetID());
@@ -455,7 +419,7 @@ index 261742ba789809e4dc65530fff25554d10c59b75..40a7529c7b069a3b705705354bdb41ec
#if BUILDFLAG(IS_WIN) && BUILDFLAG(GOOGLE_CHROME_BRANDING)
DisableThirdPartyBlocking();
#endif
-@@ -1321,7 +1402,7 @@ void PrintViewManagerBase::CompleteScriptedPrint(
+@@ -1321,7 +1382,7 @@ void PrintViewManagerBase::CompleteScriptedPrint(
params->expected_pages_count, params->has_selection, params->margin_type,
params->is_scripted, !render_process_host->IsPdf(),
base::BindOnce(&OnDidScriptedPrint, queue_, std::move(printer_query),
@@ -465,7 +429,7 @@ index 261742ba789809e4dc65530fff25554d10c59b75..40a7529c7b069a3b705705354bdb41ec
#if BUILDFLAG(ENABLE_PRINT_CONTENT_ANALYSIS)
diff --git a/chrome/browser/printing/print_view_manager_base.h b/chrome/browser/printing/print_view_manager_base.h
-index 43e353663b9b6be478a9418752dc189118b7fa58..c52ba4328c2f41c8d4233eecb96b864e0a1b7979 100644
+index 43e353663b9b6be478a9418752dc189118b7fa58..a751bdfeac3a7072114420cb5d93b2732a79696f 100644
--- a/chrome/browser/printing/print_view_manager_base.h
+++ b/chrome/browser/printing/print_view_manager_base.h
@@ -51,6 +51,8 @@ class PrinterQuery;
@@ -477,19 +441,18 @@ index 43e353663b9b6be478a9418752dc189118b7fa58..c52ba4328c2f41c8d4233eecb96b864e
// Base class for managing the print commands for a WebContents.
class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
public:
-@@ -84,7 +86,10 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
+@@ -84,7 +86,9 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
// Prints the current document immediately. Since the rendering is
// asynchronous, the actual printing will not be completed on the return of
// this function. Returns false if printing is impossible at the moment.
- virtual bool PrintNow(content::RenderFrameHost* rfh);
+ virtual bool PrintNow(content::RenderFrameHost* rfh,
-+ bool silent = true,
+ base::Value::Dict settings = {},
+ CompletionCallback callback = {});
// Like PrintNow(), but for the node under the context menu, instead of the
// entire frame.
-@@ -138,8 +143,10 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
+@@ -138,8 +142,10 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
void IsPrintingEnabled(IsPrintingEnabledCallback callback) override;
void ScriptedPrint(mojom::ScriptedPrintParamsPtr params,
ScriptedPrintCallback callback) override;
@@ -500,7 +463,7 @@ index 43e353663b9b6be478a9418752dc189118b7fa58..c52ba4328c2f41c8d4233eecb96b864e
// Adds and removes observers for `PrintViewManagerBase` events. The order in
// which notifications are sent to observers is undefined. Observers must be
-@@ -147,6 +154,14 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
+@@ -147,6 +153,14 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
void AddTestObserver(TestObserver& observer);
void RemoveTestObserver(TestObserver& observer);
@@ -515,7 +478,7 @@ index 43e353663b9b6be478a9418752dc189118b7fa58..c52ba4328c2f41c8d4233eecb96b864e
protected:
#if BUILDFLAG(ENABLE_PRINT_CONTENT_ANALYSIS)
using PrintDocumentCallback =
-@@ -290,6 +305,7 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
+@@ -290,6 +304,7 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
bool success);
#endif
void CompleteUpdatePrintSettings(
@@ -523,7 +486,7 @@ index 43e353663b9b6be478a9418752dc189118b7fa58..c52ba4328c2f41c8d4233eecb96b864e
base::Value::Dict job_settings,
std::unique_ptr<PrintSettings> print_settings,
UpdatePrintSettingsCallback callback);
-@@ -384,8 +400,11 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
+@@ -384,8 +399,11 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
// The current RFH that is printing with a system printing dialog.
raw_ptr<content::RenderFrameHost> printing_rfh_ = nullptr;
@@ -564,32 +527,6 @@ index 0e48a7582d86c85a826de08af655b29a3ef74fd2..2e67a73611ca2c55ffc002341b0878de
}
#if BUILDFLAG(IS_CHROMEOS)
-diff --git a/chrome/browser/ui/webui/print_preview/fake_print_render_frame.cc b/chrome/browser/ui/webui/print_preview/fake_print_render_frame.cc
-index ac54519f611f719470c4b7a139a58f489884ede2..89055b6df74389560b6c5884a511897a36425b7b 100644
---- a/chrome/browser/ui/webui/print_preview/fake_print_render_frame.cc
-+++ b/chrome/browser/ui/webui/print_preview/fake_print_render_frame.cc
-@@ -21,7 +21,7 @@ FakePrintRenderFrame::FakePrintRenderFrame(
-
- FakePrintRenderFrame::~FakePrintRenderFrame() = default;
-
--void FakePrintRenderFrame::PrintRequestedPages() {}
-+void FakePrintRenderFrame::PrintRequestedPages(bool /*silent*/, ::base::Value::Dict /*settings*/) {}
-
- void FakePrintRenderFrame::PrintWithParams(mojom::PrintPagesParamsPtr params,
- PrintWithParamsCallback callback) {
-diff --git a/chrome/browser/ui/webui/print_preview/fake_print_render_frame.h b/chrome/browser/ui/webui/print_preview/fake_print_render_frame.h
-index 1e8f7bedaf679ee19788bf181b33e5d574d1f863..8be77b57580621bf659a6a2a63a2be94a2301c70 100644
---- a/chrome/browser/ui/webui/print_preview/fake_print_render_frame.h
-+++ b/chrome/browser/ui/webui/print_preview/fake_print_render_frame.h
-@@ -25,7 +25,7 @@ class FakePrintRenderFrame : public mojom::PrintRenderFrame {
-
- private:
- // printing::mojom::PrintRenderFrame:
-- void PrintRequestedPages() override;
-+ void PrintRequestedPages(bool silent, ::base::Value::Dict settings) override;
- void PrintWithParams(mojom::PrintPagesParamsPtr params,
- PrintWithParamsCallback callback) override;
- void PrintForSystemDialog() override;
diff --git a/components/printing/browser/print_manager.cc b/components/printing/browser/print_manager.cc
index 21c81377d32ae8d4185598a7eba88ed1d2063ef0..0767f4e9369e926b1cea99178c1a1975941f1765 100644
--- a/components/printing/browser/print_manager.cc
@@ -616,7 +553,7 @@ index ca71560874a0189068dd11fbc039f5673bf6bd96..a8551d95e64da2afbc1685b2df8f1fc3
mojom::PrintFailureReason reason) override;
diff --git a/components/printing/common/print.mojom b/components/printing/common/print.mojom
-index 4ecdb28904fac480cf102fffdff24ae008ac88cf..e8150c95fafd83d7e2fe1f472a35acec3ca6e391 100644
+index 4ecdb28904fac480cf102fffdff24ae008ac88cf..0d7d20c1a7920b1961585b345d30d9969411ca9e 100644
--- a/components/printing/common/print.mojom
+++ b/components/printing/common/print.mojom
@@ -302,7 +302,7 @@ union PrintWithParamsResult {
@@ -624,7 +561,7 @@ index 4ecdb28904fac480cf102fffdff24ae008ac88cf..e8150c95fafd83d7e2fe1f472a35acec
// Tells the RenderFrame to switch the CSS to print media type, render every
// requested page, and then switch back the CSS to display media type.
- PrintRequestedPages();
-+ PrintRequestedPages(bool silent, mojo_base.mojom.DictionaryValue settings);
++ PrintRequestedPages(mojo_base.mojom.DictionaryValue settings);
// Requests the frame to be printed with specified parameters. This is used
// to programmatically produce PDF by request from the browser (e.g. over
@@ -639,7 +576,7 @@ index 4ecdb28904fac480cf102fffdff24ae008ac88cf..e8150c95fafd83d7e2fe1f472a35acec
PrintingFailed(int32 cookie, PrintFailureReason reason);
diff --git a/components/printing/renderer/print_render_frame_helper.cc b/components/printing/renderer/print_render_frame_helper.cc
-index 5df31ec780ae5388b431e6fd63cee5de705a177a..ed520b130544a3854c4dcf98b04ada0cc2a14587 100644
+index 5df31ec780ae5388b431e6fd63cee5de705a177a..9a7d340b38124b2557b43efb12f1d110c230de8f 100644
--- a/components/printing/renderer/print_render_frame_helper.cc
+++ b/components/printing/renderer/print_render_frame_helper.cc
@@ -47,6 +47,7 @@
@@ -663,7 +600,7 @@ index 5df31ec780ae5388b431e6fd63cee5de705a177a..ed520b130544a3854c4dcf98b04ada0c
- Print(web_frame, blink::WebNode(), PrintRequestType::kScripted);
+ Print(web_frame, blink::WebNode(), PrintRequestType::kScripted,
-+ false /* silent */, base::Value::Dict() /* new_settings */);
++ base::Value::Dict());
if (!weak_this) {
return;
}
@@ -672,7 +609,7 @@ index 5df31ec780ae5388b431e6fd63cee5de705a177a..ed520b130544a3854c4dcf98b04ada0c
}
-void PrintRenderFrameHelper::PrintRequestedPages() {
-+void PrintRenderFrameHelper::PrintRequestedPages(bool silent, base::Value::Dict settings) {
++void PrintRenderFrameHelper::PrintRequestedPages(base::Value::Dict settings) {
ScopedIPC scoped_ipc(weak_ptr_factory_.GetWeakPtr());
if (ipc_nesting_level_ > kAllowedIpcDepthForPrint)
return;
@@ -681,21 +618,11 @@ index 5df31ec780ae5388b431e6fd63cee5de705a177a..ed520b130544a3854c4dcf98b04ada0c
auto plugin = delegate_->GetPdfElement(frame);
- Print(frame, plugin, PrintRequestType::kRegular);
-+ Print(frame, plugin, PrintRequestType::kRegular, silent, std::move(settings));
-
- if (render_frame_gone_) {
- return;
-@@ -1373,7 +1374,8 @@ void PrintRenderFrameHelper::PrintForSystemDialog() {
- }
++ Print(frame, plugin, PrintRequestType::kRegular, std::move(settings));
- Print(frame, print_preview_context_.source_node(),
-- PrintRequestType::kRegular);
-+ PrintRequestType::kRegular, false,
-+ base::Value::Dict());
if (render_frame_gone_) {
return;
- }
-@@ -1436,6 +1438,8 @@ void PrintRenderFrameHelper::PrintPreview(base::Value::Dict settings) {
+@@ -1436,6 +1437,8 @@ void PrintRenderFrameHelper::PrintPreview(base::Value::Dict settings) {
if (ipc_nesting_level_ > kAllowedIpcDepthForPrint)
return;
@@ -704,28 +631,18 @@ index 5df31ec780ae5388b431e6fd63cee5de705a177a..ed520b130544a3854c4dcf98b04ada0c
print_preview_context_.OnPrintPreview();
#if BUILDFLAG(IS_CHROMEOS_ASH)
-@@ -2013,7 +2017,8 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) {
- }
-
- Print(duplicate_node.GetDocument().GetFrame(), duplicate_node,
-- PrintRequestType::kRegular);
-+ PrintRequestType::kRegular, false /* silent */,
-+ base::Value::Dict() /* new_settings */);
- // Check if `this` is still valid.
- if (!weak_this) {
- return;
-@@ -2029,17 +2034,19 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) {
+@@ -2029,17 +2032,19 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) {
void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame,
const blink::WebNode& node,
- PrintRequestType print_request_type) {
+ PrintRequestType print_request_type,
-+ bool silent,
+ base::Value::Dict settings) {
// If still not finished with earlier print request simply ignore.
if (prep_frame_view_)
return;
++ bool silent = settings.FindBool("silent").value_or(false);
FrameReference frame_ref(frame);
- if (!InitPrintSettings(frame, node)) {
@@ -737,7 +654,7 @@ index 5df31ec780ae5388b431e6fd63cee5de705a177a..ed520b130544a3854c4dcf98b04ada0c
DidFinishPrinting(PrintingResult::kFailPrintInit);
return;
}
-@@ -2060,8 +2067,15 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame,
+@@ -2060,8 +2065,15 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame,
print_pages_params_->params->print_scaling_option;
auto self = weak_ptr_factory_.GetWeakPtr();
@@ -754,7 +671,7 @@ index 5df31ec780ae5388b431e6fd63cee5de705a177a..ed520b130544a3854c4dcf98b04ada0c
// Check if `this` is still valid.
if (!self)
return;
-@@ -2319,25 +2333,33 @@ void PrintRenderFrameHelper::IPCProcessed() {
+@@ -2319,25 +2331,33 @@ void PrintRenderFrameHelper::IPCProcessed() {
}
bool PrintRenderFrameHelper::InitPrintSettings(blink::WebLocalFrame* frame,
@@ -795,7 +712,7 @@ index 5df31ec780ae5388b431e6fd63cee5de705a177a..ed520b130544a3854c4dcf98b04ada0c
}
diff --git a/components/printing/renderer/print_render_frame_helper.h b/components/printing/renderer/print_render_frame_helper.h
-index b0ac94751454bd16b4e9bfdc071e2623813133ec..271bd9949a802a370b3619340f3364df14c7fe4a 100644
+index b0ac94751454bd16b4e9bfdc071e2623813133ec..2631e9019e4c6617e2a8a90d30a21ca5552f1d67 100644
--- a/components/printing/renderer/print_render_frame_helper.h
+++ b/components/printing/renderer/print_render_frame_helper.h
@@ -245,7 +245,7 @@ class PrintRenderFrameHelper
@@ -803,22 +720,21 @@ index b0ac94751454bd16b4e9bfdc071e2623813133ec..271bd9949a802a370b3619340f3364df
// printing::mojom::PrintRenderFrame:
- void PrintRequestedPages() override;
-+ void PrintRequestedPages(bool silent, base::Value::Dict settings) override;
++ void PrintRequestedPages(base::Value::Dict settings) override;
void PrintWithParams(mojom::PrintPagesParamsPtr params,
PrintWithParamsCallback callback) override;
#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
-@@ -312,7 +312,9 @@ class PrintRenderFrameHelper
+@@ -312,7 +312,8 @@ class PrintRenderFrameHelper
// WARNING: |this| may be gone after this method returns.
void Print(blink::WebLocalFrame* frame,
const blink::WebNode& node,
- PrintRequestType print_request_type);
+ PrintRequestType print_request_type,
-+ bool silent,
-+ base::Value::Dict settings);
++ base::Value::Dict settings = {});
// Notification when printing is done - signal tear-down/free resources.
void DidFinishPrinting(PrintingResult result);
-@@ -322,7 +324,8 @@ class PrintRenderFrameHelper
+@@ -322,7 +323,8 @@ class PrintRenderFrameHelper
// Initialize print page settings with default settings.
// Used only for native printing workflow.
bool InitPrintSettings(blink::WebLocalFrame* frame,
diff --git a/shell/browser/api/electron_api_web_contents.cc b/shell/browser/api/electron_api_web_contents.cc
index 1c18e9f0b3..50e2d77540 100644
--- a/shell/browser/api/electron_api_web_contents.cc
+++ b/shell/browser/api/electron_api_web_contents.cc
@@ -2865,7 +2865,6 @@ bool WebContents::IsCurrentlyAudible() {
void WebContents::OnGetDeviceNameToUse(
base::Value::Dict print_settings,
printing::CompletionCallback print_callback,
- bool silent,
// <error, device_name>
std::pair<std::string, std::u16string> info) {
// The content::WebContents might be already deleted at this point, and the
@@ -2901,7 +2900,7 @@ void WebContents::OnGetDeviceNameToUse(
? focused_frame
: web_contents()->GetPrimaryMainFrame();
- print_view_manager->PrintNow(rfh, silent, std::move(print_settings),
+ print_view_manager->PrintNow(rfh, std::move(print_settings),
std::move(print_callback));
}
@@ -2922,9 +2921,10 @@ void WebContents::Print(gin::Arguments* args) {
return;
}
- // Set optional silent printing
+ // Set optional silent printing.
bool silent = false;
options.Get("silent", &silent);
+ settings.Set("silent", silent);
bool print_background = false;
options.Get("printBackground", &print_background);
@@ -3065,7 +3065,7 @@ void WebContents::Print(gin::Arguments* args) {
FROM_HERE, base::BindOnce(&GetDeviceNameToUse, device_name),
base::BindOnce(&WebContents::OnGetDeviceNameToUse,
weak_factory_.GetWeakPtr(), std::move(settings),
- std::move(callback), silent));
+ std::move(callback)));
}
// Partially duplicated and modified from
diff --git a/shell/browser/api/electron_api_web_contents.h b/shell/browser/api/electron_api_web_contents.h
index d074fec80e..f2aeab11c9 100644
--- a/shell/browser/api/electron_api_web_contents.h
+++ b/shell/browser/api/electron_api_web_contents.h
@@ -237,7 +237,6 @@ class WebContents : public ExclusiveAccessContext,
#if BUILDFLAG(ENABLE_PRINTING)
void OnGetDeviceNameToUse(base::Value::Dict print_settings,
printing::CompletionCallback print_callback,
- bool silent,
// <error, device_name>
std::pair<std::string, std::u16string> info);
void Print(gin::Arguments* args);
|
refactor
|
fdab0799fedbb61db31c73d4f56b03347d353e36
|
Milan Burda
|
2023-02-16 01:29:02
|
docs: only macOS 10.13+ is supported now (#37286)
Co-authored-by: Milan Burda <[email protected]>
|
diff --git a/docs/api/browser-window.md b/docs/api/browser-window.md
index a60ad91b16..73f40824fa 100644
--- a/docs/api/browser-window.md
+++ b/docs/api/browser-window.md
@@ -269,7 +269,7 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
zoom to the width of the screen. This will also affect the behavior when
calling `maximize()` directly. Default is `false`.
* `tabbingIdentifier` string (optional) _macOS_ - Tab group name, allows
- opening the window as a native tab on macOS 10.12+. Windows with the same
+ opening the window as a native tab. Windows with the same
tabbing identifier will be grouped together. This also adds a native new
tab button to your window's tab bar and allows your `app` and window to
receive the `new-window-for-tab` event.
@@ -1859,7 +1859,7 @@ frameless window.
Sets the touchBar layout for the current window. Specifying `null` or
`undefined` clears the touch bar. This method only has an effect if the
-machine has a touch bar and is running on macOS 10.12.1+.
+machine has a touch bar.
**Note:** The TouchBar API is currently experimental and may change or be
removed in future Electron releases.
diff --git a/docs/api/menu-item.md b/docs/api/menu-item.md
index 53a7528f49..eda52087fc 100644
--- a/docs/api/menu-item.md
+++ b/docs/api/menu-item.md
@@ -51,7 +51,7 @@ See [`Menu`](menu.md) for examples.
the placement of their containing group after the containing group of the item
with the specified label.
-**Note:** `acceleratorWorksWhenHidden` is specified as being macOS-only because accelerators always work when items are hidden on Windows and Linux. The option is exposed to users to give them the option to turn it off, as this is possible in native macOS development. This property is only usable on macOS High Sierra 10.13 or newer.
+**Note:** `acceleratorWorksWhenHidden` is specified as being macOS-only because accelerators always work when items are hidden on Windows and Linux. The option is exposed to users to give them the option to turn it off, as this is possible in native macOS development.
### Roles
diff --git a/docs/api/system-preferences.md b/docs/api/system-preferences.md
index 1361865ff3..f64fb9c620 100644
--- a/docs/api/system-preferences.md
+++ b/docs/api/system-preferences.md
@@ -394,8 +394,6 @@ system default and override the value of `getEffectiveAppearance`.
Returns `boolean` - whether or not this device has the ability to use Touch ID.
-**NOTE:** This API will return `false` on macOS systems older than Sierra 10.12.2.
-
### `systemPreferences.promptTouchID(reason)` _macOS_
* `reason` string - The reason you are asking for Touch ID authentication
@@ -414,8 +412,6 @@ systemPreferences.promptTouchID('To get consent for a Security-Gated Thing').the
This API itself will not protect your user data; rather, it is a mechanism to allow you to do so. Native apps will need to set [Access Control Constants](https://developer.apple.com/documentation/security/secaccesscontrolcreateflags?language=objc) like [`kSecAccessControlUserPresence`](https://developer.apple.com/documentation/security/secaccesscontrolcreateflags/ksecaccesscontroluserpresence?language=objc) on their keychain entry so that reading it would auto-prompt for Touch ID biometric consent. This could be done with [`node-keytar`](https://github.com/atom/node-keytar), such that one would store an encryption key with `node-keytar` and only fetch it if `promptTouchID()` resolves.
-**NOTE:** This API will return a rejected Promise on macOS systems older than Sierra 10.12.2.
-
### `systemPreferences.isTrustedAccessibilityClient(prompt)` _macOS_
* `prompt` boolean - whether or not the user will be informed via prompt if the current process is untrusted.
@@ -428,7 +424,7 @@ Returns `boolean` - `true` if the current process is a trusted accessibility cli
Returns `string` - Can be `not-determined`, `granted`, `denied`, `restricted` or `unknown`.
-This user consent was not required on macOS 10.13 High Sierra or lower so this method will always return `granted`.
+This user consent was not required on macOS 10.13 High Sierra so this method will always return `granted`.
macOS 10.14 Mojave or higher requires consent for `microphone` and `camera` access.
macOS 10.15 Catalina or higher requires consent for `screen` access.
@@ -443,7 +439,7 @@ Returns `Promise<boolean>` - A promise that resolves with `true` if consent was
**Important:** In order to properly leverage this API, you [must set](https://developer.apple.com/documentation/avfoundation/cameras_and_media_capture/requesting_authorization_for_media_capture_on_macos?language=objc) the `NSMicrophoneUsageDescription` and `NSCameraUsageDescription` strings in your app's `Info.plist` file. The values for these keys will be used to populate the permission dialogs so that the user will be properly informed as to the purpose of the permission request. See [Electron Application Distribution](../tutorial/application-distribution.md#rebranding-with-downloaded-binaries) for more information about how to set these in the context of Electron.
-This user consent was not required until macOS 10.14 Mojave, so this method will always return `true` if your system is running 10.13 High Sierra or lower.
+This user consent was not required until macOS 10.14 Mojave, so this method will always return `true` if your system is running 10.13 High Sierra.
### `systemPreferences.getAnimationSettings()`
diff --git a/docs/api/tray.md b/docs/api/tray.md
index 2514931dd0..e531778ba0 100644
--- a/docs/api/tray.md
+++ b/docs/api/tray.md
@@ -235,7 +235,7 @@ Sets the hover text for this tray icon.
* `title` string
* `options` Object (optional)
- * `fontType` string (optional) - The font family variant to display, can be `monospaced` or `monospacedDigit`. `monospaced` is available in macOS 10.15+ and `monospacedDigit` is available in macOS 10.11+. When left blank, the title uses the default system font.
+ * `fontType` string (optional) - The font family variant to display, can be `monospaced` or `monospacedDigit`. `monospaced` is available in macOS 10.15+ When left blank, the title uses the default system font.
Sets the title displayed next to the tray icon in the status bar (Support ANSI colors).
diff --git a/docs/breaking-changes.md b/docs/breaking-changes.md
index 222da60c90..5449a4b60a 100644
--- a/docs/breaking-changes.md
+++ b/docs/breaking-changes.md
@@ -236,6 +236,13 @@ webContents.printToPDF({
## Planned Breaking API Changes (20.0)
+### Removed: macOS 10.11 / 10.12 support
+
+macOS 10.11 (El Capitan) and macOS 10.12 (Sierra) are no longer supported by [Chromium](https://chromium-review.googlesource.com/c/chromium/src/+/3646050).
+
+Older versions of Electron will continue to run on these operating systems, but macOS 10.13 (High Sierra)
+or later will be required to run Electron v20.0.0 and higher.
+
### Default Changed: renderers without `nodeIntegration: true` are sandboxed by default
Previously, renderers that specified a preload script defaulted to being
|
docs
|
7cd23a4900642c5f2eb83c1fd5af42da20e05102
|
Charles Kerr
|
2024-02-20 06:29:11
|
perf: omit unnecessary work from `ElectronRenderFrameObserver::ShouldNotifyClient()` (#41347)
perf: omit unnecessary work from ElectronRenderFrameObserver::ShouldNotifyClient()
- (perf) GetBlinkPreferences() returns a const&, so we can use that
reference instead of making a temporary copy
- (perf) Don't create url object unless it's needed.
- (refactor) Move is_main_world() and is_isolated_world() from the
header into an anonymous namespace in the .cc file so they can
be inlined and made constexpr
|
diff --git a/shell/renderer/electron_render_frame_observer.cc b/shell/renderer/electron_render_frame_observer.cc
index 0f321f9adf..5423b18018 100644
--- a/shell/renderer/electron_render_frame_observer.cc
+++ b/shell/renderer/electron_render_frame_observer.cc
@@ -47,6 +47,14 @@ scoped_refptr<base::RefCountedMemory> NetResourceProvider(int key) {
return nullptr;
}
+[[nodiscard]] constexpr bool is_main_world(int world_id) {
+ return world_id == WorldIDs::MAIN_WORLD_ID;
+}
+
+[[nodiscard]] constexpr bool is_isolated_world(int world_id) {
+ return world_id == WorldIDs::ISOLATED_WORLD_ID;
+}
+
} // namespace
ElectronRenderFrameObserver::ElectronRenderFrameObserver(
@@ -130,7 +138,7 @@ void ElectronRenderFrameObserver::DidInstallConditionalFeatures(
// This logic matches the EXPLAINED logic in electron_renderer_client.cc
// to avoid explaining it twice go check that implementation in
// DidCreateScriptContext();
- bool is_main_world = IsMainWorld(world_id);
+ bool is_main_world = electron::is_main_world(world_id);
bool is_main_frame = render_frame_->IsMainFrame();
bool allow_node_in_sub_frames = prefs.node_integration_in_sub_frames;
@@ -204,16 +212,8 @@ void ElectronRenderFrameObserver::CreateIsolatedWorldContext() {
blink::BackForwardCacheAware::kPossiblyDisallow);
}
-bool ElectronRenderFrameObserver::IsMainWorld(int world_id) {
- return world_id == WorldIDs::MAIN_WORLD_ID;
-}
-
-bool ElectronRenderFrameObserver::IsIsolatedWorld(int world_id) {
- return world_id == WorldIDs::ISOLATED_WORLD_ID;
-}
-
-bool ElectronRenderFrameObserver::ShouldNotifyClient(int world_id) {
- auto prefs = render_frame_->GetBlinkPreferences();
+bool ElectronRenderFrameObserver::ShouldNotifyClient(int world_id) const {
+ const auto& prefs = render_frame_->GetBlinkPreferences();
// This is necessary because if an iframe is created and a source is not
// set, the iframe loads about:blank and creates a script context for the
@@ -221,17 +221,17 @@ bool ElectronRenderFrameObserver::ShouldNotifyClient(int world_id) {
// is later set, the JS necessary to do that triggers illegal access errors
// when the initial about:blank Node.js environment is cleaned up. See:
// https://source.chromium.org/chromium/chromium/src/+/main:content/renderer/render_frame_impl.h;l=870-892;drc=4b6001440a18740b76a1c63fa2a002cc941db394
- GURL url = render_frame_->GetWebFrame()->GetDocument().Url();
- bool allow_node_in_sub_frames = prefs.node_integration_in_sub_frames;
- if (allow_node_in_sub_frames && url.IsAboutBlank() &&
- !render_frame_->IsMainFrame())
- return false;
+ const bool allow_node_in_sub_frames = prefs.node_integration_in_sub_frames;
+ if (allow_node_in_sub_frames && !render_frame_->IsMainFrame()) {
+ if (GURL{render_frame_->GetWebFrame()->GetDocument().Url()}.IsAboutBlank())
+ return false;
+ }
if (prefs.context_isolation &&
(render_frame_->IsMainFrame() || allow_node_in_sub_frames))
- return IsIsolatedWorld(world_id);
+ return is_isolated_world(world_id);
- return IsMainWorld(world_id);
+ return is_main_world(world_id);
}
} // namespace electron
diff --git a/shell/renderer/electron_render_frame_observer.h b/shell/renderer/electron_render_frame_observer.h
index b7a3718172..408d316cab 100644
--- a/shell/renderer/electron_render_frame_observer.h
+++ b/shell/renderer/electron_render_frame_observer.h
@@ -37,10 +37,9 @@ class ElectronRenderFrameObserver : public content::RenderFrameObserver {
void DidMeaningfulLayout(blink::WebMeaningfulLayout layout_type) override;
private:
- bool ShouldNotifyClient(int world_id);
+ [[nodiscard]] bool ShouldNotifyClient(int world_id) const;
+
void CreateIsolatedWorldContext();
- bool IsMainWorld(int world_id);
- bool IsIsolatedWorld(int world_id);
void OnTakeHeapSnapshot(IPC::PlatformFileForTransit file_handle,
const std::string& channel);
|
perf
|
da6ab9235391966a3a82ae9e23e33956b26b9d1c
|
Shelley Vohr
|
2024-09-26 16:54:13
|
fix: ensure correct `WebContents` when checking `PDFReadyToPrint` (#43943)
* fix: ensure correct WebContents when checking PDFReadyToPrint
* test: fix paths on Windows
|
diff --git a/shell/browser/electron_pdf_document_helper_client.cc b/shell/browser/electron_pdf_document_helper_client.cc
index 6a66f6d067..6ee4576169 100644
--- a/shell/browser/electron_pdf_document_helper_client.cc
+++ b/shell/browser/electron_pdf_document_helper_client.cc
@@ -27,13 +27,23 @@ void ElectronPDFDocumentHelperClient::UpdateContentRestrictions(
// allowed there won't be a printing restriction passed, so we can use this
// second call to notify that the pdf document is ready to print.
if (!(content_restrictions & chrome_pdf::kContentRestrictionPrint)) {
- content::WebContents* web_contents =
- content::WebContents::FromRenderFrameHost(render_frame_host);
- electron::api::WebContents* api_web_contents =
- electron::api::WebContents::From(
- web_contents->GetOutermostWebContents());
- if (api_web_contents) {
- api_web_contents->PDFReadyToPrint();
+ // It's a WebView - emit the event on the WebView webContents.
+ auto* guest_view = extensions::MimeHandlerViewGuest::FromRenderFrameHost(
+ render_frame_host);
+ if (guest_view) {
+ auto* gv_api_wc =
+ electron::api::WebContents::From(guest_view->embedder_web_contents());
+ if (gv_api_wc)
+ gv_api_wc->PDFReadyToPrint();
+ return;
+ }
+
+ auto* wc = content::WebContents::FromRenderFrameHost(render_frame_host);
+ if (wc) {
+ auto* api_wc =
+ electron::api::WebContents::From(wc->GetOuterWebContents());
+ if (api_wc)
+ api_wc->PDFReadyToPrint();
}
}
}
diff --git a/spec/api-web-contents-spec.ts b/spec/api-web-contents-spec.ts
index 5155642813..42764b66a8 100644
--- a/spec/api-web-contents-spec.ts
+++ b/spec/api-web-contents-spec.ts
@@ -5,6 +5,7 @@ import * as path from 'node:path';
import * as fs from 'node:fs';
import * as http from 'node:http';
import * as os from 'node:os';
+import * as url from 'node:url';
import { BrowserWindow, ipcMain, webContents, session, app, BrowserView, WebContents } from 'electron/main';
import { closeAllWindows } from './lib/window-helpers';
import { ifdescribe, defer, waitUntil, listen, ifit } from './lib/spec-helpers';
@@ -12,7 +13,6 @@ import { once } from 'node:events';
import { setTimeout } from 'node:timers/promises';
const fixturesPath = path.resolve(__dirname, 'fixtures');
-const mainFixturesPath = path.resolve(__dirname, 'fixtures');
const features = process._linkedBinding('electron_common_features');
describe('webContents module', () => {
@@ -1185,7 +1185,7 @@ describe('webContents module', () => {
}).to.throw('\'icon\' parameter is required');
expect(() => {
- w.webContents.startDrag({ file: __filename, icon: path.join(mainFixturesPath, 'blank.png') });
+ w.webContents.startDrag({ file: __filename, icon: path.join(fixturesPath, 'blank.png') });
}).to.throw(/Failed to load image from path (.+)/);
});
});
@@ -2496,6 +2496,43 @@ describe('webContents module', () => {
expect(pdfInfo.numPages).to.equal(2);
expect(containsText(pdfInfo.textContent, /Cat: The Ideal Pet/)).to.be.true();
});
+
+ it('from an existing pdf document in a WebView', async () => {
+ const win = new BrowserWindow({
+ show: false,
+ webPreferences: {
+ webviewTag: true
+ }
+ });
+
+ await win.loadURL('about:blank');
+ const webContentsCreated = once(app, 'web-contents-created') as Promise<[any, WebContents]>;
+
+ const src = url.format({
+ pathname: `${fixturesPath.replaceAll('\\', '/')}/cat.pdf`,
+ protocol: 'file',
+ slashes: true
+ });
+ await win.webContents.executeJavaScript(`
+ new Promise((resolve, reject) => {
+ const webview = new WebView()
+ webview.setAttribute('src', '${src}')
+ document.body.appendChild(webview)
+ webview.addEventListener('did-finish-load', () => {
+ resolve()
+ })
+ })
+ `);
+
+ const [, webContents] = await webContentsCreated;
+
+ await once(webContents, '-pdf-ready-to-print');
+
+ const data = await webContents.printToPDF({});
+ const pdfInfo = await readPDF(data);
+ expect(pdfInfo.numPages).to.equal(2);
+ expect(containsText(pdfInfo.textContent, /Cat: The Ideal Pet/)).to.be.true();
+ });
});
describe('PictureInPicture video', () => {
|
fix
|
84e15e2d045635b0113fcedc0ca61ee2d72770f4
|
Shelley Vohr
|
2024-06-07 19:05:15
|
build: Azure CLI install step not needed (#42410)
|
diff --git a/.github/workflows/macos-build.yml b/.github/workflows/macos-build.yml
index 66b5bbab9c..5df6fcf7a0 100644
--- a/.github/workflows/macos-build.yml
+++ b/.github/workflows/macos-build.yml
@@ -54,8 +54,6 @@ jobs:
with:
path: src/electron
fetch-depth: 0
- - name: Install Azure CLI
- run: sudo bash ./src/electron/script/azure_cli_deb_install.sh
- name: Set GIT_CACHE_PATH to make gclient to use the cache
run: |
echo "GIT_CACHE_PATH=$(pwd)/git-cache" >> $GITHUB_ENV
@@ -211,9 +209,6 @@ jobs:
with:
path: src/electron
fetch-depth: 0
- - name: Install Azure CLI
- run: |
- brew update && brew install azure-cli
- name: Setup Node.js/npm
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8
with:
diff --git a/script/azure_cli_deb_install.sh b/script/azure_cli_deb_install.sh
deleted file mode 100755
index b10ce2cc98..0000000000
--- a/script/azure_cli_deb_install.sh
+++ /dev/null
@@ -1,91 +0,0 @@
-#!/usr/bin/env bash
-
-#######################################################################################################################
-# This script does three fundamental things: #
-# 1. Add Microsoft's GPG Key has a trusted source of apt packages. #
-# 2. Add Microsoft's repositories as a source for apt packages. #
-# 3. Installs the Azure CLI from those repositories. #
-# Given the nature of this script, it must be executed with elevated privileges, i.e. with `sudo`. #
-# #
-# Copied from https://azurecliprod.blob.core.windows.net/$root/deb_install.sh #
-#######################################################################################################################
-
-set -e
-
-if [[ $# -ge 1 && $1 == "-y" ]]; then
- global_consent=0
-else
- global_consent=1
-fi
-
-function assert_consent {
- if [[ $2 -eq 0 ]]; then
- return 0
- fi
-
- echo -n "$1 [Y/n] "
- read consent
- if [[ ! "${consent}" == "y" && ! "${consent}" == "Y" && ! "${consent}" == "" ]]; then
- echo "'${consent}'"
- exit 1
- fi
-}
-
-global_consent=0 # Artificially giving global consent after review-feedback. Remove this line to enable interactive mode
-
-setup() {
-
- assert_consent "Add packages necessary to modify your apt-package sources?" ${global_consent}
- set -v
- export DEBIAN_FRONTEND=noninteractive
- apt-get update
- apt-get install -y apt-transport-https lsb-release gnupg curl
- set +v
-
- assert_consent "Add Microsoft as a trusted package signer?" ${global_consent}
- set -v
- curl -sL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > /etc/apt/trusted.gpg.d/microsoft.gpg
- set +v
-
- assert_consent "Add the Azure CLI Repository to your apt sources?" ${global_consent}
- set -v
- # Use env var DIST_CODE for the package dist name if provided
- if [[ -z $DIST_CODE ]]; then
- CLI_REPO=$(lsb_release -cs)
- shopt -s nocasematch
- ERROR_MSG="Unable to find a package for your system. Please check if an existing package in https://packages.microsoft.com/repos/azure-cli/dists/ can be used in your system and install with the dist name: 'curl -sL https://aka.ms/InstallAzureCLIDeb | sudo DIST_CODE=<dist_code_name> bash'"
- if [[ ! $(curl -sL https://packages.microsoft.com/repos/azure-cli/dists/) =~ $CLI_REPO ]]; then
- DIST=$(lsb_release -is)
- if [[ $DIST =~ "Ubuntu" ]]; then
- CLI_REPO="jammy"
- elif [[ $DIST =~ "Debian" ]]; then
- CLI_REPO="bookworm"
- elif [[ $DIST =~ "LinuxMint" ]]; then
- CLI_REPO=$(cat /etc/os-release | grep -Po 'UBUNTU_CODENAME=\K.*') || true
- if [[ -z $CLI_REPO ]]; then
- echo $ERROR_MSG
- exit 1
- fi
- else
- echo $ERROR_MSG
- exit 1
- fi
- fi
- else
- CLI_REPO=$DIST_CODE
- if [[ ! $(curl -sL https://packages.microsoft.com/repos/azure-cli/dists/) =~ $CLI_REPO ]]; then
- echo "Unable to find an azure-cli package with DIST_CODE=$CLI_REPO in https://packages.microsoft.com/repos/azure-cli/dists/."
- exit 1
- fi
- fi
- echo "deb [arch=$(dpkg --print-architecture)] https://packages.microsoft.com/repos/azure-cli/ ${CLI_REPO} main" \
- > /etc/apt/sources.list.d/azure-cli.list
- apt-get update
- set +v
-
- assert_consent "Install the Azure CLI?" ${global_consent}
- apt-get install -y azure-cli
-
-}
-
-setup # ensure the whole file is downloaded before executing
|
build
|
b142fce229c5821083ad6b7c9aa6aa5790032127
|
Shelley Vohr
|
2023-07-12 11:42:49
|
fix: `protocol.handle` not intercepting file protocol (#39048)
fix: protocol.handle not intercepting file protocol
|
diff --git a/lib/browser/api/protocol.ts b/lib/browser/api/protocol.ts
index 79e5f7c60e..3d5f7cd96b 100644
--- a/lib/browser/api/protocol.ts
+++ b/lib/browser/api/protocol.ts
@@ -9,7 +9,7 @@ const { registerSchemesAsPrivileged, getStandardSchemes, Protocol } = process._l
const ERR_FAILED = -2;
const ERR_UNEXPECTED = -9;
-const isBuiltInScheme = (scheme: string) => scheme === 'http' || scheme === 'https';
+const isBuiltInScheme = (scheme: string) => ['http', 'https', 'file'].includes(scheme);
function makeStreamFromPipe (pipe: any): ReadableStream {
const buf = new Uint8Array(1024 * 1024 /* 1 MB */);
diff --git a/spec/api-protocol-spec.ts b/spec/api-protocol-spec.ts
index 365e3ae137..90b07b7074 100644
--- a/spec/api-protocol-spec.ts
+++ b/spec/api-protocol-spec.ts
@@ -1114,13 +1114,34 @@ describe('protocol module', () => {
await expect(net.fetch('test-scheme://foo')).to.eventually.be.rejectedWith(/ERR_UNKNOWN_URL_SCHEME/);
});
- it('receives requests to an existing scheme', async () => {
+ it('receives requests to the existing https scheme', async () => {
protocol.handle('https', (req) => new Response('hello ' + req.url));
defer(() => { protocol.unhandle('https'); });
const body = await net.fetch('https://foo').then(r => r.text());
expect(body).to.equal('hello https://foo/');
});
+ it('receives requests to the existing file scheme', (done) => {
+ const filePath = path.join(__dirname, 'fixtures', 'pages', 'a.html');
+
+ protocol.handle('file', (req) => {
+ let file;
+ if (process.platform === 'win32') {
+ file = `file:///${filePath.replace(/\\/g, '/')}`;
+ } else {
+ file = `file://${filePath}`;
+ }
+
+ if (req.url === file) done();
+ return new Response(req.url);
+ });
+
+ defer(() => { protocol.unhandle('file'); });
+
+ const w = new BrowserWindow();
+ w.loadFile(filePath);
+ });
+
it('receives requests to an existing scheme when navigating', async () => {
protocol.handle('https', (req) => new Response('hello ' + req.url));
defer(() => { protocol.unhandle('https'); });
|
fix
|
adb1172066a72a22e7e1e83a04a3504b964f0cbb
|
David Sanders
|
2023-04-10 23:30:25
|
chore: use nested namespaces (#37855)
|
diff --git a/shell/browser/api/electron_api_push_notifications.cc b/shell/browser/api/electron_api_push_notifications.cc
index 80973c11c4..afd0c554f8 100644
--- a/shell/browser/api/electron_api_push_notifications.cc
+++ b/shell/browser/api/electron_api_push_notifications.cc
@@ -10,9 +10,7 @@
#include "shell/common/gin_helper/dictionary.h"
#include "shell/common/node_includes.h"
-namespace electron {
-
-namespace api {
+namespace electron::api {
PushNotifications* g_push_notifications = nullptr;
@@ -55,9 +53,7 @@ const char* PushNotifications::GetTypeName() {
return "PushNotifications";
}
-} // namespace api
-
-} // namespace electron
+} // namespace electron::api
namespace {
diff --git a/shell/browser/api/electron_api_push_notifications.h b/shell/browser/api/electron_api_push_notifications.h
index f0f46b5e57..19f29d83d5 100644
--- a/shell/browser/api/electron_api_push_notifications.h
+++ b/shell/browser/api/electron_api_push_notifications.h
@@ -15,9 +15,7 @@
#include "shell/browser/event_emitter_mixin.h"
#include "shell/common/gin_helper/promise.h"
-namespace electron {
-
-namespace api {
+namespace electron::api {
class PushNotifications
: public ElectronBrowserClient::Delegate,
@@ -57,8 +55,6 @@ class PushNotifications
#endif
};
-} // namespace api
-
-} // namespace electron
+} // namespace electron::api
#endif // ELECTRON_SHELL_BROWSER_API_ELECTRON_API_PUSH_NOTIFICATIONS_H_
diff --git a/shell/browser/api/electron_api_push_notifications_mac.mm b/shell/browser/api/electron_api_push_notifications_mac.mm
index 6838293937..b9f3de1744 100644
--- a/shell/browser/api/electron_api_push_notifications_mac.mm
+++ b/shell/browser/api/electron_api_push_notifications_mac.mm
@@ -12,9 +12,7 @@
#include "shell/common/gin_converters/value_converter.h"
#include "shell/common/gin_helper/promise.h"
-namespace electron {
-
-namespace api {
+namespace electron::api {
v8::Local<v8::Promise> PushNotifications::RegisterForAPNSNotifications(
v8::Isolate* isolate) {
@@ -57,6 +55,4 @@ void PushNotifications::OnDidReceiveAPNSNotification(
Emit("received-apns-notification", user_info);
}
-} // namespace api
-
-} // namespace electron
+} // namespace electron::api
diff --git a/shell/browser/api/electron_api_utility_process.h b/shell/browser/api/electron_api_utility_process.h
index 482437e571..e75e4ffdd3 100644
--- a/shell/browser/api/electron_api_utility_process.h
+++ b/shell/browser/api/electron_api_utility_process.h
@@ -33,9 +33,7 @@ namespace base {
class Process;
} // namespace base
-namespace electron {
-
-namespace api {
+namespace electron::api {
class UtilityProcessWrapper
: public gin::Wrappable<UtilityProcessWrapper>,
@@ -93,8 +91,6 @@ class UtilityProcessWrapper
base::WeakPtrFactory<UtilityProcessWrapper> weak_factory_{this};
};
-} // namespace api
-
-} // namespace electron
+} // namespace electron::api
#endif // ELECTRON_SHELL_BROWSER_API_ELECTRON_API_UTILITY_PROCESS_H_
diff --git a/shell/browser/ui/gtk/menu_gtk.cc b/shell/browser/ui/gtk/menu_gtk.cc
index 8e73a50569..77843d41c8 100644
--- a/shell/browser/ui/gtk/menu_gtk.cc
+++ b/shell/browser/ui/gtk/menu_gtk.cc
@@ -9,9 +9,7 @@
#include "shell/browser/ui/gtk/menu_util.h"
#include "ui/base/models/menu_model.h"
-namespace electron {
-
-namespace gtkui {
+namespace electron::gtkui {
MenuGtk::MenuGtk(ui::MenuModel* model)
: menu_model_(model), gtk_menu_(TakeGObject(gtk_menu_new())) {
@@ -65,6 +63,4 @@ void MenuGtk::OnMenuItemActivated(GtkWidget* menu_item) {
ExecuteCommand(model, id);
}
-} // namespace gtkui
-
-} // namespace electron
+} // namespace electron::gtkui
diff --git a/shell/browser/ui/gtk/menu_gtk.h b/shell/browser/ui/gtk/menu_gtk.h
index acfdfcd8b1..8faca14f64 100644
--- a/shell/browser/ui/gtk/menu_gtk.h
+++ b/shell/browser/ui/gtk/menu_gtk.h
@@ -17,9 +17,7 @@ namespace ui {
class MenuModel;
}
-namespace electron {
-
-namespace gtkui {
+namespace electron::gtkui {
class MenuGtk {
public:
@@ -41,8 +39,6 @@ class MenuGtk {
bool block_activation_ = false;
};
-} // namespace gtkui
-
-} // namespace electron
+} // namespace electron::gtkui
#endif // ELECTRON_SHELL_BROWSER_UI_GTK_MENU_GTK_H_
|
chore
|
79e714a82506f133516749ff0447717e92104bc1
|
Samuel Attard
|
2023-11-22 12:36:52
|
chore: add patch upstream plan for resize patch (#40596)
|
diff --git a/patches/chromium/fix_restore_original_resize_performance_on_macos.patch b/patches/chromium/fix_restore_original_resize_performance_on_macos.patch
index 7961fa26bc..1aab5e4746 100644
--- a/patches/chromium/fix_restore_original_resize_performance_on_macos.patch
+++ b/patches/chromium/fix_restore_original_resize_performance_on_macos.patch
@@ -7,6 +7,9 @@ Reverts https://chromium-review.googlesource.com/c/chromium/src/+/3118293 which
fixed a android only regression but in the process regressed electron window
resize perf wildly on macOS.
+This patch should be upstreamed as a conditional revert of the logic in desktop
+vs mobile runtimes. i.e. restore the old logic only on desktop platforms
+
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc
index 749ee4641462aec1142f75de9f0459d7e7cf322f..4dcee366b8bd43add1f7e1dbedaf73403dd944cd 100644
--- a/content/browser/renderer_host/render_widget_host_impl.cc
|
chore
|
737e3de3fa34acd9b9222a898de44cf233ca9575
|
Milan Burda
|
2023-10-09 01:55:16
|
chore: restore deprecate as an internal module (#40124)
* Revert "refactor: don't expose deprecate as an internal module (#35311)"
This reverts commit 8424779906ae33222764db9ed837f55115143e71.
* check crashed event warnings
|
diff --git a/filenames.auto.gni b/filenames.auto.gni
index 1d89fc05e3..02837fff6d 100644
--- a/filenames.auto.gni
+++ b/filenames.auto.gni
@@ -142,6 +142,7 @@ auto_filenames = {
]
sandbox_bundle_deps = [
+ "lib/common/api/deprecate.ts",
"lib/common/api/native-image.ts",
"lib/common/define-properties.ts",
"lib/common/ipc-messages.ts",
@@ -247,11 +248,11 @@ auto_filenames = {
"lib/browser/parse-features-string.ts",
"lib/browser/rpc-server.ts",
"lib/browser/web-view-events.ts",
+ "lib/common/api/deprecate.ts",
"lib/common/api/module-list.ts",
"lib/common/api/native-image.ts",
"lib/common/api/shell.ts",
"lib/common/define-properties.ts",
- "lib/common/deprecate.ts",
"lib/common/init.ts",
"lib/common/ipc-messages.ts",
"lib/common/reset-search-paths.ts",
@@ -265,6 +266,7 @@ auto_filenames = {
]
renderer_bundle_deps = [
+ "lib/common/api/deprecate.ts",
"lib/common/api/module-list.ts",
"lib/common/api/native-image.ts",
"lib/common/api/shell.ts",
@@ -303,6 +305,7 @@ auto_filenames = {
]
worker_bundle_deps = [
+ "lib/common/api/deprecate.ts",
"lib/common/api/module-list.ts",
"lib/common/api/native-image.ts",
"lib/common/api/shell.ts",
diff --git a/lib/browser/api/app.ts b/lib/browser/api/app.ts
index 5d7ce57880..0fe34383c9 100644
--- a/lib/browser/api/app.ts
+++ b/lib/browser/api/app.ts
@@ -1,7 +1,6 @@
import * as fs from 'fs';
-import { Menu } from 'electron/main';
-import * as deprecate from '@electron/internal/common/deprecate';
+import { Menu, deprecate } from 'electron/main';
const bindings = process._linkedBinding('electron_browser_app');
const commandLine = process._linkedBinding('electron_common_command_line');
diff --git a/lib/browser/api/crash-reporter.ts b/lib/browser/api/crash-reporter.ts
index 729d9fe53d..16a9b1b5cb 100644
--- a/lib/browser/api/crash-reporter.ts
+++ b/lib/browser/api/crash-reporter.ts
@@ -1,5 +1,4 @@
-import { app } from 'electron/main';
-import * as deprecate from '@electron/internal/common/deprecate';
+import { app, deprecate } from 'electron/main';
const binding = process._linkedBinding('electron_browser_crash_reporter');
diff --git a/lib/browser/api/web-contents.ts b/lib/browser/api/web-contents.ts
index 7c876d5317..307530b41c 100644
--- a/lib/browser/api/web-contents.ts
+++ b/lib/browser/api/web-contents.ts
@@ -1,4 +1,4 @@
-import { app, ipcMain, session, webFrameMain } from 'electron/main';
+import { app, ipcMain, session, webFrameMain, deprecate } from 'electron/main';
import type { BrowserWindowConstructorOptions, LoadURLOptions } from 'electron/main';
import * as url from 'url';
@@ -10,7 +10,6 @@ import * as ipcMainUtils from '@electron/internal/browser/ipc-main-internal-util
import { MessagePortMain } from '@electron/internal/browser/message-port-main';
import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
import { IpcMainImpl } from '@electron/internal/browser/ipc-main-impl';
-import * as deprecate from '@electron/internal/common/deprecate';
// session is not used here, the purpose is to make sure session is initialized
// before the webContents module.
diff --git a/lib/common/deprecate.ts b/lib/common/api/deprecate.ts
similarity index 74%
rename from lib/common/deprecate.ts
rename to lib/common/api/deprecate.ts
index dc4e9d80ca..12dc31122c 100644
--- a/lib/common/deprecate.ts
+++ b/lib/common/api/deprecate.ts
@@ -2,13 +2,13 @@ type DeprecationHandler = (message: string) => void;
let deprecationHandler: DeprecationHandler | null = null;
-export function warnOnce (oldName: string, newName?: string) {
+function warnOnce (oldName: string, newName?: string) {
return warnOnceMessage(newName
? `'${oldName}' is deprecated and will be removed. Please use '${newName}' instead.`
: `'${oldName}' is deprecated and will be removed.`);
}
-export function warnOnceMessage (msg: string) {
+function warnOnceMessage (msg: string) {
let warned = false;
return () => {
if (!warned && !process.noDeprecation) {
@@ -18,21 +18,21 @@ export function warnOnceMessage (msg: string) {
};
}
-export function setHandler (handler: DeprecationHandler | null): void {
+function setHandler (handler: DeprecationHandler | null): void {
deprecationHandler = handler;
}
-export function getHandler (): DeprecationHandler | null {
+function getHandler (): DeprecationHandler | null {
return deprecationHandler;
}
-export function warn (oldName: string, newName: string): void {
+function warn (oldName: string, newName: string): void {
if (!process.noDeprecation) {
log(`'${oldName}' is deprecated. Use '${newName}' instead.`);
}
}
-export function log (message: string): void {
+function log (message: string): void {
if (typeof deprecationHandler === 'function') {
deprecationHandler(message);
} else if (process.throwDeprecation) {
@@ -45,7 +45,7 @@ export function log (message: string): void {
}
// remove a function with no replacement
-export function removeFunction<T extends Function> (fn: T, removedName: string): T {
+function removeFunction<T extends Function> (fn: T, removedName: string): T {
if (!fn) { throw new Error(`'${removedName} function' is invalid or does not exist.`); }
// wrap the deprecated function to warn user
@@ -57,7 +57,7 @@ export function removeFunction<T extends Function> (fn: T, removedName: string):
}
// change the name of a function
-export function renameFunction<T extends Function> (fn: T, newName: string): T {
+function renameFunction<T extends Function> (fn: T, newName: string): T {
const warn = warnOnce(`${fn.name} function`, `${newName} function`);
return function (this: any) {
warn();
@@ -66,7 +66,7 @@ export function renameFunction<T extends Function> (fn: T, newName: string): T {
}
// change the name of an event
-export function event (emitter: NodeJS.EventEmitter, oldName: string, newName: string, transformer: (...args: any[]) => any[] | undefined = (...args) => args) {
+function event (emitter: NodeJS.EventEmitter, oldName: string, newName: string, transformer: (...args: any[]) => any[] | undefined = (...args) => args) {
const warn = newName.startsWith('-') /* internal event */
? warnOnce(`${oldName} event`)
: warnOnce(`${oldName} event`, `${newName} event`);
@@ -82,7 +82,7 @@ export function event (emitter: NodeJS.EventEmitter, oldName: string, newName: s
}
// remove a property with no replacement
-export function removeProperty<T, K extends (keyof T & string)>(object: T, removedName: K, onlyForValues?: any[]): T {
+function removeProperty<T extends Object, K extends (keyof T & string)>(object: T, removedName: K, onlyForValues?: any[]): T {
// if the property's already been removed, warn about it
// eslint-disable-next-line no-proto
const info = Object.getOwnPropertyDescriptor((object as any).__proto__, removedName);
@@ -113,7 +113,7 @@ export function removeProperty<T, K extends (keyof T & string)>(object: T, remov
}
// change the name of a property
-export function renameProperty<T extends Object, K extends (keyof T & string)>(object: T, oldName: string, newName: K): T {
+function renameProperty<T extends Object, K extends (keyof T & string)>(object: T, oldName: string, newName: K): T {
const warn = warnOnce(oldName, newName);
// if the new property isn't there yet,
@@ -137,10 +137,27 @@ export function renameProperty<T extends Object, K extends (keyof T & string)>(o
});
}
-export function moveAPI<T extends Function> (fn: T, oldUsage: string, newUsage: string): T {
+function moveAPI<T extends Function> (fn: T, oldUsage: string, newUsage: string): T {
const warn = warnOnce(oldUsage, newUsage);
return function (this: any) {
warn();
return fn.apply(this, arguments);
} as unknown as typeof fn;
}
+
+const deprecate: ElectronInternal.DeprecationUtil = {
+ warnOnce,
+ warnOnceMessage,
+ setHandler,
+ getHandler,
+ warn,
+ log,
+ removeFunction,
+ renameFunction,
+ event,
+ removeProperty,
+ renameProperty,
+ moveAPI
+};
+
+export default deprecate;
diff --git a/lib/common/api/module-list.ts b/lib/common/api/module-list.ts
index 6383c33cd8..202c38b3a7 100644
--- a/lib/common/api/module-list.ts
+++ b/lib/common/api/module-list.ts
@@ -1,5 +1,7 @@
// Common modules, please sort alphabetically
export const commonModuleList: ElectronInternal.ModuleEntry[] = [
{ name: 'nativeImage', loader: () => require('./native-image') },
- { name: 'shell', loader: () => require('./shell') }
+ { name: 'shell', loader: () => require('./shell') },
+ // The internal modules, invisible unless you know their names.
+ { name: 'deprecate', loader: () => require('./deprecate'), private: true }
];
diff --git a/lib/common/define-properties.ts b/lib/common/define-properties.ts
index ad9e08d4fd..add72cd846 100644
--- a/lib/common/define-properties.ts
+++ b/lib/common/define-properties.ts
@@ -9,7 +9,7 @@ export function defineProperties (targetExports: Object, moduleList: ElectronInt
const descriptors: PropertyDescriptorMap = {};
for (const module of moduleList) {
descriptors[module.name] = {
- enumerable: true,
+ enumerable: !module.private,
get: handleESModule(module.loader)
};
}
diff --git a/lib/sandboxed_renderer/api/module-list.ts b/lib/sandboxed_renderer/api/module-list.ts
index 09772fd72e..91d075eebc 100644
--- a/lib/sandboxed_renderer/api/module-list.ts
+++ b/lib/sandboxed_renderer/api/module-list.ts
@@ -18,5 +18,11 @@ export const moduleList: ElectronInternal.ModuleEntry[] = [
{
name: 'webFrame',
loader: () => require('@electron/internal/renderer/api/web-frame')
+ },
+ // The internal modules, invisible unless you know their names.
+ {
+ name: 'deprecate',
+ loader: () => require('@electron/internal/common/api/deprecate'),
+ private: true
}
];
diff --git a/spec/api-app-spec.ts b/spec/api-app-spec.ts
index f77b73b56a..fabd5b3dc5 100644
--- a/spec/api-app-spec.ts
+++ b/spec/api-app-spec.ts
@@ -6,7 +6,7 @@ import * as net from 'node:net';
import * as fs from 'fs-extra';
import * as path from 'node:path';
import { promisify } from 'node:util';
-import { app, BrowserWindow, Menu, session, net as electronNet, WebContents } from 'electron/main';
+import { app, BrowserWindow, Menu, session, net as electronNet, WebContents, deprecate } from 'electron/main';
import { closeWindow, closeAllWindows } from './lib/window-helpers';
import { ifdescribe, ifit, listen, waitUntil } from './lib/spec-helpers';
import { once } from 'node:events';
@@ -492,7 +492,10 @@ describe('app module', () => {
describe('BrowserWindow events', () => {
let w: BrowserWindow = null as any;
- afterEach(() => closeWindow(w).then(() => { w = null as any; }));
+ afterEach(() => {
+ deprecate.setHandler(null);
+ closeWindow(w).then(() => { w = null as any; });
+ });
it('should emit browser-window-focus event when window is focused', async () => {
const emitted = once(app, 'browser-window-focus') as Promise<[any, BrowserWindow]>;
@@ -535,11 +538,16 @@ describe('app module', () => {
});
await w.loadURL('about:blank');
- const emitted = once(app, 'renderer-process-crashed') as Promise<[any, WebContents]>;
+ const messages: string[] = [];
+ deprecate.setHandler(message => messages.push(message));
+
+ const emitted = once(app, 'renderer-process-crashed') as Promise<[any, WebContents, boolean]>;
w.webContents.executeJavaScript('process.crash()');
- const [, webContents] = await emitted;
+ const [, webContents, killed] = await emitted;
expect(webContents).to.equal(w.webContents);
+ expect(killed).to.be.false();
+ expect(messages).to.deep.equal(['\'renderer-process-crashed event\' is deprecated and will be removed. Please use \'render-process-gone event\' instead.']);
});
// FIXME: re-enable this test on win32.
diff --git a/spec/api-web-contents-spec.ts b/spec/api-web-contents-spec.ts
index 8f8fc04397..9b59f9bce3 100644
--- a/spec/api-web-contents-spec.ts
+++ b/spec/api-web-contents-spec.ts
@@ -3,7 +3,7 @@ import { AddressInfo } from 'node:net';
import * as path from 'node:path';
import * as fs from 'node:fs';
import * as http from 'node:http';
-import { BrowserWindow, ipcMain, webContents, session, app, BrowserView, WebContents } from 'electron/main';
+import { BrowserWindow, ipcMain, webContents, session, app, BrowserView, WebContents, deprecate } from 'electron/main';
import { closeAllWindows } from './lib/window-helpers';
import { ifdescribe, defer, waitUntil, listen, ifit } from './lib/spec-helpers';
import { once } from 'node:events';
@@ -2331,6 +2331,8 @@ describe('webContents module', () => {
});
describe('crashed event', () => {
+ afterEach(() => deprecate.setHandler(null));
+
it('does not crash main process when destroying WebContents in it', async () => {
const contents = (webContents as typeof ElectronInternal.WebContents).create({ nodeIntegration: true });
const crashEvent = once(contents, 'render-process-gone');
@@ -2339,6 +2341,21 @@ describe('webContents module', () => {
await crashEvent;
contents.destroy();
});
+
+ it('logs a warning', async () => {
+ const contents = (webContents as typeof ElectronInternal.WebContents).create({ nodeIntegration: true });
+ await contents.loadURL('about:blank');
+
+ const messages: string[] = [];
+ deprecate.setHandler(message => messages.push(message));
+
+ const crashEvent = once(contents, 'crashed');
+ contents.forcefullyCrashRenderer();
+ const [, killed] = await crashEvent;
+
+ expect(killed).to.be.a('boolean');
+ expect(messages).to.deep.equal(['\'crashed event\' is deprecated and will be removed. Please use \'render-process-gone event\' instead.']);
+ });
});
describe('context-menu event', () => {
diff --git a/spec/deprecate-spec.ts b/spec/deprecate-spec.ts
index b8e3ae9b1d..c45c338e26 100644
--- a/spec/deprecate-spec.ts
+++ b/spec/deprecate-spec.ts
@@ -1,5 +1,5 @@
import { expect } from 'chai';
-import * as deprecate from '../lib/common/deprecate';
+import { deprecate } from 'electron/main';
describe('deprecate', () => {
let throwing: boolean;
diff --git a/typings/internal-electron.d.ts b/typings/internal-electron.d.ts
index caffd8d563..2ccdecd869 100644
--- a/typings/internal-electron.d.ts
+++ b/typings/internal-electron.d.ts
@@ -155,6 +155,18 @@ declare namespace Electron {
_replyChannel: ReplyChannel;
}
+ namespace Common {
+ const deprecate: ElectronInternal.DeprecationUtil;
+ }
+
+ namespace Main {
+ const deprecate: ElectronInternal.DeprecationUtil;
+ }
+
+ namespace Renderer {
+ const deprecate: ElectronInternal.DeprecationUtil;
+ }
+
class View {}
// Experimental views API
@@ -200,6 +212,22 @@ declare namespace Electron {
}
declare namespace ElectronInternal {
+ type DeprecationHandler = (message: string) => void;
+ interface DeprecationUtil {
+ warnOnce(oldName: string, newName?: string): () => void;
+ warnOnceMessage(msg: string): () => void;
+ setHandler(handler: DeprecationHandler | null): void;
+ getHandler(): DeprecationHandler | null;
+ warn(oldName: string, newName: string): void;
+ log(message: string): void;
+ removeFunction<T extends Function>(fn: T, removedName: string): T;
+ renameFunction<T extends Function>(fn: T, newName: string): T;
+ event(emitter: NodeJS.EventEmitter, oldName: string, newName: string, transformer?: (...args: any[]) => any[] | undefined): void;
+ removeProperty<T extends Object, K extends (keyof T & string)>(object: T, propertyName: K, onlyForValues?: any[]): T;
+ renameProperty<T extends Object, K extends (keyof T & string)>(object: T, oldName: string, newName: K): T;
+ moveAPI<T extends Function>(fn: T, oldUsage: string, newUsage: string): T;
+ }
+
interface DesktopCapturer {
startHandling(captureWindow: boolean, captureScreen: boolean, thumbnailSize: Electron.Size, fetchWindowIcons: boolean): void;
_onerror?: (error: string) => void;
@@ -264,6 +292,7 @@ declare namespace ElectronInternal {
interface ModuleEntry {
name: string;
loader: ModuleLoader;
+ private?: boolean;
}
interface UtilityProcessWrapper extends NodeJS.EventEmitter {
|
chore
|
ab185c058f894ddc556f67b2853de4adad2bb10c
|
Shelley Vohr
|
2023-09-11 09:38:10
|
fix: fullscreen crashing with no roundedCorners and no frame (#39747)
|
diff --git a/shell/browser/native_window_mac.mm b/shell/browser/native_window_mac.mm
index e339366b05..49f9dbdd88 100644
--- a/shell/browser/native_window_mac.mm
+++ b/shell/browser/native_window_mac.mm
@@ -683,9 +683,6 @@ void NativeWindowMac::DetachChildren() {
}
void NativeWindowMac::SetFullScreen(bool fullscreen) {
- if (!has_frame() && !HasStyleMask(NSWindowStyleMaskTitled))
- return;
-
// [NSWindow -toggleFullScreen] is an asynchronous operation, which means
// that it's possible to call it while a fullscreen transition is currently
// in process. This can create weird behavior (incl. phantom windows),
@@ -718,7 +715,8 @@ void NativeWindowMac::SetFullScreen(bool fullscreen) {
? FullScreenTransitionState::kEntering
: FullScreenTransitionState::kExiting;
- [window_ toggleFullScreenMode:nil];
+ if (![window_ toggleFullScreenMode:nil])
+ fullscreen_transition_state_ = FullScreenTransitionState::kNone;
}
bool NativeWindowMac::IsFullscreen() const {
diff --git a/shell/browser/ui/cocoa/electron_ns_window.h b/shell/browser/ui/cocoa/electron_ns_window.h
index 4256050d7e..502592313c 100644
--- a/shell/browser/ui/cocoa/electron_ns_window.h
+++ b/shell/browser/ui/cocoa/electron_ns_window.h
@@ -44,7 +44,7 @@ class ScopedDisableResize {
- (electron::NativeWindowMac*)shell;
- (id)accessibilityFocusedUIElement;
- (NSRect)originalContentRectForFrameRect:(NSRect)frameRect;
-- (void)toggleFullScreenMode:(id)sender;
+- (BOOL)toggleFullScreenMode:(id)sender;
- (NSImage*)_cornerMask;
@end
diff --git a/shell/browser/ui/cocoa/electron_ns_window.mm b/shell/browser/ui/cocoa/electron_ns_window.mm
index ae4e96859b..17adef63de 100644
--- a/shell/browser/ui/cocoa/electron_ns_window.mm
+++ b/shell/browser/ui/cocoa/electron_ns_window.mm
@@ -334,7 +334,10 @@ void SwizzleSwipeWithEvent(NSView* view, SEL swiz_selector) {
}
}
-- (void)toggleFullScreenMode:(id)sender {
+- (BOOL)toggleFullScreenMode:(id)sender {
+ if (!shell_->has_frame() && !shell_->HasStyleMask(NSWindowStyleMaskTitled))
+ return NO;
+
bool is_simple_fs = shell_->IsSimpleFullScreen();
bool always_simple_fs = shell_->always_simple_fullscreen();
@@ -363,6 +366,8 @@ void SwizzleSwipeWithEvent(NSView* view, SEL swiz_selector) {
bool maximizable = shell_->IsMaximizable();
shell_->SetMaximizable(maximizable);
}
+
+ return YES;
}
- (void)performMiniaturize:(id)sender {
|
fix
|
d829ee314530f2e7ba664a0df3d3bb7764e0078d
|
Keeley Hammond
|
2025-01-15 08:36:34
|
build: bump NMV to 133 (#45145)
|
diff --git a/build/args/all.gn b/build/args/all.gn
index f8ed5769a9..793efc2285 100644
--- a/build/args/all.gn
+++ b/build/args/all.gn
@@ -2,7 +2,7 @@ is_electron_build = true
root_extra_deps = [ "//electron" ]
# Registry of NMVs --> https://github.com/nodejs/node/blob/main/doc/abi_version_registry.json
-node_module_version = 132
+node_module_version = 133
v8_promise_internal_field_count = 1
v8_embedder_string = "-electron.0"
|
build
|
39c984e23a4459cc3204d0fb256263bff2305839
|
Shelley Vohr
|
2024-06-04 15:24:08
|
fix: WebUSB should not crash when using in-memory partitions (#42347)
|
diff --git a/shell/browser/usb/electron_usb_delegate.cc b/shell/browser/usb/electron_usb_delegate.cc
index 0e2e5c549c..e396863e0d 100644
--- a/shell/browser/usb/electron_usb_delegate.cc
+++ b/shell/browser/usb/electron_usb_delegate.cc
@@ -174,6 +174,9 @@ std::unique_ptr<content::UsbChooser> ElectronUsbDelegate::RunChooser(
bool ElectronUsbDelegate::CanRequestDevicePermission(
content::BrowserContext* browser_context,
const url::Origin& origin) {
+ if (!browser_context)
+ return false;
+
base::Value::Dict details;
details.Set("securityOrigin", origin.GetURL().spec());
auto* permission_manager = static_cast<ElectronPermissionManager*>(
@@ -188,32 +191,46 @@ void ElectronUsbDelegate::RevokeDevicePermissionWebInitiated(
content::BrowserContext* browser_context,
const url::Origin& origin,
const device::mojom::UsbDeviceInfo& device) {
- GetChooserContext(browser_context)
- ->RevokeDevicePermissionWebInitiated(origin, device);
+ auto* chooser_context = GetChooserContext(browser_context);
+ if (chooser_context) {
+ chooser_context->RevokeDevicePermissionWebInitiated(origin, device);
+ }
}
const device::mojom::UsbDeviceInfo* ElectronUsbDelegate::GetDeviceInfo(
content::BrowserContext* browser_context,
const std::string& guid) {
- return GetChooserContext(browser_context)->GetDeviceInfo(guid);
+ auto* chooser_context = GetChooserContext(browser_context);
+ if (!chooser_context)
+ return nullptr;
+ return chooser_context->GetDeviceInfo(guid);
}
bool ElectronUsbDelegate::HasDevicePermission(
content::BrowserContext* browser_context,
content::RenderFrameHost* frame,
const url::Origin& origin,
- const device::mojom::UsbDeviceInfo& device) {
- if (IsDevicePermissionAutoGranted(origin, device))
+ const device::mojom::UsbDeviceInfo& device_info) {
+ if (IsDevicePermissionAutoGranted(origin, device_info))
return true;
+ auto* chooser_context = GetChooserContext(browser_context);
+ if (!chooser_context)
+ return false;
+
return GetChooserContext(browser_context)
- ->HasDevicePermission(origin, device);
+ ->HasDevicePermission(origin, device_info);
}
void ElectronUsbDelegate::GetDevices(
content::BrowserContext* browser_context,
blink::mojom::WebUsbService::GetDevicesCallback callback) {
- GetChooserContext(browser_context)->GetDevices(std::move(callback));
+ auto* chooser_context = GetChooserContext(browser_context);
+ if (!chooser_context) {
+ std::move(callback).Run(std::vector<device::mojom::UsbDeviceInfoPtr>());
+ return;
+ }
+ chooser_context->GetDevices(std::move(callback));
}
void ElectronUsbDelegate::GetDevice(
@@ -222,25 +239,35 @@ void ElectronUsbDelegate::GetDevice(
base::span<const uint8_t> blocked_interface_classes,
mojo::PendingReceiver<device::mojom::UsbDevice> device_receiver,
mojo::PendingRemote<device::mojom::UsbDeviceClient> device_client) {
- GetChooserContext(browser_context)
- ->GetDevice(guid, blocked_interface_classes, std::move(device_receiver),
- std::move(device_client));
+ auto* chooser_context = GetChooserContext(browser_context);
+ if (chooser_context) {
+ chooser_context->GetDevice(guid, blocked_interface_classes,
+ std::move(device_receiver),
+ std::move(device_client));
+ }
}
void ElectronUsbDelegate::AddObserver(content::BrowserContext* browser_context,
Observer* observer) {
+ if (!browser_context)
+ return;
+
GetContextObserver(browser_context)->AddObserver(observer);
}
void ElectronUsbDelegate::RemoveObserver(
content::BrowserContext* browser_context,
Observer* observer) {
+ if (!browser_context)
+ return;
+
GetContextObserver(browser_context)->RemoveObserver(observer);
}
ElectronUsbDelegate::ContextObservation*
ElectronUsbDelegate::GetContextObserver(
content::BrowserContext* browser_context) {
+ CHECK(browser_context);
if (!base::Contains(observations_, browser_context)) {
observations_.emplace(browser_context, std::make_unique<ContextObservation>(
this, browser_context));
diff --git a/shell/browser/usb/electron_usb_delegate.h b/shell/browser/usb/electron_usb_delegate.h
index 9984e93378..89afd16da3 100644
--- a/shell/browser/usb/electron_usb_delegate.h
+++ b/shell/browser/usb/electron_usb_delegate.h
@@ -56,10 +56,11 @@ class ElectronUsbDelegate : public content::UsbDelegate {
const device::mojom::UsbDeviceInfo* GetDeviceInfo(
content::BrowserContext* browser_context,
const std::string& guid) override;
- bool HasDevicePermission(content::BrowserContext* browser_context,
- content::RenderFrameHost* frame,
- const url::Origin& origin,
- const device::mojom::UsbDeviceInfo& device) override;
+ bool HasDevicePermission(
+ content::BrowserContext* browser_context,
+ content::RenderFrameHost* frame,
+ const url::Origin& origin,
+ const device::mojom::UsbDeviceInfo& device_info) override;
void GetDevices(
content::BrowserContext* browser_context,
blink::mojom::WebUsbService::GetDevicesCallback callback) override;
diff --git a/spec/chromium-spec.ts b/spec/chromium-spec.ts
index fd228c63f2..0acf06cb02 100644
--- a/spec/chromium-spec.ts
+++ b/spec/chromium-spec.ts
@@ -3505,18 +3505,44 @@ describe('navigator.usb', () => {
`, true);
};
+ const getDevices: any = () => {
+ return w.webContents.executeJavaScript(`
+ navigator.usb.getDevices().then(devices => devices.map(device => device.toString())).catch(err => err.toString());
+ `, true);
+ };
+
const notFoundError = 'NotFoundError: Failed to execute \'requestDevice\' on \'USB\': No device selected.';
after(() => {
server.close();
closeAllWindows();
});
+
afterEach(() => {
session.defaultSession.setPermissionCheckHandler(null);
session.defaultSession.setDevicePermissionHandler(null);
session.defaultSession.removeAllListeners('select-usb-device');
});
+ it('does not crash when using in-memory partitions', async () => {
+ const sesWin = new BrowserWindow({
+ webPreferences: {
+ partition: 'test-partition'
+ }
+ });
+
+ await sesWin.loadFile(path.join(fixturesPath, 'pages', 'blank.html'));
+ server = http.createServer((req, res) => {
+ res.setHeader('Content-Type', 'text/html');
+ res.end('<body>');
+ });
+
+ serverUrl = (await listen(server)).url;
+
+ const devices = await getDevices();
+ expect(devices).to.be.an('array').that.is.empty();
+ });
+
it('does not return a device if select-usb-device event is not defined', async () => {
w.loadFile(path.join(fixturesPath, 'pages', 'blank.html'));
const device = await requestDevices();
|
fix
|
13be6dc8b499064fca5501d4cc2c5d9f212f7d3b
|
Calvin
|
2023-05-08 02:14:59
|
test: enable CircleCI's "re-run failed tests only" feature (#38178)
* test: enable CircleCI rerun failed *tests* only
* .
* .
* console.log never fails :shrug:
* normalize the filtered paths
circleci gives us a list of absolute paths here
* remove test output check
sometimes rerunning only failed tests results in some runners having
no tests to run, and thus no output
* keep relative paths the same
* error for when no tests match
* cleanup
* .
|
diff --git a/.circleci/config/base.yml b/.circleci/config/base.yml
index 185ae9b8e7..b2cce0fb79 100644
--- a/.circleci/config/base.yml
+++ b/.circleci/config/base.yml
@@ -452,7 +452,7 @@ step-get-more-space-on-mac: &step-get-more-space-on-mac
fi
background: true
-# On macOS delete all .git directories under src/ expect for
+# On macOS delete all .git directories under src/ except for
# third_party/angle/ and third_party/dawn/ because of build time generation of files
# gen/angle/commit.h depends on third_party/angle/.git/HEAD
# https://chromium-review.googlesource.com/c/angle/angle/+/2074924
@@ -1492,7 +1492,7 @@ commands:
export LLVM_SYMBOLIZER_PATH=$PWD/third_party/llvm-build/Release+Asserts/bin/llvm-symbolizer
export MOCHA_TIMEOUT=180000
echo "Piping output to ASAN_SYMBOLIZE ($ASAN_SYMBOLIZE)"
- (cd electron && node script/yarn test --runners=main --trace-uncaught --enable-logging --files $(circleci tests glob spec/*-spec.ts | circleci tests split --split-by=timings)) 2>&1 | $ASAN_SYMBOLIZE
+ (cd electron && (circleci tests glob "spec/*-spec.ts" | circleci tests run --command="xargs node script/yarn test --runners=main --trace-uncaught --enable-logging --files" --split-by=timings 2>&1)) | $ASAN_SYMBOLIZE
else
if [ "$TARGET_ARCH" == "arm" ] || [ "$TARGET_ARCH" == "arm64" ]; then
export ELECTRON_SKIP_NATIVE_MODULE_TESTS=true
@@ -1501,18 +1501,9 @@ commands:
if [ "$TARGET_ARCH" == "ia32" ]; then
npm_config_arch=x64 node electron/node_modules/dugite/script/download-git.js
fi
- (cd electron && node script/yarn test --runners=main --trace-uncaught --enable-logging --files $(circleci tests glob spec/*-spec.ts | circleci tests split --split-by=timings))
+ (cd electron && (circleci tests glob "spec/*-spec.ts" | circleci tests run --command="xargs node script/yarn test --runners=main --trace-uncaught --enable-logging --files" --split-by=timings))
fi
fi
- - run:
- name: Check test results existence
- command: |
- cd src
-
- # Check if test results exist and are not empty.
- if [ ! -s "junit/test-results-main.xml" ]; then
- exit 1
- fi
- store_test_results:
path: src/junit
diff --git a/spec/index.js b/spec/index.js
index 8e9b2aa155..d2b94f2e50 100644
--- a/spec/index.js
+++ b/spec/index.js
@@ -107,6 +107,11 @@ app.whenReady().then(async () => {
if (argv.grep) mocha.grep(argv.grep);
if (argv.invert) mocha.invert();
+ const baseElectronDir = path.resolve(__dirname, '..');
+ const validTestPaths = argv.files && argv.files.map(file =>
+ path.isAbsolute(file)
+ ? path.relative(baseElectronDir, file)
+ : file);
const filter = (file) => {
if (!/-spec\.[tj]s$/.test(file)) {
return false;
@@ -121,8 +126,7 @@ app.whenReady().then(async () => {
return false;
}
- const baseElectronDir = path.resolve(__dirname, '..');
- if (argv.files && !argv.files.includes(path.relative(baseElectronDir, file))) {
+ if (validTestPaths && !validTestPaths.includes(path.relative(baseElectronDir, file))) {
return false;
}
@@ -135,6 +139,12 @@ app.whenReady().then(async () => {
mocha.addFile(file);
});
+ if (validTestPaths && validTestPaths.length > 0 && testFiles.length === 0) {
+ console.error('Test files were provided, but they did not match any searched files');
+ console.error('provided file paths (relative to electron/):', validTestPaths);
+ process.exit(1);
+ }
+
const cb = () => {
// Ensure the callback is called after runner is defined
process.nextTick(() => {
|
test
|
6248c2436a2fd4c503feeee7183fe0afc44df2c6
|
Keeley Hammond
|
2025-02-21 14:45:46
|
fix: re-enable synchronous spellcheck on Windows (#45712)
* fix: re-enable synchronous spellcheck on Windows
* revert: fix: empty suggestions with windows platform checker
---------
Co-authored-by: Samuel Maddock <[email protected]>
|
diff --git a/patches/chromium/.patches b/patches/chromium/.patches
index fec7148a7e..cea4da74f5 100644
--- a/patches/chromium/.patches
+++ b/patches/chromium/.patches
@@ -140,3 +140,4 @@ revert_code_health_clean_up_stale_macwebcontentsocclusion.patch
ignore_parse_errors_for_pkey_appusermodel_toastactivatorclsid.patch
feat_add_signals_when_embedder_cleanup_callbacks_run_for.patch
feat_separate_content_settings_callback_for_sync_and_async_clipboard.patch
+fix_win32_synchronous_spellcheck.patch
diff --git a/patches/chromium/fix_win32_synchronous_spellcheck.patch b/patches/chromium/fix_win32_synchronous_spellcheck.patch
new file mode 100644
index 0000000000..355c8f8e9a
--- /dev/null
+++ b/patches/chromium/fix_win32_synchronous_spellcheck.patch
@@ -0,0 +1,29 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Keeley Hammond <[email protected]>
+Date: Wed, 19 Feb 2025 11:18:44 -0800
+Subject: fix: re-enable synchronous spellcheck on Windows
+
+This fix partially reverts 6109477: Code Health:
+Clean up stale base::Feature "WinRetrieveSuggestionsOnlyOnDemand"
+https://chromium-review.googlesource.com/c/chromium/src/+/6109477
+by re-adding a synchronous call to FillSuggestionList.
+
+This patch can be removed when an asynchronous spellcheck API
+option is added to Electron.
+
+diff --git a/components/spellcheck/browser/windows_spell_checker.cc b/components/spellcheck/browser/windows_spell_checker.cc
+index f5a7411037758427eddc088b5426554b4a500d33..04b3edd4d8c58d38e260cc54beb0dab86368fc25 100644
+--- a/components/spellcheck/browser/windows_spell_checker.cc
++++ b/components/spellcheck/browser/windows_spell_checker.cc
+@@ -239,6 +239,11 @@ std::vector<SpellCheckResult> BackgroundHelper::RequestTextCheckForAllLanguages(
+ (action == CORRECTIVE_ACTION_GET_SUGGESTIONS ||
+ action == CORRECTIVE_ACTION_REPLACE)) {
+ std::vector<std::u16string> suggestions;
++ // TODO (vertedinde): Perform the synchronous operation of retrieving
++ // suggestions for all misspelled words while performing a text check.
++ FillSuggestionList(it->first,
++ text.substr(start_index, error_length),
++ &suggestions);
+ result_map[std::tuple<ULONG, ULONG>(start_index, error_length)]
+ .push_back(suggestions);
+ }
diff --git a/shell/browser/api/electron_api_web_contents.cc b/shell/browser/api/electron_api_web_contents.cc
index f6265505f8..a18f580f92 100644
--- a/shell/browser/api/electron_api_web_contents.cc
+++ b/shell/browser/api/electron_api_web_contents.cc
@@ -194,14 +194,6 @@
#include "content/public/browser/plugin_service.h"
#endif
-#if BUILDFLAG(IS_WIN) && BUILDFLAG(ENABLE_BUILTIN_SPELLCHECKER)
-#include "chrome/browser/spellchecker/spellcheck_factory.h"
-#include "chrome/browser/spellchecker/spellcheck_service.h"
-#include "components/spellcheck/browser/spellcheck_platform.h"
-#include "components/spellcheck/common/spellcheck_common.h"
-#include "components/spellcheck/common/spellcheck_features.h"
-#endif
-
#if !IS_MAS_BUILD()
#include "chrome/browser/hang_monitor/hang_crash_dump.h" // nogncheck
#endif
@@ -1521,44 +1513,11 @@ void WebContents::RendererResponsive(
bool WebContents::HandleContextMenu(content::RenderFrameHost& render_frame_host,
const content::ContextMenuParams& params) {
-#if BUILDFLAG(IS_WIN) && BUILDFLAG(ENABLE_BUILTIN_SPELLCHECKER)
- if (!params.misspelled_word.empty() && spellcheck::UseBrowserSpellChecker()) {
- SpellcheckService* spellcheck_service =
- SpellcheckServiceFactory::GetForContext(
- render_frame_host.GetBrowserContext());
- if (spellcheck_service) {
- spellcheck_platform::GetPerLanguageSuggestions(
- spellcheck_service->platform_spell_checker(), params.misspelled_word,
- base::BindOnce(&WebContents::OnGetPlatformSuggestionsComplete,
- GetWeakPtr(), std::ref(render_frame_host), params));
- }
- } else {
-#endif
- Emit("context-menu",
- std::make_tuple(params, &render_frame_host,
- std::optional<std::vector<std::u16string>>{}));
-#if BUILDFLAG(IS_WIN) && BUILDFLAG(ENABLE_BUILTIN_SPELLCHECKER)
- }
-#endif
+ Emit("context-menu", std::make_pair(params, &render_frame_host));
return true;
}
-#if BUILDFLAG(IS_WIN) && BUILDFLAG(ENABLE_BUILTIN_SPELLCHECKER)
-void WebContents::OnGetPlatformSuggestionsComplete(
- content::RenderFrameHost& render_frame_host,
- const content::ContextMenuParams& params,
- const spellcheck::PerLanguageSuggestions&
- platform_per_language_suggestions) {
- std::vector<std::u16string> combined_suggestions;
- spellcheck::FillSuggestions(platform_per_language_suggestions,
- &combined_suggestions);
- Emit("context-menu",
- std::make_tuple(params, &render_frame_host,
- std::make_optional(combined_suggestions)));
-}
-#endif
-
void WebContents::FindReply(content::WebContents* web_contents,
int request_id,
int number_of_matches,
diff --git a/shell/browser/api/electron_api_web_contents.h b/shell/browser/api/electron_api_web_contents.h
index 58a6de68d2..40a0502b66 100644
--- a/shell/browser/api/electron_api_web_contents.h
+++ b/shell/browser/api/electron_api_web_contents.h
@@ -57,10 +57,6 @@ class ScriptExecutor;
}
#endif
-#if BUILDFLAG(IS_WIN) && BUILDFLAG(ENABLE_BUILTIN_SPELLCHECKER)
-#include "components/spellcheck/common/spellcheck_common.h"
-#endif
-
namespace blink {
struct DeviceEmulationParams;
// enum class PermissionType;
@@ -761,14 +757,6 @@ class WebContents final : public ExclusiveAccessContext,
// Update the html fullscreen flag in both browser and renderer.
void UpdateHtmlApiFullscreen(bool fullscreen);
-#if BUILDFLAG(IS_WIN) && BUILDFLAG(ENABLE_BUILTIN_SPELLCHECKER)
- void OnGetPlatformSuggestionsComplete(
- content::RenderFrameHost& render_frame_host,
- const content::ContextMenuParams& params,
- const spellcheck::PerLanguageSuggestions&
- platform_per_language_suggestions);
-#endif
-
v8::Global<v8::Value> session_;
v8::Global<v8::Value> devtools_web_contents_;
v8::Global<v8::Value> debugger_;
diff --git a/shell/common/gin_converters/content_converter.cc b/shell/common/gin_converters/content_converter.cc
index 7e593c324a..d5a257b8f2 100644
--- a/shell/common/gin_converters/content_converter.cc
+++ b/shell/common/gin_converters/content_converter.cc
@@ -88,7 +88,8 @@ v8::Local<v8::Value> Converter<blink::mojom::MenuItem::Type>::ToV8(
v8::Local<v8::Value> Converter<ContextMenuParamsWithRenderFrameHost>::ToV8(
v8::Isolate* isolate,
const ContextMenuParamsWithRenderFrameHost& val) {
- auto [params, render_frame_host, optional_suggestions] = val;
+ const auto& params = val.first;
+ content::RenderFrameHost* render_frame_host = val.second;
auto dict = gin_helper::Dictionary::CreateEmpty(isolate);
dict.SetGetter("frame", render_frame_host, v8::DontEnum);
dict.Set("x", params.x);
@@ -113,11 +114,7 @@ v8::Local<v8::Value> Converter<ContextMenuParamsWithRenderFrameHost>::ToV8(
dict.Set("misspelledWord", params.misspelled_word);
dict.Set("selectionRect", params.selection_rect);
#if BUILDFLAG(ENABLE_BUILTIN_SPELLCHECKER)
- if (optional_suggestions) {
- dict.Set("dictionarySuggestions", optional_suggestions.value());
- } else {
- dict.Set("dictionarySuggestions", params.dictionary_suggestions);
- }
+ dict.Set("dictionarySuggestions", params.dictionary_suggestions);
dict.Set("spellcheckEnabled", params.spellcheck_enabled);
#else
dict.Set("spellcheckEnabled", false);
diff --git a/shell/common/gin_converters/content_converter.h b/shell/common/gin_converters/content_converter.h
index 1e1f26012f..2fa5f7f118 100644
--- a/shell/common/gin_converters/content_converter.h
+++ b/shell/common/gin_converters/content_converter.h
@@ -26,9 +26,7 @@ struct NativeWebKeyboardEvent;
}
using ContextMenuParamsWithRenderFrameHost =
- std::tuple<content::ContextMenuParams,
- content::RenderFrameHost*,
- std::optional<std::vector<std::u16string>>>;
+ std::pair<content::ContextMenuParams, content::RenderFrameHost*>;
namespace gin {
|
fix
|
fefb22a83d8f3ed4d16a8b2814873bdfbb4ee8a0
|
Robo
|
2023-01-12 01:59:32
|
chore: enable microtask queue per window agent (#36870)
* chore: enable microtask queue per window agent
* chore: switch policies on context microtask queue
* fix: ensure node::Environment is valid
|
diff --git a/patches/v8/.patches b/patches/v8/.patches
index 4c5e530a4b..d9b32bf955 100644
--- a/patches/v8/.patches
+++ b/patches/v8/.patches
@@ -9,3 +9,4 @@ fix_disable_implies_dcheck_for_node_stream_array_buffers.patch
revert_runtime_dhceck_terminating_exception_in_microtasks.patch
chore_disable_is_execution_terminating_dcheck.patch
force_cppheapcreateparams_to_be_noncopyable.patch
+chore_allow_customizing_microtask_policy_per_context.patch
diff --git a/patches/v8/chore_allow_customizing_microtask_policy_per_context.patch b/patches/v8/chore_allow_customizing_microtask_policy_per_context.patch
new file mode 100644
index 0000000000..7d62ff9139
--- /dev/null
+++ b/patches/v8/chore_allow_customizing_microtask_policy_per_context.patch
@@ -0,0 +1,41 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: deepak1556 <[email protected]>
+Date: Wed, 11 Jan 2023 19:21:06 +0900
+Subject: chore: allow customizing microtask policy per context
+
+With https://github.com/electron/electron/issues/36813, microtask queue associated with a context
+will be used if available, instead of the default associated with an isolate. We need the
+capability to switch the microtask polciy of these per context microtask queue to support
+Node.js integration in the renderer.
+
+diff --git a/include/v8-microtask-queue.h b/include/v8-microtask-queue.h
+index 85d227fa3fdce6fc29bc4927e30a0171987578ac..1a61190ed3a2aeb440aa774788a469079df13c79 100644
+--- a/include/v8-microtask-queue.h
++++ b/include/v8-microtask-queue.h
+@@ -97,6 +97,9 @@ class V8_EXPORT MicrotaskQueue {
+ */
+ virtual int GetMicrotasksScopeDepth() const = 0;
+
++ virtual void set_microtasks_policy(v8::MicrotasksPolicy microtasks_policy) = 0;
++ virtual v8::MicrotasksPolicy microtasks_policy() const = 0;
++
+ MicrotaskQueue(const MicrotaskQueue&) = delete;
+ MicrotaskQueue& operator=(const MicrotaskQueue&) = delete;
+
+diff --git a/src/execution/microtask-queue.h b/src/execution/microtask-queue.h
+index 6091fa3575cf82ea532e88747c753040045cc9a0..55eee1dcede4daeed53bdc0447cfb714763d0d32 100644
+--- a/src/execution/microtask-queue.h
++++ b/src/execution/microtask-queue.h
+@@ -91,10 +91,10 @@ class V8_EXPORT_PRIVATE MicrotaskQueue final : public v8::MicrotaskQueue {
+ }
+ #endif
+
+- void set_microtasks_policy(v8::MicrotasksPolicy microtasks_policy) {
++ void set_microtasks_policy(v8::MicrotasksPolicy microtasks_policy) override {
+ microtasks_policy_ = microtasks_policy;
+ }
+- v8::MicrotasksPolicy microtasks_policy() const { return microtasks_policy_; }
++ v8::MicrotasksPolicy microtasks_policy() const override { return microtasks_policy_; }
+
+ intptr_t capacity() const { return capacity_; }
+ intptr_t size() const { return size_; }
diff --git a/shell/browser/feature_list.cc b/shell/browser/feature_list.cc
index 401a6d6d50..0cf9374876 100644
--- a/shell/browser/feature_list.cc
+++ b/shell/browser/feature_list.cc
@@ -16,7 +16,6 @@
#include "media/base/media_switches.h"
#include "net/base/features.h"
#include "services/network/public/cpp/features.h"
-#include "third_party/blink/renderer/platform/scheduler/common/features.h" // nogncheck
#if BUILDFLAG(IS_MAC)
#include "device/base/features.h" // nogncheck
@@ -37,12 +36,6 @@ void InitializeFeatureList() {
disable_features +=
std::string(",") + features::kSpareRendererForSitePerProcess.name;
- // Microtask queues per WindowAgent causes issues with Node, so disable
- // this feature for now. See
- // https://chromium-review.googlesource.com/c/chromium/src/+/4003663
- disable_features +=
- std::string(",") + blink::scheduler::kMicrotaskQueuePerWindowAgent.name;
-
#if BUILDFLAG(IS_MAC)
// Needed for WebUSB implementation
enable_features += std::string(",") + device::kNewUsbBackend.name;
diff --git a/shell/common/api/electron_bindings.cc b/shell/common/api/electron_bindings.cc
index c284f0fa7a..ef84624a4d 100644
--- a/shell/common/api/electron_bindings.cc
+++ b/shell/common/api/electron_bindings.cc
@@ -251,9 +251,11 @@ void ElectronBindings::DidReceiveMemoryDump(
std::unique_ptr<memory_instrumentation::GlobalMemoryDump> global_dump) {
v8::Isolate* isolate = promise.isolate();
v8::HandleScope handle_scope(isolate);
- gin_helper::MicrotasksScope microtasks_scope(isolate, true);
- v8::Context::Scope context_scope(
- v8::Local<v8::Context>::New(isolate, context));
+ v8::Local<v8::Context> local_context =
+ v8::Local<v8::Context>::New(isolate, context);
+ gin_helper::MicrotasksScope microtasks_scope(
+ isolate, local_context->GetMicrotaskQueue(), true);
+ v8::Context::Scope context_scope(local_context);
if (!success) {
promise.RejectWithErrorMessage("Failed to create memory dump");
diff --git a/shell/common/gin_helper/callback.h b/shell/common/gin_helper/callback.h
index 5f40f57c78..777238c915 100644
--- a/shell/common/gin_helper/callback.h
+++ b/shell/common/gin_helper/callback.h
@@ -48,9 +48,10 @@ struct V8FunctionInvoker<v8::Local<v8::Value>(ArgTypes...)> {
v8::EscapableHandleScope handle_scope(isolate);
if (!function.IsAlive())
return v8::Null(isolate);
- gin_helper::MicrotasksScope microtasks_scope(isolate, true);
v8::Local<v8::Function> holder = function.NewHandle(isolate);
v8::Local<v8::Context> context = holder->GetCreationContextChecked();
+ gin_helper::MicrotasksScope microtasks_scope(
+ isolate, context->GetMicrotaskQueue(), true);
v8::Context::Scope context_scope(context);
std::vector<v8::Local<v8::Value>> args{
gin::ConvertToV8(isolate, std::forward<ArgTypes>(raw))...};
@@ -72,9 +73,10 @@ struct V8FunctionInvoker<void(ArgTypes...)> {
v8::HandleScope handle_scope(isolate);
if (!function.IsAlive())
return;
- gin_helper::MicrotasksScope microtasks_scope(isolate, true);
v8::Local<v8::Function> holder = function.NewHandle(isolate);
v8::Local<v8::Context> context = holder->GetCreationContextChecked();
+ gin_helper::MicrotasksScope microtasks_scope(
+ isolate, context->GetMicrotaskQueue(), true);
v8::Context::Scope context_scope(context);
std::vector<v8::Local<v8::Value>> args{
gin::ConvertToV8(isolate, std::forward<ArgTypes>(raw))...};
@@ -95,9 +97,10 @@ struct V8FunctionInvoker<ReturnType(ArgTypes...)> {
ReturnType ret = ReturnType();
if (!function.IsAlive())
return ret;
- gin_helper::MicrotasksScope microtasks_scope(isolate, true);
v8::Local<v8::Function> holder = function.NewHandle(isolate);
v8::Local<v8::Context> context = holder->GetCreationContextChecked();
+ gin_helper::MicrotasksScope microtasks_scope(
+ isolate, context->GetMicrotaskQueue(), true);
v8::Context::Scope context_scope(context);
std::vector<v8::Local<v8::Value>> args{
gin::ConvertToV8(isolate, std::forward<ArgTypes>(raw))...};
diff --git a/shell/common/gin_helper/event_emitter_caller.cc b/shell/common/gin_helper/event_emitter_caller.cc
index be112f55fa..41b0c7b355 100644
--- a/shell/common/gin_helper/event_emitter_caller.cc
+++ b/shell/common/gin_helper/event_emitter_caller.cc
@@ -15,7 +15,8 @@ v8::Local<v8::Value> CallMethodWithArgs(v8::Isolate* isolate,
const char* method,
ValueVector* args) {
// Perform microtask checkpoint after running JavaScript.
- gin_helper::MicrotasksScope microtasks_scope(isolate, true);
+ gin_helper::MicrotasksScope microtasks_scope(
+ isolate, obj->GetCreationContextChecked()->GetMicrotaskQueue(), true);
// Use node::MakeCallback to call the callback, and it will also run pending
// tasks in Node.js.
v8::MaybeLocal<v8::Value> ret = node::MakeCallback(
diff --git a/shell/common/gin_helper/function_template.h b/shell/common/gin_helper/function_template.h
index c6d6410f94..265ddde5db 100644
--- a/shell/common/gin_helper/function_template.h
+++ b/shell/common/gin_helper/function_template.h
@@ -217,7 +217,9 @@ class Invoker<IndicesHolder<indices...>, ArgTypes...>
template <typename ReturnType>
void DispatchToCallback(
base::RepeatingCallback<ReturnType(ArgTypes...)> callback) {
- gin_helper::MicrotasksScope microtasks_scope(args_->isolate(), true);
+ gin_helper::MicrotasksScope microtasks_scope(
+ args_->isolate(),
+ args_->GetHolderCreationContext()->GetMicrotaskQueue(), true);
args_->Return(
callback.Run(std::move(ArgumentHolder<indices, ArgTypes>::value)...));
}
@@ -226,7 +228,9 @@ class Invoker<IndicesHolder<indices...>, ArgTypes...>
// expression to foo. As a result, we must specialize the case of Callbacks
// that have the void return type.
void DispatchToCallback(base::RepeatingCallback<void(ArgTypes...)> callback) {
- gin_helper::MicrotasksScope microtasks_scope(args_->isolate(), true);
+ gin_helper::MicrotasksScope microtasks_scope(
+ args_->isolate(),
+ args_->GetHolderCreationContext()->GetMicrotaskQueue(), true);
callback.Run(std::move(ArgumentHolder<indices, ArgTypes>::value)...);
}
diff --git a/shell/common/gin_helper/microtasks_scope.cc b/shell/common/gin_helper/microtasks_scope.cc
index a3f8c73d74..3b768a326f 100644
--- a/shell/common/gin_helper/microtasks_scope.cc
+++ b/shell/common/gin_helper/microtasks_scope.cc
@@ -9,14 +9,15 @@
namespace gin_helper {
MicrotasksScope::MicrotasksScope(v8::Isolate* isolate,
+ v8::MicrotaskQueue* microtask_queue,
bool ignore_browser_checkpoint,
v8::MicrotasksScope::Type scope_type) {
if (Locker::IsBrowserProcess()) {
if (!ignore_browser_checkpoint)
v8::MicrotasksScope::PerformCheckpoint(isolate);
} else {
- v8_microtasks_scope_ =
- std::make_unique<v8::MicrotasksScope>(isolate, scope_type);
+ v8_microtasks_scope_ = std::make_unique<v8::MicrotasksScope>(
+ isolate, microtask_queue, scope_type);
}
}
diff --git a/shell/common/gin_helper/microtasks_scope.h b/shell/common/gin_helper/microtasks_scope.h
index 23815a0908..a8d27d3ccb 100644
--- a/shell/common/gin_helper/microtasks_scope.h
+++ b/shell/common/gin_helper/microtasks_scope.h
@@ -16,6 +16,7 @@ namespace gin_helper {
class MicrotasksScope {
public:
explicit MicrotasksScope(v8::Isolate* isolate,
+ v8::MicrotaskQueue* microtask_queue,
bool ignore_browser_checkpoint = false,
v8::MicrotasksScope::Type scope_type =
v8::MicrotasksScope::kRunMicrotasks);
diff --git a/shell/common/gin_helper/promise.cc b/shell/common/gin_helper/promise.cc
index bc34dfa631..4ed2ecafd2 100644
--- a/shell/common/gin_helper/promise.cc
+++ b/shell/common/gin_helper/promise.cc
@@ -25,7 +25,8 @@ PromiseBase& PromiseBase::operator=(PromiseBase&&) = default;
v8::Maybe<bool> PromiseBase::Reject() {
v8::HandleScope handle_scope(isolate());
- gin_helper::MicrotasksScope microtasks_scope(isolate());
+ gin_helper::MicrotasksScope microtasks_scope(
+ isolate(), GetContext()->GetMicrotaskQueue());
v8::Context::Scope context_scope(GetContext());
return GetInner()->Reject(GetContext(), v8::Undefined(isolate()));
@@ -33,7 +34,8 @@ v8::Maybe<bool> PromiseBase::Reject() {
v8::Maybe<bool> PromiseBase::Reject(v8::Local<v8::Value> except) {
v8::HandleScope handle_scope(isolate());
- gin_helper::MicrotasksScope microtasks_scope(isolate());
+ gin_helper::MicrotasksScope microtasks_scope(
+ isolate(), GetContext()->GetMicrotaskQueue());
v8::Context::Scope context_scope(GetContext());
return GetInner()->Reject(GetContext(), except);
@@ -41,7 +43,8 @@ v8::Maybe<bool> PromiseBase::Reject(v8::Local<v8::Value> except) {
v8::Maybe<bool> PromiseBase::RejectWithErrorMessage(base::StringPiece message) {
v8::HandleScope handle_scope(isolate());
- gin_helper::MicrotasksScope microtasks_scope(isolate());
+ gin_helper::MicrotasksScope microtasks_scope(
+ isolate(), GetContext()->GetMicrotaskQueue());
v8::Context::Scope context_scope(GetContext());
v8::Local<v8::Value> error =
@@ -83,7 +86,8 @@ v8::Local<v8::Promise> Promise<void>::ResolvedPromise(v8::Isolate* isolate) {
v8::Maybe<bool> Promise<void>::Resolve() {
v8::HandleScope handle_scope(isolate());
- gin_helper::MicrotasksScope microtasks_scope(isolate());
+ gin_helper::MicrotasksScope microtasks_scope(
+ isolate(), GetContext()->GetMicrotaskQueue());
v8::Context::Scope context_scope(GetContext());
return GetInner()->Resolve(GetContext(), v8::Undefined(isolate()));
diff --git a/shell/common/gin_helper/promise.h b/shell/common/gin_helper/promise.h
index c720b588d7..4029cb505b 100644
--- a/shell/common/gin_helper/promise.h
+++ b/shell/common/gin_helper/promise.h
@@ -118,7 +118,8 @@ class Promise : public PromiseBase {
v8::Maybe<bool> Resolve(const RT& value) {
gin_helper::Locker locker(isolate());
v8::HandleScope handle_scope(isolate());
- gin_helper::MicrotasksScope microtasks_scope(isolate());
+ gin_helper::MicrotasksScope microtasks_scope(
+ isolate(), GetContext()->GetMicrotaskQueue());
v8::Context::Scope context_scope(GetContext());
return GetInner()->Resolve(GetContext(),
diff --git a/shell/common/node_bindings.cc b/shell/common/node_bindings.cc
index de5ca32838..7f135bfc77 100644
--- a/shell/common/node_bindings.cc
+++ b/shell/common/node_bindings.cc
@@ -192,11 +192,11 @@ v8::ModifyCodeGenerationFromStringsResult ModifyCodeGenerationFromStrings(
void ErrorMessageListener(v8::Local<v8::Message> message,
v8::Local<v8::Value> data) {
v8::Isolate* isolate = v8::Isolate::GetCurrent();
- gin_helper::MicrotasksScope microtasks_scope(
- isolate, v8::MicrotasksScope::kDoNotRunMicrotasks);
node::Environment* env = node::Environment::GetCurrent(isolate);
-
if (env) {
+ gin_helper::MicrotasksScope microtasks_scope(
+ isolate, env->context()->GetMicrotaskQueue(),
+ v8::MicrotasksScope::kDoNotRunMicrotasks);
// Emit the after() hooks now that the exception has been handled.
// Analogous to node/lib/internal/process/execution.js#L176-L180
if (env->async_hooks()->fields()[node::AsyncHooks::kAfter]) {
@@ -684,9 +684,10 @@ void NodeBindings::UvRunOnce() {
// checkpoints after every call into JavaScript. Since we use a different
// policy in the renderer - switch to `kExplicit` and then drop back to the
// previous policy value.
- auto old_policy = env->isolate()->GetMicrotasksPolicy();
- DCHECK_EQ(v8::MicrotasksScope::GetCurrentDepth(env->isolate()), 0);
- env->isolate()->SetMicrotasksPolicy(v8::MicrotasksPolicy::kExplicit);
+ v8::MicrotaskQueue* microtask_queue = env->context()->GetMicrotaskQueue();
+ auto old_policy = microtask_queue->microtasks_policy();
+ DCHECK_EQ(microtask_queue->GetMicrotasksScopeDepth(), 0);
+ microtask_queue->set_microtasks_policy(v8::MicrotasksPolicy::kExplicit);
if (browser_env_ != BrowserEnvironment::kBrowser)
TRACE_EVENT_BEGIN0("devtools.timeline", "FunctionCall");
@@ -697,7 +698,7 @@ void NodeBindings::UvRunOnce() {
if (browser_env_ != BrowserEnvironment::kBrowser)
TRACE_EVENT_END0("devtools.timeline", "FunctionCall");
- env->isolate()->SetMicrotasksPolicy(old_policy);
+ microtask_queue->set_microtasks_policy(old_policy);
if (r == 0)
base::RunLoop().QuitWhenIdle(); // Quit from uv.
diff --git a/shell/common/v8_value_serializer.cc b/shell/common/v8_value_serializer.cc
index 6ede4c21db..645797bcbb 100644
--- a/shell/common/v8_value_serializer.cc
+++ b/shell/common/v8_value_serializer.cc
@@ -34,7 +34,8 @@ class V8Serializer : public v8::ValueSerializer::Delegate {
bool Serialize(v8::Local<v8::Value> value, blink::CloneableMessage* out) {
gin_helper::MicrotasksScope microtasks_scope(
- isolate_, v8::MicrotasksScope::kDoNotRunMicrotasks);
+ isolate_, isolate_->GetCurrentContext()->GetMicrotaskQueue(),
+ v8::MicrotasksScope::kDoNotRunMicrotasks);
WriteBlinkEnvelope(19);
serializer_.WriteHeader();
diff --git a/shell/renderer/api/electron_api_spell_check_client.cc b/shell/renderer/api/electron_api_spell_check_client.cc
index 916022a5d7..77a2b42831 100644
--- a/shell/renderer/api/electron_api_spell_check_client.cc
+++ b/shell/renderer/api/electron_api_spell_check_client.cc
@@ -217,14 +217,14 @@ void SpellCheckClient::SpellCheckWords(const SpellCheckScope& scope,
const std::set<std::u16string>& words) {
DCHECK(!scope.spell_check_.IsEmpty());
+ auto context = isolate_->GetCurrentContext();
gin_helper::MicrotasksScope microtasks_scope(
- isolate_, v8::MicrotasksScope::kDoNotRunMicrotasks);
+ isolate_, context->GetMicrotaskQueue(),
+ v8::MicrotasksScope::kDoNotRunMicrotasks);
v8::Local<v8::FunctionTemplate> templ = gin_helper::CreateFunctionTemplate(
isolate_,
base::BindRepeating(&SpellCheckClient::OnSpellCheckDone, AsWeakPtr()));
-
- auto context = isolate_->GetCurrentContext();
v8::Local<v8::Value> args[] = {gin::ConvertToV8(isolate_, words),
templ->GetFunction(context).ToLocalChecked()};
// Call javascript with the words and the callback function
diff --git a/shell/renderer/electron_api_service_impl.cc b/shell/renderer/electron_api_service_impl.cc
index 370f429071..65fc61a2ce 100644
--- a/shell/renderer/electron_api_service_impl.cc
+++ b/shell/renderer/electron_api_service_impl.cc
@@ -87,7 +87,7 @@ void EmitIPCEvent(v8::Local<v8::Context> context,
v8::HandleScope handle_scope(isolate);
v8::Context::Scope context_scope(context);
- v8::MicrotasksScope script_scope(isolate,
+ v8::MicrotasksScope script_scope(isolate, context->GetMicrotaskQueue(),
v8::MicrotasksScope::kRunMicrotasks);
std::vector<v8::Local<v8::Value>> argv = {
diff --git a/shell/renderer/electron_render_frame_observer.cc b/shell/renderer/electron_render_frame_observer.cc
index 3fbdf4e5bb..11fedbf35e 100644
--- a/shell/renderer/electron_render_frame_observer.cc
+++ b/shell/renderer/electron_render_frame_observer.cc
@@ -67,9 +67,10 @@ void ElectronRenderFrameObserver::DidClearWindowObject() {
!web_frame->IsOnInitialEmptyDocument()) {
v8::Isolate* isolate = blink::MainThreadIsolate();
v8::HandleScope handle_scope(isolate);
- v8::MicrotasksScope microtasks_scope(
- isolate, v8::MicrotasksScope::kDoNotRunMicrotasks);
v8::Handle<v8::Context> context = web_frame->MainWorldScriptContext();
+ v8::MicrotasksScope microtasks_scope(
+ isolate, context->GetMicrotaskQueue(),
+ v8::MicrotasksScope::kDoNotRunMicrotasks);
v8::Context::Scope context_scope(context);
// DidClearWindowObject only emits for the main world.
DidInstallConditionalFeatures(context, MAIN_WORLD_ID);
@@ -112,7 +113,8 @@ void ElectronRenderFrameObserver::DidInstallConditionalFeatures(
auto* isolate = context->GetIsolate();
v8::MicrotasksScope microtasks_scope(
- isolate, v8::MicrotasksScope::kDoNotRunMicrotasks);
+ isolate, context->GetMicrotaskQueue(),
+ v8::MicrotasksScope::kDoNotRunMicrotasks);
if (ShouldNotifyClient(world_id))
renderer_client_->DidCreateScriptContext(context, render_frame_);
diff --git a/shell/renderer/electron_renderer_client.cc b/shell/renderer/electron_renderer_client.cc
index 66cadfbcbe..50b5cde56e 100644
--- a/shell/renderer/electron_renderer_client.cc
+++ b/shell/renderer/electron_renderer_client.cc
@@ -138,10 +138,10 @@ void ElectronRendererClient::WillReleaseScriptContext(
// checkpoints after every call into JavaScript. Since we use a different
// policy in the renderer - switch to `kExplicit` and then drop back to the
// previous policy value.
- v8::Isolate* isolate = context->GetIsolate();
- auto old_policy = isolate->GetMicrotasksPolicy();
- DCHECK_EQ(v8::MicrotasksScope::GetCurrentDepth(isolate), 0);
- isolate->SetMicrotasksPolicy(v8::MicrotasksPolicy::kExplicit);
+ v8::MicrotaskQueue* microtask_queue = context->GetMicrotaskQueue();
+ auto old_policy = microtask_queue->microtasks_policy();
+ DCHECK_EQ(microtask_queue->GetMicrotasksScopeDepth(), 0);
+ microtask_queue->set_microtasks_policy(v8::MicrotasksPolicy::kExplicit);
node::FreeEnvironment(env);
if (node_bindings_->uv_env() == nullptr) {
@@ -149,7 +149,7 @@ void ElectronRendererClient::WillReleaseScriptContext(
node_bindings_->set_isolate_data(nullptr);
}
- isolate->SetMicrotasksPolicy(old_policy);
+ microtask_queue->set_microtasks_policy(old_policy);
// ElectronBindings is tracking node environments.
electron_bindings_->EnvironmentDestroyed(env);
diff --git a/shell/renderer/electron_sandboxed_renderer_client.cc b/shell/renderer/electron_sandboxed_renderer_client.cc
index a73404ac02..a0e36ff3dc 100644
--- a/shell/renderer/electron_sandboxed_renderer_client.cc
+++ b/shell/renderer/electron_sandboxed_renderer_client.cc
@@ -162,12 +162,12 @@ void ElectronSandboxedRendererClient::RunScriptsAtDocumentStart(
return;
auto* isolate = blink::MainThreadIsolate();
- gin_helper::MicrotasksScope microtasks_scope(
- isolate, v8::MicrotasksScope::kDoNotRunMicrotasks);
v8::HandleScope handle_scope(isolate);
-
v8::Local<v8::Context> context =
GetContext(render_frame->GetWebFrame(), isolate);
+ gin_helper::MicrotasksScope microtasks_scope(
+ isolate, context->GetMicrotaskQueue(),
+ v8::MicrotasksScope::kDoNotRunMicrotasks);
v8::Context::Scope context_scope(context);
InvokeHiddenCallback(context, kLifecycleKey, "onDocumentStart");
@@ -180,12 +180,12 @@ void ElectronSandboxedRendererClient::RunScriptsAtDocumentEnd(
return;
auto* isolate = blink::MainThreadIsolate();
- gin_helper::MicrotasksScope microtasks_scope(
- isolate, v8::MicrotasksScope::kDoNotRunMicrotasks);
v8::HandleScope handle_scope(isolate);
-
v8::Local<v8::Context> context =
GetContext(render_frame->GetWebFrame(), isolate);
+ gin_helper::MicrotasksScope microtasks_scope(
+ isolate, context->GetMicrotaskQueue(),
+ v8::MicrotasksScope::kDoNotRunMicrotasks);
v8::Context::Scope context_scope(context);
InvokeHiddenCallback(context, kLifecycleKey, "onDocumentEnd");
@@ -230,7 +230,8 @@ void ElectronSandboxedRendererClient::WillReleaseScriptContext(
auto* isolate = context->GetIsolate();
gin_helper::MicrotasksScope microtasks_scope(
- isolate, v8::MicrotasksScope::kDoNotRunMicrotasks);
+ isolate, context->GetMicrotaskQueue(),
+ v8::MicrotasksScope::kDoNotRunMicrotasks);
v8::HandleScope handle_scope(isolate);
v8::Context::Scope context_scope(context);
InvokeHiddenCallback(context, kLifecycleKey, "onExit");
diff --git a/shell/renderer/web_worker_observer.cc b/shell/renderer/web_worker_observer.cc
index 0eb07182fa..7cf9c1cd69 100644
--- a/shell/renderer/web_worker_observer.cc
+++ b/shell/renderer/web_worker_observer.cc
@@ -41,11 +41,14 @@ WebWorkerObserver::~WebWorkerObserver() {
// Node.js expects `kExplicit` microtasks policy and will run microtasks
// checkpoints after every call into JavaScript. Since we use a different
// policy in the renderer - switch to `kExplicit`
- v8::Isolate* isolate = node_bindings_->uv_env()->isolate();
- DCHECK_EQ(v8::MicrotasksScope::GetCurrentDepth(isolate), 0);
- isolate->SetMicrotasksPolicy(v8::MicrotasksPolicy::kExplicit);
+ v8::MicrotaskQueue* microtask_queue =
+ node_bindings_->uv_env()->context()->GetMicrotaskQueue();
+ auto old_policy = microtask_queue->microtasks_policy();
+ DCHECK_EQ(microtask_queue->GetMicrotasksScopeDepth(), 0);
+ microtask_queue->set_microtasks_policy(v8::MicrotasksPolicy::kExplicit);
node::FreeEnvironment(node_bindings_->uv_env());
node::FreeIsolateData(node_bindings_->isolate_data());
+ microtask_queue->set_microtasks_policy(old_policy);
}
void WebWorkerObserver::WorkerScriptReadyForEvaluation(
@@ -53,7 +56,8 @@ void WebWorkerObserver::WorkerScriptReadyForEvaluation(
v8::Context::Scope context_scope(worker_context);
auto* isolate = worker_context->GetIsolate();
v8::MicrotasksScope microtasks_scope(
- isolate, v8::MicrotasksScope::kDoNotRunMicrotasks);
+ isolate, worker_context->GetMicrotaskQueue(),
+ v8::MicrotasksScope::kDoNotRunMicrotasks);
// Start the embed thread.
node_bindings_->PrepareEmbedThread();
|
chore
|
7609156ae176cf0308c38ded42eb0cee9b502882
|
electron-appveyor-updater[bot]
|
2024-03-20 11:50:10
|
build: update appveyor image to latest version (#41617)
Co-authored-by: electron-appveyor-updater[bot] <161660339+electron-appveyor-updater[bot]@users.noreply.github.com>
|
diff --git a/appveyor-woa.yml b/appveyor-woa.yml
index 88279140e3..05bc9ef1fb 100644
--- a/appveyor-woa.yml
+++ b/appveyor-woa.yml
@@ -29,7 +29,7 @@
version: 1.0.{build}
build_cloud: electronhq-16-core
-image: e-124.0.6353.0
+image: e-124.0.6359.0
environment:
GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache
ELECTRON_OUT_DIR: Default
diff --git a/appveyor.yml b/appveyor.yml
index caf83ffff6..83f8ec8fbc 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -29,7 +29,7 @@
version: 1.0.{build}
build_cloud: electronhq-16-core
-image: e-124.0.6353.0
+image: e-124.0.6359.0
environment:
GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache
ELECTRON_OUT_DIR: Default
|
build
|
dd68581d30fa710f1c48ad12730b3db2cfb5d19b
|
Milan Burda
|
2023-10-30 10:07:23
|
docs: add reference to `app.getAppMetrics()` in `serviceName` for `utilityProcess` (#40338)
|
diff --git a/docs/api/utility-process.md b/docs/api/utility-process.md
index f5e2542a21..7c19dd1be9 100644
--- a/docs/api/utility-process.md
+++ b/docs/api/utility-process.md
@@ -28,7 +28,8 @@ Process: [Main](../glossary.md#main-process)<br />
* `ignore`: equivalent to \['ignore', 'ignore', 'ignore']
* `inherit`: equivalent to \['ignore', 'inherit', 'inherit']
* `serviceName` string (optional) - Name of the process that will appear in `name` property of
- [`child-process-gone` event of `app`](app.md#event-child-process-gone).
+ [`ProcessMetric`](structures/process-metric.md) returned by [`app.getAppMetrics`](app.md#appgetappmetrics)
+ and [`child-process-gone` event of `app`](app.md#event-child-process-gone).
Default is `Node Utility Process`.
* `allowLoadingUnsignedLibraries` boolean (optional) _macOS_ - With this flag, the utility process will be
launched via the `Electron Helper (Plugin).app` helper executable on macOS, which can be
|
docs
|
e71a56d11e5457b9dc7ff56735c97a2200a2428a
|
Milan Burda
|
2023-09-07 00:04:25
|
refactor: const Module = require('module') as NodeJS.ModuleInternal; (#38757)
Co-authored-by: Milan Burda <[email protected]>
|
diff --git a/lib/asar/fs-wrapper.ts b/lib/asar/fs-wrapper.ts
index 3423d845f8..2427c9473f 100644
--- a/lib/asar/fs-wrapper.ts
+++ b/lib/asar/fs-wrapper.ts
@@ -5,7 +5,7 @@ import type * as Crypto from 'crypto';
const asar = process._linkedBinding('electron_common_asar');
-const Module = require('module');
+const Module = require('module') as NodeJS.ModuleInternal;
const Promise: PromiseConstructor = global.Promise;
diff --git a/lib/browser/init.ts b/lib/browser/init.ts
index 7f921cb8a1..5fb42e84fe 100644
--- a/lib/browser/init.ts
+++ b/lib/browser/init.ts
@@ -4,7 +4,7 @@ import * as path from 'path';
import type * as defaultMenuModule from '@electron/internal/browser/default-menu';
-const Module = require('module');
+const Module = require('module') as NodeJS.ModuleInternal;
// We modified the original process.argv to let node.js load the init.js,
// we need to restore it here.
diff --git a/lib/common/reset-search-paths.ts b/lib/common/reset-search-paths.ts
index ebb72862a8..4268613532 100644
--- a/lib/common/reset-search-paths.ts
+++ b/lib/common/reset-search-paths.ts
@@ -1,6 +1,6 @@
import * as path from 'path';
-const Module = require('module');
+const Module = require('module') as NodeJS.ModuleInternal;
// We do not want to allow use of the VM module in the renderer process as
// it conflicts with Blink's V8::Context internal logic.
@@ -10,7 +10,7 @@ if (process.type === 'renderer') {
if (request === 'vm') {
console.warn('The vm module of Node.js is deprecated in the renderer process and will be removed.');
}
- return _load.apply(this, arguments);
+ return _load.apply(this, arguments as any);
};
}
@@ -60,7 +60,7 @@ const originalResolveFilename = Module._resolveFilename;
// renderer process regardless of the names, they're superficial for TypeScript
// only.
const electronModuleNames = new Set(['electron', 'electron/main', 'electron/renderer', 'electron/common']);
-Module._resolveFilename = function (request: string, parent: NodeModule, isMain: boolean, options?: { paths: Array<string>}) {
+Module._resolveFilename = function (request, parent, isMain, options) {
if (electronModuleNames.has(request)) {
return 'electron';
} else {
diff --git a/lib/renderer/init.ts b/lib/renderer/init.ts
index 7bd00af472..3c1a150d6b 100644
--- a/lib/renderer/init.ts
+++ b/lib/renderer/init.ts
@@ -5,7 +5,7 @@ import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
import type * as ipcRendererInternalModule from '@electron/internal/renderer/ipc-renderer-internal';
import type * as ipcRendererUtilsModule from '@electron/internal/renderer/ipc-renderer-internal-utils';
-const Module = require('module');
+const Module = require('module') as NodeJS.ModuleInternal;
// Make sure globals like "process" and "global" are always available in preload
// scripts even after they are deleted in "loaded" script.
diff --git a/lib/utility/init.ts b/lib/utility/init.ts
index d360dd514e..5cf1ee1fde 100644
--- a/lib/utility/init.ts
+++ b/lib/utility/init.ts
@@ -1,5 +1,5 @@
import { ParentPort } from '@electron/internal/utility/parent-port';
-const Module = require('module');
+const Module = require('module') as NodeJS.ModuleInternal;
const v8Util = process._linkedBinding('electron_common_v8_util');
const entryScript: string = v8Util.getHiddenValue(process, '_serviceStartupScript');
diff --git a/lib/worker/init.ts b/lib/worker/init.ts
index a72f643c8a..7c2beaa070 100644
--- a/lib/worker/init.ts
+++ b/lib/worker/init.ts
@@ -1,6 +1,6 @@
import * as path from 'path';
-const Module = require('module');
+const Module = require('module') as NodeJS.ModuleInternal;
// We modified the original process.argv to let node.js load the
// init.js, we need to restore it here.
diff --git a/spec/modules-spec.ts b/spec/modules-spec.ts
index a6e8bc2e68..22cf628043 100644
--- a/spec/modules-spec.ts
+++ b/spec/modules-spec.ts
@@ -7,7 +7,7 @@ import { closeAllWindows } from './lib/window-helpers';
import * as childProcess from 'node:child_process';
import { once } from 'node:events';
-const Module = require('node:module');
+const Module = require('node:module') as NodeJS.ModuleInternal;
const nativeModulesEnabled = !process.env.ELECTRON_SKIP_NATIVE_MODULE_TESTS;
diff --git a/typings/internal-ambient.d.ts b/typings/internal-ambient.d.ts
index 1805f58de4..9fa99fb932 100644
--- a/typings/internal-ambient.d.ts
+++ b/typings/internal-ambient.d.ts
@@ -3,6 +3,17 @@ declare const BUILDFLAG: (flag: boolean) => boolean;
declare const ENABLE_VIEWS_API: boolean;
declare namespace NodeJS {
+ interface ModuleInternal extends NodeJS.Module {
+ new(id: string, parent?: NodeJS.Module | null): NodeJS.Module;
+ _load(request: string, parent?: NodeJS.Module | null, isMain?: boolean): any;
+ _resolveFilename(request: string, parent?: NodeJS.Module | null, isMain?: boolean, options?: { paths: string[] }): string;
+ _preloadModules(requests: string[]): void;
+ _nodeModulePaths(from: string): string[];
+ _extensions: Record<string, (module: NodeJS.Module, filename: string) => any>;
+ _cache: Record<string, NodeJS.Module>;
+ wrapper: [string, string];
+ }
+
interface FeaturesBinding {
isBuiltinSpellCheckerEnabled(): boolean;
isPDFViewerEnabled(): boolean;
|
refactor
|
f72096194fd4ae39c78f73b0acbe1a77aec04b13
|
Samuel Attard
|
2024-06-13 09:09:35
|
build: reuse checkout steps across mac and linux (#42475)
|
diff --git a/.github/actions/checkout/action.yml b/.github/actions/checkout/action.yml
new file mode 100644
index 0000000000..e8a300a014
--- /dev/null
+++ b/.github/actions/checkout/action.yml
@@ -0,0 +1,154 @@
+name: 'Checkout'
+description: 'Checks out Electron and stores it in the AKS Cache'
+inputs:
+ generate-sas-token:
+ description: 'Whether to generate and persist a SAS token for the item in the cache'
+ required: false
+ default: 'false'
+runs:
+ using: "composite"
+ steps:
+ - name: Set GIT_CACHE_PATH to make gclient to use the cache
+ shell: bash
+ run: |
+ echo "GIT_CACHE_PATH=$(pwd)/git-cache" >> $GITHUB_ENV
+ - name: Install Dependencies
+ shell: bash
+ run: |
+ cd src/electron
+ node script/yarn install
+ - name: Get Depot Tools
+ shell: bash
+ run: |
+ git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
+
+ sed -i '/ninjalog_uploader_wrapper.py/d' ./depot_tools/autoninja
+ # Remove swift-format dep from cipd on macOS until we send a patch upstream.
+ cd depot_tools
+ git apply --3way ../src/electron/.github/workflows/config/gclient.diff
+
+ # Ensure depot_tools does not update.
+ test -d depot_tools && cd depot_tools
+ touch .disable_auto_update
+ - name: Add Depot Tools to PATH
+ shell: bash
+ run: echo "$(pwd)/depot_tools" >> $GITHUB_PATH
+ - name: Generate DEPS Hash
+ shell: bash
+ run: |
+ node src/electron/script/generate-deps-hash.js && cat src/electron/.depshash-target
+ echo "DEPSHASH=v1-src-cache-$(shasum src/electron/.depshash | cut -f1 -d' ')" >> $GITHUB_ENV
+ - name: Generate SAS Key
+ if: ${{ inputs.generate-sas-token }} == 'true'
+ shell: bash
+ run: |
+ curl --unix-socket /var/run/sas/sas.sock --fail "http://foo/$DEPSHASH.tar" > sas-token
+ - name: Save SAS Key
+ if: ${{ inputs.generate-sas-token }} == 'true'
+ uses: actions/cache/save@v4
+ with:
+ path: |
+ sas-token
+ key: sas-key-${{ github.run_number }}-${{ github.run_attempt }}
+ - name: Check If Cache Exists
+ id: check-cache
+ shell: bash
+ run: |
+ cache_path=/mnt/cross-instance-cache/$DEPSHASH.tar
+ echo "Using cache key: $DEPSHASH"
+ echo "Checking for cache in: $cache_path"
+ if [ ! -f "$cache_path" ]; then
+ echo "cache_exists=false" >> $GITHUB_OUTPUT
+ echo "Cache Does Not Exist for $DEPSHASH"
+ else
+ echo "cache_exists=true" >> $GITHUB_OUTPUT
+ echo "Cache Already Exists for $DEPSHASH, Skipping.."
+ fi
+ - name: Gclient Sync
+ if: steps.check-cache.outputs.cache_exists == 'false'
+ shell: bash
+ run: |
+ gclient config \
+ --name "src/electron" \
+ --unmanaged \
+ ${GCLIENT_EXTRA_ARGS} \
+ "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY"
+
+ ELECTRON_USE_THREE_WAY_MERGE_FOR_PATCHES=1 gclient sync --with_branch_heads --with_tags -vvvvv
+ if [ "${{ inputs.is-release }}" != "true" ]; then
+ # Re-export all the patches to check if there were changes.
+ python3 src/electron/script/export_all_patches.py src/electron/patches/config.json
+ cd src/electron
+ git update-index --refresh || true
+ if ! git diff-index --quiet HEAD --; then
+ # There are changes to the patches. Make a git commit with the updated patches
+ git add patches
+ GIT_COMMITTER_NAME="PatchUp" GIT_COMMITTER_EMAIL="73610968+patchup[bot]@users.noreply.github.com" git commit -m "chore: update patches" --author="PatchUp <73610968+patchup[bot]@users.noreply.github.com>"
+ # Export it
+ mkdir -p ../../patches
+ git format-patch -1 --stdout --keep-subject --no-stat --full-index > ../../patches/update-patches.patch
+ if (node ./script/push-patch.js 2> /dev/null > /dev/null); then
+ echo
+ echo "======================================================================"
+ echo "Changes to the patches when applying, we have auto-pushed the diff to the current branch"
+ echo "A new CI job will kick off shortly"
+ echo "======================================================================"
+ exit 1
+ else
+ echo
+ echo "======================================================================"
+ echo "There were changes to the patches when applying."
+ echo "Check the CI artifacts for a patch you can apply to fix it."
+ echo "======================================================================"
+ exit 1
+ fi
+ fi
+ fi
+
+ # delete all .git directories under src/ except for
+ # third_party/angle/ and third_party/dawn/ because of build time generation of files
+ # gen/angle/commit.h depends on third_party/angle/.git/HEAD
+ # https://chromium-review.googlesource.com/c/angle/angle/+/2074924
+ # and dawn/common/Version_autogen.h depends on third_party/dawn/.git/HEAD
+ # https://dawn-review.googlesource.com/c/dawn/+/83901
+ # TODO: maybe better to always leave out */.git/HEAD file for all targets ?
+ - name: Delete .git directories under src to free space
+ if: steps.check-cache.outputs.cache_exists == 'false'
+ shell: bash
+ run: |
+ cd src
+ ( find . -type d -name ".git" -not -path "./third_party/angle/*" -not -path "./third_party/dawn/*" -not -path "./electron/*" ) | xargs rm -rf
+ - name: Minimize Cache Size for Upload
+ if: steps.check-cache.outputs.cache_exists == 'false'
+ shell: bash
+ run: |
+ rm -rf src/android_webview
+ rm -rf src/ios/chrome
+ rm -rf src/third_party/blink/web_tests
+ rm -rf src/third_party/blink/perf_tests
+ rm -rf src/chrome/test/data/xr/webvr_info
+ rm -rf src/third_party/angle/third_party/VK-GL-CTS/src
+ rm -rf src/third_party/swift-toolchain
+ rm -rf src/third_party/swiftshader/tests/regres/testlists
+ rm -rf src/electron
+ - name: Compress Src Directory
+ if: steps.check-cache.outputs.cache_exists == 'false'
+ shell: bash
+ run: |
+ echo "Uncompressed src size: $(du -sh src | cut -f1 -d' ')"
+ tar -cf $DEPSHASH.tar src
+ echo "Compressed src to $(du -sh $DEPSHASH.tar | cut -f1 -d' ')"
+ cp ./$DEPSHASH.tar /mnt/cross-instance-cache/
+ - name: Persist Src Cache
+ if: steps.check-cache.outputs.cache_exists == 'false'
+ shell: bash
+ run: |
+ final_cache_path=/mnt/cross-instance-cache/$DEPSHASH.tar
+ echo "Using cache key: $DEPSHASH"
+ echo "Checking path: $final_cache_path"
+ if [ ! -f "$final_cache_path" ]; then
+ echo "Cache key not found"
+ exit 1
+ else
+ echo "Cache key persisted in $final_cache_path"
+ fi
\ No newline at end of file
diff --git a/.github/workflows/linux-build.yml b/.github/workflows/linux-build.yml
index 2c5be4dd6d..2ebe367436 100644
--- a/.github/workflows/linux-build.yml
+++ b/.github/workflows/linux-build.yml
@@ -7,7 +7,7 @@ on:
jobs:
build:
- uses: electron/electron/.github/workflows/linux-pipeline.yml@main
+ uses: ./.github/workflows/linux-pipeline.yml
with:
is-release: false
gn-config: //electron/build/args/testing.gn
diff --git a/.github/workflows/linux-pipeline.yml b/.github/workflows/linux-pipeline.yml
index 49be09a536..f7e423b6c3 100644
--- a/.github/workflows/linux-pipeline.yml
+++ b/.github/workflows/linux-pipeline.yml
@@ -60,125 +60,8 @@ jobs:
with:
path: src/electron
fetch-depth: 0
- - name: Set GIT_CACHE_PATH to make gclient to use the cache
- run: |
- echo "GIT_CACHE_PATH=$(pwd)/git-cache" >> $GITHUB_ENV
- - name: Install Dependencies
- run: |
- cd src/electron
- node script/yarn install
- - name: Get Depot Tools
- timeout-minutes: 5
- run: |
- git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
- sed -i '/ninjalog_uploader_wrapper.py/d' ./depot_tools/autoninja
- cd depot_tools
- git apply --3way ../src/electron/.github/workflows/config/gclient.diff
- # Ensure depot_tools does not update.
- test -d depot_tools && cd depot_tools
- touch .disable_auto_update
- - name: Add Depot Tools to PATH
- run: echo "$(pwd)/depot_tools" >> $GITHUB_PATH
- - name: Generate DEPS Hash
- run: |
- node src/electron/script/generate-deps-hash.js && cat src/electron/.depshash-target
- echo "DEPSHASH=v1-src-cache-$(shasum src/electron/.depshash | cut -f1 -d' ')" >> $GITHUB_ENV
- - name: Check If Cache Exists
- id: check-cache
- run: |
- cache_path=/mnt/cross-instance-cache/$DEPSHASH.tar
- echo "Using cache key: $DEPSHASH"
- echo "Checking for cache in: $cache_path"
- if [ ! -f "$cache_path" ]; then
- echo "cache_exists=false" >> $GITHUB_OUTPUT
- echo "Cache Does Not Exist for $DEPSHASH"
- else
- echo "cache_exists=true" >> $GITHUB_OUTPUT
- echo "Cache Already Exists for $DEPSHASH, Skipping.."
- fi
- - name: Gclient Sync
- if: steps.check-cache.outputs.cache_exists == 'false'
- run: |
- gclient config \
- --name "src/electron" \
- --unmanaged \
- ${GCLIENT_EXTRA_ARGS} \
- "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY"
-
- ELECTRON_USE_THREE_WAY_MERGE_FOR_PATCHES=1 gclient sync --with_branch_heads --with_tags -vvvvv
- if [ "${{ inputs.is-release }}" != "true" ]; then
- # Re-export all the patches to check if there were changes.
- python3 src/electron/script/export_all_patches.py src/electron/patches/config.json
- cd src/electron
- git update-index --refresh || true
- if ! git diff-index --quiet HEAD --; then
- # There are changes to the patches. Make a git commit with the updated patches
- git add patches
- GIT_COMMITTER_NAME="PatchUp" GIT_COMMITTER_EMAIL="73610968+patchup[bot]@users.noreply.github.com" git commit -m "chore: update patches" --author="PatchUp <73610968+patchup[bot]@users.noreply.github.com>"
- # Export it
- mkdir -p ../../patches
- git format-patch -1 --stdout --keep-subject --no-stat --full-index > ../../patches/update-patches.patch
- if (node ./script/push-patch.js 2> /dev/null > /dev/null); then
- echo
- echo "======================================================================"
- echo "Changes to the patches when applying, we have auto-pushed the diff to the current branch"
- echo "A new CI job will kick off shortly"
- echo "======================================================================"
- exit 1
- else
- echo
- echo "======================================================================"
- echo "There were changes to the patches when applying."
- echo "Check the CI artifacts for a patch you can apply to fix it."
- echo "======================================================================"
- exit 1
- fi
- fi
- fi
-
- # delete all .git directories under src/ except for
- # third_party/angle/ and third_party/dawn/ because of build time generation of files
- # gen/angle/commit.h depends on third_party/angle/.git/HEAD
- # https://chromium-review.googlesource.com/c/angle/angle/+/2074924
- # and dawn/common/Version_autogen.h depends on third_party/dawn/.git/HEAD
- # https://dawn-review.googlesource.com/c/dawn/+/83901
- # TODO: maybe better to always leave out */.git/HEAD file for all targets ?
- - name: Delete .git directories under src to free space
- if: steps.check-cache.outputs.cache_exists == 'false'
- run: |
- cd src
- ( find . -type d -name ".git" -not -path "./third_party/angle/*" -not -path "./third_party/dawn/*" -not -path "./electron/*" ) | xargs rm -rf
- - name: Minimize Cache Size for Upload
- if: steps.check-cache.outputs.cache_exists == 'false'
- run: |
- rm -rf src/android_webview
- rm -rf src/ios/chrome
- rm -rf src/third_party/blink/web_tests
- rm -rf src/third_party/blink/perf_tests
- rm -rf src/chrome/test/data/xr/webvr_info
- rm -rf src/third_party/angle/third_party/VK-GL-CTS/src
- rm -rf src/third_party/swift-toolchain
- rm -rf src/third_party/swiftshader/tests/regres/testlists
- rm -rf src/electron
- - name: Compress Src Directory
- if: steps.check-cache.outputs.cache_exists == 'false'
- run: |
- echo "Uncompressed src size: $(du -sh src | cut -f1 -d' ')"
- tar -cf $DEPSHASH.tar src
- echo "Compressed src to $(du -sh $DEPSHASH.tar | cut -f1 -d' ')"
- cp ./$DEPSHASH.tar /mnt/cross-instance-cache/
- - name: Persist Src Cache
- if: steps.check-cache.outputs.cache_exists == 'false'
- run: |
- final_cache_path=/mnt/cross-instance-cache/$DEPSHASH.tar
- echo "Using cache key: $DEPSHASH"
- echo "Checking path: $final_cache_path"
- if [ ! -f "$final_cache_path" ]; then
- echo "Cache key not found"
- exit 1
- else
- echo "Cache key persisted in $final_cache_path"
- fi
+ - name: Checkout & Sync & Save
+ uses: ./src/electron/.github/actions/checkout
build:
strategy:
fail-fast: false
diff --git a/.github/workflows/linux-publish.yml b/.github/workflows/linux-publish.yml
index edfd928be7..edb985d8ef 100644
--- a/.github/workflows/linux-publish.yml
+++ b/.github/workflows/linux-publish.yml
@@ -15,7 +15,7 @@ on:
jobs:
publish:
- uses: electron/electron/.github/workflows/linux-pipeline.yml@main
+ uses: ./.github/workflows/linux-pipeline.yml
with:
is-release: true
gn-config: //electron/build/args/release.gn
diff --git a/.github/workflows/macos-build.yml b/.github/workflows/macos-build.yml
index 41ba81e923..5a0c55fde6 100644
--- a/.github/workflows/macos-build.yml
+++ b/.github/workflows/macos-build.yml
@@ -7,7 +7,7 @@ on:
jobs:
build:
- uses: electron/electron/.github/workflows/macos-pipeline.yml@main
+ uses: ./.github/workflows/macos-pipeline.yml
with:
is-release: false
gn-config: //electron/build/args/testing.gn
diff --git a/.github/workflows/macos-pipeline.yml b/.github/workflows/macos-pipeline.yml
index 64572ca573..9f0994f1ef 100644
--- a/.github/workflows/macos-pipeline.yml
+++ b/.github/workflows/macos-pipeline.yml
@@ -63,137 +63,10 @@ jobs:
with:
path: src/electron
fetch-depth: 0
- - name: Set GIT_CACHE_PATH to make gclient to use the cache
- run: |
- echo "GIT_CACHE_PATH=$(pwd)/git-cache" >> $GITHUB_ENV
- - name: Install Dependencies
- run: |
- cd src/electron
- node script/yarn install
- - name: Get Depot Tools
- timeout-minutes: 5
- run: |
- git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
-
- sed -i '/ninjalog_uploader_wrapper.py/d' ./depot_tools/autoninja
- # Remove swift-format dep from cipd on macOS until we send a patch upstream.
- cd depot_tools
- git apply --3way ../src/electron/.github/workflows/config/gclient.diff
-
- # Ensure depot_tools does not update.
- test -d depot_tools && cd depot_tools
- touch .disable_auto_update
- - name: Add Depot Tools to PATH
- run: echo "$(pwd)/depot_tools" >> $GITHUB_PATH
- - name: Generate DEPS Hash
- run: |
- node src/electron/script/generate-deps-hash.js && cat src/electron/.depshash-target
- echo "DEPSHASH=v1-src-cache-$(shasum src/electron/.depshash | cut -f1 -d' ')" >> $GITHUB_ENV
- - name: Generate SAS Key
- run: |
- curl --unix-socket /var/run/sas/sas.sock --fail "http://foo/$DEPSHASH.tar" > sas-token
- - name: Save SAS Key
- uses: actions/cache/save@v4
+ - name: Checkout & Sync & Save
+ uses: ./src/electron/.github/actions/checkout
with:
- path: |
- sas-token
- key: sas-key-${{ github.run_number }}-${{ github.run_attempt }}
- - name: Check If Cache Exists
- id: check-cache
- run: |
- cache_path=/mnt/cross-instance-cache/$DEPSHASH.tar
- echo "Using cache key: $DEPSHASH"
- echo "Checking for cache in: $cache_path"
- if [ ! -f "$cache_path" ]; then
- echo "cache_exists=false" >> $GITHUB_OUTPUT
- echo "Cache Does Not Exist for $DEPSHASH"
- else
- echo "cache_exists=true" >> $GITHUB_OUTPUT
- echo "Cache Already Exists for $DEPSHASH, Skipping.."
- fi
- - name: Gclient Sync
- if: steps.check-cache.outputs.cache_exists == 'false'
- run: |
- gclient config \
- --name "src/electron" \
- --unmanaged \
- ${GCLIENT_EXTRA_ARGS} \
- "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY"
-
- ELECTRON_USE_THREE_WAY_MERGE_FOR_PATCHES=1 gclient sync --with_branch_heads --with_tags -vvvvv
- if [ "${{ inputs.is-release }}" != "true" ]; then
- # Re-export all the patches to check if there were changes.
- python3 src/electron/script/export_all_patches.py src/electron/patches/config.json
- cd src/electron
- git update-index --refresh || true
- if ! git diff-index --quiet HEAD --; then
- # There are changes to the patches. Make a git commit with the updated patches
- git add patches
- GIT_COMMITTER_NAME="PatchUp" GIT_COMMITTER_EMAIL="73610968+patchup[bot]@users.noreply.github.com" git commit -m "chore: update patches" --author="PatchUp <73610968+patchup[bot]@users.noreply.github.com>"
- # Export it
- mkdir -p ../../patches
- git format-patch -1 --stdout --keep-subject --no-stat --full-index > ../../patches/update-patches.patch
- if (node ./script/push-patch.js 2> /dev/null > /dev/null); then
- echo
- echo "======================================================================"
- echo "Changes to the patches when applying, we have auto-pushed the diff to the current branch"
- echo "A new CI job will kick off shortly"
- echo "======================================================================"
- exit 1
- else
- echo
- echo "======================================================================"
- echo "There were changes to the patches when applying."
- echo "Check the CI artifacts for a patch you can apply to fix it."
- echo "======================================================================"
- exit 1
- fi
- fi
- fi
-
- # delete all .git directories under src/ except for
- # third_party/angle/ and third_party/dawn/ because of build time generation of files
- # gen/angle/commit.h depends on third_party/angle/.git/HEAD
- # https://chromium-review.googlesource.com/c/angle/angle/+/2074924
- # and dawn/common/Version_autogen.h depends on third_party/dawn/.git/HEAD
- # https://dawn-review.googlesource.com/c/dawn/+/83901
- # TODO: maybe better to always leave out */.git/HEAD file for all targets ?
- - name: Delete .git directories under src to free space
- if: steps.check-cache.outputs.cache_exists == 'false'
- run: |
- cd src
- ( find . -type d -name ".git" -not -path "./third_party/angle/*" -not -path "./third_party/dawn/*" -not -path "./electron/*" ) | xargs rm -rf
- - name: Minimize Cache Size for Upload
- if: steps.check-cache.outputs.cache_exists == 'false'
- run: |
- rm -rf src/android_webview
- rm -rf src/ios/chrome
- rm -rf src/third_party/blink/web_tests
- rm -rf src/third_party/blink/perf_tests
- rm -rf src/chrome/test/data/xr/webvr_info
- rm -rf src/third_party/angle/third_party/VK-GL-CTS/src
- rm -rf src/third_party/swift-toolchain
- rm -rf src/third_party/swiftshader/tests/regres/testlists
- rm -rf src/electron
- - name: Compress Src Directory
- if: steps.check-cache.outputs.cache_exists == 'false'
- run: |
- echo "Uncompressed src size: $(du -sh src | cut -f1 -d' ')"
- tar -cf $DEPSHASH.tar src
- echo "Compressed src to $(du -sh $DEPSHASH.tar | cut -f1 -d' ')"
- cp ./$DEPSHASH.tar /mnt/cross-instance-cache/
- - name: Persist Src Cache
- if: steps.check-cache.outputs.cache_exists == 'false'
- run: |
- final_cache_path=/mnt/cross-instance-cache/$DEPSHASH.tar
- echo "Using cache key: $DEPSHASH"
- echo "Checking path: $final_cache_path"
- if [ ! -f "$final_cache_path" ]; then
- echo "Cache key not found"
- exit 1
- else
- echo "Cache key persisted in $final_cache_path"
- fi
+ generate-sas-token: 'true'
build:
strategy:
fail-fast: false
diff --git a/.github/workflows/macos-publish.yml b/.github/workflows/macos-publish.yml
index 48a79505c3..ffccbfdec7 100644
--- a/.github/workflows/macos-publish.yml
+++ b/.github/workflows/macos-publish.yml
@@ -15,7 +15,7 @@ on:
jobs:
publish:
- uses: electron/electron/.github/workflows/macos-pipeline.yml@main
+ uses: ./.github/workflows/macos-pipeline.yml
with:
is-release: true
gn-config: //electron/build/args/release.gn
|
build
|
8d4467bdc4bb7019b4e150d47a3fbf2599c5392c
|
Richard Torres
|
2024-05-13 04:50:55
|
docs: fixing typo in dark mode fiddle and doc (#42112)
|
diff --git a/docs/fiddles/features/dark-mode/index.html b/docs/fiddles/features/dark-mode/index.html
index dfd1e075fd..85fd15ada5 100644
--- a/docs/fiddles/features/dark-mode/index.html
+++ b/docs/fiddles/features/dark-mode/index.html
@@ -14,6 +14,5 @@
<button id="reset-to-system">Reset to System Theme</button>
<script src="renderer.js"></script>
- </body>
</body>
</html>
diff --git a/docs/tutorial/dark-mode.md b/docs/tutorial/dark-mode.md
index 0d62fc1cf0..d069ed8b5d 100644
--- a/docs/tutorial/dark-mode.md
+++ b/docs/tutorial/dark-mode.md
@@ -75,7 +75,6 @@ Starting with the `index.html` file:
<button id="reset-to-system">Reset to System Theme</button>
<script src="renderer.js"></script>
- </body>
</body>
</html>
```
|
docs
|
60bb4a2617be164299e39049d068736de1b55b84
|
electron-appveyor-updater[bot]
|
2024-07-30 11:44:18
|
build: update appveyor image to latest version (#43098)
Co-authored-by: electron-appveyor-updater[bot] <161660339+electron-appveyor-updater[bot]@users.noreply.github.com>
|
diff --git a/appveyor-woa.yml b/appveyor-woa.yml
index 824c2db5c4..696eeba9ca 100644
--- a/appveyor-woa.yml
+++ b/appveyor-woa.yml
@@ -29,7 +29,7 @@
version: 1.0.{build}
build_cloud: electronhq-16-core
-image: e-128.0.6611.0
+image: e-129.0.6616.0
environment:
GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache
ELECTRON_OUT_DIR: Default
diff --git a/appveyor.yml b/appveyor.yml
index 979fda3b0c..9a5d27b37a 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -29,7 +29,7 @@
version: 1.0.{build}
build_cloud: electronhq-16-core
-image: e-128.0.6611.0
+image: e-129.0.6616.0
environment:
GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache
ELECTRON_OUT_DIR: Default
|
build
|
bcf4095aceac261fd716b9372d071b5de31a1c00
|
Shelley Vohr
|
2024-09-25 01:19:04
|
fix: crash when focusing `WebView` `webContents` (#43921)
fix: crash when focusing WebView
|
diff --git a/shell/browser/api/electron_api_web_contents.cc b/shell/browser/api/electron_api_web_contents.cc
index 8b586fa3fc..97fc55d558 100644
--- a/shell/browser/api/electron_api_web_contents.cc
+++ b/shell/browser/api/electron_api_web_contents.cc
@@ -3339,6 +3339,12 @@ void WebContents::Focus() {
if (owner_window())
owner_window()->Focus(true);
#endif
+
+ // WebView uses WebContentsViewChildFrame, which doesn't have a Focus impl
+ // and triggers a fatal NOTREACHED.
+ if (is_guest())
+ return;
+
web_contents()->Focus();
}
@@ -3782,7 +3788,8 @@ void WebContents::SetBackgroundColor(std::optional<SkColor> maybe_color) {
content::RenderWidgetHostView* rwhv = rfh->GetView();
if (rwhv) {
- // RenderWidgetHostView doesn't allow setting an alpha that's not 0 or 255.
+ // RenderWidgetHostView doesn't allow setting an alpha that's not 0 or
+ // 255.
rwhv->SetBackgroundColor(is_opaque ? color : SK_ColorTRANSPARENT);
static_cast<content::RenderWidgetHostViewBase*>(rwhv)
->SetContentBackgroundColor(color);
diff --git a/spec/api-web-contents-spec.ts b/spec/api-web-contents-spec.ts
index cd4b1e26fb..ddc6585dae 100644
--- a/spec/api-web-contents-spec.ts
+++ b/spec/api-web-contents-spec.ts
@@ -1207,6 +1207,22 @@ describe('webContents module', () => {
expect(currentFocused).to.be.true();
expect(childFocused).to.be.false();
});
+
+ it('does not crash when focusing a WebView webContents', async () => {
+ const w = new BrowserWindow({
+ show: false,
+ webPreferences: {
+ nodeIntegration: true,
+ webviewTag: true
+ }
+ });
+
+ w.show();
+ await w.loadURL('data:text/html,<webview src="data:text/html,hi"></webview>');
+
+ const wc = webContents.getAllWebContents().find((wc) => wc.getType() === 'webview')!;
+ expect(() => wc.focus()).to.not.throw();
+ });
});
const moveFocusToDevTools = async (win: BrowserWindow) => {
|
fix
|
85bc005cd64ddcddb030360c532cc37d8d53e487
|
Jeremy Rose
|
2023-12-05 17:36:23
|
refactor: move JS dialog handling to JS (#40598)
|
diff --git a/filenames.gni b/filenames.gni
index 0146238c36..7689578208 100644
--- a/filenames.gni
+++ b/filenames.gni
@@ -372,8 +372,6 @@ filenames = {
"shell/browser/electron_download_manager_delegate.h",
"shell/browser/electron_gpu_client.cc",
"shell/browser/electron_gpu_client.h",
- "shell/browser/electron_javascript_dialog_manager.cc",
- "shell/browser/electron_javascript_dialog_manager.h",
"shell/browser/electron_navigation_throttle.cc",
"shell/browser/electron_navigation_throttle.h",
"shell/browser/electron_permission_manager.cc",
diff --git a/lib/browser/api/web-contents.ts b/lib/browser/api/web-contents.ts
index a9f5a52213..c7666d9b9c 100644
--- a/lib/browser/api/web-contents.ts
+++ b/lib/browser/api/web-contents.ts
@@ -1,5 +1,5 @@
-import { app, ipcMain, session, webFrameMain } from 'electron/main';
-import type { BrowserWindowConstructorOptions, LoadURLOptions } from 'electron/main';
+import { app, ipcMain, session, webFrameMain, dialog } from 'electron/main';
+import type { BrowserWindowConstructorOptions, LoadURLOptions, MessageBoxOptions, WebFrameMain } from 'electron/main';
import * as url from 'url';
import * as path from 'path';
@@ -729,6 +729,56 @@ WebContents.prototype._init = function () {
}
});
+ const originCounts = new Map<string, number>();
+ const openDialogs = new Set<AbortController>();
+ this.on('-run-dialog' as any, async (info: {frame: WebFrameMain, dialogType: 'prompt' | 'confirm' | 'alert', messageText: string, defaultPromptText: string}, callback: (success: boolean, user_input: string) => void) => {
+ const originUrl = new URL(info.frame.url);
+ const origin = originUrl.protocol === 'file:' ? originUrl.href : originUrl.origin;
+ if ((originCounts.get(origin) ?? 0) < 0) return callback(false, '');
+
+ const prefs = this.getLastWebPreferences();
+ if (!prefs || prefs.disableDialogs) return callback(false, '');
+
+ // We don't support prompt() for some reason :)
+ if (info.dialogType === 'prompt') return callback(false, '');
+
+ originCounts.set(origin, (originCounts.get(origin) ?? 0) + 1);
+
+ // TODO: translate?
+ const checkbox = originCounts.get(origin)! > 1 && prefs.safeDialogs ? prefs.safeDialogsMessage || 'Prevent this app from creating additional dialogs' : '';
+ const parent = this.getOwnerBrowserWindow();
+ const abortController = new AbortController();
+ const options: MessageBoxOptions = {
+ message: info.messageText,
+ checkboxLabel: checkbox,
+ signal: abortController.signal,
+ ...(info.dialogType === 'confirm') ? {
+ buttons: ['OK', 'Cancel'],
+ defaultId: 0,
+ cancelId: 1
+ } : {
+ buttons: ['OK'],
+ defaultId: -1, // No default button
+ cancelId: 0
+ }
+ };
+ openDialogs.add(abortController);
+ const promise = parent && !prefs.offscreen ? dialog.showMessageBox(parent, options) : dialog.showMessageBox(options);
+ try {
+ const result = await promise;
+ if (abortController.signal.aborted) return;
+ if (result.checkboxChecked) originCounts.set(origin, -1);
+ return callback(result.response === 0, '');
+ } finally {
+ openDialogs.delete(abortController);
+ }
+ });
+
+ this.on('-cancel-dialogs' as any, () => {
+ for (const controller of openDialogs) { controller.abort(); }
+ openDialogs.clear();
+ });
+
app.emit('web-contents-created', { sender: this, preventDefault () {}, get defaultPrevented () { return false; } }, this);
// Properties
diff --git a/shell/browser/api/electron_api_web_contents.cc b/shell/browser/api/electron_api_web_contents.cc
index bf565f2aa7..5445faea46 100644
--- a/shell/browser/api/electron_api_web_contents.cc
+++ b/shell/browser/api/electron_api_web_contents.cc
@@ -88,7 +88,6 @@
#include "shell/browser/electron_browser_client.h"
#include "shell/browser/electron_browser_context.h"
#include "shell/browser/electron_browser_main_parts.h"
-#include "shell/browser/electron_javascript_dialog_manager.h"
#include "shell/browser/electron_navigation_throttle.h"
#include "shell/browser/file_select_helper.h"
#include "shell/browser/native_window.h"
@@ -263,6 +262,21 @@ struct Converter<WindowOpenDisposition> {
}
};
+template <>
+struct Converter<content::JavaScriptDialogType> {
+ static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
+ content::JavaScriptDialogType val) {
+ switch (val) {
+ case content::JAVASCRIPT_DIALOG_TYPE_ALERT:
+ return gin::ConvertToV8(isolate, "alert");
+ case content::JAVASCRIPT_DIALOG_TYPE_CONFIRM:
+ return gin::ConvertToV8(isolate, "confirm");
+ case content::JAVASCRIPT_DIALOG_TYPE_PROMPT:
+ return gin::ConvertToV8(isolate, "prompt");
+ }
+ }
+};
+
template <>
struct Converter<content::SavePageType> {
static bool FromV8(v8::Isolate* isolate,
@@ -1587,10 +1601,7 @@ void WebContents::RequestMediaAccessPermission(
content::JavaScriptDialogManager* WebContents::GetJavaScriptDialogManager(
content::WebContents* source) {
- if (!dialog_manager_)
- dialog_manager_ = std::make_unique<ElectronJavaScriptDialogManager>();
-
- return dialog_manager_.get();
+ return this;
}
void WebContents::OnAudioStateChanged(bool audible) {
@@ -3747,6 +3758,45 @@ void WebContents::OnInputEvent(const blink::WebInputEvent& event) {
Emit("input-event", event);
}
+void WebContents::RunJavaScriptDialog(content::WebContents* web_contents,
+ content::RenderFrameHost* rfh,
+ content::JavaScriptDialogType dialog_type,
+ const std::u16string& message_text,
+ const std::u16string& default_prompt_text,
+ DialogClosedCallback callback,
+ bool* did_suppress_message) {
+ CHECK_EQ(web_contents, this->web_contents());
+
+ auto* isolate = JavascriptEnvironment::GetIsolate();
+ v8::HandleScope scope(isolate);
+ auto info = gin::DataObjectBuilder(isolate)
+ .Set("frame", rfh)
+ .Set("dialogType", dialog_type)
+ .Set("messageText", message_text)
+ .Set("defaultPromptText", default_prompt_text)
+ .Build();
+
+ EmitWithoutEvent("-run-dialog", info, std::move(callback));
+}
+
+void WebContents::RunBeforeUnloadDialog(content::WebContents* web_contents,
+ content::RenderFrameHost* rfh,
+ bool is_reload,
+ DialogClosedCallback callback) {
+ // TODO: asyncify?
+ bool default_prevented = Emit("will-prevent-unload");
+ std::move(callback).Run(default_prevented, std::u16string());
+}
+
+void WebContents::CancelDialogs(content::WebContents* web_contents,
+ bool reset_state) {
+ auto* isolate = JavascriptEnvironment::GetIsolate();
+ v8::HandleScope scope(isolate);
+ EmitWithoutEvent(
+ "-cancel-dialogs",
+ gin::DataObjectBuilder(isolate).Set("resetState", reset_state).Build());
+}
+
v8::Local<v8::Promise> WebContents::GetProcessMemoryInfo(v8::Isolate* isolate) {
gin_helper::Promise<gin_helper::Dictionary> promise(isolate);
v8::Local<v8::Promise> handle = promise.GetHandle();
diff --git a/shell/browser/api/electron_api_web_contents.h b/shell/browser/api/electron_api_web_contents.h
index c9247f0df4..ec380f204a 100644
--- a/shell/browser/api/electron_api_web_contents.h
+++ b/shell/browser/api/electron_api_web_contents.h
@@ -23,6 +23,7 @@
#include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h"
#include "content/common/frame.mojom.h"
#include "content/public/browser/devtools_agent_host.h"
+#include "content/public/browser/javascript_dialog_manager.h"
#include "content/public/browser/keyboard_event_processing_result.h"
#include "content/public/browser/render_widget_host.h"
#include "content/public/browser/web_contents.h"
@@ -85,7 +86,6 @@ class SkRegion;
namespace electron {
class ElectronBrowserContext;
-class ElectronJavaScriptDialogManager;
class InspectableWebContents;
class WebContentsZoomController;
class WebViewGuestDelegate;
@@ -107,6 +107,7 @@ class WebContents : public ExclusiveAccessContext,
public content::WebContentsObserver,
public content::WebContentsDelegate,
public content::RenderWidgetHost::InputEventObserver,
+ public content::JavaScriptDialogManager,
public InspectableWebContentsDelegate,
public InspectableWebContentsViewDelegate,
public BackgroundThrottlingSource {
@@ -453,6 +454,21 @@ class WebContents : public ExclusiveAccessContext,
// content::RenderWidgetHost::InputEventObserver:
void OnInputEvent(const blink::WebInputEvent& event) override;
+ // content::JavaScriptDialogManager:
+ void RunJavaScriptDialog(content::WebContents* web_contents,
+ content::RenderFrameHost* rfh,
+ content::JavaScriptDialogType dialog_type,
+ const std::u16string& message_text,
+ const std::u16string& default_prompt_text,
+ DialogClosedCallback callback,
+ bool* did_suppress_message) override;
+ void RunBeforeUnloadDialog(content::WebContents* web_contents,
+ content::RenderFrameHost* rfh,
+ bool is_reload,
+ DialogClosedCallback callback) override;
+ void CancelDialogs(content::WebContents* web_contents,
+ bool reset_state) override;
+
SkRegion* draggable_region() {
return force_non_draggable_ ? nullptr : draggable_region_.get();
}
@@ -762,7 +778,6 @@ class WebContents : public ExclusiveAccessContext,
v8::Global<v8::Value> devtools_web_contents_;
v8::Global<v8::Value> debugger_;
- std::unique_ptr<ElectronJavaScriptDialogManager> dialog_manager_;
std::unique_ptr<WebViewGuestDelegate> guest_delegate_;
std::unique_ptr<FrameSubscriber> frame_subscriber_;
diff --git a/shell/browser/electron_javascript_dialog_manager.cc b/shell/browser/electron_javascript_dialog_manager.cc
deleted file mode 100644
index bf37e9014f..0000000000
--- a/shell/browser/electron_javascript_dialog_manager.cc
+++ /dev/null
@@ -1,137 +0,0 @@
-// Copyright (c) 2013 GitHub, Inc.
-// Use of this source code is governed by the MIT license that can be
-// found in the LICENSE file.
-
-#include "shell/browser/electron_javascript_dialog_manager.h"
-
-#include <string>
-#include <utility>
-#include <vector>
-
-#include "base/functional/bind.h"
-#include "base/strings/utf_string_conversions.h"
-#include "shell/browser/api/electron_api_web_contents.h"
-#include "shell/browser/native_window.h"
-#include "shell/browser/ui/message_box.h"
-#include "shell/browser/web_contents_preferences.h"
-#include "shell/common/options_switches.h"
-#include "ui/gfx/image/image_skia.h"
-
-using content::JavaScriptDialogType;
-
-namespace electron {
-
-namespace {
-
-constexpr int kUserWantsNoMoreDialogs = -1;
-
-} // namespace
-
-ElectronJavaScriptDialogManager::ElectronJavaScriptDialogManager() = default;
-ElectronJavaScriptDialogManager::~ElectronJavaScriptDialogManager() = default;
-
-void ElectronJavaScriptDialogManager::RunJavaScriptDialog(
- content::WebContents* web_contents,
- content::RenderFrameHost* rfh,
- JavaScriptDialogType dialog_type,
- const std::u16string& message_text,
- const std::u16string& default_prompt_text,
- DialogClosedCallback callback,
- bool* did_suppress_message) {
- auto origin_url = rfh->GetLastCommittedURL();
-
- std::string origin;
- // For file:// URLs we do the alert filtering by the
- // file path currently loaded
- if (origin_url.SchemeIsFile()) {
- origin = origin_url.path();
- } else {
- origin = origin_url.DeprecatedGetOriginAsURL().spec();
- }
-
- if (origin_counts_[origin] == kUserWantsNoMoreDialogs) {
- return std::move(callback).Run(false, std::u16string());
- }
-
- if (dialog_type != JavaScriptDialogType::JAVASCRIPT_DIALOG_TYPE_ALERT &&
- dialog_type != JavaScriptDialogType::JAVASCRIPT_DIALOG_TYPE_CONFIRM) {
- std::move(callback).Run(false, std::u16string());
- return;
- }
-
- auto* web_preferences = WebContentsPreferences::From(web_contents);
-
- if (web_preferences && web_preferences->ShouldDisableDialogs()) {
- return std::move(callback).Run(false, std::u16string());
- }
-
- // No default button
- int default_id = -1;
- int cancel_id = 0;
-
- std::vector<std::string> buttons = {"OK"};
- if (dialog_type == JavaScriptDialogType::JAVASCRIPT_DIALOG_TYPE_CONFIRM) {
- buttons.emplace_back("Cancel");
- // First button is default, second button is cancel
- default_id = 0;
- cancel_id = 1;
- }
-
- origin_counts_[origin]++;
-
- std::string checkbox;
- if (origin_counts_[origin] > 1 && web_preferences &&
- web_preferences->ShouldUseSafeDialogs() &&
- !web_preferences->GetSafeDialogsMessage(&checkbox)) {
- checkbox = "Prevent this app from creating additional dialogs";
- }
-
- // Don't set parent for offscreen window.
- NativeWindow* window = nullptr;
- if (web_preferences && !web_preferences->IsOffscreen()) {
- auto* relay = NativeWindowRelay::FromWebContents(web_contents);
- if (relay)
- window = relay->GetNativeWindow();
- }
-
- electron::MessageBoxSettings settings;
- settings.parent_window = window;
- settings.checkbox_label = checkbox;
- settings.buttons = buttons;
- settings.default_id = default_id;
- settings.cancel_id = cancel_id;
- settings.message = base::UTF16ToUTF8(message_text);
-
- electron::ShowMessageBox(
- settings,
- base::BindOnce(&ElectronJavaScriptDialogManager::OnMessageBoxCallback,
- base::Unretained(this), std::move(callback), origin));
-}
-
-void ElectronJavaScriptDialogManager::RunBeforeUnloadDialog(
- content::WebContents* web_contents,
- content::RenderFrameHost* rfh,
- bool is_reload,
- DialogClosedCallback callback) {
- auto* api_web_contents = api::WebContents::From(web_contents);
- if (api_web_contents) {
- bool default_prevented = api_web_contents->Emit("will-prevent-unload");
- std::move(callback).Run(default_prevented, std::u16string());
- }
-}
-
-void ElectronJavaScriptDialogManager::CancelDialogs(
- content::WebContents* web_contents,
- bool reset_state) {}
-
-void ElectronJavaScriptDialogManager::OnMessageBoxCallback(
- DialogClosedCallback callback,
- const std::string& origin,
- int code,
- bool checkbox_checked) {
- if (checkbox_checked)
- origin_counts_[origin] = kUserWantsNoMoreDialogs;
- std::move(callback).Run(code == 0, std::u16string());
-}
-
-} // namespace electron
diff --git a/shell/browser/electron_javascript_dialog_manager.h b/shell/browser/electron_javascript_dialog_manager.h
deleted file mode 100644
index 42e29d9e40..0000000000
--- a/shell/browser/electron_javascript_dialog_manager.h
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright (c) 2013 GitHub, Inc.
-// Use of this source code is governed by the MIT license that can be
-// found in the LICENSE file.
-
-#ifndef ELECTRON_SHELL_BROWSER_ELECTRON_JAVASCRIPT_DIALOG_MANAGER_H_
-#define ELECTRON_SHELL_BROWSER_ELECTRON_JAVASCRIPT_DIALOG_MANAGER_H_
-
-#include <map>
-#include <string>
-
-#include "content/public/browser/javascript_dialog_manager.h"
-
-namespace content {
-class WebContents;
-}
-
-namespace electron {
-
-class ElectronJavaScriptDialogManager
- : public content::JavaScriptDialogManager {
- public:
- ElectronJavaScriptDialogManager();
- ~ElectronJavaScriptDialogManager() override;
-
- // content::JavaScriptDialogManager implementations.
- void RunJavaScriptDialog(content::WebContents* web_contents,
- content::RenderFrameHost* rfh,
- content::JavaScriptDialogType dialog_type,
- const std::u16string& message_text,
- const std::u16string& default_prompt_text,
- DialogClosedCallback callback,
- bool* did_suppress_message) override;
- void RunBeforeUnloadDialog(content::WebContents* web_contents,
- content::RenderFrameHost* rfh,
- bool is_reload,
- DialogClosedCallback callback) override;
- void CancelDialogs(content::WebContents* web_contents,
- bool reset_state) override;
-
- private:
- void OnMessageBoxCallback(DialogClosedCallback callback,
- const std::string& origin,
- int code,
- bool checkbox_checked);
-
- std::map<std::string, int> origin_counts_;
-};
-
-} // namespace electron
-
-#endif // ELECTRON_SHELL_BROWSER_ELECTRON_JAVASCRIPT_DIALOG_MANAGER_H_
diff --git a/shell/browser/web_contents_preferences.cc b/shell/browser/web_contents_preferences.cc
index 8a20e51659..8c43cd3da1 100644
--- a/shell/browser/web_contents_preferences.cc
+++ b/shell/browser/web_contents_preferences.cc
@@ -391,6 +391,9 @@ void WebContentsPreferences::SaveLastPreferences() {
allow_running_insecure_content_);
dict.Set(options::kExperimentalFeatures, experimental_features_);
dict.Set(options::kEnableBlinkFeatures, enable_blink_features_.value_or(""));
+ dict.Set("disableDialogs", disable_dialogs_);
+ dict.Set("safeDialogs", safe_dialogs_);
+ dict.Set("safeDialogsMessage", safe_dialogs_message_.value_or(""));
last_web_preferences_ = base::Value(std::move(dict));
}
diff --git a/spec/chromium-spec.ts b/spec/chromium-spec.ts
index 3081b5204b..8cadc48d3d 100644
--- a/spec/chromium-spec.ts
+++ b/spec/chromium-spec.ts
@@ -1,5 +1,5 @@
import { expect } from 'chai';
-import { BrowserWindow, WebContents, webFrameMain, session, ipcMain, app, protocol, webContents } from 'electron/main';
+import { BrowserWindow, WebContents, webFrameMain, session, ipcMain, app, protocol, webContents, dialog, MessageBoxOptions } from 'electron/main';
import { closeAllWindows } from './lib/window-helpers';
import * as https from 'node:https';
import * as http from 'node:http';
@@ -2396,6 +2396,26 @@ describe('chromium features', () => {
window.alert({ toString: null });
}).to.throw('Cannot convert object to primitive value');
});
+
+ it('shows a message box', async () => {
+ const w = new BrowserWindow({ show: false });
+ w.loadURL('about:blank');
+ const p = once(w.webContents, '-run-dialog');
+ w.webContents.executeJavaScript('alert("hello")', true);
+ const [info] = await p;
+ expect(info.frame).to.equal(w.webContents.mainFrame);
+ expect(info.messageText).to.equal('hello');
+ expect(info.dialogType).to.equal('alert');
+ });
+
+ it('does not crash if a webContents is destroyed while an alert is showing', async () => {
+ const w = new BrowserWindow({ show: false });
+ w.loadURL('about:blank');
+ const p = once(w.webContents, '-run-dialog');
+ w.webContents.executeJavaScript('alert("hello")', true);
+ await p;
+ w.webContents.close();
+ });
});
describe('window.confirm(message, title)', () => {
@@ -2404,6 +2424,160 @@ describe('chromium features', () => {
(window.confirm as any)({ toString: null }, 'title');
}).to.throw('Cannot convert object to primitive value');
});
+
+ it('shows a message box', async () => {
+ const w = new BrowserWindow({ show: false });
+ w.loadURL('about:blank');
+ const p = once(w.webContents, '-run-dialog');
+ const resultPromise = w.webContents.executeJavaScript('confirm("hello")', true);
+ const [info, cb] = await p;
+ expect(info.frame).to.equal(w.webContents.mainFrame);
+ expect(info.messageText).to.equal('hello');
+ expect(info.dialogType).to.equal('confirm');
+ cb(true, '');
+ const result = await resultPromise;
+ expect(result).to.be.true();
+ });
+ });
+
+ describe('safeDialogs web preference', () => {
+ const originalShowMessageBox = dialog.showMessageBox;
+ afterEach(() => {
+ dialog.showMessageBox = originalShowMessageBox;
+ if (protocol.isProtocolHandled('https')) protocol.unhandle('https');
+ if (protocol.isProtocolHandled('file')) protocol.unhandle('file');
+ });
+ it('does not show the checkbox if not enabled', async () => {
+ const w = new BrowserWindow({ show: false, webPreferences: { safeDialogs: false } });
+ w.loadURL('about:blank');
+ // 1. The first alert() doesn't show the safeDialogs message.
+ dialog.showMessageBox = () => Promise.resolve({ response: 0, checkboxChecked: false });
+ await w.webContents.executeJavaScript('alert("hi")');
+
+ let recordedOpts: MessageBoxOptions | undefined;
+ dialog.showMessageBox = (bw, opts?: MessageBoxOptions) => {
+ recordedOpts = opts;
+ return Promise.resolve({ response: 0, checkboxChecked: false });
+ };
+ await w.webContents.executeJavaScript('alert("hi")');
+ expect(recordedOpts?.checkboxLabel).to.equal('');
+ });
+
+ it('is respected', async () => {
+ const w = new BrowserWindow({ show: false, webPreferences: { safeDialogs: true } });
+ w.loadURL('about:blank');
+ // 1. The first alert() doesn't show the safeDialogs message.
+ dialog.showMessageBox = () => Promise.resolve({ response: 0, checkboxChecked: false });
+ await w.webContents.executeJavaScript('alert("hi")');
+
+ // 2. The second alert() shows the message with a checkbox. Respond that we checked it.
+ let recordedOpts: MessageBoxOptions | undefined;
+ dialog.showMessageBox = (bw, opts?: MessageBoxOptions) => {
+ recordedOpts = opts;
+ return Promise.resolve({ response: 0, checkboxChecked: true });
+ };
+ await w.webContents.executeJavaScript('alert("hi")');
+ expect(recordedOpts?.checkboxLabel).to.be.a('string').with.length.above(0);
+
+ // 3. The third alert() shouldn't show a dialog.
+ dialog.showMessageBox = () => Promise.reject(new Error('unexpected showMessageBox'));
+ await w.webContents.executeJavaScript('alert("hi")');
+ });
+
+ it('shows the safeDialogMessage', async () => {
+ const w = new BrowserWindow({ show: false, webPreferences: { safeDialogs: true, safeDialogsMessage: 'foo bar' } });
+ w.loadURL('about:blank');
+ dialog.showMessageBox = () => Promise.resolve({ response: 0, checkboxChecked: false });
+ await w.webContents.executeJavaScript('alert("hi")');
+ let recordedOpts: MessageBoxOptions | undefined;
+ dialog.showMessageBox = (bw, opts?: MessageBoxOptions) => {
+ recordedOpts = opts;
+ return Promise.resolve({ response: 0, checkboxChecked: true });
+ };
+ await w.webContents.executeJavaScript('alert("hi")');
+ expect(recordedOpts?.checkboxLabel).to.equal('foo bar');
+ });
+
+ it('has persistent state across navigations', async () => {
+ const w = new BrowserWindow({ show: false, webPreferences: { safeDialogs: true } });
+ w.loadURL('about:blank');
+ // 1. The first alert() doesn't show the safeDialogs message.
+ dialog.showMessageBox = () => Promise.resolve({ response: 0, checkboxChecked: false });
+ await w.webContents.executeJavaScript('alert("hi")');
+
+ // 2. The second alert() shows the message with a checkbox. Respond that we checked it.
+ dialog.showMessageBox = () => Promise.resolve({ response: 0, checkboxChecked: true });
+ await w.webContents.executeJavaScript('alert("hi")');
+
+ // 3. The third alert() shouldn't show a dialog.
+ dialog.showMessageBox = () => Promise.reject(new Error('unexpected showMessageBox'));
+ await w.webContents.executeJavaScript('alert("hi")');
+
+ // 4. After navigating to the same origin, message boxes should still be hidden.
+ w.loadURL('about:blank');
+ await w.webContents.executeJavaScript('alert("hi")');
+ });
+
+ it('is separated by origin', async () => {
+ protocol.handle('https', () => new Response(''));
+ const w = new BrowserWindow({ show: false, webPreferences: { safeDialogs: true } });
+ w.loadURL('https://example1');
+ dialog.showMessageBox = () => Promise.resolve({ response: 0, checkboxChecked: false });
+ await w.webContents.executeJavaScript('alert("hi")');
+ dialog.showMessageBox = () => Promise.resolve({ response: 0, checkboxChecked: true });
+ await w.webContents.executeJavaScript('alert("hi")');
+ dialog.showMessageBox = () => Promise.reject(new Error('unexpected showMessageBox'));
+ await w.webContents.executeJavaScript('alert("hi")');
+
+ // A different origin is allowed to show message boxes after navigation.
+ w.loadURL('https://example2');
+ let dialogWasShown = false;
+ dialog.showMessageBox = () => {
+ dialogWasShown = true;
+ return Promise.resolve({ response: 0, checkboxChecked: false });
+ };
+ await w.webContents.executeJavaScript('alert("hi")');
+ expect(dialogWasShown).to.be.true();
+
+ // Navigating back to the first origin means alerts are blocked again.
+ w.loadURL('https://example1');
+ dialog.showMessageBox = () => Promise.reject(new Error('unexpected showMessageBox'));
+ await w.webContents.executeJavaScript('alert("hi")');
+ });
+
+ it('treats different file: paths as different origins', async () => {
+ protocol.handle('file', () => new Response(''));
+ const w = new BrowserWindow({ show: false, webPreferences: { safeDialogs: true } });
+ w.loadURL('file:///path/1');
+ dialog.showMessageBox = () => Promise.resolve({ response: 0, checkboxChecked: false });
+ await w.webContents.executeJavaScript('alert("hi")');
+ dialog.showMessageBox = () => Promise.resolve({ response: 0, checkboxChecked: true });
+ await w.webContents.executeJavaScript('alert("hi")');
+ dialog.showMessageBox = () => Promise.reject(new Error('unexpected showMessageBox'));
+ await w.webContents.executeJavaScript('alert("hi")');
+
+ w.loadURL('file:///path/2');
+ let dialogWasShown = false;
+ dialog.showMessageBox = () => {
+ dialogWasShown = true;
+ return Promise.resolve({ response: 0, checkboxChecked: false });
+ };
+ await w.webContents.executeJavaScript('alert("hi")');
+ expect(dialogWasShown).to.be.true();
+ });
+ });
+ describe('disableDialogs web preference', () => {
+ const originalShowMessageBox = dialog.showMessageBox;
+ afterEach(() => {
+ dialog.showMessageBox = originalShowMessageBox;
+ if (protocol.isProtocolHandled('https')) protocol.unhandle('https');
+ });
+ it('is respected', async () => {
+ const w = new BrowserWindow({ show: false, webPreferences: { disableDialogs: true } });
+ w.loadURL('about:blank');
+ dialog.showMessageBox = () => Promise.reject(new Error('unexpected message box'));
+ await w.webContents.executeJavaScript('alert("hi")');
+ });
});
});
|
refactor
|
9e7fbc7021d8d716c43782249a552e55289c35db
|
Jeremy Rose
|
2022-12-14 10:05:34
|
fix: blend node and blink code generation policy when both are loaded (#36567)
|
diff --git a/patches/chromium/.patches b/patches/chromium/.patches
index a69c49e2cb..a65b0ae9d4 100644
--- a/patches/chromium/.patches
+++ b/patches/chromium/.patches
@@ -123,4 +123,5 @@ build_only_use_the_mas_build_config_in_the_required_components.patch
fix_tray_icon_gone_on_lock_screen.patch
chore_introduce_blocking_api_for_electron.patch
chore_patch_out_partition_attribute_dcheck_for_webviews.patch
+expose_v8initializer_codegenerationcheckcallbackinmainthread.patch
chore_patch_out_profile_methods_in_profile_selections_cc.patch
diff --git a/patches/chromium/expose_v8initializer_codegenerationcheckcallbackinmainthread.patch b/patches/chromium/expose_v8initializer_codegenerationcheckcallbackinmainthread.patch
new file mode 100644
index 0000000000..50c5cb8309
--- /dev/null
+++ b/patches/chromium/expose_v8initializer_codegenerationcheckcallbackinmainthread.patch
@@ -0,0 +1,38 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Jeremy Rose <[email protected]>
+Date: Mon, 5 Dec 2022 14:27:20 -0800
+Subject: expose V8Initializer::CodeGenerationCheckCallbackInMainThread
+
+This is needed to blend Blink and Node's policy for code generation policy.
+
+diff --git a/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc b/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc
+index 7f2f8101c043a66a8c771bc21833ec541ea55101..d151ab58afb6014d4bf63a1a1464caecdce69715 100644
+--- a/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc
++++ b/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc
+@@ -443,8 +443,9 @@ TrustedTypesCodeGenerationCheck(v8::Local<v8::Context> context,
+ return {true, V8String(context->GetIsolate(), stringified_source)};
+ }
+
+-static v8::ModifyCodeGenerationFromStringsResult
+-CodeGenerationCheckCallbackInMainThread(v8::Local<v8::Context> context,
++// static
++v8::ModifyCodeGenerationFromStringsResult
++V8Initializer::CodeGenerationCheckCallbackInMainThread(v8::Local<v8::Context> context,
+ v8::Local<v8::Value> source,
+ bool is_code_like) {
+ // The TC39 "Dynamic Code Brand Check" feature is currently behind a flag.
+diff --git a/third_party/blink/renderer/bindings/core/v8/v8_initializer.h b/third_party/blink/renderer/bindings/core/v8/v8_initializer.h
+index 39d1351a4a8bbc95097640be54affec426abe73e..30a36cf16d4a8f4692ec6a13be1217212390172a 100644
+--- a/third_party/blink/renderer/bindings/core/v8/v8_initializer.h
++++ b/third_party/blink/renderer/bindings/core/v8/v8_initializer.h
+@@ -69,6 +69,10 @@ class CORE_EXPORT V8Initializer {
+ v8::Local<v8::Value>);
+ static void MessageHandlerInWorker(v8::Local<v8::Message>,
+ v8::Local<v8::Value>);
++ static v8::ModifyCodeGenerationFromStringsResult
++ CodeGenerationCheckCallbackInMainThread(v8::Local<v8::Context> context,
++ v8::Local<v8::Value> source,
++ bool is_code_like);
+ static bool WasmCodeGenerationCheckCallbackInMainThread(
+ v8::Local<v8::Context> context,
+ v8::Local<v8::String> source);
diff --git a/patches/node/.patches b/patches/node/.patches
index 37a6509bd7..b435ebacc0 100644
--- a/patches/node/.patches
+++ b/patches/node/.patches
@@ -52,3 +52,4 @@ fix_prevent_changing_functiontemplateinfo_after_publish.patch
chore_add_missing_algorithm_include.patch
fix_tolocalstring_unicode_mismatch.patch
enable_crashpad_linux_node_processes.patch
+allow_embedder_to_control_codegenerationfromstringscallback.patch
diff --git a/patches/node/allow_embedder_to_control_codegenerationfromstringscallback.patch b/patches/node/allow_embedder_to_control_codegenerationfromstringscallback.patch
new file mode 100644
index 0000000000..6e3bc16f5c
--- /dev/null
+++ b/patches/node/allow_embedder_to_control_codegenerationfromstringscallback.patch
@@ -0,0 +1,44 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Jeremy Rose <[email protected]>
+Date: Mon, 5 Dec 2022 14:28:40 -0800
+Subject: allow embedder to control CodeGenerationFromStringsCallback
+
+This is needed to blend Blink and Node's code generation policy.
+
+This should be upstreamed.
+
+diff --git a/src/api/environment.cc b/src/api/environment.cc
+index b6981c37d5b286e22f24d11751eb05f72ca27619..c4a3a54753767e7686a0e32996bcda0c90f659a7 100644
+--- a/src/api/environment.cc
++++ b/src/api/environment.cc
+@@ -259,11 +259,15 @@ void SetIsolateErrorHandlers(v8::Isolate* isolate, const IsolateSettings& s) {
+ void SetIsolateMiscHandlers(v8::Isolate* isolate, const IsolateSettings& s) {
+ isolate->SetMicrotasksPolicy(s.policy);
+
++ // Allow the embedder first chance at policy decisions.
++ // This is particularly important for embedders that combine Node and Blink,
++ // as Blink must be able to make Content Security Policy-based decisions.
+ auto* allow_wasm_codegen_cb = s.allow_wasm_code_generation_callback ?
+ s.allow_wasm_code_generation_callback : AllowWasmCodeGenerationCallback;
+ isolate->SetAllowWasmCodeGenerationCallback(allow_wasm_codegen_cb);
+- isolate->SetModifyCodeGenerationFromStringsCallback(
+- ModifyCodeGenerationFromStrings);
++ auto* modify_code_generation_from_strings_callback = s.modify_code_generation_from_strings_callback ?
++ s.modify_code_generation_from_strings_callback : ModifyCodeGenerationFromStrings;
++ isolate->SetModifyCodeGenerationFromStringsCallback(modify_code_generation_from_strings_callback);
+
+ Mutex::ScopedLock lock(node::per_process::cli_options_mutex);
+ if (per_process::cli_options->get_per_isolate_options()
+diff --git a/src/node.h b/src/node.h
+index bee494f9da8470530ee9ec58958f8f2c7ce6a302..387ce8e5edf6524db170e2d46ef501a1cd956d98 100644
+--- a/src/node.h
++++ b/src/node.h
+@@ -461,6 +461,8 @@ struct IsolateSettings {
+ v8::PromiseRejectCallback promise_reject_callback = nullptr;
+ v8::AllowWasmCodeGenerationCallback
+ allow_wasm_code_generation_callback = nullptr;
++ v8::ModifyCodeGenerationFromStringsCallback2
++ modify_code_generation_from_strings_callback = nullptr;
+ };
+
+ // Overriding IsolateSettings may produce unexpected behavior
diff --git a/shell/common/node_bindings.cc b/shell/common/node_bindings.cc
index 1ee322ea5c..de5ca32838 100644
--- a/shell/common/node_bindings.cc
+++ b/shell/common/node_bindings.cc
@@ -158,19 +158,35 @@ void V8FatalErrorCallback(const char* location, const char* message) {
}
bool AllowWasmCodeGenerationCallback(v8::Local<v8::Context> context,
- v8::Local<v8::String>) {
+ v8::Local<v8::String> source) {
// If we're running with contextIsolation enabled in the renderer process,
// fall back to Blink's logic.
- v8::Isolate* isolate = context->GetIsolate();
- if (node::Environment::GetCurrent(isolate) == nullptr) {
+ if (node::Environment::GetCurrent(context) == nullptr) {
if (gin_helper::Locker::IsBrowserProcess())
return false;
return blink::V8Initializer::WasmCodeGenerationCheckCallbackInMainThread(
- context, v8::String::Empty(isolate));
+ context, source);
+ }
+
+ return node::AllowWasmCodeGenerationCallback(context, source);
+}
+
+v8::ModifyCodeGenerationFromStringsResult ModifyCodeGenerationFromStrings(
+ v8::Local<v8::Context> context,
+ v8::Local<v8::Value> source,
+ bool is_code_like) {
+ // If we're running with contextIsolation enabled in the renderer process,
+ // fall back to Blink's logic.
+ if (node::Environment::GetCurrent(context) == nullptr) {
+ if (gin_helper::Locker::IsBrowserProcess()) {
+ NOTREACHED();
+ return {false, {}};
+ }
+ return blink::V8Initializer::CodeGenerationCheckCallbackInMainThread(
+ context, source, is_code_like);
}
- return node::AllowWasmCodeGenerationCallback(context,
- v8::String::Empty(isolate));
+ return node::ModifyCodeGenerationFromStrings(context, source, is_code_like);
}
void ErrorMessageListener(v8::Local<v8::Message> message,
@@ -543,6 +559,8 @@ node::Environment* NodeBindings::CreateEnvironment(
// Use a custom callback here to allow us to leverage Blink's logic in the
// renderer process.
is.allow_wasm_code_generation_callback = AllowWasmCodeGenerationCallback;
+ is.modify_code_generation_from_strings_callback =
+ ModifyCodeGenerationFromStrings;
if (browser_env_ == BrowserEnvironment::kBrowser ||
browser_env_ == BrowserEnvironment::kUtility) {
diff --git a/spec/chromium-spec.ts b/spec/chromium-spec.ts
index dc8f8fc86a..ec5224d3b0 100644
--- a/spec/chromium-spec.ts
+++ b/spec/chromium-spec.ts
@@ -355,6 +355,30 @@ describe('web security', () => {
});
});
+ describe('csp in sandbox: false', () => {
+ it('is correctly applied', async () => {
+ const w = new BrowserWindow({
+ show: false,
+ webPreferences: { sandbox: false }
+ });
+ w.loadURL(`data:text/html,<head>
+ <meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self' 'unsafe-inline'">
+ </head>
+ <script>
+ try {
+ // We use console.log here because it is easier than making a
+ // preload script, and the behavior under test changes when
+ // contextIsolation: false
+ console.log(eval('failure'))
+ } catch (e) {
+ console.log('success')
+ }
+ </script>`);
+ const [,, message] = await emittedOnce(w.webContents, 'console-message');
+ expect(message).to.equal('success');
+ });
+ });
+
it('does not crash when multiple WebContent are created with web security disabled', () => {
const options = { show: false, webPreferences: { webSecurity: false } };
const w1 = new BrowserWindow(options);
|
fix
|
2b9dae4b065e9fea59c90ddee2acf2c01b9ebd59
|
Will Anderson
|
2023-03-28 07:55:41
|
feat: add `will-frame-navigate` event (#34418)
* feat: add will-navigate-in-frame event to webContents
* docs: add documentation for webview will-frame-navigate event
* feat: Eliminate isInPlace argument from will-frame-navigate event
* fix: Fire will-frame-navigate before will-navigate
* feat: send will-frame-navigate with a WebFrameMain in the event details
* docs: Update WebContents docs for new API signature
* feat: Add custom event forwarding for <webview> will-frame-navigate
* fix: wrap WebFrameMain so it can be sent as an event
* test: update webContents and <webview> tests to match new signatures
* chore: undo unnecessary change
* fix: don't switch will-navigate to use EmitNavigationEventDetails
* test: clean up will-navigate and will-frame-navigate tests for <webview>
* chore: apply lint fixes
* chore: move GetRenderFrameHost helper into anonymous namespace
* docs: auto-generate WillFrameNavigateDetails rather than defining it manually
* test: Update <webview> tests to actually pass under new spec runner
* docs: Add section explaining relationship between various nav events
* test: Add some tests to ensure navigation event order doesn't silently change
* test: Always monitor all nav events to ensure unexpected ones don't fire
* test: Add test to verify in-page navigation event order
* feat: Change to new style where extra params are exposed as event props
* fix: Remove unused EmitNavigationEventDetails
* fix: Update tests to use new async helpers
* docs: Rename and reorder sections documenting navigation events
---------
Co-authored-by: Milan Burda <[email protected]>
|
diff --git a/docs/api/web-contents.md b/docs/api/web-contents.md
index 47f6e8a41c..4568936030 100644
--- a/docs/api/web-contents.md
+++ b/docs/api/web-contents.md
@@ -19,6 +19,36 @@ const contents = win.webContents
console.log(contents)
```
+## Navigation Events
+
+Several events can be used to monitor navigations as they occur within a `webContents`.
+
+### Document Navigations
+
+When a `webContents` navigates to another page (as opposed to an [in-page navigation](web-contents.md#in-page-navigation)), the following events will be fired.
+
+* [`did-start-navigation`](web-contents.md#event-did-start-navigation)
+* [`will-frame-navigate`](web-contents.md#event-will-frame-navigate)
+* [`will-navigate`](web-contents.md#event-will-navigate) (only fired when main frame navigates)
+* [`will-redirect`](web-contents.md#event-will-redirect) (only fired when a redirect happens during navigation)
+* [`did-redirect-navigation`](web-contents.md#event-did-redirect-navigation) (only fired when a redirect happens during navigation)
+* [`did-frame-navigate`](web-contents.md#event-did-frame-navigate)
+* [`did-navigate`](web-contents.md#event-did-navigate) (only fired when main frame navigates)
+
+Subsequent events will not fire if `event.preventDefault()` is called on any of the cancellable events.
+
+### In-page Navigation
+
+In-page navigations don't cause the page to reload, but instead navigate to a location within the current page. These events are not cancellable. For an in-page navigations, the following events will fire in this order:
+
+* [`did-start-navigation`](web-contents.md#event-did-start-navigation)
+* [`did-navigate-in-page`](web-contents.md#event-did-navigate-in-page)
+
+### Frame Navigation
+
+The [`will-navigate`](web-contents.md#event-will-navigate) and [`did-navigate`](web-contents.md#event-did-navigate) events only fire when the [mainFrame](web-contents.md#contentsmainframe-readonly) navigates.
+If you want to also observe navigations in `<iframe>`s, use [`will-frame-navigate`](web-contents.md#event-will-frame-navigate) and [`did-frame-navigate`](web-contents.md#event-did-frame-navigate) events.
+
## Methods
These methods can be accessed from the `webContents` module:
@@ -225,9 +255,37 @@ Returns:
* `frameProcessId` Integer _Deprecated_
* `frameRoutingId` Integer _Deprecated_
-Emitted when a user or the page wants to start navigation. It can happen when
+Emitted when a user or the page wants to start navigation on the main frame. It can happen when
+the `window.location` object is changed or a user clicks a link in the page.
+
+This event will not emit when the navigation is started programmatically with
+APIs like `webContents.loadURL` and `webContents.back`.
+
+It is also not emitted for in-page navigations, such as clicking anchor links
+or updating the `window.location.hash`. Use `did-navigate-in-page` event for
+this purpose.
+
+Calling `event.preventDefault()` will prevent the navigation.
+
+#### Event: 'will-frame-navigate'
+
+Returns:
+
+* `details` Event<>
+ * `url` string - The URL the frame is navigating to.
+ * `isMainFrame` boolean - True if the navigation is taking place in a main frame.
+ * `frame` WebFrameMain - The frame to be navigated.
+ * `initiator` WebFrameMain (optional) - The frame which initiated the
+ navigation, which can be a parent frame (e.g. via `window.open` with a
+ frame's name), or null if the navigation was not initiated by a frame. This
+ can also be null if the initiating frame was deleted before the event was
+ emitted.
+
+Emitted when a user or the page wants to start navigation in any frame. It can happen when
the `window.location` object is changed or a user clicks a link in the page.
+Unlike `will-navigate`, `will-frame-navigate` is fired when the main frame or any of its subframes attempts to navigate. When the navigation event comes from the main frame, `isMainFrame` will be `true`.
+
This event will not emit when the navigation is started programmatically with
APIs like `webContents.loadURL` and `webContents.back`.
diff --git a/docs/api/webview-tag.md b/docs/api/webview-tag.md
index c9c82f7832..f38cb9a54c 100644
--- a/docs/api/webview-tag.md
+++ b/docs/api/webview-tag.md
@@ -823,6 +823,28 @@ this purpose.
Calling `event.preventDefault()` does __NOT__ have any effect.
+### Event: 'will-frame-navigate'
+
+Returns:
+
+* `url` string
+* `isMainFrame` boolean
+* `frameProcessId` Integer
+* `frameRoutingId` Integer
+
+Emitted when a user or the page wants to start navigation anywhere in the `<webview>`
+or any frames embedded within. It can happen when the `window.location` object is
+changed or a user clicks a link in the page.
+
+This event will not emit when the navigation is started programmatically with
+APIs like `<webview>.loadURL` and `<webview>.back`.
+
+It is also not emitted during in-page navigation, such as clicking anchor links
+or updating the `window.location.hash`. Use `did-navigate-in-page` event for
+this purpose.
+
+Calling `event.preventDefault()` does __NOT__ have any effect.
+
### Event: 'did-start-navigation'
Returns:
diff --git a/lib/browser/guest-view-manager.ts b/lib/browser/guest-view-manager.ts
index 322b82aaec..a43c9cacfb 100644
--- a/lib/browser/guest-view-manager.ts
+++ b/lib/browser/guest-view-manager.ts
@@ -163,6 +163,16 @@ const createGuest = function (embedder: Electron.WebContents, embedderFrameId: n
});
});
+ // Dispatch guest's frame navigation event to embedder.
+ guest.on('will-frame-navigate', function (event: Electron.WebContentsWillFrameNavigateEventParams) {
+ sendToEmbedder(IPC_MESSAGES.GUEST_VIEW_INTERNAL_DISPATCH_EVENT, 'will-frame-navigate', {
+ url: event.url,
+ isMainFrame: event.isMainFrame,
+ frameProcessId: event.frame.processId,
+ frameRoutingId: event.frame.routingId
+ });
+ });
+
// Notify guest of embedder window visibility when it is ready
// FIXME Remove once https://github.com/electron/electron/issues/6828 is fixed
guest.on('dom-ready', function () {
diff --git a/shell/browser/api/electron_api_web_contents.cc b/shell/browser/api/electron_api_web_contents.cc
index db7dbbc505..13066035ee 100644
--- a/shell/browser/api/electron_api_web_contents.cc
+++ b/shell/browser/api/electron_api_web_contents.cc
@@ -623,6 +623,23 @@ void SetBackgroundColor(content::RenderWidgetHostView* rwhv, SkColor color) {
->SetContentBackgroundColor(color);
}
+content::RenderFrameHost* GetRenderFrameHost(
+ content::NavigationHandle* navigation_handle) {
+ int frame_tree_node_id = navigation_handle->GetFrameTreeNodeId();
+ content::FrameTreeNode* frame_tree_node =
+ content::FrameTreeNode::GloballyFindByID(frame_tree_node_id);
+ content::RenderFrameHostManager* render_manager =
+ frame_tree_node->render_manager();
+ content::RenderFrameHost* frame_host = nullptr;
+ if (render_manager) {
+ frame_host = render_manager->speculative_frame_host();
+ if (!frame_host)
+ frame_host = render_manager->current_frame_host();
+ }
+
+ return frame_host;
+}
+
} // namespace
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
@@ -1768,18 +1785,8 @@ bool WebContents::EmitNavigationEvent(
const std::string& event_name,
content::NavigationHandle* navigation_handle) {
bool is_main_frame = navigation_handle->IsInMainFrame();
- int frame_tree_node_id = navigation_handle->GetFrameTreeNodeId();
- content::FrameTreeNode* frame_tree_node =
- content::FrameTreeNode::GloballyFindByID(frame_tree_node_id);
- content::RenderFrameHostManager* render_manager =
- frame_tree_node->render_manager();
- content::RenderFrameHost* frame_host = nullptr;
- if (render_manager) {
- frame_host = render_manager->speculative_frame_host();
- if (!frame_host)
- frame_host = render_manager->current_frame_host();
- }
int frame_process_id = -1, frame_routing_id = -1;
+ content::RenderFrameHost* frame_host = GetRenderFrameHost(navigation_handle);
if (frame_host) {
frame_process_id = frame_host->GetProcess()->GetID();
frame_routing_id = frame_host->GetRoutingID();
diff --git a/shell/browser/electron_navigation_throttle.cc b/shell/browser/electron_navigation_throttle.cc
index 8397f8bfd9..e5c66077c0 100644
--- a/shell/browser/electron_navigation_throttle.cc
+++ b/shell/browser/electron_navigation_throttle.cc
@@ -37,6 +37,10 @@ ElectronNavigationThrottle::WillStartRequest() {
return PROCEED;
}
+ if (handle->IsRendererInitiated() &&
+ api_contents->EmitNavigationEvent("will-frame-navigate", handle)) {
+ return CANCEL;
+ }
if (handle->IsRendererInitiated() && handle->IsInMainFrame() &&
api_contents->EmitNavigationEvent("will-navigate", handle)) {
return CANCEL;
diff --git a/spec/api-browser-window-spec.ts b/spec/api-browser-window-spec.ts
index f41a8b5a52..5dea298430 100644
--- a/spec/api-browser-window-spec.ts
+++ b/spec/api-browser-window-spec.ts
@@ -6,7 +6,7 @@ import * as qs from 'querystring';
import * as http from 'http';
import * as os from 'os';
import { AddressInfo } from 'net';
-import { app, BrowserWindow, BrowserView, dialog, ipcMain, OnBeforeSendHeadersListenerDetails, protocol, screen, webContents, session, WebContents, WebFrameMain } from 'electron/main';
+import { app, BrowserWindow, BrowserView, dialog, ipcMain, OnBeforeSendHeadersListenerDetails, protocol, screen, webContents, webFrameMain, session, WebContents, WebFrameMain } from 'electron/main';
import { emittedUntil, emittedNTimes } from './lib/events-helpers';
import { ifit, ifdescribe, defer, listen } from './lib/spec-helpers';
@@ -568,6 +568,205 @@ describe('BrowserWindow module', () => {
});
});
+ describe('will-frame-navigate event', () => {
+ let server = null as unknown as http.Server;
+ let url = null as unknown as string;
+ before((done) => {
+ server = http.createServer((req, res) => {
+ if (req.url === '/navigate-top') {
+ res.end('<a target=_top href="/">navigate _top</a>');
+ } else if (req.url === '/navigate-iframe') {
+ res.end('<a href="/test">navigate iframe</a>');
+ } else if (req.url === '/navigate-iframe?navigated') {
+ res.end('Successfully navigated');
+ } else if (req.url === '/navigate-iframe-immediately') {
+ res.end(`
+ <script type="text/javascript" charset="utf-8">
+ location.href += '?navigated'
+ </script>
+ `);
+ } else if (req.url === '/navigate-iframe-immediately?navigated') {
+ res.end('Successfully navigated');
+ } else {
+ res.end('');
+ }
+ });
+ server.listen(0, '127.0.0.1', () => {
+ url = `http://127.0.0.1:${(server.address() as AddressInfo).port}/`;
+ done();
+ });
+ });
+
+ after(() => {
+ server.close();
+ });
+
+ it('allows the window to be closed from the event listener', (done) => {
+ w.webContents.once('will-frame-navigate', () => {
+ w.close();
+ done();
+ });
+ w.loadFile(path.join(fixtures, 'pages', 'will-navigate.html'));
+ });
+
+ it('can be prevented', (done) => {
+ let willNavigate = false;
+ w.webContents.once('will-frame-navigate', (e) => {
+ willNavigate = true;
+ e.preventDefault();
+ });
+ w.webContents.on('did-stop-loading', () => {
+ if (willNavigate) {
+ // i.e. it shouldn't have had '?navigated' appended to it.
+ try {
+ expect(w.webContents.getURL().endsWith('will-navigate.html')).to.be.true();
+ done();
+ } catch (e) {
+ done(e);
+ }
+ }
+ });
+ w.loadFile(path.join(fixtures, 'pages', 'will-navigate.html'));
+ });
+
+ it('can be prevented when navigating subframe', (done) => {
+ let willNavigate = false;
+ w.webContents.on('did-frame-navigate', (_event, _url, _httpResponseCode, _httpStatusText, isMainFrame, frameProcessId, frameRoutingId) => {
+ if (isMainFrame) return;
+
+ w.webContents.once('will-frame-navigate', (e) => {
+ willNavigate = true;
+ e.preventDefault();
+ });
+
+ w.webContents.on('did-stop-loading', () => {
+ const frame = webFrameMain.fromId(frameProcessId, frameRoutingId);
+ expect(frame).to.not.be.undefined();
+ if (willNavigate) {
+ // i.e. it shouldn't have had '?navigated' appended to it.
+ try {
+ expect(frame!.url.endsWith('/navigate-iframe-immediately')).to.be.true();
+ done();
+ } catch (e) {
+ done(e);
+ }
+ }
+ });
+ });
+ w.loadURL(`data:text/html,<iframe src="http://127.0.0.1:${(server.address() as AddressInfo).port}/navigate-iframe-immediately"></iframe>`);
+ });
+
+ it('is triggered when navigating from file: to http:', async () => {
+ await w.loadFile(path.join(fixtures, 'api', 'blank.html'));
+ w.webContents.executeJavaScript(`location.href = ${JSON.stringify(url)}`);
+ const navigatedTo = await new Promise(resolve => {
+ w.webContents.once('will-frame-navigate', (e) => {
+ e.preventDefault();
+ resolve(e.url);
+ });
+ });
+ expect(navigatedTo).to.equal(url);
+ expect(w.webContents.getURL()).to.match(/^file:/);
+ });
+
+ it('is triggered when navigating from about:blank to http:', async () => {
+ await w.loadURL('about:blank');
+ w.webContents.executeJavaScript(`location.href = ${JSON.stringify(url)}`);
+ const navigatedTo = await new Promise(resolve => {
+ w.webContents.once('will-frame-navigate', (e) => {
+ e.preventDefault();
+ resolve(e.url);
+ });
+ });
+ expect(navigatedTo).to.equal(url);
+ expect(w.webContents.getURL()).to.equal('about:blank');
+ });
+
+ it('is triggered when a cross-origin iframe navigates _top', async () => {
+ await w.loadURL(`data:text/html,<iframe src="http://127.0.0.1:${(server.address() as AddressInfo).port}/navigate-top"></iframe>`);
+ await setTimeout(1000);
+
+ let willFrameNavigateEmitted = false;
+ let isMainFrameValue;
+ w.webContents.on('will-frame-navigate', (event) => {
+ willFrameNavigateEmitted = true;
+ isMainFrameValue = event.isMainFrame;
+ });
+ const didNavigatePromise = once(w.webContents, 'did-navigate');
+
+ w.webContents.debugger.attach('1.1');
+ const targets = await w.webContents.debugger.sendCommand('Target.getTargets');
+ const iframeTarget = targets.targetInfos.find((t: any) => t.type === 'iframe');
+ const { sessionId } = await w.webContents.debugger.sendCommand('Target.attachToTarget', {
+ targetId: iframeTarget.targetId,
+ flatten: true
+ });
+ await w.webContents.debugger.sendCommand('Input.dispatchMouseEvent', {
+ type: 'mousePressed',
+ x: 10,
+ y: 10,
+ clickCount: 1,
+ button: 'left'
+ }, sessionId);
+ await w.webContents.debugger.sendCommand('Input.dispatchMouseEvent', {
+ type: 'mouseReleased',
+ x: 10,
+ y: 10,
+ clickCount: 1,
+ button: 'left'
+ }, sessionId);
+
+ await didNavigatePromise;
+
+ expect(willFrameNavigateEmitted).to.be.true();
+ expect(isMainFrameValue).to.be.true();
+ });
+
+ it('is triggered when a cross-origin iframe navigates itself', async () => {
+ await w.loadURL(`data:text/html,<iframe src="http://127.0.0.1:${(server.address() as AddressInfo).port}/navigate-iframe"></iframe>`);
+ await setTimeout(1000);
+
+ let willNavigateEmitted = false;
+ let isMainFrameValue;
+ w.webContents.on('will-frame-navigate', (event) => {
+ willNavigateEmitted = true;
+ isMainFrameValue = event.isMainFrame;
+ });
+ const didNavigatePromise = once(w.webContents, 'did-frame-navigate');
+
+ w.webContents.debugger.attach('1.1');
+ const targets = await w.webContents.debugger.sendCommand('Target.getTargets');
+ const iframeTarget = targets.targetInfos.find((t: any) => t.type === 'iframe');
+ const { sessionId } = await w.webContents.debugger.sendCommand('Target.attachToTarget', {
+ targetId: iframeTarget.targetId,
+ flatten: true
+ });
+ await w.webContents.debugger.sendCommand('Input.dispatchMouseEvent', {
+ type: 'mousePressed',
+ x: 10,
+ y: 10,
+ clickCount: 1,
+ button: 'left'
+ }, sessionId);
+ await w.webContents.debugger.sendCommand('Input.dispatchMouseEvent', {
+ type: 'mouseReleased',
+ x: 10,
+ y: 10,
+ clickCount: 1,
+ button: 'left'
+ }, sessionId);
+
+ await didNavigatePromise;
+
+ expect(willNavigateEmitted).to.be.true();
+ expect(isMainFrameValue).to.be.false();
+ });
+
+ it('can cancel when a cross-origin iframe navigates itself', async () => {
+
+ });
+ });
+
describe('will-redirect event', () => {
let server: http.Server;
let url: string;
@@ -652,6 +851,179 @@ describe('BrowserWindow module', () => {
w.loadURL(`${url}/navigate-302`);
});
});
+
+ describe('ordering', () => {
+ let server = null as unknown as http.Server;
+ let url = null as unknown as string;
+ const navigationEvents = [
+ 'did-start-navigation',
+ 'did-navigate-in-page',
+ 'will-frame-navigate',
+ 'will-navigate',
+ 'will-redirect',
+ 'did-redirect-navigation',
+ 'did-frame-navigate',
+ 'did-navigate'
+ ];
+ before((done) => {
+ server = http.createServer((req, res) => {
+ if (req.url === '/navigate') {
+ res.end('<a href="/">navigate</a>');
+ } else if (req.url === '/redirect') {
+ res.end('<a href="/redirect2">redirect</a>');
+ } else if (req.url === '/redirect2') {
+ res.statusCode = 302;
+ res.setHeader('location', url);
+ res.end();
+ } else if (req.url === '/in-page') {
+ res.end('<a href="#in-page">redirect</a><div id="in-page"></div>');
+ } else {
+ res.end('');
+ }
+ });
+ server.listen(0, '127.0.0.1', () => {
+ url = `http://127.0.0.1:${(server.address() as AddressInfo).port}/`;
+ done();
+ });
+ });
+ it('for initial navigation, event order is consistent', async () => {
+ const firedEvents: string[] = [];
+ const expectedEventOrder = [
+ 'did-start-navigation',
+ 'did-frame-navigate',
+ 'did-navigate'
+ ];
+ const allEvents = Promise.all(navigationEvents.map(event =>
+ once(w.webContents, event).then(() => firedEvents.push(event))
+ ));
+ const timeout = setTimeout(1000);
+ w.loadURL(url);
+ await Promise.race([allEvents, timeout]);
+ expect(firedEvents).to.deep.equal(expectedEventOrder);
+ });
+
+ it('for second navigation, event order is consistent', async () => {
+ const firedEvents: string[] = [];
+ const expectedEventOrder = [
+ 'did-start-navigation',
+ 'will-frame-navigate',
+ 'will-navigate',
+ 'did-frame-navigate',
+ 'did-navigate'
+ ];
+ w.loadURL(`${url}navigate`);
+ await once(w.webContents, 'did-navigate');
+ await setTimeout(1000);
+ navigationEvents.forEach(event =>
+ once(w.webContents, event).then(() => firedEvents.push(event))
+ );
+ const navigationFinished = once(w.webContents, 'did-navigate');
+ w.webContents.debugger.attach('1.1');
+ const targets = await w.webContents.debugger.sendCommand('Target.getTargets');
+ const pageTarget = targets.targetInfos.find((t: any) => t.type === 'page');
+ const { sessionId } = await w.webContents.debugger.sendCommand('Target.attachToTarget', {
+ targetId: pageTarget.targetId,
+ flatten: true
+ });
+ await w.webContents.debugger.sendCommand('Input.dispatchMouseEvent', {
+ type: 'mousePressed',
+ x: 10,
+ y: 10,
+ clickCount: 1,
+ button: 'left'
+ }, sessionId);
+ await w.webContents.debugger.sendCommand('Input.dispatchMouseEvent', {
+ type: 'mouseReleased',
+ x: 10,
+ y: 10,
+ clickCount: 1,
+ button: 'left'
+ }, sessionId);
+ await navigationFinished;
+ expect(firedEvents).to.deep.equal(expectedEventOrder);
+ });
+
+ it('when navigating with redirection, event order is consistent', async () => {
+ const firedEvents: string[] = [];
+ const expectedEventOrder = [
+ 'did-start-navigation',
+ 'will-frame-navigate',
+ 'will-navigate',
+ 'will-redirect',
+ 'did-redirect-navigation',
+ 'did-frame-navigate',
+ 'did-navigate'
+ ];
+ w.loadURL(`${url}redirect`);
+ await once(w.webContents, 'did-navigate');
+ await setTimeout(1000);
+ navigationEvents.forEach(event =>
+ once(w.webContents, event).then(() => firedEvents.push(event))
+ );
+ const navigationFinished = once(w.webContents, 'did-navigate');
+ w.webContents.debugger.attach('1.1');
+ const targets = await w.webContents.debugger.sendCommand('Target.getTargets');
+ const pageTarget = targets.targetInfos.find((t: any) => t.type === 'page');
+ const { sessionId } = await w.webContents.debugger.sendCommand('Target.attachToTarget', {
+ targetId: pageTarget.targetId,
+ flatten: true
+ });
+ await w.webContents.debugger.sendCommand('Input.dispatchMouseEvent', {
+ type: 'mousePressed',
+ x: 10,
+ y: 10,
+ clickCount: 1,
+ button: 'left'
+ }, sessionId);
+ await w.webContents.debugger.sendCommand('Input.dispatchMouseEvent', {
+ type: 'mouseReleased',
+ x: 10,
+ y: 10,
+ clickCount: 1,
+ button: 'left'
+ }, sessionId);
+ await navigationFinished;
+ expect(firedEvents).to.deep.equal(expectedEventOrder);
+ });
+
+ it('when navigating in-page, event order is consistent', async () => {
+ const firedEvents: string[] = [];
+ const expectedEventOrder = [
+ 'did-start-navigation',
+ 'did-navigate-in-page'
+ ];
+ w.loadURL(`${url}in-page`);
+ await once(w.webContents, 'did-navigate');
+ await setTimeout(1000);
+ navigationEvents.forEach(event =>
+ once(w.webContents, event).then(() => firedEvents.push(event))
+ );
+ const navigationFinished = once(w.webContents, 'did-navigate-in-page');
+ w.webContents.debugger.attach('1.1');
+ const targets = await w.webContents.debugger.sendCommand('Target.getTargets');
+ const pageTarget = targets.targetInfos.find((t: any) => t.type === 'page');
+ const { sessionId } = await w.webContents.debugger.sendCommand('Target.attachToTarget', {
+ targetId: pageTarget.targetId,
+ flatten: true
+ });
+ await w.webContents.debugger.sendCommand('Input.dispatchMouseEvent', {
+ type: 'mousePressed',
+ x: 10,
+ y: 10,
+ clickCount: 1,
+ button: 'left'
+ }, sessionId);
+ await w.webContents.debugger.sendCommand('Input.dispatchMouseEvent', {
+ type: 'mouseReleased',
+ x: 10,
+ y: 10,
+ clickCount: 1,
+ button: 'left'
+ }, sessionId);
+ await navigationFinished;
+ expect(firedEvents).to.deep.equal(expectedEventOrder);
+ });
+ });
});
}
diff --git a/spec/fixtures/pages/webview-will-navigate-in-frame.html b/spec/fixtures/pages/webview-will-navigate-in-frame.html
new file mode 100644
index 0000000000..63f921e724
--- /dev/null
+++ b/spec/fixtures/pages/webview-will-navigate-in-frame.html
@@ -0,0 +1,12 @@
+<html>
+<body>
+ <script>
+ function loadSubframe() {
+ const frame = document.createElement("iframe");
+ frame.id = "frame";
+ frame.setAttribute("src", "./webview-will-navigate.html");
+ document.body.appendChild(frame);
+ }
+ </script>
+</body>
+</html>
diff --git a/spec/webview-spec.ts b/spec/webview-spec.ts
index c6a4d514d9..8d0f78a5c8 100644
--- a/spec/webview-spec.ts
+++ b/spec/webview-spec.ts
@@ -1480,7 +1480,7 @@ describe('<webview> tag', function () {
});
describe('will-navigate event', () => {
- it('emits when a url that leads to outside of the page is clicked', async () => {
+ it('emits when a url that leads to outside of the page is loaded', async () => {
const { url } = await loadWebViewAndWaitForEvent(w, {
src: `file://${fixtures}/pages/webview-will-navigate.html`
}, 'will-navigate');
@@ -1489,6 +1489,47 @@ describe('<webview> tag', function () {
});
});
+ describe('will-frame-navigate event', () => {
+ it('emits when a link that leads to outside of the page is loaded', async () => {
+ const { url, isMainFrame } = await loadWebViewAndWaitForEvent(w, {
+ src: `file://${fixtures}/pages/webview-will-navigate.html`
+ }, 'will-frame-navigate');
+ expect(url).to.equal('http://host/');
+ expect(isMainFrame).to.be.true();
+ });
+
+ it('emits when a link within an iframe, which leads to outside of the page, is loaded', async () => {
+ await loadWebView(w, {
+ src: `file://${fixtures}/pages/webview-will-navigate-in-frame.html`,
+ nodeIntegration: ''
+ });
+
+ const { url, frameProcessId, frameRoutingId } = await w.executeJavaScript(`
+ new Promise((resolve, reject) => {
+ let hasFrameNavigatedOnce = false;
+ const webview = document.getElementById('webview');
+ webview.addEventListener('will-frame-navigate', ({url, isMainFrame, frameProcessId, frameRoutingId}) => {
+ if (isMainFrame) return;
+ if (hasFrameNavigatedOnce) resolve({
+ url,
+ isMainFrame,
+ frameProcessId,
+ frameRoutingId,
+ });
+
+ // First navigation is the initial iframe load within the <webview>
+ hasFrameNavigatedOnce = true;
+ });
+ webview.executeJavaScript('loadSubframe()');
+ });
+ `);
+
+ expect(url).to.equal('http://host/');
+ expect(frameProcessId).to.be.a('number');
+ expect(frameRoutingId).to.be.a('number');
+ });
+ });
+
describe('did-navigate event', () => {
it('emits when a url that leads to outside of the page is clicked', async () => {
const pageUrl = url.pathToFileURL(path.join(fixtures, 'pages', 'webview-will-navigate.html')).toString();
|
feat
|
b69236d1770d98768b3698760c81388c0ae9e3e2
|
David Sanders
|
2023-01-18 13:30:01
|
test: fix test for USB device.forget() (#36942)
|
diff --git a/spec/chromium-spec.ts b/spec/chromium-spec.ts
index ea431e84f5..a856f9bbdc 100644
--- a/spec/chromium-spec.ts
+++ b/spec/chromium-spec.ts
@@ -3071,7 +3071,7 @@ describe('navigator.usb', () => {
if (haveDevices) {
const grantedDevices = await w.webContents.executeJavaScript('navigator.usb.getDevices()');
if (grantedDevices.length > 0) {
- const deletedDevice = await w.webContents.executeJavaScript(`
+ const deletedDevice: Electron.USBDevice = await w.webContents.executeJavaScript(`
navigator.usb.getDevices().then(devices => {
devices[0].forget();
return {
@@ -3083,7 +3083,7 @@ describe('navigator.usb', () => {
`);
const grantedDevices2 = await w.webContents.executeJavaScript('navigator.usb.getDevices()');
expect(grantedDevices2.length).to.be.lessThan(grantedDevices.length);
- if (deletedDevice.name !== '' && deletedDevice.productId && deletedDevice.vendorId) {
+ if (deletedDevice.productName !== '' && deletedDevice.productId && deletedDevice.vendorId) {
expect(deletedDeviceFromEvent).to.include(deletedDevice);
}
}
|
test
|
d13a93fb616f90cdcd58f97c274554b0253ea35e
|
Cheng Zhao
|
2024-01-25 00:54:32
|
chore: remove node patches by using the preload feature (#41080)
|
diff --git a/BUILD.gn b/BUILD.gn
index 3e4ab11250..efbd0f585b 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -166,15 +166,6 @@ npm_action("build_electron_definitions") {
outputs = [ "$target_gen_dir/tsc/typings/electron.d.ts" ]
}
-webpack_build("electron_asar_bundle") {
- deps = [ ":build_electron_definitions" ]
-
- inputs = auto_filenames.asar_bundle_deps
-
- config_file = "//electron/build/webpack/webpack.config.asar.js"
- out_file = "$target_gen_dir/js2c/asar_bundle.js"
-}
-
webpack_build("electron_browser_bundle") {
deps = [ ":build_electron_definitions" ]
@@ -220,6 +211,15 @@ webpack_build("electron_isolated_renderer_bundle") {
out_file = "$target_gen_dir/js2c/isolated_bundle.js"
}
+webpack_build("electron_node_bundle") {
+ deps = [ ":build_electron_definitions" ]
+
+ inputs = auto_filenames.node_bundle_deps
+
+ config_file = "//electron/build/webpack/webpack.config.node.js"
+ out_file = "$target_gen_dir/js2c/node_init.js"
+}
+
webpack_build("electron_utility_bundle") {
deps = [ ":build_electron_definitions" ]
@@ -231,9 +231,9 @@ webpack_build("electron_utility_bundle") {
action("electron_js2c") {
deps = [
- ":electron_asar_bundle",
":electron_browser_bundle",
":electron_isolated_renderer_bundle",
+ ":electron_node_bundle",
":electron_renderer_bundle",
":electron_sandboxed_renderer_bundle",
":electron_utility_bundle",
@@ -242,9 +242,9 @@ action("electron_js2c") {
]
sources = [
- "$target_gen_dir/js2c/asar_bundle.js",
"$target_gen_dir/js2c/browser_init.js",
"$target_gen_dir/js2c/isolated_bundle.js",
+ "$target_gen_dir/js2c/node_init.js",
"$target_gen_dir/js2c/renderer_init.js",
"$target_gen_dir/js2c/sandbox_bundle.js",
"$target_gen_dir/js2c/utility_init.js",
diff --git a/build/webpack/webpack.config.asar.js b/build/webpack/webpack.config.asar.js
deleted file mode 100644
index 83443f467c..0000000000
--- a/build/webpack/webpack.config.asar.js
+++ /dev/null
@@ -1,5 +0,0 @@
-module.exports = require('./webpack.config.base')({
- target: 'asar',
- alwaysHasNode: true,
- targetDeletesNodeGlobals: true
-});
diff --git a/build/webpack/webpack.config.node.js b/build/webpack/webpack.config.node.js
new file mode 100644
index 0000000000..875ec4bacb
--- /dev/null
+++ b/build/webpack/webpack.config.node.js
@@ -0,0 +1,4 @@
+module.exports = require('./webpack.config.base')({
+ target: 'node',
+ alwaysHasNode: true
+});
diff --git a/filenames.auto.gni b/filenames.auto.gni
index b972dc9f4e..bbf71f31cc 100644
--- a/filenames.auto.gni
+++ b/filenames.auto.gni
@@ -336,10 +336,9 @@ auto_filenames = {
"typings/internal-electron.d.ts",
]
- asar_bundle_deps = [
- "lib/asar/fs-wrapper.ts",
- "lib/asar/init.ts",
- "lib/common/webpack-provider.ts",
+ node_bundle_deps = [
+ "lib/node/asar-fs-wrapper.ts",
+ "lib/node/init.ts",
"package.json",
"tsconfig.electron.json",
"tsconfig.json",
diff --git a/lib/asar/init.ts b/lib/asar/init.ts
deleted file mode 100644
index 71ad738e9f..0000000000
--- a/lib/asar/init.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import { wrapFsWithAsar } from './fs-wrapper';
-
-wrapFsWithAsar(require('fs'));
diff --git a/lib/asar/fs-wrapper.ts b/lib/node/asar-fs-wrapper.ts
similarity index 100%
rename from lib/asar/fs-wrapper.ts
rename to lib/node/asar-fs-wrapper.ts
diff --git a/lib/node/init.ts b/lib/node/init.ts
new file mode 100644
index 0000000000..19bd28eccf
--- /dev/null
+++ b/lib/node/init.ts
@@ -0,0 +1,31 @@
+// Initialize ASAR support in fs module.
+import { wrapFsWithAsar } from './asar-fs-wrapper';
+wrapFsWithAsar(require('fs'));
+
+// Hook child_process.fork.
+const cp = require('child_process');
+const originalFork = cp.fork;
+cp.fork = (modulePath: string, args: any, options: any) => {
+ // Parse optional args.
+ if (args == null) {
+ args = [];
+ } else if (typeof args === 'object' && !Array.isArray(args)) {
+ options = args;
+ args = [];
+ }
+ // Fallback to original fork to report arg type errors.
+ if (typeof modulePath !== 'string' || !Array.isArray(args) ||
+ (typeof options !== 'object' && typeof options !== 'undefined')) {
+ return originalFork(modulePath, args, options);
+ }
+ // When forking a child script, we setup a special environment to make
+ // the electron binary run like upstream Node.js.
+ options = options ?? {};
+ options.env = Object.create(options.env || process.env);
+ options.env.ELECTRON_RUN_AS_NODE = 1;
+ // On mac the child script runs in helper executable.
+ if (!options.execPath && process.platform === 'darwin') {
+ options.execPath = process.helperExecPath;
+ }
+ return originalFork(modulePath, args, options);
+};
diff --git a/patches/node/.patches b/patches/node/.patches
index 48c817bb39..7709224dce 100644
--- a/patches/node/.patches
+++ b/patches/node/.patches
@@ -1,5 +1,3 @@
-refactor_alter_child_process_fork_to_use_execute_script_with.patch
-feat_initialize_asar_support.patch
expose_get_builtin_module_function.patch
build_add_gn_build_files.patch
fix_add_default_values_for_variables_in_common_gypi.patch
@@ -46,3 +44,4 @@ build_do_not_rely_on_gn_helpers_in_gn_build.patch
test_make_test-node-output-v8-warning_generic.patch
test_match_wpt_streams_transferable_transform-stream-members_any_js.patch
build_ensure_v8_pointer_compression_sandbox_is_enabled_on_64bit.patch
+src_preload_function_for_environment.patch
diff --git a/patches/node/chore_allow_the_node_entrypoint_to_be_a_builtin_module.patch b/patches/node/chore_allow_the_node_entrypoint_to_be_a_builtin_module.patch
index da850edb32..4a342ab026 100644
--- a/patches/node/chore_allow_the_node_entrypoint_to_be_a_builtin_module.patch
+++ b/patches/node/chore_allow_the_node_entrypoint_to_be_a_builtin_module.patch
@@ -26,10 +26,10 @@ index 1f3b719048f2477de183e2856b9b8eee8502f708..21116088c101f4679b5a5f41762ce710
try {
resolvedArgv = Module._resolveFilename(process.argv[1], null, false);
diff --git a/lib/internal/process/pre_execution.js b/lib/internal/process/pre_execution.js
-index fc8f61ee6d30cf18951ec7a5eb5f09a9583a85ae..61858f6bdcdbc231d7e2327e42732ad928d47ac7 100644
+index 9142fed75e9050fcc17c01208e82f1bc57923fcd..157a85623c7eb5338baa77aba5dc448a4614ded0 100644
--- a/lib/internal/process/pre_execution.js
+++ b/lib/internal/process/pre_execution.js
-@@ -238,12 +238,14 @@ function patchProcessObject(expandArgv1) {
+@@ -232,12 +232,14 @@ function patchProcessObject(expandArgv1) {
if (expandArgv1 && process.argv[1] &&
!StringPrototypeStartsWith(process.argv[1], '-')) {
// Expand process.argv[1] into a full path.
diff --git a/patches/node/enable_crashpad_linux_node_processes.patch b/patches/node/enable_crashpad_linux_node_processes.patch
index 16276e457b..45a332c46f 100644
--- a/patches/node/enable_crashpad_linux_node_processes.patch
+++ b/patches/node/enable_crashpad_linux_node_processes.patch
@@ -8,7 +8,7 @@ to child processes spawned with `ELECTRON_RUN_AS_NODE` which is used
by the crashpad client to connect with the handler process.
diff --git a/lib/child_process.js b/lib/child_process.js
-index 9dd33ecbac3a5d516f9bff76fdbe1a8aece531f2..0464ecc7b53389cdff97a7fe4cb01582e8b72dbb 100644
+index 449013906e93e59568a90264d5372a3962db6cb0..168163001f13b641bc284fd01a71f075e1ada94f 100644
--- a/lib/child_process.js
+++ b/lib/child_process.js
@@ -61,6 +61,7 @@ let debug = require('internal/util/debuglog').debuglog(
@@ -19,7 +19,7 @@ index 9dd33ecbac3a5d516f9bff76fdbe1a8aece531f2..0464ecc7b53389cdff97a7fe4cb01582
const {
AbortError,
-@@ -162,7 +163,6 @@ function fork(modulePath, args = [], options) {
+@@ -154,7 +155,6 @@ function fork(modulePath, args = [], options) {
ArrayPrototypeSplice(execArgv, index - 1, 2);
}
}
@@ -27,7 +27,7 @@ index 9dd33ecbac3a5d516f9bff76fdbe1a8aece531f2..0464ecc7b53389cdff97a7fe4cb01582
args = [...execArgv, modulePath, ...args];
if (typeof options.stdio === 'string') {
-@@ -625,6 +625,21 @@ function normalizeSpawnArguments(file, args, options) {
+@@ -617,6 +617,21 @@ function normalizeSpawnArguments(file, args, options) {
'options.windowsVerbatimArguments');
}
diff --git a/patches/node/feat_initialize_asar_support.patch b/patches/node/feat_initialize_asar_support.patch
deleted file mode 100644
index 33ae71f361..0000000000
--- a/patches/node/feat_initialize_asar_support.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Shelley Vohr <[email protected]>
-Date: Thu, 13 Sep 2018 08:56:07 -0700
-Subject: feat: initialize asar support
-
-This patch initializes asar support in Node.js.
-
-diff --git a/lib/internal/process/pre_execution.js b/lib/internal/process/pre_execution.js
-index 9142fed75e9050fcc17c01208e82f1bc57923fcd..fc8f61ee6d30cf18951ec7a5eb5f09a9583a85ae 100644
---- a/lib/internal/process/pre_execution.js
-+++ b/lib/internal/process/pre_execution.js
-@@ -87,6 +87,7 @@ function prepareShadowRealmExecution() {
- });
- }
-
-+let processLinkedBinding = process._linkedBinding;
- function prepareExecution(options) {
- const { expandArgv1, initializeModules, isMainThread } = options;
-
-@@ -193,12 +194,17 @@ function setupUserModules(forceDefaultLoader = false) {
- }
- // Need to be done after --require setup.
- initializeFrozenIntrinsics();
-+ setupAsarSupport();
- }
-
- function refreshRuntimeOptions() {
- refreshOptions();
- }
-
-+function setupAsarSupport() {
-+ processLinkedBinding('electron_common_asar').initAsarSupport(require);
-+}
-+
- /**
- * Patch the process object with legacy properties and normalizations.
- * Replace `process.argv[0]` with `process.execPath`, preserving the original `argv[0]` value as `process.argv0`.
diff --git a/patches/node/refactor_alter_child_process_fork_to_use_execute_script_with.patch b/patches/node/refactor_alter_child_process_fork_to_use_execute_script_with.patch
deleted file mode 100644
index ea4b603407..0000000000
--- a/patches/node/refactor_alter_child_process_fork_to_use_execute_script_with.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Shelley Vohr <[email protected]>
-Date: Mon, 30 Jul 2018 10:30:35 -0700
-Subject: refactor: alter child_process.fork to use execute script with
- Electron
-
-When forking a child script, we setup a special environment to make the Electron binary run like the upstream node. On Mac, we use the helper app as node binary.
-
-diff --git a/lib/child_process.js b/lib/child_process.js
-index 449013906e93e59568a90264d5372a3962db6cb0..9dd33ecbac3a5d516f9bff76fdbe1a8aece531f2 100644
---- a/lib/child_process.js
-+++ b/lib/child_process.js
-@@ -139,6 +139,14 @@ function fork(modulePath, args = [], options) {
- validateObject(options, 'options');
- }
- options = { __proto__: null, ...options, shell: false };
-+ // When forking a child script, we setup a special environment to make
-+ // the electron binary run like upstream Node.js
-+ options.env = Object.create(options.env || process.env)
-+ options.env.ELECTRON_RUN_AS_NODE = 1;
-+
-+ if (!options.execPath && process.type && process.platform == 'darwin') {
-+ options.execPath = process.helperExecPath;
-+ }
- options.execPath = options.execPath || process.execPath;
- validateArgumentNullCheck(options.execPath, 'options.execPath');
-
diff --git a/patches/node/src_preload_function_for_environment.patch b/patches/node/src_preload_function_for_environment.patch
new file mode 100644
index 0000000000..5679e1572c
--- /dev/null
+++ b/patches/node/src_preload_function_for_environment.patch
@@ -0,0 +1,299 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Cheng Zhao <[email protected]>
+Date: Mon, 22 Jan 2024 13:45:55 +0900
+Subject: src: preload function for Environment
+
+https://github.com/nodejs/node/pull/51539
+
+This PR adds a |preload| arg to the node::CreateEnvironment to allow
+embedders to set a preload function for the environment, which will run
+after the environment is loaded and before the main script runs.
+
+This is similiar to the --require CLI option, but runs a C++ function,
+and can only be set by embedders.
+
+The preload function can be used by embedders to inject scripts before
+running the main script, for example:
+1. In Electron it is used to initialize the ASAR virtual filesystem,
+ inject custom process properties, etc.
+2. In VS Code it can be used to reset the module search paths for
+ extensions.
+
+diff --git a/lib/internal/process/pre_execution.js b/lib/internal/process/pre_execution.js
+index 157a85623c7eb5338baa77aba5dc448a4614ded0..701f91f1c9603c1da03e0fe6d20c8627c8d644fb 100644
+--- a/lib/internal/process/pre_execution.js
++++ b/lib/internal/process/pre_execution.js
+@@ -185,6 +185,9 @@ function setupUserModules(forceDefaultLoader = false) {
+ initializeESMLoader(forceDefaultLoader);
+ const CJSLoader = require('internal/modules/cjs/loader');
+ assert(!CJSLoader.hasLoadedAnyUserCJSModule);
++ if (getEmbedderOptions().hasEmbedderPreload) {
++ runEmbedderPreload();
++ }
+ // Do not enable preload modules if custom loaders are disabled.
+ // For example, loader workers are responsible for doing this themselves.
+ // And preload modules are not supported in ShadowRealm as well.
+@@ -742,6 +745,10 @@ function initializeFrozenIntrinsics() {
+ }
+ }
+
++function runEmbedderPreload() {
++ internalBinding('mksnapshot').runEmbedderPreload(process, require);
++}
++
+ function loadPreloadModules() {
+ // For user code, we preload modules if `-r` is passed
+ const preloadModules = getOptionValue('--require');
+diff --git a/src/api/environment.cc b/src/api/environment.cc
+index 9045de3b17c93c4864a1bb1024b08f7d1ffa83be..7c580e1ce1af66e010083240aaf8b0037dd41f2e 100644
+--- a/src/api/environment.cc
++++ b/src/api/environment.cc
+@@ -442,7 +442,8 @@ Environment* CreateEnvironment(
+ const std::vector<std::string>& exec_args,
+ EnvironmentFlags::Flags flags,
+ ThreadId thread_id,
+- std::unique_ptr<InspectorParentHandle> inspector_parent_handle) {
++ std::unique_ptr<InspectorParentHandle> inspector_parent_handle,
++ EmbedderPreloadCallback preload) {
+ Isolate* isolate = isolate_data->isolate();
+
+ Isolate::Scope isolate_scope(isolate);
+@@ -463,7 +464,8 @@ Environment* CreateEnvironment(
+ exec_args,
+ env_snapshot_info,
+ flags,
+- thread_id);
++ thread_id,
++ std::move(preload));
+ CHECK_NOT_NULL(env);
+
+ if (use_snapshot) {
+diff --git a/src/env-inl.h b/src/env-inl.h
+index 564de2990c09a54693686666f9ad66398ff76ab5..b10bc2396539b011dec6f09719251bfc842072af 100644
+--- a/src/env-inl.h
++++ b/src/env-inl.h
+@@ -438,6 +438,10 @@ inline void Environment::set_embedder_entry_point(StartExecutionCallback&& fn) {
+ embedder_entry_point_ = std::move(fn);
+ }
+
++inline const EmbedderPreloadCallback& Environment::embedder_preload() const {
++ return embedder_preload_;
++}
++
+ inline double Environment::new_async_id() {
+ async_hooks()->async_id_fields()[AsyncHooks::kAsyncIdCounter] += 1;
+ return async_hooks()->async_id_fields()[AsyncHooks::kAsyncIdCounter];
+diff --git a/src/env.cc b/src/env.cc
+index ba575a04340b91709fb6c8710ab160a4ca1f8b77..76db0ac4ef72b902a7567a96cfd751ff879117b7 100644
+--- a/src/env.cc
++++ b/src/env.cc
+@@ -767,7 +767,8 @@ Environment::Environment(IsolateData* isolate_data,
+ const std::vector<std::string>& exec_args,
+ const EnvSerializeInfo* env_info,
+ EnvironmentFlags::Flags flags,
+- ThreadId thread_id)
++ ThreadId thread_id,
++ EmbedderPreloadCallback preload)
+ : isolate_(isolate),
+ isolate_data_(isolate_data),
+ async_hooks_(isolate, MAYBE_FIELD_PTR(env_info, async_hooks)),
+@@ -793,7 +794,8 @@ Environment::Environment(IsolateData* isolate_data,
+ flags_(flags),
+ thread_id_(thread_id.id == static_cast<uint64_t>(-1)
+ ? AllocateEnvironmentThreadId().id
+- : thread_id.id) {
++ : thread_id.id),
++ embedder_preload_(std::move(preload)) {
+ constexpr bool is_shared_ro_heap =
+ #ifdef NODE_V8_SHARED_RO_HEAP
+ true;
+diff --git a/src/env.h b/src/env.h
+index 448075e354c760a2dbd1dd763f40b7a645730250..a5aad9596953536b0a1f741dfbc4f21f6a961404 100644
+--- a/src/env.h
++++ b/src/env.h
+@@ -635,7 +635,8 @@ class Environment : public MemoryRetainer {
+ const std::vector<std::string>& exec_args,
+ const EnvSerializeInfo* env_info,
+ EnvironmentFlags::Flags flags,
+- ThreadId thread_id);
++ ThreadId thread_id,
++ EmbedderPreloadCallback preload);
+ void InitializeMainContext(v8::Local<v8::Context> context,
+ const EnvSerializeInfo* env_info);
+ ~Environment() override;
+@@ -986,6 +987,8 @@ class Environment : public MemoryRetainer {
+ inline const StartExecutionCallback& embedder_entry_point() const;
+ inline void set_embedder_entry_point(StartExecutionCallback&& fn);
+
++ inline const EmbedderPreloadCallback& embedder_preload() const;
++
+ inline void set_process_exit_handler(
+ std::function<void(Environment*, ExitCode)>&& handler);
+
+@@ -1186,6 +1189,7 @@ class Environment : public MemoryRetainer {
+
+ builtins::BuiltinLoader builtin_loader_;
+ StartExecutionCallback embedder_entry_point_;
++ EmbedderPreloadCallback embedder_preload_;
+
+ // Used by allocate_managed_buffer() and release_managed_buffer() to keep
+ // track of the BackingStore for a given pointer.
+diff --git a/src/node.h b/src/node.h
+index 36da93a7b41ea450a5f288ec17b61adae46ae178..09e044e86bab2cef42c86dbfc9bbcc743daf564d 100644
+--- a/src/node.h
++++ b/src/node.h
+@@ -678,11 +678,23 @@ struct InspectorParentHandle {
+ virtual ~InspectorParentHandle() = default;
+ };
+
++using EmbedderPreloadCallback =
++ std::function<void(Environment* env,
++ v8::Local<v8::Value> process,
++ v8::Local<v8::Value> require)>;
++
+ // TODO(addaleax): Maybe move per-Environment options parsing here.
+ // Returns nullptr when the Environment cannot be created e.g. there are
+ // pending JavaScript exceptions.
+ // `context` may be empty if an `EmbedderSnapshotData` instance was provided
+ // to `NewIsolate()` and `CreateIsolateData()`.
++//
++// The |preload| function will run before executing the entry point, which
++// is usually used by embedders to inject scripts. The function is executed
++// with preload(process, require), and the passed require function has access
++// to internal Node.js modules. The |preload| function is inherited by worker
++// threads and thus will run in work threads, so make sure the function is
++// thread-safe.
+ NODE_EXTERN Environment* CreateEnvironment(
+ IsolateData* isolate_data,
+ v8::Local<v8::Context> context,
+@@ -690,7 +702,8 @@ NODE_EXTERN Environment* CreateEnvironment(
+ const std::vector<std::string>& exec_args,
+ EnvironmentFlags::Flags flags = EnvironmentFlags::kDefaultFlags,
+ ThreadId thread_id = {} /* allocates a thread id automatically */,
+- std::unique_ptr<InspectorParentHandle> inspector_parent_handle = {});
++ std::unique_ptr<InspectorParentHandle> inspector_parent_handle = {},
++ EmbedderPreloadCallback preload = nullptr);
+
+ // Returns a handle that can be passed to `LoadEnvironment()`, making the
+ // child Environment accessible to the inspector as if it were a Node.js Worker.
+diff --git a/src/node_options.cc b/src/node_options.cc
+index 48ce3f3b68a94fc35e5ce93a385ddbebb03741b9..39d34e18e483882a71145110962109711a1566e2 100644
+--- a/src/node_options.cc
++++ b/src/node_options.cc
+@@ -1290,6 +1290,12 @@ void GetEmbedderOptions(const FunctionCallbackInfo<Value>& args) {
+ .IsNothing())
+ return;
+
++ if (ret->Set(context,
++ FIXED_ONE_BYTE_STRING(env->isolate(), "hasEmbedderPreload"),
++ Boolean::New(isolate, env->embedder_preload() != nullptr))
++ .IsNothing())
++ return;
++
+ args.GetReturnValue().Set(ret);
+ }
+
+diff --git a/src/node_snapshotable.cc b/src/node_snapshotable.cc
+index 562a47ddcc9c8e61590b7b09d84dc08ab4b3653d..325bebc1df9ad2e8b0bad468951cf1563ecefc14 100644
+--- a/src/node_snapshotable.cc
++++ b/src/node_snapshotable.cc
+@@ -1369,6 +1369,13 @@ static void RunEmbedderEntryPoint(const FunctionCallbackInfo<Value>& args) {
+ }
+ }
+
++static void RunEmbedderPreload(const FunctionCallbackInfo<Value>& args) {
++ Environment* env = Environment::GetCurrent(args);
++ CHECK(env->embedder_preload());
++ CHECK_EQ(args.Length(), 2);
++ env->embedder_preload()(env, args[0], args[1]);
++}
++
+ void CompileSerializeMain(const FunctionCallbackInfo<Value>& args) {
+ CHECK(args[0]->IsString());
+ Local<String> filename = args[0].As<String>();
+@@ -1493,6 +1500,7 @@ void CreatePerIsolateProperties(IsolateData* isolate_data,
+ Local<ObjectTemplate> target) {
+ Isolate* isolate = isolate_data->isolate();
+ SetMethod(isolate, target, "runEmbedderEntryPoint", RunEmbedderEntryPoint);
++ SetMethod(isolate, target, "runEmbedderPreload", RunEmbedderPreload);
+ SetMethod(isolate, target, "compileSerializeMain", CompileSerializeMain);
+ SetMethod(isolate, target, "setSerializeCallback", SetSerializeCallback);
+ SetMethod(isolate, target, "setDeserializeCallback", SetDeserializeCallback);
+@@ -1506,6 +1514,7 @@ void CreatePerIsolateProperties(IsolateData* isolate_data,
+
+ void RegisterExternalReferences(ExternalReferenceRegistry* registry) {
+ registry->Register(RunEmbedderEntryPoint);
++ registry->Register(RunEmbedderPreload);
+ registry->Register(CompileSerializeMain);
+ registry->Register(SetSerializeCallback);
+ registry->Register(SetDeserializeCallback);
+diff --git a/src/node_worker.cc b/src/node_worker.cc
+index 900674bbe4c90e9aeb2013c06c9979864b06dcd5..2a22d986585e93ea00c6dcdca1f7b783ef0723f8 100644
+--- a/src/node_worker.cc
++++ b/src/node_worker.cc
+@@ -63,6 +63,7 @@ Worker::Worker(Environment* env,
+ thread_id_(AllocateEnvironmentThreadId()),
+ name_(name),
+ env_vars_(env_vars),
++ embedder_preload_(env->embedder_preload()),
+ snapshot_data_(snapshot_data) {
+ Debug(this, "Creating new worker instance with thread id %llu",
+ thread_id_.id);
+@@ -360,7 +361,8 @@ void Worker::Run() {
+ std::move(exec_argv_),
+ static_cast<EnvironmentFlags::Flags>(environment_flags_),
+ thread_id_,
+- std::move(inspector_parent_handle_)));
++ std::move(inspector_parent_handle_),
++ std::move(embedder_preload_)));
+ if (is_stopped()) return;
+ CHECK_NOT_NULL(env_);
+ env_->set_env_vars(std::move(env_vars_));
+diff --git a/src/node_worker.h b/src/node_worker.h
+index 531e2b5287010f9206ab4fd7f4dd0f3dec9fe55c..07fd7b460654e169e8b6822474dc3cc70fcec4c0 100644
+--- a/src/node_worker.h
++++ b/src/node_worker.h
+@@ -114,6 +114,7 @@ class Worker : public AsyncWrap {
+
+ std::unique_ptr<MessagePortData> child_port_data_;
+ std::shared_ptr<KVStore> env_vars_;
++ EmbedderPreloadCallback embedder_preload_;
+
+ // A raw flag that is used by creator and worker threads to
+ // sync up on pre-mature termination of worker - while in the
+diff --git a/test/cctest/test_environment.cc b/test/cctest/test_environment.cc
+index 2e747c7be58922897abd0424b797f3f12a89ada1..658f8df4b01d60759e858cf5283b9be9467dd142 100644
+--- a/test/cctest/test_environment.cc
++++ b/test/cctest/test_environment.cc
+@@ -773,3 +773,31 @@ TEST_F(EnvironmentTest, RequestInterruptAtExit) {
+
+ context->Exit();
+ }
++
++TEST_F(EnvironmentTest, EmbedderPreload) {
++ v8::HandleScope handle_scope(isolate_);
++ v8::Local<v8::Context> context = node::NewContext(isolate_);
++ v8::Context::Scope context_scope(context);
++
++ node::EmbedderPreloadCallback preload = [](node::Environment* env,
++ v8::Local<v8::Value> process,
++ v8::Local<v8::Value> require) {
++ CHECK(process->IsObject());
++ CHECK(require->IsFunction());
++ process.As<v8::Object>()->Set(
++ env->context(),
++ v8::String::NewFromUtf8Literal(env->isolate(), "prop"),
++ v8::String::NewFromUtf8Literal(env->isolate(), "preload")).Check();
++ };
++
++ std::unique_ptr<node::Environment, decltype(&node::FreeEnvironment)> env(
++ node::CreateEnvironment(isolate_data_, context, {}, {},
++ node::EnvironmentFlags::kDefaultFlags, {}, {},
++ preload),
++ node::FreeEnvironment);
++
++ v8::Local<v8::Value> main_ret =
++ node::LoadEnvironment(env.get(), "return process.prop;").ToLocalChecked();
++ node::Utf8Value main_ret_str(isolate_, main_ret);
++ EXPECT_EQ(std::string(*main_ret_str), "preload");
++}
diff --git a/script/gen-filenames.ts b/script/gen-filenames.ts
index b281ea78ef..cb2d0e6511 100644
--- a/script/gen-filenames.ts
+++ b/script/gen-filenames.ts
@@ -38,8 +38,8 @@ const main = async () => {
config: 'webpack.config.worker.js'
},
{
- name: 'asar_bundle_deps',
- config: 'webpack.config.asar.js'
+ name: 'node_bundle_deps',
+ config: 'webpack.config.node.js'
},
{
name: 'utility_bundle_deps',
diff --git a/shell/app/node_main.cc b/shell/app/node_main.cc
index e375cb6cb1..20b7080650 100644
--- a/shell/app/node_main.cc
+++ b/shell/app/node_main.cc
@@ -21,7 +21,6 @@
#include "base/task/single_thread_task_runner.h"
#include "base/task/thread_pool/thread_pool_instance.h"
#include "content/public/common/content_switches.h"
-#include "electron/electron_version.h"
#include "electron/fuses.h"
#include "gin/array_buffer.h"
#include "gin/public/isolate_holder.h"
@@ -260,7 +259,8 @@ int NodeMain(int argc, char* argv[]) {
env = node::CreateEnvironment(
isolate_data, isolate->GetCurrentContext(), result->args(),
result->exec_args(),
- static_cast<node::EnvironmentFlags::Flags>(env_flags));
+ static_cast<node::EnvironmentFlags::Flags>(env_flags), {}, {},
+ &OnNodePreload);
CHECK_NE(nullptr, env);
node::SetIsolateUpForNode(isolate);
@@ -282,11 +282,6 @@ int NodeMain(int argc, char* argv[]) {
#endif
process.Set("crashReporter", reporter);
-
- gin_helper::Dictionary versions;
- if (process.Get("versions", &versions)) {
- versions.SetReadOnly(ELECTRON_PROJECT_NAME, ELECTRON_VERSION_STRING);
- }
}
v8::HandleScope scope(isolate);
diff --git a/shell/common/api/electron_api_asar.cc b/shell/common/api/electron_api_asar.cc
index 4c8ff7ee47..58db75a327 100644
--- a/shell/common/api/electron_api_asar.cc
+++ b/shell/common/api/electron_api_asar.cc
@@ -10,7 +10,6 @@
#include "shell/common/gin_converters/file_path_converter.h"
#include "shell/common/gin_helper/dictionary.h"
#include "shell/common/node_includes.h"
-#include "shell/common/node_util.h"
namespace {
@@ -191,19 +190,6 @@ class Archive : public node::ObjectWrap {
std::shared_ptr<asar::Archive> archive_;
};
-static void InitAsarSupport(const v8::FunctionCallbackInfo<v8::Value>& args) {
- auto* isolate = args.GetIsolate();
- auto require = args[0];
-
- // Evaluate asar_bundle.js.
- std::vector<v8::Local<v8::String>> asar_bundle_params = {
- node::FIXED_ONE_BYTE_STRING(isolate, "require")};
- std::vector<v8::Local<v8::Value>> asar_bundle_args = {require};
- electron::util::CompileAndCall(isolate->GetCurrentContext(),
- "electron/js2c/asar_bundle",
- &asar_bundle_params, &asar_bundle_args);
-}
-
static void SplitPath(const v8::FunctionCallbackInfo<v8::Value>& args) {
auto* isolate = args.GetIsolate();
@@ -239,7 +225,6 @@ void Initialize(v8::Local<v8::Object> exports,
exports->Set(context, node::FIXED_ONE_BYTE_STRING(isolate, "Archive"), cons)
.Check();
NODE_SET_METHOD(exports, "splitPath", &SplitPath);
- NODE_SET_METHOD(exports, "initAsarSupport", &InitAsarSupport);
}
} // namespace
diff --git a/shell/common/api/electron_bindings.cc b/shell/common/api/electron_bindings.cc
index b89a583f7b..596a593b2a 100644
--- a/shell/common/api/electron_bindings.cc
+++ b/shell/common/api/electron_bindings.cc
@@ -15,8 +15,6 @@
#include "base/process/process_handle.h"
#include "base/process/process_metrics_iocounters.h"
#include "base/system/sys_info.h"
-#include "chrome/common/chrome_version.h"
-#include "electron/electron_version.h"
#include "services/resource_coordinator/public/cpp/memory_instrumentation/global_memory_dump.h"
#include "services/resource_coordinator/public/cpp/memory_instrumentation/memory_instrumentation.h"
#include "shell/browser/browser.h"
@@ -84,12 +82,6 @@ void ElectronBindings::BindTo(v8::Isolate* isolate,
dict.SetMethod("activateUvLoop",
base::BindRepeating(&ElectronBindings::ActivateUVLoop,
base::Unretained(this)));
-
- gin_helper::Dictionary versions;
- if (dict.Get("versions", &versions)) {
- versions.SetReadOnly(ELECTRON_PROJECT_NAME, ELECTRON_VERSION_STRING);
- versions.SetReadOnly("chrome", CHROME_VERSION_STRING);
- }
}
void ElectronBindings::EnvironmentDestroyed(node::Environment* env) {
diff --git a/shell/common/node_bindings.cc b/shell/common/node_bindings.cc
index 9fc4166bd0..22d08a9629 100644
--- a/shell/common/node_bindings.cc
+++ b/shell/common/node_bindings.cc
@@ -20,9 +20,11 @@
#include "base/strings/utf_string_conversions.h"
#include "base/task/single_thread_task_runner.h"
#include "base/trace_event/trace_event.h"
+#include "chrome/common/chrome_version.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/common/content_paths.h"
#include "electron/buildflags/buildflags.h"
+#include "electron/electron_version.h"
#include "electron/fuses.h"
#include "shell/browser/api/electron_api_app.h"
#include "shell/common/api/electron_bindings.h"
@@ -34,6 +36,7 @@
#include "shell/common/gin_helper/event_emitter_caller.h"
#include "shell/common/gin_helper/microtasks_scope.h"
#include "shell/common/mac/main_application_bundle.h"
+#include "shell/common/node_util.h"
#include "shell/common/world_ids.h"
#include "third_party/blink/public/web/web_local_frame.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_initializer.h" // nogncheck
@@ -610,7 +613,6 @@ std::shared_ptr<node::Environment> NodeBindings::CreateEnvironment(
electron::fuses::IsOnlyLoadAppFromAsarEnabled()));
}
- base::FilePath resources_path = GetResourcesPath();
std::string init_script = "electron/js2c/" + process_type + "_init";
args.insert(args.begin() + 1, init_script);
@@ -649,7 +651,8 @@ std::shared_ptr<node::Environment> NodeBindings::CreateEnvironment(
v8::TryCatch try_catch(isolate);
env = node::CreateEnvironment(
static_cast<node::IsolateData*>(isolate_data), context, args, exec_args,
- static_cast<node::EnvironmentFlags::Flags>(env_flags));
+ static_cast<node::EnvironmentFlags::Flags>(env_flags), {}, {},
+ &OnNodePreload);
if (try_catch.HasCaught()) {
std::string err_msg =
@@ -735,11 +738,6 @@ std::shared_ptr<node::Environment> NodeBindings::CreateEnvironment(
gin_helper::Dictionary process(context->GetIsolate(), env->process_object());
process.SetReadOnly("type", process_type);
- process.Set("resourcesPath", resources_path);
- // The path to helper app.
- base::FilePath helper_exec_path;
- base::PathService::Get(content::CHILD_PROCESS_EXE, &helper_exec_path);
- process.Set("helperExecPath", helper_exec_path);
if (browser_env_ == BrowserEnvironment::kBrowser ||
browser_env_ == BrowserEnvironment::kRenderer) {
@@ -931,4 +929,29 @@ void NodeBindings::EmbedThreadRunner(void* arg) {
}
}
+void OnNodePreload(node::Environment* env,
+ v8::Local<v8::Value> process,
+ v8::Local<v8::Value> require) {
+ // Set custom process properties.
+ gin_helper::Dictionary dict(env->isolate(), process.As<v8::Object>());
+ dict.SetReadOnly("resourcesPath", GetResourcesPath());
+ base::FilePath helper_exec_path; // path to the helper app.
+ base::PathService::Get(content::CHILD_PROCESS_EXE, &helper_exec_path);
+ dict.SetReadOnly("helperExecPath", helper_exec_path);
+ gin_helper::Dictionary versions;
+ if (dict.Get("versions", &versions)) {
+ versions.SetReadOnly(ELECTRON_PROJECT_NAME, ELECTRON_VERSION_STRING);
+ versions.SetReadOnly("chrome", CHROME_VERSION_STRING);
+ }
+
+ // Execute lib/node/init.ts.
+ std::vector<v8::Local<v8::String>> bundle_params = {
+ node::FIXED_ONE_BYTE_STRING(env->isolate(), "process"),
+ node::FIXED_ONE_BYTE_STRING(env->isolate(), "require"),
+ };
+ std::vector<v8::Local<v8::Value>> bundle_args = {process, require};
+ electron::util::CompileAndCall(env->context(), "electron/js2c/node_init",
+ &bundle_params, &bundle_args);
+}
+
} // namespace electron
diff --git a/shell/common/node_bindings.h b/shell/common/node_bindings.h
index 596eee17d3..fce3f39ead 100644
--- a/shell/common/node_bindings.h
+++ b/shell/common/node_bindings.h
@@ -219,6 +219,12 @@ class NodeBindings {
base::WeakPtrFactory<NodeBindings> weak_factory_{this};
};
+// A thread-safe function responsible for loading preload script which runs for
+// all node environments (including child processes and workers).
+void OnNodePreload(node::Environment* env,
+ v8::Local<v8::Value> process,
+ v8::Local<v8::Value> require);
+
} // namespace electron
#endif // ELECTRON_SHELL_COMMON_NODE_BINDINGS_H_
diff --git a/shell/common/node_util.cc b/shell/common/node_util.cc
index 2dcaea14cd..344f07f37c 100644
--- a/shell/common/node_util.cc
+++ b/shell/common/node_util.cc
@@ -5,6 +5,7 @@
#include "shell/common/node_util.h"
#include "base/logging.h"
+#include "gin/converter.h"
#include "shell/common/node_includes.h"
namespace electron::util {
@@ -31,7 +32,14 @@ v8::MaybeLocal<v8::Value> CompileAndCall(
// This will only be caught when something has gone terrible wrong as all
// electron scripts are wrapped in a try {} catch {} by webpack
if (try_catch.HasCaught()) {
- LOG(ERROR) << "Failed to CompileAndCall electron script: " << id;
+ std::string msg = "no error message";
+ if (!try_catch.Message().IsEmpty()) {
+ gin::ConvertFromV8(isolate, try_catch.Message()->Get(), &msg);
+ } else if (try_catch.HasTerminated()) {
+ msg = "script execution has been terminated";
+ }
+ LOG(ERROR) << "Failed to CompileAndCall electron script (" << id
+ << "): " << msg;
}
return ret;
}
diff --git a/typings/internal-ambient.d.ts b/typings/internal-ambient.d.ts
index 04a6ad6b7d..66ba2999b4 100644
--- a/typings/internal-ambient.d.ts
+++ b/typings/internal-ambient.d.ts
@@ -90,7 +90,6 @@ declare namespace NodeJS {
asarPath: string;
filePath: string;
};
- initAsarSupport(require: NodeJS.Require): void;
}
interface NetBinding {
|
chore
|
9d558cec5ef74c45a18daf3ea494cb3ecc1ab3eb
|
Sam Maddock
|
2025-02-19 18:05:02
|
fix: action.openPopup function missing (#45697)
|
diff --git a/shell/browser/extensions/api/extension_action/extension_action_api.cc b/shell/browser/extensions/api/extension_action/extension_action_api.cc
index 7b28cb7b5a..0d32060921 100644
--- a/shell/browser/extensions/api/extension_action/extension_action_api.cc
+++ b/shell/browser/extensions/api/extension_action/extension_action_api.cc
@@ -100,6 +100,13 @@ ExtensionActionSetIconFunction::RunExtensionAction() {
return RespondNow(NoArguments());
}
+ExtensionFunction::ResponseAction
+ExtensionActionOpenPopupFunction::RunExtensionAction() {
+ LOG(INFO) << "chrome.action.openPopup is not supported in Electron";
+
+ return RespondNow(WithArguments(""));
+}
+
ExtensionFunction::ResponseAction
ExtensionActionSetTitleFunction::RunExtensionAction() {
LOG(INFO) << "chrome.action.setTitle is not supported in Electron";
|
fix
|
208dc568d8541d3cdd0fbebc17c348447ba0ae0d
|
Shelley Vohr
|
2024-12-04 22:35:28
|
fix: `context-menu` event with `BaseWindows` (#44940)
fix: context-menu event with BaseWindows
|
diff --git a/docs/api/menu.md b/docs/api/menu.md
index 9be1eedb39..b9a8a7b09e 100644
--- a/docs/api/menu.md
+++ b/docs/api/menu.md
@@ -72,7 +72,7 @@ The `menu` object has the following instance methods:
#### `menu.popup([options])`
* `options` Object (optional)
- * `window` [BrowserWindow](browser-window.md) (optional) - Default is the focused window.
+ * `window` [BaseWindow](base-window.md) (optional) - Default is the focused window.
* `x` number (optional) - Default is the current mouse cursor position.
Must be declared if `y` is declared.
* `y` number (optional) - Default is the current mouse cursor position.
@@ -86,13 +86,13 @@ The `menu` object has the following instance methods:
Can be `none`, `mouse`, `keyboard`, `touch`, `touchMenu`, `longPress`, `longTap`, `touchHandle`, `stylus`, `adjustSelection`, or `adjustSelectionReset`.
* `callback` Function (optional) - Called when menu is closed.
-Pops up this menu as a context menu in the [`BrowserWindow`](browser-window.md).
+Pops up this menu as a context menu in the [`BaseWindow`](base-window.md).
-#### `menu.closePopup([browserWindow])`
+#### `menu.closePopup([window])`
-* `browserWindow` [BrowserWindow](browser-window.md) (optional) - Default is the focused window.
+* `window` [BaseWindow](base-window.md) (optional) - Default is the focused window.
-Closes the context menu in the `browserWindow`.
+Closes the context menu in the `window`.
#### `menu.append(menuItem)`
diff --git a/shell/browser/ui/cocoa/delayed_native_view_host.h b/shell/browser/ui/cocoa/delayed_native_view_host.h
index 5d63fb5cf9..e7020dba60 100644
--- a/shell/browser/ui/cocoa/delayed_native_view_host.h
+++ b/shell/browser/ui/cocoa/delayed_native_view_host.h
@@ -24,8 +24,6 @@ class DelayedNativeViewHost : public views::NativeViewHost {
void ViewHierarchyChanged(
const views::ViewHierarchyChangedDetails& details) override;
- gfx::NativeView GetNativeView() { return native_view_; }
-
private:
gfx::NativeView native_view_;
};
diff --git a/shell/browser/ui/cocoa/electron_ns_window.mm b/shell/browser/ui/cocoa/electron_ns_window.mm
index ded8d8bcf9..8da35c0bb7 100644
--- a/shell/browser/ui/cocoa/electron_ns_window.mm
+++ b/shell/browser/ui/cocoa/electron_ns_window.mm
@@ -202,26 +202,29 @@ void SwizzleSwipeWithEvent(NSView* view, SEL swiz_selector) {
if (event.type == NSEventTypeRightMouseDown ||
(event.type == NSEventTypeLeftMouseDown &&
([event modifierFlags] & NSEventModifierFlagControl))) {
- // The WebContentsView is added a sibling of BaseWindow's contentView at
- // index 0 before it in the paint order - see
- // https://github.com/electron/electron/pull/41256.
+ // We're looking for the NativeViewHost that contains the WebContentsView.
+ // There can be two possible NativeViewHosts - one containing the
+ // WebContentsView (present for BrowserWindows) and the one containing the
+ // VibrantView (present when vibrancy is set). We want the one containing
+ // the WebContentsView if it exists.
const auto& children = shell_->GetContentsView()->children();
- if (children.empty())
- return;
-
- auto* wcv = children.front().get();
- if (!wcv)
- return;
-
- auto ns_view = static_cast<electron::DelayedNativeViewHost*>(wcv)
- ->GetNativeView()
- .GetNativeNSView();
- if (!ns_view)
- return;
-
- [static_cast<ElectronInspectableWebContentsView*>(ns_view)
- redispatchContextMenuEvent:base::apple::OwnedNSEvent(event)];
- return;
+ const auto it = std::ranges::find_if(children, [&](views::View* child) {
+ if (std::strcmp(child->GetClassName(), "NativeViewHost") == 0) {
+ auto* nvh = static_cast<views::NativeViewHost*>(child);
+ return nvh->native_view().GetNativeNSView() != [self vibrantView];
+ }
+ return false;
+ });
+
+ if (it != children.end()) {
+ auto ns_view = static_cast<electron::DelayedNativeViewHost*>(*it)
+ ->native_view()
+ .GetNativeNSView();
+ if (ns_view) {
+ [static_cast<ElectronInspectableWebContentsView*>(ns_view)
+ redispatchContextMenuEvent:base::apple::OwnedNSEvent(event)];
+ }
+ }
}
[super sendEvent:event];
diff --git a/spec/api-web-contents-spec.ts b/spec/api-web-contents-spec.ts
index 3a2eb81aac..8fc502c2ca 100644
--- a/spec/api-web-contents-spec.ts
+++ b/spec/api-web-contents-spec.ts
@@ -1,4 +1,4 @@
-import { BrowserWindow, ipcMain, webContents, session, app, BrowserView, WebContents } from 'electron/main';
+import { BrowserWindow, ipcMain, webContents, session, app, BrowserView, WebContents, BaseWindow, WebContentsView } from 'electron/main';
import { expect } from 'chai';
@@ -2749,6 +2749,57 @@ describe('webContents module', () => {
expect(params.x).to.be.a('number');
expect(params.y).to.be.a('number');
});
+
+ it('emits when right clicked in a WebContentsView', async () => {
+ const w = new BaseWindow({ show: false });
+
+ const mainView = new WebContentsView({
+ webPreferences: {
+ preload: path.join(__dirname, 'preload.js')
+ }
+ });
+
+ const draggablePage = path.join(fixturesPath, 'pages', 'draggable-page.html');
+ await mainView.webContents.loadFile(draggablePage);
+
+ w.contentView.addChildView(mainView);
+
+ const { width, height } = w.getContentBounds();
+ mainView.setBounds({ x: 0, y: 0, width, height });
+
+ const promise = once(mainView.webContents, 'context-menu') as Promise<[any, Electron.ContextMenuParams]>;
+
+ // Simulate right-click to create context-menu event.
+ const opts = { x: 0, y: 0, button: 'right' as const };
+ mainView.webContents.sendInputEvent({ ...opts, type: 'mouseDown' });
+ mainView.webContents.sendInputEvent({ ...opts, type: 'mouseUp' });
+
+ const [, params] = await promise;
+
+ expect(params.pageURL).to.equal(mainView.webContents.getURL());
+ expect(params.frame).to.be.an('object');
+ expect(params.x).to.be.a('number');
+ expect(params.y).to.be.a('number');
+ });
+
+ it('emits when right clicked in a BrowserWindow with vibrancy', async () => {
+ const w = new BrowserWindow({ show: false, vibrancy: 'titlebar' });
+ await w.loadFile(path.join(fixturesPath, 'pages', 'draggable-page.html'));
+
+ const promise = once(w.webContents, 'context-menu') as Promise<[any, Electron.ContextMenuParams]>;
+
+ // Simulate right-click to create context-menu event.
+ const opts = { x: 0, y: 0, button: 'right' as const };
+ w.webContents.sendInputEvent({ ...opts, type: 'mouseDown' });
+ w.webContents.sendInputEvent({ ...opts, type: 'mouseUp' });
+
+ const [, params] = await promise;
+
+ expect(params.pageURL).to.equal(w.webContents.getURL());
+ expect(params.frame).to.be.an('object');
+ expect(params.x).to.be.a('number');
+ expect(params.y).to.be.a('number');
+ });
});
describe('close() method', () => {
|
fix
|
d8e4579e3c12d37e2a2fb903f4f4445bba6c8fcb
|
rcombs
|
2024-06-11 07:38:03
|
feat: add cumulativeCPUUsage to AppMetrics and CPUUsage (#41819)
This allows apps to measure their CPU usage over any given period
without worrying about other calls affecting the output,
as they would with `percentCPUUsage`.
|
diff --git a/docs/api/structures/cpu-usage.md b/docs/api/structures/cpu-usage.md
index 00c267533a..645da762ba 100644
--- a/docs/api/structures/cpu-usage.md
+++ b/docs/api/structures/cpu-usage.md
@@ -2,6 +2,8 @@
* `percentCPUUsage` number - Percentage of CPU used since the last call to getCPUUsage.
First call returns 0.
+* `cumulativeCPUUsage` number (optional) - Total seconds of CPU time used since process
+ startup.
* `idleWakeupsPerSecond` number - The number of average idle CPU wakeups per second
since the last call to getCPUUsage. First call returns 0. Will always return 0 on
Windows.
diff --git a/shell/browser/api/electron_api_app.cc b/shell/browser/api/electron_api_app.cc
index 1b51aae4c4..b9ab944b8d 100644
--- a/shell/browser/api/electron_api_app.cc
+++ b/shell/browser/api/electron_api_app.cc
@@ -1270,10 +1270,17 @@ std::vector<gin_helper::Dictionary> App::GetAppMetrics(v8::Isolate* isolate) {
auto pid_dict = gin_helper::Dictionary::CreateEmpty(isolate);
auto cpu_dict = gin_helper::Dictionary::CreateEmpty(isolate);
- double usage =
- process_metric.second->metrics->GetPlatformIndependentCPUUsage()
- .value_or(0);
- cpu_dict.Set("percentCPUUsage", usage / processor_count);
+ // Default usage percentage to 0 for compatibility
+ double usagePercent = 0;
+ if (auto usage = process_metric.second->metrics->GetCumulativeCPUUsage();
+ usage.has_value()) {
+ cpu_dict.Set("cumulativeCPUUsage", usage->InSecondsF());
+ usagePercent =
+ process_metric.second->metrics->GetPlatformIndependentCPUUsage(
+ *usage);
+ }
+
+ cpu_dict.Set("percentCPUUsage", usagePercent / processor_count);
#if !BUILDFLAG(IS_WIN)
cpu_dict.Set("idleWakeupsPerSecond",
diff --git a/shell/common/api/electron_bindings.cc b/shell/common/api/electron_bindings.cc
index 1a13f3979c..929f467b3b 100644
--- a/shell/common/api/electron_bindings.cc
+++ b/shell/common/api/electron_bindings.cc
@@ -274,8 +274,15 @@ v8::Local<v8::Value> ElectronBindings::GetCPUUsage(
v8::Isolate* isolate) {
auto dict = gin_helper::Dictionary::CreateEmpty(isolate);
int processor_count = base::SysInfo::NumberOfProcessors();
- double usage = metrics->GetPlatformIndependentCPUUsage().value_or(0);
- dict.Set("percentCPUUsage", usage / processor_count);
+
+ // Default usage percentage to 0 for compatibility
+ double usagePercent = 0;
+ if (auto usage = metrics->GetCumulativeCPUUsage(); usage.has_value()) {
+ dict.Set("cumulativeCPUUsage", usage->InSecondsF());
+ usagePercent = metrics->GetPlatformIndependentCPUUsage(*usage);
+ }
+
+ dict.Set("percentCPUUsage", usagePercent / processor_count);
// NB: This will throw NOTIMPLEMENTED() on Windows
// For backwards compatibility, we'll return 0
diff --git a/spec/api-app-spec.ts b/spec/api-app-spec.ts
index 4b3f9d185c..491f1cc859 100644
--- a/spec/api-app-spec.ts
+++ b/spec/api-app-spec.ts
@@ -1442,6 +1442,7 @@ describe('app module', () => {
types.push(entry.type);
expect(entry.cpu).to.have.ownProperty('percentCPUUsage').that.is.a('number');
+ expect(entry.cpu).to.have.ownProperty('cumulativeCPUUsage').that.is.a('number');
expect(entry.cpu).to.have.ownProperty('idleWakeupsPerSecond').that.is.a('number');
expect(entry.memory).to.have.property('workingSetSize').that.is.greaterThan(0);
diff --git a/spec/api-process-spec.ts b/spec/api-process-spec.ts
index 909f6f5244..3a9a068cee 100644
--- a/spec/api-process-spec.ts
+++ b/spec/api-process-spec.ts
@@ -26,6 +26,7 @@ describe('process module', () => {
it('returns a cpu usage object', async () => {
const cpuUsage = await w.webContents.executeJavaScript('process.getCPUUsage()');
expect(cpuUsage.percentCPUUsage).to.be.a('number');
+ expect(cpuUsage.cumulativeCPUUsage).to.be.a('number');
expect(cpuUsage.idleWakeupsPerSecond).to.be.a('number');
});
});
@@ -124,6 +125,7 @@ describe('process module', () => {
it('returns a cpu usage object', () => {
const cpuUsage = process.getCPUUsage();
expect(cpuUsage.percentCPUUsage).to.be.a('number');
+ expect(cpuUsage.cumulativeCPUUsage).to.be.a('number');
expect(cpuUsage.idleWakeupsPerSecond).to.be.a('number');
});
});
|
feat
|
078369280917281564193c1dd6383be3a380eac5
|
xrkffgg
|
2022-09-21 16:58:15
|
ci: add blocked/needs-repro issues-helper (#35605)
|
diff --git a/.github/workflows/issue-labeled.yml b/.github/workflows/issue-labeled.yml
new file mode 100644
index 0000000000..085fec0936
--- /dev/null
+++ b/.github/workflows/issue-labeled.yml
@@ -0,0 +1,24 @@
+name: Issue Labeled
+
+on:
+ issues:
+ types: [labeled]
+
+jobs:
+ issue-labeled:
+ runs-on: ubuntu-latest
+ steps:
+ - name: blocked/need-repro
+ if: github.event.label.name == 'blocked/need-repro'
+ uses: actions-cool/issues-helper@dad28fdb88da5f082c04659b7373d85790f9b135 # v3.3.0
+ with:
+ actions: 'create-comment'
+ body: |
+ Hello @${{ github.event.issue.user.login }}. Thanks for reporting this and helping to make Electron better!
+
+ Would it be possible for you to make a standalone testcase with only the code necessary to reproduce the issue? For example, [Electron Fiddle](https://www.electronjs.org/fiddle) is a great tool for making small test cases and makes it easy to publish your test case to a [gist](https://gist.github.com) that Electron maintainers can use.
+
+ Stand-alone test cases make fixing issues go more smoothly: it ensure everyone's looking at the same issue, it removes all unnecessary variables from the equation, and it can also provide the basis for automated regression tests.
+
+ Now adding the `blocked/need-repro` label for this reason. After you make a test case, please link to it in a followup comment. This issue will be closed in 10 days if the above is not addressed.
+
|
ci
|
c70f86fe038e0045aeddb8efe42c3846b9e3ce1d
|
electron-appveyor-updater[bot]
|
2024-08-05 16:41:40
|
build: update appveyor image to latest version (#43204)
Co-authored-by: electron-appveyor-updater[bot] <161660339+electron-appveyor-updater[bot]@users.noreply.github.com>
|
diff --git a/appveyor-woa.yml b/appveyor-woa.yml
index 696eeba9ca..e64edf57eb 100644
--- a/appveyor-woa.yml
+++ b/appveyor-woa.yml
@@ -29,7 +29,7 @@
version: 1.0.{build}
build_cloud: electronhq-16-core
-image: e-129.0.6616.0
+image: e-129.0.6636.0
environment:
GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache
ELECTRON_OUT_DIR: Default
diff --git a/appveyor.yml b/appveyor.yml
index 9a5d27b37a..c63b2c66e7 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -29,7 +29,7 @@
version: 1.0.{build}
build_cloud: electronhq-16-core
-image: e-129.0.6616.0
+image: e-129.0.6636.0
environment:
GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache
ELECTRON_OUT_DIR: Default
|
build
|
778d3098a0f0bfc00015d54263674318f4adf6b1
|
Sam Maddock
|
2024-07-16 20:16:25
|
feat: customize border radius of Views (#42320)
* feat: add View#setBorderRadius
test: initial setBorderRadius tests
fix: robustly set border radius
chore: add PAUSE_CAPTURE_TESTS for easier screencap dev
feat: add view border radius support
test: view border radius
refactor: cleanup view code
* maybe delay capture to fix tests?
* refactor: retry screen captures in an attempt to fix flakiness
* refactor: ScreenCapture constructor no longer async
* increase screen capture timeout, feels a little short
* refactor: move rounded rect util into chromium_src
* skip some capture tests on mas
|
diff --git a/chromium_src/BUILD.gn b/chromium_src/BUILD.gn
index 026260adbb..ca7edf23c0 100644
--- a/chromium_src/BUILD.gn
+++ b/chromium_src/BUILD.gn
@@ -14,6 +14,8 @@ import("//third_party/widevine/cdm/widevine.gni")
static_library("chrome") {
visibility = [ "//electron:electron_lib" ]
sources = [
+ "//ash/style/rounded_rect_cutout_path_builder.cc",
+ "//ash/style/rounded_rect_cutout_path_builder.h",
"//chrome/browser/app_mode/app_mode_utils.cc",
"//chrome/browser/app_mode/app_mode_utils.h",
"//chrome/browser/browser_features.cc",
diff --git a/docs/api/view.md b/docs/api/view.md
index 2f2ec00b2e..62c710626f 100644
--- a/docs/api/view.md
+++ b/docs/api/view.md
@@ -94,6 +94,12 @@ Examples of valid `color` values:
**Note:** Hex format with alpha takes `AARRGGBB` or `ARGB`, _not_ `RRGGBBAA` or `RGB`.
+#### `view.setBorderRadius(radius)`
+
+* `radius` Integer - Border radius size in pixels.
+
+**Note:** The area cutout of the view's border still captures clicks.
+
#### `view.setVisible(visible)`
* `visible` boolean - If false, the view will be hidden from display.
diff --git a/shell/browser/api/electron_api_view.cc b/shell/browser/api/electron_api_view.cc
index 4650dc0e2b..35cc47b703 100644
--- a/shell/browser/api/electron_api_view.cc
+++ b/shell/browser/api/electron_api_view.cc
@@ -10,6 +10,7 @@
#include <string>
#include <utility>
+#include "ash/style/rounded_rect_cutout_path_builder.h"
#include "gin/data_object_builder.h"
#include "gin/wrappable.h"
#include "shell/browser/javascript_environment.h"
@@ -338,6 +339,38 @@ void View::SetBackgroundColor(std::optional<WrappedSkColor> color) {
view_->SetBackground(color ? views::CreateSolidBackground(*color) : nullptr);
}
+void View::SetBorderRadius(int radius) {
+ border_radius_ = radius;
+ ApplyBorderRadius();
+}
+
+void View::ApplyBorderRadius() {
+ if (!border_radius_.has_value() || !view_)
+ return;
+
+ auto size = view_->bounds().size();
+
+ // Restrict border radius to the constraints set in the path builder class.
+ // If the constraints are exceeded, the builder will crash.
+ int radius;
+ {
+ float r = border_radius_.value() * 1.f;
+ r = std::min(r, size.width() / 2.f);
+ r = std::min(r, size.height() / 2.f);
+ r = std::max(r, 0.f);
+ radius = std::floor(r);
+ }
+
+ // RoundedRectCutoutPathBuilder has a minimum size of 32 x 32.
+ if (radius > 0 && size.width() >= 32 && size.height() >= 32) {
+ auto builder = ash::RoundedRectCutoutPathBuilder(gfx::SizeF(size));
+ builder.CornerRadius(radius);
+ view_->SetClipPath(builder.Build());
+ } else {
+ view_->SetClipPath(SkPath());
+ }
+}
+
void View::SetVisible(bool visible) {
if (!view_)
return;
@@ -345,6 +378,7 @@ void View::SetVisible(bool visible) {
}
void View::OnViewBoundsChanged(views::View* observed_view) {
+ ApplyBorderRadius();
Emit("bounds-changed");
}
@@ -393,6 +427,7 @@ void View::BuildPrototype(v8::Isolate* isolate,
.SetMethod("setBounds", &View::SetBounds)
.SetMethod("getBounds", &View::GetBounds)
.SetMethod("setBackgroundColor", &View::SetBackgroundColor)
+ .SetMethod("setBorderRadius", &View::SetBorderRadius)
.SetMethod("setLayout", &View::SetLayout)
.SetMethod("setVisible", &View::SetVisible);
}
diff --git a/shell/browser/api/electron_api_view.h b/shell/browser/api/electron_api_view.h
index 0475d5e6d1..b3fd2e9cd8 100644
--- a/shell/browser/api/electron_api_view.h
+++ b/shell/browser/api/electron_api_view.h
@@ -37,6 +37,7 @@ class View : public gin_helper::EventEmitter<View>,
void SetLayout(v8::Isolate* isolate, v8::Local<v8::Object> value);
std::vector<v8::Local<v8::Value>> GetChildren();
void SetBackgroundColor(std::optional<WrappedSkColor> color);
+ void SetBorderRadius(int radius);
void SetVisible(bool visible);
// views::ViewObserver
@@ -44,6 +45,7 @@ class View : public gin_helper::EventEmitter<View>,
void OnViewIsDeleting(views::View* observed_view) override;
views::View* view() const { return view_; }
+ std::optional<int> border_radius() const { return border_radius_; }
// disable copy
View(const View&) = delete;
@@ -58,9 +60,11 @@ class View : public gin_helper::EventEmitter<View>,
void set_delete_view(bool should) { delete_view_ = should; }
private:
+ void ApplyBorderRadius();
void ReorderChildView(gin::Handle<View> child, size_t index);
std::vector<v8::Global<v8::Object>> child_views_;
+ std::optional<int> border_radius_;
bool delete_view_ = true;
raw_ptr<views::View> view_ = nullptr;
diff --git a/shell/browser/api/electron_api_web_contents_view.cc b/shell/browser/api/electron_api_web_contents_view.cc
index 0d1bdd5cb3..092b60a7e9 100644
--- a/shell/browser/api/electron_api_web_contents_view.cc
+++ b/shell/browser/api/electron_api_web_contents_view.cc
@@ -20,6 +20,8 @@
#include "shell/common/options_switches.h"
#include "third_party/skia/include/core/SkRegion.h"
#include "ui/base/hit_test.h"
+#include "ui/gfx/geometry/rounded_corners_f.h"
+#include "ui/views/controls/webview/webview.h"
#include "ui/views/layout/flex_layout_types.h"
#include "ui/views/view_class_properties.h"
#include "ui/views/widget/widget.h"
@@ -65,6 +67,25 @@ void WebContentsView::SetBackgroundColor(std::optional<WrappedSkColor> color) {
}
}
+void WebContentsView::SetBorderRadius(int radius) {
+ View::SetBorderRadius(radius);
+ ApplyBorderRadius();
+}
+
+void WebContentsView::ApplyBorderRadius() {
+ if (border_radius().has_value() && api_web_contents_ && view()->GetWidget()) {
+ auto* web_view = api_web_contents_->inspectable_web_contents()
+ ->GetView()
+ ->contents_web_view();
+
+ // WebView won't exist for offscreen rendering.
+ if (web_view) {
+ web_view->holder()->SetCornerRadii(
+ gfx::RoundedCornersF(border_radius().value()));
+ }
+ }
+}
+
int WebContentsView::NonClientHitTest(const gfx::Point& point) {
if (api_web_contents_) {
gfx::Point local_point(point);
@@ -93,6 +114,7 @@ void WebContentsView::OnViewAddedToWidget(views::View* observed_view) {
// because that's handled in the WebContents dtor called prior.
api_web_contents_->SetOwnerWindow(native_window);
native_window->AddDraggableRegionProvider(this);
+ ApplyBorderRadius();
}
void WebContentsView::OnViewRemovedFromWidget(views::View* observed_view) {
@@ -198,6 +220,7 @@ void WebContentsView::BuildPrototype(
prototype->SetClassName(gin::StringToV8(isolate, "WebContentsView"));
gin_helper::ObjectTemplateBuilder(isolate, prototype->PrototypeTemplate())
.SetMethod("setBackgroundColor", &WebContentsView::SetBackgroundColor)
+ .SetMethod("setBorderRadius", &WebContentsView::SetBorderRadius)
.SetProperty("webContents", &WebContentsView::GetWebContents);
}
diff --git a/shell/browser/api/electron_api_web_contents_view.h b/shell/browser/api/electron_api_web_contents_view.h
index b02c3a460d..f4248193e5 100644
--- a/shell/browser/api/electron_api_web_contents_view.h
+++ b/shell/browser/api/electron_api_web_contents_view.h
@@ -39,6 +39,7 @@ class WebContentsView : public View,
// Public APIs.
gin::Handle<WebContents> GetWebContents(v8::Isolate* isolate);
void SetBackgroundColor(std::optional<WrappedSkColor> color);
+ void SetBorderRadius(int radius);
int NonClientHitTest(const gfx::Point& point) override;
@@ -57,6 +58,8 @@ class WebContentsView : public View,
private:
static gin_helper::WrappableBase* New(gin_helper::Arguments* args);
+ void ApplyBorderRadius();
+
// Keep a reference to v8 wrapper.
v8::Global<v8::Value> web_contents_;
raw_ptr<api::WebContents> api_web_contents_;
diff --git a/shell/browser/ui/inspectable_web_contents_view.cc b/shell/browser/ui/inspectable_web_contents_view.cc
index 8f2844850a..e3e03bc97b 100644
--- a/shell/browser/ui/inspectable_web_contents_view.cc
+++ b/shell/browser/ui/inspectable_web_contents_view.cc
@@ -84,14 +84,14 @@ InspectableWebContentsView::InspectableWebContentsView(
auto* contents_web_view = new views::WebView(nullptr);
contents_web_view->SetWebContents(
inspectable_web_contents_->GetWebContents());
- contents_web_view_ = contents_web_view;
+ contents_view_ = contents_web_view_ = contents_web_view;
} else {
- contents_web_view_ = new views::Label(u"No content under offscreen mode");
+ contents_view_ = new views::Label(u"No content under offscreen mode");
}
devtools_web_view_->SetVisible(false);
AddChildView(devtools_web_view_.get());
- AddChildView(contents_web_view_.get());
+ AddChildView(contents_view_.get());
}
InspectableWebContentsView::~InspectableWebContentsView() {
@@ -209,7 +209,7 @@ const std::u16string InspectableWebContentsView::GetTitle() {
void InspectableWebContentsView::Layout(PassKey) {
if (!devtools_web_view_->GetVisible()) {
- contents_web_view_->SetBoundsRect(GetContentsBounds());
+ contents_view_->SetBoundsRect(GetContentsBounds());
// Propagate layout call to all children, for example browser views.
LayoutSuperclass<View>(this);
return;
@@ -227,7 +227,7 @@ void InspectableWebContentsView::Layout(PassKey) {
new_contents_bounds.set_x(GetMirroredXForRect(new_contents_bounds));
devtools_web_view_->SetBoundsRect(new_devtools_bounds);
- contents_web_view_->SetBoundsRect(new_contents_bounds);
+ contents_view_->SetBoundsRect(new_contents_bounds);
// Propagate layout call to all children, for example browser views.
LayoutSuperclass<View>(this);
diff --git a/shell/browser/ui/inspectable_web_contents_view.h b/shell/browser/ui/inspectable_web_contents_view.h
index 49eafbbd0f..bd279b4ae0 100644
--- a/shell/browser/ui/inspectable_web_contents_view.h
+++ b/shell/browser/ui/inspectable_web_contents_view.h
@@ -36,6 +36,8 @@ class InspectableWebContentsView : public views::View {
return inspectable_web_contents_;
}
+ views::WebView* contents_web_view() const { return contents_web_view_; }
+
// The delegate manages its own life.
void SetDelegate(InspectableWebContentsViewDelegate* delegate) {
delegate_ = delegate;
@@ -67,8 +69,9 @@ class InspectableWebContentsView : public views::View {
std::unique_ptr<views::Widget> devtools_window_;
raw_ptr<views::WebView> devtools_window_web_view_ = nullptr;
- raw_ptr<views::View> contents_web_view_ = nullptr;
raw_ptr<views::WebView> devtools_web_view_ = nullptr;
+ raw_ptr<views::WebView> contents_web_view_ = nullptr;
+ raw_ptr<views::View> contents_view_ = nullptr;
DevToolsContentsResizingStrategy strategy_;
bool devtools_visible_ = false;
diff --git a/spec/api-browser-view-spec.ts b/spec/api-browser-view-spec.ts
index 62927d1c88..dc193b083e 100644
--- a/spec/api-browser-view-spec.ts
+++ b/spec/api-browser-view-spec.ts
@@ -3,7 +3,7 @@ import * as path from 'node:path';
import { BrowserView, BrowserWindow, screen, webContents } from 'electron/main';
import { closeWindow } from './lib/window-helpers';
import { defer, ifit, startRemoteControlApp } from './lib/spec-helpers';
-import { ScreenCapture } from './lib/screen-helpers';
+import { ScreenCapture, hasCapturableScreen } from './lib/screen-helpers';
import { once } from 'node:events';
describe('BrowserView module', () => {
@@ -75,8 +75,7 @@ describe('BrowserView module', () => {
}).not.to.throw();
});
- // Linux and arm64 platforms (WOA and macOS) do not return any capture sources
- ifit(process.platform === 'darwin' && process.arch === 'x64')('sets the background color to transparent if none is set', async () => {
+ ifit(hasCapturableScreen())('sets the background color to transparent if none is set', async () => {
const display = screen.getPrimaryDisplay();
const WINDOW_BACKGROUND_COLOR = '#55ccbb';
@@ -90,12 +89,11 @@ describe('BrowserView module', () => {
w.setBrowserView(view);
await view.webContents.loadURL('data:text/html,hello there');
- const screenCapture = await ScreenCapture.createForDisplay(display);
+ const screenCapture = new ScreenCapture(display);
await screenCapture.expectColorAtCenterMatches(WINDOW_BACKGROUND_COLOR);
});
- // Linux and arm64 platforms (WOA and macOS) do not return any capture sources
- ifit(process.platform === 'darwin' && process.arch === 'x64')('successfully applies the background color', async () => {
+ ifit(hasCapturableScreen())('successfully applies the background color', async () => {
const WINDOW_BACKGROUND_COLOR = '#55ccbb';
const VIEW_BACKGROUND_COLOR = '#ff00ff';
const display = screen.getPrimaryDisplay();
@@ -111,7 +109,7 @@ describe('BrowserView module', () => {
w.setBackgroundColor(VIEW_BACKGROUND_COLOR);
await view.webContents.loadURL('data:text/html,hello there');
- const screenCapture = await ScreenCapture.createForDisplay(display);
+ const screenCapture = new ScreenCapture(display);
await screenCapture.expectColorAtCenterMatches(VIEW_BACKGROUND_COLOR);
});
});
diff --git a/spec/api-browser-window-spec.ts b/spec/api-browser-window-spec.ts
index d5d21b9629..f0b6fb3600 100644
--- a/spec/api-browser-window-spec.ts
+++ b/spec/api-browser-window-spec.ts
@@ -6510,8 +6510,8 @@ describe('BrowserWindow module', () => {
expect(w.getBounds()).to.deep.equal(newBounds);
});
- // FIXME(codebytere): figure out why these are failing on macOS arm64.
- ifit(process.platform === 'darwin' && process.arch !== 'arm64')('should not display a visible background', async () => {
+ // FIXME(codebytere): figure out why these are failing on MAS arm64.
+ ifit(hasCapturableScreen() && !(process.mas && process.arch === 'arm64'))('should not display a visible background', async () => {
const display = screen.getPrimaryDisplay();
const backgroundWindow = new BrowserWindow({
@@ -6534,9 +6534,7 @@ describe('BrowserWindow module', () => {
const colorFile = path.join(__dirname, 'fixtures', 'pages', 'half-background-color.html');
await foregroundWindow.loadFile(colorFile);
- await setTimeout(1000);
-
- const screenCapture = await ScreenCapture.createForDisplay(display);
+ const screenCapture = new ScreenCapture(display);
await screenCapture.expectColorAtPointOnDisplayMatches(
HexColors.GREEN,
(size) => ({
@@ -6553,8 +6551,8 @@ describe('BrowserWindow module', () => {
);
});
- // FIXME(codebytere): figure out why these are failing on macOS arm64.
- ifit(process.platform === 'darwin' && process.arch !== 'arm64')('Allows setting a transparent window via CSS', async () => {
+ // FIXME(codebytere): figure out why these are failing on MAS arm64.
+ ifit(hasCapturableScreen() && !(process.mas && process.arch === 'arm64'))('Allows setting a transparent window via CSS', async () => {
const display = screen.getPrimaryDisplay();
const backgroundWindow = new BrowserWindow({
@@ -6580,14 +6578,11 @@ describe('BrowserWindow module', () => {
foregroundWindow.loadFile(path.join(__dirname, 'fixtures', 'pages', 'css-transparent.html'));
await once(ipcMain, 'set-transparent');
- await setTimeout(1000);
-
- const screenCapture = await ScreenCapture.createForDisplay(display);
+ const screenCapture = new ScreenCapture(display);
await screenCapture.expectColorAtCenterMatches(HexColors.PURPLE);
});
- // Linux and arm64 platforms (WOA and macOS) do not return any capture sources
- ifit(process.platform === 'darwin' && process.arch === 'x64')('should not make background transparent if falsy', async () => {
+ ifit(hasCapturableScreen())('should not make background transparent if falsy', async () => {
const display = screen.getPrimaryDisplay();
for (const transparent of [false, undefined]) {
@@ -6599,8 +6594,7 @@ describe('BrowserWindow module', () => {
await once(window, 'show');
await window.webContents.loadURL('data:text/html,<head><meta name="color-scheme" content="dark"></head>');
- await setTimeout(1000);
- const screenCapture = await ScreenCapture.createForDisplay(display);
+ const screenCapture = new ScreenCapture(display);
// color-scheme is set to dark so background should not be white
await screenCapture.expectColorAtCenterDoesNotMatch(HexColors.WHITE);
@@ -6612,8 +6606,7 @@ describe('BrowserWindow module', () => {
describe('"backgroundColor" option', () => {
afterEach(closeAllWindows);
- // Linux/WOA doesn't return any capture sources.
- ifit(process.platform === 'darwin')('should display the set color', async () => {
+ ifit(hasCapturableScreen())('should display the set color', async () => {
const display = screen.getPrimaryDisplay();
const w = new BrowserWindow({
@@ -6625,9 +6618,7 @@ describe('BrowserWindow module', () => {
w.loadURL('about:blank');
await once(w, 'ready-to-show');
- await setTimeout(1000);
-
- const screenCapture = await ScreenCapture.createForDisplay(display);
+ const screenCapture = new ScreenCapture(display);
await screenCapture.expectColorAtCenterMatches(HexColors.BLUE);
});
});
diff --git a/spec/api-view-spec.ts b/spec/api-view-spec.ts
index 5af674785c..de2aac8b91 100644
--- a/spec/api-view-spec.ts
+++ b/spec/api-view-spec.ts
@@ -54,4 +54,15 @@ describe('View', () => {
w.contentView.addChildView(v2);
expect(w.contentView.children).to.deep.equal([v3, v1, v2]);
});
+
+ it('allows setting various border radius values', () => {
+ w = new BaseWindow({ show: false });
+ const v = new View();
+ w.setContentView(v);
+ v.setBorderRadius(10);
+ v.setBorderRadius(0);
+ v.setBorderRadius(-10);
+ v.setBorderRadius(9999999);
+ v.setBorderRadius(-9999999);
+ });
});
diff --git a/spec/api-web-contents-view-spec.ts b/spec/api-web-contents-view-spec.ts
index dbfa1d17db..220100434d 100644
--- a/spec/api-web-contents-view-spec.ts
+++ b/spec/api-web-contents-view-spec.ts
@@ -1,10 +1,10 @@
-import { closeAllWindows } from './lib/window-helpers';
import { expect } from 'chai';
-
-import { BaseWindow, View, WebContentsView, webContents } from 'electron/main';
+import { BaseWindow, BrowserWindow, View, WebContentsView, webContents, screen } from 'electron/main';
import { once } from 'node:events';
-import { defer } from './lib/spec-helpers';
-import { BrowserWindow } from 'electron';
+
+import { closeAllWindows } from './lib/window-helpers';
+import { defer, ifdescribe } from './lib/spec-helpers';
+import { HexColors, ScreenCapture, hasCapturableScreen, nextFrameTime } from './lib/screen-helpers';
describe('WebContentsView', () => {
afterEach(closeAllWindows);
@@ -224,4 +224,92 @@ describe('WebContentsView', () => {
expect(visibilityState).to.equal('visible');
});
});
+
+ describe('setBorderRadius', () => {
+ ifdescribe(hasCapturableScreen())('capture', () => {
+ let w: Electron.BaseWindow;
+ let v: Electron.WebContentsView;
+ let display: Electron.Display;
+ let corners: Electron.Point[];
+
+ const backgroundUrl = `data:text/html,<style>html{background:${encodeURIComponent(HexColors.GREEN)}}</style>`;
+
+ beforeEach(async () => {
+ display = screen.getPrimaryDisplay();
+
+ w = new BaseWindow({
+ ...display.workArea,
+ show: true,
+ frame: false,
+ hasShadow: false,
+ backgroundColor: HexColors.BLUE,
+ roundedCorners: false
+ });
+
+ v = new WebContentsView();
+ w.setContentView(v);
+ v.setBorderRadius(100);
+
+ const readyForCapture = once(v.webContents, 'ready-to-show');
+ v.webContents.loadURL(backgroundUrl);
+
+ const inset = 10;
+ corners = [
+ { x: display.workArea.x + inset, y: display.workArea.y + inset }, // top-left
+ { x: display.workArea.x + display.workArea.width - inset, y: display.workArea.y + inset }, // top-right
+ { x: display.workArea.x + display.workArea.width - inset, y: display.workArea.y + display.workArea.height - inset }, // bottom-right
+ { x: display.workArea.x + inset, y: display.workArea.y + display.workArea.height - inset } // bottom-left
+ ];
+
+ await readyForCapture;
+ });
+
+ afterEach(() => {
+ w.destroy();
+ w = v = null!;
+ });
+
+ it('should render with cutout corners', async () => {
+ const screenCapture = new ScreenCapture(display);
+
+ for (const corner of corners) {
+ await screenCapture.expectColorAtPointOnDisplayMatches(HexColors.BLUE, () => corner);
+ }
+
+ // Center should be WebContents page background color
+ await screenCapture.expectColorAtCenterMatches(HexColors.GREEN);
+ });
+
+ it('should allow resetting corners', async () => {
+ const corner = corners[0];
+ v.setBorderRadius(0);
+
+ await nextFrameTime();
+ const screenCapture = new ScreenCapture(display);
+ await screenCapture.expectColorAtPointOnDisplayMatches(HexColors.GREEN, () => corner);
+ await screenCapture.expectColorAtCenterMatches(HexColors.GREEN);
+ });
+
+ it('should render when set before attached', async () => {
+ v = new WebContentsView();
+ v.setBorderRadius(100); // must set before
+
+ w.setContentView(v);
+
+ const readyForCapture = once(v.webContents, 'ready-to-show');
+ v.webContents.loadURL(backgroundUrl);
+ await readyForCapture;
+
+ const corner = corners[0];
+ const screenCapture = new ScreenCapture(display);
+ await screenCapture.expectColorAtPointOnDisplayMatches(HexColors.BLUE, () => corner);
+ await screenCapture.expectColorAtCenterMatches(HexColors.GREEN);
+ });
+ });
+
+ it('should allow setting when not attached', async () => {
+ const v = new WebContentsView();
+ v.setBorderRadius(100);
+ });
+ });
});
diff --git a/spec/guest-window-manager-spec.ts b/spec/guest-window-manager-spec.ts
index fbe3377897..a625f2a7b8 100644
--- a/spec/guest-window-manager-spec.ts
+++ b/spec/guest-window-manager-spec.ts
@@ -1,10 +1,9 @@
import { BrowserWindow, screen } from 'electron';
import { expect, assert } from 'chai';
-import { HexColors, ScreenCapture } from './lib/screen-helpers';
+import { HexColors, ScreenCapture, hasCapturableScreen } from './lib/screen-helpers';
import { ifit, listen } from './lib/spec-helpers';
import { closeAllWindows } from './lib/window-helpers';
import { once } from 'node:events';
-import { setTimeout as setTimeoutAsync } from 'node:timers/promises';
import * as http from 'node:http';
describe('webContents.setWindowOpenHandler', () => {
@@ -201,8 +200,7 @@ describe('webContents.setWindowOpenHandler', () => {
expect(await browserWindow.webContents.executeJavaScript('42')).to.equal(42);
});
- // Linux and arm64 platforms (WOA and macOS) do not return any capture sources
- ifit(process.platform === 'darwin' && process.arch === 'x64')('should not make child window background transparent', async () => {
+ ifit(hasCapturableScreen())('should not make child window background transparent', async () => {
browserWindow.webContents.setWindowOpenHandler(() => ({ action: 'allow' }));
const didCreateWindow = once(browserWindow.webContents, 'did-create-window');
browserWindow.webContents.executeJavaScript("window.open('about:blank') && true");
@@ -210,8 +208,7 @@ describe('webContents.setWindowOpenHandler', () => {
const display = screen.getPrimaryDisplay();
childWindow.setBounds(display.bounds);
await childWindow.webContents.executeJavaScript("const meta = document.createElement('meta'); meta.name = 'color-scheme'; meta.content = 'dark'; document.head.appendChild(meta); true;");
- await setTimeoutAsync(1000);
- const screenCapture = await ScreenCapture.createForDisplay(display);
+ const screenCapture = new ScreenCapture(display);
// color-scheme is set to dark so background should not be white
await screenCapture.expectColorAtCenterDoesNotMatch(HexColors.WHITE);
});
diff --git a/spec/lib/screen-helpers.ts b/spec/lib/screen-helpers.ts
index 3dc84bbd80..98f7ed2cb1 100644
--- a/spec/lib/screen-helpers.ts
+++ b/spec/lib/screen-helpers.ts
@@ -75,67 +75,72 @@ function areColorsSimilar (
return distance <= distanceThreshold;
}
-function imageCenter (image: NativeImage): Electron.Point {
- const size = image.getSize();
+function displayCenter (display: Electron.Display): Electron.Point {
return {
- x: size.width / 2,
- y: size.height / 2
+ x: display.size.width / 2,
+ y: display.size.height / 2
};
}
+
+/** Resolve when approx. one frame has passed (30FPS) */
+export async function nextFrameTime (): Promise<void> {
+ return await new Promise((resolve) => {
+ setTimeout(resolve, 1000 / 30);
+ });
+}
+
/**
* Utilities for creating and inspecting a screen capture.
*
+ * Set `PAUSE_CAPTURE_TESTS` env var to briefly pause during screen
+ * capture for easier inspection.
+ *
* NOTE: Not yet supported on Linux in CI due to empty sources list.
*/
export class ScreenCapture {
- /** Use the async constructor `ScreenCapture.create()` instead. */
- private constructor (image: NativeImage) {
- this.image = image;
- }
-
- public static async create (): Promise<ScreenCapture> {
- const display = screen.getPrimaryDisplay();
- return ScreenCapture._createImpl(display);
- }
+ /** Timeout to wait for expected color to match. */
+ static TIMEOUT = 3000;
- public static async createForDisplay (
- display: Electron.Display
- ): Promise<ScreenCapture> {
- return ScreenCapture._createImpl(display);
+ constructor (display?: Electron.Display) {
+ this.display = display || screen.getPrimaryDisplay();
}
public async expectColorAtCenterMatches (hexColor: string) {
- return this._expectImpl(imageCenter(this.image), hexColor, true);
+ return this._expectImpl(displayCenter(this.display), hexColor, true);
}
public async expectColorAtCenterDoesNotMatch (hexColor: string) {
- return this._expectImpl(imageCenter(this.image), hexColor, false);
+ return this._expectImpl(displayCenter(this.display), hexColor, false);
}
public async expectColorAtPointOnDisplayMatches (
hexColor: string,
findPoint: (displaySize: Electron.Size) => Electron.Point
) {
- return this._expectImpl(findPoint(this.image.getSize()), hexColor, true);
+ return this._expectImpl(findPoint(this.display.size), hexColor, true);
}
- private static async _createImpl (display: Electron.Display) {
+ private async captureFrame (): Promise<NativeImage> {
const sources = await desktopCapturer.getSources({
types: ['screen'],
- thumbnailSize: display.size
+ thumbnailSize: this.display.size
});
const captureSource = sources.find(
- (source) => source.display_id === display.id.toString()
+ (source) => source.display_id === this.display.id.toString()
);
if (captureSource === undefined) {
const displayIds = sources.map((source) => source.display_id).join(', ');
throw new Error(
- `Unable to find screen capture for display '${display.id}'\n\tAvailable displays: ${displayIds}`
+ `Unable to find screen capture for display '${this.display.id}'\n\tAvailable displays: ${displayIds}`
);
}
- return new ScreenCapture(captureSource.thumbnail);
+ if (process.env.PAUSE_CAPTURE_TESTS) {
+ await new Promise((resolve) => setTimeout(resolve, 1e3));
+ }
+
+ return captureSource.thumbnail;
}
private async _expectImpl (
@@ -143,15 +148,29 @@ export class ScreenCapture {
expectedColor: string,
matchIsExpected: boolean
) {
- const actualColor = getPixelColor(this.image, point);
- const colorsMatch = areColorsSimilar(expectedColor, actualColor);
- const gotExpectedResult = matchIsExpected ? colorsMatch : !colorsMatch;
+ let frame: Electron.NativeImage;
+ let actualColor: string;
+ let gotExpectedResult: boolean = false;
+ const expiration = Date.now() + ScreenCapture.TIMEOUT;
+
+ // Continuously capture frames until we either see the expected result or
+ // reach a timeout. This helps avoid flaky tests in which a short waiting
+ // period is required for the expected result.
+ do {
+ frame = await this.captureFrame();
+ actualColor = getPixelColor(frame, point);
+ const colorsMatch = areColorsSimilar(expectedColor, actualColor);
+ gotExpectedResult = matchIsExpected ? colorsMatch : !colorsMatch;
+ if (gotExpectedResult) break;
+
+ await nextFrameTime(); // limit framerate
+ } while (Date.now() < expiration);
if (!gotExpectedResult) {
// Save the image as an artifact for better debugging
const artifactName = await createArtifactWithRandomId(
(id) => `color-mismatch-${id}.png`,
- this.image.toPNG()
+ frame.toPNG()
);
throw new AssertionError(
`Expected color at (${point.x}, ${point.y}) to ${
@@ -161,7 +180,7 @@ export class ScreenCapture {
}
}
- private image: NativeImage;
+ private display: Electron.Display;
}
/**
@@ -174,5 +193,5 @@ export class ScreenCapture {
* - Win32 x64: virtual screen display is 0x0
*/
export const hasCapturableScreen = () => {
- return process.platform === 'darwin';
+ return process.env.CI ? process.platform === 'darwin' : true;
};
diff --git a/spec/webview-spec.ts b/spec/webview-spec.ts
index 3c80e41ce9..6c85a5bcf2 100644
--- a/spec/webview-spec.ts
+++ b/spec/webview-spec.ts
@@ -9,7 +9,7 @@ import * as http from 'node:http';
import * as auth from 'basic-auth';
import { once } from 'node:events';
import { setTimeout } from 'node:timers/promises';
-import { HexColors, ScreenCapture } from './lib/screen-helpers';
+import { HexColors, ScreenCapture, hasCapturableScreen } from './lib/screen-helpers';
declare let WebView: any;
const features = process._linkedBinding('electron_common_features');
@@ -796,41 +796,32 @@ describe('<webview> tag', function () {
});
after(() => w.close());
- // Linux and arm64 platforms (WOA and macOS) do not return any capture sources
- ifit(process.platform === 'darwin' && process.arch === 'x64')('is transparent by default', async () => {
+ ifit(hasCapturableScreen())('is transparent by default', async () => {
await loadWebView(w.webContents, {
src: 'data:text/html,foo'
});
- await setTimeout(1000);
-
- const screenCapture = await ScreenCapture.create();
+ const screenCapture = new ScreenCapture();
await screenCapture.expectColorAtCenterMatches(WINDOW_BACKGROUND_COLOR);
});
- // Linux and arm64 platforms (WOA and macOS) do not return any capture sources
- ifit(process.platform === 'darwin' && process.arch === 'x64')('remains transparent when set', async () => {
+ ifit(hasCapturableScreen())('remains transparent when set', async () => {
await loadWebView(w.webContents, {
src: 'data:text/html,foo',
webpreferences: 'transparent=yes'
});
- await setTimeout(1000);
-
- const screenCapture = await ScreenCapture.create();
+ const screenCapture = new ScreenCapture();
await screenCapture.expectColorAtCenterMatches(WINDOW_BACKGROUND_COLOR);
});
- // Linux and arm64 platforms (WOA and macOS) do not return any capture sources
- ifit(process.platform === 'darwin' && process.arch === 'x64')('can disable transparency', async () => {
+ ifit(hasCapturableScreen())('can disable transparency', async () => {
await loadWebView(w.webContents, {
src: 'data:text/html,foo',
webpreferences: 'transparent=no'
});
- await setTimeout(1000);
-
- const screenCapture = await ScreenCapture.create();
+ const screenCapture = new ScreenCapture();
await screenCapture.expectColorAtCenterMatches(HexColors.WHITE);
});
});
|
feat
|
43e328f3632f9380cae7ab0c91363fbe7acb9b11
|
Shelley Vohr
|
2025-01-30 11:03:27
|
chore: update `pdf_viewer_private.idl` (#45370)
chore: update pdf_viewer_private.idl
- https://chromium-review.googlesource.com/c/chromium/src/+/6160067
|
diff --git a/shell/common/extensions/api/pdf_viewer_private.idl b/shell/common/extensions/api/pdf_viewer_private.idl
index c3bcc770bb..0de5d9f6ce 100644
--- a/shell/common/extensions/api/pdf_viewer_private.idl
+++ b/shell/common/extensions/api/pdf_viewer_private.idl
@@ -68,5 +68,10 @@ namespace pdfViewerPrivate {
// Fired when the browser wants the listener to perform a save.
// `streamUrl`: Unique ID for the instance that should perform the save.
static void onSave(DOMString streamUrl);
+
+ // Fired when the browser wants the listener to update the viewport based on
+ // a different PDF URL.
+ // `pdfUrl`: The string of the PDF URL that should update the viewport.
+ static void onShouldUpdateViewport(DOMString pdfUrl);
};
};
|
chore
|
57b29903e30a7bdb32776e248d25750b0953777a
|
Shelley Vohr
|
2024-01-12 14:37:39
|
build: log got error response bodies (#40965)
|
diff --git a/script/prepare-appveyor.js b/script/prepare-appveyor.js
index 56e39a5f66..996b6543fa 100644
--- a/script/prepare-appveyor.js
+++ b/script/prepare-appveyor.js
@@ -70,7 +70,14 @@ async function checkAppVeyorImage (options) {
const { cloudSettings } = settings;
return cloudSettings.images.find(image => image.name === `${options.imageVersion}`) || null;
} catch (err) {
- console.log('Could not call AppVeyor: ', err);
+ if (err.response?.body) {
+ console.error('Could not call AppVeyor: ', {
+ statusCode: err.response.statusCode,
+ body: JSON.parse(err.response.body)
+ });
+ } else {
+ console.error('Error calling AppVeyor:', err);
+ }
}
}
diff --git a/script/release/ci-release-build.js b/script/release/ci-release-build.js
index 4d874201d6..6b5c31ec8b 100644
--- a/script/release/ci-release-build.js
+++ b/script/release/ci-release-build.js
@@ -183,7 +183,14 @@ async function circleCIRequest (url, method, requestBody) {
}
return makeRequest(requestOpts, true).catch(err => {
- console.log('Error calling CircleCI:', err);
+ if (err.response?.body) {
+ console.error('Could not call CircleCI: ', {
+ statusCode: err.response.statusCode,
+ body: JSON.parse(err.response.body)
+ });
+ } else {
+ console.error('Error calling CircleCI:', err);
+ }
});
}
@@ -234,7 +241,14 @@ async function callAppVeyor (targetBranch, job, options) {
const buildUrl = `https://ci.appveyor.com/project/electron-bot/${appVeyorJobs[job]}/build/${version}`;
console.log(`AppVeyor release build request for ${job} successful. Check build status at ${buildUrl}`);
} catch (err) {
- console.log('Could not call AppVeyor: ', err);
+ if (err.response?.body) {
+ console.error('Could not call AppVeyor: ', {
+ statusCode: err.response.statusCode,
+ body: JSON.parse(err.response.body)
+ });
+ } else {
+ console.error('Error calling AppVeyor:', err);
+ }
}
}
diff --git a/script/release/get-url-hash.js b/script/release/get-url-hash.js
index a4c0966559..113ee292f8 100644
--- a/script/release/get-url-hash.js
+++ b/script/release/get-url-hash.js
@@ -22,7 +22,14 @@ module.exports = async function getUrlHash (targetUrl, algorithm = 'sha256', att
return resp.body.trim();
} catch (err) {
if (attempts > 1) {
- console.error('Failed to get URL hash for', targetUrl, 'we will retry', err);
+ if (err.response?.body) {
+ console.error(`Failed to get URL hash for ${targetUrl} - we will retry`, {
+ statusCode: err.response.statusCode,
+ body: JSON.parse(err.response.body)
+ });
+ } else {
+ console.error(`Failed to get URL hash for ${targetUrl} - we will retry`, err);
+ }
return getUrlHash(targetUrl, algorithm, attempts - 1);
}
throw err;
|
build
|
2081f771e4181a5a7db8a59c85e6e966820b9017
|
Anny Yang
|
2024-11-01 08:04:37
|
docs: add custom titlebar example (#43693)
* docs: add custom titlebar example
* docs: add links and other small edits
* docs: add panel window docs
* docs: remove panel example
* docs: specify expected emphasis style
* docs: responding to feedback
* docs: fix section names in links
* docs: rework baseWindow note
* docs: making window customization its own section
* responding to feedback
|
diff --git a/.markdownlint-cli2.jsonc b/.markdownlint-cli2.jsonc
index d3f83a5217..aa44ae70b8 100644
--- a/.markdownlint-cli2.jsonc
+++ b/.markdownlint-cli2.jsonc
@@ -5,6 +5,9 @@
"autolink": false,
"shortcut": false
},
+ "MD049": {
+ "style": "underscore"
+ },
"no-angle-brackets": true,
"no-curly-braces": true,
"no-inline-html": {
diff --git a/docs/api/structures/base-window-options.md b/docs/api/structures/base-window-options.md
index 808d1609f9..771445be06 100644
--- a/docs/api/structures/base-window-options.md
+++ b/docs/api/structures/base-window-options.md
@@ -49,7 +49,7 @@
* `show` boolean (optional) - Whether window should be shown when created. Default is
`true`.
* `frame` boolean (optional) - Specify `false` to create a
- [frameless window](../../tutorial/window-customization.md#create-frameless-windows). Default is `true`.
+ [frameless window](../../tutorial/custom-window-styles.md#frameless-windows). Default is `true`.
* `parent` BaseWindow (optional) - Specify parent window. Default is `null`.
* `modal` boolean (optional) - Whether this is a modal window. This only works when the
window is a child window. Default is `false`.
@@ -70,7 +70,7 @@
is only implemented on Windows and macOS.
* `darkTheme` boolean (optional) - Forces using dark theme for the window, only works on
some GTK+3 desktop environments. Default is `false`.
-* `transparent` boolean (optional) - Makes the window [transparent](../../tutorial/window-customization.md#create-transparent-windows).
+* `transparent` boolean (optional) - Makes the window [transparent](../../tutorial/custom-window-styles.md#transparent-windows).
Default is `false`. On Windows, does not work unless the window is frameless.
* `type` string (optional) - The type of window, default is normal window. See more about
this below.
diff --git a/docs/fiddles/features/window-customization/custom-title-bar/custom-drag-region/index.html b/docs/fiddles/features/window-customization/custom-title-bar/custom-drag-region/index.html
new file mode 100644
index 0000000000..389fd9e760
--- /dev/null
+++ b/docs/fiddles/features/window-customization/custom-title-bar/custom-drag-region/index.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
+ <meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'">
+ <link href="./styles.css" rel="stylesheet">
+ <title>Custom Titlebar App</title>
+ </head>
+ <body>
+ <!-- mount your title bar at the top of you application's body tag -->
+ <div class="titlebar">Cool titlebar</div>
+ </body>
+</html>
\ No newline at end of file
diff --git a/docs/fiddles/features/window-customization/custom-title-bar/custom-drag-region/main.js b/docs/fiddles/features/window-customization/custom-title-bar/custom-drag-region/main.js
new file mode 100644
index 0000000000..b862cdf970
--- /dev/null
+++ b/docs/fiddles/features/window-customization/custom-title-bar/custom-drag-region/main.js
@@ -0,0 +1,16 @@
+const { app, BrowserWindow } = require('electron')
+
+function createWindow () {
+ const win = new BrowserWindow({
+ // remove the default titlebar
+ titleBarStyle: 'hidden',
+ // expose window controlls in Windows/Linux
+ ...(process.platform !== 'darwin' ? { titleBarOverlay: true } : {})
+ })
+
+ win.loadFile('index.html')
+}
+
+app.whenReady().then(() => {
+ createWindow()
+})
diff --git a/docs/fiddles/features/window-customization/custom-title-bar/custom-drag-region/styles.css b/docs/fiddles/features/window-customization/custom-title-bar/custom-drag-region/styles.css
new file mode 100644
index 0000000000..b5a046efdb
--- /dev/null
+++ b/docs/fiddles/features/window-customization/custom-title-bar/custom-drag-region/styles.css
@@ -0,0 +1,12 @@
+body {
+ margin: 0;
+}
+.titlebar {
+ height: 30px;
+ background: blue;
+ color: white;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ app-region: drag;
+}
\ No newline at end of file
diff --git a/docs/fiddles/features/window-customization/custom-title-bar/custom-title-bar/index.html b/docs/fiddles/features/window-customization/custom-title-bar/custom-title-bar/index.html
new file mode 100644
index 0000000000..389fd9e760
--- /dev/null
+++ b/docs/fiddles/features/window-customization/custom-title-bar/custom-title-bar/index.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
+ <meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'">
+ <link href="./styles.css" rel="stylesheet">
+ <title>Custom Titlebar App</title>
+ </head>
+ <body>
+ <!-- mount your title bar at the top of you application's body tag -->
+ <div class="titlebar">Cool titlebar</div>
+ </body>
+</html>
\ No newline at end of file
diff --git a/docs/fiddles/features/window-customization/custom-title-bar/custom-title-bar/main.js b/docs/fiddles/features/window-customization/custom-title-bar/custom-title-bar/main.js
new file mode 100644
index 0000000000..b862cdf970
--- /dev/null
+++ b/docs/fiddles/features/window-customization/custom-title-bar/custom-title-bar/main.js
@@ -0,0 +1,16 @@
+const { app, BrowserWindow } = require('electron')
+
+function createWindow () {
+ const win = new BrowserWindow({
+ // remove the default titlebar
+ titleBarStyle: 'hidden',
+ // expose window controlls in Windows/Linux
+ ...(process.platform !== 'darwin' ? { titleBarOverlay: true } : {})
+ })
+
+ win.loadFile('index.html')
+}
+
+app.whenReady().then(() => {
+ createWindow()
+})
diff --git a/docs/fiddles/features/window-customization/custom-title-bar/custom-title-bar/styles.css b/docs/fiddles/features/window-customization/custom-title-bar/custom-title-bar/styles.css
new file mode 100644
index 0000000000..1f61248a97
--- /dev/null
+++ b/docs/fiddles/features/window-customization/custom-title-bar/custom-title-bar/styles.css
@@ -0,0 +1,12 @@
+body {
+ margin: 0;
+}
+
+.titlebar {
+ height: 30px;
+ background: blue;
+ color: white;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+}
\ No newline at end of file
diff --git a/docs/fiddles/features/window-customization/custom-title-bar/native-window-controls/main.js b/docs/fiddles/features/window-customization/custom-title-bar/native-window-controls/main.js
new file mode 100644
index 0000000000..fc59d41ca1
--- /dev/null
+++ b/docs/fiddles/features/window-customization/custom-title-bar/native-window-controls/main.js
@@ -0,0 +1,15 @@
+const { app, BrowserWindow } = require('electron')
+
+function createWindow () {
+ const win = new BrowserWindow({
+ // remove the default titlebar
+ titleBarStyle: 'hidden',
+ // expose window controlls in Windows/Linux
+ ...(process.platform !== 'darwin' ? { titleBarOverlay: true } : {})
+ })
+ win.loadURL('https://example.com')
+}
+
+app.whenReady().then(() => {
+ createWindow()
+})
diff --git a/docs/fiddles/features/window-customization/custom-title-bar/remove-title-bar/main.js b/docs/fiddles/features/window-customization/custom-title-bar/remove-title-bar/main.js
new file mode 100644
index 0000000000..f85ee63f59
--- /dev/null
+++ b/docs/fiddles/features/window-customization/custom-title-bar/remove-title-bar/main.js
@@ -0,0 +1,13 @@
+const { app, BrowserWindow } = require('electron')
+
+function createWindow () {
+ const win = new BrowserWindow({
+ // remove the default titlebar
+ titleBarStyle: 'hidden'
+ })
+ win.loadURL('https://example.com')
+}
+
+app.whenReady().then(() => {
+ createWindow()
+})
diff --git a/docs/fiddles/features/window-customization/custom-title-bar/starter-code/main.js b/docs/fiddles/features/window-customization/custom-title-bar/starter-code/main.js
new file mode 100644
index 0000000000..314899176a
--- /dev/null
+++ b/docs/fiddles/features/window-customization/custom-title-bar/starter-code/main.js
@@ -0,0 +1,10 @@
+const { app, BrowserWindow } = require('electron')
+
+function createWindow () {
+ const win = new BrowserWindow({})
+ win.loadURL('https://example.com')
+}
+
+app.whenReady().then(() => {
+ createWindow()
+})
diff --git a/docs/fiddles/features/window-customization/custom-window-styles/frameless-windows/main.js b/docs/fiddles/features/window-customization/custom-window-styles/frameless-windows/main.js
new file mode 100644
index 0000000000..86e486b1ee
--- /dev/null
+++ b/docs/fiddles/features/window-customization/custom-window-styles/frameless-windows/main.js
@@ -0,0 +1,14 @@
+const { app, BrowserWindow } = require('electron')
+
+function createWindow () {
+ const win = new BrowserWindow({
+ width: 300,
+ height: 200,
+ frame: false
+ })
+ win.loadURL('https://example.com')
+}
+
+app.whenReady().then(() => {
+ createWindow()
+})
diff --git a/docs/fiddles/features/window-customization/custom-window-styles/transparent-windows/index.html b/docs/fiddles/features/window-customization/custom-window-styles/transparent-windows/index.html
new file mode 100644
index 0000000000..7c3dc93bdd
--- /dev/null
+++ b/docs/fiddles/features/window-customization/custom-window-styles/transparent-windows/index.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
+ <meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'">
+ <link href="./styles.css" rel="stylesheet">
+ <title>Transparent Hello World</title>
+ </head>
+ <body>
+ <div class="white-circle">
+ <div>Hello World!</div>
+ </div>
+ </body>
+</html>
\ No newline at end of file
diff --git a/docs/fiddles/features/window-customization/custom-window-styles/transparent-windows/main.js b/docs/fiddles/features/window-customization/custom-window-styles/transparent-windows/main.js
new file mode 100644
index 0000000000..42e63cf4d2
--- /dev/null
+++ b/docs/fiddles/features/window-customization/custom-window-styles/transparent-windows/main.js
@@ -0,0 +1,16 @@
+const { app, BrowserWindow } = require('electron')
+
+function createWindow () {
+ const win = new BrowserWindow({
+ width: 100,
+ height: 100,
+ resizable: false,
+ frame: false,
+ transparent: true
+ })
+ win.loadFile('index.html')
+}
+
+app.whenReady().then(() => {
+ createWindow()
+})
diff --git a/docs/fiddles/features/window-customization/custom-window-styles/transparent-windows/styles.css b/docs/fiddles/features/window-customization/custom-window-styles/transparent-windows/styles.css
new file mode 100644
index 0000000000..361a8d8798
--- /dev/null
+++ b/docs/fiddles/features/window-customization/custom-window-styles/transparent-windows/styles.css
@@ -0,0 +1,16 @@
+body {
+ margin: 0;
+ padding: 0;
+ background-color: rgba(0, 0, 0, 0); /* Transparent background */
+}
+.white-circle {
+ width: 100px;
+ height: 100px;
+ background-color: white;
+ border-radius: 50%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ app-region: drag;
+ user-select: none;
+}
\ No newline at end of file
diff --git a/docs/images/frameless-window.png b/docs/images/frameless-window.png
new file mode 100644
index 0000000000..586242c19b
Binary files /dev/null and b/docs/images/frameless-window.png differ
diff --git a/docs/images/transparent-window-mission-control.png b/docs/images/transparent-window-mission-control.png
new file mode 100644
index 0000000000..444d87ddb4
Binary files /dev/null and b/docs/images/transparent-window-mission-control.png differ
diff --git a/docs/images/transparent-window.png b/docs/images/transparent-window.png
new file mode 100644
index 0000000000..8d5e517081
Binary files /dev/null and b/docs/images/transparent-window.png differ
diff --git a/docs/tutorial/custom-title-bar.md b/docs/tutorial/custom-title-bar.md
new file mode 100644
index 0000000000..9f9966eaf1
--- /dev/null
+++ b/docs/tutorial/custom-title-bar.md
@@ -0,0 +1,176 @@
+# Custom Title Bar
+
+## Basic tutorial
+
+Application windows have a default [chrome][] applied by the OS. Not to be confused
+with the Google Chrome browser, window _chrome_ refers to the parts of the window (e.g.
+title bar, toolbars, controls) that are not a part of the main web content. While the
+default title bar provided by the OS chrome is sufficent for simple use cases, many
+applications opt to remove it. Implementing a custom title bar can help your application
+feel more modern and consistent across platforms.
+
+You can follow along with this tutorial by opening Fiddle with the following starter code.
+
+```fiddle docs/fiddles/features/window-customization/custom-title-bar/starter-code
+
+```
+
+### Remove the default title bar
+
+Let’s start by configuring a window with native window controls and a hidden title bar.
+To remove the default title bar, set the [`BaseWindowContructorOptions`][] `titleBarStyle`
+param in the `BrowserWindow` constructor to `'hidden'`.
+
+```fiddle docs/fiddles/features/window-customization/custom-title-bar/remove-title-bar
+
+```
+
+### Add native window controls _Windows_ _Linux_
+
+On macOS, setting `titleBarStyle: 'hidden'` removes the title bar while keeping the window’s
+traffic light controls available in the upper left hand corner. However on Windows and Linux,
+you’ll need to add window controls back into your `BrowserWindow` by setting the
+[`BaseWindowContructorOptions`][] `titleBarOverlay` param in the `BrowserWindow` constructor.
+
+```fiddle docs/fiddles/features/window-customization/custom-title-bar/native-window-controls
+
+```
+
+Setting `titleBarOverlay: true` is the simplest way to expose window controls back into
+your `BrowserWindow`. If you’re interested in customizing the window controls further,
+check out the sections [Custom traffic lights][] and [Custom window controls][] that cover
+this in more detail.
+
+### Create a custom title bar
+
+Now, let’s implement a simple custom title bar in the `webContents` of our `BrowserWindow`.
+There’s nothing fancy here, just HTML and CSS!
+
+```fiddle docs/fiddles/features/window-customization/custom-title-bar/custom-title-bar
+
+```
+
+Currently our application window can’t be moved. Since we’ve removed the default title bar,
+the application needs to tell Electron which regions are draggable. We’ll do this by adding
+the CSS style `app-region: drag` to the custom title bar. Now we can drag the custom title
+bar to reposition our app window!
+
+```fiddle docs/fiddles/features/window-customization/custom-title-bar/custom-drag-region
+
+```
+
+For more information around how to manage drag regions defined by your electron application,
+see the [Custom draggable regions][] section below.
+
+Congratulations, you've just implemented a basic custom title bar!
+
+## Advanced window customization
+
+### Custom traffic lights _macOS_
+
+#### Customize the look of your traffic lights _macOS_
+
+The `customButtonsOnHover` title bar style will hide the traffic lights until you hover
+over them. This is useful if you want to create custom traffic lights in your HTML but still
+use the native UI to control the window.
+
+```js
+const { BrowserWindow } = require('electron')
+const win = new BrowserWindow({ titleBarStyle: 'customButtonsOnHover' })
+```
+
+#### Customize the traffic light position _macOS_
+
+To modify the position of the traffic light window controls, there are two configuration
+options available.
+
+Applying `hiddenInset` title bar style will shift the vertical inset of the traffic lights
+by a fixed amount.
+
+```js title='main.js'
+const { BrowserWindow } = require('electron')
+const win = new BrowserWindow({ titleBarStyle: 'hiddenInset' })
+```
+
+If you need more granular control over the positioning of the traffic lights, you can pass
+a set of coordinates to the `trafficLightPosition` option in the `BrowserWindow`
+constructor.
+
+```js title='main.js'
+const { BrowserWindow } = require('electron')
+const win = new BrowserWindow({
+ titleBarStyle: 'hidden',
+ trafficLightPosition: { x: 10, y: 10 }
+})
+```
+
+#### Show and hide the traffic lights programmatically _macOS_
+
+You can also show and hide the traffic lights programmatically from the main process.
+The `win.setWindowButtonVisibility` forces traffic lights to be show or hidden depending
+on the value of its boolean parameter.
+
+```js title='main.js'
+const { BrowserWindow } = require('electron')
+const win = new BrowserWindow()
+// hides the traffic lights
+win.setWindowButtonVisibility(false)
+```
+
+:::note
+Given the number of APIs available, there are many ways of achieving this. For instance,
+combining `frame: false` with `win.setWindowButtonVisibility(true)` will yield the same
+layout outcome as setting `titleBarStyle: 'hidden'`.
+:::
+
+#### Custom window controls
+
+The [Window Controls Overlay API][] is a web standard that gives web apps the ability to
+customize their title bar region when installed on desktop. Electron exposes this API
+through the `titleBarOverlay` option in the `BrowserWindow` constructor. When `titleBarOverlay`
+is enabled, the window controls become exposed in their default position, and DOM elements
+cannot use the area underneath this region.
+
+:::note
+`titleBarOverlay` requires the `titleBarStyle` param in the `BrowserWindow` constructor
+to have a value other than `default`.
+:::
+
+The custom title bar tutorial covers a [basic example][Add native window controls] of exposing
+window controls by setting `titleBarOverlay: true`. The height, color (_Windows_ _Linux_), and
+symbol colors (_Windows_) of the window controls can be customized further by setting
+`titleBarOverlay` to an object.
+
+The value passed to the `height` property must be an integer. The `color` and `symbolColor`
+properties accept `rgba()`, `hsla()`, and `#RRGGBBAA` color formats and support transparency.
+If a color option is not specified, the color will default to its system color for the window
+control buttons. Similarly, if the height option is not specified, the window controls will
+default to the standard system height:
+
+```js title='main.js'
+const { BrowserWindow } = require('electron')
+const win = new BrowserWindow({
+ titleBarStyle: 'hidden',
+ titleBarOverlay: {
+ color: '#2f3241',
+ symbolColor: '#74b1be',
+ height: 60
+ }
+})
+```
+
+:::note
+Once your title bar overlay is enabled from the main process, you can access the overlay's
+color and dimension values from a renderer using a set of readonly
+[JavaScript APIs][overlay-javascript-apis] and [CSS Environment Variables][overlay-css-env-vars].
+:::
+
+[Add native window controls]: #add-native-window-controls-windows-linux
+[`BaseWindowContructorOptions`]: ../api/structures/base-window-options.md
+[chrome]: https://developer.mozilla.org/en-US/docs/Glossary/Chrome
+[Custom draggable regions]: ./custom-window-interactions.md#custom-draggable-regions
+[Custom traffic lights]: #custom-traffic-lights-macos
+[Custom window controls]: #custom-window-controls
+[overlay-css-env-vars]: https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#css-environment-variables
+[overlay-javascript-apis]: https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#javascript-apis
+[Window Controls Overlay API]: https://github.com/WICG/window-controls-overlay/blob/main/explainer.md
diff --git a/docs/tutorial/custom-window-interactions.md b/docs/tutorial/custom-window-interactions.md
new file mode 100644
index 0000000000..6801594b94
--- /dev/null
+++ b/docs/tutorial/custom-window-interactions.md
@@ -0,0 +1,107 @@
+# Custom Window Interactions
+
+## Custom draggable regions
+
+By default, windows are dragged using the title bar provided by the OS chrome. Apps
+that remove the default title bar need to use the `app-region` CSS property to define
+specific areas that can be used to drag the window. Setting `app-region: drag` marks
+a rectagular area as draggable.
+
+It is important to note that draggable areas ignore all pointer events. For example,
+a button element that overlaps a draggable region will not emit mouse clicks or mouse
+enter/exit events within that overlapping area. Setting `app-region: no-drag` reenables
+pointer events by excluding a rectagular area from a draggable region.
+
+To make the whole window draggable, you can add `app-region: drag` as
+`body`'s style:
+
+```css title='styles.css'
+body {
+ app-region: drag;
+}
+```
+
+And note that if you have made the whole window draggable, you must also mark
+buttons as non-draggable, otherwise it would be impossible for users to click on
+them:
+
+```css title='styles.css'
+button {
+ app-region: no-drag;
+}
+```
+
+If you're only setting a custom title bar as draggable, you also need to make all
+buttons in title bar non-draggable.
+
+### Tip: disable text selection
+
+When creating a draggable region, the dragging behavior may conflict with text selection.
+For example, when you drag the title bar, you may accidentally select its text contents.
+To prevent this, you need to disable text selection within a draggable area like this:
+
+```css
+.titlebar {
+ user-select: none;
+ app-region: drag;
+}
+```
+
+### Tip: disable context menus
+
+On some platforms, the draggable area will be treated as a non-client frame, so
+when you right click on it, a system menu will pop up. To make the context menu
+behave correctly on all platforms, you should never use a custom context menu on
+draggable areas.
+
+## Click-through windows
+
+To create a click-through window, i.e. making the window ignore all mouse
+events, you can call the [win.setIgnoreMouseEvents(ignore)][ignore-mouse-events]
+API:
+
+```js title='main.js'
+const { BrowserWindow } = require('electron')
+const win = new BrowserWindow()
+win.setIgnoreMouseEvents(true)
+```
+
+### Forward mouse events _macOS_ _Windows_
+
+Ignoring mouse messages makes the web contents oblivious to mouse movement,
+meaning that mouse movement events will not be emitted. On Windows and macOS, an
+optional parameter can be used to forward mouse move messages to the web page,
+allowing events such as `mouseleave` to be emitted:
+
+```js title='main.js'
+const { BrowserWindow, ipcMain } = require('electron')
+const path = require('node:path')
+
+const win = new BrowserWindow({
+ webPreferences: {
+ preload: path.join(__dirname, 'preload.js')
+ }
+})
+
+ipcMain.on('set-ignore-mouse-events', (event, ignore, options) => {
+ const win = BrowserWindow.fromWebContents(event.sender)
+ win.setIgnoreMouseEvents(ignore, options)
+})
+```
+
+```js title='preload.js'
+window.addEventListener('DOMContentLoaded', () => {
+ const el = document.getElementById('clickThroughElement')
+ el.addEventListener('mouseenter', () => {
+ ipcRenderer.send('set-ignore-mouse-events', true, { forward: true })
+ })
+ el.addEventListener('mouseleave', () => {
+ ipcRenderer.send('set-ignore-mouse-events', false)
+ })
+})
+```
+
+This makes the web page click-through when over the `#clickThroughElement` element,
+and returns to normal outside it.
+
+[ignore-mouse-events]: ../api/browser-window.md#winsetignoremouseeventsignore-options
diff --git a/docs/tutorial/custom-window-styles.md b/docs/tutorial/custom-window-styles.md
new file mode 100644
index 0000000000..0dd641ce61
--- /dev/null
+++ b/docs/tutorial/custom-window-styles.md
@@ -0,0 +1,49 @@
+# Custom Window Styles
+
+## Frameless windows
+
+
+
+A frameless window removes all [chrome][] applied by the OS, including window controls.
+
+To create a frameless window, set the [`BaseWindowContructorOptions`][] `frame` param in the `BrowserWindow` constructor to `false`.
+
+```fiddle docs/fiddles/features/window-customization/custom-window-styles/frameless-windows
+
+```
+
+## Transparent windows
+
+
+
+
+To create a fully transparent window, set the [`BaseWindowContructorOptions`][] `transparent` param in the `BrowserWindow` constructor to `true`.
+
+The following fiddle takes advantage of a tranparent window and CSS styling to create
+the illusion of a circular window.
+
+```fiddle docs/fiddles/features/window-customization/custom-window-styles/transparent-windows
+
+```
+
+### Limitations
+
+* You cannot click through the transparent area. See
+ [#1335](https://github.com/electron/electron/issues/1335) for details.
+* Transparent windows are not resizable. Setting `resizable` to `true` may make
+ a transparent window stop working on some platforms.
+* The CSS [`blur()`][] filter only applies to the window's web contents, so there is
+ no way to apply blur effect to the content below the window (i.e. other applications
+ open on the user's system).
+* The window will not be transparent when DevTools is opened.
+* On _Windows_:
+ * Transparent windows will not work when DWM is disabled.
+ * Transparent windows can not be maximized using the Windows system menu or by double
+ clicking the title bar. The reasoning behind this can be seen on
+ PR [#28207](https://github.com/electron/electron/pull/28207).
+* On _macOS_:
+ * The native window shadow will not be shown on a transparent window.
+
+[`BaseWindowContructorOptions`]: ../api/structures/base-window-options.md
+[`blur()`]: https://developer.mozilla.org/en-US/docs/Web/CSS/filter-function/blur()
+[chrome]: https://developer.mozilla.org/en-US/docs/Glossary/Chrome
diff --git a/docs/tutorial/window-customization.md b/docs/tutorial/window-customization.md
index bb35aa5249..71840bdaec 100644
--- a/docs/tutorial/window-customization.md
+++ b/docs/tutorial/window-customization.md
@@ -1,269 +1,17 @@
# Window Customization
-The `BrowserWindow` module is the foundation of your Electron application, and it exposes
-many APIs that can change the look and behavior of your browser windows. In this
-tutorial, we will be going over the various use-cases for window customization on
-macOS, Windows, and Linux.
-
-## Create frameless windows
-
-A frameless window is a window that has no [chrome][]. Not to be confused with the Google
-Chrome browser, window _chrome_ refers to the parts of the window (e.g. toolbars, controls)
-that are not a part of the web page.
-
-To create a frameless window, you need to set `frame` to `false` in the `BrowserWindow`
-constructor.
-
-```js title='main.js'
-const { BrowserWindow } = require('electron')
-const win = new BrowserWindow({ frame: false })
-```
-
-## Apply custom title bar styles _macOS_ _Windows_
-
-Title bar styles allow you to hide most of a BrowserWindow's chrome while keeping the
-system's native window controls intact and can be configured with the `titleBarStyle`
-option in the `BrowserWindow` constructor.
-
-Applying the `hidden` title bar style results in a hidden title bar and a full-size
-content window.
-
-```js title='main.js'
-const { BrowserWindow } = require('electron')
-const win = new BrowserWindow({ titleBarStyle: 'hidden' })
-```
-
-### Control the traffic lights _macOS_
-
-On macOS, applying the `hidden` title bar style will still expose the standard window
-controls (“traffic lights”) in the top left.
-
-#### Customize the look of your traffic lights _macOS_
-
-The `customButtonsOnHover` title bar style will hide the traffic lights until you hover
-over them. This is useful if you want to create custom traffic lights in your HTML but still
-use the native UI to control the window.
-
-```js
-const { BrowserWindow } = require('electron')
-const win = new BrowserWindow({ titleBarStyle: 'customButtonsOnHover' })
-```
-
-#### Customize the traffic light position _macOS_
-
-To modify the position of the traffic light window controls, there are two configuration
-options available.
-
-Applying `hiddenInset` title bar style will shift the vertical inset of the traffic lights
-by a fixed amount.
-
-```js title='main.js'
-const { BrowserWindow } = require('electron')
-const win = new BrowserWindow({ titleBarStyle: 'hiddenInset' })
-```
-
-If you need more granular control over the positioning of the traffic lights, you can pass
-a set of coordinates to the `trafficLightPosition` option in the `BrowserWindow`
-constructor.
-
-```js title='main.js'
-const { BrowserWindow } = require('electron')
-const win = new BrowserWindow({
- titleBarStyle: 'hidden',
- trafficLightPosition: { x: 10, y: 10 }
-})
-```
-
-#### Show and hide the traffic lights programmatically _macOS_
-
-You can also show and hide the traffic lights programmatically from the main process.
-The `win.setWindowButtonVisibility` forces traffic lights to be show or hidden depending
-on the value of its boolean parameter.
-
-```js title='main.js'
-const { BrowserWindow } = require('electron')
-const win = new BrowserWindow()
-// hides the traffic lights
-win.setWindowButtonVisibility(false)
-```
-
-> Note: Given the number of APIs available, there are many ways of achieving this. For instance,
-> combining `frame: false` with `win.setWindowButtonVisibility(true)` will yield the same
-> layout outcome as setting `titleBarStyle: 'hidden'`.
-
-## Window Controls Overlay
-
-The [Window Controls Overlay API][] is a web standard that gives web apps the ability to
-customize their title bar region when installed on desktop. Electron exposes this API
-through the `BrowserWindow` constructor option `titleBarOverlay`.
-
-This option only works whenever a custom `titlebarStyle` is applied.
-When `titleBarOverlay` is enabled, the window controls become exposed in their default
-position, and DOM elements cannot use the area underneath this region.
-
-The `titleBarOverlay` option accepts two different value formats.
-
-Specifying `true` on either platform will result in an overlay region with default
-system colors:
-
-```js title='main.js'
-const { BrowserWindow } = require('electron')
-const win = new BrowserWindow({
- titleBarStyle: 'hidden',
- titleBarOverlay: true
-})
-```
-
-On either platform `titleBarOverlay` can also be an object. The height of the overlay can be specified with the `height` property. On Windows and Linux, the color of the overlay and can be specified using the `color` property. On Windows and Linux, the color of the overlay and its symbols can be specified using the `color` and `symbolColor` properties respectively. The `rgba()`, `hsla()`, and `#RRGGBBAA` color formats are supported to apply transparency.
-
-If a color option is not specified, the color will default to its system color for the window control buttons. Similarly, if the height option is not specified it will default to the default height:
-
-```js title='main.js'
-const { BrowserWindow } = require('electron')
-const win = new BrowserWindow({
- titleBarStyle: 'hidden',
- titleBarOverlay: {
- color: '#2f3241',
- symbolColor: '#74b1be',
- height: 60
- }
-})
-```
-
-> Note: Once your title bar overlay is enabled from the main process, you can access the overlay's
-> color and dimension values from a renderer using a set of readonly
-> [JavaScript APIs][overlay-javascript-apis] and [CSS Environment Variables][overlay-css-env-vars].
-
-## Create transparent windows
-
-By setting the `transparent` option to `true`, you can make a fully transparent window.
-
-```js title='main.js'
-const { BrowserWindow } = require('electron')
-const win = new BrowserWindow({ transparent: true })
-```
-
-### Limitations
-
-* You cannot click through the transparent area. See
- [#1335](https://github.com/electron/electron/issues/1335) for details.
-* Transparent windows are not resizable. Setting `resizable` to `true` may make
- a transparent window stop working on some platforms.
-* The CSS [`blur()`][] filter only applies to the window's web contents, so there is no way to apply
- blur effect to the content below the window (i.e. other applications open on
- the user's system).
-* The window will not be transparent when DevTools is opened.
-* On _Windows_:
- * Transparent windows will not work when DWM is disabled.
- * Transparent windows can not be maximized using the Windows system menu or by double
- clicking the title bar. The reasoning behind this can be seen on
- PR [#28207](https://github.com/electron/electron/pull/28207).
-* On _macOS_:
- * The native window shadow will not be shown on a transparent window.
-
-## Create click-through windows
-
-To create a click-through window, i.e. making the window ignore all mouse
-events, you can call the [win.setIgnoreMouseEvents(ignore)][ignore-mouse-events]
-API:
-
-```js title='main.js'
-const { BrowserWindow } = require('electron')
-const win = new BrowserWindow()
-win.setIgnoreMouseEvents(true)
-```
-
-### Forward mouse events _macOS_ _Windows_
-
-Ignoring mouse messages makes the web contents oblivious to mouse movement,
-meaning that mouse movement events will not be emitted. On Windows and macOS, an
-optional parameter can be used to forward mouse move messages to the web page,
-allowing events such as `mouseleave` to be emitted:
-
-```js title='main.js'
-const { BrowserWindow, ipcMain } = require('electron')
-const path = require('node:path')
-
-const win = new BrowserWindow({
- webPreferences: {
- preload: path.join(__dirname, 'preload.js')
- }
-})
-
-ipcMain.on('set-ignore-mouse-events', (event, ignore, options) => {
- const win = BrowserWindow.fromWebContents(event.sender)
- win.setIgnoreMouseEvents(ignore, options)
-})
-```
-
-```js title='preload.js'
-window.addEventListener('DOMContentLoaded', () => {
- const el = document.getElementById('clickThroughElement')
- el.addEventListener('mouseenter', () => {
- ipcRenderer.send('set-ignore-mouse-events', true, { forward: true })
- })
- el.addEventListener('mouseleave', () => {
- ipcRenderer.send('set-ignore-mouse-events', false)
- })
-})
-```
-
-This makes the web page click-through when over the `#clickThroughElement` element,
-and returns to normal outside it.
-
-## Set custom draggable region
-
-By default, the frameless window is non-draggable. Apps need to specify
-`-webkit-app-region: drag` in CSS to tell Electron which regions are draggable
-(like the OS's standard titlebar), and apps can also use
-`-webkit-app-region: no-drag` to exclude the non-draggable area from the
- draggable region. Note that only rectangular shapes are currently supported.
-
-To make the whole window draggable, you can add `-webkit-app-region: drag` as
-`body`'s style:
-
-```css title='styles.css'
-body {
- -webkit-app-region: drag;
-}
-```
-
-And note that if you have made the whole window draggable, you must also mark
-buttons as non-draggable, otherwise it would be impossible for users to click on
-them:
-
-```css title='styles.css'
-button {
- -webkit-app-region: no-drag;
-}
-```
-
-If you're only setting a custom titlebar as draggable, you also need to make all
-buttons in titlebar non-draggable.
-
-### Tip: disable text selection
-
-When creating a draggable region, the dragging behavior may conflict with text selection.
-For example, when you drag the titlebar, you may accidentally select its text contents.
-To prevent this, you need to disable text selection within a draggable area like this:
-
-```css
-.titlebar {
- -webkit-user-select: none;
- -webkit-app-region: drag;
-}
-```
-
-### Tip: disable context menus
-
-On some platforms, the draggable area will be treated as a non-client frame, so
-when you right click on it, a system menu will pop up. To make the context menu
-behave correctly on all platforms, you should never use a custom context menu on
-draggable areas.
-
-[`blur()`]: https://developer.mozilla.org/en-US/docs/Web/CSS/filter-function/blur()
-[chrome]: https://developer.mozilla.org/en-US/docs/Glossary/Chrome
-[ignore-mouse-events]: ../api/browser-window.md#winsetignoremouseeventsignore-options
-[overlay-css-env-vars]: https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#css-environment-variables
-[overlay-javascript-apis]: https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#javascript-apis
-[Window Controls Overlay API]: https://github.com/WICG/window-controls-overlay/blob/main/explainer.md
+The [`BrowserWindow`][] module is the foundation of your Electron application, and
+it exposes many APIs that let you customize the look and behavior of your app’s windows.
+This section covers how to implement various use cases for window customization on macOS,
+Windows, and Linux.
+
+:::info
+`BrowserWindow` is a subclass of the [`BaseWindow`][] module. Both modules allow
+you to create and manage application windows in Electron, with the main difference
+being that `BrowserWindow` supports a single, full size web view while `BaseWindow`
+supports composing many web views. `BaseWindow` can be used interchangeably with `BrowserWindow`
+in the examples of the documents in this section.
+:::
+
+[`BaseWindow`]: ../api/base-window.md
+[`BrowserWindow`]: ../api/browser-window.md
|
docs
|
5fc3ed936e7ee5f3258782c0a0312cd9a2ebb174
|
Raymond Zhao
|
2022-11-09 07:50:43
|
feat: add app.getPreferredSystemLanguages() API (#36035)
* feat: add app.getSystemLanguage() API
* Change the API to getPreferredSystemLanguages
* Fix test
* Clarify docs and add Linux impl
* Remove USE_GLIB
* Don't add C to list
* Remove examples since there's a lot of edge cases
* Fix lint
* Add examples
* Fix compile error
* Apply PR feedback
* Update the example
|
diff --git a/docs/api/app.md b/docs/api/app.md
index 202ce053e4..418c3504c3 100755
--- a/docs/api/app.md
+++ b/docs/api/app.md
@@ -717,6 +717,8 @@ To set the locale, you'll want to use a command line switch at app startup, whic
**Note:** This API must be called after the `ready` event is emitted.
+**Note:** To see example return values of this API compared to other locale and language APIs, see [`app.getPreferredSystemLanguages()`](#appgetpreferredsystemlanguages).
+
### `app.getLocaleCountryCode()`
Returns `string` - User operating system's locale two-letter [ISO 3166](https://www.iso.org/iso-3166-country-codes.html) country code. The value is taken from native OS APIs.
@@ -725,10 +727,42 @@ Returns `string` - User operating system's locale two-letter [ISO 3166](https://
### `app.getSystemLocale()`
-Returns `string` - The current system locale. On Windows and Linux, it is fetched using Chromium's `i18n` library. On macOS, the `NSLocale` object is used instead.
+Returns `string` - The current system locale. On Windows and Linux, it is fetched using Chromium's `i18n` library. On macOS, `[NSLocale currentLocale]` is used instead. To get the user's current system language, which is not always the same as the locale, it is better to use [`app.getPreferredSystemLanguages()`](#appgetpreferredsystemlanguages).
+
+Different operating systems also use the regional data differently:
+
+* Windows 11 uses the regional format for numbers, dates, and times.
+* macOS Monterey uses the region for formatting numbers, dates, times, and for selecting the currency symbol to use.
+
+Therefore, this API can be used for purposes such as choosing a format for rendering dates and times in a calendar app, especially when the developer wants the format to be consistent with the OS.
**Note:** This API must be called after the `ready` event is emitted.
+**Note:** To see example return values of this API compared to other locale and language APIs, see [`app.getPreferredSystemLanguages()`](#appgetpreferredsystemlanguages).
+
+### `app.getPreferredSystemLanguages()`
+
+Returns `string[]` - The user's preferred system languages from most preferred to least preferred, including the country codes if applicable. A user can modify and add to this list on Windows or macOS through the Language and Region settings.
+
+The API uses `GlobalizationPreferences` (with a fallback to `GetSystemPreferredUILanguages`) on Windows, `\[NSLocale preferredLanguages\]` on macOS, and `g_get_language_names` on Linux.
+
+This API can be used for purposes such as deciding what language to present the application in.
+
+Here are some examples of return values of the various language and locale APIs with different configurations:
+
+* For Windows, where the application locale is German, the regional format is Finnish (Finland), and the preferred system languages from most to least preferred are French (Canada), English (US), Simplified Chinese (China), Finnish, and Spanish (Latin America):
+ * `app.getLocale()` returns `'de'`
+ * `app.getSystemLocale()` returns `'fi-FI'`
+ * `app.getPreferredSystemLanguages()` returns `['fr-CA', 'en-US', 'zh-Hans-CN', 'fi', 'es-419']`
+* On macOS, where the application locale is German, the region is Finland, and the preferred system languages from most to least preferred are French (Canada), English (US), Simplified Chinese, and Spanish (Latin America):
+ * `app.getLocale()` returns `'de'`
+ * `app.getSystemLocale()` returns `'fr-FI'`
+ * `app.getPreferredSystemLanguages()` returns `['fr-CA', 'en-US', 'zh-Hans-FI', 'es-419']`
+
+Both the available languages and regions and the possible return values differ between the two operating systems.
+
+As can be seen with the example above, on Windows, it is possible that a preferred system language has no country code, and that one of the preferred system languages corresponds with the language used for the regional format. On macOS, the region serves more as a default country code: the user doesn't need to have Finnish as a preferred language to use Finland as the region,and the country code `FI` is used as the country code for preferred system languages that do not have associated countries in the language name.
+
### `app.addRecentDocument(path)` _macOS_ _Windows_
* `path` string
diff --git a/shell/browser/api/electron_api_app.cc b/shell/browser/api/electron_api_app.cc
index 319b59fab5..e278785c88 100644
--- a/shell/browser/api/electron_api_app.cc
+++ b/shell/browser/api/electron_api_app.cc
@@ -67,6 +67,7 @@
#include "shell/common/gin_converters/value_converter.h"
#include "shell/common/gin_helper/dictionary.h"
#include "shell/common/gin_helper/object_template_builder.h"
+#include "shell/common/language_util.h"
#include "shell/common/node_includes.h"
#include "shell/common/options_switches.h"
#include "shell/common/platform_util.h"
@@ -1803,6 +1804,7 @@ gin::ObjectTemplateBuilder App::GetObjectTemplateBuilder(v8::Isolate* isolate) {
.SetMethod("setAppLogsPath", &App::SetAppLogsPath)
.SetMethod("setDesktopName", &App::SetDesktopName)
.SetMethod("getLocale", &App::GetLocale)
+ .SetMethod("getPreferredSystemLanguages", &GetPreferredLanguages)
.SetMethod("getSystemLocale", &App::GetSystemLocale)
.SetMethod("getLocaleCountryCode", &App::GetLocaleCountryCode)
#if BUILDFLAG(USE_NSS_CERTS)
diff --git a/shell/common/language_util_linux.cc b/shell/common/language_util_linux.cc
index 76bc557741..58754f80ef 100644
--- a/shell/common/language_util_linux.cc
+++ b/shell/common/language_util_linux.cc
@@ -4,14 +4,31 @@
#include "shell/common/language_util.h"
-#include "ui/base/l10n/l10n_util.h"
+#include <glib.h>
+
+#include "base/check.h"
+#include "base/i18n/rtl.h"
namespace electron {
std::vector<std::string> GetPreferredLanguages() {
- // Return empty as there's no API to use. You may be able to use
- // GetApplicationLocale() of a browser process.
- return std::vector<std::string>{};
+ std::vector<std::string> preferredLanguages;
+
+ // Based on
+ // https://source.chromium.org/chromium/chromium/src/+/refs/tags/108.0.5329.0:ui/base/l10n/l10n_util.cc;l=543-554
+ // GLib implements correct environment variable parsing with
+ // the precedence order: LANGUAGE, LC_ALL, LC_MESSAGES and LANG.
+ const char* const* languages = g_get_language_names();
+ DCHECK(languages); // A valid pointer is guaranteed.
+ DCHECK(*languages); // At least one entry, "C", is guaranteed.
+
+ for (; *languages; ++languages) {
+ if (strcmp(*languages, "C") != 0) {
+ preferredLanguages.push_back(base::i18n::GetCanonicalLocale(*languages));
+ }
+ }
+
+ return preferredLanguages;
}
} // namespace electron
diff --git a/spec/api-app-spec.ts b/spec/api-app-spec.ts
index 60f51fbe1b..259ff09a36 100644
--- a/spec/api-app-spec.ts
+++ b/spec/api-app-spec.ts
@@ -124,6 +124,19 @@ describe('app module', () => {
});
});
+ describe('app.getPreferredSystemLanguages()', () => {
+ ifit(process.platform !== 'linux')('should not be empty', () => {
+ expect(app.getPreferredSystemLanguages().length).to.not.equal(0);
+ });
+
+ ifit(process.platform === 'linux')('should be empty or contain C entry', () => {
+ const languages = app.getPreferredSystemLanguages();
+ if (languages.length) {
+ expect(languages).to.not.include('C');
+ }
+ });
+ });
+
describe('app.getLocaleCountryCode()', () => {
it('should be empty or have length of two', () => {
const localeCountryCode = app.getLocaleCountryCode();
diff --git a/spec/chromium-spec.ts b/spec/chromium-spec.ts
index 1bda056527..53281f6604 100644
--- a/spec/chromium-spec.ts
+++ b/spec/chromium-spec.ts
@@ -375,6 +375,7 @@ describe('command line switches', () => {
describe('--lang switch', () => {
const currentLocale = app.getLocale();
const currentSystemLocale = app.getSystemLocale();
+ const currentPreferredLanguages = JSON.stringify(app.getPreferredSystemLanguages());
const testLocale = async (locale: string, result: string, printEnv: boolean = false) => {
const appPath = path.join(fixturesPath, 'api', 'locale-check');
const args = [appPath, `--set-lang=${locale}`];
@@ -397,9 +398,9 @@ describe('command line switches', () => {
expect(output).to.equal(result);
};
- it('should set the locale', async () => testLocale('fr', `fr|${currentSystemLocale}`));
- it('should set the locale with country code', async () => testLocale('zh-CN', `zh-CN|${currentSystemLocale}`));
- it('should not set an invalid locale', async () => testLocale('asdfkl', `${currentLocale}|${currentSystemLocale}`));
+ it('should set the locale', async () => testLocale('fr', `fr|${currentSystemLocale}|${currentPreferredLanguages}`));
+ it('should set the locale with country code', async () => testLocale('zh-CN', `zh-CN|${currentSystemLocale}|${currentPreferredLanguages}`));
+ it('should not set an invalid locale', async () => testLocale('asdfkl', `${currentLocale}|${currentSystemLocale}|${currentPreferredLanguages}`));
const lcAll = String(process.env.LC_ALL);
ifit(process.platform === 'linux')('current process has a valid LC_ALL env', async () => {
diff --git a/spec/fixtures/api/locale-check/main.js b/spec/fixtures/api/locale-check/main.js
index dd4e6317db..69bbdd583c 100644
--- a/spec/fixtures/api/locale-check/main.js
+++ b/spec/fixtures/api/locale-check/main.js
@@ -9,7 +9,7 @@ app.whenReady().then(() => {
if (process.argv[3] === '--print-env') {
process.stdout.write(String(process.env.LC_ALL));
} else {
- process.stdout.write(`${app.getLocale()}|${app.getSystemLocale()}`);
+ process.stdout.write(`${app.getLocale()}|${app.getSystemLocale()}|${JSON.stringify(app.getPreferredSystemLanguages())}`);
}
process.stdout.end();
|
feat
|
fb461effae97ad10a802fc6c06f1f8d360ca2f5e
|
Jeremy Rose
|
2022-12-14 13:06:10
|
chore: cherry-pick 32b7dc86a763 from v8 (#36651)
* chore: cherry-pick 32b7dc86a763 from v8
* chore: update patches
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <[email protected]>
|
diff --git a/patches/v8/.patches b/patches/v8/.patches
index 4c5e530a4b..fef333e605 100644
--- a/patches/v8/.patches
+++ b/patches/v8/.patches
@@ -9,3 +9,4 @@ fix_disable_implies_dcheck_for_node_stream_array_buffers.patch
revert_runtime_dhceck_terminating_exception_in_microtasks.patch
chore_disable_is_execution_terminating_dcheck.patch
force_cppheapcreateparams_to_be_noncopyable.patch
+cherry-pick-32b7dc86a763.patch
diff --git a/patches/v8/cherry-pick-32b7dc86a763.patch b/patches/v8/cherry-pick-32b7dc86a763.patch
new file mode 100644
index 0000000000..c6cd67e67b
--- /dev/null
+++ b/patches/v8/cherry-pick-32b7dc86a763.patch
@@ -0,0 +1,65 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Igor Sheludko <[email protected]>
+Date: Thu, 1 Dec 2022 16:05:49 +0100
+Subject: Fix DCHECKs in VisitSpillSlot
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+... to match new encoding of the forwarding pointers.
+
+Bug: v8:11880, chromium:1393256
+Change-Id: I8bc8183c22ef8933c02470d5c8ed77cf83489e0f
+Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4069706
+Commit-Queue: Igor Sheludko <[email protected]>
+Auto-Submit: Igor Sheludko <[email protected]>
+Reviewed-by: Dominik Inführ <[email protected]>
+Cr-Commit-Position: refs/heads/main@{#84601}
+
+diff --git a/src/execution/frames.cc b/src/execution/frames.cc
+index 5065f5fe3bab7d8a9aca3db98754339ed86b0907..6dfdda7059cafb8a5bf597cd61b46fdb3177ddeb 100644
+--- a/src/execution/frames.cc
++++ b/src/execution/frames.cc
+@@ -1119,8 +1119,8 @@ void VisitSpillSlot(Isolate* isolate, RootVisitor* v,
+ ? map_word.ToForwardingAddress(raw)
+ : raw;
+ bool is_self_forwarded =
+- forwarded.map_word(cage_base, kRelaxedLoad).ptr() ==
+- forwarded.address();
++ forwarded.map_word(cage_base, kRelaxedLoad) ==
++ MapWord::FromForwardingAddress(forwarded, forwarded);
+ if (is_self_forwarded) {
+ // The object might be in a self-forwarding state if it's located
+ // in new large object space. GC will fix this at a later stage.
+diff --git a/src/objects/objects.h b/src/objects/objects.h
+index a40a169ce5d2b14e4b973cc1c5e6b4d986cbb314..2fa31a912c75a832cc0e051dfd54f4cd1ac50a79 100644
+--- a/src/objects/objects.h
++++ b/src/objects/objects.h
+@@ -904,7 +904,17 @@ class MapWord {
+ // View this map word as a forwarding address.
+ inline HeapObject ToForwardingAddress(HeapObject map_word_host);
+
+- inline Address ptr() { return value_; }
++ constexpr inline Address ptr() const { return value_; }
++
++ // When pointer compression is enabled, MapWord is uniquely identified by
++ // the lower 32 bits. On the other hand full-value comparison is not correct
++ // because map word in a forwarding state might have corrupted upper part.
++ constexpr bool operator==(MapWord other) const {
++ return static_cast<Tagged_t>(ptr()) == static_cast<Tagged_t>(other.ptr());
++ }
++ constexpr bool operator!=(MapWord other) const {
++ return static_cast<Tagged_t>(ptr()) != static_cast<Tagged_t>(other.ptr());
++ }
+
+ #ifdef V8_MAP_PACKING
+ static constexpr Address Pack(Address map) {
+@@ -929,7 +939,7 @@ class MapWord {
+ template <typename TFieldType, int kFieldOffset, typename CompressionScheme>
+ friend class TaggedField;
+
+- explicit MapWord(Address value) : value_(value) {}
++ explicit constexpr MapWord(Address value) : value_(value) {}
+
+ Address value_;
+ };
|
chore
|
f61425efdb1357795a2c05a80923e2064158002b
|
Shelley Vohr
|
2023-07-13 22:59:14
|
fix: `clipboard.readImage()` should be synchronous (#39069)
* feat: clipboard.readImage returns a Promise
* chore: update breaking changes doc
* fix: make function synchronous
* Update docs/api/native-image.md
Co-authored-by: John Kleinschmidt <[email protected]>
---------
Co-authored-by: John Kleinschmidt <[email protected]>
|
diff --git a/shell/common/api/electron_api_clipboard.cc b/shell/common/api/electron_api_clipboard.cc
index 7685369fc1..0db9fabb29 100644
--- a/shell/common/api/electron_api_clipboard.cc
+++ b/shell/common/api/electron_api_clipboard.cc
@@ -7,6 +7,7 @@
#include <map>
#include "base/containers/contains.h"
+#include "base/run_loop.h"
#include "base/strings/utf_string_conversions.h"
#include "shell/common/gin_converters/image_converter.h"
#include "shell/common/gin_helper/dictionary.h"
@@ -221,17 +222,23 @@ void Clipboard::WriteBookmark(const std::u16string& title,
gfx::Image Clipboard::ReadImage(gin_helper::Arguments* args) {
ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread();
absl::optional<gfx::Image> image;
+
+ base::RunLoop run_loop;
+ base::RepeatingClosure callback = run_loop.QuitClosure();
clipboard->ReadPng(
GetClipboardBuffer(args),
/* data_dst = */ nullptr,
base::BindOnce(
- [](absl::optional<gfx::Image>* image,
+ [](absl::optional<gfx::Image>* image, base::RepeatingClosure cb,
const std::vector<uint8_t>& result) {
SkBitmap bitmap;
gfx::PNGCodec::Decode(result.data(), result.size(), &bitmap);
image->emplace(gfx::Image::CreateFrom1xBitmap(bitmap));
+ std::move(cb).Run();
},
- &image));
+ &image, std::move(callback)));
+ run_loop.Run();
+
DCHECK(image.has_value());
return image.value();
}
|
fix
|
398ca2a0190d6c86d908a71c887260bf13ef5e2b
|
marekharanczyk
|
2024-02-05 08:36:51
|
fix: make sure invalid URL loads promises are fulfilled. (#41194)
* fix: make sure invalid URL loads promisses are fulfilled.
* fixup! fix: make sure invalid URL loads promisses are fulfilled.
|
diff --git a/lib/browser/api/web-contents.ts b/lib/browser/api/web-contents.ts
index 7fcd5dec3f..070db86390 100644
--- a/lib/browser/api/web-contents.ts
+++ b/lib/browser/api/web-contents.ts
@@ -366,11 +366,6 @@ WebContents.prototype.loadURL = function (url, options) {
resolveAndCleanup();
}
};
- const failListener = (event: Electron.Event, errorCode: number, errorDescription: string, validatedURL: string, isMainFrame: boolean) => {
- if (!error && isMainFrame) {
- error = { errorCode, errorDescription, url: validatedURL };
- }
- };
let navigationStarted = false;
let browserInitiatedInPageNavigation = false;
@@ -392,6 +387,14 @@ WebContents.prototype.loadURL = function (url, options) {
navigationStarted = true;
}
};
+ const failListener = (event: Electron.Event, errorCode: number, errorDescription: string, validatedURL: string, isMainFrame: boolean) => {
+ if (!error && isMainFrame) {
+ error = { errorCode, errorDescription, url: validatedURL };
+ }
+ if (!navigationStarted && isMainFrame) {
+ finishListener();
+ }
+ };
const stopLoadingListener = () => {
// By the time we get here, either 'finish' or 'fail' should have fired
// if the navigation occurred. However, in some situations (e.g. when
diff --git a/spec/api-web-contents-spec.ts b/spec/api-web-contents-spec.ts
index 12f1c623fd..4f6185dd4c 100644
--- a/spec/api-web-contents-spec.ts
+++ b/spec/api-web-contents-spec.ts
@@ -519,6 +519,10 @@ describe('webContents module', () => {
await expect(w.loadURL('file:non-existent')).to.eventually.be.rejected();
await expect(w.loadURL('file:non-existent')).to.eventually.be.rejected();
});
+
+ it('invalid URL load rejects', async () => {
+ await expect(w.loadURL('invalidURL')).to.eventually.be.rejected();
+ });
});
describe('getFocusedWebContents() API', () => {
|
fix
|
30e992dec4ca1c7b33c2bda1b4353072a9621aa7
|
Charles Kerr
|
2023-05-23 14:58:58
|
chore: bump chromium to 115.0.5786.0 (main) (#38301)
* chore: bump chromium in DEPS to 115.0.5772.0
* chore: update disable_color_correct_rendering.patch
no manual changes; patch succeeded with fuzz 2.
* chore: update chromium/build_libc_as_static_library.patch
no manual changes; patch succeeded with fuzz 2 (offset 1 line).
* chore: update chromium/feat_configure_launch_options_for_service_process.patch
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4518747
patch manually reapplied due to upstream code shear
* chore: update chromium/chore_patch_out_profile_methods_in_profile_selections_cc.patch
https://chromium-review.googlesource.com/c/chromium/src/+/4502965
patch manually reapplied due to upstream code shear
* chore: update bundle_locations #include location
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4525355
* chore: Remove `extension_name` from DesktopStreamsRegistry
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4514081
* chore: bump chromium in DEPS to 115.0.5778.0
* chore: add chromium/chore_patch_out_profile_methods_in_chrome_browser_pdf.patch
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4482679
Another instance of patching out upstream references to Profile code
* refactor: add WebViewGuestDelegate::GetGuestDelegateWeakPtr()
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4515455
This approach copied from GuestViewBase::GetGuestDelegateWeakPtr() approach in that same commit.
* fixup! chore: update bundle_locations #include location
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4525355
Sync namespace use to upstream base::mac -> base::apple changes
* fixup! chore: update bundle_locations #include location
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4525355
Sync namespace use to upstream base::mac -> base::apple changes
* chore: update chromium/mas_disable_remote_accessibility.patch
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4530546
patch manually reapplied due to upstream code shear
* chore: update chromium/printing.patch
no manual changes; patch succeeded with fuzz
* chore: update chromium/build_add_electron_tracing_category.patch
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4517872
no manual changes; patch succeeded with fuzz
* chore: update chromium/feat_ensure_mas_builds_of_the_same_application_can_use_safestorage.patch
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4529098
patch manually reapplied due to upstream code shear
* chromium/build_only_use_the_mas_build_config_in_the_required_components.patch
https://chromium-review.googlesource.com/c/chromium/src/+/4529098
patch manually reapplied due to upstream code shear
* chore: update chromium/mas-cgdisplayusesforcetogray.patch
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4529475
no manual changes; patch succeeded with fuzz
* chore: update chromium/build_only_use_the_mas_build_config_in_the_required_components.patch
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4429011
no manual changes; patch succeeded with fuzz
* chore: remove chromium/cherry-pick-48a136e77e6d.patch
already present upstream
* chore: remove chromium/cherry-pick-e6e23ba00379.patch
already present upstream
* [Code Health] Remove value based RegisterPref for Dict and List
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4533537
* Remove `cxx17_backports.h` and adjust unittest file
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4534916
Notes: mostly just removing #include and s/base::clamp/std::clamp/
* refactor: add FakeBrowserProcess helper class
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4424072
Used in ElectronBrowserMainParts' fake_browser_process_ field. Previously
this was an BrowserProcessImpl instance, but upstream 4424072 makes that
an abstract base class. `FakeBrowserProcess` is a thin subclass with the
minimum code needed to make it concrete.
`ElectronBrowserMainParts::fake_browser_process_` is now a `shared_ptr`
instead of a `unique_ptr` so we can avoid exposing `FakeBrowserProcess`
in the header.
* fixup! refactor: add FakeBrowserProcess helper class
remove unnecessary unique_ptr
* fix: Browser::SetDockIcon() when !Browser.is_ready()
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4410741
An alternative fix for https://github.com/electron/electron/pull/36279 .
The previous fix was to call `SetSupportedScales()` ourselves (1b1609a),
but upstream has removed this API.
CC @codebytere
* fixup! chore: remove chromium/cherry-pick-e6e23ba00379.patch
* chore: update chromium/export_gin_v8platform_pageallocator_for_usage_outside_of_the_gin.patch
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4517404
patch manually reapplied due to upstream code shear
* chore: update patches
* chore: add dep: resource_coordinator:mojo_bindings
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4521464
* fixup! chore: add dep: resource_coordinator:mojo_bindings
chore: make lint happy
* chore: patch out Profile methods in titlebar_config
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4508143 (primary)
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4534461 (followup)
* chore: bump chromium in DEPS to 115.0.5780.0
* chore: update chromium/disable_hidden.patch
no manual changes; patch succeeded with fuzz
* chore: update chromium/sysroot.patch
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4535715
no manual changes; patch succeeded with fuzz
* chore: update chromium/feat_enable_offscreen_rendering_with_viz_compositor.patch
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4403623
patch manually reapplied due to upstream code shear
* chore: update chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4547380
patch manually reapplied due to upstream code shear
* chore: update patches
* fixup! fix: Browser::SetDockIcon() when !Browser.is_ready()
chore: iwyu image.h
* chore: bump chromium in DEPS to 115.0.5782.0
* chore: bump chromium in DEPS to 115.0.5784.0
* 4514181: CR2023: Update filled cr-input styles.
https://chromium-review.googlesource.com/c/chromium/src/+/4514181
* 4521894: Remove SiteInstanceDeleting usage outside of tests.
https://chromium-review.googlesource.com/c/chromium/src/+/4521894
* 4525355: Move backup_util and bundle_locations to base/apple
https://chromium-review.googlesource.com/c/chromium/src/+/4525355
* 4484743: webauthn: add underlying support for calling iCloud Keychain on macOS.
https://chromium-review.googlesource.com/c/chromium/src/+/4484743
* chore: fixup patch indices
* 4546398: Convert /chrome/browser to use ARC
https://chromium-review.googlesource.com/c/chromium/src/+/4546398
* chore: bump chromium in DEPS to 115.0.5786.0
* chore: update patches
* 4540682: Initialize PDF SDK with policy in chrome_pdf::RenderPDFPageToDC()
https://chromium-review.googlesource.com/c/chromium/src/+/4540682
* Don't import ObjC++ fn headers into electron_api_app
* 4535715: Refactor sysroot-creator.sh
https://chromium-review.googlesource.com/c/chromium/src/+/4535715
* fixup! refactor: add FakeBrowserProcess helper class
* 4531903: [string][test] Create/Copy strings to old space before externalization
https://chromium-review.googlesource.com/c/v8/v8/+/4531903
* 59645: Add APIs to support RSA keys with large e.
https://boringssl-review.googlesource.com/c/boringssl/+/59645
---------
Co-authored-by: Shelley Vohr <[email protected]>
|
diff --git a/BUILD.gn b/BUILD.gn
index 79d0486752..362716ac14 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -555,6 +555,7 @@ source_set("electron_lib") {
}
frameworks = [
+ "AuthenticationServices.framework",
"AVFoundation.framework",
"Carbon.framework",
"LocalAuthentication.framework",
diff --git a/DEPS b/DEPS
index 655a18344c..95b0013514 100644
--- a/DEPS
+++ b/DEPS
@@ -2,7 +2,7 @@ gclient_gn_args_from = 'src'
vars = {
'chromium_version':
- '115.0.5760.0',
+ '115.0.5786.0',
'node_version':
'v18.16.0',
'nan_version':
diff --git a/chromium_src/BUILD.gn b/chromium_src/BUILD.gn
index 89011780c1..247338d5bd 100644
--- a/chromium_src/BUILD.gn
+++ b/chromium_src/BUILD.gn
@@ -157,7 +157,10 @@ static_library("chrome") {
"//services/strings",
]
- deps = [ "//chrome/browser:resource_prefetch_predictor_proto" ]
+ deps = [
+ "//chrome/browser:resource_prefetch_predictor_proto",
+ "//chrome/browser/resource_coordinator:mojo_bindings",
+ ]
if (is_linux) {
sources += [ "//chrome/browser/icon_loader_auralinux.cc" ]
diff --git a/patches/boringssl/revert_track_ssl_error_zero_return_explicitly.patch b/patches/boringssl/revert_track_ssl_error_zero_return_explicitly.patch
index 7538eaeb3a..8626416c64 100644
--- a/patches/boringssl/revert_track_ssl_error_zero_return_explicitly.patch
+++ b/patches/boringssl/revert_track_ssl_error_zero_return_explicitly.patch
@@ -48,10 +48,10 @@ index 838761af5cb8498d8bcb66b1a7a6f9c1a233cac7..b9bda24dd4d372485622ff99873ee34e
void SSL_CTX_set_tmp_rsa_callback(SSL_CTX *ctx,
RSA *(*cb)(SSL *ssl, int is_export,
diff --git a/ssl/ssl_test.cc b/ssl/ssl_test.cc
-index 1a06ba8458323c36f34fef517903807eb68e585d..4be9de27be025c859602ce54f08eabea438b3e9c 100644
+index be00e7c342759d3059d77cbfd938438df96b5c33..6e551c4d48d1633509dbb95a9619abaa84f84cb2 100644
--- a/ssl/ssl_test.cc
+++ b/ssl/ssl_test.cc
-@@ -8459,11 +8459,6 @@ TEST(SSLTest, ErrorSyscallAfterCloseNotify) {
+@@ -8558,11 +8558,6 @@ TEST(SSLTest, ErrorSyscallAfterCloseNotify) {
EXPECT_EQ(ret, 0);
EXPECT_EQ(SSL_get_error(client.get(), ret), SSL_ERROR_ZERO_RETURN);
@@ -63,7 +63,7 @@ index 1a06ba8458323c36f34fef517903807eb68e585d..4be9de27be025c859602ce54f08eabea
// Although the client has seen close_notify, it should continue to report
// |SSL_ERROR_SYSCALL| when its writes fail.
ret = SSL_write(client.get(), data, sizeof(data));
-@@ -8471,22 +8466,6 @@ TEST(SSLTest, ErrorSyscallAfterCloseNotify) {
+@@ -8570,22 +8565,6 @@ TEST(SSLTest, ErrorSyscallAfterCloseNotify) {
EXPECT_EQ(SSL_get_error(client.get(), ret), SSL_ERROR_SYSCALL);
EXPECT_TRUE(write_failed);
write_failed = false;
diff --git a/patches/chromium/.patches b/patches/chromium/.patches
index 711b02be73..2760d2a589 100644
--- a/patches/chromium/.patches
+++ b/patches/chromium/.patches
@@ -125,5 +125,6 @@ chore_patch_out_profile_methods_in_profile_selections_cc.patch
add_gin_converter_support_for_arraybufferview.patch
chore_defer_usb_service_getdevices_request_until_usb_service_is.patch
fix_remove_profiles_from_spellcheck_service.patch
-cherry-pick-48a136e77e6d.patch
-cherry-pick-e6e23ba00379.patch
+chore_patch_out_profile_methods_in_chrome_browser_pdf.patch
+chore_patch_out_profile_methods_in_titlebar_config.patch
+chore_temporarily_patch_out_arc_references.patch
diff --git a/patches/chromium/add_didinstallconditionalfeatures.patch b/patches/chromium/add_didinstallconditionalfeatures.patch
index 5d616c03ed..b15168d8aa 100644
--- a/patches/chromium/add_didinstallconditionalfeatures.patch
+++ b/patches/chromium/add_didinstallconditionalfeatures.patch
@@ -23,10 +23,10 @@ index fef4c8e02067c44ed804c8b53db1007fae2d2a76..b36304ee0a832c5e1e2fd3af6151b7b0
int32_t world_id) {}
virtual void DidClearWindowObject() {}
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
-index 3b50524b8e33d99874dd58d78ef7c96a9eaa7205..886a34f94f38444117eae7e3b117ae043d50609e 100644
+index 64e30259cdf7c0ee27f64d3c7d383171f6be1f4b..cc90f0e357d25f539be79f02724a27e178b501e8 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
-@@ -4409,6 +4409,12 @@ void RenderFrameImpl::DidCreateScriptContext(v8::Local<v8::Context> context,
+@@ -4408,6 +4408,12 @@ void RenderFrameImpl::DidCreateScriptContext(v8::Local<v8::Context> context,
observer.DidCreateScriptContext(context, world_id);
}
@@ -40,10 +40,10 @@ index 3b50524b8e33d99874dd58d78ef7c96a9eaa7205..886a34f94f38444117eae7e3b117ae04
int world_id) {
for (auto& observer : observers_)
diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h
-index 516a8140f79cc7f8ffe4b0665184d7d3d6111da9..fce2608070d2bf31b6b02de47102aff870c8229f 100644
+index 0c8628f909e3a08b3f6ce7852842e50ec37e64cc..506aa2fc88003174dc7e82fc415e162e196dad61 100644
--- a/content/renderer/render_frame_impl.h
+++ b/content/renderer/render_frame_impl.h
-@@ -608,6 +608,8 @@ class CONTENT_EXPORT RenderFrameImpl
+@@ -606,6 +606,8 @@ class CONTENT_EXPORT RenderFrameImpl
void DidObserveLayoutShift(double score, bool after_input_or_scroll) override;
void DidCreateScriptContext(v8::Local<v8::Context> context,
int world_id) override;
@@ -53,10 +53,10 @@ index 516a8140f79cc7f8ffe4b0665184d7d3d6111da9..fce2608070d2bf31b6b02de47102aff8
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 dfd33eede0a8b0935a06eeb8f505a8d0738afa19..06827403830cb730b2521c715ec06aedbf7339c6 100644
+index b9ab9b46f2aab2af137583a6012d100cabc4faaf..3c6825f29f9b5d570d968c31cee25b04aed26b58 100644
--- a/third_party/blink/public/web/web_local_frame_client.h
+++ b/third_party/blink/public/web/web_local_frame_client.h
-@@ -606,6 +606,9 @@ class BLINK_EXPORT WebLocalFrameClient {
+@@ -605,6 +605,9 @@ class BLINK_EXPORT WebLocalFrameClient {
virtual void DidCreateScriptContext(v8::Local<v8::Context>,
int32_t world_id) {}
@@ -67,7 +67,7 @@ index dfd33eede0a8b0935a06eeb8f505a8d0738afa19..06827403830cb730b2521c715ec06aed
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 e7d4256fa96f5bc8ad71bd13b6b33feef32b443f..0dfeda68a4dbfd6b442f8d8f928c8cb871dd6aa4 100644
+index 62b35b9fa47f0b99f2b7b6bc712b3a4b2c1c8e4e..4a0fdbb120edc76647560fb86d95613c95ae7094 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
@@ -198,6 +198,7 @@ void LocalWindowProxy::Initialize() {
diff --git a/patches/chromium/add_webmessageportconverter_entangleandinjectmessageportchannel.patch b/patches/chromium/add_webmessageportconverter_entangleandinjectmessageportchannel.patch
index db38c5dd0b..519bdf7743 100644
--- a/patches/chromium/add_webmessageportconverter_entangleandinjectmessageportchannel.patch
+++ b/patches/chromium/add_webmessageportconverter_entangleandinjectmessageportchannel.patch
@@ -30,7 +30,7 @@ index a58ddcc8f6e79d3288d0c645875c8b1bbdaaf209..1283bd18cce78bc5eaad71b3fad01031
} // namespace blink
diff --git a/third_party/blink/renderer/core/exported/web_message_port_converter.cc b/third_party/blink/renderer/core/exported/web_message_port_converter.cc
-index f440ee59be4ed14760f2948751f31f7ea3d42e2a..654fbb2d12c9fe7cb362d792ede64c9d1f8c099f 100644
+index 6a6cb3d4ef0e454d18cf47cd971240d0dabea9fb..10ea1b43e5caa7c6c0f6c9ff5182a712ca422f9b 100644
--- a/third_party/blink/renderer/core/exported/web_message_port_converter.cc
+++ b/third_party/blink/renderer/core/exported/web_message_port_converter.cc
@@ -6,6 +6,7 @@
diff --git a/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch b/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch
index 125f6c918a..c28d76a3f5 100644
--- a/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch
+++ b/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch
@@ -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 43c8a9913c4b3a4fe0c3151d885c5a13a9fdc74b..0cd8005e743d3bb662c2d439b552a17b1db9b0ab 100644
+index 3b059b6121562dba8ec7c4483388408100d8ef26..0eb07c514883975f39b1a98ccfe65028e4c2ad75 100644
--- a/content/browser/renderer_host/render_view_host_impl.cc
+++ b/content/browser/renderer_host/render_view_host_impl.cc
-@@ -695,6 +695,11 @@ void RenderViewHostImpl::SetBackgroundOpaque(bool opaque) {
+@@ -700,6 +700,11 @@ void RenderViewHostImpl::SetBackgroundOpaque(bool opaque) {
GetWidget()->GetAssociatedFrameWidget()->SetBackgroundOpaque(opaque);
}
@@ -60,10 +60,10 @@ index d18c66114870de83c7eef21578e9e2b8d5606a8b..e1defb3992289427df85963f44a705e3
+ SetSchedulerThrottling(bool allowed);
};
diff --git a/third_party/blink/public/web/web_view.h b/third_party/blink/public/web/web_view.h
-index 2c3930e849719dce3871c12b073966ca370e5e43..990f88a20320a2f6f58cf2e0b4d37e398d5f7fda 100644
+index 8a18ecf567cd3a6a2fb1627083a5544a93198bf4..8b6436f3ba6c8bfc2cba054e77ab888625ae668d 100644
--- a/third_party/blink/public/web/web_view.h
+++ b/third_party/blink/public/web/web_view.h
-@@ -369,6 +369,7 @@ class BLINK_EXPORT WebView {
+@@ -371,6 +371,7 @@ class BLINK_EXPORT WebView {
// Scheduling -----------------------------------------------------------
virtual PageScheduler* Scheduler() const = 0;
@@ -72,10 +72,10 @@ index 2c3930e849719dce3871c12b073966ca370e5e43..990f88a20320a2f6f58cf2e0b4d37e39
// 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 0c4e9bfffc6dca9f0540a88acfd0a57caaba9c10..55650ca27d81d09f9ad315b699cade5a6d7eaca9 100644
+index a1bcdb3b7ceb5bed96b4c442268e3b7ddb490fa4..acda9f8ea1789d3febc0386ae855c009ea462816 100644
--- a/third_party/blink/renderer/core/exported/web_view_impl.cc
+++ b/third_party/blink/renderer/core/exported/web_view_impl.cc
-@@ -3828,13 +3828,21 @@ PageScheduler* WebViewImpl::Scheduler() const {
+@@ -3833,13 +3833,21 @@ PageScheduler* WebViewImpl::Scheduler() const {
return GetPage()->GetPageScheduler();
}
@@ -99,10 +99,10 @@ index 0c4e9bfffc6dca9f0540a88acfd0a57caaba9c10..55650ca27d81d09f9ad315b699cade5a
if (!is_initial_state) {
for (auto& observer : observers_)
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 421ca0b15eea5958d18e52118613c388aeef7dce..c3751889cc1289f237f9f8e0e22f321e8e793778 100644
+index cce09d720fda1929cd5202841305ea564ebdecaf..63bb7c62a8a6abf32fd8e29861018b0c9c80d471 100644
--- a/third_party/blink/renderer/core/exported/web_view_impl.h
+++ b/third_party/blink/renderer/core/exported/web_view_impl.h
-@@ -441,6 +441,7 @@ class CORE_EXPORT WebViewImpl final : public WebView,
+@@ -443,6 +443,7 @@ class CORE_EXPORT WebViewImpl final : public WebView,
LocalDOMWindow* PagePopupWindow() const;
PageScheduler* Scheduler() const override;
@@ -110,7 +110,7 @@ index 421ca0b15eea5958d18e52118613c388aeef7dce..c3751889cc1289f237f9f8e0e22f321e
void SetVisibilityState(mojom::blink::PageVisibilityState visibility_state,
bool is_initial_state) override;
mojom::blink::PageVisibilityState GetVisibilityState() override;
-@@ -904,6 +905,8 @@ class CORE_EXPORT WebViewImpl final : public WebView,
+@@ -907,6 +908,8 @@ class CORE_EXPORT WebViewImpl final : public WebView,
// If true, we send IPC messages when |preferred_size_| changes.
bool send_preferred_size_changes_ = false;
diff --git a/patches/chromium/blink_local_frame.patch b/patches/chromium/blink_local_frame.patch
index 1f1a38e636..550e164a42 100644
--- a/patches/chromium/blink_local_frame.patch
+++ b/patches/chromium/blink_local_frame.patch
@@ -49,7 +49,7 @@ index 22c4d4e9718a503d9c7ca26a40c97149b0f8986a..6bdc2757c96a28022fda9e6f5e3b74a0
// 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 833fd0ba35b510a91bd98c98ff5b5e8a279953b8..54cb4d1ef90ded89b85243ac1296dfb7787b08dc 100644
+index c01a916555d1fe5dbf972cba3b7ce248c80df371..d7ba7113f69e23b0fe47d135a4f51b9d50fa45b2 100644
--- a/third_party/blink/renderer/core/frame/local_frame.cc
+++ b/third_party/blink/renderer/core/frame/local_frame.cc
@@ -636,10 +636,6 @@ bool LocalFrame::DetachImpl(FrameDetachType type) {
diff --git a/patches/chromium/build_add_electron_tracing_category.patch b/patches/chromium/build_add_electron_tracing_category.patch
index 1a92ae6cdc..d90e3b4c8d 100644
--- a/patches/chromium/build_add_electron_tracing_category.patch
+++ b/patches/chromium/build_add_electron_tracing_category.patch
@@ -8,7 +8,7 @@ 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 3c8faea2c2391a0172504d524129702cb3c43cf0..b561f3e09d294e74b41a22ab22e8bbe5be05a116 100644
+index dd59416e22822c8754f7446538e1add3e677a81a..b4cbc35fc1e62dffa209a74049eb32aea84090d7 100644
--- a/base/trace_event/builtin_categories.h
+++ b/base/trace_event/builtin_categories.h
@@ -80,6 +80,7 @@
@@ -18,4 +18,4 @@ index 3c8faea2c2391a0172504d524129702cb3c43cf0..b561f3e09d294e74b41a22ab22e8bbe5
+ X("electron") \
X("evdev") \
X("event") \
- X("event_latency") \
+ X("exo") \
diff --git a/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch b/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch
index 5979975fca..a94beb19da 100644
--- a/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch
+++ b/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch
@@ -11,10 +11,10 @@ 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 cde7a97b2fee1c7be9d8ff9c081b6739545ab22b..e2e8d678dea93af4f4232bab69e9f51d085969ea 100644
+index 884bccba58c66861b43b3b50a7535cba543302e2..82e7bf534aa6b998cee8df53be3ca7db450f38c0 100644
--- a/chrome/BUILD.gn
+++ b/chrome/BUILD.gn
-@@ -193,11 +193,16 @@ if (!is_android && !is_mac) {
+@@ -202,11 +202,16 @@ if (!is_android && !is_mac) {
"common/crash_keys.h",
]
@@ -33,10 +33,10 @@ index cde7a97b2fee1c7be9d8ff9c081b6739545ab22b..e2e8d678dea93af4f4232bab69e9f51d
"//base",
"//build:branding_buildflags",
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
-index 2a68fafa1f590eb967d1d5317fa1e116ebd7cea3..02926b3429e352e0592dbb2ab7c891b279ce92a4 100644
+index b50bf319e4343986a9feceeb078c00e7f5b15e0c..a772f8c59aadaccde0367ce614ea341c8de28fbd 100644
--- a/chrome/browser/BUILD.gn
+++ b/chrome/browser/BUILD.gn
-@@ -4597,7 +4597,7 @@ static_library("browser") {
+@@ -4622,7 +4622,7 @@ static_library("browser") {
# On Windows, the hashes are embedded in //chrome:chrome_initial rather
# than here in :chrome_dll.
@@ -46,10 +46,10 @@ index 2a68fafa1f590eb967d1d5317fa1e116ebd7cea3..02926b3429e352e0592dbb2ab7c891b2
sources += [ "certificate_viewer_stub.cc" ]
}
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn
-index d3eae651675c91a5953806e83bd48ef8113afca3..487bd4f50f4198ce96846bf897a81ba476bfa292 100644
+index 6e85bb36a93fa3809ea4f6e2768160cd6b7ac3c3..d606468f0f8a4bb92e69cc7ae3cd5b511f2db660 100644
--- a/chrome/test/BUILD.gn
+++ b/chrome/test/BUILD.gn
-@@ -6476,7 +6476,6 @@ test("unit_tests") {
+@@ -6573,7 +6573,6 @@ test("unit_tests") {
deps += [
"//chrome:other_version",
@@ -57,7 +57,7 @@ index d3eae651675c91a5953806e83bd48ef8113afca3..487bd4f50f4198ce96846bf897a81ba4
"//chrome//services/util_win:unit_tests",
"//chrome/app:chrome_dll_resources",
"//chrome/app:win_unit_tests",
-@@ -6502,6 +6501,10 @@ test("unit_tests") {
+@@ -6599,6 +6598,10 @@ test("unit_tests") {
"//ui/resources",
]
@@ -68,7 +68,7 @@ index d3eae651675c91a5953806e83bd48ef8113afca3..487bd4f50f4198ce96846bf897a81ba4
ldflags = [
"/DELAYLOAD:api-ms-win-core-winrt-error-l1-1-0.dll",
"/DELAYLOAD:api-ms-win-core-winrt-l1-1-0.dll",
-@@ -7445,7 +7448,6 @@ test("unit_tests") {
+@@ -7546,7 +7549,6 @@ test("unit_tests") {
}
deps += [
@@ -76,7 +76,7 @@ index d3eae651675c91a5953806e83bd48ef8113afca3..487bd4f50f4198ce96846bf897a81ba4
"//chrome/browser/apps:icon_standardizer",
"//chrome/browser/apps/app_service",
"//chrome/browser/apps/app_service:test_support",
-@@ -7526,6 +7528,10 @@ test("unit_tests") {
+@@ -7632,6 +7634,10 @@ test("unit_tests") {
"//ui/webui/resources/js/browser_command:mojo_bindings",
]
diff --git a/patches/chromium/build_gn.patch b/patches/chromium/build_gn.patch
index da0d597117..7d9a8cb297 100644
--- a/patches/chromium/build_gn.patch
+++ b/patches/chromium/build_gn.patch
@@ -14,7 +14,7 @@ tradeoff is that switching from MAS_BUILD to !MAS_BUILD or vice-versa will
rebuild the entire tree.
diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn
-index 9ab0ddbdcf39b6efcd2b0e94c246fad48ae60586..b791580cffc200aa161478bf7060156cec5adc0a 100644
+index 6ee83a41a05488f016f86f90b026835f4b19ea54..63b32e52a11af599dbc5154ed353e2bf7250e9d3 100644
--- a/build/config/BUILDCONFIG.gn
+++ b/build/config/BUILDCONFIG.gn
@@ -123,6 +123,9 @@ if (current_os == "") {
diff --git a/patches/chromium/build_libc_as_static_library.patch b/patches/chromium/build_libc_as_static_library.patch
index 833dbf78db..fb66f377c1 100644
--- a/patches/chromium/build_libc_as_static_library.patch
+++ b/patches/chromium/build_libc_as_static_library.patch
@@ -32,15 +32,15 @@ index 027ed522bf54972a6586004d4d4302bda3481146..c227b7e0379539d14859701b00c8f941
]
if (is_linux) {
diff --git a/buildtools/third_party/libc++abi/BUILD.gn b/buildtools/third_party/libc++abi/BUILD.gn
-index 3ab30c4f8776b9b60e736e69c9bfbce99263ff97..3e8ed18b836f863deafd28a6363b7de2bcdc1863 100644
+index ecd4a007ce9ad0b1595d88d7df4ffa09af89db83..94f6b98b873a6cdda7a04192fed16e532f0856ce 100644
--- a/buildtools/third_party/libc++abi/BUILD.gn
+++ b/buildtools/third_party/libc++abi/BUILD.gn
-@@ -4,7 +4,7 @@
-
+@@ -5,7 +5,7 @@
+ import("//build/config/android/config.gni")
import("//build/config/c++/c++.gni")
-source_set("libc++abi") {
+static_library("libc++abi") {
if (export_libcxxabi_from_executables) {
- visibility = [
- "//build/config:executable_deps",
+ visibility = [ "//build/config:executable_deps" ]
+ } else {
diff --git a/patches/chromium/build_only_use_the_mas_build_config_in_the_required_components.patch b/patches/chromium/build_only_use_the_mas_build_config_in_the_required_components.patch
index 2d68934b8b..7fdb910f1f 100644
--- a/patches/chromium/build_only_use_the_mas_build_config_in_the_required_components.patch
+++ b/patches/chromium/build_only_use_the_mas_build_config_in_the_required_components.patch
@@ -6,10 +6,10 @@ Subject: build: only use the mas build config in the required components
Before landing this patch should be split into the relevant MAS patches, or at least the patch this one partially reverts
diff --git a/base/BUILD.gn b/base/BUILD.gn
-index 4858b4c2c1b34434db7cf1d6dd2d166cfea9c312..304d704f5115c8f888366c47eda771381212fa5e 100644
+index 4925a756be531749e3fe1fd6f1c081b060c28a4f..b7596e0d06f07bcb950fadb0775cec5479af4c0e 100644
--- a/base/BUILD.gn
+++ b/base/BUILD.gn
-@@ -1029,6 +1029,7 @@ component("base") {
+@@ -1031,6 +1031,7 @@ component("base") {
"//build/config/compiler:prevent_unsafe_narrowing",
"//build/config/compiler:wexit_time_destructors",
"//build/config/compiler:wglobal_constructors",
@@ -18,7 +18,7 @@ index 4858b4c2c1b34434db7cf1d6dd2d166cfea9c312..304d704f5115c8f888366c47eda77138
deps = [
diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn
-index b791580cffc200aa161478bf7060156cec5adc0a..253f8bd1e0c6adaca5a7c223eaa031bedd61af08 100644
+index 63b32e52a11af599dbc5154ed353e2bf7250e9d3..fc6ed0cdbe211cb29dd5a1dded36b3b0a6912ce9 100644
--- a/build/config/BUILDCONFIG.gn
+++ b/build/config/BUILDCONFIG.gn
@@ -355,7 +355,6 @@ default_compiler_configs = [
@@ -30,13 +30,13 @@ index b791580cffc200aa161478bf7060156cec5adc0a..253f8bd1e0c6adaca5a7c223eaa031be
if (is_win) {
diff --git a/components/os_crypt/sync/BUILD.gn b/components/os_crypt/sync/BUILD.gn
-index 3314c2a5cdcef04d7f1a8bf0e07cafa073f2815e..ef75cef4e449bb5c689f95ab664c19a1c2362b16 100644
+index a20e1b68ebd112d66ad82e5753b756218e457c9e..65c7170d1c2dbe4ecfc75c4fed92d6e7ff8efb27 100644
--- a/components/os_crypt/sync/BUILD.gn
+++ b/components/os_crypt/sync/BUILD.gn
-@@ -70,6 +70,8 @@ component("os_crypt") {
- "keychain_password_mac.mm",
+@@ -71,6 +71,8 @@ component("os_crypt") {
"os_crypt_mac.mm",
]
+ configs += [ "//build/config/compiler:enable_arc" ]
+
+ configs += ["//electron/build/config:mas_build"]
}
@@ -55,18 +55,18 @@ index 0625f07f317de46af619fdb279be78d9ecdc0029..5897820839d6d57ada22a83fe753e3a6
"alert.h",
"alert.mm",
diff --git a/components/viz/service/BUILD.gn b/components/viz/service/BUILD.gn
-index 06e4c47bd5f37c041d93808cf712e9eb028ff1b2..5b0a12d8b69c0b79fefcb9194e0f3fb88c4c7051 100644
+index 9551e3ea2e5f3de9bff158fc0f443df69a27f93a..e8c192bfbe5a2688e8c767443edbe7fb573ed509 100644
--- a/components/viz/service/BUILD.gn
+++ b/components/viz/service/BUILD.gn
-@@ -322,6 +322,7 @@ viz_component("service") {
-
- frameworks += [ "CoreGraphics.framework" ]
+@@ -332,6 +332,7 @@ viz_component("service") {
+ "frame_sinks/external_begin_frame_source_mac.h",
+ ]
}
+ configs = ["//electron/build/config:mas_build"]
}
if (is_android || use_ozone) {
-@@ -576,6 +577,8 @@ viz_source_set("unit_tests") {
+@@ -588,6 +589,8 @@ viz_source_set("unit_tests") {
"display_embedder/software_output_device_mac_unittest.mm",
]
frameworks = [ "IOSurface.framework" ]
@@ -76,7 +76,7 @@ index 06e4c47bd5f37c041d93808cf712e9eb028ff1b2..5b0a12d8b69c0b79fefcb9194e0f3fb8
if (is_win) {
diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn
-index b2f8d8dab348d031510b3ff8a5cf5854feb77282..898525c4ff6517dd1c1341394b248ecbfe6527f3 100644
+index 6c5c6f0771c72ac300e07398d4ed9bd3ce9a6ae3..49b290aef900e270b5d682e0a0d9dcebb9e0414c 100644
--- a/content/browser/BUILD.gn
+++ b/content/browser/BUILD.gn
@@ -56,6 +56,7 @@ source_set("browser") {
@@ -88,10 +88,10 @@ index b2f8d8dab348d031510b3ff8a5cf5854feb77282..898525c4ff6517dd1c1341394b248ecb
libs = []
frameworks = []
diff --git a/content/common/BUILD.gn b/content/common/BUILD.gn
-index 7490e10b3741a0680b0fbe7b069bd5803dccfd42..40d243c84e0336b6f413caf3a8eee96cab62fcf8 100644
+index d38bd551f8bafbc3be22ca0bedb508e4a74ffbb5..9e17dd2484a633301e684dc091b4800d635e5a20 100644
--- a/content/common/BUILD.gn
+++ b/content/common/BUILD.gn
-@@ -171,6 +171,7 @@ source_set("common") {
+@@ -170,6 +170,7 @@ source_set("common") {
"//content:content_implementation",
"//build/config:precompiled_headers",
]
@@ -100,7 +100,7 @@ index 7490e10b3741a0680b0fbe7b069bd5803dccfd42..40d243c84e0336b6f413caf3a8eee96c
public_deps = [
":mojo_bindings",
diff --git a/content/renderer/BUILD.gn b/content/renderer/BUILD.gn
-index 8177e8f11818639b4bafbb860a0f3edd69289465..23e19a8550c20c01e5c04388fe1f0294eae9507e 100644
+index 34636a58846e2b250e423dde76e4e6ea1f686676..899b75f2be91e86c526f550718e22221eea604f3 100644
--- a/content/renderer/BUILD.gn
+++ b/content/renderer/BUILD.gn
@@ -228,6 +228,7 @@ target(link_target_type, "renderer") {
@@ -124,10 +124,10 @@ index 642afd72cc0f98fe2590cef0c470f378eabb939e..894769a5de698767117339cab0fc2942
if (is_mac) {
diff --git a/gpu/ipc/service/BUILD.gn b/gpu/ipc/service/BUILD.gn
-index 1e7a52437d36b3e55eb45f546c8449b98533ad73..dee8f9a33ed80ad52122c967c35674954ba39560 100644
+index ed977f540a2920858a05292f823bf49c669aa6d2..9acd66a086654d77f2a2f84b917795197ac12810 100644
--- a/gpu/ipc/service/BUILD.gn
+++ b/gpu/ipc/service/BUILD.gn
-@@ -129,6 +129,7 @@ component("service") {
+@@ -130,6 +130,7 @@ component("service") {
"QuartzCore.framework",
]
defines += [ "GL_SILENCE_DEPRECATION" ]
@@ -136,10 +136,10 @@ index 1e7a52437d36b3e55eb45f546c8449b98533ad73..dee8f9a33ed80ad52122c967c3567495
if (is_ios) {
sources += [
diff --git a/media/audio/BUILD.gn b/media/audio/BUILD.gn
-index 8aaf3f77faa5be3078888da392c2e2fb0d1d6959..b557f0edfe8bf4cd8c0185a94c83e53932d064b6 100644
+index a828562c1da7aecc5b7e5888b25d8a3454628074..6926d5ca4c860d8754298948097dc1b63d2688a2 100644
--- a/media/audio/BUILD.gn
+++ b/media/audio/BUILD.gn
-@@ -197,6 +197,7 @@ source_set("audio") {
+@@ -199,6 +199,7 @@ source_set("audio") {
"mac/coreaudio_dispatch_override.h",
]
frameworks += [ "AudioUnit.framework" ]
@@ -189,7 +189,7 @@ index 5e9fc18352d1bf0939f8366d2282b49aeb307994..69dcc2cafa27b3d8bdf3fe8d0a22a980
source_set("sandbox_unittests") {
diff --git a/third_party/blink/renderer/core/BUILD.gn b/third_party/blink/renderer/core/BUILD.gn
-index c0c09f37b3332772dcd71cddb3114c44648ffe06..946684da595074c4b968500594018ae5d316d569 100644
+index 2c9080001cf8e8b4da54a4744f6754e3d5aac5a0..e08a38e5f9ea9c15fc5ceba1a38af682055389b7 100644
--- a/third_party/blink/renderer/core/BUILD.gn
+++ b/third_party/blink/renderer/core/BUILD.gn
@@ -304,6 +304,7 @@ component("core") {
@@ -226,10 +226,10 @@ index c9777e07fdd311213db325da44573ed09080856e..76a7ca0545b69baf19c6c89088fb2774
if (use_atk) {
diff --git a/ui/base/BUILD.gn b/ui/base/BUILD.gn
-index 056a7b1bd399510688841cb68da3985690deb0c7..3c0c0f625156adcc9204ff718703e8314034dba4 100644
+index 9ffa8129d29ecda50f91355ffd01ce9926a70b11..5ebf5ea4db7c692b3288110945d470831e7797e2 100644
--- a/ui/base/BUILD.gn
+++ b/ui/base/BUILD.gn
-@@ -353,6 +353,7 @@ component("base") {
+@@ -359,6 +359,7 @@ component("base") {
"l10n/l10n_util_mac.mm",
"resource/resource_bundle_mac.mm",
]
@@ -253,10 +253,10 @@ index 4fb4a862d285fababc67d4f2fe38036ea83bd8a9..fa71bc82342412d85fb05312b441cecb
if (is_win) {
diff --git a/ui/gfx/BUILD.gn b/ui/gfx/BUILD.gn
-index 34a269ee4d47a2597fd098bc9eabe10685f4fc86..8a96f5abc4e0092bca15dbf6e5098a64d81a3ff7 100644
+index c7a777df6803678108952185a40b590bbf419859..76303e25a06ed2123bf9ac6b93b8a1e0a91273e9 100644
--- a/ui/gfx/BUILD.gn
+++ b/ui/gfx/BUILD.gn
-@@ -193,6 +193,7 @@ component("gfx") {
+@@ -192,6 +192,7 @@ component("gfx") {
"scoped_ns_graphics_context_save_gstate_mac.h",
"scoped_ns_graphics_context_save_gstate_mac.mm",
]
@@ -265,7 +265,7 @@ index 34a269ee4d47a2597fd098bc9eabe10685f4fc86..8a96f5abc4e0092bca15dbf6e5098a64
if (is_win) {
sources += [
diff --git a/ui/views/BUILD.gn b/ui/views/BUILD.gn
-index 11515d6de3e8b017f03f4d6665f1e57b1f6dceb3..6b5c3d3a9f6cab7dcc97830f2e76c93b3ed79d8d 100644
+index 01bbf457bc079c266e6110f7ad7c1ba701343312..0718cc10706de5e4b12a891eff696c80352fb9cd 100644
--- a/ui/views/BUILD.gn
+++ b/ui/views/BUILD.gn
@@ -675,6 +675,7 @@ component("views") {
diff --git a/patches/chromium/can_create_window.patch b/patches/chromium/can_create_window.patch
index 9cce05cfe6..4da5633ada 100644
--- a/patches/chromium/can_create_window.patch
+++ b/patches/chromium/can_create_window.patch
@@ -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 87878ae6a1cfebb3c49e6ef16e35390d9197711d..166293ad0d6246bcf477e6af57a9e6801b6f6f7b 100644
+index 865bed3fd2faea604d87db4a2fc1081a538686cd..6e4e9686134ba56655e28c47a215059fe76251c4 100644
--- a/content/browser/renderer_host/render_frame_host_impl.cc
+++ b/content/browser/renderer_host/render_frame_host_impl.cc
-@@ -7777,6 +7777,7 @@ void RenderFrameHostImpl::CreateNewWindow(
+@@ -7799,6 +7799,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 87878ae6a1cfebb3c49e6ef16e35390d9197711d..166293ad0d6246bcf477e6af57a9e680
&no_javascript_access);
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
-index 1603b08eb7d7f423a2f968ad1f1b254261f9f6c9..87dcf40a7619ad8e9999cf07e2aa7a16e380125e 100644
+index f36fb125659ffefc9d138758c2df6522169fee8f..fc91e5302297863c395982818a00e9c2946638f0 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
-@@ -4167,6 +4167,12 @@ FrameTree* WebContentsImpl::CreateNewWindow(
+@@ -4170,6 +4170,12 @@ FrameTree* WebContentsImpl::CreateNewWindow(
auto* new_contents_impl = new_contents.get();
@@ -37,7 +37,7 @@ index 1603b08eb7d7f423a2f968ad1f1b254261f9f6c9..87dcf40a7619ad8e9999cf07e2aa7a16
// If the new frame has a name, make sure any SiteInstances that can find
// this named frame have proxies for it. Must be called after
// SetSessionStorageNamespace, since this calls CreateRenderView, which uses
-@@ -4208,12 +4214,6 @@ FrameTree* WebContentsImpl::CreateNewWindow(
+@@ -4211,12 +4217,6 @@ FrameTree* WebContentsImpl::CreateNewWindow(
AddWebContentsDestructionObserver(new_contents_impl);
}
@@ -51,10 +51,10 @@ index 1603b08eb7d7f423a2f968ad1f1b254261f9f6c9..87dcf40a7619ad8e9999cf07e2aa7a16
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 12f4a2066a2a31e9852216c0cb3344095c7b0e39..588ca46227c58f9596317d6d4d05d0b3c76cbc06 100644
+index 033780b477965e6915fc808cb468598f55050f2b..51da4e464c5768d979188bb46c11565cab5a494e 100644
--- a/content/common/frame.mojom
+++ b/content/common/frame.mojom
-@@ -593,6 +593,10 @@ struct CreateNewWindowParams {
+@@ -597,6 +597,10 @@ struct CreateNewWindowParams {
// The navigation initiator's user activation and ad status.
blink.mojom.NavigationInitiatorActivationAndAdStatus
initiator_activation_and_ad_status;
@@ -66,10 +66,10 @@ index 12f4a2066a2a31e9852216c0cb3344095c7b0e39..588ca46227c58f9596317d6d4d05d0b3
// 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 24baf87b52ab9320181a6821b57ebabc94827ddc..c89e47d453a892b16ee2ed96a95ebaa912d99210 100644
+index a5ea7baed1f095c03692b42f4526db12acdceb09..25441cae5c886fae1a8c508dc7f5947281cacd3b 100644
--- a/content/public/browser/content_browser_client.cc
+++ b/content/public/browser/content_browser_client.cc
-@@ -653,6 +653,8 @@ bool ContentBrowserClient::CanCreateWindow(
+@@ -654,6 +654,8 @@ bool ContentBrowserClient::CanCreateWindow(
const std::string& frame_name,
WindowOpenDisposition disposition,
const blink::mojom::WindowFeatures& features,
@@ -79,10 +79,10 @@ index 24baf87b52ab9320181a6821b57ebabc94827ddc..c89e47d453a892b16ee2ed96a95ebaa9
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 90fc10e2c6881788f003a4a91b0719620f7a16e4..294986a55d49a9f57592cf209b6c0db42620f61e 100644
+index 3db43fde00af40df4c197146665a606dc5bf4201..8daca4d7fad172c8436b9261022c4d1114b36f07 100644
--- a/content/public/browser/content_browser_client.h
+++ b/content/public/browser/content_browser_client.h
-@@ -166,6 +166,7 @@ class NetworkService;
+@@ -167,6 +167,7 @@ class NetworkService;
class TrustedURLLoaderHeaderClient;
} // namespace mojom
struct ResourceRequest;
@@ -90,7 +90,7 @@ index 90fc10e2c6881788f003a4a91b0719620f7a16e4..294986a55d49a9f57592cf209b6c0db4
} // namespace network
namespace sandbox {
-@@ -1061,6 +1062,8 @@ class CONTENT_EXPORT ContentBrowserClient {
+@@ -1065,6 +1066,8 @@ class CONTENT_EXPORT ContentBrowserClient {
const std::string& frame_name,
WindowOpenDisposition disposition,
const blink::mojom::WindowFeatures& features,
@@ -148,10 +148,10 @@ index 5da6f93293bc5ddae88c17ac2dd8d7037ba8e8f3..76d699790fb7d92587293b14332f696d
// typically happens when popups are created.
virtual void WebContentsCreated(WebContents* source_contents,
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
-index 741d2e447107a34eab153d4d7cf8a600b3fac1b3..3b50524b8e33d99874dd58d78ef7c96a9eaa7205 100644
+index 8bf6b5dbb8b30c3b0ac817376899f6144a92754a..64e30259cdf7c0ee27f64d3c7d383171f6be1f4b 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
-@@ -6295,6 +6295,10 @@ WebView* RenderFrameImpl::CreateNewWindow(
+@@ -6280,6 +6280,10 @@ WebView* RenderFrameImpl::CreateNewWindow(
blink::GetNavigationInitiatorActivationAndAdStatus(
request.HasUserGesture(), GetWebFrame()->IsAdScriptInStack());
@@ -163,10 +163,10 @@ index 741d2e447107a34eab153d4d7cf8a600b3fac1b3..3b50524b8e33d99874dd58d78ef7c96a
// moved on send.
bool is_background_tab =
diff --git a/content/web_test/browser/web_test_content_browser_client.cc b/content/web_test/browser/web_test_content_browser_client.cc
-index 0fe31461d3b29dde0bf3754287eed766371e10f2..d1426c424b0861b3b713cd3face4f2473a356e82 100644
+index bdf18ff21a92c7cde33cb299b5c3c0a609ce2ea8..97822402213729a4204cf36c3cd42ee5f568fc21 100644
--- a/content/web_test/browser/web_test_content_browser_client.cc
+++ b/content/web_test/browser/web_test_content_browser_client.cc
-@@ -497,6 +497,8 @@ bool WebTestContentBrowserClient::CanCreateWindow(
+@@ -504,6 +504,8 @@ bool WebTestContentBrowserClient::CanCreateWindow(
const std::string& frame_name,
WindowOpenDisposition disposition,
const blink::mojom::WindowFeatures& features,
@@ -210,10 +210,10 @@ index bef5a989bac50c177f15f52fe87ac3790d553e85..65dcd2e3b51929400c8bfb6a98a4fb59
} // 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 83a6e6015d0b974dc038133948e6f436c0c8ba72..e9a85e5b1ae2d7a0d4ccb7e17792431e27ce21fe 100644
+index 0fe13a68578656da5bd511ce7ea2339150080044..cd6f197dcfdd797c0cffe1194a949c8c095c20ae 100644
--- a/third_party/blink/renderer/core/frame/local_dom_window.cc
+++ b/third_party/blink/renderer/core/frame/local_dom_window.cc
-@@ -2219,6 +2219,8 @@ DOMWindow* LocalDOMWindow::open(v8::Isolate* isolate,
+@@ -2202,6 +2202,8 @@ DOMWindow* LocalDOMWindow::open(v8::Isolate* isolate,
WebWindowFeatures window_features =
GetWindowFeaturesFromString(features, entered_window);
diff --git a/patches/chromium/cherry-pick-48a136e77e6d.patch b/patches/chromium/cherry-pick-48a136e77e6d.patch
deleted file mode 100644
index 351872e5d3..0000000000
--- a/patches/chromium/cherry-pick-48a136e77e6d.patch
+++ /dev/null
@@ -1,232 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Christopher Cameron <[email protected]>
-Date: Mon, 15 May 2023 23:09:29 +0000
-Subject: ui::Compositor: Propagate display ID
-
-The display ID originates in BrowserCompositorMac (for things like
-ContentShell) or in NativeWidgetMacNSWindowHost (for views).
-
-Add it as a parameter to RecyclableCompositorMac::UpdateSurface and
-use this to propagate it to ui::Compositor.
-
-Ensure that its initial value is propagated correctly in
-ui::Compositor::SetLayerTreeFrameSink.
-
-Remove use of base::LazyInstance from BrowserCompositorMac (it is
-long deprecated, and touching the file triggered presubmit failures).
-
-Bug: 1404797
-Change-Id: Ib39addd1ac2a3b2f42e1958d7ab7c6c4750224f8
-Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4517539
-Commit-Queue: ccameron chromium <[email protected]>
-Reviewed-by: Maggie Chen <[email protected]>
-Cr-Commit-Position: refs/heads/main@{#1144438}
-
-diff --git a/content/browser/renderer_host/browser_compositor_view_mac.mm b/content/browser/renderer_host/browser_compositor_view_mac.mm
-index 323548d3ed7be2e2572c0048dbf5f0fa464016dc..b7311c83633746855b1e7086b6824879c1870b28 100644
---- a/content/browser/renderer_host/browser_compositor_view_mac.mm
-+++ b/content/browser/renderer_host/browser_compositor_view_mac.mm
-@@ -12,7 +12,7 @@
-
- #include "base/command_line.h"
- #include "base/containers/circular_deque.h"
--#include "base/lazy_instance.h"
-+#include "base/no_destructor.h"
- #include "base/trace_event/trace_event.h"
- #include "components/viz/common/features.h"
- #include "components/viz/common/surfaces/local_surface_id.h"
-@@ -38,8 +38,10 @@
- // signals to shut down will come in very late, long after things that the
- // ui::Compositor depend on have been destroyed).
- // https://crbug.com/805726
--base::LazyInstance<std::set<BrowserCompositorMac*>>::Leaky
-- g_browser_compositors;
-+std::set<BrowserCompositorMac*>& GetBrowserCompositors() {
-+ static base::NoDestructor<std::set<BrowserCompositorMac*>> instance;
-+ return *instance.get();
-+}
-
- } // namespace
-
-@@ -54,7 +56,7 @@
- : client_(client),
- accelerated_widget_mac_ns_view_(accelerated_widget_mac_ns_view),
- weak_factory_(this) {
-- g_browser_compositors.Get().insert(this);
-+ GetBrowserCompositors().insert(this);
-
- root_layer_ = std::make_unique<ui::Layer>(ui::LAYER_SOLID_COLOR);
- // Ensure that this layer draws nothing when it does not not have delegated
-@@ -75,7 +77,7 @@
- delegated_frame_host_.reset();
- root_layer_.reset();
-
-- size_t num_erased = g_browser_compositors.Get().erase(this);
-+ size_t num_erased = GetBrowserCompositors().erase(this);
- DCHECK_EQ(1u, num_erased);
- }
-
-@@ -138,9 +140,9 @@
- }
-
- if (recyclable_compositor_) {
-- recyclable_compositor_->UpdateSurface(dfh_size_pixels_,
-- current.device_scale_factor,
-- current.display_color_spaces);
-+ recyclable_compositor_->UpdateSurface(
-+ dfh_size_pixels_, current.device_scale_factor,
-+ current.display_color_spaces, current.display_id);
- }
- }
-
-@@ -160,9 +162,9 @@
- dfh_device_scale_factor_ = new_device_scale_factor;
- root_layer_->SetBounds(gfx::Rect(dfh_size_dip_));
- if (recyclable_compositor_) {
-- recyclable_compositor_->UpdateSurface(dfh_size_pixels_,
-- current.device_scale_factor,
-- current.display_color_spaces);
-+ recyclable_compositor_->UpdateSurface(
-+ dfh_size_pixels_, current.device_scale_factor,
-+ current.display_color_spaces, current.display_id);
- }
- }
- delegated_frame_host_->EmbedSurface(
-@@ -252,9 +254,9 @@
- recyclable_compositor_ = std::make_unique<ui::RecyclableCompositorMac>(
- content::GetContextFactory());
- display::ScreenInfo current = client_->GetCurrentScreenInfo();
-- recyclable_compositor_->UpdateSurface(dfh_size_pixels_,
-- current.device_scale_factor,
-- current.display_color_spaces);
-+ recyclable_compositor_->UpdateSurface(
-+ dfh_size_pixels_, current.device_scale_factor,
-+ current.display_color_spaces, current.display_id);
- recyclable_compositor_->compositor()->SetRootLayer(root_layer_.get());
- recyclable_compositor_->compositor()->SetBackgroundColor(background_color_);
- recyclable_compositor_->widget()->SetNSView(
-@@ -273,9 +275,8 @@
- // Ensure that the client has destroyed its BrowserCompositorViewMac before
- // it dependencies are destroyed.
- // https://crbug.com/805726
-- while (!g_browser_compositors.Get().empty()) {
-- BrowserCompositorMac* browser_compositor =
-- *g_browser_compositors.Get().begin();
-+ while (!GetBrowserCompositors().empty()) {
-+ BrowserCompositorMac* browser_compositor = *GetBrowserCompositors().begin();
- browser_compositor->client_->DestroyCompositorForShutdown();
- }
- }
-diff --git a/ui/compositor/compositor.cc b/ui/compositor/compositor.cc
-index c652c0dfd2e6c464c91e3522902ee96dd19b0287..e52e5b74146d0709925e87c6f4d5dc551ec8eec8 100644
---- a/ui/compositor/compositor.cc
-+++ b/ui/compositor/compositor.cc
-@@ -347,6 +347,9 @@ void Compositor::SetLayerTreeFrameSink(
- display_private_->SetDisplayColorMatrix(
- gfx::SkM44ToTransform(display_color_matrix_));
- display_private_->SetOutputIsSecure(output_is_secure_);
-+#if BUILDFLAG(IS_MAC)
-+ display_private_->SetVSyncDisplayID(display_id_);
-+#endif
- if (has_vsync_params_) {
- display_private_->SetDisplayVSyncParameters(vsync_timebase_,
- vsync_interval_);
-diff --git a/ui/compositor/recyclable_compositor_mac.cc b/ui/compositor/recyclable_compositor_mac.cc
-index 0e30e781760d38778ec0e741ddae250e96c6d671..0c57b17778872702f887e5fe9d95dc8ad98d654f 100644
---- a/ui/compositor/recyclable_compositor_mac.cc
-+++ b/ui/compositor/recyclable_compositor_mac.cc
-@@ -12,6 +12,7 @@
- #include "ui/compositor/compositor.h"
- #include "ui/compositor/compositor_observer.h"
- #include "ui/compositor/compositor_switches.h"
-+#include "ui/display/types/display_constants.h"
-
- namespace ui {
-
-@@ -65,7 +66,8 @@ void RecyclableCompositorMac::Unsuspend() {
- void RecyclableCompositorMac::UpdateSurface(
- const gfx::Size& size_pixels,
- float scale_factor,
-- const gfx::DisplayColorSpaces& display_color_spaces) {
-+ const gfx::DisplayColorSpaces& display_color_spaces,
-+ int64_t display_id) {
- if (size_pixels != size_pixels_ || scale_factor != scale_factor_) {
- size_pixels_ = size_pixels;
- scale_factor_ = scale_factor;
-@@ -75,21 +77,19 @@ void RecyclableCompositorMac::UpdateSurface(
- compositor()->SetScaleAndSize(scale_factor_, size_pixels_,
- local_surface_id);
- }
-- if (display_color_spaces != display_color_spaces_) {
-- display_color_spaces_ = display_color_spaces;
-- compositor()->SetDisplayColorSpaces(display_color_spaces_);
-- }
-+ compositor()->SetDisplayColorSpaces(display_color_spaces);
-+ compositor()->SetVSyncDisplayID(display_id);
- }
-
- void RecyclableCompositorMac::InvalidateSurface() {
- size_pixels_ = gfx::Size();
- scale_factor_ = 1.f;
- local_surface_id_allocator_.Invalidate();
-- display_color_spaces_ = gfx::DisplayColorSpaces();
- compositor()->SetScaleAndSize(
- scale_factor_, size_pixels_,
- local_surface_id_allocator_.GetCurrentLocalSurfaceId());
- compositor()->SetDisplayColorSpaces(gfx::DisplayColorSpaces());
-+ compositor()->SetVSyncDisplayID(display::kInvalidDisplayId);
- }
-
- void RecyclableCompositorMac::OnCompositingDidCommit(
-diff --git a/ui/compositor/recyclable_compositor_mac.h b/ui/compositor/recyclable_compositor_mac.h
-index 891204a715de65bce5103b85490bb66de401ba0e..778842bee9395101c6f8b2c182e4b6de7a8a039e 100644
---- a/ui/compositor/recyclable_compositor_mac.h
-+++ b/ui/compositor/recyclable_compositor_mac.h
-@@ -49,7 +49,8 @@ class COMPOSITOR_EXPORT RecyclableCompositorMac
- // Update the compositor's surface information, if needed.
- void UpdateSurface(const gfx::Size& size_pixels,
- float scale_factor,
-- const gfx::DisplayColorSpaces& display_color_spaces);
-+ const gfx::DisplayColorSpaces& display_color_spaces,
-+ int64_t display_id);
-
- private:
- // Invalidate the compositor's surface information.
-@@ -63,7 +64,6 @@ class COMPOSITOR_EXPORT RecyclableCompositorMac
- viz::ParentLocalSurfaceIdAllocator local_surface_id_allocator_;
- gfx::Size size_pixels_;
- float scale_factor_ = 1.f;
-- gfx::DisplayColorSpaces display_color_spaces_;
-
- std::unique_ptr<ui::AcceleratedWidgetMac> accelerated_widget_mac_;
- ui::Compositor compositor_;
-diff --git a/ui/views/cocoa/native_widget_mac_ns_window_host.mm b/ui/views/cocoa/native_widget_mac_ns_window_host.mm
-index c6a33c2a85206295426292406291af670ce65ab0..f1f25bf0e19a918c3fcc7b7610ecf2924a880ff4 100644
---- a/ui/views/cocoa/native_widget_mac_ns_window_host.mm
-+++ b/ui/views/cocoa/native_widget_mac_ns_window_host.mm
-@@ -617,7 +617,7 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
- content_bounds_in_screen_.size(), display_.device_scale_factor()));
- compositor_->UpdateSurface(content_bounds_in_pixels,
- display_.device_scale_factor(),
-- display_.color_spaces());
-+ display_.color_spaces(), display_.id());
- }
-
- void NativeWidgetMacNSWindowHost::DestroyCompositor() {
-@@ -1173,7 +1173,7 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
- content_bounds_in_screen_.size(), display_.device_scale_factor()));
- compositor_->UpdateSurface(content_bounds_in_pixels,
- display_.device_scale_factor(),
-- display_.color_spaces());
-+ display_.color_spaces(), display_.id());
- }
-
- if (display_id_changed) {
-@@ -1187,7 +1187,6 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
-
- if (compositor_) {
- RequestVSyncParametersUpdate();
-- compositor_->compositor()->SetVSyncDisplayID(display_.id());
- }
- }
- }
diff --git a/patches/chromium/cherry-pick-e6e23ba00379.patch b/patches/chromium/cherry-pick-e6e23ba00379.patch
deleted file mode 100644
index bc52f235dc..0000000000
--- a/patches/chromium/cherry-pick-e6e23ba00379.patch
+++ /dev/null
@@ -1,430 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Christopher Cameron <[email protected]>
-Date: Mon, 15 May 2023 15:30:36 +0200
-Subject: Use ExternalBeginFrameSourceMac on macOS
-
-Change ExternalBeginFrameSourceMac from being a
-SyntheticBeginFrameSource to being an ExternalBeginFrameSource.
-
-Move all of the code that is responsible for updating the VSync
-parameters every 10 seconds from NativeWidgetMacNSWindowHost to
-ExternalBeginFrameSourceMac.
-
-Wire up ExternalBeginFrameSourceMac::SetVSyncDisplayID to create
-the DisplayLinkMac (that was previously created in
-NativeWidgetMacNSWindowHost). Set the VSyncCallbackMac callback in
-ExternalBeginFrameSourceMac to update the timer based VSync
-parameters the same way that was done in SyntheticBeginFrameSource.
-
-Make RootCompositorFrameSinkImpl create a ExternalBeginFrameSourceMac
-instead of creating a DelayBasedBeginFrameSource.
-
-Bug: 1404797
-Change-Id: I288497d94cc66356586e8da34852d53d05cf42f3
-
-diff --git a/components/viz/service/BUILD.gn b/components/viz/service/BUILD.gn
-index 5b0a12d8b69c0b79fefcb9194e0f3fb88c4c7051..8ebcf88eadb7fbc3ce781b9094ec88f6d23134c1 100644
---- a/components/viz/service/BUILD.gn
-+++ b/components/viz/service/BUILD.gn
-@@ -323,6 +323,12 @@ viz_component("service") {
- frameworks += [ "CoreGraphics.framework" ]
- }
- configs = ["//electron/build/config:mas_build"]
-+ if (is_mac) {
-+ sources += [
-+ "frame_sinks/external_begin_frame_source_mac.cc",
-+ "frame_sinks/external_begin_frame_source_mac.h",
-+ ]
-+ }
- }
-
- if (is_android || use_ozone) {
-diff --git a/components/viz/service/frame_sinks/DEPS b/components/viz/service/frame_sinks/DEPS
-index 163224a3cdb78d1eee055491c2daa7ca09fe4baa..c0e240ec70f7b7d4da92b497ac607e73d1168923 100644
---- a/components/viz/service/frame_sinks/DEPS
-+++ b/components/viz/service/frame_sinks/DEPS
-@@ -26,4 +26,8 @@ specific_include_rules = {
- "external_begin_frame_source_android.cc": [
- "+components/viz/service/service_jni_headers/ExternalBeginFrameSourceAndroid_jni.h",
- ],
-+ "external_begin_frame_source_mac.h": [
-+ "+ui/display/mac/display_link_mac.h",
-+ "+ui/display/types/display_constants.h",
-+ ],
- }
-diff --git a/components/viz/service/frame_sinks/external_begin_frame_source_mac.cc b/components/viz/service/frame_sinks/external_begin_frame_source_mac.cc
-new file mode 100644
-index 0000000000000000000000000000000000000000..f5bd62e7c486b8e6bb58d59984f363867015486c
---- /dev/null
-+++ b/components/viz/service/frame_sinks/external_begin_frame_source_mac.cc
-@@ -0,0 +1,97 @@
-+// Copyright 2023 The Chromium Authors
-+// Use of this source code is governed by a BSD-style license that can be
-+// found in the LICENSE file.
-+
-+#include "components/viz/service/frame_sinks/external_begin_frame_source_mac.h"
-+
-+#include <algorithm>
-+#include <memory>
-+#include <utility>
-+
-+#include "base/containers/contains.h"
-+#include "base/trace_event/trace_event.h"
-+
-+namespace viz {
-+
-+ExternalBeginFrameSourceMac::ExternalBeginFrameSourceMac(
-+ std::unique_ptr<DelayBasedTimeSource> time_source,
-+ uint32_t restart_id)
-+ : ExternalBeginFrameSource(this, restart_id),
-+ time_source_(std::move(time_source)) {
-+ time_source_->SetClient(this);
-+}
-+
-+ExternalBeginFrameSourceMac::~ExternalBeginFrameSourceMac() = default;
-+
-+void ExternalBeginFrameSourceMac::SetDynamicBeginFrameDeadlineOffsetSource(
-+ DynamicBeginFrameDeadlineOffsetSource*
-+ dynamic_begin_frame_deadline_offset_source) {
-+ begin_frame_args_generator_.set_dynamic_begin_frame_deadline_offset_source(
-+ dynamic_begin_frame_deadline_offset_source);
-+}
-+
-+void ExternalBeginFrameSourceMac::SetVSyncDisplayID(int64_t display_id) {
-+ if (display_id_ == display_id) {
-+ return;
-+ }
-+
-+ display_id_ = display_id;
-+ display_link_ = ui::DisplayLinkMac::GetForDisplay(
-+ base::checked_cast<CGDirectDisplayID>(display_id_));
-+ time_source_next_update_time_ = base::TimeTicks();
-+ RequestTimeSourceParamsUpdate();
-+}
-+
-+void ExternalBeginFrameSourceMac::OnNeedsBeginFrames(bool needs_begin_frames) {
-+ if (needs_begin_frames_ == needs_begin_frames) {
-+ return;
-+ }
-+ needs_begin_frames_ = needs_begin_frames;
-+
-+ DCHECK_NE(time_source_->Active(), needs_begin_frames_);
-+ time_source_->SetActive(needs_begin_frames_);
-+}
-+
-+void ExternalBeginFrameSourceMac::OnTimerTick() {
-+ // The VSync parameters skew over time (astonishingly quickly -- 0.1 msec per
-+ // second). If too much time has elapsed since the last time the vsync
-+ // parameters were calculated, re-calculate them.
-+ if (base::TimeTicks::Now() >= time_source_next_update_time_) {
-+ RequestTimeSourceParamsUpdate();
-+ }
-+
-+ // See comments in DelayBasedBeginFrameSource::OnTimerTick regarding the
-+ // computation of `frame_time`.
-+ base::TimeTicks frame_time =
-+ std::max(time_source_->LastTickTime(),
-+ time_source_->NextTickTime() - time_source_->Interval());
-+ OnBeginFrame(begin_frame_args_generator_.GenerateBeginFrameArgs(
-+ source_id(), frame_time, time_source_->NextTickTime(),
-+ time_source_->Interval()));
-+}
-+
-+void ExternalBeginFrameSourceMac::RequestTimeSourceParamsUpdate() {
-+ if (!display_link_ || time_source_updater_) {
-+ return;
-+ }
-+ time_source_updater_ = display_link_->RegisterCallback(base::BindRepeating(
-+ &ExternalBeginFrameSourceMac::OnTimeSourceParamsUpdate,
-+ weak_factory_.GetWeakPtr()));
-+}
-+
-+void ExternalBeginFrameSourceMac::OnTimeSourceParamsUpdate(
-+ ui::VSyncParamsMac params) {
-+ time_source_next_update_time_ = base::TimeTicks::Now() + base::Seconds(10);
-+ time_source_updater_ = nullptr;
-+
-+ if (params.display_times_valid) {
-+ time_source_->SetTimebaseAndInterval(params.display_timebase,
-+ params.display_interval);
-+ last_timebase_ = params.display_timebase;
-+ } else {
-+ time_source_->SetTimebaseAndInterval(last_timebase_,
-+ BeginFrameArgs::DefaultInterval());
-+ }
-+}
-+
-+} // namespace viz
-diff --git a/components/viz/service/frame_sinks/external_begin_frame_source_mac.h b/components/viz/service/frame_sinks/external_begin_frame_source_mac.h
-new file mode 100644
-index 0000000000000000000000000000000000000000..4753f86371d97ec0470e355258bae17e10e77dcf
---- /dev/null
-+++ b/components/viz/service/frame_sinks/external_begin_frame_source_mac.h
-@@ -0,0 +1,74 @@
-+// Copyright 2023 The Chromium Authors
-+// Use of this source code is governed by a BSD-style license that can be
-+// found in the LICENSE file.
-+
-+#ifndef COMPONENTS_VIZ_SERVICE_FRAME_SINKS_EXTERNAL_BEGIN_FRAME_SOURCE_MAC_H_
-+#define COMPONENTS_VIZ_SERVICE_FRAME_SINKS_EXTERNAL_BEGIN_FRAME_SOURCE_MAC_H_
-+
-+#include <memory>
-+
-+#include "components/viz/common/frame_sinks/begin_frame_source.h"
-+#include "components/viz/service/viz_service_export.h"
-+#include "ui/display/mac/display_link_mac.h"
-+#include "ui/display/types/display_constants.h"
-+
-+namespace viz {
-+
-+// A begin frame source for use on macOS. This behaves like a
-+// DelayBasedBeginFrameSource, but, instead of being informed externally of its
-+// timebase and interval, it is informed externally of its display::DisplayId
-+// and uses that to query its timebase and interval from a DisplayLinkMac.
-+class VIZ_COMMON_EXPORT ExternalBeginFrameSourceMac
-+ : public ExternalBeginFrameSource,
-+ public ExternalBeginFrameSourceClient,
-+ public DelayBasedTimeSourceClient {
-+ public:
-+ ExternalBeginFrameSourceMac(std::unique_ptr<DelayBasedTimeSource> time_source,
-+ uint32_t restart_id);
-+
-+ ExternalBeginFrameSourceMac(const ExternalBeginFrameSourceMac&) = delete;
-+ ExternalBeginFrameSourceMac& operator=(const ExternalBeginFrameSourceMac&) =
-+ delete;
-+ ~ExternalBeginFrameSourceMac() override;
-+
-+ // BeginFrameSource implementation.
-+ void SetDynamicBeginFrameDeadlineOffsetSource(
-+ DynamicBeginFrameDeadlineOffsetSource*
-+ dynamic_begin_frame_deadline_offset_source) override;
-+ void SetVSyncDisplayID(int64_t display_id) override;
-+
-+ // ExternalBeginFrameSourceClient implementation.
-+ void OnNeedsBeginFrames(bool needs_begin_frames) override;
-+
-+ // DelayBasedTimeSourceClient implementation.
-+ void OnTimerTick() override;
-+
-+ private:
-+ // Request a callback from DisplayLinkMac, and the callback function.
-+ void RequestTimeSourceParamsUpdate();
-+ void OnTimeSourceParamsUpdate(ui::VSyncParamsMac params);
-+
-+ BeginFrameArgsGenerator begin_frame_args_generator_;
-+
-+ bool needs_begin_frames_ = false;
-+
-+ // CVDisplayLink and related structures to set timer parameters.
-+ int64_t display_id_ = display::kInvalidDisplayId;
-+ scoped_refptr<ui::DisplayLinkMac> display_link_;
-+
-+ // Timer used to drive callbacks.
-+ // TODO(https://crbug.com/1404797): Only use this when it is not possible or
-+ // efficient to use `display_link_`.
-+ std::unique_ptr<DelayBasedTimeSource> time_source_;
-+ base::TimeTicks last_timebase_;
-+
-+ // The callback that is used to update `time_source_`.
-+ base::TimeTicks time_source_next_update_time_;
-+ std::unique_ptr<ui::VSyncCallbackMac> time_source_updater_;
-+
-+ base::WeakPtrFactory<ExternalBeginFrameSourceMac> weak_factory_{this};
-+};
-+
-+} // namespace viz
-+
-+#endif // COMPONENTS_VIZ_SERVICE_FRAME_SINKS_EXTERNAL_BEGIN_FRAME_SOURCE_MAC_H_
-diff --git a/components/viz/service/frame_sinks/root_compositor_frame_sink_impl.cc b/components/viz/service/frame_sinks/root_compositor_frame_sink_impl.cc
-index 13962687d262434de77f76c1c5a0f39f0fd9fb43..4d07b897a158bf39d9b29e3ac90920aee3050ce0 100644
---- a/components/viz/service/frame_sinks/root_compositor_frame_sink_impl.cc
-+++ b/components/viz/service/frame_sinks/root_compositor_frame_sink_impl.cc
-@@ -36,6 +36,10 @@
- #include "components/viz/service/frame_sinks/external_begin_frame_source_ios.h"
- #endif
-
-+#if BUILDFLAG(IS_MAC)
-+#include "components/viz/service/frame_sinks/external_begin_frame_source_mac.h"
-+#endif
-+
- namespace viz {
-
- class RootCompositorFrameSinkImpl::StandaloneBeginFrameObserver
-@@ -140,6 +144,11 @@ RootCompositorFrameSinkImpl::Create(
- hw_support_for_multiple_refresh_rates = true;
- external_begin_frame_source =
- std::make_unique<ExternalBeginFrameSourceIOS>(restart_id);
-+#elif BUILDFLAG(IS_MAC)
-+ external_begin_frame_source = std::make_unique<ExternalBeginFrameSourceMac>(
-+ std::make_unique<DelayBasedTimeSource>(
-+ base::SingleThreadTaskRunner::GetCurrentDefault().get()),
-+ restart_id);
- #else
- if (params->disable_frame_rate_limit) {
- synthetic_begin_frame_source =
-diff --git a/ui/display/mac/screen_mac.mm b/ui/display/mac/screen_mac.mm
-index 0d5ef8c48f08b1eb5ed878ab8934f2ecd04083fa..30f72b9655e790d864fc7e28983b6a37074448a5 100644
---- a/ui/display/mac/screen_mac.mm
-+++ b/ui/display/mac/screen_mac.mm
-@@ -9,6 +9,7 @@
- #import <Cocoa/Cocoa.h>
- #include <IOKit/IOKitLib.h>
- #include <IOKit/graphics/IOGraphicsLib.h>
-+#include <QuartzCore/CVDisplayLink.h>
- #include <stdint.h>
-
- #include <map>
-@@ -27,7 +28,6 @@
- #include "base/trace_event/trace_event.h"
- #include "ui/display/display.h"
- #include "ui/display/display_change_notifier.h"
--#include "ui/display/mac/display_link_mac.h"
- #include "ui/display/util/display_util.h"
- #include "ui/gfx/geometry/point.h"
- #include "ui/gfx/icc_profile.h"
-@@ -280,8 +280,22 @@ DisplayMac BuildDisplayForScreen(NSScreen* screen) {
- display.set_is_monochrome(CGDisplayUsesForceToGray());
- #endif
-
-- if (auto display_link = ui::DisplayLinkMac::GetForDisplay(display_id))
-- display.set_display_frequency(display_link->GetRefreshRate());
-+ // Query the display's referesh rate.
-+ {
-+ CVDisplayLinkRef display_link = nullptr;
-+ if (CVDisplayLinkCreateWithCGDisplay(display_id, &display_link) ==
-+ kCVReturnSuccess) {
-+ DCHECK(display_link);
-+ CVTime cv_time =
-+ CVDisplayLinkGetNominalOutputVideoRefreshPeriod(display_link);
-+ if (!(cv_time.flags & kCVTimeIsIndefinite)) {
-+ double refresh_rate = (static_cast<double>(cv_time.timeScale) /
-+ static_cast<double>(cv_time.timeValue));
-+ display.set_display_frequency(refresh_rate);
-+ }
-+ CVDisplayLinkRelease(display_link);
-+ }
-+ }
-
- // CGDisplayRotation returns a double. Display::SetRotationAsDegree will
- // handle the unexpected situations were the angle is not a multiple of 90.
-diff --git a/ui/views/cocoa/native_widget_mac_ns_window_host.h b/ui/views/cocoa/native_widget_mac_ns_window_host.h
-index e63b249a9bdc23545121a513156bfa32e92fec0b..e21c2df5d19bf01271bee91f792a3dbae29c55b7 100644
---- a/ui/views/cocoa/native_widget_mac_ns_window_host.h
-+++ b/ui/views/cocoa/native_widget_mac_ns_window_host.h
-@@ -24,7 +24,6 @@
- #include "ui/accelerated_widget_mac/accelerated_widget_mac.h"
- #include "ui/base/cocoa/accessibility_focus_overrider.h"
- #include "ui/compositor/layer_owner.h"
--#include "ui/display/mac/display_link_mac.h"
- #include "ui/views/cocoa/drag_drop_client_mac.h"
- #include "ui/views/cocoa/native_widget_mac_event_monitor.h"
- #include "ui/views/views_export.h"
-@@ -421,12 +420,6 @@ class VIEWS_EXPORT NativeWidgetMacNSWindowHost
- // ui::AcceleratedWidgetMacNSView:
- void AcceleratedWidgetCALayerParamsUpdated() override;
-
-- // If `display_link_` is valid and `display_link_updater_` does not exist,
-- // create it. It will call back to OnVSyncParametersUpdated with new VSync
-- // parameters.
-- void RequestVSyncParametersUpdate();
-- void OnVSyncParametersUpdated(ui::VSyncParamsMac params);
--
- // The id that this bridge may be looked up from.
- const uint64_t widget_id_;
- const raw_ptr<views::NativeWidgetMac>
-@@ -494,15 +487,6 @@ class VIEWS_EXPORT NativeWidgetMacNSWindowHost
- // The display that the window is currently on.
- display::Display display_;
-
-- // Display link for getting vsync info for `display_`, and VSyncCallbackMac to
-- // use for callbacks.
-- scoped_refptr<ui::DisplayLinkMac> display_link_;
-- std::unique_ptr<ui::VSyncCallbackMac> display_link_updater_;
--
-- // Updating VSync parameters can be expensive, so set this to the next time
-- // when we should update VSync parameters.
-- base::TimeTicks display_link_next_update_time_;
--
- // The geometry of the window and its contents view, in screen coordinates.
- gfx::Rect window_bounds_in_screen_;
- gfx::Rect content_bounds_in_screen_;
-diff --git a/ui/views/cocoa/native_widget_mac_ns_window_host.mm b/ui/views/cocoa/native_widget_mac_ns_window_host.mm
-index f1f25bf0e19a918c3fcc7b7610ecf2924a880ff4..a0c9f71c5eb97091941ba7d9955854af74bd67d5 100644
---- a/ui/views/cocoa/native_widget_mac_ns_window_host.mm
-+++ b/ui/views/cocoa/native_widget_mac_ns_window_host.mm
-@@ -1163,32 +1163,19 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
-
- void NativeWidgetMacNSWindowHost::OnWindowDisplayChanged(
- const display::Display& new_display) {
-- bool display_id_changed = display_.id() != new_display.id();
- display_ = new_display;
-- if (compositor_) {
-- // Mac device scale factor is always an integer so the result here is an
-- // integer pixel size.
-- gfx::Size content_bounds_in_pixels =
-- gfx::ToRoundedSize(gfx::ConvertSizeToPixels(
-- content_bounds_in_screen_.size(), display_.device_scale_factor()));
-- compositor_->UpdateSurface(content_bounds_in_pixels,
-- display_.device_scale_factor(),
-- display_.color_spaces(), display_.id());
-+ if (!compositor_) {
-+ return;
- }
-
-- if (display_id_changed) {
-- display_link_ = ui::DisplayLinkMac::GetForDisplay(
-- base::checked_cast<CGDirectDisplayID>(display_.id()));
-- if (!display_link_) {
-- // Note that on some headless systems, the display link will fail to be
-- // created, so this should not be a fatal error.
-- LOG(ERROR) << "Failed to create display link.";
-- }
--
-- if (compositor_) {
-- RequestVSyncParametersUpdate();
-- }
-- }
-+ // Mac device scale factor is always an integer so the result here is an
-+ // integer pixel size.
-+ gfx::Size content_bounds_in_pixels =
-+ gfx::ToRoundedSize(gfx::ConvertSizeToPixels(
-+ content_bounds_in_screen_.size(), display_.device_scale_factor()));
-+ compositor_->UpdateSurface(content_bounds_in_pixels,
-+ display_.device_scale_factor(),
-+ display_.color_spaces(), display_.id());
- }
-
- void NativeWidgetMacNSWindowHost::OnWindowWillClose() {
-@@ -1619,32 +1606,6 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
- void NativeWidgetMacNSWindowHost::AcceleratedWidgetCALayerParamsUpdated() {
- if (const auto* ca_layer_params = compositor_->widget()->GetCALayerParams())
- GetNSWindowMojo()->SetCALayerParams(*ca_layer_params);
--
-- // The VSync parameters skew over time (astonishingly quickly -- 0.1 msec per
-- // second). If too much time has elapsed since the last time the vsync
-- // parameters were calculated, re-calculate them.
-- if (base::TimeTicks::Now() >= display_link_next_update_time_) {
-- RequestVSyncParametersUpdate();
-- }
--}
--
--void NativeWidgetMacNSWindowHost::RequestVSyncParametersUpdate() {
-- if (!display_link_ || display_link_updater_) {
-- return;
-- }
-- display_link_updater_ = display_link_->RegisterCallback(base::BindRepeating(
-- &NativeWidgetMacNSWindowHost::OnVSyncParametersUpdated,
-- weak_factory_for_vsync_update_.GetWeakPtr()));
--}
--
--void NativeWidgetMacNSWindowHost::OnVSyncParametersUpdated(
-- ui::VSyncParamsMac params) {
-- if (compositor_ && params.display_times_valid) {
-- compositor_->compositor()->SetDisplayVSyncParameters(
-- params.display_timebase, params.display_interval);
-- display_link_next_update_time_ = base::TimeTicks::Now() + base::Seconds(10);
-- }
-- display_link_updater_ = nullptr;
- }
-
- } // namespace views
diff --git a/patches/chromium/chore_add_electron_deps_to_gitignores.patch b/patches/chromium/chore_add_electron_deps_to_gitignores.patch
index 483da35d19..a7a1acfab6 100644
--- a/patches/chromium/chore_add_electron_deps_to_gitignores.patch
+++ b/patches/chromium/chore_add_electron_deps_to_gitignores.patch
@@ -6,10 +6,10 @@ Subject: chore: add electron deps to gitignores
Makes things like "git status" quicker when developing electron locally
diff --git a/.gitignore b/.gitignore
-index 45a7f0076b3c39a1f1fb60e6b8b232a0d30f0113..8513e03038912fb57acfe8900bd0ec6b33b5e3f1 100644
+index 36fd6c0ff5673343258fd6eee4a79227aa4e52b5..3c2bfca45ff7012d953fc67f9fb01be67d41b35b 100644
--- a/.gitignore
+++ b/.gitignore
-@@ -239,6 +239,7 @@ vs-chromium-project.txt
+@@ -240,6 +240,7 @@ vs-chromium-project.txt
/delegate_execute
/device/serial/device_serial_mojo.xml
/docs/website
@@ -18,10 +18,10 @@ index 45a7f0076b3c39a1f1fb60e6b8b232a0d30f0113..8513e03038912fb57acfe8900bd0ec6b
/google_apis/internal
/googleurl
diff --git a/third_party/.gitignore b/third_party/.gitignore
-index 9978d8b8756ed8557275d2556cdc493eec94c7f1..58a3f97ea420d19c26a4e5e604730f0244e62283 100644
+index 242aa829efed37a00046ba2c72a5511855799cd9..8546bcfa6505686f2699f8c9ff63b4b114eb9831 100644
--- a/third_party/.gitignore
+++ b/third_party/.gitignore
-@@ -90,6 +90,7 @@
+@@ -92,6 +92,7 @@
/directxsdk
/dom_distiller_js/dist
/eigen3/src
@@ -29,7 +29,7 @@ index 9978d8b8756ed8557275d2556cdc493eec94c7f1..58a3f97ea420d19c26a4e5e604730f02
/elfutils/src
/emoji-metadata/src
/emoji-segmenter/src
-@@ -197,6 +198,7 @@
+@@ -199,6 +200,7 @@
/mocha
/mockito/src
/nacl_sdk_binaries/
@@ -37,7 +37,7 @@ index 9978d8b8756ed8557275d2556cdc493eec94c7f1..58a3f97ea420d19c26a4e5e604730f02
/nasm
/nearby/src
/neon_2_sse/src
-@@ -264,6 +266,7 @@
+@@ -266,6 +268,7 @@
/speex
/sqlite/src
/sqlite4java/lib/
diff --git a/patches/chromium/chore_introduce_blocking_api_for_electron.patch b/patches/chromium/chore_introduce_blocking_api_for_electron.patch
index 18b99bdc06..7e6fc41483 100644
--- a/patches/chromium/chore_introduce_blocking_api_for_electron.patch
+++ b/patches/chromium/chore_introduce_blocking_api_for_electron.patch
@@ -7,7 +7,7 @@ This patch comes after Chromium removed the ScopedAllowIO API in favor
of explicitly adding ScopedAllowBlocking calls as friends.
diff --git a/base/threading/thread_restrictions.h b/base/threading/thread_restrictions.h
-index 4c9ff4452fa14cbd639207169afbf3e0ea663e2b..d6487da03dd6595272d63e0930e956948791b722 100644
+index 536ee9714219fd373567b80071f453cee896060f..28764535cf3724028bd76edf036e02045c8f02c3 100644
--- a/base/threading/thread_restrictions.h
+++ b/base/threading/thread_restrictions.h
@@ -133,6 +133,7 @@ class FirefoxProfileLock;
@@ -28,7 +28,7 @@ index 4c9ff4452fa14cbd639207169afbf3e0ea663e2b..d6487da03dd6595272d63e0930e95694
namespace enterprise_connectors {
class LinuxKeyRotationCommand;
} // namespace enterprise_connectors
-@@ -579,6 +583,7 @@ class BASE_EXPORT [[maybe_unused, nodiscard]] ScopedAllowBlocking {
+@@ -580,6 +584,7 @@ class BASE_EXPORT [[maybe_unused, nodiscard]] ScopedAllowBlocking {
friend class ::DesktopNotificationBalloon;
friend class ::FirefoxProfileLock;
friend class ::GaiaConfig;
@@ -36,7 +36,7 @@ index 4c9ff4452fa14cbd639207169afbf3e0ea663e2b..d6487da03dd6595272d63e0930e95694
friend class ::ProfileImpl;
friend class ::ScopedAllowBlockingForProfile;
friend class ::StartupTabProviderImpl;
-@@ -616,6 +621,7 @@ class BASE_EXPORT [[maybe_unused, nodiscard]] ScopedAllowBlocking {
+@@ -617,6 +622,7 @@ class BASE_EXPORT [[maybe_unused, nodiscard]] ScopedAllowBlocking {
friend class crosapi::LacrosThreadTypeDelegate;
friend class crypto::ScopedAllowBlockingForNSS; // http://crbug.com/59847
friend class drive::FakeDriveService;
diff --git a/patches/chromium/chore_patch_out_partition_attribute_dcheck_for_webviews.patch b/patches/chromium/chore_patch_out_partition_attribute_dcheck_for_webviews.patch
index 279d4fe846..8ed74d1672 100644
--- a/patches/chromium/chore_patch_out_partition_attribute_dcheck_for_webviews.patch
+++ b/patches/chromium/chore_patch_out_partition_attribute_dcheck_for_webviews.patch
@@ -14,10 +14,10 @@ This change patches it out to prevent the DCHECK.
It can be removed once/if we see a better solution to the problem.
diff --git a/content/browser/site_instance_impl.cc b/content/browser/site_instance_impl.cc
-index dba7e73e0fa8ee64ebb9e349417a401533708754..43fff8314998023a43634f4f9bc73542ec7e604f 100644
+index a54616dcb3fcb29cc1115c52cf4b70f3723cc2cf..819e58dd173aa4f71995618e34e2d5d102f74578 100644
--- a/content/browser/site_instance_impl.cc
+++ b/content/browser/site_instance_impl.cc
-@@ -204,7 +204,7 @@ scoped_refptr<SiteInstanceImpl> SiteInstanceImpl::CreateForGuest(
+@@ -203,7 +203,7 @@ scoped_refptr<SiteInstanceImpl> SiteInstanceImpl::CreateForGuest(
BrowserContext* browser_context,
const StoragePartitionConfig& partition_config) {
DCHECK(browser_context);
diff --git a/patches/chromium/chore_patch_out_profile_methods_in_chrome_browser_pdf.patch b/patches/chromium/chore_patch_out_profile_methods_in_chrome_browser_pdf.patch
new file mode 100644
index 0000000000..eb21bacb8e
--- /dev/null
+++ b/patches/chromium/chore_patch_out_profile_methods_in_chrome_browser_pdf.patch
@@ -0,0 +1,30 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Charles Kerr <[email protected]>
+Date: Wed, 17 May 2023 14:42:09 -0500
+Subject: chore: patch out Profile methods in chrome_browser_pdf
+
+Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4482679
+
+Electron does not support Profiles, so this Profile::FromBrowserContext()
+call is not needed and will not link. This change patches it out.
+
+diff --git a/chrome/browser/pdf/chrome_pdf_stream_delegate.cc b/chrome/browser/pdf/chrome_pdf_stream_delegate.cc
+index 080e5b64e5fbbe9c126996549dddf7ce312998ee..47a026798a6be7ec8b7cde5b55b29d505d4f2e4c 100644
+--- a/chrome/browser/pdf/chrome_pdf_stream_delegate.cc
++++ b/chrome/browser/pdf/chrome_pdf_stream_delegate.cc
+@@ -39,6 +39,7 @@ namespace {
+ // hierarchy is: enterprise policy > user choice > finch experiment.
+ bool ShouldEnableSkiaRenderer(content::WebContents* contents) {
+ CHECK(contents);
++#if 0
+ const PrefService* prefs =
+ Profile::FromBrowserContext(contents->GetBrowserContext())->GetPrefs();
+
+@@ -46,6 +47,7 @@ bool ShouldEnableSkiaRenderer(content::WebContents* contents) {
+ if (prefs->IsManagedPreference(prefs::kPdfUseSkiaRendererEnabled)) {
+ return prefs->GetBoolean(prefs::kPdfUseSkiaRendererEnabled);
+ }
++#endif
+
+ // When the enterprise policy is not set, use finch/feature flag choice.
+ return base::FeatureList::IsEnabled(
diff --git a/patches/chromium/chore_patch_out_profile_methods_in_profile_selections_cc.patch b/patches/chromium/chore_patch_out_profile_methods_in_profile_selections_cc.patch
index f35294182b..4ef3a60537 100644
--- a/patches/chromium/chore_patch_out_profile_methods_in_profile_selections_cc.patch
+++ b/patches/chromium/chore_patch_out_profile_methods_in_profile_selections_cc.patch
@@ -8,20 +8,20 @@ is therefore not a method that will compile given we don't include
relevant files.
diff --git a/chrome/browser/profiles/profile_selections.cc b/chrome/browser/profiles/profile_selections.cc
-index 10aa2b39d4033d92fe7502532a497d394c4351d9..23e70eb0b6f49b164ffe615b32d2821e83753658 100644
+index 7e0a4eb93ac9444d760d13736c1a2f6381fc3a7b..d5e45f27144ee4b05b82d699071eaa0780c9401d 100644
--- a/chrome/browser/profiles/profile_selections.cc
+++ b/chrome/browser/profiles/profile_selections.cc
-@@ -18,6 +18,7 @@ BASE_FEATURE(kSystemProfileSelectionDefaultNone,
- base::FeatureState::FEATURE_ENABLED_BY_DEFAULT);
+@@ -14,6 +14,7 @@
+ #endif // BUILDFLAG(IS_CHROMEOS_ASH)
bool AreKeyedServicesDisabledForProfileByDefault(const Profile* profile) {
+#if 0
+ // By default disable all services for System Profile.
+ // Even though having no services is also the default value for Guest Profile,
+ // this is not really the case in practice because a lot of Service Factories
+@@ -21,7 +22,7 @@ bool AreKeyedServicesDisabledForProfileByDefault(const Profile* profile) {
if (profile && profile->IsSystemProfile()) {
- // The default behavior of the system profile selection depends on the value
- // of `kSystemProfileSelectionDefaultNone` feature flag.
-@@ -28,7 +29,7 @@ bool AreKeyedServicesDisabledForProfileByDefault(const Profile* profile) {
-
- return system_profile_default == ProfileSelection::kNone;
+ return true;
}
-
+#endif
diff --git a/patches/chromium/chore_patch_out_profile_methods_in_titlebar_config.patch b/patches/chromium/chore_patch_out_profile_methods_in_titlebar_config.patch
new file mode 100644
index 0000000000..797ad428e2
--- /dev/null
+++ b/patches/chromium/chore_patch_out_profile_methods_in_titlebar_config.patch
@@ -0,0 +1,22 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Charles Kerr <[email protected]>
+Date: Thu, 18 May 2023 22:43:53 -0500
+Subject: chore: patch out Profile methods in titlebar_config
+
+Make this code linkable in Electron by removing Profile references.
+
+diff --git a/chrome/browser/win/titlebar_config.cc b/chrome/browser/win/titlebar_config.cc
+index c270ecf428b85ff95835d8a9f6219d98113743a9..dd55d15add870fa8dfcef0b193a55af679ba6737 100644
+--- a/chrome/browser/win/titlebar_config.cc
++++ b/chrome/browser/win/titlebar_config.cc
+@@ -21,8 +21,10 @@ BASE_FEATURE(kWindows11MicaTitlebar,
+
+ bool ShouldBrowserCustomDrawTitlebar(BrowserView* browser_view) {
+ return !ShouldDefaultThemeUseMicaTitlebar() ||
++#if 0
+ !ThemeServiceFactory::GetForProfile(browser_view->GetProfile())
+ ->UsingSystemTheme() ||
++#endif
+ (!browser_view->browser()->is_type_normal() &&
+ !browser_view->browser()->is_type_popup() &&
+ !browser_view->browser()->is_type_devtools());
diff --git a/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch b/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch
index fa3c6c357e..2a2c4c5360 100644
--- a/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch
+++ b/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch
@@ -35,10 +35,10 @@ index 155296ba7ee5495be62045bc620bb1cd31d3ceb3..954efde9e7a58f8b556c6ceabb81643f
content::RenderFrameHost* requesting_frame,
const blink::mojom::FullscreenOptions& options) final;
diff --git a/chrome/browser/ui/ash/ash_web_view_impl.cc b/chrome/browser/ui/ash/ash_web_view_impl.cc
-index 75330f607c55ce38779150a512f7c1b249dbfa39..788613af709434e086360a5a383fa7c1bb3fa517 100644
+index 034562cbb05f21eec3ddf9c23f4d36182b032218..1273134d7a4c80e8be07fcb41c2318cc53c9c9e0 100644
--- a/chrome/browser/ui/ash/ash_web_view_impl.cc
+++ b/chrome/browser/ui/ash/ash_web_view_impl.cc
-@@ -96,10 +96,9 @@ bool AshWebViewImpl::IsWebContentsCreationOverridden(
+@@ -100,10 +100,9 @@ bool AshWebViewImpl::IsWebContentsCreationOverridden(
content::SiteInstance* source_site_instance,
content::mojom::WindowContainerType window_container_type,
const GURL& opener_url,
@@ -52,10 +52,10 @@ index 75330f607c55ce38779150a512f7c1b249dbfa39..788613af709434e086360a5a383fa7c1
/*from_user_gesture=*/true);
return true;
diff --git a/chrome/browser/ui/ash/ash_web_view_impl.h b/chrome/browser/ui/ash/ash_web_view_impl.h
-index 68fec72b3b97a18563fade50dd129eba49a86bb6..d3d4af06542c73c61cf8b8ee510a0345ba666739 100644
+index 257b34f41d2ae2743704484aa3a7c6e4bf1b8b34..6452a5ee6676827297842e2845614aa2b05f4d81 100644
--- a/chrome/browser/ui/ash/ash_web_view_impl.h
+++ b/chrome/browser/ui/ash/ash_web_view_impl.h
-@@ -49,8 +49,7 @@ class AshWebViewImpl : public ash::AshWebView,
+@@ -50,8 +50,7 @@ class AshWebViewImpl : public ash::AshWebView,
content::SiteInstance* source_site_instance,
content::mojom::WindowContainerType window_container_type,
const GURL& opener_url,
@@ -80,10 +80,10 @@ index aaaa61d5c3a1d5ade2fd355e38a3985ef5cc4e7d..b45746ba0f38a381a2ee5ca17f3a1685
}
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
-index a4623532f5eb5ce0a77c726ccc47f4fe6b24c42c..7f1c80ab40988510659e56d3dc00c68e51d6c10c 100644
+index 71297e151bb627819fda507a4d28488d93216e7e..76948a3c16a107c7455e97f787393ad8e8f2224c 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
-@@ -1859,12 +1859,11 @@ bool Browser::IsWebContentsCreationOverridden(
+@@ -1858,12 +1858,11 @@ bool Browser::IsWebContentsCreationOverridden(
content::SiteInstance* source_site_instance,
content::mojom::WindowContainerType window_container_type,
const GURL& opener_url,
@@ -218,10 +218,10 @@ index 4e32d708ecf4afd3913d86ec1602ef2dc9a60998..1dd2f50fba1387b5eeb554dd540957d7
void AddNewContents(content::WebContents* source,
std::unique_ptr<content::WebContents> new_contents,
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
-index 3faa83e00bfd72eebfac1290846bba1452b85bdb..57a810427461b8240d5f8da88e6ae2815b06c69a 100644
+index 62bdbaae3dc3d320dfd038282f3946fab5abd0b9..9dee22f645596fd2c2494c1f532e972099d89b2b 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
-@@ -4074,8 +4074,7 @@ FrameTree* WebContentsImpl::CreateNewWindow(
+@@ -4077,8 +4077,7 @@ FrameTree* WebContentsImpl::CreateNewWindow(
if (delegate_ && delegate_->IsWebContentsCreationOverridden(
source_site_instance, params.window_container_type,
diff --git a/patches/chromium/chore_temporarily_patch_out_arc_references.patch b/patches/chromium/chore_temporarily_patch_out_arc_references.patch
new file mode 100644
index 0000000000..d3618a5f30
--- /dev/null
+++ b/patches/chromium/chore_temporarily_patch_out_arc_references.patch
@@ -0,0 +1,111 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Shelley Vohr <[email protected]>
+Date: Mon, 22 May 2023 13:23:57 +0200
+Subject: chore: temporarily patch out ARC references
+
+https://chromium-review.googlesource.com/c/chromium/src/+/4546398
+
+Electron does not support ARC yet.
+
+diff --git a/chrome/browser/icon_loader_mac.mm b/chrome/browser/icon_loader_mac.mm
+index f6acf1369c2ca37687b4f4cd6b3b5763a29c07e7..3443e1597339ebd291517da52c945ae15d1392ce 100644
+--- a/chrome/browser/icon_loader_mac.mm
++++ b/chrome/browser/icon_loader_mac.mm
+@@ -18,9 +18,9 @@
+ #include "ui/gfx/image/image_skia.h"
+ #include "ui/gfx/image/image_skia_util_mac.h"
+
+-#if !defined(__has_feature) || !__has_feature(objc_arc)
+-#error "This file requires ARC support."
+-#endif
++// #if !defined(__has_feature) || !__has_feature(objc_arc)
++// #error "This file requires ARC support."
++// #endif
+
+ // static
+ IconLoader::IconGroup IconLoader::GroupForFilepath(
+diff --git a/chrome/browser/media/webrtc/system_media_capture_permissions_mac.mm b/chrome/browser/media/webrtc/system_media_capture_permissions_mac.mm
+index d9c0ffb9d3a775774545f2b0ddf35f4465a9f641..fbd51a74acfc7fec809fcd19706ae4017f0ece66 100644
+--- a/chrome/browser/media/webrtc/system_media_capture_permissions_mac.mm
++++ b/chrome/browser/media/webrtc/system_media_capture_permissions_mac.mm
+@@ -22,9 +22,9 @@
+ #include "media/base/media_switches.h"
+ #include "ui/base/cocoa/permissions_utils.h"
+
+-#if !defined(__has_feature) || !__has_feature(objc_arc)
+-#error "This file requires ARC support."
+-#endif
++// #if !defined(__has_feature) || !__has_feature(objc_arc)
++// #error "This file requires ARC support."
++// #endif
+
+ namespace system_media_permissions {
+
+diff --git a/chrome/browser/media/webrtc/system_media_capture_permissions_stats_mac.mm b/chrome/browser/media/webrtc/system_media_capture_permissions_stats_mac.mm
+index c8ab96a87f5e5203223bdbbf45f68b1d00226585..2c46f06d1dfd566f7e76b9d7291414c1dcdd06c6 100644
+--- a/chrome/browser/media/webrtc/system_media_capture_permissions_stats_mac.mm
++++ b/chrome/browser/media/webrtc/system_media_capture_permissions_stats_mac.mm
+@@ -10,9 +10,9 @@
+ #include "components/prefs/pref_registry_simple.h"
+ #include "components/prefs/pref_service.h"
+
+-#if !defined(__has_feature) || !__has_feature(objc_arc)
+-#error "This file requires ARC support."
+-#endif
++// #if !defined(__has_feature) || !__has_feature(objc_arc)
++// #error "This file requires ARC support."
++// #endif
+
+ namespace system_media_permissions {
+
+diff --git a/chrome/browser/media/webrtc/window_icon_util_mac.mm b/chrome/browser/media/webrtc/window_icon_util_mac.mm
+index b075efd130f996d01ce8204921832d02c476dfce..3b1933aa037610ca0ab9ebf969c80fea3ac0a5a3 100644
+--- a/chrome/browser/media/webrtc/window_icon_util_mac.mm
++++ b/chrome/browser/media/webrtc/window_icon_util_mac.mm
+@@ -11,9 +11,9 @@
+ #include "third_party/libyuv/include/libyuv/convert_argb.h"
+ #include "third_party/skia/include/core/SkBitmap.h"
+
+-#if !defined(__has_feature) || !__has_feature(objc_arc)
+-#error "This file requires ARC support."
+-#endif
++// #if !defined(__has_feature) || !__has_feature(objc_arc)
++// #error "This file requires ARC support."
++// #endif
+
+ gfx::ImageSkia GetWindowIcon(content::DesktopMediaID id) {
+ DCHECK(id.type == content::DesktopMediaID::TYPE_WINDOW);
+diff --git a/chrome/browser/platform_util_mac.mm b/chrome/browser/platform_util_mac.mm
+index 57eac7e0e9a83609701c6d5d9760112f6227b4df..03955f351cc0024cabd0a83f5e243071a95ce0fb 100644
+--- a/chrome/browser/platform_util_mac.mm
++++ b/chrome/browser/platform_util_mac.mm
+@@ -20,9 +20,9 @@
+ #include "ui/views/widget/widget.h"
+ #include "url/gurl.h"
+
+-#if !defined(__has_feature) || !__has_feature(objc_arc)
+-#error "This file requires ARC support."
+-#endif
++// #if !defined(__has_feature) || !__has_feature(objc_arc)
++// #error "This file requires ARC support."
++// #endif
+
+ namespace platform_util {
+
+diff --git a/chrome/browser/process_singleton_mac.mm b/chrome/browser/process_singleton_mac.mm
+index c92f894bbc99718747bff420e1713198d0f7a2b8..032dfb8823918da92aabf6601e493b8bbf003003 100644
+--- a/chrome/browser/process_singleton_mac.mm
++++ b/chrome/browser/process_singleton_mac.mm
+@@ -9,9 +9,9 @@
+
+ #include "base/mac/scoped_aedesc.h"
+
+-#if !defined(__has_feature) || !__has_feature(objc_arc)
+-#error "This file requires ARC support."
+-#endif
++// #if !defined(__has_feature) || !__has_feature(objc_arc)
++// #error "This file requires ARC support."
++// #endif
+
+ namespace {
+
diff --git a/patches/chromium/crash_allow_setting_more_options.patch b/patches/chromium/crash_allow_setting_more_options.patch
index dd1bb61514..2c67259d58 100644
--- a/patches/chromium/crash_allow_setting_more_options.patch
+++ b/patches/chromium/crash_allow_setting_more_options.patch
@@ -89,10 +89,10 @@ index 99efa6b245b9944710b76a342ec9a37947078a48..e55df93f17560a566e1dd2a63c560054
annotations, arguments, false, false));
} else {
diff --git a/components/crash/core/app/crashpad_mac.mm b/components/crash/core/app/crashpad_mac.mm
-index cab2c95eee53e6c406d6867b0a6e53a3a9fb5ce3..46935fcbf84cf1472214904cf96b03aa0e57be8f 100644
+index d7351f4a912b36bb541c59a408bae85dda537fc4..49e3e819f51621ce9b5f52eeed561983533783c8 100644
--- a/components/crash/core/app/crashpad_mac.mm
+++ b/components/crash/core/app/crashpad_mac.mm
-@@ -85,6 +85,8 @@
+@@ -91,6 +91,8 @@
} // @autoreleasepool
return process_annotations;
}();
@@ -101,7 +101,7 @@ index cab2c95eee53e6c406d6867b0a6e53a3a9fb5ce3..46935fcbf84cf1472214904cf96b03aa
return annotations;
}
-@@ -155,6 +157,13 @@ bool PlatformCrashpadInitialization(
+@@ -161,6 +163,13 @@ bool PlatformCrashpadInitialization(
std::vector<std::string> arguments;
diff --git a/patches/chromium/create_browser_v8_snapshot_file_name_fuse.patch b/patches/chromium/create_browser_v8_snapshot_file_name_fuse.patch
index e02cd21be0..548a9e217a 100644
--- a/patches/chromium/create_browser_v8_snapshot_file_name_fuse.patch
+++ b/patches/chromium/create_browser_v8_snapshot_file_name_fuse.patch
@@ -7,7 +7,7 @@ By default, chromium sets up one v8 snapshot to be used in all v8 contexts. This
to have a dedicated browser process v8 snapshot defined by the file `browser_v8_context_snapshot.bin`.
diff --git a/content/app/content_main_runner_impl.cc b/content/app/content_main_runner_impl.cc
-index d2ca2effde6f7523518c1531f86506c4f619797e..287abd4623f56ef00354c5892b3b6ac15786e915 100644
+index 77a9818606c3e2cde6f74d5009a05a851b6295e9..41dbb00019c076d038380862c4953e6f2b6e2275 100644
--- a/content/app/content_main_runner_impl.cc
+++ b/content/app/content_main_runner_impl.cc
@@ -39,6 +39,7 @@
@@ -18,7 +18,7 @@ index d2ca2effde6f7523518c1531f86506c4f619797e..287abd4623f56ef00354c5892b3b6ac1
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/task/single_thread_task_runner.h"
-@@ -257,8 +258,13 @@ std::string GetSnapshotDataDescriptor(const base::CommandLine& command_line) {
+@@ -258,8 +259,13 @@ std::string GetSnapshotDataDescriptor(const base::CommandLine& command_line) {
#endif
@@ -33,7 +33,7 @@ index d2ca2effde6f7523518c1531f86506c4f619797e..287abd4623f56ef00354c5892b3b6ac1
#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)
base::FileDescriptorStore& file_descriptor_store =
base::FileDescriptorStore::GetInstance();
-@@ -287,11 +293,12 @@ bool ShouldLoadV8Snapshot(const base::CommandLine& command_line,
+@@ -288,11 +294,12 @@ bool ShouldLoadV8Snapshot(const base::CommandLine& command_line,
#endif // V8_USE_EXTERNAL_STARTUP_DATA
@@ -48,7 +48,7 @@ index d2ca2effde6f7523518c1531f86506c4f619797e..287abd4623f56ef00354c5892b3b6ac1
#endif // V8_USE_EXTERNAL_STARTUP_DATA
}
-@@ -965,7 +972,7 @@ int ContentMainRunnerImpl::Initialize(ContentMainParams params) {
+@@ -966,7 +973,7 @@ int ContentMainRunnerImpl::Initialize(ContentMainParams params) {
return TerminateForFatalInitializationError();
#endif // BUILDFLAG(IS_ANDROID) && (ICU_UTIL_DATA_IMPL == ICU_UTIL_DATA_FILE)
@@ -102,10 +102,10 @@ index d4bb0e9a017a833b403916e1d6e64fb058f40f86..35ba35a95e39700824d6e0b480b99bc3
friend class ContentClientCreator;
friend class ContentClientInitializer;
diff --git a/gin/v8_initializer.cc b/gin/v8_initializer.cc
-index 8a0a8c4f678c017d455981d723eff04d2463082a..40681f43a238784a7bd4540019e8878cbc99a63d 100644
+index 0d56182a284b91e7bf5749dbf0796cbe705d2c1f..a7578102abc92cba4334459f540776dc2463cdb5 100644
--- a/gin/v8_initializer.cc
+++ b/gin/v8_initializer.cc
-@@ -507,8 +507,7 @@ void V8Initializer::GetV8ExternalSnapshotData(const char** snapshot_data_out,
+@@ -514,8 +514,7 @@ void V8Initializer::GetV8ExternalSnapshotData(const char** snapshot_data_out,
#if defined(V8_USE_EXTERNAL_STARTUP_DATA)
@@ -115,7 +115,7 @@ index 8a0a8c4f678c017d455981d723eff04d2463082a..40681f43a238784a7bd4540019e8878c
if (g_mapped_snapshot) {
// TODO(crbug.com/802962): Confirm not loading different type of snapshot
// files in a process.
-@@ -517,10 +516,17 @@ void V8Initializer::LoadV8Snapshot(V8SnapshotFileType snapshot_file_type) {
+@@ -524,10 +523,17 @@ void V8Initializer::LoadV8Snapshot(V8SnapshotFileType snapshot_file_type) {
base::MemoryMappedFile::Region file_region;
base::File file =
diff --git a/patches/chromium/dcheck.patch b/patches/chromium/dcheck.patch
index 855ecd91f1..fe41cba258 100644
--- a/patches/chromium/dcheck.patch
+++ b/patches/chromium/dcheck.patch
@@ -17,10 +17,10 @@ only one or two specific checks fail. Then it's better to simply comment out the
failing checks and allow the rest of the target to have them enabled.
diff --git a/ui/base/clipboard/clipboard_win.cc b/ui/base/clipboard/clipboard_win.cc
-index 5586af89bd658796a803c9b6098036b8266615d8..0af8417bd9440cb003ded58961a9fcd8366dd9e0 100644
+index 419781eac524f82d746f86d44dad9a3d25f31d49..1b1e0d59222d69c30edef87a96f85d78adee10d3 100644
--- a/ui/base/clipboard/clipboard_win.cc
+++ b/ui/base/clipboard/clipboard_win.cc
-@@ -888,10 +888,10 @@ SkBitmap ClipboardWin::ReadBitmapInternal(ClipboardBuffer buffer) const {
+@@ -901,10 +901,10 @@ SkBitmap ClipboardWin::ReadBitmapInternal(ClipboardBuffer buffer) const {
void ClipboardWin::WriteToClipboard(ClipboardFormatType format, HANDLE handle) {
UINT cf_format = format.ToFormatEtc().cfFormat;
diff --git a/patches/chromium/disable_color_correct_rendering.patch b/patches/chromium/disable_color_correct_rendering.patch
index 434b007041..15f51201cb 100644
--- a/patches/chromium/disable_color_correct_rendering.patch
+++ b/patches/chromium/disable_color_correct_rendering.patch
@@ -20,7 +20,7 @@ to deal with color spaces. That is being tracked at
https://crbug.com/634542 and https://crbug.com/711107.
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
-index 16117d0b40245282ed59a8b9c0cebddc3b2e288c..dd03e12e2b2069e426401ec91a3070e0a2dc0de7 100644
+index 7fe522215517ed9ac20f9895992b0b6bd1e1352c..58718799cc95768b897d94e12a4022c78ef84b54 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -1919,6 +1919,10 @@ void LayerTreeHostImpl::SetIsLikelyToRequireADraw(
@@ -35,7 +35,7 @@ index 16117d0b40245282ed59a8b9c0cebddc3b2e288c..dd03e12e2b2069e426401ec91a3070e0
// If we are likely to software composite the resource, we use sRGB because
// software compositing is unable to perform color conversion.
diff --git a/cc/trees/layer_tree_settings.h b/cc/trees/layer_tree_settings.h
-index b85b3251a752afc1305108ad370bbe8453e4f789..e24eefabacf2fcdbd15b26e0c696579cca909dd8 100644
+index 0d966e045669ee0423d6a486fa8e619938a32de2..1e46ecc1aa8447b3fd0f4e5a66f92ca5ef148887 100644
--- a/cc/trees/layer_tree_settings.h
+++ b/cc/trees/layer_tree_settings.h
@@ -96,6 +96,8 @@ class CC_EXPORT LayerTreeSettings {
@@ -93,10 +93,10 @@ index 110f05ece2064a253683cf0bf52e554788c9c660..49bf6c8f4e0f198b2c7b2b1d7cf04bcb
sandbox::policy::switches::kGpuSandboxAllowSysVShm,
sandbox::policy::switches::kGpuSandboxFailuresFatal,
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
-index 88492051b80ed4a989cb9fdf8231a38534ea4c7e..58996935d6c62bec7e090e7bed50fc870bdb46fd 100644
+index 15effd78c0a10f13dbd17b18daa12456a6bc19ae..bd563e0b55f707f1c72c221257e968320302895e 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
-@@ -3350,6 +3350,7 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer(
+@@ -3392,6 +3392,7 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer(
// Propagate the following switches to the renderer command line (along
// with any associated values) if present in the browser command line.
static const char* const kSwitchNames[] = {
@@ -148,7 +148,7 @@ index 318005b66e04ed03ce6d44931d9360c0e009cb94..0d622fddb95720141ccf8a285ace4714
}
diff --git a/third_party/blink/renderer/platform/widget/compositing/layer_tree_settings.cc b/third_party/blink/renderer/platform/widget/compositing/layer_tree_settings.cc
-index 3ebaee0026affd8a9eb4cf36432cbefc13db8f3b..0a38a4a281b5b90fea38b6a2662ec5da0087f134 100644
+index 2a31606b1f5814d57ffe59026cc5735fa7cee597..272ae9f414f8d0873e30479b5bfd237c13a69dd9 100644
--- a/third_party/blink/renderer/platform/widget/compositing/layer_tree_settings.cc
+++ b/third_party/blink/renderer/platform/widget/compositing/layer_tree_settings.cc
@@ -25,6 +25,7 @@
@@ -213,7 +213,7 @@ index 95d74c90b324760a0fafcf92fe3f40071ffa0187..cb138579bdb5b552a198d47fde220d81
IOSurfaceSetValue(surface, CFSTR("IOSurfaceColorSpace"), kCGColorSpaceSRGB);
diff --git a/ui/gfx/switches.cc b/ui/gfx/switches.cc
-index cbdfb60d42cb16848847eba67937b95b3504bedf..16c8ff102070ce75c518f8d444cae1e51580d0b4 100644
+index df3caf8fab7a1c1f6bc0efa4fd3dd60b9de66e63..ac254ec1317450a9809da5d244c42fa11a3a4f98 100644
--- a/ui/gfx/switches.cc
+++ b/ui/gfx/switches.cc
@@ -13,6 +13,8 @@ namespace switches {
@@ -226,7 +226,7 @@ index cbdfb60d42cb16848847eba67937b95b3504bedf..16c8ff102070ce75c518f8d444cae1e5
// sharpness, kerning, hinting and layout.
const char kDisableFontSubpixelPositioning[] =
diff --git a/ui/gfx/switches.h b/ui/gfx/switches.h
-index df3520997950911ab8dcd81f654016b2f726ce7d..ac38f23312eef89fb9e2614744c7226fc7091bad 100644
+index ebeb73e7f679280297a09332612a83181e24a4e1..79ec8deb0cab719b344a4964221c10725bd066e7 100644
--- a/ui/gfx/switches.h
+++ b/ui/gfx/switches.h
@@ -13,6 +13,7 @@
@@ -235,5 +235,5 @@ index df3520997950911ab8dcd81f654016b2f726ce7d..ac38f23312eef89fb9e2614744c7226f
GFX_SWITCHES_EXPORT extern const char kAnimationDurationScale[];
+GFX_SWITCHES_EXPORT extern const char kDisableColorCorrectRendering[];
GFX_SWITCHES_EXPORT extern const char kDisableFontSubpixelPositioning[];
- GFX_SWITCHES_EXPORT extern const char kDisablePPAPISharedImagesSwapChain[];
GFX_SWITCHES_EXPORT extern const char kEnableNativeGpuMemoryBuffers[];
+ GFX_SWITCHES_EXPORT extern const char kForcePrefersReducedMotion[];
diff --git a/patches/chromium/disable_hidden.patch b/patches/chromium/disable_hidden.patch
index 6dc9238140..69ff2054b5 100644
--- a/patches/chromium/disable_hidden.patch
+++ b/patches/chromium/disable_hidden.patch
@@ -6,12 +6,12 @@ Subject: disable_hidden.patch
Electron uses this to disable background throttling for hidden windows.
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc
-index e45129c031d9cecd8838483ea6ba23436d59bab3..347b8d89a2ecaa6baa4779f650b8af49a6d6d118 100644
+index 48e6fa3d8447e87ab2a729aa950cc5029c875673..90c6a5b6999571819ef71f859767cccf635ea883 100644
--- a/content/browser/renderer_host/render_widget_host_impl.cc
+++ b/content/browser/renderer_host/render_widget_host_impl.cc
-@@ -800,6 +800,9 @@ void RenderWidgetHostImpl::WasHidden() {
- if (is_hidden_)
+@@ -812,6 +812,9 @@ void RenderWidgetHostImpl::WasHidden() {
return;
+ }
+ if (disable_hidden_)
+ return;
@@ -20,7 +20,7 @@ index e45129c031d9cecd8838483ea6ba23436d59bab3..347b8d89a2ecaa6baa4779f650b8af49
blink::mojom::PointerLockResult::kWrongDocument);
diff --git a/content/browser/renderer_host/render_widget_host_impl.h b/content/browser/renderer_host/render_widget_host_impl.h
-index 308f116c4c2d746dc5da7e52f0e21e9608970db1..968a1a778d01c3ab6738ed8a3982152e2fe5809b 100644
+index fd91b2f2519383ca39342937e7c89ce35ce363a7..0fac80ecc97cb6c7ff3942a311983baa397fee0d 100644
--- a/content/browser/renderer_host/render_widget_host_impl.h
+++ b/content/browser/renderer_host/render_widget_host_impl.h
@@ -900,6 +900,8 @@ class CONTENT_EXPORT RenderWidgetHostImpl
@@ -33,7 +33,7 @@ index 308f116c4c2d746dc5da7e52f0e21e9608970db1..968a1a778d01c3ab6738ed8a3982152e
protected:
// |routing_id| must not be MSG_ROUTING_NONE.
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc
-index c295b6c6bd54f6e537775ce7fbee2a256873cd60..b69ec986a4d8a96677d785cb6768f0c0d154ff2a 100644
+index 680ac2d851294bffa8af216568421a4dd5c01750..82e59b02f6e54f9101e3b9ea5ca0f5b21ce16095 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -607,7 +607,7 @@ void RenderWidgetHostViewAura::HideImpl() {
diff --git a/patches/chromium/disable_unload_metrics.patch b/patches/chromium/disable_unload_metrics.patch
index 7f27acc74c..b91f803c0c 100644
--- a/patches/chromium/disable_unload_metrics.patch
+++ b/patches/chromium/disable_unload_metrics.patch
@@ -24,10 +24,10 @@ This patch temporarily disables the metrics so we can have green CI, and we
should continue seeking for a real fix.
diff --git a/content/browser/renderer_host/navigator.cc b/content/browser/renderer_host/navigator.cc
-index 0e23c0358cf11cdcfd555603aa2e416be3af850a..cebbec3d9a7aed408ae3e7f7c5aa28ab32989e89 100644
+index 057902f871fd474bdd029ce4797bc054a803a510..d41b8bbe37445be23690d69119bb7f722d9db5bd 100644
--- a/content/browser/renderer_host/navigator.cc
+++ b/content/browser/renderer_host/navigator.cc
-@@ -1244,6 +1244,7 @@ void Navigator::RecordNavigationMetrics(
+@@ -1257,6 +1257,7 @@ void Navigator::RecordNavigationMetrics(
.InMilliseconds());
}
@@ -35,7 +35,7 @@ index 0e23c0358cf11cdcfd555603aa2e416be3af850a..cebbec3d9a7aed408ae3e7f7c5aa28ab
// If this is a same-process navigation and we have timestamps for unload
// durations, fill those metrics out as well.
if (params.unload_start && params.unload_end &&
-@@ -1293,6 +1294,7 @@ void Navigator::RecordNavigationMetrics(
+@@ -1306,6 +1307,7 @@ void Navigator::RecordNavigationMetrics(
first_before_unload_start_time)
.InMilliseconds());
}
diff --git a/patches/chromium/export_gin_v8platform_pageallocator_for_usage_outside_of_the_gin.patch b/patches/chromium/export_gin_v8platform_pageallocator_for_usage_outside_of_the_gin.patch
index 2fdaddccec..fe808f9b14 100644
--- a/patches/chromium/export_gin_v8platform_pageallocator_for_usage_outside_of_the_gin.patch
+++ b/patches/chromium/export_gin_v8platform_pageallocator_for_usage_outside_of_the_gin.patch
@@ -9,24 +9,24 @@ correctly tagged with MAP_JIT we need to use gins page allocator instead
of the default V8 allocator. This probably can't be usptreamed.
diff --git a/gin/public/v8_platform.h b/gin/public/v8_platform.h
-index 9c3575725576cddf90e5681a52342f6b8d345bd1..f89ff175d2adf88c16167e8f306c9d3451afe94f 100644
+index 565f531328041edaac847d02881cce6e1e4f7d54..5a40be3acb11c5851daa9f8001e6a176c2d20ab1 100644
--- a/gin/public/v8_platform.h
+++ b/gin/public/v8_platform.h
-@@ -31,6 +31,7 @@ class GIN_EXPORT V8Platform : public v8::Platform {
+@@ -32,6 +32,7 @@ class GIN_EXPORT V8Platform : public v8::Platform {
// enabling Arm's Branch Target Instructions for executable pages. This is
// verified in the tests for gin::PageAllocator.
PageAllocator* GetPageAllocator() override;
+ static PageAllocator* GetCurrentPageAllocator();
- void OnCriticalMemoryPressure() override;
- v8::ZoneBackingAllocator* GetZoneBackingAllocator() override;
+ #if BUILDFLAG(ENABLE_THREAD_ISOLATION)
+ ThreadIsolatedAllocator* GetThreadIsolatedAllocator() override;
#endif
diff --git a/gin/v8_platform.cc b/gin/v8_platform.cc
-index 2cf6d986102904e3aa44b3333938b3bfcbc87470..f40799e5ae37f96ec5f3c8ae2ee73776783b0e5f 100644
+index a0bc00a3d1397934276517c19e0a76098b7099f5..7432989344148480bc4ff5f8808cf588ec45b868 100644
--- a/gin/v8_platform.cc
+++ b/gin/v8_platform.cc
-@@ -330,6 +330,10 @@ PageAllocator* V8Platform::GetPageAllocator() {
- return g_page_allocator.Pointer();
+@@ -338,6 +338,10 @@ ThreadIsolatedAllocator* V8Platform::GetThreadIsolatedAllocator() {
}
+ #endif // BUILDFLAG(ENABLE_THREAD_ISOLATION)
+PageAllocator* V8Platform::GetCurrentPageAllocator() {
+ return g_page_allocator.Pointer();
diff --git a/patches/chromium/expose_v8initializer_codegenerationcheckcallbackinmainthread.patch b/patches/chromium/expose_v8initializer_codegenerationcheckcallbackinmainthread.patch
index 8fa8ae5405..d7f3ffc950 100644
--- a/patches/chromium/expose_v8initializer_codegenerationcheckcallbackinmainthread.patch
+++ b/patches/chromium/expose_v8initializer_codegenerationcheckcallbackinmainthread.patch
@@ -6,10 +6,10 @@ Subject: expose V8Initializer::CodeGenerationCheckCallbackInMainThread
This is needed to blend Blink and Node's policy for code generation policy.
diff --git a/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc b/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc
-index 491fe7c8cda4899c37ad98da2b6daffc03944942..42ccef313e33f233342a8bd7bd5e4f0bc3847e85 100644
+index 6cc93de0150bebc10cee83aadc3a643eb8e84ce7..ec992270b6aa54e4507ad0bad501793f72353834 100644
--- a/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc
+++ b/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc
-@@ -444,8 +444,9 @@ TrustedTypesCodeGenerationCheck(v8::Local<v8::Context> context,
+@@ -439,8 +439,9 @@ TrustedTypesCodeGenerationCheck(v8::Local<v8::Context> context,
return {true, V8String(context->GetIsolate(), stringified_source)};
}
diff --git a/patches/chromium/extend_apply_webpreferences.patch b/patches/chromium/extend_apply_webpreferences.patch
index 49af5b2a75..2ee55b6832 100644
--- a/patches/chromium/extend_apply_webpreferences.patch
+++ b/patches/chromium/extend_apply_webpreferences.patch
@@ -12,7 +12,7 @@ Ideally we could add an embedder observer pattern here but that can be
done in future work.
diff --git a/third_party/blink/renderer/core/exported/web_view_impl.cc b/third_party/blink/renderer/core/exported/web_view_impl.cc
-index 55650ca27d81d09f9ad315b699cade5a6d7eaca9..6fcf69200ed29b290be4e3dcbb9caabf02c1b520 100644
+index acda9f8ea1789d3febc0386ae855c009ea462816..a4c7852daaf4ddef3c82150cf91ab1047de92eb5 100644
--- a/third_party/blink/renderer/core/exported/web_view_impl.cc
+++ b/third_party/blink/renderer/core/exported/web_view_impl.cc
@@ -165,6 +165,7 @@
@@ -23,7 +23,7 @@ index 55650ca27d81d09f9ad315b699cade5a6d7eaca9..6fcf69200ed29b290be4e3dcbb9caabf
#include "third_party/blink/renderer/platform/graphics/image.h"
#include "third_party/blink/renderer/platform/graphics/paint/cull_rect.h"
#include "third_party/blink/renderer/platform/graphics/paint/paint_record_builder.h"
-@@ -1759,6 +1760,7 @@ void WebView::ApplyWebPreferences(const web_pref::WebPreferences& prefs,
+@@ -1764,6 +1765,7 @@ void WebView::ApplyWebPreferences(const web_pref::WebPreferences& prefs,
#if BUILDFLAG(IS_MAC)
web_view_impl->SetMaximumLegibleScale(
prefs.default_maximum_page_scale_factor);
diff --git a/patches/chromium/feat_add_set_theme_source_to_allow_apps_to.patch b/patches/chromium/feat_add_set_theme_source_to_allow_apps_to.patch
index 03bf2432dd..df662f6b57 100644
--- a/patches/chromium/feat_add_set_theme_source_to_allow_apps_to.patch
+++ b/patches/chromium/feat_add_set_theme_source_to_allow_apps_to.patch
@@ -26,7 +26,7 @@ index 4c60eb7caf5eddbdb71b753c710c7053476bee04..88dd58492d84c6da4f179a5ef651923a
}
diff --git a/ui/native_theme/native_theme.h b/ui/native_theme/native_theme.h
-index f95db55b9899b7314792c99fad87e29530715d11..16f7d5c92e4380c7a705eaa6dc7bc11349d7f7f2 100644
+index a337d8ff4ed81dae4455af01cc9dc72356a31f82..ca9318f403ce9e80b28b107a47f67405663e8775 100644
--- a/ui/native_theme/native_theme.h
+++ b/ui/native_theme/native_theme.h
@@ -410,6 +410,23 @@ class NATIVE_THEME_EXPORT NativeTheme {
diff --git a/patches/chromium/feat_configure_launch_options_for_service_process.patch b/patches/chromium/feat_configure_launch_options_for_service_process.patch
index 13787d964d..2bd02c0dee 100644
--- a/patches/chromium/feat_configure_launch_options_for_service_process.patch
+++ b/patches/chromium/feat_configure_launch_options_for_service_process.patch
@@ -84,7 +84,7 @@ index 6d8aa39ab75edcba3e34134566c9fcbe56a7ec57..30912cc39806b13c47b85ba1bfc848a2
DCHECK(GetZygoteForLaunch());
// Environment variables could be supported in the future, but are not
diff --git a/content/browser/child_process_launcher_helper_mac.cc b/content/browser/child_process_launcher_helper_mac.cc
-index 7bac4c30d0be2d89335a3f77ac7fd84d120ca4ce..39b3927d42fe65563a2d4bb735c9432f1e8c386f 100644
+index 37eb06424d5ab1fc1919dc1cde603d9287014cab..08cd71c5669de94c8aebfc37849cadfcf838cf75 100644
--- a/content/browser/child_process_launcher_helper_mac.cc
+++ b/content/browser/child_process_launcher_helper_mac.cc
@@ -123,7 +123,8 @@ bool ChildProcessLauncherHelper::BeforeLaunchOnLauncherThread(
@@ -97,7 +97,7 @@ index 7bac4c30d0be2d89335a3f77ac7fd84d120ca4ce..39b3927d42fe65563a2d4bb735c9432f
options->disclaim_responsibility = delegate_->DisclaimResponsibility();
options->enable_cpu_security_mitigations =
delegate_->EnableCpuSecurityMitigations();
-@@ -184,6 +185,11 @@ bool ChildProcessLauncherHelper::BeforeLaunchOnLauncherThread(
+@@ -187,6 +188,11 @@ bool ChildProcessLauncherHelper::BeforeLaunchOnLauncherThread(
base::StringPrintf("%s%d", sandbox::switches::kSeatbeltClient, pipe));
}
@@ -163,13 +163,13 @@ index fee8640ccee0a24e1f1e282e9bad3a26bd721df8..4b6a3e7aaf686ea23500b7e051156e59
}
diff --git a/content/browser/service_process_host_impl.cc b/content/browser/service_process_host_impl.cc
-index 4d4c17b8fe687e01f7403335c88453998259d647..22c1e5fd0c6f16a101b2578675704f185e812791 100644
+index 01e62d7e8df65efb900e9cd0d34bcd8e0ed3e7da..9af6784707f125046d9a734165fc2b08cf3c97bf 100644
--- a/content/browser/service_process_host_impl.cc
+++ b/content/browser/service_process_host_impl.cc
-@@ -198,6 +198,15 @@ void LaunchServiceProcess(mojo::GenericPendingReceiver receiver,
- host->SetExtraCommandLineSwitches(std::move(options.extra_switches));
- if (options.child_flags)
- host->set_child_flags(*options.child_flags);
+@@ -208,6 +208,15 @@ void LaunchServiceProcess(mojo::GenericPendingReceiver receiver,
+ host->SetPinUser32();
+ }
+ #endif // BUILDFLAG(IS_WIN)
+#if BUILDFLAG(IS_WIN)
+ host->SetStdioHandles(std::move(options.stdout_handle), std::move(options.stderr_handle));
+#elif BUILDFLAG(IS_POSIX)
@@ -183,7 +183,7 @@ index 4d4c17b8fe687e01f7403335c88453998259d647..22c1e5fd0c6f16a101b2578675704f18
host->GetChildProcess()->BindServiceInterface(std::move(receiver));
}
diff --git a/content/browser/utility_process_host.cc b/content/browser/utility_process_host.cc
-index 475614df3115ac27fafa4cf23f65be8e794e9f90..d3a5fd8531754c07aa1fa7e175d4a650cbbeb885 100644
+index c223138472a6d4f64c65e645bb842a6be876e6b4..255ed2faa4b7b9d97800f34d1bd921a8b5925861 100644
--- a/content/browser/utility_process_host.cc
+++ b/content/browser/utility_process_host.cc
@@ -156,11 +156,13 @@ const ChildProcessData& UtilityProcessHost::GetData() {
@@ -202,7 +202,7 @@ index 475614df3115ac27fafa4cf23f65be8e794e9f90..d3a5fd8531754c07aa1fa7e175d4a650
bool UtilityProcessHost::Start() {
return StartProcess();
-@@ -216,6 +218,24 @@ void UtilityProcessHost::SetZygoteForTesting(ZygoteCommunication* handle) {
+@@ -226,6 +228,24 @@ void UtilityProcessHost::SetZygoteForTesting(ZygoteCommunication* handle) {
}
#endif // BUILDFLAG(USE_ZYGOTE)
@@ -227,7 +227,7 @@ index 475614df3115ac27fafa4cf23f65be8e794e9f90..d3a5fd8531754c07aa1fa7e175d4a650
mojom::ChildProcess* UtilityProcessHost::GetChildProcess() {
return static_cast<ChildProcessHostImpl*>(process_->GetHost())
->child_process();
-@@ -431,9 +451,22 @@ bool UtilityProcessHost::StartProcess() {
+@@ -441,9 +461,22 @@ bool UtilityProcessHost::StartProcess() {
}
#endif // BUILDFLAG(IS_LINUX)
@@ -249,10 +249,10 @@ index 475614df3115ac27fafa4cf23f65be8e794e9f90..d3a5fd8531754c07aa1fa7e175d4a650
+ sandbox_type_, env_, current_directory_, *cmd_line,
+ inherit_environment_);
- #if BUILDFLAG(USE_ZYGOTE)
- if (zygote_for_testing_.has_value()) {
+ #if BUILDFLAG(IS_WIN)
+ if (!preload_libraries_.empty()) {
diff --git a/content/browser/utility_process_host.h b/content/browser/utility_process_host.h
-index 65e59b1cbf33c065a500b7d304ed6618d0a24808..e3b1aa7963b4ab9daafdd3340ecfaee07d93f8ea 100644
+index 45b85c90b5d01a0b1311e15705794ab4c9369fa1..d13dbd7a917e53a4dbee21ad0f98a5bd2ab1d1b9 100644
--- a/content/browser/utility_process_host.h
+++ b/content/browser/utility_process_host.h
@@ -35,6 +35,10 @@
@@ -282,7 +282,7 @@ index 65e59b1cbf33c065a500b7d304ed6618d0a24808..e3b1aa7963b4ab9daafdd3340ecfaee0
// Starts the utility process.
bool Start();
-@@ -146,6 +154,16 @@ class CONTENT_EXPORT UtilityProcessHost
+@@ -154,6 +162,16 @@ class CONTENT_EXPORT UtilityProcessHost
void SetZygoteForTesting(ZygoteCommunication* handle);
#endif // BUILDFLAG(USE_ZYGOTE)
@@ -299,7 +299,7 @@ index 65e59b1cbf33c065a500b7d304ed6618d0a24808..e3b1aa7963b4ab9daafdd3340ecfaee0
// Returns a control interface for the running child process.
mojom::ChildProcess* GetChildProcess();
-@@ -194,6 +212,22 @@ class CONTENT_EXPORT UtilityProcessHost
+@@ -209,6 +227,22 @@ class CONTENT_EXPORT UtilityProcessHost
absl::optional<raw_ptr<ZygoteCommunication>> zygote_for_testing_;
#endif // BUILDFLAG(USE_ZYGOTE)
@@ -323,7 +323,7 @@ index 65e59b1cbf33c065a500b7d304ed6618d0a24808..e3b1aa7963b4ab9daafdd3340ecfaee0
// launch failed.
enum class LaunchState {
diff --git a/content/browser/utility_sandbox_delegate.cc b/content/browser/utility_sandbox_delegate.cc
-index 5a8f79cce1e6635e4656383cea8ab8763d09aa59..665904af73916b269adfb2b793c5792bbb26e862 100644
+index 1caf159300af5f8910d0c691c6eb5b2475d9f9a0..d3e4adfad23176d6e7989eb20d1f08d780d8831b 100644
--- a/content/browser/utility_sandbox_delegate.cc
+++ b/content/browser/utility_sandbox_delegate.cc
@@ -29,13 +29,15 @@ UtilitySandboxedProcessLauncherDelegate::
@@ -346,7 +346,7 @@ index 5a8f79cce1e6635e4656383cea8ab8763d09aa59..665904af73916b269adfb2b793c5792b
#if DCHECK_IS_ON()
bool supported_sandbox_type =
sandbox_type_ == sandbox::mojom::Sandbox::kNoSandbox ||
-@@ -97,11 +99,17 @@ UtilitySandboxedProcessLauncherDelegate::GetSandboxType() {
+@@ -96,11 +98,17 @@ UtilitySandboxedProcessLauncherDelegate::GetSandboxType() {
return sandbox_type_;
}
@@ -367,10 +367,10 @@ index 5a8f79cce1e6635e4656383cea8ab8763d09aa59..665904af73916b269adfb2b793c5792b
#if BUILDFLAG(USE_ZYGOTE)
ZygoteCommunication* UtilitySandboxedProcessLauncherDelegate::GetZygote() {
diff --git a/content/browser/utility_sandbox_delegate.h b/content/browser/utility_sandbox_delegate.h
-index aaf1549544051226c83e78d5d6dedac6f03618c9..517f1c05ed2bcf726a3f5aaed932adcd310a5e82 100644
+index 49b9f8429ebdd238e0e9ffb00cdf1848bda898a8..f79c7f0298ee76b2faaead195990925350306e49 100644
--- a/content/browser/utility_sandbox_delegate.h
+++ b/content/browser/utility_sandbox_delegate.h
-@@ -26,7 +26,9 @@ class UtilitySandboxedProcessLauncherDelegate
+@@ -27,7 +27,9 @@ class UtilitySandboxedProcessLauncherDelegate
public:
UtilitySandboxedProcessLauncherDelegate(sandbox::mojom::Sandbox sandbox_type,
const base::EnvironmentMap& env,
@@ -381,7 +381,7 @@ index aaf1549544051226c83e78d5d6dedac6f03618c9..517f1c05ed2bcf726a3f5aaed932adcd
~UtilitySandboxedProcessLauncherDelegate() override;
sandbox::mojom::Sandbox GetSandboxType() override;
-@@ -46,25 +48,25 @@ class UtilitySandboxedProcessLauncherDelegate
+@@ -54,18 +56,16 @@ class UtilitySandboxedProcessLauncherDelegate
ZygoteCommunication* GetZygote() override;
#endif // BUILDFLAG(USE_ZYGOTE)
@@ -400,7 +400,9 @@ index aaf1549544051226c83e78d5d6dedac6f03618c9..517f1c05ed2bcf726a3f5aaed932adcd
base::EnvironmentMap env_;
-#endif // BUILDFLAG(IS_POSIX)
- #if BUILDFLAG(USE_ZYGOTE)
+ #if BUILDFLAG(IS_WIN)
+ std::vector<base::FilePath> preload_libraries_;
+@@ -76,8 +76,10 @@ class UtilitySandboxedProcessLauncherDelegate
absl::optional<raw_ptr<ZygoteCommunication>> zygote_;
#endif // BUILDFLAG(USE_ZYGOTE)
@@ -434,7 +436,7 @@ index 498f60227d13eb2e476413f88eaa58cc0babf461..619639ad5d22a1121b0e0d5f2c9e3c10
} // namespace content
diff --git a/content/public/browser/service_process_host.cc b/content/public/browser/service_process_host.cc
-index b11ee73bed669057c02a9b3294a172003a339447..a33456d43a70fb01506c4c081f4f07f789801e87 100644
+index e6bd27288a8d29dcf263a0677d2629d0aa7cf7c4..24d5acf41ea3fb825d813a040644aef1c9d6d4ee 100644
--- a/content/public/browser/service_process_host.cc
+++ b/content/public/browser/service_process_host.cc
@@ -52,12 +52,45 @@ ServiceProcessHost::Options::WithExtraCommandLineSwitches(
@@ -480,11 +482,11 @@ index b11ee73bed669057c02a9b3294a172003a339447..a33456d43a70fb01506c4c081f4f07f7
+ return *this;
+}
+
- ServiceProcessHost::Options ServiceProcessHost::Options::Pass() {
- return std::move(*this);
- }
+ #if BUILDFLAG(IS_WIN)
+ ServiceProcessHost::Options&
+ ServiceProcessHost::Options::WithPreloadedLibraries(
diff --git a/content/public/browser/service_process_host.h b/content/public/browser/service_process_host.h
-index 123bb6fe8287b65b9c47f726fc3f29e3f3976ad9..a3fd4878dbaa5e28b3111c2ffd3718653628e18d 100644
+index 32fad70cbdf15d587eb32fa74b2995d30b27f694..2df65c405acdf896c5a66dcd3d0aaf44031bc2f7 100644
--- a/content/public/browser/service_process_host.h
+++ b/content/public/browser/service_process_host.h
@@ -13,6 +13,7 @@
@@ -495,9 +497,9 @@ index 123bb6fe8287b65b9c47f726fc3f29e3f3976ad9..a3fd4878dbaa5e28b3111c2ffd371865
#include "base/process/process_handle.h"
#include "base/strings/string_piece.h"
#include "build/chromecast_buildflags.h"
-@@ -30,6 +31,10 @@
- #include "mojo/public/cpp/system/message_pipe.h"
- #endif
+@@ -35,6 +36,10 @@
+ #include "base/types/pass_key.h"
+ #endif // BUILDFLAG(IS_WIN)
+#if BUILDFLAG(IS_WIN)
+#include "base/win/scoped_handle.h"
@@ -506,7 +508,7 @@ index 123bb6fe8287b65b9c47f726fc3f29e3f3976ad9..a3fd4878dbaa5e28b3111c2ffd371865
namespace base {
class Process;
} // namespace base
-@@ -93,11 +98,30 @@ class CONTENT_EXPORT ServiceProcessHost {
+@@ -100,11 +105,30 @@ class CONTENT_EXPORT ServiceProcessHost {
// Specifies extra command line switches to append before launch.
Options& WithExtraCommandLineSwitches(std::vector<std::string> switches);
@@ -534,10 +536,10 @@ index 123bb6fe8287b65b9c47f726fc3f29e3f3976ad9..a3fd4878dbaa5e28b3111c2ffd371865
+ Options& WithEnvironment(const base::EnvironmentMap& environment,
+ bool new_environment);
+
- // Passes the contents of this Options object to a newly returned Options
- // value. This must be called when moving a built Options object into a call
- // to |Launch()|.
-@@ -107,7 +131,16 @@ class CONTENT_EXPORT ServiceProcessHost {
+ #if BUILDFLAG(IS_WIN)
+ // Specifies libraries to preload before the sandbox is locked down. Paths
+ // should be absolute paths. Libraries will be preloaded before sandbox
+@@ -131,11 +155,20 @@ class CONTENT_EXPORT ServiceProcessHost {
absl::optional<GURL> site;
absl::optional<int> child_flags;
std::vector<std::string> extra_switches;
@@ -548,6 +550,10 @@ index 123bb6fe8287b65b9c47f726fc3f29e3f3976ad9..a3fd4878dbaa5e28b3111c2ffd371865
+ base::FileHandleMappingVector fds_to_remap;
+#endif
base::OnceCallback<void(const base::Process&)> process_callback;
+ #if BUILDFLAG(IS_WIN)
+ std::vector<base::FilePath> preload_libraries;
+ bool pin_user32;
+ #endif // BUILDFLAG(IS_WIN)
+ base::FilePath current_directory;
+ base::EnvironmentMap environment;
+ bool clear_environment = false;
@@ -621,10 +627,10 @@ index cb43aa14c9742f3788ae58c3e49b890cd532f327..6a738f7aade504f2ff3bb6647a0da8f8
#if BUILDFLAG(IS_MAC)
// Whether or not to disclaim TCC responsibility for the process, defaults to
diff --git a/sandbox/policy/win/sandbox_win.cc b/sandbox/policy/win/sandbox_win.cc
-index eba9f9ae775bace82cddbb86c4c9d0df2ce2ac2c..bd3f981c9e56740582716c2fc68ba8ed8ff589d1 100644
+index 4d566d8c23762d0310b4973a1ebfbdf8c4bc4cea..0efa9564bab43c7b2e29db193bc84a47c43d2fde 100644
--- a/sandbox/policy/win/sandbox_win.cc
+++ b/sandbox/policy/win/sandbox_win.cc
-@@ -729,11 +729,9 @@ ResultCode GenerateConfigForSandboxedProcess(const base::CommandLine& cmd_line,
+@@ -689,11 +689,9 @@ ResultCode GenerateConfigForSandboxedProcess(const base::CommandLine& cmd_line,
// command line flag.
ResultCode LaunchWithoutSandbox(
const base::CommandLine& cmd_line,
@@ -637,7 +643,7 @@ index eba9f9ae775bace82cddbb86c4c9d0df2ce2ac2c..bd3f981c9e56740582716c2fc68ba8ed
// Network process runs in a job even when unsandboxed. This is to ensure it
// does not outlive the browser, which could happen if there is a lot of I/O
// on process shutdown, in which case TerminateProcess can fail. See
-@@ -960,7 +958,7 @@ bool SandboxWin::InitTargetServices(TargetServices* target_services) {
+@@ -923,7 +921,7 @@ bool SandboxWin::InitTargetServices(TargetServices* target_services) {
ResultCode SandboxWin::GeneratePolicyForSandboxedProcess(
const base::CommandLine& cmd_line,
const std::string& process_type,
@@ -646,7 +652,7 @@ index eba9f9ae775bace82cddbb86c4c9d0df2ce2ac2c..bd3f981c9e56740582716c2fc68ba8ed
SandboxDelegate* delegate,
TargetPolicy* policy) {
const base::CommandLine& launcher_process_command_line =
-@@ -974,7 +972,7 @@ ResultCode SandboxWin::GeneratePolicyForSandboxedProcess(
+@@ -937,7 +935,7 @@ ResultCode SandboxWin::GeneratePolicyForSandboxedProcess(
}
// Add any handles to be inherited to the policy.
@@ -655,7 +661,7 @@ index eba9f9ae775bace82cddbb86c4c9d0df2ce2ac2c..bd3f981c9e56740582716c2fc68ba8ed
policy->AddHandleToShare(handle);
if (!policy->GetConfig()->IsConfigured()) {
-@@ -989,6 +987,13 @@ ResultCode SandboxWin::GeneratePolicyForSandboxedProcess(
+@@ -952,6 +950,13 @@ ResultCode SandboxWin::GeneratePolicyForSandboxedProcess(
// have no effect. These calls can fail with SBOX_ERROR_BAD_PARAMS.
policy->SetStdoutHandle(GetStdHandle(STD_OUTPUT_HANDLE));
policy->SetStderrHandle(GetStdHandle(STD_ERROR_HANDLE));
@@ -669,7 +675,7 @@ index eba9f9ae775bace82cddbb86c4c9d0df2ce2ac2c..bd3f981c9e56740582716c2fc68ba8ed
#endif
if (!delegate->PreSpawnTarget(policy))
-@@ -1001,7 +1006,7 @@ ResultCode SandboxWin::GeneratePolicyForSandboxedProcess(
+@@ -964,7 +969,7 @@ ResultCode SandboxWin::GeneratePolicyForSandboxedProcess(
ResultCode SandboxWin::StartSandboxedProcess(
const base::CommandLine& cmd_line,
const std::string& process_type,
@@ -678,7 +684,7 @@ index eba9f9ae775bace82cddbb86c4c9d0df2ce2ac2c..bd3f981c9e56740582716c2fc68ba8ed
SandboxDelegate* delegate,
base::Process* process) {
const base::ElapsedTimer timer;
-@@ -1009,13 +1014,13 @@ ResultCode SandboxWin::StartSandboxedProcess(
+@@ -972,13 +977,13 @@ ResultCode SandboxWin::StartSandboxedProcess(
// Avoid making a policy if we won't use it.
if (IsUnsandboxedProcess(delegate->GetSandboxType(), cmd_line,
*base::CommandLine::ForCurrentProcess())) {
@@ -695,10 +701,10 @@ index eba9f9ae775bace82cddbb86c4c9d0df2ce2ac2c..bd3f981c9e56740582716c2fc68ba8ed
return result;
diff --git a/sandbox/policy/win/sandbox_win.h b/sandbox/policy/win/sandbox_win.h
-index d8842ebdd1bd4ebd2ba9e33b8bcf390033dbf4d4..771c6f366559641544f775c3b45eba617923ebdb 100644
+index f45b798eaa154f25e876632fac551ed9f151fe02..24508fb22db700058da039f8644e2ec17d9b5cc3 100644
--- a/sandbox/policy/win/sandbox_win.h
+++ b/sandbox/policy/win/sandbox_win.h
-@@ -50,7 +50,7 @@ class SANDBOX_POLICY_EXPORT SandboxWin {
+@@ -52,7 +52,7 @@ class SANDBOX_POLICY_EXPORT SandboxWin {
static ResultCode StartSandboxedProcess(
const base::CommandLine& cmd_line,
const std::string& process_type,
@@ -707,7 +713,7 @@ index d8842ebdd1bd4ebd2ba9e33b8bcf390033dbf4d4..771c6f366559641544f775c3b45eba61
SandboxDelegate* delegate,
base::Process* process);
-@@ -64,7 +64,7 @@ class SANDBOX_POLICY_EXPORT SandboxWin {
+@@ -66,7 +66,7 @@ class SANDBOX_POLICY_EXPORT SandboxWin {
static ResultCode GeneratePolicyForSandboxedProcess(
const base::CommandLine& cmd_line,
const std::string& process_type,
diff --git a/patches/chromium/feat_enable_offscreen_rendering_with_viz_compositor.patch b/patches/chromium/feat_enable_offscreen_rendering_with_viz_compositor.patch
index 13956b50ec..ea876da5bd 100644
--- a/patches/chromium/feat_enable_offscreen_rendering_with_viz_compositor.patch
+++ b/patches/chromium/feat_enable_offscreen_rendering_with_viz_compositor.patch
@@ -87,10 +87,10 @@ index 8af69cac78b7488d28f1f05ccb174793fe5148cd..9f74e511c263d147b5fbe81fe100d217
private:
const HWND hwnd_;
diff --git a/components/viz/service/BUILD.gn b/components/viz/service/BUILD.gn
-index f2fe76f53dac7380cbd5d3d42a630efbb55af173..06e4c47bd5f37c041d93808cf712e9eb028ff1b2 100644
+index 5583233391b2133acd30d76ce4c3c5d87e0ffbc8..9551e3ea2e5f3de9bff158fc0f443df69a27f93a 100644
--- a/components/viz/service/BUILD.gn
+++ b/components/viz/service/BUILD.gn
-@@ -139,6 +139,8 @@ viz_component("service") {
+@@ -141,6 +141,8 @@ viz_component("service") {
"display_embedder/skia_output_surface_impl_on_gpu_debug_capture.h",
"display_embedder/skia_render_copy_results.cc",
"display_embedder/skia_render_copy_results.h",
@@ -513,10 +513,10 @@ index d4d4c1444e7a169d154bb9062f09f2270e7e9734..01943e14de567afd7b14f6a92eec651d
waiting_on_draw_ack_ = true;
diff --git a/components/viz/service/frame_sinks/root_compositor_frame_sink_impl.cc b/components/viz/service/frame_sinks/root_compositor_frame_sink_impl.cc
-index 0c438dbab1340ccc06c112d5dbc9e8f44bcb920b..13962687d262434de77f76c1c5a0f39f0fd9fb43 100644
+index 36673e93a8380d4e6d086fe3029a53fa483ccddb..ad91be73ec89f45c2ce083eaa3a8aba6b6f53877 100644
--- a/components/viz/service/frame_sinks/root_compositor_frame_sink_impl.cc
+++ b/components/viz/service/frame_sinks/root_compositor_frame_sink_impl.cc
-@@ -90,7 +90,8 @@ RootCompositorFrameSinkImpl::Create(
+@@ -94,7 +94,8 @@ RootCompositorFrameSinkImpl::Create(
params->gpu_compositing, params->widget);
auto output_surface = output_surface_provider->CreateOutputSurface(
params->widget, params->gpu_compositing, display_client.get(),
@@ -527,10 +527,10 @@ index 0c438dbab1340ccc06c112d5dbc9e8f44bcb920b..13962687d262434de77f76c1c5a0f39f
// Creating output surface failed. The host can send a new request, possibly
// with a different compositing mode.
diff --git a/content/browser/compositor/viz_process_transport_factory.cc b/content/browser/compositor/viz_process_transport_factory.cc
-index a45fa7c141777bc6ebc5c34ba73c2e6cc602c2b0..a4bbec572b63a22e2b920e7b139c0c9b6ec34e0c 100644
+index 1aae81c4b1d540fa54e4e8dd5642089369fef14e..6bfc201e9e38dc945875b74a851ce460a68d76f8 100644
--- a/content/browser/compositor/viz_process_transport_factory.cc
+++ b/content/browser/compositor/viz_process_transport_factory.cc
-@@ -397,8 +397,14 @@ void VizProcessTransportFactory::OnEstablishedGpuChannel(
+@@ -402,8 +402,14 @@ void VizProcessTransportFactory::OnEstablishedGpuChannel(
mojo::AssociatedRemote<viz::mojom::DisplayPrivate> display_private;
root_params->display_private =
display_private.BindNewEndpointAndPassReceiver();
@@ -560,13 +560,13 @@ index 350fa67c492490bbd5e8d13ea4368df798261071..d5718735b288d27055af05411a160377
// Sends the created child window to the browser process so that it can be
diff --git a/services/viz/privileged/mojom/compositing/frame_sink_manager.mojom b/services/viz/privileged/mojom/compositing/frame_sink_manager.mojom
-index b8037d39c0d763b25d3db09f73b1819a0907904d..2ecad8b7bda880b6aceb316e17a05a99575285b7 100644
+index f4c967e69e91a09c3cdb3295f353939e77ae1afb..eb87b444ec2f3142e19765f5a27c2cbe76141f5b 100644
--- a/services/viz/privileged/mojom/compositing/frame_sink_manager.mojom
+++ b/services/viz/privileged/mojom/compositing/frame_sink_manager.mojom
-@@ -30,6 +30,7 @@ struct RootCompositorFrameSinkParams {
- bool send_swap_size_notifications = false;
- // Disables begin frame rate limiting for the display compositor.
+@@ -32,6 +32,7 @@ struct RootCompositorFrameSinkParams {
bool disable_frame_rate_limit = false;
+ // Whether to use variable refresh rates when generating begin frames.
+ bool enable_variable_refresh_rate = false;
+ bool offscreen = false;
[EnableIf=is_android]
diff --git a/patches/chromium/feat_ensure_mas_builds_of_the_same_application_can_use_safestorage.patch b/patches/chromium/feat_ensure_mas_builds_of_the_same_application_can_use_safestorage.patch
index f6eac7b392..ac3f14682c 100644
--- a/patches/chromium/feat_ensure_mas_builds_of_the_same_application_can_use_safestorage.patch
+++ b/patches/chromium/feat_ensure_mas_builds_of_the_same_application_can_use_safestorage.patch
@@ -12,10 +12,10 @@ We attempt to migrate the safe storage key from the old account, if that migrati
Existing apps that aren't built for the app store should be unimpacted, there is one edge case where a user uses BOTH an AppStore and a darwin build of the same app only one will keep it's access to the safestorage key as during the migration we delete the old account. This is an acceptable edge case as no one should be actively using two versions of the same app.
diff --git a/components/os_crypt/sync/keychain_password_mac.mm b/components/os_crypt/sync/keychain_password_mac.mm
-index 1895fc822281ccc9e36500e755f028fb2f877060..8d02e232dcb53e3d753b64c8548a5b98d2bb571f 100644
+index e62a56a505e364dff7e1a9eb3043c01c2e3bc39f..2fa4598c4c38cf8dc0b03dad8ecd4faa69f0bb89 100644
--- a/components/os_crypt/sync/keychain_password_mac.mm
+++ b/components/os_crypt/sync/keychain_password_mac.mm
-@@ -22,6 +22,12 @@
+@@ -26,6 +26,12 @@
using KeychainNameContainerType = const base::NoDestructor<std::string>;
#endif
@@ -28,7 +28,7 @@ index 1895fc822281ccc9e36500e755f028fb2f877060..8d02e232dcb53e3d753b64c8548a5b98
namespace {
// These two strings ARE indeed user facing. But they are used to access
-@@ -82,11 +88,18 @@
+@@ -86,11 +92,18 @@
std::string KeychainPassword::GetPassword() const {
UInt32 password_length = 0;
void* password_data = nullptr;
@@ -43,13 +43,13 @@ index 1895fc822281ccc9e36500e755f028fb2f877060..8d02e232dcb53e3d753b64c8548a5b98
- GetAccountName().size(), GetAccountName().c_str(), &password_length,
+ service_name.size(), service_name.c_str(),
+ suffixed_account_name.size(), suffixed_account_name.c_str(), &password_length,
- &password_data, nullptr);
+ &password_data, /*item=*/nullptr);
+ // If it exists we can return it immediately
if (error == noErr) {
std::string password =
std::string(static_cast<char*>(password_data), password_length);
-@@ -94,9 +107,52 @@
+@@ -98,9 +111,52 @@
return password;
}
diff --git a/patches/chromium/feat_expose_raw_response_headers_from_urlloader.patch b/patches/chromium/feat_expose_raw_response_headers_from_urlloader.patch
index e5a73c4f4c..34b65187f3 100644
--- a/patches/chromium/feat_expose_raw_response_headers_from_urlloader.patch
+++ b/patches/chromium/feat_expose_raw_response_headers_from_urlloader.patch
@@ -17,7 +17,7 @@ headers, moving forward we should find a way in upstream to provide
access to these headers for loader clients created on the browser process.
diff --git a/services/network/public/cpp/resource_request.cc b/services/network/public/cpp/resource_request.cc
-index 6d42ae691a2c4a8cf51501bc4c690aca328001f5..71ac9d67eaa87346e7348e63d10157fbc6e8f836 100644
+index f59007a90f6a99cafb450f3e79b528b84ad563d0..e5a6e03f3ffbe49caa251ac0a87416af7b6f55e6 100644
--- a/services/network/public/cpp/resource_request.cc
+++ b/services/network/public/cpp/resource_request.cc
@@ -137,6 +137,7 @@ ResourceRequest::TrustedParams& ResourceRequest::TrustedParams::operator=(
@@ -37,10 +37,10 @@ index 6d42ae691a2c4a8cf51501bc4c690aca328001f5..71ac9d67eaa87346e7348e63d10157fb
allow_cookies_from_browser == other.allow_cookies_from_browser &&
client_security_state == other.client_security_state;
diff --git a/services/network/public/cpp/resource_request.h b/services/network/public/cpp/resource_request.h
-index 97bc15e4dbd30364a3ea9d2cc2961d8e0dce2473..c84bc3991722a252c03ebc61451cf8933e55e6f9 100644
+index b4d389b1fd8de80490b3b1d4e8d0bc632a7f9de1..d44c070c5f6ab52fdddf79f5149884176e763368 100644
--- a/services/network/public/cpp/resource_request.h
+++ b/services/network/public/cpp/resource_request.h
-@@ -65,6 +65,7 @@ struct COMPONENT_EXPORT(NETWORK_CPP_BASE) ResourceRequest {
+@@ -66,6 +66,7 @@ struct COMPONENT_EXPORT(NETWORK_CPP_BASE) ResourceRequest {
bool disable_secure_dns = false;
bool has_user_activation = false;
bool allow_cookies_from_browser = false;
@@ -49,7 +49,7 @@ index 97bc15e4dbd30364a3ea9d2cc2961d8e0dce2473..c84bc3991722a252c03ebc61451cf893
mojo::PendingRemote<mojom::TrustTokenAccessObserver> trust_token_observer;
mojo::PendingRemote<mojom::URLLoaderNetworkServiceObserver>
diff --git a/services/network/public/cpp/url_request_mojom_traits.cc b/services/network/public/cpp/url_request_mojom_traits.cc
-index e716df9998d8ec8125c7c5ceb46a0abfcd8a1538..780ffaae2f608f7e153a62adf4e61fad42d01888 100644
+index 645984438efabd1f4a0813c1c0137d37973b2126..52479f4657bdceab9d93fc1e9efde111e44e7545 100644
--- a/services/network/public/cpp/url_request_mojom_traits.cc
+++ b/services/network/public/cpp/url_request_mojom_traits.cc
@@ -90,6 +90,7 @@ bool StructTraits<network::mojom::TrustedUrlRequestParamsDataView,
@@ -61,10 +61,10 @@ index e716df9998d8ec8125c7c5ceb46a0abfcd8a1538..780ffaae2f608f7e153a62adf4e61fad
mojo::PendingRemote<network::mojom::CookieAccessObserver>>();
out->trust_token_observer = data.TakeTrustTokenObserver<
diff --git a/services/network/public/cpp/url_request_mojom_traits.h b/services/network/public/cpp/url_request_mojom_traits.h
-index fc841300bd332d240ff73dfb2991151dbc853110..4b6f6df75b42bc167da145c4e95310a10e4c91ef 100644
+index f4ad62d0093e3e6c2440b2f9307770ee6ae8ef57..fa57f132b7615d779defda35dd42515edfc77e29 100644
--- a/services/network/public/cpp/url_request_mojom_traits.h
+++ b/services/network/public/cpp/url_request_mojom_traits.h
-@@ -71,6 +71,10 @@ struct COMPONENT_EXPORT(NETWORK_CPP_BASE)
+@@ -72,6 +72,10 @@ struct COMPONENT_EXPORT(NETWORK_CPP_BASE)
const network::ResourceRequest::TrustedParams& trusted_params) {
return trusted_params.allow_cookies_from_browser;
}
@@ -76,7 +76,7 @@ index fc841300bd332d240ff73dfb2991151dbc853110..4b6f6df75b42bc167da145c4e95310a1
cookie_observer(
const network::ResourceRequest::TrustedParams& trusted_params) {
diff --git a/services/network/public/mojom/url_request.mojom b/services/network/public/mojom/url_request.mojom
-index 515e4b9d26b26e23d41a43e601c667c765b0dff1..d3f1d984e663121b97a9129b576142963ad72612 100644
+index 7b684ab387bfe37bf486f1ea5424fb7551383b2d..c2e0727104e83c0dad384794e31ffbd5e1d3136d 100644
--- a/services/network/public/mojom/url_request.mojom
+++ b/services/network/public/mojom/url_request.mojom
@@ -72,6 +72,9 @@ struct TrustedUrlRequestParams {
diff --git a/patches/chromium/fix_allow_guest_webcontents_to_enter_fullscreen.patch b/patches/chromium/fix_allow_guest_webcontents_to_enter_fullscreen.patch
index 4fe14bfe14..7553027c6b 100644
--- a/patches/chromium/fix_allow_guest_webcontents_to_enter_fullscreen.patch
+++ b/patches/chromium/fix_allow_guest_webcontents_to_enter_fullscreen.patch
@@ -6,10 +6,10 @@ Subject: fix: allow guest webcontents to enter fullscreen
This can be upstreamed, a guest webcontents can't technically become the focused webContents. This DCHECK should allow all guest webContents to request fullscreen entrance.
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
-index a114c8a72670037fe0f4b9d95c16a67094f4c13c..c91c66006ee4b08bc2b1ee7a8346a15ba763e9f4 100644
+index 4181b7dd3c8ba467e3e762e5875a97df630e62dc..9ef1f3ebeb74f4e793abc46097c7fd617ef4447f 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
-@@ -3595,7 +3595,7 @@ void WebContentsImpl::EnterFullscreenMode(
+@@ -3598,7 +3598,7 @@ void WebContentsImpl::EnterFullscreenMode(
OPTIONAL_TRACE_EVENT0("content", "WebContentsImpl::EnterFullscreenMode");
DCHECK(CanEnterFullscreenMode(requesting_frame, options));
DCHECK(requesting_frame->IsActive());
diff --git a/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch b/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch
index 296ff851f1..c4f3f63aa5 100644
--- a/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch
+++ b/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch
@@ -17,10 +17,10 @@ policy->CanCommitOriginAndUrl.
Upstreamed at https://chromium-review.googlesource.com/c/chromium/src/+/3856266.
diff --git a/content/browser/renderer_host/navigation_request.cc b/content/browser/renderer_host/navigation_request.cc
-index 8a754a2e41aeacd4d115652806ff57b5a382693b..7cd9c5fd32b7db79e1059cf9f7bf411c75416f1e 100644
+index ce02660be0a16e84f813260b8482e2de856c4856..81b0730eda5e13760721c5e48db244ab74ffd039 100644
--- a/content/browser/renderer_host/navigation_request.cc
+++ b/content/browser/renderer_host/navigation_request.cc
-@@ -7489,10 +7489,11 @@ NavigationRequest::GetOriginForURLLoaderFactoryAfterResponseWithDebugInfo() {
+@@ -7500,10 +7500,11 @@ NavigationRequest::GetOriginForURLLoaderFactoryAfterResponseWithDebugInfo() {
if (IsForMhtmlSubframe())
return origin_with_debug_info;
@@ -37,10 +37,10 @@ index 8a754a2e41aeacd4d115652806ff57b5a382693b..7cd9c5fd32b7db79e1059cf9f7bf411c
}
diff --git a/content/browser/renderer_host/render_frame_host_impl.h b/content/browser/renderer_host/render_frame_host_impl.h
-index 60b89be83a94a5f8442b945f0783853b6effa775..8ac27ed07e62c8c1f1f12e3020386ac657386290 100644
+index 617e2ca9866c76095930cdd7fe5f8fbb652ef588..ba83832f9b2b08b0ec17bff50e513bce3fd39cb8 100644
--- a/content/browser/renderer_host/render_frame_host_impl.h
+++ b/content/browser/renderer_host/render_frame_host_impl.h
-@@ -2911,6 +2911,17 @@ class CONTENT_EXPORT RenderFrameHostImpl
+@@ -2914,6 +2914,17 @@ class CONTENT_EXPORT RenderFrameHostImpl
// last committed document.
CookieChangeListener::CookieChangeInfo GetCookieChangeInfo();
@@ -58,7 +58,7 @@ index 60b89be83a94a5f8442b945f0783853b6effa775..8ac27ed07e62c8c1f1f12e3020386ac6
// Sets a ResourceCache in the renderer. `this` must be active and there must
// be no pending navigation. `remote` must have the same and process
// isolation policy.
-@@ -3280,17 +3291,6 @@ class CONTENT_EXPORT RenderFrameHostImpl
+@@ -3287,17 +3298,6 @@ class CONTENT_EXPORT RenderFrameHostImpl
// relevant.
void ResetWaitingState();
diff --git a/patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch b/patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch
index f513bd5724..ea771484d3 100644
--- a/patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch
+++ b/patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch
@@ -15,10 +15,10 @@ node does not change in this case.
chromium-bug: https://crbug.com/1369605
diff --git a/content/browser/renderer_host/render_widget_host_view_child_frame.cc b/content/browser/renderer_host/render_widget_host_view_child_frame.cc
-index 7d471653b3dfadaa91cbe7dfdd5ff324d0fbe1bb..08251f85beef09719808db3fb042c9f6f45c218e 100644
+index 8f57ba0f182fa1ae687b628c3b050d58f9ab5426..865dba163fb68ca2ab3bde5b54a0024dc650cde1 100644
--- a/content/browser/renderer_host/render_widget_host_view_child_frame.cc
+++ b/content/browser/renderer_host/render_widget_host_view_child_frame.cc
-@@ -994,6 +994,12 @@ RenderWidgetHostViewChildFrame::DidUpdateVisualProperties(
+@@ -996,6 +996,12 @@ RenderWidgetHostViewChildFrame::DidUpdateVisualProperties(
return viz::ScopedSurfaceIdAllocator(std::move(allocation_task));
}
@@ -32,7 +32,7 @@ index 7d471653b3dfadaa91cbe7dfdd5ff324d0fbe1bb..08251f85beef09719808db3fb042c9f6
if (!text_input_manager_)
return ui::TEXT_INPUT_TYPE_NONE;
diff --git a/content/browser/renderer_host/render_widget_host_view_child_frame.h b/content/browser/renderer_host/render_widget_host_view_child_frame.h
-index 2ca4e42342ff6bf3f2ad104208944e36d572aa3c..7421cc779873b580d6f5a109d57ff7445dde9d58 100644
+index 7935adbe496cacd9b02390439f759186e77ba336..a16bc977a807cf23aff0f1611ffab2fb3bca679f 100644
--- a/content/browser/renderer_host/render_widget_host_view_child_frame.h
+++ b/content/browser/renderer_host/render_widget_host_view_child_frame.h
@@ -181,6 +181,8 @@ class CONTENT_EXPORT RenderWidgetHostViewChildFrame
@@ -45,10 +45,10 @@ index 2ca4e42342ff6bf3f2ad104208944e36d572aa3c..7421cc779873b580d6f5a109d57ff744
// RenderFrameMetadataProvider::Observer implementation.
void OnRenderFrameMetadataChangedBeforeActivation(
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
-index c91c66006ee4b08bc2b1ee7a8346a15ba763e9f4..e555731a945bef8450b2ebd879b1193199c1de5f 100644
+index 9ef1f3ebeb74f4e793abc46097c7fd617ef4447f..4b6408c650e7d9deadc927dd38031e9447b39b48 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
-@@ -8103,7 +8103,7 @@ void WebContentsImpl::OnFocusedElementChangedInFrame(
+@@ -8097,7 +8097,7 @@ void WebContentsImpl::OnFocusedElementChangedInFrame(
"WebContentsImpl::OnFocusedElementChangedInFrame",
"render_frame_host", frame);
RenderWidgetHostViewBase* root_view =
diff --git a/patches/chromium/fix_return_v8_value_from_localframe_requestexecutescript.patch b/patches/chromium/fix_return_v8_value_from_localframe_requestexecutescript.patch
index 5c09814b7c..4c1293efa5 100644
--- a/patches/chromium/fix_return_v8_value_from_localframe_requestexecutescript.patch
+++ b/patches/chromium/fix_return_v8_value_from_localframe_requestexecutescript.patch
@@ -8,7 +8,7 @@ v8::Value instead of base::Value.
Refs https://bugs.chromium.org/p/chromium/issues/detail?id=1323953
diff --git a/extensions/renderer/script_injection.cc b/extensions/renderer/script_injection.cc
-index e9371fb6de28abf0cc0d35cf144427b65fe7dc04..892c1bbae90725a97db6dbcb82e732303f20199f 100644
+index 34777e89362b14587979cef76d8cd71b634cca8c..3d5e44883bab30eebdfaba70f3933435fe946ca1 100644
--- a/extensions/renderer/script_injection.cc
+++ b/extensions/renderer/script_injection.cc
@@ -275,6 +275,7 @@ void ScriptInjection::InjectJs(std::set<std::string>* executing_scripts,
@@ -20,7 +20,7 @@ index e9371fb6de28abf0cc0d35cf144427b65fe7dc04..892c1bbae90725a97db6dbcb82e73230
injector_->ExpectsResults(), injector_->ShouldWaitForPromise());
}
diff --git a/third_party/blink/public/web/web_local_frame.h b/third_party/blink/public/web/web_local_frame.h
-index 157a7a90f3e5e70b0fa80e0030e1a3f65239664c..e65e857e83568dc0b621bf8f98c2b5247836f829 100644
+index 0fb81902e569ed974c98b33e980546d210765e83..d27cf6d13b26ce8a828e62e3ddf15d082c5874e1 100644
--- a/third_party/blink/public/web/web_local_frame.h
+++ b/third_party/blink/public/web/web_local_frame.h
@@ -436,6 +436,7 @@ class BLINK_EXPORT WebLocalFrame : public WebFrame {
@@ -64,10 +64,10 @@ index 4cd668a127a50e5462e3878c3f1dcb7384926768..dfbec49249404df8f8ebdbd26e6e865c
#endif // THIRD_PARTY_BLINK_PUBLIC_WEB_WEB_SCRIPT_EXECUTION_CALLBACK_H_
diff --git a/third_party/blink/renderer/core/frame/local_frame.cc b/third_party/blink/renderer/core/frame/local_frame.cc
-index 54cb4d1ef90ded89b85243ac1296dfb7787b08dc..32cf879b41bc6d01c93d4be3c89c28d07cebbefb 100644
+index d7ba7113f69e23b0fe47d135a4f51b9d50fa45b2..3efd8610623abb804af26d6ce4461b2d8d89c43a 100644
--- a/third_party/blink/renderer/core/frame/local_frame.cc
+++ b/third_party/blink/renderer/core/frame/local_frame.cc
-@@ -2703,6 +2703,7 @@ void LocalFrame::RequestExecuteScript(
+@@ -2704,6 +2704,7 @@ void LocalFrame::RequestExecuteScript(
mojom::blink::EvaluationTiming evaluation_timing,
mojom::blink::LoadEventBlockingOption blocking_option,
WebScriptExecutionCallback callback,
@@ -75,7 +75,7 @@ index 54cb4d1ef90ded89b85243ac1296dfb7787b08dc..32cf879b41bc6d01c93d4be3c89c28d0
BackForwardCacheAware back_forward_cache_aware,
mojom::blink::WantResultOption want_result_option,
mojom::blink::PromiseResultOption promise_behavior) {
-@@ -2733,7 +2734,8 @@ void LocalFrame::RequestExecuteScript(
+@@ -2734,7 +2735,8 @@ void LocalFrame::RequestExecuteScript(
PausableScriptExecutor::CreateAndRun(
ToScriptState(DomWindow(), *world), std::move(script_sources),
execute_script_policy, user_gesture, evaluation_timing, blocking_option,
@@ -86,10 +86,10 @@ index 54cb4d1ef90ded89b85243ac1296dfb7787b08dc..32cf879b41bc6d01c93d4be3c89c28d0
void LocalFrame::SetEvictCachedSessionStorageOnFreezeOrUnload() {
diff --git a/third_party/blink/renderer/core/frame/local_frame.h b/third_party/blink/renderer/core/frame/local_frame.h
-index 3d2e44d5221078ed54ab4ba1e7e2a495eb79fae9..46bd501ba79aed310340f23ff8d2751a5ee760ec 100644
+index 50e103a3b58a9953e18bf76c713af21b1c9caf95..2dd4567b486804794e15ae389f95000e62930f40 100644
--- a/third_party/blink/renderer/core/frame/local_frame.h
+++ b/third_party/blink/renderer/core/frame/local_frame.h
-@@ -781,6 +781,7 @@ class CORE_EXPORT LocalFrame final
+@@ -787,6 +787,7 @@ class CORE_EXPORT LocalFrame final
mojom::blink::EvaluationTiming,
mojom::blink::LoadEventBlockingOption,
WebScriptExecutionCallback,
@@ -205,10 +205,10 @@ index 1e4d9e098463d61dcab787afcc46fea63b27e012..3f1ebf493ddd7d1c209acee2fb1255a0
const mojom::blink::UserActivationOption user_activation_option_;
const mojom::blink::LoadEventBlockingOption blocking_option_;
diff --git a/third_party/blink/renderer/core/frame/web_local_frame_impl.cc b/third_party/blink/renderer/core/frame/web_local_frame_impl.cc
-index 7ebcc1cdedf3e2ff2e7a6ff2edc90158815dae94..55f5860485e5013295506e4936bba34e5134aff3 100644
+index 1760444eb05fbe202181d0b67b446a56d919ba8c..46e1e4bfeb3f7b052ffe688a9dc15d602e49ff65 100644
--- a/third_party/blink/renderer/core/frame/web_local_frame_impl.cc
+++ b/third_party/blink/renderer/core/frame/web_local_frame_impl.cc
-@@ -1148,14 +1148,15 @@ void WebLocalFrameImpl::RequestExecuteScript(
+@@ -1131,14 +1131,15 @@ void WebLocalFrameImpl::RequestExecuteScript(
mojom::blink::EvaluationTiming evaluation_timing,
mojom::blink::LoadEventBlockingOption blocking_option,
WebScriptExecutionCallback callback,
@@ -227,7 +227,7 @@ index 7ebcc1cdedf3e2ff2e7a6ff2edc90158815dae94..55f5860485e5013295506e4936bba34e
v8::MaybeLocal<v8::Value> WebLocalFrameImpl::CallFunctionEvenIfScriptDisabled(
diff --git a/third_party/blink/renderer/core/frame/web_local_frame_impl.h b/third_party/blink/renderer/core/frame/web_local_frame_impl.h
-index aa8c03c35518b6c3163d7b28dc09a5cbb9d8a54d..8657a6f7191fac4263d47d34629223a165dda2e1 100644
+index 8ce3bef8acad36edf728d5a511431d902db3ab03..6dc7cd67f15d4ed0a18af953b16a374224d7aa0c 100644
--- a/third_party/blink/renderer/core/frame/web_local_frame_impl.h
+++ b/third_party/blink/renderer/core/frame/web_local_frame_impl.h
@@ -195,6 +195,7 @@ class CORE_EXPORT WebLocalFrameImpl final
diff --git a/patches/chromium/frame_host_manager.patch b/patches/chromium/frame_host_manager.patch
index 7917787b25..4b000bde41 100644
--- a/patches/chromium/frame_host_manager.patch
+++ b/patches/chromium/frame_host_manager.patch
@@ -6,10 +6,10 @@ Subject: frame_host_manager.patch
Allows embedder to intercept site instances created by chromium.
diff --git a/content/browser/renderer_host/render_frame_host_manager.cc b/content/browser/renderer_host/render_frame_host_manager.cc
-index 1e6180116afda2ebd23b6b9a22b65b05cf72e642..603ad21be099547004abfb0cb98a9eabd7d5e4ed 100644
+index fea976a03235c8212f45c605249e31aa134e69a8..10271c810c11c383750b5d43570b23b71495e3de 100644
--- a/content/browser/renderer_host/render_frame_host_manager.cc
+++ b/content/browser/renderer_host/render_frame_host_manager.cc
-@@ -3911,6 +3911,9 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest(
+@@ -3934,6 +3934,9 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest(
request->ResetStateForSiteInstanceChange();
}
@@ -20,10 +20,10 @@ index 1e6180116afda2ebd23b6b9a22b65b05cf72e642..603ad21be099547004abfb0cb98a9eab
}
diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h
-index 294986a55d49a9f57592cf209b6c0db42620f61e..28ba30415d519fb3d6d7d388006b7dee5f807944 100644
+index 8daca4d7fad172c8436b9261022c4d1114b36f07..cfd8751df862219bba4e9cb30a5f61a207911828 100644
--- a/content/public/browser/content_browser_client.h
+++ b/content/public/browser/content_browser_client.h
-@@ -302,6 +302,11 @@ class CONTENT_EXPORT ContentBrowserClient {
+@@ -303,6 +303,11 @@ class CONTENT_EXPORT ContentBrowserClient {
virtual ~ContentBrowserClient() = default;
diff --git a/patches/chromium/gin_enable_disable_v8_platform.patch b/patches/chromium/gin_enable_disable_v8_platform.patch
index 657b7f8d3a..77b91f9223 100644
--- a/patches/chromium/gin_enable_disable_v8_platform.patch
+++ b/patches/chromium/gin_enable_disable_v8_platform.patch
@@ -38,10 +38,10 @@ index 10caab6d9ef3345332c163a55dcef991248ab4ea..c9bc6e5dd7e1cf8d198afcd21cbb2497
// Returns whether `Initialize` has already been invoked in the process.
// Initialization is a one-way operation (i.e., this method cannot return
diff --git a/gin/v8_initializer.cc b/gin/v8_initializer.cc
-index ee54275c61ee283e7ef1dcf4bf04ccaccabbd0d6..8a0a8c4f678c017d455981d723eff04d2463082a 100644
+index ba3ab6adff0db46c8a1fca2e1bf3b3cb4a41fbdd..0d56182a284b91e7bf5749dbf0796cbe705d2c1f 100644
--- a/gin/v8_initializer.cc
+++ b/gin/v8_initializer.cc
-@@ -395,7 +395,8 @@ void SetFlags(IsolateHolder::ScriptMode mode,
+@@ -402,7 +402,8 @@ void SetFlags(IsolateHolder::ScriptMode mode,
// static
void V8Initializer::Initialize(IsolateHolder::ScriptMode mode,
const std::string js_command_line_flags,
@@ -51,7 +51,7 @@ index ee54275c61ee283e7ef1dcf4bf04ccaccabbd0d6..8a0a8c4f678c017d455981d723eff04d
static bool v8_is_initialized = false;
if (v8_is_initialized)
return;
-@@ -405,7 +406,8 @@ void V8Initializer::Initialize(IsolateHolder::ScriptMode mode,
+@@ -412,7 +413,8 @@ void V8Initializer::Initialize(IsolateHolder::ScriptMode mode,
// See https://crbug.com/v8/11043
SetFlags(mode, js_command_line_flags);
diff --git a/patches/chromium/gritsettings_resource_ids.patch b/patches/chromium/gritsettings_resource_ids.patch
index a8259efce6..822b75a281 100644
--- a/patches/chromium/gritsettings_resource_ids.patch
+++ b/patches/chromium/gritsettings_resource_ids.patch
@@ -6,7 +6,7 @@ Subject: gritsettings_resource_ids.patch
Add electron resources file to the list of resource ids generation.
diff --git a/tools/gritsettings/resource_ids.spec b/tools/gritsettings/resource_ids.spec
-index 179bddf7519bbb381cfc1c33c496e5ea250f8f5a..b7b1a8e628c8d404917424d12bb1273ad8073b87 100644
+index c9ebf891962bef2e91bfe51584638f3a8949acf5..e8a75fcc43f13b5ca5e238e73111f0dfd3829ceb 100644
--- a/tools/gritsettings/resource_ids.spec
+++ b/tools/gritsettings/resource_ids.spec
@@ -1143,6 +1143,11 @@
diff --git a/patches/chromium/hack_to_allow_gclient_sync_with_host_os_mac_on_linux_in_ci.patch b/patches/chromium/hack_to_allow_gclient_sync_with_host_os_mac_on_linux_in_ci.patch
index e07efece9d..6c4ff12e11 100644
--- a/patches/chromium/hack_to_allow_gclient_sync_with_host_os_mac_on_linux_in_ci.patch
+++ b/patches/chromium/hack_to_allow_gclient_sync_with_host_os_mac_on_linux_in_ci.patch
@@ -11,10 +11,10 @@ If removing this patch causes no sync failures, it's safe to delete :+1:
Ref https://chromium-review.googlesource.com/c/chromium/src/+/2953903
diff --git a/tools/clang/scripts/update.py b/tools/clang/scripts/update.py
-index 4d70ae5f394e7744cdc5db93cb0a1ef97e5aa259..25d52d6323198aaf24e5ecb1977453771599d96f 100755
+index c615f9a19854f3e9c0bc70340835cb2117c41ed0..b8ceb570450d88405999cd566ce2e5469b27f89d 100755
--- a/tools/clang/scripts/update.py
+++ b/tools/clang/scripts/update.py
-@@ -305,6 +305,8 @@ def GetDefaultHostOs():
+@@ -306,6 +306,8 @@ def GetDefaultHostOs():
'win32': 'win',
}
default_host_os = _PLATFORM_HOST_OS_MAP.get(sys.platform, sys.platform)
diff --git a/patches/chromium/load_v8_snapshot_in_browser_process.patch b/patches/chromium/load_v8_snapshot_in_browser_process.patch
index c16a965fee..9daf62a8aa 100644
--- a/patches/chromium/load_v8_snapshot_in_browser_process.patch
+++ b/patches/chromium/load_v8_snapshot_in_browser_process.patch
@@ -9,10 +9,10 @@ but due to the nature of electron, we need to load the v8 snapshot
in the browser process.
diff --git a/content/app/content_main_runner_impl.cc b/content/app/content_main_runner_impl.cc
-index 38c5f465d8e4538995ce54c134bccd591eb71261..d2ca2effde6f7523518c1531f86506c4f619797e 100644
+index fa26be0ffd110911af50a4c8a05666b94249cab6..77a9818606c3e2cde6f74d5009a05a851b6295e9 100644
--- a/content/app/content_main_runner_impl.cc
+++ b/content/app/content_main_runner_impl.cc
-@@ -278,11 +278,8 @@ void LoadV8SnapshotFile(const base::CommandLine& command_line) {
+@@ -279,11 +279,8 @@ void LoadV8SnapshotFile(const base::CommandLine& command_line) {
bool ShouldLoadV8Snapshot(const base::CommandLine& command_line,
const std::string& process_type) {
diff --git a/patches/chromium/mas-cgdisplayusesforcetogray.patch b/patches/chromium/mas-cgdisplayusesforcetogray.patch
index 33e9f151c3..36149c33e0 100644
--- a/patches/chromium/mas-cgdisplayusesforcetogray.patch
+++ b/patches/chromium/mas-cgdisplayusesforcetogray.patch
@@ -6,7 +6,7 @@ Subject: mas: avoid usage of CGDisplayUsesForceToGray
Removes usage of the CGDisplayUsesForceToGray private API.
diff --git a/ui/display/mac/screen_mac.mm b/ui/display/mac/screen_mac.mm
-index 2185525edaf5e14b57055e1043db0299bed87fd8..0d5ef8c48f08b1eb5ed878ab8934f2ecd04083fa 100644
+index 4a7d465c5f5690709eca8aa4ac90e905ab7d199e..30f72b9655e790d864fc7e28983b6a37074448a5 100644
--- a/ui/display/mac/screen_mac.mm
+++ b/ui/display/mac/screen_mac.mm
@@ -268,7 +268,17 @@ DisplayMac BuildDisplayForScreen(NSScreen* screen) {
@@ -25,5 +25,5 @@ index 2185525edaf5e14b57055e1043db0299bed87fd8..0d5ef8c48f08b1eb5ed878ab8934f2ec
display.set_is_monochrome(CGDisplayUsesForceToGray());
+#endif
- if (auto display_link = ui::DisplayLinkMac::GetForDisplay(display_id))
- display.set_display_frequency(display_link->GetRefreshRate());
+ // Query the display's referesh rate.
+ {
diff --git a/patches/chromium/mas_avoid_usage_of_private_macos_apis.patch b/patches/chromium/mas_avoid_usage_of_private_macos_apis.patch
index 0809cef673..29689b1960 100644
--- a/patches/chromium/mas_avoid_usage_of_private_macos_apis.patch
+++ b/patches/chromium/mas_avoid_usage_of_private_macos_apis.patch
@@ -39,7 +39,7 @@ index 91a65a1e700cf1accb8e4541e0ceca4e0a734b16..323b9b48214aa013ad8f7da2f63cca2e
} // namespace base
diff --git a/base/mac/foundation_util.mm b/base/mac/foundation_util.mm
-index d2b217adce962850647ddfd7898414c86b90baa4..45c81cebf3e776f2ca9de34252971ad5e959d915 100644
+index be594941e41d59cfc6bc34ce1fc21ca1b2d399c0..f46b0979f66fdb77bfdbd22358f306c6cf505816 100644
--- a/base/mac/foundation_util.mm
+++ b/base/mac/foundation_util.mm
@@ -28,12 +28,6 @@
diff --git a/patches/chromium/mas_disable_custom_window_frame.patch b/patches/chromium/mas_disable_custom_window_frame.patch
index 03761c5d4b..cf7ffb0886 100644
--- a/patches/chromium/mas_disable_custom_window_frame.patch
+++ b/patches/chromium/mas_disable_custom_window_frame.patch
@@ -95,7 +95,7 @@ index 58e974137f318b0f990e0b77630fe3a51db62c8c..8638f9ee32bea5fca67a377f27f3e24b
// The NSWindow used by BridgedNativeWidget. Provides hooks into AppKit that
// can only be accomplished by overriding methods.
diff --git a/components/remote_cocoa/app_shim/native_widget_mac_nswindow.mm b/components/remote_cocoa/app_shim/native_widget_mac_nswindow.mm
-index 3b1f523659e1199ac41637e2c4cc1c059c0a2807..47486ff72d496c10c3f238b7be89d5c241c373c7 100644
+index e90c7946c683f23852c785769e1c2809ec4f4961..6ebef9ed0e77fd215f3ee58c542549345d5e630c 100644
--- a/components/remote_cocoa/app_shim/native_widget_mac_nswindow.mm
+++ b/components/remote_cocoa/app_shim/native_widget_mac_nswindow.mm
@@ -96,7 +96,9 @@ void OrderChildWindow(NSWindow* child_window,
@@ -108,7 +108,7 @@ index 3b1f523659e1199ac41637e2c4cc1c059c0a2807..47486ff72d496c10c3f238b7be89d5c2
- (BOOL)hasKeyAppearance;
- (long long)_resizeDirectionForMouseLocation:(CGPoint)location;
- (BOOL)_isConsideredOpenForPersistentState;
-@@ -129,6 +131,8 @@ - (void)cr_mouseDownOnFrameView:(NSEvent*)event {
+@@ -134,6 +136,8 @@ - (void)cr_mouseDownOnFrameView:(NSEvent*)event {
}
@end
@@ -117,7 +117,7 @@ index 3b1f523659e1199ac41637e2c4cc1c059c0a2807..47486ff72d496c10c3f238b7be89d5c2
@implementation NativeWidgetMacNSWindowTitledFrame
- (void)mouseDown:(NSEvent*)event {
if (self.window.isMovable)
-@@ -155,6 +159,8 @@ - (BOOL)usesCustomDrawing {
+@@ -160,6 +164,8 @@ - (BOOL)usesCustomDrawing {
}
@end
@@ -126,7 +126,7 @@ index 3b1f523659e1199ac41637e2c4cc1c059c0a2807..47486ff72d496c10c3f238b7be89d5c2
@implementation NativeWidgetMacNSWindow {
@private
base::scoped_nsobject<CommandDispatcher> _commandDispatcher;
-@@ -347,6 +353,8 @@ - (NSAccessibilityRole)accessibilityRole {
+@@ -355,6 +361,8 @@ - (NSAccessibilityRole)accessibilityRole {
// NSWindow overrides.
@@ -135,7 +135,7 @@ index 3b1f523659e1199ac41637e2c4cc1c059c0a2807..47486ff72d496c10c3f238b7be89d5c2
+ (Class)frameViewClassForStyleMask:(NSWindowStyleMask)windowStyle {
if (windowStyle & NSWindowStyleMaskTitled) {
if (Class customFrame = [NativeWidgetMacNSWindowTitledFrame class])
-@@ -358,6 +366,8 @@ + (Class)frameViewClassForStyleMask:(NSWindowStyleMask)windowStyle {
+@@ -366,6 +374,8 @@ + (Class)frameViewClassForStyleMask:(NSWindowStyleMask)windowStyle {
return [super frameViewClassForStyleMask:windowStyle];
}
diff --git a/patches/chromium/mas_disable_remote_accessibility.patch b/patches/chromium/mas_disable_remote_accessibility.patch
index cbbc102543..96d53e56c6 100644
--- a/patches/chromium/mas_disable_remote_accessibility.patch
+++ b/patches/chromium/mas_disable_remote_accessibility.patch
@@ -44,7 +44,7 @@ index 3600a7ce7b3e6540767f64c631f352aa62240459..3147961f3d1c2c1690b5adf16a9a58f7
} // namespace
diff --git a/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm b/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm
-index f13ccec0334aa6b47cce180630b15298b86a4162..fa76a984f3dea99bdb337b44ceb8e397cae6a4ec 100644
+index 6a27c02614d29631de16e1c4b9b863c76de9aa24..672ecaf054d5317f957decb1fd84772bc34105b7 100644
--- a/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm
+++ b/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm
@@ -572,10 +572,12 @@ NSUInteger CountBridgedWindows(NSArray* child_windows) {
@@ -213,10 +213,10 @@ index a7cbd153f799d8e6da61fb255c3d1d70c18fa514..2e3a87b7694f105a684ac2500ae5fb68
///////////////////////////////////////////////////////////////////////////////
diff --git a/ui/base/BUILD.gn b/ui/base/BUILD.gn
-index cd69e2430bec3724f43a08318254272c0512e980..056a7b1bd399510688841cb68da3985690deb0c7 100644
+index c10eb3bb795c3a6178f50b972eaf4b70808ccf37..9ffa8129d29ecda50f91355ffd01ce9926a70b11 100644
--- a/ui/base/BUILD.gn
+++ b/ui/base/BUILD.gn
-@@ -368,6 +368,13 @@ component("base") {
+@@ -374,6 +374,13 @@ component("base") {
sources += [ "resource/resource_bundle_lacros.cc" ]
}
@@ -251,10 +251,10 @@ index aa09619a3137d1878c9f5c111a348703965dd16f..6553de29e861c15028564ffe4a4b9b01
+
#endif // UI_BASE_COCOA_REMOTE_ACCESSIBILITY_API_H_
diff --git a/ui/views/cocoa/native_widget_mac_ns_window_host.h b/ui/views/cocoa/native_widget_mac_ns_window_host.h
-index aa89421a689ad3f0872e51fa19624d2371948c21..e63b249a9bdc23545121a513156bfa32e92fec0b 100644
+index 4b06ace2dac87685a3a5b26ead3d977e035a9c21..faa5b59e81c463d93000b23dc2697192e9cedb1f 100644
--- a/ui/views/cocoa/native_widget_mac_ns_window_host.h
+++ b/ui/views/cocoa/native_widget_mac_ns_window_host.h
-@@ -32,7 +32,9 @@
+@@ -31,7 +31,9 @@
#include "ui/views/window/dialog_observer.h"
@class NativeWidgetMacNSWindow;
@@ -264,7 +264,7 @@ index aa89421a689ad3f0872e51fa19624d2371948c21..e63b249a9bdc23545121a513156bfa32
@class NSView;
namespace remote_cocoa {
-@@ -458,11 +460,13 @@ class VIEWS_EXPORT NativeWidgetMacNSWindowHost
+@@ -451,11 +453,13 @@ class VIEWS_EXPORT NativeWidgetMacNSWindowHost
mojo::AssociatedRemote<remote_cocoa::mojom::NativeWidgetNSWindow>
remote_ns_window_remote_;
@@ -279,10 +279,10 @@ index aa89421a689ad3f0872e51fa19624d2371948c21..e63b249a9bdc23545121a513156bfa32
// Used to force the NSApplication's focused accessibility element to be the
// views::Views accessibility tree when the NSView for this is focused.
diff --git a/ui/views/cocoa/native_widget_mac_ns_window_host.mm b/ui/views/cocoa/native_widget_mac_ns_window_host.mm
-index dca21f43003231445b2c6fe0cfe07cd9ad9247ba..c6a33c2a85206295426292406291af670ce65ab0 100644
+index 68663d9ee9c528b55fe98e880c9e6f736fc6dc35..d932bd087e3b127dc8f9cbf3bc8acacd25e028fc 100644
--- a/ui/views/cocoa/native_widget_mac_ns_window_host.mm
+++ b/ui/views/cocoa/native_widget_mac_ns_window_host.mm
-@@ -339,14 +339,22 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
+@@ -339,7 +339,11 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
NativeWidgetMacNSWindowHost::GetNativeViewAccessibleForNSView() const {
if (in_process_ns_window_bridge_)
return in_process_ns_window_bridge_->ns_view();
@@ -294,9 +294,10 @@ index dca21f43003231445b2c6fe0cfe07cd9ad9247ba..c6a33c2a85206295426292406291af67
}
gfx::NativeViewAccessible
- NativeWidgetMacNSWindowHost::GetNativeViewAccessibleForNSWindow() const {
- if (in_process_ns_window_bridge_)
- return in_process_ns_window_bridge_->ns_window();
+@@ -354,7 +358,11 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
+ return [in_process_ns_window_bridge_->ns_view() window];
+ }
+
+#if !IS_MAS_BUILD()
return remote_window_accessible_.get();
+#else
@@ -305,7 +306,7 @@ index dca21f43003231445b2c6fe0cfe07cd9ad9247ba..c6a33c2a85206295426292406291af67
}
remote_cocoa::mojom::NativeWidgetNSWindow*
-@@ -1333,6 +1341,7 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
+@@ -1326,6 +1334,7 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
void NativeWidgetMacNSWindowHost::SetRemoteAccessibilityTokens(
const std::vector<uint8_t>& window_token,
const std::vector<uint8_t>& view_token) {
@@ -313,7 +314,7 @@ index dca21f43003231445b2c6fe0cfe07cd9ad9247ba..c6a33c2a85206295426292406291af67
remote_window_accessible_ =
ui::RemoteAccessibility::GetRemoteElementFromToken(window_token);
remote_view_accessible_ =
-@@ -1340,14 +1349,17 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
+@@ -1333,14 +1342,17 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
[remote_view_accessible_ setWindowUIElement:remote_window_accessible_.get()];
[remote_view_accessible_
setTopLevelUIElement:remote_window_accessible_.get()];
diff --git a/patches/chromium/mas_disable_remote_layer.patch b/patches/chromium/mas_disable_remote_layer.patch
index 1ce2a04b45..87164d0733 100644
--- a/patches/chromium/mas_disable_remote_layer.patch
+++ b/patches/chromium/mas_disable_remote_layer.patch
@@ -41,7 +41,7 @@ index 6c0ab25b4faeee4095beaa10a57932021d690785..09fa4b7fb10790c2349edab7108e9d21
gfx::Size pixel_size_;
diff --git a/gpu/ipc/service/image_transport_surface_overlay_mac.mm b/gpu/ipc/service/image_transport_surface_overlay_mac.mm
-index 7ecc5ff37d7a6c156f432e9968bcce340a38b533..f5de541a91c72ef80941434b6cb55b298d8744f7 100644
+index 8c2c3758cdd7fb194db1360b98b59a08c781fc7b..bc05822738f3984b8c116fac9c152de3d1bee6d3 100644
--- a/gpu/ipc/service/image_transport_surface_overlay_mac.mm
+++ b/gpu/ipc/service/image_transport_surface_overlay_mac.mm
@@ -55,7 +55,9 @@
@@ -73,7 +73,7 @@ index 7ecc5ff37d7a6c156f432e9968bcce340a38b533..f5de541a91c72ef80941434b6cb55b29
#if BUILDFLAG(IS_MAC)
if (features::UseGpuVsync()) {
-@@ -175,9 +182,13 @@
+@@ -177,9 +184,13 @@
TRACE_EVENT_INSTANT2("test_gpu", "SwapBuffers", TRACE_EVENT_SCOPE_THREAD,
"GLImpl", static_cast<int>(gl::GetGLImplementation()),
"width", pixel_size_.width());
diff --git a/patches/chromium/mas_use_public_apis_to_determine_if_a_font_is_a_system_font.patch b/patches/chromium/mas_use_public_apis_to_determine_if_a_font_is_a_system_font.patch
index fdc4c7370f..d01a1e9c3a 100644
--- a/patches/chromium/mas_use_public_apis_to_determine_if_a_font_is_a_system_font.patch
+++ b/patches/chromium/mas_use_public_apis_to_determine_if_a_font_is_a_system_font.patch
@@ -9,10 +9,10 @@ system font by checking if it's kCTFontPriorityAttribute is set to
system priority.
diff --git a/ui/gfx/platform_font_mac.mm b/ui/gfx/platform_font_mac.mm
-index 1c563484862eedcd260db03036769778c6a48991..cd47d4c83bd99587c3e5b77941c4b4bbb01280b8 100644
+index 1e1bfb0068096b7ff8c8e1913ee884a245cfb226..2a30628c84d8f6bc2fd5548e838d2d13824bc7d3 100644
--- a/ui/gfx/platform_font_mac.mm
+++ b/ui/gfx/platform_font_mac.mm
-@@ -27,9 +27,11 @@
+@@ -32,9 +32,11 @@
using Weight = Font::Weight;
@@ -24,7 +24,7 @@ index 1c563484862eedcd260db03036769778c6a48991..cd47d4c83bd99587c3e5b77941c4b4bb
namespace {
-@@ -243,7 +245,13 @@ CTFontRef SystemFontForConstructorOfType(PlatformFontMac::SystemFontType type) {
+@@ -249,7 +251,13 @@ CTFontRef SystemFontForConstructorOfType(PlatformFontMac::SystemFontType type) {
// TODO(avi, etienneb): Figure out this font stuff.
base::ScopedCFTypeRef<CTFontDescriptorRef> descriptor(
CTFontCopyFontDescriptor(font));
diff --git a/patches/chromium/notification_provenance.patch b/patches/chromium/notification_provenance.patch
index 983f25c372..9d7fbb3277 100644
--- a/patches/chromium/notification_provenance.patch
+++ b/patches/chromium/notification_provenance.patch
@@ -133,10 +133,10 @@ index bbd2aa78722fc0a14ac815ca0243b83965ad8d7c..b6e0a2fce3a0fb9c449aa1bef6a0f970
const GURL& document_url,
const WeakDocumentPtr& weak_document_ptr,
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
-index acd1beec90cac362a126b3569a86016f0328cd0c..73435bda2d393fb22ce4cff0917d90e6ec111c69 100644
+index da1be3451a2be4a9e02bca28456906e398f2ebd1..2ff019b77e65e7ac2915c83cfc4f467c7789b678 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
-@@ -2135,7 +2135,7 @@ void RenderProcessHostImpl::CreateNotificationService(
+@@ -2148,7 +2148,7 @@ void RenderProcessHostImpl::CreateNotificationService(
case RenderProcessHost::NotificationServiceCreatorType::kSharedWorker:
case RenderProcessHost::NotificationServiceCreatorType::kDedicatedWorker: {
storage_partition_impl_->GetPlatformNotificationContext()->CreateService(
@@ -145,7 +145,7 @@ index acd1beec90cac362a126b3569a86016f0328cd0c..73435bda2d393fb22ce4cff0917d90e6
creator_type, std::move(receiver));
break;
}
-@@ -2143,7 +2143,7 @@ void RenderProcessHostImpl::CreateNotificationService(
+@@ -2156,7 +2156,7 @@ void RenderProcessHostImpl::CreateNotificationService(
CHECK(rfh);
storage_partition_impl_->GetPlatformNotificationContext()->CreateService(
diff --git a/patches/chromium/port_autofill_colors_to_the_color_pipeline.patch b/patches/chromium/port_autofill_colors_to_the_color_pipeline.patch
index a69899dad7..4cfcf3be3f 100644
--- a/patches/chromium/port_autofill_colors_to_the_color_pipeline.patch
+++ b/patches/chromium/port_autofill_colors_to_the_color_pipeline.patch
@@ -8,10 +8,10 @@ needed in chromium but our autofill implementation uses them. This patch can be
our autofill implementation to work like Chromium's.
diff --git a/ui/color/color_id.h b/ui/color/color_id.h
-index ea088b263d70c0aae6ceae7e15ebe74a906ebc90..5aaced24d344f37f089579e3627b864ce502c53f 100644
+index 112fccec57bdeb25857516c70f984d31bcc3cbeb..fdb578b491dc7cc431319b20eec483131ca4096b 100644
--- a/ui/color/color_id.h
+++ b/ui/color/color_id.h
-@@ -355,6 +355,10 @@
+@@ -359,6 +359,10 @@
E_CPONLY(kColorScrollbarThumbInactive) \
E_CPONLY(kColorScrollbarThumbPressed) \
E_CPONLY(kColorScrollbarTrack) \
@@ -19,10 +19,10 @@ index ea088b263d70c0aae6ceae7e15ebe74a906ebc90..5aaced24d344f37f089579e3627b864c
+ E_CPONLY(kColorResultsTableHoveredBackground) \
+ E_CPONLY(kColorResultsTableNormalText) \
+ E_CPONLY(kColorResultsTableDimmedText) \
- E_CPONLY(kColorSeparator) \
- E_CPONLY(kColorShadowBase) \
- E_CPONLY(kColorShadowValueAmbientShadowElevationSixteen) \
-@@ -428,6 +432,7 @@
+ E_CPONLY(kColorSegmentedButtonBorder) \
+ E_CPONLY(kColorSegmentedButtonFocus) \
+ E_CPONLY(kColorSegmentedButtonForegroundChecked) \
+@@ -445,6 +449,7 @@
E_CPONLY(kColorTreeNodeForeground) \
E_CPONLY(kColorTreeNodeForegroundSelectedFocused) \
E_CPONLY(kColorTreeNodeForegroundSelectedUnfocused) \
@@ -31,10 +31,10 @@ index ea088b263d70c0aae6ceae7e15ebe74a906ebc90..5aaced24d344f37f089579e3627b864c
#if BUILDFLAG(IS_CHROMEOS)
diff --git a/ui/color/ui_color_mixer.cc b/ui/color/ui_color_mixer.cc
-index 7b250f1ac38e0c16a5412660876ec0dc9367d353..dc51327e0e87b204ee42afe665a4ea493c21ac14 100644
+index b98320a87ce8601e28038cc15fd29d442bd57e34..d70fabe9f709ba5af1200db1a953d7ef7b65cffb 100644
--- a/ui/color/ui_color_mixer.cc
+++ b/ui/color/ui_color_mixer.cc
-@@ -219,6 +219,17 @@ void AddUiColorMixer(ColorProvider* provider,
+@@ -207,6 +207,17 @@ void AddUiColorMixer(ColorProvider* provider,
: SkColorSetA(SK_ColorBLACK, 0x80)};
mixer[kColorScrollbarTrack] = {dark_mode ? SkColorSetRGB(0x42, 0x42, 0x42)
: SkColorSetRGB(0xF1, 0xF1, 0xF1)};
@@ -52,7 +52,7 @@ index 7b250f1ac38e0c16a5412660876ec0dc9367d353..dc51327e0e87b204ee42afe665a4ea49
mixer[kColorSeparator] = {kColorMidground};
mixer[kColorShadowBase] = {dark_mode ? SK_ColorBLACK : gfx::kGoogleGrey800};
mixer[kColorShadowValueAmbientShadowElevationThree] =
-@@ -316,6 +327,7 @@ void AddUiColorMixer(ColorProvider* provider,
+@@ -304,6 +315,7 @@ void AddUiColorMixer(ColorProvider* provider,
mixer[kColorTreeNodeForegroundSelectedFocused] = {kColorTreeNodeForeground};
mixer[kColorTreeNodeForegroundSelectedUnfocused] = {
kColorTreeNodeForegroundSelectedFocused};
@@ -61,10 +61,10 @@ index 7b250f1ac38e0c16a5412660876ec0dc9367d353..dc51327e0e87b204ee42afe665a4ea49
}
diff --git a/ui/color/win/native_color_mixers_win.cc b/ui/color/win/native_color_mixers_win.cc
-index 1a26abccb3008e78881d2ddfadba904d5c9b422e..b9ff42c4a65972ad937bb379ad5318bd15e5a22a 100644
+index a688e73fe91dc4a0279a2544e54fc42bc9404d84..331770a1218100c9e52e776213662cf622276b08 100644
--- a/ui/color/win/native_color_mixers_win.cc
+++ b/ui/color/win/native_color_mixers_win.cc
-@@ -203,6 +203,10 @@ void AddNativeUiColorMixer(ColorProvider* provider,
+@@ -199,6 +199,10 @@ void AddNativeUiColorMixer(ColorProvider* provider,
SetAlpha(kColorNotificationInputForeground, gfx::kGoogleGreyAlpha700);
mixer[kColorSliderTrack] = AlphaBlend(
kColorNativeHighlight, kColorNativeWindow, gfx::kGoogleGreyAlpha400);
@@ -75,7 +75,7 @@ index 1a26abccb3008e78881d2ddfadba904d5c9b422e..b9ff42c4a65972ad937bb379ad5318bd
// Window Background
mixer[kColorBubbleFooterBackground] = {kColorNativeWindow};
-@@ -211,6 +215,7 @@ void AddNativeUiColorMixer(ColorProvider* provider,
+@@ -207,6 +211,7 @@ void AddNativeUiColorMixer(ColorProvider* provider,
mixer[kColorFrameInactive] = {ui::kColorNativeWindow};
mixer[kColorPrimaryBackground] = {kColorNativeWindow};
mixer[kColorTooltipBackground] = {kColorNativeWindow};
@@ -83,7 +83,7 @@ index 1a26abccb3008e78881d2ddfadba904d5c9b422e..b9ff42c4a65972ad937bb379ad5318bd
// Window Text
mixer[kColorAlertLowSeverity] = {kColorNativeWindowText};
-@@ -224,6 +229,7 @@ void AddNativeUiColorMixer(ColorProvider* provider,
+@@ -220,6 +225,7 @@ void AddNativeUiColorMixer(ColorProvider* provider,
mixer[kColorTableGroupingIndicator] = {kColorNativeWindowText};
mixer[kColorThrobber] = {kColorNativeWindowText};
mixer[kColorTooltipForeground] = {kColorNativeWindowText};
@@ -91,7 +91,7 @@ index 1a26abccb3008e78881d2ddfadba904d5c9b422e..b9ff42c4a65972ad937bb379ad5318bd
// Hyperlinks
mixer[kColorLinkForeground] = {kColorNativeHotlight};
-@@ -266,6 +272,7 @@ void AddNativeUiColorMixer(ColorProvider* provider,
+@@ -262,6 +268,7 @@ void AddNativeUiColorMixer(ColorProvider* provider,
mixer[kColorTextfieldForeground] = {kColorNativeBtnText};
mixer[kColorTextfieldForegroundPlaceholder] = {kColorNativeBtnText};
mixer[kColorTextfieldForegroundDisabled] = {kColorNativeBtnText};
diff --git a/patches/chromium/printing.patch b/patches/chromium/printing.patch
index 49db4dde6d..7a846d1d0f 100644
--- a/patches/chromium/printing.patch
+++ b/patches/chromium/printing.patch
@@ -11,7 +11,7 @@ majority of changes originally come from these PRs:
This patch also fixes callback for manual user cancellation and success.
diff --git a/BUILD.gn b/BUILD.gn
-index 9c4b529ba6998cd0078b2b686008d14ee3fa204c..b598c88e4992d0ba327b8c1f23c826fe3ee50e0e 100644
+index ea3d57d0937407a40e3c78bdffa18bb46a92300f..48e582b206dd31014f7e61f15725a2676f222587 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -974,7 +974,6 @@ if (is_win) {
@@ -34,10 +34,10 @@ index 9c4b529ba6998cd0078b2b686008d14ee3fa204c..b598c88e4992d0ba327b8c1f23c826fe
}
diff --git a/chrome/browser/printing/print_job.cc b/chrome/browser/printing/print_job.cc
-index b496ff49232f449fd6cea9dc1927b833c049497b..4c12ca65c1f800ddbbb792716f09f63fff8fa7d4 100644
+index 3a66a52b8d3c6da9cd8d7e9afdc8d59f528ec3d5..facaa6fbca8ee7c04f83607e62b81b9594727ada 100644
--- a/chrome/browser/printing/print_job.cc
+++ b/chrome/browser/printing/print_job.cc
-@@ -91,6 +91,7 @@ bool PrintWithReducedRasterization(PrefService* prefs) {
+@@ -93,6 +93,7 @@ bool PrintWithReducedRasterization(PrefService* prefs) {
return base::FeatureList::IsEnabled(features::kPrintWithReducedRasterization);
}
@@ -45,7 +45,7 @@ index b496ff49232f449fd6cea9dc1927b833c049497b..4c12ca65c1f800ddbbb792716f09f63f
PrefService* GetPrefsForWebContents(content::WebContents* web_contents) {
// TODO(thestig): Figure out why crbug.com/1083911 occurred, which is likely
// because `web_contents` was null. As a result, this section has many more
-@@ -105,6 +106,7 @@ content::WebContents* GetWebContents(content::GlobalRenderFrameHostId rfh_id) {
+@@ -107,6 +108,7 @@ content::WebContents* GetWebContents(content::GlobalRenderFrameHostId rfh_id) {
auto* rfh = content::RenderFrameHost::FromID(rfh_id);
return rfh ? content::WebContents::FromRenderFrameHost(rfh) : nullptr;
}
@@ -53,7 +53,20 @@ index b496ff49232f449fd6cea9dc1927b833c049497b..4c12ca65c1f800ddbbb792716f09f63f
#endif // BUILDFLAG(IS_WIN)
-@@ -363,8 +365,10 @@ void PrintJob::StartPdfToEmfConversion(
+@@ -147,10 +149,8 @@ void PrintJob::Initialize(std::unique_ptr<PrinterQuery> query,
+
+ #if BUILDFLAG(IS_WIN)
+ pdf_page_mapping_ = PageNumber::GetPages(settings->ranges(), page_count);
+- PrefService* prefs = GetPrefsForWebContents(GetWebContents(rfh_id_));
+- if (prefs && prefs->IsManagedPreference(prefs::kPdfUseSkiaRendererEnabled)) {
+- use_skia_ = prefs->GetBoolean(prefs::kPdfUseSkiaRendererEnabled);
+- }
++ // TODO(codebytere): should we enable this later?
++ use_skia_ = false;
+ #endif
+
+ auto new_doc = base::MakeRefCounted<PrintedDocument>(std::move(settings),
+@@ -374,8 +374,10 @@ void PrintJob::StartPdfToEmfConversion(
const PrintSettings& settings = document()->settings();
@@ -65,7 +78,7 @@ index b496ff49232f449fd6cea9dc1927b833c049497b..4c12ca65c1f800ddbbb792716f09f63f
using RenderMode = PdfRenderSettings::Mode;
RenderMode mode = print_with_reduced_rasterization
-@@ -454,8 +458,10 @@ void PrintJob::StartPdfToPostScriptConversion(
+@@ -465,8 +467,10 @@ void PrintJob::StartPdfToPostScriptConversion(
if (ps_level2) {
mode = PdfRenderSettings::Mode::POSTSCRIPT_LEVEL2;
} else {
@@ -78,7 +91,7 @@ index b496ff49232f449fd6cea9dc1927b833c049497b..4c12ca65c1f800ddbbb792716f09f63f
: PdfRenderSettings::Mode::POSTSCRIPT_LEVEL3;
}
diff --git a/chrome/browser/printing/print_view_manager_base.cc b/chrome/browser/printing/print_view_manager_base.cc
-index 6756967e1df3d985eab45aaaefcf5dd2f7025b9a..5dcee39d6778684f7cd171b97c68e576ec12ac3a 100644
+index d7a3961a5c79e4d4f9f0fc5fbd6f1c55ab65ca9d..cf200ee43464bcde31dc13c18524e58d4ac2479b 100644
--- a/chrome/browser/printing/print_view_manager_base.cc
+++ b/chrome/browser/printing/print_view_manager_base.cc
@@ -23,7 +23,9 @@
@@ -91,7 +104,7 @@ index 6756967e1df3d985eab45aaaefcf5dd2f7025b9a..5dcee39d6778684f7cd171b97c68e576
#include "chrome/browser/printing/print_job.h"
#include "chrome/browser/printing/print_job_manager.h"
#include "chrome/browser/printing/print_view_manager_common.h"
-@@ -79,6 +81,20 @@ namespace printing {
+@@ -83,6 +85,20 @@ namespace printing {
namespace {
@@ -112,7 +125,7 @@ index 6756967e1df3d985eab45aaaefcf5dd2f7025b9a..5dcee39d6778684f7cd171b97c68e576
void OnDidGetDefaultPrintSettings(
scoped_refptr<PrintQueriesQueue> queue,
bool want_pdf_settings,
-@@ -87,9 +103,11 @@ void OnDidGetDefaultPrintSettings(
+@@ -91,9 +107,11 @@ void OnDidGetDefaultPrintSettings(
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
if (printer_query->last_status() != mojom::ResultCode::kSuccess) {
@@ -124,7 +137,7 @@ index 6756967e1df3d985eab45aaaefcf5dd2f7025b9a..5dcee39d6778684f7cd171b97c68e576
std::move(callback).Run(nullptr);
return;
}
-@@ -99,9 +117,11 @@ void OnDidGetDefaultPrintSettings(
+@@ -103,9 +121,11 @@ void OnDidGetDefaultPrintSettings(
params->document_cookie = printer_query->cookie();
if (!PrintMsgPrintParamsIsValid(*params)) {
@@ -136,7 +149,7 @@ index 6756967e1df3d985eab45aaaefcf5dd2f7025b9a..5dcee39d6778684f7cd171b97c68e576
std::move(callback).Run(nullptr);
return;
}
-@@ -118,7 +138,7 @@ void OnDidScriptedPrint(
+@@ -122,7 +142,7 @@ void OnDidScriptedPrint(
if (printer_query->last_status() != mojom::ResultCode::kSuccess ||
!printer_query->settings().dpi()) {
@@ -145,7 +158,7 @@ index 6756967e1df3d985eab45aaaefcf5dd2f7025b9a..5dcee39d6778684f7cd171b97c68e576
return;
}
-@@ -128,12 +148,13 @@ void OnDidScriptedPrint(
+@@ -132,12 +152,13 @@ void OnDidScriptedPrint(
params->params.get());
params->params->document_cookie = printer_query->cookie();
if (!PrintMsgPrintParamsIsValid(*params->params)) {
@@ -161,7 +174,7 @@ index 6756967e1df3d985eab45aaaefcf5dd2f7025b9a..5dcee39d6778684f7cd171b97c68e576
queue->QueuePrinterQuery(std::move(printer_query));
}
-@@ -170,9 +191,11 @@ PrintViewManagerBase::PrintViewManagerBase(content::WebContents* web_contents)
+@@ -174,9 +195,11 @@ PrintViewManagerBase::PrintViewManagerBase(content::WebContents* web_contents)
: PrintManager(web_contents),
queue_(g_browser_process->print_job_manager()->queue()) {
DCHECK(queue_);
@@ -174,9 +187,9 @@ index 6756967e1df3d985eab45aaaefcf5dd2f7025b9a..5dcee39d6778684f7cd171b97c68e576
}
PrintViewManagerBase::~PrintViewManagerBase() {
-@@ -180,7 +203,10 @@ PrintViewManagerBase::~PrintViewManagerBase() {
- DisconnectFromCurrentPrintJob();
+@@ -199,7 +222,10 @@ void PrintViewManagerBase::DisableThirdPartyBlocking() {
}
+ #endif // BUILDFLAG(IS_WIN) && BUILDFLAG(GOOGLE_CHROME_BRANDING)
-bool PrintViewManagerBase::PrintNow(content::RenderFrameHost* rfh) {
+bool PrintViewManagerBase::PrintNow(content::RenderFrameHost* rfh,
@@ -186,7 +199,7 @@ index 6756967e1df3d985eab45aaaefcf5dd2f7025b9a..5dcee39d6778684f7cd171b97c68e576
// Remember the ID for `rfh`, to enable checking that the `RenderFrameHost`
// is still valid after a possible inner message loop runs in
// `DisconnectFromCurrentPrintJob()`.
-@@ -208,7 +234,12 @@ bool PrintViewManagerBase::PrintNow(content::RenderFrameHost* rfh) {
+@@ -227,7 +253,12 @@ bool PrintViewManagerBase::PrintNow(content::RenderFrameHost* rfh) {
#endif
SetPrintingRFH(rfh);
@@ -199,7 +212,7 @@ index 6756967e1df3d985eab45aaaefcf5dd2f7025b9a..5dcee39d6778684f7cd171b97c68e576
return true;
}
-@@ -432,7 +463,8 @@ void PrintViewManagerBase::GetDefaultPrintSettingsReply(
+@@ -451,7 +482,8 @@ void PrintViewManagerBase::GetDefaultPrintSettingsReply(
void PrintViewManagerBase::ScriptedPrintReply(
ScriptedPrintCallback callback,
int process_id,
@@ -209,7 +222,7 @@ index 6756967e1df3d985eab45aaaefcf5dd2f7025b9a..5dcee39d6778684f7cd171b97c68e576
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
#if BUILDFLAG(ENABLE_OOP_PRINTING)
-@@ -447,12 +479,15 @@ void PrintViewManagerBase::ScriptedPrintReply(
+@@ -466,12 +498,15 @@ void PrintViewManagerBase::ScriptedPrintReply(
return;
}
@@ -227,7 +240,7 @@ index 6756967e1df3d985eab45aaaefcf5dd2f7025b9a..5dcee39d6778684f7cd171b97c68e576
}
}
-@@ -588,10 +623,12 @@ void PrintViewManagerBase::DidPrintDocument(
+@@ -607,10 +642,12 @@ void PrintViewManagerBase::DidPrintDocument(
void PrintViewManagerBase::GetDefaultPrintSettings(
GetDefaultPrintSettingsCallback callback) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
@@ -240,7 +253,7 @@ index 6756967e1df3d985eab45aaaefcf5dd2f7025b9a..5dcee39d6778684f7cd171b97c68e576
#if BUILDFLAG(ENABLE_OOP_PRINTING)
if (printing::features::kEnableOopPrintDriversJobPrint.Get() &&
#if BUILDFLAG(ENABLE_PRINT_CONTENT_ANALYSIS)
-@@ -643,10 +680,12 @@ void PrintViewManagerBase::UpdatePrintSettings(
+@@ -661,10 +698,12 @@ void PrintViewManagerBase::UpdatePrintSettings(
base::Value::Dict job_settings,
UpdatePrintSettingsCallback callback) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
@@ -253,7 +266,7 @@ index 6756967e1df3d985eab45aaaefcf5dd2f7025b9a..5dcee39d6778684f7cd171b97c68e576
absl::optional<int> printer_type_value =
job_settings.FindInt(kSettingPrinterType);
-@@ -657,6 +696,7 @@ void PrintViewManagerBase::UpdatePrintSettings(
+@@ -675,6 +714,7 @@ void PrintViewManagerBase::UpdatePrintSettings(
mojom::PrinterType printer_type =
static_cast<mojom::PrinterType>(*printer_type_value);
@@ -261,7 +274,7 @@ index 6756967e1df3d985eab45aaaefcf5dd2f7025b9a..5dcee39d6778684f7cd171b97c68e576
if (printer_type != mojom::PrinterType::kExtension &&
printer_type != mojom::PrinterType::kPdf &&
printer_type != mojom::PrinterType::kLocal) {
-@@ -676,6 +716,7 @@ void PrintViewManagerBase::UpdatePrintSettings(
+@@ -694,6 +734,7 @@ void PrintViewManagerBase::UpdatePrintSettings(
if (value > 0)
job_settings.Set(kSettingRasterizePdfDpi, value);
}
@@ -269,7 +282,7 @@ index 6756967e1df3d985eab45aaaefcf5dd2f7025b9a..5dcee39d6778684f7cd171b97c68e576
std::unique_ptr<PrintSettings> print_settings =
PrintSettingsFromJobSettings(job_settings);
-@@ -725,7 +766,7 @@ void PrintViewManagerBase::UpdatePrintSettings(
+@@ -743,7 +784,7 @@ void PrintViewManagerBase::UpdatePrintSettings(
void PrintViewManagerBase::IsPrintingEnabled(
IsPrintingEnabledCallback callback) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
@@ -278,7 +291,7 @@ index 6756967e1df3d985eab45aaaefcf5dd2f7025b9a..5dcee39d6778684f7cd171b97c68e576
}
void PrintViewManagerBase::ScriptedPrint(mojom::ScriptedPrintParamsPtr params,
-@@ -741,14 +782,14 @@ void PrintViewManagerBase::ScriptedPrint(mojom::ScriptedPrintParamsPtr params,
+@@ -759,14 +800,14 @@ void PrintViewManagerBase::ScriptedPrint(mojom::ScriptedPrintParamsPtr params,
// didn't happen for some reason.
bad_message::ReceivedBadMessage(
render_process_host, bad_message::PVMB_SCRIPTED_PRINT_FENCED_FRAME);
@@ -295,7 +308,7 @@ index 6756967e1df3d985eab45aaaefcf5dd2f7025b9a..5dcee39d6778684f7cd171b97c68e576
return;
}
#endif
-@@ -786,6 +827,7 @@ void PrintViewManagerBase::PrintingFailed(int32_t cookie,
+@@ -801,6 +842,7 @@ void PrintViewManagerBase::PrintingFailed(int32_t cookie,
PrintManager::PrintingFailed(cookie, reason);
@@ -303,7 +316,7 @@ index 6756967e1df3d985eab45aaaefcf5dd2f7025b9a..5dcee39d6778684f7cd171b97c68e576
// `PrintingFailed()` can occur because asynchronous compositing results
// don't complete until after a print job has already failed and been
// destroyed. In such cases the error notification to the user will
-@@ -795,7 +837,7 @@ void PrintViewManagerBase::PrintingFailed(int32_t cookie,
+@@ -810,7 +852,7 @@ void PrintViewManagerBase::PrintingFailed(int32_t cookie,
print_job_->document()->cookie() == cookie) {
ShowPrintErrorDialogForGenericError();
}
@@ -312,7 +325,7 @@ index 6756967e1df3d985eab45aaaefcf5dd2f7025b9a..5dcee39d6778684f7cd171b97c68e576
ReleasePrinterQuery();
}
-@@ -807,15 +849,24 @@ void PrintViewManagerBase::RemoveObserver(Observer& observer) {
+@@ -822,15 +864,24 @@ void PrintViewManagerBase::RemoveObserver(Observer& observer) {
observers_.RemoveObserver(&observer);
}
@@ -337,7 +350,7 @@ index 6756967e1df3d985eab45aaaefcf5dd2f7025b9a..5dcee39d6778684f7cd171b97c68e576
}
void PrintViewManagerBase::RenderFrameDeleted(
-@@ -867,7 +918,12 @@ void PrintViewManagerBase::OnJobDone() {
+@@ -882,7 +933,12 @@ void PrintViewManagerBase::OnJobDone() {
// Printing is done, we don't need it anymore.
// print_job_->is_job_pending() may still be true, depending on the order
// of object registration.
@@ -351,7 +364,7 @@ index 6756967e1df3d985eab45aaaefcf5dd2f7025b9a..5dcee39d6778684f7cd171b97c68e576
ReleasePrintJob();
}
-@@ -876,9 +932,10 @@ void PrintViewManagerBase::OnCanceling() {
+@@ -891,9 +947,10 @@ void PrintViewManagerBase::OnCanceling() {
}
void PrintViewManagerBase::OnFailed() {
@@ -363,7 +376,7 @@ index 6756967e1df3d985eab45aaaefcf5dd2f7025b9a..5dcee39d6778684f7cd171b97c68e576
TerminatePrintJob(true);
}
-@@ -888,7 +945,7 @@ bool PrintViewManagerBase::RenderAllMissingPagesNow() {
+@@ -903,7 +960,7 @@ bool PrintViewManagerBase::RenderAllMissingPagesNow() {
// Is the document already complete?
if (print_job_->document() && print_job_->document()->IsComplete()) {
@@ -372,7 +385,7 @@ index 6756967e1df3d985eab45aaaefcf5dd2f7025b9a..5dcee39d6778684f7cd171b97c68e576
return true;
}
-@@ -936,7 +993,10 @@ bool PrintViewManagerBase::CreateNewPrintJob(
+@@ -951,7 +1008,10 @@ bool PrintViewManagerBase::CreateNewPrintJob(
// Disconnect the current `print_job_`.
auto weak_this = weak_ptr_factory_.GetWeakPtr();
@@ -384,7 +397,7 @@ index 6756967e1df3d985eab45aaaefcf5dd2f7025b9a..5dcee39d6778684f7cd171b97c68e576
if (!weak_this)
return false;
-@@ -957,7 +1017,7 @@ bool PrintViewManagerBase::CreateNewPrintJob(
+@@ -972,7 +1032,7 @@ bool PrintViewManagerBase::CreateNewPrintJob(
#endif
print_job_->AddObserver(*this);
@@ -393,7 +406,7 @@ index 6756967e1df3d985eab45aaaefcf5dd2f7025b9a..5dcee39d6778684f7cd171b97c68e576
return true;
}
-@@ -1019,6 +1079,11 @@ void PrintViewManagerBase::ReleasePrintJob() {
+@@ -1034,6 +1094,11 @@ void PrintViewManagerBase::ReleasePrintJob() {
}
#endif
@@ -405,7 +418,7 @@ index 6756967e1df3d985eab45aaaefcf5dd2f7025b9a..5dcee39d6778684f7cd171b97c68e576
if (!print_job_)
return;
-@@ -1026,7 +1091,7 @@ void PrintViewManagerBase::ReleasePrintJob() {
+@@ -1041,7 +1106,7 @@ void PrintViewManagerBase::ReleasePrintJob() {
// printing_rfh_ should only ever point to a RenderFrameHost with a live
// RenderFrame.
DCHECK(rfh->IsRenderFrameLive());
@@ -414,7 +427,7 @@ index 6756967e1df3d985eab45aaaefcf5dd2f7025b9a..5dcee39d6778684f7cd171b97c68e576
}
print_job_->RemoveObserver(*this);
-@@ -1068,7 +1133,7 @@ bool PrintViewManagerBase::RunInnerMessageLoop() {
+@@ -1083,7 +1148,7 @@ bool PrintViewManagerBase::RunInnerMessageLoop() {
}
bool PrintViewManagerBase::OpportunisticallyCreatePrintJob(int cookie) {
@@ -423,7 +436,7 @@ index 6756967e1df3d985eab45aaaefcf5dd2f7025b9a..5dcee39d6778684f7cd171b97c68e576
return true;
if (!cookie) {
-@@ -1176,7 +1241,7 @@ void PrintViewManagerBase::ReleasePrinterQuery() {
+@@ -1191,7 +1256,7 @@ void PrintViewManagerBase::ReleasePrinterQuery() {
}
void PrintViewManagerBase::CompletePrintNow(content::RenderFrameHost* rfh) {
@@ -432,7 +445,7 @@ index 6756967e1df3d985eab45aaaefcf5dd2f7025b9a..5dcee39d6778684f7cd171b97c68e576
for (auto& observer : GetObservers())
observer.OnPrintNow(rfh);
-@@ -1224,7 +1289,7 @@ void PrintViewManagerBase::CompleteScriptedPrintAfterContentAnalysis(
+@@ -1239,7 +1304,7 @@ void PrintViewManagerBase::CompleteScriptedPrintAfterContentAnalysis(
bool allowed) {
if (!allowed || !printing_rfh_ || IsCrashed() ||
!printing_rfh_->IsRenderFrameLive()) {
@@ -442,10 +455,10 @@ index 6756967e1df3d985eab45aaaefcf5dd2f7025b9a..5dcee39d6778684f7cd171b97c68e576
}
CompleteScriptedPrint(printing_rfh_, std::move(params), std::move(callback));
diff --git a/chrome/browser/printing/print_view_manager_base.h b/chrome/browser/printing/print_view_manager_base.h
-index af968282117eb3b6969b479a18765ec6908843be..59814c3f6c32c1aff0776031b37a296cc9133923 100644
+index 0b07b29da7df2595270391aed19e6eecd53b9f02..a5fb7fb6aac719df0dfed116daf798314a07b244 100644
--- a/chrome/browser/printing/print_view_manager_base.h
+++ b/chrome/browser/printing/print_view_manager_base.h
-@@ -46,6 +46,8 @@ namespace printing {
+@@ -47,6 +47,8 @@ namespace printing {
class PrintQueriesQueue;
class PrinterQuery;
@@ -454,7 +467,7 @@ index af968282117eb3b6969b479a18765ec6908843be..59814c3f6c32c1aff0776031b37a296c
// Base class for managing the print commands for a WebContents.
class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
public:
-@@ -74,7 +76,10 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
+@@ -80,7 +82,10 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
// Prints the current document immediately. Since the rendering is
// asynchronous, the actual printing will not be completed on the return of
// this function. Returns false if printing is impossible at the moment.
@@ -466,7 +479,7 @@ index af968282117eb3b6969b479a18765ec6908843be..59814c3f6c32c1aff0776031b37a296c
#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
// Prints the document in `print_data` with settings specified in
-@@ -126,8 +131,10 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
+@@ -132,8 +137,10 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
void IsPrintingEnabled(IsPrintingEnabledCallback callback) override;
void ScriptedPrint(mojom::ScriptedPrintParamsPtr params,
ScriptedPrintCallback callback) override;
@@ -477,7 +490,7 @@ index af968282117eb3b6969b479a18765ec6908843be..59814c3f6c32c1aff0776031b37a296c
// Adds and removes observers for `PrintViewManagerBase` events. The order in
// which notifications are sent to observers is undefined. Observers must be
-@@ -135,6 +142,14 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
+@@ -141,6 +148,14 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
void AddObserver(Observer& observer);
void RemoveObserver(Observer& observer);
@@ -492,7 +505,7 @@ index af968282117eb3b6969b479a18765ec6908843be..59814c3f6c32c1aff0776031b37a296c
protected:
explicit PrintViewManagerBase(content::WebContents* web_contents);
-@@ -285,7 +300,8 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
+@@ -291,7 +306,8 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
// Runs `callback` with `params` to reply to ScriptedPrint().
void ScriptedPrintReply(ScriptedPrintCallback callback,
int process_id,
@@ -502,7 +515,7 @@ index af968282117eb3b6969b479a18765ec6908843be..59814c3f6c32c1aff0776031b37a296c
// Requests the RenderView to render all the missing pages for the print job.
// No-op if no print job is pending. Returns true if at least one page has
-@@ -355,8 +371,11 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
+@@ -361,8 +377,11 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
// The current RFH that is printing with a system printing dialog.
raw_ptr<content::RenderFrameHost> printing_rfh_ = nullptr;
@@ -620,7 +633,7 @@ index a65f892c435369b8a9a645ab4cc757ba8bdb68cc..50b51b702d565febf1b8bbe8cd58bcef
// Tells the browser printing failed.
PrintingFailed(int32 cookie, PrintFailureReason reason);
diff --git a/components/printing/renderer/print_render_frame_helper.cc b/components/printing/renderer/print_render_frame_helper.cc
-index 9328ac374483e44200c6f85cb42462d2734c00a8..8eb81badf2ca16d0faca63a4021187426530b0d5 100644
+index 2fc137bf2583006130b133008cb4c253e76449ed..13260dc05853f565c39f001332857c232ab73e9f 100644
--- a/components/printing/renderer/print_render_frame_helper.cc
+++ b/components/printing/renderer/print_render_frame_helper.cc
@@ -45,6 +45,7 @@
@@ -631,7 +644,7 @@ index 9328ac374483e44200c6f85cb42462d2734c00a8..8eb81badf2ca16d0faca63a402118742
#include "printing/units.h"
#include "services/metrics/public/cpp/ukm_source_id.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
-@@ -1314,7 +1315,8 @@ void PrintRenderFrameHelper::ScriptedPrint(bool user_initiated) {
+@@ -1317,7 +1318,8 @@ void PrintRenderFrameHelper::ScriptedPrint(bool user_initiated) {
if (!weak_this)
return;
@@ -641,7 +654,7 @@ index 9328ac374483e44200c6f85cb42462d2734c00a8..8eb81badf2ca16d0faca63a402118742
if (!weak_this)
return;
-@@ -1345,7 +1347,7 @@ void PrintRenderFrameHelper::BindPrintRenderFrameReceiver(
+@@ -1348,7 +1350,7 @@ void PrintRenderFrameHelper::BindPrintRenderFrameReceiver(
receivers_.Add(this, std::move(receiver));
}
@@ -650,7 +663,7 @@ index 9328ac374483e44200c6f85cb42462d2734c00a8..8eb81badf2ca16d0faca63a402118742
ScopedIPC scoped_ipc(weak_ptr_factory_.GetWeakPtr());
if (ipc_nesting_level_ > kAllowedIpcDepthForPrint)
return;
-@@ -1360,7 +1362,7 @@ void PrintRenderFrameHelper::PrintRequestedPages() {
+@@ -1363,7 +1365,7 @@ void PrintRenderFrameHelper::PrintRequestedPages() {
// plugin node and print that instead.
auto plugin = delegate_->GetPdfElement(frame);
@@ -659,7 +672,7 @@ index 9328ac374483e44200c6f85cb42462d2734c00a8..8eb81badf2ca16d0faca63a402118742
if (!render_frame_gone_)
frame->DispatchAfterPrintEvent();
-@@ -1439,7 +1441,8 @@ void PrintRenderFrameHelper::PrintForSystemDialog() {
+@@ -1442,7 +1444,8 @@ void PrintRenderFrameHelper::PrintForSystemDialog() {
}
Print(frame, print_preview_context_.source_node(),
@@ -669,7 +682,7 @@ index 9328ac374483e44200c6f85cb42462d2734c00a8..8eb81badf2ca16d0faca63a402118742
if (!render_frame_gone_)
print_preview_context_.DispatchAfterPrintEvent();
// WARNING: |this| may be gone at this point. Do not do any more work here and
-@@ -1490,6 +1493,8 @@ void PrintRenderFrameHelper::PrintPreview(base::Value::Dict settings) {
+@@ -1493,6 +1496,8 @@ void PrintRenderFrameHelper::PrintPreview(base::Value::Dict settings) {
if (ipc_nesting_level_ > kAllowedIpcDepthForPrint)
return;
@@ -678,7 +691,7 @@ index 9328ac374483e44200c6f85cb42462d2734c00a8..8eb81badf2ca16d0faca63a402118742
print_preview_context_.OnPrintPreview();
#if BUILDFLAG(IS_CHROMEOS_ASH)
-@@ -2107,7 +2112,8 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) {
+@@ -2110,7 +2115,8 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) {
return;
Print(duplicate_node.GetDocument().GetFrame(), duplicate_node,
@@ -688,7 +701,7 @@ index 9328ac374483e44200c6f85cb42462d2734c00a8..8eb81badf2ca16d0faca63a402118742
// Check if |this| is still valid.
if (!weak_this)
return;
-@@ -2122,7 +2128,9 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) {
+@@ -2125,7 +2131,9 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) {
void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame,
const blink::WebNode& node,
@@ -699,7 +712,7 @@ index 9328ac374483e44200c6f85cb42462d2734c00a8..8eb81badf2ca16d0faca63a402118742
// If still not finished with earlier print request simply ignore.
if (prep_frame_view_)
return;
-@@ -2130,7 +2138,7 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame,
+@@ -2133,7 +2141,7 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame,
FrameReference frame_ref(frame);
uint32_t expected_page_count = 0;
@@ -708,7 +721,7 @@ index 9328ac374483e44200c6f85cb42462d2734c00a8..8eb81badf2ca16d0faca63a402118742
DidFinishPrinting(FAIL_PRINT_INIT);
return; // Failed to init print page settings.
}
-@@ -2149,8 +2157,15 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame,
+@@ -2152,8 +2160,15 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame,
print_pages_params_->params->print_scaling_option;
auto self = weak_ptr_factory_.GetWeakPtr();
@@ -793,7 +806,7 @@ index 9328ac374483e44200c6f85cb42462d2734c00a8..8eb81badf2ca16d0faca63a402118742
std::move(quit_closure).Run();
},
diff --git a/components/printing/renderer/print_render_frame_helper.h b/components/printing/renderer/print_render_frame_helper.h
-index 63376c5e434a8e2afa8e6c0f194377c6b5b8aff5..901dd4671ecee953927ab746eb974dcc1d04612a 100644
+index 9376c3f858bea408d07ba09d988eaa300b4f550b..d62e09ca4ace8fe094a6b71c05e4ced1170ef056 100644
--- a/components/printing/renderer/print_render_frame_helper.h
+++ b/components/printing/renderer/print_render_frame_helper.h
@@ -253,7 +253,7 @@ class PrintRenderFrameHelper
@@ -834,10 +847,10 @@ index 63376c5e434a8e2afa8e6c0f194377c6b5b8aff5..901dd4671ecee953927ab746eb974dcc
#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
// Set options for print preset from source PDF document.
diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn
-index aa0030b7e54a411afd858803fa884f7e25783115..b2f8d8dab348d031510b3ff8a5cf5854feb77282 100644
+index 7f8aea52f3aa4e3538125de9faa9215a9bb19af5..6c5c6f0771c72ac300e07398d4ed9bd3ce9a6ae3 100644
--- a/content/browser/BUILD.gn
+++ b/content/browser/BUILD.gn
-@@ -2868,8 +2868,9 @@ source_set("browser") {
+@@ -2881,8 +2881,9 @@ source_set("browser") {
"//ppapi/shared_impl",
]
diff --git a/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch b/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch
index 05894d493c..a9bc41bbcb 100644
--- a/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch
+++ b/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch
@@ -30,23 +30,24 @@ index fe010b1f001130fbdeaf4ef9ce7798e4baf958b5..28f1305f439be7f669e482ac0e4804c0
// RenderWidgetHost on the primary main frame, and false otherwise.
virtual bool IsWidgetForPrimaryMainFrame(RenderWidgetHostImpl*);
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc
-index 347b8d89a2ecaa6baa4779f650b8af49a6d6d118..07b6f899132ab4b94fb9474d441461c8fcf53705 100644
+index 90c6a5b6999571819ef71f859767cccf635ea883..d08149b8cb57ca357a2304fc9a8b8be4524b18f9 100644
--- a/content/browser/renderer_host/render_widget_host_impl.cc
+++ b/content/browser/renderer_host/render_widget_host_impl.cc
-@@ -2066,6 +2066,8 @@ void RenderWidgetHostImpl::FilterDropData(DropData* drop_data) {
- void RenderWidgetHostImpl::SetCursor(const ui::Cursor& cursor) {
- if (view_)
+@@ -2130,6 +2130,9 @@ void RenderWidgetHostImpl::SetCursor(const ui::Cursor& cursor) {
+ if (view_) {
view_->UpdateCursor(cursor);
-+ if (delegate_)
+ }
++ if (delegate_) {
+ delegate_->OnCursorChanged(cursor);
++ }
}
void RenderWidgetHostImpl::ShowContextMenuAtPoint(
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
-index 87dcf40a7619ad8e9999cf07e2aa7a16e380125e..3faa83e00bfd72eebfac1290846bba1452b85bdb 100644
+index fc91e5302297863c395982818a00e9c2946638f0..62bdbaae3dc3d320dfd038282f3946fab5abd0b9 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
-@@ -4759,6 +4759,11 @@ TextInputManager* WebContentsImpl::GetTextInputManager() {
+@@ -4762,6 +4762,11 @@ TextInputManager* WebContentsImpl::GetTextInputManager() {
return text_input_manager_.get();
}
@@ -59,10 +60,10 @@ index 87dcf40a7619ad8e9999cf07e2aa7a16e380125e..3faa83e00bfd72eebfac1290846bba14
RenderWidgetHostImpl* render_widget_host) {
return render_widget_host == GetPrimaryMainFrame()->GetRenderWidgetHost();
diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h
-index ea889f23e73044b6812c7e514956bee89ebb9396..69f9ffbf4826421491118a0b200d6c71e41f8950 100644
+index 3eb26a731cf955241918f5018f6aaa17588c62fe..86c233a7cccf3146387b56b5427fe7d558379250 100644
--- a/content/browser/web_contents/web_contents_impl.h
+++ b/content/browser/web_contents/web_contents_impl.h
-@@ -972,6 +972,7 @@ class CONTENT_EXPORT WebContentsImpl : public WebContents,
+@@ -971,6 +971,7 @@ class CONTENT_EXPORT WebContentsImpl : public WebContents,
void SendScreenRects() override;
void SendActiveState(bool active) override;
TextInputManager* GetTextInputManager() override;
diff --git a/patches/chromium/remove_usage_of_incognito_apis_in_the_spellchecker.patch b/patches/chromium/remove_usage_of_incognito_apis_in_the_spellchecker.patch
index d363c4422c..6c4ffe2929 100644
--- a/patches/chromium/remove_usage_of_incognito_apis_in_the_spellchecker.patch
+++ b/patches/chromium/remove_usage_of_incognito_apis_in_the_spellchecker.patch
@@ -9,7 +9,7 @@ change to move more of //chrome spellchecker logic into //components so
that we can further separate our dependency from //chrome.
diff --git a/chrome/browser/profiles/profile_keyed_service_factory.cc b/chrome/browser/profiles/profile_keyed_service_factory.cc
-index f14db439624e395bd6cd9d10d5aff480e0384293..ec860cd4033ac09f96be031147d70d2ccefb06c8 100644
+index 30a7e6a641e7b17a47fb5c66fb44d3d5899b9e78..85764a533585df0abe398758e4fd510c711de375 100644
--- a/chrome/browser/profiles/profile_keyed_service_factory.cc
+++ b/chrome/browser/profiles/profile_keyed_service_factory.cc
@@ -22,6 +22,9 @@ ProfileKeyedServiceFactory::~ProfileKeyedServiceFactory() = default;
@@ -23,10 +23,10 @@ index f14db439624e395bd6cd9d10d5aff480e0384293..ec860cd4033ac09f96be031147d70d2c
+#endif
}
diff --git a/chrome/browser/profiles/profile_selections.cc b/chrome/browser/profiles/profile_selections.cc
-index b0515bd0a6c7c09e828c7e67f5f75e6b0a9ea46c..10aa2b39d4033d92fe7502532a497d394c4351d9 100644
+index 7ecd897db8830378f82733d519c00c17093636cb..7e0a4eb93ac9444d760d13736c1a2f6381fc3a7b 100644
--- a/chrome/browser/profiles/profile_selections.cc
+++ b/chrome/browser/profiles/profile_selections.cc
-@@ -181,6 +181,7 @@ Profile* ProfileSelections::ApplyProfileSelection(Profile* profile) const {
+@@ -121,6 +121,7 @@ Profile* ProfileSelections::ApplyProfileSelection(Profile* profile) const {
ProfileSelection ProfileSelections::GetProfileSelection(
const Profile* profile) const {
@@ -34,7 +34,7 @@ index b0515bd0a6c7c09e828c7e67f5f75e6b0a9ea46c..10aa2b39d4033d92fe7502532a497d39
#if BUILDFLAG(IS_CHROMEOS_ASH)
// This check has to be performed before the check on
// `profile->IsRegularProfile()` because profiles that are internal ASH
-@@ -226,6 +227,7 @@ ProfileSelection ProfileSelections::GetProfileSelection(
+@@ -156,6 +157,7 @@ ProfileSelection ProfileSelections::GetProfileSelection(
}
NOTREACHED();
diff --git a/patches/chromium/render_widget_host_view_mac.patch b/patches/chromium/render_widget_host_view_mac.patch
index 4879554dbd..4c2ad40a32 100644
--- a/patches/chromium/render_widget_host_view_mac.patch
+++ b/patches/chromium/render_widget_host_view_mac.patch
@@ -10,7 +10,7 @@ kinds of utility windows. Similarly for `disableAutoHideCursor`.
Additionally, disables usage of some private APIs in MAS builds.
diff --git a/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm b/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm
-index 311d9c2c7cf8fbe70861a67d43a6f82d430f98b2..179c909acfc0c0aef1c778aa2249bd758032c077 100644
+index b95ab55cbffb41b9f13147c3ecf2675a5fe3d2a5..3adf9a51b72f732d425e93c477afdab2cec11dd1 100644
--- a/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm
+++ b/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm
@@ -155,6 +155,15 @@ void ExtractUnderlines(NSAttributedString* string,
@@ -61,7 +61,7 @@ index 311d9c2c7cf8fbe70861a67d43a6f82d430f98b2..179c909acfc0c0aef1c778aa2249bd75
// We only handle key down events and just simply forward other events.
if (eventType != NSEventTypeKeyDown) {
_hostHelper->ForwardKeyboardEvent(event, latency_info);
-@@ -1801,9 +1821,11 @@ - (NSAccessibilityRole)accessibilityRole {
+@@ -1819,9 +1839,11 @@ - (NSAccessibilityRole)accessibilityRole {
// Since this implementation doesn't have to wait any IPC calls, this doesn't
// make any key-typing jank. --hbono 7/23/09
//
@@ -73,7 +73,7 @@ index 311d9c2c7cf8fbe70861a67d43a6f82d430f98b2..179c909acfc0c0aef1c778aa2249bd75
- (NSArray*)validAttributesForMarkedText {
// This code is just copied from WebKit except renaming variables.
-@@ -1812,7 +1834,10 @@ - (NSArray*)validAttributesForMarkedText {
+@@ -1830,7 +1852,10 @@ - (NSArray*)validAttributesForMarkedText {
initWithObjects:NSUnderlineStyleAttributeName,
NSUnderlineColorAttributeName,
NSMarkedClauseSegmentAttributeName,
diff --git a/patches/chromium/resource_file_conflict.patch b/patches/chromium/resource_file_conflict.patch
index 10d38f2ef5..7662e17b10 100644
--- a/patches/chromium/resource_file_conflict.patch
+++ b/patches/chromium/resource_file_conflict.patch
@@ -52,10 +52,10 @@ Some alternatives to this patch:
None of these options seems like a substantial maintainability win over this patch to me (@nornagon).
diff --git a/chrome/BUILD.gn b/chrome/BUILD.gn
-index a1e405e63884f9f3af9b4c0803271ccf51158661..cde7a97b2fee1c7be9d8ff9c081b6739545ab22b 100644
+index a0db274a53134fb1f1085185fc1030f6bc78917b..884bccba58c66861b43b3b50a7535cba543302e2 100644
--- a/chrome/BUILD.gn
+++ b/chrome/BUILD.gn
-@@ -1587,7 +1587,7 @@ if (is_chrome_branded && !is_android) {
+@@ -1599,7 +1599,7 @@ if (is_chrome_branded && !is_android) {
}
}
@@ -64,7 +64,7 @@ index a1e405e63884f9f3af9b4c0803271ccf51158661..cde7a97b2fee1c7be9d8ff9c081b6739
chrome_paks("packed_resources") {
if (is_mac) {
output_dir = "$root_gen_dir/repack"
-@@ -1616,6 +1616,12 @@ if (!is_android) {
+@@ -1628,6 +1628,12 @@ if (!is_android) {
}
}
diff --git a/patches/chromium/scroll_bounce_flag.patch b/patches/chromium/scroll_bounce_flag.patch
index 7159b1b6c0..281c48deb2 100644
--- a/patches/chromium/scroll_bounce_flag.patch
+++ b/patches/chromium/scroll_bounce_flag.patch
@@ -6,10 +6,10 @@ Subject: scroll_bounce_flag.patch
Patch to make scrollBounce option work.
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc
-index 484bed7f0e151b76af957537d38e4224ec83adbf..a5bf64d73a97a4100b72ae453005536facb873b0 100644
+index 6b37ab029be690c4b773d54775730ea38181122c..67a98e4b6f8de2112c85e3786b4cdae112835a21 100644
--- a/content/renderer/render_thread_impl.cc
+++ b/content/renderer/render_thread_impl.cc
-@@ -1352,7 +1352,7 @@ bool RenderThreadImpl::IsLcdTextEnabled() {
+@@ -1361,7 +1361,7 @@ bool RenderThreadImpl::IsLcdTextEnabled() {
}
bool RenderThreadImpl::IsElasticOverscrollEnabled() {
diff --git a/patches/chromium/support_mixed_sandbox_with_zygote.patch b/patches/chromium/support_mixed_sandbox_with_zygote.patch
index 28ead2a331..7258431308 100644
--- a/patches/chromium/support_mixed_sandbox_with_zygote.patch
+++ b/patches/chromium/support_mixed_sandbox_with_zygote.patch
@@ -22,10 +22,10 @@ However, the patch would need to be reviewed by the security team, as it
does touch a security-sensitive class.
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
-index 73435bda2d393fb22ce4cff0917d90e6ec111c69..88492051b80ed4a989cb9fdf8231a38534ea4c7e 100644
+index 2ff019b77e65e7ac2915c83cfc4f467c7789b678..15effd78c0a10f13dbd17b18daa12456a6bc19ae 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
-@@ -1820,9 +1820,15 @@ bool RenderProcessHostImpl::Init() {
+@@ -1833,9 +1833,15 @@ bool RenderProcessHostImpl::Init() {
std::unique_ptr<SandboxedProcessLauncherDelegate> sandbox_delegate =
std::make_unique<RendererSandboxedProcessLauncherDelegateWin>(
*cmd_line, IsPdf(), IsJitDisabled());
@@ -42,7 +42,7 @@ index 73435bda2d393fb22ce4cff0917d90e6ec111c69..88492051b80ed4a989cb9fdf8231a385
auto file_data = std::make_unique<ChildProcessLauncherFileData>();
diff --git a/content/browser/renderer_host/renderer_sandboxed_process_launcher_delegate.cc b/content/browser/renderer_host/renderer_sandboxed_process_launcher_delegate.cc
-index c297e3fc2ffabb53e94908d7021ef3e750d4c0f1..4b723edd68f9c5668c5e8f3b12984a6f18392252 100644
+index 5d96b358a52b01af0cb853125782af6202ae77b7..32b8ed19e9f265dc8f371c4e9c07f71487eb36f6 100644
--- a/content/browser/renderer_host/renderer_sandboxed_process_launcher_delegate.cc
+++ b/content/browser/renderer_host/renderer_sandboxed_process_launcher_delegate.cc
@@ -33,6 +33,9 @@ namespace content {
diff --git a/patches/chromium/sysroot.patch b/patches/chromium/sysroot.patch
index 4debb1ac9a..b46ad403a9 100644
--- a/patches/chromium/sysroot.patch
+++ b/patches/chromium/sysroot.patch
@@ -7,11 +7,11 @@ Make chrome's install-sysroot scripts point to our custom sysroot builds,
which include extra deps that Electron needs (e.g. libnotify)
diff --git a/build/linux/sysroot_scripts/install-sysroot.py b/build/linux/sysroot_scripts/install-sysroot.py
-index 42842a184deb12b55c88b82134ef29f0d10c1a18..4dca0c2b63425b1592d0ee48b721402b8bebe347 100755
+index 67d52b47a7531453a1baa83b6863441ef1fadea7..da0b2142ca3fa9d4228e2592b8be9930ee1acdb3 100755
--- a/build/linux/sysroot_scripts/install-sysroot.py
+++ b/build/linux/sysroot_scripts/install-sysroot.py
-@@ -40,9 +40,11 @@ except ImportError:
- from urllib2 import urlopen
+@@ -33,9 +33,11 @@ import sys
+ from urllib.request import urlopen
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
+SRC_DIR = os.path.dirname(os.path.dirname(os.path.dirname(SCRIPT_DIR)))
@@ -22,9 +22,9 @@ index 42842a184deb12b55c88b82134ef29f0d10c1a18..4dca0c2b63425b1592d0ee48b721402b
+URL_PREFIX = 'https://dev-cdn.electronjs.org'
+URL_PATH = 'linux-sysroots'
- VALID_ARCHS = ('arm', 'arm64', 'i386', 'amd64', 'mips', 'mips64el')
+ VALID_ARCHS = ('amd64', 'i386', 'armhf', 'arm64', 'armel', 'mipsel', 'mips64el')
-@@ -106,7 +108,7 @@ def GetSysrootDict(target_platform, target_arch):
+@@ -100,7 +102,7 @@ def GetSysrootDict(target_platform, target_arch):
if target_arch not in VALID_ARCHS:
raise Error('Unknown architecture: %s' % target_arch)
diff --git a/patches/chromium/web_contents.patch b/patches/chromium/web_contents.patch
index 926b89b2b3..e2322fa403 100644
--- a/patches/chromium/web_contents.patch
+++ b/patches/chromium/web_contents.patch
@@ -9,10 +9,10 @@ is needed for OSR.
Originally landed in https://github.com/electron/libchromiumcontent/pull/226.
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
-index 57a810427461b8240d5f8da88e6ae2815b06c69a..a114c8a72670037fe0f4b9d95c16a67094f4c13c 100644
+index 9dee22f645596fd2c2494c1f532e972099d89b2b..4181b7dd3c8ba467e3e762e5875a97df630e62dc 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
-@@ -3213,6 +3213,13 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params,
+@@ -3216,6 +3216,13 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params,
params.main_frame_name, GetOpener(), primary_main_frame_policy,
base::UnguessableToken::Create());
@@ -26,7 +26,7 @@ index 57a810427461b8240d5f8da88e6ae2815b06c69a..a114c8a72670037fe0f4b9d95c16a670
std::unique_ptr<WebContentsViewDelegate> delegate =
GetContentClient()->browser()->GetWebContentsViewDelegate(this);
-@@ -3223,6 +3230,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params,
+@@ -3226,6 +3233,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params,
view_ = CreateWebContentsView(this, std::move(delegate),
&render_view_host_delegate_view_);
}
@@ -35,7 +35,7 @@ index 57a810427461b8240d5f8da88e6ae2815b06c69a..a114c8a72670037fe0f4b9d95c16a670
CHECK(view_.get());
diff --git a/content/public/browser/web_contents.h b/content/public/browser/web_contents.h
-index 8baf744895c941df36d770ad17fca925a1dfd45f..44d75c043805f9bfb4b08741fc652aafc6c50740 100644
+index c998b0813ca0448edcf5387f49b23c845f657b52..bcb06c6397eea9ef190b059b8e8c9238650d803f 100644
--- a/content/public/browser/web_contents.h
+++ b/content/public/browser/web_contents.h
@@ -96,10 +96,13 @@ class BrowserContext;
diff --git a/patches/chromium/webview_cross_drag.patch b/patches/chromium/webview_cross_drag.patch
index 592c0f1b28..31986760d1 100644
--- a/patches/chromium/webview_cross_drag.patch
+++ b/patches/chromium/webview_cross_drag.patch
@@ -8,7 +8,7 @@ This allows dragging and dropping between <webview>s.
Originally landed in https://github.com/electron/libchromiumcontent/pull/267
diff --git a/content/browser/web_contents/web_contents_view_aura.cc b/content/browser/web_contents/web_contents_view_aura.cc
-index d85232514f1a272e435489f7baecfa12b61288b8..07c20acd985351117edd270f65d9569c138742c4 100644
+index 9c62577a692d58d7e16687782fdd715f9513bc96..f429cb79b89f1516a112e0b890d6b61aaeda8d3b 100644
--- a/content/browser/web_contents/web_contents_view_aura.cc
+++ b/content/browser/web_contents/web_contents_view_aura.cc
@@ -919,10 +919,7 @@ bool WebContentsViewAura::IsValidDragTarget(
@@ -24,7 +24,7 @@ index d85232514f1a272e435489f7baecfa12b61288b8..07c20acd985351117edd270f65d9569c
////////////////////////////////////////////////////////////////////////////////
diff --git a/content/browser/web_contents/web_drag_dest_mac.mm b/content/browser/web_contents/web_drag_dest_mac.mm
-index 4a7153d7b6e23c372c6f4dd4b5d02eb2ed372ca0..aa165434b4db9a4663e890a4729badb322832af2 100644
+index 786f17d53f81bd534b156e9959cfd9ed1c28d725..68adff99738dc2c215cf5f9532e95266e6239faa 100644
--- a/content/browser/web_contents/web_drag_dest_mac.mm
+++ b/content/browser/web_contents/web_drag_dest_mac.mm
@@ -386,9 +386,7 @@ - (void)resetDragStartTrackers {
diff --git a/patches/chromium/webview_fullscreen.patch b/patches/chromium/webview_fullscreen.patch
index f034fee65b..dde0bc9eb7 100644
--- a/patches/chromium/webview_fullscreen.patch
+++ b/patches/chromium/webview_fullscreen.patch
@@ -14,10 +14,10 @@ Note that we also need to manually update embedder's
`api::WebContents::IsFullscreenForTabOrPending` value.
diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc
-index 166293ad0d6246bcf477e6af57a9e6801b6f6f7b..2e56b99d9d8699cf4c115ceccd5f5d60ced08018 100644
+index 6e4e9686134ba56655e28c47a215059fe76251c4..1b306473728f72564f22b3104c09a892edae38bb 100644
--- a/content/browser/renderer_host/render_frame_host_impl.cc
+++ b/content/browser/renderer_host/render_frame_host_impl.cc
-@@ -6998,6 +6998,17 @@ void RenderFrameHostImpl::EnterFullscreen(
+@@ -7020,6 +7020,17 @@ void RenderFrameHostImpl::EnterFullscreen(
}
}
diff --git a/patches/chromium/worker_context_will_destroy.patch b/patches/chromium/worker_context_will_destroy.patch
index 61bdd0b95b..0f2b5beb36 100644
--- a/patches/chromium/worker_context_will_destroy.patch
+++ b/patches/chromium/worker_context_will_destroy.patch
@@ -10,10 +10,10 @@ An attempt to upstream this was made, but rejected:
https://chromium-review.googlesource.com/c/chromium/src/+/1954347
diff --git a/content/public/renderer/content_renderer_client.h b/content/public/renderer/content_renderer_client.h
-index 77f2c4fbf8c886c5c622f41d0b9da67d09b7d331..7aa2059f33dfa92828beec95f4716775e7291fed 100644
+index 834a07bb92d77eceb37d0378e9fe2bf13a74a64d..13815369562c1f78c2411cde8e14d9e8795eff38 100644
--- a/content/public/renderer/content_renderer_client.h
+++ b/content/public/renderer/content_renderer_client.h
-@@ -373,6 +373,11 @@ class CONTENT_EXPORT ContentRendererClient {
+@@ -371,6 +371,11 @@ class CONTENT_EXPORT ContentRendererClient {
virtual void DidInitializeWorkerContextOnWorkerThread(
v8::Local<v8::Context> context) {}
@@ -26,10 +26,10 @@ index 77f2c4fbf8c886c5c622f41d0b9da67d09b7d331..7aa2059f33dfa92828beec95f4716775
// An empty URL is returned if the URL is not overriden.
virtual GURL OverrideFlashEmbedWithHTML(const GURL& url);
diff --git a/content/renderer/renderer_blink_platform_impl.cc b/content/renderer/renderer_blink_platform_impl.cc
-index 93de85d84231556a22becc3a60d798d4c954cedd..8b94565a7dc696ed80780de776201faab02c3803 100644
+index 58caad274969fd4d5aa95b4a3c34d16a50aa0f5c..ef5350399cd32f72601be7256f94018b84b8ef29 100644
--- a/content/renderer/renderer_blink_platform_impl.cc
+++ b/content/renderer/renderer_blink_platform_impl.cc
-@@ -827,6 +827,12 @@ void RendererBlinkPlatformImpl::WillStopWorkerThread() {
+@@ -813,6 +813,12 @@ void RendererBlinkPlatformImpl::WillStopWorkerThread() {
WorkerThreadRegistry::Instance()->WillStopCurrentWorkerThread();
}
@@ -43,10 +43,10 @@ index 93de85d84231556a22becc3a60d798d4c954cedd..8b94565a7dc696ed80780de776201faa
const v8::Local<v8::Context>& worker) {
GetContentClient()->renderer()->DidInitializeWorkerContextOnWorkerThread(
diff --git a/content/renderer/renderer_blink_platform_impl.h b/content/renderer/renderer_blink_platform_impl.h
-index 0067dcb8b5c6b0079118c5f1ae1da98c72cef4a1..19822bd314f014e4433ec5c6271e71af12a4822e 100644
+index 2a01122b6219089aef3d1992a76a056d99f2f993..b4c7fbebb3751d5c749da0d228989df27e93c01b 100644
--- a/content/renderer/renderer_blink_platform_impl.h
+++ b/content/renderer/renderer_blink_platform_impl.h
-@@ -176,6 +176,7 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl {
+@@ -175,6 +175,7 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl {
void DidStartWorkerThread() override;
void WillStopWorkerThread() override;
void WorkerContextCreated(const v8::Local<v8::Context>& worker) override;
@@ -55,10 +55,10 @@ index 0067dcb8b5c6b0079118c5f1ae1da98c72cef4a1..19822bd314f014e4433ec5c6271e71af
const blink::WebSecurityOrigin& script_origin) override;
blink::ProtocolHandlerSecurityLevel GetProtocolHandlerSecurityLevel()
diff --git a/third_party/blink/public/platform/platform.h b/third_party/blink/public/platform/platform.h
-index 78eb25f4005fd40f8ff54c4dae3d49cdeab0de16..6ee3894d45f457726bdaf6899b69c381ef9aea3f 100644
+index 1620ec518a7ef7f1421a84d66ae14761262524e3..030151f6c2617cd90ba953fc900e6918f0eb22ea 100644
--- a/third_party/blink/public/platform/platform.h
+++ b/third_party/blink/public/platform/platform.h
-@@ -633,6 +633,7 @@ class BLINK_PLATFORM_EXPORT Platform {
+@@ -622,6 +622,7 @@ class BLINK_PLATFORM_EXPORT Platform {
virtual void DidStartWorkerThread() {}
virtual void WillStopWorkerThread() {}
virtual void WorkerContextCreated(const v8::Local<v8::Context>& worker) {}
diff --git a/patches/chromium/worker_feat_add_hook_to_notify_script_ready.patch b/patches/chromium/worker_feat_add_hook_to_notify_script_ready.patch
index 80ae175246..ca3bff86fd 100644
--- a/patches/chromium/worker_feat_add_hook_to_notify_script_ready.patch
+++ b/patches/chromium/worker_feat_add_hook_to_notify_script_ready.patch
@@ -19,10 +19,10 @@ that clearly establishes the worker script is ready for evaluation with the scop
initialized.
diff --git a/content/public/renderer/content_renderer_client.h b/content/public/renderer/content_renderer_client.h
-index 7aa2059f33dfa92828beec95f4716775e7291fed..df919b894d4f29274696806444d034d4fefb7ff9 100644
+index 13815369562c1f78c2411cde8e14d9e8795eff38..42a3226c270b39658306db0b39df24b891086b21 100644
--- a/content/public/renderer/content_renderer_client.h
+++ b/content/public/renderer/content_renderer_client.h
-@@ -373,6 +373,11 @@ class CONTENT_EXPORT ContentRendererClient {
+@@ -371,6 +371,11 @@ class CONTENT_EXPORT ContentRendererClient {
virtual void DidInitializeWorkerContextOnWorkerThread(
v8::Local<v8::Context> context) {}
@@ -35,10 +35,10 @@ index 7aa2059f33dfa92828beec95f4716775e7291fed..df919b894d4f29274696806444d034d4
// from the worker thread.
virtual void WillDestroyWorkerContextOnWorkerThread(
diff --git a/content/renderer/renderer_blink_platform_impl.cc b/content/renderer/renderer_blink_platform_impl.cc
-index 8b94565a7dc696ed80780de776201faab02c3803..03b96e829bfc835cf96d3372849a91db3ce68500 100644
+index ef5350399cd32f72601be7256f94018b84b8ef29..8227aece602f5b5ab876ac2cd07d6efd0a51f157 100644
--- a/content/renderer/renderer_blink_platform_impl.cc
+++ b/content/renderer/renderer_blink_platform_impl.cc
-@@ -839,6 +839,12 @@ void RendererBlinkPlatformImpl::WorkerContextCreated(
+@@ -825,6 +825,12 @@ void RendererBlinkPlatformImpl::WorkerContextCreated(
worker);
}
@@ -52,10 +52,10 @@ index 8b94565a7dc696ed80780de776201faab02c3803..03b96e829bfc835cf96d3372849a91db
const blink::WebSecurityOrigin& script_origin) {
return GetContentClient()->renderer()->AllowScriptExtensionForServiceWorker(
diff --git a/content/renderer/renderer_blink_platform_impl.h b/content/renderer/renderer_blink_platform_impl.h
-index 19822bd314f014e4433ec5c6271e71af12a4822e..9d900d10c02928648d925e025322a614772ad98d 100644
+index b4c7fbebb3751d5c749da0d228989df27e93c01b..44f5104bc1945ced2072a0f4f205148077ed6fa0 100644
--- a/content/renderer/renderer_blink_platform_impl.h
+++ b/content/renderer/renderer_blink_platform_impl.h
-@@ -176,6 +176,8 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl {
+@@ -175,6 +175,8 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl {
void DidStartWorkerThread() override;
void WillStopWorkerThread() override;
void WorkerContextCreated(const v8::Local<v8::Context>& worker) override;
@@ -65,10 +65,10 @@ index 19822bd314f014e4433ec5c6271e71af12a4822e..9d900d10c02928648d925e025322a614
bool AllowScriptExtensionForServiceWorker(
const blink::WebSecurityOrigin& script_origin) override;
diff --git a/third_party/blink/public/platform/platform.h b/third_party/blink/public/platform/platform.h
-index 6ee3894d45f457726bdaf6899b69c381ef9aea3f..f311d98c18b4955f5257029a950644fd4423cbd6 100644
+index 030151f6c2617cd90ba953fc900e6918f0eb22ea..a30bc4d59ef311bab43cf9f507f2a68c8f9c0848 100644
--- a/third_party/blink/public/platform/platform.h
+++ b/third_party/blink/public/platform/platform.h
-@@ -633,6 +633,8 @@ class BLINK_PLATFORM_EXPORT Platform {
+@@ -622,6 +622,8 @@ class BLINK_PLATFORM_EXPORT Platform {
virtual void DidStartWorkerThread() {}
virtual void WillStopWorkerThread() {}
virtual void WorkerContextCreated(const v8::Local<v8::Context>& worker) {}
diff --git a/patches/devtools_frontend/fix_expose_globals_to_allow_patching_devtools_dock.patch b/patches/devtools_frontend/fix_expose_globals_to_allow_patching_devtools_dock.patch
index c950a98470..ea7018a7cf 100644
--- a/patches/devtools_frontend/fix_expose_globals_to_allow_patching_devtools_dock.patch
+++ b/patches/devtools_frontend/fix_expose_globals_to_allow_patching_devtools_dock.patch
@@ -36,10 +36,10 @@ index b22591ee606ef449817aef1f9bd5ff0c024d1c05..a14c0e0a381ae838d44d4c7f2cc252c2
import '../../ui/legacy/components/source_frame/source_frame-meta.js';
import '../../panels/console_counters/console_counters-meta.js';
diff --git a/front_end/ui/legacy/BUILD.gn b/front_end/ui/legacy/BUILD.gn
-index 95f598ae7f4c01012d61e78bb83887fca5ca50ab..35e963c4289b538561b78c5e84d0d411e4da43ba 100644
+index c0ff2a3161a654589c90077e2c1d50cfa8a0aba0..1e1204d315736c44d2299aeb33052e735efc08fa 100644
--- a/front_end/ui/legacy/BUILD.gn
+++ b/front_end/ui/legacy/BUILD.gn
-@@ -184,5 +184,6 @@ devtools_entrypoint("legacy") {
+@@ -185,5 +185,6 @@ devtools_entrypoint("legacy") {
visibility = [
"../..:legacy_entrypoints",
"../../legacy_test_runner/*",
diff --git a/patches/node/.patches b/patches/node/.patches
index 175faea888..fb28092bc6 100644
--- a/patches/node/.patches
+++ b/patches/node/.patches
@@ -34,3 +34,4 @@ fix_adapt_debugger_tests_for_upstream_v8_changes.patch
fix_libc_buffer_overflow_in_string_view_ctor.patch
fix_preventing_potential_oob_in_ada_no_scheme_parsing.patch
chore_remove_--no-harmony-atomics_related_code.patch
+fix_account_for_createexternalizablestring_v8_global.patch
diff --git a/patches/node/fix_account_for_createexternalizablestring_v8_global.patch b/patches/node/fix_account_for_createexternalizablestring_v8_global.patch
new file mode 100644
index 0000000000..2ef0bdb9a4
--- /dev/null
+++ b/patches/node/fix_account_for_createexternalizablestring_v8_global.patch
@@ -0,0 +1,23 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Shelley Vohr <[email protected]>
+Date: Tue, 23 May 2023 18:21:17 +0200
+Subject: fix: account for createExternalizableString V8 global
+
+Introduced in https://chromium-review.googlesource.com/c/v8/v8/+/4531903.
+
+This patch can be removed when Node.js upgrades to a version of V8 with the above
+CL - they'll need to make the same change.
+
+diff --git a/test/parallel/test-fs-write.js b/test/parallel/test-fs-write.js
+index a321f1b27adaa3f376f5e61ce5d9c1ceb3427cc7..85e8603023854de120219a98449ee64fb7372200 100644
+--- a/test/parallel/test-fs-write.js
++++ b/test/parallel/test-fs-write.js
+@@ -40,7 +40,7 @@ const constants = fs.constants;
+ const { externalizeString, isOneByteString } = global;
+
+ // Account for extra globals exposed by --expose_externalize_string.
+-common.allowGlobals(externalizeString, isOneByteString, global.x);
++common.allowGlobals(createExternalizableString, externalizeString, isOneByteString, global.x);
+
+ {
+ const expected = 'ümlaut sechzig'; // Must be a unique string.
diff --git a/patches/node/fix_crypto_tests_to_run_with_bssl.patch b/patches/node/fix_crypto_tests_to_run_with_bssl.patch
index d3b54665ff..f33cf42ce8 100644
--- a/patches/node/fix_crypto_tests_to_run_with_bssl.patch
+++ b/patches/node/fix_crypto_tests_to_run_with_bssl.patch
@@ -791,7 +791,7 @@ index 2f2e443a7f6482c26f3a065520c8764d8402a91f..ccfe79ac65a223139f293f7dd034096f
+ legacyObjectCheck.serialNumberPattern);
}
diff --git a/test/parallel/test-crypto.js b/test/parallel/test-crypto.js
-index a8ceb169de2b3de73f062083c42292babc673e73..a3bb574d0e5dc85b4ba3fb0b3bd8782fbb8c8700 100644
+index a8ceb169de2b3de73f062083c42292babc673e73..8fb950d0814e5014faf5c1ef576b65795857da1b 100644
--- a/test/parallel/test-crypto.js
+++ b/test/parallel/test-crypto.js
@@ -67,7 +67,7 @@ assert.throws(() => {
@@ -839,7 +839,24 @@ index a8ceb169de2b3de73f062083c42292babc673e73..a3bb574d0e5dc85b4ba3fb0b3bd8782f
(error) => {
assert.ok(!('opensslErrorStack' in error));
if (common.hasFipsCrypto) {
-@@ -240,15 +238,15 @@ assert.throws(() => {
+@@ -219,7 +217,7 @@ assert.throws(
+ return true;
+ }
+ );
+-
++/*
+ assert.throws(() => {
+ const priv = [
+ '-----BEGIN RSA PRIVATE KEY-----',
+@@ -232,6 +230,7 @@ assert.throws(() => {
+ ].join('\n');
+ crypto.createSign('SHA256').update('test').sign(priv);
+ }, (err) => {
++ console.log(err)
+ if (!common.hasOpenSSL3)
+ assert.ok(!('opensslErrorStack' in err));
+ assert.throws(() => { throw err; }, common.hasOpenSSL3 ? {
+@@ -240,10 +239,10 @@ assert.throws(() => {
library: 'rsa routines',
} : {
name: 'Error',
@@ -854,13 +871,7 @@ index a8ceb169de2b3de73f062083c42292babc673e73..a3bb574d0e5dc85b4ba3fb0b3bd8782f
code: 'ERR_OSSL_RSA_DIGEST_TOO_BIG_FOR_RSA_KEY'
});
return true;
- });
--
-+/*
- if (!common.hasOpenSSL3) {
- assert.throws(() => {
- // The correct header inside `rsa_private_pkcs8_bad.pem` should have been
-@@ -276,7 +274,7 @@ if (!common.hasOpenSSL3) {
+@@ -276,7 +275,7 @@ if (!common.hasOpenSSL3) {
return true;
});
}
diff --git a/patches/v8/build_gn.patch b/patches/v8/build_gn.patch
index ae4343dde6..cf37b66bba 100644
--- a/patches/v8/build_gn.patch
+++ b/patches/v8/build_gn.patch
@@ -9,10 +9,10 @@ necessary for native modules to load.
Also change visibility on mksnapshot in order to target mksnapshot for mksnapshot zip.
diff --git a/BUILD.gn b/BUILD.gn
-index d75f44b55a89828845f69f148da147ea29d523e2..3140abb0868eb81976edacafc625bc80159b5aea 100644
+index 337910a6431ca42017ccd15cd23b1f461d6db15d..b136baf5363c0d7a53f758ad4bdf790af2bbd6b5 100644
--- a/BUILD.gn
+++ b/BUILD.gn
-@@ -714,7 +714,7 @@ config("internal_config") {
+@@ -715,7 +715,7 @@ config("internal_config") {
":cppgc_header_features",
]
@@ -21,7 +21,7 @@ index d75f44b55a89828845f69f148da147ea29d523e2..3140abb0868eb81976edacafc625bc80
defines += [ "BUILDING_V8_SHARED" ]
}
-@@ -6463,7 +6463,7 @@ if (current_toolchain == v8_generator_toolchain) {
+@@ -6493,7 +6493,7 @@ if (current_toolchain == v8_generator_toolchain) {
"src/interpreter/bytecodes.h",
]
@@ -30,7 +30,7 @@ index d75f44b55a89828845f69f148da147ea29d523e2..3140abb0868eb81976edacafc625bc80
deps = [
":v8_libbase",
-@@ -6475,7 +6475,6 @@ if (current_toolchain == v8_generator_toolchain) {
+@@ -6505,7 +6505,6 @@ if (current_toolchain == v8_generator_toolchain) {
if (current_toolchain == v8_snapshot_toolchain) {
v8_executable("mksnapshot") {
diff --git a/patches/v8/do_not_export_private_v8_symbols_on_windows.patch b/patches/v8/do_not_export_private_v8_symbols_on_windows.patch
index cf1b447e03..faff2b81c8 100644
--- a/patches/v8/do_not_export_private_v8_symbols_on_windows.patch
+++ b/patches/v8/do_not_export_private_v8_symbols_on_windows.patch
@@ -12,10 +12,10 @@ This patch can be safely removed if, when it is removed, `node.lib` does not
contain any standard C++ library exports (e.g. `std::ostringstream`).
diff --git a/BUILD.gn b/BUILD.gn
-index 3140abb0868eb81976edacafc625bc80159b5aea..e3c367dd8ccc4a091a940891ceb3409051f5e553 100644
+index b136baf5363c0d7a53f758ad4bdf790af2bbd6b5..a6f3f600a87a48d88005cb0910401848b81359a4 100644
--- a/BUILD.gn
+++ b/BUILD.gn
-@@ -714,6 +714,10 @@ config("internal_config") {
+@@ -715,6 +715,10 @@ config("internal_config") {
":cppgc_header_features",
]
diff --git a/patches/v8/fix_build_deprecated_attribute_for_older_msvc_versions.patch b/patches/v8/fix_build_deprecated_attribute_for_older_msvc_versions.patch
index 6e488a8263..ba59173a46 100644
--- a/patches/v8/fix_build_deprecated_attribute_for_older_msvc_versions.patch
+++ b/patches/v8/fix_build_deprecated_attribute_for_older_msvc_versions.patch
@@ -6,10 +6,10 @@ Subject: fix: usage of c++ [[deprecated]] attribute for older msvc versions
This attribute can only be used in all contexts in Visual Studio 2019
diff --git a/include/v8config.h b/include/v8config.h
-index bee208ffa95a78be3b643a12850a48f32d169648..07590723fcab48a93e4ab39e91511d5436dc0c94 100644
+index 41e7ac3645293fa181fb98ce74a9535aaa4074b4..890567c25e1a07dcd92bbcc21eade1054cf9d0e1 100644
--- a/include/v8config.h
+++ b/include/v8config.h
-@@ -536,10 +536,13 @@ path. Add it with -I<path> to the command line
+@@ -538,10 +538,13 @@ path. Add it with -I<path> to the command line
# define V8_PRESERVE_MOST /* NOT SUPPORTED */
#endif
@@ -25,7 +25,7 @@ index bee208ffa95a78be3b643a12850a48f32d169648..07590723fcab48a93e4ab39e91511d54
#else
# define V8_DEPRECATED(message)
#endif
-@@ -547,7 +550,11 @@ path. Add it with -I<path> to the command line
+@@ -549,7 +552,11 @@ path. Add it with -I<path> to the command line
// A macro (V8_DEPRECATE_SOON) to make it easier to see what will be deprecated.
#if defined(V8_IMMINENT_DEPRECATION_WARNINGS)
@@ -38,7 +38,7 @@ index bee208ffa95a78be3b643a12850a48f32d169648..07590723fcab48a93e4ab39e91511d54
#else
# define V8_DEPRECATE_SOON(message)
#endif
-@@ -581,7 +588,7 @@ path. Add it with -I<path> to the command line
+@@ -583,7 +590,7 @@ path. Add it with -I<path> to the command line
END_ALLOW_USE_DEPRECATED()
diff --git a/script/sysroots.json b/script/sysroots.json
index 97e445ff21..8fcb670728 100644
--- a/script/sysroots.json
+++ b/script/sysroots.json
@@ -1,44 +1,44 @@
{
"bullseye_amd64": {
- "Key": "20230329T085712Z-0",
- "Sha1Sum": "39d343162ed5ed1cf5337e49917321e39eb424c7",
+ "Key": "20230329T085712Z-1",
+ "Sha1Sum": "dcd5767244034c6f9b42b64a85423d6cb849fa1e",
"SysrootDir": "debian_bullseye_amd64-sysroot",
"Tarball": "debian_bullseye_amd64_sysroot.tar.xz"
},
- "bullseye_arm": {
- "Key": "20230329T085712Z-0",
- "Sha1Sum": "4c378886e1fcab051e99c5e8c4f0b66f2f3fb738",
- "SysrootDir": "debian_bullseye_arm-sysroot",
- "Tarball": "debian_bullseye_arm_sysroot.tar.xz"
- },
"bullseye_arm64": {
- "Key": "20230329T085712Z-0",
- "Sha1Sum": "2354ab6674a0725d0c4f304b47f908eba6e3b8c7",
+ "Key": "20230329T085712Z-1",
+ "Sha1Sum": "3531a8b78fa72e7939f8082a56c9041e5bff423a",
"SysrootDir": "debian_bullseye_arm64-sysroot",
"Tarball": "debian_bullseye_arm64_sysroot.tar.xz"
},
"bullseye_armel": {
- "Key": "20230329T085712Z-0",
- "Sha1Sum": "933d6944cabe6bf2f9bc667ca52b258b52cd05e9",
+ "Key": "20230329T085712Z-1",
+ "Sha1Sum": "cf3a1348649eb26f40e358459c96afbb8e58017e",
"SysrootDir": "debian_bullseye_armel-sysroot",
"Tarball": "debian_bullseye_armel_sysroot.tar.xz"
},
+ "bullseye_armhf": {
+ "Key": "20230329T085712Z-1",
+ "Sha1Sum": "3fe59c416d0472dd4115fa3d42a29aa34191c0bf",
+ "SysrootDir": "debian_bullseye_armhf-sysroot",
+ "Tarball": "debian_bullseye_armhf_sysroot.tar.xz"
+ },
"bullseye_i386": {
- "Key": "20230329T085712Z-0",
- "Sha1Sum": "86c07fcc29a500e6ff24962c811ba82f806df00c",
+ "Key": "20230329T085712Z-1",
+ "Sha1Sum": "9b158682e7c111748e16914977546120429c9287",
"SysrootDir": "debian_bullseye_i386-sysroot",
"Tarball": "debian_bullseye_i386_sysroot.tar.xz"
},
- "bullseye_mips": {
- "Key": "20230329T085712Z-0",
- "Sha1Sum": "1b44b9ddfd3571acc17036866e0373120fd9aa03",
- "SysrootDir": "debian_bullseye_mips-sysroot",
- "Tarball": "debian_bullseye_mips_sysroot.tar.xz"
- },
"bullseye_mips64el": {
- "Key": "20230329T085712Z-0",
- "Sha1Sum": "cd0803ae938dd75247f474feb299bcaa74fa2290",
+ "Key": "20230329T085712Z-1",
+ "Sha1Sum": "c0d04d577608226d9fb0649b455800493fba2cde",
"SysrootDir": "debian_bullseye_mips64el-sysroot",
"Tarball": "debian_bullseye_mips64el_sysroot.tar.xz"
+ },
+ "bullseye_mipsel": {
+ "Key": "20230329T085712Z-1",
+ "Sha1Sum": "65f095e4edf23f0e789b22290dde9eb455aa54a0",
+ "SysrootDir": "debian_bullseye_mipsel-sysroot",
+ "Tarball": "debian_bullseye_mipsel_sysroot.tar.xz"
}
}
\ No newline at end of file
diff --git a/shell/app/electron_library_main.mm b/shell/app/electron_library_main.mm
index a064211de2..dc4fa9391d 100644
--- a/shell/app/electron_library_main.mm
+++ b/shell/app/electron_library_main.mm
@@ -6,9 +6,9 @@
#include "shell/app/electron_library_main.h"
+#include "base/apple/bundle_locations.h"
#include "base/at_exit.h"
#include "base/i18n/icu_util.h"
-#include "base/mac/bundle_locations.h"
#include "base/mac/scoped_nsautorelease_pool.h"
#include "content/public/app/content_main.h"
#include "electron/fuses.h"
@@ -35,7 +35,7 @@ int ElectronInitializeICUandStartNode(int argc, char* argv[]) {
base::AtExitManager atexit_manager;
base::mac::ScopedNSAutoreleasePool pool;
- base::mac::SetOverrideFrameworkBundlePath(
+ base::apple::SetOverrideFrameworkBundlePath(
electron::MainApplicationBundlePath()
.Append("Contents")
.Append("Frameworks")
diff --git a/shell/app/electron_main_delegate.cc b/shell/app/electron_main_delegate.cc
index 779bcabc49..05ccf1a1b6 100644
--- a/shell/app/electron_main_delegate.cc
+++ b/shell/app/electron_main_delegate.cc
@@ -9,13 +9,13 @@
#include <string>
#include <utility>
+#include "base/apple/bundle_locations.h"
#include "base/base_switches.h"
#include "base/command_line.h"
#include "base/debug/stack_trace.h"
#include "base/environment.h"
#include "base/files/file_util.h"
#include "base/logging.h"
-#include "base/mac/bundle_locations.h"
#include "base/path_service.h"
#include "base/strings/string_split.h"
#include "chrome/common/chrome_paths.h"
@@ -216,7 +216,7 @@ std::string LoadResourceBundle(const std::string& locale) {
base::FilePath pak_dir;
#if BUILDFLAG(IS_MAC)
pak_dir =
- base::mac::FrameworkBundlePath().Append(FILE_PATH_LITERAL("Resources"));
+ base::apple::FrameworkBundlePath().Append(FILE_PATH_LITERAL("Resources"));
#else
base::PathService::Get(base::DIR_MODULE, &pak_dir);
#endif
diff --git a/shell/app/electron_main_delegate_mac.mm b/shell/app/electron_main_delegate_mac.mm
index 95ed62baef..a106762f8f 100644
--- a/shell/app/electron_main_delegate_mac.mm
+++ b/shell/app/electron_main_delegate_mac.mm
@@ -6,9 +6,9 @@
#include <string>
+#include "base/apple/bundle_locations.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
-#include "base/mac/bundle_locations.h"
#include "base/mac/foundation_util.h"
#include "base/mac/scoped_nsautorelease_pool.h"
#include "base/path_service.h"
@@ -54,7 +54,7 @@ base::FilePath GetHelperAppPath(const base::FilePath& frameworks_path,
} // namespace
void ElectronMainDelegate::OverrideFrameworkBundlePath() {
- base::mac::SetOverrideFrameworkBundlePath(
+ base::apple::SetOverrideFrameworkBundlePath(
GetFrameworksPath().Append(ELECTRON_PRODUCT_NAME " Framework.framework"));
}
diff --git a/shell/browser/api/electron_api_web_contents.cc b/shell/browser/api/electron_api_web_contents.cc
index a789353d90..1bd73e7fc8 100644
--- a/shell/browser/api/electron_api_web_contents.cc
+++ b/shell/browser/api/electron_api_web_contents.cc
@@ -2617,7 +2617,7 @@ std::string WebContents::GetMediaSourceID(
request_frame_host->GetRoutingID(),
url::Origin::Create(request_frame_host->GetLastCommittedURL()
.DeprecatedGetOriginAsURL()),
- media_id, "", content::kRegistryStreamTypeTab);
+ media_id, content::kRegistryStreamTypeTab);
return id;
}
diff --git a/shell/browser/browser.cc b/shell/browser/browser.cc
index df6fff168e..7ea21c40c7 100644
--- a/shell/browser/browser.cc
+++ b/shell/browser/browser.cc
@@ -203,6 +203,13 @@ void Browser::DidFinishLaunching(base::Value::Dict launch_info) {
}
for (BrowserObserver& observer : observers_)
observer.OnFinishLaunching(launch_info.Clone());
+
+#if BUILDFLAG(IS_MAC)
+ if (dock_icon_) {
+ DockSetIconImage(*dock_icon_);
+ dock_icon_.reset();
+ }
+#endif
}
v8::Local<v8::Value> Browser::WhenReady(v8::Isolate* isolate) {
diff --git a/shell/browser/browser.h b/shell/browser/browser.h
index 2cc0a1905b..7700b55e7c 100644
--- a/shell/browser/browser.h
+++ b/shell/browser/browser.h
@@ -25,7 +25,9 @@
#endif
#if BUILDFLAG(IS_MAC)
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/cocoa/secure_password_input.h"
+#include "ui/gfx/image/image.h"
#endif
namespace base {
@@ -339,6 +341,10 @@ class Browser : public WindowListObserver {
void OnWindowCloseCancelled(NativeWindow* window) override;
void OnWindowAllClosed() override;
+#if BUILDFLAG(IS_MAC)
+ void DockSetIconImage(gfx::Image const& icon);
+#endif
+
// Observers of the browser.
base::ObserverList<BrowserObserver> observers_;
@@ -364,6 +370,10 @@ class Browser : public WindowListObserver {
#if BUILDFLAG(IS_MAC)
std::unique_ptr<ui::ScopedPasswordInputEnabler> password_input_enabler_;
base::Time last_dock_show_;
+
+ // DockSetIcon() can't set the icon if is_ready_ is false.
+ // This field caches it until the browser is ready. (#26604)
+ absl::optional<gfx::Image> dock_icon_;
#endif
base::Value::Dict about_panel_options_;
diff --git a/shell/browser/browser_mac.mm b/shell/browser/browser_mac.mm
index 35e5a5cca1..840c6176e6 100644
--- a/shell/browser/browser_mac.mm
+++ b/shell/browser/browser_mac.mm
@@ -8,8 +8,8 @@
#include <string>
#include <utility>
+#include "base/apple/bundle_locations.h"
#include "base/i18n/rtl.h"
-#include "base/mac/bundle_locations.h"
#include "base/mac/foundation_util.h"
#include "base/mac/mac_util.h"
#include "base/mac/mac_util.mm"
@@ -169,7 +169,7 @@ void Browser::ClearRecentDocuments() {
bool Browser::RemoveAsDefaultProtocolClient(const std::string& protocol,
gin::Arguments* args) {
- NSString* identifier = [base::mac::MainBundle() bundleIdentifier];
+ NSString* identifier = [base::apple::MainBundle() bundleIdentifier];
if (!identifier)
return false;
@@ -207,7 +207,7 @@ bool Browser::SetAsDefaultProtocolClient(const std::string& protocol,
if (protocol.empty())
return false;
- NSString* identifier = [base::mac::MainBundle() bundleIdentifier];
+ NSString* identifier = [base::apple::MainBundle() bundleIdentifier];
if (!identifier)
return false;
@@ -222,7 +222,7 @@ bool Browser::IsDefaultProtocolClient(const std::string& protocol,
if (protocol.empty())
return false;
- NSString* identifier = [base::mac::MainBundle() bundleIdentifier];
+ NSString* identifier = [base::apple::MainBundle() bundleIdentifier];
if (!identifier)
return false;
@@ -381,10 +381,10 @@ void Browser::SetLoginItemSettings(LoginItemSettings settings) {
}
#else
if (settings.open_at_login) {
- base::mac::AddToLoginItems(base::mac::MainBundlePath(),
+ base::mac::AddToLoginItems(base::apple::MainBundlePath(),
settings.open_as_hidden);
} else {
- base::mac::RemoveFromLoginItems(base::mac::MainBundlePath());
+ base::mac::RemoveFromLoginItems(base::apple::MainBundlePath());
}
#endif
}
@@ -501,12 +501,14 @@ void Browser::DockSetIcon(v8::Isolate* isolate, v8::Local<v8::Value> icon) {
image = native_image->image();
}
- // This is needed when this fn is called before the browser
- // process is ready, since supported scales are normally set
- // by ui::ResourceBundle::InitSharedInstance
- // during browser process startup.
- if (!is_ready())
- gfx::ImageSkia::SetSupportedScales({1.0f});
+ DockSetIconImage(image);
+}
+
+void Browser::DockSetIconImage(gfx::Image const& image) {
+ if (!is_ready_) {
+ dock_icon_ = image;
+ return;
+ }
[[AtomApplication sharedApplication]
setApplicationIconImage:image.AsNSImage()];
diff --git a/shell/browser/browser_process_impl.cc b/shell/browser/browser_process_impl.cc
index 1502908ae2..29beeab14f 100644
--- a/shell/browser/browser_process_impl.cc
+++ b/shell/browser/browser_process_impl.cc
@@ -191,6 +191,11 @@ network::NetworkQualityTracker* BrowserProcessImpl::network_quality_tracker() {
return nullptr;
}
+embedder_support::OriginTrialsSettingsStorage*
+BrowserProcessImpl::GetOriginTrialsSettingsStorage() {
+ return &origin_trials_settings_storage_;
+}
+
policy::ChromeBrowserPolicyConnector*
BrowserProcessImpl::browser_policy_connector() {
return nullptr;
diff --git a/shell/browser/browser_process_impl.h b/shell/browser/browser_process_impl.h
index b0c1d5539b..8109f5f654 100644
--- a/shell/browser/browser_process_impl.h
+++ b/shell/browser/browser_process_impl.h
@@ -15,6 +15,7 @@
#include "base/command_line.h"
#include "chrome/browser/browser_process.h"
+#include "components/embedder_support/origin_trials/origin_trials_settings_storage.h"
#include "components/prefs/pref_service.h"
#include "components/prefs/value_map_pref_store.h"
#include "printing/buildflags/buildflags.h"
@@ -68,6 +69,8 @@ class BrowserProcessImpl : public BrowserProcess {
NotificationPlatformBridge* notification_platform_bridge() override;
SystemNetworkContextManager* system_network_context_manager() override;
network::NetworkQualityTracker* network_quality_tracker() override;
+ embedder_support::OriginTrialsSettingsStorage*
+ GetOriginTrialsSettingsStorage() override;
policy::ChromeBrowserPolicyConnector* browser_policy_connector() override;
policy::PolicyService* policy_service() override;
IconManager* icon_manager() override;
@@ -117,6 +120,7 @@ class BrowserProcessImpl : public BrowserProcess {
std::unique_ptr<device::GeolocationManager> geolocation_manager_;
std::string locale_;
std::string system_locale_;
+ embedder_support::OriginTrialsSettingsStorage origin_trials_settings_storage_;
};
#endif // ELECTRON_SHELL_BROWSER_BROWSER_PROCESS_IMPL_H_
diff --git a/shell/browser/electron_browser_client.cc b/shell/browser/electron_browser_client.cc
index 2882575fa3..994b702eba 100644
--- a/shell/browser/electron_browser_client.cc
+++ b/shell/browser/electron_browser_client.cc
@@ -724,8 +724,7 @@ void ElectronBrowserClient::SiteInstanceGotProcess(
return;
extensions::ProcessMap::Get(browser_context)
- ->Insert(extension->id(), site_instance->GetProcess()->GetID(),
- site_instance->GetId());
+ ->Insert(extension->id(), site_instance->GetProcess()->GetID());
}
#endif // BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
}
@@ -777,32 +776,6 @@ base::FilePath ElectronBrowserClient::GetLoggingFileName(
return logging::GetLogFileName(cmd_line);
}
-void ElectronBrowserClient::SiteInstanceDeleting(
- content::SiteInstance* site_instance) {
-#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
- // Don't do anything if we're shutting down.
- if (content::BrowserMainRunner::ExitedMainMessageLoop())
- return;
-
- auto* browser_context =
- static_cast<ElectronBrowserContext*>(site_instance->GetBrowserContext());
- if (!browser_context->IsOffTheRecord()) {
- // If this isn't an extension renderer there's nothing to do.
- extensions::ExtensionRegistry* registry =
- extensions::ExtensionRegistry::Get(browser_context);
- const extensions::Extension* extension =
- registry->enabled_extensions().GetExtensionOrAppByURL(
- site_instance->GetSiteURL());
- if (!extension)
- return;
-
- extensions::ProcessMap::Get(browser_context)
- ->Remove(extension->id(), site_instance->GetProcess()->GetID(),
- site_instance->GetId());
- }
-#endif
-}
-
std::unique_ptr<net::ClientCertStore>
ElectronBrowserClient::CreateClientCertStore(
content::BrowserContext* browser_context) {
diff --git a/shell/browser/electron_browser_client.h b/shell/browser/electron_browser_client.h
index 77a68b602e..00dbf38054 100644
--- a/shell/browser/electron_browser_client.h
+++ b/shell/browser/electron_browser_client.h
@@ -169,7 +169,6 @@ class ElectronBrowserClient : public content::ContentBrowserClient,
std::vector<std::string>* additional_schemes) override;
void GetAdditionalWebUISchemes(
std::vector<std::string>* additional_schemes) override;
- void SiteInstanceDeleting(content::SiteInstance* site_instance) override;
std::unique_ptr<net::ClientCertStore> CreateClientCertStore(
content::BrowserContext* browser_context) override;
std::unique_ptr<device::LocationProvider> OverrideSystemLocationProvider()
diff --git a/shell/browser/electron_browser_main_parts.cc b/shell/browser/electron_browser_main_parts.cc
index b9db118c2e..97df7fe7f0 100644
--- a/shell/browser/electron_browser_main_parts.cc
+++ b/shell/browser/electron_browser_main_parts.cc
@@ -23,6 +23,7 @@
#include "chrome/browser/ui/color/chrome_color_mixers.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
+#include "components/embedder_support/origin_trials/origin_trials_settings_storage.h"
#include "components/os_crypt/sync/key_storage_config_linux.h"
#include "components/os_crypt/sync/os_crypt.h"
#include "content/browser/browser_main_loop.h" // nogncheck
@@ -190,6 +191,18 @@ void UpdateDarkThemeSetting() {
}
#endif
+// A fake BrowserProcess object that used to feed the source code from chrome.
+class FakeBrowserProcessImpl : public BrowserProcessImpl {
+ public:
+ embedder_support::OriginTrialsSettingsStorage*
+ GetOriginTrialsSettingsStorage() override {
+ return &origin_trials_settings_storage_;
+ }
+
+ private:
+ embedder_support::OriginTrialsSettingsStorage origin_trials_settings_storage_;
+};
+
} // namespace
#if BUILDFLAG(IS_LINUX)
diff --git a/shell/browser/electron_browser_main_parts_mac.mm b/shell/browser/electron_browser_main_parts_mac.mm
index d33c5bdf40..1b5f6161fa 100644
--- a/shell/browser/electron_browser_main_parts_mac.mm
+++ b/shell/browser/electron_browser_main_parts_mac.mm
@@ -6,7 +6,7 @@
#include <string>
-#include "base/mac/bundle_locations.h"
+#include "base/apple/bundle_locations.h"
#include "base/mac/foundation_util.h"
#include "base/path_service.h"
#include "services/device/public/cpp/geolocation/system_geolocation_source_mac.h"
@@ -49,7 +49,7 @@ void ElectronBrowserMainParts::RegisterURLHandler() {
// Replicates NSApplicationMain, but doesn't start a run loop.
void ElectronBrowserMainParts::InitializeMainNib() {
- auto infoDictionary = base::mac::OuterBundle().infoDictionary;
+ auto infoDictionary = base::apple::OuterBundle().infoDictionary;
auto principalClass =
NSClassFromString([infoDictionary objectForKey:@"NSPrincipalClass"]);
@@ -61,19 +61,19 @@ void ElectronBrowserMainParts::InitializeMainNib() {
@try {
mainNib = [[NSNib alloc] initWithNibNamed:mainNibName
- bundle:base::mac::FrameworkBundle()];
+ bundle:base::apple::FrameworkBundle()];
// Handle failure of initWithNibNamed on SMB shares
// TODO(codebytere): Remove when
// https://bugs.chromium.org/p/chromium/issues/detail?id=932935 is fixed
} @catch (NSException* exception) {
NSString* nibPath =
[NSString stringWithFormat:@"Resources/%@.nib", mainNibName];
- nibPath = [base::mac::FrameworkBundle().bundlePath
+ nibPath = [base::apple::FrameworkBundle().bundlePath
stringByAppendingPathComponent:nibPath];
NSData* data = [NSData dataWithContentsOfFile:nibPath];
mainNib = [[NSNib alloc] initWithNibData:data
- bundle:base::mac::FrameworkBundle()];
+ bundle:base::apple::FrameworkBundle()];
}
[mainNib instantiateWithOwner:application topLevelObjects:nil];
diff --git a/shell/browser/native_window_mac.mm b/shell/browser/native_window_mac.mm
index cf91731888..026f166db9 100644
--- a/shell/browser/native_window_mac.mm
+++ b/shell/browser/native_window_mac.mm
@@ -13,7 +13,6 @@
#include <utility>
#include <vector>
-#include "base/cxx17_backports.h"
#include "base/mac/mac_util.h"
#include "base/mac/scoped_cftyperef.h"
#include "base/strings/sys_string_conversions.h"
@@ -1074,7 +1073,7 @@ void NativeWindowMac::InvalidateShadow() {
}
void NativeWindowMac::SetOpacity(const double opacity) {
- const double boundedOpacity = base::clamp(opacity, 0.0, 1.0);
+ const double boundedOpacity = std::clamp(opacity, 0.0, 1.0);
[window_ setAlphaValue:boundedOpacity];
}
diff --git a/shell/browser/native_window_views.cc b/shell/browser/native_window_views.cc
index b10dcb6e6a..a40540daaa 100644
--- a/shell/browser/native_window_views.cc
+++ b/shell/browser/native_window_views.cc
@@ -13,7 +13,6 @@
#include <utility>
#include <vector>
-#include "base/cxx17_backports.h"
#include "base/memory/raw_ptr.h"
#include "base/stl_util.h"
#include "base/strings/utf_string_conversions.h"
@@ -1132,7 +1131,7 @@ bool NativeWindowViews::HasShadow() {
void NativeWindowViews::SetOpacity(const double opacity) {
#if BUILDFLAG(IS_WIN)
- const double boundedOpacity = base::clamp(opacity, 0.0, 1.0);
+ const double boundedOpacity = std::clamp(opacity, 0.0, 1.0);
HWND hwnd = GetAcceleratedWidget();
if (!layered_) {
LONG ex_style = ::GetWindowLong(hwnd, GWL_EXSTYLE);
diff --git a/shell/browser/ui/autofill_popup.cc b/shell/browser/ui/autofill_popup.cc
index 516806b582..b73771a532 100644
--- a/shell/browser/ui/autofill_popup.cc
+++ b/shell/browser/ui/autofill_popup.cc
@@ -6,7 +6,6 @@
#include <memory>
#include <vector>
-#include "base/cxx17_backports.h"
#include "base/feature_list.h"
#include "base/i18n/rtl.h"
#include "components/autofill/core/common/autofill_features.h"
@@ -44,8 +43,8 @@ void CalculatePopupXAndWidthHorizontallyCentered(
// The preferred horizontal starting point for the pop-up is at the horizontal
// center of the field.
int preferred_starting_point =
- base::clamp(element_bounds.x() + (element_bounds.size().width() / 2),
- content_area_bounds.x(), content_area_bounds.right());
+ std::clamp(element_bounds.x() + (element_bounds.size().width() / 2),
+ content_area_bounds.x(), content_area_bounds.right());
// The space available to the left and to the right.
int space_to_right = content_area_bounds.right() - preferred_starting_point;
@@ -85,11 +84,11 @@ void CalculatePopupXAndWidth(int popup_preferred_width,
const gfx::Rect& element_bounds,
bool is_rtl,
gfx::Rect* popup_bounds) {
- int right_growth_start = base::clamp(
+ int right_growth_start = std::clamp(
element_bounds.x(), content_area_bounds.x(), content_area_bounds.right());
int left_growth_end =
- base::clamp(element_bounds.right(), content_area_bounds.x(),
- content_area_bounds.right());
+ std::clamp(element_bounds.right(), content_area_bounds.x(),
+ content_area_bounds.right());
int right_available = content_area_bounds.right() - right_growth_start;
int left_available = left_growth_end - content_area_bounds.x();
@@ -118,11 +117,11 @@ void CalculatePopupYAndHeight(int popup_preferred_height,
const gfx::Rect& content_area_bounds,
const gfx::Rect& element_bounds,
gfx::Rect* popup_bounds) {
- int top_growth_end = base::clamp(element_bounds.y(), content_area_bounds.y(),
- content_area_bounds.bottom());
+ int top_growth_end = std::clamp(element_bounds.y(), content_area_bounds.y(),
+ content_area_bounds.bottom());
int bottom_growth_start =
- base::clamp(element_bounds.bottom(), content_area_bounds.y(),
- content_area_bounds.bottom());
+ std::clamp(element_bounds.bottom(), content_area_bounds.y(),
+ content_area_bounds.bottom());
int top_available = top_growth_end - content_area_bounds.y();
int bottom_available = content_area_bounds.bottom() - bottom_growth_start;
diff --git a/shell/browser/ui/cocoa/electron_bundle_mover.h b/shell/browser/ui/cocoa/electron_bundle_mover.h
index c1c5306dfc..d80bc5c1c2 100644
--- a/shell/browser/ui/cocoa/electron_bundle_mover.h
+++ b/shell/browser/ui/cocoa/electron_bundle_mover.h
@@ -28,17 +28,6 @@ class ElectronBundleMover {
static bool ShouldContinueMove(gin_helper::ErrorThrower thrower,
BundlerMoverConflictType type,
gin::Arguments* args);
- static bool IsInApplicationsFolder(NSString* bundlePath);
- static NSString* ContainingDiskImageDevice(NSString* bundlePath);
- static void Relaunch(NSString* destinationPath);
- static NSString* ShellQuotedString(NSString* string);
- static bool CopyBundle(NSString* srcPath, NSString* dstPath);
- static bool AuthorizedInstall(NSString* srcPath,
- NSString* dstPath,
- bool* canceled);
- static bool IsApplicationAtPathRunning(NSString* bundlePath);
- static bool DeleteOrTrash(NSString* path);
- static bool Trash(NSString* path);
};
} // namespace electron
diff --git a/shell/browser/ui/cocoa/electron_bundle_mover.mm b/shell/browser/ui/cocoa/electron_bundle_mover.mm
index 57dcadc993..b566721753 100644
--- a/shell/browser/ui/cocoa/electron_bundle_mover.mm
+++ b/shell/browser/ui/cocoa/electron_bundle_mover.mm
@@ -36,179 +36,9 @@ struct Converter<electron::BundlerMoverConflictType> {
} // namespace gin
-namespace electron {
-
-bool ElectronBundleMover::ShouldContinueMove(gin_helper::ErrorThrower thrower,
- BundlerMoverConflictType type,
- gin::Arguments* args) {
- gin::Dictionary options(args->isolate());
- bool hasOptions = args->GetNext(&options);
- base::OnceCallback<v8::Local<v8::Value>(BundlerMoverConflictType)>
- conflict_cb;
-
- if (hasOptions && options.Get("conflictHandler", &conflict_cb)) {
- v8::Local<v8::Value> value = std::move(conflict_cb).Run(type);
- if (value->IsBoolean()) {
- if (!value.As<v8::Boolean>()->Value())
- return false;
- } else if (!value->IsUndefined()) {
- // we only want to throw an error if a user has returned a non-boolean
- // value; this allows for client-side error handling should something in
- // the handler throw
- thrower.ThrowError("Invalid conflict handler return type.");
- }
- }
- return true;
-}
-
-bool ElectronBundleMover::Move(gin_helper::ErrorThrower thrower,
- gin::Arguments* args) {
- // Path of the current bundle
- NSString* bundlePath = [[NSBundle mainBundle] bundlePath];
-
- // Skip if the application is already in the Applications folder
- if (IsInApplicationsFolder(bundlePath))
- return true;
-
- NSFileManager* fileManager = [NSFileManager defaultManager];
-
- NSString* diskImageDevice = ContainingDiskImageDevice(bundlePath);
-
- NSString* applicationsDirectory = [[NSSearchPathForDirectoriesInDomains(
- NSApplicationDirectory, NSLocalDomainMask, true) lastObject]
- stringByResolvingSymlinksInPath];
- NSString* bundleName = [bundlePath lastPathComponent];
- NSString* destinationPath =
- [applicationsDirectory stringByAppendingPathComponent:bundleName];
-
- // Check if we can write to the applications directory
- // and then make sure that if the app already exists we can overwrite it
- bool needAuthorization =
- ![fileManager isWritableFileAtPath:applicationsDirectory] ||
- ([fileManager fileExistsAtPath:destinationPath] &&
- ![fileManager isWritableFileAtPath:destinationPath]);
-
- // Activate app -- work-around for focus issues related to "scary file from
- // internet" OS dialog.
- if (![NSApp isActive]) {
- [NSApp activateIgnoringOtherApps:true];
- }
-
- // Move to applications folder
- if (needAuthorization) {
- bool authorizationCanceled;
-
- if (!AuthorizedInstall(bundlePath, destinationPath,
- &authorizationCanceled)) {
- if (authorizationCanceled) {
- // User rejected the authorization request
- thrower.ThrowError("User rejected the authorization request");
- return false;
- } else {
- thrower.ThrowError(
- "Failed to copy to applications directory even with authorization");
- return false;
- }
- }
- } else {
- // If a copy already exists in the Applications folder, put it in the Trash
- if ([fileManager fileExistsAtPath:destinationPath]) {
- // But first, make sure that it's not running
- if (IsApplicationAtPathRunning(destinationPath)) {
- // Check for callback handler and get user choice for open/quit
- if (!ShouldContinueMove(
- thrower, BundlerMoverConflictType::kExistsAndRunning, args))
- return false;
-
- // Unless explicitly denied, give running app focus and terminate self
- [[NSTask
- launchedTaskWithLaunchPath:@"/usr/bin/open"
- arguments:[NSArray
- arrayWithObject:destinationPath]]
- waitUntilExit];
- electron::Browser::Get()->Quit();
- return true;
- } else {
- // Check callback handler and get user choice for app trashing
- if (!ShouldContinueMove(thrower, BundlerMoverConflictType::kExists,
- args))
- return false;
-
- // Unless explicitly denied, attempt to trash old app
- if (!Trash([applicationsDirectory
- stringByAppendingPathComponent:bundleName])) {
- thrower.ThrowError("Failed to delete existing application");
- return false;
- }
- }
- }
-
- if (!CopyBundle(bundlePath, destinationPath)) {
- thrower.ThrowError(
- "Failed to copy current bundle to the applications folder");
- return false;
- }
- }
-
- // Trash the original app. It's okay if this fails.
- // NOTE: This final delete does not work if the source bundle is in a network
- // mounted volume.
- // Calling rm or file manager's delete method doesn't work either. It's
- // unlikely to happen but it'd be great if someone could fix this.
- if (diskImageDevice == nil && !DeleteOrTrash(bundlePath)) {
- // Could not delete original but we just don't care
- }
-
- // Relaunch.
- Relaunch(destinationPath);
+namespace {
- // Launched from within a disk image? -- unmount (if no files are open after 5
- // seconds, otherwise leave it mounted).
- if (diskImageDevice) {
- NSString* script = [NSString
- stringWithFormat:@"(/bin/sleep 5 && /usr/bin/hdiutil detach %@) &",
- ShellQuotedString(diskImageDevice)];
- [NSTask launchedTaskWithLaunchPath:@"/bin/sh"
- arguments:[NSArray arrayWithObjects:@"-c", script,
- nil]];
- }
-
- electron::Browser::Get()->Quit();
-
- return true;
-}
-
-bool ElectronBundleMover::IsCurrentAppInApplicationsFolder() {
- return IsInApplicationsFolder([[NSBundle mainBundle] bundlePath]);
-}
-
-NSString* resolvePath(NSString* path) {
- NSString* standardizedPath = [path stringByStandardizingPath];
- char resolved[PATH_MAX];
- if (realpath([standardizedPath UTF8String], resolved) == NULL)
- return path;
- return @(resolved);
-}
-
-bool ElectronBundleMover::IsInApplicationsFolder(NSString* bundlePath) {
- // Check all the normal Application directories
- NSArray* applicationDirs = NSSearchPathForDirectoriesInDomains(
- NSApplicationDirectory, NSAllDomainsMask, true);
- NSString* resolvedBundlePath = resolvePath(bundlePath);
- for (NSString* appDir in applicationDirs) {
- if ([resolvedBundlePath hasPrefix:appDir])
- return true;
- }
-
- // Also, handle the case that the user has some other Application directory
- // (perhaps on a separate data partition).
- if ([[resolvedBundlePath pathComponents] containsObject:@"Applications"])
- return true;
-
- return false;
-}
-
-NSString* ElectronBundleMover::ContainingDiskImageDevice(NSString* bundlePath) {
+NSString* ContainingDiskImageDevice(NSString* bundlePath) {
NSString* containingPath = [bundlePath stringByDeletingLastPathComponent];
struct statfs fs;
@@ -267,9 +97,33 @@ NSString* ElectronBundleMover::ContainingDiskImageDevice(NSString* bundlePath) {
return nil;
}
-bool ElectronBundleMover::AuthorizedInstall(NSString* srcPath,
- NSString* dstPath,
- bool* canceled) {
+NSString* ResolvePath(NSString* path) {
+ NSString* standardizedPath = [path stringByStandardizingPath];
+ char resolved[PATH_MAX];
+ if (realpath([standardizedPath UTF8String], resolved) == NULL)
+ return path;
+ return @(resolved);
+}
+
+bool IsInApplicationsFolder(NSString* bundlePath) {
+ // Check all the normal Application directories
+ NSArray* applicationDirs = NSSearchPathForDirectoriesInDomains(
+ NSApplicationDirectory, NSAllDomainsMask, true);
+ NSString* resolvedBundlePath = ResolvePath(bundlePath);
+ for (NSString* appDir in applicationDirs) {
+ if ([resolvedBundlePath hasPrefix:appDir])
+ return true;
+ }
+
+ // Also, handle the case that the user has some other Application directory
+ // (perhaps on a separate data partition).
+ if ([[resolvedBundlePath pathComponents] containsObject:@"Applications"])
+ return true;
+
+ return false;
+}
+
+bool AuthorizedInstall(NSString* srcPath, NSString* dstPath, bool* canceled) {
if (canceled)
*canceled = false;
@@ -371,21 +225,21 @@ fail:
return false;
}
-bool ElectronBundleMover::CopyBundle(NSString* srcPath, NSString* dstPath) {
+bool CopyBundle(NSString* srcPath, NSString* dstPath) {
NSFileManager* fileManager = [NSFileManager defaultManager];
NSError* error = nil;
return [fileManager copyItemAtPath:srcPath toPath:dstPath error:&error];
}
-NSString* ElectronBundleMover::ShellQuotedString(NSString* string) {
+NSString* ShellQuotedString(NSString* string) {
return [NSString
stringWithFormat:@"'%@'",
[string stringByReplacingOccurrencesOfString:@"'"
withString:@"'\\''"]];
}
-void ElectronBundleMover::Relaunch(NSString* destinationPath) {
+void Relaunch(NSString* destinationPath) {
// The shell script waits until the original app process terminates.
// This is done so that the relaunched app opens as the front-most app.
int pid = [[NSProcessInfo processInfo] processIdentifier];
@@ -412,21 +266,7 @@ void ElectronBundleMover::Relaunch(NSString* destinationPath) {
arguments:[NSArray arrayWithObjects:@"-c", script, nil]];
}
-bool ElectronBundleMover::IsApplicationAtPathRunning(NSString* bundlePath) {
- bundlePath = [bundlePath stringByStandardizingPath];
-
- for (NSRunningApplication* runningApplication in
- [[NSWorkspace sharedWorkspace] runningApplications]) {
- NSString* runningAppBundlePath =
- [[[runningApplication bundleURL] path] stringByStandardizingPath];
- if ([runningAppBundlePath isEqualToString:bundlePath]) {
- return true;
- }
- }
- return false;
-}
-
-bool ElectronBundleMover::Trash(NSString* path) {
+bool Trash(NSString* path) {
bool result = false;
if (floor(NSAppKitVersionNumber) >= NSAppKitVersionNumber10_8) {
@@ -457,7 +297,7 @@ end tell
return result;
}
-bool ElectronBundleMover::DeleteOrTrash(NSString* path) {
+bool DeleteOrTrash(NSString* path) {
NSError* error;
if ([[NSFileManager defaultManager] removeItemAtPath:path error:&error]) {
@@ -467,4 +307,166 @@ bool ElectronBundleMover::DeleteOrTrash(NSString* path) {
}
}
+bool IsApplicationAtPathRunning(NSString* bundlePath) {
+ bundlePath = [bundlePath stringByStandardizingPath];
+
+ for (NSRunningApplication* runningApplication in
+ [[NSWorkspace sharedWorkspace] runningApplications]) {
+ NSString* runningAppBundlePath =
+ [[[runningApplication bundleURL] path] stringByStandardizingPath];
+ if ([runningAppBundlePath isEqualToString:bundlePath]) {
+ return true;
+ }
+ }
+ return false;
+}
+
+} // namespace
+
+namespace electron {
+
+bool ElectronBundleMover::ShouldContinueMove(gin_helper::ErrorThrower thrower,
+ BundlerMoverConflictType type,
+ gin::Arguments* args) {
+ gin::Dictionary options(args->isolate());
+ bool hasOptions = args->GetNext(&options);
+ base::OnceCallback<v8::Local<v8::Value>(BundlerMoverConflictType)>
+ conflict_cb;
+
+ if (hasOptions && options.Get("conflictHandler", &conflict_cb)) {
+ v8::Local<v8::Value> value = std::move(conflict_cb).Run(type);
+ if (value->IsBoolean()) {
+ if (!value.As<v8::Boolean>()->Value())
+ return false;
+ } else if (!value->IsUndefined()) {
+ // we only want to throw an error if a user has returned a non-boolean
+ // value; this allows for client-side error handling should something in
+ // the handler throw
+ thrower.ThrowError("Invalid conflict handler return type.");
+ }
+ }
+ return true;
+}
+
+bool ElectronBundleMover::Move(gin_helper::ErrorThrower thrower,
+ gin::Arguments* args) {
+ // Path of the current bundle
+ NSString* bundlePath = [[NSBundle mainBundle] bundlePath];
+
+ // Skip if the application is already in the Applications folder
+ if (IsInApplicationsFolder(bundlePath))
+ return true;
+
+ NSFileManager* fileManager = [NSFileManager defaultManager];
+
+ NSString* diskImageDevice = ContainingDiskImageDevice(bundlePath);
+
+ NSString* applicationsDirectory = [[NSSearchPathForDirectoriesInDomains(
+ NSApplicationDirectory, NSLocalDomainMask, true) lastObject]
+ stringByResolvingSymlinksInPath];
+ NSString* bundleName = [bundlePath lastPathComponent];
+ NSString* destinationPath =
+ [applicationsDirectory stringByAppendingPathComponent:bundleName];
+
+ // Check if we can write to the applications directory
+ // and then make sure that if the app already exists we can overwrite it
+ bool needAuthorization =
+ ![fileManager isWritableFileAtPath:applicationsDirectory] ||
+ ([fileManager fileExistsAtPath:destinationPath] &&
+ ![fileManager isWritableFileAtPath:destinationPath]);
+
+ // Activate app -- work-around for focus issues related to "scary file from
+ // internet" OS dialog.
+ if (![NSApp isActive]) {
+ [NSApp activateIgnoringOtherApps:true];
+ }
+
+ // Move to applications folder
+ if (needAuthorization) {
+ bool authorizationCanceled;
+
+ if (!AuthorizedInstall(bundlePath, destinationPath,
+ &authorizationCanceled)) {
+ if (authorizationCanceled) {
+ // User rejected the authorization request
+ thrower.ThrowError("User rejected the authorization request");
+ return false;
+ } else {
+ thrower.ThrowError(
+ "Failed to copy to applications directory even with authorization");
+ return false;
+ }
+ }
+ } else {
+ // If a copy already exists in the Applications folder, put it in the Trash
+ if ([fileManager fileExistsAtPath:destinationPath]) {
+ // But first, make sure that it's not running
+ if (IsApplicationAtPathRunning(destinationPath)) {
+ // Check for callback handler and get user choice for open/quit
+ if (!ShouldContinueMove(
+ thrower, BundlerMoverConflictType::kExistsAndRunning, args))
+ return false;
+
+ // Unless explicitly denied, give running app focus and terminate self
+ [[NSTask
+ launchedTaskWithLaunchPath:@"/usr/bin/open"
+ arguments:[NSArray
+ arrayWithObject:destinationPath]]
+ waitUntilExit];
+ electron::Browser::Get()->Quit();
+ return true;
+ } else {
+ // Check callback handler and get user choice for app trashing
+ if (!ShouldContinueMove(thrower, BundlerMoverConflictType::kExists,
+ args))
+ return false;
+
+ // Unless explicitly denied, attempt to trash old app
+ if (!Trash([applicationsDirectory
+ stringByAppendingPathComponent:bundleName])) {
+ thrower.ThrowError("Failed to delete existing application");
+ return false;
+ }
+ }
+ }
+
+ if (!CopyBundle(bundlePath, destinationPath)) {
+ thrower.ThrowError(
+ "Failed to copy current bundle to the applications folder");
+ return false;
+ }
+ }
+
+ // Trash the original app. It's okay if this fails.
+ // NOTE: This final delete does not work if the source bundle is in a network
+ // mounted volume.
+ // Calling rm or file manager's delete method doesn't work either. It's
+ // unlikely to happen but it'd be great if someone could fix this.
+ if (diskImageDevice == nil && !DeleteOrTrash(bundlePath)) {
+ // Could not delete original but we just don't care
+ }
+
+ // Relaunch.
+ Relaunch(destinationPath);
+
+ // Launched from within a disk image? -- unmount (if no files are open after 5
+ // seconds, otherwise leave it mounted).
+ if (diskImageDevice) {
+ NSString* script = [NSString
+ stringWithFormat:@"(/bin/sleep 5 && /usr/bin/hdiutil detach %@) &",
+ ShellQuotedString(diskImageDevice)];
+ [NSTask launchedTaskWithLaunchPath:@"/bin/sh"
+ arguments:[NSArray arrayWithObjects:@"-c", script,
+ nil]];
+ }
+
+ electron::Browser::Get()->Quit();
+
+ return true;
+}
+
+bool ElectronBundleMover::IsCurrentAppInApplicationsFolder() {
+ return IsInApplicationsFolder([[NSBundle mainBundle] bundlePath]);
+}
+
} // namespace electron
diff --git a/shell/browser/ui/inspectable_web_contents.cc b/shell/browser/ui/inspectable_web_contents.cc
index aad6b0bf98..cffad6e98b 100644
--- a/shell/browser/ui/inspectable_web_contents.cc
+++ b/shell/browser/ui/inspectable_web_contents.cc
@@ -97,13 +97,12 @@ const size_t kMaxMessageChunkSize = IPC::Channel::kMaximumMessageSize / 4;
// Stores all instances of InspectableWebContents.
InspectableWebContents::List g_web_contents_instances_;
-base::Value RectToDictionary(const gfx::Rect& bounds) {
- base::Value::Dict dict;
- dict.Set("x", bounds.x());
- dict.Set("y", bounds.y());
- dict.Set("width", bounds.width());
- dict.Set("height", bounds.height());
- return base::Value(std::move(dict));
+base::Value::Dict RectToDictionary(const gfx::Rect& bounds) {
+ return base::Value::Dict{}
+ .Set("x", bounds.x())
+ .Set("y", bounds.y())
+ .Set("width", bounds.width())
+ .Set("height", bounds.height());
}
gfx::Rect DictionaryToRect(const base::Value::Dict& dict) {
@@ -338,7 +337,7 @@ const InspectableWebContents::List& InspectableWebContents::GetAll() {
// static
void InspectableWebContents::RegisterPrefs(PrefRegistrySimple* registry) {
registry->RegisterDictionaryPref(kDevToolsBoundsPref,
- RectToDictionary(gfx::Rect(0, 0, 800, 600)));
+ RectToDictionary(gfx::Rect{0, 0, 800, 600}));
registry->RegisterDoublePref(kDevToolsZoomPref, 0.);
registry->RegisterDictionaryPref(kDevToolsPreferences);
}
@@ -544,7 +543,8 @@ gfx::Rect InspectableWebContents::GetDevToolsBounds() const {
}
void InspectableWebContents::SaveDevToolsBounds(const gfx::Rect& bounds) {
- pref_service_->Set(kDevToolsBoundsPref, RectToDictionary(bounds));
+ pref_service_->Set(kDevToolsBoundsPref,
+ base::Value{RectToDictionary(bounds)});
devtools_bounds_ = bounds;
}
diff --git a/shell/browser/ui/win/jump_list.cc b/shell/browser/ui/win/jump_list.cc
index 12311f6377..6d868e6d9e 100644
--- a/shell/browser/ui/win/jump_list.cc
+++ b/shell/browser/ui/win/jump_list.cc
@@ -6,7 +6,6 @@
#include <propkey.h> // for PKEY_* constants
-#include "base/cxx17_backports.h"
#include "base/logging.h"
#include "base/win/scoped_co_mem.h"
#include "base/win/scoped_propvariant.h"
diff --git a/shell/browser/web_view_guest_delegate.cc b/shell/browser/web_view_guest_delegate.cc
index 8a474b2151..e67c84f1b7 100644
--- a/shell/browser/web_view_guest_delegate.cc
+++ b/shell/browser/web_view_guest_delegate.cc
@@ -124,4 +124,9 @@ WebViewGuestDelegate::CreateNewGuestWindow(
return guest_contents;
}
+base::WeakPtr<content::BrowserPluginGuestDelegate>
+WebViewGuestDelegate::GetGuestDelegateWeakPtr() {
+ return weak_ptr_factory_.GetWeakPtr();
+}
+
} // namespace electron
diff --git a/shell/browser/web_view_guest_delegate.h b/shell/browser/web_view_guest_delegate.h
index 38b456b0aa..0fcde00831 100644
--- a/shell/browser/web_view_guest_delegate.h
+++ b/shell/browser/web_view_guest_delegate.h
@@ -38,6 +38,8 @@ class WebViewGuestDelegate : public content::BrowserPluginGuestDelegate,
content::WebContents* GetOwnerWebContents() final;
std::unique_ptr<content::WebContents> CreateNewGuestWindow(
const content::WebContents::CreateParams& create_params) final;
+ base::WeakPtr<content::BrowserPluginGuestDelegate> GetGuestDelegateWeakPtr()
+ final;
// WebContentsZoomController::Observer:
void OnZoomLevelChanged(content::WebContents* web_contents,
@@ -56,6 +58,8 @@ class WebViewGuestDelegate : public content::BrowserPluginGuestDelegate,
raw_ptr<WebContentsZoomController> embedder_zoom_controller_ = nullptr;
raw_ptr<api::WebContents> api_web_contents_ = nullptr;
+
+ base::WeakPtrFactory<WebViewGuestDelegate> weak_ptr_factory_{this};
};
} // namespace electron
diff --git a/shell/common/asar/archive_mac.mm b/shell/common/asar/archive_mac.mm
index b0b13e3312..6f8a2984ec 100644
--- a/shell/common/asar/archive_mac.mm
+++ b/shell/common/asar/archive_mac.mm
@@ -11,9 +11,9 @@
#include <iomanip>
#include <string>
+#include "base/apple/bundle_locations.h"
#include "base/files/file_util.h"
#include "base/logging.h"
-#include "base/mac/bundle_locations.h"
#include "base/mac/foundation_util.h"
#include "base/mac/scoped_cftyperef.h"
#include "base/strings/sys_string_conversions.h"
@@ -23,7 +23,7 @@ namespace asar {
absl::optional<base::FilePath> Archive::RelativePath() const {
base::FilePath bundle_path = base::MakeAbsoluteFilePath(
- base::mac::MainBundlePath().Append("Contents"));
+ base::apple::MainBundlePath().Append("Contents"));
base::FilePath relative_path;
if (!bundle_path.AppendRelativePath(path_, &relative_path))
diff --git a/shell/common/color_util.cc b/shell/common/color_util.cc
index 73bbc162cc..435bcee1e4 100644
--- a/shell/common/color_util.cc
+++ b/shell/common/color_util.cc
@@ -8,7 +8,6 @@
#include <utility>
#include <vector>
-#include "base/cxx17_backports.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "content/public/common/color_parser.h"
diff --git a/shell/common/gin_helper/callback.cc b/shell/common/gin_helper/callback.cc
index 0a82b901dc..fe2d46bd04 100644
--- a/shell/common/gin_helper/callback.cc
+++ b/shell/common/gin_helper/callback.cc
@@ -4,7 +4,6 @@
#include "shell/common/gin_helper/callback.h"
-#include "base/cxx17_backports.h"
#include "content/public/browser/browser_thread.h"
#include "gin/dictionary.h"
#include "shell/common/process_util.h"
diff --git a/shell/common/mac/main_application_bundle.mm b/shell/common/mac/main_application_bundle.mm
index db7f789db7..774593f5d9 100644
--- a/shell/common/mac/main_application_bundle.mm
+++ b/shell/common/mac/main_application_bundle.mm
@@ -5,8 +5,8 @@
#import "shell/common/mac/main_application_bundle.h"
+#include "base/apple/bundle_locations.h"
#include "base/files/file_path.h"
-#include "base/mac/bundle_locations.h"
#include "base/mac/foundation_util.h"
#include "base/path_service.h"
#include "base/strings/string_util.h"
@@ -17,7 +17,7 @@ namespace electron {
namespace {
bool HasMainProcessKey() {
- NSDictionary* info_dictionary = [base::mac::MainBundle() infoDictionary];
+ NSDictionary* info_dictionary = [base::apple::MainBundle() infoDictionary];
return
[[info_dictionary objectForKey:@"ElectronMainProcess"] boolValue] != NO;
}
|
chore
|
f0d3e4233826dd60bcf3b0224b1e90841932ed55
|
John Kleinschmidt
|
2024-11-04 17:26:19
|
test: fixup flaky session tests (#44545)
test: fixup broken tests in 32-x-y (#44389)
* test: fixup broken tests in 32-x-y
* test: fixup additional failing test
(cherry picked from commit c61bb1654e7abc4b48e09b44b40468ee89c5b2b1)
|
diff --git a/spec/api-session-spec.ts b/spec/api-session-spec.ts
index d4754ceec6..323e487358 100644
--- a/spec/api-session-spec.ts
+++ b/spec/api-session-spec.ts
@@ -12,7 +12,7 @@ import * as https from 'node:https';
import * as path from 'node:path';
import { setTimeout } from 'node:timers/promises';
-import { defer, listen } from './lib/spec-helpers';
+import { defer, ifit, listen } from './lib/spec-helpers';
import { closeAllWindows } from './lib/window-helpers';
describe('session module', () => {
@@ -841,19 +841,13 @@ describe('session module', () => {
};
describe('session.downloadURL', () => {
- it('can perform a download', (done) => {
- session.defaultSession.once('will-download', function (e, item) {
- item.savePath = downloadFilePath;
- item.on('done', function (e, state) {
- try {
- assertDownload(state, item);
- done();
- } catch (e) {
- done(e);
- }
- });
- });
+ it('can perform a download', async () => {
+ const willDownload = once(session.defaultSession, 'will-download');
session.defaultSession.downloadURL(`${url}:${port}`);
+ const [, item] = await willDownload;
+ item.savePath = downloadFilePath;
+ const [, state] = await once(item, 'done');
+ assertDownload(state, item);
});
it('can perform a download with a valid auth header', async () => {
@@ -963,20 +957,14 @@ describe('session module', () => {
});
describe('webContents.downloadURL', () => {
- it('can perform a download', (done) => {
+ it('can perform a download', async () => {
const w = new BrowserWindow({ show: false });
- w.webContents.session.once('will-download', function (e, item) {
- item.savePath = downloadFilePath;
- item.on('done', function (e, state) {
- try {
- assertDownload(state, item);
- done();
- } catch (e) {
- done(e);
- }
- });
- });
+ const willDownload = once(w.webContents.session, 'will-download');
w.webContents.downloadURL(`${url}:${port}`);
+ const [, item] = await willDownload;
+ item.savePath = downloadFilePath;
+ const [, state] = await once(item, 'done');
+ assertDownload(state, item);
});
it('can perform a download with a valid auth header', async () => {
@@ -1079,73 +1067,51 @@ describe('session module', () => {
expect(item.getTotalBytes()).to.equal(0);
});
- it('can download from custom protocols', (done) => {
+ it('can download from custom protocols', async () => {
const protocol = session.defaultSession.protocol;
const handler = (ignoredError: any, callback: Function) => {
callback({ url: `${url}:${port}` });
};
protocol.registerHttpProtocol(protocolName, handler);
const w = new BrowserWindow({ show: false });
- w.webContents.session.once('will-download', function (e, item) {
- item.savePath = downloadFilePath;
- item.on('done', function (e, state) {
- try {
- assertDownload(state, item, true);
- done();
- } catch (e) {
- done(e);
- }
- });
- });
+ const willDownload = once(w.webContents.session, 'will-download');
w.webContents.downloadURL(`${protocolName}://item`);
+ const [, item] = await willDownload;
+ item.savePath = downloadFilePath;
+ const [, state] = await once(item, 'done');
+ assertDownload(state, item, true);
});
- it('can cancel download', (done) => {
+ it('can cancel download', async () => {
const w = new BrowserWindow({ show: false });
- w.webContents.session.once('will-download', function (e, item) {
- item.savePath = downloadFilePath;
- item.on('done', function (e, state) {
- try {
- expect(state).to.equal('cancelled');
- expect(item.getFilename()).to.equal('mock.pdf');
- expect(item.getMimeType()).to.equal('application/pdf');
- expect(item.getReceivedBytes()).to.equal(0);
- expect(item.getTotalBytes()).to.equal(mockPDF.length);
- expect(item.getContentDisposition()).to.equal(contentDisposition);
- done();
- } catch (e) {
- done(e);
- }
- });
- item.cancel();
- });
+ const willDownload = once(w.webContents.session, 'will-download');
w.webContents.downloadURL(`${url}:${port}/`);
+ const [, item] = await willDownload;
+ item.savePath = downloadFilePath;
+ const itemDone = once(item, 'done');
+ item.cancel();
+ const [, state] = await itemDone;
+ expect(state).to.equal('cancelled');
+ expect(item.getFilename()).to.equal('mock.pdf');
+ expect(item.getMimeType()).to.equal('application/pdf');
+ expect(item.getReceivedBytes()).to.equal(0);
+ expect(item.getTotalBytes()).to.equal(mockPDF.length);
+ expect(item.getContentDisposition()).to.equal(contentDisposition);
});
- it('can generate a default filename', function (done) {
- if (process.env.APPVEYOR === 'True') {
- // FIXME(alexeykuzmin): Skip the test.
- // this.skip()
- return done();
- }
-
+ ifit(process.platform !== 'win32')('can generate a default filename', async () => {
const w = new BrowserWindow({ show: false });
- w.webContents.session.once('will-download', function (e, item) {
- item.savePath = downloadFilePath;
- item.on('done', function () {
- try {
- expect(item.getFilename()).to.equal('download.pdf');
- done();
- } catch (e) {
- done(e);
- }
- });
- item.cancel();
- });
+ const willDownload = once(w.webContents.session, 'will-download');
w.webContents.downloadURL(`${url}:${port}/?testFilename`);
+ const [, item] = await willDownload;
+ item.savePath = downloadFilePath;
+ const itemDone = once(item, 'done');
+ item.cancel();
+ await itemDone;
+ expect(item.getFilename()).to.equal('download.pdf');
});
- it('can set options for the save dialog', (done) => {
+ it('can set options for the save dialog', async () => {
const filePath = path.join(__dirname, 'fixtures', 'mock.pdf');
const options = {
window: null,
@@ -1164,40 +1130,29 @@ describe('session module', () => {
};
const w = new BrowserWindow({ show: false });
- w.webContents.session.once('will-download', function (e, item) {
- item.setSavePath(filePath);
- item.setSaveDialogOptions(options);
- item.on('done', function () {
- try {
- expect(item.getSaveDialogOptions()).to.deep.equal(options);
- done();
- } catch (e) {
- done(e);
- }
- });
- item.cancel();
- });
+ const willDownload = once(w.webContents.session, 'will-download');
w.webContents.downloadURL(`${url}:${port}`);
+ const [, item] = await willDownload;
+ item.setSavePath(filePath);
+ item.setSaveDialogOptions(options);
+ const itemDone = once(item, 'done');
+ item.cancel();
+ await itemDone;
+ expect(item.getSaveDialogOptions()).to.deep.equal(options);
});
describe('when a save path is specified and the URL is unavailable', () => {
- it('does not display a save dialog and reports the done state as interrupted', (done) => {
+ it('does not display a save dialog and reports the done state as interrupted', async () => {
const w = new BrowserWindow({ show: false });
- w.webContents.session.once('will-download', function (e, item) {
- item.savePath = downloadFilePath;
- if (item.getState() === 'interrupted') {
- item.resume();
- }
- item.on('done', function (e, state) {
- try {
- expect(state).to.equal('interrupted');
- done();
- } catch (e) {
- done(e);
- }
- });
- });
+ const willDownload = once(w.webContents.session, 'will-download');
w.webContents.downloadURL(`file://${path.join(__dirname, 'does-not-exist.txt')}`);
+ const [, item] = await willDownload;
+ item.savePath = downloadFilePath;
+ if (item.getState() === 'interrupted') {
+ item.resume();
+ }
+ const [, state] = await once(item, 'done');
+ expect(state).to.equal('interrupted');
});
});
});
|
test
|
82ea3faae5442318ba0154aef32850a5a4bd0ee3
|
Calvin
|
2024-12-09 11:44:43
|
docs: update security scoped bookmarks info (#44968)
|
diff --git a/docs/api/dialog.md b/docs/api/dialog.md
index 81458ddece..27590bf6c2 100644
--- a/docs/api/dialog.md
+++ b/docs/api/dialog.md
@@ -360,7 +360,7 @@ On Windows the options are more limited, due to the Win32 APIs used:
## Bookmarks array
-`showOpenDialog`, `showOpenDialogSync`, `showSaveDialog`, and `showSaveDialogSync` will return a `bookmarks` array.
+`showOpenDialog` and `showSaveDialog` resolve to an object with a `bookmarks` field. This field is an array of Base64 encoded strings that contain the [security scoped bookmark](https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16) data for the saved file. The `securityScopedBookmarks` option must be enabled for this to be present.
| Build Type | securityScopedBookmarks boolean | Return Type | Return Value |
|------------|---------------------------------|:-----------:|--------------------------------|
|
docs
|
2acb97aa8505079f1e4d8afc1af27d5439d14afd
|
Milan Burda
|
2023-05-18 23:01:44
|
chore: eliminate a few uses of base::AdaptCallbackForRepeating() (#38293)
|
diff --git a/shell/browser/api/electron_api_session.cc b/shell/browser/api/electron_api_session.cc
index d278f03966..691fcf92c2 100644
--- a/shell/browser/api/electron_api_session.cc
+++ b/shell/browser/api/electron_api_session.cc
@@ -653,8 +653,7 @@ void Session::SetPermissionRequestHandler(v8::Local<v8::Value> val,
blink::PermissionType permission_type,
ElectronPermissionManager::StatusCallback callback,
const base::Value& details) {
- handler->Run(web_contents, permission_type,
- base::AdaptCallbackForRepeating(std::move(callback)),
+ handler->Run(web_contents, permission_type, std::move(callback),
details);
},
base::Owned(std::move(handler))));
diff --git a/shell/browser/bluetooth/electron_bluetooth_delegate.cc b/shell/browser/bluetooth/electron_bluetooth_delegate.cc
index 1eece6ad48..b95b3f351a 100644
--- a/shell/browser/bluetooth/electron_bluetooth_delegate.cc
+++ b/shell/browser/bluetooth/electron_bluetooth_delegate.cc
@@ -179,9 +179,9 @@ void ElectronBluetoothDelegate::ShowDevicePairPrompt(
}
permission_manager->CheckBluetoothDevicePair(
- details, base::AdaptCallbackForRepeating(base::BindOnce(
- &ElectronBluetoothDelegate::OnDevicePairPromptResponse,
- weak_factory_.GetWeakPtr(), std::move(callback))));
+ details,
+ base::BindOnce(&ElectronBluetoothDelegate::OnDevicePairPromptResponse,
+ weak_factory_.GetWeakPtr(), std::move(callback)));
}
}
diff --git a/shell/browser/hid/hid_chooser_controller.cc b/shell/browser/hid/hid_chooser_controller.cc
index 11bb87a6fb..d5f5aeee79 100644
--- a/shell/browser/hid/hid_chooser_controller.cc
+++ b/shell/browser/hid/hid_chooser_controller.cc
@@ -247,9 +247,8 @@ void HidChooserController::OnGotDevices(
.Build();
prevent_default =
session->Emit("select-hid-device", details,
- base::AdaptCallbackForRepeating(
- base::BindOnce(&HidChooserController::OnDeviceChosen,
- weak_factory_.GetWeakPtr())));
+ base::BindRepeating(&HidChooserController::OnDeviceChosen,
+ weak_factory_.GetWeakPtr()));
}
if (!prevent_default) {
RunCallback({});
diff --git a/shell/browser/serial/serial_chooser_controller.cc b/shell/browser/serial/serial_chooser_controller.cc
index d0aae7faa1..f15722b223 100644
--- a/shell/browser/serial/serial_chooser_controller.cc
+++ b/shell/browser/serial/serial_chooser_controller.cc
@@ -156,11 +156,10 @@ void SerialChooserController::OnGetDevices(
bool prevent_default = false;
api::Session* session = GetSession();
if (session) {
- prevent_default =
- session->Emit("select-serial-port", ports_, web_contents(),
- base::AdaptCallbackForRepeating(base::BindOnce(
- &SerialChooserController::OnDeviceChosen,
- weak_factory_.GetWeakPtr())));
+ prevent_default = session->Emit(
+ "select-serial-port", ports_, web_contents(),
+ base::BindRepeating(&SerialChooserController::OnDeviceChosen,
+ weak_factory_.GetWeakPtr()));
}
if (!prevent_default) {
RunCallback(/*port=*/nullptr);
diff --git a/shell/browser/usb/usb_chooser_controller.cc b/shell/browser/usb/usb_chooser_controller.cc
index ae560d7ed3..ccee9919d8 100644
--- a/shell/browser/usb/usb_chooser_controller.cc
+++ b/shell/browser/usb/usb_chooser_controller.cc
@@ -126,9 +126,8 @@ void UsbChooserController::GotUsbDeviceList(
prevent_default =
session->Emit("select-usb-device", details,
- base::AdaptCallbackForRepeating(
- base::BindOnce(&UsbChooserController::OnDeviceChosen,
- weak_factory_.GetWeakPtr())));
+ base::BindRepeating(&UsbChooserController::OnDeviceChosen,
+ weak_factory_.GetWeakPtr()));
}
if (!prevent_default) {
RunCallback(/*device_info=*/nullptr);
|
chore
|
b7c9c895b5a60ddce41b8563703b5d8516c76983
|
Shelley Vohr
|
2023-09-27 16:09:53
|
build: fix with `enable_pdf_viewer = false` (#39990)
build: fix with enable_pdf_viewer = false
|
diff --git a/shell/browser/extensions/api/resources_private/resources_private_api.cc b/shell/browser/extensions/api/resources_private/resources_private_api.cc
index d834dd9931..99f6db952c 100644
--- a/shell/browser/extensions/api/resources_private/resources_private_api.cc
+++ b/shell/browser/extensions/api/resources_private/resources_private_api.cc
@@ -13,15 +13,15 @@
#include "chrome/grit/generated_resources.h"
#include "components/strings/grit/components_strings.h"
#include "components/zoom/page_zoom_constants.h"
-#include "pdf/buildflags.h"
+#include "electron/buildflags/buildflags.h"
#include "printing/buildflags/buildflags.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/webui/web_ui_util.h"
-#if BUILDFLAG(ENABLE_PDF)
+#if BUILDFLAG(ENABLE_PDF_VIEWER)
#include "chrome/browser/pdf/pdf_extension_util.h"
#include "pdf/pdf_features.h"
-#endif // BUILDFLAG(ENABLE_PDF)
+#endif // BUILDFLAG(ENABLE_PDF_VIEWER)
// To add a new component to this API, simply:
// 1. Add your component to the Component enum in
@@ -48,7 +48,7 @@ ExtensionFunction::ResponseAction ResourcesPrivateGetStringsFunction::Run() {
switch (component) {
case api::resources_private::COMPONENT_PDF:
-#if BUILDFLAG(ENABLE_PDF)
+#if BUILDFLAG(ENABLE_PDF_VIEWER)
pdf_extension_util::AddStrings(
pdf_extension_util::PdfViewerContext::kPdfViewer, &dict);
pdf_extension_util::AddAdditionalData(true, false, &dict);
|
build
|
2cda1443fce4dbb39393dffc3636d1214ab13f86
|
Samuel Attard
|
2022-10-03 23:36:17
|
fix: ensure mas builds of the same application can use safestorage (#35864)
feat: ensure mas builds of the same application can use safestorage
This change ensures that MAS builds of applications with an equivilant darwin build that share the same name do not fight over access to the same Safe Storage account.
Specifically this changes the account name for app "My App" from "My App" to "My App AppStore" if the app is using a MAS build of Electron.
We attempt to migrate the safe storage key from the old account, if that migration succeeds we delete the old key and move on.
Existing apps that aren't built for the app store should be unimpacted, there is one edge case where a user uses BOTH an AppStore and a darwin build of the same app only one will keep it's access to the safestorage key as during the migration we delete the old account. This is an acceptable edge case as no one should be actively using two versions of the same app.
|
diff --git a/patches/chromium/.patches b/patches/chromium/.patches
index 3b356b4ab0..3d99ad54ef 100644
--- a/patches/chromium/.patches
+++ b/patches/chromium/.patches
@@ -120,3 +120,4 @@ fix_crash_loading_non-standard_schemes_in_iframes.patch
disable_optimization_guide_for_preconnect_feature.patch
fix_return_v8_value_from_localframe_requestexecutescript.patch
create_browser_v8_snapshot_file_name_fuse.patch
+feat_ensure_mas_builds_of_the_same_application_can_use_safestorage.patch
diff --git a/patches/chromium/feat_ensure_mas_builds_of_the_same_application_can_use_safestorage.patch b/patches/chromium/feat_ensure_mas_builds_of_the_same_application_can_use_safestorage.patch
new file mode 100644
index 0000000000..4b279a6d3d
--- /dev/null
+++ b/patches/chromium/feat_ensure_mas_builds_of_the_same_application_can_use_safestorage.patch
@@ -0,0 +1,105 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Samuel Attard <[email protected]>
+Date: Thu, 29 Sep 2022 16:58:47 -0700
+Subject: feat: ensure mas builds of the same application can use safestorage
+
+This change ensures that MAS builds of applications with an equivilant darwin build that share the same name do not fight over access to the same Safe Storage account.
+
+Specifically this changes the account name for app "My App" from "My App" to "My App AppStore" if the app is using a MAS build of Electron.
+
+We attempt to migrate the safe storage key from the old account, if that migration succeeds we delete the old key and move on.
+
+Existing apps that aren't built for the app store should be unimpacted, there is one edge case where a user uses BOTH an AppStore and a darwin build of the same app only one will keep it's access to the safestorage key as during the migration we delete the old account. This is an acceptable edge case as no one should be actively using two versions of the same app.
+
+diff --git a/components/os_crypt/keychain_password_mac.mm b/components/os_crypt/keychain_password_mac.mm
+index 5589310e2e1f41a6a97e77bb57a7a71cd09a18be..ad81ca6726e265b43f30f12ee3f5a22f943298ac 100644
+--- a/components/os_crypt/keychain_password_mac.mm
++++ b/components/os_crypt/keychain_password_mac.mm
+@@ -22,6 +22,12 @@
+ using KeychainNameContainerType = const base::NoDestructor<std::string>;
+ #endif
+
++#if defined(MAS_BUILD)
++const char kAccountNameSuffix[] = " App Store Key";
++#else
++const char kAccountNameSuffix[] = " Key";
++#endif
++
+ namespace {
+
+ // These two strings ARE indeed user facing. But they are used to access
+@@ -82,11 +88,18 @@
+ std::string KeychainPassword::GetPassword() const {
+ UInt32 password_length = 0;
+ void* password_data = nullptr;
++ KeychainPassword::KeychainNameType service_name = GetServiceName();
++ KeychainPassword::KeychainNameType account_name = GetAccountName();
++ const std::string account_name_suffix = kAccountNameSuffix;
++ const std::string suffixed_account_name = account_name + account_name_suffix;
++
++ // We should check if the suffixed account exists first
+ OSStatus error = keychain_.FindGenericPassword(
+- GetServiceName().size(), GetServiceName().c_str(),
+- GetAccountName().size(), GetAccountName().c_str(), &password_length,
++ service_name.size(), service_name.c_str(),
++ suffixed_account_name.size(), suffixed_account_name.c_str(), &password_length,
+ &password_data, nullptr);
+
++ // If it exists we can return it immediately
+ if (error == noErr) {
+ std::string password =
+ std::string(static_cast<char*>(password_data), password_length);
+@@ -94,9 +107,52 @@
+ return password;
+ }
+
++ // If the error was anything other than "it does not exist" we should error out here
++ // This normally means the account exists but we were deniged access to it
++ if (error != errSecItemNotFound) {
++ OSSTATUS_LOG(ERROR, error) << "Keychain lookup for suffixed key failed";
++ return std::string();
++ }
++
++ // If the suffixed account didn't exist, we should check if the legacy non-suffixed account
++ // exists. If it does we can use that key and migrate it to the new account
++ base::ScopedCFTypeRef<SecKeychainItemRef> item_ref;
++ error = keychain_.FindGenericPassword(
++ service_name.size(), service_name.c_str(),
++ account_name.size(), account_name.c_str(), &password_length,
++ &password_data, item_ref.InitializeInto());
++
++ if (error == noErr) {
++ std::string password =
++ std::string(static_cast<char*>(password_data), password_length);
++
++ // If we found the legacy account name we should copy it over to
++ // the new suffixed account
++ error = keychain_.AddGenericPassword(
++ service_name.size(), service_name.data(), suffixed_account_name.size(),
++ suffixed_account_name.data(), password.size(), password_data, NULL);
++
++ if (error == noErr) {
++ // If we successfully made the suffixed account we can delete the old
++ // account to ensure new apps don't try to use it and run into IAM
++ // issues
++ error = keychain_.ItemDelete(item_ref.get());
++ if (error != noErr) {
++ OSSTATUS_DLOG(ERROR, error) << "Keychain delete for legacy key failed";
++ }
++ } else {
++ OSSTATUS_DLOG(ERROR, error) << "Keychain add for suffixed key failed";
++ }
++
++ keychain_.ItemFreeContent(password_data);
++ return password;
++ }
++
++ // If the legacy account name was not found, make a new account in the
++ // with the suffixed name
+ if (error == errSecItemNotFound) {
+ std::string password = AddRandomPasswordToKeychain(
+- keychain_, GetServiceName(), GetAccountName());
++ keychain_, service_name, suffixed_account_name);
+ return password;
+ }
+
|
fix
|
e19754d7fd4a24d058031121b0ac73b3fcb6e6cd
|
Samuel Attard
|
2024-05-13 10:48:26
|
test: add tests for electron fuses (#42129)
* spec: add tests for electron fuses
* spec: fix tests for windows
* spec: handle weird crash codes on win32
* spec: disable fuse tests on arm64 windows
|
diff --git a/shell/common/asar/archive.cc b/shell/common/asar/archive.cc
index b7e2a12ab2..edaae7b043 100644
--- a/shell/common/asar/archive.cc
+++ b/shell/common/asar/archive.cc
@@ -116,7 +116,7 @@ bool FillFileInfoWithNode(Archive::FileInfo* info,
info->executable = *executable;
}
-#if BUILDFLAG(IS_MAC)
+#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
if (load_integrity &&
electron::fuses::IsEmbeddedAsarIntegrityValidationEnabled()) {
if (const base::Value::Dict* integrity = node->FindDict("integrity")) {
diff --git a/spec/api-autoupdater-darwin-spec.ts b/spec/api-autoupdater-darwin-spec.ts
index 373ee884b7..48084c7b85 100644
--- a/spec/api-autoupdater-darwin-spec.ts
+++ b/spec/api-autoupdater-darwin-spec.ts
@@ -7,9 +7,10 @@ import * as path from 'node:path';
import * as psList from 'ps-list';
import { AddressInfo } from 'node:net';
import { ifdescribe, ifit } from './lib/spec-helpers';
-import { copyApp, getCodesignIdentity, shouldRunCodesignTests, signApp, spawn, withTempDirectory } from './lib/codesign-helpers';
+import { copyMacOSFixtureApp, getCodesignIdentity, shouldRunCodesignTests, signApp, spawn } from './lib/codesign-helpers';
import * as uuid from 'uuid';
import { autoUpdater, systemPreferences } from 'electron';
+import { withTempDirectory } from './lib/fs-helpers';
// We can only test the auto updater on darwin non-component builds
ifdescribe(shouldRunCodesignTests)('autoUpdater behavior', function () {
@@ -65,7 +66,7 @@ ifdescribe(shouldRunCodesignTests)('autoUpdater behavior', function () {
if (!cachedZips[key]) {
let updateZipPath: string;
await withTempDirectory(async (dir) => {
- const secondAppPath = await copyApp(dir, fixture);
+ const secondAppPath = await copyMacOSFixtureApp(dir, fixture);
const appPJPath = path.resolve(secondAppPath, 'Contents', 'Resources', 'app', 'package.json');
await fs.writeFile(
appPJPath,
@@ -98,7 +99,7 @@ ifdescribe(shouldRunCodesignTests)('autoUpdater behavior', function () {
// On arm64 builds the built app is self-signed by default so the setFeedURL call always works
ifit(process.arch !== 'arm64')('should fail to set the feed URL when the app is not signed', async () => {
await withTempDirectory(async (dir) => {
- const appPath = await copyApp(dir);
+ const appPath = await copyMacOSFixtureApp(dir);
const launchResult = await launchApp(appPath, ['http://myupdate']);
console.log(launchResult);
expect(launchResult.code).to.equal(1);
@@ -108,7 +109,7 @@ ifdescribe(shouldRunCodesignTests)('autoUpdater behavior', function () {
it('should cleanly set the feed URL when the app is signed', async () => {
await withTempDirectory(async (dir) => {
- const appPath = await copyApp(dir);
+ const appPath = await copyMacOSFixtureApp(dir);
await signApp(appPath, identity);
const launchResult = await launchApp(appPath, ['http://myupdate']);
expect(launchResult.code).to.equal(0);
@@ -149,7 +150,7 @@ ifdescribe(shouldRunCodesignTests)('autoUpdater behavior', function () {
it('should hit the update endpoint when checkForUpdates is called', async () => {
await withTempDirectory(async (dir) => {
- const appPath = await copyApp(dir, 'check');
+ const appPath = await copyMacOSFixtureApp(dir, 'check');
await signApp(appPath, identity);
server.get('/update-check', (req, res) => {
res.status(204).send();
@@ -166,7 +167,7 @@ ifdescribe(shouldRunCodesignTests)('autoUpdater behavior', function () {
it('should hit the update endpoint with customer headers when checkForUpdates is called', async () => {
await withTempDirectory(async (dir) => {
- const appPath = await copyApp(dir, 'check-with-headers');
+ const appPath = await copyMacOSFixtureApp(dir, 'check-with-headers');
await signApp(appPath, identity);
server.get('/update-check', (req, res) => {
res.status(204).send();
@@ -183,7 +184,7 @@ ifdescribe(shouldRunCodesignTests)('autoUpdater behavior', function () {
it('should hit the download endpoint when an update is available and error if the file is bad', async () => {
await withTempDirectory(async (dir) => {
- const appPath = await copyApp(dir, 'update');
+ const appPath = await copyMacOSFixtureApp(dir, 'update');
await signApp(appPath, identity);
server.get('/update-file', (req, res) => {
res.status(500).send('This is not a file');
@@ -217,7 +218,7 @@ ifdescribe(shouldRunCodesignTests)('autoUpdater behavior', function () {
mutateAppPostSign?: Mutation;
}, fn: (appPath: string, zipPath: string) => Promise<void>) => {
await withTempDirectory(async (dir) => {
- const appPath = await copyApp(dir, opts.startFixture);
+ const appPath = await copyMacOSFixtureApp(dir, opts.startFixture);
await opts.mutateAppPreSign?.mutate(appPath);
const infoPath = path.resolve(appPath, 'Contents', 'Info.plist');
await fs.writeFile(
diff --git a/spec/asar-integrity-spec.ts b/spec/asar-integrity-spec.ts
new file mode 100644
index 0000000000..e7cefbb0c3
--- /dev/null
+++ b/spec/asar-integrity-spec.ts
@@ -0,0 +1,189 @@
+import { expect } from 'chai';
+import * as cp from 'node:child_process';
+import * as nodeCrypto from 'node:crypto';
+import * as originalFs from 'node:original-fs';
+import * as fs from 'fs-extra';
+import * as os from 'node:os';
+import * as path from 'node:path';
+import { ifdescribe } from './lib/spec-helpers';
+
+import { getRawHeader } from '@electron/asar';
+import { resedit } from '@electron/packager/dist/resedit';
+import { flipFuses, FuseV1Config, FuseV1Options, FuseVersion } from '@electron/fuses';
+import { copyApp } from './lib/fs-helpers';
+
+const bufferReplace = (haystack: Buffer, needle: string, replacement: string, throwOnMissing = true): Buffer => {
+ const needleBuffer = Buffer.from(needle);
+ const idx = haystack.indexOf(needleBuffer);
+ if (idx === -1) {
+ if (throwOnMissing) throw new Error(`Needle ${needle} not found in haystack`);
+ return haystack;
+ }
+
+ const before = haystack.slice(0, idx);
+ const after = bufferReplace(haystack.slice(idx + needleBuffer.length), needle, replacement, false);
+ const len = idx + replacement.length + after.length;
+ return Buffer.concat([before, Buffer.from(replacement), after], len);
+};
+
+type SpawnResult = { code: number | null, out: string, signal: NodeJS.Signals | null };
+function spawn (cmd: string, args: string[], opts: any = {}) {
+ let out = '';
+ const child = cp.spawn(cmd, args, opts);
+ child.stdout.on('data', (chunk: Buffer) => {
+ out += chunk.toString();
+ });
+ child.stderr.on('data', (chunk: Buffer) => {
+ out += chunk.toString();
+ });
+ return new Promise<SpawnResult>((resolve) => {
+ child.on('exit', (code, signal) => {
+ resolve({
+ code,
+ signal,
+ out
+ });
+ });
+ });
+};
+
+const expectToHaveCrashed = (res: SpawnResult) => {
+ if (process.platform === 'win32') {
+ expect(res.code).to.not.equal(0);
+ expect(res.code).to.not.equal(null);
+ expect(res.signal).to.equal(null);
+ } else {
+ expect(res.code).to.equal(null);
+ expect(res.signal).to.equal('SIGTRAP');
+ }
+};
+
+describe('fuses', function () {
+ this.timeout(120000);
+
+ let tmpDir: string;
+ let appPath: string;
+
+ const launchApp = (args: string[] = []) => {
+ if (process.platform === 'darwin') {
+ return spawn(path.resolve(appPath, 'Contents/MacOS/Electron'), args);
+ }
+ return spawn(appPath, args);
+ };
+
+ const ensureFusesBeforeEach = (fuses: Omit<FuseV1Config<boolean>, 'version' | 'strictlyRequireAllFuses' | 'resetAdhocDarwinSignature'>) => {
+ beforeEach(async () => {
+ await flipFuses(appPath, {
+ version: FuseVersion.V1,
+ resetAdHocDarwinSignature: true,
+ ...fuses
+ });
+ });
+ };
+
+ beforeEach(async () => {
+ tmpDir = await fs.mkdtemp(path.resolve(os.tmpdir(), 'electron-asar-integrity-spec-'));
+ appPath = await copyApp(tmpDir);
+ });
+
+ afterEach(async () => {
+ for (let attempt = 0; attempt <= 3; attempt++) {
+ // Somtimes windows holds on to a DLL during the crash for a little bit, so we try a few times to delete it
+ if (attempt > 0) await new Promise((resolve) => setTimeout(resolve, 500 * attempt));
+ try {
+ await originalFs.promises.rm(tmpDir, { recursive: true });
+ break;
+ } catch {}
+ }
+ });
+
+ ifdescribe((process.platform === 'win32' && process.arch !== 'arm64') || process.platform === 'darwin')('ASAR Integrity', () => {
+ let pathToAsar: string;
+
+ beforeEach(async () => {
+ if (process.platform === 'darwin') {
+ pathToAsar = path.resolve(appPath, 'Contents', 'Resources', 'default_app.asar');
+ } else {
+ pathToAsar = path.resolve(path.dirname(appPath), 'resources', 'default_app.asar');
+ }
+
+ if (process.platform === 'win32') {
+ await resedit(appPath, {
+ asarIntegrity: {
+ 'resources\\default_app.asar': {
+ algorithm: 'SHA256',
+ hash: nodeCrypto.createHash('sha256').update(getRawHeader(pathToAsar).headerString).digest('hex')
+ }
+ }
+ });
+ }
+ });
+
+ describe('when enabled', () => {
+ ensureFusesBeforeEach({
+ [FuseV1Options.EnableEmbeddedAsarIntegrityValidation]: true
+ });
+
+ it('opens normally when unmodified', async () => {
+ const res = await launchApp([path.resolve(__dirname, 'fixtures/apps/hello/hello.js')]);
+ expect(res.code).to.equal(0);
+ expect(res.signal).to.equal(null);
+ expect(res.out).to.include('alive');
+ });
+
+ it('fatals if the integrity header does not match', async () => {
+ const asar = await originalFs.promises.readFile(pathToAsar);
+ // Ensure that the header stil starts with the same thing, if build system
+ // things result in the header changing we should update this test
+ expect(asar.toString()).to.contain('{"files":{"default_app.js"');
+ await originalFs.promises.writeFile(pathToAsar, bufferReplace(asar, '{"files":{"default_app.js"', '{"files":{"default_oop.js"'));
+
+ const res = await launchApp(['--version']);
+ expectToHaveCrashed(res);
+ expect(res.out).to.include('Integrity check failed for asar archive');
+ });
+
+ it('fatals if a loaded main process JS file does not match', async () => {
+ const asar = await originalFs.promises.readFile(pathToAsar);
+ // Ensure that the header stil starts with the same thing, if build system
+ // things result in the header changing we should update this test
+ expect(asar.toString()).to.contain('Invalid Usage');
+ await originalFs.promises.writeFile(pathToAsar, bufferReplace(asar, 'Invalid Usage', 'VVValid Usage'));
+
+ const res = await launchApp(['--version']);
+ expect(res.code).to.equal(1);
+ expect(res.signal).to.equal(null);
+ expect(res.out).to.include('ASAR Integrity Violation: got a hash mismatch');
+ });
+
+ it('fatals if a renderer content file does not match', async () => {
+ const asar = await originalFs.promises.readFile(pathToAsar);
+ // Ensure that the header stil starts with the same thing, if build system
+ // things result in the header changing we should update this test
+ expect(asar.toString()).to.contain('require-trusted-types-for');
+ await originalFs.promises.writeFile(pathToAsar, bufferReplace(asar, 'require-trusted-types-for', 'require-trusted-types-not'));
+
+ const res = await launchApp();
+ expectToHaveCrashed(res);
+ expect(res.out).to.include('Failed to validate block while ending ASAR file stream');
+ });
+ });
+
+ describe('when disabled', () => {
+ ensureFusesBeforeEach({
+ [FuseV1Options.EnableEmbeddedAsarIntegrityValidation]: false
+ });
+
+ it('does nothing if the integrity header does not match', async () => {
+ const asar = await originalFs.promises.readFile(pathToAsar);
+ // Ensure that the header stil starts with the same thing, if build system
+ // things result in the header changing we should update this test
+ expect(asar.toString()).to.contain('{"files":{"default_app.js"');
+ await originalFs.promises.writeFile(pathToAsar, bufferReplace(asar, '{"files":{"default_app.js"', '{"files":{"default_oop.js"'));
+
+ const res = await launchApp(['--version']);
+ expect(res.code).to.equal(0);
+ });
+ });
+ });
+});
diff --git a/spec/fixtures/apps/hello/hello.js b/spec/fixtures/apps/hello/hello.js
new file mode 100644
index 0000000000..6d9338ca85
--- /dev/null
+++ b/spec/fixtures/apps/hello/hello.js
@@ -0,0 +1,2 @@
+console.log('alive');
+process.exit(0);
diff --git a/spec/lib/codesign-helpers.ts b/spec/lib/codesign-helpers.ts
index 37f129c911..58c08b1e05 100644
--- a/spec/lib/codesign-helpers.ts
+++ b/spec/lib/codesign-helpers.ts
@@ -1,6 +1,5 @@
import * as cp from 'node:child_process';
import * as fs from 'fs-extra';
-import * as os from 'node:os';
import * as path from 'node:path';
import { expect } from 'chai';
@@ -32,7 +31,7 @@ export function getCodesignIdentity () {
return identity;
}
-export async function copyApp (newDir: string, fixture: string | null = 'initial') {
+export async function copyMacOSFixtureApp (newDir: string, fixture: string | null = 'initial') {
const appBundlePath = path.resolve(process.execPath, '../../..');
const newPath = path.resolve(newDir, 'Electron.app');
cp.spawnSync('cp', ['-R', appBundlePath, path.dirname(newPath)]);
@@ -86,14 +85,3 @@ export function spawn (cmd: string, args: string[], opts: any = {}) {
export function signApp (appPath: string, identity: string) {
return spawn('codesign', ['-s', identity, '--deep', '--force', appPath]);
};
-
-export async function withTempDirectory (fn: (dir: string) => Promise<void>, autoCleanUp = true) {
- const dir = await fs.mkdtemp(path.resolve(os.tmpdir(), 'electron-update-spec-'));
- try {
- await fn(dir);
- } finally {
- if (autoCleanUp) {
- cp.spawnSync('rm', ['-r', dir]);
- }
- }
-};
diff --git a/spec/lib/fs-helpers.ts b/spec/lib/fs-helpers.ts
new file mode 100644
index 0000000000..0367bccf47
--- /dev/null
+++ b/spec/lib/fs-helpers.ts
@@ -0,0 +1,40 @@
+import * as cp from 'node:child_process';
+import * as fs from 'original-fs';
+import * as fsExtra from 'fs-extra';
+import * as os from 'node:os';
+import * as path from 'node:path';
+
+export async function copyApp (targetDir: string): Promise<string> {
+ // On macOS we can just copy the app bundle, easier too because of symlinks
+ if (process.platform === 'darwin') {
+ const appBundlePath = path.resolve(process.execPath, '../../..');
+ const newPath = path.resolve(targetDir, 'Electron.app');
+ cp.spawnSync('cp', ['-R', appBundlePath, path.dirname(newPath)]);
+ return newPath;
+ }
+
+ // On windows and linux we should read the zip manifest files and then copy each of those files
+ // one by one
+ const baseDir = path.dirname(process.execPath);
+ const zipManifestPath = path.resolve(__dirname, '..', '..', 'script', 'zip_manifests', `dist_zip.${process.platform === 'win32' ? 'win' : 'linux'}.${process.arch}.manifest`);
+ const filesToCopy = (fs.readFileSync(zipManifestPath, 'utf-8')).split('\n').filter(f => f !== 'LICENSE' && f !== 'LICENSES.chromium.html' && f !== 'version' && f.trim());
+ await Promise.all(
+ filesToCopy.map(async rel => {
+ await fsExtra.mkdirp(path.dirname(path.resolve(targetDir, rel)));
+ fs.copyFileSync(path.resolve(baseDir, rel), path.resolve(targetDir, rel));
+ })
+ );
+
+ return path.resolve(targetDir, path.basename(process.execPath));
+}
+
+export async function withTempDirectory (fn: (dir: string) => Promise<void>, autoCleanUp = true) {
+ const dir = await fsExtra.mkdtemp(path.resolve(os.tmpdir(), 'electron-update-spec-'));
+ try {
+ await fn(dir);
+ } finally {
+ if (autoCleanUp) {
+ cp.spawnSync('rm', ['-r', dir]);
+ }
+ }
+};
diff --git a/spec/node-spec.ts b/spec/node-spec.ts
index df70e2ab2d..00141b9fa0 100644
--- a/spec/node-spec.ts
+++ b/spec/node-spec.ts
@@ -4,10 +4,11 @@ import * as fs from 'fs-extra';
import * as path from 'node:path';
import * as util from 'node:util';
import { getRemoteContext, ifdescribe, ifit, itremote, useRemoteContext } from './lib/spec-helpers';
-import { copyApp, getCodesignIdentity, shouldRunCodesignTests, signApp, spawn, withTempDirectory } from './lib/codesign-helpers';
+import { copyMacOSFixtureApp, getCodesignIdentity, shouldRunCodesignTests, signApp, spawn } from './lib/codesign-helpers';
import { webContents } from 'electron/main';
import { EventEmitter } from 'node:stream';
import { once } from 'node:events';
+import { withTempDirectory } from './lib/fs-helpers';
const mainFixturesPath = path.resolve(__dirname, 'fixtures');
@@ -683,7 +684,7 @@ describe('node feature', () => {
it('is disabled when invoked by other apps in ELECTRON_RUN_AS_NODE mode', async () => {
await withTempDirectory(async (dir) => {
- const appPath = await copyApp(dir);
+ const appPath = await copyMacOSFixtureApp(dir);
await signApp(appPath, identity);
// Invoke Electron by using the system node binary as middle layer, so
// the check of NODE_OPTIONS will think the process is started by other
@@ -696,7 +697,7 @@ describe('node feature', () => {
it('is disabled when invoked by alien binary in app bundle in ELECTRON_RUN_AS_NODE mode', async function () {
await withTempDirectory(async (dir) => {
- const appPath = await copyApp(dir);
+ const appPath = await copyMacOSFixtureApp(dir);
await signApp(appPath, identity);
// Find system node and copy it to app bundle.
const nodePath = process.env.PATH?.split(path.delimiter).find(dir => fs.existsSync(path.join(dir, 'node')));
@@ -715,7 +716,7 @@ describe('node feature', () => {
it('is respected when invoked from self', async () => {
await withTempDirectory(async (dir) => {
- const appPath = await copyApp(dir, null);
+ const appPath = await copyMacOSFixtureApp(dir, null);
await signApp(appPath, identity);
const appExePath = path.join(appPath, 'Contents/MacOS/Electron');
const { code, out } = await spawn(appExePath, [script, appExePath]);
diff --git a/spec/package.json b/spec/package.json
index fe1af9b97d..94f0f54246 100644
--- a/spec/package.json
+++ b/spec/package.json
@@ -10,6 +10,8 @@
"@electron-ci/echo": "file:./fixtures/native-addon/echo",
"@electron-ci/is-valid-window": "file:./is-valid-window",
"@electron-ci/uv-dlopen": "file:./fixtures/native-addon/uv-dlopen/",
+ "@electron/fuses": "^1.8.0",
+ "@electron/packager": "^18.3.2",
"@marshallofsound/mocha-appveyor-reporter": "^0.4.3",
"@types/sinon": "^9.0.4",
"@types/ws": "^7.2.0",
diff --git a/spec/yarn.lock b/spec/yarn.lock
index f9631143b7..f833f786fe 100644
--- a/spec/yarn.lock
+++ b/spec/yarn.lock
@@ -13,6 +13,116 @@
"@electron-ci/uv-dlopen@file:./fixtures/native-addon/uv-dlopen":
version "0.0.1"
+"@electron/asar@^3.2.1", "@electron/asar@^3.2.7":
+ version "3.2.10"
+ resolved "https://registry.yarnpkg.com/@electron/asar/-/asar-3.2.10.tgz#615cf346b734b23cafa4e0603551010bd0e50aa8"
+ integrity sha512-mvBSwIBUeiRscrCeJE1LwctAriBj65eUDm0Pc11iE5gRwzkmsdbS7FnZ1XUWjpSeQWL1L5g12Fc/SchPM9DUOw==
+ dependencies:
+ commander "^5.0.0"
+ glob "^7.1.6"
+ minimatch "^3.0.4"
+
+"@electron/fuses@^1.8.0":
+ version "1.8.0"
+ resolved "https://registry.yarnpkg.com/@electron/fuses/-/fuses-1.8.0.tgz#ad34d3cc4703b1258b83f6989917052cfc1490a0"
+ integrity sha512-zx0EIq78WlY/lBb1uXlziZmDZI4ubcCXIMJ4uGjXzZW0nS19TjSPeXPAjzzTmKQlJUZm0SbmZhPKP7tuQ1SsEw==
+ dependencies:
+ chalk "^4.1.1"
+ fs-extra "^9.0.1"
+ minimist "^1.2.5"
+
+"@electron/get@^3.0.0":
+ version "3.0.0"
+ resolved "https://registry.yarnpkg.com/@electron/get/-/get-3.0.0.tgz#2b0c794b98902d0bc5218546872c1379bef68aa2"
+ integrity sha512-hLv4BYFiyrNRI+U0Mm2X7RxCCdJLkDUn8GCEp9QJzbLpZRko+UaLlCjOMkj6TEtirNLPyBA7y1SeGfnpOB21aQ==
+ dependencies:
+ debug "^4.1.1"
+ env-paths "^2.2.0"
+ fs-extra "^8.1.0"
+ got "^11.8.5"
+ progress "^2.0.3"
+ semver "^6.2.0"
+ sumchecker "^3.0.1"
+ optionalDependencies:
+ global-agent "^3.0.0"
+
+"@electron/notarize@^2.1.0":
+ version "2.3.0"
+ resolved "https://registry.yarnpkg.com/@electron/notarize/-/notarize-2.3.0.tgz#9659cf6c92563dd69411afce229f52f9f7196227"
+ integrity sha512-EiTBU0BwE7HZZjAG1fFWQaiQpCuPrVGn7jPss1kUjD6eTTdXXd29RiZqEqkgN7xqt/Pgn4g3I7Saqovanrfj3w==
+ dependencies:
+ debug "^4.1.1"
+ fs-extra "^9.0.1"
+ promise-retry "^2.0.1"
+
+"@electron/osx-sign@^1.0.5":
+ version "1.2.0"
+ resolved "https://registry.yarnpkg.com/@electron/osx-sign/-/osx-sign-1.2.0.tgz#d1c83cac03e52f210858594eb011142a1ad0ae70"
+ integrity sha512-kOA3bAeDXFMj2JHj0R2fk/IT92qpu3tZHwM4l/PdksAuy7eA3/23QktCiAoQICwPdtxCYdt9ZLimKvnNyUpdSQ==
+ dependencies:
+ compare-version "^0.1.2"
+ debug "^4.3.4"
+ fs-extra "^10.0.0"
+ isbinaryfile "^4.0.8"
+ minimist "^1.2.6"
+ plist "^3.0.5"
+
+"@electron/packager@^18.3.2":
+ version "18.3.2"
+ resolved "https://registry.yarnpkg.com/@electron/packager/-/packager-18.3.2.tgz#49412a06b3233635bd9cdf87edf9cd9e2aa0567f"
+ integrity sha512-orjylavppgIh24qkNpWm2B/LQUpCS/YLOoKoU+eMK/hJgIhShLDsusPIQzgUGVwNCichu8/zPAGfdQZXHG0gtw==
+ dependencies:
+ "@electron/asar" "^3.2.1"
+ "@electron/get" "^3.0.0"
+ "@electron/notarize" "^2.1.0"
+ "@electron/osx-sign" "^1.0.5"
+ "@electron/universal" "^2.0.1"
+ "@electron/windows-sign" "^1.0.0"
+ debug "^4.0.1"
+ extract-zip "^2.0.0"
+ filenamify "^4.1.0"
+ fs-extra "^11.1.0"
+ galactus "^1.0.0"
+ get-package-info "^1.0.0"
+ junk "^3.1.0"
+ parse-author "^2.0.0"
+ plist "^3.0.0"
+ resedit "^2.0.0"
+ resolve "^1.1.6"
+ semver "^7.1.3"
+ yargs-parser "^21.1.1"
+
+"@electron/universal@^2.0.1":
+ version "2.0.1"
+ resolved "https://registry.yarnpkg.com/@electron/universal/-/universal-2.0.1.tgz#7b070ab355e02957388f3dbd68e2c3cd08c448ae"
+ integrity sha512-fKpv9kg4SPmt+hY7SVBnIYULE9QJl8L3sCfcBsnqbJwwBwAeTLokJ9TRt9y7bK0JAzIW2y78TVVjvnQEms/yyA==
+ dependencies:
+ "@electron/asar" "^3.2.7"
+ "@malept/cross-spawn-promise" "^2.0.0"
+ debug "^4.3.1"
+ dir-compare "^4.2.0"
+ fs-extra "^11.1.1"
+ minimatch "^9.0.3"
+ plist "^3.1.0"
+
+"@electron/windows-sign@^1.0.0":
+ version "1.1.2"
+ resolved "https://registry.yarnpkg.com/@electron/windows-sign/-/windows-sign-1.1.2.tgz#5489861ca62348d2300407e85d949af95849955e"
+ integrity sha512-eXEiZjDtxW3QORCWfRUarANPRTlH9B6At4jqBZJ0NzokSGutXQUVLPA6WmGpIhDW6w2yCMdHW1EJd1HrXtU5sg==
+ dependencies:
+ cross-dirname "^0.1.0"
+ debug "^4.3.4"
+ fs-extra "^11.1.1"
+ minimist "^1.2.8"
+ postject "^1.0.0-alpha.6"
+
+"@malept/cross-spawn-promise@^2.0.0":
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/@malept/cross-spawn-promise/-/cross-spawn-promise-2.0.0.tgz#d0772de1aa680a0bfb9ba2f32b4c828c7857cb9d"
+ integrity sha512-1DpKU0Z5ThltBwjNySMC14g0CkbyhCaz9FkhxqNsZI6uAPJXFS8cMXlBKo26FJ8ZuW6S9GCMcR9IO5k2X5/9Fg==
+ dependencies:
+ cross-spawn "^7.0.1"
+
"@marshallofsound/mocha-appveyor-reporter@^0.4.3":
version "0.4.3"
resolved "https://registry.yarnpkg.com/@marshallofsound/mocha-appveyor-reporter/-/mocha-appveyor-reporter-0.4.3.tgz#a9225224391a90e3c6bb48415d5015de895a7114"
@@ -120,7 +230,19 @@
dependencies:
"@types/node" "*"
-abstract-socket@^2.0.0, "abstract-socket@github:deepak1556/node-abstractsocket#928cc591decd12aff7dad96449da8afc29832c19":
+"@types/yauzl@^2.9.1":
+ version "2.10.3"
+ resolved "https://registry.yarnpkg.com/@types/yauzl/-/yauzl-2.10.3.tgz#e9b2808b4f109504a03cda958259876f61017999"
+ integrity sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q==
+ dependencies:
+ "@types/node" "*"
+
+"@xmldom/xmldom@^0.8.8":
+ version "0.8.10"
+ resolved "https://registry.yarnpkg.com/@xmldom/xmldom/-/xmldom-0.8.10.tgz#a1337ca426aa61cef9fe15b5b28e340a72f6fa99"
+ integrity sha512-2WALfTl4xo2SkGCYRt6rDTFfk9R1czmBvUQy12gK2KuRKIpWEhcbbzy8EZXtz/jkRqHX8bFEc6FC1HjX4TUWYw==
+
+"abstract-socket@github:deepak1556/node-abstractsocket#928cc591decd12aff7dad96449da8afc29832c19", "abstract-socket@github:saghul/node-abstractsocket#35b1b1491fabc04899bde5be3428abf5cf9cd528":
version "2.1.1"
resolved "https://codeload.github.com/deepak1556/node-abstractsocket/tar.gz/928cc591decd12aff7dad96449da8afc29832c19"
dependencies:
@@ -167,11 +289,26 @@ assertion-error@^1.1.0:
resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-1.1.0.tgz#e60b6b0e8f301bd97e5375215bda406c85118c0b"
integrity sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==
+at-least-node@^1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/at-least-node/-/at-least-node-1.0.0.tgz#602cd4b46e844ad4effc92a8011a3c46e0238dc2"
+ integrity sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==
+
+author-regex@^1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/author-regex/-/author-regex-1.0.0.tgz#d08885be6b9bbf9439fe087c76287245f0a81450"
+ integrity sha512-KbWgR8wOYRAPekEmMXrYYdc7BRyhn2Ftk7KWfMUnQ43hFdojWEFRxhhRUm3/OFEdPa1r0KAvTTg9YQK57xTe0g==
+
balanced-match@^1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee"
integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==
+base64-js@^1.5.1:
+ version "1.5.1"
+ resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a"
+ integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==
+
basic-auth@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/basic-auth/-/basic-auth-2.0.1.tgz#b998279bf47ce38344b4f3cf916d4679bbf51e3a"
@@ -191,6 +328,16 @@ bindings@^1.2.1:
dependencies:
file-uri-to-path "1.0.0"
+bluebird@^3.1.1:
+ version "3.7.2"
+ resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f"
+ integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==
+
+boolean@^3.0.1:
+ version "3.2.0"
+ resolved "https://registry.yarnpkg.com/boolean/-/boolean-3.2.0.tgz#9e5294af4e98314494cbb17979fa54ca159f116b"
+ integrity sha512-d0II/GO9uf9lfUHH2BQsjxzRJZBdsjgsBiW4BvhWk/3qoKwQFjIDVN19PfX8F2D/r9PCMTtLWjYVCFrpeYUzsw==
+
brace-expansion@^1.1.7:
version "1.1.11"
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd"
@@ -218,6 +365,11 @@ [email protected]:
resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.1.tgz#baa559ee14ced73452229bad7326467c61fabd60"
integrity sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==
+buffer-crc32@~0.2.3:
+ version "0.2.13"
+ resolved "https://registry.yarnpkg.com/buffer-crc32/-/buffer-crc32-0.2.13.tgz#0d333e3f00eac50aa1454abd30ef8c2a5d9a7242"
+ integrity sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==
+
busboy@^1.6.0:
version "1.6.0"
resolved "https://registry.yarnpkg.com/busboy/-/busboy-1.6.0.tgz#966ea36a9502e43cdb9146962523b92f531f6893"
@@ -268,7 +420,7 @@ chai@^4.2.0:
pathval "^1.1.1"
type-detect "^4.0.8"
-chalk@^4.1.0:
+chalk@^4.1.0, chalk@^4.1.1:
version "4.1.2"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01"
integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==
@@ -336,11 +488,40 @@ color-name@~1.1.4:
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2"
integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==
+commander@^5.0.0:
+ version "5.1.0"
+ resolved "https://registry.yarnpkg.com/commander/-/commander-5.1.0.tgz#46abbd1652f8e059bddaef99bbdcb2ad9cf179ae"
+ integrity sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg==
+
+commander@^9.4.0:
+ version "9.5.0"
+ resolved "https://registry.yarnpkg.com/commander/-/commander-9.5.0.tgz#bc08d1eb5cedf7ccb797a96199d41c7bc3e60d30"
+ integrity sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==
+
+compare-version@^0.1.2:
+ version "0.1.2"
+ resolved "https://registry.yarnpkg.com/compare-version/-/compare-version-0.1.2.tgz#0162ec2d9351f5ddd59a9202cba935366a725080"
+ integrity sha512-pJDh5/4wrEnXX/VWRZvruAGHkzKdr46z11OlTPN+VrATlWWhSKewNCJ1futCO5C7eJB3nPMFZA1LeYtcFboZ2A==
+
[email protected]:
version "0.0.1"
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==
+cross-dirname@^0.1.0:
+ version "0.1.0"
+ resolved "https://registry.yarnpkg.com/cross-dirname/-/cross-dirname-0.1.0.tgz#b899599f30a5389f59e78c150e19f957ad16a37c"
+ integrity sha512-+R08/oI0nl3vfPcqftZRpytksBXDzOUveBq/NBVx0sUp1axwzPQrKinNx5yd5sxPu8j1wIy8AfnVQ+5eFdha6Q==
+
+cross-spawn@^7.0.1:
+ version "7.0.3"
+ resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6"
+ integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==
+ dependencies:
+ path-key "^3.1.0"
+ shebang-command "^2.0.0"
+ which "^2.0.1"
+
[email protected]:
version "0.0.2"
resolved "https://registry.yarnpkg.com/crypt/-/crypt-0.0.2.tgz#88d7ff7ec0dfb86f713dc87bbb42d044d3e6c41b"
@@ -358,7 +539,7 @@ [email protected]:
safe-buffer "^5.1.1"
xml2js "^0.4.17"
optionalDependencies:
- abstract-socket "^2.0.0"
+ abstract-socket "github:saghul/node-abstractsocket#35b1b1491fabc04899bde5be3428abf5cf9cd528"
[email protected], debug@^2.2.0:
version "2.6.9"
@@ -367,7 +548,7 @@ [email protected], debug@^2.2.0:
dependencies:
ms "2.0.0"
[email protected], debug@^4.1.1:
[email protected], debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.4:
version "4.3.4"
resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865"
integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==
@@ -398,6 +579,24 @@ defer-to-connect@^2.0.0:
resolved "https://registry.yarnpkg.com/defer-to-connect/-/defer-to-connect-2.0.1.tgz#8016bdb4143e4632b77a3449c6236277de520587"
integrity sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg==
+define-data-property@^1.0.1:
+ version "1.1.4"
+ resolved "https://registry.yarnpkg.com/define-data-property/-/define-data-property-1.1.4.tgz#894dc141bb7d3060ae4366f6a0107e68fbe48c5e"
+ integrity sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==
+ dependencies:
+ es-define-property "^1.0.0"
+ es-errors "^1.3.0"
+ gopd "^1.0.1"
+
+define-properties@^1.2.1:
+ version "1.2.1"
+ resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.2.1.tgz#10781cc616eb951a80a034bafcaa7377f6af2b6c"
+ integrity sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==
+ dependencies:
+ define-data-property "^1.0.1"
+ has-property-descriptors "^1.0.0"
+ object-keys "^1.1.1"
+
depd@~1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/depd/-/depd-1.1.2.tgz#9bcd52e14c097763e749b274c4346ed2e560b5a9"
@@ -408,6 +607,11 @@ destroy@~1.0.4:
resolved "https://registry.yarnpkg.com/destroy/-/destroy-1.0.4.tgz#978857442c44749e4206613e37946205826abd80"
integrity sha512-3NdhDuEXnfun/z7x9GOElY49LoqVHoGScmOKwmxhsS8N5Y+Z8KyPPDnaSzqWgYt/ji4mqwfTS34Htrk0zPIXVg==
+detect-node@^2.0.4:
+ version "2.1.0"
+ resolved "https://registry.yarnpkg.com/detect-node/-/detect-node-2.1.0.tgz#c9c70775a49c3d03bc2c06d9a73be550f978f8b1"
+ integrity sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==
+
[email protected]:
version "5.0.0"
resolved "https://registry.yarnpkg.com/diff/-/diff-5.0.0.tgz#7ed6ad76d859d030787ec35855f5b1daf31d852b"
@@ -418,6 +622,14 @@ diff@^4.0.2:
resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d"
integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==
+dir-compare@^4.2.0:
+ version "4.2.0"
+ resolved "https://registry.yarnpkg.com/dir-compare/-/dir-compare-4.2.0.tgz#d1d4999c14fbf55281071fdae4293b3b9ce86f19"
+ integrity sha512-2xMCmOoMrdQIPHdsTawECdNPwlVFB9zGcz3kuhmBO6U3oU+UQjsue0i8ayLKpgBcm+hcXPMVSGUN9d+pvJ6+VQ==
+ dependencies:
+ minimatch "^3.0.5"
+ p-limit "^3.1.0 "
+
dirty-chai@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/dirty-chai/-/dirty-chai-2.0.1.tgz#6b2162ef17f7943589da840abc96e75bda01aff3"
@@ -455,6 +667,40 @@ end-of-stream@^1.1.0:
dependencies:
once "^1.4.0"
+env-paths@^2.2.0:
+ version "2.2.1"
+ resolved "https://registry.yarnpkg.com/env-paths/-/env-paths-2.2.1.tgz#420399d416ce1fbe9bc0a07c62fa68d67fd0f8f2"
+ integrity sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==
+
+err-code@^2.0.2:
+ version "2.0.3"
+ resolved "https://registry.yarnpkg.com/err-code/-/err-code-2.0.3.tgz#23c2f3b756ffdfc608d30e27c9a941024807e7f9"
+ integrity sha512-2bmlRpNKBxT/CRmPOlyISQpNj+qSeYvcym/uT0Jx2bMOlKLtSy1ZmLuVxSEKKyor/N5yhvp/ZiG1oE3DEYMSFA==
+
+error-ex@^1.2.0:
+ version "1.3.2"
+ resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf"
+ integrity sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==
+ dependencies:
+ is-arrayish "^0.2.1"
+
+es-define-property@^1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/es-define-property/-/es-define-property-1.0.0.tgz#c7faefbdff8b2696cf5f46921edfb77cc4ba3845"
+ integrity sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==
+ dependencies:
+ get-intrinsic "^1.2.4"
+
+es-errors@^1.3.0:
+ version "1.3.0"
+ resolved "https://registry.yarnpkg.com/es-errors/-/es-errors-1.3.0.tgz#05f75a25dab98e4fb1dcd5e1472c0546d5057c8f"
+ integrity sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==
+
+es6-error@^4.1.1:
+ version "4.1.1"
+ resolved "https://registry.yarnpkg.com/es6-error/-/es6-error-4.1.1.tgz#9e3af407459deed47e9a91f9b885a84eb05c561d"
+ integrity sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==
+
escalade@^3.1.1:
version "3.1.2"
resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.2.tgz#54076e9ab29ea5bf3d8f1ed62acffbb88272df27"
@@ -465,11 +711,16 @@ escape-html@~1.0.3:
resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988"
integrity sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==
[email protected]:
[email protected], escape-string-regexp@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34"
integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==
+escape-string-regexp@^1.0.2:
+ version "1.0.5"
+ resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
+ integrity sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==
+
etag@~1.8.1:
version "1.8.1"
resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887"
@@ -488,11 +739,43 @@ event-stream@^4.0.0:
stream-combiner "^0.2.2"
through "^2.3.8"
+extract-zip@^2.0.0:
+ version "2.0.1"
+ resolved "https://registry.yarnpkg.com/extract-zip/-/extract-zip-2.0.1.tgz#663dca56fe46df890d5f131ef4a06d22bb8ba13a"
+ integrity sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==
+ dependencies:
+ debug "^4.1.1"
+ get-stream "^5.1.0"
+ yauzl "^2.10.0"
+ optionalDependencies:
+ "@types/yauzl" "^2.9.1"
+
+fd-slicer@~1.1.0:
+ version "1.1.0"
+ resolved "https://registry.yarnpkg.com/fd-slicer/-/fd-slicer-1.1.0.tgz#25c7c89cb1f9077f8891bbe61d8f390eae256f1e"
+ integrity sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==
+ dependencies:
+ pend "~1.2.0"
+
[email protected]:
version "1.0.0"
resolved "https://registry.yarnpkg.com/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz#553a7b8446ff6f684359c445f1e37a05dacc33dd"
integrity sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==
+filename-reserved-regex@^2.0.0:
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/filename-reserved-regex/-/filename-reserved-regex-2.0.0.tgz#abf73dfab735d045440abfea2d91f389ebbfa229"
+ integrity sha512-lc1bnsSr4L4Bdif8Xb/qrtokGbq5zlsms/CYH8PP+WtCkGNF65DPiQY8vG3SakEdRn8Dlnm+gW/qWKKjS5sZzQ==
+
+filenamify@^4.1.0:
+ version "4.3.0"
+ resolved "https://registry.yarnpkg.com/filenamify/-/filenamify-4.3.0.tgz#62391cb58f02b09971c9d4f9d63b3cf9aba03106"
+ integrity sha512-hcFKyUG57yWGAzu1CMt/dPzYZuv+jAJUT85bL8mrXvNe6hWj6yEHEc4EdcgiA6Z3oi1/9wXJdZPXF2dZNgwgOg==
+ dependencies:
+ filename-reserved-regex "^2.0.0"
+ strip-outer "^1.0.1"
+ trim-repeated "^1.0.0"
+
fill-range@^7.0.1:
version "7.0.1"
resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40"
@@ -508,11 +791,26 @@ [email protected]:
locate-path "^6.0.0"
path-exists "^4.0.0"
+find-up@^2.0.0:
+ version "2.1.0"
+ resolved "https://registry.yarnpkg.com/find-up/-/find-up-2.1.0.tgz#45d1b7e506c717ddd482775a2b77920a3c0c57a7"
+ integrity sha512-NWzkk0jSJtTt08+FBFMvXoeZnOJD+jTtsRmBYbAIzJdX6l7dLgR7CTubCM5/eDdPUBvLCeVasP1brfVR/9/EZQ==
+ dependencies:
+ locate-path "^2.0.0"
+
flat@^5.0.2:
version "5.0.2"
resolved "https://registry.yarnpkg.com/flat/-/flat-5.0.2.tgz#8ca6fe332069ffa9d324c327198c598259ceb241"
integrity sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==
+flora-colossus@^2.0.0:
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/flora-colossus/-/flora-colossus-2.0.0.tgz#af1e85db0a8256ef05f3fb531c1235236c97220a"
+ integrity sha512-dz4HxH6pOvbUzZpZ/yXhafjbR2I8cenK5xL0KtBFb7U2ADsR+OwXifnxZjij/pZWF775uSCMzWVd+jDik2H2IA==
+ dependencies:
+ debug "^4.3.4"
+ fs-extra "^10.1.0"
+
[email protected]:
version "0.5.2"
resolved "https://registry.yarnpkg.com/fresh/-/fresh-0.5.2.tgz#3d8cadd90d976569fa835ab1f8e4b23a105605a7"
@@ -523,6 +821,43 @@ from@^0.1.7:
resolved "https://registry.yarnpkg.com/from/-/from-0.1.7.tgz#83c60afc58b9c56997007ed1a768b3ab303a44fe"
integrity sha512-twe20eF1OxVxp/ML/kq2p1uc6KvFK/+vs8WjEbeKmV2He22MKm7YF2ANIt+EOqhJ5L3K/SuuPhk0hWQDjOM23g==
+fs-extra@^10.0.0, fs-extra@^10.1.0:
+ version "10.1.0"
+ resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-10.1.0.tgz#02873cfbc4084dde127eaa5f9905eef2325d1abf"
+ integrity sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==
+ dependencies:
+ graceful-fs "^4.2.0"
+ jsonfile "^6.0.1"
+ universalify "^2.0.0"
+
+fs-extra@^11.1.0, fs-extra@^11.1.1:
+ version "11.2.0"
+ resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-11.2.0.tgz#e70e17dfad64232287d01929399e0ea7c86b0e5b"
+ integrity sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==
+ dependencies:
+ graceful-fs "^4.2.0"
+ jsonfile "^6.0.1"
+ universalify "^2.0.0"
+
+fs-extra@^8.1.0:
+ version "8.1.0"
+ resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-8.1.0.tgz#49d43c45a88cd9677668cb7be1b46efdb8d2e1c0"
+ integrity sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==
+ dependencies:
+ graceful-fs "^4.2.0"
+ jsonfile "^4.0.0"
+ universalify "^0.1.0"
+
+fs-extra@^9.0.1:
+ version "9.1.0"
+ resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.1.0.tgz#5954460c764a8da2094ba3554bf839e6b9a7c86d"
+ integrity sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==
+ dependencies:
+ at-least-node "^1.0.0"
+ graceful-fs "^4.2.0"
+ jsonfile "^6.0.1"
+ universalify "^2.0.0"
+
fs.realpath@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
@@ -533,6 +868,20 @@ fsevents@~2.3.2:
resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6"
integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==
+function-bind@^1.1.2:
+ version "1.1.2"
+ resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.2.tgz#2c02d864d97f3ea6c8830c464cbd11ab6eab7a1c"
+ integrity sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==
+
+galactus@^1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/galactus/-/galactus-1.0.0.tgz#c2615182afa0c6d0859b92e56ae36d052827db7e"
+ integrity sha512-R1fam6D4CyKQGNlvJne4dkNF+PvUUl7TAJInvTGa9fti9qAv95quQz29GXapA4d8Ec266mJJxFVh82M4GIIGDQ==
+ dependencies:
+ debug "^4.3.4"
+ flora-colossus "^2.0.0"
+ fs-extra "^10.1.0"
+
get-caller-file@^2.0.5:
version "2.0.5"
resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e"
@@ -543,6 +892,27 @@ get-func-name@^2.0.1, get-func-name@^2.0.2:
resolved "https://registry.yarnpkg.com/get-func-name/-/get-func-name-2.0.2.tgz#0d7cf20cd13fda808669ffa88f4ffc7a3943fc41"
integrity sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ==
+get-intrinsic@^1.1.3, get-intrinsic@^1.2.4:
+ version "1.2.4"
+ resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.2.4.tgz#e385f5a4b5227d449c3eabbad05494ef0abbeadd"
+ integrity sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==
+ dependencies:
+ es-errors "^1.3.0"
+ function-bind "^1.1.2"
+ has-proto "^1.0.1"
+ has-symbols "^1.0.3"
+ hasown "^2.0.0"
+
+get-package-info@^1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/get-package-info/-/get-package-info-1.0.0.tgz#6432796563e28113cd9474dbbd00052985a4999c"
+ integrity sha512-SCbprXGAPdIhKAXiG+Mk6yeoFH61JlYunqdFQFHDtLjJlDjFf6x07dsS8acO+xWt52jpdVo49AlVDnUVK1sDNw==
+ dependencies:
+ bluebird "^3.1.1"
+ debug "^2.2.0"
+ lodash.get "^4.0.0"
+ read-pkg-up "^2.0.0"
+
get-stream@^5.1.0:
version "5.2.0"
resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-5.2.0.tgz#4966a1795ee5ace65e706c4b7beb71257d6e22d3"
@@ -568,7 +938,7 @@ [email protected]:
minimatch "^5.0.1"
once "^1.3.0"
-glob@^7.1.3:
+glob@^7.1.3, glob@^7.1.6:
version "7.2.3"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b"
integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==
@@ -580,7 +950,34 @@ glob@^7.1.3:
once "^1.3.0"
path-is-absolute "^1.0.0"
-got@^11.8.6:
+global-agent@^3.0.0:
+ version "3.0.0"
+ resolved "https://registry.yarnpkg.com/global-agent/-/global-agent-3.0.0.tgz#ae7cd31bd3583b93c5a16437a1afe27cc33a1ab6"
+ integrity sha512-PT6XReJ+D07JvGoxQMkT6qji/jVNfX/h364XHZOWeRzy64sSFr+xJ5OX7LI3b4MPQzdL4H8Y8M0xzPpsVMwA8Q==
+ dependencies:
+ boolean "^3.0.1"
+ es6-error "^4.1.1"
+ matcher "^3.0.0"
+ roarr "^2.15.3"
+ semver "^7.3.2"
+ serialize-error "^7.0.1"
+
+globalthis@^1.0.1:
+ version "1.0.4"
+ resolved "https://registry.yarnpkg.com/globalthis/-/globalthis-1.0.4.tgz#7430ed3a975d97bfb59bcce41f5cabbafa651236"
+ integrity sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ==
+ dependencies:
+ define-properties "^1.2.1"
+ gopd "^1.0.1"
+
+gopd@^1.0.1:
+ version "1.0.1"
+ resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.0.1.tgz#29ff76de69dac7489b7c0918a5788e56477c332c"
+ integrity sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==
+ dependencies:
+ get-intrinsic "^1.1.3"
+
+got@^11.8.5, got@^11.8.6:
version "11.8.6"
resolved "https://registry.yarnpkg.com/got/-/got-11.8.6.tgz#276e827ead8772eddbcfc97170590b841823233a"
integrity sha512-6tfZ91bOr7bOXnK7PRDCGBLa1H4U080YHNaAQ2KsMGlLEzRbk44nsZF2E1IeRc3vtJHPVbKCYgdFbaGO2ljd8g==
@@ -597,7 +994,7 @@ got@^11.8.6:
p-cancelable "^2.0.0"
responselike "^2.0.0"
-graceful-fs@^4.1.15:
+graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.0:
version "4.2.11"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3"
integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==
@@ -607,6 +1004,30 @@ has-flag@^4.0.0:
resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b"
integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==
+has-property-descriptors@^1.0.0:
+ version "1.0.2"
+ resolved "https://registry.yarnpkg.com/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz#963ed7d071dc7bf5f084c5bfbe0d1b6222586854"
+ integrity sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==
+ dependencies:
+ es-define-property "^1.0.0"
+
+has-proto@^1.0.1:
+ version "1.0.3"
+ resolved "https://registry.yarnpkg.com/has-proto/-/has-proto-1.0.3.tgz#b31ddfe9b0e6e9914536a6ab286426d0214f77fd"
+ integrity sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==
+
+has-symbols@^1.0.3:
+ version "1.0.3"
+ resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.3.tgz#bb7b2c4349251dce87b125f7bdf874aa7c8b39f8"
+ integrity sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==
+
+hasown@^2.0.0:
+ version "2.0.2"
+ resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.2.tgz#003eaf91be7adc372e84ec59dc37252cedb80003"
+ integrity sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==
+ dependencies:
+ function-bind "^1.1.2"
+
[email protected]:
version "1.2.0"
resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f"
@@ -617,6 +1038,11 @@ hexy@^0.2.10:
resolved "https://registry.yarnpkg.com/hexy/-/hexy-0.2.11.tgz#9939c25cb6f86a91302f22b8a8a72573518e25b4"
integrity sha512-ciq6hFsSG/Bpt2DmrZJtv+56zpPdnq+NQ4ijEFrveKN0ZG1mhl/LdT1NQZ9se6ty1fACcI4d4vYqC9v8EYpH2A==
+hosted-git-info@^2.1.4:
+ version "2.8.9"
+ resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.9.tgz#dffc0bf9a21c02209090f2aa69429e1414daf3f9"
+ integrity sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==
+
http-cache-semantics@^4.0.0:
version "4.1.1"
resolved "https://registry.yarnpkg.com/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz#abe02fcb2985460bf0323be664436ec3476a6d5a"
@@ -658,6 +1084,11 @@ [email protected]:
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de"
integrity sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw==
+is-arrayish@^0.2.1:
+ version "0.2.1"
+ resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d"
+ integrity sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==
+
is-binary-path@~2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-2.1.0.tgz#ea1f7f3b80f064236e83470f86c09c254fb45b09"
@@ -670,6 +1101,13 @@ is-buffer@~1.1.6:
resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be"
integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==
+is-core-module@^2.13.0:
+ version "2.13.1"
+ resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.13.1.tgz#ad0d7532c6fea9da1ebdc82742d74525c6273384"
+ integrity sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==
+ dependencies:
+ hasown "^2.0.0"
+
is-extglob@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2"
@@ -707,6 +1145,16 @@ [email protected]:
resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf"
integrity sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ==
+isbinaryfile@^4.0.8:
+ version "4.0.10"
+ resolved "https://registry.yarnpkg.com/isbinaryfile/-/isbinaryfile-4.0.10.tgz#0c5b5e30c2557a2f06febd37b7322946aaee42b3"
+ integrity sha512-iHrqe5shvBUcFbmZq9zOQHBoeOhZJu6RQGrDpBgenUm/Am+F3JM2MgQj+rK3Z601fzrL5gLZWtAPH2OBaSVcyw==
+
+isexe@^2.0.0:
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10"
+ integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==
+
[email protected]:
version "4.1.0"
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602"
@@ -719,6 +1167,32 @@ [email protected]:
resolved "https://registry.yarnpkg.com/json-buffer/-/json-buffer-3.0.1.tgz#9338802a30d3b6605fbe0613e094008ca8c05a13"
integrity sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==
+json-stringify-safe@^5.0.1:
+ version "5.0.1"
+ resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb"
+ integrity sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==
+
+jsonfile@^4.0.0:
+ version "4.0.0"
+ resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb"
+ integrity sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==
+ optionalDependencies:
+ graceful-fs "^4.1.6"
+
+jsonfile@^6.0.1:
+ version "6.1.0"
+ resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.1.0.tgz#bc55b2634793c679ec6403094eb13698a6ec0aae"
+ integrity sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==
+ dependencies:
+ universalify "^2.0.0"
+ optionalDependencies:
+ graceful-fs "^4.1.6"
+
+junk@^3.1.0:
+ version "3.1.0"
+ resolved "https://registry.yarnpkg.com/junk/-/junk-3.1.0.tgz#31499098d902b7e98c5d9b9c80f43457a88abfa1"
+ integrity sha512-pBxcB3LFc8QVgdggvZWyeys+hnrNWg4OcZIU/1X59k5jQdLBlCsYGRQaz234SqoRLTCgMH00fY0xRJH+F9METQ==
+
just-extend@^4.0.2:
version "4.2.1"
resolved "https://registry.yarnpkg.com/just-extend/-/just-extend-4.2.1.tgz#ef5e589afb61e5d66b24eca749409a8939a8c744"
@@ -731,6 +1205,24 @@ keyv@^4.0.0:
dependencies:
json-buffer "3.0.1"
+load-json-file@^2.0.0:
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-2.0.0.tgz#7947e42149af80d696cbf797bcaabcfe1fe29ca8"
+ integrity sha512-3p6ZOGNbiX4CdvEd1VcE6yi78UrGNpjHO33noGwHCnT/o2fyllJDepsm8+mFFv/DvtwFHht5HIHSyOy5a+ChVQ==
+ dependencies:
+ graceful-fs "^4.1.2"
+ parse-json "^2.2.0"
+ pify "^2.0.0"
+ strip-bom "^3.0.0"
+
+locate-path@^2.0.0:
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e"
+ integrity sha512-NCI2kiDkyR7VeEKm27Kda/iQHyKJe1Bu0FlTbYp3CqJu+9IFe9bLyAjMxf5ZDDbEg+iMPzB5zYyUTSm8wVTKmA==
+ dependencies:
+ p-locate "^2.0.0"
+ path-exists "^3.0.0"
+
locate-path@^6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-6.0.0.tgz#55321eb309febbc59c4801d931a72452a681d286"
@@ -738,7 +1230,7 @@ locate-path@^6.0.0:
dependencies:
p-locate "^5.0.0"
-lodash.get@^4.4.2:
+lodash.get@^4.0.0, lodash.get@^4.4.2:
version "4.4.2"
resolved "https://registry.yarnpkg.com/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99"
integrity sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==
@@ -778,6 +1270,13 @@ [email protected]:
resolved "https://registry.yarnpkg.com/map-stream/-/map-stream-0.0.7.tgz#8a1f07896d82b10926bd3744a2420009f88974a8"
integrity sha512-C0X0KQmGm3N2ftbTGBhSyuydQ+vV1LC3f3zPvT3RXHXNZrvfPZcoXp/N5DOa8vedX/rTMm2CjTtivFg2STJMRQ==
+matcher@^3.0.0:
+ version "3.0.0"
+ resolved "https://registry.yarnpkg.com/matcher/-/matcher-3.0.0.tgz#bd9060f4c5b70aa8041ccc6f80368760994f30ca"
+ integrity sha512-OkeDaAZ/bQCxeFAozM55PKcKU0yJMPGifLwV4Qgjitu+5MoAfSQN4lsLJeXZ1b8w0x+/Emda6MZgXS1jvsapng==
+ dependencies:
+ escape-string-regexp "^4.0.0"
+
md5@^2.1.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/md5/-/md5-2.3.0.tgz#c3da9a6aae3a30b46b7b0c349b87b110dc3bda4f"
@@ -809,7 +1308,7 @@ [email protected]:
dependencies:
brace-expansion "^2.0.1"
-minimatch@^3.1.1:
+minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.1:
version "3.1.2"
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b"
integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==
@@ -823,12 +1322,19 @@ minimatch@^5.0.1:
dependencies:
brace-expansion "^2.0.1"
+minimatch@^9.0.3:
+ version "9.0.4"
+ resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.4.tgz#8e49c731d1749cbec05050ee5145147b32496a51"
+ integrity sha512-KqWh+VchfxcMNRAJjj2tnsSJdNbHsVgnkBhTNrW7AjVo6OvLtxw8zfT9oLw1JSohlFzJ8jCoTgaoXvJ+kHt6fw==
+ dependencies:
+ brace-expansion "^2.0.1"
+
[email protected], minimist@~0.0.1:
version "1.2.7"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.7.tgz#daa1c4d91f507390437c6a8bc01078e7000c4d18"
integrity sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==
-minimist@^1.2.6:
+minimist@^1.2.5, minimist@^1.2.6, minimist@^1.2.8:
version "1.2.8"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c"
integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==
@@ -919,6 +1425,16 @@ [email protected]:
resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-8.0.0.tgz#5453b7ad59dd040d12e0f1a97a6fa1c765c5c9d2"
integrity sha512-ipO7rsHEBqa9STO5C5T10fj732ml+5kLN1cAG8/jdHd56ldQeGj3Q7+scUS+VHK/qy1zLEwC4wMK5+yM0btPvw==
+normalize-package-data@^2.3.2:
+ version "2.5.0"
+ resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.5.0.tgz#e66db1838b200c1dfc233225d12cb36520e234a8"
+ integrity sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==
+ dependencies:
+ hosted-git-info "^2.1.4"
+ resolve "^1.10.0"
+ semver "2 || 3 || 4 || 5"
+ validate-npm-package-license "^3.0.1"
+
normalize-path@^3.0.0, normalize-path@~3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65"
@@ -929,6 +1445,11 @@ normalize-url@^6.0.1:
resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-6.1.0.tgz#40d0885b535deffe3f3147bec877d05fe4c5668a"
integrity sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A==
+object-keys@^1.1.1:
+ version "1.1.1"
+ resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e"
+ integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==
+
on-finished@~2.3.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.3.0.tgz#20f1336481b083cd75337992a16971aa2d906947"
@@ -956,13 +1477,27 @@ p-cancelable@^2.0.0:
resolved "https://registry.yarnpkg.com/p-cancelable/-/p-cancelable-2.1.1.tgz#aab7fbd416582fa32a3db49859c122487c5ed2cf"
integrity sha512-BZOr3nRQHOntUjTrH8+Lh54smKHoHyur8We1V8DSMVrl5A2malOOwuJRnKRDjSnkoeBh4at6BwEnb5I7Jl31wg==
-p-limit@^3.0.2:
+p-limit@^1.1.0:
+ version "1.3.0"
+ resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.3.0.tgz#b86bd5f0c25690911c7590fcbfc2010d54b3ccb8"
+ integrity sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==
+ dependencies:
+ p-try "^1.0.0"
+
+p-limit@^3.0.2, "p-limit@^3.1.0 ":
version "3.1.0"
resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-3.1.0.tgz#e1daccbe78d0d1388ca18c64fea38e3e57e3706b"
integrity sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==
dependencies:
yocto-queue "^0.1.0"
+p-locate@^2.0.0:
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-2.0.0.tgz#20a0103b222a70c8fd39cc2e580680f3dde5ec43"
+ integrity sha512-nQja7m7gSKuewoVRen45CtVfODR3crN3goVQ0DDZ9N3yHxgpkuBhZqsaiotSQRrADUrne346peY7kT3TSACykg==
+ dependencies:
+ p-limit "^1.1.0"
+
p-locate@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-5.0.0.tgz#83c8315c6785005e3bd021839411c9e110e6d834"
@@ -970,6 +1505,30 @@ p-locate@^5.0.0:
dependencies:
p-limit "^3.0.2"
+p-try@^1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/p-try/-/p-try-1.0.0.tgz#cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3"
+ integrity sha512-U1etNYuMJoIz3ZXSrrySFjsXQTWOx2/jdi86L+2pRvph/qMKL6sbcCYdH23fqsbm8TH2Gn0OybpT4eSFlCVHww==
+
+parse-author@^2.0.0:
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/parse-author/-/parse-author-2.0.0.tgz#d3460bf1ddd0dfaeed42da754242e65fb684a81f"
+ integrity sha512-yx5DfvkN8JsHL2xk2Os9oTia467qnvRgey4ahSm2X8epehBLx/gWLcy5KI+Y36ful5DzGbCS6RazqZGgy1gHNw==
+ dependencies:
+ author-regex "^1.0.0"
+
+parse-json@^2.2.0:
+ version "2.2.0"
+ resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-2.2.0.tgz#f480f40434ef80741f8469099f8dea18f55a4dc9"
+ integrity sha512-QR/GGaKCkhwk1ePQNYDRKYZ3mwU9ypsKhB0XyFnLQdomyEqk3e8wpW3V5Jp88zbxK4n5ST1nqo+g9juTpownhQ==
+ dependencies:
+ error-ex "^1.2.0"
+
+path-exists@^3.0.0:
+ version "3.0.0"
+ resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515"
+ integrity sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==
+
path-exists@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3"
@@ -980,6 +1539,16 @@ path-is-absolute@^1.0.0:
resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f"
integrity sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==
+path-key@^3.1.0:
+ version "3.1.1"
+ resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375"
+ integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==
+
+path-parse@^1.0.7:
+ version "1.0.7"
+ resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735"
+ integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==
+
path-to-regexp@^1.7.0:
version "1.8.0"
resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-1.8.0.tgz#887b3ba9d84393e87a0a0b9f4cb756198b53548a"
@@ -987,6 +1556,13 @@ path-to-regexp@^1.7.0:
dependencies:
isarray "0.0.1"
+path-type@^2.0.0:
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/path-type/-/path-type-2.0.0.tgz#f012ccb8415b7096fc2daa1054c3d72389594c73"
+ integrity sha512-dUnb5dXUf+kzhC/W/F4e5/SkluXIFf5VUHolW1Eg1irn1hGWjPGdsRcvYJ1nD6lhk8Ir7VM0bHJKsYTx8Jx9OQ==
+ dependencies:
+ pify "^2.0.0"
+
pathval@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/pathval/-/pathval-1.1.1.tgz#8534e77a77ce7ac5a2512ea21e0fdb8fcf6c3d8d"
@@ -1007,11 +1583,55 @@ pdfjs-dist@^2.16.105:
dommatrix "^1.0.3"
web-streams-polyfill "^3.2.1"
+pe-library@^1.0.1:
+ version "1.0.1"
+ resolved "https://registry.yarnpkg.com/pe-library/-/pe-library-1.0.1.tgz#02735430885a622576a53cd8827658b7d2fada0e"
+ integrity sha512-nh39Mo1eGWmZS7y+mK/dQIqg7S1lp38DpRxkyoHf0ZcUs/HDc+yyTjuOtTvSMZHmfSLuSQaX945u05Y2Q6UWZg==
+
+pend@~1.2.0:
+ version "1.2.0"
+ resolved "https://registry.yarnpkg.com/pend/-/pend-1.2.0.tgz#7a57eb550a6783f9115331fcf4663d5c8e007a50"
+ integrity sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==
+
picomatch@^2.0.4, picomatch@^2.2.1:
version "2.3.1"
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42"
integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==
+pify@^2.0.0:
+ version "2.3.0"
+ resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c"
+ integrity sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==
+
+plist@^3.0.0, plist@^3.0.5, plist@^3.1.0:
+ version "3.1.0"
+ resolved "https://registry.yarnpkg.com/plist/-/plist-3.1.0.tgz#797a516a93e62f5bde55e0b9cc9c967f860893c9"
+ integrity sha512-uysumyrvkUX0rX/dEVqt8gC3sTBzd4zoWfLeS29nb53imdaXVvLINYXTI2GNqzaMuvacNx4uJQ8+b3zXR0pkgQ==
+ dependencies:
+ "@xmldom/xmldom" "^0.8.8"
+ base64-js "^1.5.1"
+ xmlbuilder "^15.1.1"
+
+postject@^1.0.0-alpha.6:
+ version "1.0.0-alpha.6"
+ resolved "https://registry.yarnpkg.com/postject/-/postject-1.0.0-alpha.6.tgz#9d022332272e2cfce8dea4cfce1ee6dd1b2ee135"
+ integrity sha512-b9Eb8h2eVqNE8edvKdwqkrY6O7kAwmI8kcnBv1NScolYJbo59XUF0noFq+lxbC1yN20bmC0WBEbDC5H/7ASb0A==
+ dependencies:
+ commander "^9.4.0"
+
+progress@^2.0.3:
+ version "2.0.3"
+ resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8"
+ integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==
+
+promise-retry@^2.0.1:
+ version "2.0.1"
+ resolved "https://registry.yarnpkg.com/promise-retry/-/promise-retry-2.0.1.tgz#ff747a13620ab57ba688f5fc67855410c370da22"
+ integrity sha512-y+WKFlBR8BGXnsNlIHFGPZmyDf3DFMoLhaflAnyZgV6rG6xu+JwesTo2Q9R6XwYmtmwAFCkAk3e35jEdoeh/3g==
+ dependencies:
+ err-code "^2.0.2"
+ retry "^0.12.0"
+
ps-list@^7.0.0:
version "7.2.0"
resolved "https://registry.yarnpkg.com/ps-list/-/ps-list-7.2.0.tgz#3d110e1de8249a4b178c9b1cf2a215d1e4e42fc0"
@@ -1047,6 +1667,23 @@ range-parser@~1.2.0:
resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.1.tgz#3cf37023d199e1c24d1a55b84800c2f3e6468031"
integrity sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==
+read-pkg-up@^2.0.0:
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-2.0.0.tgz#6b72a8048984e0c41e79510fd5e9fa99b3b549be"
+ integrity sha512-1orxQfbWGUiTn9XsPlChs6rLie/AV9jwZTGmu2NZw/CUDJQchXJFYE0Fq5j7+n558T1JhDWLdhyd1Zj+wLY//w==
+ dependencies:
+ find-up "^2.0.0"
+ read-pkg "^2.0.0"
+
+read-pkg@^2.0.0:
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-2.0.0.tgz#8ef1c0623c6a6db0dc6713c4bfac46332b2368f8"
+ integrity sha512-eFIBOPW7FGjzBuk3hdXEuNSiTZS/xEMlH49HxMyzb0hyPfu4EhVjT2DH32K1hSSmVq4sebAWnZuuY5auISUTGA==
+ dependencies:
+ load-json-file "^2.0.0"
+ normalize-package-data "^2.3.2"
+ path-type "^2.0.0"
+
readdirp@~3.6.0:
version "3.6.0"
resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.6.0.tgz#74a370bd857116e245b29cc97340cd431a02a6c7"
@@ -1059,11 +1696,27 @@ require-directory@^2.1.1:
resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42"
integrity sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==
+resedit@^2.0.0:
+ version "2.0.2"
+ resolved "https://registry.yarnpkg.com/resedit/-/resedit-2.0.2.tgz#875adfb3eb975e27e4d0bec1214b8ccc37509d5d"
+ integrity sha512-UKTnq602iVe+W5SyRAQx/WdWMnlDiONfXBLFg/ur4QE4EQQ8eP7Jgm5mNXdK12kKawk1vvXPja2iXKqZiGDW6Q==
+ dependencies:
+ pe-library "^1.0.1"
+
resolve-alpn@^1.0.0:
version "1.2.1"
resolved "https://registry.yarnpkg.com/resolve-alpn/-/resolve-alpn-1.2.1.tgz#b7adbdac3546aaaec20b45e7d8265927072726f9"
integrity sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g==
+resolve@^1.1.6, resolve@^1.10.0:
+ version "1.22.8"
+ resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.8.tgz#b6c87a9f2aa06dfab52e3d70ac8cde321fa5a48d"
+ integrity sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==
+ dependencies:
+ is-core-module "^2.13.0"
+ path-parse "^1.0.7"
+ supports-preserve-symlinks-flag "^1.0.0"
+
responselike@^2.0.0:
version "2.0.1"
resolved "https://registry.yarnpkg.com/responselike/-/responselike-2.0.1.tgz#9a0bc8fdc252f3fb1cca68b016591059ba1422bc"
@@ -1071,6 +1724,11 @@ responselike@^2.0.0:
dependencies:
lowercase-keys "^2.0.0"
+retry@^0.12.0:
+ version "0.12.0"
+ resolved "https://registry.yarnpkg.com/retry/-/retry-0.12.0.tgz#1b42a6266a21f07421d1b0b54b7dc167b01c013b"
+ integrity sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow==
+
rimraf@~2.6.2:
version "2.6.3"
resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.3.tgz#b2d104fe0d8fb27cf9e0a1cda8262dd3833c6cab"
@@ -1078,6 +1736,18 @@ rimraf@~2.6.2:
dependencies:
glob "^7.1.3"
+roarr@^2.15.3:
+ version "2.15.4"
+ resolved "https://registry.yarnpkg.com/roarr/-/roarr-2.15.4.tgz#f5fe795b7b838ccfe35dc608e0282b9eba2e7afd"
+ integrity sha512-CHhPh+UNHD2GTXNYhPWLnU8ONHdI+5DI+4EYIAOaiD63rHeYlZvyh8P+in5999TTSFgUYuKUAjzRI4mdh/p+2A==
+ dependencies:
+ boolean "^3.0.1"
+ detect-node "^2.0.4"
+ globalthis "^1.0.1"
+ json-stringify-safe "^5.0.1"
+ semver-compare "^1.0.0"
+ sprintf-js "^1.1.2"
+
[email protected]:
version "5.1.2"
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d"
@@ -1093,6 +1763,26 @@ sax@>=0.6.0:
resolved "https://registry.yarnpkg.com/sax/-/sax-1.3.0.tgz#a5dbe77db3be05c9d1ee7785dbd3ea9de51593d0"
integrity sha512-0s+oAmw9zLl1V1cS9BtZN7JAd0cW5e0QH4W3LWEK6a4LaLEA2OTpGYWDY+6XasBLtz6wkm3u1xRw95mRuJ59WA==
+semver-compare@^1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/semver-compare/-/semver-compare-1.0.0.tgz#0dee216a1c941ab37e9efb1788f6afc5ff5537fc"
+ integrity sha512-YM3/ITh2MJ5MtzaM429anh+x2jiLVjqILF4m4oyQB18W7Ggea7BfqdH/wGMK7dDiMghv/6WG7znWMwUDzJiXow==
+
+"semver@2 || 3 || 4 || 5":
+ version "5.7.2"
+ resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.2.tgz#48d55db737c3287cd4835e17fa13feace1c41ef8"
+ integrity sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==
+
+semver@^6.2.0:
+ version "6.3.1"
+ resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4"
+ integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==
+
+semver@^7.1.3, semver@^7.3.2:
+ version "7.6.2"
+ resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.2.tgz#1e3b34759f896e8f14d6134732ce798aeb0c6e13"
+ integrity sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==
+
send@^0.16.2:
version "0.16.2"
resolved "https://registry.yarnpkg.com/send/-/send-0.16.2.tgz#6ecca1e0f8c156d141597559848df64730a6bbc1"
@@ -1112,6 +1802,13 @@ send@^0.16.2:
range-parser "~1.2.0"
statuses "~1.4.0"
+serialize-error@^7.0.1:
+ version "7.0.1"
+ resolved "https://registry.yarnpkg.com/serialize-error/-/serialize-error-7.0.1.tgz#f1360b0447f61ffb483ec4157c737fab7d778e18"
+ integrity sha512-8I8TjW5KMOKsZQTvoxjuSIa7foAwPWGOts+6o7sgjz41/qMD9VQHEDxi6PBvK2l0MXUmqZyNpUK+T2tQaaElvw==
+ dependencies:
+ type-fest "^0.13.1"
+
[email protected]:
version "6.0.0"
resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-6.0.0.tgz#efae5d88f45d7924141da8b5c3a7a7e663fefeb8"
@@ -1124,6 +1821,18 @@ [email protected]:
resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.1.0.tgz#d0bd85536887b6fe7c0d818cb962d9d91c54e656"
integrity sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==
+shebang-command@^2.0.0:
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea"
+ integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==
+ dependencies:
+ shebang-regex "^3.0.0"
+
+shebang-regex@^3.0.0:
+ version "3.0.0"
+ resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172"
+ integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==
+
sinon@^9.0.1:
version "9.2.4"
resolved "https://registry.yarnpkg.com/sinon/-/sinon-9.2.4.tgz#e55af4d3b174a4443a8762fa8421c2976683752b"
@@ -1136,6 +1845,32 @@ sinon@^9.0.1:
nise "^4.0.4"
supports-color "^7.1.0"
+spdx-correct@^3.0.0:
+ version "3.2.0"
+ resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.2.0.tgz#4f5ab0668f0059e34f9c00dce331784a12de4e9c"
+ integrity sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA==
+ dependencies:
+ spdx-expression-parse "^3.0.0"
+ spdx-license-ids "^3.0.0"
+
+spdx-exceptions@^2.1.0:
+ version "2.5.0"
+ resolved "https://registry.yarnpkg.com/spdx-exceptions/-/spdx-exceptions-2.5.0.tgz#5d607d27fc806f66d7b64a766650fa890f04ed66"
+ integrity sha512-PiU42r+xO4UbUS1buo3LPJkjlO7430Xn5SVAhdpzzsPHsjbYVflnnFdATgabnLude+Cqu25p6N+g2lw/PFsa4w==
+
+spdx-expression-parse@^3.0.0:
+ version "3.0.1"
+ resolved "https://registry.yarnpkg.com/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz#cf70f50482eefdc98e3ce0a6833e4a53ceeba679"
+ integrity sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==
+ dependencies:
+ spdx-exceptions "^2.1.0"
+ spdx-license-ids "^3.0.0"
+
+spdx-license-ids@^3.0.0:
+ version "3.0.17"
+ resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.17.tgz#887da8aa73218e51a1d917502d79863161a93f9c"
+ integrity sha512-sh8PWc/ftMqAAdFiBu6Fy6JUOYjqDJBJvIhpfDMyHrr0Rbp5liZqd4TjtQ/RgfLjKFZb+LMx5hpml5qOWy0qvg==
+
split@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/split/-/split-1.0.1.tgz#605bd9be303aa59fb35f9229fbea0ddec9ea07d9"
@@ -1143,6 +1878,11 @@ split@^1.0.1:
dependencies:
through "2"
+sprintf-js@^1.1.2:
+ version "1.1.3"
+ resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.1.3.tgz#4914b903a2f8b685d17fdf78a70e917e872e444a"
+ integrity sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA==
+
"statuses@>= 1.4.0 < 2":
version "1.5.0"
resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c"
@@ -1189,11 +1929,30 @@ strip-ansi@^6.0.0, strip-ansi@^6.0.1:
dependencies:
ansi-regex "^5.0.1"
+strip-bom@^3.0.0:
+ version "3.0.0"
+ resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3"
+ integrity sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==
+
[email protected]:
version "3.1.1"
resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006"
integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==
+strip-outer@^1.0.1:
+ version "1.0.1"
+ resolved "https://registry.yarnpkg.com/strip-outer/-/strip-outer-1.0.1.tgz#b2fd2abf6604b9d1e6013057195df836b8a9d631"
+ integrity sha512-k55yxKHwaXnpYGsOzg4Vl8+tDrWylxDEpknGjhTiZB8dFRU5rTo9CAzeycivxV3s+zlTKwrs6WxMxR95n26kwg==
+ dependencies:
+ escape-string-regexp "^1.0.2"
+
+sumchecker@^3.0.1:
+ version "3.0.1"
+ resolved "https://registry.yarnpkg.com/sumchecker/-/sumchecker-3.0.1.tgz#6377e996795abb0b6d348e9b3e1dfb24345a8e42"
+ integrity sha512-MvjXzkz/BOfyVDkG0oFOtBxHX2u3gKbMHIF/dXblZsgD3BWOFLmHovIpZY7BykJdAjcqRCBi1WYBNdEC9yI7vg==
+ dependencies:
+ debug "^4.1.0"
+
[email protected]:
version "8.1.1"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c"
@@ -1208,6 +1967,11 @@ supports-color@^7.1.0:
dependencies:
has-flag "^4.0.0"
+supports-preserve-symlinks-flag@^1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09"
+ integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==
+
temp@^0.9.0:
version "0.9.4"
resolved "https://registry.yarnpkg.com/temp/-/temp-0.9.4.tgz#cd20a8580cb63635d0e4e9d4bd989d44286e7620"
@@ -1228,21 +1992,51 @@ to-regex-range@^5.0.1:
dependencies:
is-number "^7.0.0"
+trim-repeated@^1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/trim-repeated/-/trim-repeated-1.0.0.tgz#e3646a2ea4e891312bf7eace6cfb05380bc01c21"
+ integrity sha512-pkonvlKk8/ZuR0D5tLW8ljt5I8kmxp2XKymhepUeOdCEfKpZaktSArkLHZt76OB1ZvO9bssUsDty4SWhLvZpLg==
+ dependencies:
+ escape-string-regexp "^1.0.2"
+
[email protected], type-detect@^4.0.0, type-detect@^4.0.8:
version "4.0.8"
resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c"
integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==
+type-fest@^0.13.1:
+ version "0.13.1"
+ resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.13.1.tgz#0172cb5bce80b0bd542ea348db50c7e21834d934"
+ integrity sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg==
+
undici-types@~5.26.4:
version "5.26.5"
resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617"
integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==
+universalify@^0.1.0:
+ version "0.1.2"
+ resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66"
+ integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==
+
+universalify@^2.0.0:
+ version "2.0.1"
+ resolved "https://registry.yarnpkg.com/universalify/-/universalify-2.0.1.tgz#168efc2180964e6386d061e094df61afe239b18d"
+ integrity sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==
+
uuid@^3.3.3:
version "3.4.0"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee"
integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==
+validate-npm-package-license@^3.0.1:
+ version "3.0.4"
+ resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz#fc91f6b9c7ba15c857f4cb2c5defeec39d4f410a"
+ integrity sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==
+ dependencies:
+ spdx-correct "^3.0.0"
+ spdx-expression-parse "^3.0.0"
+
walkdir@^0.3.2:
version "0.3.2"
resolved "https://registry.yarnpkg.com/walkdir/-/walkdir-0.3.2.tgz#ac8437a288c295656848ebc19981ebc677a5f590"
@@ -1253,6 +2047,13 @@ web-streams-polyfill@^3.2.1:
resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz#2073b91a2fdb1fbfbd401e7de0ac9f8214cecb4b"
integrity sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==
+which@^2.0.1:
+ version "2.0.2"
+ resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1"
+ integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==
+ dependencies:
+ isexe "^2.0.0"
+
[email protected]:
version "1.2.4"
resolved "https://registry.yarnpkg.com/winreg/-/winreg-1.2.4.tgz#ba065629b7a925130e15779108cf540990e98d1b"
@@ -1300,6 +2101,11 @@ xml@^1.0.0:
resolved "https://registry.yarnpkg.com/xml/-/xml-1.0.1.tgz#78ba72020029c5bc87b8a81a3cfcd74b4a2fc1e5"
integrity sha512-huCv9IH9Tcf95zuYCsQraZtWnJvBtLVE0QHMOs8bWyZAFZNDcYjsPq1nEx8jKA9y+Beo9v+7OBPRisQTjinQMw==
+xmlbuilder@^15.1.1:
+ version "15.1.1"
+ resolved "https://registry.yarnpkg.com/xmlbuilder/-/xmlbuilder-15.1.1.tgz#9dcdce49eea66d8d10b42cae94a79c3c8d0c2ec5"
+ integrity sha512-yMqGBqtXyeN1e3TGYvgNgDVZ3j84W4cwkOXQswghol6APgZWaff9lnbvN7MHYJOiXsvGPXtjTYJEiC9J2wv9Eg==
+
xmlbuilder@~11.0.0:
version "11.0.1"
resolved "https://registry.yarnpkg.com/xmlbuilder/-/xmlbuilder-11.0.1.tgz#be9bae1c8a046e76b31127726347d0ad7002beb3"
@@ -1320,6 +2126,11 @@ yargs-parser@^20.2.2:
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.9.tgz#2eb7dc3b0289718fc295f362753845c41a0c94ee"
integrity sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==
+yargs-parser@^21.1.1:
+ version "21.1.1"
+ resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35"
+ integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==
+
[email protected]:
version "2.0.0"
resolved "https://registry.yarnpkg.com/yargs-unparser/-/yargs-unparser-2.0.0.tgz#f131f9226911ae5d9ad38c432fe809366c2325eb"
@@ -1343,6 +2154,14 @@ [email protected], yargs@^16.0.3:
y18n "^5.0.5"
yargs-parser "^20.2.2"
+yauzl@^2.10.0:
+ version "2.10.0"
+ resolved "https://registry.yarnpkg.com/yauzl/-/yauzl-2.10.0.tgz#c7eb17c93e112cb1086fa6d8e51fb0667b79a5f9"
+ integrity sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g==
+ dependencies:
+ buffer-crc32 "~0.2.3"
+ fd-slicer "~1.1.0"
+
yocto-queue@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b"
|
test
|
0285592d619f4689a2a98f999b81c132e49a1a23
|
Shelley Vohr
|
2024-11-22 15:37:17
|
fix: crash calling `shell.readShortcutLink` (#44784)
fix: crash calling shell.readShortcutLink
|
diff --git a/patches/chromium/.patches b/patches/chromium/.patches
index ea5efd980e..07932bcf0d 100644
--- a/patches/chromium/.patches
+++ b/patches/chromium/.patches
@@ -135,3 +135,4 @@ chore_partial_revert_of.patch
fix_software_compositing_infinite_loop.patch
refactor_unfilter_unresponsive_events.patch
build_disable_thin_lto_mac.patch
+support_bstr_pkey_appusermodel_id_in_windows_shortcuts.patch
diff --git a/patches/chromium/support_bstr_pkey_appusermodel_id_in_windows_shortcuts.patch b/patches/chromium/support_bstr_pkey_appusermodel_id_in_windows_shortcuts.patch
new file mode 100644
index 0000000000..a72bae1ad2
--- /dev/null
+++ b/patches/chromium/support_bstr_pkey_appusermodel_id_in_windows_shortcuts.patch
@@ -0,0 +1,47 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Shelley Vohr <[email protected]>
+Date: Thu, 21 Nov 2024 14:23:17 +0100
+Subject: Support BSTR PKEY_AppUserModel_ID in Windows Shortcuts
+
+It's possible for a shortcut link on Windows to be BSTR format;
+this resulted in a DCHECK previously but as of the NOTREACHED
+fatal migration now will crash a given app. This has created an
+issue for Electron, which allows providing the shortcut information
+to end users. This CL thus allows for supporting VT_BSTR variants
+for PKEY_AppUserModel_ID and mitigates a crash. One such example
+is https://github.com/wez/wezterm, which after this change
+correctly gets an appUserModelId of 'org.wezfurlong.wezterm'.
+
+Bug: N/A
+Change-Id: I5ad114bc345059637465b68a53a2f3f8c42de898
+
+diff --git a/base/win/shortcut.cc b/base/win/shortcut.cc
+index d4a54d1afdc121192f9c0321c6ced584ee066486..02f3e63d16c3324f546f6155d722900f0a81131a 100644
+--- a/base/win/shortcut.cc
++++ b/base/win/shortcut.cc
+@@ -289,14 +289,22 @@ bool ResolveShortcutProperties(const FilePath& shortcut_path,
+ return false;
+ }
+ switch (pv_app_id.get().vt) {
+- case VT_EMPTY:
++ case VT_EMPTY: {
+ properties->set_app_id(std::wstring());
+ break;
+- case VT_LPWSTR:
++ }
++ case VT_LPWSTR: {
+ properties->set_app_id(pv_app_id.get().pwszVal);
+ break;
+- default:
++ }
++ case VT_BSTR: {
++ BSTR bs = pv_app_id.get().bstrVal;
++ properties->set_app_id(std::wstring(bs, ::SysStringLen(bs)));
++ break;
++ }
++ default: {
+ NOTREACHED() << "Unexpected variant type: " << pv_app_id.get().vt;
++ }
+ }
+ }
+
|
fix
|
670e0ca0766fd175d75e0ca5e3c9ce5335b0a2c5
|
Charles Kerr
|
2025-02-19 00:00:01
|
chore: disable 'should lock the keyboard' test on macOS (#45681)
|
diff --git a/spec/chromium-spec.ts b/spec/chromium-spec.ts
index a925e5b055..ae1004554a 100644
--- a/spec/chromium-spec.ts
+++ b/spec/chromium-spec.ts
@@ -654,7 +654,7 @@ describe('chromium features', () => {
expect(size).to.be.a('number');
});
- it('should lock the keyboard', async () => {
+ ifit(process.platform !== 'darwin')('should lock the keyboard', async () => {
const w = new BrowserWindow({ show: true });
await w.loadFile(path.join(fixturesPath, 'pages', 'modal.html'));
|
chore
|
dd3fd78e63bac52211cc3c271a39681ac3135e97
|
David Sanders
|
2024-03-21 07:22:14
|
ci: automatically add the 'has-repro-gist' label (#41646)
ci: automatically add the 'has-gist-repro' label
|
diff --git a/.github/workflows/issue-opened.yml b/.github/workflows/issue-opened.yml
index b739983f1c..809fc8a46c 100644
--- a/.github/workflows/issue-opened.yml
+++ b/.github/workflows/issue-opened.yml
@@ -25,3 +25,42 @@ jobs:
field-value: ${{ github.event.issue.user.login }}
project-number: 90
token: ${{ steps.generate-token.outputs.token }}
+ set-labels:
+ if: ${{ contains(github.event.issue.labels.*.name, 'bug :beetle:') }}
+ runs-on: ubuntu-latest
+ steps:
+ - name: Generate GitHub App token
+ uses: electron/github-app-auth-action@384fd19694fe7b6dcc9a684746c6976ad78228ae # v1.1.1
+ id: generate-token
+ with:
+ creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
+ org: electron
+ - run: npm install [email protected] [email protected]
+ - name: Add labels
+ uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
+ with:
+ github-token: ${{ steps.generate-token.outputs.token }}
+ script: |
+ const { fromMarkdown } = await import('${{ github.workspace }}/node_modules/mdast-util-from-markdown/index.js');
+ const { select } = await import('${{ github.workspace }}/node_modules/unist-util-select/index.js');
+
+ const [ owner, repo ] = '${{ github.repository }}'.split('/');
+ const issue_number = ${{ github.event.issue.number }};
+
+ const tree = fromMarkdown(`${{ github.event.issue.body }}`);
+
+ const labels = [];
+
+ const gistUrl = select('heading:has(> text[value="Testcase Gist URL"]) + paragraph > text', tree)?.value.trim();
+ if (gistUrl !== undefined && gistUrl.startsWith('https://gist.github.com/')) {
+ labels.push('has-repro-gist');
+ }
+
+ if (labels.length) {
+ await github.rest.issues.addLabels({
+ owner,
+ repo,
+ issue_number,
+ labels,
+ });
+ }
|
ci
|
1c075e5ea0416d6f0a030d42350c7be91e389a5c
|
github-actions[bot]
|
2023-05-24 17:03:14
|
chore: update appveyor image to latest version (#38426)
build: update appveyor image to latest version
Co-authored-by: jkleinsc <[email protected]>
|
diff --git a/appveyor-woa.yml b/appveyor-woa.yml
index 31b18560c2..1a2c884b60 100644
--- a/appveyor-woa.yml
+++ b/appveyor-woa.yml
@@ -29,7 +29,7 @@
version: 1.0.{build}
build_cloud: electronhq-16-core
-image: e-115.0.5760.0
+image: e-115.0.5786.0
environment:
GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache
ELECTRON_OUT_DIR: Default
diff --git a/appveyor.yml b/appveyor.yml
index b0642ddc7f..519ea6c0ba 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -29,7 +29,7 @@
version: 1.0.{build}
build_cloud: electronhq-16-core
-image: e-115.0.5760.0
+image: e-115.0.5786.0
environment:
GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache
ELECTRON_OUT_DIR: Default
|
chore
|
da3475998f154c19d3102c26fec175b9dd4eecec
|
Shelley Vohr
|
2023-07-12 17:42:24
|
fix: `BrowserWindow.moveAbove()` not working for child windows (#39034)
fix: BrowserWindow.moveAbove() not working for child windows
|
diff --git a/shell/browser/native_window_mac.mm b/shell/browser/native_window_mac.mm
index 195a684c75..9ca838f29e 100644
--- a/shell/browser/native_window_mac.mm
+++ b/shell/browser/native_window_mac.mm
@@ -162,6 +162,47 @@ void ViewDidMoveToSuperview(NSView* self, SEL _cmd) {
[self setFrame:[[self superview] bounds]];
}
+// -[NSWindow orderWindow] does not handle reordering for children
+// windows. Their order is fixed to the attachment order (the last attached
+// window is on the top). Therefore, work around it by re-parenting in our
+// desired order.
+void ReorderChildWindowAbove(NSWindow* child_window, NSWindow* other_window) {
+ NSWindow* parent = [child_window parentWindow];
+ DCHECK(parent);
+
+ // `ordered_children` sorts children windows back to front.
+ NSArray<NSWindow*>* children = [[child_window parentWindow] childWindows];
+ std::vector<std::pair<NSInteger, NSWindow*>> ordered_children;
+ for (NSWindow* child in children)
+ ordered_children.push_back({[child orderedIndex], child});
+ std::sort(ordered_children.begin(), ordered_children.end(), std::greater<>());
+
+ // If `other_window` is nullptr, place `child_window` in front of
+ // all other children windows.
+ if (other_window == nullptr)
+ other_window = ordered_children.back().second;
+
+ if (child_window == other_window)
+ return;
+
+ for (NSWindow* child in children)
+ [parent removeChildWindow:child];
+
+ const bool relative_to_parent = parent == other_window;
+ if (relative_to_parent)
+ [parent addChildWindow:child_window ordered:NSWindowAbove];
+
+ // Re-parent children windows in the desired order.
+ for (auto [ordered_index, child] : ordered_children) {
+ if (child != child_window && child != other_window) {
+ [parent addChildWindow:child ordered:NSWindowAbove];
+ } else if (child == other_window && !relative_to_parent) {
+ [parent addChildWindow:other_window ordered:NSWindowAbove];
+ [parent addChildWindow:child_window ordered:NSWindowAbove];
+ }
+ }
+}
+
} // namespace
NativeWindowMac::NativeWindowMac(const gin_helper::Dictionary& options,
@@ -759,13 +800,21 @@ bool NativeWindowMac::MoveAbove(const std::string& sourceId) {
if (!webrtc::GetWindowOwnerPid(window_id))
return false;
- [window_ orderWindow:NSWindowAbove relativeTo:id.id];
+ if (!parent()) {
+ [window_ orderWindow:NSWindowAbove relativeTo:window_id];
+ } else {
+ NSWindow* other_window = [NSApp windowWithWindowNumber:window_id];
+ ReorderChildWindowAbove(window_, other_window);
+ }
return true;
}
void NativeWindowMac::MoveTop() {
- [window_ orderWindow:NSWindowAbove relativeTo:0];
+ if (!parent())
+ [window_ orderWindow:NSWindowAbove relativeTo:0];
+ else
+ ReorderChildWindowAbove(window_, nullptr);
}
void NativeWindowMac::SetResizable(bool resizable) {
|
fix
|
b454f8c7c1e928264dbacc29cd77bd2ac76e16aa
|
Shelley Vohr
|
2023-05-31 16:30:04
|
build: combine and elaborate on exposed `BoringSSL` ciphers (#38506)
build: combine and elaborate on exposed BoringSSL ciphers
|
diff --git a/patches/boringssl/.patches b/patches/boringssl/.patches
index 1bea01e3e0..9dffabe3d9 100644
--- a/patches/boringssl/.patches
+++ b/patches/boringssl/.patches
@@ -1,6 +1,3 @@
expose_ripemd160.patch
-expose_aes-cfb.patch
-expose_des-ede3.patch
-fix_sync_evp_get_cipherbynid_and_evp_get_cipherbyname.patch
-expose_blowfish_ciphers.patch
revert_track_ssl_error_zero_return_explicitly.patch
+feat_expose_several_extra_cipher_functions.patch
diff --git a/patches/boringssl/expose_aes-cfb.patch b/patches/boringssl/expose_aes-cfb.patch
deleted file mode 100644
index 4dd7bf3702..0000000000
--- a/patches/boringssl/expose_aes-cfb.patch
+++ /dev/null
@@ -1,71 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Jeremy Apthorp <[email protected]>
-Date: Fri, 18 Jan 2019 14:23:28 -0800
-Subject: expose aes-{128,256}-cfb
-
-This exposes AES-CFB ciphers through the EVP APIs. BoringSSL has
-implementations for these ciphers, but Node doesn't realise that because
-without this patch, they're not listed in the APIs that Node uses.
-
-This should be upstreamed. See e.g.
-https://boringssl-review.googlesource.com/c/boringssl/+/33984 for a
-similar patch that was merged upstream.
-
-diff --git a/crypto/cipher_extra/cipher_extra.c b/crypto/cipher_extra/cipher_extra.c
-index 62850ab6a216d401d023f81007fb59a33b4585f3..0c30b0329d32b94b22f342f95035e927797d0aaf 100644
---- a/crypto/cipher_extra/cipher_extra.c
-+++ b/crypto/cipher_extra/cipher_extra.c
-@@ -73,6 +73,7 @@ static const struct {
- const EVP_CIPHER *(*func)(void);
- } kCiphers[] = {
- {NID_aes_128_cbc, "aes-128-cbc", EVP_aes_128_cbc},
-+ {NID_aes_128_cfb128, "aes-128-cfb", EVP_aes_128_cfb128},
- {NID_aes_128_ctr, "aes-128-ctr", EVP_aes_128_ctr},
- {NID_aes_128_ecb, "aes-128-ecb", EVP_aes_128_ecb},
- {NID_aes_128_gcm, "aes-128-gcm", EVP_aes_128_gcm},
-@@ -83,6 +84,7 @@ static const struct {
- {NID_aes_192_gcm, "aes-192-gcm", EVP_aes_192_gcm},
- {NID_aes_192_ofb128, "aes-192-ofb", EVP_aes_192_ofb},
- {NID_aes_256_cbc, "aes-256-cbc", EVP_aes_256_cbc},
-+ {NID_aes_256_cfb128, "aes-256-cfb", EVP_aes_256_cfb128},
- {NID_aes_256_ctr, "aes-256-ctr", EVP_aes_256_ctr},
- {NID_aes_256_ecb, "aes-256-ecb", EVP_aes_256_ecb},
- {NID_aes_256_gcm, "aes-256-gcm", EVP_aes_256_gcm},
-diff --git a/decrepit/evp/evp_do_all.c b/decrepit/evp/evp_do_all.c
-index 852b76bea69988e0b3ac76a17b603128f239dde0..d443f4dc2daea0b7aa86ae75d31d995fae667ba9 100644
---- a/decrepit/evp/evp_do_all.c
-+++ b/decrepit/evp/evp_do_all.c
-@@ -20,8 +20,10 @@ void EVP_CIPHER_do_all_sorted(void (*callback)(const EVP_CIPHER *cipher,
- const char *unused, void *arg),
- void *arg) {
- callback(EVP_aes_128_cbc(), "AES-128-CBC", NULL, arg);
-+ callback(EVP_aes_128_cfb128(), "AES-128-CFB", NULL, arg);
- callback(EVP_aes_192_cbc(), "AES-192-CBC", NULL, arg);
- callback(EVP_aes_256_cbc(), "AES-256-CBC", NULL, arg);
-+ callback(EVP_aes_256_cfb128(), "AES-256-CFB", NULL, arg);
- callback(EVP_aes_128_ctr(), "AES-128-CTR", NULL, arg);
- callback(EVP_aes_192_ctr(), "AES-192-CTR", NULL, arg);
- callback(EVP_aes_256_ctr(), "AES-256-CTR", NULL, arg);
-@@ -44,8 +46,10 @@ void EVP_CIPHER_do_all_sorted(void (*callback)(const EVP_CIPHER *cipher,
-
- // OpenSSL returns everything twice, the second time in lower case.
- callback(EVP_aes_128_cbc(), "aes-128-cbc", NULL, arg);
-+ callback(EVP_aes_128_cfb128(), "aes-128-cfb", NULL, arg);
- callback(EVP_aes_192_cbc(), "aes-192-cbc", NULL, arg);
- callback(EVP_aes_256_cbc(), "aes-256-cbc", NULL, arg);
-+ callback(EVP_aes_256_cfb128(), "aes-256-cfb", NULL, arg);
- callback(EVP_aes_128_ctr(), "aes-128-ctr", NULL, arg);
- callback(EVP_aes_192_ctr(), "aes-192-ctr", NULL, arg);
- callback(EVP_aes_256_ctr(), "aes-256-ctr", NULL, arg);
-diff --git a/include/openssl/cipher.h b/include/openssl/cipher.h
-index 310d7c237fd884ba715e3fa97ccf1393b6d04fbb..66e69d487fbb767438b7d0dfdf3770f54e3cf7b2 100644
---- a/include/openssl/cipher.h
-+++ b/include/openssl/cipher.h
-@@ -476,6 +476,7 @@ OPENSSL_EXPORT const EVP_CIPHER *EVP_des_ede3_ecb(void);
-
- // EVP_aes_128_cfb128 is only available in decrepit.
- OPENSSL_EXPORT const EVP_CIPHER *EVP_aes_128_cfb128(void);
-+OPENSSL_EXPORT const EVP_CIPHER *EVP_aes_256_cfb128(void);
-
- // EVP_aes_128_cfb is an alias for |EVP_aes_128_cfb128| and is only available in
- // decrepit.
diff --git a/patches/boringssl/expose_blowfish_ciphers.patch b/patches/boringssl/expose_blowfish_ciphers.patch
deleted file mode 100644
index cb6239201d..0000000000
--- a/patches/boringssl/expose_blowfish_ciphers.patch
+++ /dev/null
@@ -1,47 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Jeremy Rose <[email protected]>
-Date: Wed, 5 Jan 2022 13:08:10 -0800
-Subject: expose blowfish ciphers
-
-This exposes the (decrepit) blowfish cipher family, bf-cbc, bf-cfb and
-bf-ecb through the EVP interface. This adds references to decrepit code
-from non-decrepit code, so upstream is unlikely to take the patch.
-
-diff --git a/crypto/cipher_extra/cipher_extra.c b/crypto/cipher_extra/cipher_extra.c
-index cfdb69e3c556fea11aa7c2d28d4b7da524df15c3..95bd172c99874610ec9157c52df4fe0232e78c7f 100644
---- a/crypto/cipher_extra/cipher_extra.c
-+++ b/crypto/cipher_extra/cipher_extra.c
-@@ -89,6 +89,9 @@ static const struct {
- {NID_aes_256_ecb, "aes-256-ecb", EVP_aes_256_ecb},
- {NID_aes_256_gcm, "aes-256-gcm", EVP_aes_256_gcm},
- {NID_aes_256_ofb128, "aes-256-ofb", EVP_aes_256_ofb},
-+ {NID_bf_cbc, "bf-cbc", EVP_bf_cbc},
-+ {NID_bf_cfb64, "bf-cfb", EVP_bf_cfb},
-+ {NID_bf_ecb, "bf-ecb", EVP_bf_ecb},
- {NID_des_cbc, "des-cbc", EVP_des_cbc},
- {NID_des_ecb, "des-ecb", EVP_des_ecb},
- {NID_des_ede_cbc, "des-ede-cbc", EVP_des_ede_cbc},
-diff --git a/decrepit/evp/evp_do_all.c b/decrepit/evp/evp_do_all.c
-index 5e71420b765019edea82a33884ace539cd91bda5..43fc792697519325725e9ce87801c5dc176c70a1 100644
---- a/decrepit/evp/evp_do_all.c
-+++ b/decrepit/evp/evp_do_all.c
-@@ -36,6 +36,9 @@ void EVP_CIPHER_do_all_sorted(void (*callback)(const EVP_CIPHER *cipher,
- callback(EVP_aes_128_gcm(), "AES-128-GCM", NULL, arg);
- callback(EVP_aes_192_gcm(), "AES-192-GCM", NULL, arg);
- callback(EVP_aes_256_gcm(), "AES-256-GCM", NULL, arg);
-+ callback(EVP_bf_cbc(), "BF-CBC", NULL, arg);
-+ callback(EVP_bf_cfb(), "BF-CFB", NULL, arg);
-+ callback(EVP_bf_ecb(), "BF-ECB", NULL, arg);
- callback(EVP_des_cbc(), "DES-CBC", NULL, arg);
- callback(EVP_des_ecb(), "DES-ECB", NULL, arg);
- callback(EVP_des_ede(), "DES-EDE", NULL, arg);
-@@ -63,6 +66,9 @@ void EVP_CIPHER_do_all_sorted(void (*callback)(const EVP_CIPHER *cipher,
- callback(EVP_aes_128_gcm(), "aes-128-gcm", NULL, arg);
- callback(EVP_aes_192_gcm(), "aes-192-gcm", NULL, arg);
- callback(EVP_aes_256_gcm(), "aes-256-gcm", NULL, arg);
-+ callback(EVP_bf_cbc(), "bf-cbc", NULL, arg);
-+ callback(EVP_bf_cfb(), "bf-cfb", NULL, arg);
-+ callback(EVP_bf_ecb(), "bf-ecb", NULL, arg);
- callback(EVP_des_cbc(), "des-cbc", NULL, arg);
- callback(EVP_des_ecb(), "des-ecb", NULL, arg);
- callback(EVP_des_ede(), "des-ede", NULL, arg);
diff --git a/patches/boringssl/expose_des-ede3.patch b/patches/boringssl/expose_des-ede3.patch
deleted file mode 100644
index f39665f422..0000000000
--- a/patches/boringssl/expose_des-ede3.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Jeremy Rose <[email protected]>
-Date: Wed, 24 Feb 2021 11:08:34 -0800
-Subject: expose des-ede3
-
-This should be upstreamed.
-
-diff --git a/crypto/cipher_extra/cipher_extra.c b/crypto/cipher_extra/cipher_extra.c
-index 0c30b0329d32b94b22f342f95035e927797d0aaf..d97f67fb03756169446edf6b41d3a33fe3ae8205 100644
---- a/crypto/cipher_extra/cipher_extra.c
-+++ b/crypto/cipher_extra/cipher_extra.c
-@@ -93,6 +93,7 @@ static const struct {
- {NID_des_ecb, "des-ecb", EVP_des_ecb},
- {NID_des_ede_cbc, "des-ede-cbc", EVP_des_ede_cbc},
- {NID_des_ede_ecb, "des-ede", EVP_des_ede},
-+ {NID_des_ede3_ecb, "des-ede3", EVP_des_ede3},
- {NID_des_ede3_cbc, "des-ede3-cbc", EVP_des_ede3_cbc},
- {NID_rc2_cbc, "rc2-cbc", EVP_rc2_cbc},
- {NID_rc4, "rc4", EVP_rc4},
-diff --git a/decrepit/evp/evp_do_all.c b/decrepit/evp/evp_do_all.c
-index d443f4dc2daea0b7aa86ae75d31d995fae667ba9..5e71420b765019edea82a33884ace539cd91bda5 100644
---- a/decrepit/evp/evp_do_all.c
-+++ b/decrepit/evp/evp_do_all.c
-@@ -39,6 +39,7 @@ void EVP_CIPHER_do_all_sorted(void (*callback)(const EVP_CIPHER *cipher,
- callback(EVP_des_cbc(), "DES-CBC", NULL, arg);
- callback(EVP_des_ecb(), "DES-ECB", NULL, arg);
- callback(EVP_des_ede(), "DES-EDE", NULL, arg);
-+ callback(EVP_des_ede3(), "DES-EDE3", NULL, arg);
- callback(EVP_des_ede_cbc(), "DES-EDE-CBC", NULL, arg);
- callback(EVP_des_ede3_cbc(), "DES-EDE3-CBC", NULL, arg);
- callback(EVP_rc2_cbc(), "RC2-CBC", NULL, arg);
-@@ -65,6 +66,7 @@ void EVP_CIPHER_do_all_sorted(void (*callback)(const EVP_CIPHER *cipher,
- callback(EVP_des_cbc(), "des-cbc", NULL, arg);
- callback(EVP_des_ecb(), "des-ecb", NULL, arg);
- callback(EVP_des_ede(), "des-ede", NULL, arg);
-+ callback(EVP_des_ede3(), "des-ede3", NULL, arg);
- callback(EVP_des_ede_cbc(), "des-ede-cbc", NULL, arg);
- callback(EVP_des_ede3_cbc(), "des-ede3-cbc", NULL, arg);
- callback(EVP_rc2_cbc(), "rc2-cbc", NULL, arg);
diff --git a/patches/boringssl/feat_expose_several_extra_cipher_functions.patch b/patches/boringssl/feat_expose_several_extra_cipher_functions.patch
new file mode 100644
index 0000000000..83900671a8
--- /dev/null
+++ b/patches/boringssl/feat_expose_several_extra_cipher_functions.patch
@@ -0,0 +1,131 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Shelley Vohr <[email protected]>
+Date: Wed, 31 May 2023 11:36:48 +0200
+Subject: feat: expose several extra cipher functions
+
+This patch exposes the following ciphers:
+
+AES_CFB Ciphers: aes-128-cfb, aes-256-cfb
+
+Implementations for these ciphers exist but aren't exposed, so they're
+unusable without this patch. We should upstream this as similar
+patches for implemented cipher functions have been accepted.
+
+Blowfish Ciphers: bf-cbc, bf-cfb, bf-ecb
+
+The addition of Blowfish ciphers adds references decrepit code
+from non-decrepit code, so upstream is unlikely to take the patch.
+
+DES Ciphers: des-ede3
+
+An implementation for this cipher exists but isn't exposed, so it's
+unusable without this patch. Akin to the AES_CFB exposures, we should
+upstream this as similar patches for implemented cipher functions have
+been accepted.
+
+RC2 Ciphers: rc2-40-cbc
+
+It's unclear whether this would be accepted upstream. We should try regardless.
+
+diff --git a/crypto/cipher_extra/cipher_extra.c b/crypto/cipher_extra/cipher_extra.c
+index 62850ab6a216d401d023f81007fb59a33b4585f3..95bd172c99874610ec9157c52df4fe0232e78c7f 100644
+--- a/crypto/cipher_extra/cipher_extra.c
++++ b/crypto/cipher_extra/cipher_extra.c
+@@ -73,6 +73,7 @@ static const struct {
+ const EVP_CIPHER *(*func)(void);
+ } kCiphers[] = {
+ {NID_aes_128_cbc, "aes-128-cbc", EVP_aes_128_cbc},
++ {NID_aes_128_cfb128, "aes-128-cfb", EVP_aes_128_cfb128},
+ {NID_aes_128_ctr, "aes-128-ctr", EVP_aes_128_ctr},
+ {NID_aes_128_ecb, "aes-128-ecb", EVP_aes_128_ecb},
+ {NID_aes_128_gcm, "aes-128-gcm", EVP_aes_128_gcm},
+@@ -83,17 +84,23 @@ static const struct {
+ {NID_aes_192_gcm, "aes-192-gcm", EVP_aes_192_gcm},
+ {NID_aes_192_ofb128, "aes-192-ofb", EVP_aes_192_ofb},
+ {NID_aes_256_cbc, "aes-256-cbc", EVP_aes_256_cbc},
++ {NID_aes_256_cfb128, "aes-256-cfb", EVP_aes_256_cfb128},
+ {NID_aes_256_ctr, "aes-256-ctr", EVP_aes_256_ctr},
+ {NID_aes_256_ecb, "aes-256-ecb", EVP_aes_256_ecb},
+ {NID_aes_256_gcm, "aes-256-gcm", EVP_aes_256_gcm},
+ {NID_aes_256_ofb128, "aes-256-ofb", EVP_aes_256_ofb},
++ {NID_bf_cbc, "bf-cbc", EVP_bf_cbc},
++ {NID_bf_cfb64, "bf-cfb", EVP_bf_cfb},
++ {NID_bf_ecb, "bf-ecb", EVP_bf_ecb},
+ {NID_des_cbc, "des-cbc", EVP_des_cbc},
+ {NID_des_ecb, "des-ecb", EVP_des_ecb},
+ {NID_des_ede_cbc, "des-ede-cbc", EVP_des_ede_cbc},
+ {NID_des_ede_ecb, "des-ede", EVP_des_ede},
++ {NID_des_ede3_ecb, "des-ede3", EVP_des_ede3},
+ {NID_des_ede3_cbc, "des-ede3-cbc", EVP_des_ede3_cbc},
+ {NID_rc2_cbc, "rc2-cbc", EVP_rc2_cbc},
+ {NID_rc4, "rc4", EVP_rc4},
++ {NID_rc2_40_cbc, "rc2-40-cbc", EVP_rc2_40_cbc}
+ };
+
+ const EVP_CIPHER *EVP_get_cipherbynid(int nid) {
+diff --git a/decrepit/evp/evp_do_all.c b/decrepit/evp/evp_do_all.c
+index 852b76bea69988e0b3ac76a17b603128f239dde0..43fc792697519325725e9ce87801c5dc176c70a1 100644
+--- a/decrepit/evp/evp_do_all.c
++++ b/decrepit/evp/evp_do_all.c
+@@ -20,8 +20,10 @@ void EVP_CIPHER_do_all_sorted(void (*callback)(const EVP_CIPHER *cipher,
+ const char *unused, void *arg),
+ void *arg) {
+ callback(EVP_aes_128_cbc(), "AES-128-CBC", NULL, arg);
++ callback(EVP_aes_128_cfb128(), "AES-128-CFB", NULL, arg);
+ callback(EVP_aes_192_cbc(), "AES-192-CBC", NULL, arg);
+ callback(EVP_aes_256_cbc(), "AES-256-CBC", NULL, arg);
++ callback(EVP_aes_256_cfb128(), "AES-256-CFB", NULL, arg);
+ callback(EVP_aes_128_ctr(), "AES-128-CTR", NULL, arg);
+ callback(EVP_aes_192_ctr(), "AES-192-CTR", NULL, arg);
+ callback(EVP_aes_256_ctr(), "AES-256-CTR", NULL, arg);
+@@ -34,9 +36,13 @@ void EVP_CIPHER_do_all_sorted(void (*callback)(const EVP_CIPHER *cipher,
+ callback(EVP_aes_128_gcm(), "AES-128-GCM", NULL, arg);
+ callback(EVP_aes_192_gcm(), "AES-192-GCM", NULL, arg);
+ callback(EVP_aes_256_gcm(), "AES-256-GCM", NULL, arg);
++ callback(EVP_bf_cbc(), "BF-CBC", NULL, arg);
++ callback(EVP_bf_cfb(), "BF-CFB", NULL, arg);
++ callback(EVP_bf_ecb(), "BF-ECB", NULL, arg);
+ callback(EVP_des_cbc(), "DES-CBC", NULL, arg);
+ callback(EVP_des_ecb(), "DES-ECB", NULL, arg);
+ callback(EVP_des_ede(), "DES-EDE", NULL, arg);
++ callback(EVP_des_ede3(), "DES-EDE3", NULL, arg);
+ callback(EVP_des_ede_cbc(), "DES-EDE-CBC", NULL, arg);
+ callback(EVP_des_ede3_cbc(), "DES-EDE3-CBC", NULL, arg);
+ callback(EVP_rc2_cbc(), "RC2-CBC", NULL, arg);
+@@ -44,8 +50,10 @@ void EVP_CIPHER_do_all_sorted(void (*callback)(const EVP_CIPHER *cipher,
+
+ // OpenSSL returns everything twice, the second time in lower case.
+ callback(EVP_aes_128_cbc(), "aes-128-cbc", NULL, arg);
++ callback(EVP_aes_128_cfb128(), "aes-128-cfb", NULL, arg);
+ callback(EVP_aes_192_cbc(), "aes-192-cbc", NULL, arg);
+ callback(EVP_aes_256_cbc(), "aes-256-cbc", NULL, arg);
++ callback(EVP_aes_256_cfb128(), "aes-256-cfb", NULL, arg);
+ callback(EVP_aes_128_ctr(), "aes-128-ctr", NULL, arg);
+ callback(EVP_aes_192_ctr(), "aes-192-ctr", NULL, arg);
+ callback(EVP_aes_256_ctr(), "aes-256-ctr", NULL, arg);
+@@ -58,9 +66,13 @@ void EVP_CIPHER_do_all_sorted(void (*callback)(const EVP_CIPHER *cipher,
+ callback(EVP_aes_128_gcm(), "aes-128-gcm", NULL, arg);
+ callback(EVP_aes_192_gcm(), "aes-192-gcm", NULL, arg);
+ callback(EVP_aes_256_gcm(), "aes-256-gcm", NULL, arg);
++ callback(EVP_bf_cbc(), "bf-cbc", NULL, arg);
++ callback(EVP_bf_cfb(), "bf-cfb", NULL, arg);
++ callback(EVP_bf_ecb(), "bf-ecb", NULL, arg);
+ callback(EVP_des_cbc(), "des-cbc", NULL, arg);
+ callback(EVP_des_ecb(), "des-ecb", NULL, arg);
+ callback(EVP_des_ede(), "des-ede", NULL, arg);
++ callback(EVP_des_ede3(), "des-ede3", NULL, arg);
+ callback(EVP_des_ede_cbc(), "des-ede-cbc", NULL, arg);
+ callback(EVP_des_ede3_cbc(), "des-ede3-cbc", NULL, arg);
+ callback(EVP_rc2_cbc(), "rc2-cbc", NULL, arg);
+diff --git a/include/openssl/cipher.h b/include/openssl/cipher.h
+index 310d7c237fd884ba715e3fa97ccf1393b6d04fbb..66e69d487fbb767438b7d0dfdf3770f54e3cf7b2 100644
+--- a/include/openssl/cipher.h
++++ b/include/openssl/cipher.h
+@@ -476,6 +476,7 @@ OPENSSL_EXPORT const EVP_CIPHER *EVP_des_ede3_ecb(void);
+
+ // EVP_aes_128_cfb128 is only available in decrepit.
+ OPENSSL_EXPORT const EVP_CIPHER *EVP_aes_128_cfb128(void);
++OPENSSL_EXPORT const EVP_CIPHER *EVP_aes_256_cfb128(void);
+
+ // EVP_aes_128_cfb is an alias for |EVP_aes_128_cfb128| and is only available in
+ // decrepit.
diff --git a/patches/boringssl/fix_sync_evp_get_cipherbynid_and_evp_get_cipherbyname.patch b/patches/boringssl/fix_sync_evp_get_cipherbynid_and_evp_get_cipherbyname.patch
deleted file mode 100644
index e739ae8f70..0000000000
--- a/patches/boringssl/fix_sync_evp_get_cipherbynid_and_evp_get_cipherbyname.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Shelley Vohr <[email protected]>
-Date: Mon, 28 Jun 2021 10:41:09 +0200
-Subject: fix: sync EVP_get_cipherbynid and EVP_get_cipherbyname
-
-This commit syncs the results of EVP_get_cipherbynid and
-EVP_get_cipherbyname. Node.js logic assumes that calling EVP_get_cipherbynid
-on a NID returned from a call to `getCipherInfo` with the cipher name
-will return the same cipher information - this assumption holds in OpenSSL
-and should also hold in BoringSSL.
-
-This will be upstreamed.
-
-diff --git a/crypto/cipher_extra/cipher_extra.c b/crypto/cipher_extra/cipher_extra.c
-index d97f67fb03756169446edf6b41d3a33fe3ae8205..cfdb69e3c556fea11aa7c2d28d4b7da524df15c3 100644
---- a/crypto/cipher_extra/cipher_extra.c
-+++ b/crypto/cipher_extra/cipher_extra.c
-@@ -97,6 +97,7 @@ static const struct {
- {NID_des_ede3_cbc, "des-ede3-cbc", EVP_des_ede3_cbc},
- {NID_rc2_cbc, "rc2-cbc", EVP_rc2_cbc},
- {NID_rc4, "rc4", EVP_rc4},
-+ {NID_rc2_40_cbc, "rc2-40-cbc", EVP_rc2_40_cbc}
- };
-
- const EVP_CIPHER *EVP_get_cipherbynid(int nid) {
|
build
|
8b3d70a2a34b7fdcf91fdda5566bf2663551ff60
|
Sam Maddock
|
2024-10-11 18:33:53
|
feat: add WebFrameMain detached property (#43473)
* feat: add WebFrameMain detached property
fix: throw instead of returning null senderFrame
test: detached frames
fix: ensure IPCs of pending deletion RFHs are dispatched
fix: lookup WFM by FTN ID to dispatch IPCs
feat: add frame.isDestroyed()
return null
fix: return undefined
docs: add null to all frame properties
refactor: option c, return null and emit warning
refactor: add routingId & processId to navigation events
test: null frame property
docs: clarify warning message
better wording
clarify null frame
fix: browserwindow spec
* maybe fix :shrug:
* fix: use updated util #43722
* docs: add notice for frame change of behavior
* docs: clarify why frame properties may be null
* lint
* wip
* fix: content::FrameTreeNodeId lookup and converter
* refactor: avoid holey array deoptimization
---------
Co-authored-by: John Kleinschmidt <[email protected]>
|
diff --git a/docs/api/session.md b/docs/api/session.md
index 90c407dd31..8b56af1897 100644
--- a/docs/api/session.md
+++ b/docs/api/session.md
@@ -268,7 +268,8 @@ Returns:
* `event` Event
* `details` Object
* `deviceList` [HIDDevice[]](structures/hid-device.md)
- * `frame` [WebFrameMain](web-frame-main.md)
+ * `frame` [WebFrameMain](web-frame-main.md) | null - The frame initiating this event.
+ May be `null` if accessed after the frame has either navigated or been destroyed.
* `callback` Function
* `deviceId` string | null (optional)
@@ -332,7 +333,8 @@ Returns:
* `event` Event
* `details` Object
* `device` [HIDDevice](structures/hid-device.md)
- * `frame` [WebFrameMain](web-frame-main.md)
+ * `frame` [WebFrameMain](web-frame-main.md) | null - The frame initiating this event.
+ May be `null` if accessed after the frame has either navigated or been destroyed.
Emitted after `navigator.hid.requestDevice` has been called and
`select-hid-device` has fired if a new device becomes available before
@@ -347,7 +349,8 @@ Returns:
* `event` Event
* `details` Object
* `device` [HIDDevice](structures/hid-device.md)
- * `frame` [WebFrameMain](web-frame-main.md)
+ * `frame` [WebFrameMain](web-frame-main.md) | null - The frame initiating this event.
+ May be `null` if accessed after the frame has either navigated or been destroyed.
Emitted after `navigator.hid.requestDevice` has been called and
`select-hid-device` has fired if a device has been removed before the callback
@@ -473,7 +476,8 @@ Returns:
* `event` Event
* `details` Object
* `port` [SerialPort](structures/serial-port.md)
- * `frame` [WebFrameMain](web-frame-main.md)
+ * `frame` [WebFrameMain](web-frame-main.md) | null - The frame initiating this event.
+ May be `null` if accessed after the frame has either navigated or been destroyed.
* `origin` string - The origin that the device has been revoked from.
Emitted after `SerialPort.forget()` has been called. This event can be used
@@ -517,7 +521,8 @@ Returns:
* `event` Event
* `details` Object
* `deviceList` [USBDevice[]](structures/usb-device.md)
- * `frame` [WebFrameMain](web-frame-main.md)
+ * `frame` [WebFrameMain](web-frame-main.md) | null - The frame initiating this event.
+ May be `null` if accessed after the frame has either navigated or been destroyed.
* `callback` Function
* `deviceId` string (optional)
@@ -957,7 +962,8 @@ session.fromPartition('some-partition').setPermissionCheckHandler((webContents,
* `handler` Function | null
* `request` Object
- * `frame` [WebFrameMain](web-frame-main.md) - Frame that is requesting access to media.
+ * `frame` [WebFrameMain](web-frame-main.md) | null - Frame that is requesting access to media.
+ May be `null` if accessed after the frame has either navigated or been destroyed.
* `securityOrigin` String - Origin of the page making the request.
* `videoRequested` Boolean - true if the web content requested a video stream.
* `audioRequested` Boolean - true if the web content requested an audio stream.
@@ -1158,7 +1164,8 @@ app.whenReady().then(() => {
pin displayed on the device.
* `providePin`
This prompt is requesting that a pin be provided for the device.
- * `frame` [WebFrameMain](web-frame-main.md)
+ * `frame` [WebFrameMain](web-frame-main.md) | null - The frame initiating this handler.
+ May be `null` if accessed after the frame has either navigated or been destroyed.
* `pin` string (optional) - The pin value to verify if `pairingKind` is `confirmPin`.
* `callback` Function
* `response` Object
diff --git a/docs/api/structures/ipc-main-event.md b/docs/api/structures/ipc-main-event.md
index eb06bb9315..2bf1e84aff 100644
--- a/docs/api/structures/ipc-main-event.md
+++ b/docs/api/structures/ipc-main-event.md
@@ -4,7 +4,7 @@
* `frameId` Integer - The ID of the renderer frame that sent this message
* `returnValue` any - Set this to the value to be returned in a synchronous message
* `sender` [WebContents](../web-contents.md) - Returns the `webContents` that sent the message
-* `senderFrame` [WebFrameMain](../web-frame-main.md) _Readonly_ - The frame that sent this message
+* `senderFrame` [WebFrameMain](../web-frame-main.md) | null _Readonly_ - The frame that sent this message. May be `null` if accessed after the frame has either navigated or been destroyed.
* `ports` [MessagePortMain](../message-port-main.md)[] - A list of MessagePorts that were transferred with this message
* `reply` Function - A function that will send an IPC message to the renderer frame that sent the original message that you are currently handling. You should use this method to "reply" to the sent message in order to guarantee the reply will go to the correct process and frame.
* `channel` string
diff --git a/docs/api/structures/ipc-main-invoke-event.md b/docs/api/structures/ipc-main-invoke-event.md
index 9e24be40dc..b5c9e20438 100644
--- a/docs/api/structures/ipc-main-invoke-event.md
+++ b/docs/api/structures/ipc-main-invoke-event.md
@@ -3,4 +3,4 @@
* `processId` Integer - The internal ID of the renderer process that sent this message
* `frameId` Integer - The ID of the renderer frame that sent this message
* `sender` [WebContents](../web-contents.md) - Returns the `webContents` that sent the message
-* `senderFrame` [WebFrameMain](../web-frame-main.md) _Readonly_ - The frame that sent this message
+* `senderFrame` [WebFrameMain](../web-frame-main.md) | null _Readonly_ - The frame that sent this message. May be `null` if accessed after the frame has either navigated or been destroyed.
diff --git a/docs/api/web-contents.md b/docs/api/web-contents.md
index e0feef19d2..e76ecf0587 100644
--- a/docs/api/web-contents.md
+++ b/docs/api/web-contents.md
@@ -242,8 +242,9 @@ Returns:
* `isSameDocument` boolean - This event does not fire for same document navigations using window.history api and reference fragment navigations.
This property is always set to `false` for this event.
* `isMainFrame` boolean - True if the navigation is taking place in a main frame.
- * `frame` WebFrameMain - The frame to be navigated.
- * `initiator` WebFrameMain (optional) - The frame which initiated the
+ * `frame` WebFrameMain | null - The frame to be navigated.
+ May be `null` if accessed after the frame has either navigated or been destroyed.
+ * `initiator` WebFrameMain | null (optional) - The frame which initiated the
navigation, which can be a parent frame (e.g. via `window.open` with a
frame's name), or null if the navigation was not initiated by a frame. This
can also be null if the initiating frame was deleted before the event was
@@ -275,8 +276,9 @@ Returns:
* `isSameDocument` boolean - This event does not fire for same document navigations using window.history api and reference fragment navigations.
This property is always set to `false` for this event.
* `isMainFrame` boolean - True if the navigation is taking place in a main frame.
- * `frame` WebFrameMain - The frame to be navigated.
- * `initiator` WebFrameMain (optional) - The frame which initiated the
+ * `frame` WebFrameMain | null - The frame to be navigated.
+ May be `null` if accessed after the frame has either navigated or been destroyed.
+ * `initiator` WebFrameMain | null (optional) - The frame which initiated the
navigation, which can be a parent frame (e.g. via `window.open` with a
frame's name), or null if the navigation was not initiated by a frame. This
can also be null if the initiating frame was deleted before the event was
@@ -306,8 +308,9 @@ Returns:
document. Examples of same document navigations are reference fragment
navigations, pushState/replaceState, and same page history navigation.
* `isMainFrame` boolean - True if the navigation is taking place in a main frame.
- * `frame` WebFrameMain - The frame to be navigated.
- * `initiator` WebFrameMain (optional) - The frame which initiated the
+ * `frame` WebFrameMain | null - The frame to be navigated.
+ May be `null` if accessed after the frame has either navigated or been destroyed.
+ * `initiator` WebFrameMain | null (optional) - The frame which initiated the
navigation, which can be a parent frame (e.g. via `window.open` with a
frame's name), or null if the navigation was not initiated by a frame. This
can also be null if the initiating frame was deleted before the event was
@@ -330,8 +333,9 @@ Returns:
document. Examples of same document navigations are reference fragment
navigations, pushState/replaceState, and same page history navigation.
* `isMainFrame` boolean - True if the navigation is taking place in a main frame.
- * `frame` WebFrameMain - The frame to be navigated.
- * `initiator` WebFrameMain (optional) - The frame which initiated the
+ * `frame` WebFrameMain | null - The frame to be navigated.
+ May be `null` if accessed after the frame has either navigated or been destroyed.
+ * `initiator` WebFrameMain | null (optional) - The frame which initiated the
navigation, which can be a parent frame (e.g. via `window.open` with a
frame's name), or null if the navigation was not initiated by a frame. This
can also be null if the initiating frame was deleted before the event was
@@ -361,8 +365,9 @@ Returns:
document. Examples of same document navigations are reference fragment
navigations, pushState/replaceState, and same page history navigation.
* `isMainFrame` boolean - True if the navigation is taking place in a main frame.
- * `frame` WebFrameMain - The frame to be navigated.
- * `initiator` WebFrameMain (optional) - The frame which initiated the
+ * `frame` WebFrameMain | null - The frame to be navigated.
+ May be `null` if accessed after the frame has either navigated or been destroyed.
+ * `initiator` WebFrameMain | null (optional) - The frame which initiated the
navigation, which can be a parent frame (e.g. via `window.open` with a
frame's name), or null if the navigation was not initiated by a frame. This
can also be null if the initiating frame was deleted before the event was
@@ -743,7 +748,8 @@ Returns:
* `params` Object
* `x` Integer - x coordinate.
* `y` Integer - y coordinate.
- * `frame` WebFrameMain - Frame from which the context menu was invoked.
+ * `frame` WebFrameMain | null - Frame from which the context menu was invoked.
+ May be `null` if accessed after the frame has either navigated or been destroyed.
* `linkURL` string - URL of the link that encloses the node the context menu
was invoked on.
* `linkText` string - Text associated with the link. May be an empty
@@ -1010,7 +1016,8 @@ Returns:
* `event` Event
* `details` Object
- * `frame` WebFrameMain
+ * `frame` WebFrameMain | null - The created frame.
+ May be `null` if accessed after the frame has either navigated or been destroyed.
Emitted when the [mainFrame](web-contents.md#contentsmainframe-readonly), an `<iframe>`, or a nested `<iframe>` is loaded within the page.
diff --git a/docs/api/web-frame-main.md b/docs/api/web-frame-main.md
index 8d47956ae8..87d35051f0 100644
--- a/docs/api/web-frame-main.md
+++ b/docs/api/web-frame-main.md
@@ -97,6 +97,10 @@ this limitation.
Returns `boolean` - Whether the reload was initiated successfully. Only results in `false` when the frame has no history.
+#### `frame.isDestroyed()`
+
+Returns `boolean` - Whether the frame is destroyed.
+
#### `frame.send(channel, ...args)`
* `channel` string
@@ -231,6 +235,13 @@ A `string` representing the [visibility state](https://developer.mozilla.org/en-
See also how the [Page Visibility API](browser-window.md#page-visibility) is affected by other Electron APIs.
+#### `frame.detached` _Readonly_
+
+A `Boolean` representing whether the frame is detached from the frame tree. If a frame is accessed
+while the corresponding page is running any [unload][] listeners, it may become detached as the
+newly navigated page replaced it in the frame tree.
+
[SCA]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm
[`postMessage`]: https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage
[`MessagePortMain`]: message-port-main.md
+[unload]: https://developer.mozilla.org/en-US/docs/Web/API/Window/unload_event
diff --git a/docs/api/web-request.md b/docs/api/web-request.md
index 232831e780..062084831d 100644
--- a/docs/api/web-request.md
+++ b/docs/api/web-request.md
@@ -51,7 +51,8 @@ The following methods are available on instances of `WebRequest`:
* `method` string
* `webContentsId` Integer (optional)
* `webContents` WebContents (optional)
- * `frame` WebFrameMain (optional)
+ * `frame` WebFrameMain | null (optional) - Requesting frame.
+ May be `null` if accessed after the frame has either navigated or been destroyed.
* `resourceType` string - Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`, `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
* `referrer` string
* `timestamp` Double
@@ -94,7 +95,8 @@ Some examples of valid `urls`:
* `method` string
* `webContentsId` Integer (optional)
* `webContents` WebContents (optional)
- * `frame` WebFrameMain (optional)
+ * `frame` WebFrameMain | null (optional) - Requesting frame.
+ May be `null` if accessed after the frame has either navigated or been destroyed.
* `resourceType` string - Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`, `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
* `referrer` string
* `timestamp` Double
@@ -122,7 +124,8 @@ The `callback` has to be called with a `response` object.
* `method` string
* `webContentsId` Integer (optional)
* `webContents` WebContents (optional)
- * `frame` WebFrameMain (optional)
+ * `frame` WebFrameMain | null (optional) - Requesting frame.
+ May be `null` if accessed after the frame has either navigated or been destroyed.
* `resourceType` string - Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`, `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
* `referrer` string
* `timestamp` Double
@@ -142,7 +145,8 @@ response are visible by the time this listener is fired.
* `method` string
* `webContentsId` Integer (optional)
* `webContents` WebContents (optional)
- * `frame` WebFrameMain (optional)
+ * `frame` WebFrameMain | null (optional) - Requesting frame.
+ May be `null` if accessed after the frame has either navigated or been destroyed.
* `resourceType` string - Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`, `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
* `referrer` string
* `timestamp` Double
@@ -173,7 +177,8 @@ The `callback` has to be called with a `response` object.
* `method` string
* `webContentsId` Integer (optional)
* `webContents` WebContents (optional)
- * `frame` WebFrameMain (optional)
+ * `frame` WebFrameMain | null (optional) - Requesting frame.
+ May be `null` if accessed after the frame has either navigated or been destroyed.
* `resourceType` string - Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`, `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
* `referrer` string
* `timestamp` Double
@@ -197,7 +202,8 @@ and response headers are available.
* `method` string
* `webContentsId` Integer (optional)
* `webContents` WebContents (optional)
- * `frame` WebFrameMain (optional)
+ * `frame` WebFrameMain | null (optional) - Requesting frame.
+ May be `null` if accessed after the frame has either navigated or been destroyed.
* `resourceType` string - Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`, `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
* `referrer` string
* `timestamp` Double
@@ -222,7 +228,8 @@ redirect is about to occur.
* `method` string
* `webContentsId` Integer (optional)
* `webContents` WebContents (optional)
- * `frame` WebFrameMain (optional)
+ * `frame` WebFrameMain | null (optional) - Requesting frame.
+ May be `null` if accessed after the frame has either navigated or been destroyed.
* `resourceType` string - Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`, `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
* `referrer` string
* `timestamp` Double
@@ -245,7 +252,8 @@ completed.
* `method` string
* `webContentsId` Integer (optional)
* `webContents` WebContents (optional)
- * `frame` WebFrameMain (optional)
+ * `frame` WebFrameMain | null (optional) - Requesting frame.
+ May be `null` if accessed after the frame has either navigated or been destroyed.
* `resourceType` string - Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`, `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
* `referrer` string
* `timestamp` Double
diff --git a/docs/breaking-changes.md b/docs/breaking-changes.md
index b6d36b2e70..d8dcb2e98e 100644
--- a/docs/breaking-changes.md
+++ b/docs/breaking-changes.md
@@ -14,6 +14,34 @@ This document uses the following convention to categorize breaking changes:
## Planned Breaking API Changes (33.0)
+### Behavior Changed: frame properties may retrieve detached WebFrameMain instances or none at all
+
+APIs which provide access to a `WebFrameMain` instance may return an instance
+with `frame.detached` set to `true`, or possibly return `null`.
+
+When a frame performs a cross-origin navigation, it enters into a detached state
+in which it's no longer attached to the page. In this state, it may be running
+[unload](https://developer.mozilla.org/en-US/docs/Web/API/Window/unload_event)
+handlers prior to being deleted. In the event of an IPC sent during this state,
+`frame.detached` will be set to `true` with the frame being destroyed shortly
+thereafter.
+
+When receiving an event, it's important to access WebFrameMain properties
+immediately upon being received. Otherwise, it's not guaranteed to point to the
+same webpage as when received. To avoid misaligned expectations, Electron will
+return `null` in the case of late access where the webpage has changed.
+
+```ts
+ipcMain.on('unload-event', (event) => {
+ event.senderFrame; // ✅ accessed immediately
+});
+
+ipcMain.on('unload-event', async (event) => {
+ await crossOriginNavigationPromise;
+ event.senderFrame; // ❌ returns `null` due to late access
+});
+```
+
### Behavior Changed: custom protocol URL handling on Windows
Due to changes made in Chromium to support [Non-Special Scheme URLs](http://bit.ly/url-non-special), custom protocol URLs that use Windows file paths will no longer work correctly with the deprecated `protocol.registerFileProtocol` and the `baseURLForDataURL` property on `BrowserWindow.loadURL`, `WebContents.loadURL`, and `<webview>.loadURL`. `protocol.handle` will also not work with these types of URLs but this is not a change since it has always worked that way.
diff --git a/lib/browser/api/web-contents.ts b/lib/browser/api/web-contents.ts
index 4bde139eeb..ed519db1e8 100644
--- a/lib/browser/api/web-contents.ts
+++ b/lib/browser/api/web-contents.ts
@@ -485,10 +485,6 @@ const addReplyToEvent = (event: Electron.IpcMainEvent) => {
const addSenderToEvent = (event: Electron.IpcMainEvent | Electron.IpcMainInvokeEvent, sender: Electron.WebContents) => {
event.sender = sender;
- const { processId, frameId } = event;
- Object.defineProperty(event, 'senderFrame', {
- get: () => webFrameMain.fromId(processId, frameId)
- });
};
const addReturnValueToEvent = (event: Electron.IpcMainEvent) => {
@@ -498,11 +494,6 @@ const addReturnValueToEvent = (event: Electron.IpcMainEvent) => {
});
};
-const getWebFrameForEvent = (event: Electron.IpcMainEvent | Electron.IpcMainInvokeEvent) => {
- if (!event.processId || !event.frameId) return null;
- return webFrameMainBinding.fromIdOrNull(event.processId, event.frameId);
-};
-
const commandLine = process._linkedBinding('electron_common_command_line');
const environment = process._linkedBinding('electron_common_environment');
@@ -580,6 +571,28 @@ WebContents.prototype._init = function () {
enumerable: true
});
+ /**
+ * Cached IPC emitters sorted by dispatch priority.
+ * Caching is used to avoid frequent array allocations.
+ *
+ * 0: WebFrameMain ipc
+ * 1: WebContents ipc
+ * 2: ipcMain
+ */
+ const cachedIpcEmitters: (ElectronInternal.IpcMainInternal | undefined)[] = [undefined, ipc, ipcMain];
+
+ // Get list of relevant IPC emitters for dispatch.
+ const getIpcEmittersForEvent = (event: Electron.IpcMainEvent | Electron.IpcMainInvokeEvent): (ElectronInternal.IpcMainInternal | undefined)[] => {
+ // Lookup by FrameTreeNode ID to ensure IPCs received after a frame swap are
+ // always received. This occurs when a RenderFrame sends an IPC while it's
+ // unloading and its internal state is pending deletion.
+ const { frameTreeNodeId } = event;
+ const webFrameByFtn = frameTreeNodeId ? webFrameMainBinding._fromFtnIdIfExists(frameTreeNodeId) : undefined;
+ cachedIpcEmitters[0] = webFrameByFtn?.ipc;
+
+ return cachedIpcEmitters;
+ };
+
// Add navigationHistory property which handles session history,
// maintaining a list of navigation entries for backward and forward navigation.
Object.defineProperty(this, 'navigationHistory', {
@@ -610,10 +623,9 @@ WebContents.prototype._init = function () {
} else {
addReplyToEvent(event);
this.emit('ipc-message', event, channel, ...args);
- const maybeWebFrame = getWebFrameForEvent(event);
- maybeWebFrame && maybeWebFrame.ipc.emit(channel, event, ...args);
- ipc.emit(channel, event, ...args);
- ipcMain.emit(channel, event, ...args);
+ for (const ipcEmitter of getIpcEmittersForEvent(event)) {
+ ipcEmitter?.emit(channel, event, ...args);
+ }
}
});
@@ -624,9 +636,8 @@ WebContents.prototype._init = function () {
console.error(`Error occurred in handler for '${channel}':`, error);
event._replyChannel.sendReply({ error: error.toString() });
};
- const maybeWebFrame = getWebFrameForEvent(event);
- const targets: (ElectronInternal.IpcMainInternal| undefined)[] = internal ? [ipcMainInternal] : [maybeWebFrame?.ipc, ipc, ipcMain];
- const target = targets.find(target => target && (target as any)._invokeHandlers.has(channel));
+ const targets: (ElectronInternal.IpcMainInternal | undefined)[] = internal ? [ipcMainInternal] : getIpcEmittersForEvent(event);
+ const target = targets.find(target => (target as any)?._invokeHandlers.has(channel));
if (target) {
const handler = (target as any)._invokeHandlers.get(channel);
try {
@@ -646,24 +657,27 @@ WebContents.prototype._init = function () {
ipcMainInternal.emit(channel, event, ...args);
} else {
addReplyToEvent(event);
- const maybeWebFrame = getWebFrameForEvent(event);
- if (this.listenerCount('ipc-message-sync') === 0 && ipc.listenerCount(channel) === 0 && ipcMain.listenerCount(channel) === 0 && (!maybeWebFrame || maybeWebFrame.ipc.listenerCount(channel) === 0)) {
+ const ipcEmitters = getIpcEmittersForEvent(event);
+ if (
+ this.listenerCount('ipc-message-sync') === 0 &&
+ ipcEmitters.every(emitter => !emitter || emitter.listenerCount(channel) === 0)
+ ) {
console.warn(`WebContents #${this.id} called ipcRenderer.sendSync() with '${channel}' channel without listeners.`);
}
this.emit('ipc-message-sync', event, channel, ...args);
- maybeWebFrame && maybeWebFrame.ipc.emit(channel, event, ...args);
- ipc.emit(channel, event, ...args);
- ipcMain.emit(channel, event, ...args);
+ for (const ipcEmitter of ipcEmitters) {
+ ipcEmitter?.emit(channel, event, ...args);
+ }
}
});
this.on('-ipc-ports', function (this: Electron.WebContents, event: Electron.IpcMainEvent, internal: boolean, channel: string, message: any, ports: any[]) {
addSenderToEvent(event, this);
event.ports = ports.map(p => new MessagePortMain(p));
- const maybeWebFrame = getWebFrameForEvent(event);
- maybeWebFrame && maybeWebFrame.ipc.emit(channel, event, message);
- ipc.emit(channel, event, message);
- ipcMain.emit(channel, event, message);
+ const ipcEmitters = getIpcEmittersForEvent(event);
+ for (const ipcEmitter of ipcEmitters) {
+ ipcEmitter?.emit(channel, event, message);
+ }
});
this.on('render-process-gone', (event, details) => {
diff --git a/lib/browser/guest-view-manager.ts b/lib/browser/guest-view-manager.ts
index f05d51b8ca..b64f599522 100644
--- a/lib/browser/guest-view-manager.ts
+++ b/lib/browser/guest-view-manager.ts
@@ -168,8 +168,8 @@ const createGuest = function (embedder: Electron.WebContents, embedderFrameId: n
sendToEmbedder(IPC_MESSAGES.GUEST_VIEW_INTERNAL_DISPATCH_EVENT, 'will-frame-navigate', {
url: event.url,
isMainFrame: event.isMainFrame,
- frameProcessId: event.frame.processId,
- frameRoutingId: event.frame.routingId
+ frameProcessId: event.processId,
+ frameRoutingId: event.routingId
});
});
diff --git a/shell/browser/api/electron_api_web_contents.cc b/shell/browser/api/electron_api_web_contents.cc
index 530b1ac5dc..a9a96e74e2 100644
--- a/shell/browser/api/electron_api_web_contents.cc
+++ b/shell/browser/api/electron_api_web_contents.cc
@@ -1689,7 +1689,8 @@ void WebContents::RenderFrameHostChanged(content::RenderFrameHost* old_host,
//
// |old_host| can be a nullptr so we use |new_host| for looking up the
// WebFrameMain instance.
- auto* web_frame = WebFrameMain::FromRenderFrameHost(new_host);
+ auto* web_frame =
+ WebFrameMain::FromFrameTreeNodeId(new_host->GetFrameTreeNodeId());
if (web_frame) {
web_frame->UpdateRenderFrameHost(new_host);
}
@@ -1861,6 +1862,8 @@ bool WebContents::EmitNavigationEvent(
dict.Set("url", url);
dict.Set("isSameDocument", is_same_document);
dict.Set("isMainFrame", is_main_frame);
+ dict.Set("processId", frame_process_id);
+ dict.Set("routingId", frame_routing_id);
dict.SetGetter("frame", frame_host);
dict.SetGetter("initiator", initiator_frame_host);
@@ -1980,8 +1983,10 @@ gin::Handle<gin_helper::internal::Event> WebContents::MakeEventWithSender(
dict.Set("_replyChannel",
ReplyChannel::Create(isolate, std::move(callback)));
if (frame) {
+ dict.SetGetter("senderFrame", frame);
dict.Set("frameId", frame->GetRoutingID());
dict.Set("processId", frame->GetProcess()->GetID());
+ dict.Set("frameTreeNodeId", frame->GetFrameTreeNodeId());
}
return event;
}
diff --git a/shell/browser/api/electron_api_web_frame_main.cc b/shell/browser/api/electron_api_web_frame_main.cc
index 194cb88a45..5b3b2644fc 100644
--- a/shell/browser/api/electron_api_web_frame_main.cc
+++ b/shell/browser/api/electron_api_web_frame_main.cc
@@ -33,6 +33,37 @@
#include "shell/common/node_includes.h"
#include "shell/common/v8_value_serializer.h"
+namespace {
+
+// RenderFrameHost (RFH) exists as a child of a FrameTreeNode. When a
+// cross-origin navigation occurs, the FrameTreeNode swaps RFHs. After
+// swapping, the old RFH will be marked for deletion and run any unload
+// listeners. If an IPC is sent during an unload/beforeunload listener,
+// it's possible that it arrives after the RFH swap and has been
+// detached from the FrameTreeNode.
+bool IsDetachedFrameHost(content::RenderFrameHost* rfh) {
+ if (!rfh)
+ return true;
+
+ // RenderFrameCreated is called for speculative frames which may not be
+ // used in certain cross-origin navigations. Invoking
+ // RenderFrameHost::GetLifecycleState currently crashes when called for
+ // speculative frames so we need to filter it out for now. Check
+ // https://crbug.com/1183639 for details on when this can be removed.
+ auto* rfh_impl = static_cast<content::RenderFrameHostImpl*>(rfh);
+
+ // During cross-origin navigation, a RFH may be swapped out of its
+ // FrameTreeNode with a new RFH. In these cases, it's marked for
+ // deletion. As this pending deletion RFH won't be following future
+ // swaps, we need to indicate that its been pinned.
+ return (rfh_impl->lifecycle_state() !=
+ content::RenderFrameHostImpl::LifecycleStateImpl::kSpeculative &&
+ rfh->GetLifecycleState() ==
+ content::RenderFrameHost::LifecycleState::kPendingDeletion);
+}
+
+} // namespace
+
namespace gin {
template <>
@@ -57,45 +88,64 @@ struct Converter<blink::mojom::PageVisibilityState> {
namespace electron::api {
+// FrameTreeNodeId -> WebFrameMain*
+// Using FrameTreeNode allows us to track frame across navigations. This
+// is most similar to how <iframe> works.
typedef std::unordered_map<content::FrameTreeNodeId,
WebFrameMain*,
content::FrameTreeNodeId::Hasher>
- WebFrameMainIdMap;
+ FrameTreeNodeIdMap;
-WebFrameMainIdMap& GetWebFrameMainMap() {
- static base::NoDestructor<WebFrameMainIdMap> instance;
+// Token -> WebFrameMain*
+// Maps exact RFH to a WebFrameMain instance.
+typedef std::map<content::GlobalRenderFrameHostToken, WebFrameMain*>
+ FrameTokenMap;
+
+FrameTreeNodeIdMap& GetFrameTreeNodeIdMap() {
+ static base::NoDestructor<FrameTreeNodeIdMap> instance;
+ return *instance;
+}
+FrameTokenMap& GetFrameTokenMap() {
+ static base::NoDestructor<FrameTokenMap> instance;
return *instance;
}
// static
WebFrameMain* WebFrameMain::FromFrameTreeNodeId(
content::FrameTreeNodeId frame_tree_node_id) {
- WebFrameMainIdMap& frame_map = GetWebFrameMainMap();
+ // Pinned frames aren't tracked across navigations so only non-pinned
+ // frames will be retrieved.
+ FrameTreeNodeIdMap& frame_map = GetFrameTreeNodeIdMap();
auto iter = frame_map.find(frame_tree_node_id);
auto* web_frame = iter == frame_map.end() ? nullptr : iter->second;
return web_frame;
}
+// static
+WebFrameMain* WebFrameMain::FromFrameToken(
+ content::GlobalRenderFrameHostToken frame_token) {
+ FrameTokenMap& frame_map = GetFrameTokenMap();
+ auto iter = frame_map.find(frame_token);
+ auto* web_frame = iter == frame_map.end() ? nullptr : iter->second;
+ return web_frame;
+}
+
// static
WebFrameMain* WebFrameMain::FromRenderFrameHost(content::RenderFrameHost* rfh) {
if (!rfh)
return nullptr;
-
- // TODO(codebytere): remove after refactoring away from FrameTreeNodeId as map
- // key.
- auto* ftn =
- static_cast<content::RenderFrameHostImpl*>(rfh)->frame_tree_node();
- if (!ftn)
- return nullptr;
-
- return FromFrameTreeNodeId(rfh->GetFrameTreeNodeId());
+ return FromFrameToken(rfh->GetGlobalFrameToken());
}
gin::WrapperInfo WebFrameMain::kWrapperInfo = {gin::kEmbedderNativeGin};
WebFrameMain::WebFrameMain(content::RenderFrameHost* rfh)
- : frame_tree_node_id_(rfh->GetFrameTreeNodeId()), render_frame_(rfh) {
- GetWebFrameMainMap().emplace(frame_tree_node_id_, this);
+ : frame_tree_node_id_(rfh->GetFrameTreeNodeId()),
+ frame_token_(rfh->GetGlobalFrameToken()),
+ render_frame_(rfh),
+ render_frame_detached_(IsDetachedFrameHost(rfh)) {
+ GetFrameTreeNodeIdMap().emplace(frame_tree_node_id_, this);
+ GetFrameTokenMap().emplace(frame_token_, this);
}
WebFrameMain::~WebFrameMain() {
@@ -104,18 +154,24 @@ WebFrameMain::~WebFrameMain() {
void WebFrameMain::Destroyed() {
MarkRenderFrameDisposed();
- GetWebFrameMainMap().erase(frame_tree_node_id_);
+ GetFrameTreeNodeIdMap().erase(frame_tree_node_id_);
+ GetFrameTokenMap().erase(frame_token_);
Unpin();
}
void WebFrameMain::MarkRenderFrameDisposed() {
render_frame_ = nullptr;
+ render_frame_detached_ = true;
render_frame_disposed_ = true;
TeardownMojoConnection();
}
+// Should only be called when swapping frames.
void WebFrameMain::UpdateRenderFrameHost(content::RenderFrameHost* rfh) {
- // Should only be called when swapping frames.
+ GetFrameTokenMap().erase(frame_token_);
+ frame_token_ = rfh->GetGlobalFrameToken();
+ GetFrameTokenMap().emplace(frame_token_, this);
+
render_frame_disposed_ = false;
render_frame_ = rfh;
TeardownMojoConnection();
@@ -186,6 +242,10 @@ bool WebFrameMain::Reload() {
return render_frame_->Reload();
}
+bool WebFrameMain::IsDestroyed() const {
+ return render_frame_disposed_;
+}
+
void WebFrameMain::Send(v8::Isolate* isolate,
bool internal,
const std::string& channel,
@@ -275,8 +335,12 @@ void WebFrameMain::PostMessage(v8::Isolate* isolate,
std::move(transferable_message));
}
-int WebFrameMain::FrameTreeNodeIDAsInt() const {
- return frame_tree_node_id_.value();
+bool WebFrameMain::Detached() const {
+ return render_frame_detached_;
+}
+
+content::FrameTreeNodeId WebFrameMain::FrameTreeNodeID() const {
+ return frame_tree_node_id_;
}
std::string WebFrameMain::Name() const {
@@ -389,29 +453,17 @@ gin::Handle<WebFrameMain> WebFrameMain::From(v8::Isolate* isolate,
return handle;
}
-// static
-gin::Handle<WebFrameMain> WebFrameMain::FromOrNull(
- v8::Isolate* isolate,
- content::RenderFrameHost* rfh) {
- if (!rfh)
- return gin::Handle<WebFrameMain>();
-
- auto* web_frame = FromRenderFrameHost(rfh);
- if (!web_frame)
- return gin::Handle<WebFrameMain>();
-
- return gin::CreateHandle(isolate, web_frame);
-}
-
// static
void WebFrameMain::FillObjectTemplate(v8::Isolate* isolate,
v8::Local<v8::ObjectTemplate> templ) {
gin_helper::ObjectTemplateBuilder(isolate, templ)
.SetMethod("executeJavaScript", &WebFrameMain::ExecuteJavaScript)
.SetMethod("reload", &WebFrameMain::Reload)
+ .SetMethod("isDestroyed", &WebFrameMain::IsDestroyed)
.SetMethod("_send", &WebFrameMain::Send)
.SetMethod("_postMessage", &WebFrameMain::PostMessage)
- .SetProperty("frameTreeNodeId", &WebFrameMain::FrameTreeNodeIDAsInt)
+ .SetProperty("detached", &WebFrameMain::Detached)
+ .SetProperty("frameTreeNodeId", &WebFrameMain::FrameTreeNodeID)
.SetProperty("name", &WebFrameMain::Name)
.SetProperty("osProcessId", &WebFrameMain::OSProcessID)
.SetProperty("processId", &WebFrameMain::ProcessID)
@@ -446,22 +498,38 @@ v8::Local<v8::Value> FromID(gin_helper::ErrorThrower thrower,
auto* rfh =
content::RenderFrameHost::FromID(render_process_id, render_frame_id);
+ if (!rfh)
+ return v8::Undefined(thrower.isolate());
return WebFrameMain::From(thrower.isolate(), rfh).ToV8();
}
-v8::Local<v8::Value> FromIDOrNull(gin_helper::ErrorThrower thrower,
- int render_process_id,
- int render_frame_id) {
+v8::Local<v8::Value> FromIdIfExists(gin_helper::ErrorThrower thrower,
+ int render_process_id,
+ int render_frame_id) {
if (!electron::Browser::Get()->is_ready()) {
thrower.ThrowError("WebFrameMain is available only after app ready");
return v8::Null(thrower.isolate());
}
-
- auto* rfh =
+ content::RenderFrameHost* rfh =
content::RenderFrameHost::FromID(render_process_id, render_frame_id);
+ WebFrameMain* web_frame = WebFrameMain::FromRenderFrameHost(rfh);
+ if (!web_frame)
+ return v8::Null(thrower.isolate());
+ return gin::CreateHandle(thrower.isolate(), web_frame).ToV8();
+}
- return WebFrameMain::FromOrNull(thrower.isolate(), rfh).ToV8();
+v8::Local<v8::Value> FromFtnIdIfExists(gin_helper::ErrorThrower thrower,
+ int frame_tree_node_id) {
+ if (!electron::Browser::Get()->is_ready()) {
+ thrower.ThrowError("WebFrameMain is available only after app ready");
+ return v8::Null(thrower.isolate());
+ }
+ WebFrameMain* web_frame = WebFrameMain::FromFrameTreeNodeId(
+ content::FrameTreeNodeId(frame_tree_node_id));
+ if (!web_frame)
+ return v8::Null(thrower.isolate());
+ return gin::CreateHandle(thrower.isolate(), web_frame).ToV8();
}
void Initialize(v8::Local<v8::Object> exports,
@@ -472,7 +540,8 @@ void Initialize(v8::Local<v8::Object> exports,
gin_helper::Dictionary dict(isolate, exports);
dict.Set("WebFrameMain", WebFrameMain::GetConstructor(context));
dict.SetMethod("fromId", &FromID);
- dict.SetMethod("fromIdOrNull", &FromIDOrNull);
+ dict.SetMethod("_fromIdIfExists", &FromIdIfExists);
+ dict.SetMethod("_fromFtnIdIfExists", &FromFtnIdIfExists);
}
} // namespace
diff --git a/shell/browser/api/electron_api_web_frame_main.h b/shell/browser/api/electron_api_web_frame_main.h
index 73230af232..5f765dca48 100644
--- a/shell/browser/api/electron_api_web_frame_main.h
+++ b/shell/browser/api/electron_api_web_frame_main.h
@@ -13,6 +13,7 @@
#include "base/memory/weak_ptr.h"
#include "base/process/process.h"
#include "content/public/browser/frame_tree_node_id.h"
+#include "content/public/browser/global_routing_id.h"
#include "gin/wrappable.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
@@ -51,11 +52,10 @@ class WebFrameMain final : public gin::Wrappable<WebFrameMain>,
static gin::Handle<WebFrameMain> From(
v8::Isolate* isolate,
content::RenderFrameHost* render_frame_host);
- static gin::Handle<WebFrameMain> FromOrNull(
- v8::Isolate* isolate,
- content::RenderFrameHost* render_frame_host);
static WebFrameMain* FromFrameTreeNodeId(
content::FrameTreeNodeId frame_tree_node_id);
+ static WebFrameMain* FromFrameToken(
+ content::GlobalRenderFrameHostToken frame_token);
static WebFrameMain* FromRenderFrameHost(
content::RenderFrameHost* render_frame_host);
@@ -103,6 +103,7 @@ class WebFrameMain final : public gin::Wrappable<WebFrameMain>,
v8::Local<v8::Promise> ExecuteJavaScript(gin::Arguments* args,
const std::u16string& code);
bool Reload();
+ bool IsDestroyed() const;
void Send(v8::Isolate* isolate,
bool internal,
const std::string& channel,
@@ -112,7 +113,8 @@ class WebFrameMain final : public gin::Wrappable<WebFrameMain>,
v8::Local<v8::Value> message_value,
std::optional<v8::Local<v8::Value>> transfer);
- int FrameTreeNodeIDAsInt() const;
+ bool Detached() const;
+ content::FrameTreeNodeId FrameTreeNodeID() const;
std::string Name() const;
base::ProcessId OSProcessID() const;
int ProcessID() const;
@@ -132,6 +134,7 @@ class WebFrameMain final : public gin::Wrappable<WebFrameMain>,
mojo::PendingReceiver<mojom::ElectronRenderer> pending_receiver_;
content::FrameTreeNodeId frame_tree_node_id_;
+ content::GlobalRenderFrameHostToken frame_token_;
raw_ptr<content::RenderFrameHost> render_frame_ = nullptr;
@@ -139,6 +142,10 @@ class WebFrameMain final : public gin::Wrappable<WebFrameMain>,
// be accessed.
bool render_frame_disposed_ = false;
+ // Whether the content::RenderFrameHost is detached from the frame
+ // tree. This can occur while it's running unload handlers.
+ bool render_frame_detached_;
+
base::WeakPtrFactory<WebFrameMain> weak_factory_{this};
};
diff --git a/shell/common/gin_converters/frame_converter.cc b/shell/common/gin_converters/frame_converter.cc
index 636e028562..e089bf9d8f 100644
--- a/shell/common/gin_converters/frame_converter.cc
+++ b/shell/common/gin_converters/frame_converter.cc
@@ -8,6 +8,7 @@
#include "content/public/browser/render_process_host.h"
#include "shell/browser/api/electron_api_web_frame_main.h"
#include "shell/common/gin_helper/accessor.h"
+#include "shell/common/node_util.h"
namespace gin {
@@ -17,6 +18,13 @@ v8::Persistent<v8::ObjectTemplate> rfh_templ;
} // namespace
+// static
+v8::Local<v8::Value> Converter<content::FrameTreeNodeId>::ToV8(
+ v8::Isolate* isolate,
+ const content::FrameTreeNodeId& val) {
+ return v8::Number::New(isolate, val.value());
+}
+
// static
v8::Local<v8::Value> Converter<content::RenderFrameHost*>::ToV8(
v8::Isolate* isolate,
@@ -94,8 +102,17 @@ bool Converter<gin_helper::AccessorValue<content::RenderFrameHost*>>::FromV8(
const int routing_id = routing_id_wrapper.As<v8::Number>()->Value();
auto* rfh = content::RenderFrameHost::FromID(process_id, routing_id);
- if (!rfh)
- return false;
+
+ if (!rfh) {
+ // Lazily evaluted property accessed after RFH has been destroyed.
+ // Continue to return nullptr, but emit warning to inform developers
+ // what occurred.
+ electron::util::EmitWarning(
+ isolate,
+ "Frame property was accessed after it navigated or was destroyed. "
+ "Avoid asynchronous tasks prior to indexing.",
+ "electron");
+ }
out->Value = rfh;
return true;
diff --git a/shell/common/gin_converters/frame_converter.h b/shell/common/gin_converters/frame_converter.h
index 732cb16d47..1452ffe89d 100644
--- a/shell/common/gin_converters/frame_converter.h
+++ b/shell/common/gin_converters/frame_converter.h
@@ -5,15 +5,23 @@
#ifndef ELECTRON_SHELL_COMMON_GIN_CONVERTERS_FRAME_CONVERTER_H_
#define ELECTRON_SHELL_COMMON_GIN_CONVERTERS_FRAME_CONVERTER_H_
+#include "content/public/browser/frame_tree_node_id.h"
#include "gin/converter.h"
#include "shell/common/gin_helper/accessor.h"
namespace content {
class RenderFrameHost;
+
}
namespace gin {
+template <>
+struct Converter<content::FrameTreeNodeId> {
+ static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
+ const content::FrameTreeNodeId& val);
+};
+
template <>
struct Converter<content::RenderFrameHost*> {
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
diff --git a/spec/api-browser-window-spec.ts b/spec/api-browser-window-spec.ts
index 5a200a5885..cfa4bf58d3 100755
--- a/spec/api-browser-window-spec.ts
+++ b/spec/api-browser-window-spec.ts
@@ -591,7 +591,7 @@ describe('BrowserWindow module', () => {
it('is triggered when a cross-origin iframe navigates _top', async () => {
w.loadURL(`data:text/html,<iframe src="http://127.0.0.1:${(server.address() as AddressInfo).port}/navigate-top"></iframe>`);
await emittedUntil(w.webContents, 'did-frame-finish-load', (e: any, isMainFrame: boolean) => !isMainFrame);
- let initiator: WebFrameMain | undefined;
+ let initiator: WebFrameMain | null | undefined;
w.webContents.on('will-navigate', (e) => {
initiator = e.initiator;
});
diff --git a/spec/api-ipc-spec.ts b/spec/api-ipc-spec.ts
index 38ff8f14ae..88eaaf4a0b 100644
--- a/spec/api-ipc-spec.ts
+++ b/spec/api-ipc-spec.ts
@@ -835,5 +835,23 @@ describe('ipc module', () => {
const [, arg] = await once(w.webContents.mainFrame.frames[0].ipc, 'test');
expect(arg).to.equal(42);
});
+
+ it('receives ipcs from unloading frames in the main frame', async () => {
+ const server = http.createServer((req, res) => {
+ res.setHeader('content-type', 'text/html');
+ res.end('');
+ });
+ const { port } = await listen(server);
+ defer(() => {
+ server.close();
+ });
+ const w = new BrowserWindow({ show: false, webPreferences: { nodeIntegration: true, contextIsolation: false } });
+ await w.loadURL(`http://localhost:${port}`);
+ await w.webContents.executeJavaScript('window.onunload = () => require(\'electron\').ipcRenderer.send(\'unload\'); void 0');
+ const onUnloadIpc = once(w.webContents.mainFrame.ipc, 'unload');
+ w.loadURL(`http://127.0.0.1:${port}`); // cross-origin navigation
+ const [{ senderFrame }] = await onUnloadIpc;
+ expect(senderFrame.detached).to.be.true();
+ });
});
});
diff --git a/spec/api-web-frame-main-spec.ts b/spec/api-web-frame-main-spec.ts
index 54c95c9ef4..9d1c9edae7 100644
--- a/spec/api-web-frame-main-spec.ts
+++ b/spec/api-web-frame-main-spec.ts
@@ -18,10 +18,10 @@ describe('webFrameMain module', () => {
const fileUrl = (filename: string) => url.pathToFileURL(path.join(subframesPath, filename)).href;
- type Server = { server: http.Server, url: string }
+ type Server = { server: http.Server, url: string, crossOriginUrl: string }
/** Creates an HTTP server whose handler embeds the given iframe src. */
- const createServer = async () => {
+ const createServer = async (): Promise<Server> => {
const server = http.createServer((req, res) => {
const params = new URLSearchParams(new URL(req.url || '', `http://${req.headers.host}`).search || '');
if (params.has('frameSrc')) {
@@ -30,7 +30,15 @@ describe('webFrameMain module', () => {
res.end('');
}
});
- return { server, url: (await listen(server)).url + '/' };
+ const serverUrl = (await listen(server)).url + '/';
+ // HACK: Use 'localhost' instead of '127.0.0.1' so Chromium treats it as
+ // a separate origin because differing ports aren't enough 🤔
+ const crossOriginUrl = serverUrl.replace('127.0.0.1', 'localhost');
+ return {
+ server,
+ url: serverUrl,
+ crossOriginUrl
+ };
};
afterEach(closeAllWindows);
@@ -285,8 +293,15 @@ describe('webFrameMain module', () => {
});
describe('RenderFrame lifespan', () => {
+ let server: Awaited<ReturnType<typeof createServer>>;
let w: BrowserWindow;
+ before(async () => {
+ server = await createServer();
+ });
+ after(() => {
+ server.server.close();
+ });
beforeEach(async () => {
w = new BrowserWindow({ show: false });
});
@@ -302,19 +317,15 @@ describe('webFrameMain module', () => {
});
it('persists through cross-origin navigation', async () => {
- const server = await createServer();
- // 'localhost' is treated as a separate origin.
- const crossOriginUrl = server.url.replace('127.0.0.1', 'localhost');
await w.loadURL(server.url);
const { mainFrame } = w.webContents;
expect(mainFrame.url).to.equal(server.url);
- await w.loadURL(crossOriginUrl);
+ await w.loadURL(server.crossOriginUrl);
expect(w.webContents.mainFrame).to.equal(mainFrame);
- expect(mainFrame.url).to.equal(crossOriginUrl);
+ expect(mainFrame.url).to.equal(server.crossOriginUrl);
});
it('recovers from renderer crash on same-origin', async () => {
- const server = await createServer();
// Keep reference to mainFrame alive throughout crash and recovery.
const { mainFrame } = w.webContents;
await w.webContents.loadURL(server.url);
@@ -328,9 +339,6 @@ describe('webFrameMain module', () => {
// Fixed by #34411
it('recovers from renderer crash on cross-origin', async () => {
- const server = await createServer();
- // 'localhost' is treated as a separate origin.
- const crossOriginUrl = server.url.replace('127.0.0.1', 'localhost');
// Keep reference to mainFrame alive throughout crash and recovery.
const { mainFrame } = w.webContents;
await w.webContents.loadURL(server.url);
@@ -339,10 +347,79 @@ describe('webFrameMain module', () => {
await crashEvent;
// A short wait seems to be required to reproduce the crash.
await setTimeout(100);
- await w.webContents.loadURL(crossOriginUrl);
+ await w.webContents.loadURL(server.crossOriginUrl);
// Log just to keep mainFrame in scope.
console.log('mainFrame.url', mainFrame.url);
});
+
+ it('returns null upon accessing senderFrame after cross-origin navigation', async () => {
+ w = new BrowserWindow({
+ show: false,
+ webPreferences: {
+ preload: path.join(subframesPath, 'preload.js')
+ }
+ });
+ const preloadPromise = once(ipcMain, 'preload-ran');
+ await w.webContents.loadURL(server.url);
+ const [event] = await preloadPromise;
+ await w.webContents.loadURL(server.crossOriginUrl);
+ // senderFrame now points to a disposed RenderFrameHost. It should
+ // be null when attempting to access the lazily evaluated property.
+ expect(event.senderFrame).to.be.null();
+ });
+
+ it('is detached when unload handler sends IPC', async () => {
+ w = new BrowserWindow({
+ show: false,
+ webPreferences: {
+ preload: path.join(subframesPath, 'preload.js')
+ }
+ });
+ await w.webContents.loadURL(server.url);
+ const unloadPromise = new Promise<void>((resolve, reject) => {
+ ipcMain.once('preload-unload', (event) => {
+ try {
+ const { senderFrame } = event;
+ expect(senderFrame).to.not.be.null();
+ expect(senderFrame!.detached).to.be.true();
+ expect(senderFrame!.processId).to.equal(event.processId);
+ expect(senderFrame!.routingId).to.equal(event.frameId);
+ resolve();
+ } catch (error) {
+ reject(error);
+ }
+ });
+ });
+ await w.webContents.loadURL(server.crossOriginUrl);
+ await expect(unloadPromise).to.eventually.be.fulfilled();
+ });
+
+ it('disposes detached frame after cross-origin navigation', async () => {
+ w = new BrowserWindow({
+ show: false,
+ webPreferences: {
+ preload: path.join(subframesPath, 'preload.js')
+ }
+ });
+ await w.webContents.loadURL(server.url);
+ // eslint-disable-next-line prefer-const
+ let crossOriginPromise: Promise<void>;
+ const unloadPromise = new Promise<void>((resolve, reject) => {
+ ipcMain.once('preload-unload', async (event) => {
+ try {
+ const { senderFrame } = event;
+ expect(senderFrame!.detached).to.be.true();
+ await crossOriginPromise;
+ expect(() => senderFrame!.url).to.throw(/Render frame was disposed/);
+ resolve();
+ } catch (error) {
+ reject(error);
+ }
+ });
+ });
+ crossOriginPromise = w.webContents.loadURL(server.crossOriginUrl);
+ await expect(unloadPromise).to.eventually.be.fulfilled();
+ });
});
describe('webFrameMain.fromId', () => {
@@ -388,10 +465,6 @@ describe('webFrameMain module', () => {
it('is not emitted upon cross-origin navigation', async () => {
const server = await createServer();
- // HACK: Use 'localhost' instead of '127.0.0.1' so Chromium treats it as
- // a separate origin because differing ports aren't enough 🤔
- const secondUrl = server.url.replace('127.0.0.1', 'localhost');
-
const w = new BrowserWindow({ show: false });
await w.webContents.loadURL(server.url);
@@ -401,7 +474,7 @@ describe('webFrameMain module', () => {
frameCreatedEmitted = true;
});
- await w.webContents.loadURL(secondUrl);
+ await w.webContents.loadURL(server.crossOriginUrl);
expect(frameCreatedEmitted).to.be.false();
});
@@ -419,8 +492,8 @@ describe('webFrameMain module', () => {
const w = new BrowserWindow({ show: false });
const promise = new Promise<void>(resolve => {
w.webContents.on('frame-created', (e, { frame }) => {
- frame.on('dom-ready', () => {
- if (frame.name === 'frameA') {
+ frame!.on('dom-ready', () => {
+ if (frame!.name === 'frameA') {
resolve();
}
});
diff --git a/spec/fixtures/sub-frames/preload.js b/spec/fixtures/sub-frames/preload.js
index 52e87657f1..cc36e49e4b 100644
--- a/spec/fixtures/sub-frames/preload.js
+++ b/spec/fixtures/sub-frames/preload.js
@@ -7,3 +7,7 @@ ipcRenderer.send('preload-ran', window.location.href, webFrame.routingId);
ipcRenderer.on('preload-ping', () => {
ipcRenderer.send('preload-pong', webFrame.routingId);
});
+
+window.addEventListener('unload', () => {
+ ipcRenderer.send('preload-unload', window.location.href);
+});
diff --git a/typings/internal-ambient.d.ts b/typings/internal-ambient.d.ts
index 27c0b9f32e..4b5470e775 100644
--- a/typings/internal-ambient.d.ts
+++ b/typings/internal-ambient.d.ts
@@ -125,7 +125,8 @@ declare namespace NodeJS {
interface WebFrameMainBinding {
WebFrameMain: typeof Electron.WebFrameMain;
fromId(processId: number, routingId: number): Electron.WebFrameMain;
- fromIdOrNull(processId: number, routingId: number): Electron.WebFrameMain | null;
+ _fromIdIfExists(processId: number, routingId: number): Electron.WebFrameMain | null;
+ _fromFtnIdIfExists(frameTreeNodeId: number): Electron.WebFrameMain | null;
}
interface InternalWebPreferences {
diff --git a/typings/internal-electron.d.ts b/typings/internal-electron.d.ts
index 8de940b1ec..b213b031a6 100644
--- a/typings/internal-electron.d.ts
+++ b/typings/internal-electron.d.ts
@@ -177,10 +177,12 @@ declare namespace Electron {
interface IpcMainEvent {
_replyChannel: ReplyChannel;
+ frameTreeNodeId?: number;
}
interface IpcMainInvokeEvent {
_replyChannel: ReplyChannel;
+ frameTreeNodeId?: number;
}
// Deprecated / undocumented BrowserWindow methods
@@ -225,6 +227,11 @@ declare namespace Electron {
once(event: 'destroyed', listener: (event: Electron.Event) => void): this;
}
+
+ interface WebContentsWillFrameNavigateEventParams {
+ processId: number;
+ routingId: number;
+ }
}
declare namespace ElectronInternal {
|
feat
|
e78ce826415b8d64e9cb2c3b40ba18eadb83f23d
|
Shelley Vohr
|
2023-11-22 17:37:40
|
fix: do not call `after()` `async_hook` for `asyncId` 0 (#40574)
fix: do not call after() async_hook for asyncId 0
|
diff --git a/shell/common/node_bindings.cc b/shell/common/node_bindings.cc
index 007f0bd6d0..f58a8298bb 100644
--- a/shell/common/node_bindings.cc
+++ b/shell/common/node_bindings.cc
@@ -279,8 +279,11 @@ void ErrorMessageListener(v8::Local<v8::Message> message,
// Analogous to node/lib/internal/process/execution.js#L176-L180
if (env->async_hooks()->fields()[node::AsyncHooks::kAfter]) {
while (env->async_hooks()->fields()[node::AsyncHooks::kStackLength]) {
- node::AsyncWrap::EmitAfter(env, env->execution_async_id());
- env->async_hooks()->pop_async_context(env->execution_async_id());
+ double id = env->execution_async_id();
+ // Do not call EmitAfter for asyncId 0.
+ if (id != 0)
+ node::AsyncWrap::EmitAfter(env, id);
+ env->async_hooks()->pop_async_context(id);
}
}
|
fix
|
e055ce7c39c80e38321769df78b7323b9a00e52b
|
Milan Burda
|
2025-02-10 21:17:07
|
chore: deprecate `systemPreferences.isAeroGlassEnabled()` (#45434)
|
diff --git a/docs/api/system-preferences.md b/docs/api/system-preferences.md
index ad6f72007a..05e83be870 100644
--- a/docs/api/system-preferences.md
+++ b/docs/api/system-preferences.md
@@ -6,7 +6,7 @@ Process: [Main](../glossary.md#main-process), [Utility](../glossary.md#utility-p
```js
const { systemPreferences } = require('electron')
-console.log(systemPreferences.isAeroGlassEnabled())
+console.log(systemPreferences.getEffectiveAppearance())
```
## Events
@@ -181,35 +181,13 @@ Some popular `key` and `type`s are:
Removes the `key` in `NSUserDefaults`. This can be used to restore the default
or global value of a `key` previously set with `setUserDefault`.
-### `systemPreferences.isAeroGlassEnabled()` _Windows_
+### `systemPreferences.isAeroGlassEnabled()` _Windows_ _Deprecated_
Returns `boolean` - `true` if [DWM composition][dwm-composition] (Aero Glass) is
enabled, and `false` otherwise.
-An example of using it to determine if you should create a transparent window or
-not (transparent windows won't work correctly when DWM composition is disabled):
-
-```js
-const { BrowserWindow, systemPreferences } = require('electron')
-const browserOptions = { width: 1000, height: 800 }
-
-// Make the window transparent only if the platform supports it.
-if (process.platform !== 'win32' || systemPreferences.isAeroGlassEnabled()) {
- browserOptions.transparent = true
- browserOptions.frame = false
-}
-
-// Create the window.
-const win = new BrowserWindow(browserOptions)
-
-// Navigate.
-if (browserOptions.transparent) {
- win.loadFile('index.html')
-} else {
- // No transparency, so we load a fallback that uses basic styles.
- win.loadFile('fallback.html')
-}
-```
+**Deprecated:**
+This function has been always returning `true` since Electron 23, which only supports Windows 10+.
[dwm-composition]: https://learn.microsoft.com/en-us/windows/win32/dwm/composition-ovw
diff --git a/docs/breaking-changes.md b/docs/breaking-changes.md
index 3d6292d976..9d832290b9 100644
--- a/docs/breaking-changes.md
+++ b/docs/breaking-changes.md
@@ -63,6 +63,13 @@ webContents.on('console-message', ({ level, message, lineNumber, sourceId, frame
Additionally, `level` is now a string with possible values of `info`, `warning`, `error`, and `debug`.
+### Deprecated: `systemPreferences.isAeroGlassEnabled()`
+
+The `systemPreferences.isAeroGlassEnabled()` function has been deprecated without replacement.
+It has been always returning `true` since Electron 23, which only supports Windows 10+, where DWM composition can no longer be disabled.
+
+https://learn.microsoft.com/en-us/windows/win32/dwm/composition-ovw#disabling-dwm-composition-windows7-and-earlier
+
## Planned Breaking API Changes (34.0)
### Behavior Changed: menu bar will be hidden during fullscreen on Windows
diff --git a/lib/browser/api/system-preferences.ts b/lib/browser/api/system-preferences.ts
index b5485a7361..3f78083d02 100644
--- a/lib/browser/api/system-preferences.ts
+++ b/lib/browser/api/system-preferences.ts
@@ -20,4 +20,12 @@ if ('accessibilityDisplayShouldReduceTransparency' in systemPreferences) {
});
}
+if (process.platform === 'win32') {
+ const isAeroGlassEnabledDeprecated = deprecate.warnOnce('systemPreferences.isAeroGlassEnabled');
+ systemPreferences.isAeroGlassEnabled = () => {
+ isAeroGlassEnabledDeprecated();
+ return true;
+ };
+}
+
export default systemPreferences;
diff --git a/shell/browser/api/electron_api_system_preferences.cc b/shell/browser/api/electron_api_system_preferences.cc
index dec3d1f3ff..24ea4f10e7 100644
--- a/shell/browser/api/electron_api_system_preferences.cc
+++ b/shell/browser/api/electron_api_system_preferences.cc
@@ -60,9 +60,7 @@ gin::ObjectTemplateBuilder SystemPreferences::GetObjectTemplateBuilder(
&SystemPreferences::GetMediaAccessStatus)
#endif
-#if BUILDFLAG(IS_WIN)
- .SetMethod("isAeroGlassEnabled", &SystemPreferences::IsAeroGlassEnabled)
-#elif BUILDFLAG(IS_MAC)
+#if BUILDFLAG(IS_MAC)
.SetMethod("postNotification", &SystemPreferences::PostNotification)
.SetMethod("subscribeNotification",
&SystemPreferences::SubscribeNotification)
diff --git a/shell/browser/api/electron_api_system_preferences.h b/shell/browser/api/electron_api_system_preferences.h
index 100d77b8a3..e7ddff7d00 100644
--- a/shell/browser/api/electron_api_system_preferences.h
+++ b/shell/browser/api/electron_api_system_preferences.h
@@ -63,8 +63,6 @@ class SystemPreferences final
const std::string& media_type);
#endif
#if BUILDFLAG(IS_WIN)
- bool IsAeroGlassEnabled();
-
void InitializeWindow();
// gfx::SysColorChangeListener:
diff --git a/shell/browser/api/electron_api_system_preferences_win.cc b/shell/browser/api/electron_api_system_preferences_win.cc
index 78fb911f6c..5c60ef479d 100644
--- a/shell/browser/api/electron_api_system_preferences_win.cc
+++ b/shell/browser/api/electron_api_system_preferences_win.cc
@@ -76,10 +76,6 @@ std::string ConvertDeviceAccessStatus(DeviceAccessStatus value) {
namespace api {
-bool SystemPreferences::IsAeroGlassEnabled() {
- return true;
-}
-
std::string hexColorDWORDToRGBA(DWORD color) {
DWORD rgba = color << 8 | color >> 24;
std::ostringstream stream;
diff --git a/spec/api-system-preferences-spec.ts b/spec/api-system-preferences-spec.ts
index 05de0b91e8..44637669f2 100644
--- a/spec/api-system-preferences-spec.ts
+++ b/spec/api-system-preferences-spec.ts
@@ -2,6 +2,7 @@ import { systemPreferences } from 'electron/main';
import { expect } from 'chai';
+import { expectDeprecationMessages } from './lib/deprecate-helpers';
import { ifdescribe } from './lib/spec-helpers';
describe('systemPreferences module', () => {
@@ -59,6 +60,13 @@ describe('systemPreferences module', () => {
});
});
+ ifdescribe(process.platform === 'win32')('systemPreferences.isAeroGlassEnabled()', () => {
+ it('always returns true', () => {
+ expect(systemPreferences.isAeroGlassEnabled()).to.equal(true);
+ expectDeprecationMessages(() => systemPreferences.isAeroGlassEnabled(), '\'systemPreferences.isAeroGlassEnabled\' is deprecated and will be removed.');
+ });
+ });
+
ifdescribe(process.platform === 'darwin')('systemPreferences.getUserDefault(key, type)', () => {
it('returns values for known user defaults', () => {
const locale = systemPreferences.getUserDefault('AppleLocale', 'string');
diff --git a/spec/ts-smoke/electron/main.ts b/spec/ts-smoke/electron/main.ts
index dec772168f..4dfef7df74 100644
--- a/spec/ts-smoke/electron/main.ts
+++ b/spec/ts-smoke/electron/main.ts
@@ -359,16 +359,10 @@ app.commandLine.appendSwitch('vmodule', 'console=0');
const browserOptions = {
width: 1000,
height: 800,
- transparent: false,
- frame: true
+ transparent: true,
+ frame: false
};
-// Make the window transparent only if the platform supports it.
-if (process.platform !== 'win32' || systemPreferences.isAeroGlassEnabled()) {
- browserOptions.transparent = true;
- browserOptions.frame = false;
-}
-
if (process.platform === 'win32') {
systemPreferences.on('color-changed', () => { console.log('color changed'); });
// @ts-expect-error Removed API
|
chore
|
601217218759d088f12680a428fead8c8b26a5e0
|
David Sanders
|
2023-03-31 09:06:09
|
fix: set background color for menu bar on Windows (#37766)
|
diff --git a/shell/browser/ui/views/menu_bar.cc b/shell/browser/ui/views/menu_bar.cc
index 7a0ba8139e..0ec3372641 100644
--- a/shell/browser/ui/views/menu_bar.cc
+++ b/shell/browser/ui/views/menu_bar.cc
@@ -35,12 +35,11 @@ const char MenuBar::kViewClassName[] = "ElectronMenuBar";
MenuBar::MenuBar(NativeWindow* window, RootView* root_view)
: background_color_(kDefaultColor), window_(window), root_view_(root_view) {
const ui::NativeTheme* theme = root_view_->GetNativeTheme();
- RefreshColorCache(theme);
- UpdateViewColors();
#if BUILDFLAG(IS_WIN)
SetBackground(views::CreateThemedSolidBackground(ui::kColorMenuBackground));
- background_color_ = GetBackground()->get_color();
#endif
+ RefreshColorCache(theme);
+ UpdateViewColors();
SetFocusBehavior(FocusBehavior::ALWAYS);
SetLayoutManager(std::make_unique<views::BoxLayout>(
views::BoxLayout::Orientation::kHorizontal));
@@ -209,6 +208,14 @@ void MenuBar::ButtonPressed(size_t id, const ui::Event& event) {
menu_delegate->AddObserver(this);
}
+void MenuBar::ViewHierarchyChanged(
+ const views::ViewHierarchyChangedDetails& details) {
+ views::AccessiblePaneView::ViewHierarchyChanged(details);
+#if BUILDFLAG(IS_WIN)
+ background_color_ = GetBackground()->get_color();
+#endif
+}
+
void MenuBar::RefreshColorCache(const ui::NativeTheme* theme) {
if (theme) {
#if BUILDFLAG(IS_LINUX)
@@ -217,6 +224,8 @@ void MenuBar::RefreshColorCache(const ui::NativeTheme* theme) {
gtk::GetFgColor("GtkMenuBar#menubar GtkMenuItem#menuitem GtkLabel");
disabled_color_ = gtk::GetFgColor(
"GtkMenuBar#menubar GtkMenuItem#menuitem:disabled GtkLabel");
+#elif BUILDFLAG(IS_WIN)
+ background_color_ = GetBackground()->get_color();
#endif
}
}
diff --git a/shell/browser/ui/views/menu_bar.h b/shell/browser/ui/views/menu_bar.h
index 91546fb33c..b4beb95a72 100644
--- a/shell/browser/ui/views/menu_bar.h
+++ b/shell/browser/ui/views/menu_bar.h
@@ -50,6 +50,9 @@ class MenuBar : public views::AccessiblePaneView,
ElectronMenuModel** menu_model,
views::MenuButton** button);
+ void ViewHierarchyChanged(
+ const views::ViewHierarchyChangedDetails& details) override;
+
private:
// MenuDelegate::Observer:
void OnBeforeExecuteCommand() override;
|
fix
|
3afb012ad178922ef9a642d2fe0af9851c2196eb
|
Samuel Attard
|
2024-01-10 10:19:42
|
build: add infra for reclient support (#40850)
* chore: add patch to always set macos platform for x-build
* build: add infra for reclient support
* build: override reclient version
* build: use RBE in CI
* chore: hardcode reclient fix version
* build: lower process count on macOS
* build: use large macOS instance for testing-arm64
* Revert "build: use large macOS instance for testing-arm64"
This reverts commit 6844adfd00a5230e68234112dfd84caa50d3f621.
* build: login in via helper not writing file
* chore: update patches
* build: use recelint from DEPS
* build: fix windows reproxy cfg
* build: use reclient in appveyor
* build: update WOA job too
* build: force another build
* build: do not checkout reclient
|
diff --git a/.circleci/config/base.yml b/.circleci/config/base.yml
index 9e10618a18..a24b086c4f 100644
--- a/.circleci/config/base.yml
+++ b/.circleci/config/base.yml
@@ -335,46 +335,26 @@ step-setup-env-for-build: &step-setup-env-for-build
# To find `gn` executable.
echo 'export CHROMIUM_BUILDTOOLS_PATH="'"$PWD"'/src/buildtools"' >> $BASH_ENV
-step-setup-goma-for-build: &step-setup-goma-for-build
+step-setup-rbe-for-build: &step-setup-rbe-for-build
run:
- name: Setup Goma
+ name: Setup RBE
command: |
echo 'export NUMBER_OF_NINJA_PROCESSES=300' >> $BASH_ENV
if [ "`uname`" == "Darwin" ]; then
+ echo 'export NUMBER_OF_NINJA_PROCESSES=200' >> $BASH_ENV
echo 'ulimit -n 10000' >> $BASH_ENV
echo 'sudo launchctl limit maxfiles 65536 200000' >> $BASH_ENV
fi
- if [ ! -z "$RAW_GOMA_AUTH" ]; then
- echo $RAW_GOMA_AUTH > ~/.goma_oauth2_config
- fi
git clone https://github.com/electron/build-tools.git
cd build-tools
- npm install
+ npx yarn --ignore-engines
mkdir third_party
- node -e "require('./src/utils/goma.js').downloadAndPrepare({ gomaOneForAll: true })"
- export GOMA_FALLBACK_ON_AUTH_FAILURE=true
- third_party/goma/goma_ctl.py ensure_start
- if [ ! -z "$RAW_GOMA_AUTH" ] && [ "`third_party/goma/goma_auth.py info`" != "Login as Fermi Planck" ]; then
- echo "WARNING!!!!!! Goma authentication is incorrect; please update Goma auth token."
- exit 1
- fi
- echo 'export GN_GOMA_FILE='`node -e "console.log(require('./src/utils/goma.js').gnFilePath)"` >> $BASH_ENV
- echo 'export GOMA_DIR='`node -e "console.log(require('./src/utils/goma.js').dir)"` >> $BASH_ENV
- echo 'export GOMA_FALLBACK_ON_AUTH_FAILURE=true' >> $BASH_ENV
- cd ..
- touch "${TMPDIR:=/tmp}"/.goma-ready
- background: true
-
-step-wait-for-goma: &step-wait-for-goma
- run:
- name: Wait for Goma
- command: |
- until [ -f "${TMPDIR:=/tmp}"/.goma-ready ]
- do
- sleep 5
- done
- echo "Goma ready"
- no_output_timeout: 5m
+ # Pull down credential helper and print status
+ node -e "require('./src/utils/reclient.js').downloadAndPrepare({})"
+ HELPER=$(node -p "require('./src/utils/reclient.js').helperPath")
+ $HELPER login
+ echo 'export RBE_service='`node -e "console.log(require('./src/utils/reclient.js').serviceAddress)"` >> $BASH_ENV
+ echo 'export RBE_experimental_credentials_helper='`node -e "console.log(require('./src/utils/reclient.js').helperPath)"` >> $BASH_ENV
step-restore-brew-cache: &step-restore-brew-cache
restore_cache:
@@ -548,6 +528,13 @@ step-fix-sync: &step-fix-sync
sed -i '' "s/Updating depot_tools... //g" gn_ensure_file
cipd ensure --root src/buildtools/mac -ensure-file gn_ensure_file
+ # Fix reclient (wrong binary)
+ echo 'infra/rbe/client/${platform}' `gclient getdep --deps-file=src/DEPS -r 'src/buildtools/reclient:infra/rbe/client/${platform}'` > gn_ensure_file
+ # Remove extra output from calling gclient getdep which always calls update_depot_tools
+ sed -i '' "s/Updating depot_tools... //g" gn_ensure_file
+ cipd ensure --root src/buildtools/reclient -ensure-file gn_ensure_file
+ python3 src/buildtools/reclient_cfgs/configure_reclient_cfgs.py --rbe_instance "projects/rbe-chrome-untrusted/instances/default_instance" --reproxy_cfg_template reproxy.cfg.template --rewrapper_cfg_project "" --skip_remoteexec_cfg_fetch
+
# Fix dsymutil (wrong binary)
if [ "$TARGET_ARCH" == "arm64" ]; then
export DSYM_SHA_FILE=src/tools/clang/dsymutil/bin/dsymutil.arm64.sha1
@@ -600,7 +587,7 @@ step-gn-gen-default: &step-gn-gen-default
name: Default GN gen
command: |
cd src
- gn gen out/Default --args="import(\"$GN_CONFIG\") import(\"$GN_GOMA_FILE\") $GN_EXTRA_ARGS $GN_BUILDFLAG_ARGS"
+ gn gen out/Default --args="import(\"$GN_CONFIG\") use_remoteexec=true $GN_EXTRA_ARGS $GN_BUILDFLAG_ARGS"
step-gn-check: &step-gn-check
run:
@@ -636,16 +623,16 @@ step-electron-chromedriver-build: &step-electron-chromedriver-build
command: |
cd src
if [ "`uname`" != "Darwin" ] && ([ "$TARGET_ARCH" == "arm" ] || [ "$TARGET_ARCH" == "arm64" ]); then
- gn gen out/chromedriver --args="import(\"$GN_CONFIG\") import(\"$GN_GOMA_FILE\") is_component_ffmpeg=false proprietary_codecs=false $GN_EXTRA_ARGS $GN_BUILDFLAG_ARGS"
+ gn gen out/chromedriver --args="import(\"$GN_CONFIG\") use_remoteexec=true is_component_ffmpeg=false proprietary_codecs=false $GN_EXTRA_ARGS $GN_BUILDFLAG_ARGS"
export CHROMEDRIVER_DIR="out/chromedriver"
else
export CHROMEDRIVER_DIR="out/Default"
fi
- ninja -C $CHROMEDRIVER_DIR electron:electron_chromedriver -j $NUMBER_OF_NINJA_PROCESSES
+ autoninja -C $CHROMEDRIVER_DIR electron:electron_chromedriver -j $NUMBER_OF_NINJA_PROCESSES
if [ "`uname`" == "Linux" ]; then
electron/script/strip-binaries.py --target-cpu="$TARGET_ARCH" --file $PWD/$CHROMEDRIVER_DIR/chromedriver
fi
- ninja -C $CHROMEDRIVER_DIR electron:electron_chromedriver_zip
+ autoninja -C $CHROMEDRIVER_DIR electron:electron_chromedriver_zip
if [ "`uname`" != "Darwin" ] && ([ "$TARGET_ARCH" == "arm" ] || [ "$TARGET_ARCH" == "arm64" ]); then
cp out/chromedriver/chromedriver.zip out/Default
fi
@@ -655,7 +642,7 @@ step-nodejs-headers-build: &step-nodejs-headers-build
name: Build Node.js headers
command: |
cd src
- ninja -C out/Default electron:node_headers
+ autoninja -C out/Default electron:node_headers
step-electron-publish: &step-electron-publish
run:
@@ -709,14 +696,14 @@ step-ffmpeg-gn-gen: &step-ffmpeg-gn-gen
name: ffmpeg GN gen
command: |
cd src
- gn gen out/ffmpeg --args="import(\"//electron/build/args/ffmpeg.gn\") import(\"$GN_GOMA_FILE\") $GN_EXTRA_ARGS"
+ gn gen out/ffmpeg --args="import(\"//electron/build/args/ffmpeg.gn\") use_remoteexec=true $GN_EXTRA_ARGS"
step-ffmpeg-build: &step-ffmpeg-build
run:
name: Non proprietary ffmpeg build
command: |
cd src
- ninja -C out/ffmpeg electron:electron_ffmpeg_zip -j $NUMBER_OF_NINJA_PROCESSES
+ autoninja -C out/ffmpeg electron:electron_ffmpeg_zip -j $NUMBER_OF_NINJA_PROCESSES
step-verify-mksnapshot: &step-verify-mksnapshot
run:
@@ -748,26 +735,13 @@ step-setup-linux-for-headless-testing: &step-setup-linux-for-headless-testing
sh -e /etc/init.d/xvfb start
fi
-step-show-goma-stats: &step-show-goma-stats
- run:
- shell: /bin/bash
- name: Check goma stats after build
- command: |
- set +e
- set +o pipefail
- python3 $GOMA_DIR/goma_ctl.py stat
- python3 $GOMA_DIR/diagnose_goma_log.py
- true
- when: always
- background: true
-
step-mksnapshot-build: &step-mksnapshot-build
run:
name: mksnapshot build
no_output_timeout: 30m
command: |
cd src
- ninja -C out/Default electron:electron_mksnapshot -j $NUMBER_OF_NINJA_PROCESSES
+ autoninja -C out/Default electron:electron_mksnapshot -j $NUMBER_OF_NINJA_PROCESSES
gn desc out/Default v8:run_mksnapshot_default args > out/Default/mksnapshot_args
# Remove unused args from mksnapshot_args
SEDOPTION="-i"
@@ -790,7 +764,7 @@ step-mksnapshot-build: &step-mksnapshot-build
fi
fi
if [ "$SKIP_DIST_ZIP" != "1" ]; then
- ninja -C out/Default electron:electron_mksnapshot_zip -j $NUMBER_OF_NINJA_PROCESSES
+ autoninja -C out/Default electron:electron_mksnapshot_zip -j $NUMBER_OF_NINJA_PROCESSES
(cd out/Default; zip mksnapshot.zip mksnapshot_args gen/v8/embedded.S)
fi
@@ -800,7 +774,7 @@ step-hunspell-build: &step-hunspell-build
command: |
cd src
if [ "$SKIP_DIST_ZIP" != "1" ]; then
- ninja -C out/Default electron:hunspell_dictionaries_zip -j $NUMBER_OF_NINJA_PROCESSES
+ autoninja -C out/Default electron:hunspell_dictionaries_zip -j $NUMBER_OF_NINJA_PROCESSES
fi
step-maybe-generate-libcxx: &step-maybe-generate-libcxx
@@ -809,9 +783,9 @@ step-maybe-generate-libcxx: &step-maybe-generate-libcxx
command: |
cd src
if [ "`uname`" == "Linux" ]; then
- ninja -C out/Default electron:libcxx_headers_zip -j $NUMBER_OF_NINJA_PROCESSES
- ninja -C out/Default electron:libcxxabi_headers_zip -j $NUMBER_OF_NINJA_PROCESSES
- ninja -C out/Default electron:libcxx_objects_zip -j $NUMBER_OF_NINJA_PROCESSES
+ autoninja -C out/Default electron:libcxx_headers_zip -j $NUMBER_OF_NINJA_PROCESSES
+ autoninja -C out/Default electron:libcxxabi_headers_zip -j $NUMBER_OF_NINJA_PROCESSES
+ autoninja -C out/Default electron:libcxx_objects_zip -j $NUMBER_OF_NINJA_PROCESSES
fi
step-maybe-generate-breakpad-symbols: &step-maybe-generate-breakpad-symbols
@@ -821,7 +795,7 @@ step-maybe-generate-breakpad-symbols: &step-maybe-generate-breakpad-symbols
command: |
if [ "$GENERATE_SYMBOLS" == "true" ]; then
cd src
- ninja -C out/Default electron:electron_symbols
+ autoninja -C out/Default electron:electron_symbols
fi
step-maybe-zip-symbols: &step-maybe-zip-symbols
@@ -830,8 +804,8 @@ step-maybe-zip-symbols: &step-maybe-zip-symbols
command: |
cd src
export BUILD_PATH="$PWD/out/Default"
- ninja -C out/Default electron:licenses
- ninja -C out/Default electron:electron_version_file
+ autoninja -C out/Default electron:licenses
+ autoninja -C out/Default electron:electron_version_file
electron/script/zip-symbols.py -b $BUILD_PATH
step-maybe-zip-symbols-and-clean: &step-maybe-zip-symbols-and-clean
@@ -840,8 +814,8 @@ step-maybe-zip-symbols-and-clean: &step-maybe-zip-symbols-and-clean
command: |
cd src
export BUILD_PATH="$PWD/out/Default"
- ninja -C out/Default electron:licenses
- ninja -C out/Default electron:electron_version_file
+ autoninja -C out/Default electron:licenses
+ autoninja -C out/Default electron:electron_version_file
DELETE_DSYMS_AFTER_ZIP=1 electron/script/zip-symbols.py -b $BUILD_PATH
step-maybe-cross-arch-snapshot: &step-maybe-cross-arch-snapshot
@@ -1188,11 +1162,10 @@ commands:
could-be-aks:
type: boolean
steps:
- - *step-setup-goma-for-build
+ - *step-setup-rbe-for-build
- checkout-from-cache:
could-be-aks: << parameters.could-be-aks >>
- *step-setup-env-for-build
- - *step-wait-for-goma
- *step-gn-gen-default
- *step-gn-check
build_and_save_artifacts:
@@ -1213,8 +1186,6 @@ commands:
- step-electron-dist-build:
additional-targets: electron:node_headers third_party/electron_node:overlapped-checker electron:hunspell_dictionaries_zip
- - *step-show-goma-stats
-
# mksnapshot
- *step-mksnapshot-build
- *step-maybe-cross-arch-snapshot
@@ -1343,7 +1314,7 @@ commands:
command: |
cd src
if [ "$SKIP_DIST_ZIP" != "1" ]; then
- ninja -C out/Default electron:electron_dist_zip << parameters.additional-targets >> -j $NUMBER_OF_NINJA_PROCESSES
+ autoninja -C out/Default electron:electron_dist_zip << parameters.additional-targets >> -j $NUMBER_OF_NINJA_PROCESSES
if [ "$CHECK_DIST_MANIFEST" == "1" ]; then
if [ "`uname`" == "Darwin" ]; then
target_os=mac
@@ -1444,7 +1415,7 @@ commands:
- when:
condition: << parameters.build >>
steps:
- - *step-setup-goma-for-build
+ - *step-setup-rbe-for-build
- when:
condition: << parameters.checkout-and-assume-cache >>
steps:
@@ -1563,7 +1534,6 @@ commands:
steps:
- *step-depot-tools-add-to-path
- *step-setup-env-for-build
- - *step-wait-for-goma
- *step-get-more-space-on-mac
- *step-fix-sync
- *step-delete-git-directories
@@ -1751,14 +1721,12 @@ commands:
- *step-fix-sync
- *step-setup-env-for-build
- *step-fix-known-hosts-linux
- - *step-setup-goma-for-build
- - *step-wait-for-goma
+ - *step-setup-rbe-for-build
- *step-gn-gen-default
# Electron app
- ninja_build_electron:
build-type: << parameters.build-type >>
- - *step-show-goma-stats
- *step-maybe-generate-breakpad-symbols
- *step-maybe-electron-dist-strip
- step-electron-dist-build
diff --git a/DEPS b/DEPS
index 862d25d69f..6bb9098032 100644
--- a/DEPS
+++ b/DEPS
@@ -13,6 +13,8 @@ vars = {
'74ab5baccc6f7202c8ac69a8d1e152c29dc1ea76',
'mantle_version':
'78d3966b3c331292ea29ec38661b25df0a245948',
+ 'engflow_reclient_configs_version':
+ '955335c30a752e9ef7bff375baab5e0819b6c00d',
'pyyaml_version': '3.12',
@@ -23,6 +25,7 @@ vars = {
'squirrel_git': 'https://github.com/Squirrel',
'reactiveobjc_git': 'https://github.com/ReactiveCocoa',
'mantle_git': 'https://github.com/Mantle',
+ 'engflow_git': 'https://github.com/EngFlow',
# The path of the sysroots.json file.
'sysroots_json_path': 'electron/script/sysroots.json',
@@ -102,6 +105,10 @@ deps = {
'src/third_party/squirrel.mac/vendor/Mantle': {
'url': Var("mantle_git") + '/Mantle.git@' + Var("mantle_version"),
'condition': 'process_deps',
+ },
+ 'src/third_party/engflow-reclient-configs': {
+ 'url': Var("engflow_git") + '/reclient-configs.git@' + Var("engflow_reclient_configs_version"),
+ 'condition': 'process_deps'
}
}
diff --git a/appveyor-bake.yml b/appveyor-bake.yml
index 6404ac401f..e60bfc9a8e 100644
--- a/appveyor-bake.yml
+++ b/appveyor-bake.yml
@@ -13,7 +13,6 @@ environment:
ELECTRON_ENABLE_STACK_DUMPING: 1
MOCHA_REPORTER: mocha-multi-reporters
MOCHA_MULTI_REPORTERS: mocha-appveyor-reporter, tap
- GOMA_FALLBACK_ON_AUTH_FAILURE: true
DEPOT_TOOLS_WIN_TOOLCHAIN: 0
PYTHONIOENCODING: UTF-8
diff --git a/appveyor-woa.yml b/appveyor-woa.yml
index 092753b53d..ad487a4fbd 100644
--- a/appveyor-woa.yml
+++ b/appveyor-woa.yml
@@ -37,7 +37,6 @@ environment:
ELECTRON_ALSO_LOG_TO_STDERR: 1
MOCHA_REPORTER: mocha-multi-reporters
MOCHA_MULTI_REPORTERS: "@marshallofsound/mocha-appveyor-reporter, tap"
- GOMA_FALLBACK_ON_AUTH_FAILURE: true
DEPOT_TOOLS_WIN_TOOLCHAIN: 1
DEPOT_TOOLS_WIN_TOOLCHAIN_BASE_URL: "https://dev-cdn.electronjs.org/windows-toolchains/_"
GYP_MSVS_HASH_27370823e7: 28622d16b1
@@ -101,31 +100,20 @@ for:
if (Test-Path -Path "$pwd\src\electron") {
Remove-Item -Recurse -Force $pwd\src\electron
}
- - ps: >-
- if (Test-Path 'env:RAW_GOMA_AUTH') {
- $env:GOMA_OAUTH2_CONFIG_FILE = "$pwd\.goma_oauth2_config"
- $env:RAW_GOMA_AUTH | Set-Content $env:GOMA_OAUTH2_CONFIG_FILE
- }
- git clone https://github.com/electron/build-tools.git
- cd build-tools
- - npm install
+ - npx yarn --ignore-engines
- mkdir third_party
- ps: >-
- node -e "require('./src/utils/goma.js').downloadAndPrepare({ gomaOneForAll: true })"
- - ps: $env:GN_GOMA_FILE = node -e "console.log(require('./src/utils/goma.js').gnFilePath)"
- - ps: $env:LOCAL_GOMA_DIR = node -e "console.log(require('./src/utils/goma.js').dir)"
- - cd ..\..
- - ps: .\src\electron\script\start-goma.ps1 -gomaDir $env:LOCAL_GOMA_DIR
+ node -e "require('./src/utils/reclient.js').downloadAndPrepare({})"
+ - ps: $env:RECLIENT_HELPER = node -p "require('./src/utils/reclient.js').helperPath"
- ps: >-
- if (Test-Path 'env:RAW_GOMA_AUTH') {
- $goma_login = python3 $env:LOCAL_GOMA_DIR\goma_auth.py info
- if ($goma_login -eq 'Login as Fermi Planck') {
- Write-warning "Goma authentication is correct";
- } else {
- Write-warning "WARNING!!!!!! Goma authentication is incorrect; please update Goma auth token.";
- $host.SetShouldExit(1)
- }
- }
+ & $env:RECLIENT_HELPER login
+ - ps: >-
+ $env:RBE_service = node -e "console.log(require('./src/utils/reclient.js').serviceAddress)"
+ - ps: >-
+ $env:RBE_experimental_credentials_helper = $env:RECLIENT_HELPER
+ - cd ..\..
- ps: $env:CHROMIUM_BUILDTOOLS_PATH="$pwd\src\buildtools"
- ps: >-
if ($env:GN_CONFIG -ne 'release') {
@@ -147,27 +135,26 @@ for:
- cd src
- ps: $env:PATH="$pwd\third_party\ninja;$env:PATH"
- set BUILD_CONFIG_PATH=//electron/build/args/%GN_CONFIG%.gn
- - gn gen out/Default "--args=import(\"%BUILD_CONFIG_PATH%\") import(\"%GN_GOMA_FILE%\") %GN_EXTRA_ARGS% "
+ - gn gen out/Default "--args=import(\"%BUILD_CONFIG_PATH%\") use_remoteexec=true %GN_EXTRA_ARGS% "
- gn check out/Default //electron:electron_lib
- gn check out/Default //electron:electron_app
- gn check out/Default //electron/shell/common/api:mojo
- - if DEFINED GN_GOMA_FILE (ninja -j 300 -C out/Default electron:electron_app) else (ninja -C out/Default electron:electron_app)
+ - if DEFINED ELECTRON_RBE_JWT (autoninja -j 300 -C out/Default electron:electron_app) else (autoninja -C out/Default electron:electron_app)
- if "%GN_CONFIG%"=="testing" ( python C:\depot_tools\post_build_ninja_summary.py -C out\Default )
- - gn gen out/ffmpeg "--args=import(\"//electron/build/args/ffmpeg.gn\") %GN_EXTRA_ARGS%"
- - ninja -C out/ffmpeg electron:electron_ffmpeg_zip
- - ninja -C out/Default electron:electron_dist_zip
+ - gn gen out/ffmpeg "--args=import(\"//electron/build/args/ffmpeg.gn\") use_remoteexec=true %GN_EXTRA_ARGS%"
+ - autoninja -C out/ffmpeg electron:electron_ffmpeg_zip
+ - autoninja -C out/Default electron:electron_dist_zip
- gn desc out/Default v8:run_mksnapshot_default args > out/Default/default_mksnapshot_args
# Remove unused args from mksnapshot_args
- ps: >-
Get-Content out/Default/default_mksnapshot_args | Where-Object { -not $_.Contains('--turbo-profiling-input') -And -not $_.Contains('builtins-pgo') -And -not $_.Contains('The gn arg use_goma=true') } | Set-Content out/Default/mksnapshot_args
- - ninja -C out/Default electron:electron_mksnapshot_zip
+ - autoninja -C out/Default electron:electron_mksnapshot_zip
- cd out\Default
- 7z a mksnapshot.zip mksnapshot_args gen\v8\embedded.S
- cd ..\..
- - ninja -C out/Default electron:hunspell_dictionaries_zip
- - ninja -C out/Default electron:electron_chromedriver_zip
- - ninja -C out/Default electron:node_headers
- - python3 %LOCAL_GOMA_DIR%\goma_ctl.py stat
+ - autoninja -C out/Default electron:hunspell_dictionaries_zip
+ - autoninja -C out/Default electron:electron_chromedriver_zip
+ - autoninja -C out/Default electron:node_headers
- ps: >-
Get-CimInstance -Namespace root\cimv2 -Class Win32_product | Select vendor, description, @{l='install_location';e='InstallLocation'}, @{l='install_date';e='InstallDate'}, @{l='install_date_2';e='InstallDate2'}, caption, version, name, @{l='sku_number';e='SKUNumber'} | ConvertTo-Json | Out-File -Encoding utf8 -FilePath .\installed_software.json
- python3 electron/build/profile_toolchain.py --output-json=out/Default/windows_toolchain_profile.json
@@ -177,7 +164,7 @@ for:
if ($env:GN_CONFIG -eq 'release') {
# Needed for msdia140.dll on 64-bit windows
$env:Path += ";$pwd\third_party\llvm-build\Release+Asserts\bin"
- ninja -C out/Default electron:electron_symbols
+ autoninja -C out/Default electron:electron_symbols
}
- ps: >-
if ($env:GN_CONFIG -eq 'release') {
diff --git a/appveyor.yml b/appveyor.yml
index d02f4ee071..682a5f5600 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -37,7 +37,6 @@ environment:
ELECTRON_ALSO_LOG_TO_STDERR: 1
MOCHA_REPORTER: mocha-multi-reporters
MOCHA_MULTI_REPORTERS: "@marshallofsound/mocha-appveyor-reporter, tap"
- GOMA_FALLBACK_ON_AUTH_FAILURE: true
DEPOT_TOOLS_WIN_TOOLCHAIN: 1
DEPOT_TOOLS_WIN_TOOLCHAIN_BASE_URL: "https://dev-cdn.electronjs.org/windows-toolchains/_"
GYP_MSVS_HASH_27370823e7: 28622d16b1
@@ -99,31 +98,20 @@ for:
if (Test-Path -Path "$pwd\src\electron") {
Remove-Item -Recurse -Force $pwd\src\electron
}
- - ps: >-
- if (Test-Path 'env:RAW_GOMA_AUTH') {
- $env:GOMA_OAUTH2_CONFIG_FILE = "$pwd\.goma_oauth2_config"
- $env:RAW_GOMA_AUTH | Set-Content $env:GOMA_OAUTH2_CONFIG_FILE
- }
- git clone https://github.com/electron/build-tools.git
- cd build-tools
- - npm install
+ - npx yarn --ignore-engines
- mkdir third_party
- ps: >-
- node -e "require('./src/utils/goma.js').downloadAndPrepare({ gomaOneForAll: true })"
- - ps: $env:GN_GOMA_FILE = node -e "console.log(require('./src/utils/goma.js').gnFilePath)"
- - ps: $env:LOCAL_GOMA_DIR = node -e "console.log(require('./src/utils/goma.js').dir)"
- - cd ..\..
- - ps: .\src\electron\script\start-goma.ps1 -gomaDir $env:LOCAL_GOMA_DIR
+ node -e "require('./src/utils/reclient.js').downloadAndPrepare({})"
+ - ps: $env:RECLIENT_HELPER = node -p "require('./src/utils/reclient.js').helperPath"
- ps: >-
- if (Test-Path 'env:RAW_GOMA_AUTH') {
- $goma_login = python3 $env:LOCAL_GOMA_DIR\goma_auth.py info
- if ($goma_login -eq 'Login as Fermi Planck') {
- Write-warning "Goma authentication is correct";
- } else {
- Write-warning "WARNING!!!!!! Goma authentication is incorrect; please update Goma auth token.";
- $host.SetShouldExit(1)
- }
- }
+ & $env:RECLIENT_HELPER login
+ - ps: >-
+ $env:RBE_service = node -e "console.log(require('./src/utils/reclient.js').serviceAddress)"
+ - ps: >-
+ $env:RBE_experimental_credentials_helper = $env:RECLIENT_HELPER
+ - cd ..\..
- ps: $env:CHROMIUM_BUILDTOOLS_PATH="$pwd\src\buildtools"
- ps: >-
if ($env:GN_CONFIG -ne 'release') {
@@ -145,27 +133,26 @@ for:
- cd src
- ps: $env:PATH="$pwd\third_party\ninja;$env:PATH"
- set BUILD_CONFIG_PATH=//electron/build/args/%GN_CONFIG%.gn
- - gn gen out/Default "--args=import(\"%BUILD_CONFIG_PATH%\") import(\"%GN_GOMA_FILE%\") %GN_EXTRA_ARGS% "
+ - gn gen out/Default "--args=import(\"%BUILD_CONFIG_PATH%\") use_remoteexec=true %GN_EXTRA_ARGS% "
- gn check out/Default //electron:electron_lib
- gn check out/Default //electron:electron_app
- gn check out/Default //electron/shell/common/api:mojo
- - if DEFINED GN_GOMA_FILE (ninja -j 300 -C out/Default electron:electron_app) else (ninja -C out/Default electron:electron_app)
+ - if DEFINED ELECTRON_RBE_JWT (autoninja -j 300 -C out/Default electron:electron_app) else (autoninja -C out/Default electron:electron_app)
- if "%GN_CONFIG%"=="testing" ( python C:\depot_tools\post_build_ninja_summary.py -C out\Default )
- - gn gen out/ffmpeg "--args=import(\"//electron/build/args/ffmpeg.gn\") %GN_EXTRA_ARGS%"
- - ninja -C out/ffmpeg electron:electron_ffmpeg_zip
- - ninja -C out/Default electron:electron_dist_zip
+ - gn gen out/ffmpeg "--args=import(\"//electron/build/args/ffmpeg.gn\") use_remoteexec=true %GN_EXTRA_ARGS%"
+ - autoninja -C out/ffmpeg electron:electron_ffmpeg_zip
+ - autoninja -C out/Default electron:electron_dist_zip
- gn desc out/Default v8:run_mksnapshot_default args > out/Default/default_mksnapshot_args
# Remove unused args from mksnapshot_args
- ps: >-
Get-Content out/Default/default_mksnapshot_args | Where-Object { -not $_.Contains('--turbo-profiling-input') -And -not $_.Contains('builtins-pgo') -And -not $_.Contains('The gn arg use_goma=true') } | Set-Content out/Default/mksnapshot_args
- - ninja -C out/Default electron:electron_mksnapshot_zip
+ - autoninja -C out/Default electron:electron_mksnapshot_zip
- cd out\Default
- 7z a mksnapshot.zip mksnapshot_args gen\v8\embedded.S
- cd ..\..
- - ninja -C out/Default electron:hunspell_dictionaries_zip
- - ninja -C out/Default electron:electron_chromedriver_zip
- - ninja -C out/Default electron:node_headers
- - python3 %LOCAL_GOMA_DIR%\goma_ctl.py stat
+ - autoninja -C out/Default electron:hunspell_dictionaries_zip
+ - autoninja -C out/Default electron:electron_chromedriver_zip
+ - autoninja -C out/Default electron:node_headers
- ps: >-
Get-CimInstance -Namespace root\cimv2 -Class Win32_product | Select vendor, description, @{l='install_location';e='InstallLocation'}, @{l='install_date';e='InstallDate'}, @{l='install_date_2';e='InstallDate2'}, caption, version, name, @{l='sku_number';e='SKUNumber'} | ConvertTo-Json | Out-File -Encoding utf8 -FilePath .\installed_software.json
- python3 electron/build/profile_toolchain.py --output-json=out/Default/windows_toolchain_profile.json
@@ -174,7 +161,7 @@ for:
if ($env:GN_CONFIG -eq 'release') {
# Needed for msdia140.dll on 64-bit windows
$env:Path += ";$pwd\third_party\llvm-build\Release+Asserts\bin"
- ninja -C out/Default electron:electron_symbols
+ autoninja -C out/Default electron:electron_symbols
}
- ps: >-
if ($env:GN_CONFIG -eq 'release') {
diff --git a/patches/chromium/.patches b/patches/chromium/.patches
index 9d0137bf65..40a8fe97da 100644
--- a/patches/chromium/.patches
+++ b/patches/chromium/.patches
@@ -128,3 +128,4 @@ chore_remove_check_is_test_on_script_injection_tracker.patch
fix_restore_original_resize_performance_on_macos.patch
feat_allow_code_cache_in_custom_schemes.patch
enable_partition_alloc_ref_count_size.patch
+build_run_reclient_cfg_generator_after_chrome.patch
diff --git a/patches/chromium/build_run_reclient_cfg_generator_after_chrome.patch b/patches/chromium/build_run_reclient_cfg_generator_after_chrome.patch
new file mode 100644
index 0000000000..66dce9e49d
--- /dev/null
+++ b/patches/chromium/build_run_reclient_cfg_generator_after_chrome.patch
@@ -0,0 +1,30 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Samuel Attard <[email protected]>
+Date: Thu, 28 Dec 2023 17:09:08 +1300
+Subject: build: run reclient cfg generator after chrome
+
+We can't run our generator after chromes in gclient hooks so instead we patch
+their generator to run ours immediately after.
+
+This can't be upstreamed though may be replaceable later with some upstream refactors
+around reclient config generation.
+
+diff --git a/buildtools/reclient_cfgs/configure_reclient_cfgs.py b/buildtools/reclient_cfgs/configure_reclient_cfgs.py
+index 35aaf829ae998b52ca2ae21450a66f2c53fd457c..ecd46ccb33c5a8fe1cae526081a3bd1aa997cf81 100755
+--- a/buildtools/reclient_cfgs/configure_reclient_cfgs.py
++++ b/buildtools/reclient_cfgs/configure_reclient_cfgs.py
+@@ -317,4 +317,13 @@ def main():
+
+
+ if __name__ == "__main__":
+- sys.exit(main())
++ r = main()
++ if r != 0:
++ sys.exit(r)
++
++ electron_script = os.path.join(CHROMIUM_SRC, 'third_party', 'engflow-reclient-configs', 'configure_reclient.py')
++ r = subprocess.call([sys.executable, electron_script, '--src_dir=src', '--force'])
++ if r != 0:
++ sys.exit(r)
++
++ print('done')
diff --git a/patches/config.json b/patches/config.json
index db929cb196..4855e2e03d 100644
--- a/patches/config.json
+++ b/patches/config.json
@@ -21,5 +21,7 @@
"src/electron/patches/ReactiveObjC": "src/third_party/squirrel.mac/vendor/ReactiveObjC",
- "src/electron/patches/webrtc": "src/third_party/webrtc"
+ "src/electron/patches/webrtc": "src/third_party/webrtc",
+
+ "src/electron/patches/reclient-configs": "src/third_party/engflow-reclient-configs"
}
diff --git a/patches/reclient-configs/.patches b/patches/reclient-configs/.patches
new file mode 100644
index 0000000000..cf8760bb8e
--- /dev/null
+++ b/patches/reclient-configs/.patches
@@ -0,0 +1,3 @@
+fix_disable_compression_threshold.patch
+fix_add_python_remote_wrapper.patch
+build_on_windows_provide_clang_wrapper_as_toolchain_input.patch
diff --git a/patches/reclient-configs/build_on_windows_provide_clang_wrapper_as_toolchain_input.patch b/patches/reclient-configs/build_on_windows_provide_clang_wrapper_as_toolchain_input.patch
new file mode 100644
index 0000000000..a4195cc727
--- /dev/null
+++ b/patches/reclient-configs/build_on_windows_provide_clang_wrapper_as_toolchain_input.patch
@@ -0,0 +1,19 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Samuel Attard <[email protected]>
+Date: Tue, 9 Jan 2024 11:18:28 +1300
+Subject: build: on windows provide clang wrapper as toolchain input
+
+Should be upstreamed, fixes the executable bit being missing on win->lin x builds
+
+diff --git a/chromium-browser-clang/rewrapper_windows.cfg b/chromium-browser-clang/rewrapper_windows.cfg
+index 543b68bbd736bfb6cb2cf3e939c4cdc34b6a18da..539f37a53d990df39203496bb2d579f2ce38de75 100644
+--- a/chromium-browser-clang/rewrapper_windows.cfg
++++ b/chromium-browser-clang/rewrapper_windows.cfg
+@@ -15,6 +15,5 @@
+ # This config is merged with Chromium config. See README.md.
+
+ server_address=pipe://reproxy.pipe
+-inputs={src_dir}/buildtools/reclient_cfgs/chromium-browser-clang/clang_remote_wrapper
+-toolchain_inputs={linux_clang_base_path}/bin/clang
++toolchain_inputs={linux_clang_base_path}/bin/clang,{src_dir}/buildtools/reclient_cfgs/chromium-browser-clang/clang_remote_wrapper
+ remote_wrapper={src_dir}/buildtools/reclient_cfgs/chromium-browser-clang/clang_remote_wrapper
diff --git a/patches/reclient-configs/fix_add_python_remote_wrapper.patch b/patches/reclient-configs/fix_add_python_remote_wrapper.patch
new file mode 100644
index 0000000000..0c30b8490e
--- /dev/null
+++ b/patches/reclient-configs/fix_add_python_remote_wrapper.patch
@@ -0,0 +1,144 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Samuel Attard <[email protected]>
+Date: Thu, 28 Dec 2023 16:47:13 +1300
+Subject: fix: add python_remote_wrapper
+
+Our RBE cluster struggles to find python3 but bash finds it when spawned
+so we wrap all python remote execs with a helper bash script that just
+runs the underlying command.
+
+diff --git a/configure_reclient.py b/configure_reclient.py
+index 5948be95b6b19e6af4f9a9503c18ce2bebf63f2d..a157ceeb155987f6ab9b11d3cef8c2c9894e0436 100755
+--- a/configure_reclient.py
++++ b/configure_reclient.py
+@@ -21,6 +21,7 @@ import os
+ import re
+ import runpy
+ import shutil
++import stat
+ import string
+ import subprocess
+ import sys
+@@ -109,6 +110,8 @@ class ReclientConfigurator:
+ self.download_linux_clang_toolchain()
+ self.generate_clang_remote_wrapper()
+
++ self.generate_python_remote_wrapper()
++
+ # Reproxy config includes auth and network-related parameters.
+ self.generate_reproxy_cfg()
+ # Rewrapper configs describe how different tools should be run remotely.
+@@ -199,6 +202,32 @@ class ReclientConfigurator:
+ (f'{Paths.src_dir}/buildtools/reclient_cfgs/chromium-browser-clang/'
+ 'clang_remote_wrapper'), clang_remote_wrapper)
+
++ FileUtils.chmod_x((f'{Paths.src_dir}/buildtools/reclient_cfgs/chromium-browser-clang/'
++ 'clang_remote_wrapper'))
++
++ @staticmethod
++ def generate_python_remote_wrapper():
++ # Load python remote wrapper template.
++ template_file = (f'{Paths.script_dir}/python/'
++ 'python_remote_wrapper.template')
++ python_remote_wrapper_template = FileUtils.read_text_file(template_file)
++
++ # Variables to set in the template.
++ template_vars = {
++ }
++
++ # Substitute variables into the template.
++ python_remote_wrapper = ShellTemplate(
++ python_remote_wrapper_template).substitute(template_vars)
++
++ # Write the python remote wrapper.
++ FileUtils.write_text_file(
++ (f'{Paths.src_dir}/buildtools/reclient_cfgs/python/'
++ 'python_remote_wrapper'), python_remote_wrapper)
++
++ FileUtils.chmod_x((f'{Paths.src_dir}/buildtools/reclient_cfgs/python/'
++ 'python_remote_wrapper'))
++
+ def generate_reproxy_cfg(self):
+ # Load Chromium config template and remove everything starting with $
+ # symbol on each line.
+@@ -536,6 +565,11 @@ class FileUtils:
+
+ shutil.move(filepath_new, filepath)
+
++ @classmethod
++ def chmod_x(cls, filepath):
++ st = os.stat(filepath)
++ os.chmod(filepath, st.st_mode | stat.S_IEXEC)
++
+ @classmethod
+ def create_generated_header(cls, source_files):
+ if not isinstance(source_files, (list, tuple)):
+diff --git a/python/python_remote_wrapper.template b/python/python_remote_wrapper.template
+new file mode 100644
+index 0000000000000000000000000000000000000000..54817e4f6f9e3cb2f1e7ea1317fa8fefdf7a7da5
+--- /dev/null
++++ b/python/python_remote_wrapper.template
+@@ -0,0 +1,29 @@
++#!/bin/bash
++# Copyright (c) 2023 Contributors to the reclient-configs project. All rights reserved.
++#
++# Licensed under the Apache License, Version 2.0 (the "License");
++# you may not use this file except in compliance with the License.
++# You may obtain a copy of the License at
++#
++# http://www.apache.org/licenses/LICENSE-2.0
++#
++# Unless required by applicable law or agreed to in writing, software
++# distributed under the License is distributed on an "AS IS" BASIS,
++# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++# See the License for the specific language governing permissions and
++# limitations under the License.
++
++# AUTOGENERATED FILE - DO NOT EDIT
++# Generated by:
++# {configurator_dir}/configure_reclient.py
++# To edit update:
++# {configurator_dir}/python/python_remote_wrapper.template
++# And rerun configurator.
++
++# WARNING: This file is a part of reclient action inputs. Any modification will
++# invalidate remote cache.
++
++set -e
++
++# Launch
++"$1" "${@:2}"
+diff --git a/python/rewrapper_linux.cfg b/python/rewrapper_linux.cfg
+index 951bc66afd28b280fe936141f0b1a8e473bdba05..4ac7ec4b7559ffc133912ee932f9cf8e7450e4db 100644
+--- a/python/rewrapper_linux.cfg
++++ b/python/rewrapper_linux.cfg
+@@ -13,3 +13,6 @@
+ # limitations under the License.
+
+ # This config is merged with Chromium config. See README.md.
++
++inputs=buildtools/reclient_cfgs/python/python_remote_wrapper
++remote_wrapper=../../buildtools/reclient_cfgs/python/python_remote_wrapper
+\ No newline at end of file
+diff --git a/python/rewrapper_mac.cfg b/python/rewrapper_mac.cfg
+index 951bc66afd28b280fe936141f0b1a8e473bdba05..4ac7ec4b7559ffc133912ee932f9cf8e7450e4db 100644
+--- a/python/rewrapper_mac.cfg
++++ b/python/rewrapper_mac.cfg
+@@ -13,3 +13,6 @@
+ # limitations under the License.
+
+ # This config is merged with Chromium config. See README.md.
++
++inputs=buildtools/reclient_cfgs/python/python_remote_wrapper
++remote_wrapper=../../buildtools/reclient_cfgs/python/python_remote_wrapper
+\ No newline at end of file
+diff --git a/python/rewrapper_windows.cfg b/python/rewrapper_windows.cfg
+index 7ff80607546455eb7c5f16a410770d18949cd7f5..ce19dc95094d87b494e4b89a2bf1a368ace567a2 100644
+--- a/python/rewrapper_windows.cfg
++++ b/python/rewrapper_windows.cfg
+@@ -15,3 +15,5 @@
+ # This config is merged with Chromium config. See README.md.
+
+ server_address=pipe://reproxy.pipe
++inputs=buildtools/reclient_cfgs/python/python_remote_wrapper
++remote_wrapper=../../buildtools/reclient_cfgs/python/python_remote_wrapper
diff --git a/patches/reclient-configs/fix_disable_compression_threshold.patch b/patches/reclient-configs/fix_disable_compression_threshold.patch
new file mode 100644
index 0000000000..0be4eac477
--- /dev/null
+++ b/patches/reclient-configs/fix_disable_compression_threshold.patch
@@ -0,0 +1,17 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Samuel Attard <[email protected]>
+Date: Thu, 28 Dec 2023 16:13:18 +1300
+Subject: fix: disable compression_threshold
+
+This appears to cause issues with nginx ingress for RBE endpoints, disable
+it till we can figure out why.
+
+diff --git a/reproxy.cfg b/reproxy.cfg
+index 4325d36cbfcb6d81eb0f8dc7ab7cf8e8857d608c..2390a73f4674a591ef833d10697e4aaf3894c011 100644
+--- a/reproxy.cfg
++++ b/reproxy.cfg
+@@ -17,3 +17,4 @@
+ # Unset Chromium variables.
+ service=
+ automatic_auth=
++compression_threshold=
diff --git a/script/prepare-appveyor.js b/script/prepare-appveyor.js
index 7bac5a9a2d..56e39a5f66 100644
--- a/script/prepare-appveyor.js
+++ b/script/prepare-appveyor.js
@@ -110,7 +110,6 @@ async function callAppVeyorBuildJobs (targetBranch, job, options) {
ELECTRON_OUT_DIR: 'Default',
ELECTRON_ENABLE_STACK_DUMPING: 1,
ELECTRON_ALSO_LOG_TO_STDERR: 1,
- GOMA_FALLBACK_ON_AUTH_FAILURE: true,
DEPOT_TOOLS_WIN_TOOLCHAIN: 0,
PYTHONIOENCODING: 'UTF-8'
};
diff --git a/script/start-goma.ps1 b/script/start-goma.ps1
deleted file mode 100755
index 20e061105a..0000000000
--- a/script/start-goma.ps1
+++ /dev/null
@@ -1,10 +0,0 @@
-param([string]$gomaDir=$PWD)
-$cmdPath = Join-Path -Path $gomaDir -ChildPath "goma_ctl.py"
-Start-Process -FilePath cmd -ArgumentList "/C", "python3", "$cmdPath", "ensure_start"
-$timedOut = $false; $waitTime = 0; $waitIncrement = 5; $timeout=120;
-Do { sleep $waitIncrement; $timedOut = (($waitTime+=$waitIncrement) -gt $timeout); iex "$gomaDir\gomacc.exe port 2" > $null; } Until(($LASTEXITCODE -eq 0) -or $timedOut)
-if ($timedOut) {
- write-error 'Timed out waiting for goma to start'; exit 1;
-} else {
- Write-Output "Successfully started goma!"
-}
|
build
|
755c6640fd0c14df4528964ccffdf6b463d136c7
|
Shelley Vohr
|
2024-08-22 02:38:06
|
docs: clarify icon value in Notification (#43377)
* docs: clarify icon value in Notification
* Update docs/api/notification.md
Co-authored-by: Erick Zhao <[email protected]>
---------
Co-authored-by: Erick Zhao <[email protected]>
|
diff --git a/docs/api/notification.md b/docs/api/notification.md
index fe12a9d050..efaa93b39e 100644
--- a/docs/api/notification.md
+++ b/docs/api/notification.md
@@ -36,7 +36,7 @@ Returns `boolean` - Whether or not desktop notifications are supported on the cu
* `subtitle` string (optional) _macOS_ - A subtitle for the notification, which will be displayed below the title.
* `body` string (optional) - The body text of the notification, which will be displayed below the title or subtitle.
* `silent` boolean (optional) - Whether or not to suppress the OS notification noise when showing the notification.
- * `icon` (string | [NativeImage](native-image.md)) (optional) - An icon to use in the notification.
+ * `icon` (string | [NativeImage](native-image.md)) (optional) - An icon to use in the notification. If a string is passed, it must be a valid path to a local icon file.
* `hasReply` boolean (optional) _macOS_ - Whether or not to add an inline reply option to the notification.
* `timeoutType` string (optional) _Linux_ _Windows_ - The timeout duration of the notification. Can be 'default' or 'never'.
* `replyPlaceholder` string (optional) _macOS_ - The placeholder to write in the inline reply input field.
|
docs
|
69586684484c05a0078e3b916239186a5c3d749a
|
Samuel Attard
|
2023-04-10 14:58:27
|
fix: exceptions in nested conversions live in the target world (#37895)
|
diff --git a/shell/renderer/api/electron_api_context_bridge.cc b/shell/renderer/api/electron_api_context_bridge.cc
index 23337d9e9c..36fe034651 100644
--- a/shell/renderer/api/electron_api_context_bridge.cc
+++ b/shell/renderer/api/electron_api_context_bridge.cc
@@ -241,10 +241,10 @@ v8::MaybeLocal<v8::Value> PassValueToOtherContext(
global_destination_context.IsEmpty())
return;
context_bridge::ObjectCache object_cache;
- auto val =
- PassValueToOtherContext(global_source_context.Get(isolate),
- global_destination_context.Get(isolate),
- result, &object_cache, false, 0);
+ auto val = PassValueToOtherContext(
+ global_source_context.Get(isolate),
+ global_destination_context.Get(isolate), result, &object_cache,
+ false, 0, BridgeErrorTarget::kSource);
if (!val.IsEmpty())
proxied_promise->Resolve(val.ToLocalChecked());
},
@@ -268,10 +268,10 @@ v8::MaybeLocal<v8::Value> PassValueToOtherContext(
global_destination_context.IsEmpty())
return;
context_bridge::ObjectCache object_cache;
- auto val =
- PassValueToOtherContext(global_source_context.Get(isolate),
- global_destination_context.Get(isolate),
- result, &object_cache, false, 0);
+ auto val = PassValueToOtherContext(
+ global_source_context.Get(isolate),
+ global_destination_context.Get(isolate), result, &object_cache,
+ false, 0, BridgeErrorTarget::kSource);
if (!val.IsEmpty())
proxied_promise->Reject(val.ToLocalChecked());
},
@@ -324,7 +324,7 @@ v8::MaybeLocal<v8::Value> PassValueToOtherContext(
auto value_for_array = PassValueToOtherContext(
source_context, destination_context,
arr->Get(source_context, i).ToLocalChecked(), object_cache,
- support_dynamic_properties, recursion_depth + 1);
+ support_dynamic_properties, recursion_depth + 1, error_target);
if (value_for_array.IsEmpty())
return v8::MaybeLocal<v8::Value>();
@@ -358,7 +358,7 @@ v8::MaybeLocal<v8::Value> PassValueToOtherContext(
auto object_value = value.As<v8::Object>();
auto passed_value = CreateProxyForAPI(
object_value, source_context, destination_context, object_cache,
- support_dynamic_properties, recursion_depth + 1);
+ support_dynamic_properties, recursion_depth + 1, error_target);
if (passed_value.IsEmpty())
return v8::MaybeLocal<v8::Value>();
return v8::MaybeLocal<v8::Value>(passed_value.ToLocalChecked());
@@ -372,8 +372,9 @@ v8::MaybeLocal<v8::Value> PassValueToOtherContext(
: destination_context;
v8::Context::Scope error_scope(error_context);
// V8 serializer will throw an error if required
- if (!gin::ConvertFromV8(error_context->GetIsolate(), value, &ret))
+ if (!gin::ConvertFromV8(error_context->GetIsolate(), value, &ret)) {
return v8::MaybeLocal<v8::Value>();
+ }
}
{
@@ -420,9 +421,9 @@ void ProxyFunctionWrapper(const v8::FunctionCallbackInfo<v8::Value>& info) {
args.GetRemaining(&original_args);
for (auto value : original_args) {
- auto arg =
- PassValueToOtherContext(calling_context, func_owning_context, value,
- &object_cache, support_dynamic_properties, 0);
+ auto arg = PassValueToOtherContext(
+ calling_context, func_owning_context, value, &object_cache,
+ support_dynamic_properties, 0, BridgeErrorTarget::kSource);
if (arg.IsEmpty())
return;
proxied_args.push_back(arg.ToLocalChecked());
@@ -485,7 +486,8 @@ v8::MaybeLocal<v8::Object> CreateProxyForAPI(
const v8::Local<v8::Context>& destination_context,
context_bridge::ObjectCache* object_cache,
bool support_dynamic_properties,
- int recursion_depth) {
+ int recursion_depth,
+ BridgeErrorTarget error_target) {
gin_helper::Dictionary api(source_context->GetIsolate(), api_object);
{
@@ -526,14 +528,16 @@ v8::MaybeLocal<v8::Object> CreateProxyForAPI(
if (!getter.IsEmpty()) {
if (!PassValueToOtherContext(source_context, destination_context,
getter, object_cache,
- support_dynamic_properties, 1)
+ support_dynamic_properties, 1,
+ error_target)
.ToLocal(&getter_proxy))
continue;
}
if (!setter.IsEmpty()) {
if (!PassValueToOtherContext(source_context, destination_context,
setter, object_cache,
- support_dynamic_properties, 1)
+ support_dynamic_properties, 1,
+ error_target)
.ToLocal(&setter_proxy))
continue;
}
@@ -551,7 +555,7 @@ v8::MaybeLocal<v8::Object> CreateProxyForAPI(
auto passed_value = PassValueToOtherContext(
source_context, destination_context, value, object_cache,
- support_dynamic_properties, recursion_depth + 1);
+ support_dynamic_properties, recursion_depth + 1, error_target);
if (passed_value.IsEmpty())
return v8::MaybeLocal<v8::Object>();
proxy.Set(key, passed_value.ToLocalChecked());
@@ -597,9 +601,9 @@ void ExposeAPIInWorld(v8::Isolate* isolate,
context_bridge::ObjectCache object_cache;
v8::Context::Scope target_context_scope(target_context);
- v8::MaybeLocal<v8::Value> maybe_proxy =
- PassValueToOtherContext(electron_isolated_context, target_context, api,
- &object_cache, false, 0);
+ v8::MaybeLocal<v8::Value> maybe_proxy = PassValueToOtherContext(
+ electron_isolated_context, target_context, api, &object_cache, false, 0,
+ BridgeErrorTarget::kSource);
if (maybe_proxy.IsEmpty())
return;
auto proxy = maybe_proxy.ToLocalChecked();
@@ -649,7 +653,7 @@ void OverrideGlobalValueFromIsolatedWorld(
context_bridge::ObjectCache object_cache;
v8::MaybeLocal<v8::Value> maybe_proxy = PassValueToOtherContext(
value->GetCreationContextChecked(), main_context, value, &object_cache,
- support_dynamic_properties, 1);
+ support_dynamic_properties, 1, BridgeErrorTarget::kSource);
DCHECK(!maybe_proxy.IsEmpty());
auto proxy = maybe_proxy.ToLocalChecked();
@@ -685,14 +689,14 @@ bool OverrideGlobalPropertyFromIsolatedWorld(
if (!getter->IsNullOrUndefined()) {
v8::MaybeLocal<v8::Value> maybe_getter_proxy = PassValueToOtherContext(
getter->GetCreationContextChecked(), main_context, getter,
- &object_cache, false, 1);
+ &object_cache, false, 1, BridgeErrorTarget::kSource);
DCHECK(!maybe_getter_proxy.IsEmpty());
getter_proxy = maybe_getter_proxy.ToLocalChecked();
}
if (!setter->IsNullOrUndefined() && setter->IsObject()) {
v8::MaybeLocal<v8::Value> maybe_setter_proxy = PassValueToOtherContext(
getter->GetCreationContextChecked(), main_context, setter,
- &object_cache, false, 1);
+ &object_cache, false, 1, BridgeErrorTarget::kSource);
DCHECK(!maybe_setter_proxy.IsEmpty());
setter_proxy = maybe_setter_proxy.ToLocalChecked();
}
diff --git a/shell/renderer/api/electron_api_context_bridge.h b/shell/renderer/api/electron_api_context_bridge.h
index bc60d2356a..dd2af4b713 100644
--- a/shell/renderer/api/electron_api_context_bridge.h
+++ b/shell/renderer/api/electron_api_context_bridge.h
@@ -39,7 +39,7 @@ v8::MaybeLocal<v8::Value> PassValueToOtherContext(
context_bridge::ObjectCache* object_cache,
bool support_dynamic_properties,
int recursion_depth,
- BridgeErrorTarget error_target = BridgeErrorTarget::kSource);
+ BridgeErrorTarget error_target);
v8::MaybeLocal<v8::Object> CreateProxyForAPI(
const v8::Local<v8::Object>& api_object,
@@ -47,7 +47,8 @@ v8::MaybeLocal<v8::Object> CreateProxyForAPI(
const v8::Local<v8::Context>& destination_context,
context_bridge::ObjectCache* object_cache,
bool support_dynamic_properties,
- int recursion_depth);
+ int recursion_depth,
+ BridgeErrorTarget error_target);
} // namespace electron::api
diff --git a/shell/renderer/api/electron_api_web_frame.cc b/shell/renderer/api/electron_api_web_frame.cc
index 71f10a241f..b1a2b791cc 100644
--- a/shell/renderer/api/electron_api_web_frame.cc
+++ b/shell/renderer/api/electron_api_web_frame.cc
@@ -142,7 +142,7 @@ class ScriptExecutionCallback {
context_bridge::ObjectCache object_cache;
maybe_result = PassValueToOtherContext(
result->GetCreationContextChecked(), promise_.GetContext(), result,
- &object_cache, false, 0);
+ &object_cache, false, 0, BridgeErrorTarget::kSource);
if (maybe_result.IsEmpty() || try_catch.HasCaught()) {
success = false;
}
diff --git a/shell/renderer/renderer_client_base.cc b/shell/renderer/renderer_client_base.cc
index 8923708ab6..e5309b3989 100644
--- a/shell/renderer/renderer_client_base.cc
+++ b/shell/renderer/renderer_client_base.cc
@@ -608,7 +608,8 @@ void RendererClientBase::SetupMainWorldOverrides(
if (global.GetHidden("guestViewInternal", &guest_view_internal)) {
api::context_bridge::ObjectCache object_cache;
auto result = api::PassValueToOtherContext(
- source_context, context, guest_view_internal, &object_cache, false, 0);
+ source_context, context, guest_view_internal, &object_cache, false, 0,
+ api::BridgeErrorTarget::kSource);
if (!result.IsEmpty()) {
isolated_api.Set("guestViewInternal", result.ToLocalChecked());
}
diff --git a/spec/api-context-bridge-spec.ts b/spec/api-context-bridge-spec.ts
index e6574fff45..606394b564 100644
--- a/spec/api-context-bridge-spec.ts
+++ b/spec/api-context-bridge-spec.ts
@@ -806,6 +806,14 @@ describe('contextBridge', () => {
throwNotClonable: () => {
return Object(Symbol('foo'));
},
+ throwNotClonableNestedArray: () => {
+ return [Object(Symbol('foo'))];
+ },
+ throwNotClonableNestedObject: () => {
+ return {
+ bad: Object(Symbol('foo'))
+ };
+ },
argumentConvert: () => {}
});
});
@@ -821,10 +829,12 @@ describe('contextBridge', () => {
const normalIsError = Object.getPrototypeOf(getError(root.example.throwNormal)) === Error.prototype;
const weirdIsError = Object.getPrototypeOf(getError(root.example.throwWeird)) === Error.prototype;
const notClonableIsError = Object.getPrototypeOf(getError(root.example.throwNotClonable)) === Error.prototype;
+ const notClonableNestedArrayIsError = Object.getPrototypeOf(getError(root.example.throwNotClonableNestedArray)) === Error.prototype;
+ const notClonableNestedObjectIsError = Object.getPrototypeOf(getError(root.example.throwNotClonableNestedObject)) === Error.prototype;
const argumentConvertIsError = Object.getPrototypeOf(getError(() => root.example.argumentConvert(Object(Symbol('test'))))) === Error.prototype;
- return [normalIsError, weirdIsError, notClonableIsError, argumentConvertIsError];
+ return [normalIsError, weirdIsError, notClonableIsError, notClonableNestedArrayIsError, notClonableNestedObjectIsError, argumentConvertIsError];
});
- expect(result).to.deep.equal([true, true, true, true], 'should all be errors in the current context');
+ expect(result).to.deep.equal([true, true, true, true, true, true], 'should all be errors in the current context');
});
it('should not leak prototypes', async () => {
|
fix
|
5686f88bd298ea682d4eae576a6f84cc7844bd22
|
Charles Kerr
|
2024-02-06 09:18:05
|
refactor: KeyWeakMap cleanup (#41242)
* refactor: make KeyWeakMap::KeyObject private
* perf: avoid redundant map lookup
* refactor: remove unused KeyWeakMap::Has()
* refactor: make KeyWeakMap dtor nonvirtual
no inheritance used, so no need for virtual dtor?
* chore: fix KeyWeakMap code comment
* refactor: use if statement in KeyWeakMap::Get()
* refactor: use better variable names in KeyWeakMap::Values()
|
diff --git a/shell/common/gin_helper/trackable_object.h b/shell/common/gin_helper/trackable_object.h
index a4e3214418..3ee141e16f 100644
--- a/shell/common/gin_helper/trackable_object.h
+++ b/shell/common/gin_helper/trackable_object.h
@@ -107,7 +107,7 @@ class TrackableObject : public TrackableObjectBase, public EventEmitter<T> {
// Removes this instance from the weak map.
void RemoveFromWeakMap() {
- if (weak_map_ && weak_map_->Has(weak_map_id()))
+ if (weak_map_)
weak_map_->Remove(weak_map_id());
}
diff --git a/shell/common/key_weak_map.h b/shell/common/key_weak_map.h
index d5ab86a715..b3e4f36675 100644
--- a/shell/common/key_weak_map.h
+++ b/shell/common/key_weak_map.h
@@ -9,24 +9,17 @@
#include <utility>
#include <vector>
-#include "base/containers/contains.h"
#include "base/memory/raw_ptr.h"
#include "v8/include/v8.h"
namespace electron {
-// Like ES6's WeakMap, but the key is Integer and the value is Weak Pointer.
+// Like ES6's WeakMap, with a K key and Weak Pointer value.
template <typename K>
class KeyWeakMap {
public:
- // Records the key and self, used by SetWeak.
- struct KeyObject {
- K key;
- raw_ptr<KeyWeakMap> self;
- };
-
KeyWeakMap() {}
- virtual ~KeyWeakMap() {
+ ~KeyWeakMap() {
for (auto& p : map_)
p.second.second.ClearWeak();
}
@@ -45,23 +38,19 @@ class KeyWeakMap {
// Gets the object from WeakMap by its |key|.
v8::MaybeLocal<v8::Object> Get(v8::Isolate* isolate, const K& key) {
- auto iter = map_.find(key);
- if (iter == map_.end())
- return v8::MaybeLocal<v8::Object>();
- else
+ if (auto iter = map_.find(key); iter != map_.end())
return v8::Local<v8::Object>::New(isolate, iter->second.second);
+ return {};
}
- // Whether there is an object with |key| in this WeakMap.
- constexpr bool Has(const K& key) const { return base::Contains(map_, key); }
-
// Returns all objects.
std::vector<v8::Local<v8::Object>> Values(v8::Isolate* isolate) const {
- std::vector<v8::Local<v8::Object>> keys;
- keys.reserve(map_.size());
+ std::vector<v8::Local<v8::Object>> values;
+ values.reserve(map_.size());
for (const auto& it : map_)
- keys.emplace_back(v8::Local<v8::Object>::New(isolate, it.second.second));
- return keys;
+ values.emplace_back(
+ v8::Local<v8::Object>::New(isolate, it.second.second));
+ return values;
}
// Remove object with |key| in the WeakMap.
@@ -75,6 +64,12 @@ class KeyWeakMap {
}
private:
+ // Records the key and self, used by SetWeak.
+ struct KeyObject {
+ K key;
+ raw_ptr<KeyWeakMap> self;
+ };
+
static void OnObjectGC(
const v8::WeakCallbackInfo<typename KeyWeakMap<K>::KeyObject>& data) {
KeyWeakMap<K>::KeyObject* key_object = data.GetParameter();
|
refactor
|
88f28a302ff2ba6fd3698e1cb1cfb6497d178f32
|
David Sanders
|
2024-05-13 02:49:18
|
docs: improve protocol.handle file examples (#42111)
* docs: improve protocol.handle file examples
* chore: fix lint
|
diff --git a/docs/api/protocol.md b/docs/api/protocol.md
index 6d2de18751..3f4ce799a1 100644
--- a/docs/api/protocol.md
+++ b/docs/api/protocol.md
@@ -9,10 +9,14 @@ An example of implementing a protocol that has the same effect as the
```js
const { app, protocol, net } = require('electron')
+const path = require('node:path')
+const url = require('node:url')
app.whenReady().then(() => {
- protocol.handle('atom', (request) =>
- net.fetch('file://' + request.url.slice('atom://'.length)))
+ protocol.handle('atom', (request) => {
+ const filePath = request.url.slice('atom://'.length)
+ return net.fetch(url.pathToFileURL(path.join(__dirname, filePath)).toString())
+ })
})
```
@@ -42,7 +46,7 @@ app.whenReady().then(() => {
ses.protocol.handle('atom', (request) => {
const filePath = request.url.slice('atom://'.length)
- return net.fetch(url.pathToFileURL(path.join(__dirname, filePath)).toString())
+ return net.fetch(url.pathToFileURL(path.resolve(__dirname, filePath)).toString())
})
const mainWindow = new BrowserWindow({ webPreferences: { partition } })
|
docs
|
2a26cef577dbf6cf3bf52959a86af311e2b56b96
|
StepSecurity Bot
|
2022-12-05 12:11:10
|
ci: pin action shas (#36562)
Signed-off-by: StepSecurity Bot <[email protected]>
Signed-off-by: StepSecurity Bot <[email protected]>
|
diff --git a/.github/workflows/update_appveyor_image.yml b/.github/workflows/update_appveyor_image.yml
index 9d84c7d959..49c265c598 100644
--- a/.github/workflows/update_appveyor_image.yml
+++ b/.github/workflows/update_appveyor_image.yml
@@ -18,7 +18,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
- uses: actions/checkout@v3
+ uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
with:
fetch-depth: 0
- name: Yarn install
@@ -37,7 +37,7 @@ jobs:
fi
- name: (Optionally) Update Appveyor Image
if: ${{ env.APPVEYOR_IMAGE_VERSION }}
- uses: mikefarah/[email protected]
+ uses: mikefarah/yq@1c7dc0e88aad311c89889bc5ce5d8f96931a1bd0 # v4.27.2
with:
cmd: yq '.image = "${{ env.APPVEYOR_IMAGE_VERSION }}"' "appveyor.yml" > "appveyor2.yml"
- name: (Optionally) Generate Commit Diff
@@ -48,7 +48,7 @@ jobs:
rm appveyor2.yml appveyor.diff
- name: (Optionally) Commit and Pull Request
if: ${{ env.APPVEYOR_IMAGE_VERSION }}
- uses: peter-evans/create-pull-request@v4
+ uses: peter-evans/create-pull-request@2b011faafdcbc9ceb11414d64d0573f37c774b04 # v4.2.3
with:
token: ${{ secrets.ACTIONS_GITHUB_TOKEN }}
commit-message: 'build: update appveyor image to latest version'
|
ci
|
d09a2e513c6a64c96bf0e60699e88dfe7b17791d
|
Shelley Vohr
|
2024-07-30 12:37:27
|
fix: `showInactive` window not showing (#43079)
fix: showInactive window not showing
Refs https://github.com/electron/electron/pull/42226 and https://github.com/electron/electron/pull/43033
|
diff --git a/shell/browser/native_window_mac.mm b/shell/browser/native_window_mac.mm
index 934623985b..7f278788f9 100644
--- a/shell/browser/native_window_mac.mm
+++ b/shell/browser/native_window_mac.mm
@@ -466,7 +466,7 @@ void NativeWindowMac::ShowInactive() {
if (parent())
InternalSetParentWindow(parent(), true);
- [window_ orderFrontKeepWindowKeyState];
+ [window_ orderFrontRegardless];
}
void NativeWindowMac::Hide() {
|
fix
|
c1898c39bf8e0fb4a1ccc31023757e7304997fdf
|
Milan Burda
|
2023-08-22 06:43:30
|
chore: remove obsolete "simple" object annotations for the remote module (#39486)
|
diff --git a/shell/browser/api/electron_api_app.cc b/shell/browser/api/electron_api_app.cc
index 415ed4efc6..ac6b1c79d0 100644
--- a/shell/browser/api/electron_api_app.cc
+++ b/shell/browser/api/electron_api_app.cc
@@ -1347,8 +1347,6 @@ std::vector<gin_helper::Dictionary> App::GetAppMetrics(v8::Isolate* isolate) {
auto pid_dict = gin_helper::Dictionary::CreateEmpty(isolate);
auto cpu_dict = gin_helper::Dictionary::CreateEmpty(isolate);
- pid_dict.SetHidden("simple", true);
- cpu_dict.SetHidden("simple", true);
cpu_dict.Set(
"percentCPUUsage",
process_metric.second->metrics->GetPlatformIndependentCPUUsage() /
@@ -1383,7 +1381,6 @@ std::vector<gin_helper::Dictionary> App::GetAppMetrics(v8::Isolate* isolate) {
auto memory_info = process_metric.second->GetMemoryInfo();
auto memory_dict = gin_helper::Dictionary::CreateEmpty(isolate);
- memory_dict.SetHidden("simple", true);
memory_dict.Set("workingSetSize",
static_cast<double>(memory_info.working_set_size >> 10));
memory_dict.Set(
diff --git a/shell/browser/api/electron_api_in_app_purchase.cc b/shell/browser/api/electron_api_in_app_purchase.cc
index 5d93a3564f..ac78a07f1a 100644
--- a/shell/browser/api/electron_api_in_app_purchase.cc
+++ b/shell/browser/api/electron_api_in_app_purchase.cc
@@ -21,7 +21,6 @@ struct Converter<in_app_purchase::PaymentDiscount> {
v8::Isolate* isolate,
const in_app_purchase::PaymentDiscount& paymentDiscount) {
auto dict = gin_helper::Dictionary::CreateEmpty(isolate);
- dict.SetHidden("simple", true);
dict.Set("identifier", paymentDiscount.identifier);
dict.Set("keyIdentifier", paymentDiscount.keyIdentifier);
dict.Set("nonce", paymentDiscount.nonce);
@@ -36,7 +35,6 @@ struct Converter<in_app_purchase::Payment> {
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
const in_app_purchase::Payment& payment) {
auto dict = gin_helper::Dictionary::CreateEmpty(isolate);
- dict.SetHidden("simple", true);
dict.Set("productIdentifier", payment.productIdentifier);
dict.Set("quantity", payment.quantity);
dict.Set("applicationUsername", payment.applicationUsername);
@@ -52,7 +50,6 @@ struct Converter<in_app_purchase::Transaction> {
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
const in_app_purchase::Transaction& val) {
auto dict = gin_helper::Dictionary::CreateEmpty(isolate);
- dict.SetHidden("simple", true);
dict.Set("transactionIdentifier", val.transactionIdentifier);
dict.Set("transactionDate", val.transactionDate);
dict.Set("originalTransactionIdentifier",
@@ -72,7 +69,6 @@ struct Converter<in_app_purchase::ProductSubscriptionPeriod> {
const in_app_purchase::ProductSubscriptionPeriod&
productSubscriptionPeriod) {
auto dict = gin_helper::Dictionary::CreateEmpty(isolate);
- dict.SetHidden("simple", true);
dict.Set("numberOfUnits", productSubscriptionPeriod.numberOfUnits);
dict.Set("unit", productSubscriptionPeriod.unit);
return dict.GetHandle();
@@ -85,7 +81,6 @@ struct Converter<in_app_purchase::ProductDiscount> {
v8::Isolate* isolate,
const in_app_purchase::ProductDiscount& productDiscount) {
auto dict = gin_helper::Dictionary::CreateEmpty(isolate);
- dict.SetHidden("simple", true);
dict.Set("identifier", productDiscount.identifier);
dict.Set("type", productDiscount.type);
dict.Set("price", productDiscount.price);
@@ -105,7 +100,6 @@ struct Converter<in_app_purchase::Product> {
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
const in_app_purchase::Product& val) {
auto dict = gin_helper::Dictionary::CreateEmpty(isolate);
- dict.SetHidden("simple", true);
dict.Set("productIdentifier", val.productIdentifier);
dict.Set("localizedDescription", val.localizedDescription);
dict.Set("localizedTitle", val.localizedTitle);
diff --git a/shell/browser/api/electron_api_system_preferences.cc b/shell/browser/api/electron_api_system_preferences.cc
index ccbe9db827..302dc361fe 100644
--- a/shell/browser/api/electron_api_system_preferences.cc
+++ b/shell/browser/api/electron_api_system_preferences.cc
@@ -36,7 +36,6 @@ SystemPreferences::~SystemPreferences() = default;
v8::Local<v8::Value> SystemPreferences::GetAnimationSettings(
v8::Isolate* isolate) {
auto dict = gin_helper::Dictionary::CreateEmpty(isolate);
- dict.SetHidden("simple", true);
dict.Set("shouldRenderRichAnimation",
gfx::Animation::ShouldRenderRichAnimation());
dict.Set("scrollAnimationsEnabledBySystem",
diff --git a/shell/common/api/electron_bindings.cc b/shell/common/api/electron_bindings.cc
index 7651548d3d..a974c775f0 100644
--- a/shell/common/api/electron_bindings.cc
+++ b/shell/common/api/electron_bindings.cc
@@ -140,7 +140,6 @@ v8::Local<v8::Value> ElectronBindings::GetHeapStatistics(v8::Isolate* isolate) {
isolate->GetHeapStatistics(&v8_heap_stats);
auto dict = gin_helper::Dictionary::CreateEmpty(isolate);
- dict.SetHidden("simple", true);
dict.Set("totalHeapSize",
static_cast<double>(v8_heap_stats.total_heap_size() >> 10));
dict.Set(
@@ -185,7 +184,6 @@ v8::Local<v8::Value> ElectronBindings::GetSystemMemoryInfo(
}
auto dict = gin_helper::Dictionary::CreateEmpty(isolate);
- dict.SetHidden("simple", true);
dict.Set("total", mem_info.total);
// See Chromium's "base/process/process_metrics.h" for an explanation.
@@ -236,7 +234,6 @@ v8::Local<v8::Value> ElectronBindings::GetBlinkMemoryInfo(
auto total = blink::ProcessHeap::TotalAllocatedSpace();
auto dict = gin_helper::Dictionary::CreateEmpty(isolate);
- dict.SetHidden("simple", true);
dict.Set("allocated", static_cast<double>(allocated >> 10));
dict.Set("total", static_cast<double>(total >> 10));
return dict.GetHandle();
@@ -289,7 +286,6 @@ v8::Local<v8::Value> ElectronBindings::GetCPUUsage(
base::ProcessMetrics* metrics,
v8::Isolate* isolate) {
auto dict = gin_helper::Dictionary::CreateEmpty(isolate);
- dict.SetHidden("simple", true);
int processor_count = base::SysInfo::NumberOfProcessors();
dict.Set("percentCPUUsage",
metrics->GetPlatformIndependentCPUUsage() / processor_count);
@@ -310,7 +306,6 @@ v8::Local<v8::Value> ElectronBindings::GetIOCounters(v8::Isolate* isolate) {
auto metrics = base::ProcessMetrics::CreateCurrentProcessMetrics();
base::IoCounters io_counters;
auto dict = gin_helper::Dictionary::CreateEmpty(isolate);
- dict.SetHidden("simple", true);
if (metrics->GetIOCounters(&io_counters)) {
dict.Set("readOperationCount", io_counters.ReadOperationCount);
diff --git a/shell/common/gin_converters/gfx_converter.cc b/shell/common/gin_converters/gfx_converter.cc
index eff8a735d7..4cf81c0f69 100644
--- a/shell/common/gin_converters/gfx_converter.cc
+++ b/shell/common/gin_converters/gfx_converter.cc
@@ -18,7 +18,6 @@ namespace gin {
v8::Local<v8::Value> Converter<gfx::Point>::ToV8(v8::Isolate* isolate,
const gfx::Point& val) {
auto dict = gin_helper::Dictionary::CreateEmpty(isolate);
- dict.SetHidden("simple", true);
dict.Set("x", val.x());
dict.Set("y", val.y());
return dict.GetHandle();
@@ -41,7 +40,6 @@ bool Converter<gfx::Point>::FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> Converter<gfx::PointF>::ToV8(v8::Isolate* isolate,
const gfx::PointF& val) {
auto dict = gin_helper::Dictionary::CreateEmpty(isolate);
- dict.SetHidden("simple", true);
dict.Set("x", val.x());
dict.Set("y", val.y());
return dict.GetHandle();
@@ -63,7 +61,6 @@ bool Converter<gfx::PointF>::FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> Converter<gfx::Size>::ToV8(v8::Isolate* isolate,
const gfx::Size& val) {
auto dict = gin_helper::Dictionary::CreateEmpty(isolate);
- dict.SetHidden("simple", true);
dict.Set("width", val.width());
dict.Set("height", val.height());
return dict.GetHandle();
@@ -85,7 +82,6 @@ bool Converter<gfx::Size>::FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> Converter<gfx::Rect>::ToV8(v8::Isolate* isolate,
const gfx::Rect& val) {
auto dict = gin_helper::Dictionary::CreateEmpty(isolate);
- dict.SetHidden("simple", true);
dict.Set("x", val.x());
dict.Set("y", val.y());
dict.Set("width", val.width());
@@ -142,7 +138,6 @@ v8::Local<v8::Value> Converter<display::Display>::ToV8(
v8::Isolate* isolate,
const display::Display& val) {
auto dict = gin_helper::Dictionary::CreateEmpty(isolate);
- dict.SetHidden("simple", true);
dict.Set("id", val.id());
dict.Set("label", val.label());
dict.Set("bounds", val.bounds());
|
chore
|
18d484f39cc394016f30c91e246d3595b93b67a8
|
github-actions[bot]
|
2023-06-13 14:56:43
|
build: update appveyor image to latest version e-116.0.5815.0. (#38739)
build: update appveyor image to latest version
Co-authored-by: jkleinsc <[email protected]>
|
diff --git a/appveyor-woa.yml b/appveyor-woa.yml
index 76e4041f3c..65d636a231 100644
--- a/appveyor-woa.yml
+++ b/appveyor-woa.yml
@@ -29,7 +29,7 @@
version: 1.0.{build}
build_cloud: electronhq-16-core
-image: e-116.0.5791.0
+image: e-116.0.5815.0
environment:
GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache
ELECTRON_OUT_DIR: Default
diff --git a/appveyor.yml b/appveyor.yml
index 8c97b8688d..ec716a62a2 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -29,7 +29,7 @@
version: 1.0.{build}
build_cloud: electronhq-16-core
-image: e-116.0.5791.0
+image: e-116.0.5815.0
environment:
GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache
ELECTRON_OUT_DIR: Default
|
build
|
fff6ea438ac99cfec9818e961faf5c8a87787f91
|
Sam Maddock
|
2024-10-21 18:56:03
|
fix: software compositing infinite loop (#44318)
Co-authored-by: Keeley Hammond <[email protected]>
|
diff --git a/patches/chromium/.patches b/patches/chromium/.patches
index e78946033b..6d6c1c02eb 100644
--- a/patches/chromium/.patches
+++ b/patches/chromium/.patches
@@ -132,4 +132,5 @@ build_expose_webplugininfo_interface_to_electron.patch
osr_shared_texture_remove_keyed_mutex_on_win_dxgi.patch
feat_allow_usage_of_sccontentsharingpicker_on_supported_platforms.patch
chore_partial_revert_of.patch
+fix_software_compositing_infinite_loop.patch
ui_add_missing_shortcut_text_for_vkey_command_on_linux.patch
diff --git a/patches/chromium/fix_software_compositing_infinite_loop.patch b/patches/chromium/fix_software_compositing_infinite_loop.patch
new file mode 100644
index 0000000000..b411639835
--- /dev/null
+++ b/patches/chromium/fix_software_compositing_infinite_loop.patch
@@ -0,0 +1,31 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Samuel Maddock <[email protected]>
+Date: Fri, 18 Oct 2024 11:11:11 -0400
+Subject: fix: software compositing infinite loop
+
+When GPU compositing is unavailable, LayerTreeView::RequestNewLayerTreeFrameSink
+may run in an infinite loop due to a race condition. Need to allow time to
+process CompositingModeFallbackToSoftware IPC to disable GPU compositing.
+
+https://issues.chromium.org/345275130
+
+diff --git a/third_party/blink/renderer/platform/widget/compositing/layer_tree_view.cc b/third_party/blink/renderer/platform/widget/compositing/layer_tree_view.cc
+index 9497ab591864295231db47fdc526e59935e6aa31..635fa41649db41800f99da2683cc955b2e1e935f 100644
+--- a/third_party/blink/renderer/platform/widget/compositing/layer_tree_view.cc
++++ b/third_party/blink/renderer/platform/widget/compositing/layer_tree_view.cc
+@@ -374,9 +374,13 @@ void LayerTreeView::DidFailToInitializeLayerTreeFrameSink() {
+ // unable to be killed after Chrome is closed.
+ // https://issues.chromium.org/336164423
+ if (!Platform::Current()->IsGpuRemoteDisconnected()) {
+- layer_tree_host_->GetTaskRunnerProvider()->MainThreadTaskRunner()->PostTask(
++ // CompositingModeFallbackToSoftware IPC will disable GPU compositing in
++ // RenderThread. Post task with delay to give time to receive this IPC and
++ // prevent infinite loop of retries for software renderers.
++ // https://issues.chromium.org/345275130
++ layer_tree_host_->GetTaskRunnerProvider()->MainThreadTaskRunner()->PostDelayedTask(
+ FROM_HERE, base::BindOnce(&LayerTreeView::RequestNewLayerTreeFrameSink,
+- weak_factory_.GetWeakPtr()));
++ weak_factory_.GetWeakPtr()), base::Milliseconds(10));
+ }
+ }
+
|
fix
|
9655ae7d6ae9de4b467d197957bb3c7a152e3ddd
|
Charles Kerr
|
2024-02-09 09:44:46
|
fix: `GetCursorScreenpoint()` sometimes wrongly returns `(0,0)` (#41275)
|
diff --git a/patches/chromium/.patches b/patches/chromium/.patches
index 89d22941f0..7b76ce5b03 100644
--- a/patches/chromium/.patches
+++ b/patches/chromium/.patches
@@ -127,3 +127,4 @@ fix_restore_original_resize_performance_on_macos.patch
feat_allow_code_cache_in_custom_schemes.patch
build_run_reclient_cfg_generator_after_chrome.patch
fix_suppress_clang_-wimplicit-const-int-float-conversion_in.patch
+fix_getcursorscreenpoint_wrongly_returns_0_0.patch
diff --git a/patches/chromium/fix_getcursorscreenpoint_wrongly_returns_0_0.patch b/patches/chromium/fix_getcursorscreenpoint_wrongly_returns_0_0.patch
new file mode 100644
index 0000000000..d2e4bed589
--- /dev/null
+++ b/patches/chromium/fix_getcursorscreenpoint_wrongly_returns_0_0.patch
@@ -0,0 +1,25 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Charles Kerr <[email protected]>
+Date: Thu, 8 Feb 2024 00:41:40 -0600
+Subject: fix: GetCursorScreenPoint() wrongly returns 0, 0
+
+Fixes #41143. Discussion of the issue at
+https://github.com/electron/electron/issues/41143#issuecomment-1933443163
+
+This patch should be backported to e29, upstreamed to Chromium, and then
+removed if it lands upstream.
+
+diff --git a/ui/events/x/events_x_utils.cc b/ui/events/x/events_x_utils.cc
+index aa047f2bd39643dc471b25eeb567b0dd3731e0e0..eb312fb1c115751041930539d0d5f15208461e04 100644
+--- a/ui/events/x/events_x_utils.cc
++++ b/ui/events/x/events_x_utils.cc
+@@ -586,6 +586,9 @@ gfx::Point EventLocationFromXEvent(const x11::Event& xev) {
+ gfx::Point EventSystemLocationFromXEvent(const x11::Event& xev) {
+ if (auto* crossing = xev.As<x11::CrossingEvent>())
+ return gfx::Point(crossing->root_x, crossing->root_y);
++ if (auto* crossing = xev.As<x11::Input::CrossingEvent>())
++ return gfx::Point(Fp1616ToDouble(crossing->root_x),
++ Fp1616ToDouble(crossing->root_y));
+ if (auto* button = xev.As<x11::ButtonEvent>())
+ return gfx::Point(button->root_x, button->root_y);
+ if (auto* motion = xev.As<x11::MotionNotifyEvent>())
|
fix
|
c2cb97ea298412143e34027fac2c28fd031e169a
|
kyrylo-hrechykhin
|
2022-10-11 20:21:41
|
fix: on-screen-keyboard hides on input blurred in webview (#35921)
Co-authored-by: Kyrylo Hrechykhin <[email protected]>
|
diff --git a/patches/chromium/.patches b/patches/chromium/.patches
index a7692e6e09..5bea887422 100644
--- a/patches/chromium/.patches
+++ b/patches/chromium/.patches
@@ -122,3 +122,4 @@ fix_return_v8_value_from_localframe_requestexecutescript.patch
create_browser_v8_snapshot_file_name_fuse.patch
feat_ensure_mas_builds_of_the_same_application_can_use_safestorage.patch
cherry-pick-c83640db21b5.patch
+fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch
diff --git a/patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch b/patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch
new file mode 100644
index 0000000000..b065f747f9
--- /dev/null
+++ b/patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch
@@ -0,0 +1,59 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Kyrylo Hrechykhin <[email protected]>
+Date: Thu, 6 Oct 2022 18:30:53 +0200
+Subject: fix: on-screen-keyboard hides on input blur in webview
+
+Changes introduced by this patch fix issue where OSK does not hide on
+input rendered inside webview is blurred. This patch should be removed
+when proper fix in chromium repo is available.
+
+Note: the issue still occurs if input rendered in webview blurred due
+to touch outside of webview. It is caused by webview implementation
+details. Specificaly due to webview has its own tree nodes and focused
+node does not change in this case.
+
+chromium-bug: https://crbug.com/1369605
+
+diff --git a/content/browser/renderer_host/render_widget_host_view_child_frame.cc b/content/browser/renderer_host/render_widget_host_view_child_frame.cc
+index beb340cc38c2f82c224793b26813bead85817c85..f43fbd03646406255845cfbb02ce31d3602edf2a 100644
+--- a/content/browser/renderer_host/render_widget_host_view_child_frame.cc
++++ b/content/browser/renderer_host/render_widget_host_view_child_frame.cc
+@@ -992,6 +992,12 @@ RenderWidgetHostViewChildFrame::DidUpdateVisualProperties(
+ return viz::ScopedSurfaceIdAllocator(std::move(allocation_task));
+ }
+
++void RenderWidgetHostViewChildFrame::FocusedNodeChanged(
++ bool is_editable_node,
++ const gfx::Rect& node_bounds_in_screen) {
++ NOTREACHED();
++}
++
+ ui::TextInputType RenderWidgetHostViewChildFrame::GetTextInputType() const {
+ if (!text_input_manager_)
+ return ui::TEXT_INPUT_TYPE_NONE;
+diff --git a/content/browser/renderer_host/render_widget_host_view_child_frame.h b/content/browser/renderer_host/render_widget_host_view_child_frame.h
+index f7f9a981003ba1e3fefc9fc0f2b2bcf921c0a4d5..cd69daf186a6ec22fb70a2a36568e544524d025f 100644
+--- a/content/browser/renderer_host/render_widget_host_view_child_frame.h
++++ b/content/browser/renderer_host/render_widget_host_view_child_frame.h
+@@ -181,6 +181,8 @@ class CONTENT_EXPORT RenderWidgetHostViewChildFrame
+ void DisableAutoResize(const gfx::Size& new_size) override;
+ viz::ScopedSurfaceIdAllocator DidUpdateVisualProperties(
+ const cc::RenderFrameMetadata& metadata) override;
++ void FocusedNodeChanged(bool is_editable_node,
++ const gfx::Rect& node_bounds_in_screen) override;
+
+ // RenderFrameMetadataProvider::Observer implementation.
+ void OnRenderFrameMetadataChangedBeforeActivation(
+diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
+index 6c99fee1af1bcd64f3e6647132bd132f0ea111ec..a5d175b17cdae078997bf081fa36106bb5885779 100644
+--- a/content/browser/web_contents/web_contents_impl.cc
++++ b/content/browser/web_contents/web_contents_impl.cc
+@@ -7926,7 +7926,7 @@ void WebContentsImpl::OnFocusedElementChangedInFrame(
+ "WebContentsImpl::OnFocusedElementChangedInFrame",
+ "render_frame_host", frame);
+ RenderWidgetHostViewBase* root_view =
+- static_cast<RenderWidgetHostViewBase*>(GetRenderWidgetHostView());
++ static_cast<RenderWidgetHostViewBase*>(GetTopLevelRenderWidgetHostView());
+ if (!root_view || !frame->GetView())
+ return;
+ // Convert to screen coordinates from window coordinates by adding the
|
fix
|
3340bc1bf938cc821da1e2f91b49cdba46cb29e1
|
Tomasz
|
2023-11-22 07:21:18
|
fix: maximized window bounds when toggle setResizable (#40503)
|
diff --git a/shell/browser/native_window_views.cc b/shell/browser/native_window_views.cc
index a134dc4f45..a8d02c2c3d 100644
--- a/shell/browser/native_window_views.cc
+++ b/shell/browser/native_window_views.cc
@@ -682,11 +682,16 @@ void NativeWindowViews::Unmaximize() {
if (transparent()) {
SetBounds(restore_bounds_, false);
NotifyWindowUnmaximize();
+ UpdateThickFrame();
return;
}
#endif
widget()->Restore();
+
+#if BUILDFLAG(IS_WIN)
+ UpdateThickFrame();
+#endif
}
}
@@ -719,6 +724,10 @@ void NativeWindowViews::Minimize() {
void NativeWindowViews::Restore() {
widget()->Restore();
+
+#if BUILDFLAG(IS_WIN)
+ UpdateThickFrame();
+#endif
}
bool NativeWindowViews::IsMinimized() {
@@ -892,12 +901,13 @@ void NativeWindowViews::SetResizable(bool resizable) {
extensions::SizeConstraints(content_size, content_size));
}
}
-#if BUILDFLAG(IS_WIN)
- if (has_frame() && thick_frame_)
- FlipWindowStyle(GetAcceleratedWidget(), resizable, WS_THICKFRAME);
-#endif
+
resizable_ = resizable;
SetCanResize(resizable_);
+
+#if BUILDFLAG(IS_WIN)
+ UpdateThickFrame();
+#endif
}
bool NativeWindowViews::MoveAbove(const std::string& sourceId) {
@@ -1644,6 +1654,22 @@ void NativeWindowViews::SetIcon(const gfx::ImageSkia& icon) {
}
#endif
+#if BUILDFLAG(IS_WIN)
+void NativeWindowViews::UpdateThickFrame() {
+ if (!thick_frame_)
+ return;
+
+ if (IsMaximized() && !transparent()) {
+ // For maximized window add thick frame always, otherwise it will be removed
+ // in HWNDMessageHandler::SizeConstraintsChanged() which will result in
+ // maximized window bounds change.
+ FlipWindowStyle(GetAcceleratedWidget(), true, WS_THICKFRAME);
+ } else if (has_frame()) {
+ FlipWindowStyle(GetAcceleratedWidget(), resizable_, WS_THICKFRAME);
+ }
+}
+#endif
+
void NativeWindowViews::OnWidgetActivationChanged(views::Widget* changed_widget,
bool active) {
if (changed_widget != widget())
diff --git a/shell/browser/native_window_views.h b/shell/browser/native_window_views.h
index 7be1cf3f4f..37985da794 100644
--- a/shell/browser/native_window_views.h
+++ b/shell/browser/native_window_views.h
@@ -190,6 +190,8 @@ class NativeWindowViews : public NativeWindow,
void set_overlay_symbol_color(SkColor color) {
overlay_symbol_color_ = color;
}
+
+ void UpdateThickFrame();
#endif
private:
diff --git a/shell/browser/ui/win/electron_desktop_native_widget_aura.cc b/shell/browser/ui/win/electron_desktop_native_widget_aura.cc
index 91eb7d71b0..fef641a50a 100644
--- a/shell/browser/ui/win/electron_desktop_native_widget_aura.cc
+++ b/shell/browser/ui/win/electron_desktop_native_widget_aura.cc
@@ -30,6 +30,16 @@ void ElectronDesktopNativeWidgetAura::InitNativeWidget(
views::DesktopNativeWidgetAura::InitNativeWidget(std::move(params));
}
+#if BUILDFLAG(IS_WIN)
+void ElectronDesktopNativeWidgetAura::OnSizeConstraintsChanged() {
+ views::DesktopNativeWidgetAura::OnSizeConstraintsChanged();
+
+ // OnSizeConstraintsChanged can remove thick frame depending from
+ // resizable state, so add it if needed.
+ native_window_view_->UpdateThickFrame();
+}
+#endif
+
void ElectronDesktopNativeWidgetAura::Activate() {
// Activate can cause the focused window to be blurred so only
// call when the window being activated is visible. This prevents
diff --git a/shell/browser/ui/win/electron_desktop_native_widget_aura.h b/shell/browser/ui/win/electron_desktop_native_widget_aura.h
index 57def339c1..2279a26d40 100644
--- a/shell/browser/ui/win/electron_desktop_native_widget_aura.h
+++ b/shell/browser/ui/win/electron_desktop_native_widget_aura.h
@@ -27,6 +27,9 @@ class ElectronDesktopNativeWidgetAura : public views::DesktopNativeWidgetAura {
// views::DesktopNativeWidgetAura:
void InitNativeWidget(views::Widget::InitParams params) override;
+#if BUILDFLAG(IS_WIN)
+ void OnSizeConstraintsChanged() override;
+#endif
// internal::NativeWidgetPrivate:
void Activate() override;
diff --git a/spec/api-browser-window-spec.ts b/spec/api-browser-window-spec.ts
index 5111dc3b83..2ee8c229d8 100644
--- a/spec/api-browser-window-spec.ts
+++ b/spec/api-browser-window-spec.ts
@@ -5091,6 +5091,55 @@ describe('BrowserWindow module', () => {
w.setContentSize(10, 10);
expectBoundsEqual(w.getContentSize(), [10, 10]);
});
+
+ ifit(process.platform === 'win32')('do not change window with frame bounds when maximized', () => {
+ const w = new BrowserWindow({
+ show: true,
+ frame: true,
+ thickFrame: true
+ });
+ expect(w.isResizable()).to.be.true('resizable');
+ w.maximize();
+ expect(w.isMaximized()).to.be.true('maximized');
+ const bounds = w.getBounds();
+ w.setResizable(false);
+ expectBoundsEqual(w.getBounds(), bounds);
+ w.setResizable(true);
+ expectBoundsEqual(w.getBounds(), bounds);
+ });
+
+ ifit(process.platform === 'win32')('do not change window without frame bounds when maximized', () => {
+ const w = new BrowserWindow({
+ show: true,
+ frame: false,
+ thickFrame: true
+ });
+ expect(w.isResizable()).to.be.true('resizable');
+ w.maximize();
+ expect(w.isMaximized()).to.be.true('maximized');
+ const bounds = w.getBounds();
+ w.setResizable(false);
+ expectBoundsEqual(w.getBounds(), bounds);
+ w.setResizable(true);
+ expectBoundsEqual(w.getBounds(), bounds);
+ });
+
+ ifit(process.platform === 'win32')('do not change window transparent without frame bounds when maximized', () => {
+ const w = new BrowserWindow({
+ show: true,
+ frame: false,
+ thickFrame: true,
+ transparent: true
+ });
+ expect(w.isResizable()).to.be.true('resizable');
+ w.maximize();
+ expect(w.isMaximized()).to.be.true('maximized');
+ const bounds = w.getBounds();
+ w.setResizable(false);
+ expectBoundsEqual(w.getBounds(), bounds);
+ w.setResizable(true);
+ expectBoundsEqual(w.getBounds(), bounds);
+ });
});
describe('loading main frame state', () => {
|
fix
|
12548294c0b2639d34c05c544f56545004efee01
|
Shelley Vohr
|
2023-07-25 18:18:36
|
fix: `resizable: false` should disable fullscreen button at start (#39086)
fix: resizable should disable fullscreen button at start
|
diff --git a/shell/browser/native_window.cc b/shell/browser/native_window.cc
index a24a4c131b..aaa9676f6a 100644
--- a/shell/browser/native_window.cc
+++ b/shell/browser/native_window.cc
@@ -198,10 +198,6 @@ void NativeWindow::InitFromOptions(const gin_helper::Dictionary& options) {
SetSizeConstraints(size_constraints);
}
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
- bool resizable;
- if (options.Get(options::kResizable, &resizable)) {
- SetResizable(resizable);
- }
bool closable;
if (options.Get(options::kClosable, &closable)) {
SetClosable(closable);
@@ -223,6 +219,7 @@ void NativeWindow::InitFromOptions(const gin_helper::Dictionary& options) {
if (options.Get(options::kAlwaysOnTop, &top) && top) {
SetAlwaysOnTop(ui::ZOrderLevel::kFloatingWindow);
}
+
bool fullscreenable = true;
bool fullscreen = false;
if (options.Get(options::kFullscreen, &fullscreen) && !fullscreen) {
@@ -231,12 +228,18 @@ void NativeWindow::InitFromOptions(const gin_helper::Dictionary& options) {
fullscreenable = false;
#endif
}
- // Overridden by 'fullscreenable'.
+
options.Get(options::kFullScreenable, &fullscreenable);
SetFullScreenable(fullscreenable);
- if (fullscreen) {
+
+ if (fullscreen)
SetFullScreen(true);
+
+ bool resizable;
+ if (options.Get(options::kResizable, &resizable)) {
+ SetResizable(resizable);
}
+
bool skip;
if (options.Get(options::kSkipTaskbar, &skip)) {
SetSkipTaskbar(skip);
diff --git a/shell/browser/native_window_mac.mm b/shell/browser/native_window_mac.mm
index c396175027..7af696339e 100644
--- a/shell/browser/native_window_mac.mm
+++ b/shell/browser/native_window_mac.mm
@@ -818,7 +818,24 @@ void NativeWindowMac::MoveTop() {
void NativeWindowMac::SetResizable(bool resizable) {
ScopedDisableResize disable_resize;
SetStyleMask(resizable, NSWindowStyleMaskResizable);
+
+ // Right now, resizable and fullscreenable are decoupled in
+ // documentation and on Windows/Linux. Chromium disables
+ // fullscreenability if resizability is false on macOS as well
+ // as disabling the maximize traffic light unless the window
+ // is both resizable and maximizable. To work around this, we want
+ // to match behavior on other platforms by disabiliting the maximize
+ // button but keeping fullscreenability enabled.
+ // TODO(codebytere): refactor this once we have a better solution.
SetCanResize(resizable);
+ if (!resizable) {
+ SetFullScreenable(true);
+ [[window_ standardWindowButton:NSWindowZoomButton] setEnabled:false];
+ } else {
+ SetFullScreenable(true);
+ [[window_ standardWindowButton:NSWindowZoomButton]
+ setEnabled:IsFullScreenable()];
+ }
}
bool NativeWindowMac::IsResizable() {
|
fix
|
964934c16122767e3554e372126fb7def0243c1c
|
Milan Burda
|
2023-04-21 19:13:59
|
fix: defaults broken in shell.openExternal() options (#38038)
Co-authored-by: Milan Burda <[email protected]>
|
diff --git a/shell/common/api/electron_api_shell.cc b/shell/common/api/electron_api_shell.cc
index 0039b95961..1055cb73d4 100644
--- a/shell/common/api/electron_api_shell.cc
+++ b/shell/common/api/electron_api_shell.cc
@@ -59,13 +59,11 @@ v8::Local<v8::Promise> OpenExternal(const GURL& url, gin::Arguments* args) {
v8::Local<v8::Promise> handle = promise.GetHandle();
platform_util::OpenExternalOptions options;
- if (args->Length() >= 2) {
- gin::Dictionary obj(nullptr);
- if (args->GetNext(&obj)) {
- obj.Get("activate", &options.activate);
- obj.Get("workingDirectory", &options.working_dir);
- obj.Get("logUsage", &options.log_usage);
- }
+ gin_helper::Dictionary obj;
+ if (args->GetNext(&obj)) {
+ obj.Get("activate", &options.activate);
+ obj.Get("workingDirectory", &options.working_dir);
+ obj.Get("logUsage", &options.log_usage);
}
platform_util::OpenExternal(
|
fix
|
4aa9070e6c291c9148cd170befc82e8fb953bd2a
|
Shelley Vohr
|
2024-06-11 16:59:53
|
fix: missing `fetch`-dependent interfaces in Node.js (#42419)
fix: missing fetch-dependent interfaces in Node.js
|
diff --git a/lib/node/init.ts b/lib/node/init.ts
index e552933861..12c908a607 100644
--- a/lib/node/init.ts
+++ b/lib/node/init.ts
@@ -3,8 +3,11 @@ import { wrapFsWithAsar } from './asar-fs-wrapper';
wrapFsWithAsar(require('fs'));
// See ElectronRendererClient::DidCreateScriptContext.
-if ((globalThis as any).blinkFetch) {
- globalThis.fetch = (globalThis as any).blinkFetch;
+if ((globalThis as any).blinkfetch) {
+ const keys = ['fetch', 'Response', 'FormData', 'Request', 'Headers'];
+ for (const key of keys) {
+ (globalThis as any)[key] = (globalThis as any)[`blink${key}`];
+ }
}
// Hook child_process.fork.
diff --git a/shell/renderer/electron_renderer_client.cc b/shell/renderer/electron_renderer_client.cc
index 228ce6839c..a8e7dfea4f 100644
--- a/shell/renderer/electron_renderer_client.cc
+++ b/shell/renderer/electron_renderer_client.cc
@@ -110,19 +110,25 @@ void ElectronRendererClient::DidCreateScriptContext(
base::BindRepeating(&ElectronRendererClient::UndeferLoad,
base::Unretained(this), render_frame));
- v8::Local<v8::Object> global = renderer_context->Global();
- v8::MaybeLocal<v8::Value> fetch =
- global->Get(renderer_context, gin::StringToV8(env->isolate(), "fetch"));
-
// We need to use the Blink implementation of fetch in the renderer process
// Node.js deletes the global fetch function when their fetch implementation
// is disabled, so we need to save and re-add it after the Node.js environment
// is loaded. See corresponding change in node/init.ts.
- if (!fetch.IsEmpty()) {
- global
- ->Set(renderer_context, gin::StringToV8(env->isolate(), "blinkFetch"),
- fetch.ToLocalChecked())
- .Check();
+ v8::Isolate* isolate = env->isolate();
+ v8::Local<v8::Object> global = renderer_context->Global();
+
+ std::vector<std::string> keys = {"fetch", "Response", "FormData", "Request",
+ "Headers"};
+ for (const auto& key : keys) {
+ v8::MaybeLocal<v8::Value> value =
+ global->Get(renderer_context, gin::StringToV8(isolate, key.c_str()));
+ if (!value.IsEmpty()) {
+ std::string blink_key = "blink" + key;
+ global
+ ->Set(renderer_context, gin::StringToV8(isolate, blink_key.c_str()),
+ value.ToLocalChecked())
+ .Check();
+ }
}
// If we have disabled the site instance overrides we should prevent loading
|
fix
|
470b1d9e9d4e49e0ca61004b234c3c4fc4a42680
|
Milan Burda
|
2023-05-25 13:36:12
|
refactor: split clipboard module implementation for browser / renderer (#38429)
|
diff --git a/filenames.auto.gni b/filenames.auto.gni
index e0ac50e799..2419131d32 100644
--- a/filenames.auto.gni
+++ b/filenames.auto.gni
@@ -196,6 +196,7 @@ auto_filenames = {
"lib/browser/api/base-window.ts",
"lib/browser/api/browser-view.ts",
"lib/browser/api/browser-window.ts",
+ "lib/browser/api/clipboard.ts",
"lib/browser/api/content-tracing.ts",
"lib/browser/api/crash-reporter.ts",
"lib/browser/api/desktop-capturer.ts",
@@ -245,7 +246,6 @@ auto_filenames = {
"lib/browser/parse-features-string.ts",
"lib/browser/rpc-server.ts",
"lib/browser/web-view-events.ts",
- "lib/common/api/clipboard.ts",
"lib/common/api/module-list.ts",
"lib/common/api/native-image.ts",
"lib/common/api/shell.ts",
@@ -256,8 +256,6 @@ auto_filenames = {
"lib/common/reset-search-paths.ts",
"lib/common/web-view-methods.ts",
"lib/common/webpack-globals-provider.ts",
- "lib/renderer/ipc-renderer-internal-utils.ts",
- "lib/renderer/ipc-renderer-internal.ts",
"package.json",
"tsconfig.electron.json",
"tsconfig.json",
@@ -266,7 +264,6 @@ auto_filenames = {
]
renderer_bundle_deps = [
- "lib/common/api/clipboard.ts",
"lib/common/api/module-list.ts",
"lib/common/api/native-image.ts",
"lib/common/api/shell.ts",
@@ -276,6 +273,7 @@ auto_filenames = {
"lib/common/reset-search-paths.ts",
"lib/common/web-view-methods.ts",
"lib/common/webpack-provider.ts",
+ "lib/renderer/api/clipboard.ts",
"lib/renderer/api/context-bridge.ts",
"lib/renderer/api/crash-reporter.ts",
"lib/renderer/api/exports/electron.ts",
@@ -304,7 +302,6 @@ auto_filenames = {
]
worker_bundle_deps = [
- "lib/common/api/clipboard.ts",
"lib/common/api/module-list.ts",
"lib/common/api/native-image.ts",
"lib/common/api/shell.ts",
@@ -313,6 +310,7 @@ auto_filenames = {
"lib/common/ipc-messages.ts",
"lib/common/reset-search-paths.ts",
"lib/common/webpack-provider.ts",
+ "lib/renderer/api/clipboard.ts",
"lib/renderer/api/context-bridge.ts",
"lib/renderer/api/crash-reporter.ts",
"lib/renderer/api/exports/electron.ts",
diff --git a/lib/browser/api/clipboard.ts b/lib/browser/api/clipboard.ts
new file mode 100644
index 0000000000..000dc83d13
--- /dev/null
+++ b/lib/browser/api/clipboard.ts
@@ -0,0 +1,3 @@
+const clipboard = process._linkedBinding('electron_common_clipboard');
+
+export default clipboard;
diff --git a/lib/browser/api/module-list.ts b/lib/browser/api/module-list.ts
index 95fb3e0cb6..c3dcecdd66 100644
--- a/lib/browser/api/module-list.ts
+++ b/lib/browser/api/module-list.ts
@@ -7,6 +7,7 @@ export const browserModuleList: ElectronInternal.ModuleEntry[] = [
{ name: 'BaseWindow', loader: () => require('./base-window') },
{ name: 'BrowserView', loader: () => require('./browser-view') },
{ name: 'BrowserWindow', loader: () => require('./browser-window') },
+ { name: 'clipboard', loader: () => require('./clipboard') },
{ name: 'contentTracing', loader: () => require('./content-tracing') },
{ name: 'crashReporter', loader: () => require('./crash-reporter') },
{ name: 'desktopCapturer', loader: () => require('./desktop-capturer') },
diff --git a/lib/common/api/clipboard.ts b/lib/common/api/clipboard.ts
deleted file mode 100644
index 55f7958bc7..0000000000
--- a/lib/common/api/clipboard.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
-
-// eslint-disable-next-line no-restricted-imports
-import type * as ipcRendererUtilsModule from '@electron/internal/renderer/ipc-renderer-internal-utils';
-
-const clipboard = process._linkedBinding('electron_common_clipboard');
-
-if (process.type === 'renderer') {
- const ipcRendererUtils = require('@electron/internal/renderer/ipc-renderer-internal-utils') as typeof ipcRendererUtilsModule;
-
- const makeRemoteMethod = function (method: keyof Electron.Clipboard): any {
- return (...args: any[]) => ipcRendererUtils.invokeSync(IPC_MESSAGES.BROWSER_CLIPBOARD_SYNC, method, ...args);
- };
-
- if (process.platform === 'linux') {
- // On Linux we could not access clipboard in renderer process.
- for (const method of Object.keys(clipboard) as (keyof Electron.Clipboard)[]) {
- clipboard[method] = makeRemoteMethod(method);
- }
- } else if (process.platform === 'darwin') {
- // Read/write to find pasteboard over IPC since only main process is notified of changes
- clipboard.readFindText = makeRemoteMethod('readFindText');
- clipboard.writeFindText = makeRemoteMethod('writeFindText');
- }
-}
-
-export default clipboard;
diff --git a/lib/common/api/module-list.ts b/lib/common/api/module-list.ts
index 629186dc24..6383c33cd8 100644
--- a/lib/common/api/module-list.ts
+++ b/lib/common/api/module-list.ts
@@ -1,6 +1,5 @@
// Common modules, please sort alphabetically
export const commonModuleList: ElectronInternal.ModuleEntry[] = [
- { name: 'clipboard', loader: () => require('./clipboard') },
{ name: 'nativeImage', loader: () => require('./native-image') },
{ name: 'shell', loader: () => require('./shell') }
];
diff --git a/lib/renderer/api/clipboard.ts b/lib/renderer/api/clipboard.ts
new file mode 100644
index 0000000000..96e77b2871
--- /dev/null
+++ b/lib/renderer/api/clipboard.ts
@@ -0,0 +1,21 @@
+import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
+import * as ipcRendererUtils from '@electron/internal/renderer/ipc-renderer-internal-utils';
+
+const clipboard = process._linkedBinding('electron_common_clipboard');
+
+const makeRemoteMethod = function (method: keyof Electron.Clipboard): any {
+ return (...args: any[]) => ipcRendererUtils.invokeSync(IPC_MESSAGES.BROWSER_CLIPBOARD_SYNC, method, ...args);
+};
+
+if (process.platform === 'linux') {
+ // On Linux we could not access clipboard in renderer process.
+ for (const method of Object.keys(clipboard) as (keyof Electron.Clipboard)[]) {
+ clipboard[method] = makeRemoteMethod(method);
+ }
+} else if (process.platform === 'darwin') {
+ // Read/write to find pasteboard over IPC since only main process is notified of changes
+ clipboard.readFindText = makeRemoteMethod('readFindText');
+ clipboard.writeFindText = makeRemoteMethod('writeFindText');
+}
+
+export default clipboard;
diff --git a/lib/renderer/api/module-list.ts b/lib/renderer/api/module-list.ts
index 5f9d2154c5..3f817525ea 100644
--- a/lib/renderer/api/module-list.ts
+++ b/lib/renderer/api/module-list.ts
@@ -1,5 +1,6 @@
// Renderer side modules, please sort alphabetically.
export const rendererModuleList: ElectronInternal.ModuleEntry[] = [
+ { name: 'clipboard', loader: () => require('./clipboard') },
{ name: 'contextBridge', loader: () => require('./context-bridge') },
{ name: 'crashReporter', loader: () => require('./crash-reporter') },
{ name: 'ipcRenderer', loader: () => require('./ipc-renderer') },
|
refactor
|
a0fee8f47a0d0eff408d69f6fb7b3aa596de6fa1
|
Shelley Vohr
|
2024-04-22 20:26:11
|
build: fixup codespaces on-create (#41428)
|
diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
index 88c851c937..310fdbc875 100644
--- a/.devcontainer/devcontainer.json
+++ b/.devcontainer/devcontainer.json
@@ -27,7 +27,8 @@
]
},
"vscode": {
- "extensions": ["joeleinbinder.mojom-language",
+ "extensions": [
+ "joeleinbinder.mojom-language",
"rafaelmaiolla.diff",
"surajbarkale.ninja",
"ms-vscode.cpptools",
diff --git a/.devcontainer/on-create-command.sh b/.devcontainer/on-create-command.sh
index 4e9ffd6f23..e168a5f0a5 100755
--- a/.devcontainer/on-create-command.sh
+++ b/.devcontainer/on-create-command.sh
@@ -39,7 +39,6 @@ if [ ! -f $buildtools/configs/evm.testing.json ]; then
write_config() {
echo "
{
- \"goma\": \"$1\",
\"root\": \"/workspaces/gclient\",
\"remotes\": {
\"electron\": {
@@ -49,7 +48,7 @@ if [ ! -f $buildtools/configs/evm.testing.json ]; then
\"gen\": {
\"args\": [
\"import(\\\"//electron/build/args/testing.gn\\\")\",
- \"import(\\\"/home/builduser/.electron_build_tools/third_party/goma.gn\\\")\"
+ \"use_remoteexec = true\"
],
\"out\": \"Testing\"
},
@@ -57,26 +56,18 @@ if [ ! -f $buildtools/configs/evm.testing.json ]; then
\"CHROMIUM_BUILDTOOLS_PATH\": \"/workspaces/gclient/src/buildtools\",
\"GIT_CACHE_PATH\": \"/workspaces/gclient/.git-cache\"
},
- \"\$schema\": \"file:///home/builduser/.electron_build_tools/evm-config.schema.json\"
+ \"\$schema\": \"file:///home/builduser/.electron_build_tools/evm-config.schema.json\",
+ \"configValidationLevel\": \"strict\",
+ \"reclient\": \"$1\",
+ \"goma\": \"none\",
+ \"preserveXcode\": 5
}
" >$buildtools/configs/evm.testing.json
}
- # Start out as cache only
- write_config cache-only
+ write_config remote_exec
- e use testing
-
- # Attempt to auth to the goma service via codespaces tokens
- # if it works we can use the goma cluster
- export NOTGOMA_CODESPACES_TOKEN=$GITHUB_TOKEN
- if e d goma_auth login; then
- echo "$GITHUB_USER has GOMA access - switching to cluster mode"
- write_config cluster
- fi
+ e use testing
else
echo "build-tools testing config already exists"
-
- # Re-auth with the goma cluster regardless.
- NOTGOMA_CODESPACES_TOKEN=$GITHUB_TOKEN e d goma_auth login || true
fi
|
build
|
a9b6041d38b877319c740fe7c31e8a1a235d7764
|
Milan Burda
|
2023-01-25 16:02:44
|
chore: remove unused files in spec/fixtures (#37012)
Co-authored-by: Milan Burda <[email protected]>
|
diff --git a/spec/fixtures/api/native-window-open-argv.html b/spec/fixtures/api/native-window-open-argv.html
deleted file mode 100644
index fa613b1bf7..0000000000
--- a/spec/fixtures/api/native-window-open-argv.html
+++ /dev/null
@@ -1,8 +0,0 @@
-<html>
-<body>
-<script type="text/javascript" charset="utf-8">
- const popup = window.open()
- require('electron').ipcRenderer.send('answer', typeof popup.process)
-</script>
-</body>
-</html>
diff --git a/spec/fixtures/module/preload-pdf-loaded-in-nested-subframe.js b/spec/fixtures/module/preload-pdf-loaded-in-nested-subframe.js
deleted file mode 100644
index e72a4a4058..0000000000
--- a/spec/fixtures/module/preload-pdf-loaded-in-nested-subframe.js
+++ /dev/null
@@ -1,15 +0,0 @@
-const { ipcRenderer } = require('electron');
-
-document.addEventListener('DOMContentLoaded', (event) => {
- const outerFrame = document.querySelector('#outer-frame');
- if (outerFrame) {
- outerFrame.onload = function () {
- const pdframe = outerFrame.contentWindow.document.getElementById('pdf-frame');
- if (pdframe) {
- pdframe.contentWindow.addEventListener('pdf-loaded', (event) => {
- ipcRenderer.send('pdf-loaded', event.detail);
- });
- }
- };
- }
-});
diff --git a/spec/fixtures/module/preload-pdf-loaded-in-subframe.js b/spec/fixtures/module/preload-pdf-loaded-in-subframe.js
deleted file mode 100644
index dd7a7aaa42..0000000000
--- a/spec/fixtures/module/preload-pdf-loaded-in-subframe.js
+++ /dev/null
@@ -1,10 +0,0 @@
-const { ipcRenderer } = require('electron');
-
-document.addEventListener('DOMContentLoaded', (event) => {
- const subframe = document.querySelector('#pdf-frame');
- if (subframe) {
- subframe.contentWindow.addEventListener('pdf-loaded', (event) => {
- ipcRenderer.send('pdf-loaded', event.detail);
- });
- }
-});
diff --git a/spec/fixtures/module/preload-pdf-loaded.js b/spec/fixtures/module/preload-pdf-loaded.js
deleted file mode 100644
index aa5c8fb4ff..0000000000
--- a/spec/fixtures/module/preload-pdf-loaded.js
+++ /dev/null
@@ -1,5 +0,0 @@
-const { ipcRenderer } = require('electron');
-
-window.addEventListener('pdf-loaded', function (event) {
- ipcRenderer.send('pdf-loaded', event.detail);
-});
diff --git a/spec/fixtures/pages/target-name.html b/spec/fixtures/pages/target-name.html
deleted file mode 100644
index 0dc760d233..0000000000
--- a/spec/fixtures/pages/target-name.html
+++ /dev/null
@@ -1,13 +0,0 @@
-<html>
-<body>
-<a id="a", href="http://host" target="target">link</a>
-<script type="text/javascript" charset="utf-8">
- var event = new MouseEvent('click', {
- 'view': window,
- 'bubbles': true,
- 'cancelable': true
- });
- document.getElementById('a').dispatchEvent(event);
-</script>
-</body>
-</html>
diff --git a/spec/fixtures/zip/a.zip b/spec/fixtures/zip/a.zip
deleted file mode 100644
index 7b3a13209f..0000000000
Binary files a/spec/fixtures/zip/a.zip and /dev/null differ
|
chore
|
c09c94fc98f261dce4a35847e2dd9699dcd5213e
|
Samuel Maddock
|
2022-09-26 12:37:08
|
feat: add WebContents.opener and webContents.fromFrame() (#35140)
* feat: add WebContents.opener
* feat: add webContents.fromFrame(frame)
* fix: unknown type name
* test: fix and add more fromFrame cases
* docs: clarified terminology
|
diff --git a/docs/api/web-contents.md b/docs/api/web-contents.md
index 95d5278672..1f0df82f98 100644
--- a/docs/api/web-contents.md
+++ b/docs/api/web-contents.md
@@ -45,6 +45,13 @@ returns `null`.
Returns `WebContents` | undefined - A WebContents instance with the given ID, or
`undefined` if there is no WebContents associated with the given ID.
+### `webContents.fromFrame(frame)`
+
+* `frame` WebFrameMain
+
+Returns `WebContents` | undefined - A WebContents instance with the given WebFrameMain, or
+`undefined` if there is no WebContents associated with the given WebFrameMain.
+
### `webContents.fromDevToolsTargetId(targetId)`
* `targetId` string - The Chrome DevTools Protocol [TargetID](https://chromedevtools.github.io/devtools-protocol/tot/Target/#type-TargetID) associated with the WebContents instance.
@@ -2044,6 +2051,11 @@ when the page becomes backgrounded. This also affects the Page Visibility API.
A [`WebFrameMain`](web-frame-main.md) property that represents the top frame of the page's frame hierarchy.
+#### `contents.opener` _Readonly_
+
+A [`WebFrameMain`](web-frame-main.md) property that represents the frame that opened this WebContents, either
+with open(), or by navigating a link with a target attribute.
+
[keyboardevent]: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent
[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
diff --git a/lib/browser/api/web-contents.ts b/lib/browser/api/web-contents.ts
index 513419cbaf..640c1f79e5 100644
--- a/lib/browser/api/web-contents.ts
+++ b/lib/browser/api/web-contents.ts
@@ -835,6 +835,10 @@ export function fromId (id: string) {
return binding.fromId(id);
}
+export function fromFrame (frame: Electron.WebFrameMain) {
+ return binding.fromFrame(frame);
+}
+
export function fromDevToolsTargetId (targetId: string) {
return binding.fromDevToolsTargetId(targetId);
}
diff --git a/shell/browser/api/electron_api_web_contents.cc b/shell/browser/api/electron_api_web_contents.cc
index 274cbd8e7b..3349fb7a2d 100644
--- a/shell/browser/api/electron_api_web_contents.cc
+++ b/shell/browser/api/electron_api_web_contents.cc
@@ -3449,6 +3449,10 @@ content::RenderFrameHost* WebContents::MainFrame() {
return web_contents()->GetPrimaryMainFrame();
}
+content::RenderFrameHost* WebContents::Opener() {
+ return web_contents()->GetOpener();
+}
+
void WebContents::NotifyUserActivation() {
content::RenderFrameHost* frame = web_contents()->GetPrimaryMainFrame();
if (frame)
@@ -4060,6 +4064,7 @@ v8::Local<v8::ObjectTemplate> WebContents::FillObjectTemplate(
.SetProperty("devToolsWebContents", &WebContents::DevToolsWebContents)
.SetProperty("debugger", &WebContents::Debugger)
.SetProperty("mainFrame", &WebContents::MainFrame)
+ .SetProperty("opener", &WebContents::Opener)
.Build();
}
@@ -4174,6 +4179,7 @@ namespace {
using electron::api::GetAllWebContents;
using electron::api::WebContents;
+using electron::api::WebFrameMain;
gin::Handle<WebContents> WebContentsFromID(v8::Isolate* isolate, int32_t id) {
WebContents* contents = WebContents::FromID(id);
@@ -4181,6 +4187,15 @@ gin::Handle<WebContents> WebContentsFromID(v8::Isolate* isolate, int32_t id) {
: gin::Handle<WebContents>();
}
+gin::Handle<WebContents> WebContentsFromFrame(v8::Isolate* isolate,
+ WebFrameMain* web_frame) {
+ content::RenderFrameHost* rfh = web_frame->render_frame_host();
+ content::WebContents* source = content::WebContents::FromRenderFrameHost(rfh);
+ WebContents* contents = WebContents::From(source);
+ return contents ? gin::CreateHandle(isolate, contents)
+ : gin::Handle<WebContents>();
+}
+
gin::Handle<WebContents> WebContentsFromDevToolsTargetID(
v8::Isolate* isolate,
std::string target_id) {
@@ -4209,6 +4224,7 @@ void Initialize(v8::Local<v8::Object> exports,
gin_helper::Dictionary dict(isolate, exports);
dict.Set("WebContents", WebContents::GetConstructor(context));
dict.SetMethod("fromId", &WebContentsFromID);
+ dict.SetMethod("fromFrame", &WebContentsFromFrame);
dict.SetMethod("fromDevToolsTargetId", &WebContentsFromDevToolsTargetID);
dict.SetMethod("getAllWebContents", &GetAllWebContentsAsV8);
}
diff --git a/shell/browser/api/electron_api_web_contents.h b/shell/browser/api/electron_api_web_contents.h
index d5c59ab6fa..6aeb8b9375 100644
--- a/shell/browser/api/electron_api_web_contents.h
+++ b/shell/browser/api/electron_api_web_contents.h
@@ -333,6 +333,7 @@ class WebContents : public ExclusiveAccessContext,
v8::Local<v8::Value> DevToolsWebContents(v8::Isolate* isolate);
v8::Local<v8::Value> Debugger(v8::Isolate* isolate);
content::RenderFrameHost* MainFrame();
+ content::RenderFrameHost* Opener();
WebContentsZoomController* GetZoomController() { return zoom_controller_; }
diff --git a/spec/api-web-contents-spec.ts b/spec/api-web-contents-spec.ts
index 4be69cfb74..626a72f03b 100644
--- a/spec/api-web-contents-spec.ts
+++ b/spec/api-web-contents-spec.ts
@@ -6,7 +6,7 @@ import * as http from 'http';
import { BrowserWindow, ipcMain, webContents, session, WebContents, app, BrowserView } from 'electron/main';
import { emittedOnce } from './events-helpers';
import { closeAllWindows } from './window-helpers';
-import { ifdescribe, delay, defer } from './spec-helpers';
+import { ifdescribe, delay, defer, waitUntil } from './spec-helpers';
const pdfjs = require('pdfjs-dist');
const fixturesPath = path.resolve(__dirname, 'fixtures');
@@ -46,6 +46,28 @@ describe('webContents module', () => {
});
});
+ describe('fromFrame()', () => {
+ it('returns WebContents for mainFrame', () => {
+ const contents = (webContents as any).create() as WebContents;
+ expect(webContents.fromFrame(contents.mainFrame)).to.equal(contents);
+ });
+ it('returns undefined for disposed frame', async () => {
+ const contents = (webContents as any).create() as WebContents;
+ const { mainFrame } = contents;
+ contents.destroy();
+ await waitUntil(() => typeof webContents.fromFrame(mainFrame) === 'undefined');
+ });
+ it('throws when passing invalid argument', async () => {
+ let errored = false;
+ try {
+ webContents.fromFrame({} as any);
+ } catch {
+ errored = true;
+ }
+ expect(errored).to.be.true();
+ });
+ });
+
describe('fromDevToolsTargetId()', () => {
it('returns WebContents for attached DevTools target', async () => {
const w = new BrowserWindow({ show: false });
@@ -1281,6 +1303,54 @@ describe('webContents module', () => {
});
});
+ describe('opener api', () => {
+ afterEach(closeAllWindows);
+ it('can get opener with window.open()', async () => {
+ const w = new BrowserWindow({ show: false, webPreferences: { sandbox: true } });
+ await w.loadURL('about:blank');
+ const childPromise = emittedOnce(w.webContents, 'did-create-window');
+ w.webContents.executeJavaScript('window.open("about:blank")', true);
+ const [childWindow] = await childPromise;
+ expect(childWindow.webContents.opener).to.equal(w.webContents.mainFrame);
+ });
+ it('has no opener when using "noopener"', async () => {
+ const w = new BrowserWindow({ show: false, webPreferences: { sandbox: true } });
+ await w.loadURL('about:blank');
+ const childPromise = emittedOnce(w.webContents, 'did-create-window');
+ w.webContents.executeJavaScript('window.open("about:blank", undefined, "noopener")', true);
+ const [childWindow] = await childPromise;
+ expect(childWindow.webContents.opener).to.be.null();
+ });
+ it('can get opener with a[target=_blank][rel=opener]', async () => {
+ const w = new BrowserWindow({ show: false, webPreferences: { sandbox: true } });
+ await w.loadURL('about:blank');
+ const childPromise = emittedOnce(w.webContents, 'did-create-window');
+ w.webContents.executeJavaScript(`(function() {
+ const a = document.createElement('a');
+ a.target = '_blank';
+ a.rel = 'opener';
+ a.href = 'about:blank';
+ a.click();
+ }())`, true);
+ const [childWindow] = await childPromise;
+ expect(childWindow.webContents.opener).to.equal(w.webContents.mainFrame);
+ });
+ it('has no opener with a[target=_blank][rel=noopener]', async () => {
+ const w = new BrowserWindow({ show: false, webPreferences: { sandbox: true } });
+ await w.loadURL('about:blank');
+ const childPromise = emittedOnce(w.webContents, 'did-create-window');
+ w.webContents.executeJavaScript(`(function() {
+ const a = document.createElement('a');
+ a.target = '_blank';
+ a.rel = 'noopener';
+ a.href = 'about:blank';
+ a.click();
+ }())`, true);
+ const [childWindow] = await childPromise;
+ expect(childWindow.webContents.opener).to.be.null();
+ });
+ });
+
describe('render view deleted events', () => {
let server: http.Server;
let serverUrl: string;
|
feat
|
814ba71dc149c320f524b38201f57cff9d3fb7fb
|
Cheng Zhao
|
2024-03-04 21:11:14
|
chore: update src_preload_function_for_environment.patch (#41500)
|
diff --git a/patches/node/.patches b/patches/node/.patches
index 62cb49415d..db1ec7be46 100644
--- a/patches/node/.patches
+++ b/patches/node/.patches
@@ -44,5 +44,5 @@ build_do_not_rely_on_gn_helpers_in_gn_build.patch
test_make_test-node-output-v8-warning_generic.patch
test_match_wpt_streams_transferable_transform-stream-members_any_js.patch
build_ensure_v8_pointer_compression_sandbox_is_enabled_on_64bit.patch
-src_preload_function_for_environment.patch
fix_revert_src_lb_reducing_c_calls_of_esm_legacy_main_resolve.patch
+src_preload_function_for_environment.patch
diff --git a/patches/node/src_preload_function_for_environment.patch b/patches/node/src_preload_function_for_environment.patch
index 25190267de..783812be75 100644
--- a/patches/node/src_preload_function_for_environment.patch
+++ b/patches/node/src_preload_function_for_environment.patch
@@ -1,23 +1,9 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Cheng Zhao <[email protected]>
-Date: Mon, 22 Jan 2024 13:45:55 +0900
+Date: Mon, 4 Mar 2024 11:41:18 +0900
Subject: src: preload function for Environment
-https://github.com/nodejs/node/pull/51539
-
-This PR adds a |preload| arg to the node::CreateEnvironment to allow
-embedders to set a preload function for the environment, which will run
-after the environment is loaded and before the main script runs.
-
-This is similiar to the --require CLI option, but runs a C++ function,
-and can only be set by embedders.
-
-The preload function can be used by embedders to inject scripts before
-running the main script, for example:
-1. In Electron it is used to initialize the ASAR virtual filesystem,
- inject custom process properties, etc.
-2. In VS Code it can be used to reset the module search paths for
- extensions.
+Backport https://github.com/nodejs/node/pull/51539
diff --git a/lib/internal/process/pre_execution.js b/lib/internal/process/pre_execution.js
index eb66f0e37b517a03be20e0829863e7572042c7ed..4d5646b6067a1409df5915cc744bdc38d0191bd9 100644
@@ -45,92 +31,80 @@ index eb66f0e37b517a03be20e0829863e7572042c7ed..4d5646b6067a1409df5915cc744bdc38
// For user code, we preload modules if `-r` is passed
const preloadModules = getOptionValue('--require');
diff --git a/src/api/environment.cc b/src/api/environment.cc
-index 9045de3b17c93c4864a1bb1024b08f7d1ffa83be..7c580e1ce1af66e010083240aaf8b0037dd41f2e 100644
+index 9045de3b17c93c4864a1bb1024b08f7d1ffa83be..e8669ba2a1ede090fea1869c476cac19a2aebbc6 100644
--- a/src/api/environment.cc
+++ b/src/api/environment.cc
-@@ -442,7 +442,8 @@ Environment* CreateEnvironment(
- const std::vector<std::string>& exec_args,
- EnvironmentFlags::Flags flags,
- ThreadId thread_id,
-- std::unique_ptr<InspectorParentHandle> inspector_parent_handle) {
-+ std::unique_ptr<InspectorParentHandle> inspector_parent_handle,
-+ EmbedderPreloadCallback preload) {
- Isolate* isolate = isolate_data->isolate();
+@@ -556,25 +556,31 @@ NODE_EXTERN std::unique_ptr<InspectorParentHandle> GetInspectorParentHandle(
+ #endif
+ }
- Isolate::Scope isolate_scope(isolate);
-@@ -463,7 +464,8 @@ Environment* CreateEnvironment(
- exec_args,
- env_snapshot_info,
- flags,
-- thread_id);
-+ thread_id,
-+ std::move(preload));
- CHECK_NOT_NULL(env);
+-MaybeLocal<Value> LoadEnvironment(
+- Environment* env,
+- StartExecutionCallback cb) {
++MaybeLocal<Value> LoadEnvironment(Environment* env,
++ StartExecutionCallback cb,
++ EmbedderPreloadCallback preload) {
+ env->InitializeLibuv();
+ env->InitializeDiagnostics();
++ if (preload) {
++ env->set_embedder_preload(std::move(preload));
++ }
- if (use_snapshot) {
+ return StartExecution(env, cb);
+ }
+
+ MaybeLocal<Value> LoadEnvironment(Environment* env,
+- std::string_view main_script_source_utf8) {
++ std::string_view main_script_source_utf8,
++ EmbedderPreloadCallback preload) {
+ CHECK_NOT_NULL(main_script_source_utf8.data());
+ return LoadEnvironment(
+- env, [&](const StartExecutionCallbackInfo& info) -> MaybeLocal<Value> {
++ env,
++ [&](const StartExecutionCallbackInfo& info) -> MaybeLocal<Value> {
+ Local<Value> main_script =
+ ToV8Value(env->context(), main_script_source_utf8).ToLocalChecked();
+ return info.run_cjs->Call(
+ env->context(), Null(env->isolate()), 1, &main_script);
+- });
++ },
++ std::move(preload));
+ }
+
+ Environment* GetCurrentEnvironment(Local<Context> context) {
diff --git a/src/env-inl.h b/src/env-inl.h
-index 564de2990c09a54693686666f9ad66398ff76ab5..b10bc2396539b011dec6f09719251bfc842072af 100644
+index 564de2990c09a54693686666f9ad66398ff76ab5..cc448abbc650b5abb7f555872fd8c15bc09fd643 100644
--- a/src/env-inl.h
+++ b/src/env-inl.h
-@@ -438,6 +438,10 @@ inline void Environment::set_embedder_entry_point(StartExecutionCallback&& fn) {
+@@ -438,6 +438,14 @@ inline void Environment::set_embedder_entry_point(StartExecutionCallback&& fn) {
embedder_entry_point_ = std::move(fn);
}
+inline const EmbedderPreloadCallback& Environment::embedder_preload() const {
+ return embedder_preload_;
+}
++
++inline void Environment::set_embedder_preload(EmbedderPreloadCallback fn) {
++ embedder_preload_ = std::move(fn);
++}
+
inline double Environment::new_async_id() {
async_hooks()->async_id_fields()[AsyncHooks::kAsyncIdCounter] += 1;
return async_hooks()->async_id_fields()[AsyncHooks::kAsyncIdCounter];
-diff --git a/src/env.cc b/src/env.cc
-index ba575a04340b91709fb6c8710ab160a4ca1f8b77..76db0ac4ef72b902a7567a96cfd751ff879117b7 100644
---- a/src/env.cc
-+++ b/src/env.cc
-@@ -767,7 +767,8 @@ Environment::Environment(IsolateData* isolate_data,
- const std::vector<std::string>& exec_args,
- const EnvSerializeInfo* env_info,
- EnvironmentFlags::Flags flags,
-- ThreadId thread_id)
-+ ThreadId thread_id,
-+ EmbedderPreloadCallback preload)
- : isolate_(isolate),
- isolate_data_(isolate_data),
- async_hooks_(isolate, MAYBE_FIELD_PTR(env_info, async_hooks)),
-@@ -793,7 +794,8 @@ Environment::Environment(IsolateData* isolate_data,
- flags_(flags),
- thread_id_(thread_id.id == static_cast<uint64_t>(-1)
- ? AllocateEnvironmentThreadId().id
-- : thread_id.id) {
-+ : thread_id.id),
-+ embedder_preload_(std::move(preload)) {
- constexpr bool is_shared_ro_heap =
- #ifdef NODE_V8_SHARED_RO_HEAP
- true;
diff --git a/src/env.h b/src/env.h
-index 448075e354c760a2dbd1dd763f40b7a645730250..a5aad9596953536b0a1f741dfbc4f21f6a961404 100644
+index 448075e354c760a2dbd1dd763f40b7a645730250..d6956873b1b7bdf49ed0217587729aaa974ae89f 100644
--- a/src/env.h
+++ b/src/env.h
-@@ -635,7 +635,8 @@ class Environment : public MemoryRetainer {
- const std::vector<std::string>& exec_args,
- const EnvSerializeInfo* env_info,
- EnvironmentFlags::Flags flags,
-- ThreadId thread_id);
-+ ThreadId thread_id,
-+ EmbedderPreloadCallback preload);
- void InitializeMainContext(v8::Local<v8::Context> context,
- const EnvSerializeInfo* env_info);
- ~Environment() override;
-@@ -986,6 +987,8 @@ class Environment : public MemoryRetainer {
+@@ -985,6 +985,8 @@ class Environment : public MemoryRetainer {
+
inline const StartExecutionCallback& embedder_entry_point() const;
inline void set_embedder_entry_point(StartExecutionCallback&& fn);
-
+ inline const EmbedderPreloadCallback& embedder_preload() const;
-+
++ inline void set_embedder_preload(EmbedderPreloadCallback fn);
+
inline void set_process_exit_handler(
std::function<void(Environment*, ExitCode)>&& handler);
-
-@@ -1186,6 +1189,7 @@ class Environment : public MemoryRetainer {
+@@ -1186,6 +1188,7 @@ class Environment : public MemoryRetainer {
builtins::BuiltinLoader builtin_loader_;
StartExecutionCallback embedder_entry_point_;
@@ -139,43 +113,45 @@ index 448075e354c760a2dbd1dd763f40b7a645730250..a5aad9596953536b0a1f741dfbc4f21f
// Used by allocate_managed_buffer() and release_managed_buffer() to keep
// track of the BackingStore for a given pointer.
diff --git a/src/node.h b/src/node.h
-index 36da93a7b41ea450a5f288ec17b61adae46ae178..09e044e86bab2cef42c86dbfc9bbcc743daf564d 100644
+index 36da93a7b41ea450a5f288ec17b61adae46ae178..c65c96342d7d02ddb37565477f67a93ef55a78ba 100644
--- a/src/node.h
+++ b/src/node.h
-@@ -678,11 +678,23 @@ struct InspectorParentHandle {
- virtual ~InspectorParentHandle() = default;
- };
+@@ -718,12 +718,33 @@ struct StartExecutionCallbackInfo {
+ using StartExecutionCallback =
+ std::function<v8::MaybeLocal<v8::Value>(const StartExecutionCallbackInfo&)>;
+using EmbedderPreloadCallback =
+ std::function<void(Environment* env,
+ v8::Local<v8::Value> process,
+ v8::Local<v8::Value> require)>;
-+
- // TODO(addaleax): Maybe move per-Environment options parsing here.
- // Returns nullptr when the Environment cannot be created e.g. there are
- // pending JavaScript exceptions.
- // `context` may be empty if an `EmbedderSnapshotData` instance was provided
- // to `NewIsolate()` and `CreateIsolateData()`.
+
++// Run initialization for the environment.
+//
-+// The |preload| function will run before executing the entry point, which
-+// is usually used by embedders to inject scripts. The function is executed
-+// with preload(process, require), and the passed require function has access
-+// to internal Node.js modules. The |preload| function is inherited by worker
-+// threads and thus will run in work threads, so make sure the function is
-+// thread-safe.
- NODE_EXTERN Environment* CreateEnvironment(
- IsolateData* isolate_data,
- v8::Local<v8::Context> context,
-@@ -690,7 +702,8 @@ NODE_EXTERN Environment* CreateEnvironment(
- const std::vector<std::string>& exec_args,
- EnvironmentFlags::Flags flags = EnvironmentFlags::kDefaultFlags,
- ThreadId thread_id = {} /* allocates a thread id automatically */,
-- std::unique_ptr<InspectorParentHandle> inspector_parent_handle = {});
-+ std::unique_ptr<InspectorParentHandle> inspector_parent_handle = {},
++// The |preload| function, usually used by embedders to inject scripts,
++// will be run by Node.js before Node.js executes the entry point.
++// The function is guaranteed to run before the user land module loader running
++// any user code, so it is safe to assume that at this point, no user code has
++// been run yet.
++// The function will be executed with preload(process, require), and the passed
++// require function has access to internal Node.js modules. There is no
++// stability guarantee about the internals exposed to the internal require
++// function. Expect breakages when updating Node.js versions if the embedder
++// imports internal modules with the internal require function.
++// Worker threads created in the environment will also respect The |preload|
++// function, so make sure the function is thread-safe.
+ NODE_EXTERN v8::MaybeLocal<v8::Value> LoadEnvironment(
+ Environment* env,
+- StartExecutionCallback cb);
++ StartExecutionCallback cb,
++ EmbedderPreloadCallback preload = nullptr);
+ NODE_EXTERN v8::MaybeLocal<v8::Value> LoadEnvironment(
+- Environment* env, std::string_view main_script_source_utf8);
++ Environment* env,
++ std::string_view main_script_source_utf8,
+ EmbedderPreloadCallback preload = nullptr);
+ NODE_EXTERN void FreeEnvironment(Environment* env);
- // Returns a handle that can be passed to `LoadEnvironment()`, making the
- // child Environment accessible to the inspector as if it were a Node.js Worker.
+ // Set a callback that is called when process.exit() is called from JS,
diff --git a/src/node_options.cc b/src/node_options.cc
index 48ce3f3b68a94fc35e5ce93a385ddbebb03741b9..39d34e18e483882a71145110962109711a1566e2 100644
--- a/src/node_options.cc
@@ -194,24 +170,28 @@ index 48ce3f3b68a94fc35e5ce93a385ddbebb03741b9..39d34e18e483882a7114511096210971
}
diff --git a/src/node_snapshotable.cc b/src/node_snapshotable.cc
-index 562a47ddcc9c8e61590b7b09d84dc08ab4b3653d..325bebc1df9ad2e8b0bad468951cf1563ecefc14 100644
+index 562a47ddcc9c8e61590b7b09d84dc08ab4b3653d..431cbe1c2cb77669ceb10602a7b3ef1c2f7e8718 100644
--- a/src/node_snapshotable.cc
+++ b/src/node_snapshotable.cc
-@@ -1369,6 +1369,13 @@ static void RunEmbedderEntryPoint(const FunctionCallbackInfo<Value>& args) {
+@@ -1369,6 +1369,17 @@ static void RunEmbedderEntryPoint(const FunctionCallbackInfo<Value>& args) {
}
}
-+static void RunEmbedderPreload(const FunctionCallbackInfo<Value>& args) {
++void RunEmbedderPreload(const FunctionCallbackInfo<Value>& args) {
+ Environment* env = Environment::GetCurrent(args);
+ CHECK(env->embedder_preload());
+ CHECK_EQ(args.Length(), 2);
-+ env->embedder_preload()(env, args[0], args[1]);
++ Local<Value> process_obj = args[0];
++ Local<Value> require_fn = args[1];
++ CHECK(process_obj->IsObject());
++ CHECK(require_fn->IsFunction());
++ env->embedder_preload()(env, process_obj, require_fn);
+}
+
void CompileSerializeMain(const FunctionCallbackInfo<Value>& args) {
CHECK(args[0]->IsString());
Local<String> filename = args[0].As<String>();
-@@ -1493,6 +1500,7 @@ void CreatePerIsolateProperties(IsolateData* isolate_data,
+@@ -1493,6 +1504,7 @@ void CreatePerIsolateProperties(IsolateData* isolate_data,
Local<ObjectTemplate> target) {
Isolate* isolate = isolate_data->isolate();
SetMethod(isolate, target, "runEmbedderEntryPoint", RunEmbedderEntryPoint);
@@ -219,7 +199,7 @@ index 562a47ddcc9c8e61590b7b09d84dc08ab4b3653d..325bebc1df9ad2e8b0bad468951cf156
SetMethod(isolate, target, "compileSerializeMain", CompileSerializeMain);
SetMethod(isolate, target, "setSerializeCallback", SetSerializeCallback);
SetMethod(isolate, target, "setDeserializeCallback", SetDeserializeCallback);
-@@ -1506,6 +1514,7 @@ void CreatePerIsolateProperties(IsolateData* isolate_data,
+@@ -1506,6 +1518,7 @@ void CreatePerIsolateProperties(IsolateData* isolate_data,
void RegisterExternalReferences(ExternalReferenceRegistry* registry) {
registry->Register(RunEmbedderEntryPoint);
@@ -228,7 +208,7 @@ index 562a47ddcc9c8e61590b7b09d84dc08ab4b3653d..325bebc1df9ad2e8b0bad468951cf156
registry->Register(SetSerializeCallback);
registry->Register(SetDeserializeCallback);
diff --git a/src/node_worker.cc b/src/node_worker.cc
-index 900674bbe4c90e9aeb2013c06c9979864b06dcd5..2a22d986585e93ea00c6dcdca1f7b783ef0723f8 100644
+index 900674bbe4c90e9aeb2013c06c9979864b06dcd5..52d7473b05ccb49e5fc915224b6d2972a14191da 100644
--- a/src/node_worker.cc
+++ b/src/node_worker.cc
@@ -63,6 +63,7 @@ Worker::Worker(Environment* env,
@@ -239,16 +219,20 @@ index 900674bbe4c90e9aeb2013c06c9979864b06dcd5..2a22d986585e93ea00c6dcdca1f7b783
snapshot_data_(snapshot_data) {
Debug(this, "Creating new worker instance with thread id %llu",
thread_id_.id);
-@@ -360,7 +361,8 @@ void Worker::Run() {
- std::move(exec_argv_),
- static_cast<EnvironmentFlags::Flags>(environment_flags_),
- thread_id_,
-- std::move(inspector_parent_handle_)));
-+ std::move(inspector_parent_handle_),
-+ std::move(embedder_preload_)));
- if (is_stopped()) return;
- CHECK_NOT_NULL(env_);
- env_->set_env_vars(std::move(env_vars_));
+@@ -381,8 +382,12 @@ void Worker::Run() {
+ }
+
+ Debug(this, "Created message port for worker %llu", thread_id_.id);
+- if (LoadEnvironment(env_.get(), StartExecutionCallback{}).IsEmpty())
++ if (LoadEnvironment(env_.get(),
++ StartExecutionCallback{},
++ std::move(embedder_preload_))
++ .IsEmpty()) {
+ return;
++ }
+
+ Debug(this, "Loaded environment for worker %llu", thread_id_.id);
+ }
diff --git a/src/node_worker.h b/src/node_worker.h
index 531e2b5287010f9206ab4fd7f4dd0f3dec9fe55c..07fd7b460654e169e8b6822474dc3cc70fcec4c0 100644
--- a/src/node_worker.h
@@ -262,7 +246,7 @@ index 531e2b5287010f9206ab4fd7f4dd0f3dec9fe55c..07fd7b460654e169e8b6822474dc3cc7
// A raw flag that is used by creator and worker threads to
// sync up on pre-mature termination of worker - while in the
diff --git a/test/cctest/test_environment.cc b/test/cctest/test_environment.cc
-index 2e747c7be58922897abd0424b797f3f12a89ada1..658f8df4b01d60759e858cf5283b9be9467dd142 100644
+index 2e747c7be58922897abd0424b797f3f12a89ada1..fcffaca89cf5aa24be6e539bfb4d9d6df690a709 100644
--- a/test/cctest/test_environment.cc
+++ b/test/cctest/test_environment.cc
@@ -773,3 +773,31 @@ TEST_F(EnvironmentTest, RequestInterruptAtExit) {
@@ -280,20 +264,20 @@ index 2e747c7be58922897abd0424b797f3f12a89ada1..658f8df4b01d60759e858cf5283b9be9
+ v8::Local<v8::Value> require) {
+ CHECK(process->IsObject());
+ CHECK(require->IsFunction());
-+ process.As<v8::Object>()->Set(
-+ env->context(),
-+ v8::String::NewFromUtf8Literal(env->isolate(), "prop"),
-+ v8::String::NewFromUtf8Literal(env->isolate(), "preload")).Check();
++ process.As<v8::Object>()
++ ->Set(env->context(),
++ v8::String::NewFromUtf8Literal(env->isolate(), "prop"),
++ v8::String::NewFromUtf8Literal(env->isolate(), "preload"))
++ .Check();
+ };
+
+ std::unique_ptr<node::Environment, decltype(&node::FreeEnvironment)> env(
-+ node::CreateEnvironment(isolate_data_, context, {}, {},
-+ node::EnvironmentFlags::kDefaultFlags, {}, {},
-+ preload),
++ node::CreateEnvironment(isolate_data_, context, {}, {}),
+ node::FreeEnvironment);
+
+ v8::Local<v8::Value> main_ret =
-+ node::LoadEnvironment(env.get(), "return process.prop;").ToLocalChecked();
++ node::LoadEnvironment(env.get(), "return process.prop;", preload)
++ .ToLocalChecked();
+ node::Utf8Value main_ret_str(isolate_, main_ret);
+ EXPECT_EQ(std::string(*main_ret_str), "preload");
+}
diff --git a/shell/app/node_main.cc b/shell/app/node_main.cc
index 20b7080650..1c96b02c35 100644
--- a/shell/app/node_main.cc
+++ b/shell/app/node_main.cc
@@ -259,8 +259,7 @@ int NodeMain(int argc, char* argv[]) {
env = node::CreateEnvironment(
isolate_data, isolate->GetCurrentContext(), result->args(),
result->exec_args(),
- static_cast<node::EnvironmentFlags::Flags>(env_flags), {}, {},
- &OnNodePreload);
+ static_cast<node::EnvironmentFlags::Flags>(env_flags));
CHECK_NE(nullptr, env);
node::SetIsolateUpForNode(isolate);
@@ -285,7 +284,7 @@ int NodeMain(int argc, char* argv[]) {
}
v8::HandleScope scope(isolate);
- node::LoadEnvironment(env, node::StartExecutionCallback{});
+ node::LoadEnvironment(env, node::StartExecutionCallback{}, &OnNodePreload);
// Potential reasons we get Nothing here may include: the env
// is stopping, or the user hooks process.emit('exit').
diff --git a/shell/common/node_bindings.cc b/shell/common/node_bindings.cc
index 2ef6c3d790..cad0ebf057 100644
--- a/shell/common/node_bindings.cc
+++ b/shell/common/node_bindings.cc
@@ -651,8 +651,7 @@ std::shared_ptr<node::Environment> NodeBindings::CreateEnvironment(
v8::TryCatch try_catch(isolate);
env = node::CreateEnvironment(
static_cast<node::IsolateData*>(isolate_data), context, args, exec_args,
- static_cast<node::EnvironmentFlags::Flags>(env_flags), {}, {},
- &OnNodePreload);
+ static_cast<node::EnvironmentFlags::Flags>(env_flags));
if (try_catch.HasCaught()) {
std::string err_msg =
@@ -784,7 +783,7 @@ std::shared_ptr<node::Environment> NodeBindings::CreateEnvironment(
}
void NodeBindings::LoadEnvironment(node::Environment* env) {
- node::LoadEnvironment(env, node::StartExecutionCallback{});
+ node::LoadEnvironment(env, node::StartExecutionCallback{}, &OnNodePreload);
gin_helper::EmitEvent(env->isolate(), env->process_object(), "loaded");
}
|
chore
|
678d1aa37d26548004b0ad5df1ac027626c4ab2a
|
Shelley Vohr
|
2023-06-13 12:42:55
|
docs: clarify supported accelerator punctuation (#38740)
doc: clarify supported accelerator punctuation
|
diff --git a/docs/api/accelerator.md b/docs/api/accelerator.md
index b6f7d475da..e1fac744ad 100644
--- a/docs/api/accelerator.md
+++ b/docs/api/accelerator.md
@@ -55,7 +55,7 @@ The `Super` (or `Meta`) key is mapped to the `Windows` key on Windows and Linux
* `0` to `9`
* `A` to `Z`
* `F1` to `F24`
-* Punctuation like `~`, `!`, `@`, `#`, `$`, etc.
+* Various Punctuation: `)`, `!`, `@`, `#`, `$`, `%`, `^`, `&`, `*`, `(`, `:`, `;`, `:`, `+`, `=`, `<`, `,`, `_`, `-`, `>`, `.`, `?`, `/`, `~`, `` ` ``, `{`, `]`, `[`, `|`, `\`, `}`, `"`
* `Plus`
* `Space`
* `Tab`
diff --git a/shell/common/keyboard_util.cc b/shell/common/keyboard_util.cc
index 6116e18119..aab6816dda 100644
--- a/shell/common/keyboard_util.cc
+++ b/shell/common/keyboard_util.cc
@@ -207,7 +207,6 @@ ui::KeyboardCode KeyboardCodeFromCharCode(char16_t c, bool* shifted) {
return ui::VKEY_Y;
case 'z':
return ui::VKEY_Z;
-
case ')':
*shifted = true;
[[fallthrough]];
@@ -258,7 +257,6 @@ ui::KeyboardCode KeyboardCodeFromCharCode(char16_t c, bool* shifted) {
[[fallthrough]];
case '9':
return ui::VKEY_9;
-
case ':':
*shifted = true;
[[fallthrough]];
@@ -314,7 +312,6 @@ ui::KeyboardCode KeyboardCodeFromCharCode(char16_t c, bool* shifted) {
[[fallthrough]];
case '\'':
return ui::VKEY_OEM_7;
-
default:
return ui::VKEY_UNKNOWN;
}
|
docs
|
9bd9d312f8d59d3a80defba4aeb760e2c3e7e10c
|
Shelley Vohr
|
2023-05-16 09:29:00
|
fix: enable `BrowserWindow.id` access post-destruction (#38241)
fix: enable BrowserWindow id access post-destruction
|
diff --git a/lib/browser/api/browser-window.ts b/lib/browser/api/browser-window.ts
index 8d18fddd8e..a53129d726 100644
--- a/lib/browser/api/browser-window.ts
+++ b/lib/browser/api/browser-window.ts
@@ -12,6 +12,14 @@ BrowserWindow.prototype._init = function (this: BWT) {
// Avoid recursive require.
const { app } = require('electron');
+ // Set ID at constructon time so it's accessible after
+ // underlying window destruction.
+ const id = this.id;
+ Object.defineProperty(this, 'id', {
+ value: id,
+ writable: false
+ });
+
const nativeSetBounds = this.setBounds;
this.setBounds = (bounds, ...opts) => {
bounds = {
diff --git a/spec/api-browser-window-spec.ts b/spec/api-browser-window-spec.ts
index de1035cc2e..902c072e6f 100644
--- a/spec/api-browser-window-spec.ts
+++ b/spec/api-browser-window-spec.ts
@@ -126,6 +126,13 @@ describe('BrowserWindow module', () => {
w.webContents.on('destroyed', () => w.close());
});
+ it('should allow access to id after destruction', async () => {
+ const closed = once(w, 'closed');
+ w.destroy();
+ await closed;
+ expect(w.id).to.be.a('number');
+ });
+
it('should emit unload handler', async () => {
await w.loadFile(path.join(fixtures, 'api', 'unload.html'));
const closed = once(w, 'closed');
|
fix
|
bbd7f4a5ad6fbc6d88fcd6924eace4ad3f777d33
|
Shelley Vohr
|
2024-07-14 18:43:37
|
fix: File System Access API should remember last picked directory (#42850)
|
diff --git a/shell/browser/file_system_access/file_system_access_permission_context.cc b/shell/browser/file_system_access/file_system_access_permission_context.cc
index 42bd41c1bd..0ffa1b9f27 100644
--- a/shell/browser/file_system_access/file_system_access_permission_context.cc
+++ b/shell/browser/file_system_access/file_system_access_permission_context.cc
@@ -12,6 +12,8 @@
#include "base/json/values_util.h"
#include "base/path_service.h"
#include "base/task/thread_pool.h"
+#include "base/time/time.h"
+#include "base/timer/timer.h"
#include "base/values.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/file_system_access/chrome_file_system_access_permission_context.h" // nogncheck
@@ -38,6 +40,24 @@ using HandleType = content::FileSystemAccessPermissionContext::HandleType;
using GrantType = electron::FileSystemAccessPermissionContext::GrantType;
using blink::mojom::PermissionStatus;
+// Dictionary keys for the FILE_SYSTEM_LAST_PICKED_DIRECTORY website setting.
+// Schema (per origin):
+// {
+// ...
+// {
+// "default-id" : { "path" : <path> , "path-type" : <type>}
+// "custom-id-fruit" : { "path" : <path> , "path-type" : <type> }
+// "custom-id-flower" : { "path" : <path> , "path-type" : <type> }
+// ...
+// }
+// ...
+// }
+const char kDefaultLastPickedDirectoryKey[] = "default-id";
+const char kCustomLastPickedDirectoryKey[] = "custom-id";
+const char kPathKey[] = "path";
+const char kPathTypeKey[] = "path-type";
+const char kTimestampKey[] = "timestamp";
+
#if BUILDFLAG(IS_WIN)
[[nodiscard]] constexpr bool ContainsInvalidDNSCharacter(
base::FilePath::StringType hostname) {
@@ -79,7 +99,7 @@ bool MaybeIsLocalUNCPath(const base::FilePath& path) {
return false;
}
-#endif
+#endif // BUILDFLAG(IS_WIN)
// Describes a rule for blocking a directory, which can be constructed
// dynamically (based on state) or statically (from kBlockedPaths).
@@ -102,7 +122,7 @@ bool ShouldBlockAccessToPath(const base::FilePath& path,
MaybeIsLocalUNCPath(path)) {
return true;
}
-#endif
+#endif // BUILDFLAG(IS_WIN)
// Add the hard-coded rules to the dynamic rules.
for (auto const& [key, rule_path, type] :
@@ -150,6 +170,11 @@ bool ShouldBlockAccessToPath(const base::FilePath& path,
return true;
}
+std::string GenerateLastPickedDirectoryKey(const std::string& id) {
+ return id.empty() ? kDefaultLastPickedDirectoryKey
+ : base::StrCat({kCustomLastPickedDirectoryKey, "-", id});
+}
+
} // namespace
namespace electron {
@@ -367,8 +392,9 @@ struct FileSystemAccessPermissionContext::OriginState {
};
FileSystemAccessPermissionContext::FileSystemAccessPermissionContext(
- content::BrowserContext* browser_context)
- : browser_context_(browser_context) {
+ content::BrowserContext* browser_context,
+ const base::Clock* clock)
+ : browser_context_(browser_context), clock_(clock) {
DETACH_FROM_SEQUENCE(sequence_checker_);
}
@@ -571,13 +597,63 @@ void FileSystemAccessPermissionContext::DidCheckPathAgainstBlocklist(
std::move(callback).Run(SensitiveEntryResult::kAllowed);
}
+void FileSystemAccessPermissionContext::MaybeEvictEntries(
+ base::Value::Dict& dict) {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+
+ std::vector<std::pair<base::Time, std::string>> entries;
+ entries.reserve(dict.size());
+ for (auto entry : dict) {
+ // Don't evict the default ID.
+ if (entry.first == kDefaultLastPickedDirectoryKey) {
+ continue;
+ }
+ // If the data is corrupted and `entry.second` is for some reason not a
+ // dict, it should be first in line for eviction.
+ auto timestamp = base::Time::Min();
+ if (entry.second.is_dict()) {
+ timestamp = base::ValueToTime(entry.second.GetDict().Find(kTimestampKey))
+ .value_or(base::Time::Min());
+ }
+ entries.emplace_back(timestamp, entry.first);
+ }
+
+ if (entries.size() <= max_ids_per_origin_) {
+ return;
+ }
+
+ base::ranges::sort(entries);
+ size_t entries_to_remove = entries.size() - max_ids_per_origin_;
+ for (size_t i = 0; i < entries_to_remove; ++i) {
+ bool did_remove_entry = dict.Remove(entries[i].second);
+ DCHECK(did_remove_entry);
+ }
+}
+
void FileSystemAccessPermissionContext::SetLastPickedDirectory(
const url::Origin& origin,
const std::string& id,
const base::FilePath& path,
const PathType type) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
- LOG(INFO) << "NOTIMPLEMENTED SetLastPickedDirectory: " << path.value();
+
+ // Create an entry into the nested dictionary.
+ base::Value::Dict entry;
+ entry.Set(kPathKey, base::FilePathToValue(path));
+ entry.Set(kPathTypeKey, static_cast<int>(type));
+ entry.Set(kTimestampKey, base::TimeToValue(clock_->Now()));
+
+ auto it = id_pathinfo_map_.find(origin);
+ if (it != id_pathinfo_map_.end()) {
+ base::Value::Dict& dict = it->second;
+ dict.Set(GenerateLastPickedDirectoryKey(id), std::move(entry));
+ MaybeEvictEntries(dict);
+ } else {
+ base::Value::Dict dict;
+ dict.Set(GenerateLastPickedDirectoryKey(id), std::move(entry));
+ MaybeEvictEntries(dict);
+ id_pathinfo_map_.insert(std::make_pair(origin, std::move(dict)));
+ }
}
FileSystemAccessPermissionContext::PathInfo
@@ -585,8 +661,27 @@ FileSystemAccessPermissionContext::GetLastPickedDirectory(
const url::Origin& origin,
const std::string& id) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
- LOG(INFO) << "NOTIMPLEMENTED GetLastPickedDirectory";
- return PathInfo();
+
+ auto it = id_pathinfo_map_.find(origin);
+
+ PathInfo path_info;
+ if (it == id_pathinfo_map_.end()) {
+ return path_info;
+ }
+
+ auto* entry = it->second.FindDict(GenerateLastPickedDirectoryKey(id));
+ if (!entry) {
+ return path_info;
+ }
+
+ auto type_int =
+ entry->FindInt(kPathTypeKey).value_or(static_cast<int>(PathType::kLocal));
+ path_info.type = type_int == static_cast<int>(PathType::kExternal)
+ ? PathType::kExternal
+ : PathType::kLocal;
+ path_info.path =
+ base::ValueToFilePath(entry->Find(kPathKey)).value_or(base::FilePath());
+ return path_info;
}
base::FilePath FileSystemAccessPermissionContext::GetWellKnownDirectoryPath(
diff --git a/shell/browser/file_system_access/file_system_access_permission_context.h b/shell/browser/file_system_access/file_system_access_permission_context.h
index cd19bd1f70..fdb2976bf0 100644
--- a/shell/browser/file_system_access/file_system_access_permission_context.h
+++ b/shell/browser/file_system_access/file_system_access_permission_context.h
@@ -13,6 +13,9 @@
#include "base/functional/callback.h"
#include "base/memory/weak_ptr.h"
+#include "base/time/clock.h"
+#include "base/time/default_clock.h"
+#include "base/values.h"
#include "components/keyed_service/core/keyed_service.h"
#include "content/public/browser/file_system_access_permission_context.h"
@@ -35,7 +38,8 @@ class FileSystemAccessPermissionContext
enum class GrantType { kRead, kWrite };
explicit FileSystemAccessPermissionContext(
- content::BrowserContext* browser_context);
+ content::BrowserContext* browser_context,
+ const base::Clock* clock = base::DefaultClock::GetInstance());
FileSystemAccessPermissionContext(const FileSystemAccessPermissionContext&) =
delete;
FileSystemAccessPermissionContext& operator=(
@@ -133,6 +137,8 @@ class FileSystemAccessPermissionContext
base::OnceCallback<void(SensitiveEntryResult)> callback,
bool should_block);
+ void MaybeEvictEntries(base::Value::Dict& dict);
+
void CleanupPermissions(const url::Origin& origin);
bool AncestorHasActivePermission(const url::Origin& origin,
@@ -146,6 +152,13 @@ class FileSystemAccessPermissionContext
struct OriginState;
std::map<url::Origin, OriginState> active_permissions_map_;
+ // Number of custom IDs an origin can specify.
+ size_t max_ids_per_origin_ = 32u;
+
+ const raw_ptr<const base::Clock> clock_;
+
+ std::map<url::Origin, base::Value::Dict> id_pathinfo_map_;
+
base::WeakPtrFactory<FileSystemAccessPermissionContext> weak_factory_{this};
};
|
fix
|
1c1eb3e19dad1c60dc8926542ce9bbb3a71735f9
|
John Kleinschmidt
|
2024-11-04 14:35:10
|
build: add new status to verify if all the required gha jobs have run (#44432)
|
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index a3f72c5bda..b9e46bba67 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -250,3 +250,13 @@ jobs:
generate-symbols: false
upload-to-storage: '0'
secrets: inherit
+
+ gha-done:
+ name: GitHub Actions Completed
+ runs-on: ubuntu-latest
+ needs: [docs-only, macos-x64, macos-arm64, linux-x64, linux-x64-asan, linux-arm, linux-arm64]
+ if: always() && !contains(needs.*.result, 'failure')
+ steps:
+ - name: GitHub Actions Jobs Done
+ run: |
+ echo "All GitHub Actions Jobs are done"
|
build
|
9b2b3aa28770d8af1971d534f0d57e4c1441e386
|
Keeley Hammond
|
2023-02-06 13:42:58
|
docs: update stable dates (#37150)
|
diff --git a/docs/tutorial/electron-timelines.md b/docs/tutorial/electron-timelines.md
index e35fd45875..29fac3375a 100644
--- a/docs/tutorial/electron-timelines.md
+++ b/docs/tutorial/electron-timelines.md
@@ -9,10 +9,12 @@ check out our [Electron Versioning](./electron-versioning.md) doc.
| Electron | Alpha | Beta | Stable | EOL | Chrome | Node | Supported |
| ------- | ----- | ------- | ------ | ------ | ---- | ---- | ---- |
+| 25.0.0 | 2023-Apr-10 | 2023-May-02 | 2023-May-30 | TBD | M114 | TBD | TBD |
+| 24.0.0 | 2022-Feb-09 | 2023-Mar-07 | 2023-Apr-08 | TBD | M112 | TBD | ✅ |
| 23.0.0 | 2022-Dec-01 | 2023-Jan-10 | 2023-Feb-07 | TBD | M110 | TBD | ✅ |
| 22.0.0 | 2022-Sep-29 | 2022-Oct-25 | 2022-Nov-29 | TBD | M108 | v16.17 | ✅ |
| 21.0.0 | 2022-Aug-04 | 2022-Aug-30 | 2022-Sep-27 | TBD | M106 | v16.16 | ✅ |
-| 20.0.0 | 2022-May-26 | 2022-Jun-21 | 2022-Aug-02 | TBD | M104 | v16.15 | ✅ |
+| 20.0.0 | 2022-May-26 | 2022-Jun-21 | 2022-Aug-02 | 2023-Feb-07 | M104 | v16.15 | 🚫 |
| 19.0.0 | 2022-Mar-31 | 2022-Apr-26 | 2022-May-24 | 2022-Nov-29 | M102 | v16.14 | 🚫 |
| 18.0.0 | 2022-Feb-03 | 2022-Mar-03 | 2022-Mar-29 | 2022-Sep-27 | M100 | v16.13 | 🚫 |
| 17.0.0 | 2021-Nov-18 | 2022-Jan-06 | 2022-Feb-01 | 2022-Aug-02 | M98 | v16.13 | 🚫 |
|
docs
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.