@volter/tabnode 0.5.23 → 0.5.25
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
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();
|
|
@@ -41,7 +43,8 @@ function openHost(id, channel) {
|
|
|
41
43
|
};
|
|
42
44
|
hosts.set(id, host);
|
|
43
45
|
latestHost = host;
|
|
44
|
-
|
|
46
|
+
// Clients that are gone are forgotten; a prune that fails forgets nothing.
|
|
47
|
+
void pruneClients().catch(() => {});
|
|
45
48
|
return host;
|
|
46
49
|
}
|
|
47
50
|
|
|
@@ -149,10 +152,10 @@ self.addEventListener('message', (event) => {
|
|
|
149
152
|
// their virtual origin identity; a channel reconnect must not send their
|
|
150
153
|
// root-relative requests to network.
|
|
151
154
|
const mainPort = event.ports[0];
|
|
152
|
-
const host = openHost(event.source && event.source.id ? event.source.id :
|
|
155
|
+
const host = openHost(event.source && event.source.id ? event.source.id : UNNAMED_HOST, mainPort);
|
|
153
156
|
const initializedPort = mainPort;
|
|
154
157
|
mainPort.onmessage = (message) => {
|
|
155
|
-
if (host.port === initializedPort) handleMainMessage(host, message);
|
|
158
|
+
if (hosts.get(host.id) === host && host.port === initializedPort) handleMainMessage(host, message);
|
|
156
159
|
};
|
|
157
160
|
if (data && Array.isArray(data.ownDocuments)) host.ownDocuments = new Set(data.ownDocuments.map((path) => ownPath(String(path))));
|
|
158
161
|
DEBUG && console.log('[SW] Initialized communication channel with transferred port');
|
|
@@ -542,7 +545,7 @@ async function blobWorkerContext(client, requestUrl) {
|
|
|
542
545
|
if (owners.some(owner => owner.context.port !== owners[0].context.port || owner.host !== owners[0].host)) throw new Error('Ambiguous virtual blob owner');
|
|
543
546
|
rootedClients.set(client.id, owners[0].context.port);
|
|
544
547
|
if (owners[0].host) clientHosts.set(client.id, owners[0].host.id);
|
|
545
|
-
if (rootedClients.size > 256) pruneClients();
|
|
548
|
+
if (rootedClients.size > 256) void pruneClients().catch(() => {});
|
|
546
549
|
return owners[0].context;
|
|
547
550
|
})();
|
|
548
551
|
pendingBlobContexts.set(client.id, pending);
|
|
@@ -615,7 +618,7 @@ async function askForInit() {
|
|
|
615
618
|
function handleRootedRequest(event, port, path) {
|
|
616
619
|
if (event.resultingClientId) {
|
|
617
620
|
rootedClients.set(event.resultingClientId, port);
|
|
618
|
-
if (rootedClients.size > 256) pruneClients();
|
|
621
|
+
if (rootedClients.size > 256) void pruneClients().catch(() => {});
|
|
619
622
|
}
|
|
620
623
|
return handleVirtualRequest(event.request, port, path, true);
|
|
621
624
|
}
|
|
@@ -626,7 +629,7 @@ async function pruneClients() {
|
|
|
626
629
|
for (const id of [...rootedClients.keys()]) if (!alive.has(id)) rootedClients.delete(id);
|
|
627
630
|
for (const [id, host] of [...clientHosts]) if (!alive.has(id) || !hosts.has(host)) clientHosts.delete(id);
|
|
628
631
|
for (const [id, host] of [...hosts]) {
|
|
629
|
-
if (alive.has(id) || id
|
|
632
|
+
if (alive.has(id) || id === UNNAMED_HOST) continue;
|
|
630
633
|
hosts.delete(id);
|
|
631
634
|
host.port.onmessage = null;
|
|
632
635
|
host.port.close();
|
|
@@ -21146,17 +21146,10 @@ var implementation$1 = function bind2(that) {
|
|
|
21146
21146
|
var implementation = implementation$1;
|
|
21147
21147
|
var functionBind = Function.prototype.bind || implementation;
|
|
21148
21148
|
var functionCall = Function.prototype.call;
|
|
21149
|
-
var functionApply;
|
|
21150
|
-
var hasRequiredFunctionApply;
|
|
21151
|
-
function requireFunctionApply() {
|
|
21152
|
-
if (hasRequiredFunctionApply) return functionApply;
|
|
21153
|
-
hasRequiredFunctionApply = 1;
|
|
21154
|
-
functionApply = Function.prototype.apply;
|
|
21155
|
-
return functionApply;
|
|
21156
|
-
}
|
|
21149
|
+
var functionApply = Function.prototype.apply;
|
|
21157
21150
|
var reflectApply = typeof Reflect !== "undefined" && Reflect && Reflect.apply;
|
|
21158
21151
|
var bind$2 = functionBind;
|
|
21159
|
-
var $apply$1 =
|
|
21152
|
+
var $apply$1 = functionApply;
|
|
21160
21153
|
var $call$2 = functionCall;
|
|
21161
21154
|
var $reflectApply = reflectApply;
|
|
21162
21155
|
var actualApply = $reflectApply || bind$2.call($call$2, $apply$1);
|
|
@@ -21276,7 +21269,7 @@ var hasSymbols = requireHasSymbols()();
|
|
|
21276
21269
|
var getProto = requireGetProto();
|
|
21277
21270
|
var $ObjectGPO = requireObject_getPrototypeOf();
|
|
21278
21271
|
var $ReflectGPO = requireReflect_getPrototypeOf();
|
|
21279
|
-
var $apply =
|
|
21272
|
+
var $apply = functionApply;
|
|
21280
21273
|
var $call = functionCall;
|
|
21281
21274
|
var needsEval = {};
|
|
21282
21275
|
var TypedArray = typeof Uint8Array === "undefined" || !getProto ? undefined$1 : getProto(Uint8Array);
|
|
@@ -21917,7 +21910,7 @@ function requireApplyBind() {
|
|
|
21917
21910
|
if (hasRequiredApplyBind) return applyBind;
|
|
21918
21911
|
hasRequiredApplyBind = 1;
|
|
21919
21912
|
var bind3 = functionBind;
|
|
21920
|
-
var $apply2 =
|
|
21913
|
+
var $apply2 = functionApply;
|
|
21921
21914
|
var actualApply$1 = actualApply;
|
|
21922
21915
|
applyBind = function applyBind2() {
|
|
21923
21916
|
return actualApply$1(bind3, $apply2, arguments);
|
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);
|
|
@@ -39918,7 +39925,7 @@ class WorkerRuntime {
|
|
|
39918
39925
|
this.worker = new Worker(
|
|
39919
39926
|
new URL(
|
|
39920
39927
|
/* @vite-ignore */
|
|
39921
|
-
"/assets/runtime-worker-
|
|
39928
|
+
"/assets/runtime-worker-D6N3DujB.js",
|
|
39922
39929
|
import.meta.url
|
|
39923
39930
|
),
|
|
39924
39931
|
{ type: "module" }
|