fix(executablePath): throw unexpected platform error upon call (#3943)

This commit is contained in:
Pavel Feldman 2020-09-21 15:51:27 -07:00 committed by GitHub
parent cd0a123e78
commit f1016c1fc1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -54,6 +54,8 @@ export class BrowserType extends ChannelOwner<channels.BrowserTypeChannel, chann
} }
executablePath(): string { executablePath(): string {
if (!this._initializer.executablePath)
throw new Error('Browser is not supported on current platform');
return this._initializer.executablePath; return this._initializer.executablePath;
} }

View File

@ -39,7 +39,7 @@ type WebSocketNotPipe = { webSocketRegex: RegExp, stream: 'stdout' | 'stderr' };
export abstract class BrowserType { export abstract class BrowserType {
private _name: string; private _name: string;
private _executablePath: string | undefined; private _executablePath: string;
private _webSocketNotPipe: WebSocketNotPipe | null; private _webSocketNotPipe: WebSocketNotPipe | null;
private _browserDescriptor: browserPaths.BrowserDescriptor; private _browserDescriptor: browserPaths.BrowserDescriptor;
readonly _browserPath: string; readonly _browserPath: string;
@ -49,13 +49,11 @@ export abstract class BrowserType {
const browsersPath = browserPaths.browsersPath(packagePath); const browsersPath = browserPaths.browsersPath(packagePath);
this._browserDescriptor = browser; this._browserDescriptor = browser;
this._browserPath = browserPaths.browserDirectory(browsersPath, browser); this._browserPath = browserPaths.browserDirectory(browsersPath, browser);
this._executablePath = browserPaths.executablePath(this._browserPath, browser); this._executablePath = browserPaths.executablePath(this._browserPath, browser) || '';
this._webSocketNotPipe = webSocketOrPipe; this._webSocketNotPipe = webSocketOrPipe;
} }
executablePath(): string { executablePath(): string {
if (!this._executablePath)
throw new Error('Browser is not supported on current platform');
return this._executablePath; return this._executablePath;
} }