Skip to content

Commit 6c6df34

Browse files
committed
Add more setup logging to Electron
1 parent 423db94 commit 6c6df34

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

custom-typings/chrome-remote-interface.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ declare module 'chrome-remote-interface' {
1414

1515
export interface CdpClient {
1616
Runtime: {
17-
runIfWaitingForDebugger(): void;
17+
runIfWaitingForDebugger(): Promise<void>;
1818
enable(): Promise<void>;
1919
evaluate(options: { expression: string }): Promise<{
2020
result?: unknown,
@@ -25,7 +25,7 @@ declare module 'chrome-remote-interface' {
2525
Debugger: {
2626
enable(): Promise<void>;
2727
paused(callback: (stack: Stack) => void): void;
28-
resume(): void;
28+
resume(): Promise<void>;
2929
evaluateOnCallFrame(options: {
3030
callFrameId: string,
3131
expression: string

src/interceptors/electron.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,14 @@ export class ElectronInterceptor implements Interceptor {
101101
});
102102
});
103103

104-
debugClient.Runtime.runIfWaitingForDebugger();
104+
await debugClient.Runtime.runIfWaitingForDebugger();
105105
await debugClient.Runtime.enable();
106106
await debugClient.Debugger.enable();
107107

108108
const callFrameId = await callFramePromise;
109109

110+
console.log("Injecting interception settings into Electron app...");
111+
110112
// Inside the Electron process, load our electron-intercepting JS.
111113
const injectionResult = await debugClient.Debugger.evaluateOnCallFrame({
112114
expression: `require(${
@@ -130,7 +132,9 @@ export class ElectronInterceptor implements Interceptor {
130132
throw new Error("Failed to inject into Electron app");
131133
}
132134

133-
debugClient.Debugger.resume();
135+
console.log("App intercepted, resuming...");
136+
await debugClient.Debugger.resume();
137+
console.log("App resumed, Electron interception complete");
134138
}
135139

136140
async deactivate(proxyPort: number | string): Promise<void> {

0 commit comments

Comments
 (0)