Bug 1217290 - Add test cases for WebGL fingerprinting resistance r=daoshengmu,jgilbert
authorChung-Sheng Fu <cfu@mozilla.com>
Thu, 27 Jul 2017 15:54:36 +0800
changeset 376656 49462cfe24ecf1ee026a6fca2a9821c201488304
parent 376655 61d074cfdeafd13395c089dcd4b2c47fb5d80204
child 376657 95c4a9f2a723f59e207bfa461b274571a96311ad
push id32388
push userryanvm@gmail.com
push dateFri, 25 Aug 2017 00:20:24 +0000
treeherdermozilla-central@2306e153fba9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdaoshengmu, jgilbert
bugs1217290
milestone57.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1217290 - Add test cases for WebGL fingerprinting resistance r=daoshengmu,jgilbert MozReview-Commit-ID: LeEJ4V7iYto
dom/canvas/test/webgl-mochitest/mochitest.ini
dom/canvas/test/webgl-mochitest/test_webgl_fingerprinting_resistance.html
--- a/dom/canvas/test/webgl-mochitest/mochitest.ini
+++ b/dom/canvas/test/webgl-mochitest/mochitest.ini
@@ -103,8 +103,10 @@ skip-if = toolkit == 'android' #bug 8654
 fail-if = (os == 'mac') || (os == 'win' && !(e10s && os_version == '6.1')) # no fast path on windows yet (bug 1373165 or 1373770), and mac (bug 1373669)
 [test_video_fastpath_theora.html]
 fail-if = (os == 'win' && os_version != '6.1') # no fast path on windows yet (bug 1373192), and mac (bug 1373702)
 [test_video_fastpath_vp8.html]
 fail-if = (os == 'win' && os_version != '6.1') # no fast path on windows yet (bug 1373192), and mac (bug 1373702)
 [test_video_fastpath_vp9.html]
 fail-if = (os == 'win' && os_version != '6.1') # no fast path on windows yet (bug 1373192), and mac (bug 1373702)
 [test_webglcontextcreationerror.html]
+[test_webgl_fingerprinting_resistance.html]
+fail-if = (os == 'mac') || (os == 'win') # on try server, LOCAL_GL_MAX_CUBE_MAP_TEXTURE_SIZE = 512 on mac and LOCAL_GL_ALIASED_LINE_WIDTH_RANGE = [1, 1] on win
new file mode 100644
--- /dev/null
+++ b/dom/canvas/test/webgl-mochitest/test_webgl_fingerprinting_resistance.html
@@ -0,0 +1,47 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script>
+/* global SimpleTest SpecialPowers */
+SimpleTest.waitForExplicitFinish();
+document.addEventListener("DOMContentLoaded", async function() {
+  await SpecialPowers.pushPrefEnv({
+    set: [
+      ["privacy.resistFingerprinting", true]
+    ]
+  });
+
+  let canvas = document.body.appendChild(document.createElement("canvas"));
+  if (!canvas) {
+    SimpleTest.ok(false, "Cannot create canvas");
+    SimpleTest.finish();
+  }
+
+  let gl = canvas.getContext("webgl");
+  if (!gl) {
+    SimpleTest.ok(false, "Cannot get WebGL context");
+    SimpleTest.finish();
+  }
+
+  SimpleTest.is(gl.getParameter(gl.MAX_TEXTURE_SIZE), 2048, "MAX_TEXTURE_SIZE");
+  SimpleTest.is(gl.getParameter(gl.MAX_CUBE_MAP_TEXTURE_SIZE),  2048, "MAX_CUBE_MAP_TEXTURE_SIZE");
+  SimpleTest.is(gl.getParameter(gl.MAX_RENDERBUFFER_SIZE),  2048, "MAX_RENDERBUFFER_SIZE");
+  SimpleTest.is(gl.getParameter(gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS),  8, "MAX_VERTEX_TEXTURE_IMAGE_UNITS");
+  SimpleTest.is(gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS),  8, "MAX_TEXTURE_IMAGE_UNITS");
+  SimpleTest.is(gl.getParameter(gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS),  16, "MAX_COMBINED_TEXTURE_IMAGE_UNITS");
+  SimpleTest.is(gl.getParameter(gl.MAX_VERTEX_ATTRIBS),  16, "MAX_VERTEX_ATTRIBS");
+  SimpleTest.is(gl.getParameter(gl.MAX_VERTEX_UNIFORM_VECTORS),  256, "MAX_VERTEX_UNIFORM_VECTORS");
+  SimpleTest.is(gl.getParameter(gl.MAX_FRAGMENT_UNIFORM_VECTORS),  224, "MAX_FRAGMENT_UNIFORM_VECTORS");
+  SimpleTest.is(gl.getParameter(gl.MAX_VARYING_VECTORS),  8, "MAX_VARYING_VECTORS");
+  let viewportDims = gl.getParameter(gl.MAX_VIEWPORT_DIMS);
+  SimpleTest.is(viewportDims[0],  4096, "MAX_VIEWPORT_DIMS[0]");
+  SimpleTest.is(viewportDims[1],  4096, "MAX_VIEWPORT_DIMS[1]");
+  let aliasedPointSizeRange = gl.getParameter(gl.ALIASED_POINT_SIZE_RANGE);
+  SimpleTest.is(aliasedPointSizeRange[0],  1, "ALIASED_POINT_SIZE_RANGE[0]");
+  SimpleTest.is(aliasedPointSizeRange[1],  63, "ALIASED_POINT_SIZE_RANGE[1]");
+  let aliasedLineWIdthRange = gl.getParameter(gl.ALIASED_LINE_WIDTH_RANGE);
+  SimpleTest.is(aliasedLineWIdthRange[0],  1, "ALIASED_LINE_WIDTH_RANGE[0]");
+  SimpleTest.is(aliasedLineWIdthRange[1],  5, "ALIASED_LINE_WIDTH_RANGE[1]");
+  SimpleTest.finish();
+});
+</script>