Node updated. Some todos.
This commit is contained in:
10
Scripts/node_modules/chromium-bidi/lib/cjs/bidiServer/BrowserInstance.d.ts
generated
vendored
10
Scripts/node_modules/chromium-bidi/lib/cjs/bidiServer/BrowserInstance.d.ts
generated
vendored
@ -1,12 +1,9 @@
|
||||
import { type ChromeReleaseChannel, type Process } from '@puppeteer/browsers';
|
||||
import type { MapperOptions } from '../bidiMapper/BidiServer.js';
|
||||
import { type Process } from '@puppeteer/browsers';
|
||||
import { MapperServerCdpConnection } from './MapperCdpConnection.js';
|
||||
import type { SimpleTransport } from './SimpleTransport.js';
|
||||
type ChromeOptions = {
|
||||
export type ChromeOptions = {
|
||||
chromeArgs: string[];
|
||||
chromeBinary?: string;
|
||||
channel: ChromeReleaseChannel;
|
||||
headless: boolean;
|
||||
};
|
||||
/**
|
||||
* BrowserProcess is responsible for running the browser and BiDi Mapper within
|
||||
@ -19,9 +16,8 @@ type ChromeOptions = {
|
||||
*/
|
||||
export declare class BrowserInstance {
|
||||
#private;
|
||||
static run(chromeOptions: ChromeOptions, mapperOptions: MapperOptions, verbose: boolean): Promise<BrowserInstance>;
|
||||
static run(chromeOptions: ChromeOptions, verbose: boolean): Promise<BrowserInstance>;
|
||||
constructor(mapperCdpConnection: MapperServerCdpConnection, browserProcess: Process);
|
||||
close(): Promise<void>;
|
||||
bidiSession(): SimpleTransport;
|
||||
}
|
||||
export {};
|
||||
|
||||
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) {
|
||||
|
||||
2
Scripts/node_modules/chromium-bidi/lib/cjs/bidiServer/BrowserInstance.js.map
generated
vendored
2
Scripts/node_modules/chromium-bidi/lib/cjs/bidiServer/BrowserInstance.js.map
generated
vendored
@ -1 +1 @@
|
||||
{"version":3,"file":"BrowserInstance.js","sourceRoot":"","sources":["../../../src/bidiServer/BrowserInstance.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;;;;AAEH,0CAAoC;AACpC,4CAAoB;AACpB,gDAAwB;AAExB,kDAO6B;AAC7B,kDAA0B;AAC1B,4CAA2B;AAG3B,8DAA4D;AAC5D,0EAAkE;AAElE,qEAAmE;AACnE,2CAA+C;AAG/C,MAAM,aAAa,GAAG,IAAA,eAAK,EAAC,sBAAsB,CAAC,CAAC;AASpD;;;;;;;;GAQG;AACH,MAAa,eAAe;IAC1B,oBAAoB,CAA4B;IAChD,eAAe,CAAU;IAEzB,MAAM,CAAC,KAAK,CAAC,GAAG,CACd,aAA4B,EAC5B,aAA4B,EAC5B,OAAgB;QAEhB,MAAM,UAAU,GAAG,MAAM,IAAA,kBAAO,EAC9B,cAAI,CAAC,IAAI,CAAC,YAAE,CAAC,MAAM,EAAE,EAAE,yBAAyB,CAAC,CAClD,CAAC;QACF,+FAA+F;QAC/F,MAAM,eAAe,GAAG;YACtB,GAAG,CAAC,aAAa,CAAC,QAAQ;gBACxB,CAAC,CAAC,CAAC,YAAY,EAAE,mBAAmB,EAAE,cAAc,CAAC;gBACrD,CAAC,CAAC,EAAE,CAAC;YACP,oBAAoB;YACpB,8BAA8B;YAC9B,4BAA4B;YAC5B,wBAAwB;YACxB,kEAAkE;YAClE,oBAAoB;YACpB,yBAAyB;YACzB,0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AC;gBACtD,OAAO,CAAC,UAAU,CAAC,CAAC;YACtB,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAlHD,0CAkHC"}
|
||||
3
Scripts/node_modules/chromium-bidi/lib/cjs/bidiServer/MapperCdpConnection.d.ts
generated
vendored
3
Scripts/node_modules/chromium-bidi/lib/cjs/bidiServer/MapperCdpConnection.d.ts
generated
vendored
@ -14,12 +14,11 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import type { MapperOptions } from '../bidiMapper/BidiServer.js';
|
||||
import type { MapperCdpConnection } from '../cdp/CdpConnection.js';
|
||||
import { SimpleTransport } from './SimpleTransport.js';
|
||||
export declare class MapperServerCdpConnection {
|
||||
#private;
|
||||
static create(cdpConnection: MapperCdpConnection, mapperTabSource: string, verbose: boolean, mapperOptions: MapperOptions): Promise<MapperServerCdpConnection>;
|
||||
static create(cdpConnection: MapperCdpConnection, mapperTabSource: string, verbose: boolean): Promise<MapperServerCdpConnection>;
|
||||
private constructor();
|
||||
close(): void;
|
||||
bidiSession(): SimpleTransport;
|
||||
|
||||
27
Scripts/node_modules/chromium-bidi/lib/cjs/bidiServer/MapperCdpConnection.js
generated
vendored
27
Scripts/node_modules/chromium-bidi/lib/cjs/bidiServer/MapperCdpConnection.js
generated
vendored
@ -39,9 +39,9 @@ const getLogger = (type) => {
|
||||
class MapperServerCdpConnection {
|
||||
#cdpConnection;
|
||||
#bidiSession;
|
||||
static async create(cdpConnection, mapperTabSource, verbose, mapperOptions) {
|
||||
static async create(cdpConnection, mapperTabSource, verbose) {
|
||||
try {
|
||||
const bidiSession = await this.#initMapper(cdpConnection, mapperTabSource, verbose, mapperOptions);
|
||||
const bidiSession = await this.#initMapper(cdpConnection, mapperTabSource, verbose);
|
||||
return new MapperServerCdpConnection(cdpConnection, bidiSession);
|
||||
}
|
||||
catch (e) {
|
||||
@ -96,14 +96,24 @@ class MapperServerCdpConnection {
|
||||
static #onRuntimeExceptionThrown = (params) => {
|
||||
debugInfo('exceptionThrown:', params);
|
||||
};
|
||||
static async #initMapper(cdpConnection, mapperTabSource, verbose, mapperOptions) {
|
||||
debugInternal('Initializing Mapper.', mapperOptions);
|
||||
static async #initMapper(cdpConnection, mapperTabSource, verbose) {
|
||||
debugInternal('Initializing Mapper.');
|
||||
const browserClient = await cdpConnection.createBrowserSession();
|
||||
const { targetId: mapperTabTargetId } = await browserClient.sendCommand('Target.createTarget', {
|
||||
url: 'about:blank',
|
||||
});
|
||||
// Run mapper in the first open tab.
|
||||
const targets = (await cdpConnection.sendCommand('Target.getTargets', {}));
|
||||
const mapperTabTargetId = targets.targetInfos.filter((target) => target.type === 'page')[0].targetId;
|
||||
const { sessionId: mapperSessionId } = await browserClient.sendCommand('Target.attachToTarget', { targetId: mapperTabTargetId, flatten: true });
|
||||
const mapperCdpClient = cdpConnection.getCdpClient(mapperSessionId);
|
||||
// Click on the body to interact with the page in order to "beforeunload" being
|
||||
// triggered when the tab is closed.
|
||||
await mapperCdpClient.sendCommand('Runtime.evaluate', {
|
||||
expression: 'document.body.click()',
|
||||
userGesture: true,
|
||||
});
|
||||
// Create and activate new tab with a blank page.
|
||||
await browserClient.sendCommand('Target.createTarget', {
|
||||
url: 'about:blank',
|
||||
});
|
||||
const bidiSession = new SimpleTransport_js_1.SimpleTransport(async (message) => await this.#sendMessage(mapperCdpClient, message));
|
||||
// Process responses from the mapper tab.
|
||||
mapperCdpClient.on('Runtime.bindingCalled', (params) => this.#onBindingCalled(params, bidiSession));
|
||||
@ -129,8 +139,9 @@ class MapperServerCdpConnection {
|
||||
await mapperCdpClient.sendCommand('Runtime.evaluate', {
|
||||
expression: mapperTabSource,
|
||||
});
|
||||
// TODO: handle errors in all these evaluate calls!
|
||||
await mapperCdpClient.sendCommand('Runtime.evaluate', {
|
||||
expression: `window.runMapperInstance('${mapperTabTargetId}', ${JSON.stringify(mapperOptions)})`,
|
||||
expression: `window.runMapperInstance('${mapperTabTargetId}')`,
|
||||
awaitPromise: true,
|
||||
});
|
||||
debugInternal('Mapper is launched!');
|
||||
|
||||
2
Scripts/node_modules/chromium-bidi/lib/cjs/bidiServer/MapperCdpConnection.js.map
generated
vendored
2
Scripts/node_modules/chromium-bidi/lib/cjs/bidiServer/MapperCdpConnection.js.map
generated
vendored
@ -1 +1 @@
|
||||
{"version":3,"file":"MapperCdpConnection.js","sourceRoot":"","sources":["../../../src/bidiServer/MapperCdpConnection.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;;;;AAEH,kDAA2C;AAQ3C,6DAAqD;AAErD,MAAM,aAAa,GAAG,IAAA,eAAK,EAAC,sBAAsB,CAAC,CAAC;AACpD,MAAM,SAAS,GAAG,IAAA,eAAK,EAAC,kBAAkB,CAAC,CAAC;AAC5C,MAAM,WAAW,GAAG,IAAA,eAAK,EAAC,0BAA0B,CAAC,CAAC;AACtD,6BAA6B;AAC7B,MAAM,OAAO,GAAG,IAAI,GAAG,EAAoB,CAAC;AAC5C,MAAM,SAAS,GAAG,CAAC,IAAe,EAAE,EAAE;IACpC,MAAM,MAAM,GAAG,eAAe,IAAI,EAAE,CAAC;IACrC,IAAI,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACjC,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,GAAG,IAAA,eAAK,EAAC,MAAM,CAAC,CAAC;QACvB,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEF,MAAa,yBAAyB;IACpC,cAAc,CAAsB;IACpC,YAAY,CAAkB;IAE9B,MAAM,CAAC,KAAK,CAAC,MAAM,CACjB,aAAkC,EAClC,eAAuB,EACvB,OAAgB,EAChB,aAA4B;QAE5B,IAAI,CAAC;YACH,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,WAAW,CACxC,aAAa,EACb,eAAe,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oB,EAAE;gBACtD,IAAI,EAAE,kBAAkB;aACzB,CAAC,CAAC;QACL,CAAC;QAED,0CAA0C;QAC1C,MAAM,eAAe,CAAC,WAAW,CAAC,kBAAkB,EAAE;YACpD,UAAU,EAAE,eAAe;SAC5B,CAAC,CAAC;QAEH,mDAAmD;QACnD,MAAM,eAAe,CAAC,WAAW,CAAC,kBAAkB,EAAE;YACpD,UAAU,EAAE,6BAA6B,iBAAiB,IAAI;YAC9D,YAAY,EAAE,IAAI;SACnB,CAAC,CAAC;QAEH,aAAa,CAAC,qBAAqB,CAAC,CAAC;QACrC,OAAO,WAAW,CAAC;IACrB,CAAC;;AAnLH,8DAoLC"}
|
||||
2
Scripts/node_modules/chromium-bidi/lib/cjs/bidiServer/SimpleTransport.d.ts
generated
vendored
2
Scripts/node_modules/chromium-bidi/lib/cjs/bidiServer/SimpleTransport.d.ts
generated
vendored
@ -1,4 +1,4 @@
|
||||
import { EventEmitter } from '../utils/EventEmitter';
|
||||
import { EventEmitter } from '../utils/EventEmitter.js';
|
||||
/**
|
||||
* Implements simple transport that allows sending string messages via
|
||||
* `sendCommand` and receiving them via `on('message')`.
|
||||
|
||||
4
Scripts/node_modules/chromium-bidi/lib/cjs/bidiServer/SimpleTransport.js
generated
vendored
4
Scripts/node_modules/chromium-bidi/lib/cjs/bidiServer/SimpleTransport.js
generated
vendored
@ -17,12 +17,12 @@
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.SimpleTransport = void 0;
|
||||
const EventEmitter_1 = require("../utils/EventEmitter");
|
||||
const EventEmitter_js_1 = require("../utils/EventEmitter.js");
|
||||
/**
|
||||
* Implements simple transport that allows sending string messages via
|
||||
* `sendCommand` and receiving them via `on('message')`.
|
||||
*/
|
||||
class SimpleTransport extends EventEmitter_1.EventEmitter {
|
||||
class SimpleTransport extends EventEmitter_js_1.EventEmitter {
|
||||
#sendCommandDelegate;
|
||||
/**
|
||||
* @param sendCommandDelegate delegate to be called in `sendCommand`.
|
||||
|
||||
2
Scripts/node_modules/chromium-bidi/lib/cjs/bidiServer/SimpleTransport.js.map
generated
vendored
2
Scripts/node_modules/chromium-bidi/lib/cjs/bidiServer/SimpleTransport.js.map
generated
vendored
@ -1 +1 @@
|
||||
{"version":3,"file":"SimpleTransport.js","sourceRoot":"","sources":["../../../src/bidiServer/SimpleTransport.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH,wDAAmD;AAEnD;;;GAGG;AACH,MAAa,eAAgB,SAAQ,2BAAuC;IACjE,oBAAoB,CAA0C;IAEvE;;OAEG;IACH,YAAY,mBAA4D;QACtE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,oBAAoB,GAAG,mBAAmB,CAAC;IAClD,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,YAAoB;QACpC,MAAM,IAAI,CAAC,oBAAoB,CAAC,YAAY,CAAC,CAAC;IAChD,CAAC;CACF;AAdD,0CAcC"}
|
||||
{"version":3,"file":"SimpleTransport.js","sourceRoot":"","sources":["../../../src/bidiServer/SimpleTransport.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH,8DAAsD;AAEtD;;;GAGG;AACH,MAAa,eAAgB,SAAQ,8BAAuC;IACjE,oBAAoB,CAA0C;IAEvE;;OAEG;IACH,YAAY,mBAA4D;QACtE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,oBAAoB,GAAG,mBAAmB,CAAC;IAClD,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,YAAoB;QACpC,MAAM,IAAI,CAAC,oBAAoB,CAAC,YAAY,CAAC,CAAC;IAChD,CAAC;CACF;AAdD,0CAcC"}
|
||||
3
Scripts/node_modules/chromium-bidi/lib/cjs/bidiServer/WebSocketServer.d.ts
generated
vendored
3
Scripts/node_modules/chromium-bidi/lib/cjs/bidiServer/WebSocketServer.d.ts
generated
vendored
@ -1,7 +1,6 @@
|
||||
import type { ChromeReleaseChannel } from '@puppeteer/browsers';
|
||||
import debug from 'debug';
|
||||
export declare const debugInfo: debug.Debugger;
|
||||
export declare class WebSocketServer {
|
||||
#private;
|
||||
constructor(port: number, channel: ChromeReleaseChannel, headless: boolean, verbose: boolean);
|
||||
constructor(port: number, verbose: boolean);
|
||||
}
|
||||
|
||||
127
Scripts/node_modules/chromium-bidi/lib/cjs/bidiServer/WebSocketServer.js
generated
vendored
127
Scripts/node_modules/chromium-bidi/lib/cjs/bidiServer/WebSocketServer.js
generated
vendored
@ -46,6 +46,7 @@ exports.WebSocketServer = exports.debugInfo = void 0;
|
||||
const http_1 = __importDefault(require("http"));
|
||||
const debug_1 = __importDefault(require("debug"));
|
||||
const websocket = __importStar(require("websocket"));
|
||||
const Deferred_js_1 = require("../utils/Deferred.js");
|
||||
const uuid_js_1 = require("../utils/uuid.js");
|
||||
const BrowserInstance_js_1 = require("./BrowserInstance.js");
|
||||
exports.debugInfo = (0, debug_1.default)('bidi:server:info');
|
||||
@ -55,30 +56,55 @@ const debugRecv = (0, debug_1.default)('bidi:server:RECV â—‚');
|
||||
class WebSocketServer {
|
||||
#sessions = new Map();
|
||||
#port;
|
||||
#channel;
|
||||
#headless;
|
||||
#verbose;
|
||||
#server;
|
||||
#wsServer;
|
||||
constructor(port, channel, headless, verbose) {
|
||||
constructor(port, verbose) {
|
||||
this.#port = port;
|
||||
this.#channel = channel;
|
||||
this.#headless = headless;
|
||||
this.#verbose = verbose;
|
||||
this.#server = http_1.default.createServer(this.#onRequest.bind(this));
|
||||
this.#server = http_1.default.createServer((request, response) => {
|
||||
return this.#onRequest(request, response).catch((e) => {
|
||||
(0, exports.debugInfo)('Error while processing request', e);
|
||||
response.writeHead(500, String(e));
|
||||
});
|
||||
});
|
||||
this.#wsServer = new websocket.server({
|
||||
httpServer: this.#server,
|
||||
autoAcceptConnections: false,
|
||||
});
|
||||
this.#wsServer.on('request', this.#onWsRequest.bind(this));
|
||||
this.#server.listen(this.#port, () => {
|
||||
(0, exports.debugInfo)('BiDi server is listening on port', this.#port);
|
||||
});
|
||||
void this.#listen();
|
||||
}
|
||||
#logServerStarted() {
|
||||
(0, exports.debugInfo)('BiDi server is listening on port', this.#port);
|
||||
(0, exports.debugInfo)('BiDi server was started successfully.');
|
||||
}
|
||||
async #listen() {
|
||||
try {
|
||||
this.#server.listen(this.#port, () => {
|
||||
this.#logServerStarted();
|
||||
});
|
||||
}
|
||||
catch (error) {
|
||||
if (error &&
|
||||
typeof error === 'object' &&
|
||||
'code' in error &&
|
||||
error.code === 'EADDRINUSE') {
|
||||
await new Promise((resolve) => {
|
||||
setTimeout(resolve, 500);
|
||||
});
|
||||
(0, exports.debugInfo)('Retrying to run BiDi server');
|
||||
this.#server.listen(this.#port, () => {
|
||||
this.#logServerStarted();
|
||||
});
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
async #onRequest(request, response) {
|
||||
debugInternal(`Received HTTP ${JSON.stringify(request.method)} request for ${JSON.stringify(request.url)}`);
|
||||
if (!request.url) {
|
||||
return response.end(404);
|
||||
throw new Error('Request URL is empty.');
|
||||
}
|
||||
// https://w3c.github.io/webdriver-bidi/#transport, step 2.
|
||||
if (request.url === '/session') {
|
||||
@ -92,6 +118,7 @@ class WebSocketServer {
|
||||
resolve(Buffer.concat(bodyArray));
|
||||
});
|
||||
});
|
||||
debugInternal(`Creating session by HTTP request ${body.toString()}`);
|
||||
// https://w3c.github.io/webdriver-bidi/#transport, step 3.
|
||||
const jsonBody = JSON.parse(body.toString());
|
||||
response.writeHead(200, {
|
||||
@ -105,9 +132,9 @@ class WebSocketServer {
|
||||
// tests clean up is switched to pure BiDi.
|
||||
browserInstancePromise: undefined,
|
||||
sessionOptions: {
|
||||
chromeOptions: this.#getChromeOptions(jsonBody.capabilities, this.#channel, this.#headless),
|
||||
mapperOptions: this.#getMapperOptions(jsonBody.capabilities),
|
||||
chromeOptions: this.#getChromeOptions(jsonBody.capabilities),
|
||||
verbose: this.#verbose,
|
||||
sessionNewBody: `{"id":0,"method":"session.new","params":${body.toString()}}`,
|
||||
},
|
||||
};
|
||||
this.#sessions.set(sessionId, session);
|
||||
@ -134,13 +161,16 @@ class WebSocketServer {
|
||||
}));
|
||||
return response.end();
|
||||
}
|
||||
debugInternal(`Unknown ${request.method} request for ${JSON.stringify(request.url)} with payload ${await this.#getHttpRequestPayload(request)}. 404 returned.`);
|
||||
return response.end(404);
|
||||
throw new Error(`Unknown "${request.method}" request for "${JSON.stringify(request.url)}" with payload "${await this.#getHttpRequestPayload(request)}".`);
|
||||
}
|
||||
#onWsRequest(request) {
|
||||
// Session is set either by Classic or BiDi commands.
|
||||
let session;
|
||||
const requestSessionId = (request.resource ?? '').split('/').pop();
|
||||
// Request to `/session` should be treated as a new session request.
|
||||
let requestSessionId = '';
|
||||
if ((request.resource ?? '').startsWith(`/session/`)) {
|
||||
requestSessionId = (request.resource ?? '').split('/').pop() ?? '';
|
||||
}
|
||||
debugInternal(`new WS request received. Path: ${JSON.stringify(request.resourceURL.path)}, sessionId: ${JSON.stringify(requestSessionId)}`);
|
||||
if (requestSessionId !== '' &&
|
||||
requestSessionId !== undefined &&
|
||||
@ -186,8 +216,8 @@ class WebSocketServer {
|
||||
try {
|
||||
parsedCommandData = JSON.parse(plainCommandData);
|
||||
}
|
||||
catch (e) {
|
||||
this.#respondWithError(connection, {}, "invalid argument" /* ErrorCode.InvalidArgument */, `Cannot parse data as JSON`);
|
||||
catch (error) {
|
||||
this.#respondWithError(connection, {}, "invalid argument" /* ErrorCode.InvalidArgument */, `Cannot parse data as JSON, ${error}`);
|
||||
return;
|
||||
}
|
||||
// Handle creating new session.
|
||||
@ -199,11 +229,11 @@ class WebSocketServer {
|
||||
}
|
||||
try {
|
||||
const sessionOptions = {
|
||||
chromeOptions: this.#getChromeOptions(parsedCommandData.params?.capabilities, this.#channel, this.#headless),
|
||||
mapperOptions: this.#getMapperOptions(parsedCommandData.params?.capabilities),
|
||||
chromeOptions: this.#getChromeOptions(parsedCommandData.params?.capabilities),
|
||||
verbose: this.#verbose,
|
||||
sessionNewBody: plainCommandData,
|
||||
};
|
||||
const browserInstance = await this.#launchBrowserInstance(connection, sessionOptions);
|
||||
const browserInstance = await this.#launchBrowserInstance(connection, sessionOptions, true);
|
||||
const sessionId = (0, uuid_js_1.uuidv4)();
|
||||
session = {
|
||||
sessionId,
|
||||
@ -217,14 +247,28 @@ class WebSocketServer {
|
||||
this.#respondWithError(connection, plainCommandData, "session not created" /* ErrorCode.SessionNotCreated */, e?.message ?? 'Unknown error');
|
||||
return;
|
||||
}
|
||||
// TODO: extend with capabilities.
|
||||
return;
|
||||
}
|
||||
// Handle ending session. Close browser if open, remove session.
|
||||
if (parsedCommandData.method === 'session.end') {
|
||||
if (session === undefined) {
|
||||
(0, exports.debugInfo)('WS connection does not have an associated session.');
|
||||
this.#respondWithError(connection, plainCommandData, "session not created" /* ErrorCode.SessionNotCreated */, 'WS connection does not have an associated session.');
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await this.#closeBrowserInstanceIfLaunched(session);
|
||||
this.#sessions.delete(session.sessionId);
|
||||
}
|
||||
catch (e) {
|
||||
(0, exports.debugInfo)('Error while closing session', e);
|
||||
this.#respondWithError(connection, plainCommandData, "unknown error" /* ErrorCode.UnknownError */, `Session cannot be closed. Error: ${e?.message}`);
|
||||
return;
|
||||
}
|
||||
this.#sendClientMessage({
|
||||
id: parsedCommandData.id,
|
||||
type: 'success',
|
||||
result: {
|
||||
sessionId: session.sessionId,
|
||||
capabilities: {},
|
||||
},
|
||||
result: {},
|
||||
}, connection);
|
||||
return;
|
||||
}
|
||||
@ -266,23 +310,36 @@ class WebSocketServer {
|
||||
session.browserInstancePromise = undefined;
|
||||
void browserInstance.close();
|
||||
}
|
||||
#getMapperOptions(capabilities) {
|
||||
const acceptInsecureCerts = capabilities?.alwaysMatch?.acceptInsecureCerts ?? false;
|
||||
const sharedIdWithFrame = capabilities?.alwaysMatch?.sharedIdWithFrame ?? false;
|
||||
return { acceptInsecureCerts, sharedIdWithFrame };
|
||||
}
|
||||
#getChromeOptions(capabilities, channel, headless) {
|
||||
#getChromeOptions(capabilities) {
|
||||
const chromeCapabilities = capabilities?.alwaysMatch?.['goog:chromeOptions'];
|
||||
return {
|
||||
chromeArgs: chromeCapabilities?.args ?? [],
|
||||
channel,
|
||||
headless,
|
||||
chromeBinary: chromeCapabilities?.binary ?? undefined,
|
||||
};
|
||||
}
|
||||
async #launchBrowserInstance(connection, sessionOptions) {
|
||||
async #launchBrowserInstance(connection, sessionOptions, passSessionNewThrough = false) {
|
||||
(0, exports.debugInfo)('Scheduling browser launch...');
|
||||
const browserInstance = await BrowserInstance_js_1.BrowserInstance.run(sessionOptions.chromeOptions, sessionOptions.mapperOptions, sessionOptions.verbose);
|
||||
const browserInstance = await BrowserInstance_js_1.BrowserInstance.run(sessionOptions.chromeOptions, sessionOptions.verbose);
|
||||
const body = JSON.parse(sessionOptions.sessionNewBody);
|
||||
const id = body.id;
|
||||
const sessionCreated = new Deferred_js_1.Deferred();
|
||||
const sessionResponseListener = (message) => {
|
||||
const jsonMessage = JSON.parse(message);
|
||||
if (jsonMessage['id'] === id) {
|
||||
(0, exports.debugInfo)('Receiving session.new response from mapper', message);
|
||||
sessionCreated.resolve();
|
||||
if (passSessionNewThrough) {
|
||||
this.#sendClientMessageString(message, connection);
|
||||
}
|
||||
}
|
||||
};
|
||||
browserInstance.bidiSession().on('message', sessionResponseListener);
|
||||
(0, exports.debugInfo)('Sending session.new to mapper', sessionOptions.sessionNewBody);
|
||||
await browserInstance
|
||||
.bidiSession()
|
||||
.sendCommand(sessionOptions.sessionNewBody);
|
||||
await sessionCreated;
|
||||
browserInstance.bidiSession().off('message', sessionResponseListener);
|
||||
// Forward messages from BiDi Mapper to the client unconditionally.
|
||||
browserInstance.bidiSession().on('message', (message) => {
|
||||
this.#sendClientMessageString(message, connection);
|
||||
|
||||
2
Scripts/node_modules/chromium-bidi/lib/cjs/bidiServer/WebSocketServer.js.map
generated
vendored
2
Scripts/node_modules/chromium-bidi/lib/cjs/bidiServer/WebSocketServer.js.map
generated
vendored
File diff suppressed because one or more lines are too long
8
Scripts/node_modules/chromium-bidi/lib/cjs/bidiServer/index.d.ts
generated
vendored
8
Scripts/node_modules/chromium-bidi/lib/cjs/bidiServer/index.d.ts
generated
vendored
@ -14,4 +14,10 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
export {};
|
||||
export declare function parseCommandLineArgs(): {
|
||||
[x: string]: unknown;
|
||||
port: number;
|
||||
verbose: boolean;
|
||||
_: (string | number)[];
|
||||
$0: string;
|
||||
};
|
||||
|
||||
56
Scripts/node_modules/chromium-bidi/lib/cjs/bidiServer/index.js
generated
vendored
56
Scripts/node_modules/chromium-bidi/lib/cjs/bidiServer/index.js
generated
vendored
@ -15,45 +15,37 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const browsers_1 = require("@puppeteer/browsers");
|
||||
const argparse_1 = require("argparse");
|
||||
exports.parseCommandLineArgs = parseCommandLineArgs;
|
||||
const yargs_1 = __importDefault(require("yargs"));
|
||||
const helpers_1 = require("yargs/helpers");
|
||||
const WebSocketServer_js_1 = require("./WebSocketServer.js");
|
||||
function parseArguments() {
|
||||
const parser = new argparse_1.ArgumentParser({
|
||||
add_help: true,
|
||||
exit_on_error: true,
|
||||
});
|
||||
parser.add_argument('-c', '--channel', {
|
||||
help: 'If set, the given installed Chrome Release Channel will be used ' +
|
||||
'instead of one pointed by Puppeteer version',
|
||||
choices: Object.values(browsers_1.ChromeReleaseChannel),
|
||||
default: browsers_1.ChromeReleaseChannel.DEV,
|
||||
});
|
||||
parser.add_argument('--headless', {
|
||||
help: 'Sets if browser should run in headless or headful mode. Default is true.',
|
||||
default: true,
|
||||
});
|
||||
parser.add_argument('-p', '--port', {
|
||||
help: 'Port that BiDi server should listen to. Default is 8080.',
|
||||
type: 'int',
|
||||
default: process.env['PORT'] ?? 8080,
|
||||
});
|
||||
parser.add_argument('-v', '--verbose', {
|
||||
help: 'If present, the Mapper debug log, including CDP commands and events will be logged into the server output.',
|
||||
action: 'store_true',
|
||||
function parseCommandLineArgs() {
|
||||
return (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv))
|
||||
.usage(`$0`, `[PORT=8080] [VERBOSE=8080]`)
|
||||
.option('port', {
|
||||
alias: 'p',
|
||||
describe: 'Port that BiDi server should listen to. Default is 8080.',
|
||||
type: 'number',
|
||||
default: process.env['PORT'] ? Number(process.env['PORT']) : 8080,
|
||||
})
|
||||
.option('verbose', {
|
||||
alias: 'v',
|
||||
describe: 'If present, the Mapper debug log, including CDP commands and events will be logged into the server output.',
|
||||
type: 'boolean',
|
||||
default: process.env['VERBOSE'] === 'true' || false,
|
||||
});
|
||||
return parser.parse_known_args()[0];
|
||||
})
|
||||
.parseSync();
|
||||
}
|
||||
(() => {
|
||||
try {
|
||||
const args = parseArguments();
|
||||
const { channel, port } = args;
|
||||
const headless = args.headless !== 'false';
|
||||
const verbose = args.verbose === true;
|
||||
const argv = parseCommandLineArgs();
|
||||
const { port, verbose } = argv;
|
||||
(0, WebSocketServer_js_1.debugInfo)('Launching BiDi server...');
|
||||
new WebSocketServer_js_1.WebSocketServer(port, channel, headless, verbose);
|
||||
new WebSocketServer_js_1.WebSocketServer(port, verbose);
|
||||
(0, WebSocketServer_js_1.debugInfo)('BiDi server launched');
|
||||
}
|
||||
catch (e) {
|
||||
|
||||
2
Scripts/node_modules/chromium-bidi/lib/cjs/bidiServer/index.js.map
generated
vendored
2
Scripts/node_modules/chromium-bidi/lib/cjs/bidiServer/index.js.map
generated
vendored
@ -1 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/bidiServer/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;AAEH,kDAAyD;AAC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G,IAAI,CAAC;QAE7B,IAAA,8BAAS,EAAC,0BAA0B,CAAC,CAAC;QAEtC,IAAI,oCAAe,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACnC,IAAA,8BAAS,EAAC,sBAAsB,CAAC,CAAC;IACpC,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,IAAA,8BAAS,EAAC,6BAA6B,EAAE,CAAC,CAAC,CAAC;IAC9C,CAAC;AACH,CAAC,CAAC,EAAE,CAAC"}
|
||||
3
Scripts/node_modules/chromium-bidi/lib/cjs/bidiServer/reader.js
generated
vendored
3
Scripts/node_modules/chromium-bidi/lib/cjs/bidiServer/reader.js
generated
vendored
@ -19,11 +19,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getMapperTabSource = void 0;
|
||||
exports.getMapperTabSource = getMapperTabSource;
|
||||
const promises_1 = __importDefault(require("fs/promises"));
|
||||
const path_1 = __importDefault(require("path"));
|
||||
async function getMapperTabSource() {
|
||||
return await promises_1.default.readFile(path_1.default.join(__dirname, '../../iife/mapperTab.js'), 'utf8');
|
||||
}
|
||||
exports.getMapperTabSource = getMapperTabSource;
|
||||
//# sourceMappingURL=reader.js.map
|
||||
2
Scripts/node_modules/chromium-bidi/lib/cjs/bidiServer/reader.js.map
generated
vendored
2
Scripts/node_modules/chromium-bidi/lib/cjs/bidiServer/reader.js.map
generated
vendored
@ -1 +1 @@
|
||||
{"version":3,"file":"reader.js","sourceRoot":"","sources":["../../../src/bidiServer/reader.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;;;;AAEH,2DAA6B;AAC7B,gDAAwB;AAEjB,KAAK,UAAU,kBAAkB;IACtC,OAAO,MAAM,kBAAE,CAAC,QAAQ,CACtB,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,yBAAyB,CAAC,EAC/C,MAAM,CACP,CAAC;AACJ,CAAC;AALD,gDAKC"}
|
||||
{"version":3,"file":"reader.js","sourceRoot":"","sources":["../../../src/bidiServer/reader.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;;;AAKH,gDAKC;AARD,2DAA6B;AAC7B,gDAAwB;AAEjB,KAAK,UAAU,kBAAkB;IACtC,OAAO,MAAM,kBAAE,CAAC,QAAQ,CACtB,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,yBAAyB,CAAC,EAC/C,MAAM,CACP,CAAC;AACJ,CAAC"}
|
||||
Reference in New Issue
Block a user