test_bug536379.html (1647B)
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 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"> 18 19 /** Test for Bug 536379 */ 20 21 const CI = SpecialPowers.Ci; 22 const CC = SpecialPowers.Cc; 23 const InspectorUtils = SpecialPowers.InspectorUtils; 24 25 var rules = InspectorUtils.getMatchingCSSRules(document.getElementById("display")); 26 var firstPRule = rules[rules.length - 2]; 27 firstPRule.style.removeProperty("color"); 28 ok(true, "should not crash"); 29 30 var links = document.getElementsByTagName("link"); 31 is(links.length, 3, "links.length"); 32 is(SpecialPowers.unwrap(firstPRule.parentStyleSheet), links[1].sheet, "sheet match for first P rule"); 33 var secondPRule = rules[rules.length - 1]; 34 is(SpecialPowers.unwrap(secondPRule.parentStyleSheet), links[2].sheet, "sheet match for second P rule"); 35 is(links[1].href, links[2].href, "links should have same href"); 36 isnot(links[1].sheet, links[2].sheet, "links should have different sheets"); 37 isnot(firstPRule, secondPRule, "rules should be different"); 38 isnot(firstPRule.cssText, secondPRule.cssText, "text should be different since property was removed from one"); 39 40 </script> 41 </pre> 42 </body> 43 </html>