cherrypick(release-1.4): throw unexpected platform error upon call (#3946)

Cherry-pick:
- PR #3943 SHA 0090cd943c8c724cb0fe8b02f4fd7f7e7ba837bd

References #3919 and #3935

Co-authored-by: Pavel Feldman <pavel.feldman@gmail.com>
This commit is contained in:
Andrey Lushnikov 2020-09-23 16:26:35 -07:00 committed by GitHub
parent e79eada2be
commit b05c098f2a
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 {
if (!this._initializer.executablePath)
throw new Error('Browser is not supported on current platform');
return this._initializer.executablePath;
}

View file

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