OLD | NEW |
---|---|
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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
105 undo: function() | 105 undo: function() |
106 { | 106 { |
107 this._storageHistory.undo(); | 107 this._storageHistory.undo(); |
108 }, | 108 }, |
109 | 109 |
110 redo: function() | 110 redo: function() |
111 { | 111 { |
112 this._storageHistory.redo(); | 112 this._storageHistory.redo(); |
113 }, | 113 }, |
114 | 114 |
115 resetUndoHistory: function() | |
116 { | |
117 this._storageHistory.reset(); | |
118 }, | |
119 | |
115 __proto__: WebInspector.Object.prototype | 120 __proto__: WebInspector.Object.prototype |
116 } | 121 } |
117 | 122 |
118 /** | 123 /** |
119 * @constructor | 124 * @constructor |
120 * @param {WebInspector.DOMStorage} domStorage | 125 * @param {WebInspector.DOMStorage} domStorage |
121 */ | 126 */ |
122 WebInspector.DOMStorageAction = function(domStorage) | 127 WebInspector.DOMStorageAction = function(domStorage) |
123 { | 128 { |
124 this._domStorage = domStorage; | 129 this._domStorage = domStorage; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
174 this.redo(); | 179 this.redo(); |
175 callback(); | 180 callback(); |
176 } | 181 } |
177 }, | 182 }, |
178 | 183 |
179 /** | 184 /** |
180 * @override | 185 * @override |
181 */ | 186 */ |
182 undo: function() | 187 undo: function() |
183 { | 188 { |
189 this._domStorage._inspectorInitiated = true; | |
184 DOMStorageAgent.setDOMStorageItem(this._domStorage.id, this._key, this._ value); | 190 DOMStorageAgent.setDOMStorageItem(this._domStorage.id, this._key, this._ value); |
185 }, | 191 }, |
186 | 192 |
187 /** | 193 /** |
188 * @override | 194 * @override |
189 */ | 195 */ |
190 redo: function() | 196 redo: function() |
191 { | 197 { |
198 this._domStorage._inspectorInitiated = true; | |
192 DOMStorageAgent.removeDOMStorageItem(this._domStorage.id, this._key); | 199 DOMStorageAgent.removeDOMStorageItem(this._domStorage.id, this._key); |
193 }, | 200 }, |
194 | 201 |
195 __proto__: WebInspector.DOMStorageAction.prototype | 202 __proto__: WebInspector.DOMStorageAction.prototype |
196 } | 203 } |
197 | 204 |
198 /** | 205 /** |
199 * @constructor | 206 * @constructor |
200 * @extends {WebInspector.DOMStorageAction} | 207 * @extends {WebInspector.DOMStorageAction} |
201 * @param {WebInspector.DOMStorage} domStorage | 208 * @param {WebInspector.DOMStorage} domStorage |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
235 this.redo(); | 242 this.redo(); |
236 callback(); | 243 callback(); |
237 } | 244 } |
238 }, | 245 }, |
239 | 246 |
240 /** | 247 /** |
241 * @override | 248 * @override |
242 */ | 249 */ |
243 undo: function() | 250 undo: function() |
244 { | 251 { |
252 this._domStorage._inspectorInitiated = true; | |
245 if (!this._exists) | 253 if (!this._exists) |
246 DOMStorageAgent.removeDOMStorageItem(this._domStorage.id, this._key) ; | 254 DOMStorageAgent.removeDOMStorageItem(this._domStorage.id, this._key) ; |
247 else | 255 else |
248 DOMStorageAgent.setDOMStorageItem(this._domStorage.id, this._key, th is._oldValue); | 256 DOMStorageAgent.setDOMStorageItem(this._domStorage.id, this._key, th is._oldValue); |
249 }, | 257 }, |
250 | 258 |
251 /** | 259 /** |
252 * @override | 260 * @override |
253 */ | 261 */ |
254 redo: function() | 262 redo: function() |
255 { | 263 { |
264 this._domStorage._inspectorInitiated = true; | |
256 DOMStorageAgent.setDOMStorageItem(this._domStorage.id, this._key, this._ value); | 265 DOMStorageAgent.setDOMStorageItem(this._domStorage.id, this._key, this._ value); |
257 }, | 266 }, |
258 | 267 |
259 __proto__: WebInspector.DOMStorageAction.prototype | 268 __proto__: WebInspector.DOMStorageAction.prototype |
260 } | 269 } |
261 | 270 |
262 /** | 271 /** |
263 * @constructor | 272 * @constructor |
264 * @param {WebInspector.DOMStorage} domStorage | 273 * @param {WebInspector.DOMStorage} domStorage |
265 */ | 274 */ |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
309 }, | 318 }, |
310 | 319 |
311 redo: function() | 320 redo: function() |
312 { | 321 { |
313 if (this._undoableActionIndex >= this._actions.length - 1) | 322 if (this._undoableActionIndex >= this._actions.length - 1) |
314 return; | 323 return; |
315 | 324 |
316 var action = this._actions[++this._undoableActionIndex]; | 325 var action = this._actions[++this._undoableActionIndex]; |
317 console.assert(action); | 326 console.assert(action); |
318 action.redo(); | 327 action.redo(); |
328 }, | |
329 | |
330 reset: function() | |
331 { | |
332 this._actions.splice(0, this._actions.length); | |
333 this._undoableActionIndex = -1; | |
319 } | 334 } |
320 } | 335 } |
321 | 336 |
322 /** | 337 /** |
323 * @constructor | 338 * @constructor |
324 * @extends {WebInspector.Object} | 339 * @extends {WebInspector.Object} |
325 */ | 340 */ |
326 WebInspector.DOMStorageModel = function() | 341 WebInspector.DOMStorageModel = function() |
327 { | 342 { |
328 /** @type {!Object.<string, !WebInspector.DOMStorage>} */ | 343 /** @type {!Object.<string, !WebInspector.DOMStorage>} */ |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
389 }, | 404 }, |
390 | 405 |
391 /** | 406 /** |
392 * @param {DOMStorageAgent.StorageId} storageId | 407 * @param {DOMStorageAgent.StorageId} storageId |
393 */ | 408 */ |
394 _domStorageItemsCleared: function(storageId) | 409 _domStorageItemsCleared: function(storageId) |
395 { | 410 { |
396 var domStorage = this.storageForId(storageId); | 411 var domStorage = this.storageForId(storageId); |
397 if (!domStorage) | 412 if (!domStorage) |
398 return; | 413 return; |
414 if (typeof domStorage._inspectorInitiated === "undefined") | |
415 domStorage.resetUndoHistory(); | |
416 delete domStorage._inspectorInitiated; | |
399 | 417 |
400 var eventData = {}; | 418 var eventData = {}; |
401 domStorage.dispatchEventToListeners(WebInspector.DOMStorage.Events.DOMSt orageItemsCleared, eventData); | 419 domStorage.dispatchEventToListeners(WebInspector.DOMStorage.Events.DOMSt orageItemsCleared, eventData); |
402 }, | 420 }, |
403 | 421 |
404 /** | 422 /** |
405 * @param {DOMStorageAgent.StorageId} storageId | 423 * @param {DOMStorageAgent.StorageId} storageId |
406 * @param {string} key | 424 * @param {string} key |
407 */ | 425 */ |
408 _domStorageItemRemoved: function(storageId, key) | 426 _domStorageItemRemoved: function(storageId, key) |
409 { | 427 { |
410 var domStorage = this.storageForId(storageId); | 428 var domStorage = this.storageForId(storageId); |
411 if (!domStorage) | 429 if (!domStorage) |
412 return; | 430 return; |
431 if (typeof domStorage._inspectorInitiated === "undefined") | |
432 domStorage.resetUndoHistory(); | |
pfeldman
2013/08/27 14:27:34
Due to async nature of things, it is not necessari
| |
433 delete domStorage._inspectorInitiated; | |
413 | 434 |
414 var eventData = { key: key }; | 435 var eventData = { key: key }; |
415 domStorage.dispatchEventToListeners(WebInspector.DOMStorage.Events.DOMSt orageItemRemoved, eventData); | 436 domStorage.dispatchEventToListeners(WebInspector.DOMStorage.Events.DOMSt orageItemRemoved, eventData); |
416 }, | 437 }, |
417 | 438 |
418 /** | 439 /** |
419 * @param {DOMStorageAgent.StorageId} storageId | 440 * @param {DOMStorageAgent.StorageId} storageId |
420 * @param {string} key | 441 * @param {string} key |
421 * @param {string} value | 442 * @param {string} value |
422 */ | 443 */ |
423 _domStorageItemAdded: function(storageId, key, value) | 444 _domStorageItemAdded: function(storageId, key, value) |
424 { | 445 { |
425 var domStorage = this.storageForId(storageId); | 446 var domStorage = this.storageForId(storageId); |
426 if (!domStorage) | 447 if (!domStorage) |
427 return; | 448 return; |
449 if (typeof domStorage._inspectorInitiated === "undefined") | |
450 domStorage.resetUndoHistory(); | |
451 delete domStorage._inspectorInitiated; | |
428 | 452 |
429 var eventData = { key: key, value: value }; | 453 var eventData = { key: key, value: value }; |
430 domStorage.dispatchEventToListeners(WebInspector.DOMStorage.Events.DOMSt orageItemAdded, eventData); | 454 domStorage.dispatchEventToListeners(WebInspector.DOMStorage.Events.DOMSt orageItemAdded, eventData); |
431 }, | 455 }, |
432 | 456 |
433 /** | 457 /** |
434 * @param {DOMStorageAgent.StorageId} storageId | 458 * @param {DOMStorageAgent.StorageId} storageId |
435 * @param {string} key | 459 * @param {string} key |
436 * @param {string} oldValue | 460 * @param {string} oldValue |
437 * @param {string} value | 461 * @param {string} value |
438 */ | 462 */ |
439 _domStorageItemUpdated: function(storageId, key, oldValue, value) | 463 _domStorageItemUpdated: function(storageId, key, oldValue, value) |
440 { | 464 { |
441 var domStorage = this.storageForId(storageId); | 465 var domStorage = this.storageForId(storageId); |
442 if (!domStorage) | 466 if (!domStorage) |
443 return; | 467 return; |
468 if (typeof domStorage._inspectorInitiated === "undefined") | |
469 domStorage.resetUndoHistory(); | |
470 delete domStorage._inspectorInitiated; | |
444 | 471 |
445 var eventData = { key: key, oldValue: oldValue, value: value }; | 472 var eventData = { key: key, oldValue: oldValue, value: value }; |
446 domStorage.dispatchEventToListeners(WebInspector.DOMStorage.Events.DOMSt orageItemUpdated, eventData); | 473 domStorage.dispatchEventToListeners(WebInspector.DOMStorage.Events.DOMSt orageItemUpdated, eventData); |
447 }, | 474 }, |
448 | 475 |
449 /** | 476 /** |
450 * @param {DOMStorageAgent.StorageId} storageId | 477 * @param {DOMStorageAgent.StorageId} storageId |
451 * @return {WebInspector.DOMStorage} | 478 * @return {WebInspector.DOMStorage} |
452 */ | 479 */ |
453 storageForId: function(storageId) | 480 storageForId: function(storageId) |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
517 domStorageItemUpdated: function(storageId, key, oldValue, value) | 544 domStorageItemUpdated: function(storageId, key, oldValue, value) |
518 { | 545 { |
519 this._model._domStorageItemUpdated(storageId, key, oldValue, value); | 546 this._model._domStorageItemUpdated(storageId, key, oldValue, value); |
520 }, | 547 }, |
521 } | 548 } |
522 | 549 |
523 /** | 550 /** |
524 * @type {WebInspector.DOMStorageModel} | 551 * @type {WebInspector.DOMStorageModel} |
525 */ | 552 */ |
526 WebInspector.domStorageModel = null; | 553 WebInspector.domStorageModel = null; |
OLD | NEW |