Web Inspector: Address some ESLint warnings
authorjoepeck@webkit.org <joepeck@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 10 Sep 2018 23:47:05 +0000 (23:47 +0000)
committerjoepeck@webkit.org <joepeck@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 10 Sep 2018 23:47:05 +0000 (23:47 +0000)
https://bugs.webkit.org/show_bug.cgi?id=188824

Reviewed by Matt Baker.

* .eslintrc:
* UserInterface/Base/Platform.js:
* UserInterface/Controllers/AuditManager.js:
* UserInterface/Controllers/BasicBlockAnnotator.js:
* UserInterface/Controllers/CallFrameTreeController.js:
* UserInterface/Controllers/HARBuilder.js:
* UserInterface/Models/AuditReport.js:
* UserInterface/Models/AuditResult.js:
* UserInterface/Models/AuditTestCase.js:
* UserInterface/Models/AuditTestSuite.js:
* UserInterface/Models/Cookie.js:
* UserInterface/Models/SourceCodePosition.js:
* UserInterface/Test/FrontendTestHarness.js:
* UserInterface/Test/TestSuite.js:
* UserInterface/Views/CanvasContentView.js:
* UserInterface/Views/CollectionContentView.js:
* UserInterface/Views/ContentBrowser.js:
* UserInterface/Views/CookieStorageContentView.js:
* UserInterface/Views/DataGrid.js:
* UserInterface/Views/DatabaseTableContentView.js:
* UserInterface/Views/FindBanner.js:
* UserInterface/Views/JSONResourceContentView.js:
* UserInterface/Views/LogContentView.js:
* UserInterface/Views/ResourceSidebarPanel.js:
* UserInterface/Views/SourceCodeTextEditor.js:
* UserInterface/Views/SpreadsheetTextField.js:
* UserInterface/Workers/Formatter/FormatterUtilities.js:

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

28 files changed:
Source/WebInspectorUI/.eslintrc
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Base/Platform.js
Source/WebInspectorUI/UserInterface/Controllers/AuditManager.js
Source/WebInspectorUI/UserInterface/Controllers/BasicBlockAnnotator.js
Source/WebInspectorUI/UserInterface/Controllers/CallFrameTreeController.js
Source/WebInspectorUI/UserInterface/Controllers/HARBuilder.js
Source/WebInspectorUI/UserInterface/Models/AuditReport.js
Source/WebInspectorUI/UserInterface/Models/AuditResult.js
Source/WebInspectorUI/UserInterface/Models/AuditTestCase.js
Source/WebInspectorUI/UserInterface/Models/AuditTestSuite.js
Source/WebInspectorUI/UserInterface/Models/Cookie.js
Source/WebInspectorUI/UserInterface/Models/SourceCodePosition.js
Source/WebInspectorUI/UserInterface/Test/FrontendTestHarness.js
Source/WebInspectorUI/UserInterface/Test/TestSuite.js
Source/WebInspectorUI/UserInterface/Views/CanvasContentView.js
Source/WebInspectorUI/UserInterface/Views/CollectionContentView.js
Source/WebInspectorUI/UserInterface/Views/ContentBrowser.js
Source/WebInspectorUI/UserInterface/Views/CookieStorageContentView.js
Source/WebInspectorUI/UserInterface/Views/DataGrid.js
Source/WebInspectorUI/UserInterface/Views/DatabaseTableContentView.js
Source/WebInspectorUI/UserInterface/Views/FindBanner.js
Source/WebInspectorUI/UserInterface/Views/JSONResourceContentView.js
Source/WebInspectorUI/UserInterface/Views/LogContentView.js
Source/WebInspectorUI/UserInterface/Views/ResourceSidebarPanel.js
Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js
Source/WebInspectorUI/UserInterface/Views/SpreadsheetTextField.js
Source/WebInspectorUI/UserInterface/Workers/Formatter/FormatterUtilities.js

index 21b73f5..5e6df59 100644 (file)
@@ -54,6 +54,7 @@
         "RecordingAgent": true,
         "RuntimeAgent": true,
         "ScriptProfilerAgent": true,
+        "ServiceWorkerAgent": true,
         "TimelineAgent": true,
         "WorkerAgent": true,
 
@@ -98,6 +99,7 @@
         "CSSPrimitiveValue": true,
         "Exception": true,
         "WebKitPoint": true,
+        "SQLError": true,
 
         // Utilities
         "appendWebInspectorConsoleEvaluationSourceURL": true,
         "parseMIMEType": true,
         "resolveDotsInPath": true,
         "simpleGlobStringToRegExp": true,
+        "textToBlob": true,
         "timestamp": true,
         "zeroWidthSpace": true,
 
index 122f754..b2f23f6 100644 (file)
@@ -1,3 +1,38 @@
+2018-09-10  Joseph Pecoraro  <pecoraro@apple.com>
+
+        Web Inspector: Address some ESLint warnings
+        https://bugs.webkit.org/show_bug.cgi?id=188824
+
+        Reviewed by Matt Baker.
+
+        * .eslintrc:
+        * UserInterface/Base/Platform.js:
+        * UserInterface/Controllers/AuditManager.js:
+        * UserInterface/Controllers/BasicBlockAnnotator.js:
+        * UserInterface/Controllers/CallFrameTreeController.js:
+        * UserInterface/Controllers/HARBuilder.js:
+        * UserInterface/Models/AuditReport.js:
+        * UserInterface/Models/AuditResult.js:
+        * UserInterface/Models/AuditTestCase.js:
+        * UserInterface/Models/AuditTestSuite.js:
+        * UserInterface/Models/Cookie.js:
+        * UserInterface/Models/SourceCodePosition.js:
+        * UserInterface/Test/FrontendTestHarness.js:
+        * UserInterface/Test/TestSuite.js:
+        * UserInterface/Views/CanvasContentView.js:
+        * UserInterface/Views/CollectionContentView.js:
+        * UserInterface/Views/ContentBrowser.js:
+        * UserInterface/Views/CookieStorageContentView.js:
+        * UserInterface/Views/DataGrid.js:
+        * UserInterface/Views/DatabaseTableContentView.js:
+        * UserInterface/Views/FindBanner.js:
+        * UserInterface/Views/JSONResourceContentView.js:
+        * UserInterface/Views/LogContentView.js:
+        * UserInterface/Views/ResourceSidebarPanel.js:
+        * UserInterface/Views/SourceCodeTextEditor.js:
+        * UserInterface/Views/SpreadsheetTextField.js:
+        * UserInterface/Workers/Formatter/FormatterUtilities.js:
+
 2018-09-06  Andy Estes  <aestes@apple.com>
 
         [Apple Pay] Rename the -apple-pay-button-type value "checkout" to "check-out"
index c82e012..4f2e1e7 100644 (file)
@@ -49,7 +49,7 @@ WI.Platform = {
         WI.Platform.version.base = 10;
         WI.Platform.version.release = parseInt(osVersionMatch[2]);
         switch (osVersionMatch[2]) {
-        case "12":
+        case "13":
             WI.Platform.version.name = "high-sierra";
             break;
         case "12":
index 52f68a0..5bdc42a 100644 (file)
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
- WI.AuditManager = class AuditManager extends WI.Object
+WI.AuditManager = class AuditManager extends WI.Object
 {
     constructor()
     {
 
         this._testSuiteConstructors = [];
         this._reports = new Map;
-        
+
         // Transforming all the constructors into AuditTestSuite instances.
-        this._testSuites = this._testSuiteConstructors.map(suite =>  {
+        this._testSuites = this._testSuiteConstructors.map(suite => {
             let newTestSuite = new suite;
 
-            if (!newTestSuite instanceof WI.AuditTestSuite)
+            if (!(newTestSuite instanceof WI.AuditTestSuite))
                 throw new Error("Audit test suites must be of instance WI.AuditTestSuite.");
 
             return newTestSuite;
             let auditResult = await this._runTestCase(representedObject);
             auditReport.addResult(auditResult);
         } else if (representedObject instanceof WI.AuditTestSuite) {
-            let testCases = representedObject.testCases;            
+            let testCases = representedObject.testCases;
             // Start reducing from testCases[0].
             let result = testCases.slice(1).reduce((chain, testCase, index) => {
                 if (testCase.setup) {
-                    let setup = testCase.setup.call(testCase, testCase.suite)
+                    let setup = testCase.setup.call(testCase, testCase.suite);
                     if (testCase.setup[Symbol.toStringTag] === "AsyncFunction")
                         return setup;
                     else
@@ -73,7 +73,7 @@
                 });
 
                 if (testCase.tearDown) {
-                    let tearDown = testCase.tearDown.call(testCase, testCase.suite)
+                    let tearDown = testCase.tearDown.call(testCase, testCase.suite);
                     if (testCase.tearDown[Symbol.toStringTag] === "AsyncFunction")
                         return tearDown;
                     else
         this.dispatchEventToListeners(WI.AuditManager.Event.TestEnded, {test: testCase});
         return new WI.AuditResult(testCase, {result}, didRaiseException);
     }
-}
+};
 
 WI.AuditManager.Event = {
     TestStarted: Symbol("test-started"),
     TestEnded: Symbol("test-ended")
-}
+};
index 9ca9a22..2bb0e04 100644 (file)
@@ -63,7 +63,7 @@ WI.BasicBlockAnnotator = class BasicBlockAnnotator extends WI.Annotator
         while (match) {
             lineEndings.push(match.index);
             lineEndingLengths.push(match[0].length);
-            match = pattern.exec(content)
+            match = pattern.exec(content);
         }
 
         function offsetToPosition(offset) {
index 32d3881..4a3f210 100644 (file)
@@ -59,7 +59,7 @@ WI.CallFrameTreeController = class CallFrameTreeController extends WI.Object
         this._treeOutline.removeChildren();
 
         for (let callFrame of this._callFrames)
-            this._treeOutline.appendChild(new WI.CallFrameTreeElement(callFrame))
+            this._treeOutline.appendChild(new WI.CallFrameTreeElement(callFrame));
     }
 
     disconnect()
index af6ea6a..6fbfe49 100644 (file)
@@ -308,4 +308,4 @@ WI.HARBuilder = class HARBuilder
         console.assert(false);
         return undefined;
     }
-}
+};
index 6cb8305..62ad09d 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
- WI.AuditReport = class AuditReport
+WI.AuditReport = class AuditReport
 {
     constructor(representedTest)
     {
         console.assert(representedTest instanceof WI.AuditTestCase || representedTest instanceof WI.AuditTestSuite);
-        
+
         this._results = [];
         this._isWritable = true;
         this._representedTestCases = (representedTest instanceof WI.AuditTestCase) ? [representedTest] : [...representedTest.testCases];
@@ -59,4 +59,4 @@
     {
         this._isWritable = false;
     }
-}
+};
index ee9ba1b..4663a20 100644 (file)
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
- WI.AuditResult = class AuditResult
+WI.AuditResult = class AuditResult
 {
     constructor(testInstance, testResult, failed)
     {
     get name() { return this._testName; }
     get logLevel() { return this._logLevel; }
     get failed() { return this._failed; }
-}
+};
 
 WI.AuditResult.LogLevel = {
     Error: "error",
     Warning: "warning",
     Passed: "passed"
-}
+};
index 4547e24..d73800d 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
- WI.AuditTestCase = class AuditTestCase extends WI.Object
+WI.AuditTestCase = class AuditTestCase extends WI.Object
 {
     constructor(suite, name, test, setup, tearDown, errorDetails = {})
     {
         console.assert(suite instanceof WI.AuditTestSuite);
-        console.assert(typeof(name) === "string");
-        
+        console.assert(typeof name === "string");
+
         if (setup)
             console.assert(setup instanceof Function);
 
@@ -41,7 +41,7 @@
 
         super();
         this._id = Symbol(name);
-        
+
         this._suite = suite;
         this._name = name;
         this._test = test;
@@ -59,4 +59,4 @@
     get setup() { return this._setup; }
     get tearDown() { return this._tearDown; }
     get errorDetails() { return this._errorDetails; }
-}
+};
index f073ef4..52cfead 100644 (file)
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
- WI.AuditTestSuite = class AuditTestSuite extends WI.Object
+WI.AuditTestSuite = class AuditTestSuite extends WI.Object
 {
     constructor(identifier, name)
     {
     _buildTestCasesFromDescriptors()
     {
         for (let descriptor of this.constructor.testCaseDescriptors()) {
-            if (typeof(descriptor.name) !== "string" || !descriptor.name)
+            if (typeof descriptor.name !== "string" || !descriptor.name)
                 throw new Error("Test name must be a valid string.");
-            
+
             let {name, test, setup, tearDown, errorDetails} = descriptor;
 
-            if (!test instanceof Function || test[Symbol.toStringTag] !== "AsyncFunction")
+            if (!(test instanceof Function) || test[Symbol.toStringTag] !== "AsyncFunction")
                 throw new Error("Test function must be an async function.");
 
             let testCaseInstance = new WI.AuditTestCase(this, name, test, setup, tearDown, errorDetails);
@@ -63,8 +63,8 @@
             this._testCases.set(testCaseInstance.id, testCaseInstance);
         }
     }
-}
+};
 
 WI.AuditTestSuite.Event = {
     NewAuditResultAvailable: Symbol("new-audit-result-available")
-}   
+};
index cd2ad4e..4672942 100644 (file)
@@ -214,7 +214,7 @@ WI.Cookie = class Cookie
 
         return new WI.Cookie(WI.Cookie.Type.Response, name, value, header, expires, maxAge, path, domain, secure, httpOnly, sameSite);
     }
-}
+};
 
 WI.Cookie.Type = {
     Request: "request",
index 7e3060f..17a0a9f 100644 (file)
@@ -42,12 +42,6 @@ WI.SourceCodePosition = class SourceCodePosition
         return new WI.SourceCodePosition(this._lineNumber, this._columnNumber + delta);
     }
 
-    offsetColumn(delta)
-    {
-        console.assert(this._columnNumber + delta >= 0);
-        return new WI.SourceCodePosition(this._lineNumber, this._columnNumber + delta);
-    }
-
     equals(position)
     {
         return this._lineNumber === position.lineNumber && this._columnNumber === position.columnNumber;
index 023195f..4fbf9a4 100644 (file)
@@ -94,7 +94,7 @@ FrontendTestHarness = class FrontendTestHarness extends TestHarness
             return (!remoteObjectOnly && remoteObject.hasValue()) ? remoteObject.value : remoteObject;
         }
 
-        let response = RuntimeAgent.evaluate.invoke({expression, objectGroup: "test", includeCommandLineAPI: false})
+        let response = RuntimeAgent.evaluate.invoke({expression, objectGroup: "test", includeCommandLineAPI: false});
         if (callback && typeof callback === "function") {
             response = response.then(({result, wasThrown}) => callback(null, translateResult(result), wasThrown));
             response = response.catch((error) => callback(error, null, false));
index 79ea5cb..3e17fdf 100644 (file)
@@ -182,7 +182,7 @@ SyncTestSuite = class SyncTestSuite extends TestSuite
     addTestCase(testcase)
     {
         if ([testcase.setup, testcase.teardown, testcase.test].some((fn) => fn && fn[Symbol.toStringTag] === "AsyncFunction"))
-            throw new Error("Tried to pass a test case with an async `setup`, `test`, or `teardown` function, but this is a synchronous test suite.")
+            throw new Error("Tried to pass a test case with an async `setup`, `test`, or `teardown` function, but this is a synchronous test suite.");
 
         super.addTestCase(testcase);
     }
index 192267e..cee34bb 100644 (file)
@@ -410,7 +410,7 @@ WI.CanvasContentView = class CanvasContentView extends WI.ContentView
             let formatString = frameCount === 1 ? WI.UIString("%d Frame") : WI.UIString("%d Frames");
             title = formatString.format(frameCount);
         } else
