@types/chrome 0.1.26 → 0.1.28

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 +473 -289
  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: Mon, 27 Oct 2025 19:32:06 GMT
11
+ * Last updated: Tue, 11 Nov 2025 22:02:08 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
@@ -246,7 +246,7 @@ declare namespace chrome {
246
246
  ): void;
247
247
 
248
248
  /**
249
- * Gets the badge text of the action. If no tab is specified, the non-tab-specific badge text is returned. If {@link declarativeNetRequest.ExtensionActionOptions.displayActionCountAsBadgeText displayActionCountAsBadgeText} is enabled, a placeholder text will be returned unless the {@link runtime.ManifestPermissions declarativeNetRequestFeedback} permission is present or tab-specific badge text was provided.
249
+ * Gets the badge text of the action. If no tab is specified, the non-tab-specific badge text is returned. If {@link declarativeNetRequest.ExtensionActionOptions.displayActionCountAsBadgeText displayActionCountAsBadgeText} is enabled, a placeholder text will be returned unless the {@link runtime.ManifestPermission declarativeNetRequestFeedback} permission is present or tab-specific badge text was provided.
250
250
  *
251
251
  * Can return its result via Promise.
252
252
  */
@@ -867,174 +867,120 @@ declare namespace chrome {
867
867
  */
868
868
  export namespace browserAction {
869
869
  export interface BadgeBackgroundColorDetails {
870
- /** An array of four integers in the range [0,255] that make up the RGBA color of the badge. For example, opaque red is [255, 0, 0, 255]. Can also be a string with a CSS value, with opaque red being #FF0000 or #F00. */
870
+ /** An array of four integers in the range 0-255 that make up the RGBA color of the badge. Can also be a string with a CSS hex color value; for example, `#FF0000` or `#F00` (red). Renders colors at full opacity. */
871
871
  color: string | extensionTypes.ColorArray;
872
- /** Optional. Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
873
- tabId?: number | undefined;
872
+ /** Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
873
+ tabId?: number | null | undefined;
874
874
  }
875
875
 
876
876
  export interface BadgeTextDetails {
877
- /** Any number of characters can be passed, but only about four can fit in the space. */
877
+ /** Any number of characters can be passed, but only about four can fit into the space. If an empty string (`''`) is passed, the badge text is cleared. If `tabId` is specified and `text` is null, the text for the specified tab is cleared and defaults to the global badge text. */
878
878
  text?: string | null | undefined;
879
- /** Optional. Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
880
- tabId?: number | undefined;
879
+ /** Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
880
+ tabId?: number | null | undefined;
881
881
  }
882
882
 
883
883
  export interface TitleDetails {
884
884
  /** The string the browser action should display when moused over. */
885
885
  title: string;
886
886
  /** Optional. Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
887
- tabId?: number | null;
887
+ tabId?: number | null | undefined;
888
888
  }
889
889
 
890
890
  export interface TabDetails {
891
- /** Optional. Specify the tab to get the information. If no tab is specified, the non-tab-specific information is returned. */
892
- tabId?: number | null;
891
+ /** The ID of the tab to query state for. If no tab is specified, the non-tab-specific state is returned. */
892
+ tabId?: number | null | undefined;
893
893
  }
894
894
 
895
- export interface TabIconDetails {
896
- /** Optional. Either a relative image path or a dictionary {size -> relative image path} pointing to icon to be set. If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. If the number of image pixels that fit into one screen space unit equals scale, then image with size scale * 19 will be selected. Initially only scales 1 and 2 will be supported. At least one image must be specified. Note that 'details.path = foo' is equivalent to 'details.imageData = {'19': foo}' */
897
- path?: string | { [index: string]: string } | undefined;
898
- /** Optional. Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
899
- tabId?: number | undefined;
900
- /** Optional. Either an ImageData object or a dictionary {size -> ImageData} representing icon to be set. If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. If the number of image pixels that fit into one screen space unit equals scale, then image with size scale * 19 will be selected. Initially only scales 1 and 2 will be supported. At least one image must be specified. Note that 'details.imageData = foo' is equivalent to 'details.imageData = {'19': foo}' */
901
- imageData?: ImageData | { [index: number]: ImageData } | undefined;
902
- }
895
+ export type TabIconDetails =
896
+ & {
897
+ /** Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
898
+ tabId?: number | null | undefined;
899
+ }
900
+ & (
901
+ | {
902
+ /** Either an ImageData object or a dictionary {size -> ImageData} representing an icon to be set. If the icon is specified as a dictionary, the image used is chosen depending on the screen's pixel density. If the number of image pixels that fit into one screen space unit equals `scale`, then an image with size `scale` \* n is selected, where _n_ is the size of the icon in the UI. At least one image must be specified. Note that 'details.imageData = foo' is equivalent to 'details.imageData = {'16': foo}' */
903
+ imageData: ImageData | { [index: number]: ImageData };
904
+ /** Either a relative image path or a dictionary {size -> relative image path} pointing to an icon to be set. If the icon is specified as a dictionary, the image used is chosen depending on the screen's pixel density. If the number of image pixels that fit into one screen space unit equals `scale`, then an image with size `scale` \* n is selected, where _n_ is the size of the icon in the UI. At least one image must be specified. Note that 'details.path = foo' is equivalent to 'details.path = {'16': foo}' */
905
+ path?: string | { [index: string]: string } | undefined;
906
+ }
907
+ | {
908
+ /** Either an ImageData object or a dictionary {size -> ImageData} representing an icon to be set. If the icon is specified as a dictionary, the image used is chosen depending on the screen's pixel density. If the number of image pixels that fit into one screen space unit equals `scale`, then an image with size `scale` \* n is selected, where _n_ is the size of the icon in the UI. At least one image must be specified. Note that 'details.imageData = foo' is equivalent to 'details.imageData = {'16': foo}' */
909
+ imageData?: ImageData | { [index: number]: ImageData } | undefined;
910
+ /** Either a relative image path or a dictionary {size -> relative image path} pointing to an icon to be set. If the icon is specified as a dictionary, the image used is chosen depending on the screen's pixel density. If the number of image pixels that fit into one screen space unit equals `scale`, then an image with size `scale` \* n is selected, where _n_ is the size of the icon in the UI. At least one image must be specified. Note that 'details.path = foo' is equivalent to 'details.path = {'16': foo}' */
911
+ path: string | { [index: string]: string };
912
+ }
913
+ );
903
914
 
904
915
  export interface PopupDetails {
905
- /** Optional. Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
906
- tabId?: number | null;
907
- /** The html file to show in a popup. If set to the empty string (''), no popup is shown. */
916
+ /** Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
917
+ tabId?: number | null | undefined;
918
+ /** The relative path to the HTML file to show in a popup. If set to the empty string (`''`), no popup is shown.*/
908
919
  popup: string;
909
920
  }
910
921
 
911
- export interface BrowserClickedEvent extends chrome.events.Event<(tab: chrome.tabs.Tab) => void> {}
912
-
913
922
  /**
914
- * @since Chrome 22
915
- * Enables the browser action for a tab. By default, browser actions are enabled.
916
- * @param tabId The id of the tab for which you want to modify the browser action.
917
- * @return The `enable` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
918
- */
919
- export function enable(tabId?: number | null): Promise<void>;
920
- /**
921
- * @since Chrome 22
922
- * Enables the browser action for a tab. By default, browser actions are enabled.
923
- * @param tabId The id of the tab for which you want to modify the browser action.
924
- * @param callback Supported since Chrome 67
923
+ * Enables the browser action for a tab. Defaults to enabled.
924
+ * @param tabId The ID of the tab for which to modify the browser action.
925
+ * @param callback Since Chrome 67
925
926
  */
926
927
  export function enable(callback?: () => void): void;
927
928
  export function enable(tabId: number | null | undefined, callback?: () => void): void;
929
+
928
930
  /**
929
931
  * Sets the background color for the badge.
930
- * @return The `setBadgeBackgroundColor` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
931
- */
932
- export function setBadgeBackgroundColor(details: BadgeBackgroundColorDetails): Promise<void>;
933
- /**
934
- * Sets the background color for the badge.
935
- * @param callback Supported since Chrome 67
932
+ * @param callback Since Chrome 67
936
933
  */
937
934
  export function setBadgeBackgroundColor(details: BadgeBackgroundColorDetails, callback?: () => void): void;
935
+
938
936
  /**
939
937
  * Sets the badge text for the browser action. The badge is displayed on top of the icon.
940
- * @return The `setBadgeText` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
941
- */
942
- export function setBadgeText(details: BadgeTextDetails): Promise<void>;
943
- /**
944
- * Sets the badge text for the browser action. The badge is displayed on top of the icon.
945
- * @param callback Supported since Chrome 67
946
- */
947
- export function setBadgeText(details: BadgeTextDetails, callback: () => void): void;
948
- /**
949
- * Sets the title of the browser action. This shows up in the tooltip.
950
- * @return The `setTitle` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
938
+ * @param callback Since Chrome 67
951
939
  */
952
- export function setTitle(details: TitleDetails): Promise<void>;
953
- /**
954
- * Sets the title of the browser action. This shows up in the tooltip.
955
- * @param callback Supported since Chrome 67
956
- */
957
- export function setTitle(details: TitleDetails, callback: () => void): void;
940
+ export function setBadgeText(details: BadgeTextDetails, callback?: () => void): void;
941
+
958
942
  /**
959
- * @since Chrome 19
960
- * Gets the badge text of the browser action. If no tab is specified, the non-tab-specific badge text is returned.
961
- * @param callback Supported since Chrome 67
943
+ * Sets the title of the browser action. This title appears in the tooltip.
944
+ * @param callback Since Chrome 67
962
945
  */
946
+ export function setTitle(details: TitleDetails, callback?: () => void): void;
947
+
948
+ /** Gets the badge text of the browser action. If no tab is specified, the non-tab-specific badge text is returned. */
963
949
  export function getBadgeText(details: TabDetails, callback: (result: string) => void): void;
950
+
964
951
  /**
965
- * @since Chrome 19
966
- * Gets the badge text of the browser action. If no tab is specified, the non-tab-specific badge text is returned.
967
- * @return The `getBadgeText` method provides its result via callback or returned as a `Promise` (MV3 only).
968
- */
969
- export function getBadgeText(details: TabDetails): Promise<string>;
970
- /**
971
- * Sets the html document to be opened as a popup when the user clicks on the browser action's icon.
972
- * @return The `setPopup` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
973
- */
974
- export function setPopup(details: PopupDetails): Promise<void>;
975
- /**
976
- * Sets the html document to be opened as a popup when the user clicks on the browser action's icon.
977
- * @param callback Supported since Chrome 67
952
+ * Sets the HTML document to be opened as a popup when the user clicks the browser action icon.
953
+ * @param callback Since Chrome 67
978
954
  */
979
955
  export function setPopup(details: PopupDetails, callback?: () => void): void;
956
+
980
957
  /**
981
- * @since Chrome 22
982
- * Disables the browser action for a tab.
983
- * @param tabId The id of the tab for which you want to modify the browser action.
984
- * @return The `disable` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
985
- */
986
- export function disable(tabId?: number | null): Promise<void>;
987
- /**
988
- * @since Chrome 22
989
958
  * Disables the browser action for a tab.
990
- * @param tabId The id of the tab for which you want to modify the browser action.
991
- * @param callback Supported since Chrome 67
992
- */
993
- export function disable(callback: () => void): void;
994
- export function disable(tabId?: number | null, callback?: () => void): void;
995
- /**
996
- * @since Chrome 19
997
- * Gets the title of the browser action.
959
+ * @param tabId The ID of the tab for which to modify the browser action.
960
+ * @param callback since Chrome 67
998
961
  */
962
+ export function disable(callback?: () => void): void;
963
+ export function disable(tabId: number | null | undefined, callback?: () => void): void;
964
+
965
+ /** Gets the title of the browser action. */
999
966
  export function getTitle(details: TabDetails, callback: (result: string) => void): void;
1000
- /**
1001
- * @since Chrome 19
1002
- * Gets the title of the browser action.
1003
- * @return The `getTitle` method provides its result via callback or returned as a `Promise` (MV3 only).
1004
- */
1005
- export function getTitle(details: TabDetails): Promise<string>;
1006
- /**
1007
- * @since Chrome 19
1008
- * Gets the background color of the browser action.
1009
- */
967
+
968
+ /** Gets the background color of the browser action. */
1010
969
  export function getBadgeBackgroundColor(
1011
970
  details: TabDetails,
1012
971
  callback: (result: extensionTypes.ColorArray) => void,
1013
972
  ): void;
1014
- /**
1015
- * @since Chrome 19
1016
- * Gets the background color of the browser action.
1017
- * @return The `getBadgeBackgroundColor` method provides its result via callback or returned as a `Promise` (MV3 only).
1018
- */
1019
- export function getBadgeBackgroundColor(details: TabDetails): Promise<extensionTypes.ColorArray>;
1020
- /**
1021
- * @since Chrome 19
1022
- * Gets the html document set as the popup for this browser action.
1023
- */
973
+
974
+ /** Gets the HTML document that is set as the popup for this browser action. */
1024
975
  export function getPopup(details: TabDetails, callback: (result: string) => void): void;
976
+
1025
977
  /**
1026
- * @since Chrome 19
1027
- * Gets the html document set as the popup for this browser action.
1028
- * @return The `getPopup` method provides its result via callback or returned as a `Promise` (MV3 only).
1029
- */
1030
- export function getPopup(details: TabDetails): Promise<string>;
1031
- /**
1032
- * Sets the icon for the browser action. The icon can be specified either as the path to an image file or as the pixel data from a canvas element, or as dictionary of either one of those. Either the path or the imageData property must be specified.
978
+ * Sets the icon for the browser action. The icon can be specified as the path to an image file, as the pixel data from a canvas element, or as a dictionary of one of those. Either the `path` or the `imageData` property must be specified.
1033
979
  */
1034
980
  export function setIcon(details: TabIconDetails, callback?: () => void): void;
1035
981
 
1036
- /** Fired when a browser action icon is clicked. This event will not fire if the browser action has a popup. */
1037
- export var onClicked: BrowserClickedEvent;
982
+ /** Fired when a browser action icon is clicked. Does not fire if the browser action has a popup. */
983
+ export const onClicked: events.Event<(tab: chrome.tabs.Tab) => void>;
1038
984
  }
