RESOLVED FIXED 4309
CSSStyleSheet objects don't get Obj-C DOMCSSStyleSheet wrappers
https://bugs.webkit.org/show_bug.cgi?id=4309
Summary CSSStyleSheet objects don't get Obj-C DOMCSSStyleSheet wrappers
Darin Adler
Reported 2005-08-06 20:14:16 PDT
When calling a method that returns a style sheet object, the Objective-C DOM wrappers don't create the right type of wrapper for a CSSStyleSheet. You end up with a DOMStyleSheet instead of a DOMCSSStyleSheet.
Attachments
patch to fix the problem (2.22 KB, patch)
2005-08-06 20:16 PDT, Darin Adler
eric: review+
Darin Adler
Comment 1 2005-08-06 20:16:51 PDT
Created attachment 3246 [details] patch to fix the problem Added code to handle this like other DOM wrappers with subclasses. Looks like there's also a double-deref bug here that this fixes.
John Sullivan
Comment 2 2005-08-08 09:27:28 PDT
Comment on attachment 3246 [details] patch to fix the problem Patch looks good, but needs some sort of testing. r=me if you find a way to test it.
Eric Seidel (no email)
Comment 3 2005-09-17 14:54:55 PDT
Comment on attachment 3246 [details] patch to fix the problem Looks fine. I think this is a good change (simplifies code). I will note however, your current solution may have some rather odd failure symantics when passed the wrong pointer type to the wrong class. If you call _CSSStyleSheetWithImpl and pass a DOMStyleSheetImpl, you'll get back a valid pointer to an Obj-C object, but it will be a DOMStyleSheet *. Likewise if you call _DOMStyleSheetWithImpl and pass a DOMCSSStyleSheetImpl *, you'll get back a DOMCSSStyleSheet * instead of the expected DOMStyleSheet * In an ideal world, at least the first case (passing a DOMStyleSheetImpl * to the DOMCSSStyleSheet creation method) should return nil instead of a DOMStyleSheet *. But hopefully all this code will be going away in the next 6 months anyway (to be replaced by autogeneration). r=me.
Eric Seidel (no email)
Comment 4 2005-09-18 14:44:44 PDT
As ggaren correctly points out, all of these really should have layout tests. For better or worse I ignored that fact, realizing that we don't currently (AFAIK) have any way of testing the Obj-C DOM API. I talked with andersca a bit on IRC, he said he started the py-objc Obj-C DOM testing system, but hasn't finished yet.
Darin Adler
Comment 5 2005-09-23 10:38:32 PDT
Eric, the way this is supposed to work is that you get a compile-time error if you try to pass a DOMStyleSheetImpl to _CSSStyleSheetWithImpl. There's no need for the code to handle this case at runtime. Same for the other cases you mentioned.
Darin Adler
Comment 6 2005-09-23 10:40:39 PDT
Sorry, the other case was in the other direction. If you call _DOMStyleSheetWithImpl and pass a DOMCSSStyleSheetImpl *, you *must* get a DOMCSSStyleSheet *. That's a feature of the DOM binding, not a bug. The same is true of any subclasses of DOM nodes in a similar way. So the first of the two cases you mentioned is an error that is supposed to be caught at compile time, not runtime. And the second of the two cases is a feature, not a bug. I don't think there's anything wrong here. Lets talk about this in person if you're still concerned.
Alexey Proskuryakov
Comment 7 2006-07-28 05:16:16 PDT
*** Bug 6680 has been marked as a duplicate of this bug. ***
Note You need to log in before you can comment on or make changes to this bug.