Closed Bug 758288 Opened 13 years ago Closed 12 years ago

"Warning: function onKeyPress does not always return a value" for autocomplete.xml

Categories

(Firefox :: Address Bar, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
Firefox 21

People

(Reporter: dholbert, Assigned: florian)

References

()

Details

Attachments

(1 file)

Just noticed an 2 warning messages (for one underlying issue) in my error console that looked worth filing. The errors are: { > Timestamp: 05/24/2012 10:29:26 AM > Warning: function onKeyPress does not always return a value > Source File: chrome://global/content/bindings/autocomplete.xml > Line: 439, Column: 12 > Source Code: > return false; } ...and... { > Timestamp: 05/24/2012 10:29:26 AM > Warning: function onKeyPress does not always return a value > Source File: chrome://global/content/bindings/autocomplete.xml > Line: 503, Column: 10 > Source Code: > return true; } It looks like "onKeyPress" has both a naked "return;" statement as well as "return false" / "return true", which is why we're warning. e.g: line 439 vs 443 here, from MXR: > 433 <!-- ::::::::::::: key handling ::::::::::::: --> > 434 > 435 <method name="onKeyPress"> > 436 <parameter name="aEvent"/> > 437 <body><![CDATA[ > 438 if (aEvent.target.localName != "textbox") > 439 return; // Let child buttons of autocomplete take input > 440 > 441 //XXXpch this is so bogus... > 442 if (aEvent.defaultPrevented) > 443 return false; https://mxr.mozilla.org/mozilla-central/source/toolkit/content/widgets/autocomplete.xml#433 I'm setting this as blocking bug 407359, which added the naked "return" statement. I don't know this code at all, but I'm guessing we want "return false" instead of "return"?
Attached patch PatchSplinter Review
This warning also annoys me, and I don't know this code either. The patch I'm attaching follows the suggestion in comment 0, and I hope Neil will confirm if it's the right thing to do :).
Attachment #711350 - Flags: review?(enndeakin)
Attachment #711350 - Flags: review?(enndeakin) → review+
Assignee: nobody → florian
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 21
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: