Socket
Socket
Sign inDemoInstall

chromium-bidi

Package Overview
Dependencies
Maintainers
2
Versions
69
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.4.13 to 0.4.14

8

lib/cjs/bidiMapper/BidiServer.js

@@ -31,4 +31,4 @@ "use strict";

#commandProcessor;
#browsingContextStorage;
#realmStorage;
#browsingContextStorage = new browsingContextStorage_js_1.BrowsingContextStorage();
#realmStorage = new realmStorage_js_1.RealmStorage();
#logger;

@@ -50,8 +50,6 @@ #handleIncomingMessage = (message) => {

this.#logger = logger;
this.#browsingContextStorage = new browsingContextStorage_js_1.BrowsingContextStorage();
this.#realmStorage = new realmStorage_js_1.RealmStorage();
this.#messageQueue = new processingQueue_js_1.ProcessingQueue(this.#processOutgoingMessage, this.#logger);
this.#transport = bidiTransport;
this.#transport.setOnMessage(this.#handleIncomingMessage);
this.#commandProcessor = new CommandProcessor_js_1.CommandProcessor(this.#realmStorage, cdpConnection, new EventManager_js_1.EventManager(this), selfTargetId, parser, this.#browsingContextStorage, this.#logger);
this.#commandProcessor = new CommandProcessor_js_1.CommandProcessor(cdpConnection, new EventManager_js_1.EventManager(this), selfTargetId, parser, this.#browsingContextStorage, this.#realmStorage, this.#logger);
this.#commandProcessor.on('response', (response) => {

@@ -58,0 +56,0 @@ this.emitOutgoingMessage(response);

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

parsePrintParams(params: object): BrowsingContext.PrintParameters;
parseSetViewportParams(params: object): BrowsingContext.SetViewportParameters;
parsePerformActionsParams(params: object): Input.PerformActionsParameters;

@@ -51,5 +52,5 @@ parseReleaseActionsParams(params: object): Input.ReleaseActionsParameters;

#private;
constructor(realmStorage: RealmStorage, cdpConnection: ICdpConnection, eventManager: IEventManager, selfTargetId: string, parser: BidiParser | undefined, browsingContextStorage: BrowsingContextStorage, logger?: LoggerFn);
constructor(cdpConnection: ICdpConnection, eventManager: IEventManager, selfTargetId: string, parser: BidiParser | undefined, browsingContextStorage: BrowsingContextStorage, realmStorage: RealmStorage, logger?: LoggerFn);
processCommand(command: Message.RawCommandRequest): Promise<void>;
}
export {};

@@ -80,2 +80,5 @@ "use strict";

}
parseSetViewportParams(params) {
return params;
}
}

@@ -87,7 +90,7 @@ class CommandProcessor extends EventEmitter_js_1.EventEmitter {

#logger;
constructor(realmStorage, cdpConnection, eventManager, selfTargetId, parser = new BidiNoOpParser(), browsingContextStorage, logger) {
constructor(cdpConnection, eventManager, selfTargetId, parser = new BidiNoOpParser(), browsingContextStorage, realmStorage, logger) {
super();
this.#eventManager = eventManager;
this.#logger = logger;
this.#contextProcessor = new browsingContextProcessor_js_1.BrowsingContextProcessor(realmStorage, cdpConnection, selfTargetId, eventManager, browsingContextStorage, logger);
this.#contextProcessor = new browsingContextProcessor_js_1.BrowsingContextProcessor(cdpConnection, selfTargetId, eventManager, browsingContextStorage, realmStorage, logger);
this.#parser = parser;

@@ -128,2 +131,4 @@ }

return this.#contextProcessor.process_browsingContext_reload(this.#parser.parseReloadParams(commandData.params));
case 'browsingContext.setViewport':
return this.#contextProcessor.process_browsingContext_setViewport(this.#parser.parseSetViewportParams(commandData.params));
case 'script.addPreloadScript':

@@ -130,0 +135,0 @@ return this.#contextProcessor.process_script_addPreloadScript(this.#parser.parseAddPreloadScriptParams(commandData.params));

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

*/
import type { Protocol } from 'devtools-protocol';
import { BrowsingContext, type CommonDataTypes, Message } from '../../../protocol/protocol.js';

@@ -59,6 +60,8 @@ import { type LoggerFn } from '../../../utils/log.js';

serializeToBidiValue(maxDepth?: number, addParentField?: boolean): BrowsingContext.Info;
onTargetInfoChanged(params: Protocol.Target.TargetInfoChangedEvent): void;
navigate(url: string, wait: BrowsingContext.ReadinessState): Promise<BrowsingContext.NavigateResult>;
reload(ignoreCache: boolean, wait: BrowsingContext.ReadinessState): Promise<Message.EmptyResult>;
setViewport(viewport: BrowsingContext.Viewport | null): Promise<void>;
captureScreenshot(): Promise<BrowsingContext.CaptureScreenshotResult>;
print(params: BrowsingContext.PrintParameters): Promise<BrowsingContext.PrintResult>;
}

@@ -207,9 +207,6 @@ "use strict";

}
onTargetInfoChanged(params) {
this.#url = params.targetInfo.url;
}
#initListeners() {
this.#cdpTarget.cdpClient.on('Target.targetInfoChanged', (params) => {
if (this.id !== params.targetInfo.targetId) {
return;
}
this.#url = params.targetInfo.url;
});
this.#cdpTarget.cdpClient.on('Page.frameNavigated', (params) => {

@@ -256,11 +253,17 @@ if (this.id !== params.frame.id) {

}
if (params.name === 'init') {
this.#documentChanged(params.loaderId);
this.#deferreds.documentInitialized.resolve();
return;
}
if (params.name === 'commit') {
this.#loaderId = params.loaderId;
return;
}
// Ignore event from not current navigation.
if (params.loaderId !== this.#loaderId) {
return;
}
const timestamp = BrowsingContextImpl.getTimestamp();
switch (params.name) {
case 'init':
this.#documentChanged(params.loaderId);
this.#deferreds.documentInitialized.resolve();
break;
case 'commit':
this.#loaderId = params.loaderId;
break;
case 'DOMContentLoaded':

@@ -291,5 +294,2 @@ this.#deferreds.Page.lifecycleEvent.DOMContentLoaded.resolve(params);

}
if (params.loaderId !== this.#loaderId) {
return;
}
});

@@ -320,6 +320,2 @@ this.#cdpTarget.cdpClient.on('Runtime.executionContextCreated', (params) => {

}
this.#eventManager.registerEvent({
method: protocol_js_1.Script.EventNames.RealmCreated,
params: realm.toBiDi(),
}, this.id);
});

