Add some useful windows patches
This commit is contained in:
@@ -0,0 +1,97 @@
|
||||
From: uazo <uazo@users.noreply.github.com>
|
||||
Date: Fri, 14 Apr 2023 13:55:58 +0000
|
||||
Subject: WIN Fix log to file
|
||||
|
||||
Allows log activation without opening the console window.
|
||||
Log rotation enabled by default.
|
||||
---
|
||||
chrome/common/logging_chrome.cc | 10 +++++++---
|
||||
chrome/common/logging_chrome.h | 6 ++++--
|
||||
content/app/content_main.cc | 6 +++++-
|
||||
3 files changed, 16 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/chrome/common/logging_chrome.cc b/chrome/common/logging_chrome.cc
|
||||
--- a/chrome/common/logging_chrome.cc
|
||||
+++ b/chrome/common/logging_chrome.cc
|
||||
@@ -185,7 +185,7 @@ LoggingDestination DetermineLoggingDestination(
|
||||
return kDefaultLoggingMode;
|
||||
}
|
||||
|
||||
-#if BUILDFLAG(IS_CHROMEOS)
|
||||
+#if BUILDFLAG(IS_WIN)
|
||||
bool RotateLogFile(const base::FilePath& target_path) {
|
||||
DCHECK(!target_path.empty());
|
||||
// If the old log file doesn't exist, do nothing.
|
||||
@@ -230,7 +230,7 @@ bool RotateLogFile(const base::FilePath& target_path) {
|
||||
|
||||
return true;
|
||||
}
|
||||
-#endif // BUILDFLAG(IS_CHROMEOS)
|
||||
+#endif // BUILDFLAG(IS_WIN)
|
||||
|
||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
base::FilePath SetUpSymlinkIfNeeded(const base::FilePath& symlink_path,
|
||||
@@ -392,6 +392,10 @@ void InitChromeLogging(const base::CommandLine& command_line,
|
||||
// since that will remove the newly created link instead.
|
||||
delete_old_log_file = APPEND_TO_OLD_LOG_FILE;
|
||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
+
|
||||
+#if BUILDFLAG(IS_WIN)
|
||||
+ RotateLogFile(log_path);
|
||||
+#endif
|
||||
} else {
|
||||
log_locking_state = DONT_LOCK_LOG_FILE;
|
||||
}
|
||||
@@ -546,7 +550,7 @@ bool DialogsAreSuppressed() {
|
||||
return dialogs_are_suppressed_;
|
||||
}
|
||||
|
||||
-#if BUILDFLAG(IS_CHROMEOS)
|
||||
+#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_WIN)
|
||||
base::FilePath GenerateTimestampedName(const base::FilePath& base_path,
|
||||
base::Time timestamp) {
|
||||
base::Time::Exploded time_deets;
|
||||
diff --git a/chrome/common/logging_chrome.h b/chrome/common/logging_chrome.h
|
||||
--- a/chrome/common/logging_chrome.h
|
||||
+++ b/chrome/common/logging_chrome.h
|
||||
@@ -41,10 +41,12 @@ LoggingDestination DetermineLoggingDestination(
|
||||
// write new logs to the latest log file. Otherwise, we reuse the existing file
|
||||
// if exists.
|
||||
base::FilePath SetUpLogFile(const base::FilePath& target_path, bool new_log);
|
||||
+#endif // BUILDFLAG(IS_CHROMEOS)
|
||||
|
||||
+#if BUILDFLAG(IS_WIN)
|
||||
// Allow external calls to the internal method for testing.
|
||||
bool RotateLogFile(const base::FilePath& target_path);
|
||||
-#endif // BUILDFLAG(IS_CHROMEOS)
|
||||
+#endif // BUILDFLAG(IS_WIN)
|
||||
|
||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
#if defined(UNIT_TEST)
|
||||
@@ -76,7 +78,7 @@ base::FilePath GetLogFileName(const base::CommandLine& command_line);
|
||||
// otherwise.
|
||||
bool DialogsAreSuppressed();
|
||||
|
||||
-#if BUILDFLAG(IS_CHROMEOS)
|
||||
+#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_WIN)
|
||||
// Inserts timestamp before file extension (if any) in the form
|
||||
// "_yymmdd-hhmmss".
|
||||
base::FilePath GenerateTimestampedName(const base::FilePath& base_path,
|
||||
diff --git a/content/app/content_main.cc b/content/app/content_main.cc
|
||||
--- a/content/app/content_main.cc
|
||||
+++ b/content/app/content_main.cc
|
||||
@@ -306,7 +306,11 @@ RunContentProcess(ContentMainParams params,
|
||||
// Route stdio to parent console (if any) or create one.
|
||||
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
|
||||
switches::kEnableLogging)) {
|
||||
- base::RouteStdioToConsole(true);
|
||||
+ std::string logging_destination =
|
||||
+ base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(switches::kEnableLogging);
|
||||
+ if (logging_destination == "stderr") {
|
||||
+ base::RouteStdioToConsole(true);
|
||||
+ }
|
||||
}
|
||||
#endif
|
||||
|
||||
--
|
||||
2.25.1
|
||||
@@ -0,0 +1,69 @@
|
||||
From: uazo <uazo@users.noreply.github.com>
|
||||
Date: Sat, 15 Apr 2023 10:25:33 +0000
|
||||
Subject: WIN minimum data to enable install extensions
|
||||
|
||||
The amount of information sent is minimized without disabling
|
||||
the ability to install extensions (which is under user control)
|
||||
---
|
||||
chrome/browser/extensions/webstore_install_helper.cc | 2 +-
|
||||
chrome/browser/extensions/webstore_installer.cc | 2 +-
|
||||
.../update_client/chrome_update_query_params_delegate.cc | 5 ++---
|
||||
components/update_client/update_query_params.cc | 5 ++---
|
||||
4 files changed, 6 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/chrome/browser/extensions/webstore_install_helper.cc b/chrome/browser/extensions/webstore_install_helper.cc
|
||||
--- a/chrome/browser/extensions/webstore_install_helper.cc
|
||||
+++ b/chrome/browser/extensions/webstore_install_helper.cc
|
||||
@@ -46,7 +46,7 @@ void WebstoreInstallHelper::Start(
|
||||
data_decoder::DataDecoder::ParseJsonIsolated(
|
||||
manifest_, base::BindOnce(&WebstoreInstallHelper::OnJSONParsed, this));
|
||||
|
||||
- if (icon_url_.is_empty()) {
|
||||
+ if ((true) || icon_url_.is_empty()) {
|
||||
icon_decode_complete_ = true;
|
||||
} else {
|
||||
// No existing |icon_fetcher_| to avoid unbalanced AddRef().
|
||||
diff --git a/chrome/browser/extensions/webstore_installer.cc b/chrome/browser/extensions/webstore_installer.cc
|
||||
--- a/chrome/browser/extensions/webstore_installer.cc
|
||||
+++ b/chrome/browser/extensions/webstore_installer.cc
|
||||
@@ -644,7 +644,7 @@ void WebstoreInstaller::StartDownload(const std::string& extension_id,
|
||||
download_url_, render_process_host_id, render_frame_host->GetRoutingID(),
|
||||
traffic_annotation));
|
||||
params->set_file_path(file);
|
||||
- if (controller.GetVisibleEntry()) {
|
||||
+ if ((false) && controller.GetVisibleEntry()) {
|
||||
content::Referrer referrer = content::Referrer::SanitizeForRequest(
|
||||
download_url_,
|
||||
content::Referrer(controller.GetVisibleEntry()->GetURL(),
|
||||
diff --git a/chrome/browser/update_client/chrome_update_query_params_delegate.cc b/chrome/browser/update_client/chrome_update_query_params_delegate.cc
|
||||
--- a/chrome/browser/update_client/chrome_update_query_params_delegate.cc
|
||||
+++ b/chrome/browser/update_client/chrome_update_query_params_delegate.cc
|
||||
@@ -31,9 +31,8 @@ ChromeUpdateQueryParamsDelegate::GetInstance() {
|
||||
|
||||
std::string ChromeUpdateQueryParamsDelegate::GetExtraParams() {
|
||||
return base::StringPrintf(
|
||||
- "&prodchannel=%s&prodversion=%s&lang=%s",
|
||||
- chrome::GetChannelName(chrome::WithExtendedStable(true)).c_str(),
|
||||
- version_info::GetVersionNumber().c_str(), GetLang());
|
||||
+ "&prodversion=%s.0.0.0",
|
||||
+ version_info::GetMajorVersionNumber().c_str());
|
||||
}
|
||||
|
||||
// static
|
||||
diff --git a/components/update_client/update_query_params.cc b/components/update_client/update_query_params.cc
|
||||
--- a/components/update_client/update_query_params.cc
|
||||
+++ b/components/update_client/update_query_params.cc
|
||||
@@ -86,9 +86,8 @@ UpdateQueryParamsDelegate* g_delegate = nullptr;
|
||||
// static
|
||||
std::string UpdateQueryParams::Get(ProdId prod) {
|
||||
return base::StringPrintf(
|
||||
- "os=%s&arch=%s&os_arch=%s&nacl_arch=%s&prod=%s%s&acceptformat=crx3", kOs,
|
||||
- kArch, base::SysInfo().OperatingSystemArchitecture().c_str(),
|
||||
- GetNaclArch(), GetProdIdString(prod),
|
||||
+ "prod=%s%s&acceptformat=crx3",
|
||||
+ GetProdIdString(prod),
|
||||
g_delegate ? g_delegate->GetExtraParams().c_str() : "");
|
||||
}
|
||||
|
||||
--
|
||||
2.25.1
|
||||
Reference in New Issue
Block a user