Closed Bug 873912 Opened 11 years ago Closed 11 years ago

JS warning "anonymous function does not always return a value" resource:///modules/devtools/framework/target.js:218

Categories

(DevTools :: Debugger, defect, P3)

defect

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 24

People

(Reporter: dholbert, Assigned: past)

References

Details

Attachments

(1 file)

I noticed this in the output of my debug build today (not sure exactly what triggered it, but that doesn't really matter because the warning is pretty clear on its own): { JS Component Loader: WARNING resource://gre/modules/commonjs/toolkit/loader.js -> resource:///modules/devtools/framework/target.js:218 anonymous function does not always return a value } The code in question is: > 218 get window() { > 219 // Be extra careful here, since this may be called by HS_getHudByWindow > 220 // during shutdown. > 221 if (this._tab && this._tab.linkedBrowser) { > 222 return this._tab.linkedBrowser.contentWindow; > 223 } > 224 }, https://mxr.mozilla.org/mozilla-central/source/browser/devtools/framework/target.js?rev=aeb0f8faf02b#218 ...which, as the warning says, does not always return a value. (It's only got one return statement, which is inside of an "if".) The function used to be an unconditional return (& hence not trigger this warning), but it was changed to its current form here: https://hg.mozilla.org/mozilla-central/rev/ca621a4ceaa1#l4.124 for bug 820524. (back when the file was named Target.jsm -- it's been renamed to target.js since then) CC'ing :past and :jwalker (author and reviewer on that cset), in the hopes that at least one of you might know what the correct fix for this is. :)
(In reply to Daniel Holbert [:dholbert] from comment #0) > CC'ing :past and :jwalker (author and reviewer on that cset), in the hopes > that at least one of you might know what the correct fix for this is. :) er, now CC'ing for real.
Blocks: 820524
Flags: needinfo?(past)
Attached patch Patch v1 (deleted) — Splinter Review
I hate these warnings.
Assignee: nobody → past
Status: NEW → ASSIGNED
Attachment #751585 - Flags: review?(jwalker)
Flags: needinfo?(past)
Attachment #751585 - Flags: review?(jwalker) → review+
Priority: -- → P3
Whiteboard: [fixed-in-fx-team]
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → Firefox 24
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: