Skip to content

Commit cc28206

Browse files
committed
7.3.0
1 parent 3009abc commit cc28206

12 files changed

Lines changed: 212 additions & 52 deletions

dist/es5node/leader-election-web-lock.js

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ var LeaderElectionWebLock = exports.LeaderElectionWebLock = function LeaderElect
3030
// lock name
3131
this.lN = 'pubkey-bc||' + broadcastChannel.method.type + '||' + broadcastChannel.name;
3232
};
33+
var LEADER_DIE_ABORT_SIGNAL_MESSAGE = 'LeaderElectionWebLock.die() called';
3334
LeaderElectionWebLock.prototype = {
3435
hasLeader: function hasLeader() {
3536
var _this2 = this;
@@ -62,10 +63,19 @@ LeaderElectionWebLock.prototype = {
6263
res();
6364
return returnPromise;
6465
})["catch"](function (err) {
65-
if (_this3._wKMC.rej) {
66-
_this3._wKMC.rej(err);
66+
if (err.message && err.message === LEADER_DIE_ABORT_SIGNAL_MESSAGE) {
67+
/**
68+
* In this case we do nothing!
69+
* The leader died and awaitLeadership()
70+
* will never resolve. Also since this is not an error,
71+
* it will not throw.
72+
*/
73+
} else {
74+
if (_this3._wKMC.rej) {
75+
_this3._wKMC.rej(err);
76+
}
77+
reject(err);
6778
}
68-
reject(err);
6979
});
7080
});
7181
}
@@ -91,8 +101,13 @@ LeaderElectionWebLock.prototype = {
91101
if (this._wKMC.res) {
92102
this._wKMC.res();
93103
}
104+
105+
/**
106+
* We have to fire an abort signal
107+
* so that the navigator.locks.request stops.
108+
*/
94109
if (this._wKMC.c) {
95-
this._wKMC.c.abort('LeaderElectionWebLock.die() called');
110+
this._wKMC.c.abort(new Error(LEADER_DIE_ABORT_SIGNAL_MESSAGE));
96111
}
97112
return (0, _leaderElectionUtil.sendLeaderMessage)(this, 'death');
98113
}

dist/esbrowser/leader-election-web-lock.js

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export var LeaderElectionWebLock = function LeaderElectionWebLock(broadcastChann
2525
// lock name
2626
this.lN = 'pubkey-bc||' + broadcastChannel.method.type + '||' + broadcastChannel.name;
2727
};
28+
var LEADER_DIE_ABORT_SIGNAL_MESSAGE = 'LeaderElectionWebLock.die() called';
2829
LeaderElectionWebLock.prototype = {
2930
hasLeader: function hasLeader() {
3031
var _this2 = this;
@@ -57,10 +58,19 @@ LeaderElectionWebLock.prototype = {
5758
res();
5859
return returnPromise;
5960
})["catch"](function (err) {
60-
if (_this3._wKMC.rej) {
61-
_this3._wKMC.rej(err);
61+
if (err.message && err.message === LEADER_DIE_ABORT_SIGNAL_MESSAGE) {
62+
/**
63+
* In this case we do nothing!
64+
* The leader died and awaitLeadership()
65+
* will never resolve. Also since this is not an error,
66+
* it will not throw.
67+
*/
68+
} else {
69+
if (_this3._wKMC.rej) {
70+
_this3._wKMC.rej(err);
71+
}
72+
reject(err);
6273
}
63-
reject(err);
6474
});
6575
});
6676
}
@@ -86,8 +96,13 @@ LeaderElectionWebLock.prototype = {
8696
if (this._wKMC.res) {
8797
this._wKMC.res();
8898
}
99+
100+
/**
101+
* We have to fire an abort signal
102+
* so that the navigator.locks.request stops.
103+
*/
89104
if (this._wKMC.c) {
90-
this._wKMC.c.abort('LeaderElectionWebLock.die() called');
105+
this._wKMC.c.abort(new Error(LEADER_DIE_ABORT_SIGNAL_MESSAGE));
91106
}
92107
return sendLeaderMessage(this, 'death');
93108
}

