Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1384)

Unified Diff: Source/devtools/front_end/DOMStorage.js

Issue 22346003: DevTools: DOMStorage should notify the view about storage modifications instead of DOMStorageModel (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Review comments addressed! Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/devtools/front_end/DOMStorage.js
diff --git a/Source/devtools/front_end/DOMStorage.js b/Source/devtools/front_end/DOMStorage.js
index fc68b6a307f0b46e20e25cd16d21d191fc5e985a..6cc203b922206f47442f561b80638f302ff6845a 100644
--- a/Source/devtools/front_end/DOMStorage.js
+++ b/Source/devtools/front_end/DOMStorage.js
@@ -29,6 +29,7 @@
/**
* @constructor
+ * @extends {WebInspector.Object}
* @param {string} securityOrigin
* @param {boolean} isLocalStorage
*/
@@ -49,6 +50,13 @@ WebInspector.DOMStorage.storageId = function(securityOrigin, isLocalStorage)
return { securityOrigin: securityOrigin, isLocalStorage: isLocalStorage };
}
+WebInspector.DOMStorage.Events = {
+ DOMStorageItemsCleared: "DOMStorageItemsCleared",
+ DOMStorageItemRemoved: "DOMStorageItemRemoved",
+ DOMStorageItemAdded: "DOMStorageItemAdded",
+ DOMStorageItemUpdated: "DOMStorageItemUpdated"
+}
+
WebInspector.DOMStorage.prototype = {
/** @return {DOMStorageAgent.StorageId} */
@@ -102,7 +110,9 @@ WebInspector.DOMStorage.prototype = {
redo: function()
{
this._storageHistory.redo();
- }
+ },
+
+ __proto__: WebInspector.Object.prototype
}
/**
@@ -325,11 +335,7 @@ WebInspector.DOMStorageModel = function()
WebInspector.DOMStorageModel.Events = {
DOMStorageAdded: "DOMStorageAdded",
- DOMStorageRemoved: "DOMStorageRemoved",
- DOMStorageItemsCleared: "DOMStorageItemsCleared",
- DOMStorageItemRemoved: "DOMStorageItemRemoved",
- DOMStorageItemAdded: "DOMStorageItemAdded",
- DOMStorageItemUpdated: "DOMStorageItemUpdated"
+ DOMStorageRemoved: "DOMStorageRemoved"
}
WebInspector.DOMStorageModel.prototype = {
@@ -388,10 +394,11 @@ WebInspector.DOMStorageModel.prototype = {
_domStorageItemsCleared: function(storageId)
{
var domStorage = this.storageForId(storageId);
- var storageData = {
- storage: domStorage
- };
- this.dispatchEventToListeners(WebInspector.DOMStorageModel.Events.DOMStorageItemsCleared, storageData);
+ if (!domStorage)
+ return;
+
+ var eventData = {};
+ domStorage.dispatchEventToListeners(WebInspector.DOMStorage.Events.DOMStorageItemsCleared, eventData);
},
/**
@@ -401,45 +408,42 @@ WebInspector.DOMStorageModel.prototype = {
_domStorageItemRemoved: function(storageId, key)
{
var domStorage = this.storageForId(storageId);
- var storageData = {
- storage: domStorage,
- key: key
- };
- this.dispatchEventToListeners(WebInspector.DOMStorageModel.Events.DOMStorageItemRemoved, storageData);
+ if (!domStorage)
+ return;
+
+ var eventData = { key: key };
+ domStorage.dispatchEventToListeners(WebInspector.DOMStorage.Events.DOMStorageItemRemoved, eventData);
},
/**
* @param {DOMStorageAgent.StorageId} storageId
* @param {string} key
- * @param {string} newValue
+ * @param {string} value
*/
- _domStorageItemAdded: function(storageId, key, newValue)
+ _domStorageItemAdded: function(storageId, key, value)
{
var domStorage = this.storageForId(storageId);
- var storageData = {
- storage: domStorage,
- key: key,
- newValue: newValue
- };
- this.dispatchEventToListeners(WebInspector.DOMStorageModel.Events.DOMStorageItemAdded, storageData);
+ if (!domStorage)
+ return;
+
+ var eventData = { key: key, value: value };
+ domStorage.dispatchEventToListeners(WebInspector.DOMStorage.Events.DOMStorageItemAdded, eventData);
},
/**
* @param {DOMStorageAgent.StorageId} storageId
* @param {string} key
* @param {string} oldValue
- * @param {string} newValue
+ * @param {string} value
*/
- _domStorageItemUpdated: function(storageId, key, oldValue, newValue)
+ _domStorageItemUpdated: function(storageId, key, oldValue, value)
{
var domStorage = this.storageForId(storageId);
- var storageData = {
- storage: domStorage,
- key: key,
- oldValue: oldValue,
- newValue: newValue
- };
- this.dispatchEventToListeners(WebInspector.DOMStorageModel.Events.DOMStorageItemUpdated, storageData);
+ if (!domStorage)
+ return;
+
+ var eventData = { key: key, oldValue: oldValue, value: value };
+ domStorage.dispatchEventToListeners(WebInspector.DOMStorage.Events.DOMStorageItemUpdated, eventData);
},
/**
@@ -497,22 +501,22 @@ WebInspector.DOMStorageDispatcher.prototype = {
/**
* @param {DOMStorageAgent.StorageId} storageId
* @param {string} key
- * @param {string} newValue
+ * @param {string} value
*/
- domStorageItemAdded: function(storageId, key, newValue)
+ domStorageItemAdded: function(storageId, key, value)
{
- this._model._domStorageItemAdded(storageId, key, newValue);
+ this._model._domStorageItemAdded(storageId, key, value);
},
/**
* @param {DOMStorageAgent.StorageId} storageId
* @param {string} key
* @param {string} oldValue
- * @param {string} newValue
+ * @param {string} value
*/
- domStorageItemUpdated: function(storageId, key, oldValue, newValue)
+ domStorageItemUpdated: function(storageId, key, oldValue, value)
{
- this._model._domStorageItemUpdated(storageId, key, oldValue, newValue);
+ this._model._domStorageItemUpdated(storageId, key, oldValue, value);
},
}
« no previous file with comments | « LayoutTests/inspector/storage-panel-dom-storage-update.html ('k') | Source/devtools/front_end/DOMStorageItemsView.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698