1039
985
 
1040
986
  ////////////////////
@@ -1710,6 +1656,12 @@ declare namespace chrome {
1710
1656
  INCOGNITO_SESSION_ONLY = "incognito_session_only",
1711
1657
  }
1712
1658
 
1659
+ /** @since Chrome 141 */
1660
+ export enum SoundContentSetting {
1661
+ ALLOW = "allow",
1662
+ BLOCK = "block",
1663
+ }
1664
+
1713
1665
  /**
1714
1666
  * Whether to allow sites to download multiple files automatically. One of
1715
1667
  *
@@ -2489,109 +2441,258 @@ declare namespace chrome {
2489
2441
  * @deprecated Check out the {@link declarativeNetRequest} API instead
2490
2442
  */
2491
2443
  export namespace declarativeWebRequest {
2444
+ /** Filters request headers for various criteria. Multiple criteria are evaluated as a conjunction. */
2492
2445
  export interface HeaderFilter {
2446
+ /** Matches if the header name is equal to the specified string. */
2493
2447
  nameEquals?: string | undefined;
2448
+ /** Matches if the header value contains all of the specified strings. */
2494
2449
  valueContains?: string | string[] | undefined;
2450
+ /** Matches if the header name ends with the specified string. */
2495
2451
  nameSuffix?: string | undefined;
2452
+ /** Matches if the header value ends with the specified string. */
2496
2453
  valueSuffix?: string | undefined;
2454
+ /** Matches if the header value starts with the specified string. */
2497
2455
  valuePrefix?: string | undefined;
2456
+ /** Matches if the header name contains all of the specified strings. */
2498
2457
  nameContains?: string | string[] | undefined;
2458
+ /** Matches if the header value is equal to the specified string. */
2499
2459
  valueEquals?: string | undefined;
2460
+ /** Matches if the header name starts with the specified string. */
2500
2461
  namePrefix?: string | undefined;
2501
2462
  }
2502
2463
 
2464
+ /** Adds the response header to the response of this web request. As multiple response headers may share the same name, you need to first remove and then add a new response header in order to replace one. */
2503
2465
  export interface AddResponseHeader {
2466
+ /** HTTP response header name. */
2504
2467
  name: string;
2468
+ /** HTTP response header value. */
2505
2469
  value: string;
2506
2470
  }
2507
2471
 
2472
+ /** Removes one or more cookies of response. Note that it is preferred to use the Cookies API because this is computationally less expensive. */
2508
2473
  export interface RemoveResponseCookie {
2509
- filter: ResponseCookie;
2474
+ /** Filter for cookies that will be removed. All empty entries are ignored. */
2475
+ filter: FilterResponseCookie;
2510
2476
  }
2511
2477
 
2478
+ /** Removes all response headers of the specified names and values. */
2512
2479
  export interface RemoveResponseHeader {
2480
+ /** HTTP request header name (case-insensitive). */
2513
2481
  name: string;
2482
+ /** HTTP request header value (case-insensitive). */
2514
2483
  value?: string | undefined;
2515
2484
  }
2516
2485
 
2486
+ /** Matches network events by various criteria. */
2517
2487
  export interface RequestMatcher {
2488
+ /** Matches if the MIME media type of a response (from the HTTP Content-Type header) is contained in the list. */
2518
2489
  contentType?: string[] | undefined;
2519
- url?: chrome.events.UrlFilter | undefined;
2490
+ /** Matches if the conditions of the UrlFilter are fulfilled for the URL of the request. */
2491
+ url?: events.UrlFilter | undefined;
2492
+ /** Matches if the MIME media type of a response (from the HTTP Content-Type header) is not contained in the list. */
2520
2493
  excludeContentType?: string[] | undefined;
2494
+ /** Matches if none of the request headers is matched by any of the HeaderFilters. */
2495
+ excludeResponseHeaders?: HeaderFilter[] | undefined;
2496
+ /** Matches if none of the response headers is matched by any of the HeaderFilters. */
2521
2497
  excludeResponseHeader?: HeaderFilter[] | undefined;
2522
- resourceType?: string | undefined;
2498
+ /**
2499
+ * Matches if the conditions of the UrlFilter are fulfilled for the 'first party' URL of the request. The 'first party' URL of a request, when present, can be different from the request's target URL, and describes what is considered 'first party' for the sake of third-party checks for cookies.
2500
+ * @deprecated since Chrome 82
2501
+ */
2502
+ firstPartyForCookiesUrl?: events.UrlFilter | undefined;
2503
+ /** Matches if some of the request headers is matched by one of the HeaderFilters. */
2504
+ requestHeaders?: HeaderFilter[] | undefined;
2505
+ /** Matches if the request type of a request is contained in the list. Requests that cannot match any of the types will be filtered out. */
2506
+ resourceType?: `${webRequest.ResourceType}`[] | undefined;
2507
+ /** Matches if some of the response headers is matched by one of the HeaderFilters. */
2523
2508
  responseHeaders?: HeaderFilter[] | undefined;
2509
+ /** Contains a list of strings describing stages. Allowed values are 'onBeforeRequest', 'onBeforeSendHeaders', 'onHeadersReceived', 'onAuthRequired'. If this attribute is present, then it limits the applicable stages to those listed. Note that the whole condition is only applicable in stages compatible with all attributes. */
2510
+ stages?: `${Stage}`[] | undefined;
2511
+ /**
2512
+ * If set to true, matches requests that are subject to third-party cookie policies. If set to false, matches all other requests.
2513
+ * @deprecated since Chrome 87
2514
+ */
2515
+ thirdPartyForCookies?: boolean | undefined;
2524
2516
  }
2525
2517
 
2518
+ /** Masks all rules that match the specified criteria. */
2526
2519
  export interface IgnoreRules {
2527
- lowerPriorityThan: number;
2520
+ /** If set, rules with the specified tag are ignored. This ignoring is not persisted, it affects only rules and their actions of the same network request stage. Note that rules are executed in descending order of their priorities. This action affects rules of lower priority than the current rule. Rules with the same priority may or may not be ignored. */
2521
+ hasTag?: string | undefined;
2522
+ /** If set, rules with a lower priority than the specified value are ignored. This boundary is not persisted, it affects only rules and their actions of the same network request stage. */
2523
+ lowerPriorityThan?: number | undefined;
2528
2524
  }
2529
2525
 
2526
+ /** Declarative event action that redirects a network request to an empty document. */
2530
2527
  export interface RedirectToEmptyDocument {}
2531
2528
 
2529
+ /** Declarative event action that redirects a network request. */
2532
2530
  export interface RedirectRequest {
2531
+ /** Destination to where the request is redirected. */
2533
2532
  redirectUrl: string;
2534
2533
  }
2535
2534
 
2535
+ /** A specification of a cookie in HTTP Responses. */
2536
2536
  export interface ResponseCookie {
2537
+ /** Value of the Domain cookie attribute. */
2537
2538
  domain?: string | undefined;
2539
+ /** Name of a cookie. */
2538
2540
  name?: string | undefined;
2541
+ /** Value of the Expires cookie attribute. */
2539
2542
  expires?: string | undefined;
2543
+ /** Value of the Max-Age cookie attribute */
2540
2544
  maxAge?: number | undefined;
2545
+ /** Value of a cookie, may be padded in double-quotes. */
2541
2546
  value?: string | undefined;
2547
+ /** Value of the Path cookie attribute. */
2542
2548
  path?: string | undefined;
2549
+ /** Existence of the HttpOnly cookie attribute. */
2543
2550
  httpOnly?: string | undefined;
2551
+ /** Existence of the Secure cookie attribute. */
2544
2552
  secure?: string | undefined;
2545
2553
  }
2546
2554
 
2555
+ /** Adds a cookie to the response or overrides a cookie, in case another cookie of the same name exists already. Note that it is preferred to use the Cookies API because this is computationally less expensive. */
2547
2556
  export interface AddResponseCookie {
2548
2557
  cookie: ResponseCookie;
2549
2558
  }
2550
2559
 
2560
+ /** Edits one or more cookies of response. Note that it is preferred to use the Cookies API because this is computationally less expensive. */
2551
2561
  export interface EditResponseCookie {
2562
+ /** Filter for cookies that will be modified. All empty entries are ignored. */
2552
2563
  filter: ResponseCookie;
2564
+ /** Attributes that shall be overridden in cookies that machted the filter. Attributes that are set to an empty string are removed. */
2553
2565
  modification: ResponseCookie;
2554
2566
  }
2555
2567
 
2568
+ /** Declarative event action that cancels a network request. */
2556
2569
  export interface CancelRequest {}
2557
2570
 
2571
+ /** Removes the request header of the specified name. Do not use SetRequestHeader and RemoveRequestHeader with the same header name on the same request. Each request header name occurs only once in each request. */
2558
2572
  export interface RemoveRequestHeader {
2573
+ /** HTTP request header name (case-insensitive). */
2559
2574
  name: string;
2560
2575
  }
2561
2576
 
2577
+ /** Edits one or more cookies of request. Note that it is preferred to use the Cookies API because this is computationally less expensive. */
2562
2578
  export interface EditRequestCookie {
2579
+ /** Filter for cookies that will be modified. All empty entries are ignored. */
2563
2580
  filter: RequestCookie;
2581
+ /** Attributes that shall be overridden in cookies that machted the filter. Attributes that are set to an empty string are removed. */
2564
2582
  modification: RequestCookie;
2565
2583
  }
2566
2584
 
2585
+ /** A filter of a cookie in HTTP Responses. */
2586
+ export interface FilterResponseCookie {
2587
+ /** Inclusive lower bound on the cookie lifetime (specified in seconds after current time). Only cookies whose expiration date-time is set to 'now + ageLowerBound' or later fulfill this criterion. Session cookies do not meet the criterion of this filter. The cookie lifetime is calculated from either 'max-age' or 'expires' cookie attributes. If both are specified, 'max-age' is used to calculate the cookie lifetime. */
2588
+ ageLowerBound?: number | undefined;
2589
+ /** Inclusive upper bound on the cookie lifetime (specified in seconds after current time). Only cookies whose expiration date-time is in the interval [now, now + ageUpperBound] fulfill this criterion. Session cookies and cookies whose expiration date-time is in the past do not meet the criterion of this filter. The cookie lifetime is calculated from either 'max-age' or 'expires' cookie attributes. If both are specified, 'max-age' is used to calculate the cookie lifetime. */
2590
+ ageUpperBound?: number | undefined;
2591
+ /** Value of the Domain cookie attribute. */
2592
+ domain?: string | undefined;
2593
+ /** Value of the Expires cookie attribute. */
2594
+ expires?: string | undefined;
2595
+ /** Existence of the HttpOnly cookie attribute. */
2596
+ httpOnly?: string | undefined;
2597
+ /** Value of the Max-Age cookie attribute */
2598
+ maxAge?: number | undefined;
2599
+ /** Name of a cookie. */
2600
+ name?: string | undefined;
2601
+ /** Value of the Path cookie attribute. */
2602
+ path?: string | undefined;
2603
+ /** Existence of the Secure cookie attribute. */
2604
+ secure?: string | undefined;
2605
+ /** Filters session cookies. Session cookies have no lifetime specified in any of 'max-age' or 'expires' attributes. */
2606
+ session?: boolean | undefined;
2607
+ /** Value of a cookie, may be padded in double-quotes. */
2608
+ value?: string | undefined;
2609
+ }
2610
+
2611
+ /** Sets the request header of the specified name to the specified value. If a header with the specified name did not exist before, a new one is created. Header name comparison is always case-insensitive. Each request header name occurs only once in each request. */
2567
2612
  export interface SetRequestHeader {
2613
+ /** HTTP request header name. */
2568
2614
  name: string;
2615
+ /** HTTP request header value. */
2569
2616
  value: string;
2570
2617
  }
2571
2618
 
2619
+ /** A filter or specification of a cookie in HTTP Requests. */
2572
2620
  export interface RequestCookie {
2621
+ /** Name of a cookie. */
2573
2622
  name?: string | undefined;
2623
+ /** Value of a cookie, may be padded in double-quotes. */
2574
2624
  value?: string | undefined;
2575
2625
  }
2576
2626
 
2627
+ /** Redirects a request by applying a regular expression on the URL. The regular expressions use the RE2 syntax. */
2577
2628
  export interface RedirectByRegEx {
2629
+ /** Destination pattern. */
2578
2630
  to: string;
2631
+ /** A match pattern that may contain capture groups. Capture groups are referenced in the Perl syntax ($1, $2, ...) instead of the RE2 syntax (\1, \2, ...) in order to be closer to JavaScript Regular Expressions. */
2579
2632
  from: string;
2580
2633
  }
2581
2634
 
2635
+ /** Declarative event action that redirects a network request to a transparent image. */
2582
2636
  export interface RedirectToTransparentImage {}
2583
2637
 
2638
+ /** Adds a cookie to the request or overrides a cookie, in case another cookie of the same name exists already. Note that it is preferred to use the Cookies API because this is computationally less expensive. */
2584
2639
  export interface AddRequestCookie {
2585
2640
  cookie: RequestCookie;
2586
2641
  }
2587
2642
 
2643
+ /** Removes one or more cookies of request. Note that it is preferred to use the Cookies API because this is computationally less expensive. */
2588
2644
  export interface RemoveRequestCookie {
2645
+ /** Filter for cookies that will be removed. All empty entries are ignored. */
2589
2646
  filter: RequestCookie;
2590
2647
  }
2591
2648
 
2592
- export interface RequestedEvent extends chrome.events.Event<() => void> {}
2649
+ export enum Stage {
2650
+ ON_AUTH_REQUIRED = "onAuthRequired",
2651
+ ON_BEFORE_REQUEST = "onBeforeRequest",
2652
+ ON_BEFORE_SEND_HEADERS = "onBeforeSendHeaders",
2653
+ ON_HEADERS_RECEIVED = "onHeadersReceived",
2654
+ }
2655
+
2656
+ export interface MessageDetails {
2657
+ /** A UUID of the document that made the request. */
2658
+ documentId?: string;
2659
+ /** The lifecycle the document is in. */
2660
+ documentLifecycle: extensionTypes.DocumentLifecycle;
2661
+ /** The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (`type` is `main_frame` or `sub_frame`), `frameId` indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab. */
2662
+ frameId: number;
2663
+ /** The type of frame the navigation occurred in. */
2664
+ frameType: extensionTypes.FrameType;
2665
+ /** The message sent by the calling script. */
2666
+ message: string;
2667
+ /** Standard HTTP method. */
2668
+ method: string;
2669
+ /** A UUID of the parent document owning this frame. This is not set if there is no parent. */
2670
+ parentDocumentId?: string;
2671
+ /** ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists. */
2672
+ parentFrameId: number;
2673
+ /** The ID of the request. Request IDs are unique within a browser session. As a result, they could be used to relate different events of the same request. */
2674
+ requestId: string;
2675
+ /** The stage of the network request during which the event was triggered. */
2676
+ stage: `${Stage}`;
2677
+ /** The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab. */
2678
+ tabId: number;
2679
+ /** The time when this signal is triggered, in milliseconds since the epoch. */
2680
+ timeStamp: number;
2681
+ /** How the requested resource will be used. */
2682
+ type: `${webRequest.ResourceType}`;
2683
+ url: string;
2684
+ }
2685
+
2686
+ export interface SendMessageToExtension {
2687
+ /** The value that will be passed in the message attribute of the dictionary that is passed to the event handler. */
2688
+ message: string;
2689
+ }
2690
+
2691
+ /** Fired when a message is sent via {@link declarativeWebRequest.SendMessageToExtension} from an action of the declarative web request API. */
2692
+ export const onMessage: events.Event<(details: MessageDetails) => void>;
2593
2693
 
2594
- export var onRequest: RequestedEvent;
2694
+ /** Provides the Declarative Event API consisting of `addRules`, `removeRules`, and `getRules`. */
2695
+ export const onRequest: events.Event<() => void>;
2595
2696
  }
2596
2697
 
2597
2698
  ////////////////////
@@ -6901,16 +7002,26 @@ declare namespace chrome {
6901
7002
  */
6902
7003
  export namespace loginState {
6903
7004
  export enum ProfileType {
7005
+ /** Specifies that the extension is in the signin profile. */
6904
7006
  SIGNIN_PROFILE = "SIGNIN_PROFILE",
7007
+ /** Specifies that the extension is in the user profile. */
6905
7008
  USER_PROFILE = "USER_PROFILE",
7009
+ /** Specifies that the extension is in the lock screen profile. */
7010
+ LOCK_PROFILE = "LOCK_PROFILE",
6906
7011
  }
6907
7012
 
6908
7013
  export enum SessionState {
7014
+ /** Specifies that the session state is unknown. */
6909
7015
  UNKNOWN = "UNKNOWN",
7016
+ /** Specifies that the user is in the out-of-box-experience screen. */
6910
7017
  IN_OOBE_SCREEN = "IN_OOBE_SCREEN",
7018
+ /** Specifies that the user is in the login screen. */
6911
7019
  IN_LOGIN_SCREEN = "IN_LOGIN_SCREEN",
7020
+ /** Specifies that the user is in the session. */
6912
7021
  IN_SESSION = "IN_SESSION",
7022
+ /** Specifies that the user is in the lock screen. */
6913
7023
  IN_LOCK_SCREEN = "IN_LOCK_SCREEN",
7024
+ /** Specifies that the device is in RMA mode, finalizing repairs. */
6914
7025
  IN_RMA_SCREEN = "IN_RMA_SCREEN",
6915
7026
  }
6916
7027
 
@@ -7551,8 +7662,6 @@ declare namespace chrome {
7551
7662
  * MV2 only
7552
7663
  */
7553
7664
  export namespace pageAction {
7554
- export interface PageActionClickedEvent extends chrome.events.Event<(tab: chrome.tabs.Tab) => void> {}
7555
-
7556
7665
  export interface TitleDetails {
7557
7666
  /** The id of the tab for which you want to modify the page action. */
7558
7667
  tabId: number;
@@ -7560,77 +7669,77 @@ declare namespace chrome {
7560
7669
  title: string;
7561
7670
  }
7562
7671
 
7563
- export interface GetDetails {
7564
- /** Specify the tab to get the title from. */
7672
+ export interface TabDetails {
7673
+ /** The ID of the tab to query state for. */
7565
7674
  tabId: number;
7566
7675
  }
7567
7676
 
7568
7677
  export interface PopupDetails {
7569
7678
  /** The id of the tab for which you want to modify the page action. */
7570
7679
  tabId: number;
7571
- /** The html file to show in a popup. If set to the empty string (''), no popup is shown. */
7680
+ /** The relative path to the HTML file to show in a popup. If set to the empty string (`''`), no popup is shown. */
7572
7681
  popup: string;
7573
7682
  }
7574
7683
 
7575
- export interface IconDetails {
7576
- /** The id of the tab for which you want to modify the page action. */
7577
- tabId: number;
7578
- /**
7579
- * Optional.
7580
- * @deprecated This argument is ignored.
7581
- */
7582
- iconIndex?: number | undefined;
7583
- /**
7584
- * Optional.
7585
- * Either an ImageData object or a dictionary {size -> ImageData} representing icon to be set. If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. If the number of image pixels that fit into one screen space unit equals scale, then image with size scale * 19 will be selected. Initially only scales 1 and 2 will be supported. At least one image must be specified. Note that 'details.imageData = foo' is equivalent to 'details.imageData = {'19': foo}'
7586
- */
7587
- imageData?: ImageData | { [index: number]: ImageData } | undefined;
7588
- /**
7589
- * Optional.
7590
- * Either a relative image path or a dictionary {size -> relative image path} pointing to icon to be set. If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. If the number of image pixels that fit into one screen space unit equals scale, then image with size scale * 19 will be selected. Initially only scales 1 and 2 will be supported. At least one image must be specified. Note that 'details.path = foo' is equivalent to 'details.imageData = {'19': foo}'
7591
- */
7592
- path?: string | { [index: string]: string } | undefined;
7593
- }
7684
+ export type IconDetails =
7685
+ & {
7686
+ /** @deprecated This argument is ignored. */
7687
+ iconIndex?: number | undefined;
7688
+ /** The id of the tab for which you want to modify the page action. */
7689
+ tabId: number;
7690
+ }
7691
+ & (
7692
+ | {
7693
+ /** Either an ImageData object or a dictionary {size -> ImageData} representing icon to be set. If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. If the number of image pixels that fit into one screen space unit equals `scale`, then image with size `scale` \* n will be selected, where n is the size of the icon in the UI. At least one image must be specified. Note that 'details.imageData = foo' is equivalent to 'details.imageData = {'16': foo}' */
7694
+ imageData: ImageData | { [index: number]: ImageData };
7695
+ /** Either a relative image path or a dictionary {size -> relative image path} pointing to icon to be set. If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. If the number of image pixels that fit into one screen space unit equals `scale`, then image with size `scale` \* n will be selected, where n is the size of the icon in the UI. At least one image must be specified. Note that 'details.path = foo' is equivalent to 'details.path = {'16': foo}' */
7696
+ path?: string | { [index: string]: string } | undefined;
7697
+ }
7698
+ | {
7699
+ /** Either an ImageData object or a dictionary {size -> ImageData} representing icon to be set. If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. If the number of image pixels that fit into one screen space unit equals `scale`, then image with size `scale` \* n will be selected, where n is the size of the icon in the UI. At least one image must be specified. Note that 'details.imageData = foo' is equivalent to 'details.imageData = {'16': foo}' */
7700
+ imageData?: ImageData | { [index: number]: ImageData } | undefined;
7701
+ /** Either a relative image path or a dictionary {size -> relative image path} pointing to icon to be set. If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. If the number of image pixels that fit into one screen space unit equals `scale`, then image with size `scale` \* n will be selected, where n is the size of the icon in the UI. At least one image must be specified. Note that 'details.path = foo' is equivalent to 'details.path = {'16': foo}' */
7702
+ path: string | { [index: string]: string };
7703
+ }
7704
+ );
7594
7705
 
7595
7706
  /**
7596
- * Shows the page action. The page action is shown whenever the tab is selected.
7707
+ * Hides the page action. Hidden page actions still appear in the Chrome toolbar, but are grayed out.
7597
7708
  * @param tabId The id of the tab for which you want to modify the page action.
7598
- * @param callback Supported since Chrome 67
7709
+ * @param callback Since Chrome 67
7599
7710
  */
7600
7711
  export function hide(tabId: number, callback?: () => void): void;
7712
+
7601
7713
  /**
7602
7714
  * Shows the page action. The page action is shown whenever the tab is selected.
7603
7715
  * @param tabId The id of the tab for which you want to modify the page action.
7604
- * @param callback Supported since Chrome 67
7716
+ * @param callback Since Chrome 67
7605
7717
  */
7606
7718
  export function show(tabId: number, callback?: () => void): void;
7719
+
7607
7720
  /**
7608
7721
  * Sets the title of the page action. This is displayed in a tooltip over the page action.
7609
- * @param callback Supported since Chrome 67
7722
+ * @param callback Since Chrome 67
7610
7723
  */
7611
7724
  export function setTitle(details: TitleDetails, callback?: () => void): void;
7725
+
7612
7726
  /**
7613
- * Sets the html document to be opened as a popup when the user clicks on the page action's icon.
7614
- * @param callback Supported since Chrome 67
7727
+ * Sets the HTML document to be opened as a popup when the user clicks on the page action's icon.
7728
+ * @param callback Since Chrome 67
7615
7729
  */
7616
7730
  export function setPopup(details: PopupDetails, callback?: () => void): void;
7617
- /**
7618
- * Gets the title of the page action.
7619
- * @since Chrome 19
7620
- */
7621
- export function getTitle(details: GetDetails, callback: (result: string) => void): void;
7622
- /**
7623
- * Gets the html document set as the popup for this page action.
7624
- * @since Chrome 19
7625
- */
7626
- export function getPopup(details: GetDetails, callback: (result: string) => void): void;
7627
- /**
7628
- * Sets the icon for the page action. The icon can be specified either as the path to an image file or as the pixel data from a canvas element, or as dictionary of either one of those. Either the path or the imageData property must be specified.
7629
- */
7731
+
7732
+ /** Gets the title of the page action. */
7733
+ export function getTitle(details: TabDetails, callback: (result: string) => void): void;
7734
+
7735
+ /** Gets the html document set as the popup for this page action. */
7736
+ export function getPopup(details: TabDetails, callback: (result: string) => void): void;
7737
+
7738
+ /** Sets the icon for the page action. The icon can be specified either as the path to an image file or as the pixel data from a canvas element, or as dictionary of either one of those. Either the path or the imageData property must be specified. */
7630
7739
  export function setIcon(details: IconDetails, callback?: () => void): void;
7631
7740
 
7632
7741
  /** Fired when a page action icon is clicked. This event will not fire if the page action has a popup. */
7633
- export var onClicked: PageActionClickedEvent;
7742
+ export const onClicked: events.Event<(tab: chrome.tabs.Tab) => void>;
7634
7743
  }
7635
7744
 
7636
7745
  ////////////////////
@@ -7667,7 +7776,7 @@ declare namespace chrome {
7667
7776
  /** The list of host permissions, including those specified in the `optional_permissions` or `permissions` keys in the manifest, and those associated with [Content Scripts](https://developer.chrome.com/docs/extensions/develop/concepts/content-scripts). */
7668
7777
  origins?: string[];
7669
7778
  /** List of named permissions (does not include hosts or origins). */
7670
- permissions?: chrome.runtime.ManifestPermissions[];
7779
+ permissions?: chrome.runtime.ManifestPermission[];
7671
7780
  }
7672
7781
 
7673
7782
  export interface AddHostAccessRequest {
@@ -8973,7 +9082,7 @@ declare namespace chrome {
8973
9082
  }
8974
9083
 
8975
9084
  /** Source: https://developer.chrome.com/docs/extensions/reference/permissions-list */
8976
- export type ManifestPermissions =
9085
+ export type ManifestPermission =
8977
9086
  | "accessibilityFeatures.modify"
8978
9087
  | "accessibilityFeatures.read"
8979
9088
  | "activeTab"
@@ -9057,9 +9166,14 @@ declare namespace chrome {
9057
9166
  | "webRequestBlocking"
9058
9167
  | "webRequestAuthProvider";
9059
9168
 
9169
+ /**
9170
+ * @deprecated Use `ManifestPermission` instead.
9171
+ */
9172
+ export type ManifestPermissions = ManifestPermission;
9173
+
9060
9174
  /** Source : https://developer.chrome.com/docs/extensions/reference/api/permissions */
9061
- export type ManifestOptionalPermissions = Exclude<
9062
- ManifestPermissions,
9175
+ export type ManifestOptionalPermission = Exclude<
9176
+ ManifestPermission,
9063
9177
  | "debugger"
9064
9178
  | "declarativeNetRequest"
9065
9179
  | "devtools"
@@ -9074,6 +9188,11 @@ declare namespace chrome {
9074
9188
  | "webAuthenticationProxy"
9075
9189
  >;
9076
9190
 
9191
+ /**
9192
+ * @deprecated Use `ManifestOptionalPermission` instead.
9193
+ */
9194
+ export type ManifestOptionalPermissions = ManifestOptionalPermission;
9195
+
9077
9196
  export interface SearchProvider {
9078
9197
  name?: string | undefined;
9079
9198
  keyword?: string | undefined;
@@ -9293,8 +9412,8 @@ declare namespace chrome {
9293
9412
  }
9294
9413
  | undefined;
9295
9414
  content_security_policy?: string | undefined;
9296
- optional_permissions?: ManifestOptionalPermissions[] | string[] | undefined;
9297
- permissions?: ManifestPermissions[] | string[] | undefined;
9415
+ optional_permissions?: (ManifestOptionalPermission | string)[] | undefined;
9416
+ permissions?: (ManifestPermission | string)[] | undefined;
9298
9417
  web_accessible_resources?: string[] | undefined;
9299
9418
  }
9300
9419
 
@@ -9329,9 +9448,9 @@ declare namespace chrome {
9329
9448
  sandbox?: string;
9330
9449
  };
9331
9450
  host_permissions?: string[] | undefined;
9332
- optional_permissions?: ManifestOptionalPermissions[] | undefined;
9451
+ optional_permissions?: ManifestOptionalPermission[] | undefined;
9333
9452
  optional_host_permissions?: string[] | undefined;
9334
- permissions?: ManifestPermissions[] | undefined;
9453
+ permissions?: ManifestPermission[] | undefined;
9335
9454
  web_accessible_resources?:
9336
9455
  | Array<
9337
9456
  & {
@@ -12470,27 +12589,35 @@ declare namespace chrome {
12470
12589
  * @since Chrome 43
12471
12590
  */
12472
12591
  export namespace wallpaper {
12592
+ /**
12593
+ * The supported wallpaper layouts.
12594
+ * @since Chrome 44
12595
+ */
12596
+ export enum WallpaperLayout {
12597
+ STRETCH = "STRETCH",
12598
+ CENTER = "CENTER",
12599
+ CENTER_CROPPED = "CENTER_CROPPED",
12600
+ }
12601
+
12473
12602
  export interface WallpaperDetails {
12474
- /** Optional. The jpeg or png encoded wallpaper image. */
12603
+ /** The jpeg or png encoded wallpaper image as an ArrayBuffer. */
12475
12604
  data?: ArrayBuffer | undefined;
12476
- /** Optional. The URL of the wallpaper to be set. */
12605
+ /** The URL of the wallpaper to be set (can be relative). */
12477
12606
  url?: string | undefined;
12478
- /**
12479
- * The supported wallpaper layouts.
12480
- * One of: "STRETCH", "CENTER", or "CENTER_CROPPED"
12481
- */
12482
- layout: "STRETCH" | "CENTER" | "CENTER_CROPPED";
12607
+ /** The supported wallpaper layouts. */
12608
+ layout: `${WallpaperLayout}`;
12483
12609
  /** The file name of the saved wallpaper. */
12484
12610
  filename: string;
12485
- /** Optional. True if a 128x60 thumbnail should be generated. */
12611
+ /** True if a 128x60 thumbnail should be generated. Layout and ratio are not supported yet. */
12486
12612
  thumbnail?: boolean | undefined;
12487
12613
  }
12488
12614
 
12489
12615
  /**
12490
12616
  * Sets wallpaper to the image at url or wallpaperData with the specified layout
12491
- * @param callback
12492
- * Optional parameter thumbnail: The jpeg encoded wallpaper thumbnail. It is generated by resizing the wallpaper to 128x60.
12617
+ *
12618
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
12493
12619
  */
12620
+ export function setWallpaper(details: WallpaperDetails): Promise<ArrayBuffer | undefined>;
12494
12621
  export function setWallpaper(details: WallpaperDetails, callback: (thumbnail?: ArrayBuffer) => void): void;
12495
12622
  }
12496
12623
 
@@ -13679,7 +13806,7 @@ declare namespace chrome {
13679
13806
  * @since Chrome 86
13680
13807
  */
13681
13808
  export enum HeaderOperation {
13682
- /** Adds a new entry for the specified header. This operation is not supported for request headers. */
13809
+ /** Adds a new entry for the specified header. When modifying the headers of a request, this operation is only supported for specific headers. */
13683
13810
  APPEND = "append",
13684
13811
  /** Sets a new value for the specified header, removing any existing headers with the same name. */
13685
13812
  SET = "set",
@@ -13872,7 +13999,7 @@ declare namespace chrome {
13872
13999
  requestMethods?: `${RequestMethod}`[] | undefined;
13873
14000
 
13874
14001
  /**
13875
- * List of {@link tabs.Tab.id} which the rule should not match.
14002
+ * List of {@link tabs.Tab.id} which the rule should match.
13876
14003
  * An ID of {@link tabs.TAB_ID_NONE} matches requests which don't originate from a tab.
13877
14004
  * An empty list is not allowed. Only supported for session-scoped rules.
13878
14005
  * @since Chrome 92
@@ -14309,6 +14436,21 @@ declare namespace chrome {
14309
14436
  * @since Chrome 114, MV3
14310
14437
  */
14311
14438
  export namespace sidePanel {
14439
+ /** @since Chrome 141 */
14440
+ export type CloseOptions =
14441
+ | {
14442
+ /** The tab in which to close the side panel. If a tab-specific side panel is open in the specified tab, it will be closed for that tab. At least one of this or `windowId` must be provided. */
14443
+ tabId: number;
14444
+ /** The window in which to close the side panel. If a global side panel is open in the specified window, it will be closed for all tabs in that window where no tab-specific panel is active. At least one of this or `tabId` must be provided. */
14445
+ windowId?: number | undefined;
14446
+ }
14447
+ | {
14448
+ /** The tab in which to close the side panel. If a tab-specific side panel is open in the specified tab, it will be closed for that tab. At least one of this or `windowId` must be provided. */
14449
+ tabId?: number | undefined;
14450
+ /** The window in which to close the side panel. If a global side panel is open in the specified window, it will be closed for all tabs in that window where no tab-specific panel is active. At least one of this or `tabId` must be provided. */
14451
+ windowId: number;
14452
+ };
14453
+
14312
14454
  export interface GetPanelOptions {
14313
14455
  /**
14314
14456
  * If specified, the side panel options for the given tab will be returned.
@@ -14346,11 +14488,31 @@ declare namespace chrome {
14346
14488
  openPanelOnActionClick?: boolean | undefined;
14347
14489
  }
14348
14490
 
14491
+ /** @since Chrome 142 */
14492
+ export interface PanelClosedInfo {
14493
+ /** The path of the local resource within the extension package whose content is displayed in the panel. */
14494
+ path: string;
14495
+ /** The optional ID of the tab where the side panel was closed. This is provided only when the panel is tab-specific. */
14496
+ tabId?: number;
14497
+ /** The ID of the window where the side panel was closed. This is available for both global and tab-specific panels. */
14498
+ windowId: number;
14499
+ }
14500
+
14349
14501
  /** @since Chrome 140 */
14350
14502
  export interface PanelLayout {
14351
14503
  side: `${Side}`;
14352
14504
  }
14353
14505
 
14506
+ /** @since Chrome 141 */
14507
+ export interface PanelOpenedInfo {
14508
+ /** The path of the local resource within the extension package whose content is displayed in the panel. */
14509
+ path: string;
14510
+ /** The optional ID of the tab where the side panel is opened. This is provided only when the panel is tab-specific. */
14511
+ tabId?: number;
14512
+ /** The ID of the window where the side panel is opened. This is available for both global and tab-specific panels. */
14513
+ windowId: number;
14514
+ }
14515
+
14354
14516
  export interface PanelOptions {
14355
14517
  /** Whether the side panel should be enabled. This is optional. The default value is true. */
14356
14518
  enabled?: boolean | undefined;
@@ -14429,6 +14591,12 @@ declare namespace chrome {
14429
14591
  */
14430
14592
  export function setPanelBehavior(behavior: PanelBehavior): Promise<void>;
14431
14593
  export function setPanelBehavior(behavior: PanelBehavior, callback: () => void): void;
14594
+
14595
+ /**
14596
+ * Fired when the extension's side panel is opened.
14597
+ * @since Chrome 141
14598
+ */
14599
+ const onOpened: events.Event<(info: PanelOpenedInfo) => void>;
14432
14600
  }
14433
14601
 
14434
14602
  ////////////////////
@@ -14441,133 +14609,165 @@ declare namespace chrome {
14441
14609
  * @since Chrome 120, MV3
14442
14610
  */
14443
14611
  export namespace userScripts {
14444
- /**
14445
- * Execution environment for a user script.
14446
- */
14447
- export type ExecutionWorld = "MAIN" | "USER_SCRIPT";
14612
+ /** The JavaScript world for a user script to execute within. */
14613
+ export enum ExecutionWorld {
14614
+ /** Specifies the execution environment of the DOM, which is the execution environment shared with the host page's JavaScript. */
14615
+ MAIN = "MAIN",
14616
+ /** Specifies the execution environment that is specific to user scripts and is exempt from the page's CSP. */
14617
+ USER_SCRIPT = "USER_SCRIPT",
14618
+ }
14448
14619
 
14449
14620
  /** @since Chrome 135 */
14450
- export interface InjectionResult {
14451
- /** The document associated with the injection. */
14452
- documentId: string;
14453
- /** The error, if any. `error` and `result` are mutually exclusive. */
14454
- error?: string;
14455
- /** The frame associated with the injection. */
14456
- frameId: number;
14457
- /** The result of the script execution. */
14458
- result: any;
14459
- }
14621
+ export type InjectionResult<T = unknown> =
14622
+ & {
14623
+ /** The document associated with the injection. */
14624
+ documentId: string;
14625
+ /** The frame associated with the injection. */
14626
+ frameId: number;
14627
+ }
14628
+ & (
14629
+ | {
14630
+ /** The error, if any */
14631
+ error?: never;
14632
+ /** The result of the script execution. */
14633
+ result: T;
14634
+ }
14635
+ | {
14636
+ /** The error, if any */
14637
+ error: string;
14638
+ /** The result of the script execution. */
14639
+ result?: never;
14640
+ }
14641
+ );
14460
14642
 
14461
14643
  export interface WorldProperties {
14462
14644
  /** Specifies the world csp. The default is the `ISOLATED` world csp. */
14463
- csp?: string;
14464
- /** Specifies whether messaging APIs are exposed. The default is false.*/
14465
- messaging?: boolean;
14645
+ csp?: string | undefined;
14646
+ /** Specifies whether messaging APIs are exposed. The default is `false`.*/
14647
+ messaging?: boolean | undefined;
14466
14648
  /**
14467
14649
  * Specifies the ID of the specific user script world to update. If not provided, updates the properties of the default user script world. Values with leading underscores (`_`) are reserved.
14468
14650
  * @since Chrome 133
14469
14651
  */
14470
- worldId?: string;
14652
+ worldId?: string | undefined;
14471
14653
  }
14472
14654
 
14473
14655
  export interface UserScriptFilter {
14474
- ids?: string[];
14656
+ /** {@link getScripts} only returns scripts with the IDs specified in this list. */
14657
+ ids?: string[] | undefined;
14475
14658
  }
14476
14659
 
14477
- /** @since Chrome 135 */
14478
- export interface InjectionTarget {
14479
- /** Whether the script should inject into all frames within the tab. Defaults to false. This must not be true if `frameIds` is specified. */
14480
- allFrames?: boolean;
14481
- /** The IDs of specific documentIds to inject into. This must not be set if `frameIds` is set. */
14482
- documentIds?: string[];
14483
- /** The IDs of specific frames to inject into. */
14484
- frameIds?: number[];
14485
- /** The ID of the tab into which to inject. */
14486
- tabId: number;
14487
- }
14660
+ // /** @since Chrome 135 */
14661
+ export type InjectionTarget =
14662
+ & {
14663
+ /** The ID of the tab into which to inject. */
14664
+ tabId: number;
14665
+ }
14666
+ & (
14667
+ | {
14668
+ /** Whether the script should inject into all frames within the tab. Defaults to false. */
14669
+ allFrames?: boolean | undefined;
14670
+ /** The IDs of specific documentIds to inject into. */
14671
+ documentIds?: never;
14672
+ /** The IDs of specific frames to inject into. */
14673
+ frameIds?: never;
14674
+ }
14675
+ | {
14676
+ /** Whether the script should inject into all frames within the tab. Defaults to false. */
14677
+ allFrames?: false | undefined;
14678
+ /** The IDs of specific documentIds to inject into. */
14679
+ documentIds?: never;
14680
+ /** The IDs of specific frames to inject into. */
14681
+ frameIds: number[] | undefined;
14682
+ }
14683
+ | {
14684
+ /** Whether the script should inject into all frames within the tab. Defaults to false. */
14685
+ allFrames?: false | undefined;
14686
+ /** The IDs of specific documentIds to inject into. */
14687
+ documentIds?: string[] | undefined;
14688
+ /** The IDs of specific frames to inject into. */
14689
+ frameIds?: never;
14690
+ }
14691
+ );
14488
14692
 
14489
14693
  export interface RegisteredUserScript {
14490
14694
  /** If true, it will inject into all frames, even if the frame is not the top-most frame in the tab. Each frame is checked independently for URL requirements; it will not inject into child frames if the URL requirements are not met. Defaults to false, meaning that only the top frame is matched. */
14491
- allFrames?: boolean;
14695
+ allFrames?: boolean | undefined;
14492
14696
  /** Specifies wildcard patterns for pages this user script will NOT be injected into. */
14493
- excludeGlobs?: string[];
14697
+ excludeGlobs?: string[] | undefined;
14494
14698
  /**Excludes pages that this user script would otherwise be injected into. See Match Patterns for more details on the syntax of these strings. */
14495
- excludeMatches?: string[];
14699
+ excludeMatches?: string[] | undefined;
14496
14700
  /** The ID of the user script specified in the API call. This property must not start with a '_' as it's reserved as a prefix for generated script IDs. */
14497
14701
  id: string;
14498
14702
  /** Specifies wildcard patterns for pages this user script will be injected into. */
14499
- includeGlobs?: string[];
14703
+ includeGlobs?: string[] | undefined;
14500
14704
  /** The list of ScriptSource objects defining sources of scripts to be injected into matching pages. This property must be specified for {@link register}, and when specified it must be a non-empty array.*/
14501
14705
  js: ScriptSource[];
14502
- /** Specifies which pages this user script will be injected into. See Match Patterns for more details on the syntax of these strings. This property must be specified for ${ref:register}. */
14503
- matches?: string[];
14504
- /** Specifies when JavaScript files are injected into the web page. The preferred and default value is document_idle */
14505
- runAt?: extensionTypes.RunAt;
14706
+ /** Specifies which pages this user script will be injected into. See Match Patterns for more details on the syntax of these strings. This property must be specified for {@link register}. */
14707
+ matches?: string[] | undefined;
14708
+ /** Specifies when JavaScript files are injected into the web page. The preferred and default value is `document_idle` */
14709
+ runAt?: extensionTypes.RunAt | undefined;
14506
14710
  /** The JavaScript execution environment to run the script in. The default is `USER_SCRIPT` */
14507
- world?: ExecutionWorld;
14711
+ world?: `${ExecutionWorld}` | undefined;
14508
14712
  /**
14509
14713
  * Specifies the user script world ID to execute in. If omitted, the script will execute in the default user script world. Only valid if `world` is omitted or is `USER_SCRIPT`. Values with leading underscores (`_`) are reserved.
14510
14714
  * @since Chrome 133
14511
14715
  */
14512
- worldId?: string;
14716
+ worldId?: string | undefined;
14513
14717
  }
14514
14718
 
14515
14719
  /** @since Chrome 135 */
14516
14720
  export interface UserScriptInjection {
14517
14721
  /** Whether the injection should be triggered in the target as soon as possible. Note that this is not a guarantee that injection will occur prior to page load, as the page may have already loaded by the time the script reaches the target. */
14518
- injectImmediately?: boolean;
14722
+ injectImmediately?: boolean | undefined;
14519
14723
  /** The list of ScriptSource objects defining sources of scripts to be injected into the target. */
14520
- js: ScriptSource[];
14724
+ js: [ScriptSource, ...ScriptSource[]];
14521
14725
  /** Details specifying the target into which to inject the script. */
14522
14726
  target: InjectionTarget;
14523
14727
  /** The JavaScript "world" to run the script in. The default is `USER_SCRIPT`. */
14524
- world?: ExecutionWorld;
14728
+ world?: `${ExecutionWorld}` | undefined;
14525
14729
  /** Specifies the user script world ID to execute in. If omitted, the script will execute in the default user script world. Only valid if `world` is omitted or is `USER_SCRIPT`. Values with leading underscores (`_`) are reserved. */
14526
- worldId?: string;
14730
+ worldId?: string | undefined;
14527
14731
  }
14528
14732
 
14529
- /**
14530
- * Properties for a script source.
14531
- */
14532
- export interface ScriptSource {
14533
- /** A string containing the JavaScript code to inject. Exactly one of file or code must be specified. */
14534
- code?: string;
14535
- /** The path of the JavaScript file to inject relative to the extension's root directory. Exactly one of file or code must be specified. */
14536
- file?: string;
14537
- }
14733
+ export type ScriptSource = {
14734
+ /** A string containing the JavaScript code to inject. */
14735
+ code: string;
14736
+ /** The path of the JavaScript file to inject relative to the extension's root directory. */
14737
+ file?: undefined;
14738
+ } | {
14739
+ /** A string containing the JavaScript code to inject. */
14740
+ code?: undefined;
14741
+ /** The path of the JavaScript file to inject relative to the extension's root directory. */
14742
+ file: string;
14743
+ };
14538
14744
 
14539
14745
  /**
14540
14746
  * Configures the `USER_SCRIPT` execution environment.
14541
14747
  *
14542
- * @param properties - Contains the user script world configuration.
14543
- * @returns A Promise that resolves with the same type that is passed to the callback.
14748
+ * Can return its result via Promise.
14749
+ * @param properties Contains the user script world configuration.
14544
14750
  */
14545
14751
  export function configureWorld(properties: WorldProperties): Promise<void>;
14546
- /**
14547
- * Configures the `USER_SCRIPT` execution environment.
14548
- *
14549
- * @param properties - Contains the user script world configuration.
14550
- * @param callback - Callback function to be executed after configuring the world.
14551
- */
14552
14752
  export function configureWorld(properties: WorldProperties, callback: () => void): void;
14553
14753
 
14554
14754
  /**
14555
14755
  * Returns all dynamically-registered user scripts for this extension.
14556
14756
  *
14557
- * @param filter - If specified, this method returns only the user scripts that match it.
14558
- * @returns A Promise that resolves with the same type that is passed to the callback.
14757
+ * Can return its result via Promise.
14758
+ * @param filter If specified, this method returns only the user scripts that match it.
14559
14759
  */
14560
14760
  export function getScripts(filter?: UserScriptFilter): Promise<RegisteredUserScript[]>;
14561
- /**
14562
- * Returns all dynamically-registered user scripts for this extension.
14563
- *
14564
- * @param filter - If specified, this method returns only the user scripts that match it.
14565
- * @param callback - Callback function to be executed after getting user scripts.
14566
- */
14567
- export function getScripts(filter: UserScriptFilter, callback: (scripts: RegisteredUserScript[]) => void): void;
14761
+ export function getScripts(callback: (scripts: RegisteredUserScript[]) => void): void;
14762
+ export function getScripts(
14763
+ filter: UserScriptFilter | undefined,
14764
+ callback: (scripts: RegisteredUserScript[]) => void,
14765
+ ): void;
14568
14766
 
14569
14767
  /**
14570
14768
  * Retrieves all registered world configurations.
14769
+ *
14770
+ * Can return its result via Promise.
14571
14771
  * @since Chrome 133
14572
14772
  */
14573
14773
  export function getWorldConfigurations(): Promise<WorldProperties[]>;
@@ -14575,24 +14775,23 @@ declare namespace chrome {
14575
14775
 
14576
14776
  /**
14577
14777
  * Injects a script into a target context. By default, the script will be run at `document_idle`, or immediately if the page has already loaded. If the `injectImmediately` property is set, the script will inject without waiting, even if the page has not finished loading. If the script evaluates to a promise, the browser will wait for the promise to settle and return the resulting value.
14778
+ *
14779
+ * Can return its result via Promise.
14578
14780
  * @since Chrome 135
14579
14781
  */
14580
- export function execute(injection: UserScriptInjection): Promise<InjectionResult[]>;
14581
- export function execute(injection: UserScriptInjection, callback: (result: InjectionResult[]) => void): void;
14782
+ export function execute<T>(injection: UserScriptInjection): Promise<InjectionResult<T>[]>;
14783
+ export function execute<T>(
14784
+ injection: UserScriptInjection,
14785
+ callback: (result: InjectionResult<T>[]) => void,
14786
+ ): void;
14582
14787
 
14583
14788
  /**
14584
14789
  * Registers one or more user scripts for this extension.
14585
14790
  *
14791
+ * Can return its result via Promise.
14586
14792
  * @param scripts - Contains a list of user scripts to be registered.
14587
- * @returns A Promise that resolves with the same type that is passed to the callback.
14588
14793
  */
14589
14794
  export function register(scripts: RegisteredUserScript[]): Promise<void>;
14590
- /**
14591
- * Registers one or more user scripts for this extension.
14592
- *
14593
- * @param scripts - Contains a list of user scripts to be registered.
14594
- * @param callback - Callback function to be executed after registering user scripts.
14595
- */
14596
14795
  export function register(scripts: RegisteredUserScript[], callback: () => void): void;
14597
14796
 
14598
14797
  /**
@@ -14600,41 +14799,26 @@ declare namespace chrome {
14600
14799
  * @param worldId The ID of the user script world to reset. If omitted, resets the default world's configuration.
14601
14800
  */
14602
14801
  export function resetWorldConfiguration(worldId?: string): Promise<void>;
14603
- export function resetWorldConfiguration(worldId: string, callback: () => void): void;
14604
14802
  export function resetWorldConfiguration(callback: () => void): void;
14803
+ export function resetWorldConfiguration(worldId: string | undefined, callback: () => void): void;
14605
14804
 
14606
14805
  /**
14607
14806
  * Unregisters all dynamically-registered user scripts for this extension.
14608
14807
  *
14609
- * @param filter - If specified, this method unregisters only the user scripts that match it.
14610
- * @returns A Promise that resolves with the same type that is passed to the callback.
14808
+ * Can return its result via Promise.
14809
+ * @param filter If specified, this method unregisters only the user scripts that match it.
14611
14810
  */
14612
14811
  export function unregister(filter?: UserScriptFilter): Promise<void>;
14613
- /**
14614
- * Unregisters all dynamically-registered user scripts for this extension.
14615
- *
14616
- * @param filter - If specified, this method unregisters only the user scripts that match it.
14617
- * @param callback - Callback function to be executed after unregistering user scripts.
14618
- */
14619
- export function unregister(filter: UserScriptFilter, callback: () => void): void;
14812
+ export function unregister(callback: () => void): void;
14813
+ export function unregister(filter: UserScriptFilter | undefined, callback: () => void): void;
14620
14814
 
14621
14815
  /**
14622
14816
  * Updates one or more user scripts for this extension.
14623
14817
  *
14624
- * @param scripts - Contains a list of user scripts to be updated. A property is only updated for the existing script
14625
- * if it is specified in this object. If there are errors during script parsing/file validation, or if
14626
- * the IDs specified do not correspond to a fully registered script, then no scripts are updated.
14627
- * @returns A Promise that resolves with the same type that is passed to the callback.
14818
+ * Can return its result via Promise.
14819
+ * @param scripts Contains a list of user scripts to be updated. A property is only updated for the existing script if it is specified in this object. If there are errors during script parsing/file validation, or if the IDs specified do not correspond to a fully registered script, then no scripts are updated.
14628
14820
  */
14629
14821
  export function update(scripts: RegisteredUserScript[]): Promise<void>;
14630
- /**
14631
- * Updates one or more user scripts for this extension.
14632
- *
14633
- * @param scripts - Contains a list of user scripts to be updated. A property is only updated for the existing script
14634
- * if it is specified in this object. If there are errors during script parsing/file validation, or if
14635
- * the IDs specified do not correspond to a fully registered script, then no scripts are updated.
14636
- * @param callback - Callback function to be executed after updating user scripts.
14637
- */
14638
14822
  export function update(scripts: RegisteredUserScript[], callback: () => void): void;
14639
14823
  }
14640
14824
  }
chrome/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/chrome",
3
- "version": "0.1.26",
3
+ "version": "0.1.28",
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": "62c398ca66b33ee9108b994a25ed5bb7d36f810adacd5fe8d8e25f464f957f02",
97
+ "typesPublisherContentHash": "27f80367b3fa7447dd13ccd50fb050b324ddad2357beb3628dacba26011615a9",
98
98
  "typeScriptVersion": "5.2"
99
99
  }