Release 65.0.3325.190

This commit is contained in:
csagan5
2018-03-26 09:25:48 +02:00
parent 4029e8843d
commit 8b494263c3
3 changed files with 71 additions and 168 deletions
+4
View File
@@ -1,3 +1,7 @@
# 65.0.3325.190
* block some Canvas and AudioBuffer APIs mostly used for fingerprinting
* updated adblock filters
# 65.0.3325.176
* block plugins enumeration API
* block battery API
@@ -0,0 +1,67 @@
From: csagan5 <32685696+csagan5@users.noreply.github.com>
Date: Sat, 24 Mar 2018 05:18:03 +0100
Subject: Canvas: fingerprinting mitigations via IDL
Disable toDataURL, toBlob, getImageData and webGL renderering info
---
third_party/WebKit/Source/core/html/canvas/HTMLCanvasElement.idl | 4 ++--
.../Source/modules/canvas/canvas2d/CanvasRenderingContext2D.idl | 4 ++--
third_party/WebKit/Source/modules/webgl/WebGLDebugRendererInfo.cpp | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/third_party/WebKit/Source/core/html/canvas/HTMLCanvasElement.idl b/third_party/WebKit/Source/core/html/canvas/HTMLCanvasElement.idl
--- a/third_party/WebKit/Source/core/html/canvas/HTMLCanvasElement.idl
+++ b/third_party/WebKit/Source/core/html/canvas/HTMLCanvasElement.idl
@@ -36,9 +36,9 @@ interface HTMLCanvasElement : HTMLElement
// Note: The arguments argument is variadic in the spec, but not here as
// only one extra argument is actually used.
// FIXME: type should not have a default value.
- [MeasureAs=CanvasToDataURL, RaisesException] DOMString toDataURL(optional DOMString type = null, optional any arguments);
+ //[MeasureAs=CanvasToDataURL, RaisesException] DOMString toDataURL(optional DOMString type = null, optional any arguments);
- [MeasureAs=CanvasToBlob, RaisesException] void toBlob(BlobCallback _callback, optional DOMString type = null, optional any arguments);
+ //[MeasureAs=CanvasToBlob, RaisesException] void toBlob(BlobCallback _callback, optional DOMString type = null, optional any arguments);
};
// https://html.spec.whatwg.org/multipage/canvas.html#blobcallback
diff --git a/third_party/WebKit/Source/modules/canvas/canvas2d/CanvasRenderingContext2D.idl b/third_party/WebKit/Source/modules/canvas/canvas2d/CanvasRenderingContext2D.idl
--- a/third_party/WebKit/Source/modules/canvas/canvas2d/CanvasRenderingContext2D.idl
+++ b/third_party/WebKit/Source/modules/canvas/canvas2d/CanvasRenderingContext2D.idl
@@ -110,7 +110,7 @@ interface CanvasRenderingContext2D {
// text (see also the CanvasDrawingStyles interface)
void fillText(DOMString text, unrestricted double x, unrestricted double y, optional unrestricted double maxWidth);
void strokeText(DOMString text, unrestricted double x, unrestricted double y, optional unrestricted double maxWidth);
- TextMetrics measureText(DOMString text);
+ //TextMetrics measureText(DOMString text);
// drawing images
[CallWith=ScriptState, RaisesException] void drawImage(CanvasImageSource image, unrestricted double x, unrestricted double y);
@@ -125,7 +125,7 @@ interface CanvasRenderingContext2D {
// pixel manipulation
[RaisesException] ImageData createImageData(ImageData imagedata);
[RaisesException] ImageData createImageData(long sw, long sh);
- [RaisesException] ImageData getImageData(long sx, long sy, long sw, long sh);
+ //[RaisesException] ImageData getImageData(long sx, long sy, long sw, long sh);
[RaisesException] void putImageData(ImageData imagedata, long dx, long dy);
[RaisesException] void putImageData(ImageData imagedata, long dx, long dy, long dirtyX, long dirtyY, long dirtyWidth, long dirtyHeight);
diff --git a/third_party/WebKit/Source/modules/webgl/WebGLDebugRendererInfo.cpp b/third_party/WebKit/Source/modules/webgl/WebGLDebugRendererInfo.cpp
--- a/third_party/WebKit/Source/modules/webgl/WebGLDebugRendererInfo.cpp
+++ b/third_party/WebKit/Source/modules/webgl/WebGLDebugRendererInfo.cpp
@@ -37,11 +37,11 @@ WebGLExtensionName WebGLDebugRendererInfo::GetName() const {
WebGLDebugRendererInfo* WebGLDebugRendererInfo::Create(
WebGLRenderingContextBase* context) {
- return new WebGLDebugRendererInfo(context);
+ return nullptr;
}
bool WebGLDebugRendererInfo::Supported(WebGLRenderingContextBase*) {
- return true;
+ return false;
}
const char* WebGLDebugRendererInfo::ExtensionName() {
--
2.7.4
@@ -1,168 +0,0 @@
From: csagan5 <32685696+csagan5@users.noreply.github.com>
Date: Sat, 24 Mar 2018 05:18:03 +0100
Subject: Canvas: fingerprinting mitigations
Disable toDataURL, toBlob, getImageData and webGL renderering info
---
.../Source/core/html/canvas/HTMLCanvasElement.cpp | 71 ----------------------
.../canvas/canvas2d/BaseRenderingContext2D.cpp | 2 +-
.../canvas/canvas2d/CanvasRenderingContext2D.cpp | 19 +-----
.../modules/webgl/WebGLDebugRendererInfo.cpp | 4 +-
4 files changed, 4 insertions(+), 92 deletions(-)
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
@@ -779,42 +779,7 @@ String HTMLCanvasElement::ToDataURLInternal(
const String& mime_type,
const double& quality,
SourceDrawingBuffer source_buffer) const {
- if (!IsPaintable())
return String("data:,");
-
- String encoding_mime_type = ImageEncoderUtils::ToEncodingMimeType(
- mime_type, ImageEncoderUtils::kEncodeReasonToDataURL);
-
- Optional<ScopedUsHistogramTimer> timer;
- if (encoding_mime_type == "image/png") {
- DEFINE_THREAD_SAFE_STATIC_LOCAL(
- CustomCountHistogram, scoped_us_counter_png,
- ("Blink.Canvas.ToDataURL.PNG", 0, 10000000, 50));
- timer.emplace(scoped_us_counter_png);
- } else if (encoding_mime_type == "image/jpeg") {
- DEFINE_THREAD_SAFE_STATIC_LOCAL(
- CustomCountHistogram, scoped_us_counter_jpeg,
- ("Blink.Canvas.ToDataURL.JPEG", 0, 10000000, 50));
- timer.emplace(scoped_us_counter_jpeg);
- } else if (encoding_mime_type == "image/webp") {
- DEFINE_THREAD_SAFE_STATIC_LOCAL(
- CustomCountHistogram, scoped_us_counter_webp,
- ("Blink.Canvas.ToDataURL.WEBP", 0, 10000000, 50));
- timer.emplace(scoped_us_counter_webp);
- } else {
- // Currently we only support three encoding types.
- NOTREACHED();
- }
-
- scoped_refptr<StaticBitmapImage> image_bitmap =
- ToStaticBitmapImage(source_buffer, kPreferNoAcceleration);
- if (image_bitmap) {
- std::unique_ptr<ImageDataBuffer> data_buffer =
- ImageDataBuffer::Create(image_bitmap);
- if (data_buffer)
- return data_buffer->ToDataURL(encoding_mime_type, quality);
- }
- return String("data:,");
}
String HTMLCanvasElement::toDataURL(const String& mime_type,
@@ -844,48 +809,12 @@ void HTMLCanvasElement::toBlob(V8BlobCallback* callback,
return;
}
- if (!IsPaintable()) {
- // If the canvas element's bitmap has no pixels
- GetDocument()
- .GetTaskRunner(TaskType::kCanvasBlobSerialization)
- ->PostTask(FROM_HERE,
- WTF::Bind(&V8BlobCallback::InvokeAndReportException,
- WrapPersistentCallbackFunction(callback), nullptr,
- nullptr));
- return;
- }
-
- double start_time = WTF::CurrentTimeTicksInSeconds();
- double quality = kUndefinedQualityValue;
- if (!quality_argument.IsEmpty()) {
- v8::Local<v8::Value> v8_value = quality_argument.V8Value();
- if (v8_value->IsNumber()) {
- quality = v8_value.As<v8::Number>()->Value();
- }
- }
-
- String encoding_mime_type = ImageEncoderUtils::ToEncodingMimeType(
- mime_type, ImageEncoderUtils::kEncodeReasonToBlobCallback);
-
- CanvasAsyncBlobCreator* async_creator = nullptr;
- scoped_refptr<StaticBitmapImage> image_bitmap =
- ToStaticBitmapImage(kBackBuffer, kPreferNoAcceleration);
- if (image_bitmap) {
- async_creator = CanvasAsyncBlobCreator::Create(
- image_bitmap, encoding_mime_type, callback, start_time, &GetDocument());
- }
-
- if (async_creator) {
- async_creator->ScheduleAsyncBlobCreation(quality);
- } else {
GetDocument()
.GetTaskRunner(TaskType::kCanvasBlobSerialization)
->PostTask(FROM_HERE,
WTF::Bind(&V8BlobCallback::InvokeAndReportException,
WrapPersistentCallbackFunction(callback), nullptr,
nullptr));
- return;
- }
}
void HTMLCanvasElement::AddListener(CanvasDrawListener* listener) {
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
@@ -1541,7 +1541,7 @@ ImageData* BaseRenderingContext2D::getImageData(
String::Format("The source %s is 0.", sw ? "height" : "width"));
}
- if (exception_state.HadException())
+ //if (exception_state.HadException())
return nullptr;
if (sw < 0) {
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
@@ -758,24 +758,7 @@ void CanvasRenderingContext2D::strokeText(const String& text,
}
TextMetrics* CanvasRenderingContext2D::measureText(const String& text) {
- // The style resolution required for fonts is not available in frame-less
- // documents.
- if (!canvas()->GetDocument().GetFrame())
- return TextMetrics::Create();
-
- canvas()->GetDocument().UpdateStyleAndLayoutTreeForNode(canvas());
-
- const Font& font = AccessFont();
-
- TextDirection direction;
- if (GetState().GetDirection() ==
- CanvasRenderingContext2DState::kDirectionInherit)
- direction = DetermineDirectionality(text);
- else
- direction = ToTextDirection(GetState().GetDirection(), canvas());
-
- return TextMetrics::Create(font, direction, GetState().GetTextBaseline(),
- GetState().GetTextAlign(), text);
+ return TextMetrics::Create();
}
void CanvasRenderingContext2D::DrawTextInternal(
diff --git a/third_party/WebKit/Source/modules/webgl/WebGLDebugRendererInfo.cpp b/third_party/WebKit/Source/modules/webgl/WebGLDebugRendererInfo.cpp
--- a/third_party/WebKit/Source/modules/webgl/WebGLDebugRendererInfo.cpp
+++ b/third_party/WebKit/Source/modules/webgl/WebGLDebugRendererInfo.cpp
@@ -37,11 +37,11 @@ WebGLExtensionName WebGLDebugRendererInfo::GetName() const {
WebGLDebugRendererInfo* WebGLDebugRendererInfo::Create(
WebGLRenderingContextBase* context) {
- return new WebGLDebugRendererInfo(context);
+ return nullptr;
}
bool WebGLDebugRendererInfo::Supported(WebGLRenderingContextBase*) {
- return true;
+ return false;
}
const char* WebGLDebugRendererInfo::ExtensionName() {
--
2.7.4