Closed Bug 932560 Opened 12 years ago Closed 12 years ago

Sometimes the length property of arrays is displayed as `undefined`

Categories

(DevTools :: Debugger, defect, P3)

defect

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: bbenvie, Unassigned)

Details

Due issues with the array length property for wrappered arrays that I don't fully understand, (bug 827449, maybe others), it is possible for `Object.getOwnPropertyDescriptor(array, "length").value` to be undefined, while `array.length` will have the expected numeric length value. The following code reproduces the issue: > let principal = Components.Constructor('@mozilla.org/systemprincipal;1', 'nsIPrincipal')(); > let sandbox = Cu.Sandbox(principal); > let array = Cu.evalInSandbox("[]", sandbox); > console.log(array.length); // 0 > console.log(Object.getOwnPropertyDescriptor(array, "length").value); // undefined My understanding of the underlying issue is limited, but I've been told the issue is likely to not be fixed soon. In the meantime, it might be worthwhile for the devtools to hack around this problem so that the "length" property of arrays does not sometimes show up as `undefined` when it really isn't. When encounting an array that reports its length to be `undefined`, we would have to get the property directly. Something like `descriptor.value = obj.unsafeDereference().length`.
Priority: -- → P3
This issue comes up rarely enough that we're going to forgo hacking around this and eventually the underlying engine issue will be resolved.
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → WONTFIX
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.