@@ -444,2 +440,26 @@ this.#cdpTarget.cdpClient.on('Runtime.executionContextDestroyed', (params) => {

}
async setViewport(viewport) {
if (viewport === null) {
await this.#cdpTarget.cdpClient.sendCommand('Emulation.clearDeviceMetricsOverride');
}
else {
try {
await this.#cdpTarget.cdpClient.sendCommand('Emulation.setDeviceMetricsOverride', {
width: viewport.width,
height: viewport.height,
deviceScaleFactor: 0,
mobile: false,
dontSetVisibleSize: true,
});
}
catch (err) {
if (err.message.startsWith(
// https://crsrc.org/c/content/browser/devtools/protocol/emulation_handler.cc;l=257;drc=2f6eee84cf98d4227e7c41718dd71b82f26d90ff
'Width and height values must be positive')) {
throw new protocol_js_1.Message.UnsupportedOperationException('Provided viewport dimensions are not supported');
}
throw err;
}
}
}
async captureScreenshot() {

@@ -446,0 +466,0 @@ // XXX: Focus the original tab after the screenshot is taken.

@@ -1,18 +0,1 @@

/**
* Copyright 2021 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 { type BrowsingContext, type CDP, Input, Message, type Script } from '../../../protocol/protocol.js';

@@ -26,3 +9,3 @@ import { type LoggerFn } from '../../../utils/log.js';

#private;
constructor(realmStorage: RealmStorage, cdpConnection: ICdpConnection, selfTargetId: string, eventManager: IEventManager, browsingContextStorage: BrowsingContextStorage, logger?: LoggerFn);
constructor(cdpConnection: ICdpConnection, selfTargetId: string, eventManager: IEventManager, browsingContextStorage: BrowsingContextStorage, realmStorage: RealmStorage, logger?: LoggerFn);
process_browsingContext_getTree(params: BrowsingContext.GetTreeParameters): BrowsingContext.GetTreeResult;

@@ -42,16 +25,6 @@ process_browsingContext_create(params: BrowsingContext.CreateParameters): Promise<BrowsingContext.CreateResult>;

process_input_releaseActions(params: Input.ReleaseActionsParameters): Promise<Message.EmptyResult>;
process_browsingContext_setViewport(params: BrowsingContext.SetViewportParameters): Promise<Message.EmptyResult>;
process_browsingContext_close(commandParams: BrowsingContext.CloseParameters): Promise<Message.EmptyResult>;
process_cdp_sendCommand(params: CDP.SendCommandParams): Promise<{
result: void | Protocol.Debugger.EnableResponse | Protocol.Debugger.EvaluateOnCallFrameResponse | Protocol.Debugger.GetPossibleBreakpointsResponse | Protocol.Debugger.GetScriptSourceResponse | Protocol.Debugger.DisassembleWasmModuleResponse | Protocol.Debugger.NextWasmDisassemblyChunkResponse | Protocol.Debugger.GetWasmBytecodeResponse | Protocol.Debugger.GetStackTraceResponse | Protocol.Debugger.RestartFrameResponse | Protocol.Debugger.SearchInContentResponse | Protocol.Debugger.SetBreakpointResponse | Protocol.Debugger.SetInstrumentationBreakpointResponse | Protocol.Debugger.SetBreakpointByUrlResponse | Protocol.Debugger.SetBreakpointOnFunctionCallResponse | Protocol.Debugger.SetScriptSourceResponse | Protocol.HeapProfiler.GetHeapObjectIdResponse | Protocol.HeapProfiler.GetObjectByHeapObjectIdResponse | Protocol.HeapProfiler.GetSamplingProfileResponse | Protocol.HeapProfiler.StopSamplingResponse | Protocol.Profiler.GetBestEffortCoverageResponse | Protocol.Profiler.StartPreciseCoverageResponse | Protocol.Profiler.StopResponse | Protocol.Profiler.TakePreciseCoverageResponse | Protocol.Runtime.AwaitPromiseResponse | Protocol.Runtime.CallFunctionOnResponse | Protocol.Runtime.CompileScriptResponse | Protocol.Runtime.EvaluateResponse | Protocol.Runtime.GetIsolateIdResponse | Protocol.Runtime.GetHeapUsageResponse | Protocol.Runtime.GetPropertiesResponse | Protocol.Runtime.GlobalLexicalScopeNamesResponse | Protocol.Runtime.QueryObjectsResponse | Protocol.Runtime.RunScriptResponse | Protocol.Runtime.GetExceptionDetailsResponse | Protocol.Schema.GetDomainsResponse | Protocol.Accessibility.GetPartialAXTreeResponse | Protocol.Accessibility.GetFullAXTreeResponse | Protocol.Accessibility.GetRootAXNodeResponse | Protocol.Accessibility.GetAXNodeAndAncestorsResponse | Protocol.Accessibility.GetChildAXNodesResponse | Protocol.Accessibility.QueryAXTreeResponse | Protocol.Animation.GetCurrentTimeResponse | Protocol.Animation.GetPlaybackRateResponse | Protocol.Animation.ResolveAnimationResponse | Protocol.Audits.GetEncodedResponseResponse | Protocol.Audits.CheckFormsIssuesResponse | Protocol.Browser.GetVersionResponse | Protocol.Browser.GetBrowserCommandLineResponse | Protocol.Browser.GetHistogramsResponse | Protocol.Browser.GetHistogramResponse | Protocol.Browser.GetWindowBoundsResponse | Protocol.Browser.GetWindowForTargetResponse | Protocol.CSS.AddRuleResponse | Protocol.CSS.CollectClassNamesResponse | Protocol.CSS.CreateStyleSheetResponse | Protocol.CSS.GetBackgroundColorsResponse | Protocol.CSS.GetComputedStyleForNodeResponse | Protocol.CSS.GetInlineStylesForNodeResponse | Protocol.CSS.GetMatchedStylesForNodeResponse | Protocol.CSS.GetMediaQueriesResponse | Protocol.CSS.GetPlatformFontsForNodeResponse | Protocol.CSS.GetStyleSheetTextResponse | Protocol.CSS.GetLayersForNodeResponse | Protocol.CSS.TakeComputedStyleUpdatesResponse | Protocol.CSS.SetKeyframeKeyResponse | Protocol.CSS.SetMediaTextResponse | Protocol.CSS.SetContainerQueryTextResponse | Protocol.CSS.SetSupportsTextResponse | Protocol.CSS.SetScopeTextResponse | Protocol.CSS.SetRuleSelectorResponse | Protocol.CSS.SetStyleSheetTextResponse | Protocol.CSS.SetStyleTextsResponse | Protocol.CSS.StopRuleUsageTrackingResponse | Protocol.CSS.TakeCoverageDeltaResponse | Protocol.CacheStorage.RequestCacheNamesResponse | Protocol.CacheStorage.RequestCachedResponseResponse | Protocol.CacheStorage.RequestEntriesResponse | Protocol.DOM.CollectClassNamesFromSubtreeResponse | Protocol.DOM.CopyToResponse | Protocol.DOM.DescribeNodeResponse | Protocol.DOM.GetAttributesResponse | Protocol.DOM.GetBoxModelResponse | Protocol.DOM.GetContentQuadsResponse | Protocol.DOM.GetDocumentResponse | Protocol.DOM.GetFlattenedDocumentResponse | Protocol.DOM.GetNodesForSubtreeByStyleResponse | Protocol.DOM.GetNodeForLocationResponse | Protocol.DOM.GetOuterHTMLResponse | Protocol.DOM.GetRelayoutBoundaryResponse | Protocol.DOM.GetSearchResultsResponse | Protocol.DOM.MoveToResponse | Protocol.DOM.PerformSearchResponse | Protocol.DOM.PushNodeByPathToFrontendResponse | Protocol.DOM.PushNodesByBackendIdsToFrontendResponse | Protocol.DOM.QuerySelectorResponse | Protocol.DOM.QuerySelectorAllResponse | Protocol.DOM.GetTopLayerElementsResponse | Protocol.DOM.RequestNodeResponse | Protocol.DOM.ResolveNodeResponse | Protocol.DOM.GetNodeStackTracesResponse | Protocol.DOM.GetFileInfoResponse | Protocol.DOM.SetNodeNameResponse | Protocol.DOM.GetFrameOwnerResponse | Protocol.DOM.GetContainerForNodeResponse | Protocol.DOM.GetQueryingDescendantsForContainerResponse | Protocol.DOMDebugger.GetEventListenersResponse | Protocol.DOMSnapshot.GetSnapshotResponse | Protocol.DOMSnapshot.CaptureSnapshotResponse | Protocol.DOMStorage.GetDOMStorageItemsResponse | Protocol.Database.ExecuteSQLResponse | Protocol.Database.GetDatabaseTableNamesResponse | Protocol.Emulation.CanEmulateResponse | Protocol.Emulation.SetVirtualTimePolicyResponse | Protocol.HeadlessExperimental.BeginFrameResponse | Protocol.IO.ReadResponse | Protocol.IO.ResolveBlobResponse | Protocol.IndexedDB.RequestDataResponse | Protocol.IndexedDB.GetMetadataResponse | Protocol.IndexedDB.RequestDatabaseResponse | Protocol.IndexedDB.RequestDatabaseNamesResponse | Protocol.LayerTree.CompositingReasonsResponse | Protocol.LayerTree.LoadSnapshotResponse | Protocol.LayerTree.MakeSnapshotResponse | Protocol.LayerTree.ProfileSnapshotResponse | Protocol.LayerTree.ReplaySnapshotResponse | Protocol.LayerTree.SnapshotCommandLogResponse | Protocol.Memory.GetDOMCountersResponse | Protocol.Memory.GetAllTimeSamplingProfileResponse | Protocol.Memory.GetBrowserSamplingProfileResponse | Protocol.Memory.GetSamplingProfileResponse | Protocol.Network.CanClearBrowserCacheResponse | Protocol.Network.CanClearBrowserCookiesResponse | Protocol.Network.CanEmulateNetworkConditionsResponse | Protocol.Network.GetAllCookiesResponse | Protocol.Network.GetCertificateResponse | Protocol.Network.GetCookiesResponse | Protocol.Network.GetResponseBodyResponse | Protocol.Network.GetRequestPostDataResponse | Protocol.Network.GetResponseBodyForInterceptionResponse | Protocol.Network.TakeResponseBodyForInterceptionAsStreamResponse | Protocol.Network.SearchInResponseBodyResponse | Protocol.Network.SetCookieResponse | Protocol.Network.GetSecurityIsolationStatusResponse | Protocol.Network.LoadNetworkResourceResponse | Protocol.Overlay.GetHighlightObjectForTestResponse | Protocol.Overlay.GetGridHighlightObjectsForTestResponse | Protocol.Overlay.GetSourceOrderHighlightObjectForTestResponse | Protocol.Page.AddScriptToEvaluateOnLoadResponse | Protocol.Page.AddScriptToEvaluateOnNewDocumentResponse | Protocol.Page.CaptureScreenshotResponse | Protocol.Page.CaptureSnapshotResponse | Protocol.Page.CreateIsolatedWorldResponse | Protocol.Page.GetAppManifestResponse | Protocol.Page.GetInstallabilityErrorsResponse | Protocol.Page.GetManifestIconsResponse | Protocol.Page.GetAppIdResponse | Protocol.Page.GetAdScriptIdResponse | Protocol.Page.GetCookiesResponse | Protocol.Page.GetFrameTreeResponse | Protocol.Page.GetLayoutMetricsResponse | Protocol.Page.GetNavigationHistoryResponse | Protocol.Page.GetResourceContentResponse | Protocol.Page.GetResourceTreeResponse | Protocol.Page.NavigateResponse | Protocol.Page.PrintToPDFResponse | Protocol.Page.SearchInResourceResponse | Protocol.Page.GetPermissionsPolicyStateResponse | Protocol.Page.GetOriginTrialsResponse | Protocol.Performance.GetMetricsResponse | Protocol.Storage.GetStorageKeyForFrameResponse | Protocol.Storage.GetCookiesResponse | Protocol.Storage.GetUsageAndQuotaResponse | Protocol.Storage.GetTrustTokensResponse | Protocol.Storage.ClearTrustTokensResponse | Protocol.Storage.GetInterestGroupDetailsResponse | Protocol.Storage.GetSharedStorageMetadataResponse | Protocol.Storage.GetSharedStorageEntriesResponse | Protocol.Storage.RunBounceTrackingMitigationsResponse | Protocol.SystemInfo.GetInfoResponse | Protocol.SystemInfo.GetFeatureStateResponse | Protocol.SystemInfo.GetProcessInfoResponse | Protocol.Target.AttachToTargetResponse | Protocol.Target.AttachToBrowserTargetResponse | Protocol.Target.CloseTargetResponse | Protocol.Target.CreateBrowserContextResponse | Protocol.Target.GetBrowserContextsResponse | Protocol.Target.CreateTargetResponse | Protocol.Target.GetTargetInfoResponse | Protocol.Target.GetTargetsResponse | Protocol.Tracing.GetCategoriesResponse | Protocol.Tracing.RequestMemoryDumpResponse | Protocol.Fetch.GetResponseBodyResponse | Protocol.Fetch.TakeResponseBodyAsStreamResponse | Protocol.WebAudio.GetRealtimeDataResponse | Protocol.WebAuthn.AddVirtualAuthenticatorResponse | Protocol.WebAuthn.GetCredentialResponse | Protocol.WebAuthn.GetCredentialsResponse;
cdpSession: string | undefined;
}>;
process_cdp_getSession(params: CDP.GetSessionParams): {
result: {
cdpSession: null;
};
} | {
result: {
cdpSession: string;
};
};
process_cdp_sendCommand(params: CDP.SendCommandParams): Promise<CDP.SendCommandResult>;
process_cdp_getSession(params: CDP.GetSessionParams): CDP.GetSessionResult;
}

@@ -19,12 +19,11 @@ "use strict";

#selfTargetId;
#preloadScriptStorage;
#preloadScriptStorage = new PreloadScriptStorage_js_1.PreloadScriptStorage();
#inputStateManager = new InputStateManager_js_1.InputStateManager();
constructor(realmStorage, cdpConnection, selfTargetId, eventManager, browsingContextStorage, logger) {
this.#browsingContextStorage = browsingContextStorage;
constructor(cdpConnection, selfTargetId, eventManager, browsingContextStorage, realmStorage, logger) {
this.#cdpConnection = cdpConnection;
this.#selfTargetId = selfTargetId;
this.#eventManager = eventManager;
this.#browsingContextStorage = browsingContextStorage;
this.#realmStorage = realmStorage;
this.#logger = logger;
this.#realmStorage = realmStorage;
this.#selfTargetId = selfTargetId;
this.#preloadScriptStorage = new PreloadScriptStorage_js_1.PreloadScriptStorage();
this.#setEventListeners(this.#cdpConnection.browserClient());

@@ -43,2 +42,5 @@ }

});
cdpClient.on('Target.targetInfoChanged', (params) => {
this.#handleTargetInfoChangedEvent(params);
});
cdpClient.on('Page.frameAttached', (params) => {

@@ -99,2 +101,8 @@ this.#handleFrameAttachedEvent(params);

}
#handleTargetInfoChangedEvent(params) {
const contextId = params.targetInfo.targetId;
this.#browsingContextStorage
.findContext(contextId)
?.onTargetInfoChanged(params);
}
async #getRealm(target) {

@@ -282,2 +290,10 @@ if ('realm' in target) {

}
async process_browsingContext_setViewport(params) {
const context = this.#browsingContextStorage.getContext(params.context);
if (!context.isTopLevelContext()) {
throw new protocol_js_1.Message.InvalidArgumentException('Emulating viewport is only supported on the top-level context');
}
await context.setViewport(params.viewport);
return { result: {} };
}
async process_browsingContext_close(commandParams) {

@@ -314,9 +330,9 @@ const browserCdpClient = this.#cdpConnection.browserClient();

async process_cdp_sendCommand(params) {
const client = params.cdpSession
? this.#cdpConnection.getCdpClient(params.cdpSession)
const client = params.session
? this.#cdpConnection.getCdpClient(params.session)
: this.#cdpConnection.browserClient();
const sendCdpCommandResult = await client.sendCommand(params.cdpMethod, params.cdpParams);
const sendCdpCommandResult = await client.sendCommand(params.method, params.params);
return {
result: sendCdpCommandResult,
cdpSession: params.cdpSession,
session: params.session,
};

@@ -328,5 +344,5 @@ }

if (sessionId === undefined) {
return { result: { cdpSession: null } };
return { result: { session: null } };
}
return { result: { cdpSession: sessionId } };
return { result: { session: sessionId } };
}

@@ -333,0 +349,0 @@ }

import type { ICdpClient } from '../../../cdp/cdpClient.js';
import type { RealmStorage } from '../script/realmStorage.js';
import type { IEventManager } from '../events/EventManager.js';
import { CommonDataTypes } from '../../../protocol/protocol.js';
import type { CommonDataTypes } from '../../../protocol/protocol.js';
import { Deferred } from '../../../utils/deferred.js';

@@ -6,0 +6,0 @@ import type { ChannelProxy } from '../script/channelProxy.js';

@@ -5,3 +5,2 @@ "use strict";

const logManager_js_1 = require("../log/logManager.js");
const protocol_js_1 = require("../../../protocol/protocol.js");
const deferred_js_1 = require("../../../utils/deferred.js");

@@ -95,9 +94,14 @@ const networkProcessor_js_1 = require("../network/networkProcessor.js");

#setEventListeners() {
this.#cdpClient.on('*', (cdpMethod, params) => {
this.#cdpClient.on('*', (event, params) => {
// We may encounter uses for EventEmitter
// other then CDP events we want to skip them
if (typeof event !== 'string') {
return;
}
this.#eventManager.registerEvent({
method: protocol_js_1.CDP.EventNames.EventReceivedEvent,
method: `cdp.${event}`,
params: {
cdpMethod: cdpMethod,
cdpParams: params ?? {},
cdpSession: this.#cdpSessionId,
event,
params: params,
session: this.#cdpSessionId,
},

@@ -104,0 +108,0 @@ }, null);

@@ -27,9 +27,8 @@ "use strict";

class EventWrapper {
#idWrapper;
#idWrapper = new idWrapper_js_1.IdWrapper();
#contextId;
#event;
constructor(event, contextId) {
this.#idWrapper = new idWrapper_js_1.IdWrapper();
this.#event = event;
this.#contextId = contextId;
this.#event = event;
}

@@ -36,0 +35,0 @@ get id() {

@@ -33,25 +33,27 @@ "use strict";

function unrollEvents(events) {
const allEvents = [];
const allEvents = new Set();
function addEvents(events) {
for (const event of events) {
allEvents.add(event);
}
}
for (const event of events) {
switch (event) {
case protocol_js_1.BrowsingContext.AllEvents:
allEvents.push(...Object.values(protocol_js_1.BrowsingContext.EventNames));
addEvents(Object.values(protocol_js_1.BrowsingContext.EventNames));
break;
case protocol_js_1.CDP.AllEvents:
allEvents.push(...Object.values(protocol_js_1.CDP.EventNames));
break;
case protocol_js_1.Log.AllEvents:
allEvents.push(...Object.values(protocol_js_1.Log.EventNames));
addEvents(Object.values(protocol_js_1.Log.EventNames));
break;
case protocol_js_1.Network.AllEvents:
allEvents.push(...Object.values(protocol_js_1.Network.EventNames));
addEvents(Object.values(protocol_js_1.Network.EventNames));
break;
case protocol_js_1.Script.AllEvents:
allEvents.push(...Object.values(protocol_js_1.Script.EventNames));
addEvents(Object.values(protocol_js_1.Script.EventNames));
break;
default:
allEvents.push(event);
allEvents.add(event);
}
}
return allEvents;
return [...allEvents.values()];
}

@@ -107,6 +109,2 @@ exports.unrollEvents = unrollEvents;

}
if (event === protocol_js_1.CDP.AllEvents) {
Object.values(protocol_js_1.CDP.EventNames).map((specificEvent) => this.subscribe(specificEvent, contextId, channel));
return;
}
if (event === protocol_js_1.Log.AllEvents) {

@@ -113,0 +111,0 @@ Object.values(protocol_js_1.Log.EventNames).map((specificEvent) => this.subscribe(specificEvent, contextId, channel));

@@ -40,4 +40,4 @@ "use strict";

#responseReceivedExtraInfoEvent;
#beforeRequestSentDeferred;
#responseReceivedDeferred;
#beforeRequestSentDeferred = new deferred_js_1.Deferred();
#responseReceivedDeferred = new deferred_js_1.Deferred();
constructor(requestId, eventManager) {

@@ -47,4 +47,2 @@ this.requestId = requestId;

this.#eventManager = eventManager;
this.#beforeRequestSentDeferred = new deferred_js_1.Deferred();
this.#responseReceivedDeferred = new deferred_js_1.Deferred();
}

@@ -131,8 +129,9 @@ onRequestWillBeSentEvent(event) {

#getNavigationId() {
if (!this.#requestWillBeSentEvent?.loaderId ||
if (!this.#requestWillBeSentEvent ||
!this.#requestWillBeSentEvent.loaderId ||
// When we navigate all CDP network events have `loaderId`
// CDP's `loaderId` and `requestId` match when
// that request triggered the loading
this.#requestWillBeSentEvent?.loaderId !==
this.#requestWillBeSentEvent?.requestId) {
this.#requestWillBeSentEvent.loaderId !==
this.#requestWillBeSentEvent.requestId) {
return null;

@@ -139,0 +138,0 @@ }

@@ -181,9 +181,7 @@ "use strict";

}
else {
// The channelProxy is already created by `getEvalInWindowStr` and
// is set into window property. Return it.
const channelProxy = w[id];
delete w[id];
return channelProxy;
}
// The channelProxy is already created by `getEvalInWindowStr` and
// is set into window property. Return it.
const channelProxy = w[id];
delete w[id];
return channelProxy;
}),

@@ -190,0 +188,0 @@ arguments: [{ value: this.#id }],

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

import type { Protocol } from 'devtools-protocol';
import type { CommonDataTypes, Script } from '../../../protocol/protocol.js';
import { Script } from '../../../protocol/protocol.js';
import type { CommonDataTypes } from '../../../protocol/protocol.js';
import type { BrowsingContextStorage } from '../context/browsingContextStorage.js';

@@ -58,2 +59,3 @@ import type { IEventManager } from '../events/EventManager.js';

stringifyObject(cdpObject: Protocol.Runtime.RemoteObject): Promise<string>;
delete(): void;
}

@@ -20,2 +20,3 @@ "use strict";

exports.Realm = void 0;
const protocol_js_1 = require("../../../protocol/protocol.js");
const log_js_1 = require("../../../utils/log.js");

@@ -50,4 +51,8 @@ const scriptEvaluator_js_1 = require("./scriptEvaluator.js");

this.#scriptEvaluator = new scriptEvaluator_js_1.ScriptEvaluator(this.#eventManager);
this.#realmStorage.realmMap.set(this.#realmId, this);
this.#realmStorage.addRealm(this);
this.#logger = logger;
this.#eventManager.registerEvent({
method: protocol_js_1.Script.EventNames.RealmCreated,
params: this.toBiDi(),
}, this.browsingContextId);
}

@@ -203,4 +208,12 @@ async #releaseObject(handle) {

}
delete() {
this.#eventManager.registerEvent({
method: protocol_js_1.Script.EventNames.RealmDestroyed,
params: {
realm: this.realmId,
},
}, this.browsingContextId);
}
}
exports.Realm = Realm;
//# sourceMappingURL=realm.js.map

@@ -34,3 +34,3 @@ /**

get knownHandlesToRealm(): Map<string, string>;
get realmMap(): Map<string, Realm>;
addRealm(realm: Realm): void;
/** Finds all realms that match the given filter. */

@@ -37,0 +37,0 @@ findRealms(filter: RealmFilter): Realm[];

@@ -14,4 +14,4 @@ "use strict";

}
get realmMap() {
return this.#realmMap;
addRealm(realm) {
this.#realmMap.set(realm.realmId, realm);
}

@@ -70,6 +70,7 @@ /** Finds all realms that match the given filter. */

this.findRealms(filter).map((realm) => {
realm.delete();
this.#realmMap.delete(realm.realmId);
Array.from(this.#knownHandlesToRealm.entries())
Array.from(this.knownHandlesToRealm.entries())
.filter(([, r]) => r === realm.realmId)
.map(([handle]) => this.#knownHandlesToRealm.delete(handle));
.map(([handle]) => this.knownHandlesToRealm.delete(handle));
});

@@ -76,0 +77,0 @@ }

@@ -0,2 +1,4 @@

import debug from 'debug';
import type { ITransport } from '../utils/transport.js';
export declare const debugInfo: debug.Debugger;
export declare class BidiServerRunner {

@@ -3,0 +5,0 @@ #private;

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.BidiServerRunner = void 0;
exports.BidiServerRunner = exports.debugInfo = void 0;
/**

@@ -27,6 +27,6 @@ * Copyright 2021 Google LLC.

const websocket_1 = __importDefault(require("websocket"));
const log = (0, debug_1.default)('bidiServer:log');
const debugInternal = (0, debug_1.default)('bidiServer:internal');
const debugSend = (0, debug_1.default)('bidiServer:SEND ▸');
const debugRecv = (0, debug_1.default)('bidiServer:RECV ◂');
exports.debugInfo = (0, debug_1.default)('bidi:server:info');
const debugInternal = (0, debug_1.default)('bidi:server:internal');
const debugSend = (0, debug_1.default)('bidi:server:SEND ▸');
const debugRecv = (0, debug_1.default)('bidi:server:RECV ◂');
function getHttpRequestPayload(request) {

@@ -92,3 +92,3 @@ return new Promise((resolve, reject) => {

server.listen(bidiPort, () => {
log('Server is listening on port', bidiPort);
(0, exports.debugInfo)('Server is listening on port', bidiPort);
});

@@ -118,3 +118,3 @@ const wsServer = new websocket_1.default.server({

});
bidiServer.initialise((messageStr) => {
bidiServer.initialize((messageStr) => {
return this.#sendClientMessageStr(messageStr, connection);

@@ -171,3 +171,3 @@ });

}
initialise(sendBidiMessage) {
initialize(sendBidiMessage) {
this.#sendBidiMessage = sendBidiMessage;

@@ -174,0 +174,0 @@ }

@@ -26,3 +26,2 @@ "use strict";

const argparse_1 = __importDefault(require("argparse"));
const debug_1 = __importDefault(require("debug"));
const browsers_1 = require("@puppeteer/browsers");

@@ -32,3 +31,2 @@ const bidiServerRunner_js_1 = require("./bidiServerRunner.js");

const mapperReader_js_1 = __importDefault(require("./mapperReader.js"));
const log = (0, debug_1.default)('bidiServer:log');
function parseArguments() {

@@ -64,3 +62,3 @@ const parser = new argparse_1.default.ArgumentParser({

try {
log('Launching BiDi server');
(0, bidiServerRunner_js_1.debugInfo)('Launching BiDi server');
const args = parseArguments();

@@ -74,6 +72,6 @@ const bidiPort = args.port;

});
log('BiDi server launched');
(0, bidiServerRunner_js_1.debugInfo)('BiDi server launched');
}
catch (e) {
log('Error', e);
(0, bidiServerRunner_js_1.debugInfo)('Error', e);
}

@@ -80,0 +78,0 @@ })();

@@ -28,6 +28,6 @@ "use strict";

const websocketTransport_js_1 = require("../utils/websocketTransport.js");
const debugInternal = (0, debug_1.default)('bidiMapper:internal');
const debugLog = (0, debug_1.default)('bidiMapper:log');
const mapperDebugLogOthers = (0, debug_1.default)('bidiMapper:mapperDebug:others');
const bidiMapperMapperDebugPrefix = 'bidiMapper:mapperDebug:';
const debugInternal = (0, debug_1.default)('bidi:mapper:internal');
const debugInfo = (0, debug_1.default)('bidi:mapper:info');
const debugMapperDebugOthers = (0, debug_1.default)('bidi:mapper:debug:others');
const debugMapperDebugPrefix = 'bidi:mapper:debug:';
class MapperServer {

@@ -103,4 +103,4 @@ #handlers = [];

const debugMessage = JSON.parse(debugMessageStr);
// BiDi traffic is logged in `bidiServer:SEND ▸`
if (debugMessage.logType === log_js_1.LogType.bidi) {
// BiDi traffic is logged in `bidi:server:SEND ▸`
if (debugMessage.logType.startsWith(log_js_1.LogType.bidi)) {
return;

@@ -110,3 +110,3 @@ }

debugMessage.messages !== undefined) {
(0, debug_1.default)(bidiMapperMapperDebugPrefix + debugMessage.logType)(
(0, debug_1.default)(debugMapperDebugPrefix + debugMessage.logType)(
// No formatter is needed as the messages will be formatted

@@ -120,9 +120,9 @@ // automatically.

// Fall back to raw log in case of unknown
mapperDebugLogOthers(debugMessageStr);
debugMapperDebugOthers(debugMessageStr);
};
#onConsoleAPICalled = (params) => {
debugLog('consoleAPICalled %s %O', params.type, params.args.map((arg) => arg.value));
debugInfo('consoleAPICalled %s %O', params.type, params.args.map((arg) => arg.value));
};
#onRuntimeExceptionThrown = (params) => {
debugLog('exceptionThrown', params);
debugInfo('exceptionThrown', params);
};

@@ -129,0 +129,0 @@ static async #initMapper(cdpConnection, mapperContent, verbose) {

@@ -83,5 +83,3 @@ "use strict";

}
return new cdpConnection_js_1.CdpConnection(new WindowCdpTransport(), (...messages) => {
(0, mapperTabPage_js_1.log)(log_js_1.LogType.cdp, ...messages);
});
return new cdpConnection_js_1.CdpConnection(new WindowCdpTransport(), mapperTabPage_js_1.log);
}

@@ -93,3 +91,3 @@ function createBidiServer(selfTargetId) {

window.onBidiMessage = (messageStr) => {
(0, mapperTabPage_js_1.log)(log_js_1.LogType.bidi, 'received ◂', messageStr);
(0, mapperTabPage_js_1.log)(`${log_js_1.LogType.bidi}:RECV ◂`, messageStr);
let messageObject;

@@ -113,3 +111,3 @@ try {

window.sendBidiResponse(messageStr);
(0, mapperTabPage_js_1.log)(log_js_1.LogType.bidi, 'sent ▸', messageStr);
(0, mapperTabPage_js_1.log)(`${log_js_1.LogType.bidi}:SEND ▸`, messageStr);
}

@@ -260,2 +258,5 @@ close() {

}
parseSetViewportParams(params) {
return Parser.BrowsingContext.parseSetViewportParams(params);
}
}

@@ -262,0 +263,0 @@ // Needed to filter out info related to BiDi target.

@@ -17,4 +17,4 @@ /**

*/
import { LogType } from '../utils/log.js';
import { type LogPrefix } from '../utils/log.js';
export declare function generatePage(): void;
export declare function log(logType: LogType, ...messages: unknown[]): void;
export declare function log(logType: LogPrefix, ...messages: unknown[]): void;

@@ -42,3 +42,3 @@ /**

*/
sendCommand<CdpMethod extends keyof ProtocolMapping.Commands>(method: CdpMethod, ...params: ProtocolMapping.Commands[CdpMethod]['paramsType']): Promise<ProtocolMapping.Commands[CdpMethod]['returnType']>;
sendCommand<CdpMethod extends keyof ProtocolMapping.Commands>(method: CdpMethod, params?: ProtocolMapping.Commands[CdpMethod]['paramsType'][0]): Promise<ProtocolMapping.Commands[CdpMethod]['returnType']>;
}

@@ -45,0 +45,0 @@ /** Represents a high-level CDP connection to the browser. */

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

import type { ITransport } from '../utils/transport.js';
import type { LoggerFn } from '../utils/log.js';
import { CdpClient, type ICdpClient } from './cdpClient.js';

@@ -31,3 +32,3 @@ export interface ICdpConnection {

#private;
constructor(transport: ITransport, logger?: (...messages: unknown[]) => void);
constructor(transport: ITransport, logger?: LoggerFn);
/** Closes the connection to the browser. */

@@ -34,0 +35,0 @@ close(): void;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CdpConnection = void 0;
const log_js_1 = require("../utils/log.js");
const cdpClient_js_1 = require("./cdpClient.js");

@@ -62,6 +63,6 @@ /**

void this.#transport.sendMessage(cdpMessageStr)?.catch((error) => {
this.#logger?.('error', error);
this.#logger?.(`${log_js_1.LogType.cdp}:ERROR`, error);
this.#transport.close();
});
this.#logger?.('sent ▸', JSON.stringify(cdpMessage, null, 2));
this.#logger?.(`${log_js_1.LogType.cdp}:SEND ▸`, JSON.stringify(cdpMessage, null, 2));
});

@@ -72,3 +73,3 @@ }

const messagePretty = JSON.stringify(messageParsed, null, 2);
this.#logger?.('received ◂', messagePretty);
this.#logger?.(`${log_js_1.LogType.cdp}:RECV ◂`, messagePretty);
// Update client map if a session is attached or detached.

@@ -75,0 +76,0 @@ // Listen for these events on every session.

@@ -22,3 +22,3 @@ /**

import { type ZodType, z as zod } from 'zod';
import { BrowsingContext as BrowsingContextTypes, Script as ScriptTypes, CDP as CdpTypes, type Session as SessionTypes, type CommonDataTypes as CommonDataTypesTypes, Input as InputTypes } from '../protocol/protocol.js';
import { BrowsingContext as BrowsingContextTypes, Script as ScriptTypes, type CDP as CdpTypes, type Session as SessionTypes, type CommonDataTypes as CommonDataTypesTypes, Input as InputTypes } from '../protocol/protocol.js';
export declare function parseObject<T extends ZodType>(obj: object, schema: T): zod.infer<T>;

@@ -236,2 +236,3 @@ export declare namespace CommonDataTypes {

function parsePrintParams(params: object): BrowsingContextTypes.PrintParameters;
function parseSetViewportParams(params: object): BrowsingContextTypes.SetViewportParameters;
}

@@ -238,0 +239,0 @@ export declare namespace CDP {

@@ -464,2 +464,22 @@ "use strict";

BrowsingContext.parsePrintParams = parsePrintParams;
// browsingContext.Viewport = {
// width: js-uint,
// height: js-uint,
// }
const ViewportSchema = zod_1.z.object({
width: zod_1.z.number().int().nonnegative(),
height: zod_1.z.number().int().nonnegative(),
});
// browsingContext.SetViewportParameters = {
// context: browsingContext.BrowsingContext,
// viewport: emulation.Viewport / null
// }
const SetViewportActionSchema = zod_1.z.object({
context: CommonDataTypes.BrowsingContextSchema,
viewport: zod_1.z.union([zod_1.z.null(), ViewportSchema]),
});
function parseSetViewportParams(params) {
return parseObject(params, SetViewportActionSchema);
}
BrowsingContext.parseSetViewportParams = parseSetViewportParams;
})(BrowsingContext = exports.BrowsingContext || (exports.BrowsingContext = {}));

@@ -470,7 +490,7 @@ var CDP;

// Allowing any cdpMethod, and casting to proper type later on.
cdpMethod: zod_1.z.string(),
method: zod_1.z.string(),
// `passthrough` allows object to have any fields.
// https://github.com/colinhacks/zod#passthrough
cdpParams: zod_1.z.object({}).passthrough(),
cdpSession: zod_1.z.string().optional(),
params: zod_1.z.object({}).passthrough().optional(),
session: zod_1.z.string().optional(),
});

@@ -492,3 +512,7 @@ function parseSendCommandParams(params) {

(function (Session) {
const SubscriptionRequestParametersEventsSchema = zod_1.z.enum([
// BiDi+ events
const CDPSubscriptionRequestParametersEventsSchema = zod_1.z.custom((value) => {
return typeof value === 'string' ? value.startsWith('cdp.') : false;
}, 'Not a CDP event');
const BiDiSubscriptionRequestParametersEventsSchema = zod_1.z.enum([
protocol_js_1.BrowsingContext.AllEvents,

@@ -498,4 +522,2 @@ ...Object.values(protocol_js_1.BrowsingContext.EventNames),

...Object.values(protocol_js_1.Log.EventNames),
protocol_js_1.CDP.AllEvents,
...Object.values(protocol_js_1.CDP.EventNames),
protocol_js_1.Network.AllEvents,

@@ -506,2 +528,6 @@ ...Object.values(protocol_js_1.Network.EventNames),

]);
const SubscriptionRequestParametersEventsSchema = zod_1.z.union([
CDPSubscriptionRequestParametersEventsSchema,
BiDiSubscriptionRequestParametersEventsSchema,
]);
// SessionSubscriptionRequest = {

@@ -508,0 +534,0 @@ // events: [*text],

@@ -273,3 +273,3 @@ /**

type Result = EvaluateResult | CallFunctionResult | GetRealmsResult | DisownResult | AddPreloadScriptResult;
type Event = MessageEvent | RealmCreatedEvent;
type Event = MessageEvent | RealmCreatedEvent | RealmDestroyedEvent;
type Realm = string;

@@ -453,9 +453,10 @@ type ScriptResult = ScriptResultSuccess | ScriptResultException;

type RealmCreatedEvent = EventResponse<EventNames.RealmCreated, RealmInfo>;
type RealmCreated = {
method: 'script.realmCreated';
params: RealmInfo;
type RealmDestroyedParameters = {
realm: Realm;
};
type RealmDestroyedEvent = EventResponse<EventNames.RealmDestroyed, RealmDestroyedParameters>;
enum EventNames {
MessageEvent = "script.message",
RealmCreated = "script.realmCreated"
RealmCreated = "script.realmCreated",
RealmDestroyed = "script.realmDestroyed"
}

@@ -465,3 +466,3 @@ const AllEvents = "script";

export declare namespace BrowsingContext {
type Command = CaptureScreenshotCommand | CloseCommand | CreateCommand | GetTreeCommand | NavigateCommand | PrintCommand | ReloadCommand;
type Command = CaptureScreenshotCommand | CloseCommand | CreateCommand | GetTreeCommand | NavigateCommand | PrintCommand | ReloadCommand | SetViewportCommand;
type Result = CaptureScreenshotResult | CreateResult | GetTreeResult | NavigateResult | PrintResult;

@@ -576,2 +577,14 @@ type Event = ContextCreatedEvent | ContextDestroyedEvent | DomContentLoadedEvent | FragmentNavigatedEvent | LoadEvent;

};
type Viewport = {
width: number;
height: number;
};
type SetViewportCommand = {
method: 'browsingContext.setViewport';
params: SetViewportParameters;
};
type SetViewportParameters = {
context: CommonDataTypes.BrowsingContext;
viewport: Viewport | null;
};
type LoadEvent = EventResponse<EventNames.LoadEvent, NavigationInfo>;

@@ -736,9 +749,10 @@ type DomContentLoadedEvent = EventResponse<EventNames.DomContentLoadedEvent, NavigationInfo>;

};
type SendCommandParams = {
cdpMethod: keyof ProtocolMapping.Commands;
cdpParams: object;
cdpSession?: string;
type SendCommandParams<Command extends keyof ProtocolMapping.Commands = keyof ProtocolMapping.Commands> = {
method: Command;
params?: ProtocolMapping.Commands[Command]['paramsType'][0];
session?: string;
};
type SendCommandResult = {
result: ProtocolMapping.Commands[keyof ProtocolMapping.Commands]['returnType'];
session?: string;
};

@@ -754,15 +768,12 @@ type GetSessionCommand = {

result: {
cdpSession: string;
session: string | null;
};
};
type EventReceivedEvent = EventResponse<EventNames.EventReceivedEvent, EventReceivedParams>;
type EventReceivedParams = {
cdpMethod: keyof ProtocolMapping.Commands;
cdpParams: object;
cdpSession: string;
type EventReceivedEvent = EventResponse<EventNames, CDPEventParams>;
type CDPEventParams<EventName extends keyof ProtocolMapping.Events = keyof ProtocolMapping.Events> = {
event: EventName;
params: ProtocolMapping.Events[EventName];
session: string;
};
const AllEvents = "cdp";
enum EventNames {
EventReceivedEvent = "cdp.eventReceived"
}
type EventNames = `cdp.${keyof ProtocolMapping.Events}`;
}

@@ -787,3 +798,3 @@ /** @see https://w3c.github.io/webdriver-bidi/#module-session */

};
type SubscriptionRequestEvent = Message.EventNames | typeof BrowsingContext.AllEvents | typeof CDP.AllEvents | typeof Log.AllEvents | typeof Network.AllEvents | typeof Script.AllEvents;
type SubscriptionRequestEvent = CDP.EventNames | Message.EventNames | typeof BrowsingContext.AllEvents | typeof Log.AllEvents | typeof Network.AllEvents | typeof Script.AllEvents;
type SubscriptionRequest = {

@@ -790,0 +801,0 @@ events: SubscriptionRequestEvent[];

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.Input = exports.CDP = exports.Network = exports.Log = exports.BrowsingContext = exports.Script = exports.Message = void 0;
exports.Input = exports.Network = exports.Log = exports.BrowsingContext = exports.Script = exports.Message = void 0;
// keep-sorted end

@@ -149,2 +149,3 @@ var Message;

EventNames["RealmCreated"] = "script.realmCreated";
EventNames["RealmDestroyed"] = "script.realmDestroyed";
// keep-sorted end

@@ -189,10 +190,2 @@ })(EventNames = Script.EventNames || (Script.EventNames = {}));

})(Network = exports.Network || (exports.Network = {}));
var CDP;
(function (CDP) {
CDP.AllEvents = 'cdp';
let EventNames;
(function (EventNames) {
EventNames["EventReceivedEvent"] = "cdp.eventReceived";
})(EventNames = CDP.EventNames || (CDP.EventNames = {}));
})(CDP = exports.CDP || (exports.CDP = {}));
/** @see https://w3c.github.io/webdriver-bidi/#module-input */

