Closed Bug 79818 Opened 21 years ago Closed 21 years ago

CSSNameSpaceRuleImpl and othes in nsCSSRules.cpp do not implement nsIDOMCSSRule


(Core :: DOM: CSS Object Model, defect)

Not set





(Reporter: bzbarsky, Assigned: jst)




(5 files)

BUILD: 2001-05-09-08

We throw an exception if we try to use item() on the rule list of a stylesheet
to get a namespace declaration.  Same for media rules.
Blocks: 74862
OK.  I have a patch for this.  It works fine ... from chrome.  When I try to use
.item() to get the rules from a CSSRuleList from JS in a webpage, I get:

JavaScript error: 
 line 0: uncaught exception: Permission denied to create wrapper for object

Looks like xpcdom trouble there.. not really sure how to fix it.  Ccing Mitch.

Attaching testcase to test on and patch that implements the nsIDOMCSSRule
interface for all the various rules.
Attached file HTML file to test on
Attached patch PatchSplinter Review
Hey, a patch, great! Here's a few comments:

In ::GetParentStyleSheet() (in all classes), change:

+  if (nsnull != mSheet) {
+    return mSheet->QueryInterface(NS_GET_IID(nsIDOMCSSStyleSheet), (void**)aSheet);
+  }
+  *aSheet = nsnull;
+  return NS_OK;


+  if (mSheet) {
+    return CallQueryInterInterface(mSheet, aSheet);
+  }
+  *aSheet = nsnull;
+  return NS_OK;

Other than that the patch looks great! You wanna add classinfo to these classes
too? :-)
Adding classinfo would make these classes accessable from web content too, not
only from chrome. (look for NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO).
The new patch addresses jst's ::GetParentStyleSheet() comment, adds classinfo to
all the classes, and works from web content and chrome both.  Reviews?
I still see:

  if (nsnull != mSheet) {

in stead of simply:

  if (mSheet) {

but I can live with that, change it if you want to :-)

sr=jst, great job!
Patch without the compares to nsnull attached.  ccing jband for r=
Fix checked in, thanks for all the great work, Boris!
Closed: 21 years ago
Resolution: --- → FIXED
tweaking summary slightly to reflect what was actually implemented.  Changing
Summary: CSSNameSpaceRuleImpl and othes in nsCSSRules.cpp do not implement nsIDOMCSSStyleRule → CSSNameSpaceRuleImpl and othes in nsCSSRules.cpp do not implement nsIDOMCSSRule
*** Bug 31059 has been marked as a duplicate of this bug. ***
You need to log in before you can comment on or make changes to this bug.