@types/chrome 0.1.27 → 0.1.29

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 +425 -317
  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 20:34:59 GMT
11
+ * Last updated: Fri, 14 Nov 2025 20:02:03 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
- /**
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
922
  /**
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.
951
- */
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
938
+ * @param callback Since Chrome 67
956
939
  */
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
  & {
@@ -9906,209 +10025,157 @@ declare namespace chrome {
9906
10025
  export interface StorageArea {
9907
10026
  /**
9908
10027
  * Gets the amount of space (in bytes) being used by one or more items.
9909
- * @param keys Optional. A single key or list of keys to get the total usage for. An empty list will return 0. Pass in null to get the total usage of all of storage.
9910
- * @return A Promise that resolves with a number
9911
- * @since MV3
10028
+ * @param keys A single key or list of keys to get the total usage for. An empty list will return 0. Pass in `null` to get the total usage of all of storage.
10029
+ *
10030
+ * Can return its result via Promise in Manifest V3 or later since Chrome 95.
9912
10031
  */
10032
+ getBytesInUse(keys: never[]): Promise<0>;
9913
10033
  getBytesInUse<T = { [key: string]: any }>(keys?: keyof T | Array<keyof T> | null): Promise<number>;
9914
- /**
9915
- * Gets the amount of space (in bytes) being used by one or more items.
9916
- * @param keys Optional. A single key or list of keys to get the total usage for. An empty list will return 0. Pass in null to get the total usage of all of storage.
9917
- * @param callback Callback with the amount of space being used by storage, or on failure (in which case runtime.lastError will be set).
9918
- * Parameter bytesInUse: Amount of space being used in storage, in bytes.
9919
- */
10034
+ getBytesInUse<T = { [key: string]: any }>(callback: (bytesInUse: number) => void): void;
10035
+ getBytesInUse(keys: never[], callback: (bytesInUse: 0) => void): void;
9920
10036
  getBytesInUse<T = { [key: string]: any }>(
9921
- keys: keyof T | Array<keyof T> | null,
10037
+ keys: keyof T | Array<keyof T> | null | undefined,
9922
10038
  callback: (bytesInUse: number) => void,
9923
10039
  ): void;
9924
- /**
9925
- * Gets the amount of space (in bytes) being used by one or more items.
9926
- * @param callback Callback with the amount of space being used by storage, or on failure (in which case runtime.lastError will be set).
9927
- * Parameter bytesInUse: Amount of space being used in storage, in bytes.
9928
- */
9929
- getBytesInUse(callback: (bytesInUse: number) => void): void;
10040
+
9930
10041
  /**
9931
10042
  * Removes all items from storage.
9932
- * @return A void Promise
9933
- * @since MV3
10043
+ *
10044
+ * Can return its result via Promise in Manifest V3 or later since Chrome 95.
9934
10045
  */
9935
10046
  clear(): Promise<void>;
9936
- /**
9937
- * Removes all items from storage.
9938
- * @param callback Optional.
9939
- * Callback on success, or on failure (in which case runtime.lastError will be set).
9940
- */
9941
10047
  clear(callback: () => void): void;
10048
+
9942
10049
  /**
9943
10050
  * Sets multiple items.
9944
- * @param items An object which gives each key/value pair to update storage with. Any other key/value pairs in storage will not be affected.
9945
- * Primitive values such as numbers will serialize as expected. Values with a typeof "object" and "function" will typically serialize to {}, with the exception of Array (serializes as expected), Date, and Regex (serialize using their String representation).
9946
- * @return A void Promise
9947
- * @since MV3
10051
+ * @param items An object which gives each key/value pair to update storage with. Any other key/value pairs in storage will not be affected. Primitive values such as numbers will serialize as expected. Values with a `typeof` `object` and `function` will typically serialize to `{}`, with the exception of `Array` (serializes as expected), `Date`, and `Regex` (serialize using their `String` representation).
10052
+ *
10053
+ * Can return its result via Promise in Manifest V3 or later since Chrome 95.
9948
10054
  */
9949
10055
  set<T = { [key: string]: any }>(items: Partial<T>): Promise<void>;
9950
- /**
9951
- * Sets multiple items.
9952
- * @param items An object which gives each key/value pair to update storage with. Any other key/value pairs in storage will not be affected.
9953
- * Primitive values such as numbers will serialize as expected. Values with a typeof "object" and "function" will typically serialize to {}, with the exception of Array (serializes as expected), Date, and Regex (serialize using their String representation).
9954
- * @param callback Optional.
9955
- * Callback on success, or on failure (in which case runtime.lastError will be set).
9956
- */
9957
10056
  set<T = { [key: string]: any }>(items: Partial<T>, callback: () => void): void;
10057
+
9958
10058
  /**
9959
10059
  * Removes one or more items from storage.
9960
10060
  * @param keys A single key or a list of keys for items to remove.
9961
- * @param callback Optional.
9962
- * @return A void Promise
9963
- * @since MV3
10061
+ *
10062
+ * Can return its result via Promise in Manifest V3 or later since Chrome 95.
9964
10063
  */
9965
10064
  remove<T = { [key: string]: any }>(keys: keyof T | Array<keyof T>): Promise<void>;
9966
- /**
9967
- * Removes one or more items from storage.
9968
- * @param keys A single key or a list of keys for items to remove.
9969
- * @param callback Optional.
9970
- * Callback on success, or on failure (in which case runtime.lastError will be set).
9971
- */
9972
10065
  remove<T = { [key: string]: any }>(keys: keyof T | Array<keyof T>, callback: () => void): void;
10066
+
9973
10067
  /**
9974
10068
  * Gets one or more items from storage.
9975
- * @param keys A single key to get, list of keys to get, or a dictionary specifying default values.
9976
- * An empty list or object will return an empty result object. Pass in null to get the entire contents of storage.
9977
- * @return A Promise that resolves with an object containing items
9978
- * @since MV3
10069
+ * @param keys A single key to get, list of keys to get, or a dictionary specifying default values (see description of the object). An empty list or object will return an empty result object. Pass in `null` to get the entire contents of storage.
10070
+ *
10071
+ * Can return its result via Promise in Manifest V3 or later since Chrome 95.
9979
10072
  */
9980
- get<T = { [key: string]: any }>(
10073
+ get(keys: never[] | Record<string, never>): Promise<{ [key: string]: never }>;
10074
+ get<T = { [key: string]: unknown }>(
9981
10075
  keys?: NoInferX<keyof T> | Array<NoInferX<keyof T>> | Partial<NoInferX<T>> | null,
9982
10076
  ): Promise<T>;
9983
- /**
9984
- * Gets one or more items from storage.
9985
- * @param keys A single key to get, list of keys to get, or a dictionary specifying default values.
9986
- * An empty list or object will return an empty result object. Pass in null to get the entire contents of storage.
9987
- * @param callback Callback with storage items, or on failure (in which case runtime.lastError will be set).
9988
- * Parameter items: Object with items in their key-value mappings.
9989
- */
9990
- get<T = { [key: string]: any }>(
9991
- keys: NoInferX<keyof T> | Array<NoInferX<keyof T>> | Partial<NoInferX<T>> | null,
10077
+ get<T = { [key: string]: unknown }>(callback: (items: T) => void): void;
10078
+ get(keys: never[] | Record<string, never>, callback: (items: { [key: string]: never }) => void): void;
10079
+ get<T = { [key: string]: unknown }>(
10080
+ keys: NoInferX<keyof T> | Array<NoInferX<keyof T>> | Partial<NoInferX<T>> | null | undefined,
9992
10081
  callback: (items: T) => void,
9993
10082
  ): void;
10083
+
9994
10084
  /**
9995
- * Gets the entire contents of storage.
9996
- * @param callback Callback with storage items, or on failure (in which case runtime.lastError will be set).
9997
- * Parameter items: Object with items in their key-value mappings.
9998
- */
9999
- get<T = { [key: string]: any }>(callback: (items: T) => void): void;
10000
- /**
10001
- * Sets the desired access level for the storage area. By default, session storage is restricted to trusted contexts (extension pages and service workers), while managed, local, and sync storage allow access from both trusted and untrusted contexts.
10002
- * @param accessOptions An object containing an accessLevel key which contains the access level of the storage area.
10003
- * @return A void Promise.
10004
- * @since Chrome 102
10005
- */
10006
- setAccessLevel(accessOptions: { accessLevel: AccessLevel }): Promise<void>;
10007
- /**
10008
- * Sets the desired access level for the storage area. By default, session storage is restricted to trusted contexts (extension pages and service workers), while managed, local, and sync storage allow access from both trusted and untrusted contexts.
10009
- * @param accessOptions An object containing an accessLevel key which contains the access level of the storage area.
10010
- * @param callback Optional.
10085
+ * Sets the desired access level for the storage area. By default, session storage is restricted to trusted contexts (extension pages and service workers), while `managed`, `local`, and `sync` storage allow access from both trusted and untrusted contexts.
10086
+ * @param accessOptions The access level of the storage area.
10087
+ *
10088
+ * Can return its result via Promise in Manifest V3 or later.
10011
10089
  * @since Chrome 102
10012
10090
  */
10013
- setAccessLevel(accessOptions: { accessLevel: AccessLevel }, callback: () => void): void;
10014
- /**
10015
- * Fired when one or more items change within this storage area.
10016
- * @param keys A single key to get, list of keys to get, or a dictionary specifying default values.
10017
- * An empty list or object will return an empty result object. Pass in null to get the entire contents of storage.
10018
- * @param callback Callback with storage items, or on failure (in which case runtime.lastError will be set).
10019
- * Parameter items: Object with items in their key-value mappings.
10020
- */
10021
- onChanged: StorageAreaChangedEvent;
10091
+ setAccessLevel(accessOptions: { accessLevel: `${AccessLevel}` }): Promise<void>;
10092
+ setAccessLevel(accessOptions: { accessLevel: `${AccessLevel}` }, callback: () => void): void;
10093
+
10094
+ /** Fired when one or more items change. */
10095
+ onChanged: events.Event<(changes: { [key: string]: StorageChange }) => void>;
10096
+
10022
10097
  /**
10023
10098
  * Gets all keys from storage.
10024
- * @return A Promise that resolves with an array of keys.
10099
+ *
10100
+ * Can return its result via Promise in Manifest V3 or later.
10025
10101
  * @since Chrome 130
10026
10102
  */
10027
10103
  getKeys(): Promise<string[]>;
10028
- /**
10029
- * Gets all keys from storage.
10030
- * @param callback Callback with storage keys.
10031
- * Parameter keys: Array of keys in storage.
10032
- * @since Chrome 130
10033
- */
10034
10104
  getKeys(callback: (keys: string[]) => void): void;
10035
10105
  }
10036
10106
 
10037
10107
  export interface StorageChange {
10038
- /** Optional. The new value of the item, if there is a new value. */
10039
- newValue?: any;
10040
- /** Optional. The old value of the item, if there was an old value. */
10041
- oldValue?: any;
10108
+ /** The new value of the item, if there is a new value. */
10109
+ newValue?: unknown;
10110
+ /** The old value of the item, if there was an old value. */
10111
+ oldValue?: unknown;
10042
10112
  }
10043
10113
 
10044
10114
  export interface LocalStorageArea extends StorageArea {
10045
- /** The maximum amount (in bytes) of data that can be stored in local storage, as measured by the JSON stringification of every value plus every key's length. This value will be ignored if the extension has the unlimitedStorage permission. Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError. */
10046
- QUOTA_BYTES: number;
10115
+ /** The maximum amount (in bytes) of data that can be stored in local storage, as measured by the JSON stringification of every value plus every key's length. This value will be ignored if the extension has the unlimitedStorage permission. Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError when using a callback, or a rejected Promise if using async/await. */
10116
+ QUOTA_BYTES: 10485760;
10047
10117
  }
10048
10118
 
10049
10119
  export interface SyncStorageArea extends StorageArea {
10050
- /** @deprecated since Chrome 40. The storage.sync API no longer has a sustained write operation quota. */
10051
- MAX_SUSTAINED_WRITE_OPERATIONS_PER_MINUTE: number;
10052
- /** The maximum total amount (in bytes) of data that can be stored in sync storage, as measured by the JSON stringification of every value plus every key's length. Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError. */
10053
- QUOTA_BYTES: number;
10054
- /** The maximum size (in bytes) of each individual item in sync storage, as measured by the JSON stringification of its value plus its key length. Updates containing items larger than this limit will fail immediately and set runtime.lastError. */
10055
- QUOTA_BYTES_PER_ITEM: number;
10056
- /** The maximum number of items that can be stored in sync storage. Updates that would cause this limit to be exceeded will fail immediately and set runtime.lastError. */
10057
- MAX_ITEMS: number;
10058
- /**
10059
- * The maximum number of set, remove, or clear operations that can be performed each hour. This is 1 every 2 seconds, a lower ceiling than the short term higher writes-per-minute limit.
10060
- * Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError.
10120
+ /** @deprecated The storage.sync API no longer has a sustained write operation quota. */
10121
+ MAX_SUSTAINED_WRITE_OPERATIONS_PER_MINUTE: 1000000;
10122
+ /** The maximum total amount (in bytes) of data that can be stored in sync storage, as measured by the JSON stringification of every value plus every key's length. Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError when using a callback, or when a Promise is rejected. */
10123
+ QUOTA_BYTES: 102400;
10124
+ /** The maximum size (in bytes) of each individual item in sync storage, as measured by the JSON stringification of its value plus its key length. Updates containing items larger than this limit will fail immediately and set runtime.lastError when using a callback, or when a Promise is rejected. */
10125
+ QUOTA_BYTES_PER_ITEM: 8192;
10126
+ /** The maximum number of items that can be stored in sync storage. Updates that would cause this limit to be exceeded will fail immediately and set runtime.lastError when using a callback, or when a Promise is rejected. */
10127
+ MAX_ITEMS: 512;
10128
+ /**
10129
+ * The maximum number of `set`, `remove`, or `clear` operations that can be performed each hour. This is 1 every 2 seconds, a lower ceiling than the short term higher writes-per-minute limit.
10130
+ *
10131
+ * Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError when using a callback, or when a Promise is rejected.
10061
10132
  */
10062
- MAX_WRITE_OPERATIONS_PER_HOUR: number;
10133
+ MAX_WRITE_OPERATIONS_PER_HOUR: 1800;
10063
10134
  /**
10064
- * The maximum number of set, remove, or clear operations that can be performed each minute. This is 2 per second, providing higher throughput than writes-per-hour over a shorter period of time.
10065
- * Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError.
10066
- * @since Chrome 40
10135
+ * The maximum number of `set`, `remove`, or `clear` operations that can be performed each minute. This is 2 per second, providing higher throughput than writes-per-hour over a shorter period of time.
10136
+ *
10137
+ * Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError when using a callback, or when a Promise is rejected.
10067
10138
  */
10068
- MAX_WRITE_OPERATIONS_PER_MINUTE: number;
10139
+ MAX_WRITE_OPERATIONS_PER_MINUTE: 120;
10069
10140
  }
10070
10141
 
10071
10142
  export interface SessionStorageArea extends StorageArea {
10072
- /** The maximum amount (in bytes) of data that can be stored in memory, as measured by estimating the dynamically allocated memory usage of every value and key. Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError. */
10073
- QUOTA_BYTES: number;
10143
+ /** The maximum amount (in bytes) of data that can be stored in memory, as measured by estimating the dynamically allocated memory usage of every value and key. Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError when using a callback, or when a Promise is rejected. */
10144
+ QUOTA_BYTES: 10485760;
10074
10145
  }
10075
10146
 
10076
- export interface StorageAreaChangedEvent
10077
- extends chrome.events.Event<(changes: { [key: string]: StorageChange }) => void>
10078
- {}
10147
+ export type AreaName = "sync" | "local" | "managed" | "session";
10079
10148
 
10080
- export type AreaName = keyof Pick<typeof chrome.storage, "sync" | "local" | "managed" | "session">;
10081
- export interface StorageChangedEvent
10082
- extends chrome.events.Event<(changes: { [key: string]: StorageChange }, areaName: AreaName) => void>
10083
- {}
10084
-
10085
- export type AccessLevel = keyof typeof AccessLevel;
10149
+ /**
10150
+ * The storage area's access level.
10151
+ * @since Chrome 102
10152
+ */
10153
+ export enum AccessLevel {
10154
+ /** Specifies contexts originating from the extension itself. */
10155
+ TRUSTED_CONTEXTS = "TRUSTED_CONTEXTS",
10156
+ /** Specifies contexts originating from outside the extension. */
10157
+ TRUSTED_AND_UNTRUSTED_CONTEXTS = "TRUSTED_AND_UNTRUSTED_CONTEXTS",
10158
+ }
10086
10159
 
10087
- /** The storage area's access level. */
10088
- export var AccessLevel: {
10089
- TRUSTED_AND_UNTRUSTED_CONTEXTS: "TRUSTED_AND_UNTRUSTED_CONTEXTS";
10090
- TRUSTED_CONTEXTS: "TRUSTED_CONTEXTS";
10091
- };
10160
+ /** Items in the `local` storage area are local to each machine. */
10161
+ export const local: LocalStorageArea;
10092
10162
 
10093
- /** Items in the local storage area are local to each machine. */
10094
- export var local: LocalStorageArea;
10095
- /** Items in the sync storage area are synced using Chrome Sync. */
10096
- export var sync: SyncStorageArea;
10163
+ /** Items in the `sync` storage area are synced using Chrome Sync. */
10164
+ export const sync: SyncStorageArea;
10097
10165
 
10098
- /**
10099
- * Items in the managed storage area are set by the domain administrator, and are read-only for the extension; trying to modify this namespace results in an error.
10100
- * @since Chrome 33
10101
- */
10102
- export var managed: StorageArea;
10166
+ /** Items in the `managed` storage area are set by an enterprise policy configured by the domain administrator, and are read-only for the extension; trying to modify this namespace results in an error. For information on configuring a policy, see Manifest for storage areas. */
10167
+ export const managed: StorageArea;
10103
10168
 
10104
10169
  /**
10105
- * Items in the session storage area are stored in-memory and will not be persisted to disk.
10170
+ * Items in the `session` storage area are stored in-memory and will not be persisted to disk.
10171
+ *
10172
+ * MV3 only
10106
10173
  * @since Chrome 102
10107
10174
  */
10108
- export var session: SessionStorageArea;
10175
+ export const session: SessionStorageArea;
10109
10176
 
10110
10177
  /** Fired when one or more items change. */
10111
- export var onChanged: StorageChangedEvent;
10178
+ export const onChanged: events.Event<(changes: { [key: string]: StorageChange }, areaName: AreaName) => void>;
10112
10179
  }
10113
10180
 
10114
10181
  ////////////////////
@@ -13687,7 +13754,7 @@ declare namespace chrome {
13687
13754
  * @since Chrome 86
13688
13755
  */
13689
13756
  export enum HeaderOperation {
13690
- /** Adds a new entry for the specified header. This operation is not supported for request headers. */
13757
+ /** Adds a new entry for the specified header. When modifying the headers of a request, this operation is only supported for specific headers. */
13691
13758
  APPEND = "append",
13692
13759
  /** Sets a new value for the specified header, removing any existing headers with the same name. */
13693
13760
  SET = "set",
@@ -13880,7 +13947,7 @@ declare namespace chrome {
13880
13947
  requestMethods?: `${RequestMethod}`[] | undefined;
13881
13948
 
13882
13949
  /**
13883
- * List of {@link tabs.Tab.id} which the rule should not match.
13950
+ * List of {@link tabs.Tab.id} which the rule should match.
13884
13951
  * An ID of {@link tabs.TAB_ID_NONE} matches requests which don't originate from a tab.
13885
13952
  * An empty list is not allowed. Only supported for session-scoped rules.
13886
13953
  * @since Chrome 92
@@ -14317,6 +14384,21 @@ declare namespace chrome {
14317
14384
  * @since Chrome 114, MV3
14318
14385
  */
14319
14386
  export namespace sidePanel {
14387
+ /** @since Chrome 141 */
14388
+ export type CloseOptions =
14389
+ | {
14390
+ /** 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. */
14391
+ tabId: number;
14392
+ /** 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. */
14393
+ windowId?: number | undefined;
14394
+ }
14395
+ | {
14396
+ /** 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. */
14397
+ tabId?: number | undefined;
14398
+ /** 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. */
14399
+ windowId: number;
14400
+ };
14401
+
14320
14402
  export interface GetPanelOptions {
14321
14403
  /**
14322
14404
  * If specified, the side panel options for the given tab will be returned.
@@ -14354,11 +14436,31 @@ declare namespace chrome {
14354
14436
  openPanelOnActionClick?: boolean | undefined;
14355
14437
  }
14356
14438
 
14439
+ /** @since Chrome 142 */
14440
+ export interface PanelClosedInfo {
14441
+ /** The path of the local resource within the extension package whose content is displayed in the panel. */
14442
+ path: string;
14443
+ /** The optional ID of the tab where the side panel was closed. This is provided only when the panel is tab-specific. */
14444
+ tabId?: number;
14445
+ /** The ID of the window where the side panel was closed. This is available for both global and tab-specific panels. */
14446
+ windowId: number;
14447
+ }
14448
+
14357
14449
  /** @since Chrome 140 */
14358
14450
  export interface PanelLayout {
14359
14451
  side: `${Side}`;
14360
14452
  }
14361
14453
 
14454
+ /** @since Chrome 141 */
14455
+ export interface PanelOpenedInfo {
14456
+ /** The path of the local resource within the extension package whose content is displayed in the panel. */
14457
+ path: string;
14458
+ /** The optional ID of the tab where the side panel is opened. This is provided only when the panel is tab-specific. */
14459
+ tabId?: number;
14460
+ /** The ID of the window where the side panel is opened. This is available for both global and tab-specific panels. */
14461
+ windowId: number;
14462
+ }
14463
+
14362
14464
  export interface PanelOptions {
14363
14465
  /** Whether the side panel should be enabled. This is optional. The default value is true. */
14364
14466
  enabled?: boolean | undefined;
@@ -14437,6 +14539,12 @@ declare namespace chrome {
14437
14539
  */
14438
14540
  export function setPanelBehavior(behavior: PanelBehavior): Promise<void>;
14439
14541
  export function setPanelBehavior(behavior: PanelBehavior, callback: () => void): void;
14542
+
14543
+ /**
14544
+ * Fired when the extension's side panel is opened.
14545
+ * @since Chrome 141
14546
+ */
14547
+ const onOpened: events.Event<(info: PanelOpenedInfo) => void>;
14440
14548
  }
14441
14549
 
14442
14550
  ////////////////////
chrome/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/chrome",
3
- "version": "0.1.27",
3
+ "version": "0.1.29",
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": "855bc18cd67fbe7ca35c8d69bffa87a3a938f61821b97032b7fc5ef9613bd1ce",
97
+ "typesPublisherContentHash": "8768e75a0259479136460b35c7f59014494e96cd25273d8e592186b131d8e9fc",
98
98
  "typeScriptVersion": "5.2"
99
99
  }