Closed Bug 85560 Opened 23 years ago Closed 23 years ago

rows attribute of table object inaccessible

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
major

Tracking

()

VERIFIED FIXED

People

(Reporter: davisre, Assigned: jst)

References

Details

(Keywords: dom2, Whiteboard: DIGBug, r=peterv, sr=jst, a=dbaron)

Attachments

(3 files)

From Bugzilla Helper: User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.1+) Gecko/20010607 Netscape6/6.1b1 BuildID: Gecko/20010607 Netscape6/6.1b1 Trying to access the "rows" attribute of an HTMLTableElement object causes the following error to appear on the JavaScript console: Error: uncaught exception: Permission denied to create wrapper for object Reproducible: Always Steps to Reproduce: 1. Get a table object using getElementById() 2. Try to access its rows (e.g. table.rows) 3. See the HTML sample below. Sample HTML: <html> <script> function test() { var table = window.document.getElementById("foo"); alert(table); alert(table.rows); } </script> <body onload="test()"> <table id="foo"> <tr><td>one</td><td>two</td></tr> </table> </body> </html>
Whiteboard: DIGBug
Happens on Linux build 2001-06-11-08 as well. Looks like nsGenericHTMLCollection needs classinfo. Patch coming up.
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Windows 2000 → All
Hardware: PC → All
Attached file testcase (deleted) —
Attached patch patch adding classinfo (deleted) — Splinter Review
Reviews?
This is a good start, but nsContentList already defines classinfo for HTMLCollection, you'll need to name the classinfo something else and use the NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO_WITH_NAME macro to use your new classinfo with the name HTMLCollection, i.e. NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO_WITH_NAME(HTMLTableChildCollection, HTMLCollection)
Oh, and I think this is a dupe, btw, but I don't have the number of the other bug handy...
I tried doing something like: NS_CLASSINFO_MAP_BEGIN(HTMLGenericCollection) NS_CLASSINFO_MAP_ENTRY(nsIDOMHTMLCollection) NS_CLASSINFO_MAP_END NS_INTERFACE_MAP_BEGIN(nsGenericDOMHTMLCollection) NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLCollection) NS_INTERFACE_MAP_ENTRY(nsISupports) NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO_WITH_NAME(HTMLGenericCollection, HTMLCollection) NS_INTERFACE_MAP_END And adding: NS_DEFINE_CLASSINFO_DATA(HTMLGenericCollection, nsHTMLCollectionSH, ARRAY_SCRIPTABLE_FLAGS) to nsDOMClassInfo.cpp, but I get the following assertion: ###!!! ASSERTION: Multiple GetIIDs function for the same nsDOMClassInfoID: 'sClassInfoData[aID].mGetIIDsFptr == aGetIIDsFptr', file nsDOMClassInfo.cpp, line 996 ###!!! Break: at file nsDOMClassInfo.cpp, line 996 Is this because I'm using nsHTMLCollectionSH? Or am I doing something else wrong? Is there a good doc on the classinfo stuff somewhere? :)
jst: I thought it was a dup too, but I think we were both thinking of bug 83107 "Javascript table sort broken". jband said in that bug that nsTableCellCollection needs to expose classInfo. Boris? ;)
Hmm. Actually, jst is sort of right. In bug 83107, nsTableCellCollection inherits from GenericElementCollection, which inherits from nsGenericDOMHTMLCollection. In this bug, TableRowsCollection inherits directly from nsGenericDOMHTMLCollection. So adding classinfo to nsGenericDOMHTMLCollection (which is what the patch tries to do) fixes both bugs. It _seems_ to me that nsGenericDOMHTMLCollection should have classinfo... but I could be wrong. Perhaps there are things that inherit from it that should not be scriptable. jst? mstoltz? Oh, the assertion disappeared when I did a full build (instead of just building in dom/ and content/). So looks like that was just an artifact of something not getting rebuilt that should have been in a different module. So attaching new patch. :)
OK. I've searched through the source, and nsTableCellCollection and TableRowsCollection are the only leaf classes inheriting from nsGenericHTMLCollection. So this patch does the right thing. I've been running with it for a few days and things work fine. Reviews please?
Whiteboard: DIGBug → DIGBug, r=?, sr=?, a=?
Peter, could you review this?
r=peterv if jst buys it :).
sr=jst
Whiteboard: DIGBug, r=?, sr=?, a=? → DIGBug, r=peterv, sr=jst, a=?
Blocks: 83989
a=dbaron for trunk checkin (on behalf of drivers)
Keywords: review
Whiteboard: DIGBug, r=peterv, sr=jst, a=? → DIGBug, r=peterv, sr=jst, a=dbaron
Fix checked in.
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
tested on build 2001-06-21-11-0.9.1 windows 2000 for the testcase given below...still got this error message in console resulting in not showing alert... error message in console--- Error: uncaught exception: Permission denied to create wrapper for object reopening bug
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
sivarikan, this isn't a build off the 0.9.1 branch is it? It's a trunk build? Could you possibly retest with a current nightly? This works fine for me with a 2001-06-27-22 nightly and with my CVS builds from June 27 and June 28
WORKSFORME with yesterdays nightly build, marking FIXED again.
Status: REOPENED → RESOLVED
Closed: 23 years ago23 years ago
Resolution: --- → FIXED
works ...shows the tableelement and the htmlcollection objects... marking as verified...
Status: RESOLVED → VERIFIED
works ...shows the tableelement and the htmlcollection objects... marking as verified... verified on win2k build --2001-07-09-09
Component: DOM: HTML → DOM: Core & HTML
QA Contact: stummala → general
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: