layout/inspector/tests/test_bug536379.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/layout/inspector/tests/test_bug536379.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,46 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=536379
     1.8 +-->
     1.9 +<head>
    1.10 +  <title>Test for Bug 536379</title>
    1.11 +  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.12 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    1.13 +  <link rel="stylesheet" type="text/css" href="data:text/css,p { color: green }">
    1.14 +  <link rel="stylesheet" type="text/css" href="data:text/css,p { color: green }">
    1.15 +</head>
    1.16 +<body>
    1.17 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=536379">Mozilla Bug 536379</a>
    1.18 +<p id="display"></p>
    1.19 +<pre id="test">
    1.20 +<script type="application/javascript">
    1.21 +
    1.22 +/** Test for Bug 536379 **/
    1.23 +
    1.24 +const CI = SpecialPowers.Ci;
    1.25 +const CC = SpecialPowers.Cc;
    1.26 +
    1.27 +var domUtils =
    1.28 +  CC["@mozilla.org/inspector/dom-utils;1"].getService(CI.inIDOMUtils);
    1.29 +var rules = domUtils.getCSSStyleRules(document.getElementById("display"));
    1.30 +var firstPRule =
    1.31 +  rules.GetElementAt(rules.Count() - 2).QueryInterface(CI.nsIDOMCSSStyleRule);
    1.32 +firstPRule.style.removeProperty("color");
    1.33 +ok(true, "should not crash");
    1.34 +
    1.35 +var links = document.getElementsByTagName("link");
    1.36 +is(links.length, 3, "links.length");
    1.37 +is(SpecialPowers.unwrap(firstPRule.parentStyleSheet), links[1].sheet, "sheet match for first P rule");
    1.38 +var secondPRule =
    1.39 +  rules.GetElementAt(rules.Count() - 1).QueryInterface(CI.nsIDOMCSSStyleRule);
    1.40 +is(SpecialPowers.unwrap(secondPRule.parentStyleSheet), links[2].sheet, "sheet match for second P rule");
    1.41 +is(links[1].href, links[2].href, "links should have same href");
    1.42 +isnot(links[1].sheet, links[2].sheet, "links should have different sheets");
    1.43 +isnot(firstPRule, secondPRule, "rules should be different");
    1.44 +isnot(firstPRule.cssText, secondPRule.cssText, "text should be different since property was removed from one");
    1.45 +
    1.46 +</script>
    1.47 +</pre>
    1.48 +</body>
    1.49 +</html>

mercurial