зеркало из https://github.com/mozilla/gecko-dev.git
change itemExists to check for the cache, then call _itemExists, that way subclasses can override just that without having to care about the cache
This commit is contained in:
Родитель
55a9524e8c
Коммит
88e70d14c6
|
@ -97,14 +97,21 @@ Store.prototype = {
|
|||
fn.async(this, onComplete, record);
|
||||
},
|
||||
|
||||
// override only if neccessary
|
||||
itemExists: function Store_itemExists(GUID) {
|
||||
if (GUID in this._lookup)
|
||||
itemExists: function Store_itemExists(id) {
|
||||
if (!this._itemCache)
|
||||
return this._itemExists(id);
|
||||
|
||||
if (id in this._itemCache)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
},
|
||||
|
||||
// subclasses probably want to override this one
|
||||
_itemExists: function Store__itemExists(id) {
|
||||
return false;
|
||||
},
|
||||
|
||||
cacheItemsHint: function Store_cacheItemsHint() {
|
||||
this._itemCache = this.wrap();
|
||||
},
|
||||
|
|
Загрузка…
Ссылка в новой задаче