Add Disable-ua-full-version.patch (#1869)
* Add Disable-ua-full-version.patch * add csagan5 suggestions Co-authored-by: Carmelo Messina <uazo@users.noreply.github.com>
This commit is contained in:
parent
f89c101a77
commit
8edca3e627
1 changed files with 58 additions and 0 deletions
58
build/patches/Disable-ua-full-version.patch
Normal file
58
build/patches/Disable-ua-full-version.patch
Normal file
|
@ -0,0 +1,58 @@
|
|||
From: uazo <uazo@users.noreply.github.com>
|
||||
Date: Wed, 16 Feb 2022 14:28:58 +0000
|
||||
Subject: Disable ua full version in getHighEntropyValues()
|
||||
|
||||
getHighEntropyValues returns only the major version
|
||||
---
|
||||
.../renderer/core/frame/navigator_ua_data.cc | 16 ++++++++++++++--
|
||||
1 file changed, 14 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/third_party/blink/renderer/core/frame/navigator_ua_data.cc b/third_party/blink/renderer/core/frame/navigator_ua_data.cc
|
||||
--- a/third_party/blink/renderer/core/frame/navigator_ua_data.cc
|
||||
+++ b/third_party/blink/renderer/core/frame/navigator_ua_data.cc
|
||||
@@ -6,6 +6,8 @@
|
||||
|
||||
#include "base/compiler_specific.h"
|
||||
#include "base/task/single_thread_task_runner.h"
|
||||
+#include "base/version.h"
|
||||
+#include "base/strings/strcat.h"
|
||||
#include "third_party/blink/public/common/privacy_budget/identifiability_metric_builder.h"
|
||||
#include "third_party/blink/public/common/privacy_budget/identifiability_study_settings.h"
|
||||
#include "third_party/blink/public/common/privacy_budget/identifiable_surface.h"
|
||||
@@ -37,6 +39,16 @@ void MaybeRecordMetric(bool record_identifiability,
|
||||
.Record(execution_context->UkmRecorder());
|
||||
}
|
||||
|
||||
+const String GetReducedVersionNumber(const std::string& fullVersion) {
|
||||
+ base::Version version(fullVersion);
|
||||
+ std::string version_str;
|
||||
+ const std::vector<uint32_t>& components = version.components();
|
||||
+ if (components.size() > 0) {
|
||||
+ version_str = base::StrCat({base::NumberToString(components[0]), ".0.0.0"});
|
||||
+ }
|
||||
+ return String::FromUTF8(version_str);
|
||||
+}
|
||||
+
|
||||
} // namespace
|
||||
|
||||
NavigatorUAData::NavigatorUAData(ExecutionContext* context)
|
||||
@@ -75,7 +87,7 @@ void NavigatorUAData::SetFullVersionList(
|
||||
const UserAgentBrandList& full_version_list) {
|
||||
for (const auto& brand_version : full_version_list) {
|
||||
AddBrandFullVersion(String::FromUTF8(brand_version.brand),
|
||||
- String::FromUTF8(brand_version.version));
|
||||
+ GetReducedVersionNumber(brand_version.version));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,7 +109,7 @@ void NavigatorUAData::SetModel(const String& model) {
|
||||
}
|
||||
|
||||
void NavigatorUAData::SetUAFullVersion(const String& ua_full_version) {
|
||||
- ua_full_version_ = ua_full_version;
|
||||
+ ua_full_version_ = GetReducedVersionNumber(ua_full_version.Ascii());
|
||||
}
|
||||
|
||||
void NavigatorUAData::SetBitness(const String& bitness) {
|
||||
--
|
||||
2.25.1
|
Loading…
Add table
Reference in a new issue