Socket
Socket
Sign inDemoInstall

chromium-bidi

Package Overview
Dependencies
Maintainers
2
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chromium-bidi - npm Package Compare versions

Comparing version 0.5.7 to 0.5.8

4

lib/cjs/bidiMapper/CommandProcessor.d.ts

@@ -19,3 +19,3 @@ /**

import type { CdpConnection } from '../cdp/CdpConnection.js';
import { type ChromiumBidi } from '../protocol/protocol.js';
import { type ChromiumBidi, type Browser } from '../protocol/protocol.js';
import { EventEmitter } from '../utils/EventEmitter.js';

@@ -40,5 +40,5 @@ import { type LoggerFn } from '../utils/log.js';

#private;
constructor(cdpConnection: CdpConnection, browserCdpClient: CdpClient, eventManager: EventManager, selfTargetId: string, defaultUserContextId: string, browsingContextStorage: BrowsingContextStorage, realmStorage: RealmStorage, acceptInsecureCerts: boolean, sharedIdWithFrame: boolean, parser?: BidiCommandParameterParser, logger?: LoggerFn);
constructor(cdpConnection: CdpConnection, browserCdpClient: CdpClient, eventManager: EventManager, selfTargetId: string, defaultUserContextId: Browser.UserContext, browsingContextStorage: BrowsingContextStorage, realmStorage: RealmStorage, acceptInsecureCerts: boolean, sharedIdWithFrame: boolean, parser?: BidiCommandParameterParser, logger?: LoggerFn);
processCommand(command: ChromiumBidi.Command): Promise<void>;
}
export {};

@@ -39,12 +39,9 @@ "use strict";

#browsingContextStorage;
#deferreds = {
Page: {
navigatedWithinDocument: new Deferred_js_1.Deferred(),
lifecycleEvent: {
DOMContentLoaded: new Deferred_js_1.Deferred(),
load: new Deferred_js_1.Deferred(),
},
frameStartedLoading: new Deferred_js_1.Deferred(),
},
#lifecycle = {
DOMContentLoaded: new Deferred_js_1.Deferred(),
load: new Deferred_js_1.Deferred(),
};
#navigation = {
withinDocument: new Deferred_js_1.Deferred(),
};
#url = 'about:blank';

@@ -106,3 +103,3 @@ #eventManager;

// Fail all ongoing navigations.
this.#failDeferredsIfNotFinished();
this.#failLifecycleIfNotFinished();
this.#eventManager.registerEvent({

@@ -177,6 +174,6 @@ type: 'event',

async lifecycleLoaded() {
await this.#deferreds.Page.lifecycleEvent.load;
await this.#lifecycle.load;
}
async targetUnblockedOrThrow() {
const result = await this.#cdpTarget.targetUnblocked;
const result = await this.#cdpTarget.unblocked;
if (result.kind === 'error') {

@@ -244,3 +241,3 @@ throw result.error;

this.#url = params.url;
this.#deferreds.Page.navigatedWithinDocument.resolve(params);
this.#navigation.withinDocument.resolve(params);
this.#eventManager.registerEvent({

@@ -301,3 +298,3 @@ type: 'event',

}, this.id);
this.#deferreds.Page.lifecycleEvent.DOMContentLoaded.resolve(params);
this.#lifecycle.DOMContentLoaded.resolve(params);
break;

@@ -315,3 +312,3 @@ case 'load':

}, this.id);
this.#deferreds.Page.lifecycleEvent.load.resolve(params);
this.#lifecycle.load.resolve(params);
break;

@@ -392,4 +389,4 @@ }

if (loaderId === undefined || this.#loaderId === loaderId) {
if (this.#deferreds.Page.navigatedWithinDocument.isFinished) {
this.#deferreds.Page.navigatedWithinDocument =
if (this.#navigation.withinDocument.isFinished) {
this.#navigation.withinDocument =
new Deferred_js_1.Deferred();

@@ -402,8 +399,8 @@ }

}
this.#resetDeferredsIfFinished();
this.#resetLifecycleIfFinished();
this.#loaderId = loaderId;
}
#resetDeferredsIfFinished() {
if (this.#deferreds.Page.lifecycleEvent.DOMContentLoaded.isFinished) {
this.#deferreds.Page.lifecycleEvent.DOMContentLoaded =
#resetLifecycleIfFinished() {
if (this.#lifecycle.DOMContentLoaded.isFinished) {
this.#lifecycle.DOMContentLoaded =
new Deferred_js_1.Deferred();

@@ -414,5 +411,4 @@ }

}
if (this.#deferreds.Page.lifecycleEvent.load.isFinished) {
this.#deferreds.Page.lifecycleEvent.load =
new Deferred_js_1.Deferred();
if (this.#lifecycle.load.isFinished) {
this.#lifecycle.load = new Deferred_js_1.Deferred();
}

@@ -423,8 +419,8 @@ else {

}
#failDeferredsIfNotFinished() {
if (!this.#deferreds.Page.lifecycleEvent.DOMContentLoaded.isFinished) {
this.#deferreds.Page.lifecycleEvent.DOMContentLoaded.reject(new protocol_js_1.UnknownErrorException('navigation canceled'));
#failLifecycleIfNotFinished() {
if (!this.#lifecycle.DOMContentLoaded.isFinished) {
this.#lifecycle.DOMContentLoaded.reject(new protocol_js_1.UnknownErrorException('navigation canceled'));
}
if (!this.#deferreds.Page.lifecycleEvent.load.isFinished) {
this.#deferreds.Page.lifecycleEvent.load.reject(new protocol_js_1.UnknownErrorException('navigation canceled'));
if (!this.#lifecycle.load.isFinished) {
this.#lifecycle.load.reject(new protocol_js_1.UnknownErrorException('navigation canceled'));
}

@@ -455,6 +451,6 @@ }

if (cdpNavigateResult.loaderId === undefined) {
await this.#deferreds.Page.navigatedWithinDocument;
await this.#navigation.withinDocument;
}
else {
await this.#deferreds.Page.lifecycleEvent.DOMContentLoaded;
await this.#lifecycle.DOMContentLoaded;
}

@@ -465,6 +461,6 @@ break;

if (cdpNavigateResult.loaderId === undefined) {
await this.#deferreds.Page.navigatedWithinDocument;
await this.#navigation.withinDocument;
}
else {
await this.lifecycleLoaded();
await this.#lifecycle.load;
}

@@ -484,3 +480,3 @@ break;

});
this.#resetDeferredsIfFinished();
this.#resetLifecycleIfFinished();
switch (wait) {

@@ -490,6 +486,6 @@ case "none" /* BrowsingContext.ReadinessState.None */:

