Files
helium/patches/core/ungoogled-chromium/disable-webrtc-log-uploader.patch

128 lines
5.1 KiB
Diff
Raw Normal View History

2017-11-24 20:45:24 +00:00
# Disables WebRTC log uploading to Google
--- a/chrome/browser/media/webrtc/webrtc_log_uploader.cc
+++ b/chrome/browser/media/webrtc/webrtc_log_uploader.cc
2025-10-22 16:34:39 -05:00
@@ -178,31 +178,13 @@ void WebRtcLogUploader::OnLoggingStopped
2017-11-24 20:45:24 +00:00
DCHECK(meta_data.get());
2019-10-07 17:58:01 -05:00
DCHECK(!upload_done_data.paths.directory.empty());
2017-11-24 20:45:24 +00:00
2019-03-26 08:19:19 +03:00
- std::string compressed_log = CompressLog(log_buffer.get());
2017-11-24 20:45:24 +00:00
-
- std::string local_log_id;
-
2019-10-07 17:58:01 -05:00
if (base::PathExists(upload_done_data.paths.directory)) {
webrtc_logging::DeleteOldWebRtcLogFiles(upload_done_data.paths.directory);
2017-11-24 20:45:24 +00:00
-
2023-11-25 14:14:03 -06:00
- local_log_id =
- base::NumberToString(base::Time::Now().InSecondsFSinceUnixEpoch());
2017-11-24 20:45:24 +00:00
- base::FilePath log_file_path =
2019-10-07 17:58:01 -05:00
- upload_done_data.paths.directory.AppendASCII(local_log_id)
2017-11-24 20:45:24 +00:00
- .AddExtension(FILE_PATH_LITERAL(".gz"));
- WriteCompressedLogToFile(compressed_log, log_file_path);
-
- base::FilePath log_list_path =
2018-10-04 21:58:11 +02:00
- webrtc_logging::TextLogList::GetWebRtcLogListFileForDirectory(
2019-10-07 17:58:01 -05:00
- upload_done_data.paths.directory);
2017-11-24 20:45:24 +00:00
- AddLocallyStoredLogInfoToUploadListFile(log_list_path, local_log_id);
}
2018-10-04 21:58:11 +02:00
2020-10-10 19:34:03 -04:00
- upload_done_data.local_log_id = local_log_id;
2017-11-24 20:45:24 +00:00
2023-04-26 10:38:53 -05:00
if (is_text_log_upload_allowed) {
- PrepareMultipartPostData(compressed_log, std::move(meta_data),
- std::move(upload_done_data));
+ NotifyUploadDoneAndLogStats(net::HTTP_OK, net::OK, "", std::move(upload_done_data));
} else {
main_task_runner_->PostTask(
FROM_HERE,
2025-10-22 16:34:39 -05:00
@@ -219,28 +201,7 @@ void WebRtcLogUploader::PrepareMultipart
2017-11-24 20:45:24 +00:00
DCHECK(!compressed_log.empty());
DCHECK(meta_data.get());
- std::unique_ptr<std::string> post_data(new std::string());
2018-07-27 13:18:41 +02:00
- SetupMultipart(post_data.get(), compressed_log,
2019-10-07 17:58:01 -05:00
- upload_done_data.paths.incoming_rtp_dump,
- upload_done_data.paths.outgoing_rtp_dump, *meta_data.get());
2017-11-24 20:45:24 +00:00
-
- // If a test has set the test string pointer, write to it and skip uploading.
- // Still fire the upload callback so that we can run an extension API test
- // using the test framework for that without hanging.
- // TODO(grunell): Remove this when the api test for this feature is fully
- // implemented according to the test plan. http://crbug.com/257329.
- if (post_data_) {
- *post_data_ = *post_data;
2020-10-10 19:34:03 -04:00
- NotifyUploadDoneAndLogStats(net::HTTP_OK, net::OK, "",
- std::move(upload_done_data));
2017-11-24 20:45:24 +00:00
- return;
- }
-
2019-09-11 16:49:14 +02:00
- main_task_runner_->PostTask(
2020-10-10 19:34:03 -04:00
- FROM_HERE,
- base::BindOnce(&WebRtcLogUploader::UploadCompressedLog,
- base::Unretained(this), std::move(upload_done_data),
- std::move(post_data)));
+ NotifyUploadDoneAndLogStats(net::HTTP_OK, net::OK, "", std::move(upload_done_data));
2017-11-24 20:45:24 +00:00
}
void WebRtcLogUploader::UploadStoredLog(
2025-10-22 16:34:39 -05:00
@@ -307,48 +268,6 @@ void WebRtcLogUploader::LoggingStoppedDo
2019-09-11 16:49:14 +02:00
DCHECK(log_buffer.get());
2019-10-07 17:58:01 -05:00
DCHECK(!log_paths.directory.empty());
2017-11-24 20:45:24 +00:00
2019-10-07 17:58:01 -05:00
- webrtc_logging::DeleteOldWebRtcLogFiles(log_paths.directory);
2019-09-11 16:49:14 +02:00
-
2017-11-24 20:45:24 +00:00
- base::FilePath log_list_path =
2018-10-04 21:58:11 +02:00
- webrtc_logging::TextLogList::GetWebRtcLogListFileForDirectory(
2019-10-07 17:58:01 -05:00
- log_paths.directory);
2017-11-24 20:45:24 +00:00
-
- // Store the native log with a ".gz" extension.
2019-03-26 08:19:19 +03:00
- std::string compressed_log = CompressLog(log_buffer.get());
2018-07-27 13:18:41 +02:00
- base::FilePath native_log_path =
2019-10-07 17:58:01 -05:00
- log_paths.directory.AppendASCII(log_id).AddExtension(
2018-07-27 13:18:41 +02:00
- FILE_PATH_LITERAL(".gz"));
2017-11-24 20:45:24 +00:00
- WriteCompressedLogToFile(compressed_log, native_log_path);
- AddLocallyStoredLogInfoToUploadListFile(log_list_path, log_id);
-
- // Move the rtp dump files to the log directory with a name of
- // <log id>.rtp_[in|out].
- if (!log_paths.incoming_rtp_dump.empty()) {
2018-07-27 13:18:41 +02:00
- base::FilePath rtp_path =
2019-10-07 17:58:01 -05:00
- log_paths.directory.AppendASCII(log_id).AddExtension(
2018-07-27 13:18:41 +02:00
- FILE_PATH_LITERAL(".rtp_in"));
2017-11-24 20:45:24 +00:00
- base::Move(log_paths.incoming_rtp_dump, rtp_path);
- }
-
- if (!log_paths.outgoing_rtp_dump.empty()) {
2018-07-27 13:18:41 +02:00
- base::FilePath rtp_path =
2019-10-07 17:58:01 -05:00
- log_paths.directory.AppendASCII(log_id).AddExtension(
2018-07-27 13:18:41 +02:00
- FILE_PATH_LITERAL(".rtp_out"));
2017-11-24 20:45:24 +00:00
- base::Move(log_paths.outgoing_rtp_dump, rtp_path);
- }
-
- if (meta_data.get() && !meta_data->empty()) {
- base::Pickle pickle;
- for (const auto& it : *meta_data.get()) {
- pickle.WriteString(it.first);
- pickle.WriteString(it.second);
- }
2018-07-27 13:18:41 +02:00
- base::FilePath meta_path =
2019-10-07 17:58:01 -05:00
- log_paths.directory.AppendASCII(log_id).AddExtension(
2018-07-27 13:18:41 +02:00
- FILE_PATH_LITERAL(".meta"));
2024-02-13 13:54:32 -06:00
- base::WriteFile(meta_path, pickle);
2017-11-24 20:45:24 +00:00
- }
-
2020-10-10 19:34:03 -04:00
main_task_runner_->PostTask(
FROM_HERE, base::BindOnce(std::move(done_callback), true, ""));
2017-11-24 20:45:24 +00:00
2023-04-26 10:38:53 -05:00
--- a/chrome/browser/ui/browser_ui_prefs.cc
+++ b/chrome/browser/ui/browser_ui_prefs.cc
2025-11-20 11:54:19 -06:00
@@ -146,7 +146,7 @@ void RegisterBrowserUserPrefs(user_prefs
2024-01-14 09:08:33 -06:00
registry->RegisterStringPref(prefs::kWebRTCUDPPortRange, std::string());
2023-04-26 10:38:53 -05:00
registry->RegisterBooleanPref(prefs::kWebRtcEventLogCollectionAllowed, false);
registry->RegisterListPref(prefs::kWebRtcLocalIpsAllowedUrls);
- registry->RegisterBooleanPref(prefs::kWebRtcTextLogCollectionAllowed, true);
+ registry->RegisterBooleanPref(prefs::kWebRtcTextLogCollectionAllowed, false);
2024-02-13 13:54:32 -06:00
// We need to register the type of these preferences in order to query
// them even though they're only typically controlled via policy.