@types/chrome 0.1.12 → 0.1.14

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 +397 -440
  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
@@ -6748,35 +6761,32 @@ declare namespace chrome {
6748
6761
  * @since Chrome 44
6749
6762
  */
6750
6763
  export namespace instanceID {
6751
- export interface TokenRefreshEvent extends chrome.events.Event<() => void> {}
6752
-
6753
6764
  /**
6754
6765
  * Resets the app instance identifier and revokes all tokens associated with it.
6755
6766
  *
6756
- * The `deleteID()` method doesn't return any value, but can be used with a callback or asynchronously,
6757
- * with a Promise (MV3 only).
6767
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
6758
6768
  */
6759
6769
  export function deleteID(): Promise<void>;
6760
6770
  export function deleteID(callback: () => void): void;
6761
6771
 
6772
+ /** Parameters for {@link deleteToken}. */
6762
6773
  interface DeleteTokenParams {
6763
6774
  /**
6764
- * Identifies the entity that is authorized to access resources associated with this Instance ID.
6765
- * 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
6766
6777
  */
6767
6778
  authorizedEntity: string;
6768
6779
  /**
6769
- * Identifies authorized actions that the authorized entity can take.
6770
- * In other words, the scope that is used to obtain the token.
6771
- * 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
6772
6782
  */
6773
6783
  scope: string;
6774
6784
  }
6785
+
6775
6786
  /**
6776
- * Revoked a granted token.
6787
+ * Revokes a granted token.
6777
6788
  *
6778
- * The `deleteToken()` method doesn't return any value, but can be used with a callback or
6779
- * asynchronously, with a Promise (MV3 only).
6789
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
6780
6790
  */
6781
6791
  export function deleteToken(deleteTokenParams: DeleteTokenParams): Promise<void>;
6782
6792
  export function deleteToken(
@@ -6787,8 +6797,8 @@ declare namespace chrome {
6787
6797
  /**
6788
6798
  * Retrieves the time when the InstanceID has been generated.
6789
6799
  *
6800
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
6790
6801
  * @return The time when the Instance ID has been generated, represented in milliseconds since the epoch.
6791
- * It can return via a callback or asynchronously, with a Promise (MV3 only).
6792
6802
  */
6793
6803
  export function getCreationTime(): Promise<number>;
6794
6804
  export function getCreationTime(callback: (creationTime: number) => void): void;
@@ -6797,29 +6807,40 @@ declare namespace chrome {
6797
6807
  * Retrieves an identifier for the app instance.
6798
6808
  * The same ID will be returned as long as the application identity has not been revoked or expired.
6799
6809
  *
6800
- * @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.
6801
6812
  */
6802
6813
  export function getID(): Promise<string>;
6803
6814
  export function getID(callback: (instanceID: string) => void): void;
6804
6815
 
6805
- interface GetTokenParams extends DeleteTokenParams {
6816
+ /** Parameters for {@link getToken}. */
6817
+ interface GetTokenParams {
6806
6818
  /**
6807
- * Allows including a small number of string key/value pairs that will be associated with the token
6808
- * and may be used in processing the request.
6809
- *
6810
- * @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.
6811
6826
  */
6812
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;
6813
6833
  }
6814
6834
  /**
6815
6835
  * Return a token that allows the authorized entity to access the service defined by scope.
6816
6836
  *
6817
- * @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.
6818
6839
  */
6819
6840
  export function getToken(getTokenParams: GetTokenParams): Promise<string>;
6820
6841
  export function getToken(getTokenParams: GetTokenParams, callback: (token: string) => void): void;
6821
6842
 
6822
- export var onTokenRefresh: TokenRefreshEvent;
6843
+ export const onTokenRefresh: events.Event<() => void>;
6823
6844
  }
6824
6845
 
6825
6846
  ////////////////////
@@ -7375,23 +7396,23 @@ declare namespace chrome {
7375
7396
  export enum Reason {
7376
7397
  /** A reason used for testing purposes only. */
7377
7398
  TESTING = "TESTING",
7378
- /** The offscreen document is responsible for playing audio. */
7399
+ /** Specifies that the offscreen document is responsible for playing audio. */
7379
7400
  AUDIO_PLAYBACK = "AUDIO_PLAYBACK",
7380
- /** 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. */
7381
7402
  IFRAME_SCRIPTING = "IFRAME_SCRIPTING",
7382
- /** 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. */
7383
7404
  DOM_SCRAPING = "DOM_SCRAPING",
7384
- /** 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()`). */
7385
7406
  BLOBS = "BLOBS",
7386
- /** The offscreen document needs to use the DOMParser API. */
7407
+ /** Specifies that the offscreen document needs to use the DOMParser API. */
7387
7408
  DOM_PARSER = "DOM_PARSER",
7388
- /** 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()`). */
7389
7410
  USER_MEDIA = "USER_MEDIA",
7390
- /** 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()`). */
7391
7412
  DISPLAY_MEDIA = "DISPLAY_MEDIA",
7392
- /** The offscreen document needs to use WebRTC APIs. */
7413
+ /** Specifies that the offscreen document needs to use WebRTC APIs. */
7393
7414
  WEB_RTC = "WEB_RTC",
7394
- /** 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. */
7395
7416
  CLIPBOARD = "CLIPBOARD",
7396
7417
  /** Specifies that the offscreen document needs access to localStorage. */
7397
7418
  LOCAL_STORAGE = "LOCAL_STORAGE",
@@ -7405,7 +7426,6 @@ declare namespace chrome {
7405
7426
  GEOLOCATION = "GEOLOCATION",
7406
7427
  }
7407
7428
 
7408
- /** The parameters describing the offscreen document to create. */
7409
7429
  export interface CreateParameters {
7410
7430
  /** The reason(s) the extension is creating the offscreen document. */
7411
7431
  reasons: `${Reason}`[];
@@ -7418,36 +7438,26 @@ declare namespace chrome {
7418
7438
  /**
7419
7439
  * Creates a new offscreen document for the extension.
7420
7440
  * @param parameters The parameters describing the offscreen document to create.
7421
- * @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.
7422
7443
  */
7423
7444
  export function createDocument(parameters: CreateParameters): Promise<void>;
7424
- /**
7425
- * Creates a new offscreen document for the extension.
7426
- * @param parameters The parameters describing the offscreen document to create.
7427
- * @param callback Invoked when the offscreen document is created and has completed its initial page load.
7428
- */
7429
7445
  export function createDocument(parameters: CreateParameters, callback: () => void): void;
7430
7446
 
7431
7447
  /**
7432
7448
  * Closes the currently-open offscreen document for the extension.
7433
- * @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.
7434
7451
  */
7435
7452
  export function closeDocument(): Promise<void>;
7436
- /**
7437
- * Closes the currently-open offscreen document for the extension.
7438
- * @param callback Invoked when the offscreen document has been closed.
7439
- */
7440
7453
  export function closeDocument(callback: () => void): void;
7441
7454
 
7442
7455
  /**
7443
7456
  * Determines whether the extension has an active document.
7444
- * @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.
7445
7459
  */
7446
7460
  export function hasDocument(): Promise<boolean>;
7447
- /**
7448
- * Determines whether the extension has an active document.
7449
- * @param callback Invoked with the result of whether the extension has an active offscreen document.
7450
- */
7451
7461
  export function hasDocument(callback: (result: boolean) => void): void;
7452
7462
  }
7453
7463
 
@@ -7473,47 +7483,60 @@ declare namespace chrome {
7473
7483
  deletable?: boolean | undefined;
7474
7484
  }
7475
7485
 
7476
- export interface Suggestion {
7486
+ /** A suggest result. */
7487
+ export interface DefaultSuggestResult {
7477
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. */
7478
7489
  description: string;
7479
7490
  }
7480
7491
 
7481
- /** The window disposition for the omnibox query. This is the recommended context to display results. */
7482
- export type OnInputEnteredDisposition = "currentTab" | "newForegroundTab" | "newBackgroundTab";
7483
-
7484
- export interface OmniboxInputEnteredEvent
7485
- extends chrome.events.Event<(text: string, disposition: OnInputEnteredDisposition) => void>
7486
- {}
7487
-
7488
- export interface OmniboxInputChangedEvent
7489
- extends chrome.events.Event<(text: string, suggest: (suggestResults: SuggestResult[]) => void) => void>
7490
- {}
7491
-
7492
- export interface OmniboxInputStartedEvent extends chrome.events.Event<() => void> {}
7493
-
7494
- 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
+ }
7495
7501
 
7496
- 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
+ }
7497
7511
 
7498
7512
  /**
7499
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
7500
7516
  * @param suggestion A partial SuggestResult object, without the 'content' parameter.
7501
7517
  */
7502
- export function setDefaultSuggestion(suggestion: Suggestion): void;
7518
+ export function setDefaultSuggestion(suggestion: DefaultSuggestResult): Promise<void>;
7519
+ export function setDefaultSuggestion(suggestion: DefaultSuggestResult, callback: () => void): void;
7503
7520
 
7504
7521
  /** User has accepted what is typed into the omnibox. */
7505
- export var onInputEntered: OmniboxInputEnteredEvent;
7522
+ export const onInputEntered: events.Event<(text: string, disposition: `${OnInputEnteredDisposition}`) => void>;
7523
+
7506
7524
  /** User has changed what is typed into the omnibox. */
7507
- export var onInputChanged: OmniboxInputChangedEvent;
7525
+ export const onInputChanged: events.Event<
7526
+ (text: string, suggest: (suggestResults: SuggestResult[]) => void) => void
7527
+ >;
7528
+
7508
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. */
7509
- export var onInputStarted: OmniboxInputStartedEvent;
7530
+ export const onInputStarted: events.Event<() => void>;
7531
+
7510
7532
  /** User has ended the keyword input session without accepting the input. */
7511
- export var onInputCancelled: OmniboxInputCancelledEvent;
7533
+ export const onInputCancelled: events.Event<() => void>;
7534
+
7512
7535
  /**
7513
7536
  * User has deleted a suggested result
7514
7537
  * @since Chrome 63
7515
7538
  */
7516
- export var onDeleteSuggestion: OmniboxSuggestionDeletedEvent;
7539
+ export const onDeleteSuggestion: events.Event<(text: string) => void>;
7517
7540
  }
7518
7541
 
7519
7542
  ////////////////////
@@ -8400,58 +8423,74 @@ declare namespace chrome {
8400
8423
  * Permissions: "proxy"
8401
8424
  */
8402
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
+
8403
8440
  /** An object holding proxy auto-config information. Exactly one of the fields should be non-empty. */
8404
8441
  export interface PacScript {
8405
- /** Optional. URL of the PAC file to be used. */
8442
+ /** URL of the PAC file to be used. */
8406
8443
  url?: string | undefined;
8407
- /** 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. */
8408
8445
  mandatory?: boolean | undefined;
8409
- /** Optional. A PAC script. */
8446
+ /** A PAC script. */
8410
8447
  data?: string | undefined;
8411
8448
  }
8412
8449
 
8413
8450
  /** An object encapsulating a complete proxy configuration. */
8414
8451
  export interface ProxyConfig {
8415
- /** 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. */
8416
8453
  rules?: ProxyRules | undefined;
8417
- /** 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. */
8418
8455
  pacScript?: PacScript | undefined;
8419
- /**
8420
- * 'direct' = Never use a proxy
8421
- * 'auto_detect' = Auto detect proxy settings
8422
- * 'pac_script' = Use specified PAC script
8423
- * 'fixed_servers' = Manually specify proxy servers
8424
- * 'system' = Use system proxy settings
8425
- */
8426
- mode: string;
8456
+ mode: `${Mode}`;
8427
8457
  }
8428
8458
 
8429
8459
  /** An object encapsulating a single proxy server's specification. */
8430
8460
  export interface ProxyServer {
8431
- /** 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. */
8432
8462
  host: string;
8433
- /** Optional. The scheme (protocol) of the proxy server itself. Defaults to 'http'. */
8434
- scheme?: string | undefined;
8435
- /** 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. */
8436
8466
  port?: number | undefined;
8437
8467
  }
8438
8468
 
8439
8469
  /** An object encapsulating the set of proxy rules for all protocols. Use either 'singleProxy' or (a subset of) 'proxyForHttp', 'proxyForHttps', 'proxyForFtp' and 'fallbackProxy'. */
8440
8470
  export interface ProxyRules {
8441
- /** Optional. The proxy server to be used for FTP requests. */
8471
+ /** The proxy server to be used for FTP requests. */
8442
8472
  proxyForFtp?: ProxyServer | undefined;
8443
- /** Optional. The proxy server to be used for HTTP requests. */
8473
+ /** The proxy server to be used for HTTP requests. */
8444
8474
  proxyForHttp?: ProxyServer | undefined;
8445
- /** 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. */
8446
8476
  fallbackProxy?: ProxyServer | undefined;
8447
- /** 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). */
8448
8478
  singleProxy?: ProxyServer | undefined;
8449
- /** Optional. The proxy server to be used for HTTPS requests. */
8479
+ /** The proxy server to be used for HTTPS requests. */
8450
8480
  proxyForHttps?: ProxyServer | undefined;
8451
- /** Optional. List of servers to connect to without a proxy server. */
8481
+ /** List of servers to connect to without a proxy server. */
8452
8482
  bypassList?: string[] | undefined;
8453
8483
  }
8454
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
+
8455
8494
  export interface ErrorDetails {
8456
8495
  /** Additional details about the error such as a JavaScript runtime error. */
8457
8496
  details: string;
@@ -8461,11 +8500,11 @@ declare namespace chrome {
8461
8500
  fatal: boolean;
8462
8501
  }
8463
8502
 
8464
- 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>;
8465
8505
 
8466
- export var settings: chrome.types.ChromeSetting<ProxyConfig>;
8467
8506
  /** Notifies about proxy errors. */
8468
- export var onProxyError: ProxyErrorEvent;
8507
+ export const onProxyError: events.Event<(details: ErrorDetails) => void>;
8469
8508
  }
8470
8509
 
8471
8510
  ////////////////////
@@ -8588,29 +8627,42 @@ declare namespace chrome {
8588
8627
  * @since Chrome 87
8589
8628
  */
8590
8629
  export namespace search {
8591
- export type Disposition = "CURRENT_TAB" | "NEW_TAB" | "NEW_WINDOW";
8592
-
8593
- export interface QueryInfo {
8594
- /** Location where search results should be displayed. CURRENT_TAB is the default. */
8595
- disposition?: Disposition | undefined;
8596
- /** Location where search results should be displayed. tabIdcannot be used with disposition. */
8597
- tabId?: number | undefined;
8598
- /** String to query with the default search provider. */
8599
- text?: string | undefined;
8630
+ export enum Disposition {
8631
+ /** Specifies that the search results display in the calling tab or the tab from the active browser. */
8632
+ CURRENT_TAB = "CURRENT_TAB",
8633
+ /** Specifies that the search results display in a new tab. */
8634
+ NEW_TAB = "NEW_TAB",
8635
+ /** Specifies that the search results display in a new window. */
8636
+ NEW_WINDOW = "NEW_WINDOW",
8600
8637
  }
8601
8638
 
8602
- /**
8603
- * Used to query the default search provider. In case of an error, runtime.lastError will be set.
8604
- * @param options search configuration options.
8605
- */
8606
- export function query(options: QueryInfo, callback: () => void): void;
8639
+ export type QueryInfo =
8640
+ & {
8641
+ /** String to query with the default search provider. */
8642
+ text?: string | undefined;
8643
+ }
8644
+ & (
8645
+ | {
8646
+ /** Location where search results should be displayed. `CURRENT_TAB` is the default. */
8647
+ disposition?: `${Disposition}` | undefined;
8648
+ /** Location where search results should be displayed. `tabId` cannot be used with `disposition`. */
8649
+ tabId?: undefined;
8650
+ }
8651
+ | {
8652
+ /** Location where search results should be displayed. `CURRENT_TAB` is the default. */
8653
+ disposition?: undefined;
8654
+ /** Location where search results should be displayed. `tabId` cannot be used with `disposition`. */
8655
+ tabId?: number | undefined;
8656
+ }
8657
+ );
8607
8658
 
8608
8659
  /**
8609
- * Used to query the default search provider. In case of an error, runtime.lastError will be set.
8610
- * @param options search configuration options.
8611
- * @return The `query` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
8660
+ * Used to query the default search provider. In case of an error, {@link runtime.lastError} will be set.
8661
+ *
8662
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
8612
8663
  */
8613
8664
  export function query(options: QueryInfo): Promise<void>;
8665
+ export function query(options: QueryInfo, callback: () => void): void;
8614
8666
  }
8615
8667
 
8616
8668
  ////////////////////
@@ -11109,6 +11161,11 @@ declare namespace chrome {
11109
11161
  autoDiscardable?: boolean | undefined;
11110
11162
  /** Whether the tabs are pinned. */
11111
11163
  pinned?: boolean | undefined;
11164
+ /**
11165
+ * 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.
11166
+ * @since Chrome 140
11167
+ */
11168
+ splitViewId?: number | undefined;
11112
11169
  /**
11113
11170
  * Whether the tabs are audible.
11114
11171
  * @since Chrome 45
@@ -11172,6 +11229,11 @@ declare namespace chrome {
11172
11229
  mutedInfo?: MutedInfo;
11173
11230
  /** The tab's new pinned state. */
11174
11231
  pinned?: boolean;
11232
+ /**
11233
+ * The tab's new Split View.
11234
+ * @since Chrome 140
11235
+ */
11236
+ splitViewId?: number;
11175
11237
  /** The tab's loading status. */
11176
11238
  status?: `${TabStatus}`;
11177
11239
  /**
@@ -13528,39 +13590,40 @@ declare namespace chrome {
13528
13590
  }
13529
13591
 
13530
13592
  export interface RequestDetails {
13531
- /** 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.
13532
- * 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.
13533
- * Frame IDs are unique within a tab.
13593
+ /**
13594
+ * The unique identifier for the frame's document, if this request is for a frame.
13595
+ * @since Chrome 106
13596
+ */
13597
+ documentId?: string | undefined;
13598
+ /**
13599
+ * The lifecycle of the frame's document, if this request is for a frame.
13600
+ * @since Chrome 106
13534
13601
  */
13602
+ documentLifecycle?: extensionTypes.DocumentLifecycle | undefined;
13603
+ /** 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. */
13535
13604
  frameId: number;
13536
-
13537
- /** The origin where the request was initiated.
13538
- * This does not change through redirects.
13539
- * If this is an opaque origin, the string 'null' will be used.
13605
+ /**
13606
+ * The type of the frame, if this request is for a frame.
13607
+ * @since Chrome 106
13540
13608
  */
13609
+ frameType?: extensionTypes.FrameType | undefined;
13610
+ /** 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. */
13541
13611
  initiator?: string | undefined;
13542
-
13543
13612
  /** Standard HTTP method. */
13544
13613
  method: string;
13545
-
13546
- /** ID of frame that wraps the frame which sent the request.
13547
- * Set to -1 if no parent frame exists.
13548
- */
13549
- partentFrameId: number;
13550
-
13551
- /** The ID of the request.
13552
- * Request IDs are unique within a browser session.
13614
+ /**
13615
+ * The unique identifier for the frame's parent document, if this request is for a frame and has a parent.
13616
+ * @since Chrome 106
13553
13617
  */
13618
+ parentDocumentId?: string | undefined;
13619
+ /** ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists. */
13620
+ parentFrameId: number;
13621
+ /** The ID of the request. Request IDs are unique within a browser session. */
13554
13622
  requestId: string;
13555
-
13556
- /** The ID of the tab in which the request takes place.
13557
- * Set to -1 if the request isn't related to a tab.
13558
- */
13623
+ /** The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab. */
13559
13624
  tabId: number;
13560
-
13561
13625
  /** The resource type of the request. */
13562
13626
  type: `${ResourceType}`;
13563
-
13564
13627
  /** The URL of the request. */
13565
13628
  url: string;
13566
13629
  }
@@ -13568,38 +13631,27 @@ declare namespace chrome {
13568
13631
  export interface Rule {
13569
13632
  /** The action to take if this rule is matched. */
13570
13633
  action: RuleAction;
13571
-
13572
13634
  /** The condition under which this rule is triggered. */
13573
13635
  condition: RuleCondition;
13574
-
13575
- /** An id which uniquely identifies a rule.
13576
- * Mandatory and should be >= 1.
13577
- */
13636
+ /** An id which uniquely identifies a rule. Mandatory and should be >= 1. */
13578
13637
  id: number;
13579
-
13580
- /** Rule priority.
13581
- * Defaults to 1.
13582
- * When specified, should be >= 1.
13583
- */
13638
+ /** Rule priority. Defaults to 1. When specified, should be >= 1. */
13584
13639
  priority?: number | undefined;
13585
13640
  }
13586
13641
 
13587
13642
  export interface RuleAction {
13588
- /** Describes how the redirect should be performed.
13589
- * Only valid for redirect rules.
13590
- */
13643
+ /** Describes how the redirect should be performed. Only valid for redirect rules. */
13591
13644
  redirect?: Redirect | undefined;
13592
-
13593
- /** The request headers to modify for the request.
13594
- * Only valid if RuleActionType is "modifyHeaders".
13645
+ /**
13646
+ * The request headers to modify for the request. Only valid if RuleActionType is "modifyHeaders".
13647
+ * @since Chrome 86
13595
13648
  */
13596
13649
  requestHeaders?: ModifyHeaderInfo[] | undefined;
13597
-
13598
- /** The response headers to modify for the request.
13599
- * Only valid if RuleActionType is "modifyHeaders".
13650
+ /**
13651
+ * The response headers to modify for the request. Only valid if RuleActionType is "modifyHeaders".
13652
+ * @since Chrome 86
13600
13653
  */
13601
13654
  responseHeaders?: ModifyHeaderInfo[] | undefined;
13602
-
13603
13655
  /** The type of action to perform. */
13604
13656
  type: `${RuleActionType}`;
13605
13657
  }
@@ -13612,37 +13664,19 @@ declare namespace chrome {
13612
13664
  domainType?: `${DomainType}` | undefined;
13613
13665
 
13614
13666
  /**
13615
- * @deprecated since Chrome 101. Use initiatorDomains instead.
13616
-
13617
- * The rule will only match network requests originating from the list of domains.
13618
- * If the list is omitted, the rule is applied to requests from all domains.
13619
- * An empty list is not allowed.
13620
- *
13621
- * Notes:
13622
- * Sub-domains like "a.example.com" are also allowed.
13623
- * The entries must consist of only ascii characters.
13624
- * Use punycode encoding for internationalized domains.
13625
- * This matches against the request initiator and not the request url.
13626
- */
13667
+ * The rule will only match network requests originating from the list of `domains`.
13668
+ * @deprecated since Chrome 101. Use {@link initiatorDomains} instead
13669
+ */
13627
13670
  domains?: string[] | undefined;
13628
13671
 
13629
13672
  /**
13630
- * @deprecated since Chrome 101. Use excludedInitiatorDomains instead
13631
- *
13632
- * The rule will not match network requests originating from the list of excludedDomains.
13633
- * If the list is empty or omitted, no domains are excluded.
13634
- * This takes precedence over domains.
13635
- *
13636
- * Notes:
13637
- * Sub-domains like "a.example.com" are also allowed.
13638
- * The entries must consist of only ascii characters.
13639
- * Use punycode encoding for internationalized domains.
13640
- * This matches against the request initiator and not the request url.
13673
+ * The rule will not match network requests originating from the list of `excludedDomains`.
13674
+ * @deprecated since Chrome 101. Use {@link excludedInitiatorDomains} instead
13641
13675
  */
13642
13676
  excludedDomains?: string[] | undefined;
13643
13677
 
13644
13678
  /**
13645
- * The rule will only match network requests originating from the list of initiatorDomains.
13679
+ * The rule will only match network requests originating from the list of `initiatorDomains`.
13646
13680
  * If the list is omitted, the rule is applied to requests from all domains.
13647
13681
  * An empty list is not allowed.
13648
13682
  *
@@ -13651,24 +13685,26 @@ declare namespace chrome {
13651
13685
  * The entries must consist of only ascii characters.
13652
13686
  * Use punycode encoding for internationalized domains.
13653
13687
  * This matches against the request initiator and not the request url.
13688
+ * @since Chrome 101
13654
13689
  */
13655
13690
  initiatorDomains?: string[] | undefined;
13656
13691
 
13657
13692
  /**
13658
- * The rule will not match network requests originating from the list of excludedInitiatorDomains.
13693
+ * The rule will not match network requests originating from the list of `excludedInitiatorDomains`.
13659
13694
  * If the list is empty or omitted, no domains are excluded.
13660
- * This takes precedence over initiatorDomains.
13695
+ * This takes precedence over `initiatorDomains`.
13661
13696
  *
13662
13697
  * Notes:
13663
13698
  * Sub-domains like "a.example.com" are also allowed.
13664
13699
  * The entries must consist of only ascii characters.
13665
13700
  * Use punycode encoding for internationalized domains.
13666
13701
  * This matches against the request initiator and not the request url.
13702
+ * @since Chrome 101
13667
13703
  */
13668
13704
  excludedInitiatorDomains?: string[] | undefined;
13669
13705
 
13670
13706
  /**
13671
- * The rule will only match network requests when the domain matches one from the list of requestDomains.
13707
+ * The rule will only match network requests when the domain matches one from the list of `requestDomains`.
13672
13708
  * If the list is omitted, the rule is applied to requests from all domains.
13673
13709
  * An empty list is not allowed.
13674
13710
  *
@@ -13676,71 +13712,72 @@ declare namespace chrome {
13676
13712
  * Sub-domains like "a.example.com" are also allowed.
13677
13713
  * The entries must consist of only ascii characters.
13678
13714
  * Use punycode encoding for internationalized domains.
13715
+ * @since Chrome 101
13679
13716
  */
13680
13717
  requestDomains?: string[] | undefined;
13681
13718
 
13682
13719
  /**
13683
- * The rule will not match network requests when the domains matches one from the list of excludedRequestDomains.
13720
+ * The rule will not match network requests when the domains matches one from the list of `excludedRequestDomains`.
13684
13721
  * If the list is empty or omitted, no domains are excluded.
13685
- * This takes precedence over requestDomains.
13722
+ * This takes precedence over `requestDomains`.
13686
13723
  *
13687
13724
  * Notes:
13688
13725
  * Sub-domains like "a.example.com" are also allowed.
13689
13726
  * The entries must consist of only ascii characters.
13690
13727
  * Use punycode encoding for internationalized domains.
13728
+ * @since Chrome 101
13691
13729
  */
13692
13730
  excludedRequestDomains?: string[] | undefined;
13693
13731
 
13694
13732
  /**
13695
13733
  * List of request methods which the rule won't match.
13696
- * Only one of requestMethods and excludedRequestMethods should be specified.
13734
+ * Only one of `requestMethods` and `excludedRequestMethods` should be specified.
13697
13735
  * If neither of them is specified, all request methods are matched.
13736
+ * @since Chrome 91
13698
13737
  */
13699
13738
  excludedRequestMethods?: `${RequestMethod}`[] | undefined;
13700
13739
 
13701
13740
  /**
13702
13741
  * List of resource types which the rule won't match.
13703
- * Only one of {@link chrome.declarativeNetRequest.RuleCondition.resourceTypes}
13704
- * and {@link chrome.declarativeNetRequest.RuleCondition.excludedResourceTypes} should be specified.
13742
+ * Only one of `resourceTypes` and `excludedResourceTypes` should be specified.
13705
13743
  * If neither of them is specified, all resource types except "main_frame" are blocked.
13706
13744
  */
13707
13745
  excludedResourceTypes?: `${ResourceType}`[] | undefined;
13708
13746
 
13709
13747
  /**
13710
- * List of {@link chrome.tabs.Tab.id} which the rule should not match.
13711
- * An ID of {@link chrome.tabs.TAB_ID_NONE} excludes requests which don't originate from a tab.
13748
+ * List of {@link tabs.Tab.id} which the rule should not match.
13749
+ * An ID of {@link tabs.TAB_ID_NONE} excludes requests which don't originate from a tab.
13712
13750
  * Only supported for session-scoped rules.
13751
+ * @since Chrome 92
13713
13752
  */
13714
13753
  excludedTabIds?: number[] | undefined;
13715
13754
 
13716
- /**
13717
- * Whether the urlFilter or regexFilter (whichever is specified) is case sensitive.
13718
- * @default false Before Chrome 118 the default was true.
13719
- */
13755
+ /** Whether the `urlFilter` or `regexFilter` (whichever is specified) is case sensitive. Default is false. */
13720
13756
  isUrlFilterCaseSensitive?: boolean | undefined;
13721
13757
 
13722
13758
  /**
13723
13759
  * Regular expression to match against the network request url.
13724
13760
  * This follows the RE2 syntax.
13725
13761
  *
13726
- * Note: Only one of urlFilter or regexFilter can be specified.
13762
+ * Note: Only one of `urlFilter` or `regexFilter` can be specified.
13727
13763
  *
13728
- * Note: The regexFilter must be composed of only ASCII characters.
13764
+ * Note: The `regexFilter` must be composed of only ASCII characters.
13729
13765
  * 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.
13730
13766
  */
13731
13767
  regexFilter?: string | undefined;
13732
13768
 
13733
13769
  /**
13734
13770
  * List of HTTP request methods which the rule can match. An empty list is not allowed.
13735
- * Note: Specifying a {@link chrome.declarativeNetRequest.RuleCondition.requestMethods} rule condition will also exclude non-HTTP(s) requests,
13736
- * whereas specifying {@link chrome.declarativeNetRequest.RuleCondition.excludedRequestMethods} will not.
13771
+ *
13772
+ * Note: Specifying a `requestMethods` rule condition will also exclude non-HTTP(s) requests, whereas specifying `excludedRequestMethods` will not.
13737
13773
  */
13738
13774
  requestMethods?: `${RequestMethod}`[] | undefined;
13739
13775
 
13740
13776
  /**
13741
- * List of {@link chrome.tabs.Tab.id} which the rule should not match.
13742
- * An ID of {@link chrome.tabs.TAB_ID_NONE} excludes requests which don't originate from a tab.
13777
+ * List of {@link tabs.Tab.id} which the rule should not match.
13778
+ * An ID of {@link tabs.TAB_ID_NONE} matches requests which don't originate from a tab.
13743
13779
  * An empty list is not allowed. Only supported for session-scoped rules.
13780
+ * @since Chrome 92
13744
13781
  */
13745
13782
  tabIds?: number[] | undefined;
13746
13783
 
@@ -13757,17 +13794,17 @@ declare namespace chrome {
13757
13794
  * '^' : Separator character: This matches anything except a letter, a digit or one of the following: _ - . %.
13758
13795
  * This can also match the end of the URL.
13759
13796
  *
13760
- * Therefore urlFilter is composed of the following parts: (optional Left/Domain name anchor) + pattern + (optional Right anchor).
13797
+ * Therefore `urlFilter` is composed of the following parts: (optional Left/Domain name anchor) + pattern + (optional Right anchor).
13761
13798
  *
13762
13799
  * If omitted, all urls are matched. An empty string is not allowed.
13763
13800
  *
13764
13801
  * A pattern beginning with || is not allowed. Use instead.
13765
13802
  *
13766
- * Note: Only one of urlFilter or regexFilter can be specified.
13803
+ * Note: Only one of `urlFilter` or `regexFilter` can be specified.
13767
13804
  *
13768
- * Note: The urlFilter must be composed of only ASCII characters.
13805
+ * Note: The `urlFilter` must be composed of only ASCII characters.
13769
13806
  * 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.
13770
- * 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.
13807
+ * 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.
13771
13808
  */
13772
13809
  urlFilter?: string | undefined;
13773
13810
 
@@ -13775,7 +13812,7 @@ declare namespace chrome {
13775
13812
  * List of resource types which the rule can match.
13776
13813
  * An empty list is not allowed.
13777
13814
  *
13778
- * Note: this must be specified for allowAllRequests rules and may only include the sub_frame and main_frame resource types.
13815
+ * Note: this must be specified for `allowAllRequests` rules and may only include the `sub_frame` and `main_frame` resource types.
13779
13816
  */
13780
13817
  resourceTypes?: `${ResourceType}`[] | undefined;
13781
13818
 
@@ -13795,32 +13832,22 @@ declare namespace chrome {
13795
13832
  export interface MatchedRule {
13796
13833
  /** A matching rule's ID. */
13797
13834
  ruleId: number;
13798
-
13799
- /** ID of the Ruleset this rule belongs to.
13800
- * For a rule originating from the set of dynamic rules, this will be equal to DYNAMIC_RULESET_ID.
13801
- */
13835
+ /** 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}. */
13802
13836
  rulesetId: string;
13803
13837
  }
13804
13838
 
13805
13839
  export interface MatchedRuleInfo {
13806
13840
  rule: MatchedRule;
13807
-
13808
13841
  /** The tabId of the tab from which the request originated if the tab is still active. Else -1. */
13809
13842
  tabId: number;
13810
-
13811
- /** The time the rule was matched.
13812
- * Timestamps will correspond to the Javascript convention for times, i.e. number of milliseconds since the epoch.
13813
- */
13843
+ /** The time the rule was matched. Timestamps will correspond to the Javascript convention for times, i.e. number of milliseconds since the epoch. */
13814
13844
  timeStamp: number;
13815
13845
  }
13816
13846
 
13817
13847
  export interface MatchedRulesFilter {
13818
13848
  /** If specified, only matches rules after the given timestamp. */
13819
13849
  minTimeStamp?: number | undefined;
13820
-
13821
- /** If specified, only matches rules for the given tab.
13822
- * Matches rules not associated with any active tab if set to -1.
13823
- */
13850
+ /** If specified, only matches rules for the given tab. Matches rules not associated with any active tab if set to -1. */
13824
13851
  tabId?: number | undefined;
13825
13852
  }
13826
13853
 
@@ -13842,142 +13869,122 @@ declare namespace chrome {
13842
13869
  values?: string[];
13843
13870
  }
13844
13871
 
13872
+ /** @since Chrome 86 */
13845
13873
  export interface ModifyHeaderInfo {
13846
13874
  /** The name of the header to be modified. */
13847
13875
  header: string;
13848
-
13849
13876
  /** The operation to be performed on a header. */
13850
13877
  operation: `${HeaderOperation}`;
13851
-
13852
- /** The new value for the header.
13853
- * Must be specified for append and set operations.
13854
- */
13878
+ /** The new value for the header. Must be specified for `append` and `set` operations. */
13855
13879
  value?: string | undefined;
13856
13880
  }
13857
13881
 
13858
13882
  export interface QueryKeyValue {
13859
13883
  key: string;
13884
+ /**
13885
+ * 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.
13886
+ * @since Chrome 94
13887
+ */
13888
+ replaceOnly?: boolean | undefined;
13860
13889
  value: string;
13861
13890
  }
13862
13891
 
13863
13892
  export interface QueryTransform {
13864
13893
  /** The list of query key-value pairs to be added or replaced. */
13865
13894
  addOrReplaceParams?: QueryKeyValue[] | undefined;
13866
-
13867
13895
  /** The list of query keys to be removed. */
13868
13896
  removeParams?: string[] | undefined;
13869
13897
  }
13870
13898
 
13871
13899
  export interface URLTransform {
13872
- /** The new fragment for the request.
13873
- * Should be either empty, in which case the existing fragment is cleared; or should begin with '#'.
13874
- */
13900
+ /** The new fragment for the request. Should be either empty, in which case the existing fragment is cleared; or should begin with '#'. */
13875
13901
  fragment?: string | undefined;
13876
-
13877
13902
  /** The new host for the request. */
13878
13903
  host?: string | undefined;
13879
-
13880
13904
  /** The new password for the request. */
13881
13905
  password?: string | undefined;
13882
-
13883
- /** The new path for the request.
13884
- * If empty, the existing path is cleared.
13885
- */
13906
+ /** The new path for the request. If empty, the existing path is cleared. */
13886
13907
  path?: string | undefined;
13887
-
13888
- /** The new port for the request.
13889
- * If empty, the existing port is cleared.
13890
- */
13908
+ /** The new port for the request. If empty, the existing port is cleared. */
13891
13909
  port?: string | undefined;
13892
-
13893
- /** The new query for the request.
13894
- * Should be either empty, in which case the existing query is cleared; or should begin with '?'.
13895
- */
13910
+ /** The new query for the request. Should be either empty, in which case the existing query is cleared; or should begin with '?'. */
13896
13911
  query?: string | undefined;
13897
-
13898
13912
  /** Add, remove or replace query key-value pairs. */
13899
13913
  queryTransform?: QueryTransform | undefined;
13900
-
13901
- /** The new scheme for the request.
13902
- * Allowed values are "http", "https", "ftp" and "chrome-extension".
13903
- */
13914
+ /** The new scheme for the request. Allowed values are "http", "https", "ftp" and "chrome-extension". */
13904
13915
  scheme?: string | undefined;
13905
-
13906
13916
  /** The new username for the request. */
13907
13917
  username?: string | undefined;
13908
13918
  }
13909
13919
 
13920
+ /** @since Chrome 87 */
13910
13921
  export interface RegexOptions {
13911
- /** Whether the regex specified is case sensitive.
13912
- * Default is true.
13913
- */
13922
+ /** Whether the `regex` specified is case sensitive. Default is true. */
13914
13923
  isCaseSensitive?: boolean | undefined;
13915
-
13916
13924
  /** The regular expression to check. */
13917
13925
  regex: string;
13918
-
13919
- /** Whether the regex specified requires capturing.
13920
- * Capturing is only required for redirect rules which specify a regexSubstitution action.
13921
- * The default is false.
13922
- */
13926
+ /** Whether the `regex` specified requires capturing. Capturing is only required for redirect rules which specify a `regexSubstitution` action. The default is false. */
13923
13927
  requireCapturing?: boolean | undefined;
13924
13928
  }
13925
13929
 
13930
+ /** @since Chrome 87 */
13926
13931
  export interface IsRegexSupportedResult {
13927
13932
  isSupported: boolean;
13928
-
13929
- /** Specifies the reason why the regular expression is not supported.
13930
- * Only provided if isSupported is false.
13931
- */
13932
- reason?: `${UnsupportedRegexReason}` | undefined;
13933
+ /** Specifies the reason why the regular expression is not supported. Only provided if `isSupported` is false. */
13934
+ reason?: `${UnsupportedRegexReason}`;
13933
13935
  }
13934
13936
 
13937
+ /** @since Chrome 89 */
13935
13938
  export interface TabActionCountUpdate {
13936
- /** The amount to increment the tab's action count by.
13937
- * Negative values will decrement the count
13938
- */
13939
+ /** The amount to increment the tab's action count by. Negative values will decrement the count. */
13939
13940
  increment: number;
13940
-
13941
13941
  /** The tab for which to update the action count. */
13942
13942
  tabId: number;
13943
13943
  }
13944
13944
 
13945
+ /** @since Chrome 88 */
13945
13946
  export interface ExtensionActionOptions {
13946
- /** Whether to automatically display the action count for a page as the extension's badge text.
13947
+ /**
13948
+ * Whether to automatically display the action count for a page as the extension's badge text.
13947
13949
  * This preference is persisted across sessions.
13948
13950
  */
13949
13951
  displayActionCountAsBadgeText?: boolean | undefined;
13950
-
13951
13952
  /** Details of how the tab's action count should be adjusted. */
13952
13953
  tabUpdate?: TabActionCountUpdate | undefined;
13953
13954
  }
13954
13955
 
13956
+ /** @since Chrome 111 */
13957
+ export interface GetDisabledRuleIdsOptions {
13958
+ /** The id corresponding to a static {@link Ruleset}. */
13959
+ rulesetId: string;
13960
+ }
13961
+
13962
+ /** @since Chrome 111 */
13963
+ export interface GetRulesFilter {
13964
+ /** If specified, only rules with matching IDs are included. */
13965
+ ruleIds?: number[] | undefined;
13966
+ }
13967
+
13955
13968
  export interface Redirect {
13956
- /** Path relative to the extension directory.
13957
- * Should start with '/'.
13958
- */
13969
+ /** Path relative to the extension directory. Should start with '/'. */
13959
13970
  extensionPath?: string | undefined;
13960
-
13961
- /** Substitution pattern for rules which specify a regexFilter.
13962
- * The first match of regexFilter within the url will be replaced with this pattern.
13963
- * Within regexSubstitution, backslash-escaped digits (\1 to \9) can be used to insert the corresponding capture groups.
13971
+ /**
13972
+ * Substitution pattern for rules which specify a `regexFilter`.
13973
+ * The first match of `regexFilter` within the url will be replaced with this pattern.
13974
+ * Within `regexSubstitution`, backslash-escaped digits (\1 to \9) can be used to insert the corresponding capture groups.
13964
13975
  * \0 refers to the entire matching text.
13965
13976
  */
13966
13977
  regexSubstitution?: string | undefined;
13967
-
13968
13978
  /** Url transformations to perform. */
13969
13979
  transform?: URLTransform | undefined;
13970
-
13971
- /** The redirect url.
13972
- * Redirects to JavaScript urls are not allowed.
13973
- */
13980
+ /** The redirect url. Redirects to JavaScript urls are not allowed. */
13974
13981
  url?: string | undefined;
13975
13982
  }
13976
13983
 
13984
+ /** @since Chrome 87 */
13977
13985
  export interface UpdateRuleOptions {
13978
13986
  /** Rules to add. */
13979
13987
  addRules?: Rule[] | undefined;
13980
-
13981
13988
  /**
13982
13989
  * IDs of the rules to remove.
13983
13990
  * Any invalid IDs will be ignored.
@@ -13985,41 +13992,35 @@ declare namespace chrome {
13985
13992
  removeRuleIds?: number[] | undefined;
13986
13993
  }
13987
13994
 
13995
+ /** @since Chrome 111 */
13988
13996
  export interface UpdateStaticRulesOptions {
13989
- /** Set of ids corresponding to rules in the Ruleset to disable. */
13997
+ /** Set of ids corresponding to rules in the {@link Ruleset} to disable. */
13990
13998
  disableRuleIds?: number[];
13991
-
13992
- /** Set of ids corresponding to rules in the Ruleset to enable. */
13999
+ /** Set of ids corresponding to rules in the {@link Ruleset} to enable. */
13993
14000
  enableRuleIds?: number[];
13994
-
13995
- /** The id corresponding to a static Ruleset. */
14001
+ /** The id corresponding to a static {@link Ruleset}. */
13996
14002
  rulesetId: string;
13997
14003
  }
13998
14004
 
14005
+ /** @since Chrome 87 */
13999
14006
  export interface UpdateRulesetOptions {
14000
- /** The set of ids corresponding to a static Ruleset that should be disabled. */
14007
+ /** The set of ids corresponding to a static {@link Ruleset} that should be disabled. */
14001
14008
  disableRulesetIds?: string[] | undefined;
14002
-
14003
- /** The set of ids corresponding to a static Ruleset that should be enabled. */
14009
+ /** The set of ids corresponding to a static {@link Ruleset} that should be enabled. */
14004
14010
  enableRulesetIds?: string[] | undefined;
14005
14011
  }
14006
14012
 
14007
14013
  export interface MatchedRuleInfoDebug {
14008
14014
  /** Details about the request for which the rule was matched. */
14009
14015
  request: RequestDetails;
14010
-
14011
14016
  rule: MatchedRule;
14012
14017
  }
14013
14018
 
14014
14019
  export interface Ruleset {
14015
14020
  /** Whether the ruleset is enabled by default. */
14016
14021
  enabled: boolean;
14017
-
14018
- /** A non-empty string uniquely identifying the ruleset.
14019
- * IDs beginning with '_' are reserved for internal use.
14020
- */
14022
+ /** A non-empty string uniquely identifying the ruleset. IDs beginning with '_' are reserved for internal use. */
14021
14023
  id: string;
14022
-
14023
14024
  /** The path of the JSON ruleset relative to the extension directory. */
14024
14025
  path: string;
14025
14026
  }
@@ -14054,112 +14055,96 @@ declare namespace chrome {
14054
14055
  url: string;
14055
14056
  }
14056
14057
 
14057
- /** Returns the number of static rules an extension can enable before the global static rule limit is reached. */
14058
- export function getAvailableStaticRuleCount(callback: (count: number) => void): void;
14059
-
14060
14058
  /**
14061
14059
  * Returns the number of static rules an extension can enable before the global static rule limit is reached.
14062
- * @return The `getAvailableStaticRuleCount` method provides its result via callback or returned as a `Promise` (MV3 only).
14060
+ *
14061
+ * Can return its result via Promise in Manifest V3 or later since Chrome 91.
14062
+ * @since Chrome 89
14063
14063
  */
14064
14064
  export function getAvailableStaticRuleCount(): Promise<number>;
14065
+ export function getAvailableStaticRuleCount(callback: (count: number) => void): void;
14065
14066
 
14066
- /** Returns the current set of dynamic rules for the extension.
14067
+ /**
14068
+ * Returns the list of static rules in the given {@link Ruleset} that are currently disabled.
14067
14069
  *
14068
- * @param callback Called with the set of dynamic rules.
14069
- * An error might be raised in case of transient internal errors.
14070
+ * Can return its result via Promise in Manifest V3.
14071
+ * @param options Specifies the ruleset to query.
14072
+ * @since Chrome 111
14070
14073
  */
14071
- export function getDynamicRules(callback: (rules: Rule[]) => void): void;
14074
+ export function getDisabledRuleIds(options: GetDisabledRuleIdsOptions): Promise<number[]>;
14075
+ export function getDisabledRuleIds(
14076
+ options: GetDisabledRuleIdsOptions,
14077
+ callback: (disabledRuleIds: number[]) => void,
14078
+ ): void;
14072
14079
 
14073
14080
  /**
14074
- * Returns the current set of dynamic rules for the extension.
14075
- * @return The `getDynamicRules` method provides its result via callback or returned as a `Promise` (MV3 only).
14076
- */
14077
- export function getDynamicRules(): Promise<Rule[]>;
14078
-
14079
- /** Returns the ids for the current set of enabled static rulesets.
14081
+ * Returns the current set of dynamic rules for the extension. Callers can optionally filter the list of fetched rules by specifying a `filter`.
14080
14082
  *
14081
- * @param callback Called with a list of ids, where each id corresponds to an enabled static Ruleset. */
14082
- export function getEnabledRulesets(callback: (rulesetIds: string[]) => void): void;
14083
+ * Can return its result via Promise in Manifest V3 or later since Chrome 91.
14084
+ * @param filter An object to filter the list of fetched rules.
14085
+ */
14086
+ export function getDynamicRules(filter?: GetRulesFilter): Promise<Rule[]>;
14087
+ export function getDynamicRules(callback: (rules: Rule[]) => void): void;
14088
+ export function getDynamicRules(filter: GetRulesFilter | undefined, callback: (rules: Rule[]) => void): void;
14083
14089
 
14084
14090
  /**
14085
14091
  * Returns the ids for the current set of enabled static rulesets.
14086
- * @return The `getEnabledRulesets` method provides its result via callback or returned as a `Promise` (MV3 only).
14092
+ *
14093
+ * Can return its result via Promise in Manifest V3 or later since Chrome 91.
14087
14094
  */
14088
14095
  export function getEnabledRulesets(): Promise<string[]>;
14096
+ export function getEnabledRulesets(callback: (rulesetIds: string[]) => void): void;
14089
14097
 
14090
- /** Returns all rules matched for the extension.
14091
- * Callers can optionally filter the list of matched rules by specifying a filter.
14092
- * This method is only available to extensions with the declarativeNetRequestFeedback permission or having the activeTab permission granted for the tabId specified in filter.
14093
- * Note: Rules not associated with an active document that were matched more than five minutes ago will not be returned.
14098
+ /**
14099
+ * 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.
14094
14100
  *
14101
+ * Can return its result via Promise in Manifest V3 or later since Chrome 91.
14095
14102
  * @param filter An object to filter the list of matched rules.
14096
- * @param callback Called once the list of matched rules has been fetched.
14097
- * In case of an error, runtime.lastError will be set and no rules will be returned.
14098
- * This can happen for multiple reasons, such as insufficient permissions, or exceeding the quota.
14099
14103
  */
14104
+ export function getMatchedRules(filter?: MatchedRulesFilter): Promise<RulesMatchedDetails>;
14105
+ export function getMatchedRules(callback: (details: RulesMatchedDetails) => void): void;
14100
14106
  export function getMatchedRules(
14101
14107
  filter: MatchedRulesFilter | undefined,
14102
14108
  callback: (details: RulesMatchedDetails) => void,
14103
14109
  ): void;
14104
14110
 
14105
14111
  /**
14106
- * Returns all rules matched for the extension.
14107
- * Callers can optionally filter the list of matched rules by specifying a filter.
14108
- * This method is only available to extensions with the declarativeNetRequestFeedback permission or having the activeTab permission granted for the tabId specified in filter.
14109
- * Note: Rules not associated with an active document that were matched more than five minutes ago will not be returned.
14112
+ * Returns the current set of session scoped rules for the extension. Callers can optionally filter the list of fetched rules by specifying a `filter`.
14110
14113
  *
14111
- * @param filter An object to filter the list of matched rules.
14112
- * @return The `getMatchedRules` method provides its result via callback or returned as a `Promise` (MV3 only).
14113
- */
14114
- export function getMatchedRules(filter: MatchedRulesFilter | undefined): Promise<RulesMatchedDetails>;
14115
-
14116
- export function getMatchedRules(callback: (details: RulesMatchedDetails) => void): void;
14117
-
14118
- export function getMatchedRules(): Promise<RulesMatchedDetails>;
14119
-
14120
- /** Returns the current set of session scoped rules for the extension.
14121
- *
14122
- * @param callback Called with the set of session scoped rules.
14114
+ * Can return its result via Promise in Manifest V3 or later since Chrome 91.
14115
+ * @param filter An object to filter the list of fetched rules.
14116
+ * @since Chrome 90
14123
14117
  */
14118
+ export function getSessionRules(filter?: GetRulesFilter): Promise<Rule[]>;
14124
14119
  export function getSessionRules(callback: (rules: Rule[]) => void): void;
14120
+ export function getSessionRules(filter: GetRulesFilter | undefined, callback: (rules: Rule[]) => void): void;
14125
14121
 
14126
14122
  /**
14127
- * Returns the current set of session scoped rules for the extension.
14128
- *
14129
- * @return The `getSessionRules` method provides its result via callback or returned as a `Promise` (MV3 only).
14130
- */
14131
- export function getSessionRules(): Promise<Rule[]>;
14132
-
14133
- /** Checks if the given regular expression will be supported as a regexFilter rule condition.
14123
+ * Checks if the given regular expression will be supported as a `regexFilter` rule condition.
14134
14124
  *
14125
+ * Can return its result via Promise in Manifest V3 or later since Chrome 91.
14135
14126
  * @param regexOptions The regular expression to check.
14136
- * @param callback Called with details consisting of whether the regular expression is supported and the
14137
- * reason if not.
14127
+ * @since Chrome 87
14138
14128
  */
14129
+ export function isRegexSupported(regexOptions: RegexOptions): Promise<IsRegexSupportedResult>;
14139
14130
  export function isRegexSupported(
14140
14131
  regexOptions: RegexOptions,
14141
14132
  callback: (result: IsRegexSupportedResult) => void,
14142
14133
  ): void;
14143
14134
 
14144
- /** Checks if the given regular expression will be supported as a regexFilter rule condition.
14145
- *
14146
- * @param regexOptions The regular expression to check.
14147
- * @return The `isRegexSupported` method provides its result via callback or returned as a `Promise` (MV3 only).
14148
- */
14149
- export function isRegexSupported(regexOptions: RegexOptions): Promise<IsRegexSupportedResult>;
14150
-
14151
- /** 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. */
14152
- export function setExtensionActionOptions(options: ExtensionActionOptions, callback: () => void): void;
14153
-
14154
14135
  /**
14155
14136
  * 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.
14156
- * @return The `setExtensionActionOptions` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
14137
+ *
14138
+ * Can return its result via Promise in Manifest V3 or later since Chrome 91.
14139
+ * @since Chrome 88
14157
14140
  */
14158
14141
  export function setExtensionActionOptions(options: ExtensionActionOptions): Promise<void>;
14142
+ export function setExtensionActionOptions(options: ExtensionActionOptions, callback: () => void): void;
14159
14143
 
14160
14144
  /**
14161
14145
  * 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.
14162
- * @param request
14146
+ *
14147
+ * Can return its result via Promise in Manifest V3.
14163
14148
  * @since Chrome 103
14164
14149
  */
14165
14150
  export function testMatchOutcome(request: TestMatchRequestDetails): Promise<TestMatchOutcomeResult>;
@@ -14168,101 +14153,52 @@ declare namespace chrome {
14168
14153
  callback: (result: TestMatchOutcomeResult) => void,
14169
14154
  ): void;
14170
14155
 
14171
- /** Modifies the current set of dynamic rules for the extension.
14172
- * The rules with IDs listed in options.removeRuleIds are first removed, and then the rules given in options.addRules are added.
14173
- *
14174
- * Notes:
14175
- * This update happens as a single atomic operation: either all specified rules are added and removed, or an error is returned.
14176
- * These rules are persisted across browser sessions and across extension updates.
14177
- * Static rules specified as part of the extension package can not be removed using this function.
14178
- * MAX_NUMBER_OF_DYNAMIC_AND_SESSION_RULES is the maximum number of combined dynamic and session rules an extension can add.
14179
- *
14180
- * @param callback Called once the update is complete or has failed.
14181
- * In case of an error, runtime.lastError will be set and no change will be made to the rule set.
14182
- * This can happen for multiple reasons, such as invalid rule format, duplicate rule ID, rule count limit exceeded, internal errors, and others.
14183
- */
14184
- export function updateDynamicRules(options: UpdateRuleOptions, callback: () => void): void;
14185
-
14186
- /** Modifies the current set of dynamic rules for the extension.
14187
- * The rules with IDs listed in options.removeRuleIds are first removed, and then the rules given in options.addRules are added.
14156
+ /**
14157
+ * 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:
14188
14158
  *
14189
- * Notes:
14190
- * This update happens as a single atomic operation: either all specified rules are added and removed, or an error is returned.
14191
- * These rules are persisted across browser sessions and across extension updates.
14192
- * Static rules specified as part of the extension package can not be removed using this function.
14193
- * MAX_NUMBER_OF_DYNAMIC_AND_SESSION_RULES is the maximum number of combined dynamic and session rules an extension can add.
14159
+ * * This update happens as a single atomic operation: either all specified rules are added and removed, or an error is returned.
14160
+ * * These rules are persisted across browser sessions and across extension updates.
14161
+ * * Static rules specified as part of the extension package can not be removed using this function.
14162
+ * * {@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}.
14194
14163
  *
14195
- * @return The `updateDynamicRules` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
14196
- * In case of an error, runtime.lastError will be set and no change will be made to the rule set.
14197
- * This can happen for multiple reasons, such as invalid rule format, duplicate rule ID, rule count limit exceeded, internal errors, and others.
14164
+ * Can return its result via Promise in Manifest V3 or later since Chrome 91.
14198
14165
  */
14199
14166
  export function updateDynamicRules(options: UpdateRuleOptions): Promise<void>;
14167
+ export function updateDynamicRules(options: UpdateRuleOptions, callback: () => void): void;
14200
14168
 
14201
- /** Updates the set of enabled static rulesets for the extension.
14202
- * The rulesets with IDs listed in options.disableRulesetIds are first removed, and then the rulesets listed in options.enableRulesetIds are added.
14203
- *
14204
- * 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.
14205
- *
14206
- * @param callback Called once the update is complete.
14207
- * In case of an error, runtime.lastError will be set and no change will be made to set of enabled rulesets.
14208
- * This can happen for multiple reasons, such as invalid ruleset IDs, rule count limit exceeded, or internal errors.
14209
- */
14210
- export function updateEnabledRulesets(options: UpdateRulesetOptions, callback: () => void): void;
14211
-
14212
- /** Updates the set of enabled static rulesets for the extension.
14213
- * The rulesets with IDs listed in options.disableRulesetIds are first removed, and then the rulesets listed in options.enableRulesetIds are added.
14214
- *
14215
- * 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.
14169
+ /**
14170
+ * 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.
14171
+ * 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.
14216
14172
  *
14217
- * @return The `updateEnabledRulesets` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
14218
- * In case of an error, runtime.lastError will be set and no change will be made to set of enabled rulesets.
14219
- * This can happen for multiple reasons, such as invalid ruleset IDs, rule count limit exceeded, or internal errors.
14173
+ * Can return its result via Promise in Manifest V3 or later since Chrome 91.
14220
14174
  */
14221
14175
  export function updateEnabledRulesets(options: UpdateRulesetOptions): Promise<void>;
14176
+ export function updateEnabledRulesets(options: UpdateRulesetOptions, callback: () => void): void;
14222
14177
 
14223
- /** Modifies the current set of session scoped rules for the extension.
14224
- * The rules with IDs listed in options.removeRuleIds are first removed, and then the rules given in options.addRules are added.
14225
- *
14226
- * Notes:
14227
- * This update happens as a single atomic operation: either all specified rules are added and removed, or an error is returned.
14228
- * These rules are not persisted across sessions and are backed in memory.
14229
- * MAX_NUMBER_OF_DYNAMIC_AND_SESSION_RULES is the maximum number of combined dynamic and session rules an extension can add.
14230
- *
14231
- * @param callback Called once the update is complete or has failed.
14232
- * In case of an error, runtime.lastError will be set and no change will be made to the rule set.
14233
- * This can happen for multiple reasons, such as invalid rule format, duplicate rule ID, rule count limit exceeded, and others.
14234
- */
14235
- export function updateSessionRules(options: UpdateRuleOptions, callback: () => void): void;
14236
-
14237
- /** Modifies the current set of session scoped rules for the extension.
14238
- * The rules with IDs listed in options.removeRuleIds are first removed, and then the rules given in options.addRules are added.
14178
+ /**
14179
+ * 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:
14239
14180
  *
14240
- * Notes:
14241
- * This update happens as a single atomic operation: either all specified rules are added and removed, or an error is returned.
14242
- * These rules are not persisted across sessions and are backed in memory.
14243
- * MAX_NUMBER_OF_DYNAMIC_AND_SESSION_RULES is the maximum number of combined dynamic and session rules an extension can add.
14181
+ * * This update happens as a single atomic operation: either all specified rules are added and removed, or an error is returned.
14182
+ * * These rules are not persisted across sessions and are backed in memory.
14183
+ * * {@link MAX_NUMBER_OF_SESSION_RULES} is the maximum number of session rules an extension can add.
14244
14184
  *
14245
- * @return The `updateSessionRules` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
14246
- * In case of an error, runtime.lastError will be set and no change will be made to the rule set.
14247
- * This can happen for multiple reasons, such as invalid rule format, duplicate rule ID, rule count limit exceeded, and others.
14185
+ * Can return its result via Promise in Manifest V3 or later since Chrome 91.
14186
+ * @since Chrome 90
14248
14187
  */
14249
14188
  export function updateSessionRules(options: UpdateRuleOptions): Promise<void>;
14189
+ export function updateSessionRules(options: UpdateRuleOptions, callback: () => void): void;
14250
14190
 
14251
- /** Disables and enables individual static rules in a Ruleset.
14252
- * Changes to rules belonging to a disabled Ruleset will take effect the next time that it becomes enabled.
14191
+ /**
14192
+ * 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.
14253
14193
  *
14254
- * @return The `updateStaticRules` method either calls a provided callback if its finished or returns as a `Promise` (MV3 only).
14194
+ * Can return its result via Promise in Manifest V3.
14255
14195
  * @since Chrome 111
14256
14196
  */
14257
14197
  export function updateStaticRules(options: UpdateStaticRulesOptions): Promise<void>;
14258
14198
  export function updateStaticRules(options: UpdateStaticRulesOptions, callback?: () => void): void;
14259
14199
 
14260
- /** The rule that has been matched along with information about the associated request. */
14261
- export interface RuleMatchedDebugEvent extends chrome.events.Event<(info: MatchedRuleInfoDebug) => void> {}
14262
-
14263
- /** Fired when a rule is matched with a request.
14264
- * Only available for unpacked extensions with the declarativeNetRequestFeedback permission as this is intended to be used for debugging purposes only. */
14265
- export var onRuleMatchedDebug: RuleMatchedDebugEvent;
14200
+ /** 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. */
14201
+ export const onRuleMatchedDebug: events.Event<(info: MatchedRuleInfoDebug) => void>;
14266
14202
  }
14267
14203
 
14268
14204
  ////////////////////
@@ -14313,6 +14249,11 @@ declare namespace chrome {
14313
14249
  openPanelOnActionClick?: boolean;
14314
14250
  }
14315
14251
 
14252
+ /** @since Chrome 140 */
14253
+ export interface PanelLayout {
14254
+ side: `${Side}`;
14255
+ }
14256
+
14316
14257
  export interface PanelOptions {
14317
14258
  /** Whether the side panel should be enabled. This is optional. The default value is true. */
14318
14259
  enabled?: boolean;
@@ -14326,11 +14267,27 @@ declare namespace chrome {
14326
14267
  tabId?: number;
14327
14268
  }
14328
14269
 
14270
+ /**
14271
+ * Defines the possible alignment for the side panel in the browser UI.
14272
+ * @since Chrome 140
14273
+ */
14274
+ export enum Side {
14275
+ LEFT = "left",
14276
+ RIGHT = "right",
14277
+ }
14278
+
14329
14279
  export interface SidePanel {
14330
14280
  /** Developer specified path for side panel display. */
14331
14281
  default_path: string;
14332
14282
  }
14333
14283
 
14284
+ /**
14285
+ * Returns the side panel's current layout.
14286
+ * @since Chrome 140
14287
+ */
14288
+ export function getLayout(): Promise<PanelLayout>;
14289
+ export function getLayout(callback: (layout: PanelLayout) => void): void;
14290
+
14334
14291
  /**
14335
14292
  * Returns the active panel configuration.
14336
14293
  * Promises are supported in Manifest V3 and later, but callbacks are provided for backward compatibility.