Closed Bug 326874 Opened 19 years ago Closed 19 years ago

"ASSERTION: |First()| called on an empty string" opening Tools menu

Categories

(Core Graveyard :: Widget: Mac, defect)

PowerPC
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: jruderman, Assigned: jaas)

References

Details

(Keywords: assertion)

Attachments

(1 file)

Steps to reproduce: 1. Open the Tools menu in Firefox. Result: ASSERTION: |First()| called on an empty string: 'mLength > 0' If I open the Tools menu again immediately, I don't see the assertion again, but if I reload the page, opening the Tools menu again does trigger the assertion again. This is with a Mac debug build from a few days ago, with no extensions enabled. Stack trace (with XPCOM_DEBUG_BREAK=abort) : #0 0x9004716c in kill () #1 0x90128b98 in abort () #2 0x005f7f1c in PR_Abort () at /Users/admin/trunk/mozilla/nsprpub/pr/src/io/prlog.c:505 #3 0x01343c04 in Abort (aMsg=0xbfffd370 "\a###!!! ASSERTION: |First()| called on an empty string: 'mLength > 0', file ../../../dist/include/string/nsTSubstring.h, line 201") at /Users/admin/trunk/mozilla/xpcom/base/nsDebugImpl.cpp:358 #4 0x01343bc8 in NS_DebugBreak_P (aSeverity=1, aStr=0x8239e24 "|First()| called on an empty string", aExpr=0x8239e48 "mLength > 0", aFile=0x8238a38 "../../../dist/include/string/nsTSubstring.h", aLine=201) at /Users/admin/trunk/mozilla/xpcom/base/nsDebugImpl.cpp:341 #5 0x0825196c in nsCSubstring::First (this=0xbfffd990) at ../../../dist/include/string/nsTSubstring.h:201 #6 0x081e8708 in nsMenuX::AddMenuItem (this=0x22083620, aMenuItem=0x24e1f550) at /Users/admin/trunk/mozilla/widget/src/mac/nsMenuX.cpp:260 #7 0x081e84dc in nsMenuX::AddItem (this=0x22083620, aItem=0x24e1f550) at /Users/admin/trunk/mozilla/widget/src/mac/nsMenuX.cpp:230 #8 0x081eac88 in nsMenuX::LoadMenuItem (this=0x22083620, inParentMenu=0x22083620, inMenuItemContent=0x203f6120) at /Users/admin/trunk/mozilla/widget/src/mac/nsMenuX.cpp:899 #9 0x081e9848 in nsMenuX::MenuConstruct (this=0x22083620, aMenuEvent=@0xbfffe360, aParentWindow=0x0, aDocShell=0x1f966eb0) at /Users/admin/trunk/mozilla/widget/src/mac/nsMenuX.cpp:577 #10 0x081e9458 in nsMenuX::MenuSelected (this=0x22083620, aMenuEvent=@0xbfffe360) at /Users/admin/trunk/mozilla/widget/src/mac/nsMenuX.cpp:508 #11 0x081ea040 in MyMenuEventHandler (myHandler=0xbfffe530, event=0x24e163f0, userData=0x22083620) at /Users/admin/trunk/mozilla/widget/src/mac/nsMenuX.cpp:746 #12 0x9318cff4 in DispatchEventToHandlers () #13 0x9318c74c in SendEventToEventTargetInternal () #14 0x9318c5c8 in SendEventToEventTargetWithOptions () #15 0x93225c8c in SendMenuOpening () #16 0x9322580c in DrawTheMenu () #17 0x93225674 in MenuChanged () #18 0x932252dc in TrackMenuCommon () #19 0x932230bc in MenuSelectCore () #20 0x93222c7c in MenuSelect () #21 0x081de2ec in nsMacMessagePump::DoMouseDown (this=0x2937240, anEvent=@0xbfffeb60) at /Users/admin/trunk/mozilla/widget/src/mac/nsMacMessagePump.cpp:541 #22 0x081ddf28 in nsMacMessagePump::DispatchEvent (this=0x2937240, aRealEvent=1, anEvent=0xbfffeb60) at /Users/admin/trunk/mozilla/widget/src/mac/nsMacMessagePump.cpp:417 #23 0x081ddc64 in nsMacMessagePump::DoMessagePump (this=0x2937240) at /Users/admin/trunk/mozilla/widget/src/mac/nsMacMessagePump.cpp:289 #24 0x081cb038 in nsAppShell::Run (this=0x2931070) at /Users/admin/trunk/mozilla/widget/src/mac/nsAppShell.cpp:106 #25 0x08e0fa08 in nsAppStartup::Run (this=0x2931040) at /Users/admin/trunk/mozilla/toolkit/components/startup/src/nsAppStartup.cpp:161 #26 0x002109b4 in XRE_main (argc=1, argv=0xbffff0fc, aAppData=0x3078) at /Users/admin/trunk/mozilla/toolkit/xre/nsAppRunner.cpp:2331 #27 0x00002c8c in main (argc=1, argv=0xbffff0fc) at /Users/admin/trunk/mozilla/browser/app/nsBrowserApp.cpp:61 The code that (seemingly incorrectly) assumes that a string is not empty is Mac-specific, so I'm putting this bug in "Widget: Mac". I don't know where the empty string is coming from, though -- is there an item in the tools menu that's doing something strangely? Btw, I've seen this with the Go menu too.
I guess LoadMenuItem should not SetShortcutChar if the attribute is empty [1]? Or AddMenuItem could just filter it out [2]?. Does this happen with the other menus that contain items without shortcut keys? Am I even looking at the right code? :) Looks like the cocoa version doesn't do this, so I guess it'd be "fixed" by 326469. [1] http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/widget/src/mac/nsMenuX.cpp&rev=1.61&mark=864-866#858 [2] http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/widget/src/mac/nsMenuX.cpp&rev=1.61&mark=260#241
This would be fixed by moving to Cocoa widgets.
*** Bug 332718 has been marked as a duplicate of this bug. ***
Attached patch fix v1.0Splinter Review
Attachment #220175 - Flags: review?(mark)
Attachment #220175 - Flags: approval-branch-1.8.1+
Attachment #220175 - Flags: review?(mark) → review+
Comment on attachment 220175 [details] [diff] [review] fix v1.0 This doesn't need to go on the 1.8 branch because it was recently caused by bryner in the patch for 323471.
Attachment #220175 - Flags: approval-branch-1.8.1+
landed on trunk
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: