Compare commits

...

27 Commits
6834 ... 6613

Author SHA1 Message Date
Marshall Greenblatt
e76af7e6d6 Pin depot_tools version for out-of-support branch 2024-09-27 10:40:53 -04:00
Jacobo Aragunde Pérez
1d7a1f96bf Fix index out of bounds with dialog accept_types description (fixes #3779) 2024-09-16 12:12:24 +03:00
Nik Pavlov
4deb4879a8 Account for overlay host Widget in CefWidget::GetForWidget (fixes #3784) 2024-09-16 12:12:16 +03:00
Marshall Greenblatt
d692f803c8 Update to Chromium version 128.0.6613.138 2024-09-16 08:59:29 +00:00
Marshall Greenblatt
9840ad9688 Update to Chromium version 128.0.6613.120
Approved-by: Nik Pavlov
2024-09-05 17:20:44 +00:00
Nik Pavlov
88b5034cf8 win: Add compile guard around partition_alloc::SuspendTagCheckingScope 2024-09-02 14:09:26 +00:00
Nik Pavlov
1b57edfc50 Add missing <array> header to performance_test_tests.cc 2024-09-02 14:06:41 +00:00
Nik Pavlov
21db5606bf Update to Chromium version 128.0.6613.114 2024-09-02 09:10:34 +00:00
Marshall Greenblatt
c1d356f5ab bazel: mac: Copy but don't link the CEF framework (see #3757)
Copy the CEF framework into the app bundle but do not link it. See
https://groups.google.com/g/cef-announce/c/Fith0A3kWtw/m/6ds_mJVMCQAJ
for background.

Use `**kwargs` to pass all other arguments to the actual
`macos_application` target declaration.
2024-08-09 13:23:26 -04:00
Marshall Greenblatt
a5544b6fb1 Route Download bubble file open to OnOpenURLFromTab (fixes #3750)
Some downloaded file types [1] default to opening in a Browser. Open
requests for these file types originating from the Download bubble UI
should route to the source Browser (call OnOpenURLFromTab). If
OnOpenURLFromTab is unhandled proceed with the default Chrome behavior
of opening the URL in a new default Browser.

[1] PDF, html, etc. For the complete list of file types see
ChromeDownloadManagerDelegate::IsOpenInBrowserPreferredForFile.
2024-08-09 12:26:32 -04:00
Marshall Greenblatt
87f49de296 Fix path override ordering (fixes #3749)
The chrome::DIR_RESOURCES and ui::DIR_LOCALES overrides need to be
configured before calling ChromeMainDelegate::PreSandboxStartup.
2024-08-08 13:42:40 -04:00
Marshall Greenblatt
5c235a209f Add WebUI allowlist for Alloy-style browsers (fixes #3763) 2024-08-07 14:16:41 -04:00
Marshall Greenblatt
6d71342015 cefclient: mac: Fix "undefined symbol" link error (see #3499) 2024-08-07 11:35:14 -04:00
Marshall Greenblatt
404d11b785 Use int instead of bool in cef_settings_t 2024-08-07 11:13:01 -04:00
Sergey Markelov
b79d7a53b2 linux: Fix TLS error on dlopen of libcef.so (fixes #3616) 2024-08-06 18:32:30 -04:00
Marshall Greenblatt
bdde55a296 bazel: Limit define scope to specific cc targets (see #3757)
- Add `declare_[cc|objc]_library` macros to configure common `copts`
  and `local_defines` (where supported) on `[cc|objc]_library`
  targets. This limits the scope of defines to the specific target
  without inheritance by dependent targets.
- `objc_library` does not currently support `local_defines` so we
  use `copts` instead of MacOS.
- Use `**kwargs` to pass all other arguments to the actual cc
  target declaration.
2024-08-06 14:59:24 -04:00
Marshall Greenblatt
203875394f cefclient: Fix invalid cast to ClientHandlerStd (see #3499) 2024-08-05 18:44:34 -04:00
Marshall Greenblatt
0da33499ce bazel: Support <angled> includes of CEF headers (see #3757)
Fixes "file not found with <angled> include" errors.
2024-08-05 17:28:51 -04:00
Marshall Greenblatt
e1d1f5e3e4 Update patch file 2024-08-05 14:35:44 -04:00
JC Yang
e6d7700746 Fix dangling ptr in ReadResponseCallbackWrapper (fixes #3760) 2024-08-05 14:28:56 -04:00
Loic Frasse-Mathon
686a5cab52 posix: Added option to disable signal handlers
See https://github.com/chromiumembedded/java-cef/issues/477
2024-08-05 14:28:48 -04:00
Pedro de Carvalho Gomes
fe6e44886b linux: Add CefWindowDelegate::GetLinuxWindowProperties (fixes #3383) 2024-08-05 14:28:41 -04:00
Nik Pavlov
c739fc029f Enable V8 sandbox by default (fixes #3332)
When the V8 sandbox is enabled, ArrayBuffer backing stores must be
allocated inside the sandbox address space. This change introduces a new
CefV8Value::CreateArrayBufferWithCopy method that copies the memory
contents into the sandbox address space.

Enabling the V8 sandbox can have a performance impact, especially when
passing large ArrayBuffers from C++ code to the JS side. We have therefore
retained the old CefV8Value::CreateArrayBuffer method that references
external memory. However, this method can only be used if the V8 sandbox is
disabled at CEF/Chromium build time.

To disable the V8 sandbox add `v8_enable_sandbox=false` to
`GN_DEFINES` when building CEF/Chromium.
2024-08-05 14:28:35 -04:00
Marshall Greenblatt
31e1459f14 bazel: Fix resource paths as external repo (see #3757)
- Headers that are included by .rc files need to be supplied to
  `declare_exe` via the `resources_deps` attribute (passed as the `deps
  attribute to `compile_rc`). The headers must be part of a cc_library
  target via either the `hdrs` or `srcs` attribute.
- File paths for CEF resources are prefixed with "external/<repo>"
  when CEF is loaded as an external repo. Update `copy_filegroups` to
  work with these paths.
2024-08-02 16:53:56 -04:00
Marshall Greenblatt
d38e4ef3ba Update to Chromium version 128.0.6613.18 2024-08-02 15:12:24 +00:00
Marshall Greenblatt
2b5cb6a8ab bazel: Add repo for package-local target labels (see #3757)
Unqualified target labels don't resolve correctly when the
disribution is loaded as an external repo. Mapping, if necessary,
can be performed using the `repo_mapping` parameter to
http_archive() or local_repository().
2024-07-31 18:00:27 -04:00
Marshall Greenblatt
c234e7f44b Update to Chromium version 128.0.6613.7 2024-07-30 11:38:17 -04:00
87 changed files with 1172 additions and 423 deletions

View File

@@ -7,5 +7,6 @@
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
{
'chromium_checkout': 'refs/tags/128.0.6613.0'
'chromium_checkout': 'refs/tags/128.0.6613.138',
'depot_tools_checkout': 'ac3b7937a3'
}

View File

@@ -10,12 +10,16 @@ def _copy_filegroups_impl(ctx):
outputs = []
for f in inputs:
relative_path = f.path
if relative_path.startswith("external/"):
# Remove the "external/<repo>" component, if any.
relative_path = "/".join(relative_path.split("/")[2:])
for prefix in remove_prefixes:
# Add trailing forward slash if necessary.
if prefix[-1] != "/":
prefix += "/"
if len(prefix) > 0 and f.path.startswith(prefix):
relative_path = f.path[len(prefix):]
if len(prefix) > 0 and relative_path.startswith(prefix):
relative_path = relative_path[len(prefix):]
break
if len(add_prefix) > 0:

90
bazel/library_helpers.bzl Normal file
View File

@@ -0,0 +1,90 @@
# Copyright (c) 2024 The Chromium Embedded Framework Authors. All rights
# reserved. Use of this source code is governed by a BSD-style license that
# can be found in the LICENSE file.
load("//bazel/win:variables.bzl",
WIN_COMMON_COPTS="COMMON_COPTS",
WIN_COMMON_COPTS_RELEASE="COMMON_COPTS_RELEASE",
WIN_COMMON_COPTS_DEBUG="COMMON_COPTS_DEBUG",
WIN_COMMON_DEFINES="COMMON_DEFINES",
WIN_COMMON_DEFINES_RELEASE="COMMON_DEFINES_RELEASE",
WIN_COMMON_DEFINES_DEBUG="COMMON_DEFINES_DEBUG")
load("//bazel/linux:variables.bzl",
LINUX_COMMON_COPTS="COMMON_COPTS",
LINUX_COMMON_COPTS_RELEASE="COMMON_COPTS_RELEASE",
LINUX_COMMON_COPTS_DEBUG="COMMON_COPTS_DEBUG",
LINUX_COMMON_DEFINES="COMMON_DEFINES",
LINUX_COMMON_DEFINES_RELEASE="COMMON_DEFINES_RELEASE",
LINUX_COMMON_DEFINES_DEBUG="COMMON_DEFINES_DEBUG")
load("//bazel/mac:variables.bzl",
MAC_COMMON_COPTS="COMMON_COPTS",
MAC_COMMON_COPTS_RELEASE="COMMON_COPTS_RELEASE",
MAC_COMMON_COPTS_DEBUG="COMMON_COPTS_DEBUG")
load("@rules_cc//cc:defs.bzl", "cc_library", "objc_library")
def declare_cc_library(copts=[], local_defines=[], **kwargs):
"""
cc_library wrapper that applies common copts and local_defines.
"""
# NOTE: objc_library does not support local_defines on MacOS, so on
# that platform we put the defines in copts instead.
cc_library(
copts = select({
"@platforms//os:windows": WIN_COMMON_COPTS,
"@platforms//os:linux": LINUX_COMMON_COPTS,
"@platforms//os:macos": MAC_COMMON_COPTS,
"//conditions:default": None,
}) + select({
"@cef//:windows_opt": WIN_COMMON_COPTS_RELEASE,
"@cef//:windows_dbg": WIN_COMMON_COPTS_DEBUG,
"@cef//:windows_fastbuild": WIN_COMMON_COPTS_RELEASE,
"@cef//:linux_opt": LINUX_COMMON_COPTS_RELEASE,
"@cef//:linux_dbg": LINUX_COMMON_COPTS_DEBUG,
"@cef//:linux_fastbuild": LINUX_COMMON_COPTS_RELEASE,
"@cef//:macos_opt": MAC_COMMON_COPTS_RELEASE,
"@cef//:macos_dbg": MAC_COMMON_COPTS_DEBUG,
"@cef//:macos_fastbuild": MAC_COMMON_COPTS_RELEASE,
"//conditions:default": None,
}) + copts,
local_defines = select({
"@platforms//os:windows": WIN_COMMON_DEFINES,
"@platforms//os:linux": LINUX_COMMON_DEFINES,
"//conditions:default": None,
}) + select({
"@cef//:windows_opt": WIN_COMMON_DEFINES_RELEASE,
"@cef//:windows_dbg": WIN_COMMON_DEFINES_DEBUG,
"@cef//:windows_fastbuild": WIN_COMMON_DEFINES_RELEASE,
"@cef//:linux_opt": LINUX_COMMON_DEFINES_RELEASE,
"@cef//:linux_dbg": LINUX_COMMON_DEFINES_DEBUG,
"@cef//:linux_fastbuild": LINUX_COMMON_DEFINES_RELEASE,
"//conditions:default": None,
}) + local_defines,
**kwargs
)
def declare_objc_library(copts=[], **kwargs):
"""
objc_library wrapper that applies common copts.
"""
# NOTE: objc_library does not support local_defines on MacOS, so on
# that platform we put the defines in copts instead.
objc_library(
copts = select({
"@platforms//os:windows": WIN_COMMON_COPTS,
"@platforms//os:linux": LINUX_COMMON_COPTS,
"@platforms//os:macos": MAC_COMMON_COPTS,
"//conditions:default": None,
}) + select({
"@cef//:windows_opt": WIN_COMMON_COPTS_RELEASE,
"@cef//:windows_dbg": WIN_COMMON_COPTS_DEBUG,
"@cef//:windows_fastbuild": WIN_COMMON_COPTS_RELEASE,
"@cef//:linux_opt": LINUX_COMMON_COPTS_RELEASE,
"@cef//:linux_dbg": LINUX_COMMON_COPTS_DEBUG,
"@cef//:linux_fastbuild": LINUX_COMMON_COPTS_RELEASE,
"@cef//:macos_opt": MAC_COMMON_COPTS_RELEASE,
"@cef//:macos_dbg": MAC_COMMON_COPTS_DEBUG,
"@cef//:macos_fastbuild": MAC_COMMON_COPTS_RELEASE,
"//conditions:default": None,
}) + copts,
**kwargs
)

View File

@@ -6,17 +6,18 @@ load("//bazel:copy_filegroups.bzl", "copy_filegroups")
load("//bazel/linux:fix_rpath.bzl", "fix_rpath")
load("//bazel/linux:variables.bzl",
"COMMON_LINKOPTS",
"COMMON_COPTS", "COMMON_COPTS_RELEASE", "COMMON_COPTS_DEBUG")
"COMMON_COPTS", "COMMON_COPTS_RELEASE", "COMMON_COPTS_DEBUG",
"COMMON_DEFINES", "COMMON_DEFINES_RELEASE", "COMMON_DEFINES_DEBUG")
load("@rules_cc//cc:defs.bzl", "cc_binary")
def declare_exe(name, srcs=[], deps=[], linkopts=[], copts=[], defines=[], data=[]):
def declare_exe(name, srcs=[], deps=[], linkopts=[], copts=[], local_defines=[], data=[], **kwargs):
# Copy SOs and resources into the current project.
copy_target = "{}_sos_and_resources".format(name)
copy_filegroups(
name = copy_target,
filegroups = [
"//:sos",
"//:resources",
"@cef//:sos",
"@cef//:resources",
],
remove_prefixes = [
"Debug",
@@ -31,20 +32,24 @@ def declare_exe(name, srcs=[], deps=[], linkopts=[], copts=[], defines=[], data=
name = binary_target,
srcs = srcs,
deps = [
"//:cef_wrapper",
"//:cef",
"//:cef_sandbox",
"@cef//:cef_wrapper",
"@cef//:cef",
"@cef//:cef_sandbox",
] + deps,
linkopts = COMMON_LINKOPTS + linkopts,
copts = select({
"//:linux_dbg": COMMON_COPTS_DEBUG,
copts = COMMON_COPTS + select({
"@cef//:linux_dbg": COMMON_COPTS_DEBUG,
"//conditions:default": COMMON_COPTS_RELEASE,
}) + COMMON_COPTS + copts,
defines = defines,
}) + copts,
local_defines = COMMON_DEFINES + select({
"@cef//:linux_dbg": COMMON_DEFINES_DEBUG,
"//conditions:default": COMMON_DEFINES_RELEASE,
}) + local_defines,
data = [
":{}".format(copy_target),
] + data,
target_compatible_with = ["@platforms//os:linux"],
**kwargs
)
# Set rpath to $ORIGIN so that libraries can be loaded from next to the

View File

@@ -32,7 +32,7 @@ COMMON_LINKOPTS_RELEASE = [
COMMON_LINKOPTS = [
"-l{}".format(lib) for lib in STANDARD_LIBS
] + select({
"//:linux_dbg": COMMON_LINKOPTS_DEBUG,
"@cef//:linux_dbg": COMMON_LINKOPTS_DEBUG,
"//conditions:default": COMMON_LINKOPTS_RELEASE,
})

View File

@@ -5,10 +5,13 @@
load("@bazel_skylib//rules:expand_template.bzl", "expand_template")
load("@build_bazel_rules_apple//apple:macos.bzl", "macos_application")
load("//bazel:variables.bzl", "VERSION_PLIST")
load("//bazel/mac:variables.bzl", "MACOS_DEPLOYMENT_TARGET", "MACOS_BUNDLE_ID_BASE",
"COMMON_LINKOPTS")
load("//bazel/mac:variables.bzl",
"MACOS_DEPLOYMENT_TARGET",
"MACOS_BUNDLE_ID_BASE",
"CEF_FRAMEWORK_NAME",
"COMMON_LINKOPTS")
def _declare_helper_app(name, info_plist, deps, helper_base_name, helper_suffix):
def _declare_helper_app(name, info_plist, deps, helper_base_name, helper_suffix, **kwargs):
"""
Creates a Helper .app target.
"""
@@ -26,7 +29,7 @@ def _declare_helper_app(name, info_plist, deps, helper_base_name, helper_suffix)
out = "{}Info.plist".format(helper_base_name),
substitutions = {
"${EXECUTABLE_NAME}": helper_name,
"${PRODUCT_NAME}": helper_name,
"${PRODUCT_NAME}": name,
"${BUNDLE_ID_SUFFIX}": bundle_id_suffix,
"${VERSION_SHORT}": VERSION_PLIST,
"${VERSION_LONG}": VERSION_PLIST,
@@ -41,8 +44,9 @@ def _declare_helper_app(name, info_plist, deps, helper_base_name, helper_suffix)
infoplists = [":{}_InfoPList".format(helper_base_name)],
minimum_os_version = MACOS_DEPLOYMENT_TARGET,
deps = [
"//:cef_sandbox",
"@cef//:cef_sandbox",
] + deps,
**kwargs,
)
HELPERS = {
@@ -53,7 +57,7 @@ HELPERS = {
"HelperRenderer": "Renderer",
}
def declare_all_helper_apps(name, info_plist, deps):
def declare_all_helper_apps(name, info_plist, deps, **kwargs):
"""
Creates all Helper .app targets.
"""
@@ -63,9 +67,10 @@ def declare_all_helper_apps(name, info_plist, deps):
deps = deps,
helper_base_name = h,
helper_suffix = v,
**kwargs,
) for h, v in HELPERS.items()]
def declare_main_app(name, info_plist, deps, linkopts, resources):
def declare_main_app(name, info_plist, deps, resources, linkopts=[], **kwargs):
"""
Creates the main .app target.
"""
@@ -92,6 +97,7 @@ def declare_main_app(name, info_plist, deps, linkopts, resources):
":HelperGPU": "Frameworks",
":HelperPlugin": "Frameworks",
":HelperRenderer": "Frameworks",
"@cef//:cef_framework": "Frameworks/{}.framework".format(CEF_FRAMEWORK_NAME),
},
bundle_name = name,
bundle_id = "{}.{}".format(MACOS_BUNDLE_ID_BASE, name.lower()),
@@ -102,7 +108,6 @@ def declare_main_app(name, info_plist, deps, linkopts, resources):
target_compatible_with = [
"@platforms//os:macos",
],
deps = [
"//:cef_framework",
] + deps,
deps = deps,
**kwargs,
)

View File

@@ -7,7 +7,7 @@ MACOS_BUNDLE_ID_BASE="org.cef"
CEF_FRAMEWORK_NAME="Chromium Embedded Framework"
#
# Common 'linkopts' for cc_binary targets.
# Common 'linkopts' for macos_application targets.
#
# Standard link frameworks.
@@ -24,39 +24,29 @@ COMMON_LINKOPTS_RELEASE = [
COMMON_LINKOPTS = [
"-framework {}".format(lib) for lib in STANDARD_FRAMEWORKS
] + select({
"//:macos_dbg": COMMON_LINKOPTS_DEBUG,
"@cef//:macos_dbg": COMMON_LINKOPTS_DEBUG,
"//conditions:default": COMMON_LINKOPTS_RELEASE,
})
#
# Common 'copts' for cc_libary and cc_binary targets.
# Common 'copts' for cc_libary, objc_library and macos_application targets.
# We include defines in 'copts' because objc_library does not support
# 'local_defines'. See https://github.com/bazelbuild/bazel/issues/17482.
#
COMMON_COPTS = [
"-Wno-undefined-var-template",
"-Wno-missing-field-initializers",
"-Wno-deprecated-copy",
# Used by apps to test if the sandbox is enabled
"-DCEF_USE_SANDBOX",
]
COMMON_COPTS_DEBUG = [
]
COMMON_COPTS_RELEASE = [
]
#
# Common 'defines' for cc_libary targets.
#
COMMON_DEFINES = [
# Used by apps to test if the sandbox is enabled
"CEF_USE_SANDBOX",
]
COMMON_DEFINES_DEBUG = [
]
COMMON_DEFINES_RELEASE = [
# Not a debug build
"NDEBUG",
"-DNDEBUG",
]

View File

@@ -7,11 +7,13 @@ load("//bazel/win:mt.bzl", "add_manifest")
load("//bazel/win:rc.bzl", "compile_rc")
load("//bazel/win:variables.bzl",
"COMMON_LINKOPTS",
"COMMON_COPTS", "COMMON_COPTS_RELEASE", "COMMON_COPTS_DEBUG")
"COMMON_COPTS", "COMMON_COPTS_RELEASE", "COMMON_COPTS_DEBUG",
"COMMON_DEFINES", "COMMON_DEFINES_RELEASE", "COMMON_DEFINES_DEBUG")
load("@rules_cc//cc:defs.bzl", "cc_binary")
def declare_exe(name, srcs, manifest_srcs, rc_file, resources_srcs, resources_deps=[],
deps=[], linkopts=[], copts=[], defines=[], data=[]):
deps=[], linkopts=[], copts=[], local_defines=[], data=[],
additional_linker_inputs=[], features=[], **kwargs):
# Resource file.
res_target = "{}_res".format(name)
compile_rc(
@@ -28,8 +30,8 @@ def declare_exe(name, srcs, manifest_srcs, rc_file, resources_srcs, resources_de
copy_filegroups(
name = copy_target,
filegroups = [
"//:dlls",
"//:resources",
"@cef//:dlls",
"@cef//:resources",
],
remove_prefixes = [
"Debug",
@@ -44,26 +46,30 @@ def declare_exe(name, srcs, manifest_srcs, rc_file, resources_srcs, resources_de
name = binary_target,
srcs = srcs,
deps = [
"//:cef_wrapper",
"//:cef",
"//:cef_sandbox",
"@cef//:cef_wrapper",
"@cef//:cef",
"@cef//:cef_sandbox",
] + deps,
linkopts = [
"$(location :{})".format(res_target),
] + COMMON_LINKOPTS + linkopts,
copts = select({
"//:windows_dbg": COMMON_COPTS_DEBUG,
copts = COMMON_COPTS + select({
"@cef//:windows_dbg": COMMON_COPTS_DEBUG,
"//conditions:default": COMMON_COPTS_RELEASE,
}) + COMMON_COPTS + copts,
defines = defines,
}) + copts,
local_defines = COMMON_DEFINES + select({
"@cef//:windows_dbg": COMMON_DEFINES_DEBUG,
"//conditions:default": COMMON_DEFINES_RELEASE,
}) + local_defines,
additional_linker_inputs = [
":{}".format(res_target),
],
] + additional_linker_inputs,
data = [
":{}".format(copy_target),
] + data,
features = ["generate_pdb_file"],
features = ["generate_pdb_file"] + features,
target_compatible_with = ["@platforms//os:windows"],
**kwargs
)
# Add manifest and rename to final executable.

View File

@@ -133,11 +133,11 @@ COMMON_LINKOPTS = [
# can only control through this setting. The main thread (in 32-bit builds
# only) uses fibers to switch to a 4MiB stack at runtime via
# CefRunWinMainWithPreferredStackSize().
"//:windows_32": ["/STACK:0x80000"],
"@cef//:windows_32": ["/STACK:0x80000"],
# Increase the initial stack size to 8MiB from the default 1MiB.
"//conditions:default": ["/STACK:0x800000"],
}) + select({
"//:windows_dbg": COMMON_LINKOPTS_DEBUG,
"@cef//:windows_dbg": COMMON_LINKOPTS_DEBUG,
"//conditions:default": COMMON_LINKOPTS_RELEASE,
})

View File

@@ -245,6 +245,7 @@
'tests/cefclient/browser/client_prefs.cc',
'tests/cefclient/browser/client_prefs.h',
'tests/cefclient/browser/client_types.h',
'tests/cefclient/browser/default_client_handler.cc',
'tests/cefclient/browser/default_client_handler.h',
'tests/cefclient/browser/dialog_test.cc',
'tests/cefclient/browser/dialog_test.h',

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=5dd4948a92af2ad69e2171f2dffb8f2c23e5c147$
// $hash=0b56c483bee6489e591c54c9dbb0940cd3098eaa$
//
#ifndef CEF_INCLUDE_CAPI_CEF_V8_CAPI_H_
@@ -832,11 +832,24 @@ CEF_EXPORT cef_v8value_t* cef_v8value_create_array(int length);
/// cef_v8handler_t or cef_v8accessor_t callback, or in combination with calling
/// enter() and exit() on a stored cef_v8context_t reference.
///
/// NOTE: Always returns nullptr when V8 sandbox is enabled.
///
CEF_EXPORT cef_v8value_t* cef_v8value_create_array_buffer(
void* buffer,
size_t length,
cef_v8array_buffer_release_callback_t* release_callback);
///
/// Create a new cef_v8value_t object of type ArrayBuffer which copies the
/// provided |buffer| of size |length| bytes. This function should only be
/// called from within the scope of a cef_render_process_handler_t,
/// cef_v8handler_t or cef_v8accessor_t callback, or in combination with calling
/// enter() and exit() on a stored cef_v8context_t reference.
///
CEF_EXPORT cef_v8value_t* cef_v8value_create_array_buffer_with_copy(
void* buffer,
size_t length);
///
/// Create a new cef_v8value_t object of type function. This function should
/// only be called from within the scope of a cef_render_process_handler_t,

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=a2e5caf4dc0ed5b43a6075678e3b7b7ae83834ae$
// $hash=bafa7ddf3dfbc3fa82b1fb8a064b51f0791b29b6$
//
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_WINDOW_DELEGATE_CAPI_H_
@@ -280,6 +280,15 @@ typedef struct _cef_window_delegate_t {
///
cef_runtime_style_t(CEF_CALLBACK* get_window_runtime_style)(
struct _cef_window_delegate_t* self);
///
/// Return Linux-specific window properties for correctly handling by window
/// managers
///
int(CEF_CALLBACK* get_linux_window_properties)(
struct _cef_window_delegate_t* self,
struct _cef_window_t* window,
struct _cef_linux_window_properties_t* properties);
} cef_window_delegate_t;
#ifdef __cplusplus

View File

@@ -42,13 +42,13 @@
// way that may cause binary incompatibility with other builds. The universal
// hash value will change if any platform is affected whereas the platform hash
// values will change only if that particular platform is affected.
#define CEF_API_HASH_UNIVERSAL "316cc23ff49e0d0962090cbfb0a0279ce3dc3c50"
#define CEF_API_HASH_UNIVERSAL "3c4bef13c1801f001305b1bc3af84039b2426943"
#if defined(OS_WIN)
#define CEF_API_HASH_PLATFORM "66c126d91698670af3835a707a84ce4dbb4a16fa"
#define CEF_API_HASH_PLATFORM "10e56374e7d422b45eec31ae5d2aa7ef5288621c"
#elif defined(OS_MAC)
#define CEF_API_HASH_PLATFORM "c1d8d20920c3a3e13a6a6efef51b2b775f69d2c7"
#define CEF_API_HASH_PLATFORM "ae9f14019f456db6ad8059f17d1dfd484d4a08d7"
#elif defined(OS_LINUX)
#define CEF_API_HASH_PLATFORM "7ccfa4c608c16a4f8bedc97a2bdf50729784c5ee"
#define CEF_API_HASH_PLATFORM "84dcdea90daf46d0ba611b1d0f3e42666fb3382d"
#endif
#ifdef __cplusplus

View File

@@ -520,12 +520,26 @@ class CefV8Value : public virtual CefBaseRefCounted {
/// or CefV8Accessor callback, or in combination with calling Enter() and
/// Exit() on a stored CefV8Context reference.
///
/// NOTE: Always returns nullptr when V8 sandbox is enabled.
///
/*--cef(optional_param=buffer)--*/
static CefRefPtr<CefV8Value> CreateArrayBuffer(
void* buffer,
size_t length,
CefRefPtr<CefV8ArrayBufferReleaseCallback> release_callback);
///
/// Create a new CefV8Value object of type ArrayBuffer which copies the
/// provided |buffer| of size |length| bytes.
/// This method should only be called from within the scope of a
/// CefRenderProcessHandler, CefV8Handler or CefV8Accessor callback, or in
/// combination with calling Enter() and Exit() on a stored CefV8Context
/// reference.
///
/*--cef(optional_param=buffer)--*/
static CefRefPtr<CefV8Value> CreateArrayBufferWithCopy(void* buffer,
size_t length);
///
/// Create a new CefV8Value object of type function. This method should only
/// be called from within the scope of a CefRenderProcessHandler, CefV8Handler

View File

@@ -486,6 +486,13 @@ typedef struct _cef_settings_t {
/// Windows.
///
int chrome_app_icon_id;
#if defined(OS_POSIX) && !defined(OS_ANDROID)
///
/// Specify whether signal handlers must be disabled on POSIX systems.
///
int disable_signal_handlers;
#endif
} cef_settings_t;
///
@@ -1847,6 +1854,34 @@ typedef struct _cef_screen_info_t {
cef_rect_t available_rect;
} cef_screen_info_t;
///
/// Linux window properties, such as X11's WM_CLASS or Wayland's app_id.
/// Those are passed to CefWindowDelegate, so the client can set them
/// for the CefWindow's top-level. Thus, allowing window managers to correctly
/// display the application's information (e.g., icons).
///
typedef struct _cef_linux_window_properties_t {
///
/// Main window's Wayland's app_id
///
cef_string_t wayland_app_id;
///
/// Main window's WM_CLASS_CLASS in X11
///
cef_string_t wm_class_class;
///
/// Main window's WM_CLASS_NAME in X11
///
cef_string_t wm_class_name;
///
/// Main window's WM_WINDOW_ROLE in X11
///
cef_string_t wm_role_name;
} cef_linux_window_properties_t;
///
/// Supported menu IDs. Non-English translations can be provided for the
/// IDS_MENU_* strings in CefResourceBundleHandler::GetLocalizedString().

View File

@@ -432,6 +432,10 @@ struct CefSettingsTraits {
cef_string_set(src->chrome_policy_id.str, src->chrome_policy_id.length,
&target->chrome_policy_id, copy);
target->chrome_app_icon_id = src->chrome_app_icon_id;
#if defined(OS_POSIX) && !defined(OS_ANDROID)
target->disable_signal_handlers = src->disable_signal_handlers;
#endif
}
};
@@ -783,4 +787,36 @@ struct CefTaskInfoTraits {
///
using CefTaskInfo = CefStructBase<CefTaskInfoTraits>;
struct CefLinuxWindowPropertiesTraits {
using struct_type = cef_linux_window_properties_t;
static inline void init(struct_type* s) {}
static inline void clear(struct_type* s) {
cef_string_clear(&s->wayland_app_id);
cef_string_clear(&s->wm_class_class);
cef_string_clear(&s->wm_class_name);
cef_string_clear(&s->wm_role_name);
}
static inline void set(const struct_type* src,
struct_type* target,
bool copy) {
cef_string_set(src->wayland_app_id.str, src->wayland_app_id.length,
&target->wayland_app_id, copy);
cef_string_set(src->wm_class_class.str, src->wm_class_class.length,
&target->wm_class_class, copy);
cef_string_set(src->wm_class_name.str, src->wm_class_name.length,
&target->wm_class_name, copy);
cef_string_set(src->wm_role_name.str, src->wm_role_name.length,
&target->wm_role_name, copy);
}
};
///
/// Class representing the Linux-specific window properties required
/// for the window managers to correct group and display the window.
///
using CefLinuxWindowProperties = CefStructBase<CefLinuxWindowPropertiesTraits>;
#endif // CEF_INCLUDE_INTERNAL_CEF_TYPES_WRAPPERS_H_

View File

@@ -278,6 +278,16 @@ class CefWindowDelegate : public CefPanelDelegate {
virtual cef_runtime_style_t GetWindowRuntimeStyle() {
return CEF_RUNTIME_STYLE_DEFAULT;
}
///
/// Return Linux-specific window properties for correctly handling by window
/// managers
///
/*--cef()--*/
virtual bool GetLinuxWindowProperties(CefRefPtr<CefWindow> window,
CefLinuxWindowProperties& properties) {
return false;
}
};
#endif // CEF_INCLUDE_VIEWS_CEF_WINDOW_DELEGATE_H_

View File

@@ -33,6 +33,7 @@
#include "cef/libcef/common/values_impl.h"
#include "chrome/browser/file_select_helper.h"
#include "chrome/browser/picture_in_picture/picture_in_picture_window_manager.h"
#include "chrome/common/webui_url_constants.h"
#include "components/input/native_web_keyboard_event.h"
#include "components/zoom/page_zoom.h"
#include "content/browser/gpu/compositor_util.h"
@@ -57,6 +58,47 @@ namespace {
static constexpr base::TimeDelta kRecentlyAudibleTimeout = base::Seconds(2);
// List of WebUI hosts that have been tested to work in Alloy-style browsers.
// Do not add new hosts to this list without also manually testing all related
// functionality in CEF.
const char* kAllowedWebUIHosts[] = {
chrome::kChromeUIAccessibilityHost,
content::kChromeUIBlobInternalsHost,
chrome::kChromeUIChromeURLsHost,
chrome::kChromeUICreditsHost,
content::kChromeUIGpuHost,
content::kChromeUIHistogramHost,
content::kChromeUIIndexedDBInternalsHost,
chrome::kChromeUILicenseHost,
content::kChromeUIMediaInternalsHost,
chrome::kChromeUINetExportHost,
chrome::kChromeUINetInternalsHost,
content::kChromeUINetworkErrorHost,
content::kChromeUINetworkErrorsListingHost,
chrome::kChromeUIPrintHost,
content::kChromeUIProcessInternalsHost,
content::kChromeUIResourcesHost,
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
chrome::kChromeUISandboxHost,
#endif
content::kChromeUIServiceWorkerInternalsHost,
chrome::kChromeUISystemInfoHost,
chrome::kChromeUITermsHost,
chrome::kChromeUIThemeHost,
content::kChromeUITracingHost,
chrome::kChromeUIVersionHost,
content::kChromeUIWebRTCInternalsHost,
};
bool IsAllowedWebUIHost(const std::string_view& host) {
for (auto& allowed_host : kAllowedWebUIHosts) {
if (base::EqualsCaseInsensitiveASCII(allowed_host, host)) {
return true;
}
}
return false;
}
} // namespace
// AlloyBrowserHostImpl static methods.
@@ -567,8 +609,8 @@ bool AlloyBrowserHostImpl::MaybeAllowNavigation(
// The PDF viewer will load the PDF extension in the guest view, and print
// preview will load chrome://print in the guest view. The PDF renderer
// used with PdfUnseasoned will set |params.is_pdf| when loading the PDF
// stream (see PdfNavigationThrottle::WillStartRequest). All other
// navigations are passed to the owner browser.
// stream (see PdfNavigationThrottle::WillStartRequest). All other guest
// view navigations are passed to the owner browser.
CEF_POST_TASK(CEF_UIT,
base::BindOnce(
base::IgnoreResult(&AlloyBrowserHostImpl::OpenURLFromTab),
@@ -577,6 +619,14 @@ bool AlloyBrowserHostImpl::MaybeAllowNavigation(
return false;
}
if (!is_guest_view && params.url.SchemeIs(content::kChromeUIScheme) &&
!IsAllowedWebUIHost(params.url.host_piece())) {
// Block navigation to non-allowlisted WebUI pages.
LOG(WARNING) << "Navigation to " << params.url.spec()
<< " is blocked in Alloy-style browser.";
return false;
}
return true;
}

View File

@@ -164,13 +164,14 @@ class BrowserDelegate : public content::WebContentsDelegate {
virtual bool HasViewsHostedOpener() const { return false; }
// Same as OpenURLFromTab but only taking |navigation_handle_callback|
// if the return value is non-nullptr.
virtual content::WebContents* OpenURLFromTabEx(
// if the return value is false. Return false to cancel the navigation
// or true to proceed with default chrome handling.
virtual bool OpenURLFromTabEx(
content::WebContents* source,
const content::OpenURLParams& params,
base::OnceCallback<void(content::NavigationHandle&)>&
navigation_handle_callback) {
return nullptr;
return true;
}
};

View File

@@ -526,7 +526,7 @@ void ChromeBrowserDelegate::WebContentsCreated(
/*is_devtools_popup=*/false, opener);
}
content::WebContents* ChromeBrowserDelegate::OpenURLFromTabEx(
bool ChromeBrowserDelegate::OpenURLFromTabEx(
content::WebContents* source,
const content::OpenURLParams& params,
base::OnceCallback<void(content::NavigationHandle&)>&
@@ -535,17 +535,31 @@ content::WebContents* ChromeBrowserDelegate::OpenURLFromTabEx(
// Reading List sidebar. In that case we default to using the Browser's
// currently active WebContents.
if (!source) {
// GetActiveWebContents() may return nullptr if we're in a new Browser
// created using ScopedTabbedBrowserDisplayer. This new Browser does
// not have a WebContents yet.
source = browser_->tab_strip_model()->GetActiveWebContents();
DCHECK(source);
}
if (!source) {
LOG(WARNING) << "Failed to identify target browser for "
<< params.url.spec();
// Proceed with default chrome handling.
return true;
}
// Return nullptr to cancel the navigation. Otherwise, proceed with default
// chrome handling.
if (auto delegate = GetDelegateForWebContents(source)) {
return delegate->OpenURLFromTabEx(source, params,
navigation_handle_callback);
// Returns nullptr to cancel the navigation.
const bool cancel =
delegate->OpenURLFromTabEx(source, params,
navigation_handle_callback) == nullptr;
if (cancel) {
// Cancel the navigation.
return false;
}
}
return nullptr;
// Proceed with default chrome handling.
return true;
}
void ChromeBrowserDelegate::LoadingStateChanged(content::WebContents* source,

View File

@@ -90,11 +90,10 @@ class ChromeBrowserDelegate : public cef::BrowserDelegate {
const std::optional<SkRegion> GetDraggableRegion() const override;
void WindowFullscreenStateChanged() override;
bool HasViewsHostedOpener() const override;
content::WebContents* OpenURLFromTabEx(
content::WebContents* source,
const content::OpenURLParams& params,
base::OnceCallback<void(content::NavigationHandle&)>&
navigation_handle_callback) override;
bool OpenURLFromTabEx(content::WebContents* source,
const content::OpenURLParams& params,
base::OnceCallback<void(content::NavigationHandle&)>&
navigation_handle_callback) override;
// WebContentsDelegate methods:
void WebContentsCreated(content::WebContents* source_contents,

View File

@@ -515,7 +515,9 @@ CefFileDialogManager::MaybeRunDelegate(
ext_str += FilePathTypeToString16(FILE_PATH_LITERAL(".") + ext);
}
accept_extensions.push_back(ext_str);
accept_descriptions.push_back(descriptions[i]);
if (descriptions.size() == extensions.size()) {
accept_descriptions.push_back(descriptions[i]);
}
}
}

View File

@@ -101,7 +101,13 @@ bool CefMainRunner::Initialize(CefSettings* settings,
application_ = application;
exit_code_ =
ContentMainInitialize(args, windows_sandbox_info, &settings->no_sandbox);
ContentMainInitialize(args, windows_sandbox_info, &settings->no_sandbox,
#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_ANDROID)
settings->disable_signal_handlers
#else
false
#endif
);
if (exit_code_ >= 0) {
LOG(ERROR) << "ContentMainInitialize failed with exit code " << exit_code_;
return false;
@@ -253,7 +259,8 @@ int CefMainRunner::RunAsHelperProcess(const CefMainArgs& args,
int CefMainRunner::ContentMainInitialize(const CefMainArgs& args,
void* windows_sandbox_info,
int* no_sandbox) {
int* no_sandbox,
bool disable_signal_handlers) {
BeforeMainInitialize(args);
main_delegate_ =
@@ -278,6 +285,10 @@ int CefMainRunner::ContentMainInitialize(const CefMainArgs& args,
main_params.argv = const_cast<const char**>(args.argv);
#endif
#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_ANDROID)
main_params.disable_signal_handlers = disable_signal_handlers;
#endif
return content::ContentMainInitialize(std::move(main_params),
main_runner_.get());
}

View File

@@ -62,7 +62,9 @@ class CefMainRunner final {
// Called from Initialize().
int ContentMainInitialize(const CefMainArgs& args,
void* windows_sandbox_info,
int* no_sandbox);
int* no_sandbox,
bool disable_signal_handlers);
int ContentMainRun(bool* initialized, base::OnceClosure context_initialized);
static void BeforeMainInitialize(const CefMainArgs& args);

View File

@@ -213,7 +213,8 @@ class InputStreamReader : public base::RefCountedThreadSafe<InputStreamReader> {
InputStream::SkipCallback skip_callback);
static void RunReadCallbackOnJobThread(
int bytes_read,
InputStream::ReadCallback read_callback);
InputStream::ReadCallback read_callback,
scoped_refptr<net::IOBuffer> buffer);
std::unique_ptr<InputStream> stream_;
@@ -442,8 +443,9 @@ void InputStreamReader::RunReadCallback(int bytes_read) {
DCHECK(!pending_read_callback_.is_null());
job_thread_task_runner_->PostTask(
FROM_HERE, base::BindOnce(InputStreamReader::RunReadCallbackOnJobThread,
bytes_read, std::move(pending_read_callback_)));
FROM_HERE,
base::BindOnce(InputStreamReader::RunReadCallbackOnJobThread, bytes_read,
std::move(pending_read_callback_), buffer_));
// Reset callback state.
pending_callback_id_ = -1;
@@ -460,7 +462,8 @@ void InputStreamReader::RunSkipCallbackOnJobThread(
// static
void InputStreamReader::RunReadCallbackOnJobThread(
int bytes_read,
InputStream::ReadCallback read_callback) {
InputStream::ReadCallback read_callback,
scoped_refptr<net::IOBuffer> buffer) {
std::move(read_callback).Run(bytes_read);
}

View File

@@ -42,6 +42,9 @@ CefWidget* CefWidget::GetForWidget(views::Widget* widget) {
if (auto window = view_util::GetWindowFor(widget)) {
if (auto* window_view =
static_cast<CefWindowImpl*>(window.get())->cef_window_view()) {
if (auto widget_view = view_util::GetHostView(widget)) {
widget = widget_view->GetWidget();
}
if (window_view->IsChromeStyle()) {
return static_cast<ChromeBrowserFrame*>(widget);
}

View File

@@ -429,6 +429,16 @@ void CefWindowView::CreateWidget(gfx::AcceleratedWidget parent_widget) {
auto bounds = cef_delegate()->GetInitialBounds(cef_window);
params.bounds = gfx::Rect(bounds.x, bounds.y, bounds.width, bounds.height);
#if BUILDFLAG(IS_LINUX)
CefLinuxWindowProperties linux_props;
if (cef_delegate()->GetLinuxWindowProperties(cef_window, linux_props)) {
params.wayland_app_id = CefString(&linux_props.wayland_app_id);
params.wm_class_class = CefString(&linux_props.wm_class_class);
params.wm_class_name = CefString(&linux_props.wm_class_name);
params.wm_role_name = CefString(&linux_props.wm_role_name);
}
#endif
if (has_native_parent) {
DCHECK(!params.bounds.IsEmpty());
} else {

View File

@@ -377,12 +377,6 @@ void ChromeMainDelegateCef::PreSandboxStartup() {
// number in the app bundle path.
resource_util::OverrideUserDataDir(settings_, command_line);
ChromeMainDelegate::PreSandboxStartup();
// Initialize crash reporting state for this process/module.
// chrome::DIR_CRASH_DUMPS must be configured before calling this function.
crash_reporting::PreSandboxStartup(*command_line, process_type);
base::FilePath resources_dir;
if (command_line->HasSwitch(switches::kResourcesDirPath)) {
resources_dir =
@@ -403,6 +397,12 @@ void ChromeMainDelegateCef::PreSandboxStartup() {
}
}
ChromeMainDelegate::PreSandboxStartup();
// Initialize crash reporting state for this process/module.
// chrome::DIR_CRASH_DUMPS must be configured before calling this function.
crash_reporting::PreSandboxStartup(*command_line, process_type);
#if !BUILDFLAG(IS_WIN)
// Call after InitLogging() potentially changes values in
// chrome/app/chrome_main_delegate.cc.

View File

@@ -1412,6 +1412,7 @@ CefRefPtr<CefV8Value> CefV8Value::CreateArrayBuffer(
void* buffer,
size_t length,
CefRefPtr<CefV8ArrayBufferReleaseCallback> release_callback) {
#ifndef V8_ENABLE_SANDBOX
CEF_V8_REQUIRE_ISOLATE_RETURN(nullptr);
v8::Isolate* isolate = CefV8IsolateManager::Get()->isolate();
@@ -1451,6 +1452,46 @@ CefRefPtr<CefV8Value> CefV8Value::CreateArrayBuffer(
CefRefPtr<CefV8ValueImpl> impl = new CefV8ValueImpl(isolate);
impl->InitObject(ab, tracker);
return impl.get();
#else
LOG(ERROR)
<< "CefV8Value::CreateArrayBuffer is not supported with the V8 "
"sandbox enabled, use CefV8Value::CreateArrayBufferWithCopy instead";
return nullptr;
#endif // V8_ENABLE_SANDBOX
}
// static
CefRefPtr<CefV8Value> CefV8Value::CreateArrayBufferWithCopy(void* buffer,
size_t length) {
CEF_V8_REQUIRE_ISOLATE_RETURN(nullptr);
v8::Isolate* isolate = CefV8IsolateManager::Get()->isolate();
v8::HandleScope handle_scope(isolate);
v8::Local<v8::Context> context = isolate->GetCurrentContext();
if (context.IsEmpty()) {
DCHECK(false) << "not currently in a V8 context";
return nullptr;
}
// Create a tracker object that will cause the user data reference to be
// released when the V8 object is destroyed.
V8TrackObject* tracker = new V8TrackObject(isolate);
v8::Local<v8::ArrayBuffer> ab = v8::ArrayBuffer::New(
isolate, length, v8::BackingStoreInitializationMode::kUninitialized);
if (length > 0) {
DCHECK(ab->Data());
DCHECK(buffer);
memcpy(ab->Data(), buffer, length);
}
// Attach the tracker object.
tracker->AttachTo(context, ab);
CefRefPtr<CefV8ValueImpl> impl = new CefV8ValueImpl(isolate);
impl->InitObject(ab, tracker);
return impl;
}
// static

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=c59808566c2a9f2d204b6724bb5a905aeb0e7620$
// $hash=befb2f29af8a0e8eabf745fad126ebad5a741c74$
//
#include "libcef_dll/cpptoc/v8value_cpptoc.h"
@@ -155,6 +155,21 @@ CEF_EXPORT cef_v8value_t* cef_v8value_create_array_buffer(
return CefV8ValueCppToC::Wrap(_retval);
}
CEF_EXPORT cef_v8value_t* cef_v8value_create_array_buffer_with_copy(
void* buffer,
size_t length) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Unverified params: buffer
// Execute
CefRefPtr<CefV8Value> _retval =
CefV8Value::CreateArrayBufferWithCopy(buffer, length);
// Return type: refptr_same
return CefV8ValueCppToC::Wrap(_retval);
}
CEF_EXPORT cef_v8value_t* cef_v8value_create_function(
const cef_string_t* name,
cef_v8handler_t* handler) {

View File

@@ -9,14 +9,14 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=bcb4d6aea88f1445def6014708b69087f1a6dc74$
// $hash=2fca5c473412bd7acef54f5057dc55488271aaf9$
//
#include "libcef_dll/cpptoc/views/window_delegate_cpptoc.h"
#include "libcef_dll/ctocpp/views/view_ctocpp.h"
#include "libcef_dll/ctocpp/views/window_ctocpp.h"
#include "libcef_dll/shutdown_checker.h"
#include "libcef_dll/template_util.h"
namespace {
@@ -600,6 +600,52 @@ window_delegate_get_window_runtime_style(struct _cef_window_delegate_t* self) {
return _retval;
}
int CEF_CALLBACK window_delegate_get_linux_window_properties(
struct _cef_window_delegate_t* self,
cef_window_t* window,
struct _cef_linux_window_properties_t* properties) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self) {
return 0;
}
// Verify param: window; type: refptr_diff
DCHECK(window);
if (!window) {
return 0;
}
// Verify param: properties; type: struct_byref
DCHECK(properties);
if (!properties) {
return 0;
}
if (!template_util::has_valid_size(properties)) {
DCHECK(false) << "invalid properties->[base.]size";
return 0;
}
// Translate param: properties; type: struct_byref
CefLinuxWindowProperties propertiesObj;
if (properties) {
propertiesObj.AttachTo(*properties);
}
// Execute
bool _retval = CefWindowDelegateCppToC::Get(self)->GetLinuxWindowProperties(
CefWindowCToCpp::Wrap(window), propertiesObj);
// Restore param: properties; type: struct_byref
if (properties) {
propertiesObj.DetachTo(*properties);
}
// Return type: bool
return _retval;
}
cef_size_t CEF_CALLBACK
window_delegate_get_preferred_size(struct _cef_view_delegate_t* self,
cef_view_t* view) {
@@ -916,6 +962,8 @@ CefWindowDelegateCppToC::CefWindowDelegateCppToC() {
window_delegate_on_theme_colors_changed;
GetStruct()->get_window_runtime_style =
window_delegate_get_window_runtime_style;
GetStruct()->get_linux_window_properties =
window_delegate_get_linux_window_properties;
GetStruct()->base.base.get_preferred_size =
window_delegate_get_preferred_size;
GetStruct()->base.base.get_minimum_size = window_delegate_get_minimum_size;

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=856fc6c190d0e3376824564155618e468764e841$
// $hash=df9571f843ed0e55e581dc6282079803e3641d2c$
//
#include "libcef_dll/ctocpp/v8value_ctocpp.h"
@@ -164,6 +164,21 @@ CefRefPtr<CefV8Value> CefV8Value::CreateArrayBuffer(
return CefV8ValueCToCpp::Wrap(_retval);
}
NO_SANITIZE("cfi-icall")
CefRefPtr<CefV8Value> CefV8Value::CreateArrayBufferWithCopy(void* buffer,
size_t length) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Unverified params: buffer
// Execute
cef_v8value_t* _retval =
cef_v8value_create_array_buffer_with_copy(buffer, length);
// Return type: refptr_same
return CefV8ValueCToCpp::Wrap(_retval);
}
NO_SANITIZE("cfi-icall")
CefRefPtr<CefV8Value> CefV8Value::CreateFunction(
const CefString& name,

View File

@@ -9,11 +9,10 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=da609d625660ca617e1a01d5dc359932142e15a3$
// $hash=7bdd882f715040d06246576d0bafbbd7b9a39f8f$
//
#include "libcef_dll/ctocpp/views/window_delegate_ctocpp.h"
#include "libcef_dll/cpptoc/views/view_cpptoc.h"
#include "libcef_dll/cpptoc/views/window_cpptoc.h"
#include "libcef_dll/shutdown_checker.h"
@@ -579,6 +578,33 @@ cef_runtime_style_t CefWindowDelegateCToCpp::GetWindowRuntimeStyle() {
return _retval;
}
NO_SANITIZE("cfi-icall")
bool CefWindowDelegateCToCpp::GetLinuxWindowProperties(
CefRefPtr<CefWindow> window,
CefLinuxWindowProperties& properties) {
shutdown_checker::AssertNotShutdown();
cef_window_delegate_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_linux_window_properties)) {
return false;
}
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: window; type: refptr_diff
DCHECK(window.get());
if (!window.get()) {
return false;
}
// Execute
int _retval = _struct->get_linux_window_properties(
_struct, CefWindowCppToC::Wrap(window), &properties);
// Return type: bool
return _retval ? true : false;
}
NO_SANITIZE("cfi-icall")
CefSize CefWindowDelegateCToCpp::GetPreferredSize(CefRefPtr<CefView> view) {
shutdown_checker::AssertNotShutdown();

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=50ace2b6a45a23d4ff5d9a91ab7c37a893f7e0b4$
// $hash=ef831469d4dd59c3a20f0dfee3e8e945a52d7637$
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_VIEWS_WINDOW_DELEGATE_CTOCPP_H_
@@ -67,6 +67,8 @@ class CefWindowDelegateCToCpp
void OnThemeColorsChanged(CefRefPtr<CefWindow> window,
bool chrome_theme) override;
cef_runtime_style_t GetWindowRuntimeStyle() override;
bool GetLinuxWindowProperties(CefRefPtr<CefWindow> window,
CefLinuxWindowProperties& properties) override;
// CefPanelDelegate methods.

View File

@@ -1070,11 +1070,15 @@ class CefMessageRouterRendererSideImpl : public CefMessageRouterRendererSide {
CefRefPtr<CefV8Context> context = GetContextByID(context_id);
if (context && info->success_callback && context->Enter()) {
CefRefPtr<cmru::BinaryValueABRCallback> release_callback =
new cmru::BinaryValueABRCallback(response);
CefRefPtr<CefV8Value> value = CefV8Value::CreateArrayBuffer(
response->GetData(), response->GetSize(), release_callback);
CefRefPtr<CefV8Value> value;
#ifdef CEF_V8_ENABLE_SANDBOX
value = CefV8Value::CreateArrayBufferWithCopy(response->GetData(),
response->GetSize());
#else
value = CefV8Value::CreateArrayBuffer(
response->GetData(), response->GetSize(),
new cmru::BinaryValueABRCallback(response));
#endif
context->Exit();

View File

@@ -48,6 +48,7 @@ struct RendererMessage {
std::variant<CefString, CefRefPtr<const CefBinaryBuffer>> payload;
};
#ifndef CEF_V8_ENABLE_SANDBOX
class BinaryValueABRCallback final : public CefV8ArrayBufferReleaseCallback {
public:
explicit BinaryValueABRCallback(CefRefPtr<CefBinaryBuffer> value)
@@ -62,6 +63,7 @@ class BinaryValueABRCallback final : public CefV8ArrayBufferReleaseCallback {
IMPLEMENT_REFCOUNTING(BinaryValueABRCallback);
};
#endif
CefRefPtr<BrowserResponseBuilder> CreateBrowserResponseBuilder(
size_t threshold,

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=fd61a77bd549fb94bba963f9c0737ebceac324ac$
// $hash=85864cf7616899c4d51fbaf995d8e0db55249bd7$
//
#include <dlfcn.h>
@@ -209,6 +209,8 @@ struct libcef_pointers {
decltype(&cef_v8value_create_object) cef_v8value_create_object;
decltype(&cef_v8value_create_array) cef_v8value_create_array;
decltype(&cef_v8value_create_array_buffer) cef_v8value_create_array_buffer;
decltype(&cef_v8value_create_array_buffer_with_copy)
cef_v8value_create_array_buffer_with_copy;
decltype(&cef_v8value_create_function) cef_v8value_create_function;
decltype(&cef_v8value_create_promise) cef_v8value_create_promise;
decltype(&cef_v8stack_trace_get_current) cef_v8stack_trace_get_current;
@@ -439,6 +441,7 @@ int libcef_init_pointers(const char* path) {
INIT_ENTRY(cef_v8value_create_object);
INIT_ENTRY(cef_v8value_create_array);
INIT_ENTRY(cef_v8value_create_array_buffer);
INIT_ENTRY(cef_v8value_create_array_buffer_with_copy);
INIT_ENTRY(cef_v8value_create_function);
INIT_ENTRY(cef_v8value_create_promise);
INIT_ENTRY(cef_v8stack_trace_get_current);
@@ -1145,6 +1148,14 @@ struct _cef_v8value_t* cef_v8value_create_array_buffer(
release_callback);
}
NO_SANITIZE("cfi-icall")
struct _cef_v8value_t* cef_v8value_create_array_buffer_with_copy(
void* buffer,
size_t length) {
return g_libcef_pointers.cef_v8value_create_array_buffer_with_copy(buffer,
length);
}
NO_SANITIZE("cfi-icall")
struct _cef_v8value_t* cef_v8value_create_function(
const cef_string_t* name,

View File

@@ -278,6 +278,10 @@ patches = [
{
# chrome: Support custom DownloadManagerDelegate handling.
# https://github.com/chromiumembedded/cef/issues/3681
#
# chrome: Allow routing of Download bubble file open to non-Tabbed
# source browser.
# https://github.com/chromiumembedded/cef/issues/3750
'name': 'chrome_browser_download',
},
{
@@ -730,5 +734,15 @@ patches = [
# hidden menu items.
# https://github.com/chromiumembedded/cef/issues/3577
'name': 'ui_menu_model_3577'
},
{
# linux: Fix cannot allocate memory in static TLS block in dlopen libcef.so
# https://github.com/chromiumembedded/cef/issues/3616
'name': 'third_party_sentencepiece_3616'
},
{
# Windows: Add missing check in base/profiler/stack_copier.cc to fix
# compilation error of cef_sandbox.
'name': 'win_sandbox_stack_copier'
}
]

View File

@@ -1,8 +1,8 @@
diff --git content/browser/child_process_security_policy_impl.cc content/browser/child_process_security_policy_impl.cc
index 214c70f690b18..7e481aee2a1ca 100644
index 7d2a81d96995c..69dc5d6321a90 100644
--- content/browser/child_process_security_policy_impl.cc
+++ content/browser/child_process_security_policy_impl.cc
@@ -2079,6 +2079,16 @@ bool ChildProcessSecurityPolicyImpl::CanAccessMaybeOpaqueOrigin(
@@ -2080,6 +2080,16 @@ bool ChildProcessSecurityPolicyImpl::CanAccessMaybeOpaqueOrigin(
// DeclarativeApiTest.PersistRules.
if (actual_process_lock.matches_scheme(url::kDataScheme))
return true;
@@ -20,10 +20,10 @@ index 214c70f690b18..7e481aee2a1ca 100644
// Make an exception to allow most visited tiles to commit in
diff --git content/browser/renderer_host/navigation_request.cc content/browser/renderer_host/navigation_request.cc
index fa22dada07038..470611958482f 100644
index c90fd914ef5b0..42fc2b7467cee 100644
--- content/browser/renderer_host/navigation_request.cc
+++ content/browser/renderer_host/navigation_request.cc
@@ -8128,10 +8128,22 @@ NavigationRequest::GetOriginForURLLoaderFactoryBeforeResponseWithDebugInfo(
@@ -8131,10 +8131,22 @@ NavigationRequest::GetOriginForURLLoaderFactoryBeforeResponseWithDebugInfo(
bool use_opaque_origin =
(sandbox_flags & network::mojom::WebSandboxFlags::kOrigin) ==
network::mojom::WebSandboxFlags::kOrigin;
@@ -47,7 +47,7 @@ index fa22dada07038..470611958482f 100644
}
return origin_and_debug_info;
@@ -8239,6 +8251,15 @@ NavigationRequest::GetOriginForURLLoaderFactoryAfterResponseWithDebugInfo() {
@@ -8242,6 +8254,15 @@ NavigationRequest::GetOriginForURLLoaderFactoryAfterResponseWithDebugInfo() {
DetermineInitiatorRelationship(initiator_rfh,
frame_tree_node_->current_frame_host()));

View File

@@ -1,5 +1,5 @@
diff --git chrome/browser/BUILD.gn chrome/browser/BUILD.gn
index 7c6e3dea2fa88..8eded7f24dfc2 100644
index fe0452e8bd462..bb5f86e59e7f7 100644
--- chrome/browser/BUILD.gn
+++ chrome/browser/BUILD.gn
@@ -12,6 +12,7 @@ import("//build/config/compiler/pgo/pgo.gni")
@@ -10,7 +10,7 @@ index 7c6e3dea2fa88..8eded7f24dfc2 100644
import("//chrome/browser/buildflags.gni")
import("//chrome/browser/downgrade/buildflags.gni")
import("//chrome/browser/request_header_integrity/buildflags.gni")
@@ -2062,6 +2063,7 @@ static_library("browser") {
@@ -2058,6 +2059,7 @@ static_library("browser") {
"//build/config/chromebox_for_meetings:buildflags",
"//build/config/compiler:compiler_buildflags",
"//cc",
@@ -18,7 +18,7 @@ index 7c6e3dea2fa88..8eded7f24dfc2 100644
"//chrome:extra_resources",
"//chrome:resources",
"//chrome:strings",
@@ -2771,6 +2773,10 @@ static_library("browser") {
@@ -2767,6 +2769,10 @@ static_library("browser") {
]
}

View File

@@ -14,7 +14,7 @@ index 583dbb67a9def..c76c7984642a7 100644
std::unique_ptr<BackgroundModeManager> manager) = 0;
#endif
diff --git chrome/browser/browser_process_impl.cc chrome/browser/browser_process_impl.cc
index c37a02792e1ff..9002b26fd85f3 100644
index 8cd42a06863df..f6c33081197cd 100644
--- chrome/browser/browser_process_impl.cc
+++ chrome/browser/browser_process_impl.cc
@@ -1111,18 +1111,14 @@ DownloadRequestLimiter* BrowserProcessImpl::download_request_limiter() {

View File

@@ -13,7 +13,7 @@ index 2480282a19d12..dbd1fbf8a15b5 100644
return false;
}
diff --git chrome/browser/devtools/devtools_window.cc chrome/browser/devtools/devtools_window.cc
index 4acc7a7a3998c..d80104e8f5aa3 100644
index a7c33cf116281..345270714cccd 100644
--- chrome/browser/devtools/devtools_window.cc
+++ chrome/browser/devtools/devtools_window.cc
@@ -38,6 +38,7 @@
@@ -173,7 +173,7 @@ index c54ec37e56ad7..fda899ec278ef 100644
]
}
diff --git chrome/browser/ui/browser.cc chrome/browser/ui/browser.cc
index 681fe10f28260..89da7d87b306b 100644
index 5513b0d21ea63..8b10a082d24a9 100644
--- chrome/browser/ui/browser.cc
+++ chrome/browser/ui/browser.cc
@@ -271,6 +271,25 @@
@@ -271,24 +271,22 @@ index 681fe10f28260..89da7d87b306b 100644
}
bool Browser::TabsNeedBeforeUnloadFired() const {
@@ -1785,6 +1834,16 @@ WebContents* Browser::OpenURLFromTab(
@@ -1785,6 +1834,14 @@ WebContents* Browser::OpenURLFromTab(
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
+#if BUILDFLAG(ENABLE_CEF)
+ if (cef_browser_delegate_) {
+ auto web_contents =
+ cef_browser_delegate_->OpenURLFromTabEx(source, params,
+ navigation_handle_callback);
+ if (!web_contents)
+ return nullptr;
+ if (cef_browser_delegate_ &&
+ !cef_browser_delegate_->OpenURLFromTabEx(source, params,
+ navigation_handle_callback)) {
+ return nullptr;
+ }
+#endif
+
NavigateParams nav_params(this, params.url, params.transition);
nav_params.FillNavigateParamsFromOpenURLParams(params);
nav_params.source_contents = source;
@@ -1947,6 +2006,8 @@ void Browser::LoadingStateChanged(WebContents* source,
@@ -1947,6 +2004,8 @@ void Browser::LoadingStateChanged(WebContents* source,
bool should_show_loading_ui) {
ScheduleUIUpdate(source, content::INVALIDATE_TYPE_LOAD);
UpdateWindowForLoadingStateChanged(source, should_show_loading_ui);
@@ -297,7 +295,7 @@ index 681fe10f28260..89da7d87b306b 100644
}
void Browser::CloseContents(WebContents* source) {
@@ -1975,6 +2036,8 @@ void Browser::SetContentsBounds(WebContents* source, const gfx::Rect& bounds) {
@@ -1975,6 +2034,8 @@ void Browser::SetContentsBounds(WebContents* source, const gfx::Rect& bounds) {
}
void Browser::UpdateTargetURL(WebContents* source, const GURL& url) {
@@ -306,7 +304,7 @@ index 681fe10f28260..89da7d87b306b 100644
if (!GetStatusBubble())
return;
@@ -1982,6 +2045,17 @@ void Browser::UpdateTargetURL(WebContents* source, const GURL& url) {
@@ -1982,6 +2043,17 @@ void Browser::UpdateTargetURL(WebContents* source, const GURL& url) {
GetStatusBubble()->SetURL(url);
}
@@ -324,7 +322,7 @@ index 681fe10f28260..89da7d87b306b 100644
void Browser::ContentsMouseEvent(WebContents* source, const ui::Event& event) {
const ui::EventType type = event.type();
const bool exited = type == ui::EventType::kMouseExited;
@@ -2010,6 +2084,19 @@ bool Browser::TakeFocus(content::WebContents* source, bool reverse) {
@@ -2010,6 +2082,19 @@ bool Browser::TakeFocus(content::WebContents* source, bool reverse) {
return false;
}
@@ -344,7 +342,7 @@ index 681fe10f28260..89da7d87b306b 100644
void Browser::BeforeUnloadFired(WebContents* web_contents,
bool proceed,
bool* proceed_to_fire_unload) {
@@ -2109,12 +2196,24 @@ void Browser::WebContentsCreated(WebContents* source_contents,
@@ -2109,12 +2194,24 @@ void Browser::WebContentsCreated(WebContents* source_contents,
// Make the tab show up in the task manager.
task_manager::WebContentsTags::CreateForTabContents(new_contents);
@@ -369,7 +367,7 @@ index 681fe10f28260..89da7d87b306b 100644
// Don't show the page hung dialog when a HTML popup hangs because
// the dialog will take the focus and immediately close the popup.
RenderWidgetHostView* view = render_widget_host->GetView();
@@ -2127,6 +2226,13 @@ void Browser::RendererUnresponsive(
@@ -2127,6 +2224,13 @@ void Browser::RendererUnresponsive(
void Browser::RendererResponsive(
WebContents* source,
content::RenderWidgetHost* render_widget_host) {
@@ -383,7 +381,7 @@ index 681fe10f28260..89da7d87b306b 100644
RenderWidgetHostView* view = render_widget_host->GetView();
if (view && !render_widget_host->GetView()->IsHTMLFormPopup()) {
TabDialogs::FromWebContents(source)->HideHungRendererDialog(
@@ -2136,6 +2242,15 @@ void Browser::RendererResponsive(
@@ -2136,6 +2240,15 @@ void Browser::RendererResponsive(
content::JavaScriptDialogManager* Browser::GetJavaScriptDialogManager(
WebContents* source) {
@@ -399,7 +397,7 @@ index 681fe10f28260..89da7d87b306b 100644
return javascript_dialogs::TabModalDialogManager::FromWebContents(source);
}
@@ -2171,6 +2286,11 @@ void Browser::DraggableRegionsChanged(
@@ -2171,6 +2284,11 @@ void Browser::DraggableRegionsChanged(
if (app_controller_) {
app_controller_->DraggableRegionsChanged(regions, contents);
}
@@ -411,7 +409,7 @@ index 681fe10f28260..89da7d87b306b 100644
}
void Browser::DidFinishNavigation(
@@ -2251,11 +2371,15 @@ void Browser::EnterFullscreenModeForTab(
@@ -2251,11 +2369,15 @@ void Browser::EnterFullscreenModeForTab(
const blink::mojom::FullscreenOptions& options) {
exclusive_access_manager_->fullscreen_controller()->EnterFullscreenModeForTab(
requesting_frame, options.display_id);
@@ -427,7 +425,7 @@ index 681fe10f28260..89da7d87b306b 100644
}
bool Browser::IsFullscreenForTabOrPending(const WebContents* web_contents) {
@@ -2456,6 +2580,15 @@ void Browser::RequestMediaAccessPermission(
@@ -2456,6 +2578,15 @@ void Browser::RequestMediaAccessPermission(
content::WebContents* web_contents,
const content::MediaStreamRequest& request,
content::MediaResponseCallback callback) {
@@ -443,7 +441,7 @@ index 681fe10f28260..89da7d87b306b 100644
const extensions::Extension* extension =
GetExtensionForOrigin(profile_, request.security_origin);
MediaCaptureDevicesDispatcher::GetInstance()->ProcessMediaAccessRequest(
@@ -2998,9 +3131,11 @@ void Browser::RemoveScheduledUpdatesFor(WebContents* contents) {
@@ -2998,9 +3129,11 @@ void Browser::RemoveScheduledUpdatesFor(WebContents* contents) {
// Browser, Getters for UI (private):
StatusBubble* Browser::GetStatusBubble() {
@@ -456,7 +454,7 @@ index 681fe10f28260..89da7d87b306b 100644
}
// We hide the status bar for web apps windows as this matches native
@@ -3008,6 +3143,12 @@ StatusBubble* Browser::GetStatusBubble() {
@@ -3008,6 +3141,12 @@ StatusBubble* Browser::GetStatusBubble() {
// mode, as the minimal browser UI includes the status bar.
if (web_app::AppBrowserController::IsWebApp(this) &&
!app_controller()->HasMinimalUiButtons()) {
@@ -469,7 +467,7 @@ index 681fe10f28260..89da7d87b306b 100644
return nullptr;
}
@@ -3157,6 +3298,8 @@ void Browser::SetAsDelegate(WebContents* web_contents, bool set_delegate) {
@@ -3157,6 +3296,8 @@ void Browser::SetAsDelegate(WebContents* web_contents, bool set_delegate) {
BookmarkTabHelper::FromWebContents(web_contents)->RemoveObserver(this);
web_contents_collection_.StopObserving(web_contents);
}
@@ -478,7 +476,7 @@ index 681fe10f28260..89da7d87b306b 100644
}
void Browser::TabDetachedAtImpl(content::WebContents* contents,
@@ -3311,6 +3454,14 @@ bool Browser::PictureInPictureBrowserSupportsWindowFeature(
@@ -3311,6 +3452,14 @@ bool Browser::PictureInPictureBrowserSupportsWindowFeature(
bool Browser::SupportsWindowFeatureImpl(WindowFeature feature,
bool check_can_support) const {

View File

@@ -1,8 +1,8 @@
diff --git chrome/browser/renderer_context_menu/render_view_context_menu.cc chrome/browser/renderer_context_menu/render_view_context_menu.cc
index ec801ac598ed6..818c55412f280 100644
index 4932213c27cf0..12963b155a5fe 100644
--- chrome/browser/renderer_context_menu/render_view_context_menu.cc
+++ chrome/browser/renderer_context_menu/render_view_context_menu.cc
@@ -350,6 +350,18 @@ base::OnceCallback<void(RenderViewContextMenu*)>* GetMenuShownCallback() {
@@ -352,6 +352,18 @@ base::OnceCallback<void(RenderViewContextMenu*)>* GetMenuShownCallback() {
return callback.get();
}
@@ -21,7 +21,7 @@ index ec801ac598ed6..818c55412f280 100644
enum class UmaEnumIdLookupType {
GeneralEnumId,
ContextSpecificEnumId,
@@ -615,6 +627,10 @@ int FindUMAEnumValueForCommand(int id, UmaEnumIdLookupType type) {
@@ -617,6 +629,10 @@ int FindUMAEnumValueForCommand(int id, UmaEnumIdLookupType type) {
return 1;
}
@@ -32,7 +32,7 @@ index ec801ac598ed6..818c55412f280 100644
id = CollapseCommandsForUMA(id);
const auto& map = GetIdcToUmaMap(type);
auto it = map.find(id);
@@ -881,6 +897,14 @@ RenderViewContextMenu::RenderViewContextMenu(
@@ -893,6 +909,14 @@ RenderViewContextMenu::RenderViewContextMenu(
: nullptr;
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
@@ -47,7 +47,7 @@ index ec801ac598ed6..818c55412f280 100644
observers_.AddObserver(&autofill_context_menu_manager_);
}
@@ -1342,6 +1366,12 @@ void RenderViewContextMenu::InitMenu() {
@@ -1354,6 +1378,12 @@ void RenderViewContextMenu::InitMenu() {
autofill_client->HideAutofillSuggestions(
autofill::SuggestionHidingReason::kContextMenuOpened);
}
@@ -60,7 +60,7 @@ index ec801ac598ed6..818c55412f280 100644
}
Profile* RenderViewContextMenu::GetProfile() const {
@@ -3615,6 +3645,26 @@ void RenderViewContextMenu::RegisterExecutePluginActionCallbackForTesting(
@@ -3636,6 +3666,26 @@ void RenderViewContextMenu::RegisterExecutePluginActionCallbackForTesting(
execute_plugin_action_callback_ = std::move(cb);
}
@@ -88,7 +88,7 @@ index ec801ac598ed6..818c55412f280 100644
RenderViewContextMenu::GetHandlersForLinkUrl() {
custom_handlers::ProtocolHandlerRegistry::ProtocolHandlerList handlers =
diff --git chrome/browser/renderer_context_menu/render_view_context_menu.h chrome/browser/renderer_context_menu/render_view_context_menu.h
index 1fb447e87c1f9..7e530509425f4 100644
index af505a77c2aa6..d647cfe6bc252 100644
--- chrome/browser/renderer_context_menu/render_view_context_menu.h
+++ chrome/browser/renderer_context_menu/render_view_context_menu.h
@@ -153,7 +153,21 @@ class RenderViewContextMenu
@@ -113,7 +113,7 @@ index 1fb447e87c1f9..7e530509425f4 100644
Profile* GetProfile() const;
// This may return nullptr (e.g. for WebUI dialogs). Virtual to allow tests to
@@ -475,6 +489,9 @@ class RenderViewContextMenu
@@ -476,6 +490,9 @@ class RenderViewContextMenu
// built.
bool is_protocol_submenu_valid_ = false;

View File

@@ -1,8 +1,16 @@
diff --git chrome/browser/download/chrome_download_manager_delegate.cc chrome/browser/download/chrome_download_manager_delegate.cc
index 1becf94d357e9..9cb014e242917 100644
index 1becf94d357e9..10c169b092a3d 100644
--- chrome/browser/download/chrome_download_manager_delegate.cc
+++ chrome/browser/download/chrome_download_manager_delegate.cc
@@ -157,6 +157,10 @@
@@ -31,6 +31,7 @@
#include "base/time/time.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
+#include "cef/libcef/features/features.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/download/bubble/download_bubble_prefs.h"
#include "chrome/browser/download/download_core_service.h"
@@ -157,6 +158,10 @@
#include "chrome/browser/ash/policy/skyvault/skyvault_rename_handler.h"
#endif
@@ -13,7 +21,7 @@ index 1becf94d357e9..9cb014e242917 100644
using content::BrowserThread;
using content::DownloadManager;
using download::DownloadItem;
@@ -513,6 +517,11 @@ ChromeDownloadManagerDelegate::ChromeDownloadManagerDelegate(Profile* profile)
@@ -513,6 +518,11 @@ ChromeDownloadManagerDelegate::ChromeDownloadManagerDelegate(Profile* profile)
download_dialog_bridge_ = std::make_unique<DownloadDialogBridge>();
download_message_bridge_ = std::make_unique<DownloadMessageBridge>();
#endif
@@ -25,7 +33,7 @@ index 1becf94d357e9..9cb014e242917 100644
}
ChromeDownloadManagerDelegate::~ChromeDownloadManagerDelegate() {
@@ -572,6 +581,9 @@ void ChromeDownloadManagerDelegate::Shutdown() {
@@ -572,6 +582,9 @@ void ChromeDownloadManagerDelegate::Shutdown() {
download_manager_->RemoveObserver(this);
download_manager_ = nullptr;
}
@@ -35,7 +43,7 @@ index 1becf94d357e9..9cb014e242917 100644
}
void ChromeDownloadManagerDelegate::OnDownloadCanceledAtShutdown(
@@ -640,6 +652,12 @@ bool ChromeDownloadManagerDelegate::DetermineDownloadTarget(
@@ -640,6 +653,12 @@ bool ChromeDownloadManagerDelegate::DetermineDownloadTarget(
ReportPDFLoadStatus(PDFLoadStatus::kTriggeredNoGestureDriveByDownload);
}
@@ -48,6 +56,20 @@ index 1becf94d357e9..9cb014e242917 100644
DownloadTargetDeterminer::CompletionCallback target_determined_callback =
base::BindOnce(&ChromeDownloadManagerDelegate::OnDownloadTargetDetermined,
weak_ptr_factory_.GetWeakPtr(), download->GetId(),
@@ -1027,8 +1046,11 @@ void ChromeDownloadManagerDelegate::OpenDownload(DownloadItem* download) {
Browser* browser =
web_contents ? chrome::FindBrowserWithTab(web_contents) : nullptr;
std::unique_ptr<chrome::ScopedTabbedBrowserDisplayer> browser_displayer;
- if (!browser ||
- !browser->CanSupportWindowFeature(Browser::FEATURE_TABSTRIP)) {
+ if (!browser
+#if !BUILDFLAG(ENABLE_CEF)
+ || !browser->CanSupportWindowFeature(Browser::FEATURE_TABSTRIP)
+#endif
+ ) {
browser_displayer =
std::make_unique<chrome::ScopedTabbedBrowserDisplayer>(profile_);
browser = browser_displayer->browser();
diff --git chrome/browser/download/chrome_download_manager_delegate.h chrome/browser/download/chrome_download_manager_delegate.h
index 2c99baa2c9fa8..b721db7058d8f 100644
--- chrome/browser/download/chrome_download_manager_delegate.h

View File

@@ -33,10 +33,10 @@ index decd0b51ddc3d..17fce2da6ad0e 100644
~BrowserFrameMac() override;
diff --git chrome/browser/ui/views/frame/browser_frame_mac.mm chrome/browser/ui/views/frame/browser_frame_mac.mm
index 7b52e844d31d1..38862163b6698 100644
index e1939647c8a9c..22f994f0ce220 100644
--- chrome/browser/ui/views/frame/browser_frame_mac.mm
+++ chrome/browser/ui/views/frame/browser_frame_mac.mm
@@ -184,7 +184,14 @@ void BrowserFrameMac::OnWindowFullscreenTransitionComplete() {
@@ -185,7 +185,14 @@ void BrowserFrameMac::OnWindowFullscreenTransitionComplete() {
void BrowserFrameMac::ValidateUserInterfaceItem(
int32_t tag,
remote_cocoa::mojom::ValidateUserInterfaceItemResult* result) {
@@ -52,7 +52,7 @@ index 7b52e844d31d1..38862163b6698 100644
if (!chrome::SupportsCommand(browser, tag)) {
result->enable = false;
return;
@@ -305,8 +312,16 @@ bool BrowserFrameMac::WillExecuteCommand(
@@ -308,8 +315,16 @@ bool BrowserFrameMac::WillExecuteCommand(
int32_t command,
WindowOpenDisposition window_open_disposition,
bool is_before_first_responder) {
@@ -70,7 +70,7 @@ index 7b52e844d31d1..38862163b6698 100644
if (is_before_first_responder) {
// The specification for this private extensions API is incredibly vague.
// For now, we avoid triggering chrome commands prior to giving the
@@ -337,11 +352,20 @@ bool BrowserFrameMac::ExecuteCommand(
@@ -340,11 +355,20 @@ bool BrowserFrameMac::ExecuteCommand(
int32_t command,
WindowOpenDisposition window_open_disposition,
bool is_before_first_responder) {

View File

@@ -481,7 +481,7 @@ index 9a8dfdb6bc3ce..5981a8a0fae38 100644
+#endif
}
diff --git chrome/browser/chrome_content_browser_client.cc chrome/browser/chrome_content_browser_client.cc
index 4b8cf312d4ca4..ef3c7e5e372b4 100644
index c4b98aa0e759f..4b61126a6fa92 100644
--- chrome/browser/chrome_content_browser_client.cc
+++ chrome/browser/chrome_content_browser_client.cc
@@ -46,6 +46,7 @@
@@ -492,7 +492,7 @@ index 4b8cf312d4ca4..ef3c7e5e372b4 100644
#include "chrome/browser/after_startup_task_utils.h"
#include "chrome/browser/ai/ai_manager_keyed_service_factory.h"
#include "chrome/browser/app_mode/app_mode_utils.h"
@@ -1518,6 +1519,8 @@ ChromeContentBrowserClient::GetPopupNavigationDelegateFactoryForTesting() {
@@ -1523,6 +1524,8 @@ ChromeContentBrowserClient::GetPopupNavigationDelegateFactoryForTesting() {
}
ChromeContentBrowserClient::ChromeContentBrowserClient() {
@@ -501,7 +501,7 @@ index 4b8cf312d4ca4..ef3c7e5e372b4 100644
#if BUILDFLAG(ENABLE_PLUGINS)
extra_parts_.push_back(
std::make_unique<ChromeContentBrowserClientPluginsPart>());
@@ -1555,6 +1558,11 @@ ChromeContentBrowserClient::~ChromeContentBrowserClient() {
@@ -1560,6 +1563,11 @@ ChromeContentBrowserClient::~ChromeContentBrowserClient() {
}
}
@@ -513,7 +513,7 @@ index 4b8cf312d4ca4..ef3c7e5e372b4 100644
// static
void ChromeContentBrowserClient::RegisterLocalStatePrefs(
PrefRegistrySimple* registry) {
@@ -3890,28 +3898,25 @@ bool UpdatePreferredColorScheme(WebPreferences* web_prefs,
@@ -3905,28 +3913,25 @@ bool UpdatePreferredColorScheme(WebPreferences* web_prefs,
web_prefs->preferred_color_scheme;
}
#else
@@ -559,7 +559,7 @@ index 4b8cf312d4ca4..ef3c7e5e372b4 100644
#endif // BUILDFLAG(IS_ANDROID)
// Reauth WebUI doesn't support dark mode yet because it shares the dialog
@@ -4693,9 +4698,11 @@ void ChromeContentBrowserClient::BrowserURLHandlerCreated(
@@ -4708,9 +4713,11 @@ void ChromeContentBrowserClient::BrowserURLHandlerCreated(
&search::HandleNewTabURLReverseRewrite);
#endif // BUILDFLAG(IS_ANDROID)
@@ -571,7 +571,7 @@ index 4b8cf312d4ca4..ef3c7e5e372b4 100644
}
base::FilePath ChromeContentBrowserClient::GetDefaultDownloadDirectory() {
@@ -6794,7 +6801,7 @@ void ChromeContentBrowserClient::OnNetworkServiceCreated(
@@ -6810,7 +6817,7 @@ void ChromeContentBrowserClient::OnNetworkServiceCreated(
#endif
}
@@ -580,7 +580,7 @@ index 4b8cf312d4ca4..ef3c7e5e372b4 100644
content::BrowserContext* context,
bool in_memory,
const base::FilePath& relative_partition_path,
@@ -6812,6 +6819,8 @@ void ChromeContentBrowserClient::ConfigureNetworkContextParams(
@@ -6828,6 +6835,8 @@ void ChromeContentBrowserClient::ConfigureNetworkContextParams(
network_context_params->user_agent = GetUserAgentBasedOnPolicy(context);
network_context_params->accept_language = GetApplicationLocale();
}
@@ -589,7 +589,7 @@ index 4b8cf312d4ca4..ef3c7e5e372b4 100644
}
std::vector<base::FilePath>
@@ -7929,10 +7938,10 @@ void ChromeContentBrowserClient::OnKeepaliveRequestStarted(
@@ -7945,10 +7954,10 @@ void ChromeContentBrowserClient::OnKeepaliveRequestStarted(
const auto now = base::TimeTicks::Now();
const auto timeout = GetKeepaliveTimerTimeout(context);
keepalive_deadline_ = std::max(keepalive_deadline_, now + timeout);
@@ -602,7 +602,7 @@ index 4b8cf312d4ca4..ef3c7e5e372b4 100644
FROM_HERE, keepalive_deadline_ - now,
base::BindOnce(
&ChromeContentBrowserClient::OnKeepaliveTimerFired,
@@ -7951,7 +7960,8 @@ void ChromeContentBrowserClient::OnKeepaliveRequestFinished() {
@@ -7967,7 +7976,8 @@ void ChromeContentBrowserClient::OnKeepaliveRequestFinished() {
--num_keepalive_requests_;
if (num_keepalive_requests_ == 0) {
DVLOG(1) << "Stopping the keepalive timer";
@@ -612,7 +612,7 @@ index 4b8cf312d4ca4..ef3c7e5e372b4 100644
// This deletes the keep alive handle attached to the timer function and
// unblock the shutdown sequence.
}
@@ -8100,7 +8110,7 @@ void ChromeContentBrowserClient::OnKeepaliveTimerFired(
@@ -8116,7 +8126,7 @@ void ChromeContentBrowserClient::OnKeepaliveTimerFired(
const auto now = base::TimeTicks::Now();
const auto then = keepalive_deadline_;
if (now < then) {
@@ -622,7 +622,7 @@ index 4b8cf312d4ca4..ef3c7e5e372b4 100644
base::BindOnce(&ChromeContentBrowserClient::OnKeepaliveTimerFired,
weak_factory_.GetWeakPtr(),
diff --git chrome/browser/chrome_content_browser_client.h chrome/browser/chrome_content_browser_client.h
index be75c2ce84ba4..f76963b5023ef 100644
index b668d0f80abf2..a486d9d0bdea7 100644
--- chrome/browser/chrome_content_browser_client.h
+++ chrome/browser/chrome_content_browser_client.h
@@ -150,6 +150,8 @@ class ChromeContentBrowserClient : public content::ContentBrowserClient {
@@ -643,7 +643,7 @@ index be75c2ce84ba4..f76963b5023ef 100644
content::BrowserContext* context,
bool in_memory,
const base::FilePath& relative_partition_path,
@@ -1248,7 +1250,7 @@ class ChromeContentBrowserClient : public content::ContentBrowserClient {
@@ -1249,7 +1251,7 @@ class ChromeContentBrowserClient : public content::ContentBrowserClient {
#if !BUILDFLAG(IS_ANDROID)
uint64_t num_keepalive_requests_ = 0;
@@ -653,7 +653,7 @@ index be75c2ce84ba4..f76963b5023ef 100644
#endif
diff --git chrome/browser/prefs/browser_prefs.cc chrome/browser/prefs/browser_prefs.cc
index 0f37944dfa465..6d36a31dff18c 100644
index 8cf6b5d7d4281..ee979b5d7a4da 100644
--- chrome/browser/prefs/browser_prefs.cc
+++ chrome/browser/prefs/browser_prefs.cc
@@ -16,6 +16,7 @@

View File

@@ -1,5 +1,5 @@
diff --git chrome/browser/ui/browser_command_controller.cc chrome/browser/ui/browser_command_controller.cc
index 0108532731b73..ddfcc75ae9801 100644
index 8837e8baf3025..c48dd62adf626 100644
--- chrome/browser/ui/browser_command_controller.cc
+++ chrome/browser/ui/browser_command_controller.cc
@@ -412,6 +412,7 @@ bool BrowserCommandController::ExecuteCommandWithDisposition(
@@ -41,10 +41,10 @@ index 0108532731b73..ddfcc75ae9801 100644
void BrowserCommandController::InitCommandState() {
diff --git chrome/browser/ui/toolbar/app_menu_model.cc chrome/browser/ui/toolbar/app_menu_model.cc
index 28f18cbca8a49..31cec595eab48 100644
index 3903f81165b4a..873b193af1b05 100644
--- chrome/browser/ui/toolbar/app_menu_model.cc
+++ chrome/browser/ui/toolbar/app_menu_model.cc
@@ -715,10 +715,12 @@ FindAndEditSubMenuModel::FindAndEditSubMenuModel(
@@ -717,10 +717,12 @@ FindAndEditSubMenuModel::FindAndEditSubMenuModel(
ui::SimpleMenuModel::Delegate* delegate)
: SimpleMenuModel(delegate) {
AddItemWithStringIdAndVectorIcon(this, IDC_FIND, IDS_FIND, kSearchMenuIcon);
@@ -57,7 +57,7 @@ index 28f18cbca8a49..31cec595eab48 100644
}
class SaveAndShareSubMenuModel : public ui::SimpleMenuModel {
@@ -783,6 +785,57 @@ SaveAndShareSubMenuModel::SaveAndShareSubMenuModel(
@@ -785,6 +787,57 @@ SaveAndShareSubMenuModel::SaveAndShareSubMenuModel(
}
}
@@ -115,7 +115,7 @@ index 28f18cbca8a49..31cec595eab48 100644
} // namespace
////////////////////////////////////////////////////////////////////////////////
@@ -1676,7 +1729,7 @@ bool AppMenuModel::IsCommandIdChecked(int command_id) const {
@@ -1678,7 +1731,7 @@ bool AppMenuModel::IsCommandIdChecked(int command_id) const {
return false;
}
@@ -124,7 +124,7 @@ index 28f18cbca8a49..31cec595eab48 100644
GlobalError* error =
GlobalErrorServiceFactory::GetForProfile(browser_->profile())
->GetGlobalErrorByMenuItemCommandID(command_id);
@@ -1692,6 +1745,30 @@ bool AppMenuModel::IsCommandIdEnabled(int command_id) const {
@@ -1694,6 +1747,30 @@ bool AppMenuModel::IsCommandIdEnabled(int command_id) const {
}
}
@@ -155,7 +155,7 @@ index 28f18cbca8a49..31cec595eab48 100644
bool AppMenuModel::IsCommandIdAlerted(int command_id) const {
if (command_id == IDC_VIEW_PASSWORDS ||
command_id == IDC_SHOW_PASSWORD_MANAGER) {
@@ -1854,8 +1931,10 @@ void AppMenuModel::Build() {
@@ -1856,8 +1933,10 @@ void AppMenuModel::Build() {
IDS_CLEAR_BROWSING_DATA,
kTrashCanRefreshIcon);
@@ -166,7 +166,7 @@ index 28f18cbca8a49..31cec595eab48 100644
AddSeparator(ui::NORMAL_SEPARATOR);
AddItemWithStringIdAndVectorIcon(this, IDC_PRINT, IDS_PRINT, kPrintMenuIcon);
@@ -1967,6 +2046,11 @@ void AppMenuModel::Build() {
@@ -1972,6 +2051,11 @@ void AppMenuModel::Build() {
}
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
@@ -397,7 +397,7 @@ index 14a8a70d853f6..bf81594947886 100644
// regenerated.
bool RegenerateFrameOnThemeChange(BrowserThemeChangeType theme_change_type);
diff --git chrome/browser/ui/views/frame/browser_view.cc chrome/browser/ui/views/frame/browser_view.cc
index ab37088b71722..f4e1786b902c9 100644
index 41c6c06ccfb21..382c02cece70a 100644
--- chrome/browser/ui/views/frame/browser_view.cc
+++ chrome/browser/ui/views/frame/browser_view.cc
@@ -354,11 +354,10 @@ using content::WebContents;
@@ -564,7 +564,7 @@ index ab37088b71722..f4e1786b902c9 100644
top_container()->DestroyLayer();
AddChildViewAt(top_container(), 0);
EnsureFocusOrder();
@@ -4280,11 +4323,38 @@ void BrowserView::GetAccessiblePanes(std::vector<views::View*>* panes) {
@@ -4284,11 +4327,38 @@ void BrowserView::GetAccessiblePanes(std::vector<views::View*>* panes) {
bool BrowserView::ShouldDescendIntoChildForEventHandling(
gfx::NativeView child,
const gfx::Point& location) {
@@ -605,7 +605,7 @@ index ab37088b71722..f4e1786b902c9 100644
// Draggable regions are defined relative to the web contents.
gfx::Point point_in_contents_web_view_coords(location);
views::View::ConvertPointToTarget(GetWidget()->GetRootView(),
@@ -4293,7 +4363,7 @@ bool BrowserView::ShouldDescendIntoChildForEventHandling(
@@ -4297,7 +4367,7 @@ bool BrowserView::ShouldDescendIntoChildForEventHandling(
// Draggable regions should be ignored for clicks into any browser view's
// owned widgets, for example alerts, permission prompts or find bar.
@@ -614,7 +614,7 @@ index ab37088b71722..f4e1786b902c9 100644
point_in_contents_web_view_coords.x(),
point_in_contents_web_view_coords.y()) ||
WidgetOwnedByAnchorContainsPoint(point_in_contents_web_view_coords);
@@ -4404,8 +4474,10 @@ void BrowserView::Layout(PassKey) {
@@ -4408,8 +4478,10 @@ void BrowserView::Layout(PassKey) {
// TODO(jamescook): Why was this in the middle of layout code?
toolbar_->location_bar()->omnibox_view()->SetFocusBehavior(
@@ -627,7 +627,7 @@ index ab37088b71722..f4e1786b902c9 100644
// Some of the situations when the BrowserView is laid out are:
// - Enter/exit immersive fullscreen mode.
@@ -4471,6 +4543,11 @@ void BrowserView::AddedToWidget() {
@@ -4475,6 +4547,11 @@ void BrowserView::AddedToWidget() {
SetThemeProfileForWindow(GetNativeWindow(), browser_->profile());
#endif
@@ -639,7 +639,7 @@ index ab37088b71722..f4e1786b902c9 100644
toolbar_->Init();
// TODO(pbos): Investigate whether the side panels should be creatable when
@@ -4512,13 +4589,9 @@ void BrowserView::AddedToWidget() {
@@ -4516,13 +4593,9 @@ void BrowserView::AddedToWidget() {
EnsureFocusOrder();
@@ -655,7 +655,7 @@ index ab37088b71722..f4e1786b902c9 100644
using_native_frame_ = frame_->ShouldUseNativeFrame();
MaybeInitializeWebUITabStrip();
@@ -4886,7 +4959,8 @@ void BrowserView::ProcessFullscreen(bool fullscreen, const int64_t display_id) {
@@ -4890,7 +4963,8 @@ void BrowserView::ProcessFullscreen(bool fullscreen, const int64_t display_id) {
// Undo our anti-jankiness hacks and force a re-layout.
in_process_fullscreen_ = false;
ToolbarSizeChanged(false);
@@ -665,7 +665,7 @@ index ab37088b71722..f4e1786b902c9 100644
}
void BrowserView::RequestFullscreen(bool fullscreen, int64_t display_id) {
@@ -5387,6 +5461,8 @@ Profile* BrowserView::GetProfile() {
@@ -5391,6 +5465,8 @@ Profile* BrowserView::GetProfile() {
}
void BrowserView::UpdateUIForTabFullscreen() {
@@ -674,7 +674,7 @@ index ab37088b71722..f4e1786b902c9 100644
frame()->GetFrameView()->UpdateFullscreenTopUI();
}
@@ -5409,6 +5485,8 @@ void BrowserView::HideDownloadShelf() {
@@ -5413,6 +5489,8 @@ void BrowserView::HideDownloadShelf() {
}
bool BrowserView::CanUserExitFullscreen() const {
@@ -961,10 +961,10 @@ index 0bd4cfc52548b..8515cec793563 100644
case PageActionIconType::kPaymentsOfferNotification:
add_page_action_icon(
diff --git chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc
index 28cff32121b69..443e43779e8f5 100644
index 190843e6c42f7..da4e026a790a3 100644
--- chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc
+++ chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc
@@ -606,29 +606,41 @@ gfx::Range BrowserTabStripController::ListTabsInGroup(
@@ -600,29 +600,41 @@ gfx::Range BrowserTabStripController::ListTabsInGroup(
}
bool BrowserTabStripController::IsFrameCondensed() const {
@@ -1007,7 +1007,7 @@ index 28cff32121b69..443e43779e8f5 100644
}
diff --git chrome/browser/ui/views/toolbar/toolbar_view.cc chrome/browser/ui/views/toolbar/toolbar_view.cc
index 0ef2fcb160af2..010279ae8e5dc 100644
index df6dffc7d04ec..823b254ceb667 100644
--- chrome/browser/ui/views/toolbar/toolbar_view.cc
+++ chrome/browser/ui/views/toolbar/toolbar_view.cc
@@ -192,7 +192,7 @@ class TabstripLikeBackground : public views::Background {
@@ -1035,7 +1035,7 @@ index 0ef2fcb160af2..010279ae8e5dc 100644
SetID(VIEW_ID_TOOLBAR);
container_view_ = AddChildView(std::make_unique<ContainerView>());
@@ -255,9 +256,24 @@ ToolbarView::~ToolbarView() {
@@ -257,9 +258,24 @@ ToolbarView::~ToolbarView() {
for (const auto& view_and_command : GetViewCommandMap())
chrome::RemoveCommandObserver(browser_, view_and_command.second, this);
@@ -1060,7 +1060,7 @@ index 0ef2fcb160af2..010279ae8e5dc 100644
#if defined(USE_AURA)
// Avoid generating too many occlusion tracking calculation events before this
// function returns. The occlusion status will be computed only once once this
@@ -280,12 +296,12 @@ void ToolbarView::Init() {
@@ -282,12 +298,12 @@ void ToolbarView::Init() {
auto location_bar = std::make_unique<LocationBarView>(
browser_, browser_->profile(), browser_->command_controller(), this,
@@ -1075,7 +1075,7 @@ index 0ef2fcb160af2..010279ae8e5dc 100644
download_button =
std::make_unique<DownloadToolbarButtonView>(browser_view_);
}
@@ -365,8 +381,10 @@ void ToolbarView::Init() {
@@ -367,8 +383,10 @@ void ToolbarView::Init() {
toolbar_divider = std::make_unique<views::View>();
}
std::unique_ptr<media_router::CastToolbarButton> cast;
@@ -1087,7 +1087,7 @@ index 0ef2fcb160af2..010279ae8e5dc 100644
std::unique_ptr<MediaToolbarButtonView> media_button;
if (base::FeatureList::IsEnabled(media::kGlobalMediaControls)) {
@@ -376,7 +394,8 @@ void ToolbarView::Init() {
@@ -378,7 +396,8 @@ void ToolbarView::Init() {
std::unique_ptr<send_tab_to_self::SendTabToSelfToolbarIconView>
send_tab_to_self_button;
@@ -1097,7 +1097,7 @@ index 0ef2fcb160af2..010279ae8e5dc 100644
send_tab_to_self_button =
std::make_unique<send_tab_to_self::SendTabToSelfToolbarIconView>(
browser_view_);
@@ -810,7 +829,8 @@ void ToolbarView::Layout(PassKey) {
@@ -812,7 +831,8 @@ void ToolbarView::Layout(PassKey) {
if (display_mode_ == DisplayMode::NORMAL) {
LayoutCommon();

View File

@@ -114,7 +114,7 @@ index 77e3d993b3dc0..349043f3d965b 100644
// on blink::features::kUserAgentReduction. Content may cache this value.
virtual std::string GetUserAgent();
diff --git content/public/renderer/content_renderer_client.h content/public/renderer/content_renderer_client.h
index dd8f6b9a87a0c..c1f93a716b485 100644
index b0bfdb4f1263c..ba47b62fce436 100644
--- content/public/renderer/content_renderer_client.h
+++ content/public/renderer/content_renderer_client.h
@@ -108,6 +108,9 @@ class CONTENT_EXPORT ContentRendererClient {
@@ -127,7 +127,7 @@ index dd8f6b9a87a0c..c1f93a716b485 100644
// Notifies that a new RenderFrame has been created.
virtual void RenderFrameCreated(RenderFrame* render_frame) {}
@@ -345,6 +348,10 @@ class CONTENT_EXPORT ContentRendererClient {
@@ -354,6 +357,10 @@ class CONTENT_EXPORT ContentRendererClient {
// This method may invalidate the frame.
virtual void RunScriptsAtDocumentIdle(RenderFrame* render_frame) {}
@@ -152,10 +152,10 @@ index f2b7b6d436431..988447abd44b9 100644
base::BindRepeating(&RenderThreadImpl::OnRendererInterfaceReceiver,
base::Unretained(this)));
diff --git content/renderer/renderer_blink_platform_impl.cc content/renderer/renderer_blink_platform_impl.cc
index 06000a2c90989..df8daf5b60a1e 100644
index a59e3e52b9f98..8a110e1d57a41 100644
--- content/renderer/renderer_blink_platform_impl.cc
+++ content/renderer/renderer_blink_platform_impl.cc
@@ -1030,6 +1030,15 @@ SkBitmap* RendererBlinkPlatformImpl::GetSadPageBitmap() {
@@ -1036,6 +1036,15 @@ SkBitmap* RendererBlinkPlatformImpl::GetSadPageBitmap() {
//------------------------------------------------------------------------------
@@ -172,10 +172,10 @@ index 06000a2c90989..df8daf5b60a1e 100644
RendererBlinkPlatformImpl::CreateWebV8ValueConverter() {
return std::make_unique<V8ValueConverterImpl>();
diff --git content/renderer/renderer_blink_platform_impl.h content/renderer/renderer_blink_platform_impl.h
index 75504bfc89cbe..8a315105f4390 100644
index 69c52cb8333fc..ac2bbc7459864 100644
--- content/renderer/renderer_blink_platform_impl.h
+++ content/renderer/renderer_blink_platform_impl.h
@@ -243,6 +243,9 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl {
@@ -245,6 +245,9 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl {
InertAndMinimumIntervalOfUserLevelMemoryPressureSignal() override;
#endif // BUILDFLAG(IS_ANDROID)

View File

@@ -12,7 +12,7 @@ index 79ba3ac1913f8..46bcb4366d2f8 100644
if (main_argv)
setproctitle_init(main_argv);
diff --git content/app/content_main.cc content/app/content_main.cc
index 4251459b695e6..d74286fec151b 100644
index 4251459b695e6..4b61268b74378 100644
--- content/app/content_main.cc
+++ content/app/content_main.cc
@@ -174,11 +174,8 @@ ContentMainParams::~ContentMainParams() = default;
@@ -39,7 +39,18 @@ index 4251459b695e6..d74286fec151b 100644
// A flag to indicate whether Main() has been called before. On Android, we
// may re-run Main() without restarting the browser process. This flag
@@ -275,14 +269,6 @@ RunContentProcess(ContentMainParams params,
@@ -267,7 +261,9 @@ RunContentProcess(ContentMainParams params,
// default, "C", locale.
setlocale(LC_NUMERIC, "C");
- SetupSignalHandlers();
+ if (!params.disable_signal_handlers) {
+ SetupSignalHandlers();
+ }
#endif
#if BUILDFLAG(IS_WIN)
@@ -275,14 +271,6 @@ RunContentProcess(ContentMainParams params,
#endif
#if BUILDFLAG(IS_MAC)
@@ -54,7 +65,7 @@ index 4251459b695e6..d74286fec151b 100644
InitializeMac();
#endif
@@ -330,12 +316,46 @@ RunContentProcess(ContentMainParams params,
@@ -330,12 +318,46 @@ RunContentProcess(ContentMainParams params,
if (IsSubprocess())
CommonSubprocessInit();
@@ -149,10 +160,22 @@ index cbbc2f3ec12fa..f097b3cdded2f 100644
int RunBrowser(MainFunctionParams main_function_params,
bool start_minimal_browser);
diff --git content/public/app/content_main.h content/public/app/content_main.h
index 7f9b515297357..89b52e34fa31a 100644
index 7f9b515297357..5606867e43780 100644
--- content/public/app/content_main.h
+++ content/public/app/content_main.h
@@ -94,6 +94,13 @@ struct CONTENT_EXPORT ContentMainParams {
@@ -66,6 +66,11 @@ struct CONTENT_EXPORT ContentMainParams {
// are left uninitialized.
bool minimal_browser_mode = false;
+#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_ANDROID)
+ // Indicates whether to disable signal handlers
+ bool disable_signal_handlers = false;
+#endif
+
#if BUILDFLAG(IS_MAC)
// The outermost autorelease pool to pass to main entry points.
STACK_ALLOCATED_IGNORE("https://crbug.com/1424190")
@@ -94,6 +99,13 @@ struct CONTENT_EXPORT ContentMainParams {
}
};

View File

@@ -1,8 +1,8 @@
diff --git base/message_loop/message_pump_apple.mm base/message_loop/message_pump_apple.mm
index e7fe3f71d8710..3a145fc9282ee 100644
index 987a3ed711f33..95e058b0b8bbd 100644
--- base/message_loop/message_pump_apple.mm
+++ base/message_loop/message_pump_apple.mm
@@ -761,7 +761,8 @@ void MessagePumpUIApplication::Detach() {
@@ -762,7 +762,8 @@ void MessagePumpUIApplication::Detach() {
#else
ScopedPumpMessagesInPrivateModes::ScopedPumpMessagesInPrivateModes() {
@@ -12,7 +12,7 @@ index e7fe3f71d8710..3a145fc9282ee 100644
DCHECK_EQ(kNSApplicationModalSafeModeMask, g_app_pump->GetModeMask());
// Pumping events in private runloop modes is known to interact badly with
// app modal windows like NSAlert.
@@ -772,7 +773,8 @@ ScopedPumpMessagesInPrivateModes::ScopedPumpMessagesInPrivateModes() {
@@ -773,7 +774,8 @@ ScopedPumpMessagesInPrivateModes::ScopedPumpMessagesInPrivateModes() {
}
ScopedPumpMessagesInPrivateModes::~ScopedPumpMessagesInPrivateModes() {

View File

@@ -1,5 +1,5 @@
diff --git ui/base/resource/resource_bundle.cc ui/base/resource/resource_bundle.cc
index a0aa0b111a123..09a8e2fdc2d2c 100644
index e59ddf291c4b5..97a9e43c2eea2 100644
--- ui/base/resource/resource_bundle.cc
+++ ui/base/resource/resource_bundle.cc
@@ -944,6 +944,12 @@ ResourceBundle::ResourceBundle(Delegate* delegate)

View File

@@ -1,5 +1,5 @@
diff --git content/browser/renderer_host/render_widget_host_view_aura.cc content/browser/renderer_host/render_widget_host_view_aura.cc
index 07de8257e5952..02fa4b4813566 100644
index fec211fb0f224..6daf208412582 100644
--- content/browser/renderer_host/render_widget_host_view_aura.cc
+++ content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -6,6 +6,7 @@
@@ -35,7 +35,7 @@ index 07de8257e5952..02fa4b4813566 100644
}
#if BUILDFLAG(IS_WIN)
@@ -2366,6 +2370,16 @@ void RenderWidgetHostViewAura::CreateAuraWindow(aura::client::WindowType type) {
@@ -2370,6 +2374,16 @@ void RenderWidgetHostViewAura::CreateAuraWindow(aura::client::WindowType type) {
window_->layer()->SetColor(GetBackgroundColor() ? *GetBackgroundColor()
: SK_ColorWHITE);
UpdateFrameSinkIdRegistration();

View File

@@ -0,0 +1,33 @@
diff --git third_party/sentencepiece/src/src/util.cc third_party/sentencepiece/src/src/util.cc
index c5e5289807a0c..e10880abc17eb 100644
--- third_party/sentencepiece/src/src/util.cc
+++ third_party/sentencepiece/src/src/util.cc
@@ -16,6 +16,7 @@
#include <atomic>
#include <iostream>
+#include <memory>
namespace sentencepiece {
@@ -197,8 +198,18 @@ std::mt19937 *GetRandomGenerator() {
}
#else
std::mt19937 *GetRandomGenerator() {
- thread_local static std::mt19937 mt(GetRandomGeneratorSeed());
- return &mt;
+ // Thread-locals occupy stack space in every thread ever created by the
+ // program, even if that thread never uses the thread-local variable.
+ //
+ // https://maskray.me/blog/2021-02-14-all-about-thread-local-storage
+ //
+ // sizeof(std::mt19937) is several kilobytes, so it is safer to put that on
+ // the heap, leaving only a pointer to it in thread-local storage. This must
+ // be a unique_ptr, not a raw pointer, so that the generator is not leaked on
+ // thread exit.
+ thread_local static auto mt =
+ std::make_unique<std::mt19937>(GetRandomGeneratorSeed());
+ return mt.get();
}
#endif
} // namespace random

View File

@@ -23,7 +23,7 @@ index cef40af382b1e..a2cf4691edc37 100644
case ui::SHOW_STATE_END:
return ui::SHOW_STATE_NORMAL;
diff --git components/sessions/core/session_service_commands.cc components/sessions/core/session_service_commands.cc
index 618e95c4e4b10..028612a57382e 100644
index cb28533323769..bbaf7c78bde84 100644
--- components/sessions/core/session_service_commands.cc
+++ components/sessions/core/session_service_commands.cc
@@ -165,9 +165,10 @@ enum PersistedWindowShowState {
@@ -61,10 +61,10 @@ index 791fc1874851e..db58beed440f8 100644
case ui::SHOW_STATE_MAXIMIZED:
return kSerializedShowStateMaximized;
diff --git content/browser/renderer_host/render_widget_host_view_base.cc content/browser/renderer_host/render_widget_host_view_base.cc
index ae1a7849dab02..89db94663ad59 100644
index 63cd2577218a5..86c5e7ebbe226 100644
--- content/browser/renderer_host/render_widget_host_view_base.cc
+++ content/browser/renderer_host/render_widget_host_view_base.cc
@@ -708,6 +708,14 @@ float RenderWidgetHostViewBase::GetScaleOverrideForCapture() const {
@@ -709,6 +709,14 @@ float RenderWidgetHostViewBase::GetScaleOverrideForCapture() const {
return scale_override_for_capture_;
}
@@ -80,7 +80,7 @@ index ae1a7849dab02..89db94663ad59 100644
if (!GetMouseWheelPhaseHandler())
return;
diff --git content/browser/renderer_host/render_widget_host_view_base.h content/browser/renderer_host/render_widget_host_view_base.h
index 41308c925e5e3..bd958ba6acaa8 100644
index f1e4add662295..d2b84d0f6b19f 100644
--- content/browser/renderer_host/render_widget_host_view_base.h
+++ content/browser/renderer_host/render_widget_host_view_base.h
@@ -76,6 +76,7 @@ namespace content {
@@ -91,7 +91,7 @@ index 41308c925e5e3..bd958ba6acaa8 100644
class ScopedViewTransitionResources;
class TextInputManager;
class TouchSelectionControllerClientManager;
@@ -203,6 +204,9 @@ class CONTENT_EXPORT RenderWidgetHostViewBase
@@ -204,6 +205,9 @@ class CONTENT_EXPORT RenderWidgetHostViewBase
float GetDeviceScaleFactor() const final;
bool IsPointerLocked() override;
@@ -101,7 +101,7 @@ index 41308c925e5e3..bd958ba6acaa8 100644
// Identical to `CopyFromSurface()`, except that this method issues the
// `viz::CopyOutputRequest` against the exact `viz::Surface` currently
// embedded by this View, while `CopyFromSurface()` may return a copy of any
@@ -264,6 +268,10 @@ class CONTENT_EXPORT RenderWidgetHostViewBase
@@ -265,6 +269,10 @@ class CONTENT_EXPORT RenderWidgetHostViewBase
// Called when screen information or native widget bounds change.
virtual void UpdateScreenInfo();
@@ -112,7 +112,7 @@ index 41308c925e5e3..bd958ba6acaa8 100644
// Called by the TextInputManager to notify the view about being removed from
// the list of registered views, i.e., TextInputManager is no longer tracking
// TextInputState from this view. The RWHV should reset |text_input_manager_|
@@ -388,6 +396,12 @@ class CONTENT_EXPORT RenderWidgetHostViewBase
@@ -389,6 +397,12 @@ class CONTENT_EXPORT RenderWidgetHostViewBase
const gfx::Rect& bounds,
const gfx::Rect& anchor_rect) = 0;
@@ -125,7 +125,7 @@ index 41308c925e5e3..bd958ba6acaa8 100644
// Indicates whether the page has finished loading.
virtual void SetIsLoading(bool is_loading) = 0;
@@ -648,6 +662,10 @@ class CONTENT_EXPORT RenderWidgetHostViewBase
@@ -649,6 +663,10 @@ class CONTENT_EXPORT RenderWidgetHostViewBase
// to all displays.
gfx::Size system_cursor_size_;
@@ -136,7 +136,7 @@ index 41308c925e5e3..bd958ba6acaa8 100644
private:
FRIEND_TEST_ALL_PREFIXES(
BrowserSideFlingBrowserTest,
@@ -669,10 +687,6 @@ class CONTENT_EXPORT RenderWidgetHostViewBase
@@ -670,10 +688,6 @@ class CONTENT_EXPORT RenderWidgetHostViewBase
void SynchronizeVisualProperties();
@@ -365,7 +365,7 @@ index 6eb1cf9451db1..97b1c9bcebb1d 100644
// Calculate initial bounds.
diff --git ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc
index 269aabace2510..8e9c115c381fd 100644
index bb3eabc909922..45d063518c0ea 100644
--- ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc
+++ ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc
@@ -20,6 +20,7 @@
@@ -423,7 +423,7 @@ index 269aabace2510..8e9c115c381fd 100644
// Stack immediately above its parent so that it does not cover other
// root-level windows, with the exception of menus, to allow them to be
// displayed on top of other windows.
@@ -1025,10 +1046,23 @@ void DesktopWindowTreeHostWin::HandleWindowMinimizedOrRestored(bool restored) {
@@ -1029,10 +1050,23 @@ void DesktopWindowTreeHostWin::HandleWindowMinimizedOrRestored(bool restored) {
if (!native_widget_delegate_->IsNativeWidgetInitialized())
return;
@@ -449,7 +449,7 @@ index 269aabace2510..8e9c115c381fd 100644
}
void DesktopWindowTreeHostWin::HandleClientSizeChanged(
@@ -1045,11 +1079,15 @@ void DesktopWindowTreeHostWin::HandleFrameChanged() {
@@ -1049,11 +1083,15 @@ void DesktopWindowTreeHostWin::HandleFrameChanged() {
}
void DesktopWindowTreeHostWin::HandleNativeFocus(HWND last_focused_window) {
@@ -467,7 +467,7 @@ index 269aabace2510..8e9c115c381fd 100644
}
bool DesktopWindowTreeHostWin::HandleMouseEvent(ui::MouseEvent* event) {
@@ -1057,6 +1095,12 @@ bool DesktopWindowTreeHostWin::HandleMouseEvent(ui::MouseEvent* event) {
@@ -1061,6 +1099,12 @@ bool DesktopWindowTreeHostWin::HandleMouseEvent(ui::MouseEvent* event) {
if (ui::PlatformEventSource::ShouldIgnoreNativePlatformEvents())
return true;
@@ -480,7 +480,7 @@ index 269aabace2510..8e9c115c381fd 100644
SendEventToSink(event);
return event->handled();
}
@@ -1235,8 +1279,16 @@ void DesktopWindowTreeHostWin::SetBoundsInDIP(const gfx::Rect& bounds) {
@@ -1239,9 +1283,17 @@ void DesktopWindowTreeHostWin::SetBoundsInDIP(const gfx::Rect& bounds) {
// positions in variable-DPI situations. See https://crbug.com/1224715 for
// details.
aura::Window* root = nullptr;
@@ -490,7 +490,8 @@ index 269aabace2510..8e9c115c381fd 100644
+ root = AsWindowTreeHost()->window();
+ }
+ gfx::Rect bounds_in_pixels =
display::Screen::GetScreen()->DIPToScreenRectInWindow(root, bounds);
display::Screen::GetScreen()->DIPToScreenRectInWindow(
root, AdjustedContentBounds(bounds));
+ if (has_external_parent_) {
+ // Child windows always have origin (0,0).
+ bounds_in_pixels.set_origin(gfx::Point(0, 0));
@@ -499,10 +500,10 @@ index 269aabace2510..8e9c115c381fd 100644
}
diff --git ui/views/widget/desktop_aura/desktop_window_tree_host_win.h ui/views/widget/desktop_aura/desktop_window_tree_host_win.h
index 8169f17982253..fd8c22449a6a3 100644
index e5b304f90ef8f..205d92e42b7a9 100644
--- ui/views/widget/desktop_aura/desktop_window_tree_host_win.h
+++ ui/views/widget/desktop_aura/desktop_window_tree_host_win.h
@@ -324,6 +324,14 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin
@@ -327,6 +327,14 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin
// True if the window should have the frame removed.
bool remove_standard_frame_;
@@ -518,7 +519,7 @@ index 8169f17982253..fd8c22449a6a3 100644
// the implementation of ::ShowCursor() is based on a counter, so making this
// member static ensures that ::ShowCursor() is always called exactly once
diff --git ui/views/widget/native_widget_mac.mm ui/views/widget/native_widget_mac.mm
index e13f3a3fe4e9a..8827c0355b665 100644
index 002eab9f27f11..71c316a2292e3 100644
--- ui/views/widget/native_widget_mac.mm
+++ ui/views/widget/native_widget_mac.mm
@@ -656,6 +656,7 @@ void NativeWidgetMac::Show(ui::WindowShowState show_state,
@@ -600,7 +601,7 @@ index 2fac5a83aac46..8db0925bf0edd 100644
// focus when the window is restored.
if (v)
diff --git ui/views/widget/widget.h ui/views/widget/widget.h
index 721aa7432abbe..70dbf0eeb737e 100644
index c52927b8e10b0..deddd8aa129f2 100644
--- ui/views/widget/widget.h
+++ ui/views/widget/widget.h
@@ -370,6 +370,8 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate,
@@ -612,7 +613,7 @@ index 721aa7432abbe..70dbf0eeb737e 100644
// Specifies the initial bounds of the Widget. Default is empty, which means
// the NativeWidget may specify a default size. If the parent is specified,
// |bounds| is in the parent's coordinate system. If the parent is not
@@ -776,7 +778,7 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate,
@@ -783,7 +785,7 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate,
void ShowInactive();
// Activates the widget, assuming it already exists and is visible.

View File

@@ -150,7 +150,7 @@ index 796ae2688436e..37a3406790210 100644
TRACE_EVENT_ASYNC_BEGIN0("viz", "SoftwareOutputDeviceWinProxy::Draw", this);
diff --git content/browser/compositor/viz_process_transport_factory.cc content/browser/compositor/viz_process_transport_factory.cc
index b9ad5c8cbeb5b..05ab69062b3b2 100644
index 2ea7347d2abe0..ab412fabe399b 100644
--- content/browser/compositor/viz_process_transport_factory.cc
+++ content/browser/compositor/viz_process_transport_factory.cc
@@ -390,8 +390,13 @@ void VizProcessTransportFactory::OnEstablishedGpuChannel(

View File

@@ -1,8 +1,8 @@
diff --git content/browser/web_contents/web_contents_impl.cc content/browser/web_contents/web_contents_impl.cc
index 7318d2937012d..f7a002cb0566d 100644
index b66f7c515370f..4a66fdf43d2e3 100644
--- content/browser/web_contents/web_contents_impl.cc
+++ content/browser/web_contents/web_contents_impl.cc
@@ -3601,6 +3601,12 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params,
@@ -3617,6 +3617,12 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params,
params.main_frame_name, GetOpener(), primary_main_frame_policy,
base::UnguessableToken::Create());
@@ -15,7 +15,7 @@ index 7318d2937012d..f7a002cb0566d 100644
std::unique_ptr<WebContentsViewDelegate> delegate =
GetContentClient()->browser()->GetWebContentsViewDelegate(this);
@@ -3611,6 +3617,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params,
@@ -3627,6 +3633,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params,
view_ = CreateWebContentsView(this, std::move(delegate),
&render_view_host_delegate_view_);
}
@@ -23,7 +23,7 @@ index 7318d2937012d..f7a002cb0566d 100644
CHECK(render_view_host_delegate_view_);
CHECK(view_.get());
@@ -3807,6 +3814,9 @@ void WebContentsImpl::RenderWidgetCreated(
@@ -3823,6 +3830,9 @@ void WebContentsImpl::RenderWidgetCreated(
OPTIONAL_TRACE_EVENT1("content", "WebContentsImpl::RenderWidgetCreated",
"render_widget_host", render_widget_host);
created_widgets_.insert(render_widget_host);
@@ -33,7 +33,7 @@ index 7318d2937012d..f7a002cb0566d 100644
}
void WebContentsImpl::RenderWidgetDeleted(
@@ -4672,6 +4682,15 @@ FrameTree* WebContentsImpl::CreateNewWindow(
@@ -4688,6 +4698,15 @@ FrameTree* WebContentsImpl::CreateNewWindow(
create_params.picture_in_picture_options = *(params.pip_options);
}
@@ -49,7 +49,7 @@ index 7318d2937012d..f7a002cb0566d 100644
// Check whether there is an available prerendered page for this navigation if
// this is not for guest. If it exists, take WebContents pre-created for
// hosting the prerendered page instead of creating new WebContents.
@@ -9027,6 +9046,9 @@ void WebContentsImpl::SetFocusedFrame(FrameTreeNode* node,
@@ -9043,6 +9062,9 @@ void WebContentsImpl::SetFocusedFrame(FrameTreeNode* node,
}
CloseListenerManager::DidChangeFocusedFrame(this);
@@ -60,7 +60,7 @@ index 7318d2937012d..f7a002cb0566d 100644
FrameTree* WebContentsImpl::GetOwnedPictureInPictureFrameTree() {
diff --git content/public/browser/web_contents.h content/public/browser/web_contents.h
index d7403bb66b945..a3369846ff61f 100644
index 0e02f377b7549..b65dea7ef32af 100644
--- content/public/browser/web_contents.h
+++ content/public/browser/web_contents.h
@@ -109,10 +109,12 @@ class BrowserContext;

View File

@@ -1,8 +1,8 @@
diff --git third_party/blink/public/platform/platform.h third_party/blink/public/platform/platform.h
index 848edcdaf3a01..4c08bddc07337 100644
index 700e93a9ed053..9d5d1f67adb07 100644
--- third_party/blink/public/platform/platform.h
+++ third_party/blink/public/platform/platform.h
@@ -804,6 +804,11 @@ class BLINK_PLATFORM_EXPORT Platform {
@@ -810,6 +810,11 @@ class BLINK_PLATFORM_EXPORT Platform {
}
#endif

View File

@@ -0,0 +1,28 @@
diff --git base/profiler/stack_copier.cc base/profiler/stack_copier.cc
index 6cc3a6acef3a5..2495f4fbdf518 100644
--- base/profiler/stack_copier.cc
+++ base/profiler/stack_copier.cc
@@ -14,7 +14,9 @@
#include "base/bits.h"
#include "base/compiler_specific.h"
#include "base/profiler/stack_buffer.h"
+#if PA_BUILDFLAG(USE_PARTITION_ALLOC)
#include "partition_alloc/tagging.h"
+#endif
namespace base {
@@ -76,11 +78,13 @@ const uint8_t* StackCopier::CopyStackContentsAndRewritePointers(
const uintptr_t* original_stack_top,
size_t platform_stack_alignment,
uintptr_t* stack_buffer_bottom) {
+ #if PA_BUILDFLAG(USE_PARTITION_ALLOC)
// Disable MTE during this function because this function indiscriminately
// reads stack frames, some of which belong to system libraries, not Chrome
// itself. With stack tagging, some bytes on the stack have MTE tags different
// from the stack pointer tag.
partition_alloc::SuspendTagCheckingScope suspend_tag_checking_scope;
+#endif
const uint8_t* byte_src = original_stack_bottom;
// The first address in the stack with pointer alignment. Pointer-aligned

View File

@@ -14,7 +14,13 @@ BaseClientHandler::BaseClientHandler() {
// static
CefRefPtr<BaseClientHandler> BaseClientHandler::GetForBrowser(
CefRefPtr<CefBrowser> browser) {
return static_cast<BaseClientHandler*>(browser->GetHost()->GetClient().get());
return GetForClient(browser->GetHost()->GetClient());
}
// static
CefRefPtr<BaseClientHandler> BaseClientHandler::GetForClient(
CefRefPtr<CefClient> client) {
return static_cast<BaseClientHandler*>(client.get());
}
bool BaseClientHandler::OnProcessMessageReceived(

View File

@@ -24,6 +24,9 @@ class BaseClientHandler : public CefClient,
static CefRefPtr<BaseClientHandler> GetForBrowser(
CefRefPtr<CefBrowser> browser);
// Returns the BaseClientHandler for |client|.
static CefRefPtr<BaseClientHandler> GetForClient(CefRefPtr<CefClient> client);
// CefClient methods
CefRefPtr<CefLifeSpanHandler> GetLifeSpanHandler() override { return this; }
CefRefPtr<CefRequestHandler> GetRequestHandler() override { return this; }
@@ -92,6 +95,9 @@ class BaseClientHandler : public CefClient,
void SetHangAction(HangAction action);
HangAction GetHangAction() const;
// Used to determine the object type for each concrete implementation.
virtual const void* GetTypeKey() const = 0;
protected:
CefRefPtr<CefResourceManager> GetResourceManager() const {
return resource_manager_;

View File

@@ -1124,7 +1124,9 @@ void BrowserWindowOsrGtk::OnBeforeClose(CefRefPtr<CefBrowser> browser) {
CEF_REQUIRE_UI_THREAD();
// Detach |this| from the ClientHandlerOsr.
static_cast<ClientHandlerOsr*>(client_handler_.get())->DetachOsrDelegate();
auto handler = ClientHandlerOsr::GetForClient(client_handler_);
CHECK(handler);
handler->DetachOsrDelegate();
ScopedGdkThreadsEnter scoped_gdk_threads;

View File

@@ -1581,8 +1581,10 @@ void BrowserWindowOsrMacImpl::OnBeforeClose(CefRefPtr<CefBrowser> browser) {
REQUIRE_MAIN_THREAD();
// Detach |this| from the ClientHandlerOsr.
static_cast<ClientHandlerOsr*>(browser_window_.client_handler_.get())
->DetachOsrDelegate();
auto handler =
ClientHandlerOsr::GetForClient(browser_window_.client_handler_);
CHECK(handler);
handler->DetachOsrDelegate();
}
bool BrowserWindowOsrMacImpl::GetRootScreenRect(CefRefPtr<CefBrowser> browser,

View File

@@ -19,6 +19,16 @@ ClientHandlerOsr::ClientHandlerOsr(Delegate* delegate,
DCHECK(osr_delegate_);
}
// static
CefRefPtr<ClientHandlerOsr> ClientHandlerOsr::GetForClient(
CefRefPtr<CefClient> client) {
auto base = BaseClientHandler::GetForClient(client);
if (base && base->GetTypeKey() == &kTypeKey) {
return static_cast<ClientHandlerOsr*>(base.get());
}
return nullptr;
}
void ClientHandlerOsr::DetachOsrDelegate() {
if (!CefCurrentlyOn(TID_UI)) {
// Execute this method on the UI thread.

View File

@@ -80,6 +80,10 @@ class ClientHandlerOsr : public ClientHandler,
bool with_controls,
const std::string& startup_url);
// Returns the ClientHandlerOsr for |client|, or nullptr if |client| is not a
// ClientHandlerOsr.
static CefRefPtr<ClientHandlerOsr> GetForClient(CefRefPtr<CefClient> client);
// This object may outlive the OsrDelegate object so it's necessary for the
// OsrDelegate to detach itself before destruction.
void DetachOsrDelegate();
@@ -139,6 +143,10 @@ class ClientHandlerOsr : public ClientHandler,
void OnAccessibilityLocationChange(CefRefPtr<CefValue> value) override;
private:
// Used to determine the object type.
virtual const void* GetTypeKey() const override { return &kTypeKey; }
static constexpr int kTypeKey = 0;
// Only accessed on the UI thread.
OsrDelegate* osr_delegate_;

View File

@@ -11,4 +11,14 @@ ClientHandlerStd::ClientHandlerStd(Delegate* delegate,
const std::string& startup_url)
: ClientHandler(delegate, /*is_osr=*/false, with_controls, startup_url) {}
// static
CefRefPtr<ClientHandlerStd> ClientHandlerStd::GetForClient(
CefRefPtr<CefClient> client) {
auto base = BaseClientHandler::GetForClient(client);
if (base && base->GetTypeKey() == &kTypeKey) {
return static_cast<ClientHandlerStd*>(base.get());
}
return nullptr;
}
} // namespace client

View File

@@ -18,7 +18,15 @@ class ClientHandlerStd : public ClientHandler {
bool with_controls,
const std::string& startup_url);
// Returns the ClientHandlerStd for |client|, or nullptr if |client| is not a
// ClientHandlerStd.
static CefRefPtr<ClientHandlerStd> GetForClient(CefRefPtr<CefClient> client);
private:
// Used to determine the object type.
virtual const void* GetTypeKey() const override { return &kTypeKey; }
static constexpr int kTypeKey = 0;
// Include the default reference counting implementation.
IMPLEMENT_REFCOUNTING(ClientHandlerStd);
DISALLOW_COPY_AND_ASSIGN(ClientHandlerStd);

View File

@@ -0,0 +1,19 @@
// Copyright (c) 2024 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#include "tests/cefclient/browser/default_client_handler.h"
namespace client {
// static
CefRefPtr<DefaultClientHandler> DefaultClientHandler::GetForClient(
CefRefPtr<CefClient> client) {
auto base = BaseClientHandler::GetForClient(client);
if (base && base->GetTypeKey() == &kTypeKey) {
return static_cast<DefaultClientHandler*>(base.get());
}
return nullptr;
}
} // namespace client

View File

@@ -16,7 +16,16 @@ class DefaultClientHandler : public BaseClientHandler {
public:
DefaultClientHandler() = default;
// Returns the DefaultClientHandler for |client|, or nullptr if |client| is
// not a DefaultClientHandler.
static CefRefPtr<DefaultClientHandler> GetForClient(
CefRefPtr<CefClient> client);
private:
// Used to determine the object type.
virtual const void* GetTypeKey() const override { return &kTypeKey; }
static constexpr int kTypeKey = 0;
IMPLEMENT_REFCOUNTING(DefaultClientHandler);
DISALLOW_COPY_AND_ASSIGN(DefaultClientHandler);
};

View File

@@ -947,8 +947,10 @@ void OsrWindowWin::OnAfterCreated(CefRefPtr<CefBrowser> browser) {
void OsrWindowWin::OnBeforeClose(CefRefPtr<CefBrowser> browser) {
CEF_REQUIRE_UI_THREAD();
// Detach |this| from the ClientHandlerOsr.
static_cast<ClientHandlerOsr*>(browser_->GetHost()->GetClient().get())
->DetachOsrDelegate();
auto handler =
ClientHandlerOsr::GetForClient(browser_->GetHost()->GetClient());
CHECK(handler);
handler->DetachOsrDelegate();
browser_ = nullptr;
render_handler_->SetBrowser(nullptr);
Destroy();

View File

@@ -273,7 +273,12 @@ ViewsWindow::Delegate* RootWindowViews::GetDelegateForPopup(
CefRefPtr<CefClient> client) {
CEF_REQUIRE_UI_THREAD();
// |handler| was created in RootWindowViews::InitAsPopup().
ClientHandlerStd* handler = static_cast<ClientHandlerStd*>(client.get());
// May return nullptr when running with `--use-default-popup`.
auto handler = ClientHandlerStd::GetForClient(client);
if (!handler) {
return nullptr;
}
RootWindowViews* root_window =
static_cast<RootWindowViews*>(handler->delegate());

View File

@@ -671,6 +671,19 @@ cef_runtime_style_t ViewsWindow::GetWindowRuntimeStyle() {
return CEF_RUNTIME_STYLE_DEFAULT;
}
#if defined(OS_LINUX)
bool ViewsWindow::GetLinuxWindowProperties(
CefRefPtr<CefWindow> window,
CefLinuxWindowProperties& properties) {
CefString(&properties.wayland_app_id) =
CefString(&properties.wm_class_class) =
CefString(&properties.wm_class_name) =
CefString(&properties.wm_role_name) = "cef";
return true;
}
#endif
void ViewsWindow::OnWindowCreated(CefRefPtr<CefWindow> window) {
CEF_REQUIRE_UI_THREAD();
DCHECK(browser_view_);

View File

@@ -162,6 +162,11 @@ class ViewsWindow : public CefBrowserViewDelegate,
const CefKeyEvent& event) override;
// CefWindowDelegate methods:
#if defined(OS_LINUX)
virtual bool GetLinuxWindowProperties(
CefRefPtr<CefWindow> window,
CefLinuxWindowProperties& properties) override;
#endif
void OnWindowCreated(CefRefPtr<CefWindow> window) override;
void OnWindowClosing(CefRefPtr<CefWindow> window) override;
void OnWindowDestroyed(CefRefPtr<CefWindow> window) override;

View File

@@ -4,6 +4,8 @@
#include "tests/cefclient/renderer/performance_test.h"
#include <array>
#include "include/cef_v8.h"
#include "tests/cefclient/renderer/performance_test_setup.h"
@@ -322,6 +324,7 @@ PERF_TEST_FUNC(V8ObjectGetValueWithAccessor) {
PERF_ITERATIONS_END()
}
#ifndef CEF_V8_ENABLE_SANDBOX
PERF_TEST_FUNC(V8ArrayBufferCreate) {
class ReleaseCallback : public CefV8ArrayBufferReleaseCallback {
public:
@@ -339,6 +342,17 @@ PERF_TEST_FUNC(V8ArrayBufferCreate) {
CefV8Value::CreateArrayBuffer(buffer, byte_len, callback);
PERF_ITERATIONS_END()
}
#endif // CEF_V8_ENABLE_SANDBOX
PERF_TEST_FUNC(V8ArrayBufferCopy) {
constexpr size_t len = 1;
constexpr size_t byte_len = len * sizeof(float);
std::array<float, len> buffer = {0};
PERF_ITERATIONS_START()
CefRefPtr<CefV8Value> ret =
CefV8Value::CreateArrayBufferWithCopy(buffer.data(), byte_len);
PERF_ITERATIONS_END()
}
PERF_TEST_FUNC(V8ContextEnterExit) {
CefRefPtr<CefV8Context> context = CefV8Context::GetCurrentContext();
@@ -385,7 +399,10 @@ const PerfTestEntry kPerfTests[] = {
PERF_TEST_ENTRY(V8ObjectGetValue),
PERF_TEST_ENTRY(V8ObjectSetValueWithAccessor),
PERF_TEST_ENTRY(V8ObjectGetValueWithAccessor),
#ifndef CEF_V8_ENABLE_SANDBOX
PERF_TEST_ENTRY(V8ArrayBufferCreate),
#endif // CEF_V8_ENABLE_SANDBOX
PERF_TEST_ENTRY(V8ArrayBufferCopy),
PERF_TEST_ENTRY(V8ContextEnterExit),
PERF_TEST_ENTRY(V8ContextEval),
};

View File

@@ -3,11 +3,12 @@
<head>
<meta charset="UTF-8" />
<title>Binary vs String Transfer Benchmark</title>
<script src="https://cdn.plot.ly/plotly-2.26.0.min.js"></script>
<script src="https://cdn.plot.ly/plotly-2.34.0.min.js"></script>
<style>
body {
font-family: Tahoma, Serif;
font-size: 10pt;
background-color: white;
}
.info {
font-size: 12pt;
@@ -116,7 +117,9 @@
<div id="round_trip_avg_chart">
<!-- Average round trip linear chart will be drawn inside this DIV -->
</div>
<div id="round_trip_chart">
<!-- Round trip linear chart will be drawn inside this DIV -->
</div>
<div id="box_plot_chart">
<!-- Box plot of round trip time will be drawn inside this DIV -->
</div>
@@ -125,13 +128,14 @@
let tests = [];
let box_plot_test_data = [];
let round_trip_avg_plot_data = [];
let round_trip_plot_data = [];
function nextTestSuite(testIndex) {
const nextTestIndex = testIndex + 1;
setTimeout(execTestSuite, 0, nextTestIndex);
}
function generateRandomString(size) {
function generateString(size) {
// Symbols that will be encoded as two bytes in UTF-8
// so we compare transfer of the same amount of bytes
const characters =
@@ -144,7 +148,7 @@
return randomString;
}
function generateRandomArrayBuffer(size) {
function generateArrayBuffer(size) {
const buffer = new ArrayBuffer(size);
const uint8Array = new Uint8Array(buffer);
for (let i = 0; i < uint8Array.length; i++) {
@@ -157,8 +161,7 @@
console.error(`ErrorCode:${errorCode} Message:${errorMessage}`);
}
function sendString(size, testIndex) {
const request = generateRandomString(size);
function sendString(request, testIndex) {
const startTime = performance.now();
const onSuccess = (response) => {
const roundTrip = performance.now() - startTime;
@@ -166,6 +169,8 @@
test.totalRoundTrip += roundTrip;
test.sample++;
box_plot_test_data[testIndex].x.push(roundTrip);
round_trip_plot_data[testIndex].x.push(test.sample);
round_trip_plot_data[testIndex].y.push(roundTrip);
setTimeout(execTest, 0, testIndex);
};
@@ -176,8 +181,7 @@
});
}
function sendArrayBuffer(size, testIndex) {
const request = generateRandomArrayBuffer(size);
function sendArrayBuffer(request, testIndex) {
const startTime = performance.now();
const onSuccess = (response) => {
const roundTrip = performance.now() - startTime;
@@ -185,6 +189,8 @@
test.totalRoundTrip += roundTrip;
test.sample++;
box_plot_test_data[testIndex].x.push(roundTrip);
round_trip_plot_data[testIndex].x.push(test.sample);
round_trip_plot_data[testIndex].y.push(roundTrip);
setTimeout(execTest, 0, testIndex);
};
@@ -209,7 +215,7 @@
if (test.sample >= test.totalSamples) {
return nextTestSuite(testIndex);
}
test.func(test.length, test.index);
test.func(test.request, test.index);
}
function column(prepared, value) {
@@ -279,14 +285,14 @@
function buildTestResults(tests) {
testResults = [];
let oldRoundTrip = {
let stringRoundTrip = {
x: [],
y: [],
type: "scatter",
name: "String",
};
let newRoundTrip = {
let binaryRoundTrip = {
x: [],
y: [],
type: "scatter",
@@ -332,13 +338,13 @@
stdDeviationBinary: stdDeviationBinary,
});
oldRoundTrip.x.push(test.byteSize);
newRoundTrip.x.push(test.byteSize);
oldRoundTrip.y.push(avgRoundTrip);
newRoundTrip.y.push(avgRoundTripBin);
stringRoundTrip.x.push(test.byteSize);
binaryRoundTrip.x.push(test.byteSize);
stringRoundTrip.y.push(avgRoundTrip);
binaryRoundTrip.y.push(avgRoundTripBin);
}
round_trip_avg_plot_data = [oldRoundTrip, newRoundTrip];
round_trip_avg_plot_data = [stringRoundTrip, binaryRoundTrip];
return testResults;
}
@@ -374,17 +380,21 @@
box_plot_test_data.forEach((data) => {
data.x = [];
});
round_trip_plot_data.forEach((data) => {
data.x = [];
data.y = [];
});
}
function queueTest(name, byteSize, length, testFunc) {
function queueTest(name, byteSize, request, testFunc) {
const testIndex = tests.length;
test = {
name: name,
byteSize: byteSize,
length: length,
index: testIndex,
sample: 0,
totalRoundTrip: 0,
request: request,
func: testFunc,
};
tests.push(test);
@@ -397,11 +407,18 @@
jitter: 0.3,
pointpos: -1.8,
});
round_trip_plot_data.push({
x: [],
y: [],
type: "scatter",
name: name,
});
}
function execTestSuite(testIndex) {
if (testIndex < tests.length) {
execTest(testIndex);
setTimeout(execTest, 0, testIndex);
} else {
testsRunFinished();
}
@@ -426,19 +443,16 @@
testResults = buildTestResults(tests);
testResults.forEach((result) => displayResult(result));
const round_trip_layout = {
Plotly.newPlot("round_trip_avg_chart", round_trip_avg_plot_data, {
title: "Average round trip, μs (Smaller Better)",
};
Plotly.newPlot(
"round_trip_avg_chart",
round_trip_avg_plot_data,
round_trip_layout
);
});
Plotly.newPlot("round_trip_chart", round_trip_plot_data, {
title: "Linear: Round Trip Time, μs",
});
Plotly.newPlot("box_plot_chart", box_plot_test_data, {
title: "Box plot: Round Trip Time, μs",
});
const box_plot_layout = {
title: "Round Trip Time, μs",
};
Plotly.newPlot("box_plot_chart", box_plot_test_data, box_plot_layout);
setSettingsState(false);
}
@@ -466,6 +480,7 @@
window.runTestSuite = () => {
Plotly.purge("round_trip_avg_chart");
Plotly.purge("box_plot_chart");
Plotly.purge("round_trip_chart");
setSettingsState(true);
const totalSamples = parseInt(
document.getElementById("sSamples").value
@@ -474,21 +489,22 @@
};
const totalSamples = parseInt(document.getElementById("sSamples").value);
queueTest("Empty String", 0, 0, sendString);
queueTest("Empty Binary", 0, 0, sendArrayBuffer);
for (let byteSize = 8; byteSize <= 512 * 1024; byteSize *= 2) {
queueTest("Empty String", 0, generateString(0), sendString);
queueTest("Empty Binary", 0, generateArrayBuffer(0), sendArrayBuffer);
for (let byteSize = 8; byteSize <= 512 * 1024; byteSize *= 4) {
// Byte size of a string is twice its length because of UTF-16 encoding
const stringLen = byteSize / 2;
queueTest(
humanFileSize(byteSize) + " String",
byteSize,
stringLen,
generateString(stringLen),
sendString
);
queueTest(
humanFileSize(byteSize) + " Binary",
byteSize,
byteSize,
generateArrayBuffer(byteSize),
sendArrayBuffer
);
}

View File

@@ -8,6 +8,7 @@
body {
font-family: Tahoma, Serif;
font-size: 10pt;
background-color: white;
}
.left {

View File

@@ -58,9 +58,12 @@ enum V8TestMode {
V8TEST_EMPTY_STRING_CREATE,
V8TEST_ARRAY_CREATE,
V8TEST_ARRAY_VALUE,
#ifndef CEF_V8_ENABLE_SANDBOX
V8TEST_ARRAY_BUFFER,
V8TEST_ARRAY_BUFFER_CREATE_EMPTY,
V8TEST_ARRAY_BUFFER_VALUE,
#endif // CEF_V8_ENABLE_SANDBOX
V8TEST_ARRAY_BUFFER_CREATE_EMPTY,
V8TEST_ARRAY_BUFFER_COPY,
V8TEST_OBJECT_CREATE,
V8TEST_OBJECT_USERDATA,
V8TEST_OBJECT_ACCESSOR,
@@ -149,14 +152,19 @@ class V8RendererTest : public ClientAppRenderer::Delegate,
case V8TEST_ARRAY_VALUE:
RunArrayValueTest();
break;
#ifndef CEF_V8_ENABLE_SANDBOX
case V8TEST_ARRAY_BUFFER:
RunArrayBufferTest();
break;
case V8TEST_ARRAY_BUFFER_VALUE:
RunArrayBufferValueTest();
break;
#endif // CEF_V8_ENABLE_SANDBOX
case V8TEST_ARRAY_BUFFER_CREATE_EMPTY:
RunArrayBufferCreateEmptyTest();
break;
case V8TEST_ARRAY_BUFFER_VALUE:
RunArrayBufferValueTest();
case V8TEST_ARRAY_BUFFER_COPY:
RunArrayBufferCopyTest();
break;
case V8TEST_OBJECT_CREATE:
RunObjectCreateTest();
@@ -612,6 +620,7 @@ class V8RendererTest : public ClientAppRenderer::Delegate,
DestroyTest();
}
#ifndef CEF_V8_ENABLE_SANDBOX
void RunArrayBufferTest() {
class TestArrayBufferReleaseCallback
: public CefV8ArrayBufferReleaseCallback {
@@ -654,10 +663,11 @@ class V8RendererTest : public ClientAppRenderer::Delegate,
void* data = value->GetArrayBufferData();
EXPECT_EQ(static_cast<int*>(data), static_data);
EXPECT_FALSE(value->HasValue(0));
EXPECT_TRUE(value->GetArrayBufferReleaseCallback().get() != nullptr);
EXPECT_TRUE(((TestArrayBufferReleaseCallback*)value
->GetArrayBufferReleaseCallback()
.get()) == release_callback);
EXPECT_NE(value->GetArrayBufferReleaseCallback().get(), nullptr);
EXPECT_EQ((TestArrayBufferReleaseCallback*)value
->GetArrayBufferReleaseCallback()
.get(),
release_callback);
// |Value| buffer is explicitly freed by NeuterArrayBuffer().
EXPECT_FALSE(destructorCalled);
@@ -670,7 +680,33 @@ class V8RendererTest : public ClientAppRenderer::Delegate,
EXPECT_TRUE(context->Exit());
DestroyTest();
}
#endif // CEF_V8_ENABLE_SANDBOX
void RunArrayBufferCopyTest() {
CefRefPtr<CefV8Context> context = GetContext();
// Enter the V8 context.
EXPECT_TRUE(context->Enter());
{
int static_data[16] = {1, 2, 3, 4};
CefRefPtr<CefV8Value> value = CefV8Value::CreateArrayBufferWithCopy(
static_data, sizeof(static_data));
EXPECT_TRUE(value.get());
EXPECT_TRUE(value->IsArrayBuffer());
EXPECT_TRUE(value->IsObject());
EXPECT_EQ(value->GetArrayBufferByteLength(), sizeof(static_data));
void* data = value->GetArrayBufferData();
EXPECT_EQ(static_cast<int*>(data)[0], static_data[0]);
EXPECT_EQ(static_cast<int*>(data)[1], static_data[1]);
EXPECT_FALSE(value->HasValue(0));
}
// Exit the V8 context.
EXPECT_TRUE(context->Exit());
DestroyTest();
}
#ifndef CEF_V8_ENABLE_SANDBOX
void RunArrayBufferValueTest() {
class TestArrayBufferReleaseCallback
: public CefV8ArrayBufferReleaseCallback {
@@ -720,8 +756,17 @@ class V8RendererTest : public ClientAppRenderer::Delegate,
EXPECT_TRUE(context->Exit());
DestroyTest();
}
#endif // CEF_V8_ENABLE_SANDBOX
void RunArrayBufferCreateEmptyTest() {
// Enter the V8 context
CefRefPtr<CefV8Context> context = GetContext();
EXPECT_TRUE(context->Enter());
const size_t zero_size = 0;
void* null_data = nullptr;
CefRefPtr<CefV8Value> value;
#ifndef CEF_V8_ENABLE_SANDBOX
class TestArrayBufferReleaseCallback
: public CefV8ArrayBufferReleaseCallback {
public:
@@ -733,22 +778,17 @@ class V8RendererTest : public ClientAppRenderer::Delegate,
CefRefPtr<TestArrayBufferReleaseCallback> owner =
new TestArrayBufferReleaseCallback();
// Enter the V8 context
CefRefPtr<CefV8Context> context = GetContext();
EXPECT_TRUE(context->Enter());
const size_t zero_size = 0;
void* null_data = nullptr;
CefRefPtr<CefV8Value> value =
CefV8Value::CreateArrayBuffer(null_data, zero_size, owner);
EXPECT_EQ(value->GetArrayBufferByteLength(), zero_size);
value = CefV8Value::CreateArrayBuffer(null_data, zero_size, owner);
EXPECT_EQ(value->GetArrayBufferData(), null_data);
EXPECT_NE(value->GetArrayBufferReleaseCallback().get(), nullptr);
#else
value = CefV8Value::CreateArrayBufferWithCopy(null_data, zero_size);
#endif
EXPECT_EQ(value->GetArrayBufferByteLength(), zero_size);
CefRefPtr<CefV8Value> object = context->GetGlobal();
EXPECT_TRUE(object.get());
EXPECT_TRUE(object->SetValue("arr", value, V8_PROPERTY_ATTRIBUTE_NONE));
EXPECT_NE(value->GetArrayBufferReleaseCallback().get(), nullptr);
EXPECT_TRUE(value->NeuterArrayBuffer());
// Exit the V8 context.
@@ -3413,9 +3453,12 @@ V8_TEST(StringCreate, V8TEST_STRING_CREATE)
V8_TEST(EmptyStringCreate, V8TEST_EMPTY_STRING_CREATE)
V8_TEST(ArrayCreate, V8TEST_ARRAY_CREATE)
V8_TEST(ArrayValue, V8TEST_ARRAY_VALUE)
#ifndef CEF_V8_ENABLE_SANDBOX
V8_TEST(ArrayBuffer, V8TEST_ARRAY_BUFFER)
V8_TEST(ArrayBufferCreateEmpty, V8TEST_ARRAY_BUFFER_CREATE_EMPTY)
V8_TEST(ArrayBufferValue, V8TEST_ARRAY_BUFFER_VALUE)
#endif // CEF_V8_ENABLE_SANDBOX
V8_TEST(ArrayBufferCreateEmpty, V8TEST_ARRAY_BUFFER_CREATE_EMPTY)
V8_TEST(ArrayBufferCopy, V8TEST_ARRAY_BUFFER_COPY)
V8_TEST(ObjectCreate, V8TEST_OBJECT_CREATE)
V8_TEST(ObjectUserData, V8TEST_OBJECT_USERDATA)
V8_TEST(ObjectAccessor, V8TEST_OBJECT_ACCESSOR)

View File

@@ -7,35 +7,18 @@ package(default_visibility = [
"//visibility:public",
])
load("@aspect_bazel_lib//lib:copy_directory.bzl", "copy_directory")
load("@bazel_skylib//lib:selects.bzl", "selects")
load("@build_bazel_rules_apple//apple:apple.bzl", "apple_dynamic_framework_import")
load("//bazel:library_helpers.bzl", "declare_cc_library", "declare_objc_library")
load("//bazel/win:variables.bzl",
WIN_DLLS="DLLS",
WIN_DLLS_X64="DLLS_X64",
WIN_SANDBOX_LIBS="SANDBOX_LIBS",
WIN_COMMON_COPTS="COMMON_COPTS",
WIN_COMMON_COPTS_RELEASE="COMMON_COPTS_RELEASE",
WIN_COMMON_COPTS_DEBUG="COMMON_COPTS_DEBUG",
WIN_COMMON_DEFINES="COMMON_DEFINES",
WIN_COMMON_DEFINES_RELEASE="COMMON_DEFINES_RELEASE",
WIN_COMMON_DEFINES_DEBUG="COMMON_DEFINES_DEBUG")
WIN_SANDBOX_LIBS="SANDBOX_LIBS")
load("//bazel/linux:variables.bzl",
LINUX_SOS="SOS",
LINUX_COMMON_COPTS="COMMON_COPTS",
LINUX_COMMON_COPTS_RELEASE="COMMON_COPTS_RELEASE",
LINUX_COMMON_COPTS_DEBUG="COMMON_COPTS_DEBUG",
LINUX_COMMON_DEFINES="COMMON_DEFINES",
LINUX_COMMON_DEFINES_RELEASE="COMMON_DEFINES_RELEASE",
LINUX_COMMON_DEFINES_DEBUG="COMMON_DEFINES_DEBUG")
LINUX_SOS="SOS")
load("//bazel/mac:variables.bzl",
"CEF_FRAMEWORK_NAME",
MAC_COMMON_COPTS="COMMON_COPTS",
MAC_COMMON_COPTS_RELEASE="COMMON_COPTS_RELEASE",
MAC_COMMON_COPTS_DEBUG="COMMON_COPTS_DEBUG",
MAC_COMMON_DEFINES="COMMON_DEFINES",
MAC_COMMON_DEFINES_RELEASE="COMMON_DEFINES_RELEASE",
MAC_COMMON_DEFINES_DEBUG="COMMON_DEFINES_DEBUG")
load("@rules_cc//cc:defs.bzl", "cc_import", "cc_library", "objc_library")
"CEF_FRAMEWORK_NAME")
load("@rules_cc//cc:defs.bzl", "cc_import")
#
# Define supported configurations.
@@ -75,47 +58,47 @@ selects.config_setting_group(
selects.config_setting_group(
name = "windows_dbg",
match_all = ["@platforms//os:windows", ":dbg"],
match_all = ["@platforms//os:windows", "@cef//:dbg"],
)
selects.config_setting_group(
name = "windows_fastbuild",
match_all = ["@platforms//os:windows", ":fastbuild"],
match_all = ["@platforms//os:windows", "@cef//:fastbuild"],
)
selects.config_setting_group(
name = "windows_opt",
match_all = ["@platforms//os:windows", ":opt"],
match_all = ["@platforms//os:windows", "@cef//:opt"],
)
selects.config_setting_group(
name = "linux_dbg",
match_all = ["@platforms//os:linux", ":dbg"],
match_all = ["@platforms//os:linux", "@cef//:dbg"],
)
selects.config_setting_group(
name = "linux_fastbuild",
match_all = ["@platforms//os:linux", ":fastbuild"],
match_all = ["@platforms//os:linux", "@cef//:fastbuild"],
)
selects.config_setting_group(
name = "linux_opt",
match_all = ["@platforms//os:linux", ":opt"],
match_all = ["@platforms//os:linux", "@cef//:opt"],
)
selects.config_setting_group(
name = "macos_dbg",
match_all = ["@platforms//os:macos", ":dbg"],
match_all = ["@platforms//os:macos", "@cef//:dbg"],
)
selects.config_setting_group(
name = "macos_fastbuild",
match_all = ["@platforms//os:macos", ":fastbuild"],
match_all = ["@platforms//os:macos", "@cef//:fastbuild"],
)
selects.config_setting_group(
name = "macos_opt",
match_all = ["@platforms//os:macos", ":opt"],
match_all = ["@platforms//os:macos", "@cef//:opt"],
)
#
@@ -124,7 +107,7 @@ selects.config_setting_group(
# Public headers for cef_wrapper here.
# Seperated from the actual cef_wrapper since the *.mm file needs access to these as well.
cc_library(
declare_cc_library(
name = "cef_wrapper_headers",
hdrs = glob(
[
@@ -137,7 +120,7 @@ cc_library(
),
)
objc_library(
declare_objc_library(
name = "cef_wrapper_apple",
srcs = [
"libcef_dll/wrapper/cef_library_loader_mac.mm",
@@ -145,7 +128,7 @@ objc_library(
implementation_deps = [":cef_wrapper_headers"],
)
cc_library(
declare_cc_library(
name = "cef_wrapper",
srcs = glob(
[
@@ -159,52 +142,21 @@ cc_library(
"include/test/*.h",
],
),
copts = select({
"@platforms//os:windows": WIN_COMMON_COPTS,
"@platforms//os:linux": LINUX_COMMON_COPTS,
"@platforms//os:macos": MAC_COMMON_COPTS,
"//conditions:default": None,
}) + select({
":windows_opt": WIN_COMMON_COPTS_RELEASE,
":windows_dbg": WIN_COMMON_COPTS_DEBUG,
":windows_fastbuild": WIN_COMMON_COPTS_RELEASE,
":linux_opt": LINUX_COMMON_COPTS_RELEASE,
":linux_dbg": LINUX_COMMON_COPTS_DEBUG,
":linux_fastbuild": LINUX_COMMON_COPTS_RELEASE,
":macos_opt": MAC_COMMON_COPTS_RELEASE,
":macos_dbg": MAC_COMMON_COPTS_DEBUG,
":macos_fastbuild": MAC_COMMON_COPTS_RELEASE,
"//conditions:default": None,
}),
defines = [
"WRAPPING_CEF_SHARED",
] + select({
"@platforms//os:windows": WIN_COMMON_DEFINES,
"@platforms//os:linux": LINUX_COMMON_DEFINES,
"@platforms//os:macos": MAC_COMMON_DEFINES,
"//conditions:default": None,
}) + select({
":windows_opt": WIN_COMMON_DEFINES_RELEASE,
":windows_dbg": WIN_COMMON_DEFINES_DEBUG,
":windows_fastbuild": WIN_COMMON_DEFINES_RELEASE,
":linux_opt": LINUX_COMMON_DEFINES_RELEASE,
":linux_dbg": LINUX_COMMON_DEFINES_DEBUG,
":linux_fastbuild": LINUX_COMMON_DEFINES_RELEASE,
":macos_opt": MAC_COMMON_DEFINES_RELEASE,
":macos_dbg": MAC_COMMON_DEFINES_DEBUG,
":macos_fastbuild": MAC_COMMON_DEFINES_RELEASE,
"//conditions:default": None,
}),
],
deps = [":cef_wrapper_headers"] +
select({
"@platforms//os:macos": [":cef_wrapper_apple"],
"@platforms//os:windows": [":cef"],
"//conditions:default": None,
}),
# Support <angled> includes.
includes = ["./"],
)
# Only available on MacOS/Windows.
cc_library(
declare_cc_library(
name = "cef_sandbox_linkflags",
linkopts = select({
"@platforms//os:macos": ["-lsandbox"],
@@ -238,8 +190,8 @@ cc_import(
alias(
name = "cef_sandbox",
actual = select({
"//:dbg": ":cef_sandbox_debug",
"//conditions:default": ":cef_sandbox_release",
"@cef//:dbg": "@cef//:cef_sandbox_debug",
"//conditions:default": "@cef//:cef_sandbox_release",
}),
)
@@ -247,7 +199,7 @@ filegroup(
name = "dlls_opt",
srcs = ["Release/{}".format(name) for name in WIN_DLLS] +
select({
"//:windows_64": ["Release/{}".format(name) for name in WIN_DLLS_X64],
"@cef//:windows_64": ["Release/{}".format(name) for name in WIN_DLLS_X64],
"//conditions:default": None,
}),
)
@@ -256,7 +208,7 @@ filegroup(
name = "dlls_dbg",
srcs = ["Debug/{}".format(name) for name in WIN_DLLS] +
select({
"//:windows_64": ["Debug/{}".format(name) for name in WIN_DLLS_X64],
"@cef//:windows_64": ["Debug/{}".format(name) for name in WIN_DLLS_X64],
"//conditions:default": None,
}),
)
@@ -264,8 +216,8 @@ filegroup(
alias(
name = "dlls",
actual = select({
"//:dbg": ":dlls_dbg",
"//conditions:default": ":dlls_opt",
"@cef//:dbg": "@cef//:dlls_dbg",
"//conditions:default": "@cef//:dlls_opt",
})
)
@@ -282,8 +234,8 @@ filegroup(
alias(
name = "sos",
actual = select({
"//:dbg": ":sos_dbg",
"//conditions:default": ":sos_opt",
"@cef//:dbg": "@cef//:sos_dbg",
"//conditions:default": "@cef//:sos_opt",
})
)
@@ -300,7 +252,7 @@ filegroup(
"Release/snapshot_blob.bin",
"Release/v8_context_snapshot.bin",
"Release/vk_swiftshader_icd.json",
":resources_common",
"@cef//:resources_common",
],
)
@@ -310,15 +262,15 @@ filegroup(
"Debug/snapshot_blob.bin",
"Debug/v8_context_snapshot.bin",
"Debug/vk_swiftshader_icd.json",
":resources_common",
"@cef//:resources_common",
],
)
alias(
name = "resources",
actual = select({
"//:opt": ":resources_opt",
"//conditions:default": ":resources_dbg",
"@cef//:opt": "@cef//:resources_opt",
"//conditions:default": "@cef//:resources_dbg",
})
)
@@ -352,15 +304,20 @@ cc_import(
alias(
name = "cef",
actual = select({
"//:dbg": ":cef_dbg",
"//conditions:default": ":cef_opt",
"@cef//:dbg": "@cef//:cef_dbg",
"//conditions:default": "@cef//:cef_opt",
}),
)
apple_dynamic_framework_import(
# Copy the CEF framework into the app bundle but do not link it. See
# https://groups.google.com/g/cef-announce/c/Fith0A3kWtw/m/6ds_mJVMCQAJ
# for background. Use `copy_directory` instead of `filegroup` to remove
# the Debug/Release path prefix.
copy_directory(
name = "cef_framework",
framework_imports = select({
"//:dbg": glob(["Debug/{}.framework/**".format(CEF_FRAMEWORK_NAME)]),
"//conditions:default": glob(["Release/{}.framework/**".format(CEF_FRAMEWORK_NAME)]),
src = select({
"@cef//:dbg": "Debug/{}.framework".format(CEF_FRAMEWORK_NAME),
"//conditions:default": "Release/{}.framework".format(CEF_FRAMEWORK_NAME),
}),
out = "{}.framework".format(CEF_FRAMEWORK_NAME),
)

View File

@@ -15,3 +15,4 @@ bazel_dep(name = "rules_apple", version = "3.6.0", repo_name = "build_bazel_rule
bazel_dep(name = "rules_cc", version = "0.0.9")
# Add other dependencies here.
bazel_dep(name = "aspect_bazel_lib", version = "2.7.9")

View File

@@ -10,7 +10,8 @@ package(default_visibility = [
":__subpackages__",
])
load("@rules_cc//cc:defs.bzl", "cc_library", "objc_library")
load("//bazel:library_helpers.bzl", "declare_cc_library", "declare_objc_library")
load("@rules_cc//cc:defs.bzl", "cc_library")
#
# Source file lists.
@@ -53,7 +54,7 @@ filegroup(
# MacOS targets.
#
objc_library(
declare_objc_library(
name = "BrowserLibMac",
srcs = srcs_common + srcs_browser + srcs_browser_mac,
target_compatible_with = [
@@ -65,7 +66,7 @@ objc_library(
],
)
objc_library(
declare_objc_library(
name = "RendererLibMac",
srcs = srcs_common + srcs_renderer,
target_compatible_with = [
@@ -81,10 +82,10 @@ objc_library(
# Windows targets.
#
# Allow access from the declare_exe target.
filegroup(
# Allow access to resource.h from the declare_exe target.
cc_library(
name = "ResourceH",
srcs = [
hdrs = [
"browser/resource.h"
]
)

View File

@@ -43,12 +43,14 @@ declare_exe(
"{}.exe.manifest".format(PRODUCT_NAME),
],
resources_srcs = [
"{}:ResourceH".format(PKG_NAME),
"{}:Resources".format(PKG_NAME),
"{}.ico".format(PRODUCT_NAME),
"small.ico",
"//tests/shared:Resources",
],
resources_deps = [
"{}:ResourceH".format(PKG_NAME),
],
linkopts = [
"/SUBSYSTEM:WINDOWS",
] + [

View File

@@ -10,7 +10,8 @@ package(default_visibility = [
":__subpackages__",
])
load("@rules_cc//cc:defs.bzl", "cc_library", "objc_library")
load("//bazel:library_helpers.bzl", "declare_cc_library", "declare_objc_library")
load("@rules_cc//cc:defs.bzl", "cc_library")
#
# Source file lists.
@@ -40,7 +41,7 @@ srcs_renderer_mac = [
# MacOS targets.
#
objc_library(
declare_objc_library(
name = "BrowserLibMac",
srcs = srcs_browser + srcs_browser_mac,
target_compatible_with = [
@@ -51,7 +52,7 @@ objc_library(
],
)
cc_library(
declare_cc_library(
name = "RendererLibMac",
srcs = srcs_renderer_mac,
target_compatible_with = [
@@ -66,10 +67,10 @@ cc_library(
# Windows targets.
#
# Allow access from the declare_exe target.
filegroup(
# Allow access to resource.h from the declare_exe target.
cc_library(
name = "ResourceH",
srcs = [
hdrs = [
"resource.h"
]
)

View File

@@ -27,10 +27,12 @@ declare_exe(
"{}.exe.manifest".format(PRODUCT_NAME),
],
resources_srcs = [
"{}:ResourceH".format(PKG_NAME),
"{}.ico".format(PRODUCT_NAME),
"small.ico",
],
resources_deps = [
"{}:ResourceH".format(PKG_NAME),
],
linkopts = [
"/SUBSYSTEM:WINDOWS",
],

View File

@@ -10,7 +10,8 @@ package(default_visibility = [
":__subpackages__",
])
load("@rules_cc//cc:defs.bzl", "cc_library", "objc_library")
load("//bazel:library_helpers.bzl", "declare_cc_library", "declare_objc_library")
load("@rules_cc//cc:defs.bzl", "cc_library")
#
# Source file lists.
@@ -51,7 +52,7 @@ filegroup(
srcs = ["resources/net"],
)
objc_library(
declare_objc_library(
name = "BrowserLibMac",
srcs = srcs_browser + srcs_browser_mac,
target_compatible_with = [
@@ -64,7 +65,7 @@ objc_library(
],
)
objc_library(
declare_objc_library(
name = "RendererLibMac",
srcs = srcs_renderer_mac,
target_compatible_with = [
@@ -81,10 +82,10 @@ objc_library(
# Windows targets.
#
# Allow access from the declare_exe target.
filegroup(
# Allow access to resource.h from the declare_exe target.
cc_library(
name = "ResourceH",
srcs = [
hdrs = [
"resource.h"
]
)

View File

@@ -45,11 +45,13 @@ declare_exe(
"{}.exe.manifest".format(PRODUCT_NAME),
],
resources_srcs = [
"{}:ResourceH".format(PKG_NAME),
"{}.ico".format(PRODUCT_NAME),
"small.ico",
"//tests/shared:Resources",
],
resources_deps = [
"{}:ResourceH".format(PKG_NAME),
],
linkopts = [
"/SUBSYSTEM:CONSOLE",
],

View File

@@ -2,7 +2,8 @@
# reserved. Use of this source code is governed by a BSD-style license that
# can be found in the LICENSE file.
load("@rules_cc//cc:defs.bzl", "cc_library", "objc_library")
load("//bazel:library_helpers.bzl", "declare_cc_library", "declare_objc_library")
load("@rules_cc//cc:defs.bzl", "cc_library")
# Allow access from all //tests packages.
package(default_visibility = [
@@ -62,7 +63,7 @@ filegroup(
# MacOS targets.
#
objc_library(
declare_objc_library(
name = "BrowserLibMac",
srcs = srcs_common + srcs_browser + srcs_browser_mac,
target_compatible_with = [
@@ -73,7 +74,7 @@ objc_library(
],
)
cc_library(
declare_cc_library(
name = "RendererLibMac",
srcs = srcs_common + srcs_renderer + srcs_renderer_mac,
target_compatible_with = [
@@ -89,7 +90,7 @@ cc_library(
# Needs to be defined here because Bazel disallows direct access to files
# outside of the package directory.
objc_library(
declare_objc_library(
name = "BrowserLibMacCefTests",
srcs = srcs_browser_mac_ceftests,
target_compatible_with = [
@@ -101,7 +102,7 @@ objc_library(
],
)
objc_library(
declare_objc_library(
name = "RendererLibMacCefTests",
srcs = srcs_renderer_mac_ceftests,
target_compatible_with = [

View File

@@ -228,11 +228,6 @@ def GetRecommendedDefaultArgs():
# "//chrome:chrome_dll" target, which will fail to build with CEF.
'enable_resource_allowlist_generation': False,
# Disable V8 sandboxed pointers to avoid crashing when using
# CefV8Value::CreateArrayBuffer with memory allocated outside of the V8
# sandbox. See https://github.com/chromiumembedded/cef/issues/3332.
'v8_enable_sandbox': False,
# Disable downgrade processing/restart with the Chrome runtime.
# https://github.com/chromiumembedded/cef/issues/3608
'enable_downgrade_processing': False,

View File

@@ -28,6 +28,13 @@ def make_config_header(gn_config):
not 'ozone_platform_x11=false' in lines:
defines.append('#define CEF_X11 1')
# If the V8 sandbox is not disabled explicitly and
# the target_cpu is arm64 or x64 (see v8_enable_pointer_compression)
# add CEF_V8_ENABLE_SANDBOX define used in cef_message_router.h
if not 'v8_enable_sandbox=false' in lines and \
('target_cpu="arm64"' in lines or 'target_cpu="x64"' in lines):
defines.append('#define CEF_V8_ENABLE_SANDBOX 1')
result = get_copyright(full=True, translator=False) + \
"""//
// ---------------------------------------------------------------------------