Skip to content

Commit f1016c1

Browse files
authored
fix(executablePath): throw unexpected platform error upon call (#3943)
1 parent cd0a123 commit f1016c1

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/client/browserType.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ export class BrowserType extends ChannelOwner<channels.BrowserTypeChannel, chann
5454
}
5555

5656
executablePath(): string {
57+
if (!this._initializer.executablePath)
58+
throw new Error('Browser is not supported on current platform');
5759
return this._initializer.executablePath;
5860
}
5961

src/server/browserType.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ type WebSocketNotPipe = { webSocketRegex: RegExp, stream: 'stdout' | 'stderr' };
3939

4040
export abstract class BrowserType {
4141
private _name: string;
42-
private _executablePath: string | undefined;
42+
private _executablePath: string;
4343
private _webSocketNotPipe: WebSocketNotPipe | null;
4444
private _browserDescriptor: browserPaths.BrowserDescriptor;
4545
readonly _browserPath: string;
@@ -49,13 +49,11 @@ export abstract class BrowserType {
4949
const browsersPath = browserPaths.browsersPath(packagePath);
5050
this._browserDescriptor = browser;
5151
this._browserPath = browserPaths.browserDirectory(browsersPath, browser);
52-
this._executablePath = browserPaths.executablePath(this._browserPath, browser);
52+
this._executablePath = browserPaths.executablePath(this._browserPath, browser) || '';
5353
this._webSocketNotPipe = webSocketOrPipe;
5454
}
5555

5656
executablePath(): string {
57-
if (!this._executablePath)
58-
throw new Error('Browser is not supported on current platform');
5957
return this._executablePath;
6058
}
6159

0 commit comments

Comments
 (0)