Bug 136682 - Web Inspector: Fix ESLint consistent-return warnings
Summary: Web Inspector: Fix ESLint consistent-return warnings
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Joseph Pecoraro
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-09-09 15:10 PDT by Joseph Pecoraro
Modified: 2014-09-10 12:15 PDT (History)
6 users (show)

See Also:


Attachments
[PATCH] Proposed Fix (12.82 KB, patch)
2014-09-09 15:11 PDT, Joseph Pecoraro
no flags Details | Formatted Diff | Diff
[PATCH] Proposed Fix (13.23 KB, patch)
2014-09-09 15:13 PDT, Joseph Pecoraro
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph Pecoraro 2014-09-09 15:10:29 PDT
This warning warns about inconsistent use of "return x" and "return" within a function.

This fixes all but CodeMirrorCompletionController.js warning which have key handlers that either bail or return CodeMirror.Pass.
Comment 1 Joseph Pecoraro 2014-09-09 15:11:46 PDT
Created attachment 237861 [details]
[PATCH] Proposed Fix
Comment 2 Joseph Pecoraro 2014-09-09 15:13:41 PDT
Created attachment 237863 [details]
[PATCH] Proposed Fix

Better fix, includes the change to the eslintrc file.
Comment 3 Timothy Hatcher 2014-09-10 08:16:18 PDT
Comment on attachment 237863 [details]
[PATCH] Proposed Fix

View in context: https://bugs.webkit.org/attachment.cgi?id=237863&action=review

> Source/WebInspectorUI/UserInterface/Controllers/FrameResourceManager.js:-389
>          console.assert(!this._waitingForMainFrameResourceTreePayload);
> -        if (this._waitingForMainFrameResourceTreePayload)
> -            return;

Why isn't the early return needed still? It would be bad to continue here.
Comment 4 Joseph Pecoraro 2014-09-10 11:39:35 PDT
Comment on attachment 237863 [details]
[PATCH] Proposed Fix

View in context: https://bugs.webkit.org/attachment.cgi?id=237863&action=review

>> Source/WebInspectorUI/UserInterface/Controllers/FrameResourceManager.js:-389
>> -            return;
> 
> Why isn't the early return needed still? It would be bad to continue here.

Checking all the callers, this should never be reached if this._waitingForMainFrameResourceTreePayload. So rather then return null which could throw an exception earlier on, I just left the assert.
Comment 5 WebKit Commit Bot 2014-09-10 12:15:43 PDT
Comment on attachment 237863 [details]
[PATCH] Proposed Fix

Clearing flags on attachment: 237863

Committed r173477: <http://trac.webkit.org/changeset/173477>
Comment 6 WebKit Commit Bot 2014-09-10 12:15:47 PDT
All reviewed patches have been landed.  Closing bug.