dist/esnode/leader-election-web-lock.js

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export var LeaderElectionWebLock = function LeaderElectionWebLock(broadcastChann
2525
// lock name
2626
this.lN = 'pubkey-bc||' + broadcastChannel.method.type + '||' + broadcastChannel.name;
2727
};
28+
var LEADER_DIE_ABORT_SIGNAL_MESSAGE = 'LeaderElectionWebLock.die() called';
2829
LeaderElectionWebLock.prototype = {
2930
hasLeader: function hasLeader() {
3031
var _this2 = this;
@@ -57,10 +58,19 @@ LeaderElectionWebLock.prototype = {
5758
res();
5859
return returnPromise;
5960
})["catch"](function (err) {
60-
if (_this3._wKMC.rej) {
61-
_this3._wKMC.rej(err);
61+
if (err.message && err.message === LEADER_DIE_ABORT_SIGNAL_MESSAGE) {
62+
/**
63+
* In this case we do nothing!
64+
* The leader died and awaitLeadership()
65+
* will never resolve. Also since this is not an error,
66+
* it will not throw.
67+
*/
68+
} else {
69+
if (_this3._wKMC.rej) {
70+
_this3._wKMC.rej(err);
71+
}
72+
reject(err);
6273
}
63-
reject(err);
6474
});
6575
});
6676
}
@@ -86,8 +96,13 @@ LeaderElectionWebLock.prototype = {
8696
if (this._wKMC.res) {
8797
this._wKMC.res();
8898
}
99+
100+
/**
101+
* We have to fire an abort signal
102+
* so that the navigator.locks.request stops.
103+
*/
89104
if (this._wKMC.c) {
90-
this._wKMC.c.abort('LeaderElectionWebLock.die() called');
105+
this._wKMC.c.abort(new Error(LEADER_DIE_ABORT_SIGNAL_MESSAGE));
91106
}
92107
return sendLeaderMessage(this, 'death');
93108
}

dist/lib/browser.js

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,7 @@ var LeaderElectionWebLock = exports.LeaderElectionWebLock = function LeaderElect
418418
// lock name
419419
this.lN = 'pubkey-bc||' + broadcastChannel.method.type + '||' + broadcastChannel.name;
420420
};
421+
var LEADER_DIE_ABORT_SIGNAL_MESSAGE = 'LeaderElectionWebLock.die() called';
421422
LeaderElectionWebLock.prototype = {
422423
hasLeader: function hasLeader() {
423424
var _this2 = this;
@@ -450,10 +451,19 @@ LeaderElectionWebLock.prototype = {
450451
res();
451452
return returnPromise;
452453
})["catch"](function (err) {
453-
if (_this3._wKMC.rej) {
454-
_this3._wKMC.rej(err);
454+
if (err.message && err.message === LEADER_DIE_ABORT_SIGNAL_MESSAGE) {
455+
/**
456+
* In this case we do nothing!
457+
* The leader died and awaitLeadership()
458+
* will never resolve. Also since this is not an error,
459+
* it will not throw.
460+
*/
461+
} else {
462+
if (_this3._wKMC.rej) {
463+
_this3._wKMC.rej(err);
464+
}
465+
reject(err);
455466
}
456-
reject(err);
457467
});
458468
});
459469
}
@@ -479,8 +489,13 @@ LeaderElectionWebLock.prototype = {
479489
if (this._wKMC.res) {
480490
this._wKMC.res();
481491
}
492+
493+
/**
494+
* We have to fire an abort signal
495+
* so that the navigator.locks.request stops.
496+
*/
482497
if (this._wKMC.c) {
483-
this._wKMC.c.abort('LeaderElectionWebLock.die() called');
498+
this._wKMC.c.abort(new Error(LEADER_DIE_ABORT_SIGNAL_MESSAGE));
484499
}
485500
return (0, _leaderElectionUtil.sendLeaderMessage)(this, 'death');
486501
}

