Adding test
authorbzbarsky@mit.edu
Tue, 19 Feb 2008 10:15:45 -0800
changeset 11873 61e5e1ff72538922278f9e4bd572f2ad40988cc5
parent 11872 27ca28934b283b6102e9f14ef1eebfe9b3a79ae5
child 11874 f511da014c703895d0db4a2db843953a13a34c50
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
milestone1.9b4pre
Adding test
layout/base/tests/Makefile.in
layout/base/tests/test_bug416896.html
--- a/layout/base/tests/Makefile.in
+++ b/layout/base/tests/Makefile.in
@@ -84,14 +84,15 @@ ifdef MOZ_MOCHITEST
 		test_bug66619.html \
 		test_bug386575.xhtml \
 		test_bug388019.html \
 		test_bug394057.html \
 		test_bug396024.html \
 		test_bug399284.html \
 		test_bug399951.html \
 		test_bug404209.xhtml \
+		test_bug416896.html \
 		$(NULL)
 
 libs:: $(_TEST_FILES)
 	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
 
 endif # MOZ_MOCHITEST
new file mode 100644
--- /dev/null
+++ b/layout/base/tests/test_bug416896.html
@@ -0,0 +1,67 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=416896
+-->
+<head>
+  <title>Test for Bug 416896</title>
+  <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
+  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+  <link rel="stylesheet" type="text/css" id="l"
+        href="data:text/css,a { color: green }"/>
+  <style type="text/css" id="i"> a { color: blue; } </style>
+   
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=416896">Mozilla Bug 416896</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+  
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+/** Test for Bug 416896 **/
+ var inlineSheet = $("i").sheet;
+ isnot(inlineSheet, null, "Should have sheet here");
+
+ var linkedSheet = $("l").sheet;
+ isnot(linkedSheet, null, "Should have sheet here");
+
+  netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+ var domUtils = Components.classes["@mozilla.org/inspector/dom-utils;1"]
+                          .getService(Components.interfaces.inIDOMUtils);
+ const nsIDOMCSSStyleRule = Components.interfaces["nsIDOMCSSStyleRule"];
+ var inspectedRules = domUtils.getCSSStyleRules(document.links[0]);
+
+ var seenInline = false;
+ var seenLinked = false;
+ 
+ for (var i = 0; i < inspectedRules.Count(); ++i)
+ {
+   var rule =
+     inspectedRules.GetElementAt(i).QueryInterface(nsIDOMCSSStyleRule);
+   var sheet = rule.parentStyleSheet;
+   if (sheet == inlineSheet) {
+     is(sheet.href, null, "It's an inline sheet");
+     is(seenInline, false, "Only one inline rule matches");
+     seenInline = true;
+   } else {
+     isnot(sheet.href, null, "Shouldn't have null href here");
+     if (sheet == linkedSheet) {
+       is(seenLinked, false, "Only one linked rule matches");
+       seenLinked = true;
+     }
+   }
+ }
+
+ is(seenLinked, true, "Didn't find the linked rule?");
+ is(seenInline, true, "Didn't find the inline rule?");
+
+
+</script>
+</pre>
+</body>
+</html>
+