Index: Source/devtools/front_end/DOMStorage.js |
diff --git a/Source/devtools/front_end/DOMStorage.js b/Source/devtools/front_end/DOMStorage.js |
index 6cc203b922206f47442f561b80638f302ff6845a..8cf169f694d7cd7ef0a46c912be69630adeb0cc0 100644 |
--- a/Source/devtools/front_end/DOMStorage.js |
+++ b/Source/devtools/front_end/DOMStorage.js |
@@ -112,6 +112,11 @@ WebInspector.DOMStorage.prototype = { |
this._storageHistory.redo(); |
}, |
+ resetUndoHistory: function() |
+ { |
+ this._storageHistory.reset(); |
+ }, |
+ |
__proto__: WebInspector.Object.prototype |
} |
@@ -181,6 +186,7 @@ WebInspector.DOMStorageRemoveItemAction.prototype = { |
*/ |
undo: function() |
{ |
+ this._domStorage._inspectorInitiated = true; |
DOMStorageAgent.setDOMStorageItem(this._domStorage.id, this._key, this._value); |
}, |
@@ -189,6 +195,7 @@ WebInspector.DOMStorageRemoveItemAction.prototype = { |
*/ |
redo: function() |
{ |
+ this._domStorage._inspectorInitiated = true; |
DOMStorageAgent.removeDOMStorageItem(this._domStorage.id, this._key); |
}, |
@@ -242,6 +249,7 @@ WebInspector.DOMStorageSetItemAction.prototype = { |
*/ |
undo: function() |
{ |
+ this._domStorage._inspectorInitiated = true; |
if (!this._exists) |
DOMStorageAgent.removeDOMStorageItem(this._domStorage.id, this._key); |
else |
@@ -253,6 +261,7 @@ WebInspector.DOMStorageSetItemAction.prototype = { |
*/ |
redo: function() |
{ |
+ this._domStorage._inspectorInitiated = true; |
DOMStorageAgent.setDOMStorageItem(this._domStorage.id, this._key, this._value); |
}, |
@@ -316,6 +325,12 @@ WebInspector.DOMStorageHistory.prototype = { |
var action = this._actions[++this._undoableActionIndex]; |
console.assert(action); |
action.redo(); |
+ }, |
+ |
+ reset: function() |
+ { |
+ this._actions.splice(0, this._actions.length); |
+ this._undoableActionIndex = -1; |
} |
} |
@@ -396,6 +411,9 @@ WebInspector.DOMStorageModel.prototype = { |
var domStorage = this.storageForId(storageId); |
if (!domStorage) |
return; |
+ if (typeof domStorage._inspectorInitiated === "undefined") |
+ domStorage.resetUndoHistory(); |
+ delete domStorage._inspectorInitiated; |
var eventData = {}; |
domStorage.dispatchEventToListeners(WebInspector.DOMStorage.Events.DOMStorageItemsCleared, eventData); |
@@ -410,6 +428,9 @@ WebInspector.DOMStorageModel.prototype = { |
var domStorage = this.storageForId(storageId); |
if (!domStorage) |
return; |
+ if (typeof domStorage._inspectorInitiated === "undefined") |
+ domStorage.resetUndoHistory(); |
pfeldman
2013/08/27 14:27:34
Due to async nature of things, it is not necessari
|
+ delete domStorage._inspectorInitiated; |
var eventData = { key: key }; |
domStorage.dispatchEventToListeners(WebInspector.DOMStorage.Events.DOMStorageItemRemoved, eventData); |
@@ -425,6 +446,9 @@ WebInspector.DOMStorageModel.prototype = { |
var domStorage = this.storageForId(storageId); |
if (!domStorage) |
return; |
+ if (typeof domStorage._inspectorInitiated === "undefined") |
+ domStorage.resetUndoHistory(); |
+ delete domStorage._inspectorInitiated; |
var eventData = { key: key, value: value }; |
domStorage.dispatchEventToListeners(WebInspector.DOMStorage.Events.DOMStorageItemAdded, eventData); |
@@ -441,6 +465,9 @@ WebInspector.DOMStorageModel.prototype = { |
var domStorage = this.storageForId(storageId); |
if (!domStorage) |
return; |
+ if (typeof domStorage._inspectorInitiated === "undefined") |
+ domStorage.resetUndoHistory(); |
+ delete domStorage._inspectorInitiated; |
var eventData = { key: key, oldValue: oldValue, value: value }; |
domStorage.dispatchEventToListeners(WebInspector.DOMStorage.Events.DOMStorageItemUpdated, eventData); |