@volter/tabnode 0.5.23 → 0.5.24
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/__sw__.js +5 -3
- package/dist/index.mjs +11 -4
- package/package.json +1 -1
package/dist/__sw__.js
CHANGED
|
@@ -12,6 +12,8 @@ const DEBUG = false;
|
|
|
12
12
|
// is keyed by the id of the window that sent `init`.
|
|
13
13
|
const hosts = new Map();
|
|
14
14
|
let latestHost = null;
|
|
15
|
+
// An `init` whose sender is unknown replaces the previous such channel.
|
|
16
|
+
const UNNAMED_HOST = 'unnamed-host';
|
|
15
17
|
// The documents and workers a host's servers made, by client id, so their
|
|
16
18
|
// requests reach the host that served them.
|
|
17
19
|
const clientHosts = new Map();
|
|
@@ -149,10 +151,10 @@ self.addEventListener('message', (event) => {
|
|
|
149
151
|
// their virtual origin identity; a channel reconnect must not send their
|
|
150
152
|
// root-relative requests to network.
|
|
151
153
|
const mainPort = event.ports[0];
|
|
152
|
-
const host = openHost(event.source && event.source.id ? event.source.id :
|
|
154
|
+
const host = openHost(event.source && event.source.id ? event.source.id : UNNAMED_HOST, mainPort);
|
|
153
155
|
const initializedPort = mainPort;
|
|
154
156
|
mainPort.onmessage = (message) => {
|
|
155
|
-
if (host.port === initializedPort) handleMainMessage(host, message);
|
|
157
|
+
if (hosts.get(host.id) === host && host.port === initializedPort) handleMainMessage(host, message);
|
|
156
158
|
};
|
|
157
159
|
if (data && Array.isArray(data.ownDocuments)) host.ownDocuments = new Set(data.ownDocuments.map((path) => ownPath(String(path))));
|
|
158
160
|
DEBUG && console.log('[SW] Initialized communication channel with transferred port');
|
|
@@ -626,7 +628,7 @@ async function pruneClients() {
|
|
|
626
628
|
for (const id of [...rootedClients.keys()]) if (!alive.has(id)) rootedClients.delete(id);
|
|
627
629
|
for (const [id, host] of [...clientHosts]) if (!alive.has(id) || !hosts.has(host)) clientHosts.delete(id);
|
|
628
630
|
for (const [id, host] of [...hosts]) {
|
|
629
|
-
if (alive.has(id) || id
|
|
631
|
+
if (alive.has(id) || id === UNNAMED_HOST) continue;
|
|
630
632
|
hosts.delete(id);
|
|
631
633
|
host.port.onmessage = null;
|
|
632
634
|
host.port.close();
|
package/dist/index.mjs
CHANGED
|
@@ -21322,10 +21322,17 @@ var implementation$1 = function bind2(that) {
|
|
|
21322
21322
|
var implementation = implementation$1;
|
|
21323
21323
|
var functionBind = Function.prototype.bind || implementation;
|
|
21324
21324
|
var functionCall = Function.prototype.call;
|
|
21325
|
-
var functionApply
|
|
21325
|
+
var functionApply;
|
|
21326
|
+
var hasRequiredFunctionApply;
|
|
21327
|
+
function requireFunctionApply() {
|
|
21328
|
+
if (hasRequiredFunctionApply) return functionApply;
|
|
21329
|
+
hasRequiredFunctionApply = 1;
|
|
21330
|
+
functionApply = Function.prototype.apply;
|
|
21331
|
+
return functionApply;
|
|
21332
|
+
}
|
|
21326
21333
|
var reflectApply = typeof Reflect !== "undefined" && Reflect && Reflect.apply;
|
|
21327
21334
|
var bind$2 = functionBind;
|
|
21328
|
-
var $apply$1 =
|
|
21335
|
+
var $apply$1 = requireFunctionApply();
|
|
21329
21336
|
var $call$2 = functionCall;
|
|
21330
21337
|
var $reflectApply = reflectApply;
|
|
21331
21338
|
var actualApply = $reflectApply || bind$2.call($call$2, $apply$1);
|
|
@@ -21445,7 +21452,7 @@ var hasSymbols = requireHasSymbols()();
|
|
|
21445
21452
|
var getProto = requireGetProto();
|
|
21446
21453
|
var $ObjectGPO = requireObject_getPrototypeOf();
|
|
21447
21454
|
var $ReflectGPO = requireReflect_getPrototypeOf();
|
|
21448
|
-
var $apply =
|
|
21455
|
+
var $apply = requireFunctionApply();
|
|
21449
21456
|
var $call = functionCall;
|
|
21450
21457
|
var needsEval = {};
|
|
21451
21458
|
var TypedArray = typeof Uint8Array === "undefined" || !getProto ? undefined$1 : getProto(Uint8Array);
|
|
@@ -22086,7 +22093,7 @@ function requireApplyBind() {
|
|
|
22086
22093
|
if (hasRequiredApplyBind) return applyBind;
|
|
22087
22094
|
hasRequiredApplyBind = 1;
|
|
22088
22095
|
var bind3 = functionBind;
|
|
22089
|
-
var $apply2 =
|
|
22096
|
+
var $apply2 = requireFunctionApply();
|
|
22090
22097
|
var actualApply$1 = actualApply;
|
|
22091
22098
|
applyBind = function applyBind2() {
|
|
22092
22099
|
return actualApply$1(bind3, $apply2, arguments);
|