dist/lib/browser.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/lib/leader-election-web-lock.js

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ var LeaderElectionWebLock = exports.LeaderElectionWebLock = function LeaderElect
3030
// lock name
3131
this.lN = 'pubkey-bc||' + broadcastChannel.method.type + '||' + broadcastChannel.name;
3232
};
33+
var LEADER_DIE_ABORT_SIGNAL_MESSAGE = 'LeaderElectionWebLock.die() called';
3334
LeaderElectionWebLock.prototype = {
3435
hasLeader: function hasLeader() {
3536
var _this2 = this;
@@ -62,10 +63,19 @@ LeaderElectionWebLock.prototype = {
6263
res();
6364
return returnPromise;
6465
})["catch"](function (err) {
65-
if (_this3._wKMC.rej) {
66-
_this3._wKMC.rej(err);
66+
if (err.message && err.message === LEADER_DIE_ABORT_SIGNAL_MESSAGE) {
67+
/**
68+
* In this case we do nothing!
69+
* The leader died and awaitLeadership()
70+
* will never resolve. Also since this is not an error,
71+
* it will not throw.
72+
*/
73+
} else {
74+
if (_this3._wKMC.rej) {
75+
_this3._wKMC.rej(err);
76+
}
77+
reject(err);
6778
}
68-
reject(err);
6979
});
7080
});
7181
}
@@ -91,8 +101,13 @@ LeaderElectionWebLock.prototype = {
91101
if (this._wKMC.res) {
92102
this._wKMC.res();
93103
}
104+
105+
/**
106+
* We have to fire an abort signal
107+
* so that the navigator.locks.request stops.
108+
*/
94109
if (this._wKMC.c) {
95-
this._wKMC.c.abort('LeaderElectionWebLock.die() called');
110+
this._wKMC.c.abort(new Error(LEADER_DIE_ABORT_SIGNAL_MESSAGE));
96111
}
97112
return (0, _leaderElectionUtil.sendLeaderMessage)(this, 'death');
98113
}

docs/e2e.js

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,7 @@ var LeaderElectionWebLock = exports.LeaderElectionWebLock = function LeaderElect
410410
// lock name
411411
this.lN = 'pubkey-bc||' + broadcastChannel.method.type + '||' + broadcastChannel.name;
412412
};
413+
var LEADER_DIE_ABORT_SIGNAL_MESSAGE = 'LeaderElectionWebLock.die() called';
413414
LeaderElectionWebLock.prototype = {
414415
hasLeader: function hasLeader() {
415416
var _this2 = this;
@@ -442,10 +443,19 @@ LeaderElectionWebLock.prototype = {
442443
res();
443444
return returnPromise;
444445
})["catch"](function (err) {
445-
if (_this3._wKMC.rej) {
446-
_this3._wKMC.rej(err);
446+
if (err.message && err.message === LEADER_DIE_ABORT_SIGNAL_MESSAGE) {
447+
/**
448+
* In this case we do nothing!
449+
* The leader died and awaitLeadership()
450+
* will never resolve. Also since this is not an error,
451+
* it will not throw.
452+
*/
453+
} else {
454+
if (_this3._wKMC.rej) {
455+
_this3._wKMC.rej(err);
456+
}
457+
reject(err);
447458
}
448-
reject(err);
449459
});
450460
});
451461
}
@@ -471,8 +481,13 @@ LeaderElectionWebLock.prototype = {
471481
if (this._wKMC.res) {
472482
this._wKMC.res();
473483
}
484+
485+
/**
486+
* We have to fire an abort signal
487+
* so that the navigator.locks.request stops.
488+
*/
474489
if (this._wKMC.c) {
475-
this._wKMC.c.abort('LeaderElectionWebLock.die() called');
490+
this._wKMC.c.abort(new Error(LEADER_DIE_ABORT_SIGNAL_MESSAGE));
476491
}
477492
return (0, _leaderElectionUtil.sendLeaderMessage)(this, 'death');
478493
}
@@ -24279,21 +24294,26 @@ if (hasToStringTag && gOPD && getProto) {
2427924294
// @ts-expect-error TS won't narrow inside a closure
2428024295
descriptor = gOPD(superProto, Symbol.toStringTag);
2428124296
}
24282-
// @ts-expect-error TODO: fix
24283-
cache['$' + typedArray] = callBind(descriptor.get);
24297+
if (descriptor && descriptor.get) {
24298+
var bound = callBind(descriptor.get);
24299+
cache[
24300+
/** @type {`$${import('.').TypedArrayName}`} */ ('$' + typedArray)
24301+
] = bound;
24302+
}
2428424303
}
2428524304
});
2428624305
} else {
2428724306
forEach(typedArrays, function (typedArray) {
2428824307
var arr = new g[typedArray]();
2428924308
var fn = arr.slice || arr.set;
2429024309
if (fn) {
24291-
cache[
24292-
/** @type {`$${import('.').TypedArrayName}`} */ ('$' + typedArray)
24293-
] = /** @type {import('./types').BoundSlice | import('./types').BoundSet} */ (
24310+
var bound = /** @type {import('./types').BoundSlice | import('./types').BoundSet} */ (
2429424311
// @ts-expect-error TODO FIXME
2429524312
callBind(fn)
2429624313
);
24314+
cache[
24315+
/** @type {`$${import('.').TypedArrayName}`} */ ('$' + typedArray)
24316+
] = bound;
2429724317
}
2429824318
});
2429924319
}

docs/iframe.js

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,7 @@ var LeaderElectionWebLock = exports.LeaderElectionWebLock = function LeaderElect
410410
// lock name
411411
this.lN = 'pubkey-bc||' + broadcastChannel.method.type + '||' + broadcastChannel.name;
412412
};
413+
var LEADER_DIE_ABORT_SIGNAL_MESSAGE = 'LeaderElectionWebLock.die() called';
413414
LeaderElectionWebLock.prototype = {
414415
hasLeader: function hasLeader() {
415416
var _this2 = this;
@@ -442,10 +443,19 @@ LeaderElectionWebLock.prototype = {
442443
res();
443444
return returnPromise;
444445
})["catch"](function (err) {
445-
if (_this3._wKMC.rej) {
446-
_this3._wKMC.rej(err);
446+
if (err.message && err.message === LEADER_DIE_ABORT_SIGNAL_MESSAGE) {
447+
/**
448+
* In this case we do nothing!
449+
* The leader died and awaitLeadership()
450+
* will never resolve. Also since this is not an error,
451+
* it will not throw.
452+
*/
453+
} else {
454+
if (_this3._wKMC.rej) {
455+
_this3._wKMC.rej(err);
456+
}
457+
reject(err);
447458
}
448-
reject(err);
449459
});
450460
});
451461
}
@@ -471,8 +481,13 @@ LeaderElectionWebLock.prototype = {
471481
if (this._wKMC.res) {
472482
this._wKMC.res();
473483
}
484+
485+
/**
486+
* We have to fire an abort signal
487+
* so that the navigator.locks.request stops.
488+
*/
474489
if (this._wKMC.c) {
475-
this._wKMC.c.abort('LeaderElectionWebLock.die() called');
490+
this._wKMC.c.abort(new Error(LEADER_DIE_ABORT_SIGNAL_MESSAGE));
476491
}
477492
return (0, _leaderElectionUtil.sendLeaderMessage)(this, 'death');
478493
}