-            title = WI.UIString("Waiting for frames…")
+            title = WI.UIString("Waiting for frames…");
 
         this._progressView.title = title;
         this._progressView.subtitle = bufferUsed ? Number.bytesToString(bufferUsed) : "";
index a971659..110df70 100644 (file)
@@ -275,7 +275,7 @@ WI.CollectionContentView = class CollectionContentView extends WI.ContentView
             if (typeof this._contentPlaceholder === "string")
                 this._contentPlaceholderElement = WI.createMessageTextView(this._contentPlaceholder);
             else if (this._contentPlaceholder instanceof HTMLElement)
-                this._contentPlaceholderElement =  this._contentPlaceholder;
+                this._contentPlaceholderElement = this._contentPlaceholder;
         }
 
         if (!this._contentPlaceholderElement.parentNode)
index 1bfadab..35e7b56 100644 (file)
@@ -230,7 +230,7 @@ WI.ContentBrowser = class ContentBrowser extends WI.View
     shown()
     {
         this._updateContentViewSelectionPathNavigationItem(this.currentContentView);
-        this.updateHierarchicalPathForCurrentContentView()
+        this.updateHierarchicalPathForCurrentContentView();
 
         this._contentViewContainer.shown();
     }
index 6cb92a8..0f6f627 100644 (file)
@@ -73,7 +73,7 @@ WI.CookieStorageContentView = class CookieStorageContentView extends WI.ContentV
     {
         // FIXME <https://webkit.org/b/151400>: If there are no cookies, add placeholder explanatory text.
         if (!this._dataGrid) {
-            var columns = {name: {}, value: {}, domain: {}, path: {}, expires: {}, size: {}, http: {}, secure: {}, sameSite: {} };
+            var columns = {name: {}, value: {}, domain: {}, path: {}, expires: {}, size: {}, http: {}, secure: {}, sameSite: {}};
 
             columns.name.title = WI.UIString("Name");
             columns.name.sortable = true;
index e2530f5..2e6421c 100644 (file)
@@ -1573,7 +1573,6 @@ WI.DataGrid = class DataGrid extends WI.View
         if (!gridNode) {
             if (this.selectedNode)
                 this.selectedNode.deselect();
-            
             return;
         }
 
index 9037f6a..cb2b4c9 100644 (file)
@@ -69,7 +69,7 @@ WI.DatabaseTableContentView = class DatabaseTableContentView extends WI.ContentV
 
     _escapeTableName(name)
     {
-        return name.replace(/\"/g, "\"\"");
+        return name.replace(/"/g, "\"\"");
     }
 
     _queryFinished(columnNames, values)
index b6981cf..dc92c70 100644 (file)
@@ -53,7 +53,7 @@ WI.FindBanner = class FindBanner extends WI.NavigationItem
         this._previousResultButton = document.createElement("button");
         this._previousResultButton.classList.add("segmented", "previous-result");
         this._previousResultButton.disabled = true;
-        this._previousResultButton.title = WI.UIString("Find Previous (%s)").format(WI.findPreviousKeyboardShortcut.displayName);;
+        this._previousResultButton.title = WI.UIString("Find Previous (%s)").format(WI.findPreviousKeyboardShortcut.displayName);
         this._previousResultButton.addEventListener("click", this._previousResultButtonClicked.bind(this));
         this.element.appendChild(this._previousResultButton);
 
@@ -64,7 +64,7 @@ WI.FindBanner = class FindBanner extends WI.NavigationItem
         this._nextResultButton = document.createElement("button");
         this._nextResultButton.classList.add("segmented", "next-result");
         this._nextResultButton.disabled = true;
-        this._nextResultButton.title = WI.UIString("Find Next (%s)").format(WI.findNextKeyboardShortcut.displayName);;
+        this._nextResultButton.title = WI.UIString("Find Next (%s)").format(WI.findNextKeyboardShortcut.displayName);
         this._nextResultButton.addEventListener("click", this._nextResultButtonClicked.bind(this));
         this.element.appendChild(this._nextResultButton);
 
index 1bdd49c..a78845c 100644 (file)
@@ -56,7 +56,7 @@ WI.JSONResourceContentView = class JSONResourceContentView extends WI.ResourceCo
             doNotPauseOnExceptionsAndMuteConsole: true,
             contextId: undefined,
             returnByValue: false,
-            generatePreview: true,    
+            generatePreview: true,
         };
         this.resource.target.RuntimeAgent.evaluate.invoke(options, (error, result, wasThrown) => {
             if (error || wasThrown) {
@@ -80,6 +80,6 @@ WI.JSONResourceContentView = class JSONResourceContentView extends WI.ResourceCo
         if (this._remoteObject) {
             this._remoteObject.release();
             this._remoteObject = null;
-        }   
+        }
     }
 };
index 3c86f9e..3d97875 100644 (file)
@@ -79,7 +79,7 @@ WI.LogContentView = class LogContentView extends WI.ContentView
             new WI.ScopeBarItem(WI.LogContentView.Scopes.Warnings, WI.UIString("Warnings"), false, "warnings"),
             new WI.ScopeBarItem(WI.LogContentView.Scopes.Logs, WI.UIString("Logs"), false, "logs"),
             new WI.ScopeBarItem(WI.LogContentView.Scopes.Infos, WI.UIString("Infos"), false, "infos", true),
-            new WI.ScopeBarItem(WI.LogContentView.Scopes.Debugs, WI.UIString("Debugs"), false, "debugs", true),            
+            new WI.ScopeBarItem(WI.LogContentView.Scopes.Debugs, WI.UIString("Debugs"), false, "debugs", true),
         ];
 
         this._scopeBar = new WI.ScopeBar("log-scope-bar", scopeBarItems, scopeBarItems[0]);
