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

RESOLVED FIXED in Firefox 21

Status

()

Firefox
Address Bar
RESOLVED FIXED
6 years ago
5 years ago

People

(Reporter: dholbert, Assigned: florian)

Tracking

Trunk
Firefox 21
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

(URL)

Attachments

(1 attachment)

(Reporter)

Description

6 years ago
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"?
(Assignee)

Comment 1

5 years ago
Created attachment 711350 [details] [diff] [review]
Patch

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)

Updated

5 years ago
Attachment #711350 - Flags: review?(enndeakin) → review+
https://hg.mozilla.org/mozilla-central/rev/821c4263e71c
Assignee: nobody → florian
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 21
You need to log in before you can comment on or make changes to this bug.