[webkit-changes] [WebKit/WebKit] 3db01e: Web Inspector: Truncated localStorage editing give...

Devin Rousso noreply at github.com
Wed May 17 12:26:51 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 3db01ec96898f9a730ba4ad44a10ca533b4bd1b2
      https://github.com/WebKit/WebKit/commit/3db01ec96898f9a730ba4ad44a10ca533b4bd1b2
  Author: Devin Rousso <hi at devinrousso.com>
  Date:   2023-05-17 (Wed, 17 May 2023)

  Changed paths:
    A LayoutTests/inspector/unit-tests/html-utilities-expected.txt
    A LayoutTests/inspector/unit-tests/html-utilities.html
    M Source/WebInspectorUI/UserInterface/Base/Utilities.js
    M Source/WebInspectorUI/UserInterface/Views/DOMStorageContentView.js
    M Source/WebInspectorUI/UserInterface/Views/DataGrid.js
    M Source/WebInspectorUI/UserInterface/Views/LocalResourceOverridePopover.js

  Log Message:
  -----------
  Web Inspector: Truncated localStorage editing gives an illusion of a proper edit and truncated string is saved
https://bugs.webkit.org/show_bug.cgi?id=203013

Reviewed by Patrick Angle.

This makes it impossible to edit large `localStorage`/`sessionStorage` values as the `WI.DataGridNode` only shows the first 200 characters.

* Source/WebInspectorUI/UserInterface/Views/DataGrid.js:
(WI.DataGrid.prototype.startEditingNode):
(WI.DataGrid.prototype._startEditingNodeAtColumnIndex):
(WI.DataGrid.prototype._startEditing):
(WI.DataGrid.prototype._editingCommitted):
(WI.DataGrid.prototype._keyDown):
(WI.DataGrid.prototype._contextMenuInDataTable):
Add support for a `beforeEditCallback` that allows the caller to do work on the `WI.DataGridNode` (and its `element`) before editing starts.

* Source/WebInspectorUI/UserInterface/Views/DOMStorageContentView.js:
(WI.DOMStorageContentView):
(WI.DOMStorageContentView.prototype.itemAdded):
(WI.DOMStorageContentView.prototype.itemUpdated):
(WI.DOMStorageContentView.prototype._populate):
(WI.DOMStorageContentView.prototype._beforeEditCallback): Added.
(WI.DOMStorageContentView.prototype._afterEditCallback): Renamed from `_editingCallback`.
(WI.DOMStorageContentView.prototype._dataGridCopy):
(WI.DOMStorageContentView.prototype._editingCallback.cleanup): Deleted.
(WI.DOMStorageContentView.prototype._editingCallback): Deleted.
Leverage the new `beforeEditCallback` to replace the contents of the `element` with the actual value before editing starts.
Drive-by: Rename `value` to `displayValue` since it's not the actual value of `localStorage`/`sessionStorage`.

* Source/WebInspectorUI/UserInterface/Views/LocalResourceOverridePopover.js:
(WI.LocalResourceOverridePopover.prototype.show):
Renamed `editCallback` to `afterEditCallback`.

* Source/WebInspectorUI/UserInterface/Base/Utilities.js:
(HTMLCollection.prototype.indexOf): Added.
Add a utility function to allow `HTMLCollection` to behave similar to `Array.prototype.indexOf`, allowing for the same code to work with both.

* LayoutTests/inspector/unit-tests/html-utilities.html: Added.
* LayoutTests/inspector/unit-tests/html-utilities-expected.txt: Added.

Canonical link: https://commits.webkit.org/264166@main




More information about the webkit-changes mailing list