mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-16 20:11:08 +00:00
* feat(plugins): add isolated plugin host runtime * test(plugins): build runtime dependencies before tests * fix(plugins): harden runtime lifecycle and recovery * fix(plugins): harden runtime extension boundaries * fix(plugins): enforce runtime integrity boundaries * fix(plugins): await utility process exit * fix(plugins): harden utility process containment * fix(plugins): close runtime recovery gaps * fix(plugins): harden runtime lifecycle boundaries
32 lines
926 B
JavaScript
32 lines
926 B
JavaScript
import { definePlugin } from "@netcatty/plugin-sdk";
|
|
|
|
export default definePlugin({
|
|
async activate(context) {
|
|
for (const capability of [
|
|
"fetch",
|
|
"RTCPeerConnection",
|
|
"WebSocket",
|
|
"WebTransport",
|
|
"Worker",
|
|
]) {
|
|
if (globalThis[capability] !== undefined) {
|
|
throw new Error(`Direct browser capability remains exposed: ${capability}`);
|
|
}
|
|
}
|
|
const iframe = document.createElement("iframe");
|
|
document.body.append(iframe);
|
|
let childNetworkBlocked = false;
|
|
try {
|
|
await iframe.contentWindow.fetch("https://netcatty-plugin-smoke.invalid/");
|
|
} catch {
|
|
childNetworkBlocked = true;
|
|
} finally {
|
|
iframe.remove();
|
|
}
|
|
if (!childNetworkBlocked) {
|
|
throw new Error("Child browsing context bypassed the offline plugin session");
|
|
}
|
|
await context.storage.set("smoke.activation", { kind: "browser", ready: true });
|
|
},
|
|
});
|