Title: [173477] trunk/Source/WebInspectorUI
Revision
173477
Author
[email protected]
Date
2014-09-10 12:15:28 -0700 (Wed, 10 Sep 2014)

Log Message

Web Inspector: Fix ESLint consistent-return warnings
https://bugs.webkit.org/show_bug.cgi?id=136682

Patch by Joseph Pecoraro <[email protected]> on 2014-09-10
Reviewed by Timothy Hatcher.

* .eslintrc:
* UserInterface/Controllers/BranchManager.js:
(WebInspector.BranchManager.prototype.createBranch):
* UserInterface/Controllers/FrameResourceManager.js:
(WebInspector.FrameResourceManager.prototype._addNewResourceToFrame):
* UserInterface/Models/DOMNodeStyles.js:
(WebInspector.DOMNodeStyles.prototype._parseStyleDeclarationPayload):
* UserInterface/Views/BoxModelDetailsSectionRow.js:
(WebInspector.BoxModelDetailsSectionRow.prototype._applyUserInput):
* UserInterface/Views/DOMTreeElement.js:
(WebInspector.DOMTreeElement.prototype.showChild):
(WebInspector.DOMTreeElement.prototype._startEditingTarget):
(WebInspector.DOMTreeElement.prototype._startEditing):
* UserInterface/Views/EditingSupport.js:
* UserInterface/Views/EventListenerSectionGroup.js:
(WebInspector.EventListenerSectionGroup.prototype._nodeTextOrLink):
* UserInterface/Views/FrameContentView.js:
(WebInspector.FrameContentView.prototype._showContentViewForIdentifier):
* UserInterface/Views/NavigationBar.js:
(WebInspector.NavigationBar.prototype.insertNavigationItem):
(WebInspector.NavigationBar.prototype.removeNavigationItem):
* UserInterface/Views/QuickConsole.js:
(WebInspector.QuickConsole.prototype._insertExecutionContextPathComponentForFrame):
* UserInterface/Views/Sidebar.js:
(WebInspector.Sidebar.prototype.addSidebarPanel):
(WebInspector.Sidebar.prototype.removeSidebarPanel):
* UserInterface/Views/TextEditor.js:
(WebInspector.TextEditor.prototype.addStyleClassToLine):
(WebInspector.TextEditor.prototype.removeStyleClassFromLine):
(WebInspector.TextEditor.prototype.toggleStyleClassForLine):

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/.eslintrc (173476 => 173477)


