Changeset 146057 in webkit


Ignore:
Timestamp:
Mar 18, 2013 5:52:47 AM (11 years ago)
Author:
eustas@chromium.org
Message:

Web Inspector: [Resources] Local Storage: duplicate keys are processed inappropriately.
https://bugs.webkit.org/show_bug.cgi?id=112402

Reviewed by Alexander Pavlov.

When user creates new items or renames existing one some existing item
may be overriden. If value is changed, then frontend will receive
notification and update record appropriately.

If item value hasn't been changed, then no notification comes.
But UI still expect / rely on this notification.

With this patch the "no notification" scenario is fixed:
duplicate items are removed.

Another scenario is when update notification comes when we started
editing value (after entering / renaming key). In this case
selected node should not be changed to leave user in editing mode.

  • inspector/front-end/DOMStorageItemsView.js:

Added workarounds for "no notification" and "useless notification".

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r146056 r146057  
     12013-03-18  Eugene Klyuchnikov  <eustas@chromium.org>
     2
     3        Web Inspector: [Resources] Local Storage: duplicate keys are processed inappropriately.
     4        https://bugs.webkit.org/show_bug.cgi?id=112402
     5
     6        Reviewed by Alexander Pavlov.
     7
     8        When user creates new items or renames existing one some existing item
     9        may be overriden. If value is changed, then frontend will receive
     10        notification and update record appropriately.
     11
     12        If item value hasn't been changed, then no notification comes.
     13        But UI still expect / rely on this notification.
     14
     15        With this patch the "no notification" scenario is fixed:
     16        duplicate items are removed.
     17
     18        Another scenario is when update notification comes when we started
     19        editing value (after entering / renaming key). In this case
     20        selected node should not be changed to leave user in editing mode.
     21
     22        * inspector/front-end/DOMStorageItemsView.js:
     23        Added workarounds for "no notification" and "useless notification".
     24
    1252013-03-18  Allan Sandfeld Jensen  <allan.jensen@digia.com>
    226
  • trunk/Source/WebCore/inspector/front-end/DOMStorageItemsView.js

    r145901 r146057  
    152152                }
    153153                keyFound = true;
    154                 childNode.data.value = storageData.newValue;
    155                 childNode.refresh();
    156                 childNode.select();
    157                 childNode.reveal();
     154                if (childNode.data.value !== storageData.newValue) {
     155                    childNode.data.value = storageData.newValue;
     156                    childNode.refresh();
     157                    childNode.select();
     158                    childNode.reveal();
     159                }
    158160                this.deleteButton.visible = true;
    159161            }
     
    228230            if (oldText)
    229231                domStorage.removeItem(oldText);
    230 
    231232            domStorage.setItem(newText, editingNode.data.value);
     233            this._removeDupes(editingNode);
    232234        } else
    233235            domStorage.setItem(editingNode.data.key, newText);
    234236    },
    235237
     238    /**
     239     * @param {!WebInspector.DataGridNode} masterNode
     240     */
     241    _removeDupes: function(masterNode)
     242    {
     243        var rootNode = this._dataGrid.rootNode();
     244        var children = rootNode.children;
     245        for (var i = children.length - 1; i >= 0; --i) {
     246            var childNode = children[i];
     247            if ((childNode.data.key === masterNode.data.key) && (masterNode !== childNode))
     248                rootNode.removeChild(childNode);
     249        }
     250    },
     251
    236252    _deleteCallback: function(node)
    237253    {
Note: See TracChangeset for help on using the changeset viewer.