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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/resources/DOMStorageModel.js

Issue 2632553002: [DevTools] Clear local storage (Closed)
Patch Set: Addressed comments, moved the toolbar. 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Nokia Inc. All rights reserved. 2 * Copyright (C) 2008 Nokia Inc. All rights reserved.
3 * Copyright (C) 2013 Samsung Electronics. All rights reserved. 3 * Copyright (C) 2013 Samsung Electronics. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 setItem(key, value) { 81 setItem(key, value) {
82 this._model._agent.setDOMStorageItem(this.id, key, value); 82 this._model._agent.setDOMStorageItem(this.id, key, value);
83 } 83 }
84 84
85 /** 85 /**
86 * @param {string} key 86 * @param {string} key
87 */ 87 */
88 removeItem(key) { 88 removeItem(key) {
89 this._model._agent.removeDOMStorageItem(this.id, key); 89 this._model._agent.removeDOMStorageItem(this.id, key);
90 } 90 }
91
92 clear() {
93 if (!this.isLocalStorage)
pfeldman 2017/01/19 23:38:45 Why?
eostroukhov 2017/01/20 19:24:00 Can't wipe session storage.
pfeldman 2017/01/20 19:27:31 sessionStorage.clear() works just fine for me.
eostroukhov 2017/01/20 19:45:49 Not sure what you are talking about. Open the Verg
94 return;
95 this._model._storageAgent.clearDataForOrigin(this._securityOrigin, 'local_st orage');
96 this._model._domStorageItemsCleared(this.id);
97 }
91 }; 98 };
92 99
93 100
94 /** @enum {symbol} */ 101 /** @enum {symbol} */
95 Resources.DOMStorage.Events = { 102 Resources.DOMStorage.Events = {
96 DOMStorageItemsCleared: Symbol('DOMStorageItemsCleared'), 103 DOMStorageItemsCleared: Symbol('DOMStorageItemsCleared'),
97 DOMStorageItemRemoved: Symbol('DOMStorageItemRemoved'), 104 DOMStorageItemRemoved: Symbol('DOMStorageItemRemoved'),
98 DOMStorageItemAdded: Symbol('DOMStorageItemAdded'), 105 DOMStorageItemAdded: Symbol('DOMStorageItemAdded'),
99 DOMStorageItemUpdated: Symbol('DOMStorageItemUpdated') 106 DOMStorageItemUpdated: Symbol('DOMStorageItemUpdated')
100 }; 107 };
101 108
102 /** 109 /**
103 * @unrestricted 110 * @unrestricted
104 */ 111 */
105 Resources.DOMStorageModel = class extends SDK.SDKModel { 112 Resources.DOMStorageModel = class extends SDK.SDKModel {
106 /** 113 /**
107 * @param {!SDK.Target} target 114 * @param {!SDK.Target} target
108 * @param {!SDK.SecurityOriginManager} securityOriginManager 115 * @param {!SDK.SecurityOriginManager} securityOriginManager
109 */ 116 */
110 constructor(target, securityOriginManager) { 117 constructor(target, securityOriginManager) {
111 super(Resources.DOMStorageModel, target); 118 super(Resources.DOMStorageModel, target);
112 119
113 this._securityOriginManager = securityOriginManager; 120 this._securityOriginManager = securityOriginManager;
114 /** @type {!Object.<string, !Resources.DOMStorage>} */ 121 /** @type {!Object.<string, !Resources.DOMStorage>} */
115 this._storages = {}; 122 this._storages = {};
116 this._agent = target.domstorageAgent(); 123 this._agent = target.domstorageAgent();
124 this._storageAgent = target.storageAgent();
117 } 125 }
118 126
119 /** 127 /**
120 * @param {!SDK.Target} target 128 * @param {!SDK.Target} target
121 * @return {!Resources.DOMStorageModel} 129 * @return {!Resources.DOMStorageModel}
122 */ 130 */
123 static fromTarget(target) { 131 static fromTarget(target) {
124 var model = target.model(Resources.DOMStorageModel); 132 var model = target.model(Resources.DOMStorageModel);
125 if (!model) 133 if (!model)
126 model = new Resources.DOMStorageModel(target, SDK.SecurityOriginManager.fr omTarget(target)); 134 model = new Resources.DOMStorageModel(target, SDK.SecurityOriginManager.fr omTarget(target));
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 * @param {string} key 344 * @param {string} key
337 * @param {string} oldValue 345 * @param {string} oldValue
338 * @param {string} value 346 * @param {string} value
339 */ 347 */
340 domStorageItemUpdated(storageId, key, oldValue, value) { 348 domStorageItemUpdated(storageId, key, oldValue, value) {
341 this._model._domStorageItemUpdated(storageId, key, oldValue, value); 349 this._model._domStorageItemUpdated(storageId, key, oldValue, value);
342 } 350 }
343 }; 351 };
344 352
345 Resources.DOMStorageModel._symbol = Symbol('DomStorage'); 353 Resources.DOMStorageModel._symbol = Symbol('DomStorage');
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698