tbb-tests/test_tor_bug2875.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/tbb-tests/test_tor_bug2875.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,73 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +Tor bug
     1.8 +https://trac.torproject.org/projects/tor/ticket/2875
     1.9 +-->
    1.10 +<head>
    1.11 +  <meta charset="utf-8">
    1.12 +  <title>Test for Tor Bug #2875: Limit device and system specific CSS Media Queries</title>
    1.13 +  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.14 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    1.15 +  <script type="application/javascript">
    1.16 +  var keyValMatches = ([key, val]) => matchMedia("(" + key + ":" + val +")").matches;
    1.17 +
    1.18 +  // Default spoofed values by Tor Browser:
    1.19 +  var tor_defaults = [
    1.20 +    ["color", 8],
    1.21 +    ["color-index", 0],
    1.22 +    ["aspect-ratio", window.innerWidth + "/" + window.innerHeight],
    1.23 +    ["device-aspect-ratio", window.innerWidth + "/" + window.innerHeight],
    1.24 +    ["device-height", window.innerHeight + "px"],
    1.25 +    ["device-width", window.innerWidth + "px"],
    1.26 +    ["grid", 0],
    1.27 +    ["height", window.innerHeight + "px"],
    1.28 +    ["monochrome", 0],
    1.29 +    ["orientation", window.innerWidth > window.innerHeight ? "landscape" : "portrait"],
    1.30 +    ["resolution", "96dpi"],
    1.31 +    ["resolution", "1dppx"],
    1.32 +    ["width", window.innerWidth + "px"],
    1.33 +    ["-moz-device-pixel-ratio", 1],
    1.34 +    ["-moz-device-orientation", window.innerWidth > window.innerHeight ? "landscape" : "portrait"]
    1.35 +  ];
    1.36 +
    1.37 +  tor_defaults.map(([key, val]) => ok(keyValMatches([key, val]), "Expected " + key + ":" + val));
    1.38 +
    1.39 +  var tor_suppressed_toggles = [
    1.40 +    "-moz-images-in-menus",
    1.41 +    "-moz-mac-graphite-theme",
    1.42 +    "-moz-maemo-classic",
    1.43 +    "-moz-scrollbar-end-backward",
    1.44 +    "-moz-scrollbar-end-forward",
    1.45 +    "-moz-scrollbar-start-backward",
    1.46 +    "-moz-scrollbar-start-backward",
    1.47 +    "-moz-scrollbar-thumb-proportional",
    1.48 +    "-moz-touch-enabled",
    1.49 +    "-moz-windows-classic",
    1.50 +    "-moz-windows-compositor",
    1.51 +    "-moz-windows-default-theme",
    1.52 +    "-moz-windows-glass",
    1.53 +    "-moz-windows-theme"
    1.54 +  ];
    1.55 +
    1.56 +  tor_suppressed_toggles.map(key => ok(!keyValMatches([key, 0]) && !keyValMatches([key, 1]),
    1.57 +                                       key + " should not exist.")); 
    1.58 +
    1.59 +  var foundOSVersion = false;
    1.60 +  ["windows-xp", "windows-vista", "windows-win7", "windows-win8"].map(function (val) {
    1.61 +    foundOSVersion = foundOSVersion || keyValMatches(["-moz-os-version", val]);
    1.62 +  });
    1.63 +  ok(!foundOSVersion, "-moz-os-version should have no match");
    1.64 +    
    1.65 +  </script>
    1.66 +</head>
    1.67 +<body>
    1.68 +<a target="_blank" href="https://trac.torproject.org/projects/tor/ticket/2875">Tor Bug 2875</a>
    1.69 +<p id="display"></p>
    1.70 +<div id="content" style="display: none">
    1.71 +
    1.72 +</div>
    1.73 +<pre id="test">
    1.74 +</pre>
    1.75 +</body>
    1.76 +</html>

mercurial