Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aac51e0a5a | ||
|
|
ea53ed1889 | ||
|
|
780bb60137 | ||
|
|
0fd859a0a6 |
@@ -1,3 +1,14 @@
|
||||
# 66.0.3359.202
|
||||
* fix DevTools integration (https://github.com/bromite/bromite/issues/23)
|
||||
* allow toggling of Javascript from New Tab Page (fixes https://github.com/bromite/bromite/issues/60)
|
||||
* updated AdBlock filters
|
||||
|
||||
# 66.0.3359.200
|
||||
* updated AdBlock filters
|
||||
|
||||
# 66.0.3359.196
|
||||
* updated AdBlock filters
|
||||
|
||||
# 66.0.3359.188
|
||||
* updated AdBlock filters
|
||||
* increase max (persistent) connections per server from 6 to 15
|
||||
|
||||
+1702
-156
File diff suppressed because it is too large
Load Diff
@@ -65,7 +65,7 @@ new file mode 100644
|
||||
+#ifndef anti_amp_cure_h
|
||||
+#define anti_amp_cure_h
|
||||
+
|
||||
+#define ANTI_AMP_CURE_JS "/* Bromite click-tracking and AMP removal v0.3.5 */\n\nfunction recreateHyperlink(a) {\n // skip already-sanitized hyperlinks\n if (a.sane) return false;\n\n // create new A element - old one has event listeners attached\n var newA = document.createElement('a');\n newA.referrerPolicy = 'origin';\n // property set when hyperlink has been created by this script\n newA.sane = 1;\n\n // remove AMP class, get actual page URL\n var ampCur = a.getAttribute('data-amp-cur');\n if (ampCur) {\n newA.href = ampCur;\n a.classList.remove('amp_r');\n } else {\n var realLink = getRealLinkFromGoogleUrl(a);\n if (realLink) {\n newA.href = realLink;\n } else {\n // might not be an actual hyperlink, ignore it\n if (!a.href) {\n return false;\n }\n // leave original href unchanged\n newA.href = a.href;\n }\n }\n // copy CSS classes\n newA.className = a.className;\n\n // copy nodes inside the hyperlink\n while (a.firstChild) {\n newA.appendChild(a.lastChild);\n }\n // replace hyperlink\n a.parentNode.replaceChild(newA, a);\n return true;\n}\n\nfunction isResult(a) {\n if (a.getAttribute('data-amp-cur'))\n return true;\n var inlineMousedown = a.getAttribute('onmousedown');\n if (!inlineMousedown)\n\treturn false;\n // return rwt(....); // E.g Google search results.\n // return google.rwt(...); // E.g. sponsored search results\n // return google.arwt(this); // E.g. sponsored search results (dec 2016).\n return /\\ba?rwt\\(/.test(inlineMousedown) || /\\bctpacw\\b/.test(inlineMousedown);\n}\n\n/**\n * @returns {String} the real URL if the given link is a Google redirect URL.\n */\nfunction getRealLinkFromGoogleUrl(a) {\n if ((a.hostname === location.hostname || a.hostname.indexOf('www.google.') == 0) &&\n /^\\/(local_)?url$/.test(a.pathname)) {\n // Google Maps / Dito (/local_url?q=<url>)\n // Mobile (/url?q=<url>)\n var url = /[?&](?:q|url)=((?:https?|ftp)[%:][^&]+)/.exec(a.search);\n if (url) {\n return decodeURIComponent(url[1]);\n }\n // Help pages, e.g. safe browsing (/url?...&q=%2Fsupport%2Fanswer...)\n url = /[?&](?:q|url)=((?:%2[Ff]|\\/)[^&]+)/.exec(a.search);\n if (url) {\n return a.origin + decodeURIComponent(url[1]);\n }\n }\n}\n\nfunction sanitizeAds() {\n // scan all divs\n var div = document.getElementById('tads');\n if (div) {\n div.style.display = 'none';\n\treturn true;\n }\n return false;\n}\n\nfunction sanitizeAll() {\n console.log(\"ads removed: \", sanitizeAds());\n console.log(\"hyperlinks sanitized: \", sanitizeAllHyperlinks());\n}\n\nfunction setMlogoClick() {\n var mlogo = document.getElementById('mlogo');\n if (mlogo) {\n mlogo.removeAttribute(\"href\");\n mlogo.setAttribute(\"onclick\", \"sanitizeAll()\");\n console.log(\"logo link replaced\");\n } else {\n console.log(\"could not replace logo link\");\n }\n}\n\nfunction sanitizeAllHyperlinks() {\n var saned = 0, total = 0;\n document.querySelectorAll('div[data-hveid]:not([data-hveid=\"\"]) a').forEach(function(a) {\n\ttotal++;\n\tvar res = recreateHyperlink(a);\n\tif (res) saned++;\n });\n console.log(\"sanitized \", saned, \"/\", total, \" hyperlinks\");\n\n return saned;\n}\n\n// avoid running cleanup on non-search pages\nif ((document.location.host.indexOf(\"images.google.\") == -1) && (document.location.host.indexOf(\"news.google.\") == -1)) {\n// document.addEventListener('touchstart', handlePointerPress, true);\n sanitizeAll();\n}\nsetMlogoClick();\n"
|
||||
+#define ANTI_AMP_CURE_JS "/* Bromite click-tracking and AMP removal v0.3.5 */\n\nfunction recreateHyperlink(a) {\n // skip already-sanitized hyperlinks\n if (a.sane) return false;\n\n // create new A element - old one has event listeners attached\n var newA = document.createElement('a');\n newA.referrerPolicy = 'origin';\n // property set when hyperlink has been created by this script\n newA.sane = 1;\n\n // remove AMP class, get actual page URL\n var ampCur = a.getAttribute('data-amp-cur');\n if (ampCur) {\n newA.href = ampCur;\n a.classList.remove('amp_r');\n } else {\n var realLink = getRealLinkFromGoogleUrl(a);\n if (realLink) {\n newA.href = realLink;\n } else {\n // might not be an actual hyperlink, ignore it\n if (!a.href) {\n return false;\n }\n // leave original href unchanged\n newA.href = a.href;\n }\n }\n // copy CSS classes\n newA.className = a.className;\n\n // copy nodes inside the hyperlink\n while (a.firstChild) {\n newA.appendChild(a.lastChild);\n }\n // replace hyperlink\n a.parentNode.replaceChild(newA, a);\n return true;\n}\n\nfunction isResult(a) {\n if (a.getAttribute('data-amp-cur'))\n return true;\n var inlineMousedown = a.getAttribute('onmousedown');\n if (!inlineMousedown)\n\treturn false;\n // return rwt(....); // E.g Google search results.\n // return google.rwt(...); // E.g. sponsored search results\n // return google.arwt(this); // E.g. sponsored search results (dec 2016).\n return /\\ba?rwt\\(/.test(inlineMousedown) || /\\bctpacw\\b/.test(inlineMousedown);\n}\n\n/**\n * @returns {String} the real URL if the given link is a Google redirect URL.\n */\nfunction getRealLinkFromGoogleUrl(a) {\n if ((a.hostname === location.hostname || a.hostname.indexOf('www.google.') == 0) &&\n /^\\/(local_)?url$/.test(a.pathname)) {\n // Google Maps / Dito (/local_url?q=<url>)\n // Mobile (/url?q=<url>)\n var url = /[?&](?:q|url)=((?:https?|ftp)[%:][^&]+)/.exec(a.search);\n if (url) {\n return decodeURIComponent(url[1]);\n }\n // Help pages, e.g. safe browsing (/url?...&q=%2Fsupport%2Fanswer...)\n url = /[?&](?:q|url)=((?:%2[Ff]|\\/)[^&]+)/.exec(a.search);\n if (url) {\n return a.origin + decodeURIComponent(url[1]);\n }\n }\n}\n\nfunction sanitizeAds() {\n // scan all divs\n var div = document.getElementById('tads');\n if (div) {\n div.style.display = 'none';\n\treturn true;\n }\n return false;\n}\n\nfunction sanitizeAll() {\n console.log(\"ads removed: \", sanitizeAds());\n console.log(\"hyperlinks sanitized: \", sanitizeAllHyperlinks(document));\n}\n\nfunction hookMoreResults() {\n var extrares = document.getElementById('extrares');\n if (!extrares) {\n console.log(\"could not hook more results\");\n return;\n }\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(n) {\n console.log(\"hyperlinks sanitized on new result node: \", sanitizeAllHyperlinks(n));\n });\n });\n });\n observer.observe(extrares, {childList: true});\n}\n\nfunction setMlogoClick() {\n var mlogo = document.getElementById('qslc');\n if (mlogo && mlogo.children[0]) {\n mlogo = mlogo.children[0];\n mlogo.removeAttribute(\"href\");\n mlogo.setAttribute(\"onclick\", \"sanitizeAll()\");\n console.log(\"logo link replaced\");\n } else {\n console.log(\"could not replace logo link\");\n }\n}\n\nfunction sanitizeAllHyperlinks(rootNode) {\n var saned = 0, total = 0;\n rootNode.querySelectorAll('div[data-hveid]:not([data-hveid=\"\"]) a').forEach(function(a) {\n\ttotal++;\n\tvar res = recreateHyperlink(a);\n\tif (res) saned++;\n });\n console.log(\"sanitized \", saned, \"/\", total, \" hyperlinks\");\n\n return saned;\n}\n\n// avoid running cleanup on non-search pages\nif ((document.location.host.indexOf(\"images.google.\") == -1) && (document.location.host.indexOf(\"news.google.\") == -1)) {\n sanitizeAll();\n}\nsetMlogoClick();\n\nhookMoreResults();\n"
|
||||
+
|
||||
+#endif // anti_amp_cure_h
|
||||
--
|
||||
|
||||
@@ -7,10 +7,10 @@ Subject: Add menu option to toggle global Javascript preference
|
||||
chrome/android/java/res/menu/main_menu.xml | 13 ++++++++
|
||||
.../chromium/chrome/browser/ChromeActivity.java | 8 +++++
|
||||
.../chrome/browser/ChromeTabbedActivity.java | 8 +++++
|
||||
.../browser/appmenu/AppMenuPropertiesDelegate.java | 35 ++++++++++++++++++++++
|
||||
.../browser/appmenu/AppMenuPropertiesDelegate.java | 37 ++++++++++++++++++++++
|
||||
.../CustomTabAppMenuPropertiesDelegate.java | 1 +
|
||||
.../java/strings/android_chrome_strings.grd | 11 +++++++
|
||||
7 files changed, 89 insertions(+)
|
||||
7 files changed, 91 insertions(+)
|
||||
|
||||
diff --git a/chrome/android/java/res/menu/custom_tabs_menu.xml b/chrome/android/java/res/menu/custom_tabs_menu.xml
|
||||
--- a/chrome/android/java/res/menu/custom_tabs_menu.xml
|
||||
@@ -106,7 +106,7 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenu
|
||||
// Only display reader mode settings menu option if the current page is in reader mode.
|
||||
menu.findItem(R.id.reader_mode_prefs_id)
|
||||
.setVisible(DomDistillerUrlUtils.isDistilledPage(currentTab.getUrl()));
|
||||
@@ -468,4 +470,37 @@ public class AppMenuPropertiesDelegate {
|
||||
@@ -468,4 +470,39 @@ public class AppMenuPropertiesDelegate {
|
||||
|
||||
return chromeHomeMenuItemFlagEnabled && !sHideChromeHomeMenuItems;
|
||||
}
|
||||
@@ -123,12 +123,14 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenu
|
||||
+ MenuItem enableMenuLabel = menu.findItem(R.id.enable_javascript_id);
|
||||
+ MenuItem enableMenuCheck = menu.findItem(R.id.enable_javascript_check_id);
|
||||
+
|
||||
+ // Hide enable javascript on all chrome:// pages and the NTP.
|
||||
+ // Hide enable javascript on all chrome:// pages except for the NTP.
|
||||
+ String url = currentTab.getUrl();
|
||||
+ boolean isChromeScheme = url.startsWith(UrlConstants.CHROME_URL_PREFIX)
|
||||
+ || url.startsWith(UrlConstants.CHROME_NATIVE_URL_PREFIX);
|
||||
+ // Also hide enable javascsript on Reader Mode.
|
||||
+ boolean isDistilledPage = DomDistillerUrlUtils.isDistilledPage(url);
|
||||
+
|
||||
+ boolean itemVisible = !isChromeScheme && !currentTab.isNativePage();
|
||||
+ boolean itemVisible = (!isChromeScheme || currentTab.isNativePage()) && !isDistilledPage;
|
||||
+ enableMenuRow.setVisible(itemVisible);
|
||||
+ if (!itemVisible) return;
|
||||
+
|
||||
|
||||
@@ -0,0 +1,273 @@
|
||||
From: csagan5 <32685696+csagan5@users.noreply.github.com>
|
||||
Date: Mon, 30 Apr 2018 15:39:58 +0200
|
||||
Subject: Started work on canvas randomisation
|
||||
|
||||
Add shuffling for TextMetrics
|
||||
---
|
||||
.../Source/core/html/canvas/CanvasAsyncBlobCreator.cpp | 14 +++++++-------
|
||||
.../Source/core/html/canvas/CanvasAsyncBlobCreator.h | 6 +++---
|
||||
.../WebKit/Source/core/html/canvas/HTMLCanvasElement.cpp | 4 ++--
|
||||
third_party/WebKit/Source/core/html/canvas/TextMetrics.cpp | 4 ++++
|
||||
third_party/WebKit/Source/core/html/canvas/TextMetrics.h | 2 ++
|
||||
.../WebKit/Source/core/inspector/InspectorAuditsAgent.cpp | 2 +-
|
||||
.../WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp | 6 +++++-
|
||||
.../WebKit/Source/modules/accessibility/AXLayoutObject.cpp | 2 +-
|
||||
.../modules/canvas/canvas2d/BaseRenderingContext2D.cpp | 3 +++
|
||||
.../modules/canvas/canvas2d/CanvasRenderingContext2D.cpp | 6 +++++-
|
||||
.../WebKit/Source/platform/graphics/ImageDataBuffer.cpp | 6 ++++--
|
||||
.../WebKit/Source/platform/graphics/ImageDataBuffer.h | 3 ++-
|
||||
12 files changed, 39 insertions(+), 19 deletions(-)
|
||||
|
||||
diff --git a/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.cpp b/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.cpp
|
||||
--- a/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.cpp
|
||||
+++ b/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.cpp
|
||||
@@ -220,14 +220,14 @@ void CanvasAsyncBlobCreator::Dispose() {
|
||||
image_ = nullptr;
|
||||
}
|
||||
|
||||
-bool CanvasAsyncBlobCreator::EncodeImage(const double& quality) {
|
||||
+bool CanvasAsyncBlobCreator::EncodeImage(const double& quality, const double shuffleAmt) {
|
||||
std::unique_ptr<ImageDataBuffer> buffer = ImageDataBuffer::Create(src_data_);
|
||||
if (!buffer)
|
||||
return false;
|
||||
- return buffer->EncodeImage("image/webp", quality, &encoded_image_);
|
||||
+ return buffer->EncodeImage("image/webp", quality, shuffleAmt, &encoded_image_);
|
||||
}
|
||||
|
||||
-void CanvasAsyncBlobCreator::ScheduleAsyncBlobCreation(const double& quality) {
|
||||
+void CanvasAsyncBlobCreator::ScheduleAsyncBlobCreation(const double& quality, const double shuffleAmt) {
|
||||
if (!static_bitmap_image_loaded_) {
|
||||
context_->GetTaskRunner(TaskType::kCanvasBlobSerialization)
|
||||
->PostTask(FROM_HERE,
|
||||
@@ -241,7 +241,7 @@ void CanvasAsyncBlobCreator::ScheduleAsyncBlobCreation(const double& quality) {
|
||||
// When OffscreenCanvas.convertToBlob() occurs on worker thread,
|
||||
// we do not need to use background task runner to reduce load on main.
|
||||
// So we just directly encode images on the worker thread.
|
||||
- if (!EncodeImage(quality)) {
|
||||
+ if (!EncodeImage(quality, shuffleAmt)) {
|
||||
context_->GetTaskRunner(TaskType::kCanvasBlobSerialization)
|
||||
->PostTask(
|
||||
FROM_HERE,
|
||||
@@ -260,7 +260,7 @@ void CanvasAsyncBlobCreator::ScheduleAsyncBlobCreation(const double& quality) {
|
||||
BackgroundTaskRunner::PostOnBackgroundThread(
|
||||
FROM_HERE,
|
||||
CrossThreadBind(&CanvasAsyncBlobCreator::EncodeImageOnEncoderThread,
|
||||
- WrapCrossThreadPersistent(this), quality));
|
||||
+ WrapCrossThreadPersistent(this), quality, shuffleAmt));
|
||||
}
|
||||
} else {
|
||||
idle_task_status_ = kIdleTaskNotStarted;
|
||||
@@ -432,11 +432,11 @@ void CanvasAsyncBlobCreator::CreateNullAndReturnResult() {
|
||||
Dispose();
|
||||
}
|
||||
|
||||
-void CanvasAsyncBlobCreator::EncodeImageOnEncoderThread(double quality) {
|
||||
+void CanvasAsyncBlobCreator::EncodeImageOnEncoderThread(double quality, double shuffleAmt) {
|
||||
DCHECK(!IsMainThread());
|
||||
DCHECK(mime_type_ == kMimeTypeWebp);
|
||||
|
||||
- if (!EncodeImage(quality)) {
|
||||
+ if (!EncodeImage(quality, shuffleAmt)) {
|
||||
PostCrossThreadTask(
|
||||
*parent_frame_task_runner_->Get(TaskType::kCanvasBlobSerialization),
|
||||
FROM_HERE,
|
||||
diff --git a/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.h b/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.h
|
||||
--- a/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.h
|
||||
+++ b/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.h
|
||||
@@ -38,7 +38,7 @@ class CORE_EXPORT CanvasAsyncBlobCreator
|
||||
ExecutionContext*,
|
||||
ScriptPromiseResolver*);
|
||||
|
||||
- void ScheduleAsyncBlobCreation(const double& quality);
|
||||
+ void ScheduleAsyncBlobCreation(const double& quality, const double shuffleAmt);
|
||||
virtual ~CanvasAsyncBlobCreator();
|
||||
enum MimeType {
|
||||
kMimeTypePng,
|
||||
@@ -130,7 +130,7 @@ class CORE_EXPORT CanvasAsyncBlobCreator
|
||||
Member<ScriptPromiseResolver> script_promise_resolver_;
|
||||
|
||||
void LoadStaticBitmapImage();
|
||||
- bool EncodeImage(const double&);
|
||||
+ bool EncodeImage(const double&, const double);
|
||||
|
||||
// PNG, JPEG
|
||||
bool InitializeEncoder(double quality);
|
||||
@@ -138,7 +138,7 @@ class CORE_EXPORT CanvasAsyncBlobCreator
|
||||
// without deadline
|
||||
|
||||
// WEBP
|
||||
- void EncodeImageOnEncoderThread(double quality);
|
||||
+ void EncodeImageOnEncoderThread(double quality, double shuffleAmt);
|
||||
|
||||
void IdleTaskStartTimeoutEvent(double quality);
|
||||
void IdleTaskCompleteTimeoutEvent();
|
||||
diff --git a/third_party/WebKit/Source/core/html/canvas/HTMLCanvasElement.cpp b/third_party/WebKit/Source/core/html/canvas/HTMLCanvasElement.cpp
|
||||
--- a/third_party/WebKit/Source/core/html/canvas/HTMLCanvasElement.cpp
|
||||
+++ b/third_party/WebKit/Source/core/html/canvas/HTMLCanvasElement.cpp
|
||||
@@ -826,7 +826,7 @@ String HTMLCanvasElement::ToDataURLInternal(
|
||||
std::unique_ptr<ImageDataBuffer> data_buffer =
|
||||
ImageDataBuffer::Create(image_bitmap);
|
||||
if (data_buffer)
|
||||
- return data_buffer->ToDataURL(encoding_mime_type, quality);
|
||||
+ return data_buffer->ToDataURL(encoding_mime_type, quality, GetDocument().GetShuffleFactorX());
|
||||
}
|
||||
return String("data:,");
|
||||
}
|
||||
@@ -892,7 +892,7 @@ void HTMLCanvasElement::toBlob(V8BlobCallback* callback,
|
||||
}
|
||||
|
||||
if (async_creator) {
|
||||
- async_creator->ScheduleAsyncBlobCreation(quality);
|
||||
+ async_creator->ScheduleAsyncBlobCreation(quality, GetDocument().GetShuffleFactorX());
|
||||
} else {
|
||||
GetDocument()
|
||||
.GetTaskRunner(TaskType::kCanvasBlobSerialization)
|
||||
diff --git a/third_party/WebKit/Source/core/html/canvas/TextMetrics.cpp b/third_party/WebKit/Source/core/html/canvas/TextMetrics.cpp
|
||||
--- a/third_party/WebKit/Source/core/html/canvas/TextMetrics.cpp
|
||||
+++ b/third_party/WebKit/Source/core/html/canvas/TextMetrics.cpp
|
||||
@@ -47,6 +47,10 @@ float TextMetrics::GetFontBaseline(const TextBaseline& text_baseline,
|
||||
return 0;
|
||||
}
|
||||
|
||||
+void TextMetrics::Shuffle(const double amt) {
|
||||
+ //TODO: shuffle here
|
||||
+}
|
||||
+
|
||||
void TextMetrics::Update(const Font& font,
|
||||
const TextDirection& direction,
|
||||
const TextBaseline& baseline,
|
||||
diff --git a/third_party/WebKit/Source/core/html/canvas/TextMetrics.h b/third_party/WebKit/Source/core/html/canvas/TextMetrics.h
|
||||
--- a/third_party/WebKit/Source/core/html/canvas/TextMetrics.h
|
||||
+++ b/third_party/WebKit/Source/core/html/canvas/TextMetrics.h
|
||||
@@ -67,6 +67,8 @@ class CORE_EXPORT TextMetrics final : public ScriptWrappable {
|
||||
|
||||
static float GetFontBaseline(const TextBaseline&, const FontMetrics&);
|
||||
|
||||
+ void Shuffle(const double amt);
|
||||
+
|
||||
private:
|
||||
void Update(const Font&,
|
||||
const TextDirection&,
|
||||
diff --git a/third_party/WebKit/Source/core/inspector/InspectorAuditsAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorAuditsAgent.cpp
|
||||
--- a/third_party/WebKit/Source/core/inspector/InspectorAuditsAgent.cpp
|
||||
+++ b/third_party/WebKit/Source/core/inspector/InspectorAuditsAgent.cpp
|
||||
@@ -56,7 +56,7 @@ bool EncodeAsImage(char* body,
|
||||
|
||||
String mime_type = "image/";
|
||||
mime_type.append(encoding);
|
||||
- return image_to_encode->EncodeImage(mime_type, quality, output);
|
||||
+ return image_to_encode->EncodeImage(mime_type, quality, 0, output);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
diff --git a/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp b/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp
|
||||
--- a/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp
|
||||
+++ b/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "core/offscreencanvas/OffscreenCanvas.h"
|
||||
|
||||
#include <memory>
|
||||
+#include "base/rand_util.h"
|
||||
#include "core/css/CSSFontSelector.h"
|
||||
#include "core/css/OffscreenFontSelector.h"
|
||||
#include "core/css/StyleEngine.h"
|
||||
@@ -398,7 +399,10 @@ 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());
|
||||
+
|
||||
+ // add +/- 3% noise against fingerprinting
|
||||
+ double shuffleAmt = (base::RandDouble() - 0.5) * 0.03;
|
||||
+ async_creator->ScheduleAsyncBlobCreation(options.quality(), shuffleAmt);
|
||||
return resolver->Promise();
|
||||
} else {
|
||||
exception_state.ThrowDOMException(
|
||||
diff --git a/third_party/WebKit/Source/modules/accessibility/AXLayoutObject.cpp b/third_party/WebKit/Source/modules/accessibility/AXLayoutObject.cpp
|
||||
--- a/third_party/WebKit/Source/modules/accessibility/AXLayoutObject.cpp
|
||||
+++ b/third_party/WebKit/Source/modules/accessibility/AXLayoutObject.cpp
|
||||
@@ -1017,7 +1017,7 @@ String AXLayoutObject::ImageDataUrl(const IntSize& max_size) const {
|
||||
if (!buffer)
|
||||
return String();
|
||||
|
||||
- return buffer->ToDataURL("image/png", 1.0);
|
||||
+ return buffer->ToDataURL("image/png", 1.0, document->GetShuffleFactorX());
|
||||
}
|
||||
|
||||
String AXLayoutObject::GetText() const {
|
||||
diff --git a/third_party/WebKit/Source/modules/canvas/canvas2d/BaseRenderingContext2D.cpp b/third_party/WebKit/Source/modules/canvas/canvas2d/BaseRenderingContext2D.cpp
|
||||
--- a/third_party/WebKit/Source/modules/canvas/canvas2d/BaseRenderingContext2D.cpp
|
||||
+++ b/third_party/WebKit/Source/modules/canvas/canvas2d/BaseRenderingContext2D.cpp
|
||||
@@ -1610,6 +1610,9 @@ ImageData* BaseRenderingContext2D::getImageData(
|
||||
const CanvasColorParams& color_params = ColorParams();
|
||||
scoped_refptr<StaticBitmapImage> snapshot = GetImage(kPreferNoAcceleration);
|
||||
|
||||
+ //TODO: calculate some random value and use it to shuffle pixel data in 'snapshot'
|
||||
+ // it should StaticBitmapImage somehow
|
||||
+
|
||||
if (!StaticBitmapImage::ConvertToArrayBufferContents(
|
||||
snapshot, contents, image_data_rect, color_params, IsAccelerated())) {
|
||||
exception_state.ThrowRangeError("Out of memory at ImageData creation");
|
||||
diff --git a/third_party/WebKit/Source/modules/canvas/canvas2d/CanvasRenderingContext2D.cpp b/third_party/WebKit/Source/modules/canvas/canvas2d/CanvasRenderingContext2D.cpp
|
||||
--- a/third_party/WebKit/Source/modules/canvas/canvas2d/CanvasRenderingContext2D.cpp
|
||||
+++ b/third_party/WebKit/Source/modules/canvas/canvas2d/CanvasRenderingContext2D.cpp
|
||||
@@ -779,8 +779,12 @@ TextMetrics* CanvasRenderingContext2D::measureText(const String& text) {
|
||||
else
|
||||
direction = ToTextDirection(GetState().GetDirection(), canvas());
|
||||
|
||||
- return TextMetrics::Create(font, direction, GetState().GetTextBaseline(),
|
||||
+ TextMetrics* textMetrics = TextMetrics::Create(font, direction, GetState().GetTextBaseline(),
|
||||
GetState().GetTextAlign(), text);
|
||||
+
|
||||
+ textMetrics->Shuffle(canvas()->GetDocument().GetShuffleFactorX());
|
||||
+
|
||||
+ return textMetrics;
|
||||
}
|
||||
|
||||
void CanvasRenderingContext2D::DrawTextInternal(
|
||||
diff --git a/third_party/WebKit/Source/platform/graphics/ImageDataBuffer.cpp b/third_party/WebKit/Source/platform/graphics/ImageDataBuffer.cpp
|
||||
--- a/third_party/WebKit/Source/platform/graphics/ImageDataBuffer.cpp
|
||||
+++ b/third_party/WebKit/Source/platform/graphics/ImageDataBuffer.cpp
|
||||
@@ -124,7 +124,9 @@ const unsigned char* ImageDataBuffer::Pixels() const {
|
||||
|
||||
bool ImageDataBuffer::EncodeImage(const String& mime_type,
|
||||
const double& quality,
|
||||
+ const double shuffleAmt,
|
||||
Vector<unsigned char>* encoded_image) const {
|
||||
+ //TODO: this is the only place where shuffleAmt should be used
|
||||
DCHECK(is_valid_);
|
||||
SkPixmap src;
|
||||
if (uses_pixmap_) {
|
||||
@@ -165,12 +167,12 @@ bool ImageDataBuffer::EncodeImage(const String& mime_type,
|
||||
}
|
||||
|
||||
String ImageDataBuffer::ToDataURL(const String& mime_type,
|
||||
- const double& quality) const {
|
||||
+ const double& quality, const double shuffleAmt) const {
|
||||
DCHECK(is_valid_);
|
||||
DCHECK(MIMETypeRegistry::IsSupportedImageMIMETypeForEncoding(mime_type));
|
||||
|
||||
Vector<unsigned char> result;
|
||||
- if (!EncodeImage(mime_type, quality, &result))
|
||||
+ if (!EncodeImage(mime_type, quality, shuffleAmt, &result))
|
||||
return "data:,";
|
||||
|
||||
return "data:" + mime_type + ";base64," + Base64Encode(result);
|
||||
diff --git a/third_party/WebKit/Source/platform/graphics/ImageDataBuffer.h b/third_party/WebKit/Source/platform/graphics/ImageDataBuffer.h
|
||||
--- a/third_party/WebKit/Source/platform/graphics/ImageDataBuffer.h
|
||||
+++ b/third_party/WebKit/Source/platform/graphics/ImageDataBuffer.h
|
||||
@@ -51,9 +51,10 @@ class PLATFORM_EXPORT ImageDataBuffer {
|
||||
const CanvasColorParams& = CanvasColorParams());
|
||||
static std::unique_ptr<ImageDataBuffer> Create(const SkPixmap&);
|
||||
|
||||
- String ToDataURL(const String& mime_type, const double& quality) const;
|
||||
+ String ToDataURL(const String& mime_type, const double& quality, const double shuffleAmt) const;
|
||||
bool EncodeImage(const String& mime_type,
|
||||
const double& quality,
|
||||
+ double shuffleAmt,
|
||||
Vector<unsigned char>* encoded_image) const;
|
||||
const unsigned char* Pixels() const;
|
||||
const IntSize& size() const { return size_; }
|
||||
--
|
||||
2.7.4
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
From: csagan5 <32685696+csagan5@users.noreply.github.com>
|
||||
Date: Fri, 18 May 2018 10:10:00 +0200
|
||||
Subject: Increase maximum connections per host from 6 to 15
|
||||
|
||||
---
|
||||
net/socket/client_socket_pool_manager.cc | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/net/socket/client_socket_pool_manager.cc b/net/socket/client_socket_pool_manager.cc
|
||||
--- a/net/socket/client_socket_pool_manager.cc
|
||||
+++ b/net/socket/client_socket_pool_manager.cc
|
||||
@@ -41,7 +41,7 @@ static_assert(arraysize(g_max_sockets_per_pool) ==
|
||||
// be the same as the limit for ws. Also note that Firefox uses a limit of 200.
|
||||
// See http://crbug.com/486800
|
||||
int g_max_sockets_per_group[] = {
|
||||
- 6, // NORMAL_SOCKET_POOL
|
||||
+ 15, // NORMAL_SOCKET_POOL
|
||||
255 // WEBSOCKET_SOCKET_POOL
|
||||
};
|
||||
|
||||
--
|
||||
2.7.4
|
||||
|
||||
Reference in New Issue
Block a user