- Revision
- 244350
- Author
- [email protected]
- Date
- 2019-04-16 12:02:23 -0700 (Tue, 16 Apr 2019)
Log Message
Web Inspector: Storage: values truncated in Local/Session table
https://bugs.webkit.org/show_bug.cgi?id=178318
<rdar://problem/34998581>
Reviewed by Joseph Pecoraro.
* UserInterface/Views/DataGrid.js:
(WI.DataGrid):
(WI.DataGrid.prototype._copyTextForDataGridNode):
* UserInterface/Views/TimelineDataGrid.js:
(WI.TimelineDataGrid):
Refactor `WI.DataGrid` constructor to allow for more optional arguments.
Introduce a new optional argument `copyCallback` that can be used to override the text that
would be copied for any `WI.DataGridNode` in any column.
* UserInterface/Views/DOMStorageContentView.js:
(WI.DOMStorageContentView):
(WI.DOMStorageContentView.prototype.itemAdded):
(WI.DOMStorageContentView.prototype.itemUpdated):
(WI.DOMStorageContentView.prototype._populate):
(WI.DOMStorageContentView.prototype._dataGridCopy): Added.
Save the full non-truncated value as part of the `WI.DataGridNode`'s `data`. When copying,
use the full non-truncated value instead of what was shown in the DOM.
Modified Paths
Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (244349 => 244350)
--- trunk/Source/WebInspectorUI/ChangeLog 2019-04-16 18:51:29 UTC (rev 244349)
+++ trunk/Source/WebInspectorUI/ChangeLog 2019-04-16 19:02:23 UTC (rev 244350)
@@ -1,3 +1,29 @@
+2019-04-16 Devin Rousso <[email protected]>
+
+ Web Inspector: Storage: values truncated in Local/Session table
+ https://bugs.webkit.org/show_bug.cgi?id=178318
+ <rdar://problem/34998581>
+
+ Reviewed by Joseph Pecoraro.
+
+ * UserInterface/Views/DataGrid.js:
+ (WI.DataGrid):
+ (WI.DataGrid.prototype._copyTextForDataGridNode):
+ * UserInterface/Views/TimelineDataGrid.js:
+ (WI.TimelineDataGrid):
+ Refactor `WI.DataGrid` constructor to allow for more optional arguments.
+ Introduce a new optional argument `copyCallback` that can be used to override the text that
+ would be copied for any `WI.DataGridNode` in any column.
+
+ * UserInterface/Views/DOMStorageContentView.js:
+ (WI.DOMStorageContentView):
+ (WI.DOMStorageContentView.prototype.itemAdded):
+ (WI.DOMStorageContentView.prototype.itemUpdated):
+ (WI.DOMStorageContentView.prototype._populate):
+ (WI.DOMStorageContentView.prototype._dataGridCopy): Added.
+ Save the full non-truncated value as part of the `WI.DataGridNode`'s `data`. When copying,
+ use the full non-truncated value instead of what was shown in the DOM.
+
2019-04-15 Joseph Pecoraro <[email protected]>
Web Inspector: DOM Nodes should not show $0 when selected in Console area
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/DOMStorageContentView.js (244349 => 244350)
--- trunk/Source/WebInspectorUI/UserInterface/Views/DOMStorageContentView.js 2019-04-16 18:51:29 UTC (rev 244349)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/DOMStorageContentView.js 2019-04-16 19:02:23 UTC (rev 244350)
@@ -41,7 +41,11 @@
columns.key = {title: WI.UIString("Key"), sortable: true};
columns.value = {title: WI.UIString("Value"), sortable: true};
- this._dataGrid = new WI.DataGrid(columns, this._editingCallback.bind(this), this._deleteCallback.bind(this));
+ this._dataGrid = new WI.DataGrid(columns, {
+ editingCallback: this._editingCallback.bind(this),
+ copyCallback: this._dataGridCopy.bind(this),
+ deleteCallback: this._deleteCallback.bind(this),
+ });
this._dataGrid.sortOrder = WI.DataGrid.SortOrder.Ascending;
this._dataGrid.sortColumnIdentifier = "key";
this._dataGrid.createSettings("dom-storage-content-view");
@@ -85,6 +89,7 @@
itemAdded(event)
{
let {key, value} = event.data;
+ let originalValue = value;
value = this._truncateValue(value);
// Enforce key uniqueness.
@@ -93,7 +98,7 @@
return;
}
- this._dataGrid.appendChild(new WI.DataGridNode({key, value}, false));
+ this._dataGrid.appendChild(new WI.DataGridNode({key, value, originalValue}, false));
this._sortDataGrid();
}
@@ -100,6 +105,7 @@
itemUpdated(event)
{
let {key, value} = event.data;
+ let originalValue = value;
value = this._truncateValue(value);
let keyFound = false;
@@ -113,6 +119,7 @@
keyFound = true;
childNode.data.value = value;
+ childNode.data.originalValue = originalValue;
childNode.refresh();
}
}
@@ -136,8 +143,9 @@
if (!key || !value)
continue;
+ let originalValue = value;
value = this._truncateValue(value);
- let node = new WI.DataGridNode({key, value}, false);
+ let node = new WI.DataGridNode({key, value, originalValue}, false);
this._dataGrid.appendChild(node);
}
@@ -253,6 +261,13 @@
cleanup();
domStorage.setItem(key, value);
}
+
+ _dataGridCopy(node, columnIdentifier, text)
+ {
+ if (columnIdentifier === "value" && node.data.originalValue)
+ return node.data.originalValue;
+ return text;
+ }
};
WI.DOMStorageContentView.DuplicateKeyStyleClassName = "duplicate-key";
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/DataGrid.js (244349 => 244350)
--- trunk/Source/WebInspectorUI/UserInterface/Views/DataGrid.js 2019-04-16 18:51:29 UTC (rev 244349)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/DataGrid.js 2019-04-16 19:02:23 UTC (rev 244350)
@@ -25,7 +25,7 @@
WI.DataGrid = class DataGrid extends WI.View
{
- constructor(columnsData, editCallback, deleteCallback, preferredColumnOrder)
+ constructor(columnsData, {editCallback, copyCallback, deleteCallback, preferredColumnOrder} = {})
{
super();
@@ -109,6 +109,9 @@
this._editCallback = editCallback;
}
+ if (copyCallback)
+ this._copyCallback = copyCallback;
+
if (deleteCallback)
this._deleteCallback = deleteCallback;
@@ -168,7 +171,7 @@
};
}
- var dataGrid = new WI.DataGrid(columnsData, undefined, undefined, columnNames);
+ let dataGrid = new WI.DataGrid(columnsData, {preferredColumnOrder: columnNames});
for (var i = 0; i < values.length / numColumns; ++i) {
var data = ""
for (var j = 0; j < columnNames.length; ++j)
@@ -1697,7 +1700,12 @@
_copyTextForDataGridNode(node)
{
- let fields = node.dataGrid.orderedColumns.map((identifier) => this.textForDataGridNodeColumn(node, identifier));
+ let fields = node.dataGrid.orderedColumns.map((identifier) => {
+ let text = this.textForDataGridNodeColumn(node, identifier);
+ if (this._copyCallback)
+ text = this._copyCallback(node, identifier, text);
+ return text;
+ });
return fields.join(this._copyTextDelimiter);
}
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TimelineDataGrid.js (244349 => 244350)
--- trunk/Source/WebInspectorUI/UserInterface/Views/TimelineDataGrid.js 2019-04-16 18:51:29 UTC (rev 244349)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TimelineDataGrid.js 2019-04-16 19:02:23 UTC (rev 244350)
@@ -25,9 +25,9 @@
WI.TimelineDataGrid = class TimelineDataGrid extends WI.DataGrid
{
- constructor(columns, editCallback, deleteCallback)
+ constructor(columns)
{
- super(columns, editCallback, deleteCallback);
+ super(columns);
this.element.classList.add("timeline");