tor-browser

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

test_bug1346623.html (1718B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <head>
      4  <title>Test for bug 1346623</title>
      5  <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
      6  <script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
      7  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
      8 </head>
      9 <body onload="startTest();">
     10 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1346623">Mozilla Bug 1346623</a>
     11 <div id="display">
     12 
     13 </div>
     14 <pre id="test">
     15 <script type="application/javascript">
     16 
     17 var winUtils = window.windowUtils;
     18 
     19 function startTest() {
     20  // load some styles at the agent level
     21  var css = `
     22    #ac-parent { color: green; }
     23    #ac-child.abc { }
     24  `;
     25  var sheetURL = "data:text/css," + encodeURIComponent(css);
     26  winUtils.loadSheetUsingURIString(sheetURL, winUtils.AGENT_SHEET);
     27 
     28  // add canvas anonymous content
     29  var bq = document.createElement("blockquote");
     30  bq.id = "ac-parent";
     31  bq.textContent = "This blockquote text should be green.";
     32  var div = document.createElement("div");
     33  div.id = "ac-child";
     34  div.textContent = " This div text should be green.";
     35  bq.appendChild(div);
     36  var ac = document.insertAnonymousContent();
     37  ac.root.appendChild(bq);
     38  document.body.offsetWidth;
     39 
     40  is(getComputedStyle(div).color, "rgb(0, 128, 0)",
     41     "color before reframing");
     42 
     43  // reframe the root
     44  document.documentElement.style.display = "flex";
     45  document.body.offsetWidth;
     46 
     47  // restyle the div
     48  div.className = "abc";
     49  document.body.offsetWidth;
     50 
     51  is(getComputedStyle(div).color, "rgb(0, 128, 0)",
     52     "color after reframing");
     53  SimpleTest.finish();
     54 }
     55 
     56 SimpleTest.waitForExplicitFinish();
     57 </script>
     58 </pre>
     59 </body>
     60 </html>