commit 3e925a360daf492465ab74f336209dad54e5497b Author: Arthur Edelstein arthuredelstein@gmail.com Date: Fri Oct 16 17:10:57 2015 -0700
Regression tests for Bug #17207: Hide mime types and plugins when resisting fingerprinting --- dom/base/test/mochitest.ini | 1 + dom/base/test/test_tor_bug17207.html | 49 ++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+)
diff --git a/dom/base/test/mochitest.ini b/dom/base/test/mochitest.ini index 133348e..6a8c334 100644 --- a/dom/base/test/mochitest.ini +++ b/dom/base/test/mochitest.ini @@ -739,6 +739,7 @@ skip-if = toolkit == 'android' || e10s #RANDOM [test_title.html] [test_tor_bug15502.html] [test_tor_bug15703.html] +[test_tor_bug17207.html] [test_treewalker_nextsibling.xml] [test_viewport_scroll.html] [test_viewsource_forbidden_in_object.html] diff --git a/dom/base/test/test_tor_bug17207.html b/dom/base/test/test_tor_bug17207.html new file mode 100644 index 0000000..4ab0a0d --- /dev/null +++ b/dom/base/test/test_tor_bug17207.html @@ -0,0 +1,49 @@ +<!DOCTYPE HTML> +<html> +<!-- +https://bugs.torproject.org/17207 +--> +<head> + <meta http-equiv="content-type" content="text/html; charset=utf-8"> + <title>Test for Tor Browser Bug 17207</title> + <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> + <script type="text/javascript" src="/tests/SimpleTest/SpawnTask.js"></script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> +</head> +<body> +<p id="display"></p> +<div id="content"></div> + +<script class="testbody" type="application/javascript;version=1.7"> +SimpleTest.waitForExplicitFinish(); + +// __setPref(key, value)__. +// Set a pref value asynchronously, returning a promise that resolves +// when it succeeds. +let setPref = function* (key, value) { + return new Promise(function(resolve, reject) { + SpecialPowers.pushPrefEnv({"set": [[key, value]]}, resolve); + }); +}; + +// Run a test to see that we don't expose the supported mimeTypes +// or installed plugins when "privacy.resistFingerprinting" is active. +spawnTask(function* () { + yield setPref("privacy.resistFingerprinting", true); + is(navigator.mimeTypes["application/pdf"], undefined, "Don't reveal mime types"); + is(navigator.mimeTypes.length, 0, "navigator.mimeTypes.length should be 0"); + yield setPref("privacy.resistFingerprinting", false); + isnot(navigator.mimeTypes["application/pdf"], undefined), + // TODO: In Firefox 38, mimeTypes are not enumerable because of https://bugzilla.mozilla.org/757726. + // But mimeType enumeration was subsequently brought back by https://bugzilla.mozilla.org/1169945. + // So we'll need to include the following line in mozilla-central or TBB/FF45ESR: + // isnot(navigator.mimeTypes.length, 0, "navigator.mimeTypes.length should not be nonzero"); + // TODO: We don't have any plugins in Tor Browser, but we will need to implement + // similar tests for plugins in mainline Firefox. + SimpleTest.finish(); +}); + +</script> + +</body> +</html>
tbb-commits@lists.torproject.org