| 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 11 matching lines...) Expand all Loading... |
| 22 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 22 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 28 */ | 28 */ |
| 29 | 29 |
| 30 /** | 30 /** |
| 31 * @constructor | 31 * @constructor |
| 32 * @extends {WebInspector.Object} |
| 32 * @param {string} securityOrigin | 33 * @param {string} securityOrigin |
| 33 * @param {boolean} isLocalStorage | 34 * @param {boolean} isLocalStorage |
| 34 */ | 35 */ |
| 35 WebInspector.DOMStorage = function(securityOrigin, isLocalStorage) | 36 WebInspector.DOMStorage = function(securityOrigin, isLocalStorage) |
| 36 { | 37 { |
| 37 this._securityOrigin = securityOrigin; | 38 this._securityOrigin = securityOrigin; |
| 38 this._isLocalStorage = isLocalStorage; | 39 this._isLocalStorage = isLocalStorage; |
| 39 this._storageHistory = new WebInspector.DOMStorageHistory(this); | 40 this._storageHistory = new WebInspector.DOMStorageHistory(this); |
| 40 } | 41 } |
| 41 | 42 |
| 42 /** | 43 /** |
| 43 * @param {string} securityOrigin | 44 * @param {string} securityOrigin |
| 44 * @param {boolean} isLocalStorage | 45 * @param {boolean} isLocalStorage |
| 45 * @return {DOMStorageAgent.StorageId} | 46 * @return {DOMStorageAgent.StorageId} |
| 46 */ | 47 */ |
| 47 WebInspector.DOMStorage.storageId = function(securityOrigin, isLocalStorage) | 48 WebInspector.DOMStorage.storageId = function(securityOrigin, isLocalStorage) |
| 48 { | 49 { |
| 49 return { securityOrigin: securityOrigin, isLocalStorage: isLocalStorage }; | 50 return { securityOrigin: securityOrigin, isLocalStorage: isLocalStorage }; |
| 50 } | 51 } |
| 51 | 52 |
| 53 WebInspector.DOMStorage.Events = { |
| 54 DOMStorageItemsCleared: "DOMStorageItemsCleared", |
| 55 DOMStorageItemRemoved: "DOMStorageItemRemoved", |
| 56 DOMStorageItemAdded: "DOMStorageItemAdded", |
| 57 DOMStorageItemUpdated: "DOMStorageItemUpdated" |
| 58 } |
| 59 |
| 52 WebInspector.DOMStorage.prototype = { | 60 WebInspector.DOMStorage.prototype = { |
| 53 | 61 |
| 54 /** @return {DOMStorageAgent.StorageId} */ | 62 /** @return {DOMStorageAgent.StorageId} */ |
| 55 get id() | 63 get id() |
| 56 { | 64 { |
| 57 return WebInspector.DOMStorage.storageId(this._securityOrigin, this._isL
ocalStorage); | 65 return WebInspector.DOMStorage.storageId(this._securityOrigin, this._isL
ocalStorage); |
| 58 }, | 66 }, |
| 59 | 67 |
| 60 /** @return {string} */ | 68 /** @return {string} */ |
| 61 get securityOrigin() | 69 get securityOrigin() |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 }, | 103 }, |
| 96 | 104 |
| 97 undo: function() | 105 undo: function() |
| 98 { | 106 { |
| 99 this._storageHistory.undo(); | 107 this._storageHistory.undo(); |
| 100 }, | 108 }, |
| 101 | 109 |
| 102 redo: function() | 110 redo: function() |
| 103 { | 111 { |
| 104 this._storageHistory.redo(); | 112 this._storageHistory.redo(); |
| 105 } | 113 }, |
| 114 |
| 115 __proto__: WebInspector.Object.prototype |
| 106 } | 116 } |
| 107 | 117 |
| 108 /** | 118 /** |
| 109 * @constructor | 119 * @constructor |
| 110 * @param {WebInspector.DOMStorage} domStorage | 120 * @param {WebInspector.DOMStorage} domStorage |
| 111 */ | 121 */ |
| 112 WebInspector.DOMStorageAction = function(domStorage) | 122 WebInspector.DOMStorageAction = function(domStorage) |
| 113 { | 123 { |
| 114 this._domStorage = domStorage; | 124 this._domStorage = domStorage; |
| 115 } | 125 } |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 /** @type {!Object.<string, !WebInspector.DOMStorage>} */ | 328 /** @type {!Object.<string, !WebInspector.DOMStorage>} */ |
| 319 this._storages = {}; | 329 this._storages = {}; |
| 320 InspectorBackend.registerDOMStorageDispatcher(new WebInspector.DOMStorageDis
patcher(this)); | 330 InspectorBackend.registerDOMStorageDispatcher(new WebInspector.DOMStorageDis
patcher(this)); |
| 321 DOMStorageAgent.enable(); | 331 DOMStorageAgent.enable(); |
| 322 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeMod
el.EventTypes.SecurityOriginAdded, this._securityOriginAdded, this); | 332 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeMod
el.EventTypes.SecurityOriginAdded, this._securityOriginAdded, this); |
| 323 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeMod
el.EventTypes.SecurityOriginRemoved, this._securityOriginRemoved, this); | 333 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeMod
el.EventTypes.SecurityOriginRemoved, this._securityOriginRemoved, this); |
| 324 } | 334 } |
| 325 | 335 |
| 326 WebInspector.DOMStorageModel.Events = { | 336 WebInspector.DOMStorageModel.Events = { |
| 327 DOMStorageAdded: "DOMStorageAdded", | 337 DOMStorageAdded: "DOMStorageAdded", |
| 328 DOMStorageRemoved: "DOMStorageRemoved", | 338 DOMStorageRemoved: "DOMStorageRemoved" |
| 329 DOMStorageItemsCleared: "DOMStorageItemsCleared", | |
| 330 DOMStorageItemRemoved: "DOMStorageItemRemoved", | |
| 331 DOMStorageItemAdded: "DOMStorageItemAdded", | |
| 332 DOMStorageItemUpdated: "DOMStorageItemUpdated" | |
| 333 } | 339 } |
| 334 | 340 |
| 335 WebInspector.DOMStorageModel.prototype = { | 341 WebInspector.DOMStorageModel.prototype = { |
| 336 | 342 |
| 337 /** | 343 /** |
| 338 * @param {WebInspector.Event} event | 344 * @param {WebInspector.Event} event |
| 339 */ | 345 */ |
| 340 _securityOriginAdded: function(event) | 346 _securityOriginAdded: function(event) |
| 341 { | 347 { |
| 342 var securityOrigin = /** @type {string} */ (event.data); | 348 var securityOrigin = /** @type {string} */ (event.data); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 { | 387 { |
| 382 return JSON.stringify(WebInspector.DOMStorage.storageId(securityOrigin,
isLocalStorage)); | 388 return JSON.stringify(WebInspector.DOMStorage.storageId(securityOrigin,
isLocalStorage)); |
| 383 }, | 389 }, |
| 384 | 390 |
| 385 /** | 391 /** |
| 386 * @param {DOMStorageAgent.StorageId} storageId | 392 * @param {DOMStorageAgent.StorageId} storageId |
| 387 */ | 393 */ |
| 388 _domStorageItemsCleared: function(storageId) | 394 _domStorageItemsCleared: function(storageId) |
| 389 { | 395 { |
| 390 var domStorage = this.storageForId(storageId); | 396 var domStorage = this.storageForId(storageId); |
| 391 var storageData = { | 397 if (!domStorage) |
| 392 storage: domStorage | 398 return; |
| 393 }; | 399 |
| 394 this.dispatchEventToListeners(WebInspector.DOMStorageModel.Events.DOMSto
rageItemsCleared, storageData); | 400 var eventData = {}; |
| 401 domStorage.dispatchEventToListeners(WebInspector.DOMStorage.Events.DOMSt
orageItemsCleared, eventData); |
| 395 }, | 402 }, |
| 396 | 403 |
| 397 /** | 404 /** |
| 398 * @param {DOMStorageAgent.StorageId} storageId | 405 * @param {DOMStorageAgent.StorageId} storageId |
| 399 * @param {string} key | 406 * @param {string} key |
| 400 */ | 407 */ |
| 401 _domStorageItemRemoved: function(storageId, key) | 408 _domStorageItemRemoved: function(storageId, key) |
| 402 { | 409 { |
| 403 var domStorage = this.storageForId(storageId); | 410 var domStorage = this.storageForId(storageId); |
| 404 var storageData = { | 411 if (!domStorage) |
| 405 storage: domStorage, | 412 return; |
| 406 key: key | 413 |
| 407 }; | 414 var eventData = { key: key }; |
| 408 this.dispatchEventToListeners(WebInspector.DOMStorageModel.Events.DOMSto
rageItemRemoved, storageData); | 415 domStorage.dispatchEventToListeners(WebInspector.DOMStorage.Events.DOMSt
orageItemRemoved, eventData); |
| 409 }, | 416 }, |
| 410 | 417 |
| 411 /** | 418 /** |
| 412 * @param {DOMStorageAgent.StorageId} storageId | 419 * @param {DOMStorageAgent.StorageId} storageId |
| 413 * @param {string} key | 420 * @param {string} key |
| 414 * @param {string} newValue | 421 * @param {string} value |
| 415 */ | 422 */ |
| 416 _domStorageItemAdded: function(storageId, key, newValue) | 423 _domStorageItemAdded: function(storageId, key, value) |
| 417 { | 424 { |
| 418 var domStorage = this.storageForId(storageId); | 425 var domStorage = this.storageForId(storageId); |
| 419 var storageData = { | 426 if (!domStorage) |
| 420 storage: domStorage, | 427 return; |
| 421 key: key, | 428 |
| 422 newValue: newValue | 429 var eventData = { key: key, value: value }; |
| 423 }; | 430 domStorage.dispatchEventToListeners(WebInspector.DOMStorage.Events.DOMSt
orageItemAdded, eventData); |
| 424 this.dispatchEventToListeners(WebInspector.DOMStorageModel.Events.DOMSto
rageItemAdded, storageData); | |
| 425 }, | 431 }, |
| 426 | 432 |
| 427 /** | 433 /** |
| 428 * @param {DOMStorageAgent.StorageId} storageId | 434 * @param {DOMStorageAgent.StorageId} storageId |
| 429 * @param {string} key | 435 * @param {string} key |
| 430 * @param {string} oldValue | 436 * @param {string} oldValue |
| 431 * @param {string} newValue | 437 * @param {string} value |
| 432 */ | 438 */ |
| 433 _domStorageItemUpdated: function(storageId, key, oldValue, newValue) | 439 _domStorageItemUpdated: function(storageId, key, oldValue, value) |
| 434 { | 440 { |
| 435 var domStorage = this.storageForId(storageId); | 441 var domStorage = this.storageForId(storageId); |
| 436 var storageData = { | 442 if (!domStorage) |
| 437 storage: domStorage, | 443 return; |
| 438 key: key, | 444 |
| 439 oldValue: oldValue, | 445 var eventData = { key: key, oldValue: oldValue, value: value }; |
| 440 newValue: newValue | 446 domStorage.dispatchEventToListeners(WebInspector.DOMStorage.Events.DOMSt
orageItemUpdated, eventData); |
| 441 }; | |
| 442 this.dispatchEventToListeners(WebInspector.DOMStorageModel.Events.DOMSto
rageItemUpdated, storageData); | |
| 443 }, | 447 }, |
| 444 | 448 |
| 445 /** | 449 /** |
| 446 * @param {DOMStorageAgent.StorageId} storageId | 450 * @param {DOMStorageAgent.StorageId} storageId |
| 447 * @return {WebInspector.DOMStorage} | 451 * @return {WebInspector.DOMStorage} |
| 448 */ | 452 */ |
| 449 storageForId: function(storageId) | 453 storageForId: function(storageId) |
| 450 { | 454 { |
| 451 return this._storages[JSON.stringify(storageId)]; | 455 return this._storages[JSON.stringify(storageId)]; |
| 452 }, | 456 }, |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 * @param {string} key | 494 * @param {string} key |
| 491 */ | 495 */ |
| 492 domStorageItemRemoved: function(storageId, key) | 496 domStorageItemRemoved: function(storageId, key) |
| 493 { | 497 { |
| 494 this._model._domStorageItemRemoved(storageId, key); | 498 this._model._domStorageItemRemoved(storageId, key); |
| 495 }, | 499 }, |
| 496 | 500 |
| 497 /** | 501 /** |
| 498 * @param {DOMStorageAgent.StorageId} storageId | 502 * @param {DOMStorageAgent.StorageId} storageId |
| 499 * @param {string} key | 503 * @param {string} key |
| 500 * @param {string} newValue | 504 * @param {string} value |
| 501 */ | 505 */ |
| 502 domStorageItemAdded: function(storageId, key, newValue) | 506 domStorageItemAdded: function(storageId, key, value) |
| 503 { | 507 { |
| 504 this._model._domStorageItemAdded(storageId, key, newValue); | 508 this._model._domStorageItemAdded(storageId, key, value); |
| 505 }, | 509 }, |
| 506 | 510 |
| 507 /** | 511 /** |
| 508 * @param {DOMStorageAgent.StorageId} storageId | 512 * @param {DOMStorageAgent.StorageId} storageId |
| 509 * @param {string} key | 513 * @param {string} key |
| 510 * @param {string} oldValue | 514 * @param {string} oldValue |
| 511 * @param {string} newValue | 515 * @param {string} value |
| 512 */ | 516 */ |
| 513 domStorageItemUpdated: function(storageId, key, oldValue, newValue) | 517 domStorageItemUpdated: function(storageId, key, oldValue, value) |
| 514 { | 518 { |
| 515 this._model._domStorageItemUpdated(storageId, key, oldValue, newValue); | 519 this._model._domStorageItemUpdated(storageId, key, oldValue, value); |
| 516 }, | 520 }, |
| 517 } | 521 } |
| 518 | 522 |
| 519 /** | 523 /** |
| 520 * @type {WebInspector.DOMStorageModel} | 524 * @type {WebInspector.DOMStorageModel} |
| 521 */ | 525 */ |
| 522 WebInspector.domStorageModel = null; | 526 WebInspector.domStorageModel = null; |
| OLD | NEW |