Closed Bug 420424 Opened 16 years ago Closed 15 years ago

"ASSERTION: Ensure row is visible called with a negative number!" with listbox.ensureElementIsVisible(null)

Categories

(Core :: XUL, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: jruderman, Unassigned)

Details

(Keywords: assertion, testcase)

Attachments

(2 files)

Attached file testcase
###!!! ASSERTION: Ensure row is visible called with a negative number!: 'aRowIndex >= 0', file /Users/jruderman/trunk/mozilla/layout/xul/base/src/nsListBoxBodyFrame.cpp, line 550


The stack makes me suspicious that NS_InvokeByIndex_P isn't doing the right thing.  Why does only EnsureIndexIsVisible appear on the stack instead of EnsureElementIsVisible?

#2  0x0139373f in Break (aMsg=0xbfffb7dc "###!!! ASSERTION: Ensure row is visible called with a negative number!: 'aRowIndex >= 0', file /Users/jruderman/trunk/mozilla/layout/xul/base/src/nsListBoxBodyFrame.cpp, line 550") at /Users/jruderman/trunk/mozilla/xpcom/base/nsDebugImpl.cpp:474
#3  0x01393a64 in NS_DebugBreak_P (aSeverity=1, aStr=0x1856f488 "Ensure row is visible called with a negative number!", aExpr=0x1856f478 "aRowIndex >= 0", aFile=0x1856f2bc "/Users/jruderman/trunk/mozilla/layout/xul/base/src/nsListBoxBodyFrame.cpp", aLine=550) at /Users/jruderman/trunk/mozilla/xpcom/base/nsDebugImpl.cpp:358
#4  0x180b6a34 in nsListBoxBodyFrame::EnsureIndexIsVisible (this=0x24e6978, aRowIndex=-1) at /Users/jruderman/trunk/mozilla/layout/xul/base/src/nsListBoxBodyFrame.cpp:550
#5  0x18098cb8 in nsListBoxObject::EnsureIndexIsVisible (this=0x3d64f1c0, aRowIndex=-1) at /Users/jruderman/trunk/mozilla/layout/xul/base/src/nsListBoxObject.cpp:119
#6  0x0139aeea in NS_InvokeByIndex_P (that=0x3d64f1c0, methodIndex=7, paramCount=1, params=0xbfffbea4) at /Users/jruderman/trunk/mozilla/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_unixish_x86.cpp:179
#7  0x02a44f63 in XPCWrappedNative::CallMethod (ccx=@0xbfffc0ec, mode=CALL_METHOD) at /Users/jruderman/trunk/mozilla/js/src/xpconnect/src/xpcwrappednative.cpp:2369
#8  0x02a4caa8 in XPC_WN_CallMethod (cx=0x3c799230, obj=0x3bd9f360, argc=1, argv=0x24f0d6c, vp=0xbfffc220) at /Users/jruderman/trunk/mozilla/js/src/xpconnect/src/xpcwrappednativejsops.cpp:1470
#9  0x010660ab in js_Invoke (cx=0x3c799230, argc=1, vp=0x24f0d64, flags=0) at /Users/jruderman/trunk/mozilla/js/src/jsinterp.c:1419
(In reply to comment #0)
>Why does only EnsureIndexIsVisible appear on the stack instead of  EnsureElementIsVisible?
Reading the exception in the error console would have been a dead giveaway:

Error: uncaught exception: [Exception... "Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIListBoxObject.ensureIndexIsVisible]"  nsresult: "0x80070057 (NS_ERROR_ILLEGAL_VALUE)"  location: "JS frame :: chrome://global/content/bindings/listbox.xml :: ensureIndexIsVisible :: line 778"  data: no]

      <method name="ensureIndexIsVisible">
        <parameter name="index"/>
        <body>
          return this.listBoxObject.ensureIndexIsVisible(index);
        </body>
      </method>

      <method name="ensureElementIsVisible">
        <parameter name="element"/>
        <body>
          return this.ensureIndexIsVisible(this.listBoxObject.getIndexOfItem(element));
        </body>
      </method>

The assertion is bogus, as a -1 index is not an unexpected error.
Component: XP Toolkit/Widgets: XUL → XUL
QA Contact: xptoolkit.xul → xptoolkit.widgets
Attachment #396626 - Flags: review?(bzbarsky)
Attachment #396626 - Flags: review?(bzbarsky) → review+
Patch checked in: http://hg.mozilla.org/mozilla-central/rev/13ede33fb54b
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Crashtest: http://hg.mozilla.org/mozilla-central/rev/f4622261cce8
Flags: in-testsuite+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: