Node updated. Some todos.
This commit is contained in:
23
Scripts/node_modules/chromium-bidi/lib/cjs/bidiServer/BrowserInstance.js
generated
vendored
23
Scripts/node_modules/chromium-bidi/lib/cjs/bidiServer/BrowserInstance.js
generated
vendored
@ -44,13 +44,10 @@ const debugInternal = (0, debug_1.default)('bidi:mapper:internal');
|
||||
class BrowserInstance {
|
||||
#mapperCdpConnection;
|
||||
#browserProcess;
|
||||
static async run(chromeOptions, mapperOptions, verbose) {
|
||||
static async run(chromeOptions, verbose) {
|
||||
const profileDir = await (0, promises_1.mkdtemp)(path_1.default.join(os_1.default.tmpdir(), 'web-driver-bidi-server-'));
|
||||
// See https://github.com/GoogleChrome/chrome-launcher/blob/main/docs/chrome-flags-for-tools.md
|
||||
const chromeArguments = [
|
||||
...(chromeOptions.headless
|
||||
? ['--headless', '--hide-scrollbars', '--mute-audio']
|
||||
: []),
|
||||
// keep-sorted start
|
||||
'--allow-browser-signin=false',
|
||||
'--disable-component-update',
|
||||
@ -68,23 +65,23 @@ class BrowserInstance {
|
||||
'--use-mock-keychain',
|
||||
`--user-data-dir=${profileDir}`,
|
||||
// keep-sorted end
|
||||
...chromeOptions.chromeArgs.filter((arg) => !arg.startsWith('--headless')),
|
||||
...chromeOptions.chromeArgs,
|
||||
'about:blank',
|
||||
];
|
||||
const executablePath = chromeOptions.chromeBinary ??
|
||||
process.env['BROWSER_BIN'] ??
|
||||
(0, browsers_1.computeSystemExecutablePath)({
|
||||
browser: browsers_1.Browser.CHROME,
|
||||
channel: chromeOptions.channel,
|
||||
});
|
||||
const executablePath = chromeOptions.chromeBinary ?? process.env['BROWSER_BIN'];
|
||||
if (!executablePath) {
|
||||
throw new Error('Could not find Chrome binary');
|
||||
}
|
||||
const browserProcess = (0, browsers_1.launch)({
|
||||
const launchArguments = {
|
||||
executablePath,
|
||||
args: chromeArguments,
|
||||
env: process.env,
|
||||
};
|
||||
debugInternal(`Launching browser`, {
|
||||
executablePath,
|
||||
args: chromeArguments,
|
||||
});
|
||||
const browserProcess = (0, browsers_1.launch)(launchArguments);
|
||||
const cdpEndpoint = await browserProcess.waitForLineOutput(browsers_1.CDP_WEBSOCKET_ENDPOINT_REGEX);
|
||||
// There is a conflict between prettier and eslint here.
|
||||
// prettier-ignore
|
||||
@ -92,7 +89,7 @@ class BrowserInstance {
|
||||
// 2. Get `BiDi-CDP` mapper JS binaries.
|
||||
const mapperTabSource = await (0, reader_js_1.getMapperTabSource)();
|
||||
// 3. Run `BiDi-CDP` mapper in launched browser using `MapperRunner`.
|
||||
const mapperCdpConnection = await MapperCdpConnection_js_1.MapperServerCdpConnection.create(cdpConnection, mapperTabSource, verbose, mapperOptions);
|
||||
const mapperCdpConnection = await MapperCdpConnection_js_1.MapperServerCdpConnection.create(cdpConnection, mapperTabSource, verbose);
|
||||
return new BrowserInstance(mapperCdpConnection, browserProcess);
|
||||
}
|
||||
constructor(mapperCdpConnection, browserProcess) {
|
||||
|
||||
Reference in New Issue
Block a user