case "interactive" /* BrowsingContext.ReadinessState.Interactive */:
await this.#deferreds.Page.lifecycleEvent.DOMContentLoaded;
await this.#lifecycle.DOMContentLoaded;
break;
case "complete" /* BrowsingContext.ReadinessState.Complete */:
await this.lifecycleLoaded();
await this.#lifecycle.load;
break;

@@ -496,0 +492,0 @@ }

import type { CdpClient } from '../../../cdp/CdpClient.js';
import type { CdpConnection } from '../../../cdp/CdpConnection.js';
import { BrowsingContext, type EmptyResult } from '../../../protocol/protocol.js';
import { BrowsingContext, type EmptyResult, type Browser } from '../../../protocol/protocol.js';
import { type LoggerFn } from '../../../utils/log.js';

@@ -12,3 +12,3 @@ import type { NetworkStorage } from '../network/NetworkStorage.js';

#private;
constructor(cdpConnection: CdpConnection, browserCdpClient: CdpClient, selfTargetId: string, eventManager: EventManager, browsingContextStorage: BrowsingContextStorage, realmStorage: RealmStorage, networkStorage: NetworkStorage, preloadScriptStorage: PreloadScriptStorage, acceptInsecureCerts: boolean, sharedIdWithFrame: boolean, defaultUserContextId: string, logger?: LoggerFn);
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);
getTree(params: BrowsingContext.GetTreeParameters): BrowsingContext.GetTreeResult;

@@ -15,0 +15,0 @@ create(params: BrowsingContext.CreateParameters): Promise<BrowsingContext.CreateResult>;

@@ -229,3 +229,3 @@ "use strict";

}
const cdpTarget = this.#createCdpTarget(targetCdpClient, targetInfo, sessionId);
const cdpTarget = this.#createCdpTarget(targetCdpClient, targetInfo);
const maybeContext = this.#browsingContextStorage.findContext(targetInfo.targetId);

