You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/** Debuggee identifier. Either tabIdor extensionId must be specified */
2301
+
/** Debuggee identifier. Either tabId, extensionId or targetId must be specified */
2302
2302
export interface Debuggee {
2303
-
/** Optional. The id of the tab which you intend to debug. */
2304
-
tabId?: number | undefined;
2305
-
/**
2306
-
* Optional.
2307
-
* @since Chrome 27
2308
-
* The id of the extension which you intend to debug. Attaching to an extension background page is only possible when 'silent-debugger-extension-api' flag is enabled on the target browser.
2309
-
*/
2310
-
extensionId?: string | undefined;
2311
-
/**
2312
-
* Optional.
2313
-
* @since Chrome 28
2314
-
* The opaque id of the debug target.
2315
-
*/
2316
-
targetId?: string | undefined;
2303
+
/** The id of the tab which you intend to debug. */
2304
+
tabId?: number;
2305
+
/** The id of the extension which you intend to debug. Attaching to an extension background page is only possible when the `--silent-debugger-extension-api` command-line switch is used. */
2306
+
extensionId?: string;
2307
+
/** The opaque id of the debug target. */
2308
+
targetId?: string;
2317
2309
}
2318
2310
2319
2311
/**
2320
-
* @since Chrome 28
2321
-
* Debug target information
2312
+
* Debugger session identifier. One of tabId, extensionId or targetId must be specified. Additionally, an optional sessionId can be provided. If sessionId is specified for arguments sent from {@link onEvent}, it means the event is coming from a child protocol session within the root debuggee session. If sessionId is specified when passed to {@link sendCommand}, it targets a child protocol session within the root debuggee session.
2313
+
* @since Chrome 125
2322
2314
*/
2315
+
export interface DebuggerSession {
2316
+
/** The id of the extension which you intend to debug. Attaching to an extension background page is only possible when the `--silent-debugger-extension-api` command-line switch is used.*/
2317
+
extensionId?: string;
2318
+
/** The opaque id of the Chrome DevTools Protocol session. Identifies a child session within the root session identified by tabId, extensionId or targetId. */
2319
+
sessionId?: string;
2320
+
/** The id of the tab which you intend to debug. */
2321
+
tabId?: number;
2322
+
/** The opaque id of the debug target. */
2323
+
targetId?: string;
2324
+
}
2325
+
2326
+
/**
2327
+
* Connection termination reason.
2328
+
* @since Chrome 44
2329
+
*/
2330
+
export enum DetachReason {
2331
+
CANCELED_BY_USER = "canceled_by_user",
2332
+
TARGET_CLOSED = "target_closed",
2333
+
}
2334
+
2335
+
/** Debug target information */
2323
2336
export interface TargetInfo {
2324
2337
/** Target type. */
2325
-
type: string;
2338
+
type: `${TargetInfoType}`;
2326
2339
/** Target id. */
2327
2340
id: string;
2328
-
/**
2329
-
* Optional.
2330
-
* @since Chrome 30
2331
-
* The tab id, defined if type == 'page'.
2332
-
*/
2333
-
tabId?: number | undefined;
2334
-
/**
2335
-
* Optional.
2336
-
* @since Chrome 30
2337
-
* The extension id, defined if type = 'background_page'.
2338
-
*/
2339
-
extensionId?: string | undefined;
2341
+
/** The tab id, defined if type == 'page'. */
2342
+
tabId?: number;
2343
+
/** The extension id, defined if type = 'background_page'. */
* @param target Debugging target to which you want to attach.
2361
-
* @param requiredVersion Required debugging protocol version ("0.1"). One can only attach to the debuggee with matching major version and greater or equal minor version. List of the protocol versions can be obtained in the documentation pages.
2362
-
* @return The `attach` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
2356
+
* Target type.
2357
+
* @since Chrome 44
2363
2358
*/
2364
-
export function attach(target: Debuggee, requiredVersion: string): Promise<void>;
2359
+
export enum TargetInfoType {
2360
+
BACKGROUND_PAGE = "background_page",
2361
+
OTHER = "other",
2362
+
PAGE = "page",
2363
+
WORKER = "worker",
2364
+
}
2365
+
2365
2366
/**
2366
2367
* Attaches debugger to the given target.
2367
2368
* @param target Debugging target to which you want to attach.
2368
2369
* @param requiredVersion Required debugging protocol version ("0.1"). One can only attach to the debuggee with matching major version and greater or equal minor version. List of the protocol versions can be obtained in the documentation pages.
2369
-
* @param callback Called once the attach operation succeeds or fails. If the attach fails, runtime.lastError will be set to the error message.
2370
+
*
2371
+
* Can return its result via Promise since Chrome 96.
2370
2372
*/
2373
+
export function attach(target: Debuggee, requiredVersion: string): Promise<void>;
* @param target Debugging target from which you want to detach.
2375
-
* @return The `detach` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
2379
+
*
2380
+
* Can return its result via Promise since Chrome 96.
2376
2381
*/
2377
2382
export function detach(target: Debuggee): Promise<void>;
2378
-
/**
2379
-
* Detaches debugger from the given target.
2380
-
* @param target Debugging target from which you want to detach.
2381
-
* @param callback Called once the detach operation succeeds or fails. If the detach fails, runtime.lastError will be set to the error message.
2382
-
*/
2383
2383
export function detach(target: Debuggee, callback: () => void): void;
2384
+
2384
2385
/**
2385
2386
* Sends given command to the debugging target.
2386
2387
* @param target Debugging target to which you want to send the command.
2387
2388
* @param method Method name. Should be one of the methods defined by the remote debugging protocol.
2388
-
* @param commandParams Since Chrome 22.
2389
-
* JSON object with request parameters. This object must conform to the remote debugging params scheme for given method.
2390
-
* @return The `sendCommand` method provides its result via callback or returned as a `Promise` (MV3 only).
2389
+
* @param commandParams JSON object with request parameters. This object must conform to the remote debugging params scheme for given method.
2390
+
*
2391
+
* Can return its result via Promise since Chrome 96.
2391
2392
*/
2392
2393
export function sendCommand(
2393
-
target: Debuggee,
2394
+
target: DebuggerSession,
2394
2395
method: string,
2395
2396
commandParams?: Object,
2396
-
): Promise<Object>;
2397
-
/**
2398
-
* Sends given command to the debugging target.
2399
-
* @param target Debugging target to which you want to send the command.
2400
-
* @param method Method name. Should be one of the methods defined by the remote debugging protocol.
2401
-
* @param commandParams Since Chrome 22.
2402
-
* JSON object with request parameters. This object must conform to the remote debugging params scheme for given method.
2403
-
* @param callback Response body. If an error occurs while posting the message, the callback will be called with no arguments and runtime.lastError will be set to the error message.
2404
-
*/
2397
+
): Promise<Object | undefined>;
2405
2398
export function sendCommand(
2406
-
target: Debuggee,
2399
+
target: DebuggerSession,
2407
2400
method: string,
2408
2401
commandParams?: Object,
2409
2402
callback?: (result?: Object) => void,
2410
2403
): void;
2404
+
2411
2405
/**
2412
-
* @since Chrome 28
2413
2406
* Returns the list of available debug targets.
2414
-
* @return The `getTargets` method provides its result via callback or returned as a `Promise` (MV3 only).
2407
+
*
2408
+
* Can return its result via Promise since Chrome 96.
2415
2409
*/
2416
2410
export function getTargets(): Promise<TargetInfo[]>;
2417
-
/**
2418
-
* @since Chrome 28
2419
-
* Returns the list of available debug targets.
2420
-
* Parameter result: Array of TargetInfo objects corresponding to the available debug targets.
2421
-
*/
2422
2411
export function getTargets(callback: (result: TargetInfo[]) => void): void;
2423
2412
2424
2413
/** Fired when browser terminates debugging session for the tab. This happens when either the tab is being closed or Chrome DevTools is being invoked for the attached tab. */
0 commit comments