Skip to content

Commit 5438b06

Browse files
committed
Allow re-activating fresh Chromium browsers
This is useful because if you have an old process running, it's easy to lose it (especially on Mac, where it may be invisible) and this provides an easy way to ping it back into the foreground.
1 parent b79064c commit 5438b06

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/interceptors/chromium-based-interceptors.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ abstract class FreshChromiumBasedInterceptor implements Interceptor {
9696
}
9797

9898
async activate(proxyPort: number, options: { webExtensionEnabled?: boolean } = {}) {
99-
if (this.isActive(proxyPort)) return;
99+
const alreadyActive = this.isActive(proxyPort);
100100

101101
const hideWarningServer = new HideWarningServer(this.config);
102102
await hideWarningServer.start('https://amiusing.httptoolkit.tech');
@@ -119,6 +119,8 @@ abstract class FreshChromiumBasedInterceptor implements Interceptor {
119119
await hideWarningServer.completedPromise;
120120
await hideWarningServer.stop();
121121

122+
if (alreadyActive) return; // If we're just opening a new tab, we're done, don't track the process.
123+
122124
this.activeBrowsers[proxyPort] = browser;
123125
browser.process.once('close', async () => {
124126
delete this.activeBrowsers[proxyPort];

0 commit comments

Comments
 (0)