@types/chrome 0.1.11 → 0.1.13

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 +451 -483
  3. chrome/package.json +2 -2
chrome/index.d.ts CHANGED
@@ -153,7 +153,7 @@ declare namespace chrome {
153
153
  export namespace action {
154
154
  export interface BadgeColorDetails {
155
155
  /** 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`. */
156
- color: string | ColorArray;
156
+ color: string | extensionTypes.ColorArray;
157
157
  /** Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
158
158
  tabId?: number | undefined;
159
159
  }
@@ -165,8 +165,6 @@ declare namespace chrome {
165
165
  tabId?: number | undefined;
166
166
  }
167
167
 
168
- export type ColorArray = [number, number, number, number];
169
-
170
168
  export interface TitleDetails {
171
169
  /** The string the action should display when moused over. */
172
170
  title: string;
@@ -241,8 +239,11 @@ declare namespace chrome {
241
239
  *
242
240
  * Can return its result via Promise.
243
241
  */
244
- export function getBadgeBackgroundColor(details: TabDetails): Promise<ColorArray>;
245
- export function getBadgeBackgroundColor(details: TabDetails, callback: (result: ColorArray) => void): void;
242
+ export function getBadgeBackgroundColor(details: TabDetails): Promise<extensionTypes.ColorArray>;
243
+ export function getBadgeBackgroundColor(
244
+ details: TabDetails,
245
+ callback: (result: extensionTypes.ColorArray) => void,
246
+ ): void;
246
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.
@@ -258,8 +259,11 @@ declare namespace chrome {
258
259
  * Can return its result via Promise.
259
260
  * @since Chrome 110
260
261
  */
261
- export function getBadgeTextColor(details: TabDetails): Promise<ColorArray>;
262
- export function getBadgeTextColor(details: TabDetails, callback: (result: ColorArray) => void): void;
262
+ export function getBadgeTextColor(details: TabDetails): Promise<extensionTypes.ColorArray>;
263
+ export function getBadgeTextColor(
264
+ details: TabDetails,
265
+ callback: (result: extensionTypes.ColorArray) => void,
266
+ ): void;
263
267
 
264
268
  /**
265
269
  * Gets the html document set as the popup for this action.
@@ -864,7 +868,7 @@ declare namespace chrome {
864
868
  export namespace browserAction {
865
869
  export interface BadgeBackgroundColorDetails {
866
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. */
867
- color: string | ColorArray;
871
+ color: string | extensionTypes.ColorArray;
868
872
  /** Optional. Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
869
873
  tabId?: number | undefined;
870
874
  }
@@ -876,8 +880,6 @@ declare namespace chrome {
876
880
  tabId?: number | undefined;
877
881
  }
878
882
 
879
- export type ColorArray = [number, number, number, number];
880
-
881
883
  export interface TitleDetails {
882
884
  /** The string the browser action should display when moused over. */
883
885
  title: string;
@@ -1005,13 +1007,16 @@ declare namespace chrome {
1005
1007
  * @since Chrome 19
1006
1008
  * Gets the background color of the browser action.
1007
1009
  */
1008
- export function getBadgeBackgroundColor(details: TabDetails, callback: (result: ColorArray) => void): void;
1010
+ export function getBadgeBackgroundColor(
1011
+ details: TabDetails,
1012
+ callback: (result: extensionTypes.ColorArray) => void,
1013
+ ): void;
1009
1014
  /**
1010
1015
  * @since Chrome 19
1011
1016
  * Gets the background color of the browser action.
1012
1017
  * @return The `getBadgeBackgroundColor` method provides its result via callback or returned as a `Promise` (MV3 only).
1013
1018
  */
1014
- export function getBadgeBackgroundColor(details: TabDetails): Promise<ColorArray>;
1019
+ export function getBadgeBackgroundColor(details: TabDetails): Promise<extensionTypes.ColorArray>;
1015
1020
  /**
1016
1021
  * @since Chrome 19
1017
1022
  * Gets the html document set as the popup for this browser action.
@@ -2819,6 +2824,11 @@ declare namespace chrome {
2819
2824
  onHidden: events.Event<() => void>;
2820
2825
  /** Fired upon a search action (start of a new search, search result navigation, or search being canceled). */
2821
2826
  onSearch: events.Event<(action: string, queryString?: string) => void>;
2827
+ /**
2828
+ * Shows the panel by activating the corresponding tab.
2829
+ * @since Chrome 140
2830
+ */
2831
+ show(): void;
2822
2832
  }
2823
2833
 
2824
2834
  /** A button created by the extension. */
@@ -4473,6 +4483,9 @@ declare namespace chrome {
4473
4483
  ////////////////////
4474
4484
  /** The `chrome.extensionTypes` API contains type declarations for Chrome extensions. */
4475
4485
  export namespace extensionTypes {
4486
+ /** @since Chrome 139 */
4487
+ export type ColorArray = [number, number, number, number];
4488
+
4476
4489
  /**
4477
4490
  * The origin of injected CSS.
4478
4491
  * @since Chrome 66
@@ -5815,46 +5828,81 @@ declare namespace chrome {
5815
5828
  /** An object encapsulating one visit to a URL. */
5816
5829
  export interface VisitItem {
5817
5830
  /** The transition type for this visit from its referrer. */
5818
- transition: string;
5819
- /** Optional. When this visit occurred, represented in milliseconds since the epoch. */
5820
- visitTime?: number | undefined;
5831
+ transition: `${TransitionType}`;
5832
+ /**
5833
+ * True if the visit originated on this device. False if it was synced from a different device
5834
+ * @since Chrome 115
5835
+ */
5836
+ isLocal: boolean;
5837
+ /** When this visit occurred, represented in milliseconds since the epoch. */
5838
+ visitTime?: number;
5821
5839
  /** The unique identifier for this visit. */
5822
5840
  visitId: string;
5823
5841
  /** The visit ID of the referrer. */
5824
5842
  referringVisitId: string;
5825
- /** The unique identifier for the item. */
5843
+ /** The unique identifier for the corresponding {@link history.HistoryItem}. */
5826
5844
  id: string;
5827
5845
  }
5828
5846
 
5829
5847
  /** An object encapsulating one result of a history query. */
5830
5848
  export interface HistoryItem {
5831
- /** Optional. The number of times the user has navigated to this page by typing in the address. */
5832
- typedCount?: number | undefined;
5833
- /** Optional. The title of the page when it was last loaded. */
5834
- title?: string | undefined;
5835
- /** Optional. The URL navigated to by a user. */
5836
- url?: string | undefined;
5837
- /** Optional. When this page was last loaded, represented in milliseconds since the epoch. */
5838
- lastVisitTime?: number | undefined;
5839
- /** Optional. The number of times the user has navigated to this page. */
5840
- visitCount?: number | undefined;
5849
+ /** The number of times the user has navigated to this page by typing in the address. */
5850
+ typedCount?: number;
5851
+ /** The title of the page when it was last loaded. */
5852
+ title?: string;
5853
+ /** The URL navigated to by a user. */
5854
+ url?: string;
5855
+ /** When this page was last loaded, represented in milliseconds since the epoch. */
5856
+ lastVisitTime?: number;
5857
+ /** The number of times the user has navigated to this page. */
5858
+ visitCount?: number;
5841
5859
  /** The unique identifier for the item. */
5842
5860
  id: string;
5843
5861
  }
5844
5862
 
5863
+ /**
5864
+ * The transition type for this visit from its referrer.
5865
+ * @since Chrome 44
5866
+ */
5867
+ export enum TransitionType {
5868
+ /** The user arrived at this page by clicking a link on another page. */
5869
+ LINK = "link",
5870
+ /** The user arrived at this page by typing the URL in the address bar. This is also used for other explicit navigation actions. */
5871
+ TYPED = "typed",
5872
+ /** The user arrived at this page through a suggestion in the UI, for example, through a menu item. */
5873
+ AUTO_BOOKMARK = "auto_bookmark",
5874
+ /** The user arrived at this page through subframe navigation that they didn't request, such as through an ad loading in a frame on the previous page. These don't always generate new navigation entries in the back and forward menus. */
5875
+ AUTO_SUBFRAME = "auto_subframe",
5876
+ /** The user arrived at this page by selecting something in a subframe. */
5877
+ MANUAL_SUBFRAME = "manual_subframe",
5878
+ /** The user arrived at this page by typing in the address bar and selecting an entry that didn't look like a URL, such as a Google Search suggestion. For example, a match might have the URL of a Google Search result page, but it might appear to the user as "Search Google for ...". These are different from typed navigations because the user didn't type or see the destination URL. They're also related to keyword navigations. */
5879
+ GENERATED = "generated",
5880
+ /** The page was specified in the command line or is the start page. */
5881
+ AUTO_TOPLEVEL = "auto_toplevel",
5882
+ /** The user arrived at this page by filling out values in a form and submitting the form. Not all form submissions use this transition type. */
5883
+ FORM_SUBMIT = "form_submit",
5884
+ /** The user reloaded the page, either by clicking the reload button or by pressing Enter in the address bar. Session restore and Reopen closed tab also use this transition type. */
5885
+ RELOAD = "reload",
5886
+ /** The URL for this page was generated from a replaceable keyword other than the default search provider. */
5887
+ KEYWORD = "keyword",
5888
+ /** Corresponds to a visit generated for a keyword. */
5889
+ KEYWORD_GENERATED = "keyword_generated",
5890
+ }
5891
+
5845
5892
  export interface HistoryQuery {
5846
- /** A free-text query to the history service. Leave empty to retrieve all pages. */
5893
+ /** A free-text query to the history service. Leave this empty to retrieve all pages. */
5847
5894
  text: string;
5848
- /** Optional. The maximum number of results to retrieve. Defaults to 100. */
5895
+ /** The maximum number of results to retrieve. Defaults to 100. */
5849
5896
  maxResults?: number | undefined;
5850
- /** Optional. Limit results to those visited after this date, represented in milliseconds since the epoch. */
5897
+ /** Limit results to those visited after this date, represented in milliseconds since the epoch. If property is not specified, it will default to 24 hours. */
5851
5898
  startTime?: number | undefined;
5852
- /** Optional. Limit results to those visited before this date, represented in milliseconds since the epoch. */
5899
+ /** Limit results to those visited before this date, represented in milliseconds since the epoch. */
5853
5900
  endTime?: number | undefined;
5854
5901
  }
5855
5902
 
5856
- export interface Url {
5857
- /** The URL for the operation. It must be in the format as returned from a call to history.search. */
5903
+ /** @since Chrome 88 */
5904
+ export interface UrlDetails {
5905
+ /** The URL for the operation. It must be in the format as returned from a call to {@link history.search}. */
5858
5906
  url: string;
5859
5907
  }
5860
5908
 
@@ -5868,73 +5916,62 @@ declare namespace chrome {
5868
5916
  export interface RemovedResult {
5869
5917
  /** True if all history was removed. If true, then urls will be empty. */
5870
5918
  allHistory: boolean;
5871
- /** Optional. */
5872
- urls?: string[] | undefined;
5919
+ urls?: string[];
5873
5920
  }
5874
5921
 
5875
- export interface HistoryVisitedEvent extends chrome.events.Event<(result: HistoryItem) => void> {}
5876
-
5877
- export interface HistoryVisitRemovedEvent extends chrome.events.Event<(removed: RemovedResult) => void> {}
5878
-
5879
5922
  /**
5880
5923
  * Searches the history for the last visit time of each page matching the query.
5881
- * @return The `search` method provides its result via callback or returned as a `Promise` (MV3 only).
5924
+ *
5925
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
5882
5926
  */
5883
5927
  export function search(query: HistoryQuery): Promise<HistoryItem[]>;
5884
- /**
5885
- * Searches the history for the last visit time of each page matching the query.
5886
- */
5887
5928
  export function search(query: HistoryQuery, callback: (results: HistoryItem[]) => void): void;
5929
+
5888
5930
  /**
5889
5931
  * Adds a URL to the history at the current time with a transition type of "link".
5890
- * @return The `addUrl` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
5891
- */
5892
- export function addUrl(details: Url): Promise<void>;
5893
- /**
5894
- * Adds a URL to the history at the current time with a transition type of "link".
5932
+ *
5933
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
5895
5934
  */
5896
- export function addUrl(details: Url, callback: () => void): void;
5935
+ export function addUrl(details: UrlDetails): Promise<void>;
5936
+ export function addUrl(details: UrlDetails, callback: () => void): void;
5937
+
5897
5938
  /**
5898
5939
  * Removes all items within the specified date range from the history. Pages will not be removed from the history unless all visits fall within the range.
5899
- * @return The `deleteRange` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
5940
+ *
5941
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
5900
5942
  */
5901
5943
  export function deleteRange(range: Range): Promise<void>;
5902
- /**
5903
- * Removes all items within the specified date range from the history. Pages will not be removed from the history unless all visits fall within the range.
5904
- */
5905
5944
  export function deleteRange(range: Range, callback: () => void): void;
5945
+
5906
5946
  /**
5907
5947
  * Deletes all items from the history.
5908
- * @return The `deleteAll` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
5948
+ *
5949
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
5909
5950
  */
5910
5951
  export function deleteAll(): Promise<void>;
5911
- /**
5912
- * Deletes all items from the history.
5913
- */
5914
5952
  export function deleteAll(callback: () => void): void;
5953
+
5915
5954
  /**
5916
5955
  * Retrieves information about visits to a URL.
5917
- * @return The `getVisits` method provides its result via callback or returned as a `Promise` (MV3 only).
5918
- */
5919
- export function getVisits(details: Url): Promise<VisitItem[]>;
5920
- /**
5921
- * Retrieves information about visits to a URL.
5922
- */
5923
- export function getVisits(details: Url, callback: (results: VisitItem[]) => void): void;
5924
- /**
5925
- * Removes all occurrences of the given URL from the history.
5926
- * @return The `deleteUrl` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
5956
+ *
5957
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
5927
5958
  */
5928
- export function deleteUrl(details: Url): Promise<void>;
5959
+ export function getVisits(details: UrlDetails): Promise<VisitItem[]>;
5960
+ export function getVisits(details: UrlDetails, callback: (results: VisitItem[]) => void): void;
5961
+
5929
5962
  /**
5930
5963
  * Removes all occurrences of the given URL from the history.
5964
+ *
5965
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
5931
5966
  */
5932
- export function deleteUrl(details: Url, callback: () => void): void;
5967
+ export function deleteUrl(details: UrlDetails): Promise<void>;
5968
+ export function deleteUrl(details: UrlDetails, callback: () => void): void;
5969
+
5970
+ /** Fired when a URL is visited, providing the {@link HistoryItem} data for that URL. This event fires before the page has loaded. */
5971
+ export const onVisited: events.Event<(result: HistoryItem) => void>;
5933
5972
 
5934
- /** Fired when a URL is visited, providing the HistoryItem data for that URL. This event fires before the page has loaded. */
5935
- export var onVisited: HistoryVisitedEvent;
5936
- /** Fired when one or more URLs are removed from the history service. When all visits have been removed the URL is purged from history. */
5937
- export var onVisitRemoved: HistoryVisitRemovedEvent;
5973
+ /** Fired when one or more URLs are removed from history. When all visits have been removed the URL is purged from history. */
5974
+ export const onVisitRemoved: events.Event<(removed: RemovedResult) => void>;
5938
5975
  }
5939
5976
 
5940
5977
  ////////////////////
@@ -6724,35 +6761,32 @@ declare namespace chrome {
6724
6761
  * @since Chrome 44
6725
6762
  */
6726
6763
  export namespace instanceID {
6727
- export interface TokenRefreshEvent extends chrome.events.Event<() => void> {}
6728
-
6729
6764
  /**
6730
6765
  * Resets the app instance identifier and revokes all tokens associated with it.
6731
6766
  *
6732
- * The `deleteID()` method doesn't return any value, but can be used with a callback or asynchronously,
6733
- * with a Promise (MV3 only).
6767
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
6734
6768
  */
6735
6769
  export function deleteID(): Promise<void>;
6736
6770
  export function deleteID(callback: () => void): void;
6737
6771
 
6772
+ /** Parameters for {@link deleteToken}. */
6738
6773
  interface DeleteTokenParams {
6739
6774
  /**
6740
- * Identifies the entity that is authorized to access resources associated with this Instance ID.
6741
- * It can be a project ID from Google developer console.
6775
+ * The authorized entity that is used to obtain the token.
6776
+ * @since Chrome 46
6742
6777
  */
6743
6778
  authorizedEntity: string;
6744
6779
  /**
6745
- * Identifies authorized actions that the authorized entity can take.
6746
- * In other words, the scope that is used to obtain the token.
6747
- * E.g. for sending GCM messages, `GCM` scope should be used.
6780
+ * The scope that is used to obtain the token.
6781
+ * @since Chrome 46
6748
6782
  */
6749
6783
  scope: string;
6750
6784
  }
6785
+
6751
6786
  /**
6752
- * Revoked a granted token.
6787
+ * Revokes a granted token.
6753
6788
  *
6754
- * The `deleteToken()` method doesn't return any value, but can be used with a callback or
6755
- * asynchronously, with a Promise (MV3 only).
6789
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
6756
6790
  */
6757
6791
  export function deleteToken(deleteTokenParams: DeleteTokenParams): Promise<void>;
6758
6792
  export function deleteToken(
@@ -6763,8 +6797,8 @@ declare namespace chrome {
6763
6797
  /**
6764
6798
  * Retrieves the time when the InstanceID has been generated.
6765
6799
  *
6800
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
6766
6801
  * @return The time when the Instance ID has been generated, represented in milliseconds since the epoch.
6767
- * It can return via a callback or asynchronously, with a Promise (MV3 only).
6768
6802
  */
6769
6803
  export function getCreationTime(): Promise<number>;
6770
6804
  export function getCreationTime(callback: (creationTime: number) => void): void;
@@ -6773,29 +6807,40 @@ declare namespace chrome {
6773
6807
  * Retrieves an identifier for the app instance.
6774
6808
  * The same ID will be returned as long as the application identity has not been revoked or expired.
6775
6809
  *
6776
- * @return An Instance ID assigned to the app instance. Can be returned by a callback or a Promise (MV3 only).
6810
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
6811
+ * @return An Instance ID assigned to the app instance.
6777
6812
  */
6778
6813
  export function getID(): Promise<string>;
6779
6814
  export function getID(callback: (instanceID: string) => void): void;
6780
6815
 
6781
- interface GetTokenParams extends DeleteTokenParams {
6816
+ /** Parameters for {@link getToken}. */
6817
+ interface GetTokenParams {
6782
6818
  /**
6783
- * Allows including a small number of string key/value pairs that will be associated with the token
6784
- * and may be used in processing the request.
6785
- *
6786
- * @deprecated Since Chrome 89. `options` are deprecated and will be ignored.
6819
+ * Identifies the entity that is authorized to access resources associated with this Instance ID. It can be a project ID from Google developer console.
6820
+ * @since Chrome 46
6821
+ */
6822
+ authorizedEntity: string;
6823
+ /**
6824
+ * Allows including a small number of string key/value pairs that will be associated with the token and may be used in processing the request.
6825
+ * @deprecated since Chrome 89. `options` are deprecated and will be ignored.
6787
6826
  */
6788
6827
  options?: { [key: string]: string };
6828
+ /**
6829
+ * Identifies authorized actions that the authorized entity can take. E.g. for sending GCM messages, `GCM` scope should be used.
6830
+ * @since Chrome 46
6831
+ */
6832
+ scope: string;
6789
6833
  }
6790
6834
  /**
6791
6835
  * Return a token that allows the authorized entity to access the service defined by scope.
6792
6836
  *
6793
- * @return A token assigned by the requested service. Can be returned by a callback or a Promise (MV3 only).
6837
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
6838
+ * @return A token assigned by the requested service.
6794
6839
  */
6795
6840
  export function getToken(getTokenParams: GetTokenParams): Promise<string>;
6796
6841
  export function getToken(getTokenParams: GetTokenParams, callback: (token: string) => void): void;
6797
6842
 
6798
- export var onTokenRefresh: TokenRefreshEvent;
6843
+ export const onTokenRefresh: events.Event<() => void>;
6799
6844
  }
6800
6845
 
6801
6846
  ////////////////////
@@ -7351,23 +7396,23 @@ declare namespace chrome {
7351
7396
  export enum Reason {
7352
7397
  /** A reason used for testing purposes only. */
7353
7398
  TESTING = "TESTING",
7354
- /** The offscreen document is responsible for playing audio. */
7399
+ /** Specifies that the offscreen document is responsible for playing audio. */
7355
7400
  AUDIO_PLAYBACK = "AUDIO_PLAYBACK",
7356
- /** The offscreen document needs to embed and script an iframe in order to modify the iframe's content. */
7401
+ /** Specifies that the offscreen document needs to embed and script an iframe in order to modify the iframe's content. */
7357
7402
  IFRAME_SCRIPTING = "IFRAME_SCRIPTING",
7358
- /** The offscreen document needs to embed an iframe and scrape its DOM to extract information. */
7403
+ /** Specifies that the offscreen document needs to embed an iframe and scrape its DOM to extract information. */
7359
7404
  DOM_SCRAPING = "DOM_SCRAPING",
7360
- /** The offscreen document needs to interact with Blob objects (including URL.createObjectURL()). */
7405
+ /** Specifies that the offscreen document needs to interact with Blob objects (including `URL.createObjectURL()`). */
7361
7406
  BLOBS = "BLOBS",
7362
- /** The offscreen document needs to use the DOMParser API. */
7407
+ /** Specifies that the offscreen document needs to use the DOMParser API. */
7363
7408
  DOM_PARSER = "DOM_PARSER",
7364
- /** The offscreen document needs to interact with media streams from user media (e.g. getUserMedia()). */
7409
+ /** Specifies that the offscreen document needs to interact with media streams from user media (e.g. `getUserMedia()`). */
7365
7410
  USER_MEDIA = "USER_MEDIA",
7366
- /** The offscreen document needs to interact with media streams from display media (e.g. getDisplayMedia()). */
7411
+ /** Specifies that the offscreen document needs to interact with media streams from display media (e.g. `getDisplayMedia()`). */
7367
7412
  DISPLAY_MEDIA = "DISPLAY_MEDIA",
7368
- /** The offscreen document needs to use WebRTC APIs. */
7413
+ /** Specifies that the offscreen document needs to use WebRTC APIs. */
7369
7414
  WEB_RTC = "WEB_RTC",
7370
- /** The offscreen document needs to interact with the clipboard APIs(e.g. Navigator.clipboard). */
7415
+ /** Specifies that the offscreen document needs to interact with the Clipboard API. */
7371
7416
  CLIPBOARD = "CLIPBOARD",
7372
7417
  /** Specifies that the offscreen document needs access to localStorage. */
7373
7418
  LOCAL_STORAGE = "LOCAL_STORAGE",
@@ -7381,7 +7426,6 @@ declare namespace chrome {
7381
7426
  GEOLOCATION = "GEOLOCATION",
7382
7427
  }
7383
7428
 
7384
- /** The parameters describing the offscreen document to create. */
7385
7429
  export interface CreateParameters {
7386
7430
  /** The reason(s) the extension is creating the offscreen document. */
7387
7431
  reasons: `${Reason}`[];
@@ -7394,36 +7438,26 @@ declare namespace chrome {
7394
7438
  /**
7395
7439
  * Creates a new offscreen document for the extension.
7396
7440
  * @param parameters The parameters describing the offscreen document to create.
7397
- * @return The `createDocument` method provides its result via callback or returned as a `Promise` (MV3 only).
7441
+ *
7442
+ * Can return its result via Promise in Manifest V3.
7398
7443
  */
7399
7444
  export function createDocument(parameters: CreateParameters): Promise<void>;
7400
- /**
7401
- * Creates a new offscreen document for the extension.
7402
- * @param parameters The parameters describing the offscreen document to create.
7403
- * @param callback Invoked when the offscreen document is created and has completed its initial page load.
7404
- */
7405
7445
  export function createDocument(parameters: CreateParameters, callback: () => void): void;
7406
7446
 
7407
7447
  /**
7408
7448
  * Closes the currently-open offscreen document for the extension.
7409
- * @return The `closeDocument` method provides its result via callback or returned as a `Promise` (MV3 only).
7449
+ *
7450
+ * Can return its result via Promise in Manifest V3.
7410
7451
  */
7411
7452
  export function closeDocument(): Promise<void>;
7412
- /**
7413
- * Closes the currently-open offscreen document for the extension.
7414
- * @param callback Invoked when the offscreen document has been closed.
7415
- */
7416
7453
  export function closeDocument(callback: () => void): void;
7417
7454
 
7418
7455
  /**
7419
7456
  * Determines whether the extension has an active document.
7420
- * @return The `hasDocument` method provides its result via callback or returned as a `Promise` (MV3 only).
7457
+ *
7458
+ * Can return its result via Promise in Manifest V3.
7421
7459
  */
7422
7460
  export function hasDocument(): Promise<boolean>;
7423
- /**
7424
- * Determines whether the extension has an active document.
7425
- * @param callback Invoked with the result of whether the extension has an active offscreen document.
7426
- */
7427
7461
  export function hasDocument(callback: (result: boolean) => void): void;
7428
7462
  }
7429
7463
 
@@ -7449,47 +7483,60 @@ declare namespace chrome {
7449
7483
  deletable?: boolean | undefined;
7450
7484
  }
7451
7485
 
7452
- export interface Suggestion {
7486
+ /** A suggest result. */
7487
+ export interface DefaultSuggestResult {
7453
7488
  /** The text that is displayed in the URL dropdown. Can contain XML-style markup for styling. The supported tags are 'url' (for a literal URL), 'match' (for highlighting text that matched what the user's query), and 'dim' (for dim helper text). The styles can be nested, eg. dimmed match. */
7454
7489
  description: string;
7455
7490
  }
7456
7491
 
7457
- /** The window disposition for the omnibox query. This is the recommended context to display results. */
7458
- export type OnInputEnteredDisposition = "currentTab" | "newForegroundTab" | "newBackgroundTab";
7459
-
7460
- export interface OmniboxInputEnteredEvent
7461
- extends chrome.events.Event<(text: string, disposition: OnInputEnteredDisposition) => void>
7462
- {}
7463
-
7464
- export interface OmniboxInputChangedEvent
7465
- extends chrome.events.Event<(text: string, suggest: (suggestResults: SuggestResult[]) => void) => void>
7466
- {}
7467
-
7468
- export interface OmniboxInputStartedEvent extends chrome.events.Event<() => void> {}
7469
-
7470
- export interface OmniboxInputCancelledEvent extends chrome.events.Event<() => void> {}
7492
+ /**
7493
+ * The style type.
7494
+ * @since Chrome 44
7495
+ */
7496
+ export enum DescriptionStyleType {
7497
+ URL = "url",
7498
+ MATCH = "match",
7499
+ DIM = "dim",
7500
+ }
7471
7501
 
7472
- export interface OmniboxSuggestionDeletedEvent extends chrome.events.Event<(text: string) => void> {}
7502
+ /**
7503
+ * The window disposition for the omnibox query. This is the recommended context to display results. For example, if the omnibox command is to navigate to a certain URL, a disposition of 'newForegroundTab' means the navigation should take place in a new selected tab.
7504
+ * @since Chrome 44
7505
+ */
7506
+ export enum OnInputEnteredDisposition {
7507
+ CURRENT_TAB = "currentTab",
7508
+ NEW_FOREGROUND_TAB = "newForegroundTab",
7509
+ NEW_BACKGROUND_TAB = "newBackgroundTab",
7510
+ }
7473
7511
 
7474
7512
  /**
7475
7513
  * Sets the description and styling for the default suggestion. The default suggestion is the text that is displayed in the first suggestion row underneath the URL bar.
7514
+ *
7515
+ * Can return its result via Promise in Manifest V3 or later since Chrome 100
7476
7516
  * @param suggestion A partial SuggestResult object, without the 'content' parameter.
7477
7517
  */
7478
- export function setDefaultSuggestion(suggestion: Suggestion): void;
7518
+ export function setDefaultSuggestion(suggestion: DefaultSuggestResult): Promise<void>;
7519
+ export function setDefaultSuggestion(suggestion: DefaultSuggestResult, callback: () => void): void;
7479
7520
 
7480
7521
  /** User has accepted what is typed into the omnibox. */
7481
- export var onInputEntered: OmniboxInputEnteredEvent;
7522
+ export const onInputEntered: events.Event<(text: string, disposition: `${OnInputEnteredDisposition}`) => void>;
7523
+
7482
7524
  /** User has changed what is typed into the omnibox. */
7483
- export var onInputChanged: OmniboxInputChangedEvent;
7525
+ export const onInputChanged: events.Event<
7526
+ (text: string, suggest: (suggestResults: SuggestResult[]) => void) => void
7527
+ >;
7528
+
7484
7529
  /** User has started a keyword input session by typing the extension's keyword. This is guaranteed to be sent exactly once per input session, and before any onInputChanged events. */
7485
- export var onInputStarted: OmniboxInputStartedEvent;
7530
+ export const onInputStarted: events.Event<() => void>;
7531
+
7486
7532
  /** User has ended the keyword input session without accepting the input. */
7487
- export var onInputCancelled: OmniboxInputCancelledEvent;
7533
+ export const onInputCancelled: events.Event<() => void>;
7534
+
7488
7535
  /**
7489
7536
  * User has deleted a suggested result
7490
7537
  * @since Chrome 63
7491
7538
  */
7492
- export var onDeleteSuggestion: OmniboxSuggestionDeletedEvent;
7539
+ export const onDeleteSuggestion: events.Event<(text: string) => void>;
7493
7540
  }
7494
7541
 
7495
7542
  ////////////////////
@@ -8376,58 +8423,74 @@ declare namespace chrome {
8376
8423
  * Permissions: "proxy"
8377
8424
  */
8378
8425
  export namespace proxy {
8426
+ /** @since Chrome 54 */
8427
+ export enum Mode {
8428
+ /** Never use a proxy */
8429
+ DIRECT = "direct",
8430
+ /** Auto detect proxy settings */
8431
+ AUTO_DETECT = "auto_detect",
8432
+ /** Use specified PAC script */
8433
+ PAC_SCRIPT = "pac_script",
8434
+ /** Manually specify proxy servers */
8435
+ FIXED_SERVERS = "fixed_servers",
8436
+ /** Use system proxy settings */
8437
+ SYSTEM = "system",
8438
+ }
8439
+
8379
8440
  /** An object holding proxy auto-config information. Exactly one of the fields should be non-empty. */
8380
8441
  export interface PacScript {
8381
- /** Optional. URL of the PAC file to be used. */
8442
+ /** URL of the PAC file to be used. */
8382
8443
  url?: string | undefined;
8383
- /** Optional. If true, an invalid PAC script will prevent the network stack from falling back to direct connections. Defaults to false. */
8444
+ /** If true, an invalid PAC script will prevent the network stack from falling back to direct connections. Defaults to false. */
8384
8445
  mandatory?: boolean | undefined;
8385
- /** Optional. A PAC script. */
8446
+ /** A PAC script. */
8386
8447
  data?: string | undefined;
8387
8448
  }
8388
8449
 
8389
8450
  /** An object encapsulating a complete proxy configuration. */
8390
8451
  export interface ProxyConfig {
8391
- /** Optional. The proxy rules describing this configuration. Use this for 'fixed_servers' mode. */
8452
+ /** The proxy rules describing this configuration. Use this for 'fixed_servers' mode. */
8392
8453
  rules?: ProxyRules | undefined;
8393
- /** Optional. The proxy auto-config (PAC) script for this configuration. Use this for 'pac_script' mode. */
8454
+ /** The proxy auto-config (PAC) script for this configuration. Use this for 'pac_script' mode. */
8394
8455
  pacScript?: PacScript | undefined;
8395
- /**
8396
- * 'direct' = Never use a proxy
8397
- * 'auto_detect' = Auto detect proxy settings
8398
- * 'pac_script' = Use specified PAC script
8399
- * 'fixed_servers' = Manually specify proxy servers
8400
- * 'system' = Use system proxy settings
8401
- */
8402
- mode: string;
8456
+ mode: `${Mode}`;
8403
8457
  }
8404
8458
 
8405
8459
  /** An object encapsulating a single proxy server's specification. */
8406
8460
  export interface ProxyServer {
8407
- /** The URI of the proxy server. This must be an ASCII hostname (in Punycode format). IDNA is not supported, yet. */
8461
+ /** The hostname or IP address of the proxy server. Hostnames must be in ASCII (in Punycode format). IDNA is not supported, yet. */
8408
8462
  host: string;
8409
- /** Optional. The scheme (protocol) of the proxy server itself. Defaults to 'http'. */
8410
- scheme?: string | undefined;
8411
- /** Optional. The port of the proxy server. Defaults to a port that depends on the scheme. */
8463
+ /** The scheme (protocol) of the proxy server itself. Defaults to 'http'. */
8464
+ scheme?: `${Scheme}` | undefined;
8465
+ /** The port of the proxy server. Defaults to a port that depends on the scheme. */
8412
8466
  port?: number | undefined;
8413
8467
  }
8414
8468
 
8415
8469
  /** An object encapsulating the set of proxy rules for all protocols. Use either 'singleProxy' or (a subset of) 'proxyForHttp', 'proxyForHttps', 'proxyForFtp' and 'fallbackProxy'. */
8416
8470
  export interface ProxyRules {
8417
- /** Optional. The proxy server to be used for FTP requests. */
8471
+ /** The proxy server to be used for FTP requests. */
8418
8472
  proxyForFtp?: ProxyServer | undefined;
8419
- /** Optional. The proxy server to be used for HTTP requests. */
8473
+ /** The proxy server to be used for HTTP requests. */
8420
8474
  proxyForHttp?: ProxyServer | undefined;
8421
- /** Optional. The proxy server to be used for everything else or if any of the specific proxyFor... is not specified. */
8475
+ /** The proxy server to be used for everything else or if any of the specific proxyFor... is not specified. */
8422
8476
  fallbackProxy?: ProxyServer | undefined;
8423
- /** Optional. The proxy server to be used for all per-URL requests (that is http, https, and ftp). */
8477
+ /** The proxy server to be used for all per-URL requests (that is http, https, and ftp). */
8424
8478
  singleProxy?: ProxyServer | undefined;
8425
- /** Optional. The proxy server to be used for HTTPS requests. */
8479
+ /** The proxy server to be used for HTTPS requests. */
8426
8480
  proxyForHttps?: ProxyServer | undefined;
8427
- /** Optional. List of servers to connect to without a proxy server. */
8481
+ /** List of servers to connect to without a proxy server. */
8428
8482
  bypassList?: string[] | undefined;
8429
8483
  }
8430
8484
 
8485
+ /** @since Chrome 54 */
8486
+ export enum Scheme {
8487
+ HTTP = "http",
8488
+ HTTPS = "https",
8489
+ QUIC = "quic",
8490
+ SOCKS4 = "socks4",
8491
+ SOCKS5 = "socks5",
8492
+ }
8493
+
8431
8494
  export interface ErrorDetails {
8432
8495
  /** Additional details about the error such as a JavaScript runtime error. */
8433
8496
  details: string;
@@ -8437,11 +8500,11 @@ declare namespace chrome {
8437
8500
  fatal: boolean;
8438
8501
  }
8439
8502
 
8440
- export interface ProxyErrorEvent extends chrome.events.Event<(details: ErrorDetails) => void> {}
8503
+ /** Proxy settings to be used. The value of this setting is a ProxyConfig object. */
8504
+ export const settings: types.ChromeSetting<ProxyConfig>;
8441
8505
 
8442
- export var settings: chrome.types.ChromeSetting<ProxyConfig>;
8443
8506
  /** Notifies about proxy errors. */
8444
- export var onProxyError: ProxyErrorEvent;
8507
+ export const onProxyError: events.Event<(details: ErrorDetails) => void>;
8445
8508
  }
8446
8509
 
8447
8510
  ////////////////////
@@ -11085,6 +11148,11 @@ declare namespace chrome {
11085
11148
  autoDiscardable?: boolean | undefined;
11086
11149
  /** Whether the tabs are pinned. */
11087
11150
  pinned?: boolean | undefined;
11151
+ /**
11152
+ * The ID of the Split View that the tabs are in, or `tabs.SPLIT_VIEW_ID_NONE` for tabs that aren't in a Split View.
11153
+ * @since Chrome 140
11154
+ */
11155
+ splitViewId?: number | undefined;
11088
11156
  /**
11089
11157
  * Whether the tabs are audible.
11090
11158
  * @since Chrome 45
@@ -11148,6 +11216,11 @@ declare namespace chrome {
11148
11216
  mutedInfo?: MutedInfo;
11149
11217
  /** The tab's new pinned state. */
11150
11218
  pinned?: boolean;
11219
+ /**
11220
+ * The tab's new Split View.
11221
+ * @since Chrome 140
11222
+ */
11223
+ splitViewId?: number;
11151
11224
  /** The tab's loading status. */
11152
11225
  status?: `${TabStatus}`;
11153
11226
  /**
@@ -13504,39 +13577,40 @@ declare namespace chrome {
13504
13577
  }
13505
13578
 
13506
13579
  export interface RequestDetails {
13507
- /** 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.
13508
- * 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.
13509
- * Frame IDs are unique within a tab.
13580
+ /**
13581
+ * The unique identifier for the frame's document, if this request is for a frame.
13582
+ * @since Chrome 106
13510
13583
  */
13584
+ documentId?: string | undefined;
13585
+ /**
13586
+ * The lifecycle of the frame's document, if this request is for a frame.
13587
+ * @since Chrome 106
13588
+ */
13589
+ documentLifecycle?: extensionTypes.DocumentLifecycle | undefined;
13590
+ /** 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. */
13511
13591
  frameId: number;
13512
-
13513
- /** The origin where the request was initiated.
13514
- * This does not change through redirects.
13515
- * If this is an opaque origin, the string 'null' will be used.
13592
+ /**
13593
+ * The type of the frame, if this request is for a frame.
13594
+ * @since Chrome 106
13516
13595
  */
13596
+ frameType?: extensionTypes.FrameType | undefined;
13597
+ /** The origin where the request was initiated. This does not change through redirects. If this is an opaque origin, the string 'null' will be used. */
13517
13598
  initiator?: string | undefined;
13518
-
13519
13599
  /** Standard HTTP method. */
13520
13600
  method: string;
13521
-
13522
- /** ID of frame that wraps the frame which sent the request.
13523
- * Set to -1 if no parent frame exists.
13524
- */
13525
- partentFrameId: number;
13526
-
13527
- /** The ID of the request.
13528
- * Request IDs are unique within a browser session.
13601
+ /**
13602
+ * The unique identifier for the frame's parent document, if this request is for a frame and has a parent.
13603
+ * @since Chrome 106
13529
13604
  */
13605
+ parentDocumentId?: string | undefined;
13606
+ /** ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists. */
13607
+ parentFrameId: number;
13608
+ /** The ID of the request. Request IDs are unique within a browser session. */
13530
13609
  requestId: string;
13531
-
13532
- /** The ID of the tab in which the request takes place.
13533
- * Set to -1 if the request isn't related to a tab.
13534
- */
13610
+ /** The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab. */
13535
13611
  tabId: number;
13536
-
13537
13612
  /** The resource type of the request. */
13538
13613
  type: `${ResourceType}`;
13539
-
13540
13614
  /** The URL of the request. */
13541
13615
  url: string;
13542
13616
  }
@@ -13544,38 +13618,27 @@ declare namespace chrome {
13544
13618
  export interface Rule {
13545
13619
  /** The action to take if this rule is matched. */
13546
13620
  action: RuleAction;
13547
-
13548
13621
  /** The condition under which this rule is triggered. */
13549
13622
  condition: RuleCondition;
13550
-
13551
- /** An id which uniquely identifies a rule.
13552
- * Mandatory and should be >= 1.
13553
- */
13623
+ /** An id which uniquely identifies a rule. Mandatory and should be >= 1. */
13554
13624
  id: number;
13555
-
13556
- /** Rule priority.
13557
- * Defaults to 1.
13558
- * When specified, should be >= 1.
13559
- */
13625
+ /** Rule priority. Defaults to 1. When specified, should be >= 1. */
13560
13626
  priority?: number | undefined;
13561
13627
  }
13562
13628
 
13563
13629
  export interface RuleAction {
13564
- /** Describes how the redirect should be performed.
13565
- * Only valid for redirect rules.
13566
- */
13630
+ /** Describes how the redirect should be performed. Only valid for redirect rules. */
13567
13631
  redirect?: Redirect | undefined;
13568
-
13569
- /** The request headers to modify for the request.
13570
- * Only valid if RuleActionType is "modifyHeaders".
13632
+ /**
13633
+ * The request headers to modify for the request. Only valid if RuleActionType is "modifyHeaders".
13634
+ * @since Chrome 86
13571
13635
  */
13572
13636
  requestHeaders?: ModifyHeaderInfo[] | undefined;
13573
-
13574
- /** The response headers to modify for the request.
13575
- * Only valid if RuleActionType is "modifyHeaders".
13637
+ /**
13638
+ * The response headers to modify for the request. Only valid if RuleActionType is "modifyHeaders".
13639
+ * @since Chrome 86
13576
13640
  */
13577
13641
  responseHeaders?: ModifyHeaderInfo[] | undefined;
13578
-
13579
13642
  /** The type of action to perform. */
13580
13643
  type: `${RuleActionType}`;
13581
13644
  }
@@ -13588,37 +13651,19 @@ declare namespace chrome {
13588
13651
  domainType?: `${DomainType}` | undefined;
13589
13652
 
13590
13653
  /**
13591
- * @deprecated since Chrome 101. Use initiatorDomains instead.
13592
-
13593
- * The rule will only match network requests originating from the list of domains.
13594
- * If the list is omitted, the rule is applied to requests from all domains.
13595
- * An empty list is not allowed.
13596
- *
13597
- * Notes:
13598
- * Sub-domains like "a.example.com" are also allowed.
13599
- * The entries must consist of only ascii characters.
13600
- * Use punycode encoding for internationalized domains.
13601
- * This matches against the request initiator and not the request url.
13602
- */
13654
+ * The rule will only match network requests originating from the list of `domains`.
13655
+ * @deprecated since Chrome 101. Use {@link initiatorDomains} instead
13656
+ */
13603
13657
  domains?: string[] | undefined;
13604
13658
 
13605
13659
  /**
13606
- * @deprecated since Chrome 101. Use excludedInitiatorDomains instead
13607
- *
13608
- * The rule will not match network requests originating from the list of excludedDomains.
13609
- * If the list is empty or omitted, no domains are excluded.
13610
- * This takes precedence over domains.
13611
- *
13612
- * Notes:
13613
- * Sub-domains like "a.example.com" are also allowed.
13614
- * The entries must consist of only ascii characters.
13615
- * Use punycode encoding for internationalized domains.
13616
- * This matches against the request initiator and not the request url.
13660
+ * The rule will not match network requests originating from the list of `excludedDomains`.
13661
+ * @deprecated since Chrome 101. Use {@link excludedInitiatorDomains} instead
13617
13662
  */
13618
13663
  excludedDomains?: string[] | undefined;
13619
13664
 
13620
13665
  /**
13621
- * The rule will only match network requests originating from the list of initiatorDomains.
13666
+ * The rule will only match network requests originating from the list of `initiatorDomains`.
13622
13667
  * If the list is omitted, the rule is applied to requests from all domains.
13623
13668
  * An empty list is not allowed.
13624
13669
  *
@@ -13627,24 +13672,26 @@ declare namespace chrome {
13627
13672
  * The entries must consist of only ascii characters.
13628
13673
  * Use punycode encoding for internationalized domains.
13629
13674
  * This matches against the request initiator and not the request url.
13675
+ * @since Chrome 101
13630
13676
  */
13631
13677
  initiatorDomains?: string[] | undefined;
13632
13678
 
13633
13679
  /**
13634
- * The rule will not match network requests originating from the list of excludedInitiatorDomains.
13680
+ * The rule will not match network requests originating from the list of `excludedInitiatorDomains`.
13635
13681
  * If the list is empty or omitted, no domains are excluded.
13636
- * This takes precedence over initiatorDomains.
13682
+ * This takes precedence over `initiatorDomains`.
13637
13683
  *
13638
13684
  * Notes:
13639
13685
  * Sub-domains like "a.example.com" are also allowed.
13640
13686
  * The entries must consist of only ascii characters.
13641
13687
  * Use punycode encoding for internationalized domains.
13642
13688
  * This matches against the request initiator and not the request url.
13689
+ * @since Chrome 101
13643
13690
  */
13644
13691
  excludedInitiatorDomains?: string[] | undefined;
13645
13692
 
13646
13693
  /**
13647
- * The rule will only match network requests when the domain matches one from the list of requestDomains.
13694
+ * The rule will only match network requests when the domain matches one from the list of `requestDomains`.
13648
13695
  * If the list is omitted, the rule is applied to requests from all domains.
13649
13696
  * An empty list is not allowed.
13650
13697
  *
@@ -13652,71 +13699,72 @@ declare namespace chrome {
13652
13699
  * Sub-domains like "a.example.com" are also allowed.
13653
13700
  * The entries must consist of only ascii characters.
13654
13701
  * Use punycode encoding for internationalized domains.
13702
+ * @since Chrome 101
13655
13703
  */
13656
13704
  requestDomains?: string[] | undefined;
13657
13705
 
13658
13706
  /**
13659
- * The rule will not match network requests when the domains matches one from the list of excludedRequestDomains.
13707
+ * The rule will not match network requests when the domains matches one from the list of `excludedRequestDomains`.
13660
13708
  * If the list is empty or omitted, no domains are excluded.
13661
- * This takes precedence over requestDomains.
13709
+ * This takes precedence over `requestDomains`.
13662
13710
  *
13663
13711
  * Notes:
13664
13712
  * Sub-domains like "a.example.com" are also allowed.
13665
13713
  * The entries must consist of only ascii characters.
13666
13714
  * Use punycode encoding for internationalized domains.
13715
+ * @since Chrome 101
13667
13716
  */
13668
13717
  excludedRequestDomains?: string[] | undefined;
13669
13718
 
13670
13719
  /**
13671
13720
  * List of request methods which the rule won't match.
13672
- * Only one of requestMethods and excludedRequestMethods should be specified.
13721
+ * Only one of `requestMethods` and `excludedRequestMethods` should be specified.
13673
13722
  * If neither of them is specified, all request methods are matched.
13723
+ * @since Chrome 91
13674
13724
  */
13675
13725
  excludedRequestMethods?: `${RequestMethod}`[] | undefined;
13676
13726
 
13677
13727
  /**
13678
13728
  * List of resource types which the rule won't match.
13679
- * Only one of {@link chrome.declarativeNetRequest.RuleCondition.resourceTypes}
13680
- * and {@link chrome.declarativeNetRequest.RuleCondition.excludedResourceTypes} should be specified.
13729
+ * Only one of `resourceTypes` and `excludedResourceTypes` should be specified.
13681
13730
  * If neither of them is specified, all resource types except "main_frame" are blocked.
13682
13731
  */
13683
13732
  excludedResourceTypes?: `${ResourceType}`[] | undefined;
13684
13733
 
13685
13734
  /**
13686
- * List of {@link chrome.tabs.Tab.id} which the rule should not match.
13687
- * An ID of {@link chrome.tabs.TAB_ID_NONE} excludes requests which don't originate from a tab.
13735
+ * List of {@link tabs.Tab.id} which the rule should not match.
13736
+ * An ID of {@link tabs.TAB_ID_NONE} excludes requests which don't originate from a tab.
13688
13737
  * Only supported for session-scoped rules.
13738
+ * @since Chrome 92
13689
13739
  */
13690
13740
  excludedTabIds?: number[] | undefined;
13691
13741
 
13692
- /**
13693
- * Whether the urlFilter or regexFilter (whichever is specified) is case sensitive.
13694
- * @default false Before Chrome 118 the default was true.
13695
- */
13742
+ /** Whether the `urlFilter` or `regexFilter` (whichever is specified) is case sensitive. Default is false. */
13696
13743
  isUrlFilterCaseSensitive?: boolean | undefined;
13697
13744
 
13698
13745
  /**
13699
13746
  * Regular expression to match against the network request url.
13700
13747
  * This follows the RE2 syntax.
13701
13748
  *
13702
- * Note: Only one of urlFilter or regexFilter can be specified.
13749
+ * Note: Only one of `urlFilter` or `regexFilter` can be specified.
13703
13750
  *
13704
- * Note: The regexFilter must be composed of only ASCII characters.
13751
+ * Note: The `regexFilter` must be composed of only ASCII characters.
13705
13752
  * This is matched against a url where the host is encoded in the punycode format (in case of internationalized domains) and any other non-ascii characters are url encoded in utf-8.
13706
13753
  */
13707
13754
  regexFilter?: string | undefined;
13708
13755
 
13709
13756
  /**
13710
13757
  * List of HTTP request methods which the rule can match. An empty list is not allowed.
13711
- * Note: Specifying a {@link chrome.declarativeNetRequest.RuleCondition.requestMethods} rule condition will also exclude non-HTTP(s) requests,
13712
- * whereas specifying {@link chrome.declarativeNetRequest.RuleCondition.excludedRequestMethods} will not.
13758
+ *
13759
+ * Note: Specifying a `requestMethods` rule condition will also exclude non-HTTP(s) requests, whereas specifying `excludedRequestMethods` will not.
13713
13760
  */
13714
13761
  requestMethods?: `${RequestMethod}`[] | undefined;
13715
13762
 
13716
13763
  /**
13717
- * List of {@link chrome.tabs.Tab.id} which the rule should not match.
13718
- * An ID of {@link chrome.tabs.TAB_ID_NONE} excludes requests which don't originate from a tab.
13764
+ * List of {@link tabs.Tab.id} which the rule should not match.
13765
+ * An ID of {@link tabs.TAB_ID_NONE} matches requests which don't originate from a tab.
13719
13766
  * An empty list is not allowed. Only supported for session-scoped rules.
13767
+ * @since Chrome 92
13720
13768
  */
13721
13769
  tabIds?: number[] | undefined;
13722
13770
 
@@ -13733,17 +13781,17 @@ declare namespace chrome {
13733
13781
  * '^' : Separator character: This matches anything except a letter, a digit or one of the following: _ - . %.
13734
13782
  * This can also match the end of the URL.
13735
13783
  *
13736
- * Therefore urlFilter is composed of the following parts: (optional Left/Domain name anchor) + pattern + (optional Right anchor).
13784
+ * Therefore `urlFilter` is composed of the following parts: (optional Left/Domain name anchor) + pattern + (optional Right anchor).
13737
13785
  *
13738
13786
  * If omitted, all urls are matched. An empty string is not allowed.
13739
13787
  *
13740
13788
  * A pattern beginning with || is not allowed. Use instead.
13741
13789
  *
13742
- * Note: Only one of urlFilter or regexFilter can be specified.
13790
+ * Note: Only one of `urlFilter` or `regexFilter` can be specified.
13743
13791
  *
13744
- * Note: The urlFilter must be composed of only ASCII characters.
13792
+ * Note: The `urlFilter` must be composed of only ASCII characters.
13745
13793
  * This is matched against a url where the host is encoded in the punycode format (in case of internationalized domains) and any other non-ascii characters are url encoded in utf-8.
13746
- * For example, when the request url is http://abc.рф?q=ф, the urlFilter will be matched against the url http://abc.xn--p1ai/?q=%D1%84.
13794
+ * For example, when the request url is http://abc.рф?q=ф, the `urlFilter` will be matched against the url http://abc.xn--p1ai/?q=%D1%84.
13747
13795
  */
13748
13796
  urlFilter?: string | undefined;
13749
13797
 
@@ -13751,7 +13799,7 @@ declare namespace chrome {
13751
13799
  * List of resource types which the rule can match.
13752
13800
  * An empty list is not allowed.
13753
13801
  *
13754
- * Note: this must be specified for allowAllRequests rules and may only include the sub_frame and main_frame resource types.
13802
+ * Note: this must be specified for `allowAllRequests` rules and may only include the `sub_frame` and `main_frame` resource types.
13755
13803
  */
13756
13804
  resourceTypes?: `${ResourceType}`[] | undefined;
13757
13805
 
@@ -13771,32 +13819,22 @@ declare namespace chrome {
13771
13819
  export interface MatchedRule {
13772
13820
  /** A matching rule's ID. */
13773
13821
  ruleId: number;
13774
-
13775
- /** ID of the Ruleset this rule belongs to.
13776
- * For a rule originating from the set of dynamic rules, this will be equal to DYNAMIC_RULESET_ID.
13777
- */
13822
+ /** ID of the {@link Ruleset} this rule belongs to. For a rule originating from the set of dynamic rules, this will be equal to {@link DYNAMIC_RULESET_ID}. */
13778
13823
  rulesetId: string;
13779
13824
  }
13780
13825
 
13781
13826
  export interface MatchedRuleInfo {
13782
13827
  rule: MatchedRule;
13783
-
13784
13828
  /** The tabId of the tab from which the request originated if the tab is still active. Else -1. */
13785
13829
  tabId: number;
13786
-
13787
- /** The time the rule was matched.
13788
- * Timestamps will correspond to the Javascript convention for times, i.e. number of milliseconds since the epoch.
13789
- */
13830
+ /** The time the rule was matched. Timestamps will correspond to the Javascript convention for times, i.e. number of milliseconds since the epoch. */
13790
13831
  timeStamp: number;
13791
13832
  }
13792
13833
 
13793
13834
  export interface MatchedRulesFilter {
13794
13835
  /** If specified, only matches rules after the given timestamp. */
13795
13836
  minTimeStamp?: number | undefined;
13796
-
13797
- /** If specified, only matches rules for the given tab.
13798
- * Matches rules not associated with any active tab if set to -1.
13799
- */
13837
+ /** If specified, only matches rules for the given tab. Matches rules not associated with any active tab if set to -1. */
13800
13838
  tabId?: number | undefined;
13801
13839
  }
13802
13840
 
@@ -13818,142 +13856,122 @@ declare namespace chrome {
13818
13856
  values?: string[];
13819
13857
  }
13820
13858
 
13859
+ /** @since Chrome 86 */
13821
13860
  export interface ModifyHeaderInfo {
13822
13861
  /** The name of the header to be modified. */
13823
13862
  header: string;
13824
-
13825
13863
  /** The operation to be performed on a header. */
13826
13864
  operation: `${HeaderOperation}`;
13827
-
13828
- /** The new value for the header.
13829
- * Must be specified for append and set operations.
13830
- */
13865
+ /** The new value for the header. Must be specified for `append` and `set` operations. */
13831
13866
  value?: string | undefined;
13832
13867
  }
13833
13868
 
13834
13869
  export interface QueryKeyValue {
13835
13870
  key: string;
13871
+ /**
13872
+ * If true, the query key is replaced only if it's already present. Otherwise, the key is also added if it's missing. Defaults to false.
13873
+ * @since Chrome 94
13874
+ */
13875
+ replaceOnly?: boolean | undefined;
13836
13876
  value: string;
13837
13877
  }
13838
13878
 
13839
13879
  export interface QueryTransform {
13840
13880
  /** The list of query key-value pairs to be added or replaced. */
13841
13881
  addOrReplaceParams?: QueryKeyValue[] | undefined;
13842
-
13843
13882
  /** The list of query keys to be removed. */
13844
13883
  removeParams?: string[] | undefined;
13845
13884
  }
13846
13885
 
13847
13886
  export interface URLTransform {
13848
- /** The new fragment for the request.
13849
- * Should be either empty, in which case the existing fragment is cleared; or should begin with '#'.
13850
- */
13887
+ /** The new fragment for the request. Should be either empty, in which case the existing fragment is cleared; or should begin with '#'. */
13851
13888
  fragment?: string | undefined;
13852
-
13853
13889
  /** The new host for the request. */
13854
13890
  host?: string | undefined;
13855
-
13856
13891
  /** The new password for the request. */
13857
13892
  password?: string | undefined;
13858
-
13859
- /** The new path for the request.
13860
- * If empty, the existing path is cleared.
13861
- */
13893
+ /** The new path for the request. If empty, the existing path is cleared. */
13862
13894
  path?: string | undefined;
13863
-
13864
- /** The new port for the request.
13865
- * If empty, the existing port is cleared.
13866
- */
13895
+ /** The new port for the request. If empty, the existing port is cleared. */
13867
13896
  port?: string | undefined;
13868
-
13869
- /** The new query for the request.
13870
- * Should be either empty, in which case the existing query is cleared; or should begin with '?'.
13871
- */
13897
+ /** The new query for the request. Should be either empty, in which case the existing query is cleared; or should begin with '?'. */
13872
13898
  query?: string | undefined;
13873
-
13874
13899
  /** Add, remove or replace query key-value pairs. */
13875
13900
  queryTransform?: QueryTransform | undefined;
13876
-
13877
- /** The new scheme for the request.
13878
- * Allowed values are "http", "https", "ftp" and "chrome-extension".
13879
- */
13901
+ /** The new scheme for the request. Allowed values are "http", "https", "ftp" and "chrome-extension". */
13880
13902
  scheme?: string | undefined;
13881
-
13882
13903
  /** The new username for the request. */
13883
13904
  username?: string | undefined;
13884
13905
  }
13885
13906
 
13907
+ /** @since Chrome 87 */
13886
13908
  export interface RegexOptions {
13887
- /** Whether the regex specified is case sensitive.
13888
- * Default is true.
13889
- */
13909
+ /** Whether the `regex` specified is case sensitive. Default is true. */
13890
13910
  isCaseSensitive?: boolean | undefined;
13891
-
13892
13911
  /** The regular expression to check. */
13893
13912
  regex: string;
13894
-
13895
- /** Whether the regex specified requires capturing.
13896
- * Capturing is only required for redirect rules which specify a regexSubstitution action.
13897
- * The default is false.
13898
- */
13913
+ /** Whether the `regex` specified requires capturing. Capturing is only required for redirect rules which specify a `regexSubstitution` action. The default is false. */
13899
13914
  requireCapturing?: boolean | undefined;
13900
13915
  }
13901
13916
 
13917
+ /** @since Chrome 87 */
13902
13918
  export interface IsRegexSupportedResult {
13903
13919
  isSupported: boolean;
13904
-
13905
- /** Specifies the reason why the regular expression is not supported.
13906
- * Only provided if isSupported is false.
13907
- */
13908
- reason?: `${UnsupportedRegexReason}` | undefined;
13920
+ /** Specifies the reason why the regular expression is not supported. Only provided if `isSupported` is false. */
13921
+ reason?: `${UnsupportedRegexReason}`;
13909
13922
  }
13910
13923
 
13924
+ /** @since Chrome 89 */
13911
13925
  export interface TabActionCountUpdate {
13912
- /** The amount to increment the tab's action count by.
13913
- * Negative values will decrement the count
13914
- */
13926
+ /** The amount to increment the tab's action count by. Negative values will decrement the count. */
13915
13927
  increment: number;
13916
-
13917
13928
  /** The tab for which to update the action count. */
13918
13929
  tabId: number;
13919
13930
  }
13920
13931
 
13932
+ /** @since Chrome 88 */
13921
13933
  export interface ExtensionActionOptions {
13922
- /** Whether to automatically display the action count for a page as the extension's badge text.
13934
+ /**
13935
+ * Whether to automatically display the action count for a page as the extension's badge text.
13923
13936
  * This preference is persisted across sessions.
13924
13937
  */
13925
13938
  displayActionCountAsBadgeText?: boolean | undefined;
13926
-
13927
13939
  /** Details of how the tab's action count should be adjusted. */
13928
13940
  tabUpdate?: TabActionCountUpdate | undefined;
13929
13941
  }
13930
13942
 
13943
+ /** @since Chrome 111 */
13944
+ export interface GetDisabledRuleIdsOptions {
13945
+ /** The id corresponding to a static {@link Ruleset}. */
13946
+ rulesetId: string;
13947
+ }
13948
+
13949
+ /** @since Chrome 111 */
13950
+ export interface GetRulesFilter {
13951
+ /** If specified, only rules with matching IDs are included. */
13952
+ ruleIds?: number[] | undefined;
13953
+ }
13954
+
13931
13955
  export interface Redirect {
13932
- /** Path relative to the extension directory.
13933
- * Should start with '/'.
13934
- */
13956
+ /** Path relative to the extension directory. Should start with '/'. */
13935
13957
  extensionPath?: string | undefined;
13936
-
13937
- /** Substitution pattern for rules which specify a regexFilter.
13938
- * The first match of regexFilter within the url will be replaced with this pattern.
13939
- * Within regexSubstitution, backslash-escaped digits (\1 to \9) can be used to insert the corresponding capture groups.
13958
+ /**
13959
+ * Substitution pattern for rules which specify a `regexFilter`.
13960
+ * The first match of `regexFilter` within the url will be replaced with this pattern.
13961
+ * Within `regexSubstitution`, backslash-escaped digits (\1 to \9) can be used to insert the corresponding capture groups.
13940
13962
  * \0 refers to the entire matching text.
13941
13963
  */
13942
13964
  regexSubstitution?: string | undefined;
13943
-
13944
13965
  /** Url transformations to perform. */
13945
13966
  transform?: URLTransform | undefined;
13946
-
13947
- /** The redirect url.
13948
- * Redirects to JavaScript urls are not allowed.
13949
- */
13967
+ /** The redirect url. Redirects to JavaScript urls are not allowed. */
13950
13968
  url?: string | undefined;
13951
13969
  }
13952
13970
 
13971
+ /** @since Chrome 87 */
13953
13972
  export interface UpdateRuleOptions {
13954
13973
  /** Rules to add. */
13955
13974
  addRules?: Rule[] | undefined;
13956
-
13957
13975
  /**
13958
13976
  * IDs of the rules to remove.
13959
13977
  * Any invalid IDs will be ignored.
@@ -13961,41 +13979,35 @@ declare namespace chrome {
13961
13979
  removeRuleIds?: number[] | undefined;
13962
13980
  }
13963
13981
 
13982
+ /** @since Chrome 111 */
13964
13983
  export interface UpdateStaticRulesOptions {
13965
- /** Set of ids corresponding to rules in the Ruleset to disable. */
13984
+ /** Set of ids corresponding to rules in the {@link Ruleset} to disable. */
13966
13985
  disableRuleIds?: number[];
13967
-
13968
- /** Set of ids corresponding to rules in the Ruleset to enable. */
13986
+ /** Set of ids corresponding to rules in the {@link Ruleset} to enable. */
13969
13987
  enableRuleIds?: number[];
13970
-
13971
- /** The id corresponding to a static Ruleset. */
13988
+ /** The id corresponding to a static {@link Ruleset}. */
13972
13989
  rulesetId: string;
13973
13990
  }
13974
13991
 
13992
+ /** @since Chrome 87 */
13975
13993
  export interface UpdateRulesetOptions {
13976
- /** The set of ids corresponding to a static Ruleset that should be disabled. */
13994
+ /** The set of ids corresponding to a static {@link Ruleset} that should be disabled. */
13977
13995
  disableRulesetIds?: string[] | undefined;
13978
-
13979
- /** The set of ids corresponding to a static Ruleset that should be enabled. */
13996
+ /** The set of ids corresponding to a static {@link Ruleset} that should be enabled. */
13980
13997
  enableRulesetIds?: string[] | undefined;
13981
13998
  }
13982
13999
 
13983
14000
  export interface MatchedRuleInfoDebug {
13984
14001
  /** Details about the request for which the rule was matched. */
13985
14002
  request: RequestDetails;
13986
-
13987
14003
  rule: MatchedRule;
13988
14004
  }
13989
14005
 
13990
14006
  export interface Ruleset {
13991
14007
  /** Whether the ruleset is enabled by default. */
13992
14008
  enabled: boolean;
13993
-
13994
- /** A non-empty string uniquely identifying the ruleset.
13995
- * IDs beginning with '_' are reserved for internal use.
13996
- */
14009
+ /** A non-empty string uniquely identifying the ruleset. IDs beginning with '_' are reserved for internal use. */
13997
14010
  id: string;
13998
-
13999
14011
  /** The path of the JSON ruleset relative to the extension directory. */
14000
14012
  path: string;
14001
14013
  }
@@ -14030,112 +14042,96 @@ declare namespace chrome {
14030
14042
  url: string;
14031
14043
  }
14032
14044
 
14033
- /** Returns the number of static rules an extension can enable before the global static rule limit is reached. */
14034
- export function getAvailableStaticRuleCount(callback: (count: number) => void): void;
14035
-
14036
14045
  /**
14037
14046
  * Returns the number of static rules an extension can enable before the global static rule limit is reached.
14038
- * @return The `getAvailableStaticRuleCount` method provides its result via callback or returned as a `Promise` (MV3 only).
14047
+ *
14048
+ * Can return its result via Promise in Manifest V3 or later since Chrome 91.
14049
+ * @since Chrome 89
14039
14050
  */
14040
14051
  export function getAvailableStaticRuleCount(): Promise<number>;
14052
+ export function getAvailableStaticRuleCount(callback: (count: number) => void): void;
14041
14053
 
14042
- /** Returns the current set of dynamic rules for the extension.
14054
+ /**
14055
+ * Returns the list of static rules in the given {@link Ruleset} that are currently disabled.
14043
14056
  *
14044
- * @param callback Called with the set of dynamic rules.
14045
- * An error might be raised in case of transient internal errors.
14057
+ * Can return its result via Promise in Manifest V3.
14058
+ * @param options Specifies the ruleset to query.
14059
+ * @since Chrome 111
14046
14060
  */
14047
- export function getDynamicRules(callback: (rules: Rule[]) => void): void;
14061
+ export function getDisabledRuleIds(options: GetDisabledRuleIdsOptions): Promise<number[]>;
14062
+ export function getDisabledRuleIds(
14063
+ options: GetDisabledRuleIdsOptions,
14064
+ callback: (disabledRuleIds: number[]) => void,
14065
+ ): void;
14048
14066
 
14049
14067
  /**
14050
- * Returns the current set of dynamic rules for the extension.
14051
- * @return The `getDynamicRules` method provides its result via callback or returned as a `Promise` (MV3 only).
14052
- */
14053
- export function getDynamicRules(): Promise<Rule[]>;
14054
-
14055
- /** Returns the ids for the current set of enabled static rulesets.
14068
+ * Returns the current set of dynamic rules for the extension. Callers can optionally filter the list of fetched rules by specifying a `filter`.
14056
14069
  *
14057
- * @param callback Called with a list of ids, where each id corresponds to an enabled static Ruleset. */
14058
- export function getEnabledRulesets(callback: (rulesetIds: string[]) => void): void;
14070
+ * Can return its result via Promise in Manifest V3 or later since Chrome 91.
14071
+ * @param filter An object to filter the list of fetched rules.
14072
+ */
14073
+ export function getDynamicRules(filter?: GetRulesFilter): Promise<Rule[]>;
14074
+ export function getDynamicRules(callback: (rules: Rule[]) => void): void;
14075
+ export function getDynamicRules(filter: GetRulesFilter | undefined, callback: (rules: Rule[]) => void): void;
14059
14076
 
14060
14077
  /**
14061
14078
  * Returns the ids for the current set of enabled static rulesets.
14062
- * @return The `getEnabledRulesets` method provides its result via callback or returned as a `Promise` (MV3 only).
14079
+ *
14080
+ * Can return its result via Promise in Manifest V3 or later since Chrome 91.
14063
14081
  */
14064
14082
  export function getEnabledRulesets(): Promise<string[]>;
14083
+ export function getEnabledRulesets(callback: (rulesetIds: string[]) => void): void;
14065
14084
 
14066
- /** Returns all rules matched for the extension.
14067
- * Callers can optionally filter the list of matched rules by specifying a filter.
14068
- * This method is only available to extensions with the declarativeNetRequestFeedback permission or having the activeTab permission granted for the tabId specified in filter.
14069
- * Note: Rules not associated with an active document that were matched more than five minutes ago will not be returned.
14085
+ /**
14086
+ * Returns all rules matched for the extension. Callers can optionally filter the list of matched rules by specifying a `filter`. This method is only available to extensions with the `"declarativeNetRequestFeedback"` permission or having the `"activeTab"` permission granted for the `tabId` specified in `filter`. Note: Rules not associated with an active document that were matched more than five minutes ago will not be returned.
14070
14087
  *
14088
+ * Can return its result via Promise in Manifest V3 or later since Chrome 91.
14071
14089
  * @param filter An object to filter the list of matched rules.
14072
- * @param callback Called once the list of matched rules has been fetched.
14073
- * In case of an error, runtime.lastError will be set and no rules will be returned.
14074
- * This can happen for multiple reasons, such as insufficient permissions, or exceeding the quota.
14075
14090
  */
14091
+ export function getMatchedRules(filter?: MatchedRulesFilter): Promise<RulesMatchedDetails>;
14092
+ export function getMatchedRules(callback: (details: RulesMatchedDetails) => void): void;
14076
14093
  export function getMatchedRules(
14077
14094
  filter: MatchedRulesFilter | undefined,
14078
14095
  callback: (details: RulesMatchedDetails) => void,
14079
14096
  ): void;
14080
14097
 
14081
14098
  /**
14082
- * Returns all rules matched for the extension.
14083
- * Callers can optionally filter the list of matched rules by specifying a filter.
14084
- * This method is only available to extensions with the declarativeNetRequestFeedback permission or having the activeTab permission granted for the tabId specified in filter.
14085
- * Note: Rules not associated with an active document that were matched more than five minutes ago will not be returned.
14099
+ * Returns the current set of session scoped rules for the extension. Callers can optionally filter the list of fetched rules by specifying a `filter`.
14086
14100
  *
14087
- * @param filter An object to filter the list of matched rules.
14088
- * @return The `getMatchedRules` method provides its result via callback or returned as a `Promise` (MV3 only).
14089
- */
14090
- export function getMatchedRules(filter: MatchedRulesFilter | undefined): Promise<RulesMatchedDetails>;
14091
-
14092
- export function getMatchedRules(callback: (details: RulesMatchedDetails) => void): void;
14093
-
14094
- export function getMatchedRules(): Promise<RulesMatchedDetails>;
14095
-
14096
- /** Returns the current set of session scoped rules for the extension.
14097
- *
14098
- * @param callback Called with the set of session scoped rules.
14101
+ * Can return its result via Promise in Manifest V3 or later since Chrome 91.
14102
+ * @param filter An object to filter the list of fetched rules.
14103
+ * @since Chrome 90
14099
14104
  */
14105
+ export function getSessionRules(filter?: GetRulesFilter): Promise<Rule[]>;
14100
14106
  export function getSessionRules(callback: (rules: Rule[]) => void): void;
14107
+ export function getSessionRules(filter: GetRulesFilter | undefined, callback: (rules: Rule[]) => void): void;
14101
14108
 
14102
14109
  /**
14103
- * Returns the current set of session scoped rules for the extension.
14104
- *
14105
- * @return The `getSessionRules` method provides its result via callback or returned as a `Promise` (MV3 only).
14106
- */
14107
- export function getSessionRules(): Promise<Rule[]>;
14108
-
14109
- /** Checks if the given regular expression will be supported as a regexFilter rule condition.
14110
+ * Checks if the given regular expression will be supported as a `regexFilter` rule condition.
14110
14111
  *
14112
+ * Can return its result via Promise in Manifest V3 or later since Chrome 91.
14111
14113
  * @param regexOptions The regular expression to check.
14112
- * @param callback Called with details consisting of whether the regular expression is supported and the
14113
- * reason if not.
14114
+ * @since Chrome 87
14114
14115
  */
14116
+ export function isRegexSupported(regexOptions: RegexOptions): Promise<IsRegexSupportedResult>;
14115
14117
  export function isRegexSupported(
14116
14118
  regexOptions: RegexOptions,
14117
14119
  callback: (result: IsRegexSupportedResult) => void,
14118
14120
  ): void;
14119
14121
 
14120
- /** Checks if the given regular expression will be supported as a regexFilter rule condition.
14121
- *
14122
- * @param regexOptions The regular expression to check.
14123
- * @return The `isRegexSupported` method provides its result via callback or returned as a `Promise` (MV3 only).
14124
- */
14125
- export function isRegexSupported(regexOptions: RegexOptions): Promise<IsRegexSupportedResult>;
14126
-
14127
- /** Configures if the action count for tabs should be displayed as the extension action's badge text and provides a way for that action count to be incremented. */
14128
- export function setExtensionActionOptions(options: ExtensionActionOptions, callback: () => void): void;
14129
-
14130
14122
  /**
14131
14123
  * Configures if the action count for tabs should be displayed as the extension action's badge text and provides a way for that action count to be incremented.
14132
- * @return The `setExtensionActionOptions` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
14124
+ *
14125
+ * Can return its result via Promise in Manifest V3 or later since Chrome 91.
14126
+ * @since Chrome 88
14133
14127
  */
14134
14128
  export function setExtensionActionOptions(options: ExtensionActionOptions): Promise<void>;
14129
+ export function setExtensionActionOptions(options: ExtensionActionOptions, callback: () => void): void;
14135
14130
 
14136
14131
  /**
14137
14132
  * Checks if any of the extension's declarativeNetRequest rules would match a hypothetical request. Note: Only available for unpacked extensions as this is only intended to be used during extension development.
14138
- * @param request
14133
+ *
14134
+ * Can return its result via Promise in Manifest V3.
14139
14135
  * @since Chrome 103
14140
14136
  */
14141
14137
  export function testMatchOutcome(request: TestMatchRequestDetails): Promise<TestMatchOutcomeResult>;
@@ -14144,101 +14140,52 @@ declare namespace chrome {
14144
14140
  callback: (result: TestMatchOutcomeResult) => void,
14145
14141
  ): void;
14146
14142
 
14147
- /** Modifies the current set of dynamic rules for the extension.
14148
- * The rules with IDs listed in options.removeRuleIds are first removed, and then the rules given in options.addRules are added.
14149
- *
14150
- * Notes:
14151
- * This update happens as a single atomic operation: either all specified rules are added and removed, or an error is returned.
14152
- * These rules are persisted across browser sessions and across extension updates.
14153
- * Static rules specified as part of the extension package can not be removed using this function.
14154
- * MAX_NUMBER_OF_DYNAMIC_AND_SESSION_RULES is the maximum number of combined dynamic and session rules an extension can add.
14155
- *
14156
- * @param callback Called once the update is complete or has failed.
14157
- * In case of an error, runtime.lastError will be set and no change will be made to the rule set.
14158
- * This can happen for multiple reasons, such as invalid rule format, duplicate rule ID, rule count limit exceeded, internal errors, and others.
14159
- */
14160
- export function updateDynamicRules(options: UpdateRuleOptions, callback: () => void): void;
14161
-
14162
- /** Modifies the current set of dynamic rules for the extension.
14163
- * The rules with IDs listed in options.removeRuleIds are first removed, and then the rules given in options.addRules are added.
14143
+ /**
14144
+ * Modifies the current set of dynamic rules for the extension. The rules with IDs listed in `options.removeRuleIds` are first removed, and then the rules given in `options.addRules` are added. Notes:
14164
14145
  *
14165
- * Notes:
14166
- * This update happens as a single atomic operation: either all specified rules are added and removed, or an error is returned.
14167
- * These rules are persisted across browser sessions and across extension updates.
14168
- * Static rules specified as part of the extension package can not be removed using this function.
14169
- * MAX_NUMBER_OF_DYNAMIC_AND_SESSION_RULES is the maximum number of combined dynamic and session rules an extension can add.
14146
+ * * This update happens as a single atomic operation: either all specified rules are added and removed, or an error is returned.
14147
+ * * These rules are persisted across browser sessions and across extension updates.
14148
+ * * Static rules specified as part of the extension package can not be removed using this function.
14149
+ * * {@link MAX_NUMBER_OF_DYNAMIC_RULES} is the maximum number of dynamic rules an extension can add. The number of [unsafe rules](https://developer.chrome.com/docs/extensions/reference/declarativeNetRequest/#safe_rules) must not exceed {@link MAX_NUMBER_OF_UNSAFE_DYNAMIC_RULES}.
14170
14150
  *
14171
- * @return The `updateDynamicRules` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
14172
- * In case of an error, runtime.lastError will be set and no change will be made to the rule set.
14173
- * This can happen for multiple reasons, such as invalid rule format, duplicate rule ID, rule count limit exceeded, internal errors, and others.
14151
+ * Can return its result via Promise in Manifest V3 or later since Chrome 91.
14174
14152
  */
14175
14153
  export function updateDynamicRules(options: UpdateRuleOptions): Promise<void>;
14154
+ export function updateDynamicRules(options: UpdateRuleOptions, callback: () => void): void;
14176
14155
 
14177
- /** Updates the set of enabled static rulesets for the extension.
14178
- * The rulesets with IDs listed in options.disableRulesetIds are first removed, and then the rulesets listed in options.enableRulesetIds are added.
14179
- *
14180
- * Note that the set of enabled static rulesets is persisted across sessions but not across extension updates, i.e. the rule_resources manifest key will determine the set of enabled static rulesets on each extension update.
14181
- *
14182
- * @param callback Called once the update is complete.
14183
- * In case of an error, runtime.lastError will be set and no change will be made to set of enabled rulesets.
14184
- * This can happen for multiple reasons, such as invalid ruleset IDs, rule count limit exceeded, or internal errors.
14185
- */
14186
- export function updateEnabledRulesets(options: UpdateRulesetOptions, callback: () => void): void;
14187
-
14188
- /** Updates the set of enabled static rulesets for the extension.
14189
- * The rulesets with IDs listed in options.disableRulesetIds are first removed, and then the rulesets listed in options.enableRulesetIds are added.
14190
- *
14191
- * Note that the set of enabled static rulesets is persisted across sessions but not across extension updates, i.e. the rule_resources manifest key will determine the set of enabled static rulesets on each extension update.
14156
+ /**
14157
+ * Updates the set of enabled static rulesets for the extension. The rulesets with IDs listed in `options.disableRulesetIds` are first removed, and then the rulesets listed in `options.enableRulesetIds` are added.
14158
+ * Note that the set of enabled static rulesets is persisted across sessions but not across extension updates, i.e. the `rule_resources` manifest key will determine the set of enabled static rulesets on each extension update.
14192
14159
  *
14193
- * @return The `updateEnabledRulesets` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
14194
- * In case of an error, runtime.lastError will be set and no change will be made to set of enabled rulesets.
14195
- * This can happen for multiple reasons, such as invalid ruleset IDs, rule count limit exceeded, or internal errors.
14160
+ * Can return its result via Promise in Manifest V3 or later since Chrome 91.
14196
14161
  */
14197
14162
  export function updateEnabledRulesets(options: UpdateRulesetOptions): Promise<void>;
14163
+ export function updateEnabledRulesets(options: UpdateRulesetOptions, callback: () => void): void;
14198
14164
 
14199
- /** Modifies the current set of session scoped rules for the extension.
14200
- * The rules with IDs listed in options.removeRuleIds are first removed, and then the rules given in options.addRules are added.
14201
- *
14202
- * Notes:
14203
- * This update happens as a single atomic operation: either all specified rules are added and removed, or an error is returned.
14204
- * These rules are not persisted across sessions and are backed in memory.
14205
- * MAX_NUMBER_OF_DYNAMIC_AND_SESSION_RULES is the maximum number of combined dynamic and session rules an extension can add.
14206
- *
14207
- * @param callback Called once the update is complete or has failed.
14208
- * In case of an error, runtime.lastError will be set and no change will be made to the rule set.
14209
- * This can happen for multiple reasons, such as invalid rule format, duplicate rule ID, rule count limit exceeded, and others.
14210
- */
14211
- export function updateSessionRules(options: UpdateRuleOptions, callback: () => void): void;
14212
-
14213
- /** Modifies the current set of session scoped rules for the extension.
14214
- * The rules with IDs listed in options.removeRuleIds are first removed, and then the rules given in options.addRules are added.
14165
+ /**
14166
+ * Modifies the current set of session scoped rules for the extension. The rules with IDs listed in `options.removeRuleIds` are first removed, and then the rules given in `options.addRules` are added. Notes:
14215
14167
  *
14216
- * Notes:
14217
- * This update happens as a single atomic operation: either all specified rules are added and removed, or an error is returned.
14218
- * These rules are not persisted across sessions and are backed in memory.
14219
- * MAX_NUMBER_OF_DYNAMIC_AND_SESSION_RULES is the maximum number of combined dynamic and session rules an extension can add.
14168
+ * * This update happens as a single atomic operation: either all specified rules are added and removed, or an error is returned.
14169
+ * * These rules are not persisted across sessions and are backed in memory.
14170
+ * * {@link MAX_NUMBER_OF_SESSION_RULES} is the maximum number of session rules an extension can add.
14220
14171
  *
14221
- * @return The `updateSessionRules` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
14222
- * In case of an error, runtime.lastError will be set and no change will be made to the rule set.
14223
- * This can happen for multiple reasons, such as invalid rule format, duplicate rule ID, rule count limit exceeded, and others.
14172
+ * Can return its result via Promise in Manifest V3 or later since Chrome 91.
14173
+ * @since Chrome 90
14224
14174
  */
14225
14175
  export function updateSessionRules(options: UpdateRuleOptions): Promise<void>;
14176
+ export function updateSessionRules(options: UpdateRuleOptions, callback: () => void): void;
14226
14177
 
14227
- /** Disables and enables individual static rules in a Ruleset.
14228
- * Changes to rules belonging to a disabled Ruleset will take effect the next time that it becomes enabled.
14178
+ /**
14179
+ * Disables and enables individual static rules in a {@link Ruleset}. Changes to rules belonging to a disabled {@link Ruleset} will take effect the next time that it becomes enabled.
14229
14180
  *
14230
- * @return The `updateStaticRules` method either calls a provided callback if its finished or returns as a `Promise` (MV3 only).
14181
+ * Can return its result via Promise in Manifest V3.
14231
14182
  * @since Chrome 111
14232
14183
  */
14233
14184
  export function updateStaticRules(options: UpdateStaticRulesOptions): Promise<void>;
14234
14185
  export function updateStaticRules(options: UpdateStaticRulesOptions, callback?: () => void): void;
14235
14186
 
14236
- /** The rule that has been matched along with information about the associated request. */
14237
- export interface RuleMatchedDebugEvent extends chrome.events.Event<(info: MatchedRuleInfoDebug) => void> {}
14238
-
14239
- /** Fired when a rule is matched with a request.
14240
- * Only available for unpacked extensions with the declarativeNetRequestFeedback permission as this is intended to be used for debugging purposes only. */
14241
- export var onRuleMatchedDebug: RuleMatchedDebugEvent;
14187
+ /** Fired when a rule is matched with a request. Only available for unpacked extensions with the `declarativeNetRequestFeedback` permission as this is intended to be used for debugging purposes only. */
14188
+ export const onRuleMatchedDebug: events.Event<(info: MatchedRuleInfoDebug) => void>;
14242
14189
  }
14243
14190
 
14244
14191
  ////////////////////
@@ -14289,6 +14236,11 @@ declare namespace chrome {
14289
14236
  openPanelOnActionClick?: boolean;
14290
14237
  }
14291
14238
 
14239
+ /** @since Chrome 140 */
14240
+ export interface PanelLayout {
14241
+ side: `${Side}`;
14242
+ }
14243
+
14292
14244
  export interface PanelOptions {
14293
14245
  /** Whether the side panel should be enabled. This is optional. The default value is true. */
14294
14246
  enabled?: boolean;
@@ -14302,11 +14254,27 @@ declare namespace chrome {
14302
14254
  tabId?: number;
14303
14255
  }
14304
14256
 
14257
+ /**
14258
+ * Defines the possible alignment for the side panel in the browser UI.
14259
+ * @since Chrome 140
14260
+ */
14261
+ export enum Side {
14262
+ LEFT = "left",
14263
+ RIGHT = "right",
14264
+ }
14265
+
14305
14266
  export interface SidePanel {
14306
14267
  /** Developer specified path for side panel display. */
14307
14268
  default_path: string;
14308
14269
  }
14309
14270
 
14271
+ /**
14272
+ * Returns the side panel's current layout.
14273
+ * @since Chrome 140
14274
+ */
14275
+ export function getLayout(): Promise<PanelLayout>;
14276
+ export function getLayout(callback: (layout: PanelLayout) => void): void;
14277
+
14310
14278
  /**
14311
14279
  * Returns the active panel configuration.
14312
14280
  * Promises are supported in Manifest V3 and later, but callbacks are provided for backward compatibility.