@@ -199,0 +192,0 @@ var Input;

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

}
export type LoggerFn = (type: LogType, ...messages: unknown[]) => void;
export type LogPrefix = LogType | `${LogType}:${string}`;
export type LoggerFn = (type: LogPrefix, ...messages: unknown[]) => void;
{
"name": "chromium-bidi",
"version": "0.4.13",
"version": "0.4.14",
"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": {

@@ -33,5 +33,5 @@ # WebDriver BiDi for Chromium [![chromium-bidi on npm](https://img.shields.io/npm/v/chromium-bidi)](https://www.npmjs.com/package/chromium-bidi)

CdpSendCommandParameters = {
cdpMethod: text,
cdpParams: any,
cdpSession?: text,
method: text,
params: any,
cession?: text,
}

@@ -41,3 +41,3 @@

result: any,
cdpSession: text,
session: text,
}

@@ -63,3 +63,3 @@ ```

CdpGetSessionResult = {
cdpSession: text,
session: text,
}

@@ -70,14 +70,14 @@ ```

### Event `cdp.eventReceived`
### Events `cdp`
```cddl
CdpEventReceivedEvent = {
method: "cdp.eventReceived",
params: ScriptEvaluateParameters,
method: "cdp.<CDP Event Name>",
params: CdpEventReceivedParameters,
}
CdpEventReceivedParameters = {
cdpMethod: text,
cdpParams: any,
cdpSession: string,
event: text,
params: any,
session: string,
}

@@ -187,6 +187,6 @@ ```

Use the CLI argument `--verbose` to have CDP events printed to the console. Note: you have to enable debugging output `bidiMapper:mapperDebug:*` as well.
Use the CLI argument `--verbose` to have CDP events printed to the console. Note: you have to enable debugging output `bidi:mapper:debug:*` as well.
```sh
DEBUG=bidiMapper:mapperDebug:* npm run server -- --verbose
DEBUG=bidi:mapper:debug:* npm run server -- --verbose
```

@@ -374,7 +374,5 @@

#### Semi-automatic release
#### Automatic release
Go to [GitHub Actions](https://github.com/GoogleChromeLabs/chromium-bidi/actions/workflows/create-release-pr.yml) and trigger a run with the correct SemVer
type.
That will create a PR. Once that is merge a new tag and release will be created.
We use [release-please](https://github.com/googleapis/release-please) to automate releases. When a release should be done, check for the release PR in our [pull requests](https://github.com/GoogleChromeLabs/chromium-bidi/pulls) and merge it.

@@ -392,3 +390,3 @@ #### Manual release

```sh
npm version patch -m 'Release v%s' --no-git-tag-version
npm version patch -m 'chore: Release v%s' --no-git-tag-version
```

@@ -395,0 +393,0 @@

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 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