Release 67.0.3396.92

This commit is contained in:
csagan5 2018-06-20 21:18:07 +02:00
parent 6e86d3db21
commit d9a4d2dc88
8 changed files with 292 additions and 442 deletions

View file

@ -1,3 +1,7 @@
# 67.0.3396.92
* improve randomisation for each retrieved Canvas data (fixes )https://github.com/bromite/bromite/issues/69
* updated AdBlock filters
# 67.0.3396.88
* add flag for DNS-over-HTTPS (Google experimental DNS) (fixes https://github.com/bromite/bromite/issues/68)
* disable signin, translate and data saver UI/internal components (fixes https://github.com/bromite/bromite/issues/67)

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
From: csagan5 <32685696+csagan5@users.noreply.github.com>
Date: Mon, 11 Dec 2017 22:42:11 +0100
Subject: Added Google English-only engine
Subject: Add Google English-only engine
Add a Google search engine that forces languages to English,
disable from all its searches RLZ and field experiments querystring parameters.

View file

@ -4,19 +4,21 @@ Subject: Canvas: fingerprinting mitigations for image data, font metrics and
webGL
Disable webGL renderering info, add shuffling to TextMetrics;
additionally the color data returned by ToBlob and ToDataURL will
contain randomly manipulated pixels (maximum 6) that slightly
additionally, the color data returned by ToBlob and ToDataURL will
contain randomly manipulated pixels (maximum 10) that slightly
change the color R,G,B components without visibly altering the rendering.
Credits to Slaviro (https://github.com/Slaviro) for coming up with a better
approach to change color components.
---
.../renderer/core/html/canvas/text_metrics.cc | 20 +++
.../blink/renderer/core/html/canvas/text_metrics.h | 2 +
.../core/offscreencanvas/offscreen_canvas.cc | 1 +
.../canvas/canvas2d/base_rendering_context_2d.cc | 3 +
.../canvas/canvas2d/canvas_rendering_context_2d.cc | 6 +-
.../modules/webgl/webgl_debug_renderer_info.cc | 4 +-
.../platform/graphics/image_data_buffer.cc | 136 +++++++++++++++++++++
.../platform/graphics/image_data_buffer.cc | 137 +++++++++++++++++++++
.../renderer/platform/graphics/image_data_buffer.h | 2 +
8 files changed, 171 insertions(+), 3 deletions(-)
7 files changed, 171 insertions(+), 3 deletions(-)
diff --git a/third_party/blink/renderer/core/html/canvas/text_metrics.cc b/third_party/blink/renderer/core/html/canvas/text_metrics.cc
--- a/third_party/blink/renderer/core/html/canvas/text_metrics.cc
@ -60,17 +62,6 @@ diff --git a/third_party/blink/renderer/core/html/canvas/text_metrics.h b/third_
private:
void Update(const Font&,
const TextDirection&,
diff --git a/third_party/blink/renderer/core/offscreencanvas/offscreen_canvas.cc b/third_party/blink/renderer/core/offscreencanvas/offscreen_canvas.cc
--- a/third_party/blink/renderer/core/offscreencanvas/offscreen_canvas.cc
+++ b/third_party/blink/renderer/core/offscreencanvas/offscreen_canvas.cc
@@ -403,6 +403,7 @@ ScriptPromise OffscreenCanvas::convertToBlob(ScriptState* script_state,
CanvasAsyncBlobCreator* async_creator = CanvasAsyncBlobCreator::Create(
snapshot, encoding_mime_type, start_time,
ExecutionContext::From(script_state), resolver);
+
async_creator->ScheduleAsyncBlobCreation(options.quality());
return resolver->Promise();
} else {
diff --git a/third_party/blink/renderer/modules/canvas/canvas2d/base_rendering_context_2d.cc b/third_party/blink/renderer/modules/canvas/canvas2d/base_rendering_context_2d.cc
--- a/third_party/blink/renderer/modules/canvas/canvas2d/base_rendering_context_2d.cc
+++ b/third_party/blink/renderer/modules/canvas/canvas2d/base_rendering_context_2d.cc
@ -79,7 +70,7 @@ diff --git a/third_party/blink/renderer/modules/canvas/canvas2d/base_rendering_c
scoped_refptr<StaticBitmapImage> snapshot = GetImage(kPreferNoAcceleration);
+ //TODO: calculate some random value and use it to shuffle pixel data in 'snapshot'
+ // it should StaticBitmapImage somehow
+ // it should be a StaticBitmapImage somehow
+
if (!StaticBitmapImage::ConvertToArrayBufferContents(
snapshot, contents, image_data_rect, color_params, IsAccelerated())) {
@ -137,14 +128,16 @@ diff --git a/third_party/blink/renderer/platform/graphics/image_data_buffer.cc b
namespace blink {
@@ -116,11 +118,145 @@ const unsigned char* ImageDataBuffer::Pixels() const {
@@ -116,11 +118,146 @@ const unsigned char* ImageDataBuffer::Pixels() const {
return static_cast<const unsigned char*>(pixmap_.addr());
}
+#define shuffleComponent(color, max, delta) ((color) >= (max) ? -(delta) : (delta))
+
+void ImageDataBuffer::shuffleSubchannelColorData() const {
+ auto w = pixmap_.width(), h = pixmap_.height();
+ // generate the first random number here
+ double shuffleX = base::RandDouble();
+ double shuffleX = 0.5 + base::RandDouble() * 0.5;
+
+ // cap maximum pixels to change
+ auto pixels = (w + h) / 128;
@ -154,31 +147,29 @@ diff --git a/third_party/blink/renderer/platform/graphics/image_data_buffer.cc b
+ pixels = 2;
+ }
+
+ // second random number (for y/height)
+ double shuffleY = base::RandDouble();
+
+ // calculate amounts to change per component
+ double shuffleR = shuffleX - 0.5, shuffleG = shuffleY - 0.5, shuffleB = (shuffleX + shuffleY)/2 - 0.5;
+ shuffleR *= 0.03;
+ shuffleG *= 0.03;
+ shuffleB *= 0.03;
+
+ auto colorType = pixmap_.colorType();
+
+ // second random number (for y/height)
+ double shuffleY = 0.5 + base::RandDouble() * 0.5;
+
+ // calculate random coordinates using bisection
+ auto currentW = w, currentH = h;
+ for(;pixels >= 0; pixels--) {
+ int x = currentW * shuffleX, y = currentH * shuffleY;
+
+ // calculate randomisation amounts for each RGB component
+ auto shuffleR = (uint8_t)base::RandInt(0, 4), shuffleG = (uint8_t)base::RandInt(0, 4), shuffleB = (uint8_t)base::RandInt(0, 4);
+
+ // manipulate pixel data to slightly change the R, G, B components
+ switch (colorType) {
+ case kAlpha_8_SkColorType:
+ {
+ uint8_t *pixel = pixmap_.writable_addr8(x, y);
+ auto r = SkColorGetR(*pixel), g = SkColorGetG(*pixel), b = SkColorGetB(*pixel), a = SkColorGetA(*pixel);
+ r *= shuffleR;
+ g *= shuffleG;
+ b *= shuffleB;
+
+ r += shuffleComponent(r, UINT8_MAX-1, shuffleR);
+ g += shuffleComponent(g, UINT8_MAX-1, shuffleG);
+ b += shuffleComponent(b, UINT8_MAX-1, shuffleB);
+ // alpha is left unchanged
+
+ *pixel = SkColorSetARGB(a, r, g, b);
@ -187,7 +178,7 @@ diff --git a/third_party/blink/renderer/platform/graphics/image_data_buffer.cc b
+ case kGray_8_SkColorType:
+ {
+ uint8_t *pixel = pixmap_.writable_addr8(x, y);
+ *pixel = *pixel * shuffleB;
+ *pixel += shuffleComponent(*pixel, UINT8_MAX-1, shuffleB);
+ }
+ break;
+ case kRGB_565_SkColorType:
@ -196,9 +187,10 @@ diff --git a/third_party/blink/renderer/platform/graphics/image_data_buffer.cc b
+ unsigned r = SkPacked16ToR32(*pixel);
+ unsigned g = SkPacked16ToG32(*pixel);
+ unsigned b = SkPacked16ToB32(*pixel);
+ r *= shuffleR;
+ g *= shuffleG;
+ b *= shuffleB;
+
+ r += shuffleComponent(r, 31, shuffleR);
+ g += shuffleComponent(g, 63, shuffleG);
+ b += shuffleComponent(b, 31, shuffleB);
+
+ unsigned r16 = (r & SK_R16_MASK) << SK_R16_SHIFT;
+ unsigned g16 = (g & SK_G16_MASK) << SK_G16_SHIFT;
@ -212,9 +204,9 @@ diff --git a/third_party/blink/renderer/platform/graphics/image_data_buffer.cc b
+ uint16_t *pixel = pixmap_.writable_addr16(x, y);
+ auto a = SkGetPackedA4444(*pixel), r = SkGetPackedR4444(*pixel), g = SkGetPackedG4444(*pixel), b = SkGetPackedB4444(*pixel);
+
+ r *= shuffleR;
+ g *= shuffleG;
+ b *= shuffleB;
+ r += shuffleComponent(r, 15, shuffleR);
+ g += shuffleComponent(g, 15, shuffleG);
+ b += shuffleComponent(b, 15, shuffleB);
+ // alpha is left unchanged
+
+ unsigned a4 = (a & 0xF) << SK_A4444_SHIFT;
@ -230,9 +222,9 @@ diff --git a/third_party/blink/renderer/platform/graphics/image_data_buffer.cc b
+ uint32_t *pixel = pixmap_.writable_addr32(x, y);
+ auto a = SkGetPackedA32(*pixel), r = SkGetPackedR32(*pixel), g = SkGetPackedG32(*pixel), b = SkGetPackedB32(*pixel);
+
+ r *= shuffleR;
+ g *= shuffleG;
+ b *= shuffleB;
+ r += shuffleComponent(r, UINT8_MAX-1, shuffleR);
+ g += shuffleComponent(g, UINT8_MAX-1, shuffleG);
+ b += shuffleComponent(b, UINT8_MAX-1, shuffleB);
+ // alpha is left unchanged
+
+ *pixel = (a << SK_A32_SHIFT) | (r << SK_R32_SHIFT) |
@ -244,9 +236,9 @@ diff --git a/third_party/blink/renderer/platform/graphics/image_data_buffer.cc b
+ uint32_t *pixel = pixmap_.writable_addr32(x, y);
+ auto a = SkGetPackedA32(*pixel), b = SkGetPackedR32(*pixel), g = SkGetPackedG32(*pixel), r = SkGetPackedB32(*pixel);
+
+ r *= shuffleR;
+ g *= shuffleG;
+ b *= shuffleB;
+ r += shuffleComponent(r, UINT8_MAX-1, shuffleR);
+ g += shuffleComponent(g, UINT8_MAX-1, shuffleG);
+ b += shuffleComponent(b, UINT8_MAX-1, shuffleB);
+ // alpha is left unchanged
+
+ *pixel = (a << SK_BGRA_A32_SHIFT) | (r << SK_BGRA_R32_SHIFT) |

View file

@ -2,30 +2,43 @@ From: csagan5 <32685696+csagan5@users.noreply.github.com>
Date: Sat, 28 Apr 2018 08:30:26 +0200
Subject: Add a flag for DNS-over-HTTPS
Specify explicit values for the DNS-over-HTTPS servers (Google experimental DNS).
Allow selection between Google and Cloudflare endpoints.
See also: https://tools.ietf.org/id/draft-ietf-doh-dns-over-https-02.txt
---
chrome/browser/about_flags.cc | 6 ++++++
chrome/browser/flag_descriptions.cc | 3 +++
chrome/browser/flag_descriptions.h | 3 +++
chrome/browser/io_thread.cc | 9 +++++----
chrome/common/chrome_features.cc | 7 +++++++
chrome/common/chrome_features.h | 4 ++++
.../network_session_configurator/common/network_features.cc | 3 ---
.../network_session_configurator/common/network_features.h | 4 ----
8 files changed, 28 insertions(+), 11 deletions(-)
chrome/browser/about_flags.cc | 12 ++++++++++++
chrome/browser/flag_descriptions.cc | 3 +++
chrome/browser/flag_descriptions.h | 3 +++
chrome/browser/io_thread.cc | 14 +++++++++-----
.../common/network_features.cc | 5 +++--
.../network_session_configurator/common/network_features.h | 5 +++--
.../common/network_switch_list.h | 4 ++++
7 files changed, 37 insertions(+), 9 deletions(-)
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -3544,6 +3544,12 @@ const FeatureEntry kFeatureEntries[] = {
@@ -395,6 +395,12 @@ const FeatureEntry::Choice kChromeHomeSwipeLogicChoices[] = {
switches::kChromeHomeSwipeLogicType, "velocity"},
};
+const FeatureEntry::Choice kDnsOverHttpsChoices[] = {
+ {features::kDnsOverHttpsChoiceDefault, "", ""},
+ {features::kDnsOverHttpsChoiceGoogle, switches::kDnsOverHttpsServer, "https://dns.google.com/experimental"},
+ {features::kDnsOverHttpsChoiceCloudflare, switches::kDnsOverHttpsServer, "https://1.1.1.1/dns-query"},
+};
+
#endif // OS_ANDROID
const FeatureEntry::Choice kNumRasterThreadsChoices[] = {
@@ -3544,6 +3550,12 @@ const FeatureEntry kFeatureEntries[] = {
FEATURE_VALUE_TYPE(features::kAsyncDns)},
#endif // defined(OS_ANDROID)
+#if defined(OS_ANDROID)
+ {"enable-dns-over-https", flag_descriptions::kDnsOverHttpsName,
+ flag_descriptions::kDnsOverHttpsDescription, kOsAndroid,
+ FEATURE_VALUE_TYPE(features::kDnsOverHttps)},
+ MULTI_VALUE_TYPE(kDnsOverHttpsChoices)},
+#endif // defined(OS_ANDROID)
+
{"enable-overflow-icons-for-media-controls",
@ -39,7 +52,7 @@ diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descripti
const char kAsyncDnsDescription[] = "Enables the built-in DNS resolver.";
+const char kDnsOverHttpsName[] = "DNS over HTTPS";
+const char kDnsOverHttpsDescription[] = "Enables DNS-over-HTTPS (experimental, non-IETF).";
+const char kDnsOverHttpsDescription[] = "Enables DNS-over-HTTPS (experimental).";
+
const char kAutofillAccessoryViewName[] =
"Autofill suggestions as keyboard accessory view";
@ -60,8 +73,23 @@ diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptio
diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc
--- a/chrome/browser/io_thread.cc
+++ b/chrome/browser/io_thread.cc
@@ -386,10 +386,11 @@ IOThread::IOThread(
if (base::FeatureList::IsEnabled(features::kDnsOverHttps)) {
@@ -53,6 +53,7 @@
#include "components/metrics/metrics_service.h"
#include "components/net_log/chrome_net_log.h"
#include "components/network_session_configurator/common/network_features.h"
+#include "components/network_session_configurator/common/network_switches.h"
#include "components/policy/core/common/policy_service.h"
#include "components/policy/policy_constants.h"
#include "components/prefs/pref_registry_simple.h"
@@ -383,13 +384,16 @@ IOThread::IOThread(
base::Unretained(this)));
dns_client_enabled_.MoveToThread(io_thread_proxy);
- if (base::FeatureList::IsEnabled(features::kDnsOverHttps)) {
+ std::string dnsOverHttpsServer =
+ base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+ switches::kDnsOverHttpsServer);
+ if (!dnsOverHttpsServer.empty()) {
base::Value specs(base::Value::Type::LIST);
base::Value methods(base::Value::Type::LIST);
- base::Value spec(variations::GetVariationParamValueByFeature(
@ -69,69 +97,56 @@ diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc
- base::Value method(variations::GetVariationParamValueByFeature(
- features::kDnsOverHttps, "method"));
+
+ // use some hard-coded defaults
+ base::Value spec("https://dns.google.com/experimental");
+ base::Value spec(dnsOverHttpsServer);
+ base::Value method("POST");
+
if (spec.GetString().size() > 0) {
specs.GetList().push_back(std::move(spec));
methods.GetList().push_back(std::move(method));
diff --git a/chrome/common/chrome_features.cc b/chrome/common/chrome_features.cc
--- a/chrome/common/chrome_features.cc
+++ b/chrome/common/chrome_features.cc
@@ -79,6 +79,13 @@ const base::Feature kAsyncDns {
#endif
};
+// Enable DNS over HTTPS
+// (https://tools.ietf.org/id/draft-ietf-doh-dns-over-https-02.txt).
+const base::Feature kDnsOverHttps {
+ "dns-over-https",
+ base::FEATURE_DISABLED_BY_DEFAULT
+};
+
#if defined(OS_WIN) || defined(OS_MACOSX)
// Enables automatic tab discarding, when the system is in low memory state.
const base::Feature kAutomaticTabDiscarding{"AutomaticTabDiscarding",
diff --git a/chrome/common/chrome_features.h b/chrome/common/chrome_features.h
--- a/chrome/common/chrome_features.h
+++ b/chrome/common/chrome_features.h
@@ -48,6 +48,10 @@ extern const base::Feature kAssetDownloadSuggestionsFeature;
extern const base::Feature kAsyncDns;
+// Enable DNS over HTTPS
+// (https://tools.ietf.org/id/draft-ietf-doh-dns-over-https-02.txt).
+extern const base::Feature kDnsOverHttps;
+
#if defined(OS_WIN) || defined(OS_MACOSX)
extern const base::Feature kAutomaticTabDiscarding;
#endif // defined(OS_WIN) || defined(OS_MACOSX)
diff --git a/components/network_session_configurator/common/network_features.cc b/components/network_session_configurator/common/network_features.cc
--- a/components/network_session_configurator/common/network_features.cc
+++ b/components/network_session_configurator/common/network_features.cc
@@ -9,7 +9,4 @@ namespace features {
@@ -9,7 +9,8 @@ namespace features {
const base::Feature kTokenBinding{"token-binding",
base::FEATURE_DISABLED_BY_DEFAULT};
-const base::Feature kDnsOverHttps{"dns-over-https",
- base::FEATURE_DISABLED_BY_DEFAULT};
-
+const char kDnsOverHttpsChoiceDefault[] = "Disabled",
+ kDnsOverHttpsChoiceGoogle[] = "Google",
+ kDnsOverHttpsChoiceCloudflare[] = "Cloudflare";
} // namespace features
diff --git a/components/network_session_configurator/common/network_features.h b/components/network_session_configurator/common/network_features.h
--- a/components/network_session_configurator/common/network_features.h
+++ b/components/network_session_configurator/common/network_features.h
@@ -14,10 +14,6 @@ namespace features {
@@ -14,9 +14,10 @@ namespace features {
// (https://www.ietf.org/id/draft-ietf-tokbind-protocol-04.txt).
NETWORK_SESSION_CONFIGURATOR_EXPORT extern const base::Feature kTokenBinding;
-// Enabled DNS over HTTPS
-// (https://tools.ietf.org/id/draft-ietf-doh-dns-over-https-02.txt).
+// DNS over HTTPS server endpoint choices
// (https://tools.ietf.org/id/draft-ietf-doh-dns-over-https-02.txt).
-NETWORK_SESSION_CONFIGURATOR_EXPORT extern const base::Feature kDnsOverHttps;
-
+NETWORK_SESSION_CONFIGURATOR_EXPORT extern const char kDnsOverHttpsChoiceDefault[],
+ kDnsOverHttpsChoiceGoogle[], kDnsOverHttpsChoiceCloudflare[];
} // namespace features
#endif // COMPONENTS_NETWORK_SESSION_CONFIGURATOR_COMMON_NETWORK_FEATURES_H_
diff --git a/components/network_session_configurator/common/network_switch_list.h b/components/network_session_configurator/common/network_switch_list.h
--- a/components/network_session_configurator/common/network_switch_list.h
+++ b/components/network_session_configurator/common/network_switch_list.h
@@ -35,6 +35,10 @@ NETWORK_SWITCH(kOriginToForceQuicOn, "origin-to-force-quic-on")
// the server.
NETWORK_SWITCH(kQuicConnectionOptions, "quic-connection-options")
+// Specifies an IETF DNS-over-HTTPS server endpoint
+// (https://tools.ietf.org/id/draft-ietf-doh-dns-over-https-02.txt).
+NETWORK_SWITCH(kDnsOverHttpsServer, "dns-over-https-server")
+
// Specifies the maximum length for a QUIC packet.
NETWORK_SWITCH(kQuicMaxPacketLength, "quic-max-packet-length")
--
2.7.4

View file

@ -11,7 +11,7 @@ Do not read experiment value for cronet async DNS configuration
diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc
--- a/chrome/browser/io_thread.cc
+++ b/chrome/browser/io_thread.cc
@@ -257,15 +257,7 @@ void UpdateMetricsUsagePrefsOnUIThread(const std::string& service_name,
@@ -258,15 +258,7 @@ void UpdateMetricsUsagePrefsOnUIThread(const std::string& service_name,
// Check the AsyncDns field trial and return true if it should be enabled. On
// Android this includes checking the Android version in the field trial.
bool ShouldEnableAsyncDns() {

View file

@ -1,156 +0,0 @@
From: csagan5 <32685696+csagan5@users.noreply.github.com>
Date: Thu, 14 Jun 2018 18:45:31 +0200
Subject: DNS-over-HTTPS: allow selection between Google and CloudFlare
---
chrome/browser/about_flags.cc | 8 +++++++-
chrome/browser/flag_descriptions.cc | 2 +-
chrome/browser/io_thread.cc | 9 ++++++---
chrome/common/chrome_features.cc | 7 -------
chrome/common/chrome_features.h | 4 ----
.../network_session_configurator/common/network_features.cc | 4 ++++
.../network_session_configurator/common/network_features.h | 5 +++++
.../network_session_configurator/common/network_switch_list.h | 4 ++++
8 files changed, 27 insertions(+), 16 deletions(-)
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -395,6 +395,12 @@ const FeatureEntry::Choice kChromeHomeSwipeLogicChoices[] = {
switches::kChromeHomeSwipeLogicType, "velocity"},
};
+const FeatureEntry::Choice kDnsOverHttpsChoices[] = {
+ {features::kDnsOverHttpsChoiceDefault, "", ""},
+ {features::kDnsOverHttpsChoiceGoogle, switches::kDnsOverHttpsServer, "https://dns.google.com/experimental"},
+ {features::kDnsOverHttpsChoiceCloudFlare, switches::kDnsOverHttpsServer, "https://1.1.1.1/dns-query"},
+};
+
#endif // OS_ANDROID
const FeatureEntry::Choice kNumRasterThreadsChoices[] = {
@@ -3547,7 +3553,7 @@ const FeatureEntry kFeatureEntries[] = {
#if defined(OS_ANDROID)
{"enable-dns-over-https", flag_descriptions::kDnsOverHttpsName,
flag_descriptions::kDnsOverHttpsDescription, kOsAndroid,
- FEATURE_VALUE_TYPE(features::kDnsOverHttps)},
+ MULTI_VALUE_TYPE(kDnsOverHttpsChoices)},
#endif // defined(OS_ANDROID)
{"enable-overflow-icons-for-media-controls",
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc
--- a/chrome/browser/flag_descriptions.cc
+++ b/chrome/browser/flag_descriptions.cc
@@ -1850,7 +1850,7 @@ const char kAsyncDnsName[] = "Async DNS resolver";
const char kAsyncDnsDescription[] = "Enables the built-in DNS resolver.";
const char kDnsOverHttpsName[] = "DNS over HTTPS";
-const char kDnsOverHttpsDescription[] = "Enables DNS-over-HTTPS (experimental, non-IETF).";
+const char kDnsOverHttpsDescription[] = "Enables DNS-over-HTTPS (experimental).";
const char kAutofillAccessoryViewName[] =
"Autofill suggestions as keyboard accessory view";
diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc
--- a/chrome/browser/io_thread.cc
+++ b/chrome/browser/io_thread.cc
@@ -53,6 +53,7 @@
#include "components/metrics/metrics_service.h"
#include "components/net_log/chrome_net_log.h"
#include "components/network_session_configurator/common/network_features.h"
+#include "components/network_session_configurator/common/network_switches.h"
#include "components/policy/core/common/policy_service.h"
#include "components/policy/policy_constants.h"
#include "components/prefs/pref_registry_simple.h"
@@ -375,12 +376,14 @@ IOThread::IOThread(
base::Unretained(this)));
dns_client_enabled_.MoveToThread(io_thread_proxy);
- if (base::FeatureList::IsEnabled(features::kDnsOverHttps)) {
+ std::string dnsOverHttpsServer =
+ base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+ switches::kDnsOverHttpsServer);
+ if (!dnsOverHttpsServer.empty()) {
base::Value specs(base::Value::Type::LIST);
base::Value methods(base::Value::Type::LIST);
- // use some hard-coded defaults
- base::Value spec("https://dns.google.com/experimental");
+ base::Value spec(dnsOverHttpsServer);
base::Value method("POST");
if (spec.GetString().size() > 0) {
diff --git a/chrome/common/chrome_features.cc b/chrome/common/chrome_features.cc
--- a/chrome/common/chrome_features.cc
+++ b/chrome/common/chrome_features.cc
@@ -79,13 +79,6 @@ const base::Feature kAsyncDns {
#endif
};
-// Enable DNS over HTTPS
-// (https://tools.ietf.org/id/draft-ietf-doh-dns-over-https-02.txt).
-const base::Feature kDnsOverHttps {
- "dns-over-https",
- base::FEATURE_DISABLED_BY_DEFAULT
-};
-
#if defined(OS_WIN) || defined(OS_MACOSX)
// Enables automatic tab discarding, when the system is in low memory state.
const base::Feature kAutomaticTabDiscarding{"AutomaticTabDiscarding",
diff --git a/chrome/common/chrome_features.h b/chrome/common/chrome_features.h
--- a/chrome/common/chrome_features.h
+++ b/chrome/common/chrome_features.h
@@ -48,10 +48,6 @@ extern const base::Feature kAssetDownloadSuggestionsFeature;
extern const base::Feature kAsyncDns;
-// Enable DNS over HTTPS
-// (https://tools.ietf.org/id/draft-ietf-doh-dns-over-https-02.txt).
-extern const base::Feature kDnsOverHttps;
-
#if defined(OS_WIN) || defined(OS_MACOSX)
extern const base::Feature kAutomaticTabDiscarding;
#endif // defined(OS_WIN) || defined(OS_MACOSX)
diff --git a/components/network_session_configurator/common/network_features.cc b/components/network_session_configurator/common/network_features.cc
--- a/components/network_session_configurator/common/network_features.cc
+++ b/components/network_session_configurator/common/network_features.cc
@@ -9,4 +9,8 @@ namespace features {
const base::Feature kTokenBinding{"token-binding",
base::FEATURE_DISABLED_BY_DEFAULT};
+const char kDnsOverHttpsChoiceDefault[] = "Disabled",
+ kDnsOverHttpsChoiceGoogle[] = "Google",
+ kDnsOverHttpsChoiceCloudFlare[] = "CloudFlare";
+
} // namespace features
diff --git a/components/network_session_configurator/common/network_features.h b/components/network_session_configurator/common/network_features.h
--- a/components/network_session_configurator/common/network_features.h
+++ b/components/network_session_configurator/common/network_features.h
@@ -14,6 +14,11 @@ namespace features {
// (https://www.ietf.org/id/draft-ietf-tokbind-protocol-04.txt).
NETWORK_SESSION_CONFIGURATOR_EXPORT extern const base::Feature kTokenBinding;
+// DNS over HTTPS server endpoint choices
+// (https://tools.ietf.org/id/draft-ietf-doh-dns-over-https-02.txt).
+NETWORK_SESSION_CONFIGURATOR_EXPORT extern const char kDnsOverHttpsChoiceDefault[],
+ kDnsOverHttpsChoiceGoogle[], kDnsOverHttpsChoiceCloudFlare[];
+
} // namespace features
#endif // COMPONENTS_NETWORK_SESSION_CONFIGURATOR_COMMON_NETWORK_FEATURES_H_
diff --git a/components/network_session_configurator/common/network_switch_list.h b/components/network_session_configurator/common/network_switch_list.h
--- a/components/network_session_configurator/common/network_switch_list.h
+++ b/components/network_session_configurator/common/network_switch_list.h
@@ -35,6 +35,10 @@ NETWORK_SWITCH(kOriginToForceQuicOn, "origin-to-force-quic-on")
// the server.
NETWORK_SWITCH(kQuicConnectionOptions, "quic-connection-options")
+// Specifies an IETF DNS-over-HTTPS server endpoint
+// (https://tools.ietf.org/id/draft-ietf-doh-dns-over-https-02.txt).
+NETWORK_SWITCH(kDnsOverHttpsServer, "dns-over-https-server")
+
// Specifies the maximum length for a QUIC packet.
NETWORK_SWITCH(kQuicMaxPacketLength, "quic-max-packet-length")
--
2.7.4

View file

@ -1,160 +0,0 @@
From: csagan5 <32685696+csagan5@users.noreply.github.com>
Date: Mon, 18 Jun 2018 09:03:52 +0200
Subject: Tune canvas randomisation
Randomise RGB for each pixel, change value up to to 8%
Adopt some improvements for RGB randomisation
---
.../core/offscreencanvas/offscreen_canvas.cc | 1 -
.../canvas/canvas2d/base_rendering_context_2d.cc | 2 +-
.../platform/graphics/image_data_buffer.cc | 53 +++++++++++-----------
3 files changed, 28 insertions(+), 28 deletions(-)
diff --git a/third_party/blink/renderer/core/offscreencanvas/offscreen_canvas.cc b/third_party/blink/renderer/core/offscreencanvas/offscreen_canvas.cc
--- a/third_party/blink/renderer/core/offscreencanvas/offscreen_canvas.cc
+++ b/third_party/blink/renderer/core/offscreencanvas/offscreen_canvas.cc
@@ -403,7 +403,6 @@ ScriptPromise OffscreenCanvas::convertToBlob(ScriptState* script_state,
CanvasAsyncBlobCreator* async_creator = CanvasAsyncBlobCreator::Create(
snapshot, encoding_mime_type, start_time,
ExecutionContext::From(script_state), resolver);
-
async_creator->ScheduleAsyncBlobCreation(options.quality());
return resolver->Promise();
} else {
diff --git a/third_party/blink/renderer/modules/canvas/canvas2d/base_rendering_context_2d.cc b/third_party/blink/renderer/modules/canvas/canvas2d/base_rendering_context_2d.cc
--- a/third_party/blink/renderer/modules/canvas/canvas2d/base_rendering_context_2d.cc
+++ b/third_party/blink/renderer/modules/canvas/canvas2d/base_rendering_context_2d.cc
@@ -1621,7 +1621,7 @@ ImageData* BaseRenderingContext2D::getImageData(
scoped_refptr<StaticBitmapImage> snapshot = GetImage(kPreferNoAcceleration);
//TODO: calculate some random value and use it to shuffle pixel data in 'snapshot'
- // it should StaticBitmapImage somehow
+ // it should be a StaticBitmapImage somehow
if (!StaticBitmapImage::ConvertToArrayBufferContents(
snapshot, contents, image_data_rect, color_params, IsAccelerated())) {
diff --git a/third_party/blink/renderer/platform/graphics/image_data_buffer.cc b/third_party/blink/renderer/platform/graphics/image_data_buffer.cc
--- a/third_party/blink/renderer/platform/graphics/image_data_buffer.cc
+++ b/third_party/blink/renderer/platform/graphics/image_data_buffer.cc
@@ -118,10 +118,12 @@ const unsigned char* ImageDataBuffer::Pixels() const {
return static_cast<const unsigned char*>(pixmap_.addr());
}
+#define shuffleComponent(color, max, delta) ((color) >= (max) ? -(delta) : (delta))
+
void ImageDataBuffer::shuffleSubchannelColorData() const {
auto w = pixmap_.width(), h = pixmap_.height();
// generate the first random number here
- double shuffleX = base::RandDouble();
+ double shuffleX = 0.5 + base::RandDouble() * 0.5;
// cap maximum pixels to change
auto pixels = (w + h) / 128;
@@ -131,31 +133,29 @@ void ImageDataBuffer::shuffleSubchannelColorData() const {
pixels = 2;
}
- // second random number (for y/height)
- double shuffleY = base::RandDouble();
-
- // calculate amounts to change per component
- double shuffleR = shuffleX - 0.5, shuffleG = shuffleY - 0.5, shuffleB = (shuffleX + shuffleY)/2 - 0.5;
- shuffleR *= 0.03;
- shuffleG *= 0.03;
- shuffleB *= 0.03;
-
auto colorType = pixmap_.colorType();
+ // second random number (for y/height)
+ double shuffleY = 0.5 + base::RandDouble() * 0.5;
+
// calculate random coordinates using bisection
auto currentW = w, currentH = h;
for(;pixels >= 0; pixels--) {
int x = currentW * shuffleX, y = currentH * shuffleY;
+ // calculate randomisation amounts for each RGB component
+ auto shuffleR = (uint8_t)base::RandInt(0, 4), shuffleG = (uint8_t)base::RandInt(0, 4), shuffleB = (uint8_t)base::RandInt(0, 4);
+
// manipulate pixel data to slightly change the R, G, B components
switch (colorType) {
case kAlpha_8_SkColorType:
{
uint8_t *pixel = pixmap_.writable_addr8(x, y);
auto r = SkColorGetR(*pixel), g = SkColorGetG(*pixel), b = SkColorGetB(*pixel), a = SkColorGetA(*pixel);
- r *= shuffleR;
- g *= shuffleG;
- b *= shuffleB;
+
+ r += shuffleComponent(r, UINT8_MAX-1, shuffleR);
+ g += shuffleComponent(g, UINT8_MAX-1, shuffleG);
+ b += shuffleComponent(b, UINT8_MAX-1, shuffleB);
// alpha is left unchanged
*pixel = SkColorSetARGB(a, r, g, b);
@@ -164,7 +164,7 @@ void ImageDataBuffer::shuffleSubchannelColorData() const {
case kGray_8_SkColorType:
{
uint8_t *pixel = pixmap_.writable_addr8(x, y);
- *pixel = *pixel * shuffleB;
+ *pixel += shuffleComponent(*pixel, UINT8_MAX-1, shuffleB);
}
break;
case kRGB_565_SkColorType:
@@ -173,9 +173,10 @@ void ImageDataBuffer::shuffleSubchannelColorData() const {
unsigned r = SkPacked16ToR32(*pixel);
unsigned g = SkPacked16ToG32(*pixel);
unsigned b = SkPacked16ToB32(*pixel);
- r *= shuffleR;
- g *= shuffleG;
- b *= shuffleB;
+
+ r += shuffleComponent(r, 31, shuffleR);
+ g += shuffleComponent(g, 63, shuffleG);
+ b += shuffleComponent(b, 31, shuffleB);
unsigned r16 = (r & SK_R16_MASK) << SK_R16_SHIFT;
unsigned g16 = (g & SK_G16_MASK) << SK_G16_SHIFT;
@@ -189,9 +190,9 @@ void ImageDataBuffer::shuffleSubchannelColorData() const {
uint16_t *pixel = pixmap_.writable_addr16(x, y);
auto a = SkGetPackedA4444(*pixel), r = SkGetPackedR4444(*pixel), g = SkGetPackedG4444(*pixel), b = SkGetPackedB4444(*pixel);
- r *= shuffleR;
- g *= shuffleG;
- b *= shuffleB;
+ r += shuffleComponent(r, 15, shuffleR);
+ g += shuffleComponent(g, 15, shuffleG);
+ b += shuffleComponent(b, 15, shuffleB);
// alpha is left unchanged
unsigned a4 = (a & 0xF) << SK_A4444_SHIFT;
@@ -207,9 +208,9 @@ void ImageDataBuffer::shuffleSubchannelColorData() const {
uint32_t *pixel = pixmap_.writable_addr32(x, y);
auto a = SkGetPackedA32(*pixel), r = SkGetPackedR32(*pixel), g = SkGetPackedG32(*pixel), b = SkGetPackedB32(*pixel);
- r *= shuffleR;
- g *= shuffleG;
- b *= shuffleB;
+ r += shuffleComponent(r, UINT8_MAX-1, shuffleR);
+ g += shuffleComponent(g, UINT8_MAX-1, shuffleG);
+ b += shuffleComponent(b, UINT8_MAX-1, shuffleB);
// alpha is left unchanged
*pixel = (a << SK_A32_SHIFT) | (r << SK_R32_SHIFT) |
@@ -221,9 +222,9 @@ void ImageDataBuffer::shuffleSubchannelColorData() const {
uint32_t *pixel = pixmap_.writable_addr32(x, y);
auto a = SkGetPackedA32(*pixel), b = SkGetPackedR32(*pixel), g = SkGetPackedG32(*pixel), r = SkGetPackedB32(*pixel);
- r *= shuffleR;
- g *= shuffleG;
- b *= shuffleB;
+ r += shuffleComponent(r, UINT8_MAX-1, shuffleR);
+ g += shuffleComponent(g, UINT8_MAX-1, shuffleG);
+ b += shuffleComponent(b, UINT8_MAX-1, shuffleB);
// alpha is left unchanged
*pixel = (a << SK_BGRA_A32_SHIFT) | (r << SK_BGRA_R32_SHIFT) |
--
2.7.4