win: Disable use of Rust for JSON parsing with cef_sandbox
This commit is contained in:
parent
89ab864065
commit
f8b673a3ea
|
@ -512,6 +512,10 @@ patches = [
|
||||||
# win: Add SHA256 implementation for Sid::FromNamedCapability using the
|
# win: Add SHA256 implementation for Sid::FromNamedCapability using the
|
||||||
# Crypto API.
|
# Crypto API.
|
||||||
# https://github.com/chromiumembedded/cef/issues/3791
|
# https://github.com/chromiumembedded/cef/issues/3791
|
||||||
|
#
|
||||||
|
# win: Disable use of Rust for JSON parsing with cef_sandbox.
|
||||||
|
# Enables the fallback to C++ that was removed in
|
||||||
|
# https://crrev.com/9ddc1624637c8cfa8ef50a95abd779e0ba4d67f6
|
||||||
'name': 'base_sandbox_2743',
|
'name': 'base_sandbox_2743',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -87,6 +87,116 @@ index 2158b648ca58a..8a8cb13b2fd74 100644
|
||||||
#include "base/hash/sha1_nacl.h"
|
#include "base/hash/sha1_nacl.h"
|
||||||
#else
|
#else
|
||||||
#include "base/hash/sha1_boringssl.h"
|
#include "base/hash/sha1_boringssl.h"
|
||||||
|
diff --git base/json/json_reader.cc base/json/json_reader.cc
|
||||||
|
index b3db0dea0fff6..e53ff0049559a 100644
|
||||||
|
--- base/json/json_reader.cc
|
||||||
|
+++ base/json/json_reader.cc
|
||||||
|
@@ -12,8 +12,9 @@
|
||||||
|
#include "base/logging.h"
|
||||||
|
#include "base/metrics/histogram_macros.h"
|
||||||
|
#include "build/build_config.h"
|
||||||
|
+#include "cef/libcef/features/features.h"
|
||||||
|
|
||||||
|
-#if !BUILDFLAG(IS_NACL)
|
||||||
|
+#if !(BUILDFLAG(IS_NACL) || BUILDFLAG(IS_CEF_SANDBOX_BUILD))
|
||||||
|
#include "base/strings/string_view_rust.h"
|
||||||
|
#include "third_party/rust/serde_json_lenient/v0_2/wrapper/functions.h"
|
||||||
|
#include "third_party/rust/serde_json_lenient/v0_2/wrapper/lib.rs.h"
|
||||||
|
@@ -23,7 +24,7 @@ namespace base {
|
||||||
|
|
||||||
|
// TODO(crbug.com/40811643): Move the C++ parser into components/nacl to just
|
||||||
|
// run in-process there. Don't compile base::JSONReader on NaCL at all.
|
||||||
|
-#if !BUILDFLAG(IS_NACL)
|
||||||
|
+#if !(BUILDFLAG(IS_NACL) || BUILDFLAG(IS_CEF_SANDBOX_BUILD))
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
using serde_json_lenient::ContextPointer;
|
||||||
|
@@ -134,16 +135,16 @@ JSONReader::Result DecodeJSONInRust(std::string_view json,
|
||||||
|
|
||||||
|
} // anonymous namespace
|
||||||
|
|
||||||
|
-#endif // !BUILDFLAG(IS_NACL)
|
||||||
|
+#endif // !(BUILDFLAG(IS_NACL) || BUILDFLAG(IS_CEF_SANDBOX_BUILD))
|
||||||
|
|
||||||
|
// static
|
||||||
|
std::optional<Value> JSONReader::Read(std::string_view json,
|
||||||
|
int options,
|
||||||
|
size_t max_depth) {
|
||||||
|
-#if BUILDFLAG(IS_NACL)
|
||||||
|
+#if (BUILDFLAG(IS_NACL) || BUILDFLAG(IS_CEF_SANDBOX_BUILD))
|
||||||
|
internal::JSONParser parser(options, max_depth);
|
||||||
|
return parser.Parse(json);
|
||||||
|
-#else // BUILDFLAG(IS_NACL)
|
||||||
|
+#else // (BUILDFLAG(IS_NACL) || BUILDFLAG(IS_CEF_SANDBOX_BUILD))
|
||||||
|
SCOPED_UMA_HISTOGRAM_TIMER_MICROS(kSecurityJsonParsingTime);
|
||||||
|
if (UsingRust()) {
|
||||||
|
JSONReader::Result result = DecodeJSONInRust(json, options, max_depth);
|
||||||
|
@@ -155,7 +156,7 @@ std::optional<Value> JSONReader::Read(std::string_view json,
|
||||||
|
internal::JSONParser parser(options, max_depth);
|
||||||
|
return parser.Parse(json);
|
||||||
|
}
|
||||||
|
-#endif // BUILDFLAG(IS_NACL)
|
||||||
|
+#endif // (BUILDFLAG(IS_NACL) || BUILDFLAG(IS_CEF_SANDBOX_BUILD))
|
||||||
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
@@ -173,7 +174,7 @@ std::optional<Value::Dict> JSONReader::ReadDict(std::string_view json,
|
||||||
|
JSONReader::Result JSONReader::ReadAndReturnValueWithError(
|
||||||
|
std::string_view json,
|
||||||
|
int options) {
|
||||||
|
-#if BUILDFLAG(IS_NACL)
|
||||||
|
+#if (BUILDFLAG(IS_NACL) || BUILDFLAG(IS_CEF_SANDBOX_BUILD))
|
||||||
|
internal::JSONParser parser(options);
|
||||||
|
auto value = parser.Parse(json);
|
||||||
|
if (!value) {
|
||||||
|
@@ -185,7 +186,7 @@ JSONReader::Result JSONReader::ReadAndReturnValueWithError(
|
||||||
|
}
|
||||||
|
|
||||||
|
return std::move(*value);
|
||||||
|
-#else // BUILDFLAG(IS_NACL)
|
||||||
|
+#else // (BUILDFLAG(IS_NACL) || BUILDFLAG(IS_CEF_SANDBOX_BUILD))
|
||||||
|
SCOPED_UMA_HISTOGRAM_TIMER_MICROS(kSecurityJsonParsingTime);
|
||||||
|
if (UsingRust()) {
|
||||||
|
return DecodeJSONInRust(json, options, internal::kAbsoluteMaxDepth);
|
||||||
|
@@ -202,7 +203,7 @@ JSONReader::Result JSONReader::ReadAndReturnValueWithError(
|
||||||
|
|
||||||
|
return std::move(*value);
|
||||||
|
}
|
||||||
|
-#endif // BUILDFLAG(IS_NACL)
|
||||||
|
+#endif // (BUILDFLAG(IS_NACL) || BUILDFLAG(IS_CEF_SANDBOX_BUILD))
|
||||||
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
@@ -213,7 +214,7 @@ bool JSONReader::UsingRust() {
|
||||||
|
if (!base::FeatureList::GetInstance()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
-#if BUILDFLAG(IS_NACL)
|
||||||
|
+#if (BUILDFLAG(IS_NACL) || BUILDFLAG(IS_CEF_SANDBOX_BUILD))
|
||||||
|
return false;
|
||||||
|
#else
|
||||||
|
return base::FeatureList::IsEnabled(base::features::kUseRustJsonParser);
|
||||||
|
diff --git base/logging.cc base/logging.cc
|
||||||
|
index 508ce135131aa..4158b7d5273b0 100644
|
||||||
|
--- base/logging.cc
|
||||||
|
+++ base/logging.cc
|
||||||
|
@@ -60,6 +60,7 @@
|
||||||
|
#include "base/vlog.h"
|
||||||
|
#include "build/build_config.h"
|
||||||
|
#include "build/chromeos_buildflags.h"
|
||||||
|
+#include "cef/libcef/features/features.h"
|
||||||
|
#include "third_party/abseil-cpp/absl/base/internal/raw_logging.h"
|
||||||
|
#include "third_party/abseil-cpp/absl/cleanup/cleanup.h"
|
||||||
|
|
||||||
|
@@ -526,7 +527,7 @@ bool BaseInitLoggingImpl(const LoggingSettings& settings) {
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
-#if !BUILDFLAG(IS_NACL)
|
||||||
|
+#if !BUILDFLAG(IS_NACL) && !BUILDFLAG(IS_CEF_SANDBOX_BUILD)
|
||||||
|
// Connects Rust logging with the //base logging functionality.
|
||||||
|
internal::init_rust_log_crate();
|
||||||
|
#endif
|
||||||
diff --git base/metrics/crc32.cc base/metrics/crc32.cc
|
diff --git base/metrics/crc32.cc base/metrics/crc32.cc
|
||||||
index 83e3cee2579ab..8238767ab9126 100644
|
index 83e3cee2579ab..8238767ab9126 100644
|
||||||
--- base/metrics/crc32.cc
|
--- base/metrics/crc32.cc
|
||||||
|
|
|
@ -544,10 +544,6 @@ def GetConfigArgsSandbox(platform, args, is_debug, cpu):
|
||||||
# Enable base target customizations necessary for distribution of the
|
# Enable base target customizations necessary for distribution of the
|
||||||
# cef_sandbox static library.
|
# cef_sandbox static library.
|
||||||
'is_cef_sandbox_build': True,
|
'is_cef_sandbox_build': True,
|
||||||
|
|
||||||
# Disable use of rust for JSON parsing. This avoids a dependency on
|
|
||||||
# rust libraries.
|
|
||||||
'enable_rust_json': False,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if platform == 'windows':
|
if platform == 'windows':
|
||||||
|
|
Loading…
Reference in New Issue