Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | <!DOCTYPE HTML> |
michael@0 | 2 | <html> |
michael@0 | 3 | <!-- |
michael@0 | 4 | https://bugzilla.mozilla.org/show_bug.cgi?id=416896 |
michael@0 | 5 | --> |
michael@0 | 6 | <head> |
michael@0 | 7 | <title>Test for Bug 416896</title> |
michael@0 | 8 | <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 9 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
michael@0 | 10 | <link rel="stylesheet" type="text/css" id="l" |
michael@0 | 11 | href="data:text/css,a { color: green }"/> |
michael@0 | 12 | <style type="text/css" id="i"> a { color: blue; } </style> |
michael@0 | 13 | |
michael@0 | 14 | </head> |
michael@0 | 15 | <body> |
michael@0 | 16 | <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=416896">Mozilla Bug 416896</a> |
michael@0 | 17 | <p id="display"></p> |
michael@0 | 18 | <div id="content" style="display: none"> |
michael@0 | 19 | |
michael@0 | 20 | </div> |
michael@0 | 21 | <pre id="test"> |
michael@0 | 22 | <script class="testbody" type="text/javascript"> |
michael@0 | 23 | |
michael@0 | 24 | /** Test for Bug 416896 **/ |
michael@0 | 25 | var inlineSheet = $("i").sheet; |
michael@0 | 26 | isnot(inlineSheet, null, "Should have sheet here"); |
michael@0 | 27 | |
michael@0 | 28 | var linkedSheet = $("l").sheet; |
michael@0 | 29 | isnot(linkedSheet, null, "Should have sheet here"); |
michael@0 | 30 | |
michael@0 | 31 | var domUtils = SpecialPowers.Cc["@mozilla.org/inspector/dom-utils;1"] |
michael@0 | 32 | .getService(SpecialPowers.Ci.inIDOMUtils); |
michael@0 | 33 | const nsIDOMCSSStyleRule = SpecialPowers.Ci["nsIDOMCSSStyleRule"]; |
michael@0 | 34 | var inspectedRules = domUtils.getCSSStyleRules(document.links[0]); |
michael@0 | 35 | |
michael@0 | 36 | var seenInline = false; |
michael@0 | 37 | var seenLinked = false; |
michael@0 | 38 | |
michael@0 | 39 | for (var i = 0; i < inspectedRules.Count(); ++i) |
michael@0 | 40 | { |
michael@0 | 41 | var rule = |
michael@0 | 42 | SpecialPowers.unwrap(inspectedRules.GetElementAt(i).QueryInterface(nsIDOMCSSStyleRule)); |
michael@0 | 43 | var sheet = rule.parentStyleSheet; |
michael@0 | 44 | if (sheet == inlineSheet) { |
michael@0 | 45 | is(sheet.href, null, "It's an inline sheet"); |
michael@0 | 46 | is(seenInline, false, "Only one inline rule matches"); |
michael@0 | 47 | seenInline = true; |
michael@0 | 48 | } else { |
michael@0 | 49 | isnot(sheet.href, null, "Shouldn't have null href here"); |
michael@0 | 50 | if (sheet == linkedSheet) { |
michael@0 | 51 | is(seenLinked, false, "Only one linked rule matches"); |
michael@0 | 52 | seenLinked = true; |
michael@0 | 53 | } |
michael@0 | 54 | } |
michael@0 | 55 | } |
michael@0 | 56 | |
michael@0 | 57 | is(seenLinked, true, "Didn't find the linked rule?"); |
michael@0 | 58 | is(seenInline, true, "Didn't find the inline rule?"); |
michael@0 | 59 | |
michael@0 | 60 | |
michael@0 | 61 | </script> |
michael@0 | 62 | </pre> |
michael@0 | 63 | </body> |
michael@0 | 64 | </html> |
michael@0 | 65 |