fix(capture): retain Electron observations and HAR resource failures

This commit is contained in:
morluto
2026-10-09 06:49:02 +08:00
parent 6c13fc8e0a
commit 44fd18305f
27 changed files with 1462 additions and 145 deletions
@@ -10,6 +10,7 @@ const temporary: string[] = [];
const electronModuleSource = `const { EventEmitter } = require("node:events");
const app = new EventEmitter();
app.isReady = () => true;
app.relaunch = () => undefined;
app.setAsDefaultProtocolClient = () => true;
app.setLoginItemSettings = () => undefined;
@@ -40,6 +41,8 @@ class BrowserWindow extends EventEmitter {
this.id = 3;
this.webContents = new WebContents();
this.options = options;
this.webContents.getLastWebPreferences = () => options.webPreferences;
app.emit("browser-window-created", {}, this);
}
}
const utilityProcess = {
@@ -66,7 +69,7 @@ const contextBridge = {
};
module.exports = {
app,
BrowserWindow,
get BrowserWindow() { return BrowserWindow; },
contextBridge,
ipcMain,
ipcRenderer,
@@ -266,7 +266,7 @@ it("cancels after snapshot acquisition before launch and removes private input d
it.each([
{ reason: "input-limit", tag: "AnalysisInputError" },
{ reason: "resource-limit", tag: "ProviderAdapterError" },
{ reason: "resource-limit", tag: "AnalysisResourceConstraintError" },
{ reason: "decoder", tag: "ProviderAdapterError" },
{ reason: "limit", tag: "AnalysisOutputError" },
])(