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

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

Issue 1960663003: DevTools: introduce the Clear storage pane in the resources panel. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tests fixed Created 4 years, 7 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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 this._agent.enable(); 137 this._agent.enable();
138 138
139 var securityOrigins = this.target().resourceTreeModel.securityOrigins(); 139 var securityOrigins = this.target().resourceTreeModel.securityOrigins();
140 for (var i = 0; i < securityOrigins.length; ++i) 140 for (var i = 0; i < securityOrigins.length; ++i)
141 this._addOrigin(securityOrigins[i]); 141 this._addOrigin(securityOrigins[i]);
142 142
143 this._enabled = true; 143 this._enabled = true;
144 }, 144 },
145 145
146 /** 146 /**
147 * @param {string} origin
148 */
149 clearForOrigin: function(origin)
150 {
151 if (!this._enabled)
152 return;
153 this._removeOrigin(origin);
154 this._addOrigin(origin);
155 },
156
157 /**
147 * @param {!WebInspector.Event} event 158 * @param {!WebInspector.Event} event
148 */ 159 */
149 _securityOriginAdded: function(event) 160 _securityOriginAdded: function(event)
150 { 161 {
151 this._addOrigin(/** @type {string} */ (event.data)); 162 this._addOrigin(/** @type {string} */ (event.data));
152 }, 163 },
153 164
154
155 /** 165 /**
156 * @param {string} securityOrigin 166 * @param {string} securityOrigin
157 */ 167 */
158 _addOrigin: function(securityOrigin) 168 _addOrigin: function(securityOrigin)
159 { 169 {
160 var localStorageKey = this._storageKey(securityOrigin, true); 170 var localStorageKey = this._storageKey(securityOrigin, true);
161 console.assert(!this._storages[localStorageKey]); 171 console.assert(!this._storages[localStorageKey]);
162 var localStorage = new WebInspector.DOMStorage(this, securityOrigin, tru e); 172 var localStorage = new WebInspector.DOMStorage(this, securityOrigin, tru e);
163 this._storages[localStorageKey] = localStorage; 173 this._storages[localStorageKey] = localStorage;
164 this.dispatchEventToListeners(WebInspector.DOMStorageModel.Events.DOMSto rageAdded, localStorage); 174 this.dispatchEventToListeners(WebInspector.DOMStorageModel.Events.DOMSto rageAdded, localStorage);
165 175
166 var sessionStorageKey = this._storageKey(securityOrigin, false); 176 var sessionStorageKey = this._storageKey(securityOrigin, false);
167 console.assert(!this._storages[sessionStorageKey]); 177 console.assert(!this._storages[sessionStorageKey]);
168 var sessionStorage = new WebInspector.DOMStorage(this, securityOrigin, f alse); 178 var sessionStorage = new WebInspector.DOMStorage(this, securityOrigin, f alse);
169 this._storages[sessionStorageKey] = sessionStorage; 179 this._storages[sessionStorageKey] = sessionStorage;
170 this.dispatchEventToListeners(WebInspector.DOMStorageModel.Events.DOMSto rageAdded, sessionStorage); 180 this.dispatchEventToListeners(WebInspector.DOMStorageModel.Events.DOMSto rageAdded, sessionStorage);
171 }, 181 },
172 182
173 /** 183 /**
174 * @param {!WebInspector.Event} event 184 * @param {!WebInspector.Event} event
175 */ 185 */
176 _securityOriginRemoved: function(event) 186 _securityOriginRemoved: function(event)
177 { 187 {
178 var securityOrigin = /** @type {string} */ (event.data); 188 this._removeOrigin(/** @type {string} */ (event.data));
189 },
190
191 /**
192 * @param {string} securityOrigin
193 */
194 _removeOrigin: function(securityOrigin)
195 {
179 var localStorageKey = this._storageKey(securityOrigin, true); 196 var localStorageKey = this._storageKey(securityOrigin, true);
180 var localStorage = this._storages[localStorageKey]; 197 var localStorage = this._storages[localStorageKey];
181 console.assert(localStorage); 198 console.assert(localStorage);
182 delete this._storages[localStorageKey]; 199 delete this._storages[localStorageKey];
183 this.dispatchEventToListeners(WebInspector.DOMStorageModel.Events.DOMSto rageRemoved, localStorage); 200 this.dispatchEventToListeners(WebInspector.DOMStorageModel.Events.DOMSto rageRemoved, localStorage);
184 201
185 var sessionStorageKey = this._storageKey(securityOrigin, false); 202 var sessionStorageKey = this._storageKey(securityOrigin, false);
186 var sessionStorage = this._storages[sessionStorageKey]; 203 var sessionStorage = this._storages[sessionStorageKey];
187 console.assert(sessionStorage); 204 console.assert(sessionStorage);
188 delete this._storages[sessionStorageKey]; 205 delete this._storages[sessionStorageKey];
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 * @param {!WebInspector.Target} target 357 * @param {!WebInspector.Target} target
341 * @return {!WebInspector.DOMStorageModel} 358 * @return {!WebInspector.DOMStorageModel}
342 */ 359 */
343 WebInspector.DOMStorageModel.fromTarget = function(target) 360 WebInspector.DOMStorageModel.fromTarget = function(target)
344 { 361 {
345 if (!target[WebInspector.DOMStorageModel._symbol]) 362 if (!target[WebInspector.DOMStorageModel._symbol])
346 target[WebInspector.DOMStorageModel._symbol] = new WebInspector.DOMStora geModel(target); 363 target[WebInspector.DOMStorageModel._symbol] = new WebInspector.DOMStora geModel(target);
347 364
348 return target[WebInspector.DOMStorageModel._symbol]; 365 return target[WebInspector.DOMStorageModel._symbol];
349 } 366 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698