@@ -252,3 +252,3 @@ if (maybeContext) {

}
const cdpTarget = this.#createCdpTarget(targetCdpClient, targetInfo, sessionId);
const cdpTarget = this.#createCdpTarget(targetCdpClient, targetInfo);
this.#handleWorkerTarget(cdpTarget, this.#realmStorage.getRealm({

@@ -269,5 +269,5 @@ browsingContextId: browsingContext.id,

}
#createCdpTarget(targetCdpClient, targetInfo, sessionId) {
#createCdpTarget(targetCdpClient, targetInfo) {
this.#setEventListeners(targetCdpClient);
return CdpTarget_js_1.CdpTarget.create(targetInfo.targetId, targetCdpClient, this.#browserCdpClient, sessionId, this.#realmStorage, this.#eventManager, this.#preloadScriptStorage, this.#networkStorage, this.#acceptInsecureCerts, this.#logger);
return CdpTarget_js_1.CdpTarget.create(targetInfo.targetId, targetCdpClient, this.#browserCdpClient, this.#realmStorage, this.#eventManager, this.#preloadScriptStorage, this.#networkStorage, this.#acceptInsecureCerts, this.#logger);
}

@@ -274,0 +274,0 @@ #workers = new Map();

@@ -13,7 +13,7 @@ import type { Protocol } from 'devtools-protocol';

#private;
static create(targetId: Protocol.Target.TargetID, cdpClient: CdpClient, browserCdpClient: CdpClient, cdpSessionId: Protocol.Target.SessionID, realmStorage: RealmStorage, eventManager: EventManager, preloadScriptStorage: PreloadScriptStorage, networkStorage: NetworkStorage, acceptInsecureCerts: boolean, logger?: LoggerFn): CdpTarget;
constructor(targetId: Protocol.Target.TargetID, cdpClient: CdpClient, browserCdpClient: CdpClient, cdpSessionId: Protocol.Target.SessionID, eventManager: EventManager, preloadScriptStorage: PreloadScriptStorage, networkStorage: NetworkStorage, acceptInsecureCerts: boolean);
/** Returns a promise that resolves when the target is unblocked. */
get targetUnblocked(): Deferred<Result<void>>;
get targetId(): Protocol.Target.TargetID;
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);
/** Returns a deferred that resolves when the target is unblocked. */
get unblocked(): Deferred<Result<void>>;
get id(): Protocol.Target.TargetID;
get cdpClient(): CdpClient;

@@ -20,0 +20,0 @@ get browserCdpClient(): CdpClient;

@@ -8,6 +8,5 @@ "use strict";