docs/index.js

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,7 @@ var LeaderElectionWebLock = exports.LeaderElectionWebLock = function LeaderElect
410410
// lock name
411411
this.lN = 'pubkey-bc||' + broadcastChannel.method.type + '||' + broadcastChannel.name;
412412
};
413+
var LEADER_DIE_ABORT_SIGNAL_MESSAGE = 'LeaderElectionWebLock.die() called';
413414
LeaderElectionWebLock.prototype = {
414415
hasLeader: function hasLeader() {
415416
var _this2 = this;
@@ -442,10 +443,19 @@ LeaderElectionWebLock.prototype = {
442443
res();
443444
return returnPromise;
444445
})["catch"](function (err) {
445-
if (_this3._wKMC.rej) {
446-
_this3._wKMC.rej(err);
446+
if (err.message && err.message === LEADER_DIE_ABORT_SIGNAL_MESSAGE) {
447+
/**
448+
* In this case we do nothing!
449+
* The leader died and awaitLeadership()
450+
* will never resolve. Also since this is not an error,
451+
* it will not throw.
452+
*/
453+
} else {
454+
if (_this3._wKMC.rej) {
455+
_this3._wKMC.rej(err);
456+
}
457+
reject(err);
447458
}
448-
reject(err);
449459
});
450460
});
451461
}
@@ -471,8 +481,13 @@ LeaderElectionWebLock.prototype = {
471481
if (this._wKMC.res) {
472482
this._wKMC.res();
473483
}
484+
485+
/**
486+
* We have to fire an abort signal
487+
* so that the navigator.locks.request stops.
488+
*/
474489
if (this._wKMC.c) {
475-
this._wKMC.c.abort('LeaderElectionWebLock.die() called');
490+
this._wKMC.c.abort(new Error(LEADER_DIE_ABORT_SIGNAL_MESSAGE));
476491
}
477492
return (0, _leaderElectionUtil.sendLeaderMessage)(this, 'death');
478493
}

0 commit comments

Comments
 (0)