Closed Bug 477431 Opened 15 years ago Closed 15 years ago

Inspector gets confused as to whether a node has children

Categories

(Core :: XPConnect, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

VERIFIED FIXED
mozilla1.9.1b3

People

(Reporter: WeirdAl, Assigned: mrbkap)

References

Details

(Keywords: testcase, verified1.9.1)

Attachments

(3 files, 1 obsolete file)

Attached file testcase document
Steps to reproduce:
(1) Open the grid-navigable.xul attachment in DOM Inspector.
(2) In the DOM Nodes panel on the left, navigate to window > gridbox > stack > second anonymous grid > columns.
(3) Switch to JS Object Viewer in the right-hand panel.

Expected results:  DOM Nodes panel shows the columns element as having children, and is expandable.  JS Object Viewer panel shows the childNodes property as having children and is also expandable.

Actual results:  DOM Nodes panel shows the columns element as having no children.  JS Object Viewer panel shows the childNodes property as having children, but you cannot expand the child rows beneath it.
Attached patch patch for JS Object Viewer (obsolete) — Splinter Review
I don't have a patch for the DOM Nodes viewer yet.
Attachment #361106 - Flags: review?(sdwilsh)
Blocks: 477844
Comment on attachment 361106 [details] [diff] [review]
patch for JS Object Viewer

r=sdwilsh, if you update the javadoc comment above the method, and add a comment stating why you are forcing everything to a string.
Attachment #361106 - Flags: superreview?(neil)
Attachment #361106 - Flags: review?(sdwilsh)
Attachment #361106 - Flags: review+
I don't think this is right. For some reason, the enumerator for an XPCSafeJSObjectWrapper for childNodes is returning the properties as numbers, not strings. For example, evaluate these in the JS console (opening the JS console from a blank browser tab for consistency):

>for (var prop in XPCSafeJSObjectWrapper(top.opener.content.document.childNodes)) dump(prop + "(" + (typeof prop) + ")\n")
0(number)
1(number)
length(string)
item(string)

>for (var prop in XPCNativeWrapper(top.opener.content.document.childNodes)) dump(prop + "(" + (typeof prop) + ")\n")
0(string)
1(string)

>for (var prop in (top.opener.content.document.childNodes)) dump(prop + "(" + (typeof prop) + ")\n")
0(string)
1(string)
length(string)
item(string)
Comment on attachment 361106 [details] [diff] [review]
patch for JS Object Viewer

This is actually the wrong fix for two reasons. The underlying bug is that XPConnect is enumerating numeric properties, although ES3 requires strings. Even if numeric properties were expected, we would want to stringise them during enumeration and not once every comparison.
Attachment #361106 - Flags: superreview?(neil) → superreview-
I got this one.
Status: NEW → ASSIGNED
Component: DOM Inspector → XPConnect
Product: Other Applications → Core
QA Contact: dom-inspector → xpconnect
Target Milestone: --- → mozilla1.9.1b3
Attached patch FixSplinter Review
Assignee: nobody → mrbkap
Attachment #361874 - Flags: superreview?(jst)
Attachment #361874 - Flags: review?(jst)
Attachment #361106 - Attachment is obsolete: true
Attachment #361874 - Flags: superreview?(jst)
Attachment #361874 - Flags: superreview+
Attachment #361874 - Flags: review?(jst)
Attachment #361874 - Flags: review+
This doesn't block, but it's a potential compatibility problem. I'll request approval for the 1.9 branch after I get this on trunk.
Flags: wanted1.9.1?
http://hg.mozilla.org/mozilla-central/rev/48f66b2b3c61
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
I wonder what an automated test for this would look like.  The testcase in comment 0 is clearly too big, and requires DOM Inspector to actually test.
Attached patch MochitestSplinter Review
This could be done with an xpcshell "simple" test, but since we already have the test_wrapper.html file, this will do.
Attachment #364280 - Flags: review?(jst)
Attachment #361874 - Flags: approval1.9.1?
Attachment #364280 - Flags: superreview+
Attachment #364280 - Flags: review?(jst)
Attachment #364280 - Flags: review+
Comment on attachment 361874 [details] [diff] [review]
Fix

a191=beltzner, please make sure to also land the test
Attachment #361874 - Flags: approval1.9.1? → approval1.9.1+
verified FIXED on builds:

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2a1pre) Gecko/20090721
Minefield/3.6a1pre ID:20090721044139

and

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.1pre) Gecko/20090720
Shiretoko/3.5.1pre ID:20090720042942
Status: RESOLVED → VERIFIED
mrbkap: I think the Mochitest you landed for this bug (comment 10) is actually not testing the number correctly.

js> var x = {0: 3};
js> var y = "";
js> for (var prop in x) { y += (typeof prop) + "\n"; }
string

js> y
string

In other words, the property names are strings before you pass them into XPCSafeJSObjectWrapper(...).
Alex, your test doesn't work the way you think it does -- for-in string-izes for you. Internally, we keep the properties as their original types and only convert when they become user-visible.
Flags: wanted1.9.1?
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: