Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/DataModel/EncryptedRemoteObject.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/gamma/js/Clipperz/PM/DataModel/EncryptedRemoteObject.js | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/EncryptedRemoteObject.js b/frontend/gamma/js/Clipperz/PM/DataModel/EncryptedRemoteObject.js index cdeec8b..1aa7a52 100644 --- a/frontend/gamma/js/Clipperz/PM/DataModel/EncryptedRemoteObject.js +++ b/frontend/gamma/js/Clipperz/PM/DataModel/EncryptedRemoteObject.js | |||
@@ -1,118 +1,116 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | try { if (typeof(Clipperz.KeyValueObjectStore) == 'undefined') { throw ""; }} catch (e) { | 24 | try { if (typeof(Clipperz.KeyValueObjectStore) == 'undefined') { throw ""; }} catch (e) { |
27 | throw "Clipperz.PM.DataModel.EncryptedRemoteObject depends on Clipperz.KeyValueObjectStore!"; | 25 | throw "Clipperz.PM.DataModel.EncryptedRemoteObject depends on Clipperz.KeyValueObjectStore!"; |
28 | } | 26 | } |
29 | 27 | ||
30 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 28 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
31 | if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } | 29 | if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } |
32 | 30 | ||
33 | Clipperz.PM.DataModel.EncryptedRemoteObject = function(args) { | 31 | Clipperz.PM.DataModel.EncryptedRemoteObject = function(args) { |
34 | args = args || {}; | 32 | args = args || {}; |
35 | 33 | ||
36 | this._name = args.name || null; | 34 | this._name = args.name || null; |
37 | this._reference = args.reference || Clipperz.PM.Crypto.randomKey(); | 35 | this._reference = args.reference || Clipperz.PM.Crypto.randomKey(); |
38 | this._isBrandNew = ((args.reference == null) && (args.remoteData == null)); | 36 | this._isBrandNew = ((args.reference == null) && (args.remoteData == null)); |
39 | 37 | ||
40 | if ((this._isBrandNew == false) && (args['retrieveKeyFunction'] == null)) { | 38 | if ((this._isBrandNew == false) && (args['retrieveKeyFunction'] == null)) { |
41 | Clipperz.Base.exception.raise('MandatoryParameter'); | 39 | Clipperz.Base.exception.raise('MandatoryParameter'); |
42 | } else { | 40 | } else { |
43 | this._retrieveKeyFunction = args['retrieveKeyFunction']; | 41 | this._retrieveKeyFunction = args['retrieveKeyFunction']; |
44 | } | 42 | } |
45 | 43 | ||
46 | this._retrieveRemoteDataFunction = args.retrieveRemoteDataFunction|| null; | 44 | this._retrieveRemoteDataFunction = args.retrieveRemoteDataFunction|| null; |
47 | this._remoteData = args.remoteData || null; | 45 | this._remoteData = args.remoteData || null; |
48 | // this._remoteData = args.remoteData ? Clipperz.Base.deepClone(args.remoteData) : null; | 46 | // this._remoteData = args.remoteData ? Clipperz.Base.deepClone(args.remoteData) : null; |
49 | if ((!this._isBrandNew) && ((this._retrieveRemoteDataFunction == null) && (this._remoteData == null))) { | 47 | if ((!this._isBrandNew) && ((this._retrieveRemoteDataFunction == null) && (this._remoteData == null))) { |
50 | Clipperz.Base.exception.raise('MandatoryParameter'); | 48 | Clipperz.Base.exception.raise('MandatoryParameter'); |
51 | } | 49 | } |
52 | 50 | ||
53 | 51 | ||
54 | this._encryptedDataKeypath = args.encryptedDataKeypath || 'data'; //Clipperz.Base.exception.raise('MandatoryParameter'); | 52 | this._encryptedDataKeypath = args.encryptedDataKeypath || 'data'; //Clipperz.Base.exception.raise('MandatoryParameter'); |
55 | this._encryptedVersionKeypath = args.encryptedVersionKeypath || 'version';//Clipperz.Base.exception.raise('MandatoryParameter'); | 53 | this._encryptedVersionKeypath = args.encryptedVersionKeypath || 'version';//Clipperz.Base.exception.raise('MandatoryParameter'); |
56 | 54 | ||
57 | 55 | ||
58 | this._transientState = null; | 56 | this._transientState = null; |
59 | this._deferredLocks = {}; | 57 | this._deferredLocks = {}; |
60 | 58 | ||
61 | if (this._isBrandNew == true) { | 59 | if (this._isBrandNew == true) { |
62 | this._objectDataStore = new Clipperz.KeyValueObjectStore(/*{'name':'EncryptedRemoteObject.objectDataStore [1]'}*/); | 60 | this._objectDataStore = new Clipperz.KeyValueObjectStore(/*{'name':'EncryptedRemoteObject.objectDataStore [1]'}*/); |
63 | } else { | 61 | } else { |
64 | this._objectDataStore = null; | 62 | this._objectDataStore = null; |
65 | } | 63 | } |
66 | 64 | ||
67 | return this; | 65 | return this; |
68 | } | 66 | } |
69 | 67 | ||
70 | // | 68 | // |
71 | // Basic data workflow | 69 | // Basic data workflow |
72 | //======================= | 70 | //======================= |
73 | // | 71 | // |
74 | //getRemoteData | 72 | //getRemoteData |
75 | // unpackRemoteData | 73 | // unpackRemoteData |
76 | // getDecryptData [encryptedDataKeypath, encryptedVersionKeypath] | 74 | // getDecryptData [encryptedDataKeypath, encryptedVersionKeypath] |
77 | // unpackData | 75 | // unpackData |
78 | // | 76 | // |
79 | // | 77 | // |
80 | // ?? packData | 78 | // ?? packData |
81 | // ?? encryptDataWithKey | 79 | // ?? encryptDataWithKey |
82 | // ??packRemoteData [encryptedDataKeypath (?), encryptedVersionKeypath (?)] | 80 | // ??packRemoteData [encryptedDataKeypath (?), encryptedVersionKeypath (?)] |
83 | // | 81 | // |
84 | 82 | ||
85 | Clipperz.PM.DataModel.EncryptedRemoteObject.prototype = MochiKit.Base.update(null, { | 83 | Clipperz.PM.DataModel.EncryptedRemoteObject.prototype = MochiKit.Base.update(null, { |
86 | 84 | ||
87 | 'toString': function () { | 85 | 'toString': function () { |
88 | return "Clipperz.PM.DataModel.EncryptedRemoteObject" + (this.name() != null ? " - " + this.name() : ""); | 86 | return "Clipperz.PM.DataModel.EncryptedRemoteObject" + (this.name() != null ? " - " + this.name() : ""); |
89 | }, | 87 | }, |
90 | 88 | ||
91 | //------------------------------------------------------------------------- | 89 | //------------------------------------------------------------------------- |
92 | 90 | ||
93 | 'name': function () { | 91 | 'name': function () { |
94 | return this._name; | 92 | return this._name; |
95 | }, | 93 | }, |
96 | 94 | ||
97 | //------------------------------------------------------------------------- | 95 | //------------------------------------------------------------------------- |
98 | 96 | ||
99 | 'reference': function () { | 97 | 'reference': function () { |
100 | return this._reference; | 98 | return this._reference; |
101 | }, | 99 | }, |
102 | 100 | ||
103 | 'setReference': function (aValue) { | 101 | 'setReference': function (aValue) { |
104 | this._reference = aValue; | 102 | this._reference = aValue; |
105 | 103 | ||
106 | return this._reference; | 104 | return this._reference; |
107 | }, | 105 | }, |
108 | 106 | ||
109 | //------------------------------------------------------------------------- | 107 | //------------------------------------------------------------------------- |
110 | 108 | ||
111 | 'transientState': function () { | 109 | 'transientState': function () { |
112 | if (this._transientState == null) { | 110 | if (this._transientState == null) { |
113 | this._transientState = new Clipperz.KeyValueObjectStore(/*{'name':'EncryptedRemoteObject.transientState [2]'}*/); | 111 | this._transientState = new Clipperz.KeyValueObjectStore(/*{'name':'EncryptedRemoteObject.transientState [2]'}*/); |
114 | } | 112 | } |
115 | 113 | ||
116 | return this._transientState; | 114 | return this._transientState; |
117 | }, | 115 | }, |
118 | 116 | ||
@@ -318,196 +316,192 @@ Clipperz.PM.DataModel.EncryptedRemoteObject.prototype = MochiKit.Base.update(nul | |||
318 | MochiKit.Base.method(this, '_getObjectDataStore'), | 316 | MochiKit.Base.method(this, '_getObjectDataStore'), |
319 | MochiKit.Base.methodcaller('values') | 317 | MochiKit.Base.methodcaller('values') |
320 | ], {trace:false}); | 318 | ], {trace:false}); |
321 | }, | 319 | }, |
322 | 320 | ||
323 | 'setValues': function (someValues) { | 321 | 'setValues': function (someValues) { |
324 | return Clipperz.Async.callbacks("EncryptedRemoteObject.values", [ | 322 | return Clipperz.Async.callbacks("EncryptedRemoteObject.values", [ |
325 | MochiKit.Base.method(this, '_getObjectDataStore'), | 323 | MochiKit.Base.method(this, '_getObjectDataStore'), |
326 | MochiKit.Base.methodcaller('setValues', someValues) | 324 | MochiKit.Base.methodcaller('setValues', someValues) |
327 | ], {trace:false}); | 325 | ], {trace:false}); |
328 | }, | 326 | }, |
329 | 327 | ||
330 | //......................................................................... | 328 | //......................................................................... |
331 | 329 | ||
332 | '_getObjectDataStore': function () { | 330 | '_getObjectDataStore': function () { |
333 | var deferredResult; | 331 | var deferredResult; |
334 | var deferredLock; | 332 | var deferredLock; |
335 | 333 | ||
336 | deferredLock = this.getDeferredLockForKey('objectDataStore'); | 334 | deferredLock = this.getDeferredLockForKey('objectDataStore'); |
337 | 335 | ||
338 | deferredResult = new Clipperz.Async.Deferred("EncryptedRemoteObject._getObjectDataStore", {trace:false}); | 336 | deferredResult = new Clipperz.Async.Deferred("EncryptedRemoteObject._getObjectDataStore", {trace:false}); |
339 | deferredResult.acquireLock(deferredLock); | 337 | deferredResult.acquireLock(deferredLock); |
340 | deferredResult.addCallback(MochiKit.Base.bind(function () { | 338 | deferredResult.addCallback(MochiKit.Base.bind(function () { |
341 | var innerDeferredResult; | 339 | var innerDeferredResult; |
342 | 340 | ||
343 | if (this._objectDataStore == null) { | 341 | if (this._objectDataStore == null) { |
344 | this._objectDataStore = new Clipperz.KeyValueObjectStore(/*{'name':'EncryptedRemoteObject.objectDataStore [4]'}*/); | 342 | this._objectDataStore = new Clipperz.KeyValueObjectStore(/*{'name':'EncryptedRemoteObject.objectDataStore [4]'}*/); |
345 | 343 | ||
346 | innerDeferredResult = new Clipperz.Async.Deferred("EncryptedRemoteObject._getObjectDataStore <inner deferred>", {trace:false}); | 344 | innerDeferredResult = new Clipperz.Async.Deferred("EncryptedRemoteObject._getObjectDataStore <inner deferred>", {trace:false}); |
347 | innerDeferredResult.addMethod(this, 'getDecryptedData'); | 345 | innerDeferredResult.addMethod(this, 'getDecryptedData'); |
348 | innerDeferredResult.addMethod(this._objectDataStore, 'initWithValues'); | 346 | innerDeferredResult.addMethod(this._objectDataStore, 'initWithValues'); |
349 | innerDeferredResult.callback(); | 347 | innerDeferredResult.callback(); |
350 | } else { | 348 | } else { |
351 | innerDeferredResult = MochiKit.Async.succeed(this._objectDataStore); | 349 | innerDeferredResult = MochiKit.Async.succeed(this._objectDataStore); |
352 | } | 350 | } |
353 | 351 | ||
354 | return innerDeferredResult; | 352 | return innerDeferredResult; |
355 | }, this)); | 353 | }, this)); |
356 | deferredResult.releaseLock(deferredLock); | 354 | deferredResult.releaseLock(deferredLock); |
357 | deferredResult.callback(); | 355 | deferredResult.callback(); |
358 | 356 | ||
359 | return deferredResult; | 357 | return deferredResult; |
360 | }, | 358 | }, |
361 | 359 | ||
362 | 'hasInitiatedObjectDataStore': function () { | 360 | 'hasInitiatedObjectDataStore': function () { |
363 | return (this._objectDataStore != null); | 361 | return (this._objectDataStore != null); |
364 | }, | 362 | }, |
365 | 363 | ||
366 | //------------------------------------------------------------------------- | 364 | //------------------------------------------------------------------------- |
367 | 365 | ||
368 | 'getDeferredLockForKey': function (aKey) { | 366 | 'getDeferredLockForKey': function (aKey) { |
369 | var result; | 367 | var result; |
370 | 368 | ||
371 | result = this._deferredLocks[aKey]; | 369 | result = this._deferredLocks[aKey]; |
372 | 370 | ||
373 | if (typeof(result) == 'undefined') { | 371 | if (typeof(result) == 'undefined') { |
374 | result = new MochiKit.Async.DeferredLock(); | 372 | result = new MochiKit.Async.DeferredLock(); |
375 | this._deferredLocks[aKey] = result; | 373 | this._deferredLocks[aKey] = result; |
376 | } | 374 | } |
377 | 375 | ||
378 | return result; | 376 | return result; |
379 | }, | 377 | }, |
380 | 378 | ||
381 | //------------------------------------------------------------------------- | 379 | //------------------------------------------------------------------------- |
382 | 380 | ||
383 | 'unpackData': function (someData) { //++ | 381 | 'unpackData': function (someData) { //++ |
384 | return someData; | 382 | return someData; |
385 | }, | 383 | }, |
386 | 384 | ||
387 | 'packData': function (someData) { //++ | 385 | 'packData': function (someData) { //++ |
388 | return someData; | 386 | return someData; |
389 | }, | 387 | }, |
390 | 388 | ||
391 | //------------------------------------------------------------------------- | 389 | //------------------------------------------------------------------------- |
392 | 390 | ||
393 | 'hasPendingChanges': function () { | 391 | 'hasPendingChanges': function () { |
394 | var deferredResult; | 392 | var deferredResult; |
395 | var tempObj = this; | 393 | var tempObj = this; |
396 | 394 | ||
397 | if (this.isBrandNew()) { | 395 | if (this.isBrandNew()) { |
398 | // deferredResult = MochiKit.Async.succeed(true); | 396 | // deferredResult = MochiKit.Async.succeed(true); |
399 | deferredResult = this.hasPendingChangesWhenBrandNew(); | 397 | deferredResult = this.hasPendingChangesWhenBrandNew(); |
400 | } else if (this.hasInitiatedObjectDataStore()) { | 398 | } else if (this.hasInitiatedObjectDataStore()) { |
401 | deferredResult = new Clipperz.Async.Deferred("EncryptedRemoteObject.hasPendingChanges", {trace:false}); | 399 | deferredResult = new Clipperz.Async.Deferred("EncryptedRemoteObject.hasPendingChanges", {trace:false}); |
402 | deferredResult.collectResults({ | 400 | deferredResult.collectResults({ |
403 | 'decryptedData': [ | 401 | 'decryptedData': [ |
404 | MochiKit.Base.method(this, 'getDecryptedData'), | 402 | MochiKit.Base.method(this, 'getDecryptedData'), |
405 | Clipperz.Base.serializeJSON | 403 | Clipperz.Base.serializeJSON |
406 | ], | 404 | ], |
407 | 'objectData': [ | 405 | 'objectData': [ |
408 | MochiKit.Base.method(this, '_getObjectDataStore'), | 406 | MochiKit.Base.method(this, '_getObjectDataStore'), |
409 | MochiKit.Base.methodcaller('values'), | 407 | MochiKit.Base.methodcaller('values'), |
410 | Clipperz.Base.serializeJSON | 408 | Clipperz.Base.serializeJSON |
411 | ] | 409 | ] |
412 | }); | 410 | }); |
413 | deferredResult.addCallback(function (someValues) { | 411 | deferredResult.addCallback(function (someValues) { |
414 | //if (someValues['decryptedData'] != someValues['objectData']) { | ||
415 | //console.log("ORIGINAL DATA", '[[[' + someValues['decryptedData'] + ']]]'); | ||
416 | //console.log("CURRENT DATA", '>>>' + someValues['objectData'] + '<<<'); | ||
417 | //} | ||
418 | return (someValues['decryptedData'] != someValues['objectData']); | 412 | return (someValues['decryptedData'] != someValues['objectData']); |
419 | }); | 413 | }); |
420 | deferredResult.callback(); | 414 | deferredResult.callback(); |
421 | } else { | 415 | } else { |
422 | deferredResult = MochiKit.Async.succeed(false); | 416 | deferredResult = MochiKit.Async.succeed(false); |
423 | } | 417 | } |
424 | 418 | ||
425 | return deferredResult; | 419 | return deferredResult; |
426 | }, | 420 | }, |
427 | 421 | ||
428 | 'hasPendingChangesWhenBrandNew': function () { | 422 | 'hasPendingChangesWhenBrandNew': function () { |
429 | return MochiKit.Async.succeed(true); | 423 | return MochiKit.Async.succeed(true); |
430 | }, | 424 | }, |
431 | 425 | ||
432 | //------------------------------------------------------------------------- | 426 | //------------------------------------------------------------------------- |
433 | 427 | ||
434 | 'commitTransientState': function () { | 428 | 'commitTransientState': function () { |
435 | var deferredResult; | 429 | var deferredResult; |
436 | 430 | ||
437 | // if (this.transientState().getValue('__prepareRemoteData') == true) { | 431 | // if (this.transientState().getValue('__prepareRemoteData') == true) { |
438 | if (this.transientState().getValue('packedRemoteData') != null) { | 432 | if (this.transientState().getValue('packedRemoteData') != null) { |
439 | deferredResult = Clipperz.Async.callbacks("EncryptedRemoteObject.commitTransientState - prepareRemoteData", [ | 433 | deferredResult = Clipperz.Async.callbacks("EncryptedRemoteObject.commitTransientState - prepareRemoteData", [ |
440 | MochiKit.Base.bind(function (someData) { | 434 | MochiKit.Base.bind(function (someData) { |
441 | this._remoteData = this.transientState().getValue('packedRemoteData'); | 435 | this._remoteData = this.transientState().getValue('packedRemoteData'); |
442 | }, this), | 436 | }, this), |
443 | 437 | ||
444 | MochiKit.Base.method(this, '_getObjectDataStore'), | 438 | MochiKit.Base.method(this, '_getObjectDataStore'), |
445 | MochiKit.Base.methodcaller('values'), | 439 | MochiKit.Base.methodcaller('values'), |
446 | Clipperz.Base.deepClone, | 440 | Clipperz.Base.deepClone, |
447 | MochiKit.Base.method(this.decryptedDataStore(), 'setValue', 'decryptedData'), | 441 | MochiKit.Base.method(this.decryptedDataStore(), 'setValue', 'decryptedData'), |
448 | 442 | ||
449 | MochiKit.Base.method(this, 'resetTransientState', true) | 443 | MochiKit.Base.method(this, 'resetTransientState', true) |
450 | ], {trace:false}); | 444 | ], {trace:false}); |
451 | 445 | ||
452 | } else { | 446 | } else { |
453 | deferredResult = Clipperz.Async.callbacks("EncryptedRemoteObject.commitTransientState - NO prepareRemoteData", [ | 447 | deferredResult = Clipperz.Async.callbacks("EncryptedRemoteObject.commitTransientState - NO prepareRemoteData", [ |
454 | MochiKit.Base.method(this, 'resetTransientState', true) | 448 | MochiKit.Base.method(this, 'resetTransientState', true) |
455 | ], {trace:false}); | 449 | ], {trace:false}); |
456 | } | 450 | } |
457 | 451 | ||
458 | this._isBrandNew = false; | 452 | this._isBrandNew = false; |
459 | 453 | ||
460 | return deferredResult; | 454 | return deferredResult; |
461 | }, | 455 | }, |
462 | 456 | ||
463 | //------------------------------------------------------------------------- | 457 | //------------------------------------------------------------------------- |
464 | 458 | ||
465 | 'revertChanges': function () { | 459 | 'revertChanges': function () { |
466 | if (this.hasInitiatedObjectDataStore()) { | 460 | if (this.hasInitiatedObjectDataStore()) { |
467 | this._objectDataStore.removeAllData(); | 461 | this._objectDataStore.removeAllData(); |
468 | this._objectDataStore = null; | 462 | this._objectDataStore = null; |
469 | } | 463 | } |
470 | this.resetTransientState(false); | 464 | this.resetTransientState(false); |
471 | 465 | ||
472 | return MochiKit.Async.succeed(); | 466 | return MochiKit.Async.succeed(); |
473 | }, | 467 | }, |
474 | 468 | ||
475 | //------------------------------------------------------------------------- | 469 | //------------------------------------------------------------------------- |
476 | 470 | ||
477 | 'deleteAllCleanTextData': function () { | 471 | 'deleteAllCleanTextData': function () { |
478 | var deferredResult; | 472 | var deferredResult; |
479 | 473 | ||
480 | deferredResult = new Clipperz.Async.Deferred("EncryptedRemoteObject.deleteAllCleanTextData", {trace:false}); | 474 | deferredResult = new Clipperz.Async.Deferred("EncryptedRemoteObject.deleteAllCleanTextData", {trace:false}); |
481 | 475 | ||
482 | deferredResult.addMethod(this, 'resetTransientState', false); | 476 | deferredResult.addMethod(this, 'resetTransientState', false); |
483 | 477 | ||
484 | deferredResult.acquireLock(this.getDeferredLockForKey('decryptedData')); | 478 | deferredResult.acquireLock(this.getDeferredLockForKey('decryptedData')); |
485 | deferredResult.addCallback(MochiKit.Base.bind(function () { | 479 | deferredResult.addCallback(MochiKit.Base.bind(function () { |
486 | if (this._decryptedDataStore != null) { | 480 | if (this._decryptedDataStore != null) { |
487 | this._decryptedDataStore.removeAllData(); | 481 | this._decryptedDataStore.removeAllData(); |
488 | } | 482 | } |
489 | }, this)); | 483 | }, this)); |
490 | deferredResult.releaseLock(this.getDeferredLockForKey('decryptedData')); | 484 | deferredResult.releaseLock(this.getDeferredLockForKey('decryptedData')); |
491 | 485 | ||
492 | deferredResult.acquireLock(this.getDeferredLockForKey('objectDataStore')); | 486 | deferredResult.acquireLock(this.getDeferredLockForKey('objectDataStore')); |
493 | deferredResult.addCallback(MochiKit.Base.bind(function () { | 487 | deferredResult.addCallback(MochiKit.Base.bind(function () { |
494 | if (this._objectDataStore != null) { | 488 | if (this._objectDataStore != null) { |
495 | this._objectDataStore.removeAllData(); | 489 | this._objectDataStore.removeAllData(); |
496 | this._objectDataStore = null; | 490 | this._objectDataStore = null; |
497 | } | 491 | } |
498 | }, this)); | 492 | }, this)); |
499 | deferredResult.releaseLock(this.getDeferredLockForKey('objectDataStore')); | 493 | deferredResult.releaseLock(this.getDeferredLockForKey('objectDataStore')); |
500 | 494 | ||
501 | deferredResult.callback(); | 495 | deferredResult.callback(); |
502 | 496 | ||
503 | return deferredResult; | 497 | return deferredResult; |
504 | }, | 498 | }, |
505 | 499 | ||
506 | //......................................................................... | 500 | //......................................................................... |
507 | 501 | ||
508 | 'hasAnyCleanTextData': function () { | 502 | 'hasAnyCleanTextData': function () { |
509 | var result; | 503 | var result; |
510 | 504 | ||
511 | result = false; | 505 | result = false; |
512 | 506 | ||
513 | result = result || (! this.decryptedDataStore().isEmpty()); | 507 | result = result || (! this.decryptedDataStore().isEmpty()); |