Commit 2c935ce7 authored by Arthur Edelstein's avatar Arthur Edelstein Committed by Georg Koppen
Browse files

Regression tests for Bug #17207: Hide mime types and plugins when resisting fingerprinting

parent 78688df9
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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]
+49 −0
Original line number Diff line number Diff line
<!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>