In page http://soren.qzone.qq.com/cgi-bin/soren/cgi_userinfo_search?bSimple=0&ptlang=2052, it uses document.styleSheets["CssId"].rules to get style css rule list. In safari, the page run well, but in Google Chrome, accessing document.styleSheets["CssId"].rules got "undefined". After investigation, Safari returns a [CSSStyleSheet] object when accessing document.styleSheets["CssId"], so the "rules" can be gotten. Chrome returns a [HTMLStyleElement] object when accessing document.styleSheets["CssId"], so the "rules" can not be gotten. I believe it's v8 binding's fault. See JS binding (JSStyleSheetListCustom.cpp, line 60), it returns stylesheet instead of returning style element.
Created attachment 42694 [details] patch to fix this issue.
Comment on attachment 42694 [details] patch to fix this issue. Thanks for tackling this! We just need a layout test and one small nit: > Index: WebCore/ChangeLog > =================================================================== > --- WebCore/ChangeLog (revision 50615) > +++ WebCore/ChangeLog (working copy) > @@ -1,3 +1,16 @@ > +2009-11-07 Johnny Ding <johnnyding.webkit@gmail.com> > + > + Reviewed by NOBODY (OOPS!). > + > + https://bugs.webkit.org/show_bug.cgi?id=31224 > + Returns a StyleSheet object instead of HTMLStyleElement when using Please update this to match the subject of the bug (including [V8] prefix). > + V8 engine to retrieve style sheet by a name from document.styleSheets . > + > + No new tests since it is only V8 binding issue.(JS binding is OK) Well, this is an easily testable case, so I would say a layout test is in order, regardless of whether it's a bindings issue for one engine and not another.
I wonder if there's already a layout test that we're failing that tests this.
Created attachment 42696 [details] patch v2 for fix Thanks, patch v2 is coming:)
Created attachment 42698 [details] patch v3 for fix
Created attachment 42699 [details] patch v3 for fix
Comment on attachment 42699 [details] patch v3 for fix Lovely. r=me.
Comment on attachment 42699 [details] patch v3 for fix Clearing flags on attachment: 42699 Committed r50637: <http://trac.webkit.org/changeset/50637>
All reviewed patches have been landed. Closing bug.