Log Message
Web Inspector: Sources: expanding a grouping of blackboxed call frames should be persistent https://bugs.webkit.org/show_bug.cgi?id=234614 <rdar://problem/86989232>
Reviewed by Patrick Angle. Source/WebInspectorUI: If the developer has explicitly decided to show blackboxed call frames, we should respect that decision. Requiring them to re-expand after _every_ debugger action is very hostile. So long as the blackboxed call frames remain the same we should persist the expansion. Only if the location of those blackboxed frames changes should we re-collapse. * UserInterface/Controllers/DebuggerManager.js: (WI.DebuggerManager): (WI.DebuggerManager.prototype.rememberBlackboxedCallFrameGroupToAutoExpand): Added. (WI.DebuggerManager.prototype.shouldAutoExpandBlackboxedCallFrameGroup): Added. (WI.DebuggerManager.prototype._didResumeInternal): * UserInterface/Views/BlackboxedGroupTreeElement.js: (WI.BlackboxedGroupTreeElement.prototype.expand): Keep a list of blackboxed call frame groupings that have been expanded by the developer. Use this list to decide whether "new" blackboxed call frame grouping should be auto-expanded by default (i.e. if every `WI.CallFrame` is identical with something in the list). Clear the list when resuming, as we're only trying to keep expanded blackboxed call frame groupings within the same call stack (i.e. while stepping). * UserInterface/Base/Utilities.js: (Array.prototype.groupBy): Deleted. * UserInterface/Views/ThreadTreeElement.js: (WI.ThreadTreeElement.prototype.refresh): Remove the custom `Array.prototype.groupBy` since it's no longer needed (and there's now a builtin function with the same name). Instead, just keep an index of the first blackboxed call frame and iterate until either the end of the call stack or a non-blackboxed call frame is found, `slice`ing from the saved index to the current item to make a blackboxed call frame group. If that blackboxed call frame group should be auto-expanded (see above), create a `WI.CallFrameTreeElement` for each blackboxed call frame instead of one `WI.BlackboxedGroupTreeElement`. * UserInterface/Models/CallFrame.js: (WI.CallFrame.prototype.isEqual): Added. Add a convenience function to compare two `WI.CallFrame`. Right now it just looks at the `WI.SourceCodeLocation`, since for most purposes that's really how one would identify a `WI.CallFrame` (i.e. it's probably more important to know "is this the same spot in code" as opposed to "do we have the same `this` object"). LayoutTests: * inspector/unit-tests/array-utilities.html: * inspector/unit-tests/array-utilities-expected.txt: Remove the custom `Array.prototype.groupBy` since it's no longer needed (and there's now a builtin function with the same name).
Modified Paths
- trunk/LayoutTests/ChangeLog
- trunk/LayoutTests/inspector/unit-tests/array-utilities-expected.txt
- trunk/LayoutTests/inspector/unit-tests/array-utilities.html
- trunk/Source/WebInspectorUI/ChangeLog
- trunk/Source/WebInspectorUI/UserInterface/Base/Utilities.js
- trunk/Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js
- trunk/Source/WebInspectorUI/UserInterface/Models/CallFrame.js
- trunk/Source/WebInspectorUI/UserInterface/Views/BlackboxedGroupTreeElement.js
- trunk/Source/WebInspectorUI/UserInterface/Views/ThreadTreeElement.js
Diff
Modified: trunk/LayoutTests/ChangeLog (287589 => 287590)
--- trunk/LayoutTests/ChangeLog 2022-01-04 22:14:05 UTC (rev 287589)
+++ trunk/LayoutTests/ChangeLog 2022-01-04 22:51:18 UTC (rev 287590)
@@ -1,3 +1,16 @@
+2022-01-04 Devin Rousso <[email protected]>
+
+ Web Inspector: Sources: expanding a grouping of blackboxed call frames should be persistent
+ https://bugs.webkit.org/show_bug.cgi?id=234614
+ <rdar://problem/86989232>
+
+ Reviewed by Patrick Angle.
+
+ * inspector/unit-tests/array-utilities.html:
+ * inspector/unit-tests/array-utilities-expected.txt:
+ Remove the custom `Array.prototype.groupBy` since it's no longer needed (and there's now a
+ builtin function with the same name).
+
2022-01-04 Arcady Goldmints-Orlov <[email protected]>
[WPE] Update test baselines after recent LFC-related changes.
Modified: trunk/LayoutTests/inspector/unit-tests/array-utilities-expected.txt (287589 => 287590)
--- trunk/LayoutTests/inspector/unit-tests/array-utilities-expected.txt 2022-01-04 22:14:05 UTC (rev 287589)
+++ trunk/LayoutTests/inspector/unit-tests/array-utilities-expected.txt 2022-01-04 22:51:18 UTC (rev 287590)
@@ -105,16 +105,6 @@
[1,2,3] => [[1,2],[2,3]]
[1,2,3,4] => [[1,2],[2,3],[3,4]]
--- Running test case: Array.prototype.groupBy
-[0,1,0,1,1,0,1,1,1,0] => [0,[1],0,[1,1],0,[1,1,1],0]
-[0,1,0,1,1,0,1,1,1,0] => [0,1,0,[1,1],0,[1,1,1],0]
-[0,1,0,1,1,0,1,1,1,0] => [0,1,0,1,1,0,[1,1,1],0]
-[0,1,0,1,1,0,1,1,1,0] => [0,1,0,1,1,0,1,1,1,0]
-[0,1,0,1,1,0,1,1,1] => [0,[1],0,[1,1],0,[1,1,1]]
-[0,1,0,1,1,0,1,1,1] => [0,1,0,[1,1],0,[1,1,1]]
-[0,1,0,1,1,0,1,1,1] => [0,1,0,1,1,0,[1,1,1]]
-[0,1,0,1,1,0,1,1,1] => [0,1,0,1,1,0,1,1,1]
-
-- Running test case: Array.prototype.remove
PASS: remove should return true when removing a value that exists.
PASS: remove should only remove the first matching value.
Modified: trunk/LayoutTests/inspector/unit-tests/array-utilities.html (287589 => 287590)
--- trunk/LayoutTests/inspector/unit-tests/array-utilities.html 2022-01-04 22:14:05 UTC (rev 287589)
+++ trunk/LayoutTests/inspector/unit-tests/array-utilities.html 2022-01-04 22:51:18 UTC (rev 287590)
@@ -220,32 +220,6 @@
});
suite.addTestCase({
- name: "Array.prototype.groupBy",
- test() {
- function log(input, output) {
- InspectorTest.log(JSON.stringify(input) + " => " + JSON.stringify(output));
- }
-
- let arr = [0, 1, 0, 1, 1, 0, 1, 1, 1, 0];
- let isOne = (x) => { return x === 1 };
-
- log(arr, arr.groupBy(isOne, 1));
- log(arr, arr.groupBy(isOne, 2));
- log(arr, arr.groupBy(isOne, 3));
- log(arr, arr.groupBy(isOne, 4));
-
- let arr2 = [0, 1, 0, 1, 1, 0, 1, 1, 1];
-
- log(arr2, arr2.groupBy(isOne, 1));
- log(arr2, arr2.groupBy(isOne, 2));
- log(arr2, arr2.groupBy(isOne, 3));
- log(arr2, arr2.groupBy(isOne, 4));
-
- return true;
- }
- });
-
- suite.addTestCase({
name: "Array.prototype.remove",
test() {
let arr1 = [1, 2, 3, 1];
Modified: trunk/Source/WebInspectorUI/ChangeLog (287589 => 287590)
--- trunk/Source/WebInspectorUI/ChangeLog 2022-01-04 22:14:05 UTC (rev 287589)
+++ trunk/Source/WebInspectorUI/ChangeLog 2022-01-04 22:51:18 UTC (rev 287590)
@@ -1,5 +1,49 @@
2022-01-04 Devin Rousso <[email protected]>
+ Web Inspector: Sources: expanding a grouping of blackboxed call frames should be persistent
+ https://bugs.webkit.org/show_bug.cgi?id=234614
+ <rdar://problem/86989232>
+
+ Reviewed by Patrick Angle.
+
+ If the developer has explicitly decided to show blackboxed call frames, we should respect
+ that decision. Requiring them to re-expand after _every_ debugger action is very hostile.
+ So long as the blackboxed call frames remain the same we should persist the expansion. Only
+ if the location of those blackboxed frames changes should we re-collapse.
+
+ * UserInterface/Controllers/DebuggerManager.js:
+ (WI.DebuggerManager):
+ (WI.DebuggerManager.prototype.rememberBlackboxedCallFrameGroupToAutoExpand): Added.
+ (WI.DebuggerManager.prototype.shouldAutoExpandBlackboxedCallFrameGroup): Added.
+ (WI.DebuggerManager.prototype._didResumeInternal):
+ * UserInterface/Views/BlackboxedGroupTreeElement.js:
+ (WI.BlackboxedGroupTreeElement.prototype.expand):
+ Keep a list of blackboxed call frame groupings that have been expanded by the developer.
+ Use this list to decide whether "new" blackboxed call frame grouping should be auto-expanded
+ by default (i.e. if every `WI.CallFrame` is identical with something in the list). Clear the
+ list when resuming, as we're only trying to keep expanded blackboxed call frame groupings
+ within the same call stack (i.e. while stepping).
+
+ * UserInterface/Base/Utilities.js:
+ (Array.prototype.groupBy): Deleted.
+ * UserInterface/Views/ThreadTreeElement.js:
+ (WI.ThreadTreeElement.prototype.refresh):
+ Remove the custom `Array.prototype.groupBy` since it's no longer needed (and there's now a
+ builtin function with the same name). Instead, just keep an index of the first blackboxed
+ call frame and iterate until either the end of the call stack or a non-blackboxed call frame
+ is found, `slice`ing from the saved index to the current item to make a blackboxed call
+ frame group. If that blackboxed call frame group should be auto-expanded (see above), create
+ a `WI.CallFrameTreeElement` for each blackboxed call frame instead of one `WI.BlackboxedGroupTreeElement`.
+
+ * UserInterface/Models/CallFrame.js:
+ (WI.CallFrame.prototype.isEqual): Added.
+ Add a convenience function to compare two `WI.CallFrame`. Right now it just looks at the
+ `WI.SourceCodeLocation`, since for most purposes that's really how one would identify a
+ `WI.CallFrame` (i.e. it's probably more important to know "is this the same spot in code"
+ as opposed to "do we have the same `this` object").
+
+2022-01-04 Devin Rousso <[email protected]>
+
Web Inspector: Add icon for collapsed blackboxed section
https://bugs.webkit.org/show_bug.cgi?id=219806
<rdar://problem/72240360>
Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Utilities.js (287589 => 287590)
--- trunk/Source/WebInspectorUI/UserInterface/Base/Utilities.js 2022-01-04 22:14:05 UTC (rev 287589)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Utilities.js 2022-01-04 22:51:18 UTC (rev 287590)
@@ -1624,40 +1624,6 @@
}
});
-Object.defineProperty(Array.prototype, "groupBy",
-{
- value(groupFunction, minGroupSize = 1)
- {
- let result = [];
- let startIndex = null;
-
- let flush = (endIndex) => {
- if (startIndex === null)
- return;
- let group = this.slice(startIndex, endIndex + 1);
- let adjacentCount = (endIndex + 1) - startIndex;
- if (adjacentCount >= minGroupSize)
- result.push(group);
- else
- result.pushAll(group);
- }
-
- this.forEach((item, i) => {
- if (groupFunction(item)) {
- startIndex ??= i;
- if (i === this.length - 1)
- flush(this.length - 1);
- } else {
- flush(i - 1);
- result.push(item);
- startIndex = null;
- }
- });
-
- return result;
- }
-});
-
Object.defineProperty(Promise, "chain",
{
async value(callbacks, initialValue)
Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js (287589 => 287590)
--- trunk/Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js 2022-01-04 22:14:05 UTC (rev 287589)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js 2022-01-04 22:51:18 UTC (rev 287590)
@@ -80,6 +80,7 @@
this._blackboxedURLsSetting = new WI.Setting("debugger-blackboxed-urls", []);
this._blackboxedPatternsSetting = new WI.Setting("debugger-blackboxed-patterns", []);
this._blackboxedPatternDataMap = new Map;
+ this._blackboxedCallFrameGroupsToAutoExpand = [];
this._activeCallFrame = null;
@@ -530,6 +531,26 @@
this.dispatchEventToListeners(DebuggerManager.Event.BlackboxChanged);
}
+ rememberBlackboxedCallFrameGroupToAutoExpand(blackboxedCallFrameGroup)
+ {
+ console.assert(!this.shouldAutoExpandBlackboxedCallFrameGroup(blackboxedCallFrameGroup), blackboxedCallFrameGroup);
+
+ this._blackboxedCallFrameGroupsToAutoExpand.push(blackboxedCallFrameGroup);
+ }
+
+ shouldAutoExpandBlackboxedCallFrameGroup(blackboxedCallFrameGroup)
+ {
+ console.assert(WI.settings.experimentalCollapseBlackboxedCallFrames.value);
+ console.assert(Array.isArray(blackboxedCallFrameGroup) && blackboxedCallFrameGroup.length && blackboxedCallFrameGroup.every((callFrame) => callFrame instanceof WI.CallFrame && callFrame.blackboxed), blackboxedCallFrameGroup);
+
+ return this._blackboxedCallFrameGroupsToAutoExpand.some((blackboxedCallFrameGroupToAutoExpand) => {
+ if (blackboxedCallFrameGroupToAutoExpand.length !== blackboxedCallFrameGroup.length)
+ return false;
+
+ return blackboxedCallFrameGroupToAutoExpand.every((item, i) => item.isEqual(blackboxedCallFrameGroup[i]));
+ });
+ }
+
get asyncStackTraceDepth()
{
return this._asyncStackTraceDepthSetting.value;
@@ -1418,6 +1439,8 @@
activeCallFrameDidChange = true;
}
+ this._blackboxedCallFrameGroupsToAutoExpand = [];
+
this.dataForTarget(target).updateForResume();
if (!this.paused)
Modified: trunk/Source/WebInspectorUI/UserInterface/Models/CallFrame.js (287589 => 287590)
--- trunk/Source/WebInspectorUI/UserInterface/Models/CallFrame.js 2022-01-04 22:14:05 UTC (rev 287589)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/CallFrame.js 2022-01-04 22:51:18 UTC (rev 287590)
@@ -64,6 +64,17 @@
get blackboxed() { return this._blackboxed; }
get isConsoleEvaluation() { return this._isConsoleEvaluation; }
+ isEqual(other)
+ {
+ if (!other)
+ return false;
+
+ if (this._sourceCodeLocation && other._sourceCodeLocation)
+ return this._sourceCodeLocation.isEqual(other._sourceCodeLocation);
+
+ return false;
+ }
+
saveIdentityToCookie()
{
// Do nothing. The call frame is torn down when the inspector closes, and
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/BlackboxedGroupTreeElement.js (287589 => 287590)
--- trunk/Source/WebInspectorUI/UserInterface/Views/BlackboxedGroupTreeElement.js 2022-01-04 22:14:05 UTC (rev 287589)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/BlackboxedGroupTreeElement.js 2022-01-04 22:51:18 UTC (rev 287590)
@@ -27,7 +27,7 @@
{
constructor(callFrames)
{
- console.assert(Array.isArray(callFrames) && callFrames.length && callFrames.every((callFrame) => callFrame instanceof WI.CallFrame));
+ console.assert(!WI.debuggerManager.shouldAutoExpandBlackboxedCallFrameGroup(callFrames), callFrames);
const classNames = ["blackboxed-group"];
const title = WI.UIString("Blackboxed", "Blackboxed @ Debugger Call Stack", "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.");
@@ -48,6 +48,8 @@
expand()
{
+ WI.debuggerManager.rememberBlackboxedCallFrameGroupToAutoExpand(this._callFrames);
+
let index = this.parent.children.indexOf(this);
for (let i = this._callFrames.length - 1; i >= 0; --i)
this.parent.insertChild(new WI.CallFrameTreeElement(this._callFrames[i]), index);
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ThreadTreeElement.js (287589 => 287590)
--- trunk/Source/WebInspectorUI/UserInterface/Views/ThreadTreeElement.js 2022-01-04 22:14:05 UTC (rev 287589)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ThreadTreeElement.js 2022-01-04 22:51:18 UTC (rev 287590)
@@ -57,16 +57,35 @@
let activeCallFrameTreeElement = null;
let renderCallFrames = (callFrames, shouldSelectActiveFrame) => {
- if (WI.settings.experimentalCollapseBlackboxedCallFrames.value)
- callFrames = callFrames.groupBy((callFrame) => callFrame.blackboxed);
+ let blackboxedCallFrameGroupStartIndex = undefined;
- for (let callFrameOrBlackboxedGroup of callFrames) {
- if (Array.isArray(callFrameOrBlackboxedGroup)) {
- this.appendChild(new WI.BlackboxedGroupTreeElement(callFrameOrBlackboxedGroup));
+ // Add one extra iteration to handle call stacks that start blackboxed.
+ for (let i = 0; i < callFrames.length + 1; ++i) {
+ let callFrame = callFrames[i];
+
+ if (callFrame?.blackboxed && WI.settings.experimentalCollapseBlackboxedCallFrames.value) {
+ blackboxedCallFrameGroupStartIndex ??= i;
continue;
}
- let callFrameTreeElement = new WI.CallFrameTreeElement(callFrameOrBlackboxedGroup);
- if (shouldSelectActiveFrame && callFrameOrBlackboxedGroup === activeCallFrame)
+
+ if (blackboxedCallFrameGroupStartIndex !== undefined) {
+ let blackboxedCallFrameGroup = callFrames.slice(blackboxedCallFrameGroupStartIndex, i);
+ blackboxedCallFrameGroupStartIndex = undefined;
+
+ if (!WI.debuggerManager.shouldAutoExpandBlackboxedCallFrameGroup(blackboxedCallFrameGroup)) {
+ this.appendChild(new WI.BlackboxedGroupTreeElement(blackboxedCallFrameGroup));
+ continue;
+ }
+
+ for (let blackboxedCallFrame of blackboxedCallFrameGroup)
+ this.appendChild(new WI.CallFrameTreeElement(blackboxedCallFrame));
+ }
+
+ if (!callFrame)
+ continue;
+
+ let callFrameTreeElement = new WI.CallFrameTreeElement(callFrame);
+ if (shouldSelectActiveFrame && callFrame === activeCallFrame)
activeCallFrameTreeElement = callFrameTreeElement;
this.appendChild(callFrameTreeElement);
}
_______________________________________________ webkit-changes mailing list [email protected] https://lists.webkit.org/mailman/listinfo/webkit-changes
