dexie 1.5.0 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/dexie.js CHANGED
@@ -10,7 +10,7 @@
10
10
  *
11
11
  * By David Fahlander, david.fahlander@gmail.com
12
12
  *
13
- * Version 1.5.0, Thu Oct 13 2016
13
+ * Version 1.5.1, Tue Nov 01 2016
14
14
  * www.dexie.com
15
15
  * Apache License Version 2.0, January 2004, http://www.apache.org/licenses/
16
16
  */
@@ -1427,14 +1427,14 @@ function rejection(err, uncaughtHandler) {
1427
1427
  *
1428
1428
  * By David Fahlander, david.fahlander@gmail.com
1429
1429
  *
1430
- * Version 1.5.0, Thu Oct 13 2016
1430
+ * Version 1.5.1, Tue Nov 01 2016
1431
1431
  *
1432
1432
  * http://dexie.org
1433
1433
  *
1434
1434
  * Apache License Version 2.0, January 2004, http://www.apache.org/licenses/
1435
1435
  */
1436
1436
 
1437
- var DEXIE_VERSION = '1.5.0';
1437
+ var DEXIE_VERSION = '1.5.1';
1438
1438
  var maxString = String.fromCharCode(65535);
1439
1439
  var maxKey = function () {
1440
1440
  try {
@@ -2784,9 +2784,9 @@ function Dexie(dbName, options) {
2784
2784
  if (--this._reculock === 0) {
2785
2785
  if (!PSD.global) PSD.lockOwnerFor = null;
2786
2786
  while (this._blockedFuncs.length > 0 && !this._locked()) {
2787
- var fn = this._blockedFuncs.shift();
2787
+ var fnAndPSD = this._blockedFuncs.shift();
2788
2788
  try {
2789
- fn();
2789
+ usePSD(fnAndPSD[1], fnAndPSD[0]);
2790
2790
  } catch (e) {}
2791
2791
  }
2792
2792
  }
@@ -2844,30 +2844,27 @@ function Dexie(dbName, options) {
2844
2844
  },
2845
2845
  _promise: function (mode, fn, bWriteLock) {
2846
2846
  var self = this;
2847
- return newScope(function () {
2848
- var p;
2849
- // Read lock always
2850
- if (!self._locked()) {
2851
- p = self.active ? new Promise(function (resolve, reject) {
2852
- if (mode === READWRITE && self.mode !== READWRITE) throw new exceptions.ReadOnly("Transaction is readonly");
2853
- if (!self.idbtrans && mode) self.create();
2854
- if (bWriteLock) self._lock(); // Write lock if write operation is requested
2855
- fn(resolve, reject, self);
2856
- }) : rejection(new exceptions.TransactionInactive());
2857
- if (self.active && bWriteLock) p.finally(function () {
2858
- self._unlock();
2859
- });
2860
- } else {
2861
- // Transaction is write-locked. Wait for mutex.
2862
- p = new Promise(function (resolve, reject) {
2863
- self._blockedFuncs.push(function () {
2864
- self._promise(mode, fn, bWriteLock).then(resolve, reject);
2865
- });
2866
- });
2867
- }
2868
- p._lib = true;
2869
- return p.uncaught(dbUncaught);
2847
+ var p = self._locked() ?
2848
+ // Read lock always. Transaction is write-locked. Wait for mutex.
2849
+ new Promise(function (resolve, reject) {
2850
+ self._blockedFuncs.push([function () {
2851
+ self._promise(mode, fn, bWriteLock).then(resolve, reject);
2852
+ }, PSD]);
2853
+ }) : newScope(function () {
2854
+ var p_ = self.active ? new Promise(function (resolve, reject) {
2855
+ if (mode === READWRITE && self.mode !== READWRITE) throw new exceptions.ReadOnly("Transaction is readonly");
2856
+ if (!self.idbtrans && mode) self.create();
2857
+ if (bWriteLock) self._lock(); // Write lock if write operation is requested
2858
+ fn(resolve, reject, self);
2859
+ }) : rejection(new exceptions.TransactionInactive());
2860
+ if (self.active && bWriteLock) p_.finally(function () {
2861
+ self._unlock();
2862
+ });
2863
+ return p_;
2870
2864
  });
2865
+
2866
+ p._lib = true;
2867
+ return p.uncaught(dbUncaught);
2871
2868
  },
2872
2869
 
2873
2870
  //