Closed Bug 148010 Opened 22 years ago Closed 22 years ago

JS exceptions in mailnews autocomplete widget on trunk

Categories

(SeaMonkey :: Autocomplete, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: dmosedale, Assigned: yuanyi21)

References

Details

Attachments

(1 file, 1 obsolete file)

This seems to have been caused by the fix to bug 133365; backing out that patch causes the exceptions to go away. Seth has suggested adding "disableKeyNavigation" to the addressingWidgetOverlay, which sounds reasonable. But is this actually something that should be disabled on _all_ widgets of type autocomplete -- ie should we instead make an analogous fix in autocomplete.xml?
FWIW, the exceptions are happening around line 684 in listbox.xml. I added a dump statement and it shows the following: i= 0; start= 1; c= -1 i= 1; start= 1; c= -1 i= 2; start= 1; c= -1 i= 3; start= 1; c= -1 i= 0; start= 0; c= -1 before throwing the exception.
JavaScript error: line 0: uncaught exception: [Exception... "Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIListBoxObject.getItemAtIndex]" nsresult: "0x80070057 (NS_ERROR_ILLEGAL_VALUE)" location: "JS frame :: chrome://global/content/bindings/listbox.xml#listbox.getItemAtIndex() :: getItemAtIndex :: line 1" data: no] is the exception in question. I see multiple of these just by typing in the addressing widget, both linux and windows.
can reproduce, taking...
Assignee: hewitt → kyle.yuan
1) Check (i + start + c) >= 0 is always true to prevent JS exception 2) Prevent navigation when <ctrl>/<alt>/<shift>/<meta> was pressed 3) Disable key-navigation feature in autocomplete listbox. There are about 30 xul files that use <listbox>, I think only the autocomplete widget need to disable this feature. 4) Fix the same potential error (JS exception) in tree.xml
call Jan to review my patch
Status: NEW → ASSIGNED
Alernatively, could you not check that k > 0 after var k = (i + start + c) % rowCount; ? As for the question in comment 0, I think we should disable this for all auto-complete widgets and not this specific one. I can't think of why you'd want both auto-complete and keyboard navigation enabled.
I can guarantee (i + start + c) >= 0 before entering the loop. Checking (k > 0) in loop will consume more time. Yes, we should disable this for all the autocomplete widgets. Dean, can you figure them out?
Yeah, I realized that as soon as I had pressed commit. Can I figure out autocompletes? No. But maybe you can set the attribute in the constructor. Just a stab in the dark. http://lxr.mozilla.org/seamonkey/source/xpfe/components/autocomplete/resources/content/autocomplete.xml#41
Yeah! Pretty good idea. I'll do that soon.
turned on disableKeyNavigation in autocomplete.xml rather than in addressingWidgetOverlay.xul.
Attachment #85546 - Attachment is obsolete: true
Comment on attachment 85549 [details] [diff] [review] revised (follow Dean's suggestion) r=varga
Attachment #85549 - Flags: review+
Comment on attachment 85549 [details] [diff] [review] revised (follow Dean's suggestion) sr=hewitt
Attachment #85549 - Flags: superreview+
checked in!
Status: ASSIGNED → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Product: Core → Mozilla Application Suite
Depends on: 339313
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: