Changeset 272371 in webkit
- Timestamp:
- Feb 4, 2021 9:16:03 AM (18 months ago)
- Location:
- trunk
- Files:
-
- 1 added
- 17 edited
- 1 copied
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/inspector/unit-tests/array-utilities-expected.txt (modified) (1 diff)
-
LayoutTests/inspector/unit-tests/array-utilities.html (modified) (1 diff)
-
Source/WebInspectorUI/ChangeLog (modified) (1 diff)
-
Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js (modified) (4 diffs)
-
Source/WebInspectorUI/UserInterface/Base/Setting.js (modified) (1 diff)
-
Source/WebInspectorUI/UserInterface/Base/Utilities.js (modified) (1 diff)
-
Source/WebInspectorUI/UserInterface/Images/TypeIcons.svg (modified) (1 diff)
-
Source/WebInspectorUI/UserInterface/Main.html (modified) (2 diffs)
-
Source/WebInspectorUI/UserInterface/Models/CallFrame.js (modified) (5 diffs)
-
Source/WebInspectorUI/UserInterface/Views/BlackboxedGroupTreeElement.css (copied) (copied from trunk/Source/WebInspectorUI/UserInterface/Views/CallFrameView.css) (2 diffs)
-
Source/WebInspectorUI/UserInterface/Views/BlackboxedGroupTreeElement.js (added)
-
Source/WebInspectorUI/UserInterface/Views/CallFrameTreeElement.css (modified) (1 diff)
-
Source/WebInspectorUI/UserInterface/Views/CallFrameView.css (modified) (1 diff)
-
Source/WebInspectorUI/UserInterface/Views/SettingsTabContentView.js (modified) (2 diffs)
-
Source/WebInspectorUI/UserInterface/Views/SourcesNavigationSidebarPanel.js (modified) (1 diff)
-
Source/WebInspectorUI/UserInterface/Views/ThreadTreeElement.js (modified) (2 diffs)
-
Source/WebInspectorUI/UserInterface/Views/TreeElement.js (modified) (1 diff)
-
Source/WebInspectorUI/UserInterface/Views/Variables.css (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r272368 r272371 1 2021-02-04 Nikita Vasilyev <nvasilyev@apple.com> 2 3 Web Inspector: Collapse blackboxed call frames in Sources 4 https://bugs.webkit.org/show_bug.cgi?id=216897 5 6 Reviewed by Devin Rousso. 7 8 Test Array.prototype.groupBy. 9 10 * inspector/unit-tests/array-utilities-expected.txt: 11 * inspector/unit-tests/array-utilities.html: 12 1 13 2021-02-04 Aditya Keerthi <akeerthi@apple.com> 2 14 -
trunk/LayoutTests/inspector/unit-tests/array-utilities-expected.txt
r249301 r272371 106 106 [1,2,3,4] => [[1,2],[2,3],[3,4]] 107 107 108 -- Running test case: Array.prototype.groupBy 109 [0,1,0,1,1,0,1,1,1,0] => [0,[1],0,[1,1],0,[1,1,1],0] 110 [0,1,0,1,1,0,1,1,1,0] => [0,1,0,[1,1],0,[1,1,1],0] 111 [0,1,0,1,1,0,1,1,1,0] => [0,1,0,1,1,0,[1,1,1],0] 112 [0,1,0,1,1,0,1,1,1,0] => [0,1,0,1,1,0,1,1,1,0] 113 [0,1,0,1,1,0,1,1,1] => [0,[1],0,[1,1],0,[1,1,1]] 114 [0,1,0,1,1,0,1,1,1] => [0,1,0,[1,1],0,[1,1,1]] 115 [0,1,0,1,1,0,1,1,1] => [0,1,0,1,1,0,[1,1,1]] 116 [0,1,0,1,1,0,1,1,1] => [0,1,0,1,1,0,1,1,1] 117 108 118 -- Running test case: Array.prototype.remove 109 119 PASS: remove should return true when removing a value that exists. -
trunk/LayoutTests/inspector/unit-tests/array-utilities.html
r249301 r272371 221 221 222 222 suite.addTestCase({ 223 name: "Array.prototype.groupBy", 224 test() { 225 function log(input, output) { 226 InspectorTest.log(JSON.stringify(input) + " => " + JSON.stringify(output)); 227 } 228 229 let arr = [0, 1, 0, 1, 1, 0, 1, 1, 1, 0]; 230 let isOne = (x) => { return x === 1 }; 231 232 log(arr, arr.groupBy(isOne, 1)); 233 log(arr, arr.groupBy(isOne, 2)); 234 log(arr, arr.groupBy(isOne, 3)); 235 log(arr, arr.groupBy(isOne, 4)); 236 237 let arr2 = [0, 1, 0, 1, 1, 0, 1, 1, 1]; 238 239 log(arr2, arr2.groupBy(isOne, 1)); 240 log(arr2, arr2.groupBy(isOne, 2)); 241 log(arr2, arr2.groupBy(isOne, 3)); 242 log(arr2, arr2.groupBy(isOne, 4)); 243 244 return true; 245 } 246 }); 247 248 suite.addTestCase({ 223 249 name: "Array.prototype.remove", 224 250 test() { -
trunk/Source/WebInspectorUI/ChangeLog
r272232 r272371 1 2021-02-04 Nikita Vasilyev <nvasilyev@apple.com> 2 3 Web Inspector: Collapse blackboxed call frames in Sources 4 https://bugs.webkit.org/show_bug.cgi?id=216897 5 6 Reviewed by Devin Rousso. 7 8 Stack traces often have dozens of blackboxed call frames when using blackboxing for JS-frameworks such as React.js. 9 It makes it hard to see more relevant non-framework code. 10 11 To improve this, introduce "Collapse blackboxed call frames" experimental setting, that collapses adjacent 12 blackboxed call frames into expandable items. 13 14 * Localizations/en.lproj/localizedStrings.js: 15 * UserInterface/Base/Setting.js: 16 * UserInterface/Base/Utilities.js: 17 * UserInterface/Images/TypeIcons.svg: 18 * UserInterface/Main.html: 19 * UserInterface/Models/CallFrame.js: 20 (WI.CallFrame): 21 (WI.CallFrame.prototype.get blackboxed): 22 (WI.CallFrame.fromDebuggerPayload): 23 (WI.CallFrame.fromPayload): 24 * UserInterface/Views/BlackboxedGroupTreeElement.css: Added. 25 (.tree-outline .item.blackboxed-group): 26 (.tree-outline .item.blackboxed-group .icon): 27 (@media (prefers-color-scheme: dark) .tree-outline .item.blackboxed-group .icon): 28 * UserInterface/Views/BlackboxedGroupTreeElement.js: Added. 29 (WI.BlackboxedGroupTreeElement): 30 (WI.BlackboxedGroupTreeElement.prototype.expand): 31 * UserInterface/Views/CallFrameTreeElement.css: 32 (.tree-outline .item.call-frame.blackboxed:not(.selected)): 33 * UserInterface/Views/CallFrameView.css: 34 (.call-frame.blackboxed > .title,): 35 * UserInterface/Views/SettingsTabContentView.js: 36 (WI.SettingsTabContentView.prototype._createExperimentalSettingsView): 37 * UserInterface/Views/SourcesNavigationSidebarPanel.js: 38 (WI.SourcesNavigationSidebarPanel.prototype._handleTreeSelectionDidChange): 39 * UserInterface/Views/ThreadTreeElement.js: 40 (WI.ThreadTreeElement.prototype.refresh): 41 * UserInterface/Views/TreeElement.js: 42 (WI.TreeElement.treeElementToggled): 43 This is necessary since `WI.BlackboxedGroupTreeElement` removes itself when expanded. 44 45 * UserInterface/Views/Variables.css: 46 (:root): 47 1 48 2021-02-02 BJ Burg <bburg@apple.com> 2 49 -
trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
r271874 r272371 220 220 localizedStrings["Blackbox Script"] = "Blackbox Script"; 221 221 localizedStrings["Blackbox script to ignore it when debugging"] = "Blackbox script to ignore it when debugging"; 222 /* Part of the 'Blackboxed - %d call frames' label shown in the debugger call stack when paused instead of subsequent call frames that have been blackboxed. */ 223 localizedStrings["Blackboxed @ Debugger Call Stack"] = "Blackboxed"; 222 224 localizedStrings["Block Variables"] = "Block Variables"; 223 225 /* Input label for the blur radius of a CSS box shadow */ … … 325 327 localizedStrings["Code"] = "Code"; 326 328 localizedStrings["Collapse All"] = "Collapse All"; 329 /* Setting to collapse blackboxed call frames in the debugger. */ 330 localizedStrings["Collapse blackboxed call frames @ Experimental Settings"] = "Collapse blackboxed call frames"; 327 331 localizedStrings["Collapse columns"] = "Collapse columns"; 328 332 localizedStrings["Collect garbage"] = "Collect garbage"; … … 421 425 localizedStrings["Debugger disabled during Timeline recording"] = "Debugger disabled during Timeline recording"; 422 426 localizedStrings["Debugging:"] = "Debugging:"; 427 /* Category label for experimental settings related to debugging. */ 428 localizedStrings["Debugging: @ Experimental Settings"] = "Debugging:"; 423 429 localizedStrings["Debugs"] = "Debugs"; 424 430 localizedStrings["Decoded"] = "Decoded"; … … 1690 1696 localizedStrings["\u201C%s\u201D Event Fired"] = "\u201C%s\u201D Event Fired"; 1691 1697 localizedStrings["\u201C%s\u201D Profile Recorded"] = "\u201C%s\u201D Profile Recorded"; 1698 /* Part of the 'Blackboxed - %d call frame' label shown in the debugger call stack when paused instead of subsequent call frames that have been blackboxed. */ 1699 localizedStrings["call frame @ Debugger Call Stack"] = "%d call frame"; 1700 /* Part of the 'Blackboxed - %d call frames' label shown in the debugger call stack when paused instead of subsequent call frames that have been blackboxed. */ 1701 localizedStrings["call frames @ Debugger Call Stack"] = "%d call frames"; 1692 1702 localizedStrings["computed"] = "computed"; 1693 1703 localizedStrings["default"] = "default"; -
trunk/Source/WebInspectorUI/UserInterface/Base/Setting.js
r271874 r272371 225 225 experimentalEnableStylesJumpToVariableDeclaration: new WI.Setting("experimental-styles-jump-to-variable-declaration", false), 226 226 experimentalEnableLayoutPanel: new WI.Setting("experimental-enable-layout-panel", false), 227 experimentalCollapseBlackboxedCallFrames: new WI.Setting("experimental-collapse-blackboxed-call-frames", false), 227 228 228 229 // Protocol -
trunk/Source/WebInspectorUI/UserInterface/Base/Utilities.js
r270149 r272371 1625 1625 }); 1626 1626 1627 Object.defineProperty(Array.prototype, "groupBy", 1628 { 1629 value(groupFunction, minGroupSize = 1) 1630 { 1631 let result = []; 1632 let startIndex = null; 1633 1634 let flush = (endIndex) => { 1635 if (startIndex === null) 1636 return; 1637 let group = this.slice(startIndex, endIndex + 1); 1638 let adjacentCount = (endIndex + 1) - startIndex; 1639 if (adjacentCount >= minGroupSize) 1640 result.push(group); 1641 else 1642 result.pushAll(group); 1643 } 1644 1645 this.forEach((item, i) => { 1646 if (groupFunction(item)) { 1647 startIndex ??= i; 1648 if (i === this.length - 1) 1649 flush(this.length - 1); 1650 } else { 1651 flush(i - 1); 1652 result.push(item); 1653 startIndex = null; 1654 } 1655 }); 1656 1657 return result; 1658 } 1659 }); 1660 1627 1661 Object.defineProperty(Promise, "chain", 1628 1662 { -
trunk/Source/WebInspectorUI/UserInterface/Images/TypeIcons.svg
r258900 r272371 291 291 <g id="AuditTestGroupResult-dark" class="dark grey"><use href="#box"/><use href="#T"/></g> 292 292 <g id="AuditTestGroupResult-light" class="light grey"><use href="#box"/><use href="#T"/></g> 293 <g id="Blackboxed-dark" class="dark grey"><use href="#box"/><use href="#question-mark"/></g> 294 <g id="Blackboxed-light" class="light grey"><use href="#box"/><use href="#question-mark"/></g> 293 295 <g id="CallTrees-dark" class="dark grey"><use href="#box"/><use href="#calltree"/></g> 294 296 <g id="CallTrees-light" class="light grey"><use href="#box"/><use href="#calltree"/></g> -
trunk/Source/WebInspectorUI/UserInterface/Main.html
r271874 r272371 42 42 <link rel="stylesheet" href="Views/BannerView.css"> 43 43 <link rel="stylesheet" href="Views/BezierEditor.css"> 44 <link rel="stylesheet" href="Views/BlackboxedGroupTreeElement.css"> 44 45 <link rel="stylesheet" href="Views/BlackboxSettingsView.css"> 45 46 <link rel="stylesheet" href="Views/BootstrapScriptTreeElement.css"> … … 621 622 <script src="Views/BezierEditor.js"></script> 622 623 <script src="Views/BlackboxSettingsView.js"></script> 624 <script src="Views/BlackboxedGroupTreeElement.js"></script> 623 625 <script src="Views/BootstrapScriptTreeElement.js"></script> 624 626 <script src="Views/BoxModelDetailsSectionRow.js"></script> -
trunk/Source/WebInspectorUI/UserInterface/Models/CallFrame.js
r262806 r272371 26 26 WI.CallFrame = class CallFrame 27 27 { 28 constructor(target, id, sourceCodeLocation, functionName, thisObject, scopeChain, nativeCode, programCode, isTailDeleted )28 constructor(target, id, sourceCodeLocation, functionName, thisObject, scopeChain, nativeCode, programCode, isTailDeleted, blackboxed) 29 29 { 30 30 console.assert(target instanceof WI.Target); … … 48 48 this._programCode = programCode || false; 49 49 this._isTailDeleted = isTailDeleted || false; 50 this._blackboxed = blackboxed || false; 50 51 } 51 52 … … 61 62 get scopeChain() { return this._scopeChain; } 62 63 get isTailDeleted() { return this._isTailDeleted; } 64 get blackboxed() { return this._blackboxed; } 63 65 get isConsoleEvaluation() { return this._isConsoleEvaluation; } 64 66 … … 210 212 let programCode = WI.CallFrame.programCodeFromPayload(payload); 211 213 let isTailDeleted = payload.isTailDeleted; 212 return new WI.CallFrame(target, id, sourceCodeLocation, functionName, thisObject, scopeChain, nativeCode, programCode, isTailDeleted); 214 let blackboxed = sourceCodeLocation && !!WI.debuggerManager.blackboxDataForSourceCode(sourceCodeLocation.sourceCode); 215 return new WI.CallFrame(target, id, sourceCodeLocation, functionName, thisObject, scopeChain, nativeCode, programCode, isTailDeleted, blackboxed); 213 216 } 214 217 … … 254 257 const scopeChain = null; 255 258 const isTailDeleted = false; 256 return new WI.CallFrame(target, id, sourceCodeLocation, functionName, thisObject, scopeChain, nativeCode, programCode, isTailDeleted); 259 let blackboxed = sourceCodeLocation && !!WI.debuggerManager.blackboxDataForSourceCode(sourceCodeLocation.sourceCode); 260 return new WI.CallFrame(target, id, sourceCodeLocation, functionName, thisObject, scopeChain, nativeCode, programCode, isTailDeleted, blackboxed); 257 261 } 258 262 }; -
trunk/Source/WebInspectorUI/UserInterface/Views/BlackboxedGroupTreeElement.css
r272370 r272371 1 1 /* 2 * Copyright (C) 20 13-2020 Apple Inc. All rights reserved.2 * Copyright (C) 2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 .call-frame { 27 overflow: hidden; 28 text-overflow: ellipsis; 29 white-space: nowrap; 26 .tree-outline .item.blackboxed-group { 30 27 cursor: pointer; 28 opacity: var(--blackboxed-tree-item-opacity); 31 29 } 32 30 33 .call-frame.blackboxed > .title, 34 .call-frame.blackboxed:not(:hover, :focus) > .subtitle { 35 opacity: 0.5; 36 } 37 38 .call-frame .icon { 39 display: inline-block; 40 vertical-align: top; 41 width: 16px; 42 height: 16px; 43 margin-inline-end: 3px; 44 } 45 46 .call-frame .titles { 47 display: inline-block; 48 } 49 50 .call-frame .subtitle, 51 .call-frame .subtitle .source-link { 52 color: hsla(0, 0%, 0%, 0.6); 53 text-decoration: none; 54 } 55 56 .call-frame:hover .subtitle .source-link, 57 .call-frame:focus .subtitle .source-link { 58 color: hsl(210, 0%, 0%); 59 } 60 61 .call-frame .subtitle:empty { 62 display: none; 63 } 64 65 .call-frame .subtitle { 66 font-size: inherit; 67 } 68 69 .call-frame .colon { 70 background-color: red; 71 } 72 73 .call-frame .separator { 74 white-space: nowrap; 75 color: hsla(0, 0%, 0%, 0.2); 31 .tree-outline .item.blackboxed-group .icon { 32 content: url(../Images/TypeIcons.svg#Blackboxed-light); 76 33 } 77 34 78 35 @media (prefers-color-scheme: dark) { 79 .call-frame .subtitle, 80 .call-frame .subtitle .source-link { 81 color: hsla(0, 0%, var(--foreground-lightness), 0.6); 82 } 83 84 .call-frame:hover .subtitle .source-link, 85 .call-frame:focus .subtitle .source-link { 86 color: hsl(0, 0%, var(--foreground-lightness)); 87 } 88 89 .call-frame .separator { 90 color: hsla(0, 0%, var(--foreground-lightness), 0.2); 36 .tree-outline .item.blackboxed-group .icon { 37 content: url(../Images/TypeIcons.svg#Blackboxed-dark); 91 38 } 92 39 } -
trunk/Source/WebInspectorUI/UserInterface/Views/CallFrameTreeElement.css
r269166 r272371 100 100 101 101 .tree-outline .item.call-frame.blackboxed:not(.selected) { 102 opacity: 0.5;102 opacity: var(--blackboxed-tree-item-opacity); 103 103 } -
trunk/Source/WebInspectorUI/UserInterface/Views/CallFrameView.css
r269166 r272371 33 33 .call-frame.blackboxed > .title, 34 34 .call-frame.blackboxed:not(:hover, :focus) > .subtitle { 35 opacity: 0.5;35 opacity: var(--blackboxed-tree-item-opacity); 36 36 } 37 37 -
trunk/Source/WebInspectorUI/UserInterface/Views/SettingsTabContentView.js
r271874 r272371 404 404 } 405 405 406 let supportsBlackboxingScripts = WI.DebuggerManager.supportsBlackboxingScripts(); 407 if (supportsBlackboxingScripts) { 408 experimentalSettingsView.addSetting(WI.UIString("Debugging:", "Debugging: @ Experimental Settings", "Category label for experimental settings related to debugging."), WI.settings.experimentalCollapseBlackboxedCallFrames, WI.UIString("Collapse blackboxed call frames", "Collapse blackboxed call frames @ Experimental Settings", "Setting to collapse blackboxed call frames in the debugger.")); 409 experimentalSettingsView.addSeparator(); 410 } 411 406 412 let reloadInspectorButton = document.createElement("button"); 407 413 reloadInspectorButton.textContent = WI.UIString("Reload Web Inspector"); … … 427 433 listenForChange(WI.settings.experimentalEnableStylesJumpToVariableDeclaration); 428 434 } 435 436 if (supportsBlackboxingScripts) 437 listenForChange(WI.settings.experimentalCollapseBlackboxedCallFrames); 429 438 430 439 this._createReferenceLink(experimentalSettingsView); -
trunk/Source/WebInspectorUI/UserInterface/Views/SourcesNavigationSidebarPanel.js
r270604 r272371 1988 1988 } 1989 1989 1990 if (treeElement instanceof WI.BlackboxedGroupTreeElement) 1991 return; 1992 1990 1993 console.error("Unknown tree element", treeElement); 1991 1994 } -
trunk/Source/WebInspectorUI/UserInterface/Views/ThreadTreeElement.js
r269359 r272371 57 57 let activeCallFrameTreeElement = null; 58 58 59 for (let callFrame of callFrames) { 60 let callFrameTreeElement = new WI.CallFrameTreeElement(callFrame); 61 if (callFrame === activeCallFrame) 62 activeCallFrameTreeElement = callFrameTreeElement; 63 this.appendChild(callFrameTreeElement); 64 } 59 let renderCallFrames = (callFrames, shouldSelectActiveFrame) => { 60 if (WI.settings.experimentalCollapseBlackboxedCallFrames.value) 61 callFrames = callFrames.groupBy((callFrame) => callFrame.blackboxed); 62 63 for (let callFrameOrBlackboxedGroup of callFrames) { 64 if (Array.isArray(callFrameOrBlackboxedGroup)) { 65 this.appendChild(new WI.BlackboxedGroupTreeElement(callFrameOrBlackboxedGroup)); 66 continue; 67 } 68 let callFrameTreeElement = new WI.CallFrameTreeElement(callFrameOrBlackboxedGroup); 69 if (shouldSelectActiveFrame && callFrameOrBlackboxedGroup === activeCallFrame) 70 activeCallFrameTreeElement = callFrameTreeElement; 71 this.appendChild(callFrameTreeElement); 72 } 73 }; 74 75 renderCallFrames(callFrames, true); 65 76 66 77 if (activeCallFrameTreeElement) { … … 90 101 91 102 let startIndex = currentStackTrace.topCallFrameIsBoundary ? 1 : 0; 92 for (let i = startIndex; i < currentStackTrace.callFrames.length; ++i) 93 this.appendChild(new WI.CallFrameTreeElement(currentStackTrace.callFrames[i])); 103 renderCallFrames(startIndex ? currentStackTrace.callFrames.slice(startIndex) : currentStackTrace.callFrames); 94 104 95 105 if (currentStackTrace.truncated) { -
trunk/Source/WebInspectorUI/UserInterface/Views/TreeElement.js
r258536 r272371 325 325 } 326 326 327 if ( !treeElement.treeOutline.selectable)327 if (treeElement.treeOutline && !treeElement.treeOutline.selectable) 328 328 treeElement.treeOutline.dispatchEventToListeners(WI.TreeOutline.Event.ElementClicked, {treeElement}); 329 329 } -
trunk/Source/WebInspectorUI/UserInterface/Views/Variables.css
r268473 r272371 216 216 217 217 --image-button-navigation-item-width: 26px; 218 219 --blackboxed-tree-item-opacity: 0.5; 218 220 } 219 221
Note: See TracChangeset
for help on using the changeset viewer.