class CdpTarget {
#targetId;
#id;
#cdpClient;
#browserCdpClient;
#cdpSessionId;
#eventManager;

@@ -18,4 +17,4 @@ #preloadScriptStorage;

#acceptInsecureCerts;
static create(targetId, cdpClient, browserCdpClient, cdpSessionId, realmStorage, eventManager, preloadScriptStorage, networkStorage, acceptInsecureCerts, logger) {
const cdpTarget = new CdpTarget(targetId, cdpClient, browserCdpClient, cdpSessionId, eventManager, preloadScriptStorage, networkStorage, 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);

@@ -29,6 +28,5 @@ NetworkManager_js_1.NetworkManager.create(cdpTarget, eventManager, networkStorage);

}
constructor(targetId, cdpClient, browserCdpClient, cdpSessionId, eventManager, preloadScriptStorage, networkStorage, acceptInsecureCerts) {
this.#targetId = targetId;
constructor(targetId, cdpClient, browserCdpClient, eventManager, preloadScriptStorage, networkStorage, acceptInsecureCerts) {
this.#id = targetId;
this.#cdpClient = cdpClient;
this.#cdpSessionId = cdpSessionId;
this.#eventManager = eventManager;

@@ -40,8 +38,8 @@ this.#preloadScriptStorage = preloadScriptStorage;

}
/** Returns a promise that resolves when the target is unblocked. */
get targetUnblocked() {
/** Returns a deferred that resolves when the target is unblocked. */
get unblocked() {
return this.#targetUnblocked;
}
get targetId() {
return this.#targetId;
get id() {
return this.#id;
}

@@ -56,3 +54,4 @@ get cdpClient() {

get cdpSessionId() {
return this.#cdpSessionId;
// SAFETY we got the client by it's id for creating
return this.#cdpClient.sessionId;
}

@@ -124,3 +123,3 @@ /** Calls `Fetch.enable` with the added network intercepts. */

params,
session: this.#cdpSessionId,
session: this.cdpSessionId,
},

@@ -127,0 +126,0 @@ }, null);

@@ -54,9 +54,9 @@ /**

count: number;
"__#89098@#x": number;
"__#89098@#y": number;
"__#89098@#time": number;
"__#89102@#x": number;
"__#89102@#y": number;
"__#89102@#time": number;
compare(context: any): boolean;
};
"__#89098@#DOUBLE_CLICK_TIME_MS": number;
"__#89098@#MAX_DOUBLE_CLICK_RADIUS": number;
"__#89102@#DOUBLE_CLICK_TIME_MS": number;
"__#89102@#MAX_DOUBLE_CLICK_RADIUS": number;
};

@@ -63,0 +63,0 @@ setClickCount(button: number, context: InstanceType<typeof PointerSource.ClickContext>): number;

@@ -30,3 +30,4 @@ /**

get realmType(): 'dedicated-worker';
get source(): Script.Source;
get realmInfo(): Script.DedicatedWorkerRealmInfo;
}

@@ -34,2 +34,10 @@ "use strict";

}
get source() {
return {
realm: this.realmId,
// This is a hack to make Puppeteer able to track workers.
// TODO: remove after Puppeteer tracks workers by owners and use the base version.
context: this.associatedBrowsingContexts[0]?.id,
};
}
get realmInfo() {

@@ -36,0 +44,0 @@ return {

@@ -103,3 +103,3 @@ "use strict";

});
this.#targetIds.add(cdpTarget.targetId);
this.#targetIds.add(cdpTarget.id);
}

@@ -120,3 +120,3 @@ /**

dispose(cdpTargetId) {
this.#cdpPreloadScripts = this.#cdpPreloadScripts.filter((cdpPreloadScript) => cdpPreloadScript.target?.targetId !== cdpTargetId);
this.#cdpPreloadScripts = this.#cdpPreloadScripts.filter((cdpPreloadScript) => cdpPreloadScript.target?.id !== cdpTargetId);
this.#targetIds.delete(cdpTargetId);

@@ -123,0 +123,0 @@ }

import type { CdpTarget } from '../context/CdpTarget.js';
import type { PreloadScript } from './PreloadScript.js';
/** PreloadScripts can be filtered by BiDi ID or target ID. */
export type PreloadScriptFilter = Partial<Pick<PreloadScript, 'id'> & Pick<CdpTarget, 'targetId'> & {
export type PreloadScriptFilter = Partial<{
id: PreloadScript['id'];
targetId: CdpTarget['id'];
global: boolean;

@@ -6,0 +8,0 @@ }>;

@@ -17,2 +17,3 @@ /**

*/
import type { BidiPlusChannel } from '../../../protocol/chromium-bidi.js';
import { ChromiumBidi, type BrowsingContext } from '../../../protocol/protocol.js';

@@ -37,5 +38,5 @@ import { EventEmitter } from '../../../utils/EventEmitter.js';

registerPromiseEvent(event: Promise<Result<ChromiumBidi.Event>>, contextId: BrowsingContext.BrowsingContext | null, eventName: ChromiumBidi.EventNames): void;
subscribe(eventNames: ChromiumBidi.EventNames[], contextIds: (BrowsingContext.BrowsingContext | null)[], channel: string | null): void;
unsubscribe(eventNames: ChromiumBidi.EventNames[], contextIds: (BrowsingContext.BrowsingContext | null)[], channel: string | null): void;
subscribe(eventNames: ChromiumBidi.EventNames[], contextIds: (BrowsingContext.BrowsingContext | null)[], channel: BidiPlusChannel): void;
unsubscribe(eventNames: ChromiumBidi.EventNames[], contextIds: (BrowsingContext.BrowsingContext | null)[], channel: BidiPlusChannel): void;
}
export {};

@@ -17,2 +17,3 @@ /**

*/
import type { BidiPlusChannel } from '../../../protocol/chromium-bidi.js';
import type { EmptyResult, Session } from '../../../protocol/protocol.js';

@@ -24,4 +25,4 @@ import type { EventManager } from './EventManager.js';

status(): Session.StatusResult;
subscribe(params: Session.SubscriptionRequest, channel?: string | null): EmptyResult;
unsubscribe(params: Session.SubscriptionRequest, channel?: string | null): EmptyResult;
subscribe(params: Session.SubscriptionRequest, channel?: BidiPlusChannel): EmptyResult;
unsubscribe(params: Session.SubscriptionRequest, channel?: BidiPlusChannel): EmptyResult;
}

@@ -17,2 +17,3 @@ /**

*/
import type { BidiPlusChannel } from '../../../protocol/chromium-bidi.js';
import { ChromiumBidi, type BrowsingContext } from '../../../protocol/protocol.js';

@@ -32,8 +33,8 @@ import type { BrowsingContextStorage } from '../context/BrowsingContextStorage.js';

constructor(browsingContextStorage: BrowsingContextStorage);
getChannelsSubscribedToEvent(eventMethod: ChromiumBidi.EventNames, contextId: BrowsingContext.BrowsingContext | null): (string | null)[];
subscribe(event: ChromiumBidi.EventNames, contextId: BrowsingContext.BrowsingContext | null, channel: string | null): void;
getChannelsSubscribedToEvent(eventMethod: ChromiumBidi.EventNames, contextId: BrowsingContext.BrowsingContext | null): BidiPlusChannel[];
subscribe(event: ChromiumBidi.EventNames, contextId: BrowsingContext.BrowsingContext | null, channel: BidiPlusChannel): void;
/**
* Unsubscribes atomically from all events in the given contexts and channel.
*/
unsubscribeAll(events: ChromiumBidi.EventNames[], contextIds: (BrowsingContext.BrowsingContext | null)[], channel: string | null): void;
unsubscribeAll(events: ChromiumBidi.EventNames[], contextIds: (BrowsingContext.BrowsingContext | null)[], channel: BidiPlusChannel): void;
/**

@@ -43,3 +44,3 @@ * Unsubscribes from the event in the given context and channel.

*/
unsubscribe(eventName: ChromiumBidi.EventNames, contextId: BrowsingContext.BrowsingContext | null, channel: string | null): void;
unsubscribe(eventName: ChromiumBidi.EventNames, contextId: BrowsingContext.BrowsingContext | null, channel: BidiPlusChannel): void;
}

