@types/chrome 0.1.24 → 0.1.26

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 +263 -178
  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 07:32:14 GMT
11
+ * Last updated: Mon, 27 Oct 2025 19:32:06 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
@@ -11869,7 +11869,7 @@ declare namespace chrome {
11869
11869
  * Permissions: "topSites"
11870
11870
  */
11871
11871
  export namespace topSites {
11872
- /** An object encapsulating a most visited URL, such as the URLs on the new tab page. */
11872
+ /** An object encapsulating a most visited URL, such as the default shortcuts on the new tab page. */
11873
11873
  export interface MostVisitedURL {
11874
11874
  /** The most visited URL. */
11875
11875
  url: string;
@@ -11877,14 +11877,13 @@ declare namespace chrome {
11877
11877
  title: string;
11878
11878
  }
11879
11879
 
11880
- /** Gets a list of top sites. */
11881
- export function get(callback: (data: MostVisitedURL[]) => void): void;
11882
-
11883
11880
  /**
11884
11881
  * Gets a list of top sites.
11885
- * @return The `get` method provides its result via callback or returned as a `Promise` (MV3 only).
11882
+ *
11883
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
11886
11884
  */
11887
11885
  export function get(): Promise<MostVisitedURL[]>;
11886
+ export function get(callback: (data: MostVisitedURL[]) => void): void;
11888
11887
  }
11889
11888
 
11890
11889
  ////////////////////
@@ -12247,16 +12246,16 @@ declare namespace chrome {
12247
12246
  */
12248
12247
  value: T;
12249
12248
  /** Where to set the setting (default: regular). */
12250
- scope?: ChromeSettingScope;
12249
+ scope?: ChromeSettingScope | undefined;
12251
12250
  }
12252
12251
 
12253
12252
  /** Which setting to consider. */
12254
12253
  export interface ChromeSettingGetDetails {
12255
12254
  /** Whether to return the value that applies to the incognito session (default false). */
12256
- incognito?: boolean;
12255
+ incognito?: boolean | undefined;
12257
12256
  }
12258
12257
 
12259
- /** Details of the currently effective value */
12258
+ /** Details of the currently effective value. */
12260
12259
  export interface ChromeSettingGetResult<T> {
12261
12260
  /** The level of control of the setting. */
12262
12261
  levelOfControl: LevelOfControl;
@@ -12264,7 +12263,7 @@ declare namespace chrome {
12264
12263
  value: T;
12265
12264
  /**
12266
12265
  * Whether the effective value is specific to the incognito session.
12267
- * This property will only be present if the incognito property in the details parameter of get() was true.
12266
+ * This property will only be present if the `incognito` property in the `details` parameter of `get()` was true.
12268
12267
  */
12269
12268
  incognitoSpecific?: boolean;
12270
12269
  }
@@ -12272,17 +12271,14 @@ declare namespace chrome {
12272
12271
  /** Which setting to clear. */
12273
12272
  export interface ChromeSettingClearDetails {
12274
12273
  /** Where to clear the setting (default: regular). */
12275
- scope?: ChromeSettingScope;
12274
+ scope?: ChromeSettingScope | undefined;
12276
12275
  }
12277
12276
 
12278
12277
  /** Details of the currently effective value. */
12279
12278
  export interface ChromeSettingOnChangeDetails<T> {
12280
- /**
12281
- * Whether the effective value is specific to the incognito session. T
12282
- * his property will only be present if the incognito property in the details parameter of get() was true.
12283
- */
12279
+ /** 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. */
12284
12280
  incognitoSpecific?: boolean;
12285
- /** The value of the setting. */
12281
+ /** The value of the setting after the change. */
12286
12282
  value: T;
12287
12283
  /** The level of control of the setting. */
12288
12284
  levelOfControl: LevelOfControl;
@@ -12295,27 +12291,30 @@ declare namespace chrome {
12295
12291
  export interface ChromeSetting<T> {
12296
12292
  /**
12297
12293
  * Sets the value of a setting.
12294
+ *
12298
12295
  * Can return its result via Promise in Manifest V3 or later since Chrome 96.
12299
12296
  */
12300
- set(details: ChromeSettingSetDetails<T>, callback: () => void): void;
12301
12297
  set(details: ChromeSettingSetDetails<T>): Promise<void>;
12298
+ set(details: ChromeSettingSetDetails<T>, callback: () => void): void;
12302
12299
 
12303
12300
  /**
12304
12301
  * Gets the value of a setting.
12302
+ *
12305
12303
  * Can return its result via Promise in Manifest V3 or later since Chrome 96.
12306
12304
  */
12307
- get(details: ChromeSettingGetDetails, callback: (details: ChromeSettingGetResult<T>) => void): void;
12308
12305
  get(details: ChromeSettingGetDetails): Promise<ChromeSettingGetResult<T>>;
12306
+ get(details: ChromeSettingGetDetails, callback: (details: ChromeSettingGetResult<T>) => void): void;
12309
12307
 
12310
12308
  /**
12311
12309
  * Clears the setting, restoring any default value.
12310
+ *
12312
12311
  * Can return its result via Promise in Manifest V3 or later since Chrome 96.
12313
12312
  */
12314
- clear(details: ChromeSettingClearDetails, callback: () => void): void;
12315
12313
  clear(details: ChromeSettingClearDetails): Promise<void>;
12314
+ clear(details: ChromeSettingClearDetails, callback: () => void): void;
12316
12315
 
12317
12316
  /** Fired after the setting changes. */
12318
- onChange: chrome.events.Event<(details: ChromeSettingOnChangeDetails<T>) => void>;
12317
+ onChange: events.Event<(details: ChromeSettingOnChangeDetails<T>) => void>;
12319
12318
  }
12320
12319
  }
12321
12320
 
@@ -12330,85 +12329,134 @@ declare namespace chrome {
12330
12329
  * @since Chrome 43
12331
12330
  */
12332
12331
  export namespace vpnProvider {
12333
- export interface VpnSessionParameters {
12332
+ export interface Parameters {
12334
12333
  /** IP address for the VPN interface in CIDR notation. IPv4 is currently the only supported mode. */
12335
12334
  address: string;
12336
- /** Optional. Broadcast address for the VPN interface. (default: deduced from IP address and mask) */
12335
+ /** Broadcast address for the VPN interface. (default: deduced from IP address and mask) */
12337
12336
  broadcastAddress?: string | undefined;
12338
- /** Optional. MTU setting for the VPN interface. (default: 1500 bytes) */
12337
+ /** MTU setting for the VPN interface. (default: 1500 bytes) */
12339
12338
  mtu?: string | undefined;
12340
- /**
12341
- * 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.
12342
- */
12339
+ /** 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. */
12343
12340
  exclusionList: string[];
12344
- /**
12345
- * 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.
12346
- */
12341
+ /** 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. */
12347
12342
  inclusionList: string[];
12348
- /** Optional. A list of search domains. (default: no search domain) */
12343
+ /** A list of search domains. (default: no search domain) */
12349
12344
  domainSearch?: string[] | undefined;
12350
12345
  /** A list of IPs for the DNS servers. */
12351
- dnsServer: string[];
12346
+ dnsServers: string[];
12347
+ /**
12348
+ * Whether or not the VPN extension implements auto-reconnection.
12349
+ *
12350
+ * 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)
12351
+ *
12352
+ * 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.
12353
+ * @since Chrome 51
12354
+ */
12355
+ reconnect?: string | undefined;
12352
12356
  }
12353
12357
 
12354
- export interface VpnPlatformMessageEvent
12355
- extends chrome.events.Event<(id: string, message: string, error: string) => void>
12356
- {}
12358
+ /** @deprecated Use {@link Parameters} instead */
12359
+ interface VpnSessionParameters extends Parameters {}
12357
12360
 
12358
- export interface VpnPacketReceptionEvent extends chrome.events.Event<(data: ArrayBuffer) => void> {}
12359
-
12360
- export interface VpnConfigRemovalEvent extends chrome.events.Event<(id: string) => void> {}
12361
+ /** The enum is used by the platform to notify the client of the VPN session status. */
12362
+ export enum PlatformMessage {
12363
+ /** Indicates that the VPN configuration connected. */
12364
+ CONNECTED = "connected",
12365
+ /** Indicates that the VPN configuration disconnected. */
12366
+ DISCONNECTED = "disconnected",
12367
+ /** 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. */
12368
+ ERROR = "error",
12369
+ /** Indicates that the default physical network connection is down. */
12370
+ LINK_DOWN = "linkDown",
12371
+ /** Indicates that the default physical network connection is back up. */
12372
+ LINK_UP = "linkUp",
12373
+ /** Indicates that the default physical network connection changed, e.g. wifi->mobile. */
12374
+ LINK_CHANGED = "linkChanged",
12375
+ /** 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. */
12376
+ SUSPEND = "suspend",
12377
+ /** Indicates that the OS has resumed and the user has logged back in, so the VPN should try to reconnect. */
12378
+ RESUME = "resume",
12379
+ }
12361
12380
 
12362
- export interface VpnConfigCreationEvent
12363
- extends chrome.events.Event<(id: string, name: string, data: { [key: string]: unknown }) => void>
12364
- {}
12381
+ /** The enum is used by the platform to indicate the event that triggered {@link onUIEvent}. */
12382
+ export enum UIEvent {
12383
+ /** Requests that the VPN client show the add configuration dialog box to the user. */
12384
+ SHOW_ADD_DIALOG = "showAddDialog",
12385
+ /** Requests that the VPN client show the configuration settings dialog box to the user. */
12386
+ SHOW_CONFIGURE_DIALOG = "showConfigureDialog",
12387
+ }
12365
12388
 
12366
- export interface VpnUiEvent extends chrome.events.Event<(event: string, id?: string) => void> {}
12389
+ /** The enum is used by the VPN client to inform the platform of its current state. This helps provide meaningful messages to the user. */
12390
+ export enum VpnConnectionState {
12391
+ /** Specifies that VPN connection was successful. */
12392
+ CONNECTED = "connected",
12393
+ /** Specifies that VPN connection has failed. */
12394
+ FAILURE = "failure",
12395
+ }
12367
12396
 
12368
12397
  /**
12369
12398
  * Creates a new VPN configuration that persists across multiple login sessions of the user.
12399
+ *
12400
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
12370
12401
  * @param name The name of the VPN configuration.
12371
- * @param callback Called when the configuration is created or if there is an error.
12372
- * Parameter id: A unique ID for the created configuration, empty string on failure.
12373
12402
  */
12403
+ export function createConfig(name: string): Promise<string>;
12374
12404
  export function createConfig(name: string, callback: (id: string) => void): void;
12405
+
12375
12406
  /**
12376
12407
  * Destroys a VPN configuration created by the extension.
12408
+ *
12409
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
12377
12410
  * @param id ID of the VPN configuration to destroy.
12378
- * @param callback Optional. Called when the configuration is destroyed or if there is an error.
12379
12411
  */
12380
- export function destroyConfig(id: string, callback?: () => void): void;
12412
+ export function destroyConfig(id: string): Promise<void>;
12413
+ export function destroyConfig(id: string, callback: () => void): void;
12414
+
12381
12415
  /**
12382
- * 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.
12416
+ * 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
+ *
12418
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
12383
12419
  * @param parameters The parameters for the VPN session.
12384
- * @param callback Called when the parameters are set or if there is an error.
12385
12420
  */
12386
- export function setParameters(parameters: VpnSessionParameters, callback?: () => void): void;
12421
+ export function setParameters(parameters: Parameters): Promise<void>;
12422
+ export function setParameters(parameters: Parameters, callback: () => void): void;
12423
+
12387
12424
  /**
12388
12425
  * 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.
12426
+ *
12427
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
12389
12428
  * @param data The IP packet to be sent to the platform.
12390
- * @param callback Optional. Called when the packet is sent or if there is an error.
12391
12429
  */
12392
- export function sendPacket(data: ArrayBuffer, callback?: () => void): void;
12430
+ export function sendPacket(data: ArrayBuffer): Promise<void>;
12431
+ export function sendPacket(data: ArrayBuffer, callback: () => void): void;
12432
+
12393
12433
  /**
12394
12434
  * Notifies the VPN session state to the platform. This will succeed only when the VPN session is owned by the extension.
12435
+ *
12436
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
12395
12437
  * @param state The VPN session state of the VPN client.
12396
- * connected: VPN connection was successful.
12397
- * failure: VPN connection failed.
12398
- * @param callback Optional. Called when the notification is complete or if there is an error.
12399
12438
  */
12400
- export function notifyConnectionStateChanged(state: string, callback?: () => void): void;
12439
+ export function notifyConnectionStateChanged(state: `${VpnConnectionState}`): Promise<void>;
12440
+ export function notifyConnectionStateChanged(state: `${VpnConnectionState}`, callback: () => void): void;
12401
12441
 
12402
12442
  /** Triggered when a message is received from the platform for a VPN configuration owned by the extension. */
12403
- export var onPlatformMessage: VpnPlatformMessageEvent;
12443
+ export const onPlatformMessage: events.Event<
12444
+ (id: string, message: `${PlatformMessage}`, error: string) => void
12445
+ >;
12446
+
12404
12447
  /** Triggered when an IP packet is received via the tunnel for the VPN session owned by the extension. */
12405
- export var onPacketReceived: VpnPacketReceptionEvent;
12448
+ export const onPacketReceived: events.Event<(data: ArrayBuffer) => void>;
12449
+
12406
12450
  /** Triggered when a configuration created by the extension is removed by the platform. */
12407
- export var onConfigRemoved: VpnConfigRemovalEvent;
12408
- /** Triggered when a configuration is created by the platform for the extension. */
12409
- export var onConfigCreated: VpnConfigCreationEvent;
12451
+ export const onConfigRemoved: events.Event<(id: string) => void>;
12452
+
12453
+ // /** Triggered when a configuration is created by the platform for the extension. */
12454
+ export const onConfigCreated: events.Event<
12455
+ (id: string, name: string, data: { [key: string]: unknown }) => void
12456
+ >;
12457
+
12410
12458
  /** 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. */
12411
- export var onUIEvent: VpnUiEvent;
12459
+ export const onUIEvent: events.Event<(event: `${UIEvent}`, id?: string) => void>;
12412
12460
  }
12413
12461
 
12414
12462
  ////////////////////
@@ -12572,33 +12620,84 @@ declare namespace chrome {
12572
12620
  * Permissions: "webNavigation"
12573
12621
  */
12574
12622
  export namespace webNavigation {
12575
- export interface GetFrameDetails {
12576
- /**
12577
- * The ID of the process runs the renderer for this tab.
12578
- * @since Chrome 22
12579
- * @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.
12580
- */
12581
- processId?: number | undefined;
12582
- /** The ID of the tab in which the frame is. */
12583
- tabId: number;
12584
- /** The ID of the frame in the given tab. */
12585
- frameId: number;
12623
+ /** @since Chrome 44 */
12624
+ export enum TransitionQualifier {
12625
+ CLIENT_REDIRECT = "client_redirect",
12626
+ SERVER_REDIRECT = "server_redirect",
12627
+ FORWARD_BACK = "forward_back",
12628
+ FROM_ADDRESS_BAR = "from_address_bar",
12629
+ }
12630
+
12631
+ /**
12632
+ * 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).
12633
+ * @since Chrome 44
12634
+ */
12635
+ export enum TransitionType {
12636
+ LINK = "link",
12637
+ TYPED = "typed",
12638
+ AUTO_BOOKMARK = "auto_bookmark",
12639
+ AUTO_SUBFRAME = "auto_subframe",
12640
+ MANUAL_SUBFRAME = "manual_subframe",
12641
+ GENERATED = "generated",
12642
+ START_PAGE = "start_page",
12643
+ FORM_SUBMIT = "form_submit",
12644
+ RELOAD = "reload",
12645
+ KEYWORD = "keyword",
12646
+ KEYWORD_GENERATED = "keyword_generated",
12586
12647
  }
12587
12648
 
12649
+ export type GetFrameDetails =
12650
+ & ({
12651
+ /**
12652
+ * The ID of the process that runs the renderer for this tab.
12653
+ * @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.
12654
+ */
12655
+ processId?: number | undefined;
12656
+ })
12657
+ & (
12658
+ {
12659
+ /** The ID of the tab in which the frame is. */
12660
+ tabId?: number | undefined;
12661
+ /** The ID of the frame in the given tab. */
12662
+ frameId?: number | undefined;
12663
+ /**
12664
+ * 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.
12665
+ * @since Chrome 106
12666
+ */
12667
+ documentId: string;
12668
+ } | {
12669
+ /** The ID of the tab in which the frame is. */
12670
+ tabId: number;
12671
+ /** The ID of the frame in the given tab. */
12672
+ frameId: number;
12673
+ /**
12674
+ * 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.
12675
+ * @since Chrome 106
12676
+ */
12677
+ documentId?: string | undefined;
12678
+ }
12679
+ );
12680
+
12588
12681
  export interface GetFrameResultDetails {
12589
12682
  /** 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. */
12590
12683
  url: string;
12591
12684
  /** A UUID of the document loaded. */
12592
12685
  documentId: string;
12593
- /** The lifecycle the document is in. */
12686
+ /**
12687
+ * The lifecycle the document is in.
12688
+ * @since Chrome 106
12689
+ */
12594
12690
  documentLifecycle: extensionTypes.DocumentLifecycle;
12595
12691
  /** True if the last navigation in this frame was interrupted by an error, i.e. the onErrorOccurred event fired. */
12596
12692
  errorOccurred: boolean;
12597
12693
  /** The type of frame the navigation occurred in. */
12598
12694
  frameType: extensionTypes.FrameType;
12599
- /** A UUID of the parent document owning this frame. This is not set if there is no parent. */
12695
+ /**
12696
+ * A UUID of the parent document owning this frame. This is not set if there is no parent.
12697
+ * @since Chrome 106
12698
+ */
12600
12699
  parentDocumentId?: string | undefined;
12601
- /** ID of frame that wraps the frame. Set to -1 of no parent frame exists. */
12700
+ /** The ID of the parent frame, or `-1` if this is the main frame. */
12602
12701
  parentFrameId: number;
12603
12702
  }
12604
12703
 
@@ -12607,83 +12706,86 @@ declare namespace chrome {
12607
12706
  tabId: number;
12608
12707
  }
12609
12708
 
12709
+ /** A list of frames in the given tab, null if the specified tab ID is invalid. */
12610
12710
  export interface GetAllFrameResultDetails extends GetFrameResultDetails {
12611
- /** The ID of the process runs the renderer for this tab. */
12711
+ /** The ID of the process that runs the renderer for this frame. */
12612
12712
  processId: number;
12613
12713
  /** The ID of the frame. 0 indicates that this is the main frame; a positive value indicates the ID of a subframe. */
12614
12714
  frameId: number;
12615
12715
  }
12616
12716
 
12617
- export interface WebNavigationCallbackDetails {
12618
- /** The ID of the tab in which the navigation is about to occur. */
12619
- tabId: number;
12620
- /** The time when the browser was about to start the navigation, in milliseconds since the epoch. */
12621
- timeStamp: number;
12622
- }
12623
-
12624
- export interface WebNavigationUrlCallbackDetails extends WebNavigationCallbackDetails {
12625
- url: string;
12626
- }
12627
-
12628
- export interface WebNavigationReplacementCallbackDetails extends WebNavigationCallbackDetails {
12717
+ export interface WebNavigationReplacementCallbackDetails {
12629
12718
  /** The ID of the tab that was replaced. */
12630
12719
  replacedTabId: number;
12720
+ /** The ID of the tab that replaced the old tab. */
12721
+ tabId: number;
12722
+ /** The time when the replacement happened, in milliseconds since the epoch. */
12723
+ timeStamp: number;
12631
12724
  }
12632
12725
 
12633
- export interface WebNavigationFramedCallbackDetails extends WebNavigationUrlCallbackDetails {
12634
- /** 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. */
12726
+ export interface WebNavigationBaseCallbackDetails {
12727
+ /** The lifecycle the document is in. */
12728
+ documentLifecycle: extensionTypes.DocumentLifecycle;
12729
+ /** 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. */
12635
12730
  frameId: number;
12636
12731
  /** The type of frame the navigation occurred in. */
12637
12732
  frameType: extensionTypes.FrameType;
12638
- /** A UUID of the document loaded. (This is not set for onBeforeNavigate callbacks.) */
12639
- documentId?: string | undefined;
12640
- /** The lifecycle the document is in. */
12641
- documentLifecycle: extensionTypes.DocumentLifecycle;
12642
12733
  /** A UUID of the parent document owning this frame. This is not set if there is no parent. */
12643
- parentDocumentId?: string | undefined;
12734
+ parentDocumentId?: string;
12735
+ /** The ID of the parent frame, or `-1` if this is the main frame. */
12736
+ parentFrameId: number;
12737
+ /** The ID of the process that runs the renderer for this frame. */
12738
+ processId: number;
12739
+ /** The ID of the tab in which the navigation occurs. */
12740
+ tabId: number;
12741
+ /** The time when the browser was about to start the navigation, in milliseconds since the epoch */
12742
+ timeStamp: number;
12743
+ url: string;
12744
+ }
12745
+
12746
+ export interface WebNavigationFramedCallbackDetails extends WebNavigationBaseCallbackDetails {
12644
12747
  /**
12645
- * The ID of the process runs the renderer for this tab.
12646
- * @since Chrome 22
12748
+ * A UUID of the document loaded.
12749
+ * @since Chrome 106
12647
12750
  */
12648
- processId: number;
12751
+ documentId: string;
12649
12752
  }
12650
12753
 
12651
- export interface WebNavigationFramedErrorCallbackDetails extends WebNavigationFramedCallbackDetails {
12754
+ export interface WebNavigationFramedErrorCallbackDetails extends WebNavigationBaseCallbackDetails {
12755
+ /**
12756
+ * A UUID of the document loaded.
12757
+ * @since Chrome 106
12758
+ */
12759
+ documentId: string;
12652
12760
  /** The error description. */
12653
12761
  error: string;
12654
12762
  }
12655
12763
 
12656
- export interface WebNavigationSourceCallbackDetails extends WebNavigationUrlCallbackDetails {
12657
- /** The ID of the tab in which the navigation is triggered. */
12658
- sourceTabId: number;
12659
- /**
12660
- * The ID of the process runs the renderer for the source tab.
12661
- * @since Chrome 22
12662
- */
12663
- sourceProcessId: number;
12764
+ export interface WebNavigationSourceCallbackDetails {
12664
12765
  /** The ID of the frame with sourceTabId in which the navigation is triggered. 0 indicates the main frame. */
12665
12766
  sourceFrameId: number;
12767
+ /** The ID of the process that runs the renderer for the source frame. */
12768
+ sourceProcessId: number;
12769
+ /** The ID of the tab in which the navigation is triggered. */
12770
+ sourceTabId: number;
12771
+ /** The ID of the tab in which the url is opened */
12772
+ tabId: number;
12773
+ /** The time when the browser was about to create a new view, in milliseconds since the epoch. */
12774
+ timeStamp: number;
12775
+ /** The URL to be opened in the new window. */
12776
+ url: string;
12666
12777
  }
12667
12778
 
12668
- export interface WebNavigationParentedCallbackDetails extends WebNavigationFramedCallbackDetails {
12669
- /**
12670
- * ID of frame that wraps the frame. Set to -1 of no parent frame exists.
12671
- * @since Chrome 24
12672
- */
12673
- parentFrameId: number;
12674
- }
12675
-
12676
- export interface WebNavigationTransitionCallbackDetails extends WebNavigationFramedCallbackDetails {
12677
- /**
12678
- * Cause of the navigation.
12679
- * One of: "link", "typed", "auto_bookmark", "auto_subframe", "manual_subframe", "generated", "start_page", "form_submit", "reload", "keyword", or "keyword_generated"
12680
- */
12681
- transitionType: string;
12779
+ export interface WebNavigationTransitionCallbackDetails extends WebNavigationBaseCallbackDetails {
12682
12780
  /**
12683
- * A list of transition qualifiers.
12684
- * Each element one of: "client_redirect", "server_redirect", "forward_back", or "from_address_bar"
12781
+ * A UUID of the document loaded.
12782
+ * @since Chrome 106
12685
12783
  */
12686
- transitionQualifiers: string[];
12784
+ documentId: string;
12785
+ /** Cause of the navigation. */
12786
+ transitionType: `${TransitionType}`;
12787
+ /** A list of transition qualifiers.*/
12788
+ transitionQualifiers: `${TransitionQualifier}`[];
12687
12789
  }
12688
12790
 
12689
12791
  export interface WebNavigationEventFilter {
@@ -12691,89 +12793,72 @@ declare namespace chrome {
12691
12793
  url: chrome.events.UrlFilter[];
12692
12794
  }
12693
12795
 
12694
- export interface WebNavigationEvent<T extends WebNavigationCallbackDetails>
12695
- extends chrome.events.Event<(details: T) => void>
12796
+ interface WebNavigationEvent<T extends (...args: any) => void>
12797
+ extends Omit<chrome.events.Event<T>, "addListener">
12696
12798
  {
12697
- addListener(callback: (details: T) => void, filters?: WebNavigationEventFilter): void;
12799
+ addListener(callback: T, filters?: WebNavigationEventFilter): void;
12698
12800
  }
12699
12801
 
12700
- export interface WebNavigationFramedEvent extends WebNavigationEvent<WebNavigationFramedCallbackDetails> {}
12701
-
12702
- export interface WebNavigationFramedErrorEvent
12703
- extends WebNavigationEvent<WebNavigationFramedErrorCallbackDetails>
12704
- {}
12705
-
12706
- export interface WebNavigationSourceEvent extends WebNavigationEvent<WebNavigationSourceCallbackDetails> {}
12707
-
12708
- export interface WebNavigationParentedEvent extends WebNavigationEvent<WebNavigationParentedCallbackDetails> {}
12709
-
12710
- export interface WebNavigationTransitionalEvent
12711
- extends WebNavigationEvent<WebNavigationTransitionCallbackDetails>
12712
- {}
12713
-
12714
- export interface WebNavigationReplacementEvent
12715
- extends WebNavigationEvent<WebNavigationReplacementCallbackDetails>
12716
- {}
12717
-
12718
12802
  /**
12719
12803
  * 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.
12804
+ *
12805
+ * Can return its result via Promise in Manifest V3 or later since Chrome 93.
12720
12806
  * @param details Information about the frame to retrieve information about.
12721
- * @param callback
12722
- * Optional parameter details: Information about the requested frame, null if the specified frame ID and/or tab ID are invalid.
12723
12807
  */
12808
+ export function getFrame(
12809
+ details: GetFrameDetails,
12810
+ ): Promise<GetFrameResultDetails | null>;
12724
12811
  export function getFrame(
12725
12812
  details: GetFrameDetails,
12726
12813
  callback: (details: GetFrameResultDetails | null) => void,
12727
12814
  ): void;
12728
- /**
12729
- * 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.
12730
- * @param details Information about the frame to retrieve information about.
12731
- * @return The getFrame method provides its result via callback or returned as a Promise (MV3 only).
12732
- */
12733
- export function getFrame(details: GetFrameDetails): Promise<GetFrameResultDetails | null>;
12734
12815
 
12735
12816
  /**
12736
12817
  * Retrieves information about all frames of a given tab.
12818
+ *
12819
+ * Can return its result via Promise in Manifest V3 or later since Chrome 93.
12737
12820
  * @param details Information about the tab to retrieve all frames from.
12738
- * @param callback
12739
- * Optional parameter details: A list of frames in the given tab, null if the specified tab ID is invalid.
12740
12821
  */
12741
12822
  export function getAllFrames(
12742
12823
  details: GetAllFrameDetails,
12743
- callback: (details: GetAllFrameResultDetails[] | null) => void,
12744
- ): void;
12745
- /**
12746
- * Retrieves information about all frames of a given tab.
12747
- * @param details Information about the tab to retrieve all frames from.
12748
- * @return The getAllFrames method provides its result via callback or returned as a Promise (MV3 only).
12749
- */
12824
+ ): Promise<GetAllFrameResultDetails[] | null>;
12750
12825
  export function getAllFrames(
12751
12826
  details: GetAllFrameDetails,
12752
- ): Promise<GetAllFrameResultDetails[] | null>;
12827
+ callback: (details: GetAllFrameResultDetails[] | null) => void,
12828
+ ): void;
12829
+
12753
12830
  /** Fired when the reference fragment of a frame was updated. All future events for that frame will use the updated URL. */
12754
- export var onReferenceFragmentUpdated: WebNavigationTransitionalEvent;
12831
+ export const onReferenceFragmentUpdated: WebNavigationEvent<
12832
+ (details: WebNavigationTransitionCallbackDetails) => void
12833
+ >;
12834
+
12755
12835
  /** Fired when a document, including the resources it refers to, is completely loaded and initialized. */
12756
- export var onCompleted: WebNavigationFramedEvent;
12757
- /**
12758
- * Fired when the frame's history was updated to a new URL. All future events for that frame will use the updated URL.
12759
- * @since Chrome 22
12760
- */
12761
- export var onHistoryStateUpdated: WebNavigationTransitionalEvent;
12836
+ export const onCompleted: WebNavigationEvent<(details: WebNavigationFramedCallbackDetails) => void>;
12837
+
12838
+ // /** Fired when the frame's history was updated to a new URL. All future events for that frame will use the updated URL. */
12839
+ export const onHistoryStateUpdated: WebNavigationEvent<
12840
+ (details: WebNavigationTransitionCallbackDetails) => void
12841
+ >;
12842
+
12762
12843
  /** Fired when a new window, or a new tab in an existing window, is created to host a navigation. */
12763
- export var onCreatedNavigationTarget: WebNavigationSourceEvent;
12764
- /**
12765
- * Fired when the contents of the tab is replaced by a different (usually previously pre-rendered) tab.
12766
- * @since Chrome 22
12767
- */
12768
- export var onTabReplaced: WebNavigationReplacementEvent;
12844
+ export const onCreatedNavigationTarget: WebNavigationEvent<
12845
+ (details: WebNavigationSourceCallbackDetails) => void
12846
+ >;
12847
+
12848
+ /** Fired when the contents of the tab is replaced by a different (usually previously pre-rendered) tab*/
12849
+ export const onTabReplaced: events.Event<(details: WebNavigationReplacementCallbackDetails) => void>;
12850
+
12769
12851
  /** Fired when a navigation is about to occur. */
12770
- export var onBeforeNavigate: WebNavigationParentedEvent;
12852
+ export const onBeforeNavigate: WebNavigationEvent<(details: WebNavigationBaseCallbackDetails) => void>;
12853
+
12771
12854
  /** 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. */
12772
- export var onCommitted: WebNavigationTransitionalEvent;
12855
+ export const onCommitted: WebNavigationEvent<(details: WebNavigationTransitionCallbackDetails) => void>;
12856
+
12773
12857
  /** Fired when the page's DOM is fully constructed, but the referenced resources may not finish loading. */
12774
- export var onDOMContentLoaded: WebNavigationFramedEvent;
12858
+ export const onDOMContentLoaded: WebNavigationEvent<(details: WebNavigationFramedCallbackDetails) => void>;
12859
+
12775
12860
  /** 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. */
12776
- export var onErrorOccurred: WebNavigationFramedErrorEvent;
12861
+ export const onErrorOccurred: WebNavigationEvent<(details: WebNavigationFramedErrorCallbackDetails) => void>;
12777
12862
  }
12778
12863
 
12779
12864
  ////////////////////
chrome/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/chrome",
3
- "version": "0.1.24",
3
+ "version": "0.1.26",
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": "730d0c18220e1638428b77185a71f68f956e1e59195316ce218a90aef4255a1a",
97
+ "typesPublisherContentHash": "62c398ca66b33ee9108b994a25ed5bb7d36f810adacd5fe8d8e25f464f957f02",
98
98
  "typeScriptVersion": "5.2"
99
99
  }