Last Comment Bug 754772 - CSS rules are recognized as CSSNameSpaceRule
: CSS rules are recognized as CSSNameSpaceRule
Status: UNCONFIRMED
:
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
:
Mentors:
Depends on: 851892
Blocks:
  Show dependency treegraph
 
Reported: 2012-05-13 22:33 PDT by Sebastian Zartner
Modified: 2015-09-24 07:02 PDT (History)
5 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


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

Description 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.

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

Sebastian
Comment 3 David Baron :dbaron: ⌚️UTC+2 (mostly busy through August 4; review requests must explain patch) 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 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);

Sebastian
Comment 5 Boris Zbarsky [:bz] 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 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 https://getfirebug.com/tests/manual/issues/6282/issue6282.html.

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

Sebastian
Comment 7 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.

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

Sebastian
Comment 9 Boris Zbarsky [:bz] 2015-09-24 07:02:27 PDT
Looks like I forgot to cc Peter.  Anyway, the right fix here is the webidl conversion.

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