@types/chrome 0.1.23 → 0.1.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. chrome/README.md +1 -1
  2. chrome/index.d.ts +322 -200
  3. chrome/package.json +2 -2
chrome/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for chrome (https://developer.chrome.com/
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/chrome.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Sat, 11 Oct 2025 05:34:11 GMT
11
+ * Last updated: Mon, 27 Oct 2025 18:40:39 GMT
12
12
  * Dependencies: [@types/filesystem](https://npmjs.com/package/@types/filesystem), [@types/har-format](https://npmjs.com/package/@types/har-format)
13
13
 
14
14
  # Credits
chrome/index.d.ts CHANGED
@@ -7899,13 +7899,25 @@ declare namespace chrome {
7899
7899
  id: string;
7900
7900
  /** Printer's human readable name. */
7901
7901
  name: string;
7902
- /** Optional. Printer's human readable description. */
7902
+ /** Printer's human readable description. */
7903
7903
  description?: string | undefined;
7904
7904
  }
7905
7905
 
7906
+ /** Error codes returned in response to {@link onPrintRequested} event. */
7907
+ export enum PrintError {
7908
+ /** Specifies that the operation was completed successfully. */
7909
+ OK = "OK",
7910
+ /** Specifies that a general failure occured. */
7911
+ FAILED = "FAILED",
7912
+ /** Specifies that the print ticket is invalid. For example, the ticket is inconsistent with some capabilities, or the extension is not able to handle all settings from the ticket. */
7913
+ INVALID_TICKET = "INVALID_TICKET",
7914
+ /** Specifies that the document is invalid. For example, data may be corrupted or the format is incompatible with the extension. */
7915
+ INVALID_DATA = "INVALID_DATA",
7916
+ }
7917
+
7906
7918
  export interface PrinterCapabilities {
7907
7919
  /** Device capabilities in CDD format. */
7908
- capabilities: any;
7920
+ capabilities: { [key: string]: unknown };
7909
7921
  }
7910
7922
 
7911
7923
  export interface PrintJob {
@@ -7913,44 +7925,68 @@ declare namespace chrome {
7913
7925
  printerId: string;
7914
7926
  /** The print job title. */
7915
7927
  title: string;
7916
- /** Print ticket in CJT format. */
7928
+ /** Print ticket in CJT format. */
7917
7929
  ticket: { [key: string]: unknown };
7918
- /** The document content type. Supported formats are "application/pdf" and "image/pwg-raster". */
7930
+ /** The document content type. Supported formats are `application/pdf` and `image/pwg-raster`. */
7919
7931
  contentType: string;
7920
- /** Blob containing the document data to print. Format must match |contentType|. */
7932
+ /** Blob containing the document data to print. Format must match `contentType`. */
7921
7933
  document: Blob;
7922
7934
  }
7923
7935
 
7924
- export interface PrinterRequestedEvent
7925
- extends chrome.events.Event<(resultCallback: (printerInfo: PrinterInfo[]) => void) => void>
7926
- {}
7927
-
7928
- export interface PrinterInfoRequestedEvent
7929
- extends chrome.events.Event<(device: any, resultCallback: (printerInfo?: PrinterInfo) => void) => void>
7930
- {}
7931
-
7932
- export interface CapabilityRequestedEvent extends
7933
- chrome.events.Event<
7934
- (printerId: string, resultCallback: (capabilities: PrinterCapabilities) => void) => void
7935
- >
7936
- {}
7937
-
7938
- export interface PrintRequestedEvent
7939
- extends chrome.events.Event<(printJob: PrintJob, resultCallback: (result: string) => void) => void>
7940
- {}
7936
+ /** from https://developer.chrome.com/docs/apps/reference/usb#type-Device */
7937
+ export interface Device {
7938
+ /** An opaque ID for the USB device. It remains unchanged until the device is unplugged. */
7939
+ device: number;
7940
+ /**
7941
+ * The iManufacturer string read from the device, if available.
7942
+ * @since Chrome 46
7943
+ */
7944
+ manufacturerName: string;
7945
+ /** The product ID. */
7946
+ productId: number;
7947
+ /**
7948
+ * The iProduct string read from the device, if available.
7949
+ * @since Chrome 46
7950
+ */
7951
+ productName: string;
7952
+ /**
7953
+ * The iSerialNumber string read from the device, if available.
7954
+ * @since Chrome 46
7955
+ */
7956
+ serialNumber: string;
7957
+ /** The device vendor ID. */
7958
+ vendorId: number;
7959
+ /**
7960
+ * The device version (bcdDevice field).
7961
+ * @since Chrome 51
7962
+ */
7963
+ version: number;
7964
+ }
7941
7965
 
7942
7966
  /** Event fired when print manager requests printers provided by extensions. */
7943
- export var onGetPrintersRequested: PrinterRequestedEvent;
7967
+ export const onGetPrintersRequested: events.Event<
7968
+ (resultCallback: (printerInfo: PrinterInfo[]) => void) => void
7969
+ >;
7970
+
7944
7971
  /**
7945
7972
  * Event fired when print manager requests information about a USB device that may be a printer.
7946
- * Note: An application should not rely on this event being fired more than once per device. If a connected device is supported it should be returned in the onGetPrintersRequested event.
7973
+ *
7974
+ * Note: An application should not rely on this event being fired more than once per device. If a connected device is supported it should be returned in the {@link onGetPrintersRequested} event.
7947
7975
  * @since Chrome 45
7948
7976
  */
7949
- export var onGetUsbPrinterInfoRequested: PrinterInfoRequestedEvent;
7977
+ export const onGetUsbPrinterInfoRequested: events.Event<
7978
+ (device: Device, resultCallback: (printerInfo?: PrinterInfo) => void) => void
7979
+ >;
7980
+
7950
7981
  /** Event fired when print manager requests printer capabilities. */
7951
- export var onGetCapabilityRequested: CapabilityRequestedEvent;
7982
+ export const onGetCapabilityRequested: events.Event<
7983
+ (printerId: string, resultCallback: (capabilities: PrinterCapabilities) => void) => void
7984
+ >;
7985
+
7952
7986
  /** Event fired when print manager requests printing. */
7953
- export var onPrintRequested: PrintRequestedEvent;
7987
+ export const onPrintRequested: events.Event<
7988
+ (printJob: PrintJob, resultCallback: (result: `${PrintError}`) => void) => void
7989
+ >;
7954
7990
  }
7955
7991
 
7956
7992
  ////////////////////
@@ -12211,16 +12247,16 @@ declare namespace chrome {
12211
12247
  */
12212
12248
  value: T;
12213
12249
  /** Where to set the setting (default: regular). */
12214
- scope?: ChromeSettingScope;
12250
+ scope?: ChromeSettingScope | undefined;
12215
12251
  }
12216
12252
 
12217
12253
  /** Which setting to consider. */
12218
12254
  export interface ChromeSettingGetDetails {
12219
12255
  /** Whether to return the value that applies to the incognito session (default false). */
12220
- incognito?: boolean;
12256
+ incognito?: boolean | undefined;
12221
12257
  }
12222
12258
 
12223
- /** Details of the currently effective value */
12259
+ /** Details of the currently effective value. */
12224
12260
  export interface ChromeSettingGetResult<T> {
12225
12261
  /** The level of control of the setting. */
12226
12262
  levelOfControl: LevelOfControl;
@@ -12228,7 +12264,7 @@ declare namespace chrome {
12228
12264
  value: T;
12229
12265
  /**
12230
12266
  * Whether the effective value is specific to the incognito session.
12231
- * This property will only be present if the incognito property in the details parameter of get() was true.
12267
+ * This property will only be present if the `incognito` property in the `details` parameter of `get()` was true.
12232
12268
  */
12233
12269
  incognitoSpecific?: boolean;
12234
12270
  }
@@ -12236,17 +12272,14 @@ declare namespace chrome {
12236
12272
  /** Which setting to clear. */
12237
12273
  export interface ChromeSettingClearDetails {
12238
12274
  /** Where to clear the setting (default: regular). */
12239
- scope?: ChromeSettingScope;
12275
+ scope?: ChromeSettingScope | undefined;
12240
12276
  }
12241
12277
 
12242
12278
  /** Details of the currently effective value. */
12243
12279
  export interface ChromeSettingOnChangeDetails<T> {
12244
- /**
12245
- * Whether the effective value is specific to the incognito session. T
12246
- * his property will only be present if the incognito property in the details parameter of get() was true.
12247
- */
12280
+ /** Whether the value that has changed is specific to the incognito session. This property will only be present if the user has enabled the extension in incognito mode. */
12248
12281
  incognitoSpecific?: boolean;
12249
- /** The value of the setting. */
12282
+ /** The value of the setting after the change. */
12250
12283
  value: T;
12251
12284
  /** The level of control of the setting. */
12252
12285
  levelOfControl: LevelOfControl;
@@ -12259,27 +12292,30 @@ declare namespace chrome {
12259
12292
  export interface ChromeSetting<T> {
12260
12293
  /**
12261
12294
  * Sets the value of a setting.
12295
+ *
12262
12296
  * Can return its result via Promise in Manifest V3 or later since Chrome 96.
12263
12297
  */
12264
- set(details: ChromeSettingSetDetails<T>, callback: () => void): void;
12265
12298
  set(details: ChromeSettingSetDetails<T>): Promise<void>;
12299
+ set(details: ChromeSettingSetDetails<T>, callback: () => void): void;
12266
12300
 
12267
12301
  /**
12268
12302
  * Gets the value of a setting.
12303
+ *
12269
12304
  * Can return its result via Promise in Manifest V3 or later since Chrome 96.
12270
12305
  */
12271
- get(details: ChromeSettingGetDetails, callback: (details: ChromeSettingGetResult<T>) => void): void;
12272
12306
  get(details: ChromeSettingGetDetails): Promise<ChromeSettingGetResult<T>>;
12307
+ get(details: ChromeSettingGetDetails, callback: (details: ChromeSettingGetResult<T>) => void): void;
12273
12308
 
12274
12309
  /**
12275
12310
  * Clears the setting, restoring any default value.
12311
+ *
12276
12312
  * Can return its result via Promise in Manifest V3 or later since Chrome 96.
12277
12313
  */
12278
- clear(details: ChromeSettingClearDetails, callback: () => void): void;
12279
12314
  clear(details: ChromeSettingClearDetails): Promise<void>;
12315
+ clear(details: ChromeSettingClearDetails, callback: () => void): void;
12280
12316
 
12281
12317
  /** Fired after the setting changes. */
12282
- onChange: chrome.events.Event<(details: ChromeSettingOnChangeDetails<T>) => void>;
12318
+ onChange: events.Event<(details: ChromeSettingOnChangeDetails<T>) => void>;
12283
12319
  }
12284
12320
  }
12285
12321
 
@@ -12294,85 +12330,134 @@ declare namespace chrome {
12294
12330
  * @since Chrome 43
12295
12331
  */
12296
12332
  export namespace vpnProvider {
12297
- export interface VpnSessionParameters {
12333
+ export interface Parameters {
12298
12334
  /** IP address for the VPN interface in CIDR notation. IPv4 is currently the only supported mode. */
12299
12335
  address: string;
12300
- /** Optional. Broadcast address for the VPN interface. (default: deduced from IP address and mask) */
12336
+ /** Broadcast address for the VPN interface. (default: deduced from IP address and mask) */
12301
12337
  broadcastAddress?: string | undefined;
12302
- /** Optional. MTU setting for the VPN interface. (default: 1500 bytes) */
12338
+ /** MTU setting for the VPN interface. (default: 1500 bytes) */
12303
12339
  mtu?: string | undefined;
12304
- /**
12305
- * Exclude network traffic to the list of IP blocks in CIDR notation from the tunnel. This can be used to bypass traffic to and from the VPN server. When many rules match a destination, the rule with the longest matching prefix wins. Entries that correspond to the same CIDR block are treated as duplicates. Such duplicates in the collated (exclusionList + inclusionList) list are eliminated and the exact duplicate entry that will be eliminated is undefined.
12306
- */
12340
+ /** Exclude network traffic to the list of IP blocks in CIDR notation from the tunnel. This can be used to bypass traffic to and from the VPN server. When many rules match a destination, the rule with the longest matching prefix wins. Entries that correspond to the same CIDR block are treated as duplicates. Such duplicates in the collated (exclusionList + inclusionList) list are eliminated and the exact duplicate entry that will be eliminated is undefined. */
12307
12341
  exclusionList: string[];
12308
- /**
12309
- * Include network traffic to the list of IP blocks in CIDR notation to the tunnel. This parameter can be used to set up a split tunnel. By default no traffic is directed to the tunnel. Adding the entry "0.0.0.0/0" to this list gets all the user traffic redirected to the tunnel. When many rules match a destination, the rule with the longest matching prefix wins. Entries that correspond to the same CIDR block are treated as duplicates. Such duplicates in the collated (exclusionList + inclusionList) list are eliminated and the exact duplicate entry that will be eliminated is undefined.
12310
- */
12342
+ /** Include network traffic to the list of IP blocks in CIDR notation to the tunnel. This parameter can be used to set up a split tunnel. By default no traffic is directed to the tunnel. Adding the entry "0.0.0.0/0" to this list gets all the user traffic redirected to the tunnel. When many rules match a destination, the rule with the longest matching prefix wins. Entries that correspond to the same CIDR block are treated as duplicates. Such duplicates in the collated (exclusionList + inclusionList) list are eliminated and the exact duplicate entry that will be eliminated is undefined. */
12311
12343
  inclusionList: string[];
12312
- /** Optional. A list of search domains. (default: no search domain) */
12344
+ /** A list of search domains. (default: no search domain) */
12313
12345
  domainSearch?: string[] | undefined;
12314
12346
  /** A list of IPs for the DNS servers. */
12315
- dnsServer: string[];
12347
+ dnsServers: string[];
12348
+ /**
12349
+ * Whether or not the VPN extension implements auto-reconnection.
12350
+ *
12351
+ * If true, the `linkDown`, `linkUp`, `linkChanged`, `suspend`, and `resume` platform messages will be used to signal the respective events. If false, the system will forcibly disconnect the VPN if the network topology changes, and the user will need to reconnect manually. (default: false)
12352
+ *
12353
+ * This property is new in Chrome 51; it will generate an exception in earlier versions. try/catch can be used to conditionally enable the feature based on browser support.
12354
+ * @since Chrome 51
12355
+ */
12356
+ reconnect?: string | undefined;
12316
12357
  }
12317
12358
 
12318
- export interface VpnPlatformMessageEvent
12319
- extends chrome.events.Event<(id: string, message: string, error: string) => void>
12320
- {}
12359
+ /** @deprecated Use {@link Parameters} instead */
12360
+ interface VpnSessionParameters extends Parameters {}
12321
12361
 
12322
- export interface VpnPacketReceptionEvent extends chrome.events.Event<(data: ArrayBuffer) => void> {}
12323
-
12324
- export interface VpnConfigRemovalEvent extends chrome.events.Event<(id: string) => void> {}
12362
+ /** The enum is used by the platform to notify the client of the VPN session status. */
12363
+ export enum PlatformMessage {
12364
+ /** Indicates that the VPN configuration connected. */
12365
+ CONNECTED = "connected",
12366
+ /** Indicates that the VPN configuration disconnected. */
12367
+ DISCONNECTED = "disconnected",
12368
+ /** Indicates that an error occurred in VPN connection, for example a timeout. A description of the error is given as the error argument to onPlatformMessage. */
12369
+ ERROR = "error",
12370
+ /** Indicates that the default physical network connection is down. */
12371
+ LINK_DOWN = "linkDown",
12372
+ /** Indicates that the default physical network connection is back up. */
12373
+ LINK_UP = "linkUp",
12374
+ /** Indicates that the default physical network connection changed, e.g. wifi->mobile. */
12375
+ LINK_CHANGED = "linkChanged",
12376
+ /** Indicates that the OS is preparing to suspend, so the VPN should drop its connection. The extension is not guaranteed to receive this event prior to suspending. */
12377
+ SUSPEND = "suspend",
12378
+ /** Indicates that the OS has resumed and the user has logged back in, so the VPN should try to reconnect. */
12379
+ RESUME = "resume",
12380
+ }
12325
12381
 
12326
- export interface VpnConfigCreationEvent
12327
- extends chrome.events.Event<(id: string, name: string, data: { [key: string]: unknown }) => void>
12328
- {}
12382
+ /** The enum is used by the platform to indicate the event that triggered {@link onUIEvent}. */
12383
+ export enum UIEvent {
12384
+ /** Requests that the VPN client show the add configuration dialog box to the user. */
12385
+ SHOW_ADD_DIALOG = "showAddDialog",
12386
+ /** Requests that the VPN client show the configuration settings dialog box to the user. */
12387
+ SHOW_CONFIGURE_DIALOG = "showConfigureDialog",
12388
+ }
12329
12389
 
12330
- export interface VpnUiEvent extends chrome.events.Event<(event: string, id?: string) => void> {}
12390
+ /** The enum is used by the VPN client to inform the platform of its current state. This helps provide meaningful messages to the user. */
12391
+ export enum VpnConnectionState {
12392
+ /** Specifies that VPN connection was successful. */
12393
+ CONNECTED = "connected",
12394
+ /** Specifies that VPN connection has failed. */
12395
+ FAILURE = "failure",
12396
+ }
12331
12397
 
12332
12398
  /**
12333
12399
  * Creates a new VPN configuration that persists across multiple login sessions of the user.
12400
+ *
12401
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
12334
12402
  * @param name The name of the VPN configuration.
12335
- * @param callback Called when the configuration is created or if there is an error.
12336
- * Parameter id: A unique ID for the created configuration, empty string on failure.
12337
12403
  */
12404
+ export function createConfig(name: string): Promise<string>;
12338
12405
  export function createConfig(name: string, callback: (id: string) => void): void;
12406
+
12339
12407
  /**
12340
12408
  * Destroys a VPN configuration created by the extension.
12409
+ *
12410
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
12341
12411
  * @param id ID of the VPN configuration to destroy.
12342
- * @param callback Optional. Called when the configuration is destroyed or if there is an error.
12343
12412
  */
12344
- export function destroyConfig(id: string, callback?: () => void): void;
12413
+ export function destroyConfig(id: string): Promise<void>;
12414
+ export function destroyConfig(id: string, callback: () => void): void;
12415
+
12345
12416
  /**
12346
- * Sets the parameters for the VPN session. This should be called immediately after "connected" is received from the platform. This will succeed only when the VPN session is owned by the extension.
12417
+ * Sets the parameters for the VPN session. This should be called immediately after `"connected"` is received from the platform. This will succeed only when the VPN session is owned by the extension.
12418
+ *
12419
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
12347
12420
  * @param parameters The parameters for the VPN session.
12348
- * @param callback Called when the parameters are set or if there is an error.
12349
12421
  */
12350
- export function setParameters(parameters: VpnSessionParameters, callback?: () => void): void;
12422
+ export function setParameters(parameters: Parameters): Promise<void>;
12423
+ export function setParameters(parameters: Parameters, callback: () => void): void;
12424
+
12351
12425
  /**
12352
12426
  * Sends an IP packet through the tunnel created for the VPN session. This will succeed only when the VPN session is owned by the extension.
12427
+ *
12428
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
12353
12429
  * @param data The IP packet to be sent to the platform.
12354
- * @param callback Optional. Called when the packet is sent or if there is an error.
12355
12430
  */
12356
- export function sendPacket(data: ArrayBuffer, callback?: () => void): void;
12431
+ export function sendPacket(data: ArrayBuffer): Promise<void>;
12432
+ export function sendPacket(data: ArrayBuffer, callback: () => void): void;
12433
+
12357
12434
  /**
12358
12435
  * Notifies the VPN session state to the platform. This will succeed only when the VPN session is owned by the extension.
12436
+ *
12437
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
12359
12438
  * @param state The VPN session state of the VPN client.
12360
- * connected: VPN connection was successful.
12361
- * failure: VPN connection failed.
12362
- * @param callback Optional. Called when the notification is complete or if there is an error.
12363
12439
  */
12364
- export function notifyConnectionStateChanged(state: string, callback?: () => void): void;
12440
+ export function notifyConnectionStateChanged(state: `${VpnConnectionState}`): Promise<void>;
12441
+ export function notifyConnectionStateChanged(state: `${VpnConnectionState}`, callback: () => void): void;
12365
12442
 
12366
12443
  /** Triggered when a message is received from the platform for a VPN configuration owned by the extension. */
12367
- export var onPlatformMessage: VpnPlatformMessageEvent;
12444
+ export const onPlatformMessage: events.Event<
12445
+ (id: string, message: `${PlatformMessage}`, error: string) => void
12446
+ >;
12447
+
12368
12448
  /** Triggered when an IP packet is received via the tunnel for the VPN session owned by the extension. */
12369
- export var onPacketReceived: VpnPacketReceptionEvent;
12449
+ export const onPacketReceived: events.Event<(data: ArrayBuffer) => void>;
12450
+
12370
12451
  /** Triggered when a configuration created by the extension is removed by the platform. */
12371
- export var onConfigRemoved: VpnConfigRemovalEvent;
12372
- /** Triggered when a configuration is created by the platform for the extension. */
12373
- export var onConfigCreated: VpnConfigCreationEvent;
12452
+ export const onConfigRemoved: events.Event<(id: string) => void>;
12453
+
12454
+ // /** Triggered when a configuration is created by the platform for the extension. */
12455
+ export const onConfigCreated: events.Event<
12456
+ (id: string, name: string, data: { [key: string]: unknown }) => void
12457
+ >;
12458
+
12374
12459
  /** Triggered when there is a UI event for the extension. UI events are signals from the platform that indicate to the app that a UI dialog needs to be shown to the user. */
12375
- export var onUIEvent: VpnUiEvent;
12460
+ export const onUIEvent: events.Event<(event: `${UIEvent}`, id?: string) => void>;
12376
12461
  }
12377
12462
 
12378
12463
  ////////////////////
@@ -12536,33 +12621,84 @@ declare namespace chrome {
12536
12621
  * Permissions: "webNavigation"
12537
12622
  */
12538
12623
  export namespace webNavigation {
12539
- export interface GetFrameDetails {
12540
- /**
12541
- * The ID of the process runs the renderer for this tab.
12542
- * @since Chrome 22
12543
- * @deprecated since Chrome 49. Frames are now uniquely identified by their tab ID and frame ID; the process ID is no longer needed and therefore ignored.
12544
- */
12545
- processId?: number | undefined;
12546
- /** The ID of the tab in which the frame is. */
12547
- tabId: number;
12548
- /** The ID of the frame in the given tab. */
12549
- frameId: number;
12624
+ /** @since Chrome 44 */
12625
+ export enum TransitionQualifier {
12626
+ CLIENT_REDIRECT = "client_redirect",
12627
+ SERVER_REDIRECT = "server_redirect",
12628
+ FORWARD_BACK = "forward_back",
12629
+ FROM_ADDRESS_BAR = "from_address_bar",
12630
+ }
12631
+
12632
+ /**
12633
+ * Cause of the navigation. The same transition types as defined in the history API are used. These are the same transition types as defined in the history API except with `"start_page"` in place of `"auto_toplevel"` (for backwards compatibility).
12634
+ * @since Chrome 44
12635
+ */
12636
+ export enum TransitionType {
12637
+ LINK = "link",
12638
+ TYPED = "typed",
12639
+ AUTO_BOOKMARK = "auto_bookmark",
12640
+ AUTO_SUBFRAME = "auto_subframe",
12641
+ MANUAL_SUBFRAME = "manual_subframe",
12642
+ GENERATED = "generated",
12643
+ START_PAGE = "start_page",
12644
+ FORM_SUBMIT = "form_submit",
12645
+ RELOAD = "reload",
12646
+ KEYWORD = "keyword",
12647
+ KEYWORD_GENERATED = "keyword_generated",
12550
12648
  }
12551
12649
 
12650
+ export type GetFrameDetails =
12651
+ & ({
12652
+ /**
12653
+ * The ID of the process that runs the renderer for this tab.
12654
+ * @deprecated since Chrome 49. Frames are now uniquely identified by their tab ID and frame ID; the process ID is no longer needed and therefore ignored.
12655
+ */
12656
+ processId?: number | undefined;
12657
+ })
12658
+ & (
12659
+ {
12660
+ /** The ID of the tab in which the frame is. */
12661
+ tabId?: number | undefined;
12662
+ /** The ID of the frame in the given tab. */
12663
+ frameId?: number | undefined;
12664
+ /**
12665
+ * The UUID of the document. If the frameId and/or tabId are provided they will be validated to match the document found by provided document ID.
12666
+ * @since Chrome 106
12667
+ */
12668
+ documentId: string;
12669
+ } | {
12670
+ /** The ID of the tab in which the frame is. */
12671
+ tabId: number;
12672
+ /** The ID of the frame in the given tab. */
12673
+ frameId: number;
12674
+ /**
12675
+ * The UUID of the document. If the frameId and/or tabId are provided they will be validated to match the document found by provided document ID.
12676
+ * @since Chrome 106
12677
+ */
12678
+ documentId?: string | undefined;
12679
+ }
12680
+ );
12681
+
12552
12682
  export interface GetFrameResultDetails {
12553
12683
  /** The URL currently associated with this frame, if the frame identified by the frameId existed at one point in the given tab. The fact that an URL is associated with a given frameId does not imply that the corresponding frame still exists. */
12554
12684
  url: string;
12555
12685
  /** A UUID of the document loaded. */
12556
12686
  documentId: string;
12557
- /** The lifecycle the document is in. */
12687
+ /**
12688
+ * The lifecycle the document is in.
12689
+ * @since Chrome 106
12690
+ */
12558
12691
  documentLifecycle: extensionTypes.DocumentLifecycle;
12559
12692
  /** True if the last navigation in this frame was interrupted by an error, i.e. the onErrorOccurred event fired. */
12560
12693
  errorOccurred: boolean;
12561
12694
  /** The type of frame the navigation occurred in. */
12562
12695
  frameType: extensionTypes.FrameType;
12563
- /** A UUID of the parent document owning this frame. This is not set if there is no parent. */
12696
+ /**
12697
+ * A UUID of the parent document owning this frame. This is not set if there is no parent.
12698
+ * @since Chrome 106
12699
+ */
12564
12700
  parentDocumentId?: string | undefined;
12565
- /** ID of frame that wraps the frame. Set to -1 of no parent frame exists. */
12701
+ /** The ID of the parent frame, or `-1` if this is the main frame. */
12566
12702
  parentFrameId: number;
12567
12703
  }
12568
12704
 
@@ -12571,83 +12707,86 @@ declare namespace chrome {
12571
12707
  tabId: number;
12572
12708
  }
12573
12709
 
12710
+ /** A list of frames in the given tab, null if the specified tab ID is invalid. */
12574
12711
  export interface GetAllFrameResultDetails extends GetFrameResultDetails {
12575
- /** The ID of the process runs the renderer for this tab. */
12712
+ /** The ID of the process that runs the renderer for this frame. */
12576
12713
  processId: number;
12577
12714
  /** The ID of the frame. 0 indicates that this is the main frame; a positive value indicates the ID of a subframe. */
12578
12715
  frameId: number;
12579
12716
  }
12580
12717
 
12581
- export interface WebNavigationCallbackDetails {
12582
- /** The ID of the tab in which the navigation is about to occur. */
12583
- tabId: number;
12584
- /** The time when the browser was about to start the navigation, in milliseconds since the epoch. */
12585
- timeStamp: number;
12586
- }
12587
-
12588
- export interface WebNavigationUrlCallbackDetails extends WebNavigationCallbackDetails {
12589
- url: string;
12590
- }
12591
-
12592
- export interface WebNavigationReplacementCallbackDetails extends WebNavigationCallbackDetails {
12718
+ export interface WebNavigationReplacementCallbackDetails {
12593
12719
  /** The ID of the tab that was replaced. */
12594
12720
  replacedTabId: number;
12721
+ /** The ID of the tab that replaced the old tab. */
12722
+ tabId: number;
12723
+ /** The time when the replacement happened, in milliseconds since the epoch. */
12724
+ timeStamp: number;
12595
12725
  }
12596
12726
 
12597
- export interface WebNavigationFramedCallbackDetails extends WebNavigationUrlCallbackDetails {
12598
- /** 0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe. Frame IDs are unique for a given tab and process. */
12727
+ export interface WebNavigationBaseCallbackDetails {
12728
+ /** The lifecycle the document is in. */
12729
+ documentLifecycle: extensionTypes.DocumentLifecycle;
12730
+ /** 0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe. Frame IDs are unique within a tab. */
12599
12731
  frameId: number;
12600
12732
  /** The type of frame the navigation occurred in. */
12601
12733
  frameType: extensionTypes.FrameType;
12602
- /** A UUID of the document loaded. (This is not set for onBeforeNavigate callbacks.) */
12603
- documentId?: string | undefined;
12604
- /** The lifecycle the document is in. */
12605
- documentLifecycle: extensionTypes.DocumentLifecycle;
12606
12734
  /** A UUID of the parent document owning this frame. This is not set if there is no parent. */
12607
- parentDocumentId?: string | undefined;
12735
+ parentDocumentId?: string;
12736
+ /** The ID of the parent frame, or `-1` if this is the main frame. */
12737
+ parentFrameId: number;
12738
+ /** The ID of the process that runs the renderer for this frame. */
12739
+ processId: number;
12740
+ /** The ID of the tab in which the navigation occurs. */
12741
+ tabId: number;
12742
+ /** The time when the browser was about to start the navigation, in milliseconds since the epoch */
12743
+ timeStamp: number;
12744
+ url: string;
12745
+ }
12746
+
12747
+ export interface WebNavigationFramedCallbackDetails extends WebNavigationBaseCallbackDetails {
12608
12748
  /**
12609
- * The ID of the process runs the renderer for this tab.
12610
- * @since Chrome 22
12749
+ * A UUID of the document loaded.
12750
+ * @since Chrome 106
12611
12751
  */
12612
- processId: number;
12752
+ documentId: string;
12613
12753
  }
12614
12754
 
12615
- export interface WebNavigationFramedErrorCallbackDetails extends WebNavigationFramedCallbackDetails {
12755
+ export interface WebNavigationFramedErrorCallbackDetails extends WebNavigationBaseCallbackDetails {
12756
+ /**
12757
+ * A UUID of the document loaded.
12758
+ * @since Chrome 106
12759
+ */
12760
+ documentId: string;
12616
12761
  /** The error description. */
12617
12762
  error: string;
12618
12763
  }
12619
12764
 
12620
- export interface WebNavigationSourceCallbackDetails extends WebNavigationUrlCallbackDetails {
12621
- /** The ID of the tab in which the navigation is triggered. */
12622
- sourceTabId: number;
12623
- /**
12624
- * The ID of the process runs the renderer for the source tab.
12625
- * @since Chrome 22
12626
- */
12627
- sourceProcessId: number;
12765
+ export interface WebNavigationSourceCallbackDetails {
12628
12766
  /** The ID of the frame with sourceTabId in which the navigation is triggered. 0 indicates the main frame. */
12629
12767
  sourceFrameId: number;
12768
+ /** The ID of the process that runs the renderer for the source frame. */
12769
+ sourceProcessId: number;
12770
+ /** The ID of the tab in which the navigation is triggered. */
12771
+ sourceTabId: number;
12772
+ /** The ID of the tab in which the url is opened */
12773
+ tabId: number;
12774
+ /** The time when the browser was about to create a new view, in milliseconds since the epoch. */
12775
+ timeStamp: number;
12776
+ /** The URL to be opened in the new window. */
12777
+ url: string;
12630
12778
  }
12631
12779
 
12632
- export interface WebNavigationParentedCallbackDetails extends WebNavigationFramedCallbackDetails {
12633
- /**
12634
- * ID of frame that wraps the frame. Set to -1 of no parent frame exists.
12635
- * @since Chrome 24
12636
- */
12637
- parentFrameId: number;
12638
- }
12639
-
12640
- export interface WebNavigationTransitionCallbackDetails extends WebNavigationFramedCallbackDetails {
12641
- /**
12642
- * Cause of the navigation.
12643
- * One of: "link", "typed", "auto_bookmark", "auto_subframe", "manual_subframe", "generated", "start_page", "form_submit", "reload", "keyword", or "keyword_generated"
12644
- */
12645
- transitionType: string;
12780
+ export interface WebNavigationTransitionCallbackDetails extends WebNavigationBaseCallbackDetails {
12646
12781
  /**
12647
- * A list of transition qualifiers.
12648
- * Each element one of: "client_redirect", "server_redirect", "forward_back", or "from_address_bar"
12782
+ * A UUID of the document loaded.
12783
+ * @since Chrome 106
12649
12784
  */
12650
- transitionQualifiers: string[];
12785
+ documentId: string;
12786
+ /** Cause of the navigation. */
12787
+ transitionType: `${TransitionType}`;
12788
+ /** A list of transition qualifiers.*/
12789
+ transitionQualifiers: `${TransitionQualifier}`[];
12651
12790
  }
12652
12791
 
12653
12792
  export interface WebNavigationEventFilter {
@@ -12655,89 +12794,72 @@ declare namespace chrome {
12655
12794
  url: chrome.events.UrlFilter[];
12656
12795
  }
12657
12796
 
12658
- export interface WebNavigationEvent<T extends WebNavigationCallbackDetails>
12659
- extends chrome.events.Event<(details: T) => void>
12797
+ interface WebNavigationEvent<T extends (...args: any) => void>
12798
+ extends Omit<chrome.events.Event<T>, "addListener">
12660
12799
  {
12661
- addListener(callback: (details: T) => void, filters?: WebNavigationEventFilter): void;
12800
+ addListener(callback: T, filters?: WebNavigationEventFilter): void;
12662
12801
  }
12663
12802
 
12664
- export interface WebNavigationFramedEvent extends WebNavigationEvent<WebNavigationFramedCallbackDetails> {}
12665
-
12666
- export interface WebNavigationFramedErrorEvent
12667
- extends WebNavigationEvent<WebNavigationFramedErrorCallbackDetails>
12668
- {}
12669
-
12670
- export interface WebNavigationSourceEvent extends WebNavigationEvent<WebNavigationSourceCallbackDetails> {}
12671
-
12672
- export interface WebNavigationParentedEvent extends WebNavigationEvent<WebNavigationParentedCallbackDetails> {}
12673
-
12674
- export interface WebNavigationTransitionalEvent
12675
- extends WebNavigationEvent<WebNavigationTransitionCallbackDetails>
12676
- {}
12677
-
12678
- export interface WebNavigationReplacementEvent
12679
- extends WebNavigationEvent<WebNavigationReplacementCallbackDetails>
12680
- {}
12681
-
12682
12803
  /**
12683
12804
  * Retrieves information about the given frame. A frame refers to an <iframe> or a <frame> of a web page and is identified by a tab ID and a frame ID.
12805
+ *
12806
+ * Can return its result via Promise in Manifest V3 or later since Chrome 93.
12684
12807
  * @param details Information about the frame to retrieve information about.
12685
- * @param callback
12686
- * Optional parameter details: Information about the requested frame, null if the specified frame ID and/or tab ID are invalid.
12687
12808
  */
12809
+ export function getFrame(
12810
+ details: GetFrameDetails,
12811
+ ): Promise<GetFrameResultDetails | null>;
12688
12812
  export function getFrame(
12689
12813
  details: GetFrameDetails,
12690
12814
  callback: (details: GetFrameResultDetails | null) => void,
12691
12815
  ): void;
12692
- /**
12693
- * Retrieves information about the given frame. A frame refers to an <iframe> or a <frame> of a web page and is identified by a tab ID and a frame ID.
12694
- * @param details Information about the frame to retrieve information about.
12695
- * @return The getFrame method provides its result via callback or returned as a Promise (MV3 only).
12696
- */
12697
- export function getFrame(details: GetFrameDetails): Promise<GetFrameResultDetails | null>;
12698
12816
 
12699
12817
  /**
12700
12818
  * Retrieves information about all frames of a given tab.
12819
+ *
12820
+ * Can return its result via Promise in Manifest V3 or later since Chrome 93.
12701
12821
  * @param details Information about the tab to retrieve all frames from.
12702
- * @param callback
12703
- * Optional parameter details: A list of frames in the given tab, null if the specified tab ID is invalid.
12704
12822
  */
12705
12823
  export function getAllFrames(
12706
12824
  details: GetAllFrameDetails,
12707
- callback: (details: GetAllFrameResultDetails[] | null) => void,
12708
- ): void;
12709
- /**
12710
- * Retrieves information about all frames of a given tab.
12711
- * @param details Information about the tab to retrieve all frames from.
12712
- * @return The getAllFrames method provides its result via callback or returned as a Promise (MV3 only).
12713
- */
12825
+ ): Promise<GetAllFrameResultDetails[] | null>;
12714
12826
  export function getAllFrames(
12715
12827
  details: GetAllFrameDetails,
12716
- ): Promise<GetAllFrameResultDetails[] | null>;
12828
+ callback: (details: GetAllFrameResultDetails[] | null) => void,
12829
+ ): void;
12830
+
12717
12831
  /** Fired when the reference fragment of a frame was updated. All future events for that frame will use the updated URL. */
12718
- export var onReferenceFragmentUpdated: WebNavigationTransitionalEvent;
12832
+ export const onReferenceFragmentUpdated: WebNavigationEvent<
12833
+ (details: WebNavigationTransitionCallbackDetails) => void
12834
+ >;
12835
+
12719
12836
  /** Fired when a document, including the resources it refers to, is completely loaded and initialized. */
12720
- export var onCompleted: WebNavigationFramedEvent;
12721
- /**
12722
- * Fired when the frame's history was updated to a new URL. All future events for that frame will use the updated URL.
12723
- * @since Chrome 22
12724
- */
12725
- export var onHistoryStateUpdated: WebNavigationTransitionalEvent;
12837
+ export const onCompleted: WebNavigationEvent<(details: WebNavigationFramedCallbackDetails) => void>;
12838
+
12839
+ // /** Fired when the frame's history was updated to a new URL. All future events for that frame will use the updated URL. */
12840
+ export const onHistoryStateUpdated: WebNavigationEvent<
12841
+ (details: WebNavigationTransitionCallbackDetails) => void
12842
+ >;
12843
+
12726
12844
  /** Fired when a new window, or a new tab in an existing window, is created to host a navigation. */
12727
- export var onCreatedNavigationTarget: WebNavigationSourceEvent;
12728
- /**
12729
- * Fired when the contents of the tab is replaced by a different (usually previously pre-rendered) tab.
12730
- * @since Chrome 22
12731
- */
12732
- export var onTabReplaced: WebNavigationReplacementEvent;
12845
+ export const onCreatedNavigationTarget: WebNavigationEvent<
12846
+ (details: WebNavigationSourceCallbackDetails) => void
12847
+ >;
12848
+
12849
+ /** Fired when the contents of the tab is replaced by a different (usually previously pre-rendered) tab*/
12850
+ export const onTabReplaced: events.Event<(details: WebNavigationReplacementCallbackDetails) => void>;
12851
+
12733
12852
  /** Fired when a navigation is about to occur. */
12734
- export var onBeforeNavigate: WebNavigationParentedEvent;
12853
+ export const onBeforeNavigate: WebNavigationEvent<(details: WebNavigationBaseCallbackDetails) => void>;
12854
+
12735
12855
  /** Fired when a navigation is committed. The document (and the resources it refers to, such as images and subframes) might still be downloading, but at least part of the document has been received from the server and the browser has decided to switch to the new document. */
12736
- export var onCommitted: WebNavigationTransitionalEvent;
12856
+ export const onCommitted: WebNavigationEvent<(details: WebNavigationTransitionCallbackDetails) => void>;
12857
+
12737
12858
  /** Fired when the page's DOM is fully constructed, but the referenced resources may not finish loading. */
12738
- export var onDOMContentLoaded: WebNavigationFramedEvent;
12859
+ export const onDOMContentLoaded: WebNavigationEvent<(details: WebNavigationFramedCallbackDetails) => void>;
12860
+
12739
12861
  /** Fired when an error occurs and the navigation is aborted. This can happen if either a network error occurred, or the user aborted the navigation. */
12740
- export var onErrorOccurred: WebNavigationFramedErrorEvent;
12862
+ export const onErrorOccurred: WebNavigationEvent<(details: WebNavigationFramedErrorCallbackDetails) => void>;
12741
12863
  }
12742
12864
 
12743
12865
  ////////////////////
chrome/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/chrome",
3
- "version": "0.1.23",
3
+ "version": "0.1.25",
4
4
  "description": "TypeScript definitions for chrome",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/chrome",
6
6
  "license": "MIT",
@@ -94,6 +94,6 @@
94
94
  "@types/har-format": "*"
95
95
  },
96
96
  "peerDependencies": {},
97
- "typesPublisherContentHash": "aeba34b4b0487d782a1e868033d51b9b8e2e4509e7973ea314537754c5337132",
97
+ "typesPublisherContentHash": "d216a6c8c00a765cff5c13cda2f955a491576cb4cf67da012fc054017600a879",
98
98
  "typeScriptVersion": "5.2"
99
99
  }