Changeset 182142 in webkit
- Timestamp:
- Mar 30, 2015 9:29:18 AM (9 years ago)
- Location:
- trunk/Source/WebInspectorUI
- Files:
-
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebInspectorUI/.eslintrc
r181987 r182142 41 41 "DebuggerAgent": true, 42 42 "Formatter": true, 43 "FormatterContentBuilder": true, 43 44 "IndexedDBAgent": true, 44 45 "InspectorAgent": true, … … 54 55 "TimelineAgent": true, 55 56 "WebInspector": true, 57 "WebKitPoint": true, 56 58 "WorkerAgent": true, 57 59 "console": true, 60 // utilities 61 "clamp": true, 62 "isEnterKey": true, 63 "isEmptyObject": true, 64 "insertionIndexForObjectInListSortedByFunction": true, 65 "isFunctionStringNativeCode": true, 66 "parseMIMEType": true, 67 "doubleQuotedString": true, 68 // image utilities 69 "platformImagePath": true, 70 "wrappedSVGDocument": true, 71 // url utilities 72 "absoluteURL": true, 73 "parseQueryString": true, 74 "parseURL": true, 75 "parseSecurityOrigin": true, 76 "removeURLFragment": true, 77 // externals 78 "esprima": true, 58 79 }, 59 80 "rules": { 60 81 "consistent-return": 2, 61 82 "curly": 0, 83 "comma-dangle": 0, 84 "dot-notation": 0, 62 85 "eqeqeq": 2, 86 "new-cap": 0, 63 87 "new-parens": 0, 64 "no-comma-dangle": 0,65 88 "no-console": 0, 66 89 "no-constant-condition": 0, 67 90 "no-extra-bind": 2, 68 91 "no-extra-semi": 2, 92 "no-inner-declarations": 0, 93 "no-new": 0, 69 94 "no-proto": 0, 95 "no-redeclare": 0, 70 96 "no-return-assign": 2, 97 "no-shadow": 0, 71 98 "no-trailing-spaces": 2, 72 99 "no-undef": 2, 100 "no-unused-vars": [2, {"vars": "all", "args": "none"}], 73 101 "no-underscore-dangle": 0, 74 102 "no-unused-expressions": 2, 103 "no-use-before-define": 0, 75 104 "no-wrap-func": 2, 76 105 "quotes": [2, "double"], -
trunk/Source/WebInspectorUI/ChangeLog
r182114 r182142 1 2015-03-30 Tobias Reiss <tobi+webkit@basecode.de> 2 3 Web Inspector: Add more ESLint rules that reflect the current state of the code base 4 https://bugs.webkit.org/show_bug.cgi?id=143212 5 6 Reviewed by Timothy Hatcher. 7 8 * .eslintrc: 9 Define some utilities as globals. 10 Replace "no-comma-dangle" with "comma-dangle". "no-comma-dangle" is deprecated and does not trigger in ESLint v.0.17.1 11 Set "new-cap" to 0 due to the usage of "WebInspector.UIString". 12 Disable "no-redeclare" for now and enable it back as soon as block scoped `let` is used. 13 Disable "dot-notation", "no-shadow" and "no-use-before-define" due to a lot of hits. 14 Disable "no-inner-declarations" as this is a common pattern to save memory. 15 * UserInterface/Views/ObjectTreePropertyTreeElement.js: 16 * UserInterface/Models/SourceCodeLocation.js: 17 It's not necessary to initialize x to undefined. 18 * UserInterface/Views/CSSStyleDeclarationTextEditor.js: 19 * UserInterface/Views/LayerTreeDetailsSidebarPanel.js: 20 * UserInterface/Views/TextEditor.js: 21 * UserInterface/Views/ScopeChainDetailsSidebarPanel.js: 22 Remove unused variable x. 23 * UserInterface/Views/ObjectTreeMapEntryTreeElement.js: 24 * UserInterface/Models/PropertyPath.js: 25 * UserInterface/Views/RadioButtonNavigationItem.js: 26 * UserInterface/Views/ReplayDashboardView.js: 27 * UserInterface/Models/ScriptSyntaxTree.js: 28 * UserInterface/Views/SourceCodeTextEditor.js: 29 * UserInterface/Views/SourceCodeTreeElement.js: 30 Remove trailing and unexpected whitespace. 31 * UserInterface/Views/ProbeSetDataGrid.js: 32 * UserInterface/Views/TimelineRuler.js: 33 Add missing semicolon. 34 * UserInterface/Views/TimelineDataGrid.js: 35 * UserInterface/Views/TimelineRecordFrame.js: 36 Add missing var statement. 37 * UserInterface/Views/TypeTokenView.js: 38 Remove unnecessary `bind`. 39 1 40 2015-03-28 Saam Barati <saambarati1@gmail.com> 2 41 -
trunk/Source/WebInspectorUI/UserInterface/Models/PropertyPath.js
r181769 r182142 102 102 for (var p = this; p && p.pathComponent; p = p.parent) 103 103 components.push(p.pathComponent); 104 components.reverse() 104 components.reverse(); 105 105 return components.join(""); 106 106 } … … 127 127 128 128 components.reverse(); 129 return components.join(""); 129 return components.join(""); 130 130 } 131 131 … … 215 215 if (keyObject.type === "string") { 216 216 var component = ".get(" + doubleQuotedString(keyObject.description) + ")"; 217 return new WebInspector.PropertyPath(object, component, this); 217 return new WebInspector.PropertyPath(object, component, this); 218 218 } 219 219 220 220 var component = ".get(" + keyObject.description + ")"; 221 return new WebInspector.PropertyPath(object, component, this); 221 return new WebInspector.PropertyPath(object, component, this); 222 222 } 223 223 224 224 var component = WebInspector.PropertyPath.SpecialPathComponent.MapValue; 225 225 return new WebInspector.PropertyPath(object, component, this); … … 231 231 return new WebInspector.PropertyPath(object, component, this); 232 232 } 233 233 234 234 appendPropertyDescriptor(object, descriptor, type) 235 235 { … … 249 249 return this.appendArrayIndex(object, descriptor.name); 250 250 251 return this.appendPropertyName(object, descriptor.name) 251 return this.appendPropertyName(object, descriptor.name); 252 252 } 253 253 -
trunk/Source/WebInspectorUI/UserInterface/Models/ScriptSyntaxTree.js
r182106 r182142 46 46 47 47 // Public 48 48 49 49 get parsedSuccessfully() 50 50 { … … 61 61 } 62 62 63 filter(predicate, startNode) 63 filter(predicate, startNode) 64 64 { 65 65 console.assert(startNode && this._parsedSuccessfully); … … 73 73 nodes.push(node); 74 74 else 75 state.skipChildNodes = true; 75 state.skipChildNodes = true; 76 76 } 77 77 … … 86 86 if (!this._parsedSuccessfully) 87 87 return []; 88 88 89 89 var allNodes = []; 90 90 var start = 0; … … 128 128 function removeFunctionsFilter(node) 129 129 { 130 return node.type !== WebInspector.ScriptSyntaxTree.NodeType.FunctionExpression 130 return node.type !== WebInspector.ScriptSyntaxTree.NodeType.FunctionExpression 131 131 && node.type !== WebInspector.ScriptSyntaxTree.NodeType.FunctionDeclaration; 132 132 } … … 141 141 } 142 142 } 143 143 144 144 startNode.attachments._hasNonEmptyReturnStatement = hasNonEmptyReturnStatement; 145 145 … … 222 222 _gatherIdentifiersInDeclaration(node) 223 223 { 224 function gatherIdentifiers(node) 224 function gatherIdentifiers(node) 225 225 { 226 226 switch (node.type) { … … 254 254 } 255 255 256 _defaultParserState() 256 _defaultParserState() 257 257 { 258 258 return { … … 262 262 } 263 263 264 _recurse(node, callback, state) 264 _recurse(node, callback, state) 265 265 { 266 266 if (!node) … … 488 488 } 489 489 490 _recurseArray(array, callback, state) 490 _recurseArray(array, callback, state) 491 491 { 492 492 for (var node of array) 493 493 this._recurse(node, callback, state); 494 494 } 495 496 // This function translates from esprima's Abstract Syntax Tree to ours. 495 496 // This function translates from esprima's Abstract Syntax Tree to ours. 497 497 // Mostly, this is just the identity function. We've added an extra isGetterOrSetter property for functions. 498 498 // Our AST complies with the Mozilla parser API: 499 499 // https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/Parser_API 500 _createInternalSyntaxTree(node) 500 _createInternalSyntaxTree(node) 501 501 { 502 502 if (!node) … … 580 580 body: this._createInternalSyntaxTree(node.body), 581 581 }; 582 break; 582 break; 583 583 case "ConditionalExpression": 584 584 result = { … … 854 854 return null; 855 855 } 856 856 857 857 result.range = node.range; 858 858 // This is an object for which you can add fields to an AST node without worrying about polluting the syntax-related fields of the node. -
trunk/Source/WebInspectorUI/UserInterface/Models/SourceCodeLocation.js
r181769 r182142 212 212 populateLiveDisplayLocationString(element, propertyName, columnStyle, nameStyle, prefix) 213 213 { 214 var currentDisplay = undefined;214 var currentDisplay; 215 215 216 216 function updateDisplayString(showAlternativeLocation, forceUpdate) -
trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js
r182054 r182142 311 311 this._clearTextMarkers(true); 312 312 313 var styleText = this._style.text;314 315 313 this._iterateOverProperties(true, function(property) { 316 314 var styleTextRange = property.styleDeclarationTextRange; … … 396 394 397 395 var codeMirrorTextMarker = marker.codeMirrorTextMarker; 398 var swatchMarker = this._codeMirror.setUniqueBookmark(codeMirrorTextMarker.find().from, swatchElement);399 396 400 397 swatchInnerElement.__colorTextMarker = codeMirrorTextMarker; -
trunk/Source/WebInspectorUI/UserInterface/Views/LayerTreeDetailsSidebarPanel.js
r182041 r182142 246 246 _updateLayerInfoSection(layer) 247 247 { 248 var emDash = "\u2014";249 250 248 this._layerInfoSection.groups = layer ? [this._layerInfoGroup] : [this._noLayerInformationGroup]; 251 249 -
trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeMapEntryTreeElement.js
r182042 r182142 90 90 this.addClassName("key"); 91 91 } 92 92 93 93 // Protected 94 94 … … 114 114 this.addClassName("value"); 115 115 } 116 116 117 117 // Protected 118 118 -
trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreePropertyTreeElement.js
r182099 r182142 51 51 this._updateHasChildren(); 52 52 } 53 53 54 54 // Protected 55 55 … … 358 358 var isAPI = mode !== WebInspector.ObjectTreeView.Mode.Prototype; 359 359 360 var prototypeName = undefined;360 var prototypeName; 361 361 if (this.property.name === "__proto__") { 362 362 if (resolvedValue.description) -
trunk/Source/WebInspectorUI/UserInterface/Views/ProbeSetDataGrid.js
r172650 r182142 47 47 this._listeners.register(probeSet, WebInspector.ProbeSet.Event.ProbeRemoved, this._teardownProbe); 48 48 this._listeners.register(probeSet, WebInspector.ProbeSet.Event.SamplesCleared, this._setupData); 49 this._listeners.register(WebInspector.Probe, WebInspector.Probe.Event.ExpressionChanged, this._probeExpressionChanged) 49 this._listeners.register(WebInspector.Probe, WebInspector.Probe.Event.ExpressionChanged, this._probeExpressionChanged); 50 50 this._listeners.install(); 51 51 52 52 this._setupData(); 53 } 53 }; 54 54 55 55 WebInspector.ProbeSetDataGrid.DataUpdatedStyleClassName = "data-updated"; … … 193 193 this._updateNodeForFrame(frame); 194 194 } 195 } 195 }; -
trunk/Source/WebInspectorUI/UserInterface/Views/RadioButtonNavigationItem.js
r164543 r182142 71 71 72 72 // Default state. 73 var styleText = parentSelector + " ." + classNames + " > .glyph { background-image: -webkit-canvas(" + this._canvasIdentifier() + "); background-size: " + 73 var styleText = parentSelector + " ." + classNames + " > .glyph { background-image: -webkit-canvas(" + this._canvasIdentifier() + "); background-size: " + this._imageWidth + "px " + this._imageHeight + "px; }\n"; 74 74 75 75 // Selected state. -
trunk/Source/WebInspectorUI/UserInterface/Views/ReplayDashboardView.js
r182055 r182142 63 63 this._playbackPaused(); 64 64 } 65 65 66 66 // Private 67 67 -
trunk/Source/WebInspectorUI/UserInterface/Views/ScopeChainDetailsSidebarPanel.js
r182041 r182142 94 94 var extraPropertyDescriptor = null; 95 95 var collapsedByDefault = false; 96 var dontHighlightNonEnumerableProperties = true;97 96 98 97 ++sectionCountByType[scope.type]; … … 102 101 foundLocalScope = true; 103 102 collapsedByDefault = false; 104 dontHighlightNonEnumerableProperties = true;105 103 106 104 title = WebInspector.UIString("Local Variables"); … … 112 110 case WebInspector.ScopeChainNode.Type.Closure: 113 111 title = WebInspector.UIString("Closure Variables"); 114 dontHighlightNonEnumerableProperties = true;115 112 collapsedByDefault = false; 116 113 break; … … 118 115 case WebInspector.ScopeChainNode.Type.Catch: 119 116 title = WebInspector.UIString("Catch Variables"); 120 dontHighlightNonEnumerableProperties = true;121 117 collapsedByDefault = false; 122 118 break; … … 124 120 case WebInspector.ScopeChainNode.Type.FunctionName: 125 121 title = WebInspector.UIString("Function Name Variable"); 126 dontHighlightNonEnumerableProperties = true;127 122 collapsedByDefault = true; 128 123 break; … … 131 126 title = WebInspector.UIString("With Object Properties"); 132 127 collapsedByDefault = foundLocalScope; 133 dontHighlightNonEnumerableProperties = false;134 128 break; 135 129 136 130 case WebInspector.ScopeChainNode.Type.Global: 137 131 title = WebInspector.UIString("Global Variables"); 138 dontHighlightNonEnumerableProperties = false;139 132 collapsedByDefault = true; 140 133 break; -
trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js
r182105 r182142 117 117 118 118 this._dismissPopover(); 119 119 120 120 this._dismissEditingController(true); 121 121 … … 299 299 prettyPrint(pretty) 300 300 { 301 // The annotators must be cleared before pretty printing takes place and resumed 302 // after so that they clear their annotations in a known state and insert new annotations 301 // The annotators must be cleared before pretty printing takes place and resumed 302 // after so that they clear their annotations in a known state and insert new annotations 303 303 // in the new state. 304 304 var shouldResumeTypeTokenAnnotator = this._typeTokenAnnotator && this._typeTokenAnnotator.isActive(); … … 869 869 870 870 var iconElement = widgetElement.appendChild(document.createElement("span")); 871 iconElement.className = "icon"; 871 iconElement.className = "icon"; 872 872 873 873 var textElement = widgetElement.appendChild(document.createElement("span")); … … 928 928 if (textElement.offsetWidth !== textElement.scrollWidth) 929 929 return true; 930 930 931 931 return false; 932 932 } … … 1552 1552 _trackPopoverEvents() 1553 1553 { 1554 if (!this._popoverEventListeners) 1554 if (!this._popoverEventListeners) 1555 1555 this._popoverEventListeners = new WebInspector.EventListenerSet(this, "Popover listeners"); 1556 1556 if (!this._popoverEventListenersAreRegistered) { … … 1623 1623 if (this._editingController) 1624 1624 this._editingController.dismissHoverMenu(discrete); 1625 1625 1626 1626 this.tokenTrackingController.hoveredMarker = null; 1627 1627 delete this._editingController; … … 1629 1629 1630 1630 // CodeMirrorEditingController Delegate 1631 1631 1632 1632 editingControllerDidStartEditing(editingController) 1633 1633 { … … 1639 1639 // We clear the marker since we'll reset it after editing. 1640 1640 editingController.marker.clear(); 1641 1641 1642 1642 // We ignore content changes made as a result of color editing. 1643 1643 this._ignoreContentDidChange++; 1644 1644 } 1645 1645 1646 1646 editingControllerDidFinishEditing(editingController) 1647 1647 { … … 1671 1671 this._enableScrollEventsForTypeTokenAnnotator(); 1672 1672 } else { 1673 // Because we disable type profiling when exiting the inspector, there is no need to call 1674 // RuntimeAgent.disableTypeProfiler() here. If we were to call it here, JavaScriptCore would 1675 // compile out all the necessary type profiling information, so if a user were to quickly press then 1676 // unpress the type profiling button, we wouldn't be able to re-show type information which would 1673 // Because we disable type profiling when exiting the inspector, there is no need to call 1674 // RuntimeAgent.disableTypeProfiler() here. If we were to call it here, JavaScriptCore would 1675 // compile out all the necessary type profiling information, so if a user were to quickly press then 1676 // unpress the type profiling button, we wouldn't be able to re-show type information which would 1677 1677 // provide a confusing user experience. 1678 1678 -
trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTreeElement.js
r182042 r182142 148 148 var currentFolderTreeElement = this; 149 149 150 for (var i = 0 150 for (var i = 0; i < components.length - 1; ++i) { 151 151 var componentName = components[i]; 152 152 currentPath += (i ? "/" : "") + componentName; -
trunk/Source/WebInspectorUI/UserInterface/Views/TextEditor.js
r182054 r182142 30 30 super(); 31 31 32 var text = (element ? element.textContent : "");33 32 this._element = element || document.createElement("div"); 34 33 this._element.classList.add("text-editor"); … … 758 757 var mappedAnchorLocation = this._formatterSourceMap.originalToFormatted(oldSelectionAnchor.line, oldSelectionAnchor.ch); 759 758 var mappedHeadLocation = this._formatterSourceMap.originalToFormatted(oldSelectionHead.line, oldSelectionHead.ch); 760 newSelectionAnchor = {line: mappedAnchorLocation.lineNumber, ch:mappedAnchorLocation.columnNumber};761 newSelectionHead = {line: mappedHeadLocation.lineNumber, ch:mappedHeadLocation.columnNumber};759 newSelectionAnchor = {line: mappedAnchorLocation.lineNumber, ch: mappedAnchorLocation.columnNumber}; 760 newSelectionHead = {line: mappedHeadLocation.lineNumber, ch: mappedHeadLocation.columnNumber}; 762 761 } else { 763 762 this._codeMirror.undo(); … … 781 780 var mappedAnchorLocation = this._formatterSourceMap.formattedToOriginal(oldSelectionAnchor.line, oldSelectionAnchor.ch); 782 781 var mappedHeadLocation = this._formatterSourceMap.formattedToOriginal(oldSelectionHead.line, oldSelectionHead.ch); 783 newSelectionAnchor = {line: mappedAnchorLocation.lineNumber, ch:mappedAnchorLocation.columnNumber};784 newSelectionHead = {line: mappedHeadLocation.lineNumber, ch:mappedHeadLocation.columnNumber};782 newSelectionAnchor = {line: mappedAnchorLocation.lineNumber, ch: mappedAnchorLocation.columnNumber}; 783 newSelectionHead = {line: mappedHeadLocation.lineNumber, ch: mappedHeadLocation.columnNumber}; 785 784 786 785 this._formatterSourceMap = null; -
trunk/Source/WebInspectorUI/UserInterface/Views/TimelineDataGrid.js
r182042 r182142 63 63 64 64 window.addEventListener("resize", this._windowResized.bind(this)); 65 } 65 }; 66 66 67 67 WebInspector.TimelineDataGrid.StyleClassName = "timeline"; … … 169 169 170 170 parentElement = parentElement || this._treeOutlineDataGridSynchronizer.treeOutline; 171 parentNode = parentElement.root ? this : this._treeOutlineDataGridSynchronizer.dataGridNodeForTreeElement(parentElement);171 var parentNode = parentElement.root ? this : this._treeOutlineDataGridSynchronizer.dataGridNodeForTreeElement(parentElement); 172 172 173 173 console.assert(parentNode); … … 468 468 469 469 var callFrames = this.selectedNode.record.callFrames; 470 for (var i = 0 470 for (var i = 0; i < callFrames.length; ++i) { 471 471 var callFrameTreeElement = new WebInspector.CallFrameTreeElement(callFrames[i]); 472 472 this._popoverCallStackTreeOutline.appendChild(callFrameTreeElement); -
trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRecordFrame.js
r181769 r182142 213 213 } 214 214 215 for ( type in WebInspector.TimelineRecord.Type) {215 for (var type in WebInspector.TimelineRecord.Type) { 216 216 var recordType = WebInspector.TimelineRecord.Type[type]; 217 217 var duration = displayRecord.durationForRecords(recordType); -
trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRuler.js
r181769 r182142 354 354 firstTime: firstDividerTime, 355 355 lastTime: lastDividerTime, 356 } 356 }; 357 357 358 358 if (Object.shallowEqual(dividerData, this._currentDividers)) -
trunk/Source/WebInspectorUI/UserInterface/Views/TypeTokenView.js
r182114 r182142 28 28 constructor(tokenAnnotator, shouldHaveRightMargin, shouldHaveLeftMargin, titleType, functionOrVariableName) 29 29 { 30 console.assert(titleType === WebInspector.TypeTokenView.TitleType.Variable 30 console.assert(titleType === WebInspector.TypeTokenView.TitleType.Variable || titleType === WebInspector.TypeTokenView.TitleType.ReturnStatement); 31 31 32 32 super(); … … 111 111 if (timeoutID) 112 112 clearTimeout(timeoutID); 113 } .bind(this));113 }); 114 114 } 115 115 … … 142 142 } 143 143 144 // The order of these checks are important. 144 // The order of these checks are important. 145 145 // For example, if a value is only a function, it is contained in TypeFunction, but it is also contained in (TypeFunction | TypeNull). 146 146 // Therefore, more specific types must be checked first. … … 179 179 if (typeSet.isContainedIn(WebInspector.TypeSet.TypeBit.Symbol | WebInspector.TypeSet.NullOrUndefinedTypeBits)) 180 180 return "Symbol?"; 181 181 182 182 if (typeSet.isContainedIn(WebInspector.TypeSet.TypeBit.Object | WebInspector.TypeSet.TypeBit.Function | WebInspector.TypeSet.TypeBit.String)) 183 183 return "Object";
Note: See TracChangeset
for help on using the changeset viewer.