[tor-commits] [tor-browser/tor-browser-38.1.0esr-5.x-1] Bug #16005: Relax minimal mode.

mikeperry at torproject.org mikeperry at torproject.org
Thu Jun 25 23:20:04 UTC 2015


commit 340de21bca0cf0c8a7633bdad3c61ef4d9265438
Author: Mike Perry <mikeperry-git at torproject.org>
Date:   Fri Jun 19 20:20:00 2015 -0700

    Bug #16005: Relax minimal mode.
    
    Use min values from a 2013 Moto E and a 2009 laptop with integrated graphics.
---
 dom/canvas/WebGLContext.cpp         |    5 ++++-
 dom/canvas/WebGLContext.h           |   33 +++++++++++++++++++++++----------
 dom/canvas/WebGLContextState.cpp    |   32 ++++++++++++++++++++++++++++++++
 dom/canvas/WebGLContextValidate.cpp |    3 ---
 4 files changed, 59 insertions(+), 14 deletions(-)

diff --git a/dom/canvas/WebGLContext.cpp b/dom/canvas/WebGLContext.cpp
index 1c22c27..da6442c 100644
--- a/dom/canvas/WebGLContext.cpp
+++ b/dom/canvas/WebGLContext.cpp
@@ -1245,7 +1245,10 @@ WebGLContext::GetContextAttributes(Nullable<dom::WebGLContextAttributes>& retval
     result.mAlpha.Construct(mOptions.alpha);
     result.mDepth = mOptions.depth;
     result.mStencil = mOptions.stencil;
-    result.mAntialias = mOptions.antialias;
+    if (MinCapabilityMode())
+        result.mAntialias = false;
+    else
+        result.mAntialias = mOptions.antialias;
     result.mPremultipliedAlpha = mOptions.premultipliedAlpha;
     result.mPreserveDrawingBuffer = mOptions.preserveDrawingBuffer;
 }
diff --git a/dom/canvas/WebGLContext.h b/dom/canvas/WebGLContext.h
index 63c4091..f72d552 100644
--- a/dom/canvas/WebGLContext.h
+++ b/dom/canvas/WebGLContext.h
@@ -53,17 +53,30 @@ class nsIDocShell;
  *
  * Exceptions: some of the following values are set to higher values than in the spec because
  * the values in the spec are ridiculously low. They are explicitly marked below
+ *
+ * Tor Browser Modifications: The following values are the minimum between a 2009 laptop, and a 2013 Moto E
  */
