layout/inspector/tests/test_bug536379.html

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 <!DOCTYPE HTML>
     2 <html>
     3 <!--
     4 https://bugzilla.mozilla.org/show_bug.cgi?id=536379
     5 -->
     6 <head>
     7   <title>Test for Bug 536379</title>
     8   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     9   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    10   <link rel="stylesheet" type="text/css" href="data:text/css,p { color: green }">
    11   <link rel="stylesheet" type="text/css" href="data:text/css,p { color: green }">
    12 </head>
    13 <body>
    14 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=536379">Mozilla Bug 536379</a>
    15 <p id="display"></p>
    16 <pre id="test">
    17 <script type="application/javascript">
    19 /** Test for Bug 536379 **/
    21 const CI = SpecialPowers.Ci;
    22 const CC = SpecialPowers.Cc;
    24 var domUtils =
    25   CC["@mozilla.org/inspector/dom-utils;1"].getService(CI.inIDOMUtils);
    26 var rules = domUtils.getCSSStyleRules(document.getElementById("display"));
    27 var firstPRule =
    28   rules.GetElementAt(rules.Count() - 2).QueryInterface(CI.nsIDOMCSSStyleRule);
    29 firstPRule.style.removeProperty("color");
    30 ok(true, "should not crash");
    32 var links = document.getElementsByTagName("link");
    33 is(links.length, 3, "links.length");
    34 is(SpecialPowers.unwrap(firstPRule.parentStyleSheet), links[1].sheet, "sheet match for first P rule");
    35 var secondPRule =
    36   rules.GetElementAt(rules.Count() - 1).QueryInterface(CI.nsIDOMCSSStyleRule);
    37 is(SpecialPowers.unwrap(secondPRule.parentStyleSheet), links[2].sheet, "sheet match for second P rule");
    38 is(links[1].href, links[2].href, "links should have same href");
    39 isnot(links[1].sheet, links[2].sheet, "links should have different sheets");
    40 isnot(firstPRule, secondPRule, "rules should be different");
    41 isnot(firstPRule.cssText, secondPRule.cssText, "text should be different since property was removed from one");
    43 </script>
    44 </pre>
    45 </body>
    46 </html>

mercurial