Web Inspector: Eliminate typeof "undefined" checks
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 10 Sep 2014 22:41:20 +0000 (22:41 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 10 Sep 2014 22:41:20 +0000 (22:41 +0000)
https://bugs.webkit.org/show_bug.cgi?id=136691

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2014-09-10
Reviewed by Alexey Proskuryakov.

* UserInterface/Base/Main.js:
(WebInspector.linkifyURLAsNode):
(WebInspector.linkifyStringAsFragment):
* UserInterface/Protocol/InspectorBackend.js:
(InspectorBackend.Command.prototype._invokeWithArguments):
* UserInterface/Views/DataGrid.js:
(WebInspector.DataGrid.prototype.get resizeMethod):
* UserInterface/Views/NavigationBar.js:
(WebInspector.NavigationBar.prototype.get minimumWidth):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@173494 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Base/Main.js
Source/WebInspectorUI/UserInterface/Protocol/InspectorBackend.js
Source/WebInspectorUI/UserInterface/Views/DataGrid.js
Source/WebInspectorUI/UserInterface/Views/NavigationBar.js

index e51353e..adaeadc 100644 (file)
@@ -1,5 +1,22 @@
 2014-09-10  Joseph Pecoraro  <pecoraro@apple.com>
 
+        Web Inspector: Eliminate typeof "undefined" checks
+        https://bugs.webkit.org/show_bug.cgi?id=136691
+
+        Reviewed by Alexey Proskuryakov.
+
+        * UserInterface/Base/Main.js:
+        (WebInspector.linkifyURLAsNode):
+        (WebInspector.linkifyStringAsFragment):
+        * UserInterface/Protocol/InspectorBackend.js:
+        (InspectorBackend.Command.prototype._invokeWithArguments):
+        * UserInterface/Views/DataGrid.js:
+        (WebInspector.DataGrid.prototype.get resizeMethod):
+        * UserInterface/Views/NavigationBar.js:
+        (WebInspector.NavigationBar.prototype.get minimumWidth):
+
+2014-09-10  Joseph Pecoraro  <pecoraro@apple.com>
+
         Web Inspector: Fix obscure ESLint warnings and skip directories
         https://bugs.webkit.org/show_bug.cgi?id=136686
 
index 0d2b878..85c5ec7 100644 (file)
@@ -1626,7 +1626,7 @@ WebInspector.linkifyURLAsNode = function(url, linkText, classes, tooltipText)
     a.href = url;
     a.className = classes;
 
-    if (typeof tooltipText === "undefined")
+    if (tooltipText === undefined)
         a.title = url;
     else if (typeof tooltipText !== "string" || tooltipText.length)
         a.title = tooltipText;
@@ -1675,7 +1675,7 @@ WebInspector.linkifyStringAsFragment = function(string)
     function linkifier(title, url, lineNumber)
     {
         var urlNode = WebInspector.linkifyURLAsNode(url, title, undefined);
-        if (typeof(lineNumber) !== "undefined")
+        if (lineNumber !== undefined)
             urlNode.lineNumber = lineNumber;
 
         return urlNode;
index fe4e93e..d16ab43 100644 (file)
@@ -430,7 +430,7 @@ InspectorBackend.Command.prototype = {
             }
 
             var value = commandArguments.shift();
-            if (optionalFlag && typeof value === "undefined")
+            if (optionalFlag && value === undefined)
                 continue;
 
             if (typeof value !== typeName) {
@@ -442,7 +442,7 @@ InspectorBackend.Command.prototype = {
         }
 
         if (commandArguments.length === 1 && !callback) {
-            if (typeof commandArguments[0] !== "undefined") {
+            if (commandArguments[0] !== undefined) {
                 console.error("Protocol Error: Optional callback argument for method '" + instance.qualifiedName + "' call must be a function but its type is '" + typeof args[0] + "'.");
                 return;
             }
index d1d2cdc..af204e5 100644 (file)
@@ -414,7 +414,7 @@ WebInspector.DataGrid.prototype = {
     },
 
     insertColumn: function(columnIdentifier, columnData, insertionIndex) {
-        if (typeof insertionIndex === "undefined")
+        if (insertionIndex === undefined)
             insertionIndex = this.orderedColumns.length;
         insertionIndex = Number.constrain(insertionIndex, 0, this.orderedColumns.length);
 
@@ -1217,7 +1217,7 @@ WebInspector.DataGrid.prototype = {
 
     get resizeMethod()
     {
-        if (typeof this._resizeMethod === "undefined")
+        if (!this._resizeMethod)
             return WebInspector.DataGrid.ResizeMethod.Nearest;
         return this._resizeMethod;
     },
index a21b1a2..6306292 100644 (file)
@@ -233,7 +233,7 @@ WebInspector.NavigationBar.prototype = {
 
     get minimumWidth()
     {
-        if (typeof this._minimumWidth === "undefined" || this._minimumWidthNeedsRecalculation) {
+        if (this._minimumWidth === undefined || this._minimumWidthNeedsRecalculation) {
             this._minimumWidth = this._calculateMinimumWidth();
             delete this._minimumWidthNeedsRecalculation;
         }