-#define MINVALUE_GL_MAX_TEXTURE_SIZE                  1024  // Different from the spec, which sets it to 64 on page 162
-#define MINVALUE_GL_MAX_CUBE_MAP_TEXTURE_SIZE         512   // Different from the spec, which sets it to 16 on page 162
-#define MINVALUE_GL_MAX_VERTEX_ATTRIBS                8     // Page 164
-#define MINVALUE_GL_MAX_FRAGMENT_UNIFORM_VECTORS      16    // Page 164
-#define MINVALUE_GL_MAX_VERTEX_UNIFORM_VECTORS        128   // Page 164
-#define MINVALUE_GL_MAX_VARYING_VECTORS               8     // Page 164
-#define MINVALUE_GL_MAX_TEXTURE_IMAGE_UNITS           8     // Page 164
-#define MINVALUE_GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS    0     // Page 164
-#define MINVALUE_GL_MAX_RENDERBUFFER_SIZE             1024  // Different from the spec, which sets it to 1 on page 164
-#define MINVALUE_GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS  8     // Page 164
+#define MINVALUE_GL_MAX_TEXTURE_SIZE                  4096  // Different from the spec, which sets it to 64 on page 162
+#define MINVALUE_GL_MAX_CUBE_MAP_TEXTURE_SIZE         2048   // Different from the spec, which sets it to 16 on page 162
+#define MINVALUE_GL_MAX_VERTEX_ATTRIBS                16     // Page 164
+#define MINVALUE_GL_MAX_FRAGMENT_UNIFORM_VECTORS      224    // Page 164
+#define MINVALUE_GL_MAX_VERTEX_UNIFORM_VECTORS        256   // Page 164
+#define MINVALUE_GL_MAX_VARYING_VECTORS               16     // Page 164
+#define MINVALUE_GL_MAX_TEXTURE_IMAGE_UNITS           16     // Page 164
+#define MINVALUE_GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS    16     // Page 164
+#define MINVALUE_GL_MAX_RENDERBUFFER_SIZE             4096  // Different from the spec, which sets it to 1 on page 164
+#define MINVALUE_GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS  32     // Page 164
+
+/* The following additional values were set specifically for fingerprinting.
+ * These ranges came from a 2013 Moto E.
+ *
+ * These values specify the upper end of the maximum size of line and point
+ * elements. The lower bounds are 1 in both cases (and the minimum of 1 is
+ * guaranteed by OpenGL). */
+#define MINVALUE_GL_ALIASED_LINE_WIDTH_RANGE          5
+#define MINVALUE_GL_ALIASED_POINT_SIZE_RANGE          255
+/* This value is used to cap the resolution of the viewport to (MAX x MAX) */
+#define MINVALUE_GL_MAX_VIEWPORT_DIMS                 4096
 
 namespace mozilla {
 
diff --git a/dom/canvas/WebGLContextState.cpp b/dom/canvas/WebGLContextState.cpp
index fe7f078..7646ce9 100644
--- a/dom/canvas/WebGLContextState.cpp
+++ b/dom/canvas/WebGLContextState.cpp
@@ -134,6 +134,38 @@ WebGLContext::GetParameter(JSContext* cx, GLenum pname, ErrorResult& rv)
             case LOCAL_GL_MAX_RENDERBUFFER_SIZE:
                 return JS::Int32Value(MINVALUE_GL_MAX_RENDERBUFFER_SIZE);
 
+            case LOCAL_GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS:
+                return JS::Int32Value(MINVALUE_GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS);
+
+            //case LOCAL_GL_DEPTH_RANGE:
+            case LOCAL_GL_ALIASED_POINT_SIZE_RANGE: {
+                GLfloat fv[2] = { 1, MINVALUE_GL_ALIASED_POINT_SIZE_RANGE };
+                JSObject* obj = Float32Array::Create(cx, this, 2, fv);
+                if (!obj) {
+                    rv = NS_ERROR_OUT_OF_MEMORY;
+                }
+                return JS::ObjectOrNullValue(obj);
+            }
+
+            case LOCAL_GL_ALIASED_LINE_WIDTH_RANGE: {
+                GLfloat fv[2] = { 1, MINVALUE_GL_ALIASED_LINE_WIDTH_RANGE };
+                JSObject* obj = Float32Array::Create(cx, this, 2, fv);
+                if (!obj) {
+                    rv = NS_ERROR_OUT_OF_MEMORY;
+                }
+                return JS::ObjectOrNullValue(obj);
+            }
+
+            case LOCAL_GL_MAX_VIEWPORT_DIMS: {
+                GLint iv[2] = { MINVALUE_GL_MAX_VIEWPORT_DIMS, MINVALUE_GL_MAX_VIEWPORT_DIMS };
+                JSObject* obj = Int32Array::Create(cx, this, 2, iv);
+                if (!obj) {
+                    rv = NS_ERROR_OUT_OF_MEMORY;
+                }
+                return JS::ObjectOrNullValue(obj);
+            }
+
+
             default:
                 // Return the real value; we're not overriding this one
                 break;
diff --git a/dom/canvas/WebGLContextValidate.cpp b/dom/canvas/WebGLContextValidate.cpp
index 703fd0f..a6fb0fb 100644
--- a/dom/canvas/WebGLContextValidate.cpp
+++ b/dom/canvas/WebGLContextValidate.cpp
@@ -1700,9 +1700,6 @@ WebGLContext::InitAndValidateGL()
     mCanLoseContextInForeground = Preferences::GetBool("webgl.can-lose-context-in-foreground", true);
     mRestoreWhenVisible = Preferences::GetBool("webgl.restore-context-when-visible", true);
 
-    if (MinCapabilityMode())
-        mDisableFragHighP = true;
-
     // These are the default values, see 6.2 State tables in the
     // OpenGL ES 2.0.25 spec.
     mColorWriteMask[0] = 1;



More information about the tor-commits mailing list