CSSNameSpaceRuleImpl and othes in nsCSSRules.cpp do not implement nsIDOMCSSRule

RESOLVED FIXED

Status

()

RESOLVED FIXED
18 years ago
17 years ago

People

(Reporter: bzbarsky, Assigned: jst)

Tracking

Trunk
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(5 attachments)

(Reporter)

Description

18 years ago
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.
(Reporter)

Updated

18 years ago
Blocks: 74862
(Reporter)

Comment 1

18 years ago
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.
(Reporter)

Comment 2

18 years ago
Created attachment 33837 [details]
HTML file to test on
(Assignee)

Comment 4

18 years ago
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;

to:

+  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? :-)
(Assignee)

Comment 5

18 years ago
Adding classinfo would make these classes accessable from web content too, not
only from chrome. (look for NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO).
(Reporter)

Comment 6

18 years ago
Created attachment 34308 [details] [diff] [review]
Patch adding classinfo
(Reporter)

Comment 7

18 years ago
The new patch addresses jst's ::GetParentStyleSheet() comment, adds classinfo to
all the classes, and works from web content and chrome both.  Reviews?
Keywords: mozilla0.9.1, patch, review
(Assignee)

Comment 8

18 years ago
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!
(Reporter)

Comment 9

18 years ago
Created attachment 34365 [details] [diff] [review]
patch without the comparison to nsnull
(Reporter)

Comment 10

18 years ago
Patch without the compares to nsnull attached.  ccing jband for r=
(Reporter)

Comment 11

18 years ago
Created attachment 34498 [details] [diff] [review]
patch updated to apply cleanly
(Assignee)

Comment 12

18 years ago
Fix checked in, thanks for all the great work, Boris!
Status: NEW → RESOLVED
Last Resolved: 18 years ago
Resolution: --- → FIXED
(Reporter)

Comment 13

18 years ago
tweaking summary slightly to reflect what was actually implemented.  Changing
nsIDOMCSSSTyleRule to nsIDOMCSSRule
Summary: CSSNameSpaceRuleImpl and othes in nsCSSRules.cpp do not implement nsIDOMCSSStyleRule → CSSNameSpaceRuleImpl and othes in nsCSSRules.cpp do not implement nsIDOMCSSRule
(Reporter)

Comment 14

17 years ago
*** 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.