use base::RandInt
This commit is contained in:
parent
95090b016d
commit
76992d379b
1 changed files with 9 additions and 7 deletions
|
@ -1206,15 +1206,18 @@ diff --git a/components/content_settings/core/common/pref_names.h b/components/c
|
|||
diff --git a/components/content_settings/renderer/content_settings_agent_impl.cc b/components/content_settings/renderer/content_settings_agent_impl.cc
|
||||
--- a/components/content_settings/renderer/content_settings_agent_impl.cc
|
||||
+++ b/components/content_settings/renderer/content_settings_agent_impl.cc
|
||||
@@ -9,6 +9,7 @@
|
||||
@@ -9,8 +9,10 @@
|
||||
|
||||
#include "base/bind.h"
|
||||
#include "base/feature_list.h"
|
||||
+#include "base/logging.h"
|
||||
#include "base/metrics/histogram_macros.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
+#include "base/rand_util.h"
|
||||
#include "components/content_settings/core/common/content_settings.h"
|
||||
@@ -32,6 +33,10 @@
|
||||
#include "components/content_settings/core/common/content_settings.mojom.h"
|
||||
#include "components/content_settings/core/common/content_settings_pattern.h"
|
||||
@@ -32,6 +34,10 @@
|
||||
#include "third_party/blink/public/web/web_local_frame.h"
|
||||
#include "third_party/blink/public/web/web_local_frame_client.h"
|
||||
#include "third_party/blink/public/web/web_view.h"
|
||||
|
@ -1225,7 +1228,7 @@ diff --git a/components/content_settings/renderer/content_settings_agent_impl.cc
|
|||
#include "url/gurl.h"
|
||||
#include "url/origin.h"
|
||||
#include "url/url_constants.h"
|
||||
@@ -45,6 +50,8 @@ using blink::WebURL;
|
||||
@@ -45,6 +51,8 @@ using blink::WebURL;
|
||||
using blink::WebView;
|
||||
using content::DocumentState;
|
||||
|
||||
|
@ -1234,7 +1237,7 @@ diff --git a/components/content_settings/renderer/content_settings_agent_impl.cc
|
|||
namespace content_settings {
|
||||
namespace {
|
||||
|
||||
@@ -377,6 +384,10 @@ bool ContentSettingsAgentImpl::AllowScript(bool enabled_per_settings) {
|
||||
@@ -377,6 +385,10 @@ bool ContentSettingsAgentImpl::AllowScript(bool enabled_per_settings) {
|
||||
allow = allow || IsWhitelistedForContentSettings();
|
||||
|
||||
cached_script_permissions_[frame] = allow;
|
||||
|
@ -1245,7 +1248,7 @@ diff --git a/components/content_settings/renderer/content_settings_agent_impl.cc
|
|||
return allow;
|
||||
}
|
||||
|
||||
@@ -509,4 +520,82 @@ bool ContentSettingsAgentImpl::IsWhitelistedForContentSettings() const {
|
||||
@@ -509,4 +521,81 @@ bool ContentSettingsAgentImpl::IsWhitelistedForContentSettings() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1287,8 +1290,7 @@ diff --git a/components/content_settings/renderer/content_settings_agent_impl.cc
|
|||
+ } else if (setting == CONTENT_SETTING_BLOCK) {
|
||||
+ // timezone random
|
||||
+ UErrorCode ec = U_ZERO_ERROR;
|
||||
+ std::srand(std::time(nullptr));
|
||||
+ int32_t rawOffset = ((std::rand() % 24) - 12) * 3600 * 1000;
|
||||
+ int32_t rawOffset = base::RandInt(-12, 11) * 3600 * 1000;
|
||||
+ icu::StringEnumeration* timezones = icu::TimeZone::createEnumeration(
|
||||
+ rawOffset); // Obtain timezones by GMT timezone offset
|
||||
+ if (timezones) {
|
||||
|
|
Loading…
Add table
Reference in a new issue