fix: load balancer panics, stealth flag, shadow DOM polyfill
Fixes #1: replace unwrap() panics in run_multi_worker_serve with match on the Result. Fixes #2: route /json round-robin via worker_port instead of hardcoded port+1. Fixes #3: return 502 Bad Gateway when a worker is unreachable instead of silently dropping the connection. Fixes #5: thread --stealth through start_with_options -> CdpContext -> BrowserContext::with_options so the flag actually has an effect in serve mode (was let _ before). Log message now reflects the actual capability based on the stealth cargo feature being compiled in. Fixes #15: try/catch the parentNode assignment in the attachShadow polyfill so it doesn't throw a TypeError against the read-only Node.parentNode getter (Cloudflare Turnstile triggers this path).
This commit is contained in:
1 parent
74cf88d0f4
commit
99e75f1e62
4 files changed
+106
-24
No files matched your search
Vendored
+20
-4
@@ -2382,17 +2382,33 @@ Element.prototype.attachShadow = function attachShadow(opts) {
|
||||
get lastChild() { return children[children.length - 1] || null; },
|
||||
get firstElementChild() { return children.find(c => c.nodeType === 1) || null; },
|
||||
get children() { return children.filter(c => c.nodeType === 1); },
|
||||
appendChild(c) { if (c) { children.push(c); c.parentNode = shadow; } return c; },
|
||||
appendChild(c) {
|
||||
if (c) {
|
||||
children.push(c);
|
||||
try { c.parentNode = shadow; } catch (_) { /* parentNode is getter-only on Node, ignore */ }
|
||||
}
|
||||
return c;
|
||||
},
|
||||
insertBefore(n, ref) {
|
||||
if (!n) return n;
|
||||
if (!ref) { shadow.appendChild(n); return n; }
|
||||
const idx = children.indexOf(ref);
|
||||
if (idx >= 0) { children.splice(idx, 0, n); n.parentNode = shadow; }
|
||||
if (idx >= 0) {
|
||||
children.splice(idx, 0, n);
|
||||
try { n.parentNode = shadow; } catch (_) {}
|
||||
}
|
||||
else shadow.appendChild(n);
|
||||
return n;
|
||||
},
|
||||
removeChild(c) { const idx = children.indexOf(c); if (idx >= 0) children.splice(idx, 1); return c; },
|
||||
replaceChild(n, o) { const idx = children.indexOf(o); if (idx >= 0) { children[idx] = n; n.parentNode = shadow; } return o; },
|
||||
replaceChild(n, o) {
|
||||
const idx = children.indexOf(o);
|
||||
if (idx >= 0) {
|
||||
children[idx] = n;
|
||||
try { n.parentNode = shadow; } catch (_) {}
|
||||
}
|
||||
return o;
|
||||
},
|
||||
querySelector(s) {
|
||||
for (const c of children) {
|
||||
if (c.matches && c.matches(s)) return c;
|
||||
@@ -2922,4 +2938,4 @@ globalThis.__obscura_init = function() {
|
||||
}
|
||||
}
|
||||
delete globalThis.__obscura_init;
|
||||
};
|
||||
};
|
||||
Reference in new issue
Block a user