tor-browser

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

test_reframe_pseudo_element.html (1203B)


      1 <!doctype html>
      2 <meta charset="utf-8">
      3 <title>
      4  Test for bug 1376352: We don't reframe all the time a replaced element that
      5  matches generated content rules.
      6 </title>
      7 <link rel="author" href="mailto:emilio@crisal.io" title="Emilio Cobos Álvarez">
      8 <script src="/tests/SimpleTest/SimpleTest.js"></script>
      9 <style>
     10 #flex::before,
     11 input::before {
     12  content: "Foo";
     13 }
     14 </style>
     15 <input type="text">
     16 <div id="flex"></div>
     17 <script>
     18 SimpleTest.waitForExplicitFinish();
     19 const utils = SpecialPowers.getDOMWindowUtils(window);
     20 
     21 function testNoReframe(callback) {
     22  document.documentElement.offsetTop;
     23  const previousConstructCount = utils.framesConstructed;
     24  const previousRestyleGeneration = utils.restyleGeneration;
     25 
     26  callback();
     27 
     28  document.documentElement.offsetTop;
     29  isnot(previousRestyleGeneration, utils.restyleGeneration,
     30        "We should have restyled");
     31  is(previousConstructCount, utils.framesConstructed,
     32     "We shouldn't have reframed");
     33 }
     34 
     35 testNoReframe(function() {
     36  const input = document.querySelector('input');
     37  input.style.color = "blue";
     38 });
     39 
     40 testNoReframe(function() {
     41  const flex = document.getElementById('flex');
     42  flex.style.color = "blue";
     43 });
     44 
     45 SimpleTest.finish();
     46 </script>