index 5424eef..2f76b6c 100644 (file)
@@ -317,7 +317,7 @@ WI.ResourceSidebarPanel = class ResourceSidebarPanel extends WI.NavigationSideba
                     this._addTargetWithMainResource(script.target);
                 this.contentTreeOutline.disclosureButtons = true;
                 return;
-            }            
+            }
         }
 
         // If the script URL matches a resource we can assume it is part of that resource and does not need added.
index 83d0ff1..12e5de2 100644 (file)
@@ -1432,7 +1432,7 @@ WI.SourceCodeTextEditor = class SourceCodeTextEditor extends WI.TextEditor
             startPosition = fromInlineScriptPosition(startPosition).toCodeMirror();
             endPosition = fromInlineScriptPosition(endPosition).toCodeMirror();
             callback({startPosition, endPosition});
-        }
+        };
 
         script.requestScriptSyntaxTree((syntaxTree) => {
             // Convert to the position within the inline script before querying the AST.
index 16512f6..fa0acdd 100644 (file)
@@ -396,7 +396,7 @@ WI.SpreadsheetTextField = class SpreadsheetTextField
         let selection = window.getSelection();
 
         let isHidden = (clientRect) => {
-            return clientRect.x === 0 && clientRect.y === 0
+            return clientRect.x === 0 && clientRect.y === 0;
         };
 
         if (selection.rangeCount) {
index 8a8946c..4b28128 100644 (file)
@@ -42,7 +42,7 @@ Object.defineProperty(String.prototype, "lineEndings",
         let match = pattern.exec(this);
         while (match) {
             lineEndings.push(match.index);
-            match = pattern.exec(this)
+            match = pattern.exec(this);
         }
 
         lineEndings.push(this.length);