Node updated. Some todos.
This commit is contained in:
5
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/BidiNoOpParser.d.ts
generated
vendored
5
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/BidiNoOpParser.d.ts
generated
vendored
@ -14,21 +14,24 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import type { BrowsingContext, Cdp, Input, Network, Script, Session, Storage, Permissions } from '../protocol/protocol.js';
|
||||
import type { Browser, BrowsingContext, Cdp, Input, Network, Script, Session, Storage, Permissions } from '../protocol/protocol.js';
|
||||
import type { BidiCommandParameterParser } from './BidiParser.js';
|
||||
export declare class BidiNoOpParser implements BidiCommandParameterParser {
|
||||
parseRemoveUserContextParams(params: unknown): Browser.RemoveUserContextParameters;
|
||||
parseActivateParams(params: unknown): BrowsingContext.ActivateParameters;
|
||||
parseCaptureScreenshotParams(params: unknown): BrowsingContext.CaptureScreenshotParameters;
|
||||
parseCloseParams(params: unknown): BrowsingContext.CloseParameters;
|
||||
parseCreateParams(params: unknown): BrowsingContext.CreateParameters;
|
||||
parseGetTreeParams(params: unknown): BrowsingContext.GetTreeParameters;
|
||||
parseHandleUserPromptParams(params: unknown): BrowsingContext.HandleUserPromptParameters;
|
||||
parseLocateNodesParams(params: unknown): BrowsingContext.LocateNodesParameters;
|
||||
parseNavigateParams(params: unknown): BrowsingContext.NavigateParameters;
|
||||
parsePrintParams(params: unknown): BrowsingContext.PrintParameters;
|
||||
parseReloadParams(params: unknown): BrowsingContext.ReloadParameters;
|
||||
parseSetViewportParams(params: unknown): BrowsingContext.SetViewportParameters;
|
||||
parseTraverseHistoryParams(params: unknown): BrowsingContext.TraverseHistoryParameters;
|
||||
parseGetSessionParams(params: unknown): Cdp.GetSessionParameters;
|
||||
parseResolveRealmParams(params: unknown): Cdp.ResolveRealmParameters;
|
||||
parseSendCommandParams(params: unknown): Cdp.SendCommandParameters;
|
||||
parseAddPreloadScriptParams(params: unknown): Script.AddPreloadScriptParameters;
|
||||
parseCallFunctionParams(params: unknown): Script.CallFunctionParameters;
|
||||
|
||||
12
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/BidiNoOpParser.js
generated
vendored
12
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/BidiNoOpParser.js
generated
vendored
@ -18,6 +18,12 @@
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.BidiNoOpParser = void 0;
|
||||
class BidiNoOpParser {
|
||||
// Browser domain
|
||||
// keep-sorted start block=yes
|
||||
parseRemoveUserContextParams(params) {
|
||||
return params;
|
||||
}
|
||||
// keep-sorted end
|
||||
// Browsing Context domain
|
||||
// keep-sorted start block=yes
|
||||
parseActivateParams(params) {
|
||||
@ -38,6 +44,9 @@ class BidiNoOpParser {
|
||||
parseHandleUserPromptParams(params) {
|
||||
return params;
|
||||
}
|
||||
parseLocateNodesParams(params) {
|
||||
return params;
|
||||
}
|
||||
parseNavigateParams(params) {
|
||||
return params;
|
||||
}
|
||||
@ -59,6 +68,9 @@ class BidiNoOpParser {
|
||||
parseGetSessionParams(params) {
|
||||
return params;
|
||||
}
|
||||
parseResolveRealmParams(params) {
|
||||
return params;
|
||||
}
|
||||
parseSendCommandParams(params) {
|
||||
return params;
|
||||
}
|
||||
|
||||
2
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/BidiNoOpParser.js.map
generated
vendored
2
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/BidiNoOpParser.js.map
generated
vendored
@ -1 +1 @@
|
||||
{"version":3,"file":"BidiNoOpParser.js","sourceRoot":"","sources":["../../../src/bidiMapper/BidiNoOpParser.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAeH,MAAa,cAAc;IACzB,0BAA0B;IAC1B,8BAA8B;IAC9B,mBAAmB,CAAC,MAAe;QACjC,OAAO,MAA4C,CAAC;IACtD,CAAC;IACD,4BAA4B,CAC1B,MAAe;QAEf,OAAO,MAAqD,CA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yB,CAAC,MAAe;QACvC,OAAO,MAAwC,CAAC;IAClD,CAAC;IACD,yBAAyB,CAAC,MAAe;QACvC,OAAO,MAAwC,CAAC;IAClD,CAAC;IACD,mBAAmB,CAAC,MAAe;QACjC,OAAO,MAAkC,CAAC;IAC5C,CAAC;IACD,kBAAkB;IAElB,iBAAiB;IACjB,8BAA8B;IAC9B,uBAAuB,CAAC,MAAe;QACrC,OAAO,MAAwC,CAAC;IAClD,CAAC;IACD,0BAA0B,CACxB,MAAe;QAEf,OAAO,MAA2C,CAAC;IACrD,CAAC;IACD,2BAA2B,CACzB,MAAe;QAEf,OAAO,MAA4C,CAAC;IACtD,CAAC;IACD,2BAA2B,CACzB,MAAe;QAEf,OAAO,MAA4C,CAAC;IACtD,CAAC;IACD,sBAAsB,CAAC,MAAe;QACpC,OAAO,MAAuC,CAAC;IACjD,CAAC;IACD,0BAA0B,CACxB,MAAe;QAEf,OAAO,MAA2C,CAAC;IACrD,CAAC;IACD,0BAA0B,CACxB,MAAe;QAEf,OAAO,MAA2C,CAAC;IACrD,CAAC;IACD,kBAAkB;IAElB,qBAAqB;IACrB,8BAA8B;IAC9B,yBAAyB,CACvB,MAAe;QAEf,OAAO,MAA6C,CAAC;IACvD,CAAC;IACD,kBAAkB;IAElB,iBAAiB;IACjB,8BAA8B;IAC9B,oBAAoB,CAAC,MAAe;QAClC,OAAO,MAAqC,CAAC;IAC/C,CAAC;IACD,kBAAkB;IAElB,iBAAiB;IACjB,8BAA8B;IAC9B,wBAAwB,CAAC,MAAe;QACtC,OAAO,MAAyC,CAAC;IACnD,CAAC;IACD,qBAAqB,CAAC,MAAe;QACnC,OAAO,MAAsC,CAAC;IAChD,CAAC;IACD,oBAAoB,CAAC,MAAe;QAClC,OAAO,MAAqC,CAAC;IAC/C,CAAC;CAEF;AA9JD,wCA8JC"}
|
||||
{"version":3,"file":"BidiNoOpParser.js","sourceRoot":"","sources":["../../../src/bidiMapper/BidiNoOpParser.ts"],"names":[],"mappings":";AAAA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B;IAC9B,oBAAoB,CAAC,MAAe;QAClC,OAAO,MAAqC,CAAC;IAC/C,CAAC;IACD,kBAAkB;IAElB,iBAAiB;IACjB,8BAA8B;IAC9B,wBAAwB,CAAC,MAAe;QACtC,OAAO,MAAyC,CAAC;IACnD,CAAC;IACD,qBAAqB,CAAC,MAAe;QACnC,OAAO,MAAsC,CAAC;IAChD,CAAC;IACD,oBAAoB,CAAC,MAAe;QAClC,OAAO,MAAqC,CAAC;IAC/C,CAAC;CAEF;AA/KD,wCA+KC"}
|
||||
5
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/BidiParser.d.ts
generated
vendored
5
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/BidiParser.d.ts
generated
vendored
@ -14,20 +14,23 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import type { BrowsingContext, Cdp, Input, Network, Permissions, Script, Session, Storage } from '../protocol/protocol.js';
|
||||
import type { Browser, BrowsingContext, Cdp, Input, Network, Permissions, Script, Session, Storage } from '../protocol/protocol.js';
|
||||
export interface BidiCommandParameterParser {
|
||||
parseRemoveUserContextParams(params: unknown): Browser.RemoveUserContextParameters;
|
||||
parseActivateParams(params: unknown): BrowsingContext.ActivateParameters;
|
||||
parseCaptureScreenshotParams(params: unknown): BrowsingContext.CaptureScreenshotParameters;
|
||||
parseCloseParams(params: unknown): BrowsingContext.CloseParameters;
|
||||
parseCreateParams(params: unknown): BrowsingContext.CreateParameters;
|
||||
parseGetTreeParams(params: unknown): BrowsingContext.GetTreeParameters;
|
||||
parseHandleUserPromptParams(params: unknown): BrowsingContext.HandleUserPromptParameters;
|
||||
parseLocateNodesParams(params: unknown): BrowsingContext.LocateNodesParameters;
|
||||
parseNavigateParams(params: unknown): BrowsingContext.NavigateParameters;
|
||||
parsePrintParams(params: unknown): BrowsingContext.PrintParameters;
|
||||
parseReloadParams(params: unknown): BrowsingContext.ReloadParameters;
|
||||
parseSetViewportParams(params: unknown): BrowsingContext.SetViewportParameters;
|
||||
parseTraverseHistoryParams(params: unknown): BrowsingContext.TraverseHistoryParameters;
|
||||
parseGetSessionParams(params: unknown): Cdp.GetSessionParameters;
|
||||
parseResolveRealmParams(params: unknown): Cdp.ResolveRealmParameters;
|
||||
parseSendCommandParams(params: unknown): Cdp.SendCommandParameters;
|
||||
parsePerformActionsParams(params: unknown): Input.PerformActionsParameters;
|
||||
parseReleaseActionsParams(params: unknown): Input.ReleaseActionsParameters;
|
||||
|
||||
8
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/BidiServer.d.ts
generated
vendored
8
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/BidiServer.d.ts
generated
vendored
@ -16,7 +16,7 @@
|
||||
*/
|
||||
import type { CdpClient } from '../cdp/CdpClient';
|
||||
import type { CdpConnection } from '../cdp/CdpConnection.js';
|
||||
import type { ChromiumBidi } from '../protocol/protocol.js';
|
||||
import type { ChromiumBidi, Session } from '../protocol/protocol.js';
|
||||
import { EventEmitter } from '../utils/EventEmitter.js';
|
||||
import { type LoggerFn } from '../utils/log.js';
|
||||
import type { Result } from '../utils/result.js';
|
||||
@ -27,8 +27,8 @@ type BidiServerEvent = {
|
||||
message: ChromiumBidi.Command;
|
||||
};
|
||||
export type MapperOptions = {
|
||||
acceptInsecureCerts: boolean;
|
||||
sharedIdWithFrame?: boolean;
|
||||
acceptInsecureCerts?: boolean;
|
||||
unhandledPromptBehavior?: Session.UserPromptHandler;
|
||||
};
|
||||
export declare class BidiServer extends EventEmitter<BidiServerEvent> {
|
||||
#private;
|
||||
@ -36,7 +36,7 @@ export declare class BidiServer extends EventEmitter<BidiServerEvent> {
|
||||
/**
|
||||
* Creates and starts BiDi Mapper instance.
|
||||
*/
|
||||
static createAndStart(bidiTransport: BidiTransport, cdpConnection: CdpConnection, browserCdpClient: CdpClient, selfTargetId: string, options?: MapperOptions, parser?: BidiCommandParameterParser, logger?: LoggerFn): Promise<BidiServer>;
|
||||
static createAndStart(bidiTransport: BidiTransport, cdpConnection: CdpConnection, browserCdpClient: CdpClient, selfTargetId: string, parser?: BidiCommandParameterParser, logger?: LoggerFn): Promise<BidiServer>;
|
||||
/**
|
||||
* Sends BiDi message.
|
||||
*/
|
||||
|
||||
48
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/BidiServer.js
generated
vendored
48
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/BidiServer.js
generated
vendored
@ -21,15 +21,20 @@ const EventEmitter_js_1 = require("../utils/EventEmitter.js");
|
||||
const log_js_1 = require("../utils/log.js");
|
||||
const ProcessingQueue_js_1 = require("../utils/ProcessingQueue.js");
|
||||
const CommandProcessor_js_1 = require("./CommandProcessor.js");
|
||||
const BrowsingContextStorage_js_1 = require("./domains/context/BrowsingContextStorage.js");
|
||||
const RealmStorage_js_1 = require("./domains/script/RealmStorage.js");
|
||||
const EventManager_js_1 = require("./domains/session/EventManager.js");
|
||||
const CdpTargetManager_js_1 = require("./modules/cdp/CdpTargetManager.js");
|
||||
const BrowsingContextStorage_js_1 = require("./modules/context/BrowsingContextStorage.js");
|
||||
const NetworkStorage_js_1 = require("./modules/network/NetworkStorage.js");
|
||||
const PreloadScriptStorage_js_1 = require("./modules/script/PreloadScriptStorage.js");
|
||||
const RealmStorage_js_1 = require("./modules/script/RealmStorage.js");
|
||||
const EventManager_js_1 = require("./modules/session/EventManager.js");
|
||||
class BidiServer extends EventEmitter_js_1.EventEmitter {
|
||||
#messageQueue;
|
||||
#transport;
|
||||
#commandProcessor;
|
||||
#eventManager;
|
||||
#browsingContextStorage = new BrowsingContextStorage_js_1.BrowsingContextStorage();
|
||||
#realmStorage = new RealmStorage_js_1.RealmStorage();
|
||||
#preloadScriptStorage = new PreloadScriptStorage_js_1.PreloadScriptStorage();
|
||||
#logger;
|
||||
#handleIncomingMessage = (message) => {
|
||||
void this.#commandProcessor.processCommand(message).catch((error) => {
|
||||
@ -43,14 +48,32 @@ class BidiServer extends EventEmitter_js_1.EventEmitter {
|
||||
}
|
||||
await this.#transport.sendMessage(message);
|
||||
};
|
||||
constructor(bidiTransport, cdpConnection, browserCdpClient, selfTargetId, defaultUserContextId, options, parser, logger) {
|
||||
constructor(bidiTransport, cdpConnection, browserCdpClient, selfTargetId, defaultUserContextId, parser, logger) {
|
||||
super();
|
||||
this.#logger = logger;
|
||||
this.#messageQueue = new ProcessingQueue_js_1.ProcessingQueue(this.#processOutgoingMessage, this.#logger);
|
||||
this.#transport = bidiTransport;
|
||||
this.#transport.setOnMessage(this.#handleIncomingMessage);
|
||||
this.#eventManager = new EventManager_js_1.EventManager(this.#browsingContextStorage);
|
||||
this.#commandProcessor = new CommandProcessor_js_1.CommandProcessor(cdpConnection, browserCdpClient, this.#eventManager, selfTargetId, defaultUserContextId, this.#browsingContextStorage, new RealmStorage_js_1.RealmStorage(), options?.acceptInsecureCerts ?? false, options?.sharedIdWithFrame ?? false, parser, this.#logger);
|
||||
const networkStorage = new NetworkStorage_js_1.NetworkStorage(this.#eventManager, this.#browsingContextStorage, browserCdpClient, logger);
|
||||
this.#commandProcessor = new CommandProcessor_js_1.CommandProcessor(cdpConnection, browserCdpClient, this.#eventManager, this.#browsingContextStorage, this.#realmStorage, this.#preloadScriptStorage, networkStorage, parser, async (options) => {
|
||||
// This is required to ignore certificate errors when service worker is fetched.
|
||||
await browserCdpClient.sendCommand('Security.setIgnoreCertificateErrors', {
|
||||
ignore: options.acceptInsecureCerts ?? false,
|
||||
});
|
||||
new CdpTargetManager_js_1.CdpTargetManager(cdpConnection, browserCdpClient, selfTargetId, this.#eventManager, this.#browsingContextStorage, this.#realmStorage, networkStorage, this.#preloadScriptStorage, defaultUserContextId, options?.unhandledPromptBehavior, logger);
|
||||
// Needed to get events about new targets.
|
||||
await browserCdpClient.sendCommand('Target.setDiscoverTargets', {
|
||||
discover: true,
|
||||
});
|
||||
// Needed to automatically attach to new targets.
|
||||
await browserCdpClient.sendCommand('Target.setAutoAttach', {
|
||||
autoAttach: true,
|
||||
waitForDebuggerOnStart: true,
|
||||
flatten: true,
|
||||
});
|
||||
await this.#topLevelContextsLoaded();
|
||||
}, this.#logger);
|
||||
this.#eventManager.on("event" /* EventManagerEvents.Event */, ({ message, event }) => {
|
||||
this.emitOutgoingMessage(message, event);
|
||||
});
|
||||
@ -61,7 +84,7 @@ class BidiServer extends EventEmitter_js_1.EventEmitter {
|
||||
/**
|
||||
* Creates and starts BiDi Mapper instance.
|
||||
*/
|
||||
static async createAndStart(bidiTransport, cdpConnection, browserCdpClient, selfTargetId, options, parser, logger) {
|
||||
static async createAndStart(bidiTransport, cdpConnection, browserCdpClient, selfTargetId, parser, logger) {
|
||||
// The default context is not exposed in Target.getBrowserContexts but can
|
||||
// be observed via Target.getTargets. To determine the default browser
|
||||
// context, we check which one is mentioned in Target.getTargets and not in
|
||||
@ -78,18 +101,7 @@ class BidiServer extends EventEmitter_js_1.EventEmitter {
|
||||
break;
|
||||
}
|
||||
}
|
||||
const server = new BidiServer(bidiTransport, cdpConnection, browserCdpClient, selfTargetId, defaultUserContextId, options, parser, logger);
|
||||
// Needed to get events about new targets.
|
||||
await browserCdpClient.sendCommand('Target.setDiscoverTargets', {
|
||||
discover: true,
|
||||
});
|
||||
// Needed to automatically attach to new targets.
|
||||
await browserCdpClient.sendCommand('Target.setAutoAttach', {
|
||||
autoAttach: true,
|
||||
waitForDebuggerOnStart: true,
|
||||
flatten: true,
|
||||
});
|
||||
await server.#topLevelContextsLoaded();
|
||||
const server = new BidiServer(bidiTransport, cdpConnection, browserCdpClient, selfTargetId, defaultUserContextId, parser, logger);
|
||||
return server;
|
||||
}
|
||||
/**
|
||||
|
||||
2
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/BidiServer.js.map
generated
vendored
2
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/BidiServer.js.map
generated
vendored
@ -1 +1 @@
|
||||
{"version":3,"file":"BidiServer.js","sourceRoot":"","sources":["../../../src/bidiMapper/BidiServer.ts"],"names":[],"mappings":";AAAA;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CAAC,gBAAgB,CAAC;gBAC7C,MAAM;YACR,CAAC;QACH,CAAC;QAED,MAAM,MAAM,GAAG,IAAI,UAAU,CAC3B,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,oBAAoB,EACpB,MAAM,EACN,MAAM,CACP,CAAC;QAEF,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;OAEG;IACH,mBAAmB,CACjB,YAA8C,EAC9C,KAAa;QAEb,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;IAC9C,CAAC;IAED,KAAK;QACH,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;IAC1B,CAAC;IAED,KAAK,CAAC,uBAAuB;QAC3B,MAAM,OAAO,CAAC,GAAG,CACf,IAAI,CAAC,uBAAuB;aACzB,mBAAmB,EAAE;aACrB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC,CACnC,CAAC;IACJ,CAAC;CACF;AA9KD,gCA8KC"}
|
||||
13
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/CommandProcessor.d.ts
generated
vendored
13
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/CommandProcessor.d.ts
generated
vendored
@ -16,14 +16,17 @@
|
||||
*/
|
||||
import type { CdpClient } from '../cdp/CdpClient';
|
||||
import type { CdpConnection } from '../cdp/CdpConnection.js';
|
||||
import { type ChromiumBidi, type Browser } from '../protocol/protocol.js';
|
||||
import { type ChromiumBidi } from '../protocol/protocol.js';
|
||||
import { EventEmitter } from '../utils/EventEmitter.js';
|
||||
import { type LoggerFn } from '../utils/log.js';
|
||||
import type { Result } from '../utils/result.js';
|
||||
import type { BidiCommandParameterParser } from './BidiParser.js';
|
||||
import type { BrowsingContextStorage } from './domains/context/BrowsingContextStorage.js';
|
||||
import type { RealmStorage } from './domains/script/RealmStorage.js';
|
||||
import type { EventManager } from './domains/session/EventManager.js';
|
||||
import type { MapperOptions } from './BidiServer.js';
|
||||
import type { BrowsingContextStorage } from './modules/context/BrowsingContextStorage.js';
|
||||
import type { NetworkStorage } from './modules/network/NetworkStorage.js';
|
||||
import type { PreloadScriptStorage } from './modules/script/PreloadScriptStorage.js';
|
||||
import type { RealmStorage } from './modules/script/RealmStorage.js';
|
||||
import type { EventManager } from './modules/session/EventManager.js';
|
||||
import { OutgoingMessage } from './OutgoingMessage.js';
|
||||
export declare const enum CommandProcessorEvents {
|
||||
Response = "response"
|
||||
@ -36,7 +39,7 @@ type CommandProcessorEventsMap = {
|
||||
};
|
||||
export declare class CommandProcessor extends EventEmitter<CommandProcessorEventsMap> {
|
||||
#private;
|
||||
constructor(cdpConnection: CdpConnection, browserCdpClient: CdpClient, eventManager: EventManager, selfTargetId: string, defaultUserContextId: Browser.UserContext, browsingContextStorage: BrowsingContextStorage, realmStorage: RealmStorage, acceptInsecureCerts: boolean, sharedIdWithFrame: boolean, parser?: BidiCommandParameterParser, logger?: LoggerFn);
|
||||
constructor(cdpConnection: CdpConnection, browserCdpClient: CdpClient, eventManager: EventManager, browsingContextStorage: BrowsingContextStorage, realmStorage: RealmStorage, preloadScriptStorage: PreloadScriptStorage, networkStorage: NetworkStorage, parser: BidiCommandParameterParser | undefined, initConnection: (options: MapperOptions) => Promise<void>, logger?: LoggerFn);
|
||||
processCommand(command: ChromiumBidi.Command): Promise<void>;
|
||||
}
|
||||
export {};
|
||||
|
||||
72
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/CommandProcessor.js
generated
vendored
72
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/CommandProcessor.js
generated
vendored
@ -21,17 +21,15 @@ const protocol_js_1 = require("../protocol/protocol.js");
|
||||
const EventEmitter_js_1 = require("../utils/EventEmitter.js");
|
||||
const log_js_1 = require("../utils/log.js");
|
||||
const BidiNoOpParser_js_1 = require("./BidiNoOpParser.js");
|
||||
const BrowserProcessor_js_1 = require("./domains/browser/BrowserProcessor.js");
|
||||
const CdpProcessor_js_1 = require("./domains/cdp/CdpProcessor.js");
|
||||
const BrowsingContextProcessor_js_1 = require("./domains/context/BrowsingContextProcessor.js");
|
||||
const InputProcessor_js_1 = require("./domains/input/InputProcessor.js");
|
||||
const NetworkProcessor_js_1 = require("./domains/network/NetworkProcessor.js");
|
||||
const NetworkStorage_js_1 = require("./domains/network/NetworkStorage.js");
|
||||
const PermissionsProcessor_js_1 = require("./domains/permissions/PermissionsProcessor.js");
|
||||
const PreloadScriptStorage_js_1 = require("./domains/script/PreloadScriptStorage.js");
|
||||
const ScriptProcessor_js_1 = require("./domains/script/ScriptProcessor.js");
|
||||
const SessionProcessor_js_1 = require("./domains/session/SessionProcessor.js");
|
||||
const StorageProcessor_js_1 = require("./domains/storage/StorageProcessor.js");
|
||||
const BrowserProcessor_js_1 = require("./modules/browser/BrowserProcessor.js");
|
||||
const CdpProcessor_js_1 = require("./modules/cdp/CdpProcessor.js");
|
||||
const BrowsingContextProcessor_js_1 = require("./modules/context/BrowsingContextProcessor.js");
|
||||
const InputProcessor_js_1 = require("./modules/input/InputProcessor.js");
|
||||
const NetworkProcessor_js_1 = require("./modules/network/NetworkProcessor.js");
|
||||
const PermissionsProcessor_js_1 = require("./modules/permissions/PermissionsProcessor.js");
|
||||
const ScriptProcessor_js_1 = require("./modules/script/ScriptProcessor.js");
|
||||
const SessionProcessor_js_1 = require("./modules/session/SessionProcessor.js");
|
||||
const StorageProcessor_js_1 = require("./modules/storage/StorageProcessor.js");
|
||||
const OutgoingMessage_js_1 = require("./OutgoingMessage.js");
|
||||
class CommandProcessor extends EventEmitter_js_1.EventEmitter {
|
||||
// keep-sorted start
|
||||
@ -47,28 +45,25 @@ class CommandProcessor extends EventEmitter_js_1.EventEmitter {
|
||||
// keep-sorted end
|
||||
#parser;
|
||||
#logger;
|
||||
constructor(cdpConnection, browserCdpClient, eventManager, selfTargetId, defaultUserContextId, browsingContextStorage, realmStorage, acceptInsecureCerts, sharedIdWithFrame, parser = new BidiNoOpParser_js_1.BidiNoOpParser(), logger) {
|
||||
constructor(cdpConnection, browserCdpClient, eventManager, browsingContextStorage, realmStorage, preloadScriptStorage, networkStorage, parser = new BidiNoOpParser_js_1.BidiNoOpParser(), initConnection, logger) {
|
||||
super();
|
||||
this.#parser = parser;
|
||||
this.#logger = logger;
|
||||
const networkStorage = new NetworkStorage_js_1.NetworkStorage();
|
||||
const preloadScriptStorage = new PreloadScriptStorage_js_1.PreloadScriptStorage();
|
||||
// keep-sorted start block=yes
|
||||
this.#browserProcessor = new BrowserProcessor_js_1.BrowserProcessor(browserCdpClient);
|
||||
this.#browsingContextProcessor = new BrowsingContextProcessor_js_1.BrowsingContextProcessor(cdpConnection, browserCdpClient, selfTargetId, eventManager, browsingContextStorage, realmStorage, networkStorage, preloadScriptStorage, acceptInsecureCerts, sharedIdWithFrame, defaultUserContextId, logger);
|
||||
this.#cdpProcessor = new CdpProcessor_js_1.CdpProcessor(browsingContextStorage, cdpConnection, browserCdpClient);
|
||||
this.#inputProcessor = new InputProcessor_js_1.InputProcessor(browsingContextStorage, realmStorage);
|
||||
this.#browsingContextProcessor = new BrowsingContextProcessor_js_1.BrowsingContextProcessor(browserCdpClient, browsingContextStorage, eventManager);
|
||||
this.#cdpProcessor = new CdpProcessor_js_1.CdpProcessor(browsingContextStorage, realmStorage, cdpConnection, browserCdpClient);
|
||||
this.#inputProcessor = new InputProcessor_js_1.InputProcessor(browsingContextStorage);
|
||||
this.#networkProcessor = new NetworkProcessor_js_1.NetworkProcessor(browsingContextStorage, networkStorage);
|
||||
this.#permissionsProcessor = new PermissionsProcessor_js_1.PermissionsProcessor(browserCdpClient);
|
||||
this.#scriptProcessor = new ScriptProcessor_js_1.ScriptProcessor(browsingContextStorage, realmStorage, preloadScriptStorage, logger);
|
||||
this.#sessionProcessor = new SessionProcessor_js_1.SessionProcessor(eventManager);
|
||||
this.#scriptProcessor = new ScriptProcessor_js_1.ScriptProcessor(eventManager, browsingContextStorage, realmStorage, preloadScriptStorage, logger);
|
||||
this.#sessionProcessor = new SessionProcessor_js_1.SessionProcessor(eventManager, browserCdpClient, initConnection);
|
||||
this.#storageProcessor = new StorageProcessor_js_1.StorageProcessor(browserCdpClient, browsingContextStorage, logger);
|
||||
// keep-sorted end
|
||||
}
|
||||
async #processCommand(command) {
|
||||
switch (command.method) {
|
||||
case 'session.end':
|
||||
case 'session.new':
|
||||
// TODO: Implement.
|
||||
break;
|
||||
// Browser domain
|
||||
@ -76,11 +71,11 @@ class CommandProcessor extends EventEmitter_js_1.EventEmitter {
|
||||
case 'browser.close':
|
||||
return this.#browserProcessor.close();
|
||||
case 'browser.createUserContext':
|
||||
return await this.#browserProcessor.createUserContext();
|
||||
return await this.#browserProcessor.createUserContext(command.params);
|
||||
case 'browser.getUserContexts':
|
||||
return await this.#browserProcessor.getUserContexts();
|
||||
case 'browser.removeUserContext':
|
||||
return await this.#browserProcessor.removeUserContext(command.params.userContext);
|
||||
return await this.#browserProcessor.removeUserContext(this.#parser.parseRemoveUserContextParams(command.params));
|
||||
// keep-sorted end
|
||||
// Browsing Context domain
|
||||
// keep-sorted start block=yes
|
||||
@ -97,7 +92,7 @@ class CommandProcessor extends EventEmitter_js_1.EventEmitter {
|
||||
case 'browsingContext.handleUserPrompt':
|
||||
return await this.#browsingContextProcessor.handleUserPrompt(this.#parser.parseHandleUserPromptParams(command.params));
|
||||
case 'browsingContext.locateNodes':
|
||||
throw new protocol_js_1.UnsupportedOperationException(`Command '${command.method}' not yet implemented.`);
|
||||
return await this.#browsingContextProcessor.locateNodes(this.#parser.parseLocateNodesParams(command.params));
|
||||
case 'browsingContext.navigate':
|
||||
return await this.#browsingContextProcessor.navigate(this.#parser.parseNavigateParams(command.params));
|
||||
case 'browsingContext.print':
|
||||
@ -113,6 +108,8 @@ class CommandProcessor extends EventEmitter_js_1.EventEmitter {
|
||||
// keep-sorted start block=yes
|
||||
case 'cdp.getSession':
|
||||
return this.#cdpProcessor.getSession(this.#parser.parseGetSessionParams(command.params));
|
||||
case 'cdp.resolveRealm':
|
||||
return this.#cdpProcessor.resolveRealm(this.#parser.parseResolveRealmParams(command.params));
|
||||
case 'cdp.sendCommand':
|
||||
return await this.#cdpProcessor.sendCommand(this.#parser.parseSendCommandParams(command.params));
|
||||
// keep-sorted end
|
||||
@ -141,6 +138,8 @@ class CommandProcessor extends EventEmitter_js_1.EventEmitter {
|
||||
return await this.#networkProcessor.provideResponse(this.#parser.parseProvideResponseParams(command.params));
|
||||
case 'network.removeIntercept':
|
||||
return await this.#networkProcessor.removeIntercept(this.#parser.parseRemoveInterceptParams(command.params));
|
||||
case 'network.setCacheBehavior':
|
||||
throw new protocol_js_1.UnknownErrorException("Method 'network.setCacheBehavior' is not implemented.");
|
||||
// keep-sorted end
|
||||
// Permissions domain
|
||||
// keep-sorted start block=yes
|
||||
@ -152,11 +151,11 @@ class CommandProcessor extends EventEmitter_js_1.EventEmitter {
|
||||
case 'script.addPreloadScript':
|
||||
return await this.#scriptProcessor.addPreloadScript(this.#parser.parseAddPreloadScriptParams(command.params));
|
||||
case 'script.callFunction':
|
||||
return await this.#scriptProcessor.callFunction(this.#parser.parseCallFunctionParams(command.params));
|
||||
return await this.#scriptProcessor.callFunction(this.#parser.parseCallFunctionParams(this.#processTargetParams(command.params)));
|
||||
case 'script.disown':
|
||||
return await this.#scriptProcessor.disown(this.#parser.parseDisownParams(command.params));
|
||||
return await this.#scriptProcessor.disown(this.#parser.parseDisownParams(this.#processTargetParams(command.params)));
|
||||
case 'script.evaluate':
|
||||
return await this.#scriptProcessor.evaluate(this.#parser.parseEvaluateParams(command.params));
|
||||
return await this.#scriptProcessor.evaluate(this.#parser.parseEvaluateParams(this.#processTargetParams(command.params)));
|
||||
case 'script.getRealms':
|
||||
return this.#scriptProcessor.getRealms(this.#parser.parseGetRealmsParams(command.params));
|
||||
case 'script.removePreloadScript':
|
||||
@ -164,17 +163,19 @@ class CommandProcessor extends EventEmitter_js_1.EventEmitter {
|
||||
// keep-sorted end
|
||||
// Session domain
|
||||
// keep-sorted start block=yes
|
||||
case 'session.new':
|
||||
return await this.#sessionProcessor.new(command.params);
|
||||
case 'session.status':
|
||||
return this.#sessionProcessor.status();
|
||||
case 'session.subscribe':
|
||||
return this.#sessionProcessor.subscribe(this.#parser.parseSubscribeParams(command.params), command.channel);
|
||||
return await this.#sessionProcessor.subscribe(this.#parser.parseSubscribeParams(command.params), command.channel);
|
||||
case 'session.unsubscribe':
|
||||
return this.#sessionProcessor.unsubscribe(this.#parser.parseSubscribeParams(command.params), command.channel);
|
||||
return await this.#sessionProcessor.unsubscribe(this.#parser.parseSubscribeParams(command.params), command.channel);
|
||||
// keep-sorted end
|
||||
// Storage domain
|
||||
// keep-sorted start block=yes
|
||||
case 'storage.deleteCookies':
|
||||
throw new protocol_js_1.UnsupportedOperationException(`${command.method} is not supported yet`);
|
||||
return await this.#storageProcessor.deleteCookies(this.#parser.parseDeleteCookiesParams(command.params));
|
||||
case 'storage.getCookies':
|
||||
return await this.#storageProcessor.getCookies(this.#parser.parseGetCookiesParams(command.params));
|
||||
case 'storage.setCookie':
|
||||
@ -186,6 +187,19 @@ class CommandProcessor extends EventEmitter_js_1.EventEmitter {
|
||||
// command is added.
|
||||
throw new protocol_js_1.UnknownCommandException(`Unknown command '${command.method}'.`);
|
||||
}
|
||||
// Workaround for as zod.union always take the first schema
|
||||
// https://github.com/w3c/webdriver-bidi/issues/635
|
||||
#processTargetParams(params) {
|
||||
if (typeof params === 'object' &&
|
||||
params &&
|
||||
'target' in params &&
|
||||
typeof params.target === 'object' &&
|
||||
params.target &&
|
||||
'context' in params.target) {
|
||||
delete params.target['realm'];
|
||||
}
|
||||
return params;
|
||||
}
|
||||
async processCommand(command) {
|
||||
try {
|
||||
const result = await this.#processCommand(command);
|
||||
|
||||
2
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/CommandProcessor.js.map
generated
vendored
2
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/CommandProcessor.js.map
generated
vendored
File diff suppressed because one or more lines are too long
@ -1 +0,0 @@
|
||||
{"version":3,"file":"BrowserProcessor.js","sourceRoot":"","sources":["../../../../../src/bidiMapper/domains/browser/BrowserProcessor.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH,+DAKuC;AAGvC,MAAa,gBAAgB;IAClB,iBAAiB,CAAY;IAEtC,YAAY,gBAA2B;QACrC,IAAI,CAAC,iBAAiB,GAAG,gBAAgB,CAAC;IAC5C,CAAC;IAED,KAAK;QACH,sDAAsD;QACtD,6DAA6D;QAC7D,UAAU,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC,WAAW,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC,CAAC;QAEzE,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,KAAK,CAAC,iBAAiB;QACrB,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,iBAAiB,CAAC,WAAW,CACtD,6BAA6B,CAC9B,CAAC;QACF,OAAO;YACL,WAAW,EAAE,OAAO,CAAC,gBAAgB;SACtC,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,iBAAiB,CACrB,WAAgC;QAEhC,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;YAC9B,MAAM,IAAI,sCAAwB,CAChC,0CAA0C,CAC3C,CAAC;QACJ,CAAC;QACD,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,iBAAiB,CAAC,WAAW,CAAC,8BAA8B,EAAE;gBACvE,gBAAgB,EAAE,WAAW;aAC9B,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,mKAAmK;YACnK,IAAK,GAAa,CAAC,OAAO,CAAC,UAAU,CAAC,gCAAgC,CAAC,EAAE,CAAC;gBACxE,MAAM,IAAI,wCAA0B,CAAE,GAAa,CAAC,OAAO,CAAC,CAAC;YAC/D,CAAC;YACD,MAAM,GAAG,CAAC;QACZ,CAAC;QACD,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,KAAK,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C,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC;YAClD,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC;QAC3B,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;QACtE,OAAO;YACL,MAAM;YACN,OAAO,EAAE,MAAM,CAAC,OAAO;SACxB,CAAC;IACJ,CAAC;CACF;AArCD,oCAqCC"}
|
||||
File diff suppressed because one or more lines are too long
@ -1,303 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.BrowsingContextProcessor = void 0;
|
||||
const protocol_js_1 = require("../../../protocol/protocol.js");
|
||||
const log_js_1 = require("../../../utils/log.js");
|
||||
const DedicatedWorkerRealm_js_1 = require("../script/DedicatedWorkerRealm.js");
|
||||
const BrowsingContextImpl_js_1 = require("./BrowsingContextImpl.js");
|
||||
const CdpTarget_js_1 = require("./CdpTarget.js");
|
||||
class BrowsingContextProcessor {
|
||||
#browserCdpClient;
|
||||
#cdpConnection;
|
||||
#selfTargetId;
|
||||
#eventManager;
|
||||
#browsingContextStorage;
|
||||
#networkStorage;
|
||||
#acceptInsecureCerts;
|
||||
#sharedIdWithFrame;
|
||||
#preloadScriptStorage;
|
||||
#realmStorage;
|
||||
#defaultUserContextId;
|
||||
#logger;
|
||||
constructor(cdpConnection, browserCdpClient, selfTargetId, eventManager, browsingContextStorage, realmStorage, networkStorage, preloadScriptStorage, acceptInsecureCerts, sharedIdWithFrame, defaultUserContextId, logger) {
|
||||
this.#acceptInsecureCerts = acceptInsecureCerts;
|
||||
this.#cdpConnection = cdpConnection;
|
||||
this.#browserCdpClient = browserCdpClient;
|
||||
this.#selfTargetId = selfTargetId;
|
||||
this.#eventManager = eventManager;
|
||||
this.#browsingContextStorage = browsingContextStorage;
|
||||
this.#preloadScriptStorage = preloadScriptStorage;
|
||||
this.#networkStorage = networkStorage;
|
||||
this.#realmStorage = realmStorage;
|
||||
this.#sharedIdWithFrame = sharedIdWithFrame;
|
||||
this.#defaultUserContextId = defaultUserContextId;
|
||||
this.#logger = logger;
|
||||
this.#setEventListeners(browserCdpClient);
|
||||
}
|
||||
getTree(params) {
|
||||
const resultContexts = params.root === undefined
|
||||
? this.#browsingContextStorage.getTopLevelContexts()
|
||||
: [this.#browsingContextStorage.getContext(params.root)];
|
||||
return {
|
||||
contexts: resultContexts.map((c) => c.serializeToBidiValue(params.maxDepth ?? Number.MAX_VALUE)),
|
||||
};
|
||||
}
|
||||
async create(params) {
|
||||
let referenceContext;
|
||||
let userContext = params.userContext ?? 'default';
|
||||
if (params.referenceContext !== undefined) {
|
||||
referenceContext = this.#browsingContextStorage.getContext(params.referenceContext);
|
||||
if (!referenceContext.isTopLevelContext()) {
|
||||
throw new protocol_js_1.InvalidArgumentException(`referenceContext should be a top-level context`);
|
||||
}
|
||||
userContext = referenceContext.userContext;
|
||||
}
|
||||
let newWindow = false;
|
||||
switch (params.type) {
|
||||
case "tab" /* BrowsingContext.CreateType.Tab */:
|
||||
newWindow = false;
|
||||
break;
|
||||
case "window" /* BrowsingContext.CreateType.Window */:
|
||||
newWindow = true;
|
||||
break;
|
||||
}
|
||||
if (userContext !== 'default') {
|
||||
const existingContexts = this.#browsingContextStorage
|
||||
.getAllContexts()
|
||||
.filter((context) => context.userContext === userContext);
|
||||
if (!existingContexts.length) {
|
||||
// If there are no contexts in the given user context, we need to set
|
||||
// newWindow to true as newWindow=false will be rejected.
|
||||
newWindow = true;
|
||||
}
|
||||
}
|
||||
let result;
|
||||
try {
|
||||
result = await this.#browserCdpClient.sendCommand('Target.createTarget', {
|
||||
url: 'about:blank',
|
||||
newWindow,
|
||||
browserContextId: userContext === 'default' ? undefined : userContext,
|
||||
});
|
||||
}
|
||||
catch (err) {
|
||||
if (
|
||||
// See https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/devtools/protocol/target_handler.cc;l=90;drc=e80392ac11e48a691f4309964cab83a3a59e01c8
|
||||
err.message.startsWith('Failed to find browser context with id') ||
|
||||
// See https://source.chromium.org/chromium/chromium/src/+/main:headless/lib/browser/protocol/target_handler.cc;l=49;drc=e80392ac11e48a691f4309964cab83a3a59e01c8
|
||||
err.message === 'browserContextId') {
|
||||
throw new protocol_js_1.NoSuchUserContextException(`The context ${userContext} was not found`);
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
// Wait for the new tab to be loaded to avoid race conditions in the
|
||||
// `browsingContext` events, when the `browsingContext.domContentLoaded` and
|
||||
// `browsingContext.load` events from the initial `about:blank` navigation
|
||||
// are emitted after the next navigation is started.
|
||||
// Details: https://github.com/web-platform-tests/wpt/issues/35846
|
||||
const contextId = result.targetId;
|
||||
const context = this.#browsingContextStorage.getContext(contextId);
|
||||
await context.lifecycleLoaded();
|
||||
return { context: context.id };
|
||||
}
|
||||
navigate(params) {
|
||||
const context = this.#browsingContextStorage.getContext(params.context);
|
||||
return context.navigate(params.url, params.wait ?? "none" /* BrowsingContext.ReadinessState.None */);
|
||||
}
|
||||
reload(params) {
|
||||
const context = this.#browsingContextStorage.getContext(params.context);
|
||||
return context.reload(params.ignoreCache ?? false, params.wait ?? "none" /* BrowsingContext.ReadinessState.None */);
|
||||
}
|
||||
async activate(params) {
|
||||
const context = this.#browsingContextStorage.getContext(params.context);
|
||||
if (!context.isTopLevelContext()) {
|
||||
throw new protocol_js_1.InvalidArgumentException('Activation is only supported on the top-level context');
|
||||
}
|
||||
await context.activate();
|
||||
return {};
|
||||
}
|
||||
async captureScreenshot(params) {
|
||||
const context = this.#browsingContextStorage.getContext(params.context);
|
||||
return await context.captureScreenshot(params);
|
||||
}
|
||||
async print(params) {
|
||||
const context = this.#browsingContextStorage.getContext(params.context);
|
||||
return await context.print(params);
|
||||
}
|
||||
async setViewport(params) {
|
||||
const context = this.#browsingContextStorage.getContext(params.context);
|
||||
if (!context.isTopLevelContext()) {
|
||||
throw new protocol_js_1.InvalidArgumentException('Emulating viewport is only supported on the top-level context');
|
||||
}
|
||||
await context.setViewport(params.viewport, params.devicePixelRatio);
|
||||
return {};
|
||||
}
|
||||
async traverseHistory(params) {
|
||||
const context = this.#browsingContextStorage.getContext(params.context);
|
||||
if (!context) {
|
||||
throw new protocol_js_1.InvalidArgumentException(`No browsing context with id ${params.context}`);
|
||||
}
|
||||
await context.traverseHistory(params.delta);
|
||||
return {};
|
||||
}
|
||||
async handleUserPrompt(params) {
|
||||
const context = this.#browsingContextStorage.getContext(params.context);
|
||||
await context.handleUserPrompt(params);
|
||||
return {};
|
||||
}
|
||||
async close(params) {
|
||||
const context = this.#browsingContextStorage.getContext(params.context);
|
||||
if (!context.isTopLevelContext()) {
|
||||
throw new protocol_js_1.InvalidArgumentException(`Non top-level browsing context ${context.id} cannot be closed.`);
|
||||
}
|
||||
try {
|
||||
const detachedFromTargetPromise = new Promise((resolve) => {
|
||||
const onContextDestroyed = (event) => {
|
||||
if (event.targetId === params.context) {
|
||||
this.#browserCdpClient.off('Target.detachedFromTarget', onContextDestroyed);
|
||||
resolve();
|
||||
}
|
||||
};
|
||||
this.#browserCdpClient.on('Target.detachedFromTarget', onContextDestroyed);
|
||||
});
|
||||
if (params.promptUnload) {
|
||||
await context.close();
|
||||
}
|
||||
else {
|
||||
await this.#browserCdpClient.sendCommand('Target.closeTarget', {
|
||||
targetId: params.context,
|
||||
});
|
||||
}
|
||||
// Sometimes CDP command finishes before `detachedFromTarget` event,
|
||||
// sometimes after. Wait for the CDP command to be finished, and then wait
|
||||
// for `detachedFromTarget` if it hasn't emitted.
|
||||
await detachedFromTargetPromise;
|
||||
}
|
||||
catch (error) {
|
||||
// Swallow error that arise from the page being destroyed
|
||||
// Example is navigating to faulty SSL certificate
|
||||
if (!(error.code === -32000 /* CdpErrorConstants.GENERIC_ERROR */ &&
|
||||
error.message === 'Not attached to an active page')) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
return {};
|
||||
}
|
||||
/**
|
||||
* This method is called for each CDP session, since this class is responsible
|
||||
* for creating and destroying all targets and browsing contexts.
|
||||
*/
|
||||
#setEventListeners(cdpClient) {
|
||||
cdpClient.on('Target.attachedToTarget', (params) => {
|
||||
this.#handleAttachedToTargetEvent(params, cdpClient);
|
||||
});
|
||||
cdpClient.on('Target.detachedFromTarget', (params) => {
|
||||
this.#handleDetachedFromTargetEvent(params);
|
||||
});
|
||||
cdpClient.on('Target.targetInfoChanged', (params) => {
|
||||
this.#handleTargetInfoChangedEvent(params);
|
||||
});
|
||||
cdpClient.on('Page.frameAttached', (params) => {
|
||||
this.#handleFrameAttachedEvent(params);
|
||||
});
|
||||
cdpClient.on('Page.frameDetached', (params) => {
|
||||
this.#handleFrameDetachedEvent(params);
|
||||
});
|
||||
}
|
||||
#handleFrameAttachedEvent(params) {
|
||||
const parentBrowsingContext = this.#browsingContextStorage.findContext(params.parentFrameId);
|
||||
if (parentBrowsingContext !== undefined) {
|
||||
BrowsingContextImpl_js_1.BrowsingContextImpl.create(parentBrowsingContext.cdpTarget, this.#realmStorage, params.frameId, params.parentFrameId, parentBrowsingContext.userContext, this.#eventManager, this.#browsingContextStorage, this.#sharedIdWithFrame, this.#logger);
|
||||
}
|
||||
}
|
||||
#handleFrameDetachedEvent(params) {
|
||||
// In case of OOPiF no need in deleting BrowsingContext.
|
||||
if (params.reason === 'swap') {
|
||||
return;
|
||||
}
|
||||
this.#browsingContextStorage.findContext(params.frameId)?.dispose();
|
||||
}
|
||||
#handleAttachedToTargetEvent(params, parentSessionCdpClient) {
|
||||
const { sessionId, targetInfo } = params;
|
||||
const targetCdpClient = this.#cdpConnection.getCdpClient(sessionId);
|
||||
this.#logger?.(log_js_1.LogType.debugInfo, 'AttachedToTarget event received:', params);
|
||||
switch (targetInfo.type) {
|
||||
case 'page':
|
||||
case 'iframe': {
|
||||
if (targetInfo.targetId === this.#selfTargetId) {
|
||||
break;
|
||||
}
|
||||
const cdpTarget = this.#createCdpTarget(targetCdpClient, targetInfo);
|
||||
const maybeContext = this.#browsingContextStorage.findContext(targetInfo.targetId);
|
||||
if (maybeContext) {
|
||||
// OOPiF.
|
||||
maybeContext.updateCdpTarget(cdpTarget);
|
||||
}
|
||||
else {
|
||||
// New context.
|
||||
BrowsingContextImpl_js_1.BrowsingContextImpl.create(cdpTarget, this.#realmStorage, targetInfo.targetId, null, targetInfo.browserContextId &&
|
||||
targetInfo.browserContextId !== this.#defaultUserContextId
|
||||
? targetInfo.browserContextId
|
||||
: 'default', this.#eventManager, this.#browsingContextStorage, this.#sharedIdWithFrame, this.#logger);
|
||||
}
|
||||
return;
|
||||
}
|
||||
case 'worker': {
|
||||
const browsingContext = parentSessionCdpClient.sessionId &&
|
||||
this.#browsingContextStorage.findContextBySession(parentSessionCdpClient.sessionId);
|
||||
// If there is no browsing context, this worker is already terminated.
|
||||
if (!browsingContext) {
|
||||
break;
|
||||
}
|
||||
const cdpTarget = this.#createCdpTarget(targetCdpClient, targetInfo);
|
||||
this.#handleWorkerTarget(cdpTarget, this.#realmStorage.getRealm({
|
||||
browsingContextId: browsingContext.id,
|
||||
type: 'window',
|
||||
sandbox: undefined,
|
||||
}));
|
||||
return;
|
||||
}
|
||||
}
|
||||
// DevTools or some other not supported by BiDi target. Just release
|
||||
// debugger and ignore them.
|
||||
targetCdpClient
|
||||
.sendCommand('Runtime.runIfWaitingForDebugger')
|
||||
.then(() => parentSessionCdpClient.sendCommand('Target.detachFromTarget', params))
|
||||
.catch((error) => this.#logger?.(log_js_1.LogType.debugError, error));
|
||||
}
|
||||
#createCdpTarget(targetCdpClient, targetInfo) {
|
||||
this.#setEventListeners(targetCdpClient);
|
||||
return CdpTarget_js_1.CdpTarget.create(targetInfo.targetId, targetCdpClient, this.#browserCdpClient, this.#realmStorage, this.#eventManager, this.#preloadScriptStorage, this.#networkStorage, this.#acceptInsecureCerts, this.#logger);
|
||||
}
|
||||
#workers = new Map();
|
||||
#handleWorkerTarget(cdpTarget, ownerRealm) {
|
||||
cdpTarget.cdpClient.on('Runtime.executionContextCreated', (params) => {
|
||||
const { uniqueId, id, origin } = params.context;
|
||||
const workerRealm = new DedicatedWorkerRealm_js_1.DedicatedWorkerRealm(cdpTarget.cdpClient, this.#eventManager, id, this.#logger, (0, BrowsingContextImpl_js_1.serializeOrigin)(origin), ownerRealm, uniqueId, this.#realmStorage);
|
||||
this.#workers.set(cdpTarget.cdpSessionId, workerRealm);
|
||||
});
|
||||
}
|
||||
#handleDetachedFromTargetEvent(params) {
|
||||
const context = this.#browsingContextStorage.findContextBySession(params.sessionId);
|
||||
if (context) {
|
||||
context.dispose();
|
||||
this.#preloadScriptStorage
|
||||
.find({ targetId: context.id })
|
||||
.map((preloadScript) => preloadScript.dispose(context.id));
|
||||
return;
|
||||
}
|
||||
const worker = this.#workers.get(params.sessionId);
|
||||
if (worker) {
|
||||
this.#realmStorage.deleteRealms({
|
||||
cdpSessionId: worker.cdpClient.sessionId,
|
||||
});
|
||||
}
|
||||
}
|
||||
#handleTargetInfoChangedEvent(params) {
|
||||
const context = this.#browsingContextStorage.findContext(params.targetInfo.targetId);
|
||||
if (context) {
|
||||
context.onTargetInfoChanged(params);
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.BrowsingContextProcessor = BrowsingContextProcessor;
|
||||
//# sourceMappingURL=BrowsingContextProcessor.js.map
|
||||
File diff suppressed because one or more lines are too long
142
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/domains/context/CdpTarget.js
generated
vendored
142
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/domains/context/CdpTarget.js
generated
vendored
@ -1,142 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CdpTarget = void 0;
|
||||
const Deferred_js_1 = require("../../../utils/Deferred.js");
|
||||
const LogManager_js_1 = require("../log/LogManager.js");
|
||||
const NetworkManager_js_1 = require("../network/NetworkManager.js");
|
||||
class CdpTarget {
|
||||
#id;
|
||||
#cdpClient;
|
||||
#browserCdpClient;
|
||||
#eventManager;
|
||||
#preloadScriptStorage;
|
||||
#networkStorage;
|
||||
#targetUnblocked = new Deferred_js_1.Deferred();
|
||||
#acceptInsecureCerts;
|
||||
static create(targetId, cdpClient, browserCdpClient, realmStorage, eventManager, preloadScriptStorage, networkStorage, acceptInsecureCerts, logger) {
|
||||
const cdpTarget = new CdpTarget(targetId, cdpClient, browserCdpClient, eventManager, preloadScriptStorage, networkStorage, acceptInsecureCerts);
|
||||
LogManager_js_1.LogManager.create(cdpTarget, realmStorage, eventManager, logger);
|
||||
NetworkManager_js_1.NetworkManager.create(cdpTarget, eventManager, networkStorage);
|
||||
cdpTarget.#setEventListeners();
|
||||
// No need to await.
|
||||
// Deferred will be resolved when the target is unblocked.
|
||||
void cdpTarget.#unblock();
|
||||
return cdpTarget;
|
||||
}
|
||||
constructor(targetId, cdpClient, browserCdpClient, eventManager, preloadScriptStorage, networkStorage, acceptInsecureCerts) {
|
||||
this.#id = targetId;
|
||||
this.#cdpClient = cdpClient;
|
||||
this.#eventManager = eventManager;
|
||||
this.#preloadScriptStorage = preloadScriptStorage;
|
||||
this.#networkStorage = networkStorage;
|
||||
this.#browserCdpClient = browserCdpClient;
|
||||
this.#acceptInsecureCerts = acceptInsecureCerts;
|
||||
}
|
||||
/** Returns a deferred that resolves when the target is unblocked. */
|
||||
get unblocked() {
|
||||
return this.#targetUnblocked;
|
||||
}
|
||||
get id() {
|
||||
return this.#id;
|
||||
}
|
||||
get cdpClient() {
|
||||
return this.#cdpClient;
|
||||
}
|
||||
get browserCdpClient() {
|
||||
return this.#browserCdpClient;
|
||||
}
|
||||
/** Needed for CDP escape path. */
|
||||
get cdpSessionId() {
|
||||
// SAFETY we got the client by it's id for creating
|
||||
return this.#cdpClient.sessionId;
|
||||
}
|
||||
/** Calls `Fetch.enable` with the added network intercepts. */
|
||||
async fetchEnable() {
|
||||
await this.#cdpClient.sendCommand('Fetch.enable', this.#networkStorage.getFetchEnableParams());
|
||||
}
|
||||
/** Calls `Fetch.disable`. */
|
||||
async fetchDisable() {
|
||||
await this.#cdpClient.sendCommand('Fetch.disable');
|
||||
}
|
||||
/**
|
||||
* Enables all the required CDP domains and unblocks the target.
|
||||
*/
|
||||
async #unblock() {
|
||||
try {
|
||||
await Promise.all([
|
||||
this.#cdpClient.sendCommand('Runtime.enable'),
|
||||
this.#cdpClient.sendCommand('Page.enable'),
|
||||
this.#cdpClient.sendCommand('Page.setLifecycleEventsEnabled', {
|
||||
enabled: true,
|
||||
}),
|
||||
// Set ignore certificate errors for each target.
|
||||
this.#cdpClient.sendCommand('Security.setIgnoreCertificateErrors', {
|
||||
ignore: this.#acceptInsecureCerts,
|
||||
}),
|
||||
// XXX: #1080: Do not always enable the network domain globally.
|
||||
// TODO: enable Network domain for OOPiF targets.
|
||||
this.#cdpClient.sendCommand('Network.enable'),
|
||||
// XXX: #1080: Do not always enable the fetch domain globally.
|
||||
this.fetchEnable(),
|
||||
this.#cdpClient.sendCommand('Target.setAutoAttach', {
|
||||
autoAttach: true,
|
||||
waitForDebuggerOnStart: true,
|
||||
flatten: true,
|
||||
}),
|
||||
this.#initAndEvaluatePreloadScripts(),
|
||||
this.#cdpClient.sendCommand('Runtime.runIfWaitingForDebugger'),
|
||||
]);
|
||||
}
|
||||
catch (error) {
|
||||
// The target might have been closed before the initialization finished.
|
||||
if (!this.#cdpClient.isCloseError(error)) {
|
||||
this.#targetUnblocked.resolve({
|
||||
kind: 'error',
|
||||
error,
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.#targetUnblocked.resolve({
|
||||
kind: 'success',
|
||||
value: undefined,
|
||||
});
|
||||
}
|
||||
#setEventListeners() {
|
||||
this.#cdpClient.on('*', (event, params) => {
|
||||
// We may encounter uses for EventEmitter other than CDP events,
|
||||
// which we want to skip.
|
||||
if (typeof event !== 'string') {
|
||||
return;
|
||||
}
|
||||
this.#eventManager.registerEvent({
|
||||
type: 'event',
|
||||
method: `cdp.${event}`,
|
||||
params: {
|
||||
event,
|
||||
params,
|
||||
session: this.cdpSessionId,
|
||||
},
|
||||
}, null);
|
||||
});
|
||||
}
|
||||
/**
|
||||
* All the ProxyChannels from all the preload scripts of the given
|
||||
* BrowsingContext.
|
||||
*/
|
||||
getChannels() {
|
||||
return this.#preloadScriptStorage
|
||||
.find()
|
||||
.flatMap((script) => script.channels);
|
||||
}
|
||||
/** Loads all top-level preload scripts. */
|
||||
async #initAndEvaluatePreloadScripts() {
|
||||
for (const script of this.#preloadScriptStorage.find({
|
||||
global: true,
|
||||
})) {
|
||||
await script.initInTarget(this, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.CdpTarget = CdpTarget;
|
||||
//# sourceMappingURL=CdpTarget.js.map
|
||||
@ -1 +0,0 @@
|
||||
{"version":3,"file":"CdpTarget.js","sourceRoot":"","sources":["../../../../../src/bidiMapper/domains/context/CdpTarget.ts"],"names":[],"mappings":";;;AAoBA,4DAAoD;AAGpD,wDAAgD;AAChD,oEAA4D;AAO5D,MAAa,SAAS;IACX,GAAG,CAA2B;IAC9B,UAAU,CAAY;IACtB,iBAAiB,CAAY;IAC7B,aAAa,CAAe;IAE5B,qBAAqB,CAAuB;IAC5C,eAAe,CAAiB;IAEhC,gBAAgB,GAAG,IAAI,sBAAQ,EAAgB,CAAC;IAChD,oBAAoB,CAAU;IAEvC,MAAM,CAAC,MAAM,CACX,QAAkC,EAClC,SAAoB,EACpB,gBAA2B,EAC3B,YAA0B,EAC1B,YAA0B,EAC1B,oBAA0C,EAC1C,cAA8B,EAC9B,mBAA4B,EAC5B,MAAiB;QAEjB,MAAM,SAAS,GAAG,IAAI,SAAS,CAC7B,QAAQ,EACR,SAAS,EACT,gBAAgB,EAChB,YAAY,EACZ,oBAAoB,EACpB,cAAc,EACd,mBAAmB,CACpB,CAAC;QAEF,0BAAU,CAAC,MAAM,CAAC,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,CAAC,CAAC;QACjE,kCAAc,CAAC,MAAM,CAAC,SAAS,EAAE,YAAY,EAAE,cAAc,CAAC,CAAC;QAE/D,SAAS,CA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I,CAAC,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;YACxC,gEAAgE;YAChE,yBAAyB;YACzB,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;gBAC9B,OAAO;YACT,CAAC;YACD,IAAI,CAAC,aAAa,CAAC,aAAa,CAC9B;gBACE,IAAI,EAAE,OAAO;gBACb,MAAM,EAAE,OAAO,KAAK,EAAE;gBACtB,MAAM,EAAE;oBACN,KAAK;oBACL,MAAM;oBACN,OAAO,EAAE,IAAI,CAAC,YAAY;iBAC3B;aACF,EACD,IAAI,CACL,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;OAGG;IACH,WAAW;QACT,OAAO,IAAI,CAAC,qBAAqB;aAC9B,IAAI,EAAE;aACN,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC1C,CAAC;IAED,2CAA2C;IAC3C,KAAK,CAAC,8BAA8B;QAClC,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC;YACnD,MAAM,EAAE,IAAI;SACb,CAAC,EAAE,CAAC;YACH,MAAM,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACxC,CAAC;IACH,CAAC;CACF;AAxLD,8BAwLC"}
|
||||
File diff suppressed because one or more lines are too long
@ -1 +0,0 @@
|
||||
{"version":3,"file":"ActionOption.js","sourceRoot":"","sources":["../../../../../src/bidiMapper/domains/input/ActionOption.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG"}
|
||||
File diff suppressed because one or more lines are too long
@ -1 +0,0 @@
|
||||
{"version":3,"file":"InputSource.js","sourceRoot":"","sources":["../../../../../src/bidiMapper/domains/input/InputSource.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAWH,MAAa,UAAU;IACrB,IAAI,GAAG,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.map
generated
vendored
1
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/domains/input/keyUtils.js.map
generated
vendored
File diff suppressed because one or more lines are too long
1
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/domains/log/LogManager.js.map
generated
vendored
1
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/domains/log/LogManager.js.map
generated
vendored
@ -1 +0,0 @@
|
||||
{"version":3,"file":"LogManager.js","sourceRoot":"","sources":["../../../../../src/bidiMapper/domains/log/LogManager.ts"],"names":[],"mappings":";;;AAkBA,+DAAwE;AACxE,kDAA6D;AAM7D,iDAAmD;AAEnD,gEAAgE;AAChE,SAAS,iBAAiB,CACxB,aAAsD;IAEtD,MAAM,WAAW,GAAG,aAAa,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE;QAC9D,OAAO;YACL,YAAY,EAAE,SAAS,CAAC,YAAY;YACpC,YAAY,EAAE,SAAS,CAAC,YAAY;YACpC,UAAU,EAAE,SAAS,CAAC,UAAU;YAChC,GAAG,EAAE,SAAS,CAAC,GAAG;SACnB,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO,WAAW,CAAC,CAAC,CAAC,EAAC,UAAU,EAAE,WAAW,EAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAC7D,CAAC;AAED,SAAS,WAAW,CAAC,cAAsB;IACzC,IAAI,gCAAkB,QAAQ,CAAC,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC;QACzD,qCAAuB;IACzB,CAAC;IACD,IAAI,gCAAkB,OAAO,CAAC,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC;QACxD,qCAAuB;IACzB,CAAC;IACD,IAAI,8BAAiB,SAAS,CAAC,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC;QACzD,mCAAsB;IACxB,CAAC;IACD,mCAAsB;AACxB,CAAC;AAED,MAAa,UAAU;IACZ,aAAa,CAAe;IAC5B,aAAa,C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S,EAAE,CAAC;YACxB,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;QAC3D,CAAC;QACD,OAAO,MAAM,KAAK,CAAC,eAAe,CAAC,MAAM,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;IACxE,CAAC;CACF;AApJD,gCAoJC"}
|
||||
1
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/domains/log/logHelper.js.map
generated
vendored
1
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/domains/log/logHelper.js.map
generated
vendored
@ -1 +0,0 @@
|
||||
{"version":3,"file":"logHelper.js","sourceRoot":"","sources":["../../../../../src/bidiMapper/domains/log/logHelper.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAGH,wDAAgD;AAEhD,MAAM,UAAU,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAE9D,SAAS,iBAAiB,CAAC,GAAW;IACpC,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;AACvD,CAAC;AAED;;;GAGG;AACH,SAAgB,mBAAmB,CAAC,IAA0B;IAC5D,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,MAAM,SAAS,GAAI,IAAI,CAAC,CAAC,CAAmC,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;IAC9E,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;IAC3C,MAAM,MAAM,GAAG,SAAS,CAAC,KAAK,CAC5B,IAAI,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,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C;QAC9C,KAAK,OAAO;YACV,OAAO,SAAS,GAAG,CAAC,KAAK,EAAE,MAAM,IAAI,EAAE,GAAG,CAAC;QAC7C,KAAK,KAAK;YACR,OAAO,OAAO,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,CAAC;QACrC,KAAK,KAAK;YACR,OAAO,OAAO,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,CAAC;QAErC;YACE,OAAO,GAAG,CAAC,IAAI,CAAC;IACpB,CAAC;AACH,CAAC;AAED,SAAgB,mBAAmB,CACjC,IAA0B,EAC1B,UAAmB;IAEnB,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;IAEpB,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,8DAA8D;IAC9D,IACE,GAAG,CAAC,IAAI,KAAK,QAAQ;QACrB,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;QACvC,UAAU,EACV,CAAC;QACD,OAAO,mBAAmB,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;IAED,yFAAyF;IACzF,OAAO,IAAI;SACR,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;QACX,OAAO,aAAa,CAAC,GAAG,CAAC,CAAC;IAC5B,CAAC,CAAC;SACD,IAAI,CAAC,QAAQ,CAAC,CAAC;AACpB,CAAC;AAzBD,kDAyBC"}
|
||||
@ -1,11 +0,0 @@
|
||||
import type { CdpTarget } from '../context/CdpTarget.js';
|
||||
import type { EventManager } from '../session/EventManager.js';
|
||||
import type { NetworkStorage } from './NetworkStorage.js';
|
||||
/** Maps 1:1 to CdpTarget. */
|
||||
export declare class NetworkManager {
|
||||
#private;
|
||||
private constructor();
|
||||
/** Returns the CDP Target associated with this NetworkManager instance. */
|
||||
get cdpTarget(): CdpTarget;
|
||||
static create(cdpTarget: CdpTarget, eventManager: EventManager, networkStorage: NetworkStorage): NetworkManager;
|
||||
}
|
||||
110
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/domains/network/NetworkManager.js
generated
vendored
110
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/domains/network/NetworkManager.js
generated
vendored
@ -1,110 +0,0 @@
|
||||
"use strict";
|
||||
/*
|
||||
* Copyright 2023 Google LLC.
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.NetworkManager = void 0;
|
||||
const NetworkRequest_js_1 = require("./NetworkRequest.js");
|
||||
/** Maps 1:1 to CdpTarget. */
|
||||
class NetworkManager {
|
||||
#cdpTarget;
|
||||
#eventManager;
|
||||
#networkStorage;
|
||||
constructor(cdpTarget, eventManager, networkStorage) {
|
||||
this.#cdpTarget = cdpTarget;
|
||||
this.#eventManager = eventManager;
|
||||
this.#networkStorage = networkStorage;
|
||||
}
|
||||
/** Returns the CDP Target associated with this NetworkManager instance. */
|
||||
get cdpTarget() {
|
||||
return this.#cdpTarget;
|
||||
}
|
||||
/**
|
||||
* Gets the network request with the given ID, if any.
|
||||
* Otherwise, creates a new network request with the given ID and cdp target.
|
||||
*/
|
||||
#getOrCreateNetworkRequest(id, redirectCount) {
|
||||
let request = this.#networkStorage.getRequest(id);
|
||||
if (request) {
|
||||
return request;
|
||||
}
|
||||
request = new NetworkRequest_js_1.NetworkRequest(id, this.#eventManager, this.#networkStorage, this.#cdpTarget, redirectCount);
|
||||
this.#networkStorage.addRequest(request);
|
||||
return request;
|
||||
}
|
||||
static create(cdpTarget, eventManager, networkStorage) {
|
||||
const networkManager = new NetworkManager(cdpTarget, eventManager, networkStorage);
|
||||
cdpTarget.browserCdpClient.on('Target.detachedFromTarget', (params) => {
|
||||
if (cdpTarget.cdpClient.sessionId === params.sessionId) {
|
||||
networkManager.#networkStorage.disposeRequestMap();
|
||||
}
|
||||
});
|
||||
cdpTarget.cdpClient.on('Network.requestWillBeSent', (params) => {
|
||||
const request = networkManager.#networkStorage.getRequest(params.requestId);
|
||||
if (request && request.isRedirecting()) {
|
||||
request.handleRedirect(params);
|
||||
networkManager.#networkStorage.deleteRequest(params.requestId);
|
||||
networkManager
|
||||
.#getOrCreateNetworkRequest(params.requestId, request.redirectCount + 1)
|
||||
.onRequestWillBeSentEvent(params);
|
||||
}
|
||||
else if (request) {
|
||||
request.onRequestWillBeSentEvent(params);
|
||||
}
|
||||
else {
|
||||
networkManager
|
||||
.#getOrCreateNetworkRequest(params.requestId)
|
||||
.onRequestWillBeSentEvent(params);
|
||||
}
|
||||
});
|
||||
cdpTarget.cdpClient.on('Network.requestWillBeSentExtraInfo', (params) => {
|
||||
networkManager
|
||||
.#getOrCreateNetworkRequest(params.requestId)
|
||||
.onRequestWillBeSentExtraInfoEvent(params);
|
||||
});
|
||||
cdpTarget.cdpClient.on('Network.responseReceived', (params) => {
|
||||
networkManager
|
||||
.#getOrCreateNetworkRequest(params.requestId)
|
||||
.onResponseReceivedEvent(params);
|
||||
});
|
||||
cdpTarget.cdpClient.on('Network.responseReceivedExtraInfo', (params) => {
|
||||
networkManager
|
||||
.#getOrCreateNetworkRequest(params.requestId)
|
||||
.onResponseReceivedExtraInfoEvent(params);
|
||||
});
|
||||
cdpTarget.cdpClient.on('Network.requestServedFromCache', (params) => {
|
||||
networkManager
|
||||
.#getOrCreateNetworkRequest(params.requestId)
|
||||
.onServedFromCache();
|
||||
});
|
||||
cdpTarget.cdpClient.on('Network.loadingFailed', (params) => {
|
||||
networkManager
|
||||
.#getOrCreateNetworkRequest(params.requestId)
|
||||
.onLoadingFailedEvent(params);
|
||||
});
|
||||
// https://chromedevtools.github.io/devtools-protocol/tot/Fetch/#event-requestPaused
|
||||
cdpTarget.cdpClient.on('Fetch.requestPaused', (params) => {
|
||||
if (params.networkId) {
|
||||
networkManager
|
||||
.#getOrCreateNetworkRequest(params.networkId)
|
||||
.onRequestPaused(params);
|
||||
}
|
||||
});
|
||||
return networkManager;
|
||||
}
|
||||
}
|
||||
exports.NetworkManager = NetworkManager;
|
||||
//# sourceMappingURL=NetworkManager.js.map
|
||||
@ -1 +0,0 @@
|
||||
{"version":3,"file":"NetworkManager.js","sourceRoot":"","sources":["../../../../../src/bidiMapper/domains/network/NetworkManager.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAaH,2DAAmD;AAGnD,6BAA6B;AAC7B,MAAa,cAAc;IAChB,UAAU,CAAY;IACtB,aAAa,CAAe;IAC5B,eAAe,CAAiB;IAEzC,YACE,SAAoB,EACpB,YAA0B,EAC1B,cAA8B;QAE9B,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;QAClC,IAAI,CAAC,eAAe,GAAG,cAAc,CAAC;IACxC,CAAC;IAED,2EAA2E;IAC3E,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED;;;OAGG;IACH,0BAA0B,CACxB,EAAmB,EACnB,aAAsB;QAEtB,IAAI,OAAO,GAAG,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;QAClD,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,OAAO,CAAC;QACjB,CAAC;QAED,OAAO,GAAG,IAAI,kCAAc,CAC1B,EAAE,EACF,IAAI,CAAC,aAAa,EAClB,IAAI,CAAC,eAAe,EACpB,IAAI,CAAC,UAAU,EACf,aAAa,CACd,CAAC;QAEF,IAAI,CAAC,eAAe,CAAC,UAAU,CA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CACF,CAAC;QAEF,OAAO,cAAc,CAAC;IACxB,CAAC;CACF;AAtJD,wCAsJC"}
|
||||
230
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/domains/network/NetworkProcessor.js
generated
vendored
230
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/domains/network/NetworkProcessor.js
generated
vendored
@ -1,230 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.NetworkProcessor = void 0;
|
||||
const protocol_js_1 = require("../../../protocol/protocol.js");
|
||||
const assert_js_1 = require("../../../utils/assert.js");
|
||||
const NetworkStorage_js_1 = require("./NetworkStorage.js");
|
||||
const NetworkUtils_js_1 = require("./NetworkUtils.js");
|
||||
/** Dispatches Network domain commands. */
|
||||
class NetworkProcessor {
|
||||
#browsingContextStorage;
|
||||
#networkStorage;
|
||||
constructor(browsingContextStorage, networkStorage) {
|
||||
this.#browsingContextStorage = browsingContextStorage;
|
||||
this.#networkStorage = networkStorage;
|
||||
}
|
||||
async addIntercept(params) {
|
||||
// If AuthRequired is specified, BeforeRequestSent must also be specified.
|
||||
// This is a CDP quirk.
|
||||
if (params.phases.includes("authRequired" /* Network.InterceptPhase.AuthRequired */) &&
|
||||
!params.phases.includes("beforeRequestSent" /* Network.InterceptPhase.BeforeRequestSent */)) {
|
||||
params.phases.unshift("beforeRequestSent" /* Network.InterceptPhase.BeforeRequestSent */);
|
||||
}
|
||||
const urlPatterns = params.urlPatterns ?? [];
|
||||
const parsedUrlPatterns = NetworkProcessor.parseUrlPatterns(urlPatterns);
|
||||
const intercept = this.#networkStorage.addIntercept({
|
||||
urlPatterns: parsedUrlPatterns,
|
||||
phases: params.phases,
|
||||
});
|
||||
await this.#fetchApply();
|
||||
return {
|
||||
intercept,
|
||||
};
|
||||
}
|
||||
async continueRequest(params) {
|
||||
const networkId = params.request;
|
||||
const { request: fetchId, phase } = this.#getBlockedRequest(networkId);
|
||||
if (phase !== "beforeRequestSent" /* Network.InterceptPhase.BeforeRequestSent */) {
|
||||
throw new protocol_js_1.InvalidArgumentException(`Blocked request for network id '${networkId}' is not in 'BeforeRequestSent' phase`);
|
||||
}
|
||||
if (params.url !== undefined) {
|
||||
NetworkProcessor.parseUrlString(params.url);
|
||||
}
|
||||
const { url, method, headers } = params;
|
||||
// TODO: Set / expand.
|
||||
// ; Step 9. cookies
|
||||
// ; Step 10. body
|
||||
const requestHeaders = (0, NetworkUtils_js_1.cdpFetchHeadersFromBidiNetworkHeaders)(headers);
|
||||
const request = this.#getRequestOrFail(networkId);
|
||||
await request.continueRequest(fetchId, url, method, requestHeaders);
|
||||
this.#networkStorage.removeBlockedRequest(networkId);
|
||||
return {};
|
||||
}
|
||||
async continueResponse(params) {
|
||||
const networkId = params.request;
|
||||
const { request: fetchId, phase } = this.#getBlockedRequest(networkId);
|
||||
if (phase === "beforeRequestSent" /* Network.InterceptPhase.BeforeRequestSent */) {
|
||||
throw new protocol_js_1.InvalidArgumentException(`Blocked request for network id '${networkId}' is in 'BeforeRequestSent' phase`);
|
||||
}
|
||||
const { statusCode, reasonPhrase, headers } = params;
|
||||
const responseHeaders = (0, NetworkUtils_js_1.cdpFetchHeadersFromBidiNetworkHeaders)(headers);
|
||||
// TODO: Set / expand.
|
||||
// ; Step 10. cookies
|
||||
// ; Step 11. credentials
|
||||
const request = this.#getRequestOrFail(networkId);
|
||||
await request.continueResponse(fetchId, statusCode, reasonPhrase, responseHeaders);
|
||||
this.#networkStorage.removeBlockedRequest(networkId);
|
||||
return {};
|
||||
}
|
||||
async continueWithAuth(params) {
|
||||
const networkId = params.request;
|
||||
const { request: fetchId, phase } = this.#getBlockedRequest(networkId);
|
||||
if (phase !== "authRequired" /* Network.InterceptPhase.AuthRequired */) {
|
||||
throw new protocol_js_1.InvalidArgumentException(`Blocked request for network id '${networkId}' is not in 'AuthRequired' phase`);
|
||||
}
|
||||
const request = this.#getRequestOrFail(networkId);
|
||||
let username;
|
||||
let password;
|
||||
if (params.action === 'provideCredentials') {
|
||||
const { credentials } = params;
|
||||
username = credentials.username;
|
||||
password = credentials.password;
|
||||
// TODO: This should be invalid argument exception.
|
||||
// Spec may need to be updated.
|
||||
(0, assert_js_1.assert)(credentials.type === 'password', `Credentials type ${credentials.type} must be 'password'`);
|
||||
}
|
||||
const response = (0, NetworkUtils_js_1.cdpAuthChallengeResponseFromBidiAuthContinueWithAuthAction)(params.action);
|
||||
await request.continueWithAuth(fetchId, response, username, password);
|
||||
return {};
|
||||
}
|
||||
async failRequest({ request: networkId, }) {
|
||||
const { request: fetchId, phase } = this.#getBlockedRequest(networkId);
|
||||
if (phase === "authRequired" /* Network.InterceptPhase.AuthRequired */) {
|
||||
throw new protocol_js_1.InvalidArgumentException(`Blocked request for network id '${networkId}' is in 'AuthRequired' phase`);
|
||||
}
|
||||
const request = this.#getRequestOrFail(networkId);
|
||||
await request.failRequest(fetchId, 'Failed');
|
||||
this.#networkStorage.removeBlockedRequest(networkId);
|
||||
return {};
|
||||
}
|
||||
async provideResponse(params) {
|
||||
const { statusCode, reasonPhrase, headers, body, request: networkId, } = params;
|
||||
const { request: fetchId } = this.#getBlockedRequest(networkId);
|
||||
// TODO: Step 6
|
||||
// https://w3c.github.io/webdriver-bidi/#command-network-continueResponse
|
||||
const responseHeaders = (0, NetworkUtils_js_1.cdpFetchHeadersFromBidiNetworkHeaders)(headers);
|
||||
// TODO: Set / expand.
|
||||
// ; Step 10. cookies
|
||||
// ; Step 11. credentials
|
||||
const request = this.#getRequestOrFail(networkId);
|
||||
await request.provideResponse(fetchId, statusCode ?? request.statusCode, reasonPhrase, responseHeaders, body?.value // TODO: Differ base64 / string
|
||||
);
|
||||
this.#networkStorage.removeBlockedRequest(networkId);
|
||||
return {};
|
||||
}
|
||||
async removeIntercept(params) {
|
||||
this.#networkStorage.removeIntercept(params.intercept);
|
||||
await this.#fetchApply();
|
||||
return {};
|
||||
}
|
||||
/** Applies all existing network intercepts to all CDP targets concurrently. */
|
||||
async #fetchEnable() {
|
||||
await Promise.all(this.#browsingContextStorage.getAllContexts().map(async (context) => {
|
||||
await context.cdpTarget.fetchEnable();
|
||||
}));
|
||||
}
|
||||
/** Removes all existing network intercepts from all CDP targets concurrently. */
|
||||
async #fetchDisable() {
|
||||
await Promise.all(this.#browsingContextStorage.getAllContexts().map(async (context) => {
|
||||
await context.cdpTarget.fetchDisable();
|
||||
}));
|
||||
}
|
||||
/**
|
||||
* Either enables or disables the Fetch domain.
|
||||
*
|
||||
* If enabling, applies all existing network intercepts to all CDP targets.
|
||||
* If disabling, removes all existing network intercepts from all CDP targets.
|
||||
*
|
||||
* Disabling is only performed when there are no remaining intercepts or
|
||||
* // blocked requests.
|
||||
*/
|
||||
async #fetchApply() {
|
||||
if (this.#networkStorage.hasIntercepts() ||
|
||||
this.#networkStorage.hasBlockedRequests() ||
|
||||
this.#networkStorage.hasNetworkRequests()) {
|
||||
// TODO: Add try/catch. Remove the intercept if CDP Fetch commands fail.
|
||||
await this.#fetchEnable();
|
||||
}
|
||||
else {
|
||||
// The last intercept has been removed, and there are no pending
|
||||
// blocked requests.
|
||||
// Disable the Fetch domain.
|
||||
await this.#fetchDisable();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Returns the blocked request associated with the given network ID.
|
||||
* If none, throws a NoSuchRequestException.
|
||||
*/
|
||||
#getBlockedRequest(networkId) {
|
||||
const blockedRequest = this.#networkStorage.getBlockedRequest(networkId);
|
||||
if (!blockedRequest) {
|
||||
throw new protocol_js_1.NoSuchRequestException(`No blocked request found for network id '${networkId}'`);
|
||||
}
|
||||
return blockedRequest;
|
||||
}
|
||||
#getRequestOrFail(id) {
|
||||
const request = this.#networkStorage.getRequest(id);
|
||||
if (!request) {
|
||||
throw new protocol_js_1.NoSuchRequestException(`Network request with ID ${id} doesn't exist`);
|
||||
}
|
||||
return request;
|
||||
}
|
||||
/**
|
||||
* Attempts to parse the given url.
|
||||
* Throws an InvalidArgumentException if the url is invalid.
|
||||
*/
|
||||
static parseUrlString(url) {
|
||||
try {
|
||||
return new URL(url);
|
||||
}
|
||||
catch (error) {
|
||||
throw new protocol_js_1.InvalidArgumentException(`Invalid URL '${url}': ${error}`);
|
||||
}
|
||||
}
|
||||
static parseUrlPatterns(urlPatterns) {
|
||||
return urlPatterns.map((urlPattern) => {
|
||||
switch (urlPattern.type) {
|
||||
case 'string': {
|
||||
NetworkProcessor.parseUrlString(urlPattern.pattern);
|
||||
return urlPattern;
|
||||
}
|
||||
case 'pattern':
|
||||
// No params signifies intercept all
|
||||
if (urlPattern.protocol === undefined &&
|
||||
urlPattern.hostname === undefined &&
|
||||
urlPattern.port === undefined &&
|
||||
urlPattern.pathname === undefined &&
|
||||
urlPattern.search === undefined) {
|
||||
return urlPattern;
|
||||
}
|
||||
if (urlPattern.protocol === '') {
|
||||
throw new protocol_js_1.InvalidArgumentException(`URL pattern must specify a protocol`);
|
||||
}
|
||||
if (urlPattern.hostname === '') {
|
||||
throw new protocol_js_1.InvalidArgumentException(`URL pattern must specify a hostname`);
|
||||
}
|
||||
if ((urlPattern.hostname?.length ?? 0) > 0) {
|
||||
if (urlPattern.protocol?.match(/^file/i)) {
|
||||
throw new protocol_js_1.InvalidArgumentException(`URL pattern protocol cannot be 'file'`);
|
||||
}
|
||||
if (urlPattern.hostname?.includes(':')) {
|
||||
throw new protocol_js_1.InvalidArgumentException(`URL pattern hostname must not contain a colon`);
|
||||
}
|
||||
}
|
||||
if (urlPattern.port === '') {
|
||||
throw new protocol_js_1.InvalidArgumentException(`URL pattern must specify a port`);
|
||||
}
|
||||
try {
|
||||
new URL(NetworkStorage_js_1.NetworkStorage.buildUrlPatternString(urlPattern));
|
||||
}
|
||||
catch (error) {
|
||||
throw new protocol_js_1.InvalidArgumentException(`${error}`);
|
||||
}
|
||||
return urlPattern;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.NetworkProcessor = NetworkProcessor;
|
||||
//# sourceMappingURL=NetworkProcessor.js.map
|
||||
File diff suppressed because one or more lines are too long
532
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/domains/network/NetworkRequest.js
generated
vendored
532
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/domains/network/NetworkRequest.js
generated
vendored
@ -1,532 +0,0 @@
|
||||
"use strict";
|
||||
/*
|
||||
* Copyright 2023 Google LLC.
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.NetworkRequest = void 0;
|
||||
const protocol_js_1 = require("../../../protocol/protocol.js");
|
||||
const assert_js_1 = require("../../../utils/assert.js");
|
||||
const Deferred_js_1 = require("../../../utils/Deferred.js");
|
||||
const NetworkUtils_js_1 = require("./NetworkUtils.js");
|
||||
/** Abstracts one individual network request. */
|
||||
class NetworkRequest {
|
||||
static #unknown = 'UNKNOWN';
|
||||
/**
|
||||
* Each network request has an associated request id, which is a string
|
||||
* uniquely identifying that request.
|
||||
*
|
||||
* The identifier for a request resulting from a redirect matches that of the
|
||||
* request that initiated it.
|
||||
*/
|
||||
#requestId;
|
||||
// TODO: Handle auth required?
|
||||
/**
|
||||
* Indicates the network intercept phase, if the request is currently blocked.
|
||||
* Undefined necessarily implies that the request is not blocked.
|
||||
*/
|
||||
#interceptPhase = undefined;
|
||||
#servedFromCache = false;
|
||||
#redirectCount;
|
||||
#eventManager;
|
||||
#networkStorage;
|
||||
#request = {};
|
||||
#response = {};
|
||||
#beforeRequestSentDeferred = new Deferred_js_1.Deferred();
|
||||
#responseStartedDeferred = new Deferred_js_1.Deferred();
|
||||
#responseCompletedDeferred = new Deferred_js_1.Deferred();
|
||||
#cdpTarget;
|
||||
constructor(requestId, eventManager, networkStorage, cdpTarget, redirectCount = 0) {
|
||||
this.#requestId = requestId;
|
||||
this.#eventManager = eventManager;
|
||||
this.#networkStorage = networkStorage;
|
||||
this.#cdpTarget = cdpTarget;
|
||||
this.#redirectCount = redirectCount;
|
||||
}
|
||||
get requestId() {
|
||||
return this.#requestId;
|
||||
}
|
||||
get url() {
|
||||
return this.#response.info?.url ?? this.#request.info?.request.url;
|
||||
}
|
||||
get redirectCount() {
|
||||
return this.#redirectCount;
|
||||
}
|
||||
get cdpTarget() {
|
||||
return this.#cdpTarget;
|
||||
}
|
||||
isRedirecting() {
|
||||
return Boolean(this.#request.info);
|
||||
}
|
||||
handleRedirect(event) {
|
||||
this.#queueResponseStartedEvent();
|
||||
this.#queueResponseCompletedEvent();
|
||||
this.#response.hasExtraInfo = event.redirectHasExtraInfo;
|
||||
this.#response.info = event.redirectResponse;
|
||||
this.#emitEventsIfReady(true);
|
||||
}
|
||||
#emitEventsIfReady(wasRedirected = false) {
|
||||
const requestExtraInfoCompleted =
|
||||
// Flush redirects
|
||||
wasRedirected ||
|
||||
Boolean(this.#request.extraInfo) ||
|
||||
// Requests from cache don't have extra info
|
||||
this.#servedFromCache ||
|
||||
// Sometimes there is no extra info and the response
|
||||
// is the only place we can find out
|
||||
Boolean(this.#response.info && !this.#response.hasExtraInfo) ||
|
||||
this.#interceptPhase === "beforeRequestSent" /* Network.InterceptPhase.BeforeRequestSent */;
|
||||
if (this.#request.info && requestExtraInfoCompleted) {
|
||||
this.#beforeRequestSentDeferred.resolve({
|
||||
kind: 'success',
|
||||
value: undefined,
|
||||
});
|
||||
}
|
||||
const responseExtraInfoCompleted = Boolean(this.#response.extraInfo) ||
|
||||
// Response from cache don't have extra info
|
||||
this.#servedFromCache ||
|
||||
// Don't expect extra info if the flag is false
|
||||
Boolean(this.#response.info && !this.#response.hasExtraInfo) ||
|
||||
this.#interceptPhase === "responseStarted" /* Network.InterceptPhase.ResponseStarted */;
|
||||
if (this.#response.info && responseExtraInfoCompleted) {
|
||||
this.#responseStartedDeferred.resolve({
|
||||
kind: 'success',
|
||||
value: undefined,
|
||||
});
|
||||
this.#responseCompletedDeferred.resolve({
|
||||
kind: 'success',
|
||||
value: undefined,
|
||||
});
|
||||
}
|
||||
}
|
||||
onRequestWillBeSentEvent(event) {
|
||||
this.#request.info = event;
|
||||
this.#queueBeforeRequestSentEvent();
|
||||
this.#emitEventsIfReady();
|
||||
}
|
||||
onRequestWillBeSentExtraInfoEvent(event) {
|
||||
this.#request.extraInfo = event;
|
||||
this.#emitEventsIfReady();
|
||||
}
|
||||
onResponseReceivedExtraInfoEvent(event) {
|
||||
this.#response.extraInfo = event;
|
||||
this.#emitEventsIfReady();
|
||||
}
|
||||
onResponseReceivedEvent(event) {
|
||||
this.#response.hasExtraInfo = event.hasExtraInfo;
|
||||
this.#response.info = event.response;
|
||||
this.#queueResponseStartedEvent();
|
||||
this.#queueResponseCompletedEvent();
|
||||
this.#emitEventsIfReady();
|
||||
}
|
||||
onServedFromCache() {
|
||||
this.#servedFromCache = true;
|
||||
this.#emitEventsIfReady();
|
||||
}
|
||||
onLoadingFailedEvent(event) {
|
||||
this.#beforeRequestSentDeferred.resolve({
|
||||
kind: 'success',
|
||||
value: undefined,
|
||||
});
|
||||
this.#responseStartedDeferred.resolve({
|
||||
kind: 'error',
|
||||
error: new Error('Network event loading failed'),
|
||||
});
|
||||
this.#responseCompletedDeferred.resolve({
|
||||
kind: 'error',
|
||||
error: new Error('Network event loading failed'),
|
||||
});
|
||||
this.#eventManager.registerEvent({
|
||||
type: 'event',
|
||||
method: protocol_js_1.ChromiumBidi.Network.EventNames.FetchError,
|
||||
params: {
|
||||
...this.#getBaseEventParams(),
|
||||
errorText: event.errorText,
|
||||
},
|
||||
}, this.#context);
|
||||
}
|
||||
/** Fired whenever a network request interception is hit. */
|
||||
onRequestPaused(params) {
|
||||
if (this.#isIgnoredEvent()) {
|
||||
void this.continueRequest(params.requestId).catch(() => {
|
||||
// TODO: Add some logging
|
||||
});
|
||||
return;
|
||||
}
|
||||
// The stage of the request can be determined by presence of
|
||||
// responseErrorReason and responseStatusCode -- the request is at
|
||||
// the response stage if either of these fields is present and in the
|
||||
// request stage otherwise.
|
||||
let phase;
|
||||
if (params.responseErrorReason === undefined &&
|
||||
params.responseStatusCode === undefined) {
|
||||
phase = "beforeRequestSent" /* Network.InterceptPhase.BeforeRequestSent */;
|
||||
}
|
||||
else if (params.responseStatusCode === 401 &&
|
||||
params.responseStatusText === 'Unauthorized') {
|
||||
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401
|
||||
phase = "authRequired" /* Network.InterceptPhase.AuthRequired */;
|
||||
}
|
||||
else {
|
||||
phase = "responseStarted" /* Network.InterceptPhase.ResponseStarted */;
|
||||
}
|
||||
const headers = (0, NetworkUtils_js_1.bidiNetworkHeadersFromCdpFetchHeaders)(
|
||||
// TODO: Use params.request.headers if request?
|
||||
params.responseHeaders);
|
||||
this.#networkStorage.addBlockedRequest(this.requestId, {
|
||||
request: params.requestId, // intercept request id
|
||||
phase,
|
||||
// TODO: Finish populating response / ResponseData.
|
||||
response: {
|
||||
url: params.request.url,
|
||||
// TODO: populate.
|
||||
protocol: '',
|
||||
status: params.responseStatusCode ?? 0,
|
||||
statusText: params.responseStatusText ?? '',
|
||||
// TODO: populate.
|
||||
fromCache: false,
|
||||
headers,
|
||||
// TODO: populate.
|
||||
mimeType: '',
|
||||
// TODO: populate.
|
||||
bytesReceived: 0,
|
||||
headersSize: (0, NetworkUtils_js_1.computeHeadersSize)(headers),
|
||||
// TODO: consider removing from spec.
|
||||
bodySize: 0,
|
||||
// TODO: consider removing from spec.
|
||||
content: {
|
||||
size: 0,
|
||||
},
|
||||
// TODO: populate.
|
||||
authChallenge: undefined,
|
||||
},
|
||||
});
|
||||
this.#interceptPhase = phase;
|
||||
this.#emitEventsIfReady();
|
||||
}
|
||||
/** @see https://chromedevtools.github.io/devtools-protocol/tot/Fetch/#method-failRequest */
|
||||
async failRequest(networkId, errorReason) {
|
||||
await this.#cdpTarget.cdpClient.sendCommand('Fetch.failRequest', {
|
||||
requestId: networkId,
|
||||
errorReason,
|
||||
});
|
||||
this.#interceptPhase = undefined;
|
||||
}
|
||||
/** @see https://chromedevtools.github.io/devtools-protocol/tot/Fetch/#method-continueRequest */
|
||||
async continueRequest(cdpFetchRequestId, url, method, headers) {
|
||||
// TODO: Expand.
|
||||
await this.#cdpTarget.cdpClient.sendCommand('Fetch.continueRequest', {
|
||||
requestId: cdpFetchRequestId,
|
||||
url,
|
||||
method,
|
||||
headers,
|
||||
// TODO: Set?
|
||||
// postData:,
|
||||
// interceptResponse:,
|
||||
});
|
||||
this.#interceptPhase = undefined;
|
||||
}
|
||||
/** @see https://chromedevtools.github.io/devtools-protocol/tot/Fetch/#method-continueResponse */
|
||||
async continueResponse(cdpFetchRequestId, responseCode, responsePhrase, responseHeaders) {
|
||||
await this.#cdpTarget.cdpClient.sendCommand('Fetch.continueResponse', {
|
||||
requestId: cdpFetchRequestId,
|
||||
responseCode,
|
||||
responsePhrase,
|
||||
responseHeaders,
|
||||
});
|
||||
this.#interceptPhase = undefined;
|
||||
}
|
||||
/** @see https://chromedevtools.github.io/devtools-protocol/tot/Fetch/#method-continueWithAuth */
|
||||
async continueWithAuth(cdpFetchRequestId, response, username, password) {
|
||||
await this.#cdpTarget.cdpClient.sendCommand('Fetch.continueWithAuth', {
|
||||
requestId: cdpFetchRequestId,
|
||||
authChallengeResponse: {
|
||||
response,
|
||||
username,
|
||||
password,
|
||||
},
|
||||
});
|
||||
this.#interceptPhase = undefined;
|
||||
}
|
||||
/** @see https://chromedevtools.github.io/devtools-protocol/tot/Fetch/#method-provideResponse */
|
||||
async provideResponse(cdpFetchRequestId, responseCode, responsePhrase, responseHeaders, body) {
|
||||
await this.#cdpTarget.cdpClient.sendCommand('Fetch.fulfillRequest', {
|
||||
requestId: cdpFetchRequestId,
|
||||
responseCode,
|
||||
responsePhrase,
|
||||
responseHeaders,
|
||||
...(body ? { body: btoa(body) } : {}), // TODO: Double-check if btoa usage is correct.
|
||||
});
|
||||
this.#interceptPhase = undefined;
|
||||
}
|
||||
dispose() {
|
||||
const result = {
|
||||
kind: 'error',
|
||||
error: new Error('Network processor detached'),
|
||||
};
|
||||
this.#beforeRequestSentDeferred.resolve(result);
|
||||
this.#responseStartedDeferred.resolve(result);
|
||||
this.#responseCompletedDeferred.resolve(result);
|
||||
}
|
||||
get #context() {
|
||||
return this.#request.info?.frameId ?? null;
|
||||
}
|
||||
/** Returns the HTTP status code associated with this request if any. */
|
||||
get statusCode() {
|
||||
return (this.#response.info?.status ?? this.#response.extraInfo?.statusCode ?? -1 // TODO: Throw an exception or use some other status code?
|
||||
);
|
||||
}
|
||||
#getBaseEventParams(phase) {
|
||||
// TODO: Set this in terms of intercepts?
|
||||
const isBlocked = phase !== undefined && phase === this.#interceptPhase;
|
||||
const intercepts = this.#networkStorage.getNetworkIntercepts(this.#requestId, phase);
|
||||
return {
|
||||
isBlocked,
|
||||
context: this.#context,
|
||||
navigation: this.#getNavigationId(),
|
||||
redirectCount: this.#redirectCount,
|
||||
request: this.#getRequestData(),
|
||||
// Timestamp should be in milliseconds, while CDP provides it in seconds.
|
||||
timestamp: Math.round((this.#request.info?.wallTime ?? 0) * 1000),
|
||||
// XXX: we should return correct types from the function.
|
||||
intercepts: isBlocked ? intercepts : undefined,
|
||||
};
|
||||
}
|
||||
#getNavigationId() {
|
||||
if (!this.#request.info ||
|
||||
!this.#request.info.loaderId ||
|
||||
// When we navigate all CDP network events have `loaderId`
|
||||
// CDP's `loaderId` and `requestId` match when
|
||||
// that request triggered the loading
|
||||
this.#request.info.loaderId !== this.#request.info.requestId) {
|
||||
return null;
|
||||
}
|
||||
return this.#request.info.loaderId;
|
||||
}
|
||||
#getRequestData() {
|
||||
const cookies = this.#request.extraInfo
|
||||
? NetworkRequest.#getCookies(this.#request.extraInfo.associatedCookies)
|
||||
: [];
|
||||
const headers = (0, NetworkUtils_js_1.bidiNetworkHeadersFromCdpNetworkHeaders)(this.#request.info?.request.headers);
|
||||
return {
|
||||
request: this.#request.info?.requestId ?? NetworkRequest.#unknown,
|
||||
url: this.#request.info?.request.url ?? NetworkRequest.#unknown,
|
||||
method: this.#request.info?.request.method ?? NetworkRequest.#unknown,
|
||||
headers,
|
||||
cookies,
|
||||
headersSize: (0, NetworkUtils_js_1.computeHeadersSize)(headers),
|
||||
// TODO: implement.
|
||||
bodySize: 0,
|
||||
timings: this.#getTimings(),
|
||||
};
|
||||
}
|
||||
// TODO: implement.
|
||||
#getTimings() {
|
||||
return {
|
||||
timeOrigin: 0,
|
||||
requestTime: 0,
|
||||
redirectStart: 0,
|
||||
redirectEnd: 0,
|
||||
fetchStart: 0,
|
||||
dnsStart: 0,
|
||||
dnsEnd: 0,
|
||||
connectStart: 0,
|
||||
connectEnd: 0,
|
||||
tlsStart: 0,
|
||||
requestStart: 0,
|
||||
responseStart: 0,
|
||||
responseEnd: 0,
|
||||
};
|
||||
}
|
||||
#queueBeforeRequestSentEvent() {
|
||||
if (this.#isIgnoredEvent()) {
|
||||
return;
|
||||
}
|
||||
this.#eventManager.registerPromiseEvent(this.#beforeRequestSentDeferred.then((result) => {
|
||||
if (result.kind === 'success') {
|
||||
try {
|
||||
return {
|
||||
kind: 'success',
|
||||
value: Object.assign(this.#getBeforeRequestEvent(), {
|
||||
type: 'event',
|
||||
}),
|
||||
};
|
||||
}
|
||||
catch (error) {
|
||||
return {
|
||||
kind: 'error',
|
||||
error: error instanceof Error ? error : new Error('Unknown'),
|
||||
};
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}), this.#context, protocol_js_1.ChromiumBidi.Network.EventNames.BeforeRequestSent);
|
||||
}
|
||||
#getBeforeRequestEvent() {
|
||||
(0, assert_js_1.assert)(this.#request.info, 'RequestWillBeSentEvent is not set');
|
||||
return {
|
||||
method: protocol_js_1.ChromiumBidi.Network.EventNames.BeforeRequestSent,
|
||||
params: {
|
||||
...this.#getBaseEventParams("beforeRequestSent" /* Network.InterceptPhase.BeforeRequestSent */),
|
||||
initiator: {
|
||||
type: NetworkRequest.#getInitiatorType(this.#request.info.initiator.type),
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
#queueResponseStartedEvent() {
|
||||
if (this.#isIgnoredEvent()) {
|
||||
return;
|
||||
}
|
||||
this.#eventManager.registerPromiseEvent(this.#responseStartedDeferred.then((result) => {
|
||||
if (result.kind === 'success') {
|
||||
try {
|
||||
return {
|
||||
kind: 'success',
|
||||
value: Object.assign(this.#getResponseStartedEvent(), {
|
||||
type: 'event',
|
||||
}),
|
||||
};
|
||||
}
|
||||
catch (error) {
|
||||
return {
|
||||
kind: 'error',
|
||||
error: error instanceof Error ? error : new Error('Unknown'),
|
||||
};
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}), this.#context, protocol_js_1.ChromiumBidi.Network.EventNames.ResponseStarted);
|
||||
}
|
||||
#getResponseStartedEvent() {
|
||||
(0, assert_js_1.assert)(this.#request.info, 'RequestWillBeSentEvent is not set');
|
||||
(0, assert_js_1.assert)(this.#response.info, 'ResponseReceivedEvent is not set');
|
||||
// Chromium sends wrong extraInfo events for responses served from cache.
|
||||
// See https://github.com/puppeteer/puppeteer/issues/9965 and
|
||||
// https://crbug.com/1340398.
|
||||
if (this.#response.info.fromDiskCache) {
|
||||
this.#response.extraInfo = undefined;
|
||||
}
|
||||
const headers = (0, NetworkUtils_js_1.bidiNetworkHeadersFromCdpNetworkHeaders)(this.#response.info.headers);
|
||||
return {
|
||||
method: protocol_js_1.ChromiumBidi.Network.EventNames.ResponseStarted,
|
||||
params: {
|
||||
...this.#getBaseEventParams(),
|
||||
response: {
|
||||
url: this.#response.info.url ?? NetworkRequest.#unknown,
|
||||
protocol: this.#response.info.protocol ?? '',
|
||||
status: this.statusCode,
|
||||
statusText: this.#response.info.statusText,
|
||||
fromCache: this.#response.info.fromDiskCache ||
|
||||
this.#response.info.fromPrefetchCache ||
|
||||
this.#servedFromCache,
|
||||
headers,
|
||||
mimeType: this.#response.info.mimeType,
|
||||
bytesReceived: this.#response.info.encodedDataLength,
|
||||
headersSize: (0, NetworkUtils_js_1.computeHeadersSize)(headers),
|
||||
// TODO: consider removing from spec.
|
||||
bodySize: 0,
|
||||
content: {
|
||||
// TODO: consider removing from spec.
|
||||
size: 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
#queueResponseCompletedEvent() {
|
||||
if (this.#isIgnoredEvent()) {
|
||||
return;
|
||||
}
|
||||
this.#eventManager.registerPromiseEvent(this.#responseCompletedDeferred.then((result) => {
|
||||
if (result.kind === 'success') {
|
||||
try {
|
||||
return {
|
||||
kind: 'success',
|
||||
value: Object.assign(this.#getResponseReceivedEvent(), {
|
||||
type: 'event',
|
||||
}),
|
||||
};
|
||||
}
|
||||
catch (error) {
|
||||
return {
|
||||
kind: 'error',
|
||||
error: error instanceof Error ? error : new Error('Unknown'),
|
||||
};
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}), this.#context, protocol_js_1.ChromiumBidi.Network.EventNames.ResponseCompleted);
|
||||
}
|
||||
#getResponseReceivedEvent() {
|
||||
(0, assert_js_1.assert)(this.#request.info, 'RequestWillBeSentEvent is not set');
|
||||
(0, assert_js_1.assert)(this.#response.info, 'ResponseReceivedEvent is not set');
|
||||
// Chromium sends wrong extraInfo events for responses served from cache.
|
||||
// See https://github.com/puppeteer/puppeteer/issues/9965 and
|
||||
// https://crbug.com/1340398.
|
||||
if (this.#response.info.fromDiskCache) {
|
||||
this.#response.extraInfo = undefined;
|
||||
}
|
||||
const headers = (0, NetworkUtils_js_1.bidiNetworkHeadersFromCdpNetworkHeaders)(this.#response.info.headers);
|
||||
return {
|
||||
method: protocol_js_1.ChromiumBidi.Network.EventNames.ResponseCompleted,
|
||||
params: {
|
||||
...this.#getBaseEventParams(),
|
||||
response: {
|
||||
url: this.#response.info.url ?? NetworkRequest.#unknown,
|
||||
protocol: this.#response.info.protocol ?? '',
|
||||
status: this.statusCode,
|
||||
statusText: this.#response.info.statusText,
|
||||
fromCache: this.#response.info.fromDiskCache ||
|
||||
this.#response.info.fromPrefetchCache ||
|
||||
this.#servedFromCache,
|
||||
headers,
|
||||
mimeType: this.#response.info.mimeType,
|
||||
bytesReceived: this.#response.info.encodedDataLength,
|
||||
headersSize: (0, NetworkUtils_js_1.computeHeadersSize)(headers),
|
||||
// TODO: consider removing from spec.
|
||||
bodySize: 0,
|
||||
content: {
|
||||
// TODO: consider removing from spec.
|
||||
size: 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
#isIgnoredEvent() {
|
||||
return this.#request.info?.request.url.endsWith('/favicon.ico') ?? false;
|
||||
}
|
||||
static #getInitiatorType(initiatorType) {
|
||||
switch (initiatorType) {
|
||||
case 'parser':
|
||||
case 'script':
|
||||
case 'preflight':
|
||||
return initiatorType;
|
||||
default:
|
||||
return 'other';
|
||||
}
|
||||
}
|
||||
static #getCookies(associatedCookies) {
|
||||
return associatedCookies
|
||||
.filter(({ blockedReasons }) => {
|
||||
return !Array.isArray(blockedReasons) || blockedReasons.length === 0;
|
||||
})
|
||||
.map(({ cookie }) => (0, NetworkUtils_js_1.cdpToBiDiCookie)(cookie));
|
||||
}
|
||||
}
|
||||
exports.NetworkRequest = NetworkRequest;
|
||||
//# sourceMappingURL=NetworkRequest.js.map
|
||||
File diff suppressed because one or more lines are too long
@ -1,84 +0,0 @@
|
||||
/**
|
||||
* Copyright 2023 Google LLC.
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import type { Protocol } from 'devtools-protocol';
|
||||
import { Network } from '../../../protocol/protocol.js';
|
||||
import type { NetworkRequest } from './NetworkRequest.js';
|
||||
interface NetworkInterception {
|
||||
urlPatterns: Network.UrlPattern[];
|
||||
phases: Network.AddInterceptParameters['phases'];
|
||||
}
|
||||
export interface BlockedRequest {
|
||||
request: Protocol.Fetch.RequestId;
|
||||
phase: Network.InterceptPhase;
|
||||
response: Network.ResponseData;
|
||||
}
|
||||
/** Stores network and intercept maps. */
|
||||
export declare class NetworkStorage {
|
||||
#private;
|
||||
disposeRequestMap(): void;
|
||||
/**
|
||||
* Adds the given entry to the intercept map.
|
||||
* URL patterns are assumed to be parsed.
|
||||
*
|
||||
* @return The intercept ID.
|
||||
*/
|
||||
addIntercept(value: NetworkInterception): Network.Intercept;
|
||||
/**
|
||||
* Removes the given intercept from the intercept map.
|
||||
* Throws NoSuchInterceptException if the intercept does not exist.
|
||||
*/
|
||||
removeIntercept(intercept: Network.Intercept): void;
|
||||
/** Returns true if there's at least one added intercept. */
|
||||
hasIntercepts(): boolean;
|
||||
/** Gets parameters for CDP 'Fetch.enable' command from the intercept map. */
|
||||
getFetchEnableParams(): Protocol.Fetch.EnableRequest;
|
||||
getRequest(id: Network.Request): NetworkRequest | undefined;
|
||||
addRequest(request: NetworkRequest): void;
|
||||
deleteRequest(id: Network.Request): void;
|
||||
/** Returns true if there's at least one network request. */
|
||||
hasNetworkRequests(): boolean;
|
||||
/** Returns true if there's at least one blocked network request. */
|
||||
hasBlockedRequests(): boolean;
|
||||
/** Converts a URL pattern from the spec to a CDP URL pattern. */
|
||||
static cdpFromSpecUrlPattern(urlPattern: Network.UrlPattern): string;
|
||||
static buildUrlPatternString({ protocol, hostname, port, pathname, search, }: Network.UrlPatternPattern): string;
|
||||
/**
|
||||
* Maps spec Network.InterceptPhase to CDP Fetch.RequestStage.
|
||||
* AuthRequired has no CDP equivalent..
|
||||
*/
|
||||
static requestStageFromPhase(phase: Network.InterceptPhase): Protocol.Fetch.RequestStage;
|
||||
/**
|
||||
* Returns true if the given protocol is special.
|
||||
* Special protocols are those that have a default port.
|
||||
*
|
||||
* Example inputs: 'http', 'http:'
|
||||
*
|
||||
* @see https://url.spec.whatwg.org/#special-scheme
|
||||
*/
|
||||
static isSpecialScheme(protocol: string): boolean;
|
||||
addBlockedRequest(requestId: Network.Request, value: BlockedRequest): void;
|
||||
removeBlockedRequest(requestId: Network.Request): void;
|
||||
/**
|
||||
* Returns the blocked request associated with the given network ID, if any.
|
||||
*/
|
||||
getBlockedRequest(networkId: Network.Request): BlockedRequest | undefined;
|
||||
/** #@see https://w3c.github.io/webdriver-bidi/#get-the-network-intercepts */
|
||||
getNetworkIntercepts(requestId: Network.Request, phase?: Network.InterceptPhase): Network.Intercept[];
|
||||
/** Matches the given URLPattern against the given URL. */
|
||||
static matchUrlPattern(urlPattern: Network.UrlPattern, url: string | undefined): boolean;
|
||||
}
|
||||
export {};
|
||||
217
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/domains/network/NetworkStorage.js
generated
vendored
217
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/domains/network/NetworkStorage.js
generated
vendored
@ -1,217 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.NetworkStorage = void 0;
|
||||
const protocol_js_1 = require("../../../protocol/protocol.js");
|
||||
const UrlPattern_js_1 = require("../../../utils/UrlPattern.js");
|
||||
const uuid_js_1 = require("../../../utils/uuid.js");
|
||||
/** Stores network and intercept maps. */
|
||||
class NetworkStorage {
|
||||
/**
|
||||
* A map from network request ID to Network Request objects.
|
||||
* Needed as long as information about requests comes from different events.
|
||||
*/
|
||||
#requestMap = new Map();
|
||||
/** A map from intercept ID to track active network intercepts. */
|
||||
#interceptMap = new Map();
|
||||
/** A map from network request ID to track actively blocked requests. */
|
||||
#blockedRequestMap = new Map();
|
||||
disposeRequestMap() {
|
||||
for (const request of this.#requestMap.values()) {
|
||||
request.dispose();
|
||||
}
|
||||
this.#requestMap.clear();
|
||||
}
|
||||
/**
|
||||
* Adds the given entry to the intercept map.
|
||||
* URL patterns are assumed to be parsed.
|
||||
*
|
||||
* @return The intercept ID.
|
||||
*/
|
||||
addIntercept(value) {
|
||||
const interceptId = (0, uuid_js_1.uuidv4)();
|
||||
this.#interceptMap.set(interceptId, value);
|
||||
return interceptId;
|
||||
}
|
||||
/**
|
||||
* Removes the given intercept from the intercept map.
|
||||
* Throws NoSuchInterceptException if the intercept does not exist.
|
||||
*/
|
||||
removeIntercept(intercept) {
|
||||
if (!this.#interceptMap.has(intercept)) {
|
||||
throw new protocol_js_1.NoSuchInterceptException(`Intercept '${intercept}' does not exist.`);
|
||||
}
|
||||
this.#interceptMap.delete(intercept);
|
||||
}
|
||||
/** Returns true if there's at least one added intercept. */
|
||||
hasIntercepts() {
|
||||
return this.#interceptMap.size > 0;
|
||||
}
|
||||
/** Gets parameters for CDP 'Fetch.enable' command from the intercept map. */
|
||||
getFetchEnableParams() {
|
||||
const patterns = [];
|
||||
for (const value of this.#interceptMap.values()) {
|
||||
for (const phase of value.phases) {
|
||||
const requestStage = NetworkStorage.requestStageFromPhase(phase);
|
||||
if (value.urlPatterns.length === 0) {
|
||||
patterns.push({
|
||||
urlPattern: '*',
|
||||
requestStage,
|
||||
});
|
||||
continue;
|
||||
}
|
||||
for (const urlPatternSpec of value.urlPatterns) {
|
||||
const urlPattern = NetworkStorage.cdpFromSpecUrlPattern(urlPatternSpec);
|
||||
patterns.push({
|
||||
urlPattern,
|
||||
requestStage,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
return {
|
||||
patterns,
|
||||
// If there's at least one intercept that requires auth, enable the
|
||||
// 'Fetch.authRequired' event.
|
||||
handleAuthRequests: [...this.#interceptMap.values()].some((param) => {
|
||||
return param.phases.includes("authRequired" /* Network.InterceptPhase.AuthRequired */);
|
||||
}),
|
||||
};
|
||||
}
|
||||
getRequest(id) {
|
||||
return this.#requestMap.get(id);
|
||||
}
|
||||
addRequest(request) {
|
||||
this.#requestMap.set(request.requestId, request);
|
||||
}
|
||||
deleteRequest(id) {
|
||||
const request = this.#requestMap.get(id);
|
||||
if (request) {
|
||||
request.dispose();
|
||||
this.#requestMap.delete(id);
|
||||
}
|
||||
}
|
||||
/** Returns true if there's at least one network request. */
|
||||
hasNetworkRequests() {
|
||||
return this.#requestMap.size > 0;
|
||||
}
|
||||
/** Returns true if there's at least one blocked network request. */
|
||||
hasBlockedRequests() {
|
||||
return this.#blockedRequestMap.size > 0;
|
||||
}
|
||||
/** Converts a URL pattern from the spec to a CDP URL pattern. */
|
||||
static cdpFromSpecUrlPattern(urlPattern) {
|
||||
switch (urlPattern.type) {
|
||||
case 'string':
|
||||
return urlPattern.pattern;
|
||||
case 'pattern':
|
||||
return NetworkStorage.buildUrlPatternString(urlPattern);
|
||||
}
|
||||
}
|
||||
static buildUrlPatternString({ protocol, hostname, port, pathname, search, }) {
|
||||
if (!protocol && !hostname && !port && !pathname && !search) {
|
||||
return '*';
|
||||
}
|
||||
let url = '';
|
||||
if (protocol) {
|
||||
url += protocol;
|
||||
if (!protocol.endsWith(':')) {
|
||||
url += ':';
|
||||
}
|
||||
if (NetworkStorage.isSpecialScheme(protocol)) {
|
||||
url += '//';
|
||||
}
|
||||
}
|
||||
if (hostname) {
|
||||
url += hostname;
|
||||
}
|
||||
if (port) {
|
||||
url += `:${port}`;
|
||||
}
|
||||
if (pathname) {
|
||||
if (!pathname.startsWith('/')) {
|
||||
url += '/';
|
||||
}
|
||||
url += pathname;
|
||||
}
|
||||
if (search) {
|
||||
if (!search.startsWith('?')) {
|
||||
url += '?';
|
||||
}
|
||||
url += search;
|
||||
}
|
||||
return url;
|
||||
}
|
||||
/**
|
||||
* Maps spec Network.InterceptPhase to CDP Fetch.RequestStage.
|
||||
* AuthRequired has no CDP equivalent..
|
||||
*/
|
||||
static requestStageFromPhase(phase) {
|
||||
switch (phase) {
|
||||
case "beforeRequestSent" /* Network.InterceptPhase.BeforeRequestSent */:
|
||||
return 'Request';
|
||||
case "responseStarted" /* Network.InterceptPhase.ResponseStarted */:
|
||||
case "authRequired" /* Network.InterceptPhase.AuthRequired */:
|
||||
return 'Response';
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Returns true if the given protocol is special.
|
||||
* Special protocols are those that have a default port.
|
||||
*
|
||||
* Example inputs: 'http', 'http:'
|
||||
*
|
||||
* @see https://url.spec.whatwg.org/#special-scheme
|
||||
*/
|
||||
static isSpecialScheme(protocol) {
|
||||
return ['ftp', 'file', 'http', 'https', 'ws', 'wss'].includes(protocol.replace(/:$/, ''));
|
||||
}
|
||||
addBlockedRequest(requestId, value) {
|
||||
this.#blockedRequestMap.set(requestId, value);
|
||||
}
|
||||
removeBlockedRequest(requestId) {
|
||||
this.#blockedRequestMap.delete(requestId);
|
||||
}
|
||||
/**
|
||||
* Returns the blocked request associated with the given network ID, if any.
|
||||
*/
|
||||
getBlockedRequest(networkId) {
|
||||
return this.#blockedRequestMap.get(networkId);
|
||||
}
|
||||
/** #@see https://w3c.github.io/webdriver-bidi/#get-the-network-intercepts */
|
||||
getNetworkIntercepts(requestId, phase) {
|
||||
const request = this.#requestMap.get(requestId);
|
||||
if (!request) {
|
||||
return [];
|
||||
}
|
||||
const interceptIds = [];
|
||||
for (const [interceptId, { phases, urlPatterns },] of this.#interceptMap.entries()) {
|
||||
if (phase && phases.includes(phase)) {
|
||||
if (urlPatterns.length === 0) {
|
||||
interceptIds.push(interceptId);
|
||||
}
|
||||
else if (urlPatterns.some((urlPattern) => NetworkStorage.matchUrlPattern(urlPattern, request.url))) {
|
||||
interceptIds.push(interceptId);
|
||||
}
|
||||
}
|
||||
}
|
||||
return interceptIds;
|
||||
}
|
||||
/** Matches the given URLPattern against the given URL. */
|
||||
static matchUrlPattern(urlPattern, url) {
|
||||
switch (urlPattern.type) {
|
||||
case 'string':
|
||||
return urlPattern.pattern === url;
|
||||
case 'pattern': {
|
||||
return (new UrlPattern_js_1.URLPattern({
|
||||
protocol: urlPattern.protocol,
|
||||
hostname: urlPattern.hostname,
|
||||
port: urlPattern.port,
|
||||
pathname: urlPattern.pathname,
|
||||
search: urlPattern.search,
|
||||
}).exec(url) !== null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.NetworkStorage = NetworkStorage;
|
||||
//# sourceMappingURL=NetworkStorage.js.map
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1 +0,0 @@
|
||||
{"version":3,"file":"PermissionsProcessor.js","sourceRoot":"","sources":["../../../../../src/bidiMapper/domains/permissions/PermissionsProcessor.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAGH,+DAIuC;AAEvC,MAAa,oBAAoB;IAC/B,iBAAiB,CAAY;IAE7B,YAAY,gBAA2B;QACrC,IAAI,CAAC,iBAAiB,GAAG,gBAAgB,CAAC;IAC5C,CAAC;IAED,KAAK,CAAC,cAAc,CAClB,MAA2C;QAE3C,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,iBAAiB,CAAC,WAAW,CAAC,uBAAuB,EAAE;gBAChE,MAAM,EAAE,MAAM,CAAC,MAAM;gBACrB,UAAU,EAAE;oBACV,IAAI,EAAE,MAAM,CAAC,UAAU,CAAC,IAAI;iBAC7B;gBACD,OAAO,EAAE,MAAM,CAAC,KAAK;aACtB,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IACG,GAAa,CAAC,OAAO;gBACtB,gDAAgD,EAChD,CAAC;gBACD,gEAAgE;gBAChE,qBAAqB;gBACrB,OAAO,EAAE,CAAC;YACZ,CAAC;YACD,MAAM,IAAI,sCAAwB,CAAE,GAAa,CAAC,OAAO,CAAC,CAAC;QAC7D,CAAC;QACD,OAAO,EAAE,CAAC;IACZ,CAAC;CACF;AA/BD,oDA+BC"}
|
||||
@ -1 +0,0 @@
|
||||
{"version":3,"file":"DedicatedWorkerRealm.js","sourceRoot":"","sources":["../../../../../src/bidiMapper/domains/script/DedicatedWorkerRealm.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAUH,yCAAiC;AAGjC,MAAa,oBAAqB,SAAQ,gBAAK;IACpC,WAAW,CAAQ;IAE5B,YACE,SAAoB,EACpB,YAA0B,EAC1B,kBAAuD,EACvD,MAA4B,EAC5B,MAAc,EACd,UAAiB,EACjB,OAAqB,EACrB,YAA0B;QAE1B,KAAK,CACH,SAAS,EACT,YAAY,EACZ,kBAAkB,EAClB,MAAM,EACN,MAAM,EACN,OAAO,EACP,YAAY,CACb,CAAC;QAEF,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;QAE9B,IAAI,CAAC,UAAU,EAAE,CAAC;IACpB,CAAC;IAED,IAAa,0BAA0B;QACrC,OAAO,IAAI,CAAC,WAAW,CAAC,0BAA0B,CAAC;IACrD,CAAC;IAED,IAAa,SAAS;QACpB,OAAO,kBAAkB,CAAC;IAC5B,CAAC;IAED,IAAa,MAAM;QACjB,OAAO;YACL,KAAK,EAAE,IAAI,CAAC,OAAO;YACnB,0DAA0D;YAC1D,kFAAkF;YAClF,OAAO,EAAE,IAAI,CAAC,0BAA0B,CAAC,CAAC,CAAC,EAAE,EAAE;SAChD,CAAC;IACJ,CAAC;IAED,IAAa,SAAS;QACpB,OAAO;YACL,GAAG,IAAI,CAAC,QAAQ;YAChB,IAAI,EAAE,IAAI,CAAC,SAAS;YACpB,MAAM,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC;SACnC,CAAC;IACJ,CAAC;CACF;AApDD,oDAoDC"}
|
||||
@ -1 +0,0 @@
|
||||
{"version":3,"file":"PreloadScriptStorage.js","sourceRoot":"","sources":["../../../../../src/bidiMapper/domains/script/PreloadScriptStorage.ts"],"names":[],"mappings":";;;AA2BA;;GAEG;AACH,MAAa,oBAAoB;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CAAC;IACH,CAAC;CACF;AA3CD,oDA2CC"}
|
||||
1
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/domains/script/Realm.js.map
generated
vendored
1
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/domains/script/Realm.js.map
generated
vendored
File diff suppressed because one or more lines are too long
@ -1 +0,0 @@
|
||||
{"version":3,"file":"ScriptProcessor.js","sourceRoot":"","sources":["../../../../../src/bidiMapper/domains/script/ScriptProcessor.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH,yDAKoC;AAMpC,mDAA8C;AAK9C,MAAa,eAAe;IACjB,uBAAuB,CAAyB;IAChD,aAAa,CAAe;IAC5B,qBAAqB,CAAC;IACtB,OAAO,CAAY;IAE5B,YACE,sBAA8C,EAC9C,YAA0B,EAC1B,oBAA0C,EAC1C,MAAiB;QAEjB,IAAI,CAAC,uBAAuB,GAAG,sBAAsB,CAAC;QACtD,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;QAClC,IAAI,CAAC,qBAAqB,GAAG,oBAAoB,CAAC;QAClD,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED,KAAK,CAAC,gBAAgB,CACpB,MAAyC;QAEzC,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAuB,CAAC;QAChD,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;YACpB,+EAA+E;YAC/E,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACjC,MAAM,IAAI,mCAAwB,CAAC,yBAAyB,CAAC,CAAC;YAChE,CAAC;YAED,KAAK,MAAM,SAAS,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;gBACxC,MAAM,OAAO,GAAG,IAAI,CAAC,uBAAuB,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;gBACnE,IAAI,OAAO,CAAC,iBAAiB,EAAE,EAAE,CAAC;oBAChC,QAAQ,CAAC,GAAG,CA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C,CAAC,CACjE,CAAC;QACF,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,SAAS,CAAC,MAAkC;QAC1C,IAAI,MAAM,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;YACjC,kCAAkC;YAClC,IAAI,CAAC,uBAAuB,CAAC,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC1D,CAAC;QACD,MAAM,MAAM,GAAG,IAAI,CAAC,aAAa;aAC9B,UAAU,CAAC;YACV,iBAAiB,EAAE,MAAM,CAAC,OAAO;YACjC,IAAI,EAAE,MAAM,CAAC,IAAI;SAClB,CAAC;aACD,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QACnC,OAAO,EAAC,MAAM,EAAC,CAAC;IAClB,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,MAAqB;QACnC,IAAI,OAAO,IAAI,MAAM,EAAE,CAAC;YACtB,OAAO,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC;gBACjC,OAAO,EAAE,MAAM,CAAC,KAAK;aACtB,CAAC,CAAC;QACL,CAAC;QACD,MAAM,OAAO,GAAG,IAAI,CAAC,uBAAuB,CAAC,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACxE,OAAO,MAAM,OAAO,CAAC,kBAAkB,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC1D,CAAC;CACF;AAlJD,0CAkJC"}
|
||||
1
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/domains/script/SharedId.js.map
generated
vendored
1
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/domains/script/SharedId.js.map
generated
vendored
@ -1 +0,0 @@
|
||||
{"version":3,"file":"SharedId.js","sourceRoot":"","sources":["../../../../../src/bidiMapper/domains/script/SharedId.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH,MAAM,iBAAiB,GAAG,WAAW,CAAC;AAEtC,SAAgB,W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AAI,CAAC,KAAK,EAAE,CAAC;QACX,qCAAqC;QACrC,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IACzB,MAAM,UAAU,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IAC5B,MAAM,SAAS,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IAE3B,IACE,OAAO,KAAK,SAAS;QACrB,UAAU,KAAK,SAAS;QACxB,SAAS,KAAK,SAAS,EACvB,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,aAAa,GAAG,QAAQ,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC;IAChD,IAAI,KAAK,CAAC,aAAa,CAAC,EAAE,CAAC;QACzB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO;QACL,OAAO;QACP,UAAU;QACV,aAAa;KACd,CAAC;AACJ,CAAC;AAxCD,sCAwCC"}
|
||||
@ -1 +0,0 @@
|
||||
{"version":3,"file":"WindowRealm.js","sourceRoot":"","sources":["../../../../../src/bidiMapper/domains/script/WindowRealm.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAKH,+DAKuC;AAOvC,yCAAiC;AAEjC,+CAAyD;AAEzD,MAAa,WAAY,SAAQ,gBAAK;IAC3B,kBAAkB,CAAkC;IACpD,uBAAuB,CAAyB;IAChD,kBAAkB,CAAU;IAC5B,OAAO,CAAqB;IAErC,YACE,iBAAkD,EAClD,sBAA8C,EAC9C,SAAoB,EACpB,YAA0B,EAC1B,kBAAuD,EACvD,MAA4B,EAC5B,MAAc,EACd,OAAqB,EACrB,YAA0B,EAC1B,OAA2B,EAC3B,iBAA0B;QAE1B,KAAK,CACH,SAAS,EACT,YAAY,EACZ,kBAAkB,EAClB,MAAM,EACN,MAAM,EACN,OAAO,EACP,YAAY,CACb,CAAC;QAEF,IAAI,CAAC,kBAAkB,GAAG,iBAAiB,CAAC;QAC5C,IAAI,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QACD,OAAO,MAAM,KAAK,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;IACnD,CAAC;IAEQ,KAAK,CAAC,QAAQ,CACrB,UAAkB,EAClB,YAAqB,EACrB,eAAuC,EACvC,oBAAiD,EACjD,cAAwB;QAExB,MAAM,IAAI,CAAC,uBAAuB;aAC/B,UAAU,CAAC,IAAI,CAAC,kBAAkB,CAAC;aACnC,sBAAsB,EAAE,CAAC;QAE5B,OAAO,MAAM,KAAK,CAAC,QAAQ,CACzB,UAAU,EACV,YAAY,EACZ,eAAe,EACf,oBAAoB,EACpB,cAAc,CACf,CAAC;IACJ,CAAC;IAEQ,KAAK,CAAC,YAAY,CACzB,mBAA2B,EAC3B,cAAiC,EACjC,oBAAyC,EACzC,YAAqB,EACrB,eAAuC,EACvC,oBAAiD,EACjD,cAAwB;QAExB,MAAM,IAAI,CAAC,uBAAuB;aAC/B,UAAU,CAAC,IAAI,CAAC,kBAAkB,CAAC;aACnC,sBAAsB,EAAE,CAAC;QAE5B,OAAO,MAAM,KAAK,CAAC,YAAY,CAC7B,mBAAmB,EACnB,cAAc,EACd,oBAAoB,EACpB,YAAY,EACZ,eAAe,EACf,oBAAoB,EACpB,cAAc,CACf,CAAC;IACJ,CAAC;CACF;AA9MD,kCA8MC"}
|
||||
File diff suppressed because one or more lines are too long
@ -1 +0,0 @@
|
||||
{"version":3,"file":"SessionProcessor.js","sourceRoot":"","sources":["../../../../../src/bidiMapper/domains/session/SessionProcessor.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAWH,MAAa,gBAAgB;IAC3B,aAAa,CAAe;IAE5B,YAAY,YAA0B;QACpC,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;IACpC,CAAC;IAED,MAAM;QACJ,OAAO,EAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,mBAAmB,EAAC,CAAC;IACtD,CAAC;IAED,SAAS,CACP,MAAmC,EACnC,UAA2B,IAAI;QAE/B,IAAI,CAAC,aAAa,CAAC,SAAS,CAC1B,MAAM,CAAC,MAAmC,EAC1C,MAAM,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,EACzB,OAAO,CACR,CAAC;QACF,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,WAAW,CACT,MAAmC,EACnC,UAA2B,IAAI;QAE/B,IAAI,CAAC,aAAa,CAAC,WAAW,CAC5B,MAAM,CAAC,MAAmC,EAC1C,MAAM,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,EACzB,OAAO,CACR,CAAC;QACF,OAAO,EAAE,CAAC;IACZ,CAAC;CACF;AAlCD,4CAkCC"}
|
||||
File diff suppressed because one or more lines are too long
1
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/domains/session/events.js.map
generated
vendored
1
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/domains/session/events.js.map
generated
vendored
@ -1 +0,0 @@
|
||||
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../../../../src/bidiMapper/domains/session/events.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;GAeG;AACH,+DAGuC;AAEvC;;;GAGG;AACH,SAAgB,UAAU,CAAC,IAAY;IACrC,OAAO,CACL,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,0BAAY,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,KAAK,CACxE,CAAC;AACJ,CAAC;AAJD,gCAIC;AAED;;GAEG;AACH,SAAgB,oBAAoB,CAClC,IAAY;IAEZ,IAAI,CAAC,0BAAY,CAAC,WAAW,CAAC,GAAG,CAAC,IAAa,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACtE,MAAM,IAAI,sCAAwB,CAAC,kBAAkB,IAAI,EAAE,CAAC,CAAC;IAC/D,CAAC;AACH,CAAC;AAND,oDAMC"}
|
||||
@ -1 +0,0 @@
|
||||
{"version":3,"file":"StorageProc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AM,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC;YAChE,CAAC,MAAM,CAAC,QAAQ,KAAK,SAAS,IAAI,MAAM,CAAC,QAAQ,KAAK,MAAM,CAAC,QAAQ,CAAC;YACtE,CAAC,MAAM,CAAC,MAAM,KAAK,SAAS,IAAI,MAAM,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,CACjE,CAAC;IACJ,CAAC;CACF;AAlKD,4CAkKC"}
|
||||
@ -20,7 +20,7 @@ export declare class BrowserProcessor {
|
||||
#private;
|
||||
constructor(browserCdpClient: CdpClient);
|
||||
close(): EmptyResult;
|
||||
createUserContext(): Promise<Browser.CreateUserContextResult>;
|
||||
removeUserContext(userContext: Browser.UserContext): Promise<EmptyResult>;
|
||||
createUserContext(params: Record<string, any>): Promise<Browser.CreateUserContextResult>;
|
||||
removeUserContext(params: Browser.RemoveUserContextParameters): Promise<EmptyResult>;
|
||||
getUserContexts(): Promise<Browser.GetUserContextsResult>;
|
||||
}
|
||||
@ -29,13 +29,21 @@ class BrowserProcessor {
|
||||
setTimeout(() => this.#browserCdpClient.sendCommand('Browser.close'), 0);
|
||||
return {};
|
||||
}
|
||||
async createUserContext() {
|
||||
const context = await this.#browserCdpClient.sendCommand('Target.createBrowserContext');
|
||||
async createUserContext(params) {
|
||||
const request = {
|
||||
proxyServer: params['goog:proxyServer'] ?? undefined,
|
||||
};
|
||||
const proxyBypassList = params['goog:proxyBypassList'] ?? undefined;
|
||||
if (proxyBypassList) {
|
||||
request.proxyBypassList = proxyBypassList.join(',');
|
||||
}
|
||||
const context = await this.#browserCdpClient.sendCommand('Target.createBrowserContext', request);
|
||||
return {
|
||||
userContext: context.browserContextId,
|
||||
};
|
||||
}
|
||||
async removeUserContext(userContext) {
|
||||
async removeUserContext(params) {
|
||||
const userContext = params.userContext;
|
||||
if (userContext === 'default') {
|
||||
throw new protocol_js_1.InvalidArgumentException('`default` user context cannot be removed');
|
||||
}
|
||||
1
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/modules/browser/BrowserProcessor.js.map
generated
vendored
Normal file
1
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/modules/browser/BrowserProcessor.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"BrowserProcessor.js","sourceRoot":"","sources":["../../../../../src/bidiMapper/modules/browser/BrowserProcessor.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAIH,+DAKuC;AAGvC,MAAa,gBAAgB;IAClB,iBAAiB,CAAY;IAEtC,YAAY,gBAA2B;QACrC,IAAI,CAAC,iBAAiB,GAAG,gBAAgB,CAAC;IAC5C,CAAC;IAED,KAAK;QACH,sDAAsD;QACtD,6DAA6D;QAC7D,UAAU,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC,WAAW,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC,CAAC;QAEzE,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,KAAK,CAAC,iBAAiB,CACrB,MAA2B;QAE3B,MAAM,OAAO,GAAgD;YAC3D,WAAW,EAAE,MAAM,CAAC,kBAAkB,CAAC,IAAI,SAAS;SACrD,CAAC;QACF,MAAM,eAAe,GACnB,MAAM,CAAC,sBAAsB,CAAC,IAAI,SAAS,CAAC;QAC9C,IAAI,eAAe,EAAE,CAAC;YACpB,OAAO,CAAC,eAAe,GAAG,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACtD,CAAC;QACD,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,iBAAiB,CAAC,WAAW,CACtD,6BAA6B,EAC7B,OAAO,CACR,CAAC;QACF,OAAO;YACL,WAAW,EAAE,OAAO,CAAC,gBAAgB;SACtC,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,iBAAiB,CACrB,MAA2C;QAE3C,MAAM,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC;QACvC,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;YAC9B,MAAM,IAAI,sCAAwB,CAChC,0CAA0C,CAC3C,CAAC;QACJ,CAAC;QACD,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,iBAAiB,CAAC,WAAW,CAAC,8BAA8B,EAAE;gBACvE,gBAAgB,EAAE,WAAW;aAC9B,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,mKAAmK;YACnK,IAAK,GAAa,CAAC,OAAO,CAAC,UAAU,CAAC,gCAAgC,CAAC,EAAE,CAAC;gBACxE,MAAM,IAAI,wCAA0B,CAAE,GAAa,CAAC,OAAO,CAAC,CAAC;YAC/D,CAAC;YACD,MAAM,GAAG,CAAC;QACZ,CAAC;QACD,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,KAAK,CAAC,eAAe;QACnB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,iBAAiB,CAAC,WAAW,CACrD,2BAA2B,CAC5B,CAAC;QACF,OAAO;YACL,YAAY,EAAE;gBACZ;oBACE,WAAW,EAAE,SAAS;iBACvB;gBACD,GAAG,MAAM,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE;oBACrC,OAAO;wBACL,WAAW,EAAE,EAAE;qBAChB,CAAC;gBACJ,CAAC,CAAC;aACH;SACF,CAAC;IACJ,CAAC;CACF;AA3ED,4CA2EC"}
|
||||
@ -14,12 +14,14 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import type { Cdp } from '../../../protocol/protocol.js';
|
||||
import { type Cdp } from '../../../protocol/protocol.js';
|
||||
import type { CdpClient, CdpConnection } from '../../BidiMapper.js';
|
||||
import type { BrowsingContextStorage } from '../context/BrowsingContextStorage.js';
|
||||
import type { RealmStorage } from '../script/RealmStorage.js';
|
||||
export declare class CdpProcessor {
|
||||
#private;
|
||||
constructor(browsingContextStorage: BrowsingContextStorage, cdpConnection: CdpConnection, browserCdpClient: CdpClient);
|
||||
constructor(browsingContextStorage: BrowsingContextStorage, realmStorage: RealmStorage, cdpConnection: CdpConnection, browserCdpClient: CdpClient);
|
||||
getSession(params: Cdp.GetSessionParameters): Cdp.GetSessionResult;
|
||||
resolveRealm(params: Cdp.ResolveRealmParameters): Cdp.ResolveRealmResult;
|
||||
sendCommand(params: Cdp.SendCommandParameters): Promise<Cdp.SendCommandResult>;
|
||||
}
|
||||
@ -17,12 +17,15 @@
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CdpProcessor = void 0;
|
||||
const protocol_js_1 = require("../../../protocol/protocol.js");
|
||||
class CdpProcessor {
|
||||
#browsingContextStorage;
|
||||
#realmStorage;
|
||||
#cdpConnection;
|
||||
#browserCdpClient;
|
||||
constructor(browsingContextStorage, cdpConnection, browserCdpClient) {
|
||||
constructor(browsingContextStorage, realmStorage, cdpConnection, browserCdpClient) {
|
||||
this.#browsingContextStorage = browsingContextStorage;
|
||||
this.#realmStorage = realmStorage;
|
||||
this.#cdpConnection = cdpConnection;
|
||||
this.#browserCdpClient = browserCdpClient;
|
||||
}
|
||||
@ -34,6 +37,14 @@ class CdpProcessor {
|
||||
}
|
||||
return { session: sessionId };
|
||||
}
|
||||
resolveRealm(params) {
|
||||
const context = params.realm;
|
||||
const realm = this.#realmStorage.getRealm({ realmId: context });
|
||||
if (realm === undefined) {
|
||||
throw new protocol_js_1.UnknownErrorException(`Could not find realm ${params.realm}`);
|
||||
}
|
||||
return { executionContextId: realm.executionContextId };
|
||||
}
|
||||
async sendCommand(params) {
|
||||
const client = params.session
|
||||
? this.#cdpConnection.getCdpClient(params.session)
|
||||
1
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/modules/cdp/CdpProcessor.js.map
generated
vendored
Normal file
1
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/modules/cdp/CdpProcessor.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"CdpProcessor.js","sourceRoot":"","sources":["../../../../../src/bidi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B,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC;YAClD,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC;QAC3B,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;QACtE,OAAO;YACL,MAAM;YACN,OAAO,EAAE,MAAM,CAAC,OAAO;SACxB,CAAC;IACJ,CAAC;CACF;AAjDD,oCAiDC"}
|
||||
@ -1,8 +1,10 @@
|
||||
import type { Protocol } from 'devtools-protocol';
|
||||
import type { CdpClient } from '../../../cdp/CdpClient.js';
|
||||
import type { ChromiumBidi, Session } from '../../../protocol/protocol.js';
|
||||
import { Deferred } from '../../../utils/Deferred.js';
|
||||
import type { LoggerFn } from '../../../utils/log.js';
|
||||
import type { Result } from '../../../utils/result.js';
|
||||
import type { BrowsingContextStorage } from '../context/BrowsingContextStorage.js';
|
||||
import type { NetworkStorage } from '../network/NetworkStorage.js';
|
||||
import type { ChannelProxy } from '../script/ChannelProxy.js';
|
||||
import type { PreloadScriptStorage } from '../script/PreloadScriptStorage.js';
|
||||
@ -10,8 +12,8 @@ import type { RealmStorage } from '../script/RealmStorage.js';
|
||||
import type { EventManager } from '../session/EventManager.js';
|
||||
export declare class CdpTarget {
|
||||
#private;
|
||||
static create(targetId: Protocol.Target.TargetID, cdpClient: CdpClient, browserCdpClient: CdpClient, realmStorage: RealmStorage, eventManager: EventManager, preloadScriptStorage: PreloadScriptStorage, networkStorage: NetworkStorage, acceptInsecureCerts: boolean, logger?: LoggerFn): CdpTarget;
|
||||
constructor(targetId: Protocol.Target.TargetID, cdpClient: CdpClient, browserCdpClient: CdpClient, eventManager: EventManager, preloadScriptStorage: PreloadScriptStorage, networkStorage: NetworkStorage, acceptInsecureCerts: boolean);
|
||||
static create(targetId: Protocol.Target.TargetID, cdpClient: CdpClient, browserCdpClient: CdpClient, realmStorage: RealmStorage, eventManager: EventManager, preloadScriptStorage: PreloadScriptStorage, browsingContextStorage: BrowsingContextStorage, networkStorage: NetworkStorage, unhandledPromptBehavior?: Session.UserPromptHandler, logger?: LoggerFn): CdpTarget;
|
||||
constructor(targetId: Protocol.Target.TargetID, cdpClient: CdpClient, browserCdpClient: CdpClient, eventManager: EventManager, realmStorage: RealmStorage, preloadScriptStorage: PreloadScriptStorage, browsingContextStorage: BrowsingContextStorage, networkStorage: NetworkStorage, unhandledPromptBehavior?: Session.UserPromptHandler, logger?: LoggerFn);
|
||||
/** Returns a deferred that resolves when the target is unblocked. */
|
||||
get unblocked(): Deferred<Result<void>>;
|
||||
get id(): Protocol.Target.TargetID;
|
||||
@ -19,13 +21,16 @@ export declare class CdpTarget {
|
||||
get browserCdpClient(): CdpClient;
|
||||
/** Needed for CDP escape path. */
|
||||
get cdpSessionId(): Protocol.Target.SessionID;
|
||||
/** Calls `Fetch.enable` with the added network intercepts. */
|
||||
fetchEnable(): Promise<void>;
|
||||
/** Calls `Fetch.disable`. */
|
||||
fetchDisable(): Promise<void>;
|
||||
toggleFetchIfNeeded(): Promise<void>;
|
||||
/**
|
||||
* Toggles both Network and Fetch domains.
|
||||
*/
|
||||
toggleNetworkIfNeeded(): Promise<void>;
|
||||
/**
|
||||
* All the ProxyChannels from all the preload scripts of the given
|
||||
* BrowsingContext.
|
||||
*/
|
||||
getChannels(): ChannelProxy[];
|
||||
get topLevelId(): string;
|
||||
isSubscribedTo(moduleOrEvent: ChromiumBidi.EventNames): boolean;
|
||||
}
|
||||
236
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/modules/cdp/CdpTarget.js
generated
vendored
Normal file
236
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/modules/cdp/CdpTarget.js
generated
vendored
Normal file
@ -0,0 +1,236 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CdpTarget = void 0;
|
||||
const chromium_bidi_js_1 = require("../../../protocol/chromium-bidi.js");
|
||||
const Deferred_js_1 = require("../../../utils/Deferred.js");
|
||||
const log_js_1 = require("../../../utils/log.js");
|
||||
const BrowsingContextImpl_js_1 = require("../context/BrowsingContextImpl.js");
|
||||
const LogManager_js_1 = require("../log/LogManager.js");
|
||||
class CdpTarget {
|
||||
#id;
|
||||
#cdpClient;
|
||||
#browserCdpClient;
|
||||
#realmStorage;
|
||||
#eventManager;
|
||||
#preloadScriptStorage;
|
||||
#browsingContextStorage;
|
||||
#networkStorage;
|
||||
#unblocked = new Deferred_js_1.Deferred();
|
||||
#unhandledPromptBehavior;
|
||||
#logger;
|
||||
#networkDomainEnabled = false;
|
||||
#fetchDomainStages = {
|
||||
request: false,
|
||||
response: false,
|
||||
auth: false,
|
||||
};
|
||||
static create(targetId, cdpClient, browserCdpClient, realmStorage, eventManager, preloadScriptStorage, browsingContextStorage, networkStorage, unhandledPromptBehavior, logger) {
|
||||
const cdpTarget = new CdpTarget(targetId, cdpClient, browserCdpClient, eventManager, realmStorage, preloadScriptStorage, browsingContextStorage, networkStorage, unhandledPromptBehavior, logger);
|
||||
LogManager_js_1.LogManager.create(cdpTarget, realmStorage, eventManager, logger);
|
||||
cdpTarget.#setEventListeners();
|
||||
// No need to await.
|
||||
// Deferred will be resolved when the target is unblocked.
|
||||
void cdpTarget.#unblock();
|
||||
return cdpTarget;
|
||||
}
|
||||
constructor(targetId, cdpClient, browserCdpClient, eventManager, realmStorage, preloadScriptStorage, browsingContextStorage, networkStorage, unhandledPromptBehavior, logger) {
|
||||
this.#id = targetId;
|
||||
this.#cdpClient = cdpClient;
|
||||
this.#browserCdpClient = browserCdpClient;
|
||||
this.#eventManager = eventManager;
|
||||
this.#realmStorage = realmStorage;
|
||||
this.#preloadScriptStorage = preloadScriptStorage;
|
||||
this.#networkStorage = networkStorage;
|
||||
this.#browsingContextStorage = browsingContextStorage;
|
||||
this.#unhandledPromptBehavior = unhandledPromptBehavior;
|
||||
this.#logger = logger;
|
||||
}
|
||||
/** Returns a deferred that resolves when the target is unblocked. */
|
||||
get unblocked() {
|
||||
return this.#unblocked;
|
||||
}
|
||||
get id() {
|
||||
return this.#id;
|
||||
}
|
||||
get cdpClient() {
|
||||
return this.#cdpClient;
|
||||
}
|
||||
get browserCdpClient() {
|
||||
return this.#browserCdpClient;
|
||||
}
|
||||
/** Needed for CDP escape path. */
|
||||
get cdpSessionId() {
|
||||
// SAFETY we got the client by it's id for creating
|
||||
return this.#cdpClient.sessionId;
|
||||
}
|
||||
/**
|
||||
* Enables all the required CDP domains and unblocks the target.
|
||||
*/
|
||||
async #unblock() {
|
||||
try {
|
||||
await Promise.all([
|
||||
this.#cdpClient.sendCommand('Page.enable'),
|
||||
// There can be some existing frames in the target, if reconnecting to an
|
||||
// existing browser instance, e.g. via Puppeteer. Need to restore the browsing
|
||||
// contexts for the frames to correctly handle further events, like
|
||||
// `Runtime.executionContextCreated`.
|
||||
// It's important to schedule this task together with enabling domains commands to
|
||||
// prepare the tree before the events (e.g. Runtime.executionContextCreated) start
|
||||
// coming.
|
||||
// https://github.com/GoogleChromeLabs/chromium-bidi/issues/2282
|
||||
this.#cdpClient
|
||||
.sendCommand('Page.getFrameTree')
|
||||
.then((frameTree) => this.#restoreFrameTreeState(frameTree.frameTree)),
|
||||
this.#cdpClient.sendCommand('Runtime.enable'),
|
||||
this.#cdpClient.sendCommand('Page.setLifecycleEventsEnabled', {
|
||||
enabled: true,
|
||||
}),
|
||||
this.toggleNetworkIfNeeded(),
|
||||
this.#cdpClient.sendCommand('Target.setAutoAttach', {
|
||||
autoAttach: true,
|
||||
waitForDebuggerOnStart: true,
|
||||
flatten: true,
|
||||
}),
|
||||
this.#initAndEvaluatePreloadScripts(),
|
||||
this.#cdpClient.sendCommand('Runtime.runIfWaitingForDebugger'),
|
||||
]);
|
||||
}
|
||||
catch (error) {
|
||||
this.#logger?.(log_js_1.LogType.debugError, 'Failed to unblock target', error);
|
||||
// The target might have been closed before the initialization finished.
|
||||
if (!this.#cdpClient.isCloseError(error)) {
|
||||
this.#unblocked.resolve({
|
||||
kind: 'error',
|
||||
error,
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.#unblocked.resolve({
|
||||
kind: 'success',
|
||||
value: undefined,
|
||||
});
|
||||
}
|
||||
#restoreFrameTreeState(frameTree) {
|
||||
const frame = frameTree.frame;
|
||||
const maybeContext = this.#browsingContextStorage.findContext(frame.id);
|
||||
if (maybeContext !== undefined) {
|
||||
// Restoring parent of already known browsing context. This means the target is
|
||||
// OOPiF and the BiDi session was connected to already existing browser instance.
|
||||
if (maybeContext.parentId === null &&
|
||||
frame.parentId !== null &&
|
||||
frame.parentId !== undefined) {
|
||||
maybeContext.parentId = frame.parentId;
|
||||
}
|
||||
}
|
||||
if (maybeContext === undefined && frame.parentId !== undefined) {
|
||||
// Restore not yet known nested frames. The top-level frame is created when the
|
||||
// target is attached.
|
||||
const parentBrowsingContext = this.#browsingContextStorage.getContext(frame.parentId);
|
||||
BrowsingContextImpl_js_1.BrowsingContextImpl.create(frame.id, frame.parentId, parentBrowsingContext.userContext, parentBrowsingContext.cdpTarget, this.#eventManager, this.#browsingContextStorage, this.#realmStorage, frame.url, undefined, this.#unhandledPromptBehavior, this.#logger);
|
||||
}
|
||||
frameTree.childFrames?.map((frameTree) => this.#restoreFrameTreeState(frameTree));
|
||||
}
|
||||
async toggleFetchIfNeeded() {
|
||||
const stages = this.#networkStorage.getInterceptionStages(this.topLevelId);
|
||||
if (
|
||||
// Only toggle interception when Network is enabled
|
||||
!this.#networkDomainEnabled ||
|
||||
(this.#fetchDomainStages.request === stages.request &&
|
||||
this.#fetchDomainStages.response === stages.response &&
|
||||
this.#fetchDomainStages.auth === stages.auth)) {
|
||||
return;
|
||||
}
|
||||
const patterns = [];
|
||||
this.#fetchDomainStages = stages;
|
||||
if (stages.request || stages.auth) {
|
||||
// CDP quirk we need request interception when we intercept auth
|
||||
patterns.push({
|
||||
urlPattern: '*',
|
||||
requestStage: 'Request',
|
||||
});
|
||||
}
|
||||
if (stages.response) {
|
||||
patterns.push({
|
||||
urlPattern: '*',
|
||||
requestStage: 'Response',
|
||||
});
|
||||
}
|
||||
if (patterns.length) {
|
||||
await this.#cdpClient.sendCommand('Fetch.enable', {
|
||||
patterns,
|
||||
handleAuthRequests: stages.auth,
|
||||
});
|
||||
}
|
||||
else {
|
||||
await this.#cdpClient.sendCommand('Fetch.disable');
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Toggles both Network and Fetch domains.
|
||||
*/
|
||||
async toggleNetworkIfNeeded() {
|
||||
const enabled = this.isSubscribedTo(chromium_bidi_js_1.BiDiModule.Network);
|
||||
if (enabled === this.#networkDomainEnabled) {
|
||||
return;
|
||||
}
|
||||
this.#networkDomainEnabled = enabled;
|
||||
try {
|
||||
await Promise.all([
|
||||
this.#cdpClient.sendCommand(enabled ? 'Network.enable' : 'Network.disable'),
|
||||
this.toggleFetchIfNeeded(),
|
||||
]);
|
||||
}
|
||||
catch (err) {
|
||||
this.#logger?.(log_js_1.LogType.debugError, err);
|
||||
this.#networkDomainEnabled = !enabled;
|
||||
}
|
||||
}
|
||||
#setEventListeners() {
|
||||
this.#cdpClient.on('*', (event, params) => {
|
||||
// We may encounter uses for EventEmitter other than CDP events,
|
||||
// which we want to skip.
|
||||
if (typeof event !== 'string') {
|
||||
return;
|
||||
}
|
||||
this.#eventManager.registerEvent({
|
||||
type: 'event',
|
||||
method: `cdp.${event}`,
|
||||
params: {
|
||||
event,
|
||||
params,
|
||||
session: this.cdpSessionId,
|
||||
},
|
||||
}, this.id);
|
||||
});
|
||||
}
|
||||
/**
|
||||
* All the ProxyChannels from all the preload scripts of the given
|
||||
* BrowsingContext.
|
||||
*/
|
||||
getChannels() {
|
||||
return this.#preloadScriptStorage
|
||||
.find()
|
||||
.flatMap((script) => script.channels);
|
||||
}
|
||||
/** Loads all top-level preload scripts. */
|
||||
async #initAndEvaluatePreloadScripts() {
|
||||
await Promise.all(this.#preloadScriptStorage
|
||||
.find({
|
||||
// Needed for OOPIF
|
||||
targetId: this.topLevelId,
|
||||
global: true,
|
||||
})
|
||||
.map((script) => {
|
||||
return script.initInTarget(this, true);
|
||||
}));
|
||||
}
|
||||
get topLevelId() {
|
||||
return (this.#browsingContextStorage.findTopLevelContextId(this.id) ?? this.id);
|
||||
}
|
||||
isSubscribedTo(moduleOrEvent) {
|
||||
return this.#eventManager.subscriptionManager.isSubscribedTo(moduleOrEvent, this.topLevelId);
|
||||
}
|
||||
}
|
||||
exports.CdpTarget = CdpTarget;
|
||||
//# sourceMappingURL=CdpTarget.js.map
|
||||
1
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/modules/cdp/CdpTarget.js.map
generated
vendored
Normal file
1
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/modules/cdp/CdpTarget.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
13
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/modules/cdp/CdpTargetManager.d.ts
generated
vendored
Normal file
13
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/modules/cdp/CdpTargetManager.d.ts
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
import type { CdpClient } from '../../../cdp/CdpClient.js';
|
||||
import type { CdpConnection } from '../../../cdp/CdpConnection.js';
|
||||
import type { Browser, Session } from '../../../protocol/protocol.js';
|
||||
import { type LoggerFn } from '../../../utils/log.js';
|
||||
import type { BrowsingContextStorage } from '../context/BrowsingContextStorage.js';
|
||||
import type { NetworkStorage } from '../network/NetworkStorage.js';
|
||||
import type { PreloadScriptStorage } from '../script/PreloadScriptStorage.js';
|
||||
import type { RealmStorage } from '../script/RealmStorage.js';
|
||||
import type { EventManager } from '../session/EventManager.js';
|
||||
export declare class CdpTargetManager {
|
||||
#private;
|
||||
constructor(cdpConnection: CdpConnection, browserCdpClient: CdpClient, selfTargetId: string, eventManager: EventManager, browsingContextStorage: BrowsingContextStorage, realmStorage: RealmStorage, networkStorage: NetworkStorage, preloadScriptStorage: PreloadScriptStorage, defaultUserContextId: Browser.UserContext, unhandledPromptBehavior?: Session.UserPromptHandler, logger?: LoggerFn);
|
||||
}
|
||||
212
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/modules/cdp/CdpTargetManager.js
generated
vendored
Normal file
212
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/modules/cdp/CdpTargetManager.js
generated
vendored
Normal file
@ -0,0 +1,212 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CdpTargetManager = void 0;
|
||||
const log_js_1 = require("../../../utils/log.js");
|
||||
const BrowsingContextImpl_js_1 = require("../context/BrowsingContextImpl.js");
|
||||
const WorkerRealm_js_1 = require("../script/WorkerRealm.js");
|
||||
const CdpTarget_js_1 = require("./CdpTarget.js");
|
||||
const cdpToBidiTargetTypes = {
|
||||
service_worker: 'service-worker',
|
||||
shared_worker: 'shared-worker',
|
||||
worker: 'dedicated-worker',
|
||||
};
|
||||
class CdpTargetManager {
|
||||
#browserCdpClient;
|
||||
#cdpConnection;
|
||||
#targetKeysToBeIgnoredByAutoAttach = new Set();
|
||||
#selfTargetId;
|
||||
#eventManager;
|
||||
#browsingContextStorage;
|
||||
#networkStorage;
|
||||
#preloadScriptStorage;
|
||||
#realmStorage;
|
||||
#defaultUserContextId;
|
||||
#logger;
|
||||
#unhandledPromptBehavior;
|
||||
constructor(cdpConnection, browserCdpClient, selfTargetId, eventManager, browsingContextStorage, realmStorage, networkStorage, preloadScriptStorage, defaultUserContextId, unhandledPromptBehavior, logger) {
|
||||
this.#cdpConnection = cdpConnection;
|
||||
this.#browserCdpClient = browserCdpClient;
|
||||
this.#targetKeysToBeIgnoredByAutoAttach.add(selfTargetId);
|
||||
this.#selfTargetId = selfTargetId;
|
||||
this.#eventManager = eventManager;
|
||||
this.#browsingContextStorage = browsingContextStorage;
|
||||
this.#preloadScriptStorage = preloadScriptStorage;
|
||||
this.#networkStorage = networkStorage;
|
||||
this.#realmStorage = realmStorage;
|
||||
this.#defaultUserContextId = defaultUserContextId;
|
||||
this.#unhandledPromptBehavior = unhandledPromptBehavior;
|
||||
this.#logger = logger;
|
||||
this.#setEventListeners(browserCdpClient);
|
||||
}
|
||||
/**
|
||||
* This method is called for each CDP session, since this class is responsible
|
||||
* for creating and destroying all targets and browsing contexts.
|
||||
*/
|
||||
#setEventListeners(cdpClient) {
|
||||
cdpClient.on('Target.attachedToTarget', (params) => {
|
||||
this.#handleAttachedToTargetEvent(params, cdpClient);
|
||||
});
|
||||
cdpClient.on('Target.detachedFromTarget', this.#handleDetachedFromTargetEvent.bind(this));
|
||||
cdpClient.on('Target.targetInfoChanged', this.#handleTargetInfoChangedEvent.bind(this));
|
||||
cdpClient.on('Inspector.targetCrashed', () => {
|
||||
this.#handleTargetCrashedEvent(cdpClient);
|
||||
});
|
||||
cdpClient.on('Page.frameAttached', this.#handleFrameAttachedEvent.bind(this));
|
||||
cdpClient.on('Page.frameDetached', this.#handleFrameDetachedEvent.bind(this));
|
||||
}
|
||||
#handleFrameAttachedEvent(params) {
|
||||
const parentBrowsingContext = this.#browsingContextStorage.findContext(params.parentFrameId);
|
||||
if (parentBrowsingContext !== undefined) {
|
||||
BrowsingContextImpl_js_1.BrowsingContextImpl.create(params.frameId, params.parentFrameId, parentBrowsingContext.userContext, parentBrowsingContext.cdpTarget, this.#eventManager, this.#browsingContextStorage, this.#realmStorage,
|
||||
// At this point, we don't know the URL of the frame yet, so it will be updated
|
||||
// later.
|
||||
'about:blank', undefined, this.#unhandledPromptBehavior, this.#logger);
|
||||
}
|
||||
}
|
||||
#handleFrameDetachedEvent(params) {
|
||||
// In case of OOPiF no need in deleting BrowsingContext.
|
||||
if (params.reason === 'swap') {
|
||||
return;
|
||||
}
|
||||
this.#browsingContextStorage.findContext(params.frameId)?.dispose();
|
||||
}
|
||||
#handleAttachedToTargetEvent(params, parentSessionCdpClient) {
|
||||
const { sessionId, targetInfo } = params;
|
||||
const targetCdpClient = this.#cdpConnection.getCdpClient(sessionId);
|
||||
const detach = async () => {
|
||||
// Detaches and resumes the target suppressing errors.
|
||||
await targetCdpClient
|
||||
.sendCommand('Runtime.runIfWaitingForDebugger')
|
||||
.then(() => parentSessionCdpClient.sendCommand('Target.detachFromTarget', params))
|
||||
.catch((error) => this.#logger?.(log_js_1.LogType.debugError, error));
|
||||
};
|
||||
if (this.#selfTargetId !== targetInfo.targetId) {
|
||||
// Service workers are special case because they attach to the
|
||||
// browser target and the page target (so twice per worker) during
|
||||
// the regular auto-attach and might hang if the CDP session on
|
||||
// the browser level is not detached. The logic to detach the
|
||||
// right session is handled in the switch below.
|
||||
const targetKey = targetInfo.type === 'service_worker'
|
||||
? `${parentSessionCdpClient.sessionId}_${targetInfo.targetId}`
|
||||
: targetInfo.targetId;
|
||||
// Mapper generally only needs one session per target. If we
|
||||
// receive additional auto-attached sessions, that is very likely
|
||||
// coming from custom CDP sessions.
|
||||
if (this.#targetKeysToBeIgnoredByAutoAttach.has(targetKey)) {
|
||||
// Return to leave the session untouched.
|
||||
return;
|
||||
}
|
||||
this.#targetKeysToBeIgnoredByAutoAttach.add(targetKey);
|
||||
}
|
||||
switch (targetInfo.type) {
|
||||
case 'page':
|
||||
case 'iframe': {
|
||||
if (this.#selfTargetId === targetInfo.targetId) {
|
||||
void detach();
|
||||
return;
|
||||
}
|
||||
const cdpTarget = this.#createCdpTarget(targetCdpClient, targetInfo);
|
||||
const maybeContext = this.#browsingContextStorage.findContext(targetInfo.targetId);
|
||||
if (maybeContext && targetInfo.type === 'iframe') {
|
||||
// OOPiF.
|
||||
maybeContext.updateCdpTarget(cdpTarget);
|
||||
}
|
||||
else {
|
||||
const userContext = targetInfo.browserContextId &&
|
||||
targetInfo.browserContextId !== this.#defaultUserContextId
|
||||
? targetInfo.browserContextId
|
||||
: 'default';
|
||||
// New context.
|
||||
BrowsingContextImpl_js_1.BrowsingContextImpl.create(targetInfo.targetId, null, userContext, cdpTarget, this.#eventManager, this.#browsingContextStorage, this.#realmStorage,
|
||||
// Hack: when a new target created, CDP emits targetInfoChanged with an empty
|
||||
// url, and navigates it to about:blank later. When the event is emitted for
|
||||
// an existing target (reconnect), the url is already known, and navigation
|
||||
// events will not be emitted anymore. Replacing empty url with `about:blank`
|
||||
// allows to handle both cases in the same way.
|
||||
// "7.3.2.1 Creating browsing contexts".
|
||||
// https://html.spec.whatwg.org/multipage/document-sequences.html#creating-browsing-contexts
|
||||
// TODO: check who to deal with non-null creator and its `creatorOrigin`.
|
||||
targetInfo.url === '' ? 'about:blank' : targetInfo.url, targetInfo.openerFrameId ?? targetInfo.openerId, this.#unhandledPromptBehavior, this.#logger);
|
||||
}
|
||||
return;
|
||||
}
|
||||
case 'service_worker':
|
||||
case 'worker': {
|
||||
const realm = this.#realmStorage.findRealm({
|
||||
cdpSessionId: parentSessionCdpClient.sessionId,
|
||||
});
|
||||
// If there is no browsing context, this worker is already terminated.
|
||||
if (!realm) {
|
||||
void detach();
|
||||
return;
|
||||
}
|
||||
const cdpTarget = this.#createCdpTarget(targetCdpClient, targetInfo);
|
||||
this.#handleWorkerTarget(cdpToBidiTargetTypes[targetInfo.type], cdpTarget, realm);
|
||||
return;
|
||||
}
|
||||
// In CDP, we only emit shared workers on the browser and not the set of
|
||||
// frames that use the shared worker. If we change this in the future to
|
||||
// behave like service workers (emits on both browser and frame targets),
|
||||
// we can remove this block and merge service workers with the above one.
|
||||
case 'shared_worker': {
|
||||
const cdpTarget = this.#createCdpTarget(targetCdpClient, targetInfo);
|
||||
this.#handleWorkerTarget(cdpToBidiTargetTypes[targetInfo.type], cdpTarget);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// DevTools or some other not supported by BiDi target. Just release
|
||||
// debugger and ignore them.
|
||||
void detach();
|
||||
}
|
||||
#createCdpTarget(targetCdpClient, targetInfo) {
|
||||
this.#setEventListeners(targetCdpClient);
|
||||
const target = CdpTarget_js_1.CdpTarget.create(targetInfo.targetId, targetCdpClient, this.#browserCdpClient, this.#realmStorage, this.#eventManager, this.#preloadScriptStorage, this.#browsingContextStorage, this.#networkStorage, this.#unhandledPromptBehavior, this.#logger);
|
||||
this.#networkStorage.onCdpTargetCreated(target);
|
||||
return target;
|
||||
}
|
||||
#workers = new Map();
|
||||
#handleWorkerTarget(realmType, cdpTarget, ownerRealm) {
|
||||
cdpTarget.cdpClient.on('Runtime.executionContextCreated', (params) => {
|
||||
const { uniqueId, id, origin } = params.context;
|
||||
const workerRealm = new WorkerRealm_js_1.WorkerRealm(cdpTarget.cdpClient, this.#eventManager, id, this.#logger, (0, BrowsingContextImpl_js_1.serializeOrigin)(origin), ownerRealm ? [ownerRealm] : [], uniqueId, this.#realmStorage, realmType);
|
||||
this.#workers.set(cdpTarget.cdpSessionId, workerRealm);
|
||||
});
|
||||
}
|
||||
#handleDetachedFromTargetEvent({ sessionId, targetId, }) {
|
||||
if (targetId) {
|
||||
this.#preloadScriptStorage.find({ targetId }).map((preloadScript) => {
|
||||
preloadScript.dispose(targetId);
|
||||
});
|
||||
}
|
||||
const context = this.#browsingContextStorage.findContextBySession(sessionId);
|
||||
if (context) {
|
||||
context.dispose();
|
||||
return;
|
||||
}
|
||||
const worker = this.#workers.get(sessionId);
|
||||
if (worker) {
|
||||
this.#realmStorage.deleteRealms({
|
||||
cdpSessionId: worker.cdpClient.sessionId,
|
||||
});
|
||||
}
|
||||
}
|
||||
#handleTargetInfoChangedEvent(params) {
|
||||
const context = this.#browsingContextStorage.findContext(params.targetInfo.targetId);
|
||||
if (context) {
|
||||
context.onTargetInfoChanged(params);
|
||||
}
|
||||
}
|
||||
#handleTargetCrashedEvent(cdpClient) {
|
||||
// This is primarily used for service and shared workers. CDP tends to not
|
||||
// signal they closed gracefully and instead says they crashed to signal
|
||||
// they are closed.
|
||||
const realms = this.#realmStorage.findRealms({
|
||||
cdpSessionId: cdpClient.sessionId,
|
||||
});
|
||||
for (const realm of realms) {
|
||||
realm.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.CdpTargetManager = CdpTargetManager;
|
||||
//# sourceMappingURL=CdpTargetManager.js.map
|
||||
1
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/modules/cdp/CdpTargetManager.js.map
generated
vendored
Normal file
1
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/modules/cdp/CdpTargetManager.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -15,29 +15,37 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
import type { Protocol } from 'devtools-protocol';
|
||||
import { BrowsingContext } from '../../../protocol/protocol.js';
|
||||
import { BrowsingContext, Session } from '../../../protocol/protocol.js';
|
||||
import { type LoggerFn } from '../../../utils/log.js';
|
||||
import type { CdpTarget } from '../cdp/CdpTarget.js';
|
||||
import type { Realm } from '../script/Realm.js';
|
||||
import type { RealmStorage } from '../script/RealmStorage.js';
|
||||
import type { EventManager } from '../session/EventManager.js';
|
||||
import type { BrowsingContextStorage } from './BrowsingContextStorage.js';
|
||||
import type { CdpTarget } from './CdpTarget.js';
|
||||
export declare class BrowsingContextImpl {
|
||||
#private;
|
||||
static readonly LOGGER_PREFIX: "debug:browsingContext";
|
||||
readonly userContext: string;
|
||||
private constructor();
|
||||
static create(cdpTarget: CdpTarget, realmStorage: RealmStorage, id: BrowsingContext.BrowsingContext, parentId: BrowsingContext.BrowsingContext | null, userContext: string, eventManager: EventManager, browsingContextStorage: BrowsingContextStorage, sharedIdWithFrame: boolean, logger?: LoggerFn): BrowsingContextImpl;
|
||||
static create(id: BrowsingContext.BrowsingContext, parentId: BrowsingContext.BrowsingContext | null, userContext: string, cdpTarget: CdpTarget, eventManager: EventManager, browsingContextStorage: BrowsingContextStorage, realmStorage: RealmStorage, url: string, originalOpener?: string, unhandledPromptBehavior?: Session.UserPromptHandler, logger?: LoggerFn): BrowsingContextImpl;
|
||||
static getTimestamp(): number;
|
||||
/**
|
||||
* @see https://html.spec.whatwg.org/multipage/document-sequences.html#navigable
|
||||
*/
|
||||
get navigableId(): string | undefined;
|
||||
/**
|
||||
* Virtual navigation ID. Required, as CDP `loaderId` cannot be mapped 1:1 to all the
|
||||
* navigations (e.g. same document navigations). Updated after each navigation,
|
||||
* including same-document ones.
|
||||
*/
|
||||
get virtualNavigationId(): string;
|
||||
dispose(): void;
|
||||
/** Returns the ID of this context. */
|
||||
get id(): BrowsingContext.BrowsingContext;
|
||||
/** Returns the parent context ID. */
|
||||
get parentId(): BrowsingContext.BrowsingContext | null;
|
||||
/** Sets the parent context ID and updates parent's children. */
|
||||
set parentId(parentId: BrowsingContext.BrowsingContext | null);
|
||||
/** Returns the parent context. */
|
||||
get parent(): BrowsingContextImpl | null;
|
||||
/** Returns all direct children contexts. */
|
||||
@ -62,11 +70,13 @@ export declare class BrowsingContextImpl {
|
||||
navigate(url: string, wait: BrowsingContext.ReadinessState): Promise<BrowsingContext.NavigateResult>;
|
||||
reload(ignoreCache: boolean, wait: BrowsingContext.ReadinessState): Promise<BrowsingContext.NavigateResult>;
|
||||
setViewport(viewport?: BrowsingContext.Viewport | null, devicePixelRatio?: number | null): Promise<void>;
|
||||
handleUserPrompt(params: BrowsingContext.HandleUserPromptParameters): Promise<void>;
|
||||
handleUserPrompt(accept?: boolean, userText?: string): Promise<void>;
|
||||
activate(): Promise<void>;
|
||||
captureScreenshot(params: BrowsingContext.CaptureScreenshotParameters): Promise<BrowsingContext.CaptureScreenshotResult>;
|
||||
print(params: BrowsingContext.PrintParameters): Promise<BrowsingContext.PrintResult>;
|
||||
close(): Promise<void>;
|
||||
traverseHistory(delta: number): Promise<void>;
|
||||
toggleModulesIfNeeded(): Promise<void>;
|
||||
locateNodes(params: BrowsingContext.LocateNodesParameters): Promise<BrowsingContext.LocateNodesResult>;
|
||||
}
|
||||
export declare function serializeOrigin(origin: string): string;
|
||||
@ -16,12 +16,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.serializeOrigin = exports.BrowsingContextImpl = void 0;
|
||||
exports.BrowsingContextImpl = void 0;
|
||||
exports.serializeOrigin = serializeOrigin;
|
||||
const protocol_js_1 = require("../../../protocol/protocol.js");
|
||||
const assert_js_1 = require("../../../utils/assert.js");
|
||||
const Deferred_js_1 = require("../../../utils/Deferred.js");
|
||||
const log_js_1 = require("../../../utils/log.js");
|
||||
const unitConversions_js_1 = require("../../../utils/unitConversions.js");
|
||||
const uuid_1 = require("../../../utils/uuid");
|
||||
const WindowRealm_js_1 = require("../script/WindowRealm.js");
|
||||
class BrowsingContextImpl {
|
||||
static LOGGER_PREFIX = `${log_js_1.LogType.debug}:browsingContext`;
|
||||
@ -32,7 +34,7 @@ class BrowsingContextImpl {
|
||||
* The ID of the parent browsing context.
|
||||
* If null, this is a top-level context.
|
||||
*/
|
||||
#parentId;
|
||||
#parentId = null;
|
||||
/** Direct children browsing contexts. */
|
||||
#children = new Set();
|
||||
#browsingContextStorage;
|
||||
@ -43,37 +45,64 @@ class BrowsingContextImpl {
|
||||
#navigation = {
|
||||
withinDocument: new Deferred_js_1.Deferred(),
|
||||
};
|
||||
#url = 'about:blank';
|
||||
#url;
|
||||
#eventManager;
|
||||
#realmStorage;
|
||||
#loaderId;
|
||||
#cdpTarget;
|
||||
#maybeDefaultRealm;
|
||||
#sharedIdWithFrame;
|
||||
// The deferred will be resolved when the default realm is created.
|
||||
#defaultRealmDeferred = new Deferred_js_1.Deferred();
|
||||
#logger;
|
||||
constructor(cdpTarget, realmStorage, id, parentId, userContext, eventManager, browsingContextStorage, sharedIdWithFrame, logger) {
|
||||
// Keeps track of the previously set viewport.
|
||||
#previousViewport = { width: 0, height: 0 };
|
||||
// The URL of the navigation that is currently in progress. A workaround of the CDP
|
||||
// lacking URL for the pending navigation events, e.g. `Page.frameStartedLoading`.
|
||||
// Set on `Page.navigate`, `Page.reload` commands and on deprecated CDP event
|
||||
// `Page.frameScheduledNavigation`.
|
||||
#pendingNavigationUrl;
|
||||
#virtualNavigationId = (0, uuid_1.uuidv4)();
|
||||
#originalOpener;
|
||||
// Set when the user prompt is opened. Required to provide the type in closing event.
|
||||
#lastUserPromptType;
|
||||
#unhandledPromptBehavior;
|
||||
constructor(id, parentId, userContext, cdpTarget, eventManager, browsingContextStorage, realmStorage, url, originalOpener, unhandledPromptBehavior, logger) {
|
||||
this.#cdpTarget = cdpTarget;
|
||||
this.#realmStorage = realmStorage;
|
||||
this.#id = id;
|
||||
this.#parentId = parentId;
|
||||
this.userContext = userContext;
|
||||
this.#eventManager = eventManager;
|
||||
this.#browsingContextStorage = browsingContextStorage;
|
||||
this.#sharedIdWithFrame = sharedIdWithFrame;
|
||||
this.#realmStorage = realmStorage;
|
||||
this.#unhandledPromptBehavior = unhandledPromptBehavior;
|
||||
this.#logger = logger;
|
||||
this.#url = url;
|
||||
this.#originalOpener = originalOpener;
|
||||
}
|
||||
static create(cdpTarget, realmStorage, id, parentId, userContext, eventManager, browsingContextStorage, sharedIdWithFrame, logger) {
|
||||
const context = new BrowsingContextImpl(cdpTarget, realmStorage, id, parentId, userContext, eventManager, browsingContextStorage, sharedIdWithFrame, logger);
|
||||
static create(id, parentId, userContext, cdpTarget, eventManager, browsingContextStorage, realmStorage, url, originalOpener, unhandledPromptBehavior, logger) {
|
||||
const context = new BrowsingContextImpl(id, parentId, userContext, cdpTarget, eventManager, browsingContextStorage, realmStorage, url, originalOpener, unhandledPromptBehavior, logger);
|
||||
context.#initListeners();
|
||||
browsingContextStorage.addContext(context);
|
||||
if (!context.isTopLevelContext()) {
|
||||
context.parent.addChild(context.id);
|
||||
}
|
||||
eventManager.registerEvent({
|
||||
type: 'event',
|
||||
method: protocol_js_1.ChromiumBidi.BrowsingContext.EventNames.ContextCreated,
|
||||
params: context.serializeToBidiValue(),
|
||||
}, context.id);
|
||||
// Hold on the `contextCreated` event until the target is unblocked. This is required,
|
||||
// as the parent of the context can be set later in case of reconnecting to an
|
||||
// existing browser instance + OOPiF.
|
||||
eventManager.registerPromiseEvent(context.targetUnblockedOrThrow().then(() => {
|
||||
return {
|
||||
kind: 'success',
|
||||
value: {
|
||||
type: 'event',
|
||||
method: protocol_js_1.ChromiumBidi.BrowsingContext.EventNames.ContextCreated,
|
||||
params: context.serializeToBidiValue(),
|
||||
},
|
||||
};
|
||||
}, (error) => {
|
||||
return {
|
||||
kind: 'error',
|
||||
error,
|
||||
};
|
||||
}), context.id, protocol_js_1.ChromiumBidi.BrowsingContext.EventNames.ContextCreated);
|
||||
return context;
|
||||
}
|
||||
static getTimestamp() {
|
||||
@ -89,6 +118,14 @@ class BrowsingContextImpl {
|
||||
get navigableId() {
|
||||
return this.#loaderId;
|
||||
}
|
||||
/**
|
||||
* Virtual navigation ID. Required, as CDP `loaderId` cannot be mapped 1:1 to all the
|
||||
* navigations (e.g. same document navigations). Updated after each navigation,
|
||||
* including same-document ones.
|
||||
*/
|
||||
get virtualNavigationId() {
|
||||
return this.#virtualNavigationId;
|
||||
}
|
||||
dispose() {
|
||||
this.#deleteAllChildren();
|
||||
this.#realmStorage.deleteRealms({
|
||||
@ -115,6 +152,19 @@ class BrowsingContextImpl {
|
||||
get parentId() {
|
||||
return this.#parentId;
|
||||
}
|
||||
/** Sets the parent context ID and updates parent's children. */
|
||||
set parentId(parentId) {
|
||||
if (this.#parentId !== null) {
|
||||
this.#logger?.(log_js_1.LogType.debugError, 'Parent context already set');
|
||||
// Cannot do anything except logging, as throwing will stop event processing. So
|
||||
// just return,
|
||||
return;
|
||||
}
|
||||
this.#parentId = parentId;
|
||||
if (!this.isTopLevelContext()) {
|
||||
this.parent.addChild(this.id);
|
||||
}
|
||||
}
|
||||
/** Returns the parent context. */
|
||||
get parent() {
|
||||
if (this.parentId === null) {
|
||||
@ -154,10 +204,6 @@ class BrowsingContextImpl {
|
||||
#deleteAllChildren() {
|
||||
this.directChildren.map((child) => child.dispose());
|
||||
}
|
||||
get #defaultRealm() {
|
||||
(0, assert_js_1.assert)(this.#maybeDefaultRealm, `No default realm for browsing context ${this.#id}`);
|
||||
return this.#maybeDefaultRealm;
|
||||
}
|
||||
get cdpTarget() {
|
||||
return this.#cdpTarget;
|
||||
}
|
||||
@ -179,7 +225,8 @@ class BrowsingContextImpl {
|
||||
}
|
||||
async getOrCreateSandbox(sandbox) {
|
||||
if (sandbox === undefined || sandbox === '') {
|
||||
return this.#defaultRealm;
|
||||
// Default realm is not guaranteed to be created at this point, so return a deferred.
|
||||
return await this.#defaultRealmDeferred;
|
||||
}
|
||||
let maybeSandboxes = this.#realmStorage.findRealms({
|
||||
browsingContextId: this.id,
|
||||
@ -209,6 +256,7 @@ class BrowsingContextImpl {
|
||||
context: this.#id,
|
||||
url: this.url,
|
||||
userContext: this.userContext,
|
||||
originalOpener: this.#originalOpener ?? null,
|
||||
children: maxDepth > 0
|
||||
? this.directChildren.map((c) => c.serializeToBidiValue(maxDepth - 1, false))
|
||||
: null,
|
||||
@ -224,6 +272,7 @@ class BrowsingContextImpl {
|
||||
return;
|
||||
}
|
||||
this.#url = params.frame.url + (params.frame.urlFragment ?? '');
|
||||
this.#pendingNavigationUrl = undefined;
|
||||
// At the point the page is initialized, all the nested iframes from the
|
||||
// previous page are detached and realms are destroyed.
|
||||
// Remove children from context.
|
||||
@ -233,15 +282,16 @@ class BrowsingContextImpl {
|
||||
if (this.id !== params.frameId) {
|
||||
return;
|
||||
}
|
||||
this.#pendingNavigationUrl = undefined;
|
||||
const timestamp = BrowsingContextImpl.getTimestamp();
|
||||
this.#url = params.url;
|
||||
this.#navigation.withinDocument.resolve(params);
|
||||
this.#navigation.withinDocument.resolve();
|
||||
this.#eventManager.registerEvent({
|
||||
type: 'event',
|
||||
method: protocol_js_1.ChromiumBidi.BrowsingContext.EventNames.FragmentNavigated,
|
||||
params: {
|
||||
context: this.id,
|
||||
navigation: null,
|
||||
navigation: this.#virtualNavigationId,
|
||||
timestamp,
|
||||
url: this.#url,
|
||||
},
|
||||
@ -251,17 +301,30 @@ class BrowsingContextImpl {
|
||||
if (this.id !== params.frameId) {
|
||||
return;
|
||||
}
|
||||
// Generate a new virtual navigation id.
|
||||
this.#virtualNavigationId = (0, uuid_1.uuidv4)();
|
||||
this.#eventManager.registerEvent({
|
||||
type: 'event',
|
||||
method: protocol_js_1.ChromiumBidi.BrowsingContext.EventNames.NavigationStarted,
|
||||
params: {
|
||||
context: this.id,
|
||||
navigation: null,
|
||||
navigation: this.#virtualNavigationId,
|
||||
timestamp: BrowsingContextImpl.getTimestamp(),
|
||||
url: '',
|
||||
// The URL of the navigation that is currently in progress. Although the URL
|
||||
// is not yet known in case of user-initiated navigations, it is possible to
|
||||
// provide the URL in case of BiDi-initiated navigations.
|
||||
// TODO: provide proper URL in case of user-initiated navigations.
|
||||
url: this.#pendingNavigationUrl ?? 'UNKNOWN',
|
||||
},
|
||||
}, this.id);
|
||||
});
|
||||
// TODO: don't use deprecated `Page.frameScheduledNavigation` event.
|
||||
this.#cdpTarget.cdpClient.on('Page.frameScheduledNavigation', (params) => {
|
||||
if (this.id !== params.frameId) {
|
||||
return;
|
||||
}
|
||||
this.#pendingNavigationUrl = params.url;
|
||||
});
|
||||
this.#cdpTarget.cdpClient.on('Page.lifecycleEvent', (params) => {
|
||||
if (this.id !== params.frameId) {
|
||||
return;
|
||||
@ -274,6 +337,12 @@ class BrowsingContextImpl {
|
||||
this.#loaderId = params.loaderId;
|
||||
return;
|
||||
}
|
||||
// If mapper attached to the page late, it might miss init and
|
||||
// commit events. In that case, save the first loaderId for this
|
||||
// frameId.
|
||||
if (!this.#loaderId) {
|
||||
this.#loaderId = params.loaderId;
|
||||
}
|
||||
// Ignore event from not current navigation.
|
||||
if (params.loaderId !== this.#loaderId) {
|
||||
return;
|
||||
@ -286,12 +355,12 @@ class BrowsingContextImpl {
|
||||
method: protocol_js_1.ChromiumBidi.BrowsingContext.EventNames.DomContentLoaded,
|
||||
params: {
|
||||
context: this.id,
|
||||
navigation: this.#loaderId ?? null,
|
||||
navigation: this.#virtualNavigationId,
|
||||
timestamp,
|
||||
url: this.#url,
|
||||
},
|
||||
}, this.id);
|
||||
this.#lifecycle.DOMContentLoaded.resolve(params);
|
||||
this.#lifecycle.DOMContentLoaded.resolve();
|
||||
break;
|
||||
case 'load':
|
||||
this.#eventManager.registerEvent({
|
||||
@ -299,12 +368,12 @@ class BrowsingContextImpl {
|
||||
method: protocol_js_1.ChromiumBidi.BrowsingContext.EventNames.Load,
|
||||
params: {
|
||||
context: this.id,
|
||||
navigation: this.#loaderId ?? null,
|
||||
navigation: this.#virtualNavigationId,
|
||||
timestamp,
|
||||
url: this.#url,
|
||||
},
|
||||
}, this.id);
|
||||
this.#lifecycle.load.resolve(params);
|
||||
this.#lifecycle.load.resolve();
|
||||
break;
|
||||
}
|
||||
});
|
||||
@ -321,7 +390,13 @@ class BrowsingContextImpl {
|
||||
sandbox = name;
|
||||
// Sandbox should have the same origin as the context itself, but in CDP
|
||||
// it has an empty one.
|
||||
origin = this.#defaultRealm.origin;
|
||||
if (!this.#defaultRealmDeferred.isFinished) {
|
||||
this.#logger?.(log_js_1.LogType.debugError, 'Unexpectedly, isolated realm created before the default one');
|
||||
}
|
||||
origin = this.#defaultRealmDeferred.isFinished
|
||||
? this.#defaultRealmDeferred.result.origin
|
||||
: // This fallback is not expected to be ever reached.
|
||||
'';
|
||||
break;
|
||||
case 'default':
|
||||
origin = serializeOrigin(params.context.origin);
|
||||
@ -329,9 +404,9 @@ class BrowsingContextImpl {
|
||||
default:
|
||||
return;
|
||||
}
|
||||
const realm = new WindowRealm_js_1.WindowRealm(this.id, this.#browsingContextStorage, this.#cdpTarget.cdpClient, this.#eventManager, id, this.#logger, origin, uniqueId, this.#realmStorage, sandbox, this.#sharedIdWithFrame);
|
||||
const realm = new WindowRealm_js_1.WindowRealm(this.id, this.#browsingContextStorage, this.#cdpTarget.cdpClient, this.#eventManager, id, this.#logger, origin, uniqueId, this.#realmStorage, sandbox);
|
||||
if (auxData.isDefault) {
|
||||
this.#maybeDefaultRealm = realm;
|
||||
this.#defaultRealmDeferred.resolve(realm);
|
||||
// Initialize ChannelProxy listeners for all the channels of all the
|
||||
// preload scripts related to this BrowsingContext.
|
||||
// TODO: extend for not default realms by the sandbox name.
|
||||
@ -341,48 +416,117 @@ class BrowsingContextImpl {
|
||||
}
|
||||
});
|
||||
this.#cdpTarget.cdpClient.on('Runtime.executionContextDestroyed', (params) => {
|
||||
if (this.#defaultRealmDeferred.isFinished &&
|
||||
this.#defaultRealmDeferred.result.executionContextId ===
|
||||
params.executionContextId) {
|
||||
this.#defaultRealmDeferred = new Deferred_js_1.Deferred();
|
||||
}
|
||||
this.#realmStorage.deleteRealms({
|
||||
cdpSessionId: this.#cdpTarget.cdpSessionId,
|
||||
executionContextId: params.executionContextId,
|
||||
});
|
||||
});
|
||||
this.#cdpTarget.cdpClient.on('Runtime.executionContextsCleared', () => {
|
||||
if (!this.#defaultRealmDeferred.isFinished) {
|
||||
this.#defaultRealmDeferred.reject(new protocol_js_1.UnknownErrorException('execution contexts cleared'));
|
||||
}
|
||||
this.#defaultRealmDeferred = new Deferred_js_1.Deferred();
|
||||
this.#realmStorage.deleteRealms({
|
||||
cdpSessionId: this.#cdpTarget.cdpSessionId,
|
||||
});
|
||||
});
|
||||
this.#cdpTarget.cdpClient.on('Page.javascriptDialogClosed', (params) => {
|
||||
const accepted = params.result;
|
||||
if (this.#lastUserPromptType === undefined) {
|
||||
this.#logger?.(log_js_1.LogType.debugError, 'Unexpectedly no opening prompt event before closing one');
|
||||
}
|
||||
this.#eventManager.registerEvent({
|
||||
type: 'event',
|
||||
method: protocol_js_1.ChromiumBidi.BrowsingContext.EventNames.UserPromptClosed,
|
||||
params: {
|
||||
context: this.id,
|
||||
accepted,
|
||||
// `lastUserPromptType` should never be undefined here, so fallback to
|
||||
// `UNKNOWN`. The fallback is required to prevent tests from hanging while
|
||||
// waiting for the closing event. The cast is required, as the `UNKNOWN` value
|
||||
// is not standard.
|
||||
type: this.#lastUserPromptType ??
|
||||
'UNKNOWN',
|
||||
userText: accepted && params.userInput ? params.userInput : undefined,
|
||||
},
|
||||
}, this.id);
|
||||
this.#lastUserPromptType = undefined;
|
||||
});
|
||||
this.#cdpTarget.cdpClient.on('Page.javascriptDialogOpening', (params) => {
|
||||
const promptType = BrowsingContextImpl.#getPromptType(params.type);
|
||||
// Set the last prompt type to provide it in closing event.
|
||||
this.#lastUserPromptType = promptType;
|
||||
const promptHandler = this.#getPromptHandler(promptType);
|
||||
this.#eventManager.registerEvent({
|
||||
type: 'event',
|
||||
method: protocol_js_1.ChromiumBidi.BrowsingContext.EventNames.UserPromptOpened,
|
||||
params: {
|
||||
context: this.id,
|
||||
type: params.type,
|
||||
handler: promptHandler,
|
||||
type: promptType,
|
||||
message: params.message,
|
||||
// Don't set the value if empty string
|
||||
defaultValue: params.defaultPrompt || undefined,
|
||||
...(params.type === 'prompt'
|
||||
? { defaultValue: params.defaultPrompt }
|
||||
: {}),
|
||||
},
|
||||
}, this.id);
|
||||
switch (promptHandler) {
|
||||
// Based on `unhandledPromptBehavior`, check if the prompt should be handled
|
||||
// automatically (`accept`, `dismiss`) or wait for the user to do it.
|
||||
case "accept" /* Session.UserPromptHandlerType.Accept */:
|
||||
void this.handleUserPrompt(true);
|
||||
break;
|
||||
case "dismiss" /* Session.UserPromptHandlerType.Dismiss */:
|
||||
void this.handleUserPrompt(false);
|
||||
break;
|
||||
case "ignore" /* Session.UserPromptHandlerType.Ignore */:
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
static #getPromptType(cdpType) {
|
||||
switch (cdpType) {
|
||||
case 'alert':
|
||||
return "alert" /* BrowsingContext.UserPromptType.Alert */;
|
||||
case 'beforeunload':
|
||||
return "beforeunload" /* BrowsingContext.UserPromptType.Beforeunload */;
|
||||
case 'confirm':
|
||||
return "confirm" /* BrowsingContext.UserPromptType.Confirm */;
|
||||
case 'prompt':
|
||||
return "prompt" /* BrowsingContext.UserPromptType.Prompt */;
|
||||
}
|
||||
}
|
||||
#getPromptHandler(promptType) {
|
||||
const defaultPromptHandler = "dismiss" /* Session.UserPromptHandlerType.Dismiss */;
|
||||
switch (promptType) {
|
||||
case "alert" /* BrowsingContext.UserPromptType.Alert */:
|
||||
return (this.#unhandledPromptBehavior?.alert ??
|
||||
this.#unhandledPromptBehavior?.default ??
|
||||
defaultPromptHandler);
|
||||
case "beforeunload" /* BrowsingContext.UserPromptType.Beforeunload */:
|
||||
return (this.#unhandledPromptBehavior?.beforeUnload ??
|
||||
this.#unhandledPromptBehavior?.default ??
|
||||
"accept" /* Session.UserPromptHandlerType.Accept */);
|
||||
case "confirm" /* BrowsingContext.UserPromptType.Confirm */:
|
||||
return (this.#unhandledPromptBehavior?.confirm ??
|
||||
this.#unhandledPromptBehavior?.default ??
|
||||
defaultPromptHandler);
|
||||
case "prompt" /* BrowsingContext.UserPromptType.Prompt */:
|
||||
return (this.#unhandledPromptBehavior?.prompt ??
|
||||
this.#unhandledPromptBehavior?.default ??
|
||||
defaultPromptHandler);
|
||||
}
|
||||
}
|
||||
#documentChanged(loaderId) {
|
||||
// Same document navigation.
|
||||
if (loaderId === undefined || this.#loaderId === loaderId) {
|
||||
if (this.#navigation.withinDocument.isFinished) {
|
||||
this.#navigation.withinDocument =
|
||||
new Deferred_js_1.Deferred();
|
||||
this.#navigation.withinDocument = new Deferred_js_1.Deferred();
|
||||
}
|
||||
else {
|
||||
this.#logger?.(BrowsingContextImpl.LOGGER_PREFIX, 'Document changed (navigatedWithinDocument)');
|
||||
@ -394,8 +538,7 @@ class BrowsingContextImpl {
|
||||
}
|
||||
#resetLifecycleIfFinished() {
|
||||
if (this.#lifecycle.DOMContentLoaded.isFinished) {
|
||||
this.#lifecycle.DOMContentLoaded =
|
||||
new Deferred_js_1.Deferred();
|
||||
this.#lifecycle.DOMContentLoaded = new Deferred_js_1.Deferred();
|
||||
}
|
||||
else {
|
||||
this.#logger?.(BrowsingContextImpl.LOGGER_PREFIX, 'Document changed (DOMContentLoaded)');
|
||||
@ -423,12 +566,29 @@ class BrowsingContextImpl {
|
||||
throw new protocol_js_1.InvalidArgumentException(`Invalid URL: ${url}`);
|
||||
}
|
||||
await this.targetUnblockedOrThrow();
|
||||
// Set the pending navigation URL to provide it in `browsingContext.navigationStarted`
|
||||
// event.
|
||||
// TODO: detect navigation start not from CDP. Check if
|
||||
// `Page.frameRequestedNavigation` can be used for this purpose.
|
||||
this.#pendingNavigationUrl = url;
|
||||
// TODO: handle loading errors.
|
||||
const cdpNavigateResult = await this.#cdpTarget.cdpClient.sendCommand('Page.navigate', {
|
||||
url,
|
||||
frameId: this.id,
|
||||
});
|
||||
if (cdpNavigateResult.errorText) {
|
||||
// If navigation failed, no pending navigation is left.
|
||||
this.#pendingNavigationUrl = undefined;
|
||||
this.#eventManager.registerEvent({
|
||||
type: 'event',
|
||||
method: protocol_js_1.ChromiumBidi.BrowsingContext.EventNames.NavigationFailed,
|
||||
params: {
|
||||
context: this.id,
|
||||
navigation: this.#virtualNavigationId,
|
||||
timestamp: BrowsingContextImpl.getTimestamp(),
|
||||
url,
|
||||
},
|
||||
}, this.id);
|
||||
throw new protocol_js_1.UnknownErrorException(cdpNavigateResult.errorText);
|
||||
}
|
||||
this.#documentChanged(cdpNavigateResult.loaderId);
|
||||
@ -455,17 +615,17 @@ class BrowsingContextImpl {
|
||||
break;
|
||||
}
|
||||
return {
|
||||
navigation: cdpNavigateResult.loaderId ?? null,
|
||||
navigation: this.#virtualNavigationId,
|
||||
// Url can change due to redirect get the latest one.
|
||||
url: wait === "none" /* BrowsingContext.ReadinessState.None */ ? url : this.#url,
|
||||
};
|
||||
}
|
||||
async reload(ignoreCache, wait) {
|
||||
await this.targetUnblockedOrThrow();
|
||||
this.#resetLifecycleIfFinished();
|
||||
await this.#cdpTarget.cdpClient.sendCommand('Page.reload', {
|
||||
ignoreCache,
|
||||
});
|
||||
this.#resetLifecycleIfFinished();
|
||||
switch (wait) {
|
||||
case "none" /* BrowsingContext.ReadinessState.None */:
|
||||
break;
|
||||
@ -477,9 +637,7 @@ class BrowsingContextImpl {
|
||||
break;
|
||||
}
|
||||
return {
|
||||
navigation: wait === "none" /* BrowsingContext.ReadinessState.None */
|
||||
? null
|
||||
: this.navigableId ?? null,
|
||||
navigation: this.#virtualNavigationId,
|
||||
url: this.url,
|
||||
};
|
||||
}
|
||||
@ -489,9 +647,23 @@ class BrowsingContextImpl {
|
||||
}
|
||||
else {
|
||||
try {
|
||||
let appliedViewport;
|
||||
if (viewport === undefined) {
|
||||
appliedViewport = this.#previousViewport;
|
||||
}
|
||||
else if (viewport === null) {
|
||||
appliedViewport = {
|
||||
width: 0,
|
||||
height: 0,
|
||||
};
|
||||
}
|
||||
else {
|
||||
appliedViewport = viewport;
|
||||
}
|
||||
this.#previousViewport = appliedViewport;
|
||||
await this.#cdpTarget.cdpClient.sendCommand('Emulation.setDeviceMetricsOverride', {
|
||||
width: viewport ? viewport.width : 0,
|
||||
height: viewport ? viewport.height : 0,
|
||||
width: this.#previousViewport.width,
|
||||
height: this.#previousViewport.height,
|
||||
deviceScaleFactor: devicePixelRatio ? devicePixelRatio : 0,
|
||||
mobile: false,
|
||||
dontSetVisibleSize: true,
|
||||
@ -507,10 +679,10 @@ class BrowsingContextImpl {
|
||||
}
|
||||
}
|
||||
}
|
||||
async handleUserPrompt(params) {
|
||||
async handleUserPrompt(accept, userText) {
|
||||
await this.#cdpTarget.cdpClient.sendCommand('Page.handleJavaScriptDialog', {
|
||||
accept: params.accept ?? true,
|
||||
promptText: params.userText,
|
||||
accept: accept ?? true,
|
||||
promptText: userText,
|
||||
});
|
||||
}
|
||||
async activate() {
|
||||
@ -555,13 +727,22 @@ class BrowsingContextImpl {
|
||||
}
|
||||
}
|
||||
const realm = await this.getOrCreateSandbox(undefined);
|
||||
const originResult = await realm.callFunction(script, { type: 'undefined' }, [], false, "none" /* Script.ResultOwnership.None */, {}, false);
|
||||
const originResult = await realm.callFunction(script, false);
|
||||
(0, assert_js_1.assert)(originResult.type === 'success');
|
||||
const origin = deserializeDOMRect(originResult.result);
|
||||
(0, assert_js_1.assert)(origin);
|
||||
const rect = params.clip
|
||||
? getIntersectionRect(await this.#parseRect(params.clip), origin)
|
||||
: origin;
|
||||
let rect = origin;
|
||||
if (params.clip) {
|
||||
const clip = params.clip;
|
||||
if (params.origin === 'viewport' && clip.type === 'box') {
|
||||
// For viewport origin, the clip is relative to the viewport, while the CDP
|
||||
// screenshot is relative to the document. So correction for the viewport position
|
||||
// is required.
|
||||
clip.x += origin.x;
|
||||
clip.y += origin.y;
|
||||
}
|
||||
rect = getIntersectionRect(await this.#parseRect(clip), origin);
|
||||
}
|
||||
if (rect.width === 0 || rect.height === 0) {
|
||||
throw new protocol_js_1.UnableToCaptureScreenException(`Unable to capture screenshot with zero dimensions: width=${rect.width}, height=${rect.height}`);
|
||||
}
|
||||
@ -665,7 +846,7 @@ class BrowsingContextImpl {
|
||||
const sandbox = await this.getOrCreateSandbox(undefined);
|
||||
const result = await sandbox.callFunction(String((element) => {
|
||||
return element instanceof Element;
|
||||
}), { type: 'undefined' }, [clip.element], false, "none" /* Script.ResultOwnership.None */, {});
|
||||
}), false, { type: 'undefined' }, [clip.element]);
|
||||
if (result.type === 'exception') {
|
||||
throw new protocol_js_1.NoSuchElementException(`Element '${clip.element.sharedId}' was not found`);
|
||||
}
|
||||
@ -682,7 +863,7 @@ class BrowsingContextImpl {
|
||||
height: rect.height,
|
||||
width: rect.width,
|
||||
};
|
||||
}), { type: 'undefined' }, [clip.element], false, "none" /* Script.ResultOwnership.None */, {});
|
||||
}), false, { type: 'undefined' }, [clip.element]);
|
||||
(0, assert_js_1.assert)(result.type === 'success');
|
||||
const rect = deserializeDOMRect(result.result);
|
||||
if (!rect) {
|
||||
@ -709,6 +890,300 @@ class BrowsingContextImpl {
|
||||
entryId: entry.id,
|
||||
});
|
||||
}
|
||||
async toggleModulesIfNeeded() {
|
||||
await this.#cdpTarget.toggleNetworkIfNeeded();
|
||||
}
|
||||
async locateNodes(params) {
|
||||
// TODO: create a dedicated sandbox instead of `#defaultRealm`.
|
||||
return await this.#locateNodesByLocator(await this.#defaultRealmDeferred, params.locator, params.startNodes ?? [], params.maxNodeCount, params.serializationOptions);
|
||||
}
|
||||
async #getLocatorDelegate(realm, locator, maxNodeCount, startNodes) {
|
||||
switch (locator.type) {
|
||||
case 'css':
|
||||
return {
|
||||
functionDeclaration: String((cssSelector, maxNodeCount, ...startNodes) => {
|
||||
const locateNodesUsingCss = (element) => {
|
||||
if (!(element instanceof HTMLElement ||
|
||||
element instanceof Document ||
|
||||
element instanceof DocumentFragment)) {
|
||||
throw new Error('startNodes in css selector should be HTMLElement, Document or DocumentFragment');
|
||||
}
|
||||
return [...element.querySelectorAll(cssSelector)];
|
||||
};
|
||||
startNodes = startNodes.length > 0 ? startNodes : [document];
|
||||
const returnedNodes = startNodes
|
||||
.map((startNode) =>
|
||||
// TODO: stop search early if `maxNodeCount` is reached.
|
||||
locateNodesUsingCss(startNode))
|
||||
.flat(1);
|
||||
return maxNodeCount === 0
|
||||
? returnedNodes
|
||||
: returnedNodes.slice(0, maxNodeCount);
|
||||
}),
|
||||
argumentsLocalValues: [
|
||||
// `cssSelector`
|
||||
{ type: 'string', value: locator.value },
|
||||
// `maxNodeCount` with `0` means no limit.
|
||||
{ type: 'number', value: maxNodeCount ?? 0 },
|
||||
// `startNodes`
|
||||
...startNodes,
|
||||
],
|
||||
};
|
||||
case 'xpath':
|
||||
return {
|
||||
functionDeclaration: String((xPathSelector, maxNodeCount, ...startNodes) => {
|
||||
// https://w3c.github.io/webdriver-bidi/#locate-nodes-using-xpath
|
||||
const evaluator = new XPathEvaluator();
|
||||
const expression = evaluator.createExpression(xPathSelector);
|
||||
const locateNodesUsingXpath = (element) => {
|
||||
const xPathResult = expression.evaluate(element, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE);
|
||||
const returnedNodes = [];
|
||||
for (let i = 0; i < xPathResult.snapshotLength; i++) {
|
||||
returnedNodes.push(xPathResult.snapshotItem(i));
|
||||
}
|
||||
return returnedNodes;
|
||||
};
|
||||
startNodes = startNodes.length > 0 ? startNodes : [document];
|
||||
const returnedNodes = startNodes
|
||||
.map((startNode) =>
|
||||
// TODO: stop search early if `maxNodeCount` is reached.
|
||||
locateNodesUsingXpath(startNode))
|
||||
.flat(1);
|
||||
return maxNodeCount === 0
|
||||
? returnedNodes
|
||||
: returnedNodes.slice(0, maxNodeCount);
|
||||
}),
|
||||
argumentsLocalValues: [
|
||||
// `xPathSelector`
|
||||
{ type: 'string', value: locator.value },
|
||||
// `maxNodeCount` with `0` means no limit.
|
||||
{ type: 'number', value: maxNodeCount ?? 0 },
|
||||
// `startNodes`
|
||||
...startNodes,
|
||||
],
|
||||
};
|
||||
case 'innerText':
|
||||
// https://w3c.github.io/webdriver-bidi/#locate-nodes-using-inner-text
|
||||
if (locator.value === '') {
|
||||
throw new protocol_js_1.InvalidSelectorException('innerText locator cannot be empty');
|
||||
}
|
||||
return {
|
||||
functionDeclaration: String((innerTextSelector, fullMatch, ignoreCase, maxNodeCount, maxDepth, ...startNodes) => {
|
||||
const searchText = ignoreCase
|
||||
? innerTextSelector.toUpperCase()
|
||||
: innerTextSelector;
|
||||
const locateNodesUsingInnerText = (node, currentMaxDepth) => {
|
||||
const returnedNodes = [];
|
||||
if (node instanceof DocumentFragment ||
|
||||
node instanceof Document) {
|
||||
const children = [...node.children];
|
||||
children.forEach((child) =>
|
||||
// `currentMaxDepth` is not decremented intentionally according to
|
||||
// https://github.com/w3c/webdriver-bidi/pull/713.
|
||||
returnedNodes.push(...locateNodesUsingInnerText(child, currentMaxDepth)));
|
||||
return returnedNodes;
|
||||
}
|
||||
if (!(node instanceof HTMLElement)) {
|
||||
return [];
|
||||
}
|
||||
const element = node;
|
||||
const nodeInnerText = ignoreCase
|
||||
? element.innerText?.toUpperCase()
|
||||
: element.innerText;
|
||||
if (!nodeInnerText.includes(searchText)) {
|
||||
return [];
|
||||
}
|
||||
const childNodes = [];
|
||||
for (const child of element.children) {
|
||||
if (child instanceof HTMLElement) {
|
||||
childNodes.push(child);
|
||||
}
|
||||
}
|
||||
if (childNodes.length === 0) {
|
||||
if (fullMatch && nodeInnerText === searchText) {
|
||||
returnedNodes.push(element);
|
||||
}
|
||||
else {
|
||||
if (!fullMatch) {
|
||||
// Note: `nodeInnerText.includes(searchText)` is already checked
|
||||
returnedNodes.push(element);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
const childNodeMatches =
|
||||
// Don't search deeper if `maxDepth` is reached.
|
||||
currentMaxDepth <= 0
|
||||
? []
|
||||
: childNodes
|
||||
.map((child) => locateNodesUsingInnerText(child, currentMaxDepth - 1))
|
||||
.flat(1);
|
||||
if (childNodeMatches.length === 0) {
|
||||
// Note: `nodeInnerText.includes(searchText)` is already checked
|
||||
if (!fullMatch || nodeInnerText === searchText) {
|
||||
returnedNodes.push(element);
|
||||
}
|
||||
}
|
||||
else {
|
||||
returnedNodes.push(...childNodeMatches);
|
||||
}
|
||||
}
|
||||
// TODO: stop search early if `maxNodeCount` is reached.
|
||||
return returnedNodes;
|
||||
};
|
||||
// TODO: stop search early if `maxNodeCount` is reached.
|
||||
startNodes = startNodes.length > 0 ? startNodes : [document];
|
||||
const returnedNodes = startNodes
|
||||
.map((startNode) =>
|
||||
// TODO: stop search early if `maxNodeCount` is reached.
|
||||
locateNodesUsingInnerText(startNode, maxDepth))
|
||||
.flat(1);
|
||||
return maxNodeCount === 0
|
||||
? returnedNodes
|
||||
: returnedNodes.slice(0, maxNodeCount);
|
||||
}),
|
||||
argumentsLocalValues: [
|
||||
// `innerTextSelector`
|
||||
{ type: 'string', value: locator.value },
|
||||
// `fullMatch` with default `true`.
|
||||
{ type: 'boolean', value: locator.matchType !== 'partial' },
|
||||
// `ignoreCase` with default `false`.
|
||||
{ type: 'boolean', value: locator.ignoreCase === true },
|
||||
// `maxNodeCount` with `0` means no limit.
|
||||
{ type: 'number', value: maxNodeCount ?? 0 },
|
||||
// `maxDepth` with default `1000` (same as default full serialization depth).
|
||||
{ type: 'number', value: locator.maxDepth ?? 1000 },
|
||||
// `startNodes`
|
||||
...startNodes,
|
||||
],
|
||||
};
|
||||
case 'accessibility': {
|
||||
// https://w3c.github.io/webdriver-bidi/#locate-nodes-using-accessibility-attributes
|
||||
if (!locator.value.name && !locator.value.role) {
|
||||
throw new protocol_js_1.InvalidSelectorException('Either name or role has to be specified');
|
||||
}
|
||||
// The next two commands cause a11y caches for the target to be
|
||||
// preserved. We probably do not need to disable them if the
|
||||
// client is using a11y features, but we could by calling
|
||||
// Accessibility.disable.
|
||||
await Promise.all([
|
||||
this.#cdpTarget.cdpClient.sendCommand('Accessibility.enable'),
|
||||
this.#cdpTarget.cdpClient.sendCommand('Accessibility.getRootAXNode'),
|
||||
]);
|
||||
const bindings = await realm.evaluate(
|
||||
/* expression=*/ '({getAccessibleName, getAccessibleRole})',
|
||||
/* awaitPromise=*/ false, "root" /* Script.ResultOwnership.Root */,
|
||||
/* serializationOptions= */ undefined,
|
||||
/* userActivation=*/ false,
|
||||
/* includeCommandLineApi=*/ true);
|
||||
if (bindings.type !== 'success') {
|
||||
throw new Error('Could not get bindings');
|
||||
}
|
||||
if (bindings.result.type !== 'object') {
|
||||
throw new Error('Could not get bindings');
|
||||
}
|
||||
return {
|
||||
functionDeclaration: String((name, role, bindings, maxNodeCount, ...startNodes) => {
|
||||
const returnedNodes = [];
|
||||
let aborted = false;
|
||||
function collect(contextNodes, selector) {
|
||||
if (aborted) {
|
||||
return;
|
||||
}
|
||||
for (const contextNode of contextNodes) {
|
||||
let match = true;
|
||||
if (selector.role) {
|
||||
const role = bindings.getAccessibleRole(contextNode);
|
||||
if (selector.role !== role) {
|
||||
match = false;
|
||||
}
|
||||
}
|
||||
if (selector.name) {
|
||||
const name = bindings.getAccessibleName(contextNode);
|
||||
if (selector.name !== name) {
|
||||
match = false;
|
||||
}
|
||||
}
|
||||
if (match) {
|
||||
if (maxNodeCount !== 0 &&
|
||||
returnedNodes.length === maxNodeCount) {
|
||||
aborted = true;
|
||||
break;
|
||||
}
|
||||
returnedNodes.push(contextNode);
|
||||
}
|
||||
const childNodes = [];
|
||||
for (const child of contextNode.children) {
|
||||
if (child instanceof HTMLElement) {
|
||||
childNodes.push(child);
|
||||
}
|
||||
}
|
||||
collect(childNodes, selector);
|
||||
}
|
||||
}
|
||||
startNodes =
|
||||
startNodes.length > 0
|
||||
? startNodes
|
||||
: Array.from(document.documentElement.children).filter((c) => c instanceof HTMLElement);
|
||||
collect(startNodes, {
|
||||
role,
|
||||
name,
|
||||
});
|
||||
return returnedNodes;
|
||||
}),
|
||||
argumentsLocalValues: [
|
||||
// `name`
|
||||
{ type: 'string', value: locator.value.name || '' },
|
||||
// `role`
|
||||
{ type: 'string', value: locator.value.role || '' },
|
||||
// `bindings`.
|
||||
{ handle: bindings.result.handle },
|
||||
// `maxNodeCount` with `0` means no limit.
|
||||
{ type: 'number', value: maxNodeCount ?? 0 },
|
||||
// `startNodes`
|
||||
...startNodes,
|
||||
],
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
async #locateNodesByLocator(realm, locator, startNodes, maxNodeCount, serializationOptions) {
|
||||
const locatorDelegate = await this.#getLocatorDelegate(realm, locator, maxNodeCount, startNodes);
|
||||
serializationOptions = {
|
||||
...serializationOptions,
|
||||
// The returned object is an array of nodes, so no need in deeper JS serialization.
|
||||
maxObjectDepth: 1,
|
||||
};
|
||||
const locatorResult = await realm.callFunction(locatorDelegate.functionDeclaration, false, { type: 'undefined' }, locatorDelegate.argumentsLocalValues, "none" /* Script.ResultOwnership.None */, serializationOptions);
|
||||
if (locatorResult.type !== 'success') {
|
||||
this.#logger?.(BrowsingContextImpl.LOGGER_PREFIX, 'Failed locateNodesByLocator', locatorResult);
|
||||
// Heuristic to detect invalid selector for different types of selectors.
|
||||
if (
|
||||
// CSS selector.
|
||||
locatorResult.exceptionDetails.text?.endsWith('is not a valid selector.') ||
|
||||
// XPath selector.
|
||||
locatorResult.exceptionDetails.text?.endsWith('is not a valid XPath expression.')) {
|
||||
throw new protocol_js_1.InvalidSelectorException(`Not valid selector ${typeof locator.value === 'string' ? locator.value : JSON.stringify(locator.value)}`);
|
||||
}
|
||||
// Heuristic to detect if the `startNode` is not an `HTMLElement` in css selector.
|
||||
if (locatorResult.exceptionDetails.text ===
|
||||
'Error: startNodes in css selector should be HTMLElement, Document or DocumentFragment') {
|
||||
throw new protocol_js_1.InvalidArgumentException('startNodes in css selector should be HTMLElement, Document or DocumentFragment');
|
||||
}
|
||||
throw new protocol_js_1.UnknownErrorException(`Unexpected error in selector script: ${locatorResult.exceptionDetails.text}`);
|
||||
}
|
||||
if (locatorResult.result.type !== 'array') {
|
||||
throw new protocol_js_1.UnknownErrorException(`Unexpected selector script result type: ${locatorResult.result.type}`);
|
||||
}
|
||||
// Check there are no non-node elements in the result.
|
||||
const nodes = locatorResult.result.value.map((value) => {
|
||||
if (value.type !== 'node') {
|
||||
throw new protocol_js_1.UnknownErrorException(`Unexpected selector script result element: ${value.type}`);
|
||||
}
|
||||
return value;
|
||||
});
|
||||
return { nodes };
|
||||
}
|
||||
}
|
||||
exports.BrowsingContextImpl = BrowsingContextImpl;
|
||||
function serializeOrigin(origin) {
|
||||
@ -718,7 +1193,6 @@ function serializeOrigin(origin) {
|
||||
}
|
||||
return origin;
|
||||
}
|
||||
exports.serializeOrigin = serializeOrigin;
|
||||
function getImageFormatParameters(params) {
|
||||
const { quality, type } = params.format ?? {
|
||||
type: 'image/png',
|
||||
1
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/modules/context/BrowsingContextImpl.js.map
generated
vendored
Normal file
1
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/modules/context/BrowsingContextImpl.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -1,15 +1,10 @@
|
||||
import type { CdpClient } from '../../../cdp/CdpClient.js';
|
||||
import type { CdpConnection } from '../../../cdp/CdpConnection.js';
|
||||
import { BrowsingContext, type EmptyResult, type Browser } from '../../../protocol/protocol.js';
|
||||
import { type LoggerFn } from '../../../utils/log.js';
|
||||
import type { NetworkStorage } from '../network/NetworkStorage.js';
|
||||
import type { PreloadScriptStorage } from '../script/PreloadScriptStorage.js';
|
||||
import type { RealmStorage } from '../script/RealmStorage.js';
|
||||
import { BrowsingContext, type EmptyResult } from '../../../protocol/protocol.js';
|
||||
import type { EventManager } from '../session/EventManager.js';
|
||||
import type { BrowsingContextStorage } from './BrowsingContextStorage.js';
|
||||
export declare class BrowsingContextProcessor {
|
||||
#private;
|
||||
constructor(cdpConnection: CdpConnection, browserCdpClient: CdpClient, selfTargetId: string, eventManager: EventManager, browsingContextStorage: BrowsingContextStorage, realmStorage: RealmStorage, networkStorage: NetworkStorage, preloadScriptStorage: PreloadScriptStorage, acceptInsecureCerts: boolean, sharedIdWithFrame: boolean, defaultUserContextId: Browser.UserContext, logger?: LoggerFn);
|
||||
constructor(browserCdpClient: CdpClient, browsingContextStorage: BrowsingContextStorage, eventManager: EventManager);
|
||||
getTree(params: BrowsingContext.GetTreeParameters): BrowsingContext.GetTreeResult;
|
||||
create(params: BrowsingContext.CreateParameters): Promise<BrowsingContext.CreateResult>;
|
||||
navigate(params: BrowsingContext.NavigateParameters): Promise<BrowsingContext.NavigateResult>;
|
||||
@ -21,4 +16,5 @@ export declare class BrowsingContextProcessor {
|
||||
traverseHistory(params: BrowsingContext.TraverseHistoryParameters): Promise<BrowsingContext.TraverseHistoryResult>;
|
||||
handleUserPrompt(params: BrowsingContext.HandleUserPromptParameters): Promise<EmptyResult>;
|
||||
close(params: BrowsingContext.CloseParameters): Promise<EmptyResult>;
|
||||
locateNodes(params: BrowsingContext.LocateNodesParameters): Promise<BrowsingContext.LocateNodesResult>;
|
||||
}
|
||||
196
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/modules/context/BrowsingContextProcessor.js
generated
vendored
Normal file
196
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/modules/context/BrowsingContextProcessor.js
generated
vendored
Normal file
@ -0,0 +1,196 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.BrowsingContextProcessor = void 0;
|
||||
const protocol_js_1 = require("../../../protocol/protocol.js");
|
||||
class BrowsingContextProcessor {
|
||||
#browserCdpClient;
|
||||
#browsingContextStorage;
|
||||
#eventManager;
|
||||
constructor(browserCdpClient, browsingContextStorage, eventManager) {
|
||||
this.#browserCdpClient = browserCdpClient;
|
||||
this.#browsingContextStorage = browsingContextStorage;
|
||||
this.#eventManager = eventManager;
|
||||
this.#eventManager.addSubscribeHook(protocol_js_1.ChromiumBidi.BrowsingContext.EventNames.ContextCreated, this.#onContextCreatedSubscribeHook.bind(this));
|
||||
}
|
||||
getTree(params) {
|
||||
const resultContexts = params.root === undefined
|
||||
? this.#browsingContextStorage.getTopLevelContexts()
|
||||
: [this.#browsingContextStorage.getContext(params.root)];
|
||||
return {
|
||||
contexts: resultContexts.map((c) => c.serializeToBidiValue(params.maxDepth ?? Number.MAX_VALUE)),
|
||||
};
|
||||
}
|
||||
async create(params) {
|
||||
let referenceContext;
|
||||
let userContext = 'default';
|
||||
if (params.referenceContext !== undefined) {
|
||||
referenceContext = this.#browsingContextStorage.getContext(params.referenceContext);
|
||||
if (!referenceContext.isTopLevelContext()) {
|
||||
throw new protocol_js_1.InvalidArgumentException(`referenceContext should be a top-level context`);
|
||||
}
|
||||
userContext = referenceContext.userContext;
|
||||
}
|
||||
if (params.userContext !== undefined) {
|
||||
userContext = params.userContext;
|
||||
}
|
||||
const existingContexts = this.#browsingContextStorage
|
||||
.getAllContexts()
|
||||
.filter((context) => context.userContext === userContext);
|
||||
let newWindow = false;
|
||||
switch (params.type) {
|
||||
case "tab" /* BrowsingContext.CreateType.Tab */:
|
||||
newWindow = false;
|
||||
break;
|
||||
case "window" /* BrowsingContext.CreateType.Window */:
|
||||
newWindow = true;
|
||||
break;
|
||||
}
|
||||
if (!existingContexts.length) {
|
||||
// If there are no contexts in the given user context, we need to set
|
||||
// newWindow to true as newWindow=false will be rejected.
|
||||
newWindow = true;
|
||||
}
|
||||
let result;
|
||||
try {
|
||||
result = await this.#browserCdpClient.sendCommand('Target.createTarget', {
|
||||
url: 'about:blank',
|
||||
newWindow,
|
||||
browserContextId: userContext === 'default' ? undefined : userContext,
|
||||
background: params.background === true,
|
||||
});
|
||||
}
|
||||
catch (err) {
|
||||
if (
|
||||
// See https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/devtools/protocol/target_handler.cc;l=90;drc=e80392ac11e48a691f4309964cab83a3a59e01c8
|
||||
err.message.startsWith('Failed to find browser context with id') ||
|
||||
// See https://source.chromium.org/chromium/chromium/src/+/main:headless/lib/browser/protocol/target_handler.cc;l=49;drc=e80392ac11e48a691f4309964cab83a3a59e01c8
|
||||
err.message === 'browserContextId') {
|
||||
throw new protocol_js_1.NoSuchUserContextException(`The context ${userContext} was not found`);
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
// Wait for the new tab to be loaded to avoid race conditions in the
|
||||
// `browsingContext` events, when the `browsingContext.domContentLoaded` and
|
||||
// `browsingContext.load` events from the initial `about:blank` navigation
|
||||
// are emitted after the next navigation is started.
|
||||
// Details: https://github.com/web-platform-tests/wpt/issues/35846
|
||||
const contextId = result.targetId;
|
||||
const context = this.#browsingContextStorage.getContext(contextId);
|
||||
await context.lifecycleLoaded();
|
||||
return { context: context.id };
|
||||
}
|
||||
navigate(params) {
|
||||
const context = this.#browsingContextStorage.getContext(params.context);
|
||||
return context.navigate(params.url, params.wait ?? "none" /* BrowsingContext.ReadinessState.None */);
|
||||
}
|
||||
reload(params) {
|
||||
const context = this.#browsingContextStorage.getContext(params.context);
|
||||
return context.reload(params.ignoreCache ?? false, params.wait ?? "none" /* BrowsingContext.ReadinessState.None */);
|
||||
}
|
||||
async activate(params) {
|
||||
const context = this.#browsingContextStorage.getContext(params.context);
|
||||
if (!context.isTopLevelContext()) {
|
||||
throw new protocol_js_1.InvalidArgumentException('Activation is only supported on the top-level context');
|
||||
}
|
||||
await context.activate();
|
||||
return {};
|
||||
}
|
||||
async captureScreenshot(params) {
|
||||
const context = this.#browsingContextStorage.getContext(params.context);
|
||||
return await context.captureScreenshot(params);
|
||||
}
|
||||
async print(params) {
|
||||
const context = this.#browsingContextStorage.getContext(params.context);
|
||||
return await context.print(params);
|
||||
}
|
||||
async setViewport(params) {
|
||||
const context = this.#browsingContextStorage.getContext(params.context);
|
||||
if (!context.isTopLevelContext()) {
|
||||
throw new protocol_js_1.InvalidArgumentException('Emulating viewport is only supported on the top-level context');
|
||||
}
|
||||
await context.setViewport(params.viewport, params.devicePixelRatio);
|
||||
return {};
|
||||
}
|
||||
async traverseHistory(params) {
|
||||
const context = this.#browsingContextStorage.getContext(params.context);
|
||||
if (!context) {
|
||||
throw new protocol_js_1.InvalidArgumentException(`No browsing context with id ${params.context}`);
|
||||
}
|
||||
await context.traverseHistory(params.delta);
|
||||
return {};
|
||||
}
|
||||
async handleUserPrompt(params) {
|
||||
const context = this.#browsingContextStorage.getContext(params.context);
|
||||
try {
|
||||
await context.handleUserPrompt(params.accept, params.userText);
|
||||
}
|
||||
catch (error) {
|
||||
// Heuristically determine the error
|
||||
// https://source.chromium.org/chromium/chromium/src/+/main:content/browser/devtools/protocol/page_handler.cc;l=1085?q=%22No%20dialog%20is%20showing%22&ss=chromium
|
||||
if (error.message?.includes('No dialog is showing')) {
|
||||
throw new protocol_js_1.NoSuchAlertException('No dialog is showing');
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
return {};
|
||||
}
|
||||
async close(params) {
|
||||
const context = this.#browsingContextStorage.getContext(params.context);
|
||||
if (!context.isTopLevelContext()) {
|
||||
throw new protocol_js_1.InvalidArgumentException(`Non top-level browsing context ${context.id} cannot be closed.`);
|
||||
}
|
||||
try {
|
||||
const detachedFromTargetPromise = new Promise((resolve) => {
|
||||
const onContextDestroyed = (event) => {
|
||||
if (event.targetId === params.context) {
|
||||
this.#browserCdpClient.off('Target.detachedFromTarget', onContextDestroyed);
|
||||
resolve();
|
||||
}
|
||||
};
|
||||
this.#browserCdpClient.on('Target.detachedFromTarget', onContextDestroyed);
|
||||
});
|
||||
if (params.promptUnload) {
|
||||
await context.close();
|
||||
}
|
||||
else {
|
||||
await this.#browserCdpClient.sendCommand('Target.closeTarget', {
|
||||
targetId: params.context,
|
||||
});
|
||||
}
|
||||
// Sometimes CDP command finishes before `detachedFromTarget` event,
|
||||
// sometimes after. Wait for the CDP command to be finished, and then wait
|
||||
// for `detachedFromTarget` if it hasn't emitted.
|
||||
await detachedFromTargetPromise;
|
||||
}
|
||||
catch (error) {
|
||||
// Swallow error that arise from the page being destroyed
|
||||
// Example is navigating to faulty SSL certificate
|
||||
if (!(error.code === -32000 /* CdpErrorConstants.GENERIC_ERROR */ &&
|
||||
error.message === 'Not attached to an active page')) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
return {};
|
||||
}
|
||||
async locateNodes(params) {
|
||||
const context = this.#browsingContextStorage.getContext(params.context);
|
||||
return await context.locateNodes(params);
|
||||
}
|
||||
#onContextCreatedSubscribeHook(contextId) {
|
||||
const context = this.#browsingContextStorage.getContext(contextId);
|
||||
const contextsToReport = [
|
||||
context,
|
||||
...this.#browsingContextStorage.getContext(contextId).allChildren,
|
||||
];
|
||||
contextsToReport.forEach((context) => {
|
||||
this.#eventManager.registerEvent({
|
||||
type: 'event',
|
||||
method: protocol_js_1.ChromiumBidi.BrowsingContext.EventNames.ContextCreated,
|
||||
params: context.serializeToBidiValue(),
|
||||
}, context.id);
|
||||
});
|
||||
return Promise.resolve();
|
||||
}
|
||||
}
|
||||
exports.BrowsingContextProcessor = BrowsingContextProcessor;
|
||||
//# sourceMappingURL=BrowsingContextProcessor.js.map
|
||||
1
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/modules/context/BrowsingContextProcessor.js.map
generated
vendored
Normal file
1
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/modules/context/BrowsingContextProcessor.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -38,4 +38,5 @@ export declare class BrowsingContextStorage {
|
||||
findContextBySession(sessionId: string): BrowsingContextImpl | undefined;
|
||||
/** Gets the context with the given ID, if any, otherwise throws. */
|
||||
getContext(id: BrowsingContext.BrowsingContext): BrowsingContextImpl;
|
||||
verifyTopLevelContextsList(contexts: BrowsingContext.BrowsingContext[] | undefined): Set<BrowsingContextImpl>;
|
||||
}
|
||||
@ -78,6 +78,22 @@ class BrowsingContextStorage {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
verifyTopLevelContextsList(contexts) {
|
||||
const foundContexts = new Set();
|
||||
if (!contexts) {
|
||||
return foundContexts;
|
||||
}
|
||||
for (const contextId of contexts) {
|
||||
const context = this.getContext(contextId);
|
||||
if (context.isTopLevelContext()) {
|
||||
foundContexts.add(context);
|
||||
}
|
||||
else {
|
||||
throw new protocol_js_1.InvalidArgumentException(`Non top-level context '${contextId}' given.`);
|
||||
}
|
||||
}
|
||||
return foundContexts;
|
||||
}
|
||||
}
|
||||
exports.BrowsingContextStorage = BrowsingContextStorage;
|
||||
//# sourceMappingURL=BrowsingContextStorage.js.map
|
||||
@ -1 +1 @@
|
||||
{"version":3,"file":"BrowsingContextStorage.js","sourceRoot":"","sources":["../../../../../src/bidiMapper/domains/context/BrowsingContextStorage.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH,+DAGuC;AAIvC,6CAA6C;AAC7C,MAAa,sBAAsB;IACjC,qDAAqD;IAC5C,SAAS,GAAG,IAAI,GAAG,EAGzB,CAAC;IAEJ,8DAA8D;IAC9D,mBAAmB;QACjB,OAAO,IAAI,CAAC,cAAc,EAAE,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAC9C,OAAO,CAAC,iBAAiB,EAAE,CAC5B,CAAC;IACJ,CAAC;IAED,yBAAyB;IACzB,cAAc;QACZ,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC;IAC7C,CAAC;IAED,6CAA6C;IAC7C,iBAAiB,CAAC,EAAmC;QACnD,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAC5B,CAAC;IAED,iCAAiC;IACjC,aAAa,CA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AK,SAAS,EAAE,CAAC;YACzB,MAAM,IAAI,kCAAoB,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;QAC5D,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AA9ED,wDA8EC"}
|
||||
{"version":3,"file":"BrowsingContextStorage.js","sourceRoot":"","sources":["../../../../../src/bidiMapper/modules/context/BrowsingContextStorage.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH,+DAIuC;AAIvC,6CAA6C;AAC7C,MAAa,sBAAsB;IACjC,qDAAqD;IAC5C,SAAS,GAAG,IAAI,GAAG,EAGzB,CAAC;IAEJ,8DAA8D;IAC9D,mBAAmB;QACjB,OAAO,IAAI,CAAC,cAAc,EAAE,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAC9C,OAAO,CAAC,iBAAiB,EAAE,CAC5B,CAAC;IACJ,CAAC;IAED,yBAAyB;IACzB,cAAc;QACZ,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC;IAC7C,CAAC;IAED,6CAA6C;IAC7C,iBAAiB,CAAC,EAAmC;QACnD,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAC5B,CAAC;IAED,iCAAiC;IACjC,aAAa,CAAC,OAA4B;QACxC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IACpC,CAAC;IAED,gCAAgC;IAChC,UAAU,CAAC,OAA4B;QACrC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;IAC1C,CAAC;IAED,2EAA2E;IAC3E,UAAU,CAAC,EAAmC;QAC5C,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChC,CAAC;IAED,kDAAkD;IAClD,WAAW,CACT,EAAmC;QAEnC,OA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AC3C,IAAI,OAAO,CAAC,iBAAiB,EAAE,EAAE,CAAC;gBAChC,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YAC7B,CAAC;iBAAM,CAAC;gBACN,MAAM,IAAI,sCAAwB,CAChC,0BAA0B,SAAS,UAAU,CAC9C,CAAC;YACJ,CAAC;QACH,CAAC;QACD,OAAO,aAAa,CAAC;IACvB,CAAC;CACF;AAnGD,wDAmGC"}
|
||||
@ -19,6 +19,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ActionDispatcher = void 0;
|
||||
const protocol_js_1 = require("../../../protocol/protocol.js");
|
||||
const assert_js_1 = require("../../../utils/assert.js");
|
||||
const GraphemeTools_1 = require("../../../utils/GraphemeTools");
|
||||
const InputSource_js_1 = require("./InputSource.js");
|
||||
const keyUtils_js_1 = require("./keyUtils.js");
|
||||
const USKeyboardLayout_js_1 = require("./USKeyboardLayout.js");
|
||||
@ -32,7 +33,7 @@ const IS_MAC_DECL = (() => {
|
||||
}).toString();
|
||||
async function getElementCenter(context, element) {
|
||||
const sandbox = await context.getOrCreateSandbox(undefined);
|
||||
const result = await sandbox.callFunction(CALCULATE_IN_VIEW_CENTER_PT_DECL, { type: 'undefined' }, [element], false, "none" /* Script.ResultOwnership.None */, {});
|
||||
const result = await sandbox.callFunction(CALCULATE_IN_VIEW_CENTER_PT_DECL, false, { type: 'undefined' }, [element]);
|
||||
if (result.type === 'exception') {
|
||||
throw new protocol_js_1.NoSuchElementException(`Origin element ${element.sharedId} was not found`);
|
||||
}
|
||||
@ -44,7 +45,7 @@ async function getElementCenter(context, element) {
|
||||
}
|
||||
class ActionDispatcher {
|
||||
static isMacOS = async (context) => {
|
||||
const result = await (await context.getOrCreateSandbox(undefined)).callFunction(IS_MAC_DECL, { type: 'undefined' }, [], false, "none" /* Script.ResultOwnership.None */, {});
|
||||
const result = await (await context.getOrCreateSandbox(undefined)).callFunction(IS_MAC_DECL, false);
|
||||
(0, assert_js_1.assert)(result.type !== 'exception');
|
||||
(0, assert_js_1.assert)(result.result.type === 'boolean');
|
||||
return result.result.value;
|
||||
@ -139,7 +140,7 @@ class ActionDispatcher {
|
||||
}
|
||||
}
|
||||
}
|
||||
#dispatchPointerDownAction(source, keyState, action) {
|
||||
async #dispatchPointerDownAction(source, keyState, action) {
|
||||
const { button } = action;
|
||||
if (source.pressed.has(button)) {
|
||||
return;
|
||||
@ -150,11 +151,12 @@ class ActionDispatcher {
|
||||
const { tiltX, tiltY } = getTilt(action);
|
||||
// --- Platform-specific code begins here ---
|
||||
const { modifiers } = keyState;
|
||||
const { radiusX, radiusY } = getRadii(width ?? 1, height ?? 1);
|
||||
switch (pointerType) {
|
||||
case "mouse" /* Input.PointerType.Mouse */:
|
||||
case "pen" /* Input.PointerType.Pen */:
|
||||
// TODO: Implement width and height when available.
|
||||
return this.#context.cdpTarget.cdpClient.sendCommand('Input.dispatchMouseEvent', {
|
||||
await this.#context.cdpTarget.cdpClient.sendCommand('Input.dispatchMouseEvent', {
|
||||
type: 'mousePressed',
|
||||
x,
|
||||
y,
|
||||
@ -169,14 +171,16 @@ class ActionDispatcher {
|
||||
twist,
|
||||
force: pressure,
|
||||
});
|
||||
break;
|
||||
case "touch" /* Input.PointerType.Touch */:
|
||||
return this.#context.cdpTarget.cdpClient.sendCommand('Input.dispatchTouchEvent', {
|
||||
await this.#context.cdpTarget.cdpClient.sendCommand('Input.dispatchTouchEvent', {
|
||||
type: 'touchStart',
|
||||
touchPoints: [
|
||||
{
|
||||
x,
|
||||
y,
|
||||
...getRadii(width ?? 1, height ?? 1),
|
||||
radiusX,
|
||||
radiusY,
|
||||
tangentialPressure,
|
||||
tiltX,
|
||||
tiltY,
|
||||
@ -187,7 +191,11 @@ class ActionDispatcher {
|
||||
],
|
||||
modifiers,
|
||||
});
|
||||
break;
|
||||
}
|
||||
source.radiusX = radiusX;
|
||||
source.radiusY = radiusY;
|
||||
source.force = pressure;
|
||||
// --- Platform-specific code ends here ---
|
||||
}
|
||||
#dispatchPointerUpAction(source, keyState, action) {
|
||||
@ -196,7 +204,7 @@ class ActionDispatcher {
|
||||
return;
|
||||
}
|
||||
source.pressed.delete(button);
|
||||
const { x, y, subtype: pointerType } = source;
|
||||
const { x, y, force, radiusX, radiusY, subtype: pointerType } = source;
|
||||
// --- Platform-specific code begins here ---
|
||||
const { modifiers } = keyState;
|
||||
switch (pointerType) {
|
||||
@ -221,6 +229,9 @@ class ActionDispatcher {
|
||||
x,
|
||||
y,
|
||||
id: source.pointerId,
|
||||
force,
|
||||
radiusX,
|
||||
radiusY,
|
||||
},
|
||||
],
|
||||
modifiers,
|
||||
@ -232,6 +243,7 @@ class ActionDispatcher {
|
||||
const { x: startX, y: startY, subtype: pointerType } = source;
|
||||
const { width, height, pressure, twist, tangentialPressure, x: offsetX, y: offsetY, origin = 'viewport', duration = this.#tickDuration, } = action;
|
||||
const { tiltX, tiltY } = getTilt(action);
|
||||
const { radiusX, radiusY } = getRadii(width ?? 1, height ?? 1);
|
||||
const { targetX, targetY } = await this.#getCoordinateFromOrigin(origin, offsetX, offsetY, startX, startY);
|
||||
if (targetX < 0 || targetY < 0) {
|
||||
throw new protocol_js_1.MoveTargetOutOfBoundsException(`Cannot move beyond viewport (x: ${targetX}, y: ${targetY})`);
|
||||
@ -274,6 +286,12 @@ class ActionDispatcher {
|
||||
break;
|
||||
case "pen" /* Input.PointerType.Pen */:
|
||||
if (source.pressed.size !== 0) {
|
||||
// Empty `source.pressed.size` means the pen is not detected by digitizer.
|
||||
// Dispatch a mouse event for the pen only if either:
|
||||
// 1. the pen is hovering over the digitizer (0);
|
||||
// 2. the pen is in contact with the digitizer (1);
|
||||
// 3. the pen has at least one button pressed (2, 4, etc).
|
||||
// https://www.w3.org/TR/pointerevents/#the-buttons-property
|
||||
// TODO: Implement width and height when available.
|
||||
await this.#context.cdpTarget.cdpClient.sendCommand('Input.dispatchMouseEvent', {
|
||||
type: 'mouseMoved',
|
||||
@ -288,7 +306,7 @@ class ActionDispatcher {
|
||||
tiltX,
|
||||
tiltY,
|
||||
twist,
|
||||
force: pressure,
|
||||
force: pressure ?? 0.5,
|
||||
});
|
||||
}
|
||||
break;
|
||||
@ -300,7 +318,8 @@ class ActionDispatcher {
|
||||
{
|
||||
x,
|
||||
y,
|
||||
...getRadii(width ?? 1, height ?? 1),
|
||||
radiusX,
|
||||
radiusY,
|
||||
tangentialPressure,
|
||||
tiltX,
|
||||
tiltY,
|
||||
@ -317,6 +336,9 @@ class ActionDispatcher {
|
||||
// --- Platform-specific code ends here ---
|
||||
source.x = x;
|
||||
source.y = y;
|
||||
source.radiusX = radiusX;
|
||||
source.radiusY = radiusY;
|
||||
source.force = pressure;
|
||||
}
|
||||
} while (!last);
|
||||
}
|
||||
@ -385,10 +407,13 @@ class ActionDispatcher {
|
||||
} while (!last);
|
||||
}
|
||||
async #dispatchKeyDownAction(source, action) {
|
||||
if ([...action.value].length > 1) {
|
||||
throw new protocol_js_1.InvalidArgumentException(`Invalid key value: ${action.value}`);
|
||||
}
|
||||
const rawKey = action.value;
|
||||
if (!(0, GraphemeTools_1.isSingleGrapheme)(rawKey)) {
|
||||
// https://w3c.github.io/webdriver/#dfn-process-a-key-action
|
||||
// WebDriver spec allows a grapheme to be used.
|
||||
throw new protocol_js_1.InvalidArgumentException(`Invalid key value: ${rawKey}`);
|
||||
}
|
||||
const isGrapheme = (0, GraphemeTools_1.isSingleComplexGrapheme)(rawKey);
|
||||
const key = (0, keyUtils_js_1.getNormalizedKey)(rawKey);
|
||||
const repeat = source.pressed.has(key);
|
||||
const code = (0, keyUtils_js_1.getKeyCode)(rawKey);
|
||||
@ -412,7 +437,7 @@ class ActionDispatcher {
|
||||
// --- Platform-specific code begins here ---
|
||||
// The spread is a little hack so JS gives us an array of unicode characters
|
||||
// to measure.
|
||||
const unmodifiedText = getKeyEventUnmodifiedText(key, source);
|
||||
const unmodifiedText = getKeyEventUnmodifiedText(key, source, isGrapheme);
|
||||
const text = getKeyEventText(code ?? '', source) ?? unmodifiedText;
|
||||
let command;
|
||||
// The following commands need to be declared because Chromium doesn't
|
||||
@ -466,10 +491,13 @@ class ActionDispatcher {
|
||||
// --- Platform-specific code ends here ---
|
||||
}
|
||||
#dispatchKeyUpAction(source, action) {
|
||||
if ([...action.value].length > 1) {
|
||||
throw new protocol_js_1.InvalidArgumentException(`Invalid key value: ${action.value}`);
|
||||
}
|
||||
const rawKey = action.value;
|
||||
if (!(0, GraphemeTools_1.isSingleGrapheme)(rawKey)) {
|
||||
// https://w3c.github.io/webdriver/#dfn-process-a-key-action
|
||||
// WebDriver spec allows a grapheme to be used.
|
||||
throw new protocol_js_1.InvalidArgumentException(`Invalid key value: ${rawKey}`);
|
||||
}
|
||||
const isGrapheme = (0, GraphemeTools_1.isSingleComplexGrapheme)(rawKey);
|
||||
const key = (0, keyUtils_js_1.getNormalizedKey)(rawKey);
|
||||
if (!source.pressed.has(key)) {
|
||||
return;
|
||||
@ -495,7 +523,7 @@ class ActionDispatcher {
|
||||
// --- Platform-specific code begins here ---
|
||||
// The spread is a little hack so JS gives us an array of unicode characters
|
||||
// to measure.
|
||||
const unmodifiedText = getKeyEventUnmodifiedText(key, source);
|
||||
const unmodifiedText = getKeyEventUnmodifiedText(key, source, isGrapheme);
|
||||
const text = getKeyEventText(code ?? '', source) ?? unmodifiedText;
|
||||
return this.#context.cdpTarget.cdpClient.sendCommand('Input.dispatchKeyEvent', {
|
||||
type: 'keyUp',
|
||||
@ -513,10 +541,20 @@ class ActionDispatcher {
|
||||
}
|
||||
}
|
||||
exports.ActionDispatcher = ActionDispatcher;
|
||||
const getKeyEventUnmodifiedText = (key, source) => {
|
||||
/**
|
||||
* Translates a non-grapheme key to either an `undefined` for a special keys, or a single
|
||||
* character modified by shift if needed.
|
||||
*/
|
||||
const getKeyEventUnmodifiedText = (key, source, isGrapheme) => {
|
||||
if (isGrapheme) {
|
||||
// Graphemes should be presented as text in the CDP command.
|
||||
return key;
|
||||
}
|
||||
if (key === 'Enter') {
|
||||
return '\r';
|
||||
}
|
||||
// If key is not a single character, it is a normalized key value, and should be
|
||||
// presented as key, not text in the CDP command.
|
||||
return [...key].length === 1
|
||||
? source.shift
|
||||
? key.toLocaleUpperCase('en-US')
|
||||
@ -605,6 +643,7 @@ const getKeyEventText = (code, source) => {
|
||||
return;
|
||||
};
|
||||
function getCdpButton(button) {
|
||||
// https://www.w3.org/TR/pointerevents/#the-button-property
|
||||
switch (button) {
|
||||
case 0:
|
||||
return 'left';
|
||||
@ -622,7 +661,7 @@ function getCdpButton(button) {
|
||||
}
|
||||
function getTilt(action) {
|
||||
// https://w3c.github.io/pointerevents/#converting-between-tiltx-tilty-and-altitudeangle-azimuthangle
|
||||
const altitudeAngle = action.altitudeAngle ?? 0;
|
||||
const altitudeAngle = action.altitudeAngle ?? Math.PI / 2;
|
||||
const azimuthAngle = action.azimuthAngle ?? 0;
|
||||
let tiltXRadians = 0;
|
||||
let tiltYRadians = 0;
|
||||
1
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/modules/input/ActionDispatcher.js.map
generated
vendored
Normal file
1
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/modules/input/ActionDispatcher.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/modules/input/ActionOption.js.map
generated
vendored
Normal file
1
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/modules/input/ActionOption.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"ActionOption.js","sourceRoot":"","sources":["../../../../../src/bidiMapper/modules/input/ActionOption.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG"}
|
||||
@ -1,9 +1,8 @@
|
||||
import { Input, type EmptyResult } from '../../../protocol/protocol.js';
|
||||
import type { BrowsingContextStorage } from '../context/BrowsingContextStorage.js';
|
||||
import type { RealmStorage } from '../script/RealmStorage.js';
|
||||
export declare class InputProcessor {
|
||||
#private;
|
||||
constructor(browsingContextStorage: BrowsingContextStorage, realmStorage: RealmStorage);
|
||||
constructor(browsingContextStorage: BrowsingContextStorage);
|
||||
performActions(params: Input.PerformActionsParameters): Promise<EmptyResult>;
|
||||
releaseActions(params: Input.ReleaseActionsParameters): Promise<EmptyResult>;
|
||||
setFiles(params: Input.SetFilesParameters): Promise<EmptyResult>;
|
||||
@ -23,11 +23,9 @@ const ActionDispatcher_js_1 = require("../input/ActionDispatcher.js");
|
||||
const InputStateManager_js_1 = require("../input/InputStateManager.js");
|
||||
class InputProcessor {
|
||||
#browsingContextStorage;
|
||||
#realmStorage;
|
||||
#inputStateManager = new InputStateManager_js_1.InputStateManager();
|
||||
constructor(browsingContextStorage, realmStorage) {
|
||||
constructor(browsingContextStorage) {
|
||||
this.#browsingContextStorage = browsingContextStorage;
|
||||
this.#realmStorage = realmStorage;
|
||||
}
|
||||
async performActions(params) {
|
||||
const context = this.#browsingContextStorage.getContext(params.context);
|
||||
@ -47,40 +45,81 @@ class InputProcessor {
|
||||
return {};
|
||||
}
|
||||
async setFiles(params) {
|
||||
const realm = this.#realmStorage.findRealm({
|
||||
browsingContextId: params.context,
|
||||
});
|
||||
if (realm === undefined) {
|
||||
throw new protocol_js_1.NoSuchFrameException(`Could not find browsingContext ${params.context}`);
|
||||
}
|
||||
let isFileInput;
|
||||
const context = this.#browsingContextStorage.getContext(params.context);
|
||||
const realm = await context.getOrCreateSandbox(undefined);
|
||||
let result;
|
||||
try {
|
||||
const result = await realm.callFunction(String(function getFiles() {
|
||||
return (this instanceof HTMLInputElement &&
|
||||
this.type === 'file' &&
|
||||
!this.disabled);
|
||||
}), params.element, [], false, "none" /* Script.ResultOwnership.None */, {}, false);
|
||||
(0, assert_js_1.assert)(result.type === 'success');
|
||||
(0, assert_js_1.assert)(result.result.type === 'boolean');
|
||||
isFileInput = result.result.value;
|
||||
result = await realm.callFunction(String(function getFiles(fileListLength) {
|
||||
if (!(this instanceof HTMLInputElement)) {
|
||||
if (this instanceof Element) {
|
||||
return 1 /* ErrorCode.Element */;
|
||||
}
|
||||
return 0 /* ErrorCode.Node */;
|
||||
}
|
||||
if (this.type !== 'file') {
|
||||
return 2 /* ErrorCode.Type */;
|
||||
}
|
||||
if (this.disabled) {
|
||||
return 3 /* ErrorCode.Disabled */;
|
||||
}
|
||||
if (fileListLength > 1 && !this.multiple) {
|
||||
return 4 /* ErrorCode.Multiple */;
|
||||
}
|
||||
return;
|
||||
}), false, params.element, [{ type: 'number', value: params.files.length }]);
|
||||
}
|
||||
catch {
|
||||
throw new protocol_js_1.NoSuchElementException(`Could not find element ${params.element.sharedId}`);
|
||||
throw new protocol_js_1.NoSuchNodeException(`Could not find element ${params.element.sharedId}`);
|
||||
}
|
||||
if (!isFileInput) {
|
||||
throw new protocol_js_1.UnableToSetFileInputException(`Element ${params.element.sharedId} is not a mutable file input.`);
|
||||
(0, assert_js_1.assert)(result.type === 'success');
|
||||
if (result.result.type === 'number') {
|
||||
switch (result.result.value) {
|
||||
case 0 /* ErrorCode.Node */: {
|
||||
throw new protocol_js_1.NoSuchElementException(`Could not find element ${params.element.sharedId}`);
|
||||
}
|
||||
case 1 /* ErrorCode.Element */: {
|
||||
throw new protocol_js_1.UnableToSetFileInputException(`Element ${params.element.sharedId} is not a input`);
|
||||
}
|
||||
case 2 /* ErrorCode.Type */: {
|
||||
throw new protocol_js_1.UnableToSetFileInputException(`Input element ${params.element.sharedId} is not a file type`);
|
||||
}
|
||||
case 3 /* ErrorCode.Disabled */: {
|
||||
throw new protocol_js_1.UnableToSetFileInputException(`Input element ${params.element.sharedId} is disabled`);
|
||||
}
|
||||
case 4 /* ErrorCode.Multiple */: {
|
||||
throw new protocol_js_1.UnableToSetFileInputException(`Cannot set multiple files on a non-multiple input element`);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* The zero-length array is a special case, it seems that
|
||||
* DOM.setFileInputFiles does not actually update the files in that case, so
|
||||
* the solution is to eval the element value to a new FileList directly.
|
||||
*/
|
||||
if (params.files.length === 0) {
|
||||
// XXX: These events should converted to trusted events. Perhaps do this
|
||||
// in `DOM.setFileInputFiles`?
|
||||
await realm.callFunction(String(function dispatchEvent() {
|
||||
if (this.files?.length === 0) {
|
||||
this.dispatchEvent(new Event('cancel', {
|
||||
bubbles: true,
|
||||
}));
|
||||
return;
|
||||
}
|
||||
this.files = new DataTransfer().files;
|
||||
// Dispatch events for this case because it should behave akin to a user action.
|
||||
this.dispatchEvent(new Event('input', { bubbles: true, composed: true }));
|
||||
this.dispatchEvent(new Event('change', { bubbles: true }));
|
||||
}), false, params.element);
|
||||
return {};
|
||||
}
|
||||
// Our goal here is to iterate over the input element files and get their
|
||||
// file paths.
|
||||
const paths = [];
|
||||
for (let i = 0; i < params.files.length; ++i) {
|
||||
const result = await realm.callFunction(String(function getFiles(index) {
|
||||
if (!this.files) {
|
||||
// We use `null` because `item` also returns null.
|
||||
return null;
|
||||
}
|
||||
return this.files.item(index);
|
||||
}), params.element, [{ type: 'number', value: 0 }], false, "root" /* Script.ResultOwnership.Root */, {}, false);
|
||||
return this.files?.item(index);
|
||||
}), false, params.element, [{ type: 'number', value: 0 }], "root" /* Script.ResultOwnership.Root */);
|
||||
(0, assert_js_1.assert)(result.type === 'success');
|
||||
if (result.result.type !== 'object') {
|
||||
break;
|
||||
@ -115,7 +154,7 @@ class InputProcessor {
|
||||
this.dispatchEvent(new Event('cancel', {
|
||||
bubbles: true,
|
||||
}));
|
||||
}), params.element, [], false, "none" /* Script.ResultOwnership.None */, {}, false);
|
||||
}), false, params.element);
|
||||
}
|
||||
return {};
|
||||
}
|
||||
1
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/modules/input/InputProcessor.js.map
generated
vendored
Normal file
1
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/modules/input/InputProcessor.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -46,18 +46,21 @@ export declare class PointerSource {
|
||||
pressed: Set<number>;
|
||||
x: number;
|
||||
y: number;
|
||||
radiusX?: number;
|
||||
radiusY?: number;
|
||||
force?: number;
|
||||
constructor(id: number, subtype: Input.PointerType);
|
||||
get buttons(): number;
|
||||
static ClickContext: {
|
||||
new (x: number, y: number, time: number): {
|
||||
count: number;
|
||||
"__#89102@#x": number;
|
||||
"__#89102@#y": number;
|
||||
"__#89102@#time": number;
|
||||
"__#92359@#x": number;
|
||||
"__#92359@#y": number;
|
||||
"__#92359@#time": number;
|
||||
compare(context: any): boolean;
|
||||
};
|
||||
"__#89102@#DOUBLE_CLICK_TIME_MS": number;
|
||||
"__#89102@#MAX_DOUBLE_CLICK_RADIUS": number;
|
||||
"__#92359@#DOUBLE_CLICK_TIME_MS": number;
|
||||
"__#92359@#MAX_DOUBLE_CLICK_RADIUS": number;
|
||||
};
|
||||
setClickCount(button: number, context: InstanceType<typeof PointerSource.ClickContext>): number;
|
||||
getClickCount(button: number): number;
|
||||
@ -71,6 +71,9 @@ class PointerSource {
|
||||
pressed = new Set();
|
||||
x = 0;
|
||||
y = 0;
|
||||
radiusX;
|
||||
radiusY;
|
||||
force;
|
||||
constructor(id, subtype) {
|
||||
this.pointerId = id;
|
||||
this.subtype = subtype;
|
||||
1
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/modules/input/InputSource.js.map
generated
vendored
Normal file
1
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/modules/input/InputSource.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"InputSource.js","sourceRoot":"","sources":["../../../../../src/bidiMapper/modules/input/InputSource.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAWH,MAAa,UAAU;IACrB,IAAI,GAAG,4BAAwB,CAAC;CACjC;AAFD,gCAEC;AACD,MAAa,SAAS;IACpB,IAAI,GAAG,0BAAuB,CAAC;IAC/B,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;IAE5B,6DAA6D;IAC7D,wFAAwF;IACxF,UAAU,GAAG,CAAC,CAAC;IACf,IAAI,SAAS;Q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YAC3B,OAAO;YACL,uDAAuD;YACvD,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,GAAG,YAAY,CAAC,qBAAqB;gBAC/D,wDAAwD;gBACxD,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;oBAC5B,YAAY,CAAC,wBAAwB;gBACvC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,YAAY,CAAC,wBAAwB,CACvE,CAAC;QACJ,CAAC;KACF,CAAC;IAEF,cAAc,GAAG,IAAI,GAAG,EAGrB,CAAC;IAEJ,aAAa,CACX,MAAc,EACd,OAAwD;QAExD,IAAI,aAAa,GAAG,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACpD,IAAI,CAAC,aAAa,IAAI,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;YACrD,aAAa,GAAG,OAAO,CAAC;QAC1B,CAAC;QACD,EAAE,aAAa,CAAC,KAAK,CAAC;QACtB,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;QAC/C,OAAO,aAAa,CAAC,KAAK,CAAC;IAC7B,CAAC;IAED,aAAa,CAAC,MAAc;QAC1B,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,KAAK,IAAI,CAAC,CAAC;IACrD,CAAC;;AA7FH,sCA+FC;AAED,MAAa,WAAW;IACtB,IAAI,GAAG,8BAAyB,CAAC;CAClC;AAFD,kCAEC"}
|
||||
@ -1 +1 @@
|
||||
{"version":3,"file":"InputState.js","sourceRoot":"","sources":["../../../../../src/bidiMapper/domains/input/InputState.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH,+DAIuC;AACvC,sDAA8C;AAG9C,qDAQ0B;AAE1B,MAAa,UAAU;IACrB,UAAU,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AyFC"}
|
||||
{"version":3,"file":"InputState.js","sourceRoot":"","sources":["../../../../../src/bidiMapper/modules/input/InputState.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH,+DAIuC;AACvC,sDAA8C;AAG9C,qDAQ0B;AAE1B,MAAa,UAAU;IACrB,UAAU,GAAmB,EAAE,CAAC;IAChC,QAAQ,GAAG,IAAI,GAAG,EAAuB,CAAC;IAC1C,MAAM,GAAG,IAAI,gBAAK,EAAE,CAAC;IAWrB,WAAW,CACT,EAAU,EACV,IAAU,EACV,OAA2B;QAE3B,IAAI,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACnC,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,QAAQ,IAAI,EAAE,CAAC;gBACb;oBACE,MAAM,GAAG,IAAI,2BAAU,EAAE,CAAC;oBAC1B,MAAM;gBACR;oBACE,MAAM,GAAG,IAAI,0BAAS,EAAE,CAAC;oBACzB,MAAM;gBACR,uCAAuB,CAAC,CAAC,CAAC;oBACxB,IAAI,SAAS,GAAG,OAAO,0CAA4B,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;oBAC5D,MAAM,UAAU,GAAG,IAAI,GAAG,EAAU,CAAC;oBACrC,KAAK,MAAM,CAAC,EAAE,MAAM,CAAC,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;wBACvC,IAAI,MAAM,CAAC,IAAI,uCAAuB,EAAE,CAAC;4BACvC,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;wBACnC,CAAC;oBACH,CAAC;oBACD,OAAO,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;wBACjC,EAAE,SAAS,CAAC;oBACd,CAAC;oBACD,MAAM,GAAG,IAAI,8BAAa,CAAC,SAAS,EAAE,OAA4B,CAAC,CAAC;oBACpE,MAAM;gBACR,CAAC;gBACD;oBACE,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AAM,CAAC,IAAI,CAAC;YAC3B,KAAK,CAAC,KAAK,KAAK,MAAM,CAAC,KAAK,CAAC;QAC/B,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF;AAzFD,gCAyFC"}
|
||||
@ -1 +1 @@
|
||||
{"version":3,"file":"InputStateManager.js","sourceRoot":"","sources":["../../../../../src/bidiMapper/domains/input/InputStateManager.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH,wDAAgD;AAGhD,mDAA2C;AAE3C,4CAA4C;AAC5C,wEAAwE;AACxE,MAAa,iBAAkB,SAAQ,OAGtC;IACU,GAAG,CAAC,OAA4B;QACvC,IAAA,kBAAM,EAAC,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAAC;QAEpC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;YACvB,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,0BAAU,EAAE,CAAC,CAAC;QACtC,CAAC;QAED,OAAO,KAAK,CAAC,GAAG,CAAC,OAAO,CAAE,CAAC;IAC7B,CAAC;CACF;AAbD,8CAaC"}
|
||||
{"version":3,"file":"InputStateManager.js","sourceRoot":"","sources":["../../../../../src/bidiMapper/modules/input/InputStateManager.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH,wDAAgD;AAGhD,mDAA2C;AAE3C,4CAA4C;AAC5C,wEAAwE;AACxE,MAAa,iBAAkB,SAAQ,OAGtC;IACU,GAAG,CAAC,OAA4B;QACvC,IAAA,kBAAM,EAAC,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAAC;QAEpC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;YACvB,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,0BAAU,EAAE,CAAC,CAAC;QACtC,CAAC;QAED,OAAO,KAAK,CAAC,GAAG,CAAC,OAAO,CAAE,CAAC;IAC7B,CAAC;CACF;AAbD,8CAaC"}
|
||||
File diff suppressed because one or more lines are too long
31
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/modules/input/keyUtils.d.ts
generated
vendored
Normal file
31
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/modules/input/keyUtils.d.ts
generated
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
/**
|
||||
* Copyright 2023 Google LLC.
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/**
|
||||
* Returns the normalized key value for a given key according to the table:
|
||||
* https://w3c.github.io/webdriver/#dfn-normalized-key-value
|
||||
*/
|
||||
export declare function getNormalizedKey(value: string): string;
|
||||
/**
|
||||
* Returns the key code for a given key according to the table:
|
||||
* https://w3c.github.io/webdriver/#dfn-shifted-character
|
||||
*/
|
||||
export declare function getKeyCode(key: string): string | undefined;
|
||||
/**
|
||||
* Returns the location of the key according to the table:
|
||||
* https://w3c.github.io/webdriver/#dfn-key-location
|
||||
*/
|
||||
export declare function getKeyLocation(key: string): 0 | 1 | 2 | 3;
|
||||
@ -16,7 +16,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getKeyLocation = exports.getKeyCode = exports.getNormalizedKey = void 0;
|
||||
exports.getNormalizedKey = getNormalizedKey;
|
||||
exports.getKeyCode = getKeyCode;
|
||||
exports.getKeyLocation = getKeyLocation;
|
||||
/**
|
||||
* Returns the normalized key value for a given key according to the table:
|
||||
* https://w3c.github.io/webdriver/#dfn-normalized-key-value
|
||||
*/
|
||||
function getNormalizedKey(value) {
|
||||
switch (value) {
|
||||
case '\uE000':
|
||||
@ -31,8 +37,9 @@ function getNormalizedKey(value) {
|
||||
return 'Tab';
|
||||
case '\uE005':
|
||||
return 'Clear';
|
||||
// Specification declares the '\uE006' to be `Return`, but it is not supported by
|
||||
// Chrome, so fall back to `Enter`, which aligns with WPT.
|
||||
case '\uE006':
|
||||
return 'Return';
|
||||
case '\uE007':
|
||||
return 'Enter';
|
||||
case '\uE008':
|
||||
@ -163,7 +170,10 @@ function getNormalizedKey(value) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
exports.getNormalizedKey = getNormalizedKey;
|
||||
/**
|
||||
* Returns the key code for a given key according to the table:
|
||||
* https://w3c.github.io/webdriver/#dfn-shifted-character
|
||||
*/
|
||||
function getKeyCode(key) {
|
||||
switch (key) {
|
||||
case '`':
|
||||
@ -216,6 +226,10 @@ function getKeyCode(key) {
|
||||
case '=':
|
||||
case '+':
|
||||
return 'Equal';
|
||||
// The spec declares the '<' to be `IntlBackslash` as well, but it is already covered
|
||||
// in the `Comma` above.
|
||||
case '>':
|
||||
return 'IntlBackslash';
|
||||
case 'a':
|
||||
case 'A':
|
||||
return 'KeyA';
|
||||
@ -318,6 +332,8 @@ function getKeyCode(key) {
|
||||
return 'ControlRight';
|
||||
case '\uE006':
|
||||
return 'Enter';
|
||||
case '\uE00B':
|
||||
return 'Pause';
|
||||
case '\uE03D':
|
||||
return 'MetaLeft';
|
||||
case '\uE053':
|
||||
@ -379,6 +395,8 @@ function getKeyCode(key) {
|
||||
return 'F11';
|
||||
case '\uE03C':
|
||||
return 'F12';
|
||||
case '\uE019':
|
||||
return 'NumpadEqual';
|
||||
case '\uE01A':
|
||||
case '\uE05C':
|
||||
return 'Numpad0';
|
||||
@ -427,7 +445,10 @@ function getKeyCode(key) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
exports.getKeyCode = getKeyCode;
|
||||
/**
|
||||
* Returns the location of the key according to the table:
|
||||
* https://w3c.github.io/webdriver/#dfn-key-location
|
||||
*/
|
||||
function getKeyLocation(key) {
|
||||
switch (key) {
|
||||
case '\uE007':
|
||||
@ -436,6 +457,7 @@ function getKeyLocation(key) {
|
||||
case '\uE00A':
|
||||
case '\uE03D':
|
||||
return 1;
|
||||
case '\uE019':
|
||||
case '\uE01A':
|
||||
case '\uE01B':
|
||||
case '\uE01C':
|
||||
@ -472,5 +494,4 @@ function getKeyLocation(key) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
exports.getKeyLocation = getKeyLocation;
|
||||
//# sourceMappingURL=keyUtils.js.map
|
||||
1
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/modules/input/keyUtils.js.map
generated
vendored
Normal file
1
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/modules/input/keyUtils.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -1,5 +1,5 @@
|
||||
import { type LoggerFn } from '../../../utils/log.js';
|
||||
import type { CdpTarget } from '../context/CdpTarget.js';
|
||||
import type { CdpTarget } from '../cdp/CdpTarget.js';
|
||||
import type { RealmStorage } from '../script/RealmStorage.js';
|
||||
import type { EventManager } from '../session/EventManager.js';
|
||||
export declare class LogManager {
|
||||
@ -81,6 +81,9 @@ class LogManager {
|
||||
args,
|
||||
},
|
||||
},
|
||||
}), (error) => ({
|
||||
kind: 'error',
|
||||
error,
|
||||
})), browsingContext.id, protocol_js_1.ChromiumBidi.Log.EventNames.LogEntryAdded);
|
||||
}
|
||||
});
|
||||
@ -111,6 +114,9 @@ class LogManager {
|
||||
type: 'javascript',
|
||||
},
|
||||
},
|
||||
}), (error) => ({
|
||||
kind: 'error',
|
||||
error,
|
||||
})), browsingContext.id, protocol_js_1.ChromiumBidi.Log.EventNames.LogEntryAdded);
|
||||
}
|
||||
});
|
||||
1
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/modules/log/LogManager.js.map
generated
vendored
Normal file
1
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/modules/log/LogManager.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"LogManager.js","sourceRoot":"","sources":["../../../../../src/bidiMapper/modules/log/LogManager.ts"],"names":[],"mappings":";;;AAkBA,+DAAwE;AACxE,kDAA6D;AAM7D,iDAAmD;AAEnD,gEAAgE;AAChE,SAAS,iBAAiB,CACxB,aAAsD;IAEtD,MAAM,WAAW,GAAG,aAAa,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE;QAC9D,OAAO;YACL,YAAY,EAAE,SAAS,CAAC,YAAY;YACpC,YAAY,EAAE,SAAS,CAAC,YAAY;YACpC,UAAU,EAAE,SAAS,CAAC,UAAU;YAChC,GAAG,EAAE,SAAS,CAAC,GAAG;SACnB,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO,WAAW,CAAC,CAAC,CAAC,EAAC,UAAU,EAAE,WAAW,EAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAC7D,CAAC;AAED,SAAS,WAAW,CAAC,cAAsB;IACzC,IAAI,gCAAkB,QAAQ,CAAC,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC;QACzD,qCAAuB;IACzB,CAAC;IACD,IAAI,gCAAkB,OAAO,CAAC,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC;QACxD,qCAAuB;IACzB,CAAC;IACD,IAAI,8BAAiB,SAAS,CAAC,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC;QACzD,mCAAsB;IACxB,CAAC;IACD,mCAAsB;AACxB,CAAC;AAED,MAAa,UAAU;IACZ,aAAa,CAAe;IAC5B,aAAa,CAAe;IAC5B,UAAU,CAAY;IACtB,OAAO,CAAY;IAE5B,YACE,SAAoB,EACpB,YAA0B,EAC1B,YAA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AO,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC;QACtC,CAAC;QACD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;QAC3D,CAAC;QACD,OAAO,MAAM,KAAK,CAAC,eAAe,CAAC,MAAM,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;IACxE,CAAC;CACF;AA1JD,gCA0JC"}
|
||||
@ -16,7 +16,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getRemoteValuesText = exports.logMessageFormatter = void 0;
|
||||
exports.logMessageFormatter = logMessageFormatter;
|
||||
exports.getRemoteValuesText = getRemoteValuesText;
|
||||
const assert_js_1 = require("../../../utils/assert.js");
|
||||
const specifiers = ['%s', '%d', '%i', '%f', '%o', '%O', '%c'];
|
||||
function isFormatSpecifier(str) {
|
||||
@ -77,7 +78,6 @@ function logMessageFormatter(args) {
|
||||
}
|
||||
return output;
|
||||
}
|
||||
exports.logMessageFormatter = logMessageFormatter;
|
||||
/**
|
||||
* @param arg input remote value to be parsed
|
||||
* @return parsed text of the remote value
|
||||
@ -170,5 +170,4 @@ function getRemoteValuesText(args, formatText) {
|
||||
})
|
||||
.join('\u0020');
|
||||
}
|
||||
exports.getRemoteValuesText = getRemoteValuesText;
|
||||
//# sourceMappingURL=logHelper.js.map
|
||||
1
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/modules/log/logHelper.js.map
generated
vendored
Normal file
1
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/modules/log/logHelper.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"logHelper.js","sourceRoot":"","sources":["../../../../../src/bidiMapper/modules/log/logHelper.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;AAeH,kDA0DC;AAwFD,kDAyBC;AA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CAAC,IAAI,KAAK,QAAQ;QACrB,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;QACvC,UAAU,EACV,CAAC;QACD,OAAO,mBAAmB,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;IAED,yFAAyF;IACzF,OAAO,IAAI;SACR,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;QACX,OAAO,aAAa,CAAC,GAAG,CAAC,CAAC;IAC5B,CAAC,CAAC;SACD,IAAI,CAAC,QAAQ,CAAC,CAAC;AACpB,CAAC"}
|
||||
@ -1,6 +1,22 @@
|
||||
/**
|
||||
* Copyright 2023 Google LLC.
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { Network, type EmptyResult } from '../../../protocol/protocol.js';
|
||||
import type { BrowsingContextStorage } from '../context/BrowsingContextStorage.js';
|
||||
import { NetworkStorage } from './NetworkStorage.js';
|
||||
import type { NetworkStorage } from './NetworkStorage.js';
|
||||
/** Dispatches Network domain commands. */
|
||||
export declare class NetworkProcessor {
|
||||
#private;
|
||||
@ -12,10 +28,16 @@ export declare class NetworkProcessor {
|
||||
failRequest({ request: networkId, }: Network.FailRequestParameters): Promise<EmptyResult>;
|
||||
provideResponse(params: Network.ProvideResponseParameters): Promise<EmptyResult>;
|
||||
removeIntercept(params: Network.RemoveInterceptParameters): Promise<EmptyResult>;
|
||||
/**
|
||||
* Validate https://fetch.spec.whatwg.org/#header-value
|
||||
*/
|
||||
static validateHeaders(headers: Network.Header[]): void;
|
||||
static isMethodValid(method: string): boolean;
|
||||
/**
|
||||
* Attempts to parse the given url.
|
||||
* Throws an InvalidArgumentException if the url is invalid.
|
||||
*/
|
||||
static parseUrlString(url: string): URL;
|
||||
static parseUrlPatterns(urlPatterns: Network.UrlPattern[]): Network.UrlPattern[];
|
||||
static wrapInterceptionError(error: any): any;
|
||||
}
|
||||
288
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/modules/network/NetworkProcessor.js
generated
vendored
Normal file
288
Scripts/node_modules/chromium-bidi/lib/cjs/bidiMapper/modules/network/NetworkProcessor.js
generated
vendored
Normal file
@ -0,0 +1,288 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Copyright 2023 Google LLC.
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.NetworkProcessor = void 0;
|
||||
const protocol_js_1 = require("../../../protocol/protocol.js");
|
||||
const UrlPattern_js_1 = require("../../../utils/UrlPattern.js");
|
||||
/** Dispatches Network domain commands. */
|
||||
class NetworkProcessor {
|
||||
#browsingContextStorage;
|
||||
#networkStorage;
|
||||
constructor(browsingContextStorage, networkStorage) {
|
||||
this.#browsingContextStorage = browsingContextStorage;
|
||||
this.#networkStorage = networkStorage;
|
||||
}
|
||||
async addIntercept(params) {
|
||||
this.#browsingContextStorage.verifyTopLevelContextsList(params.contexts);
|
||||
const urlPatterns = params.urlPatterns ?? [];
|
||||
const parsedUrlPatterns = NetworkProcessor.parseUrlPatterns(urlPatterns);
|
||||
const intercept = this.#networkStorage.addIntercept({
|
||||
urlPatterns: parsedUrlPatterns,
|
||||
phases: params.phases,
|
||||
contexts: params.contexts,
|
||||
});
|
||||
await Promise.all(this.#browsingContextStorage.getAllContexts().map((context) => {
|
||||
return context.cdpTarget.toggleFetchIfNeeded();
|
||||
}));
|
||||
return {
|
||||
intercept,
|
||||
};
|
||||
}
|
||||
async continueRequest(params) {
|
||||
if (params.url !== undefined) {
|
||||
NetworkProcessor.parseUrlString(params.url);
|
||||
}
|
||||
if (params.method !== undefined) {
|
||||
if (!NetworkProcessor.isMethodValid(params.method)) {
|
||||
throw new protocol_js_1.InvalidArgumentException(`Method '${params.method}' is invalid.`);
|
||||
}
|
||||
}
|
||||
if (params.headers) {
|
||||
NetworkProcessor.validateHeaders(params.headers);
|
||||
}
|
||||
const request = this.#getBlockedRequestOrFail(params.request, [
|
||||
"beforeRequestSent" /* Network.InterceptPhase.BeforeRequestSent */,
|
||||
]);
|
||||
try {
|
||||
await request.continueRequest(params);
|
||||
}
|
||||
catch (error) {
|
||||
throw NetworkProcessor.wrapInterceptionError(error);
|
||||
}
|
||||
return {};
|
||||
}
|
||||
async continueResponse(params) {
|
||||
if (params.headers) {
|
||||
NetworkProcessor.validateHeaders(params.headers);
|
||||
}
|
||||
const request = this.#getBlockedRequestOrFail(params.request, [
|
||||
"authRequired" /* Network.InterceptPhase.AuthRequired */,
|
||||
"responseStarted" /* Network.InterceptPhase.ResponseStarted */,
|
||||
]);
|
||||
try {
|
||||
await request.continueResponse(params);
|
||||
}
|
||||
catch (error) {
|
||||
throw NetworkProcessor.wrapInterceptionError(error);
|
||||
}
|
||||
return {};
|
||||
}
|
||||
async continueWithAuth(params) {
|
||||
const networkId = params.request;
|
||||
const request = this.#getBlockedRequestOrFail(networkId, [
|
||||
"authRequired" /* Network.InterceptPhase.AuthRequired */,
|
||||
]);
|
||||
await request.continueWithAuth(params);
|
||||
return {};
|
||||
}
|
||||
async failRequest({ request: networkId, }) {
|
||||
const request = this.#getRequestOrFail(networkId);
|
||||
if (request.interceptPhase === "authRequired" /* Network.InterceptPhase.AuthRequired */) {
|
||||
throw new protocol_js_1.InvalidArgumentException(`Request '${networkId}' in 'authRequired' phase cannot be failed`);
|
||||
}
|
||||
if (!request.interceptPhase) {
|
||||
throw new protocol_js_1.NoSuchRequestException(`No blocked request found for network id '${networkId}'`);
|
||||
}
|
||||
await request.failRequest('Failed');
|
||||
return {};
|
||||
}
|
||||
async provideResponse(params) {
|
||||
if (params.headers) {
|
||||
NetworkProcessor.validateHeaders(params.headers);
|
||||
}
|
||||
const request = this.#getBlockedRequestOrFail(params.request, [
|
||||
"beforeRequestSent" /* Network.InterceptPhase.BeforeRequestSent */,
|
||||
"responseStarted" /* Network.InterceptPhase.ResponseStarted */,
|
||||
"authRequired" /* Network.InterceptPhase.AuthRequired */,
|
||||
]);
|
||||
try {
|
||||
await request.provideResponse(params);
|
||||
}
|
||||
catch (error) {
|
||||
throw NetworkProcessor.wrapInterceptionError(error);
|
||||
}
|
||||
return {};
|
||||
}
|
||||
async removeIntercept(params) {
|
||||
this.#networkStorage.removeIntercept(params.intercept);
|
||||
await Promise.all(this.#browsingContextStorage.getAllContexts().map((context) => {
|
||||
return context.cdpTarget.toggleFetchIfNeeded();
|
||||
}));
|
||||
return {};
|
||||
}
|
||||
#getRequestOrFail(id) {
|
||||
const request = this.#networkStorage.getRequestById(id);
|
||||
if (!request) {
|
||||
throw new protocol_js_1.NoSuchRequestException(`Network request with ID '${id}' doesn't exist`);
|
||||
}
|
||||
return request;
|
||||
}
|
||||
#getBlockedRequestOrFail(id, phases) {
|
||||
const request = this.#getRequestOrFail(id);
|
||||
if (!request.interceptPhase) {
|
||||
throw new protocol_js_1.NoSuchRequestException(`No blocked request found for network id '${id}'`);
|
||||
}
|
||||
if (request.interceptPhase && !phases.includes(request.interceptPhase)) {
|
||||
throw new protocol_js_1.InvalidArgumentException(`Blocked request for network id '${id}' is in '${request.interceptPhase}' phase`);
|
||||
}
|
||||
return request;
|
||||
}
|
||||
/**
|
||||
* Validate https://fetch.spec.whatwg.org/#header-value
|
||||
*/
|
||||
static validateHeaders(headers) {
|
||||
for (const header of headers) {
|
||||
let headerValue;
|
||||
if (header.value.type === 'string') {
|
||||
headerValue = header.value.value;
|
||||
}
|
||||
else {
|
||||
headerValue = atob(header.value.value);
|
||||
}
|
||||
if (headerValue !== headerValue.trim() ||
|
||||
headerValue.includes('\n') ||
|
||||
headerValue.includes('\0')) {
|
||||
throw new protocol_js_1.InvalidArgumentException(`Header value '${headerValue}' is not acceptable value`);
|
||||
}
|
||||
}
|
||||
}
|
||||
static isMethodValid(method) {
|
||||
// https://httpwg.org/specs/rfc9110.html#method.overview
|
||||
return /^[!#$%&'*+\-.^_`|~a-zA-Z\d]+$/.test(method);
|
||||
}
|
||||
/**
|
||||
* Attempts to parse the given url.
|
||||
* Throws an InvalidArgumentException if the url is invalid.
|
||||
*/
|
||||
static parseUrlString(url) {
|
||||
try {
|
||||
return new URL(url);
|
||||
}
|
||||
catch (error) {
|
||||
throw new protocol_js_1.InvalidArgumentException(`Invalid URL '${url}': ${error}`);
|
||||
}
|
||||
}
|
||||
static parseUrlPatterns(urlPatterns) {
|
||||
return urlPatterns.map((urlPattern) => {
|
||||
switch (urlPattern.type) {
|
||||
case 'string': {
|
||||
NetworkProcessor.parseUrlString(urlPattern.pattern);
|
||||
return urlPattern;
|
||||
}
|
||||
case 'pattern':
|
||||
// No params signifies intercept all
|
||||
if (urlPattern.protocol === undefined &&
|
||||
urlPattern.hostname === undefined &&
|
||||
urlPattern.port === undefined &&
|
||||
urlPattern.pathname === undefined &&
|
||||
urlPattern.search === undefined) {
|
||||
return urlPattern;
|
||||
}
|
||||
if (urlPattern.protocol) {
|
||||
urlPattern.protocol = unescapeURLPattern(urlPattern.protocol);
|
||||
if (!urlPattern.protocol.match(/^[a-zA-Z+-.]+$/)) {
|
||||
throw new protocol_js_1.InvalidArgumentException('Forbidden characters');
|
||||
}
|
||||
}
|
||||
if (urlPattern.hostname) {
|
||||
urlPattern.hostname = unescapeURLPattern(urlPattern.hostname);
|
||||
}
|
||||
if (urlPattern.port) {
|
||||
urlPattern.port = unescapeURLPattern(urlPattern.port);
|
||||
}
|
||||
if (urlPattern.pathname) {
|
||||
urlPattern.pathname = unescapeURLPattern(urlPattern.pathname);
|
||||
if (urlPattern.pathname[0] !== '/') {
|
||||
urlPattern.pathname = `/${urlPattern.pathname}`;
|
||||
}
|
||||
if (urlPattern.pathname.includes('#') ||
|
||||
urlPattern.pathname.includes('?')) {
|
||||
throw new protocol_js_1.InvalidArgumentException('Forbidden characters');
|
||||
}
|
||||
}
|
||||
else if (urlPattern.pathname === '') {
|
||||
urlPattern.pathname = '/';
|
||||
}
|
||||
if (urlPattern.search) {
|
||||
urlPattern.search = unescapeURLPattern(urlPattern.search);
|
||||
if (urlPattern.search[0] !== '?') {
|
||||
urlPattern.search = `?${urlPattern.search}`;
|
||||
}
|
||||
if (urlPattern.search.includes('#')) {
|
||||
throw new protocol_js_1.InvalidArgumentException('Forbidden characters');
|
||||
}
|
||||
}
|
||||
if (urlPattern.protocol === '') {
|
||||
throw new protocol_js_1.InvalidArgumentException(`URL pattern must specify a protocol`);
|
||||
}
|
||||
if (urlPattern.hostname === '') {
|
||||
throw new protocol_js_1.InvalidArgumentException(`URL pattern must specify a hostname`);
|
||||
}
|
||||
if ((urlPattern.hostname?.length ?? 0) > 0) {
|
||||
if (urlPattern.protocol?.match(/^file/i)) {
|
||||
throw new protocol_js_1.InvalidArgumentException(`URL pattern protocol cannot be 'file'`);
|
||||
}
|
||||
if (urlPattern.hostname?.includes(':')) {
|
||||
throw new protocol_js_1.InvalidArgumentException(`URL pattern hostname must not contain a colon`);
|
||||
}
|
||||
}
|
||||
if (urlPattern.port === '') {
|
||||
throw new protocol_js_1.InvalidArgumentException(`URL pattern must specify a port`);
|
||||
}
|
||||
try {
|
||||
new UrlPattern_js_1.URLPattern(urlPattern);
|
||||
}
|
||||
catch (error) {
|
||||
throw new protocol_js_1.InvalidArgumentException(`${error}`);
|
||||
}
|
||||
return urlPattern;
|
||||
}
|
||||
});
|
||||
}
|
||||
static wrapInterceptionError(error) {
|
||||
// https://source.chromium.org/chromium/chromium/src/+/main:content/browser/devtools/protocol/fetch_handler.cc;l=169
|
||||
if (error?.message.includes('Invalid header')) {
|
||||
return new protocol_js_1.InvalidArgumentException('Invalid header');
|
||||
}
|
||||
return error;
|
||||
}
|
||||
}
|
||||
exports.NetworkProcessor = NetworkProcessor;
|
||||
/**
|
||||
* See https://w3c.github.io/webdriver-bidi/#unescape-url-pattern
|
||||
*/
|
||||
function unescapeURLPattern(pattern) {
|
||||
const forbidden = new Set(['(', ')', '*', '{', '}']);
|
||||
let result = '';
|
||||
let isEscaped = false;
|
||||
for (const c of pattern) {
|
||||
if (!isEscaped) {
|
||||
if (forbidden.has(c)) {
|
||||
throw new protocol_js_1.InvalidArgumentException('Forbidden characters');
|
||||
}
|
||||
if (c === '\\') {
|
||||
isEscaped = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
result += c;
|
||||
isEscaped = false;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
//# sourceMappingURL=NetworkProcessor.js.map
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user