Last Comment Bug 754772 - CSS rules are recognized as CSSNameSpaceRule
: CSS rules are recognized as CSSNameSpaceRule
Product: Core
Classification: Components
Component: DOM: CSS Object Model (show other bugs)
: Trunk
: All All
-- normal (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
: Jet Villegas (:jet)
Depends on: 851892
  Show dependency treegraph
Reported: 2012-05-13 22:33 PDT by Sebastian Zartner
Modified: 2017-01-21 16:19 PST (History)
5 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

Test case (2.22 KB, text/html)
2012-05-13 22:35 PDT, Sebastian Zartner
no flags Details

Description User image Sebastian Zartner 2012-05-13 22:33:18 PDT
Testing a MozCSSKeyframesRule for "instanceof CSSNameSpaceRule" returns true.
See the attached test case for more info.

Comment 1 User image Sebastian Zartner 2012-05-13 22:35:22 PDT
Created attachment 623587 [details]
Test case
Comment 2 User image Sebastian Zartner 2012-05-13 22:47:44 PDT
Btw. MozCSSKeyframeRules are also recognized as CSSNameSpaceRules.

Comment 3 User image David Baron :dbaron: ⌚️UTC-8 2012-05-14 00:23:51 PDT
I'm guessing this is because CSSNameSpaceRule doesn't have any of its own interfaces; it just implements the generic CSS rule interface.
Comment 4 User image Sebastian Zartner 2012-05-14 01:29:41 PDT
Though a MozCSSKeyframeRule isn't an instance of a CSSNameSpaceRule.

I tried the following (via Firebug's Command Editor) to verify that:

function isInstanceOf(object, constructor)
    var proto = Object.getPrototypeOf(object);
    do {
        if (proto === constructor)
           return true;
        proto = Object.getPrototypeOf(proto);
    } while (proto !== null);
    return false;

isInstanceOf(document.styleSheets[1].cssRules[0], CSSNameSpaceRule.prototype);

Comment 5 User image Boris Zbarsky [:bz] (still a bit busy) 2012-05-14 07:30:29 PDT
This is a bit weird.  CSSNameSpaceRule.prototype.__proto__ == CSSRule.prototype.  That part is fine.

Peter, is the issues that we end up QIing to nsIDOMCSSRule in some xpconnect hasInstance hook here?

In any case, new bindings, when they happen, will fix this.
Comment 6 User image Sebastian Zartner [:sebo] 2013-02-21 14:01:49 PST
Note that this problem also occurs for the new CSSPageRule.
A test case can be found at

Executing document.styleSheets[2].cssRules[1] instanceof CSSNameSpaceRule will incorrectly return true.

Comment 7 User image Sebastian Zartner 2014-07-24 01:14:09 PDT
Just stumbled over this again when trying to check an CSSCounterStyleRule.

As David and Boris indicate this actually happens for all types of CSS rules.

> Peter, is the issues that we end up QIing to nsIDOMCSSRule in some xpconnect hasInstance hook here?
@Boris, could it be that Peter didn't get this message? At least there's no Peter in the CC list.

Also you marked this issue being blocked by the big Paris Bindings issue. I guess the more specific issue this depends on is bug 851892, so I replaced the bug number. Please correct me if that's wrong.

Comment 8 User image Sebastian Zartner [:sebo] 2015-09-24 06:09:15 PDT
ni'ing regarding comment 7.

Comment 9 User image Boris Zbarsky [:bz] (still a bit busy) 2015-09-24 07:02:27 PDT
Looks like I forgot to cc Peter.  Anyway, the right fix here is the webidl conversion.
Comment 10 User image Boris Zbarsky [:bz] (still a bit busy) 2017-01-14 10:29:53 PST
Fixed in bug 851892.
Comment 11 User image Sebastian Zartner [:sebo] 2017-01-21 16:19:39 PST
I can confirm that it works in Nightly 53.0a1 2017-01-21. Thank you, Boris!


Note You need to log in before you can comment on or make changes to this bug.