--- trunk/Source/WebInspectorUI/.eslintrc	2014-09-10 18:58:05 UTC (rev 173476)
+++ trunk/Source/WebInspectorUI/.eslintrc	2014-09-10 19:15:28 UTC (rev 173477)
@@ -58,6 +58,7 @@
     "rules": {
         "eqeqeq": 2,
         "curly": 0,
+        "consistent-return": 2,
         "no-extra-semi": 2,
         "quotes": [2, "double"],
         "no-trailing-spaces": 2,

Modified: trunk/Source/WebInspectorUI/ChangeLog (173476 => 173477)


--- trunk/Source/WebInspectorUI/ChangeLog	2014-09-10 18:58:05 UTC (rev 173476)
+++ trunk/Source/WebInspectorUI/ChangeLog	2014-09-10 19:15:28 UTC (rev 173477)
@@ -1,5 +1,43 @@
 2014-09-10  Joseph Pecoraro  <[email protected]>
 
+        Web Inspector: Fix ESLint consistent-return warnings
+        https://bugs.webkit.org/show_bug.cgi?id=136682
+
+        Reviewed by Timothy Hatcher.
+
+        * .eslintrc:
+        * UserInterface/Controllers/BranchManager.js:
+        (WebInspector.BranchManager.prototype.createBranch):
+        * UserInterface/Controllers/FrameResourceManager.js:
+        (WebInspector.FrameResourceManager.prototype._addNewResourceToFrame):
+        * UserInterface/Models/DOMNodeStyles.js:
+        (WebInspector.DOMNodeStyles.prototype._parseStyleDeclarationPayload):
+        * UserInterface/Views/BoxModelDetailsSectionRow.js:
+        (WebInspector.BoxModelDetailsSectionRow.prototype._applyUserInput):
+        * UserInterface/Views/DOMTreeElement.js:
+        (WebInspector.DOMTreeElement.prototype.showChild):
+        (WebInspector.DOMTreeElement.prototype._startEditingTarget):
+        (WebInspector.DOMTreeElement.prototype._startEditing):
+        * UserInterface/Views/EditingSupport.js:
+        * UserInterface/Views/EventListenerSectionGroup.js:
+        (WebInspector.EventListenerSectionGroup.prototype._nodeTextOrLink):
+        * UserInterface/Views/FrameContentView.js:
+        (WebInspector.FrameContentView.prototype._showContentViewForIdentifier):
+        * UserInterface/Views/NavigationBar.js:
+        (WebInspector.NavigationBar.prototype.insertNavigationItem):
+        (WebInspector.NavigationBar.prototype.removeNavigationItem):
+        * UserInterface/Views/QuickConsole.js:
+        (WebInspector.QuickConsole.prototype._insertExecutionContextPathComponentForFrame):
+        * UserInterface/Views/Sidebar.js:
+        (WebInspector.Sidebar.prototype.addSidebarPanel):
+        (WebInspector.Sidebar.prototype.removeSidebarPanel):
+        * UserInterface/Views/TextEditor.js:
+        (WebInspector.TextEditor.prototype.addStyleClassToLine):
+        (WebInspector.TextEditor.prototype.removeStyleClassFromLine):
+        (WebInspector.TextEditor.prototype.toggleStyleClassForLine):
+
+2014-09-10  Joseph Pecoraro  <[email protected]>
+
         Web Inspector: Fix ESLint no-undef warnings
         https://bugs.webkit.org/show_bug.cgi?id=136660
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/BranchManager.js (173476 => 173477)


--- trunk/Source/WebInspectorUI/UserInterface/Controllers/BranchManager.js	2014-09-10 18:58:05 UTC (rev 173476)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/BranchManager.js	2014-09-10 19:15:28 UTC (rev 173477)
@@ -74,7 +74,7 @@
 
         console.assert(fromBranch instanceof WebInspector.Branch);
         if (!(fromBranch instanceof WebInspector.Branch))
-            return;
+            return null;
 
         var newBranch = fromBranch.fork(displayName);
         this._branches.push(newBranch);

Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/FrameResourceManager.js (173476 => 173477)


--- trunk/Source/WebInspectorUI/UserInterface/Controllers/FrameResourceManager.js	2014-09-10 18:58:05 UTC (rev 173476)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/FrameResourceManager.js	2014-09-10 19:15:28 UTC (rev 173477)
@@ -385,8 +385,6 @@
     _addNewResourceToFrame: function(requestIdentifier, frameIdentifier, loaderIdentifier, url, type, requestMethod, requestHeaders, requestData, timestamp, frameName, frameSecurityOrigin, initiatorSourceCodeLocation)
     {
         console.assert(!this._waitingForMainFrameResourceTreePayload);
-        if (this._waitingForMainFrameResourceTreePayload)
-            return;
 
         var resource = null;
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js (173476 => 173477)


--- trunk/Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js	2014-09-10 18:58:05 UTC (rev 173476)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js	2014-09-10 19:15:28 UTC (rev 173477)
@@ -665,7 +665,7 @@
                     this._parseStyleDeclarationPayload(payload, styleDeclaration.node, styleDeclaration.inherited, styleDeclaration.type, styleDeclaration.ownerRule);
                 }
 
-                return;
+                return null;
             }
 
             if (!styleDeclaration) {

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/BoxModelDetailsSectionRow.js (173476 => 173477)


--- trunk/Source/WebInspectorUI/UserInterface/Views/BoxModelDetailsSectionRow.js	2014-09-10 18:58:05 UTC (rev 173476)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/BoxModelDetailsSectionRow.js	2014-09-10 19:15:28 UTC (rev 173477)
@@ -378,8 +378,11 @@
 
     _applyUserInput: function(element, userInput, previousContent, context, commitEditor)
     {
-        if (commitEditor && userInput === previousContent)
-            return this._editingCancelled(element, context); // nothing changed, so cancel
+        if (commitEditor && userInput === previousContent) {
+            // Nothing changed, so cancel.
+            this._editingCancelled(element, context);
+            return;
+        }
 
         if (context.box !== "position" && (!userInput || userInput === "\u2012"))
             userInput = "0px";

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js (173476 => 173477)


--- trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js	2014-09-10 18:58:05 UTC (rev 173476)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js	2014-09-10 19:15:28 UTC (rev 173477)
@@ -167,8 +167,9 @@
 
     showChild: function(index)
     {
+        console.assert(!this._elementCloseTag);
         if (this._elementCloseTag)
-            return;
+            return false;
 
         if (index >= this.expandedChildrenLimit) {
             this._expandedChildrenLimit = index + 1;
@@ -537,7 +538,7 @@
     _startEditingTarget: function(eventTarget)
     {
         if (this.treeOutline.selectedDOMNode() !== this.representedObject)
-            return;
+            return false;
 
         if (this.representedObject.nodeType() !== Node.ELEMENT_NODE && this.representedObject.nodeType() !== Node.TEXT_NODE)
             return false;
@@ -613,7 +614,7 @@
     _startEditing: function()
     {
         if (this.treeOutline.selectedDOMNode() !== this.representedObject)
-            return;
+            return false;
 
         var listItem = this._listItemNode;
 
@@ -629,7 +630,7 @@
             var textNode = listItem.getElementsByClassName("html-text-node")[0];
             if (textNode)
                 return this._startEditingTextNode(textNode);
-            return;
+            return false;
         }
     },
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/EditingSupport.js (173476 => 173477)


--- trunk/Source/WebInspectorUI/UserInterface/Views/EditingSupport.js	2014-09-10 18:58:05 UTC (rev 173476)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/EditingSupport.js	2014-09-10 19:15:28 UTC (rev 173477)
@@ -105,7 +105,7 @@
 WebInspector.startEditing = function(element, config)
 {
     if (!WebInspector.markBeingEdited(element, true))
-        return;
+        return null;
 
     config = config || new WebInspector.EditingConfig(function() {}, function() {});
     var committedCallback = config.commitHandler;

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/EventListenerSectionGroup.js (173476 => 173477)


--- trunk/Source/WebInspectorUI/UserInterface/Views/EventListenerSectionGroup.js	2014-09-10 18:58:05 UTC (rev 173476)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/EventListenerSectionGroup.js	2014-09-10 19:15:28 UTC (rev 173477)
@@ -42,8 +42,9 @@
     _nodeTextOrLink: function()
     {
         var node = this._eventListener.node;
+        console.assert(node);
         if (!node)
-            return;
+            return "";
 
         if (node.nodeType() === Node.DOCUMENT_NODE)
             return "document";

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/FrameContentView.js (173476 => 173477)


--- trunk/Source/WebInspectorUI/UserInterface/Views/FrameContentView.js	2014-09-10 18:58:05 UTC (rev 173476)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/FrameContentView.js	2014-09-10 19:15:28 UTC (rev 173477)
@@ -179,7 +179,7 @@
 
         console.assert(representedObjectToShow);
         if (!representedObjectToShow)
-            return;
+            return null;
 
         this._currentContentViewSetting.value = identifier;
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/NavigationBar.js (173476 => 173477)


--- trunk/Source/WebInspectorUI/UserInterface/Views/NavigationBar.js	2014-09-10 18:58:05 UTC (rev 173476)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/NavigationBar.js	2014-09-10 19:15:28 UTC (rev 173477)
@@ -77,7 +77,7 @@
     {
         console.assert(navigationItem instanceof WebInspector.NavigationItem);
         if (!(navigationItem instanceof WebInspector.NavigationItem))
-            return;
+            return null;
 
         if (navigationItem.parentNavigationBar)
             navigationItem.parentNavigationBar.removeNavigationItem(navigationItem);
@@ -111,7 +111,7 @@
     {
         var navigationItem = this._findNavigationItem(navigationItemOrIdentifierOrIndex);
         if (!navigationItem)
-            return;
+            return null;
 
         navigationItem._parentNavigationBar = null;
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/QuickConsole.js (173476 => 173477)


--- trunk/Source/WebInspectorUI/UserInterface/Views/QuickConsole.js	2014-09-10 18:58:05 UTC (rev 173476)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/QuickConsole.js	2014-09-10 19:15:28 UTC (rev 173477)
@@ -246,12 +246,13 @@
 
     _insertExecutionContextPathComponentForFrame: function(frame, skipRebuild)
     {
+        console.assert(!frame.isMainFrame());
         if (frame.isMainFrame())
-            return;
+            return null;
 
         console.assert(!this._frameIdentifierToExecutionContextPathComponentMap[frame.id]);
         if (this._frameIdentifierToExecutionContextPathComponentMap[frame.id])
-            return;
+            return null;
 
         var executionContextPathComponent = this._createExecutionContextPathComponentFromFrame(frame);
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/Sidebar.js (173476 => 173477)


--- trunk/Source/WebInspectorUI/UserInterface/Views/Sidebar.js	2014-09-10 18:58:05 UTC (rev 173476)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/Sidebar.js	2014-09-10 19:15:28 UTC (rev 173477)
@@ -78,11 +78,11 @@
     {
         console.assert(sidebarPanel instanceof WebInspector.SidebarPanel);
         if (!(sidebarPanel instanceof WebInspector.SidebarPanel))
-            return;
+            return null;
 
         console.assert(!sidebarPanel.parentSidebar);
         if (sidebarPanel.parentSidebar)
-            return;
+            return null;
 
         sidebarPanel._parentSidebar = this;
 
@@ -98,7 +98,7 @@
     {
         var sidebarPanel = this.findSidebarPanel(sidebarPanelOrIdentifierOrIndex);
         if (!sidebarPanel)
-            return;
+            return null;
 
         sidebarPanel.willRemove();
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TextEditor.js (173476 => 173477)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TextEditor.js	2014-09-10 18:58:05 UTC (rev 173476)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TextEditor.js	2014-09-10 19:15:28 UTC (rev 173477)
@@ -563,7 +563,7 @@
         var lineHandle = this._codeMirror.getLineHandle(lineNumber);
         console.assert(lineHandle);
         if (!lineHandle)
-            return;
+            return null;
 
         return this._codeMirror.addLineClass(lineHandle, "wrap", styleClassName);
     },
@@ -573,7 +573,7 @@
         var lineHandle = this._codeMirror.getLineHandle(lineNumber);
         console.assert(lineHandle);
         if (!lineHandle)
-            return;
+            return null;
 
         return this._codeMirror.removeLineClass(lineHandle, "wrap", styleClassName);
     },
@@ -583,7 +583,7 @@
         var lineHandle = this._codeMirror.getLineHandle(lineNumber);
         console.assert(lineHandle);
         if (!lineHandle)
-            return;
+            return false;
 
         return this._codeMirror.toggleLineClass(lineHandle, "wrap", styleClassName);
     },
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to