2015-06-03 15:04:00 +03:00
|
|
|
/* jshint moz: true, esnext: true */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
2019-01-17 21:18:31 +03:00
|
|
|
const {IndexedDBHelper} = ChromeUtils.import("resource://gre/modules/IndexedDBHelper.jsm");
|
|
|
|
const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
2018-05-26 03:02:29 +03:00
|
|
|
XPCOMUtils.defineLazyGlobalGetters(this, ["indexedDB"]);
|
2015-06-03 15:04:00 +03:00
|
|
|
|
2018-02-23 22:50:01 +03:00
|
|
|
var EXPORTED_SYMBOLS = ["PushDB"];
|
2015-06-03 15:04:00 +03:00
|
|
|
|
2015-11-10 00:58:32 +03:00
|
|
|
XPCOMUtils.defineLazyGetter(this, "console", () => {
|
2019-01-17 21:18:31 +03:00
|
|
|
let {ConsoleAPI} = ChromeUtils.import("resource://gre/modules/Console.jsm");
|
2015-11-10 00:58:32 +03:00
|
|
|
return new ConsoleAPI({
|
|
|
|
maxLogLevelPref: "dom.push.loglevel",
|
|
|
|
prefix: "PushDB",
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2018-02-23 22:50:01 +03:00
|
|
|
function PushDB(dbName, dbVersion, dbStoreName, keyPath, model) {
|
2015-11-10 00:58:32 +03:00
|
|
|
console.debug("PushDB()");
|
2015-06-03 15:04:00 +03:00
|
|
|
this._dbStoreName = dbStoreName;
|
2015-06-26 00:52:57 +03:00
|
|
|
this._keyPath = keyPath;
|
|
|
|
this._model = model;
|
2015-06-03 15:04:00 +03:00
|
|
|
|
|
|
|
// set the indexeddb database
|
|
|
|
this.initDBHelper(dbName, dbVersion,
|
|
|
|
[dbStoreName]);
|
2018-02-23 22:50:01 +03:00
|
|
|
}
|
2015-06-03 15:04:00 +03:00
|
|
|
|
|
|
|
this.PushDB.prototype = {
|
|
|
|
__proto__: IndexedDBHelper.prototype,
|
|
|
|
|
2015-06-26 00:52:57 +03:00
|
|
|
toPushRecord: function(record) {
|
|
|
|
if (!record) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
return new this._model(record);
|
|
|
|
},
|
|
|
|
|
|
|
|
isValidRecord: function(record) {
|
|
|
|
return record && typeof record.scope == "string" &&
|
|
|
|
typeof record.originAttributes == "string" &&
|
|
|
|
record.quota >= 0 &&
|
|
|
|
typeof record[this._keyPath] == "string";
|
|
|
|
},
|
|
|
|
|
2015-06-03 15:04:00 +03:00
|
|
|
upgradeSchema: function(aTransaction, aDb, aOldVersion, aNewVersion) {
|
2015-06-26 00:52:57 +03:00
|
|
|
if (aOldVersion <= 3) {
|
|
|
|
//XXXnsm We haven't shipped Push during this upgrade, so I'm just going to throw old
|
|
|
|
//registrations away without even informing the app.
|
|
|
|
if (aDb.objectStoreNames.contains(this._dbStoreName)) {
|
|
|
|
aDb.deleteObjectStore(this._dbStoreName);
|
|
|
|
}
|
|
|
|
|
|
|
|
let objectStore = aDb.createObjectStore(this._dbStoreName,
|
|
|
|
{ keyPath: this._keyPath });
|
|
|
|
|
|
|
|
// index to fetch records based on endpoints. used by unregister
|
|
|
|
objectStore.createIndex("pushEndpoint", "pushEndpoint", { unique: true });
|
|
|
|
|
|
|
|
// index to fetch records by identifiers.
|
|
|
|
// In the current security model, the originAttributes distinguish between
|
|
|
|
// different 'apps' on the same origin. Since ServiceWorkers are
|
|
|
|
// same-origin to the scope they are registered for, the attributes and
|
|
|
|
// scope are enough to reconstruct a valid principal.
|
|
|
|
objectStore.createIndex("identifiers", ["scope", "originAttributes"], { unique: true });
|
|
|
|
objectStore.createIndex("originAttributes", "originAttributes", { unique: false });
|
|
|
|
}
|
|
|
|
|
|
|
|
if (aOldVersion < 4) {
|
|
|
|
let objectStore = aTransaction.objectStore(this._dbStoreName);
|
|
|
|
|
|
|
|
// index to fetch active and expired registrations.
|
|
|
|
objectStore.createIndex("quota", "quota", { unique: false });
|
2015-06-03 15:04:00 +03:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
/*
|
2015-06-03 15:06:00 +03:00
|
|
|
* @param aRecord
|
2015-06-03 15:04:00 +03:00
|
|
|
* The record to be added.
|
|
|
|
*/
|
|
|
|
|
2015-06-03 15:06:00 +03:00
|
|
|
put: function(aRecord) {
|
2015-11-10 00:58:32 +03:00
|
|
|
console.debug("put()", aRecord);
|
2015-06-26 00:52:57 +03:00
|
|
|
if (!this.isValidRecord(aRecord)) {
|
|
|
|
return Promise.reject(new TypeError(
|
|
|
|
"Scope, originAttributes, and quota are required! " +
|
|
|
|
JSON.stringify(aRecord)
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
2015-06-03 15:04:00 +03:00
|
|
|
|
|
|
|
return new Promise((resolve, reject) =>
|
|
|
|
this.newTxn(
|
|
|
|
"readwrite",
|
|
|
|
this._dbStoreName,
|
2015-06-26 00:52:57 +03:00
|
|
|
(aTxn, aStore) => {
|
|
|
|
aTxn.result = undefined;
|
|
|
|
|
|
|
|
aStore.put(aRecord).onsuccess = aEvent => {
|
2015-11-10 00:58:32 +03:00
|
|
|
console.debug("put: Request successful. Updated record",
|
|
|
|
aEvent.target.result);
|
2015-06-26 00:52:57 +03:00
|
|
|
aTxn.result = this.toPushRecord(aRecord);
|
2015-06-03 15:04:00 +03:00
|
|
|
};
|
|
|
|
},
|
|
|
|
resolve,
|
|
|
|
reject
|
|
|
|
)
|
|
|
|
);
|
|
|
|
},
|
|
|
|
|
|
|
|
/*
|
2015-06-03 15:06:00 +03:00
|
|
|
* @param aKeyID
|
2015-06-03 15:04:00 +03:00
|
|
|
* The ID of record to be deleted.
|
|
|
|
*/
|
2015-06-03 15:06:00 +03:00
|
|
|
delete: function(aKeyID) {
|
2015-11-10 00:58:32 +03:00
|
|
|
console.debug("delete()");
|
2015-06-03 15:04:00 +03:00
|
|
|
|
|
|
|
return new Promise((resolve, reject) =>
|
|
|
|
this.newTxn(
|
|
|
|
"readwrite",
|
|
|
|
this._dbStoreName,
|
2016-06-27 18:22:59 +03:00
|
|
|
(aTxn, aStore) => {
|
2015-11-10 00:58:32 +03:00
|
|
|
console.debug("delete: Removing record", aKeyID);
|
2015-11-11 01:27:47 +03:00
|
|
|
aStore.get(aKeyID).onsuccess = event => {
|
2016-06-27 18:22:59 +03:00
|
|
|
aTxn.result = this.toPushRecord(event.target.result);
|
2015-11-11 01:27:47 +03:00
|
|
|
aStore.delete(aKeyID);
|
|
|
|
};
|
2015-06-03 15:04:00 +03:00
|
|
|
},
|
|
|
|
resolve,
|
|
|
|
reject
|
|
|
|
)
|
|
|
|
);
|
|
|
|
},
|
|
|
|
|
2015-07-29 21:33:48 +03:00
|
|
|
// testFn(record) is called with a database record and should return true if
|
|
|
|
// that record should be deleted.
|
|
|
|
clearIf: function(testFn) {
|
2015-11-10 00:58:32 +03:00
|
|
|
console.debug("clearIf()");
|
2015-07-29 21:33:48 +03:00
|
|
|
return new Promise((resolve, reject) =>
|
|
|
|
this.newTxn(
|
|
|
|
"readwrite",
|
|
|
|
this._dbStoreName,
|
|
|
|
(aTxn, aStore) => {
|
|
|
|
aTxn.result = undefined;
|
|
|
|
|
|
|
|
aStore.openCursor().onsuccess = event => {
|
|
|
|
let cursor = event.target.result;
|
|
|
|
if (cursor) {
|
2015-11-10 00:58:32 +03:00
|
|
|
let record = this.toPushRecord(cursor.value);
|
|
|
|
if (testFn(record)) {
|
2015-07-29 21:33:48 +03:00
|
|
|
let deleteRequest = cursor.delete();
|
|
|
|
deleteRequest.onerror = e => {
|
2015-11-10 00:58:32 +03:00
|
|
|
console.error("clearIf: Error removing record",
|
|
|
|
record.keyID, e);
|
2015-07-29 21:33:48 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
cursor.continue();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve,
|
|
|
|
reject
|
|
|
|
)
|
|
|
|
);
|
|
|
|
},
|
|
|
|
|
2015-06-03 15:04:00 +03:00
|
|
|
getByPushEndpoint: function(aPushEndpoint) {
|
2015-11-10 00:58:32 +03:00
|
|
|
console.debug("getByPushEndpoint()");
|
2015-06-03 15:04:00 +03:00
|
|
|
|
|
|
|
return new Promise((resolve, reject) =>
|
|
|
|
this.newTxn(
|
|
|
|
"readonly",
|
|
|
|
this._dbStoreName,
|
2015-06-26 00:52:57 +03:00
|
|
|
(aTxn, aStore) => {
|
2015-06-03 15:04:00 +03:00
|
|
|
aTxn.result = undefined;
|
|
|
|
|
|
|
|
let index = aStore.index("pushEndpoint");
|
2015-06-26 00:52:57 +03:00
|
|
|
index.get(aPushEndpoint).onsuccess = aEvent => {
|
2015-11-10 00:58:32 +03:00
|
|
|
let record = this.toPushRecord(aEvent.target.result);
|
|
|
|
console.debug("getByPushEndpoint: Got record", record);
|
|
|
|
aTxn.result = record;
|
2015-06-03 15:05:00 +03:00
|
|
|
};
|
2015-06-03 15:04:00 +03:00
|
|
|
},
|
|
|
|
resolve,
|
|
|
|
reject
|
|
|
|
)
|
|
|
|
);
|
|
|
|
},
|
|
|
|
|
2015-06-03 15:06:00 +03:00
|
|
|
getByKeyID: function(aKeyID) {
|
2015-11-10 00:58:32 +03:00
|
|
|
console.debug("getByKeyID()");
|
2015-06-03 15:04:00 +03:00
|
|
|
|
|
|
|
return new Promise((resolve, reject) =>
|
|
|
|
this.newTxn(
|
|
|
|
"readonly",
|
|
|
|
this._dbStoreName,
|
2015-06-26 00:52:57 +03:00
|
|
|
(aTxn, aStore) => {
|
2015-06-03 15:04:00 +03:00
|
|
|
aTxn.result = undefined;
|
|
|
|
|
2015-06-26 00:52:57 +03:00
|
|
|
aStore.get(aKeyID).onsuccess = aEvent => {
|
2015-11-10 00:58:32 +03:00
|
|
|
let record = this.toPushRecord(aEvent.target.result);
|
|
|
|
console.debug("getByKeyID: Got record", record);
|
|
|
|
aTxn.result = record;
|
2015-06-03 15:05:00 +03:00
|
|
|
};
|
2015-06-03 15:04:00 +03:00
|
|
|
},
|
|
|
|
resolve,
|
|
|
|
reject
|
|
|
|
)
|
|
|
|
);
|
|
|
|
},
|
|
|
|
|
2015-10-31 04:15:48 +03:00
|
|
|
/**
|
2016-05-05 19:12:35 +03:00
|
|
|
* Iterates over all records associated with an origin.
|
2015-10-31 04:15:48 +03:00
|
|
|
*
|
|
|
|
* @param {String} origin The origin, matched as a prefix against the scope.
|
|
|
|
* @param {String} originAttributes Additional origin attributes. Requires
|
|
|
|
* an exact match.
|
2016-05-05 19:12:35 +03:00
|
|
|
* @param {Function} callback A function with the signature `(record,
|
|
|
|
* cursor)`, called for each record. `record` is the registration, and
|
|
|
|
* `cursor` is an `IDBCursor`.
|
|
|
|
* @returns {Promise} Resolves once all records have been processed.
|
2015-10-31 04:15:48 +03:00
|
|
|
*/
|
2016-05-05 19:12:35 +03:00
|
|
|
forEachOrigin: function(origin, originAttributes, callback) {
|
2015-11-11 01:27:47 +03:00
|
|
|
console.debug("forEachOrigin()");
|
2015-10-06 18:14:25 +03:00
|
|
|
|
|
|
|
return new Promise((resolve, reject) =>
|
|
|
|
this.newTxn(
|
2015-10-31 04:15:48 +03:00
|
|
|
"readwrite",
|
2015-10-06 18:14:25 +03:00
|
|
|
this._dbStoreName,
|
|
|
|
(aTxn, aStore) => {
|
2016-05-05 19:12:35 +03:00
|
|
|
aTxn.result = undefined;
|
2015-10-06 18:14:25 +03:00
|
|
|
|
|
|
|
let index = aStore.index("identifiers");
|
|
|
|
let range = IDBKeyRange.bound(
|
|
|
|
[origin, originAttributes],
|
|
|
|
[origin + "\x7f", originAttributes]
|
|
|
|
);
|
|
|
|
index.openCursor(range).onsuccess = event => {
|
|
|
|
let cursor = event.target.result;
|
2015-10-31 04:15:48 +03:00
|
|
|
if (!cursor) {
|
|
|
|
return;
|
|
|
|
}
|
2016-05-05 19:12:35 +03:00
|
|
|
callback(this.toPushRecord(cursor.value), cursor);
|
2015-10-31 04:15:48 +03:00
|
|
|
cursor.continue();
|
2015-10-06 18:14:25 +03:00
|
|
|
};
|
|
|
|
},
|
|
|
|
resolve,
|
|
|
|
reject
|
|
|
|
)
|
|
|
|
);
|
|
|
|
},
|
|
|
|
|
2015-06-24 23:34:54 +03:00
|
|
|
// Perform a unique match against { scope, originAttributes }
|
|
|
|
getByIdentifiers: function(aPageRecord) {
|
2015-11-10 00:58:32 +03:00
|
|
|
console.debug("getByIdentifiers()", aPageRecord);
|
2015-06-24 23:34:54 +03:00
|
|
|
if (!aPageRecord.scope || aPageRecord.originAttributes == undefined) {
|
2015-11-10 00:58:32 +03:00
|
|
|
console.error("getByIdentifiers: Scope and originAttributes are required",
|
|
|
|
aPageRecord);
|
|
|
|
return Promise.reject(new TypeError("Invalid page record"));
|
2015-06-24 23:34:54 +03:00
|
|
|
}
|
2015-06-03 15:04:00 +03:00
|
|
|
|
2015-06-24 23:34:54 +03:00
|
|
|
return new Promise((resolve, reject) =>
|
|
|
|
this.newTxn(
|
|
|
|
"readonly",
|
|
|
|
this._dbStoreName,
|
2015-06-26 00:52:57 +03:00
|
|
|
(aTxn, aStore) => {
|
2015-06-24 23:34:54 +03:00
|
|
|
aTxn.result = undefined;
|
2015-06-03 15:04:00 +03:00
|
|
|
|
2015-06-24 23:34:54 +03:00
|
|
|
let index = aStore.index("identifiers");
|
|
|
|
let request = index.get(IDBKeyRange.only([aPageRecord.scope, aPageRecord.originAttributes]));
|
2015-06-26 00:52:57 +03:00
|
|
|
request.onsuccess = aEvent => {
|
|
|
|
aTxn.result = this.toPushRecord(aEvent.target.result);
|
|
|
|
};
|
2015-06-24 23:34:54 +03:00
|
|
|
},
|
|
|
|
resolve,
|
|
|
|
reject
|
|
|
|
)
|
|
|
|
);
|
|
|
|
},
|
|
|
|
|
|
|
|
_getAllByKey: function(aKeyName, aKeyValue) {
|
2015-06-03 15:04:00 +03:00
|
|
|
return new Promise((resolve, reject) =>
|
|
|
|
this.newTxn(
|
|
|
|
"readonly",
|
|
|
|
this._dbStoreName,
|
2015-06-26 00:52:57 +03:00
|
|
|
(aTxn, aStore) => {
|
2015-06-03 15:04:00 +03:00
|
|
|
aTxn.result = undefined;
|
|
|
|
|
2015-06-24 23:34:54 +03:00
|
|
|
let index = aStore.index(aKeyName);
|
|
|
|
// It seems ok to use getAll here, since unlike contacts or other
|
|
|
|
// high storage APIs, we don't expect more than a handful of
|
|
|
|
// registrations per domain, and usually only one.
|
|
|
|
let getAllReq = index.mozGetAll(aKeyValue);
|
2015-06-26 00:52:57 +03:00
|
|
|
getAllReq.onsuccess = aEvent => {
|
|
|
|
aTxn.result = aEvent.target.result.map(
|
|
|
|
record => this.toPushRecord(record));
|
|
|
|
};
|
2015-06-03 15:04:00 +03:00
|
|
|
},
|
|
|
|
resolve,
|
|
|
|
reject
|
|
|
|
)
|
|
|
|
);
|
|
|
|
},
|
|
|
|
|
2015-06-24 23:34:54 +03:00
|
|
|
// aOriginAttributes must be a string!
|
|
|
|
getAllByOriginAttributes: function(aOriginAttributes) {
|
|
|
|
if (typeof aOriginAttributes !== "string") {
|
|
|
|
return Promise.reject("Expected string!");
|
|
|
|
}
|
|
|
|
return this._getAllByKey("originAttributes", aOriginAttributes);
|
|
|
|
},
|
|
|
|
|
2015-06-03 15:06:00 +03:00
|
|
|
getAllKeyIDs: function() {
|
2015-11-10 00:58:32 +03:00
|
|
|
console.debug("getAllKeyIDs()");
|
2015-06-03 15:04:00 +03:00
|
|
|
|
|
|
|
return new Promise((resolve, reject) =>
|
|
|
|
this.newTxn(
|
|
|
|
"readonly",
|
|
|
|
this._dbStoreName,
|
2015-06-26 00:52:57 +03:00
|
|
|
(aTxn, aStore) => {
|
2015-06-24 23:34:54 +03:00
|
|
|
aTxn.result = undefined;
|
2015-06-26 00:52:57 +03:00
|
|
|
aStore.mozGetAll().onsuccess = event => {
|
|
|
|
aTxn.result = event.target.result.map(
|
|
|
|
record => this.toPushRecord(record));
|
|
|
|
};
|
|
|
|
},
|
|
|
|
resolve,
|
|
|
|
reject
|
|
|
|
)
|
|
|
|
);
|
|
|
|
},
|
|
|
|
|
|
|
|
_getAllByPushQuota: function(range) {
|
2015-11-10 00:58:32 +03:00
|
|
|
console.debug("getAllByPushQuota()");
|
2015-06-26 00:52:57 +03:00
|
|
|
|
|
|
|
return new Promise((resolve, reject) =>
|
|
|
|
this.newTxn(
|
|
|
|
"readonly",
|
|
|
|
this._dbStoreName,
|
|
|
|
(aTxn, aStore) => {
|
|
|
|
aTxn.result = [];
|
|
|
|
|
|
|
|
let index = aStore.index("quota");
|
|
|
|
index.openCursor(range).onsuccess = event => {
|
|
|
|
let cursor = event.target.result;
|
|
|
|
if (cursor) {
|
|
|
|
aTxn.result.push(this.toPushRecord(cursor.value));
|
|
|
|
cursor.continue();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
},
|
|
|
|
resolve,
|
|
|
|
reject
|
|
|
|
)
|
|
|
|
);
|
|
|
|
},
|
|
|
|
|
|
|
|
getAllUnexpired: function() {
|
2015-11-10 00:58:32 +03:00
|
|
|
console.debug("getAllUnexpired()");
|
2015-06-26 00:52:57 +03:00
|
|
|
return this._getAllByPushQuota(IDBKeyRange.lowerBound(1));
|
|
|
|
},
|
|
|
|
|
|
|
|
getAllExpired: function() {
|
2015-11-10 00:58:32 +03:00
|
|
|
console.debug("getAllExpired()");
|
2015-06-26 00:52:57 +03:00
|
|
|
return this._getAllByPushQuota(IDBKeyRange.only(0));
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Updates an existing push registration.
|
|
|
|
*
|
|
|
|
* @param {String} aKeyID The registration ID.
|
|
|
|
* @param {Function} aUpdateFunc A function that receives the existing
|
2016-10-20 18:45:44 +03:00
|
|
|
* registration record as its argument, and returns a new record.
|
|
|
|
* @returns {Promise} A promise resolved with either the updated record.
|
|
|
|
* Rejects if the record does not exist, or the function returns an invalid
|
|
|
|
* record.
|
2015-06-26 00:52:57 +03:00
|
|
|
*/
|
|
|
|
update: function(aKeyID, aUpdateFunc) {
|
|
|
|
return new Promise((resolve, reject) =>
|
|
|
|
this.newTxn(
|
|
|
|
"readwrite",
|
|
|
|
this._dbStoreName,
|
|
|
|
(aTxn, aStore) => {
|
|
|
|
aStore.get(aKeyID).onsuccess = aEvent => {
|
|
|
|
aTxn.result = undefined;
|
|
|
|
|
|
|
|
let record = aEvent.target.result;
|
|
|
|
if (!record) {
|
2016-10-20 18:45:44 +03:00
|
|
|
throw new Error("Record " + aKeyID + " does not exist");
|
2015-06-26 00:52:57 +03:00
|
|
|
}
|
|
|
|
let newRecord = aUpdateFunc(this.toPushRecord(record));
|
|
|
|
if (!this.isValidRecord(newRecord)) {
|
2015-11-10 00:58:32 +03:00
|
|
|
console.error("update: Ignoring invalid update",
|
|
|
|
aKeyID, newRecord);
|
2016-10-20 18:45:44 +03:00
|
|
|
throw new Error("Invalid update for record " + aKeyID);
|
2015-06-26 00:52:57 +03:00
|
|
|
}
|
2016-02-05 07:17:07 +03:00
|
|
|
function putRecord() {
|
|
|
|
let req = aStore.put(newRecord);
|
|
|
|
req.onsuccess = aEvent => {
|
|
|
|
console.debug("update: Update successful", aKeyID, newRecord);
|
|
|
|
aTxn.result = newRecord;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
if (aKeyID === newRecord.keyID) {
|
|
|
|
putRecord();
|
|
|
|
} else {
|
|
|
|
// If we changed the primary key, delete the old record to avoid
|
|
|
|
// unique constraint errors.
|
|
|
|
aStore.delete(aKeyID).onsuccess = putRecord;
|
|
|
|
}
|
2015-06-03 15:05:00 +03:00
|
|
|
};
|
2015-06-03 15:04:00 +03:00
|
|
|
},
|
|
|
|
resolve,
|
|
|
|
reject
|
|
|
|
)
|
|
|
|
);
|
|
|
|
},
|
|
|
|
|
|
|
|
drop: function() {
|
2015-11-10 00:58:32 +03:00
|
|
|
console.debug("drop()");
|
2015-06-03 15:04:00 +03:00
|
|
|
|
|
|
|
return new Promise((resolve, reject) =>
|
|
|
|
this.newTxn(
|
|
|
|
"readwrite",
|
|
|
|
this._dbStoreName,
|
|
|
|
function txnCb(aTxn, aStore) {
|
|
|
|
aStore.clear();
|
|
|
|
},
|
|
|
|
resolve,
|
|
|
|
reject
|
|
|
|
)
|
|
|
|
);
|
|
|
|
},
|
|
|
|
};
|