tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_ch_ex_no_infloops.html (1742B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=678671
      5 -->
      6 <head>
      7  <title>Test for Bug 678671</title>
      8  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      9  <script type="text/javascript" src="property_database.js"></script>
     10  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
     11 </head>
     12 <body>
     13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=678671">Mozilla Bug 678671</a>
     14 <p id="display"></p>
     15 <div id="content"></div>
     16 <script type="application/javascript">
     17 
     18 /** Test for Bug 678671 */
     19 
     20 /**
     21 * Test 'ex' and 'ch' units in every place we possible can to make
     22 * sure they don't cause an infinite loop.
     23 */
     24 
     25 var content = document.getElementById("content");
     26 var cs = getComputedStyle(content, "");
     27 
     28 for (var prop in gCSSProperties) {
     29  var info = gCSSProperties[prop];
     30  function test_val(v) {
     31    content.style.setProperty(prop, v, "");
     32    isnot(get_computed_value(cs, prop), "",
     33      "Setting '" + prop + "' to '" + v + "' should not cause infinite loop");
     34  }
     35  test_val('3ex');
     36  test_val('2ch');
     37  function test_replaced_values(value_list) {
     38    // For each item in value_list, if it looks like it has a dimension
     39    // in it, replace those dimensions with 3ex and 2ch and test it.
     40    for (var i = 0; i < value_list.length; ++i) {
     41      var value = value_list[i];
     42      function try_replace(withval) {
     43        var rep = value.replace(/[0-9.]+[a-zA-Z]+/g, withval)
     44        if (rep != value) {
     45          test_val(rep);
     46        }
     47      }
     48      try_replace('3ex');
     49      try_replace('2ch');
     50    }
     51  }
     52  test_replaced_values(info.initial_values);
     53  test_replaced_values(info.other_values);
     54  content.style.removeProperty(prop);
     55 }
     56 
     57 </script>
     58 </pre>
     59 </body>
     60 </html>