Skip to content

Commit 537e72a

Browse files
committed
Disable two-step Firefox setup on OSX
Annoyingly, OSX has some of the larger UX issues that this should fix, but also has problems with rapidly starting & stopping FF that break the solution. Still useful elsewhere though I think.
1 parent e682f59 commit 537e72a

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/interceptors/fresh-firefox.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,24 +153,26 @@ export class FreshFirefox implements Interceptor {
153153

154154
let existingPrefs: _.Dictionary<any> = {};
155155

156-
if (await canAccess(firefoxPrefsFile) === false) {
156+
if (await canAccess(firefoxPrefsFile) === false && process.platform !== 'darwin') {
157157
/*
158158
First time, we do a separate pre-usage startup & stop, without the proxy, for certificate setup.
159159
This helps avoid initial Firefox profile setup request noise, and tidies up some awkward UX where
160-
firefox likes to open extra welcome windows/tabs on first run, especially on OSX.
160+
firefox likes to open extra welcome windows/tabs on first run.
161+
162+
Unfortunately, OSX doesn't seem to play nicely with this, so we have to fall back to normal
163+
behaviour in that case.
161164
*/
162165
await this.setupFirefoxProfile();
163166
}
164167

165168
const certCheckServer = new CertCheckServer(this.config);
166169
await certCheckServer.start('https://amiusing.httptoolkit.tech');
167170

168-
// At this stage, we've run firefox at least once, at it's working nicely.
169171
// We need to preserve & reuse any existing preferences, to avoid issues
170172
// where on pref setup firefox behaves badly (opening a 2nd window) on OSX.
171173
const prefContents = await readFile(firefoxPrefsFile, {
172174
encoding: 'utf8'
173-
});
175+
}).catch(() => '');
174176

175177
existingPrefs = _(prefContents)
176178
.split('\n')

0 commit comments

Comments
 (0)