@@ -17,2 +17,3 @@ /**

*/
import type { BidiPlusChannel } from '../protocol/chromium-bidi.js';
import type { ChromiumBidi } from '../protocol/protocol.js';

@@ -23,6 +24,6 @@ import type { Result } from '../utils/result.js';

private constructor();
static createFromPromise(messagePromise: Promise<Result<ChromiumBidi.Message>>, channel: string | null): Promise<Result<OutgoingMessage>>;
static createResolved(message: ChromiumBidi.Message, channel?: string | null): Promise<Result<OutgoingMessage>>;
static createFromPromise(messagePromise: Promise<Result<ChromiumBidi.Message>>, channel: BidiPlusChannel): Promise<Result<OutgoingMessage>>;
static createResolved(message: ChromiumBidi.Message, channel?: BidiPlusChannel): Promise<Result<OutgoingMessage>>;
get message(): ChromiumBidi.Message;
get channel(): string | null;
get channel(): BidiPlusChannel;
}

@@ -76,6 +76,7 @@ /**

export type ResultData = WebDriverBidi.ResultData | Cdp.ResultData;
export type BidiPlusChannel = string | null;
export type Message = (WebDriverBidi.Message | Cdp.Message | {
launched: true;
}) & {
channel?: WebDriverBidi.Script.Channel;
channel?: BidiPlusChannel;
};
{
"name": "chromium-bidi",
"version": "0.5.7",
"version": "0.5.8",
"description": "An implementation of the WebDriver BiDi protocol for Chromium implemented as a JavaScript layer translating between BiDi and CDP, running inside a Chrome tab.",

@@ -5,0 +5,0 @@ "scripts": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc