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

Unified Diff: third_party/WebKit/Source/devtools/front_end/resources/ResourcesPanel.js

Issue 2632553002: [DevTools] Clear local storage (Closed)
Patch Set: Created 3 years, 11 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: third_party/WebKit/Source/devtools/front_end/resources/ResourcesPanel.js
diff --git a/third_party/WebKit/Source/devtools/front_end/resources/ResourcesPanel.js b/third_party/WebKit/Source/devtools/front_end/resources/ResourcesPanel.js
index de4043087fd4342c1da10823079617c4d12179cb..f300c52aaa5e276e72dc4969b4cd9a7905af85a9 100644
--- a/third_party/WebKit/Source/devtools/front_end/resources/ResourcesPanel.js
+++ b/third_party/WebKit/Source/devtools/front_end/resources/ResourcesPanel.js
@@ -580,6 +580,20 @@ Resources.ResourcesPanel = class extends UI.PanelWithSidebar {
}
/**
+ * @param {!Resources.DOMStorage} domStorage
+ */
+ _clearDOMStorage(domStorage) {
+ if (!domStorage)
+ return;
+
+ var view = this._domStorageViews.get(domStorage);
+ if (view)
+ view.clear();
+ else
+ domStorage.clear();
+ }
+
+ /**
* @param {!Resources.CookieTreeElement} treeElement
* @param {string} cookieDomain
*/
@@ -1902,6 +1916,25 @@ Resources.DOMStorageTreeElement = class extends Resources.BaseStorageTreeElement
this._storagePanel._showDOMStorage(this._domStorage);
return false;
}
+
+ /**
+ * @override
+ */
+ onattach() {
+ super.onattach();
+ this.listItemElement.addEventListener('contextmenu', this._handleContextMenuEvent.bind(this), true);
pfeldman 2017/01/13 18:51:25 Drop context menu.
eostroukhov 2017/01/19 00:42:10 I do not see any harm in having this menu item - s
+ }
+
+ _handleContextMenuEvent(event) {
+ var contextMenu = new UI.ContextMenu(event);
+ if (this._domStorage.isLocalStorage)
+ contextMenu.appendItem(Common.UIString('Clear'), this._clearDOMStorage.bind(this));
+ contextMenu.show();
+ }
+
+ _clearDOMStorage() {
+ this._storagePanel._clearDOMStorage(this._domStorage);
+ }
};
/**

Powered by Google App Engine
This is Rietveld 408576698