Bug 765590 - CSSNameSpaceRule.type should be 10, not 0. r=dbaron
authorJignesh Kakadiya <jigneshhk1992@gmail.com>
Thu, 21 Jun 2012 12:58:19 -0700
changeset 97320 0f3f06fbe11d1eb3b2c2e263b50040948077bf50
parent 97319 8505289f8042424ef02f240f230892f4e713a00c
child 97321 94e753c5323db1cfb7260dcef4fca864d03f022f
push id22968
push useremorley@mozilla.com
push dateFri, 22 Jun 2012 10:29:13 +0000
treeherdermozilla-central@aaa6906f8e92 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron
bugs765590
milestone16.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 765590 - CSSNameSpaceRule.type should be 10, not 0. r=dbaron
dom/interfaces/css/nsIDOMCSSRule.idl
layout/style/nsCSSRules.cpp
layout/style/test/Makefile.in
layout/style/test/test_bug765590.html
--- a/dom/interfaces/css/nsIDOMCSSRule.idl
+++ b/dom/interfaces/css/nsIDOMCSSRule.idl
@@ -21,16 +21,17 @@ interface nsIDOMCSSRule : nsISupports
   const unsigned short      STYLE_RULE                     = 1;
   const unsigned short      CHARSET_RULE                   = 2;
   const unsigned short      IMPORT_RULE                    = 3;
   const unsigned short      MEDIA_RULE                     = 4;
   const unsigned short      FONT_FACE_RULE                 = 5;
   const unsigned short      PAGE_RULE                      = 6;
   const unsigned short      MOZ_KEYFRAMES_RULE             = 7;
   const unsigned short      MOZ_KEYFRAME_RULE              = 8;
+  const unsigned short      NAMESPACE_RULE                 = 10;
 
   readonly attribute unsigned short      type;
            attribute DOMString           cssText;
                                         // raises(DOMException) on setting
 
   readonly attribute nsIDOMCSSStyleSheet parentStyleSheet;
   readonly attribute nsIDOMCSSRule       parentRule;
 };
--- a/layout/style/nsCSSRules.cpp
+++ b/layout/style/nsCSSRules.cpp
@@ -1192,18 +1192,17 @@ NameSpaceRule::Clone() const
 {
   nsRefPtr<Rule> clone = new NameSpaceRule(*this);
   return clone.forget();
 }
 
 NS_IMETHODIMP
 NameSpaceRule::GetType(PRUint16* aType)
 {
-  // XXX What should really happen here?
-  *aType = nsIDOMCSSRule::UNKNOWN_RULE;
+  *aType = nsIDOMCSSRule::NAMESPACE_RULE;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 NameSpaceRule::GetCssText(nsAString& aCssText)
 {
   aCssText.AssignLiteral("@namespace ");
   if (mPrefix) {
--- a/layout/style/test/Makefile.in
+++ b/layout/style/test/Makefile.in
@@ -97,16 +97,17 @@ GARBAGE += css_properties.js
 		test_bug652486.html \
 		test_bug657143.html \
 		test_bug664955.html \
 		test_bug667520.html \
 		test_bug645998.html \
 		file_bug645998-1.css \
 		file_bug645998-2.css \
 		test_bug716226.html \
+		test_bug765590.html \
 		test_cascade.html \
 		test_ch_ex_no_infloops.html \
 		test_compute_data_with_start_struct.html \
 		test_computed_style.html \
 		test_computed_style_no_pseudo.html \
 		test_css_cross_domain.html \
 		test_css_eof_handling.html \
 		test_default_bidi_css.html \
new file mode 100644
--- /dev/null
+++ b/layout/style/test/test_bug765590.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=765590
+-->
+<head>
+  <title>Test for Bug 765590</title>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+  <style>
+    @namespace svg "http://www.w3.org/2000/svg";
+  </style>
+</head>
+<body>
+  <script>
+    var styleElement = document.getElementsByTagName("style")[0]
+    var rule = styleElement.sheet.cssRules[0];
+    is(rule.type, 10, "rule type should be equal 10")
+    is(CSSRule.NAMESPACE_RULE, 10, "NAMESPACE_RULE should be equal to 10")
+  </script>
+</body>