@wxt-dev/browser 0.2.2 → 0.2.6

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 (2) hide show
  1. package/package.json +4 -5
  2. package/src/gen/index.d.ts +323 -141
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@wxt-dev/browser",
3
3
  "description": "Provides a cross-browser API for using extension APIs and types based on @types/chrome",
4
- "version": "0.2.2",
4
+ "version": "0.2.6",
5
5
  "type": "module",
6
6
  "main": "src/index.mjs",
7
7
  "types": "src/index.d.ts",
@@ -25,11 +25,10 @@
25
25
  "src"
26
26
  ],
27
27
  "devDependencies": {
28
- "@types/chrome": "0.2.2",
29
- "@types/node": "^20.17.6",
30
- "nano-spawn": "^2.0.0",
28
+ "@types/chrome": "0.2.6",
29
+ "@types/node": "^22",
31
30
  "typescript": "^6.0.3",
32
- "vitest": "^4.1.5"
31
+ "vitest": "^4.1.10"
33
32
  },
34
33
  "dependencies": {
35
34
  "@types/filesystem": "*",
@@ -170,7 +170,7 @@ export namespace Browser {
170
170
  interface TitleDetails {
171
171
  /** The string the action should display when moused over. */
172
172
  title: string;
173
- /** Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
173
+ /** Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
174
174
  tabId?: number | undefined;
175
175
  }
176
176
 
@@ -181,23 +181,34 @@ export namespace Browser {
181
181
  popup: string;
182
182
  }
183
183
 
184
- interface TabIconDetails {
185
- /** Either a relative image path or a dictionary {size -> relative image path} pointing to icon to be set. If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. If the number of image pixels that fit into one screen space unit equals `scale`, then image with size `scale` \* n will be selected, where n is the size of the icon in the UI. At least one image must be specified. Note that 'details.path = foo' is equivalent to 'details.path = {'16': foo}' */
186
- path?: string | { [index: number]: string } | undefined;
187
- /** Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
188
- tabId?: number | undefined;
189
- /** Either an ImageData object or a dictionary {size -> ImageData} representing icon to be set. If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. If the number of image pixels that fit into one screen space unit equals `scale`, then image with size `scale` \* n will be selected, where n is the size of the icon in the UI. At least one image must be specified. Note that 'details.imageData = foo' is equivalent to 'details.imageData = {'16': foo}' */
190
- imageData?: ImageData | { [index: number]: ImageData } | undefined;
191
- }
184
+ type TabIconDetails =
185
+ & {
186
+ /** Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
187
+ tabId?: number | null | undefined;
188
+ }
189
+ & (
190
+ | {
191
+ /** Either an ImageData object or a dictionary {size -> ImageData} representing an icon to be set. If the icon is specified as a dictionary, the image used is chosen depending on the screen's pixel density. If the number of image pixels that fit into one screen space unit equals `scale`, then an image with size `scale` \* n is selected, where _n_ is the size of the icon in the UI. At least one image must be specified. Note that 'details.imageData = foo' is equivalent to 'details.imageData = {'16': foo}' */
192
+ imageData: ImageData | { [index: number]: ImageData };
193
+ /** Either a relative image path or a dictionary {size -> relative image path} pointing to an icon to be set. If the icon is specified as a dictionary, the image used is chosen depending on the screen's pixel density. If the number of image pixels that fit into one screen space unit equals `scale`, then an image with size `scale` \* n is selected, where _n_ is the size of the icon in the UI. At least one image must be specified. Note that 'details.path = foo' is equivalent to 'details.path = {'16': foo}' */
194
+ path?: string | { [index: string]: string } | undefined;
195
+ }
196
+ | {
197
+ /** Either an ImageData object or a dictionary {size -> ImageData} representing an icon to be set. If the icon is specified as a dictionary, the image used is chosen depending on the screen's pixel density. If the number of image pixels that fit into one screen space unit equals `scale`, then an image with size `scale` \* n is selected, where _n_ is the size of the icon in the UI. At least one image must be specified. Note that 'details.imageData = foo' is equivalent to 'details.imageData = {'16': foo}' */
198
+ imageData?: ImageData | { [index: number]: ImageData } | undefined;
199
+ /** Either a relative image path or a dictionary {size -> relative image path} pointing to an icon to be set. If the icon is specified as a dictionary, the image used is chosen depending on the screen's pixel density. If the number of image pixels that fit into one screen space unit equals `scale`, then an image with size `scale` \* n is selected, where _n_ is the size of the icon in the UI. At least one image must be specified. Note that 'details.path = foo' is equivalent to 'details.path = {'16': foo}' */
200
+ path: string | { [index: string]: string };
201
+ }
202
+ );
192
203
 
193
204
  /** @since Chrome 99 */
194
205
  interface OpenPopupOptions {
195
- /** The id of the window to open the action popup in. Defaults to the currently-active window if unspecified. */
206
+ /** The id of the window to open the action popup in. Defaults to the currently-active window if unspecified. */
196
207
  windowId?: number | undefined;
197
208
  }
198
209
 
199
210
  interface TabDetails {
200
- /** The ID of the tab to query state for. If no tab is specified, the non-tab-specific state is returned. */
211
+ /** The ID of the tab to query state for. If no tab is specified, the non-tab-specific state is returned. */
201
212
  tabId?: number | undefined;
202
213
  }
203
214
 
@@ -393,24 +404,24 @@ export namespace Browser {
393
404
  }
394
405
  & (
395
406
  | {
396
- /** Length of time in minutes after which the {@link onAlarm} event should fire. */
407
+ /** Length of time in minutes after which the {@link onAlarm} event should fire. */
397
408
  delayInMinutes: number;
398
409
  /** If set, the onAlarm event should fire every `periodInMinutes` minutes after the initial event specified by `when` or `delayInMinutes`. If not set, the alarm will only fire once. */
399
410
  periodInMinutes?: number | undefined;
400
411
  /** Time at which the alarm should fire, in milliseconds past the epoch (e.g. `Date.now() + n`). */
401
- when?: never | undefined;
412
+ when?: undefined;
402
413
  }
403
414
  | {
404
- /** Length of time in minutes after which the {@link onAlarm} event should fire. */
415
+ /** Length of time in minutes after which the {@link onAlarm} event should fire. */
405
416
  delayInMinutes?: number | undefined;
406
417
  /** If set, the onAlarm event should fire every `periodInMinutes` minutes after the initial event specified by `when` or `delayInMinutes`. If not set, the alarm will only fire once. */
407
418
  periodInMinutes: number;
408
419
  /** Time at which the alarm should fire, in milliseconds past the epoch (e.g. `Date.now() + n`). */
409
- when?: number | undefined;
420
+ when?: undefined;
410
421
  }
411
422
  | {
412
- /** Length of time in minutes after which the {@link onAlarm} event should fire. */
413
- delayInMinutes?: never | undefined;
423
+ /** Length of time in minutes after which the {@link onAlarm} event should fire. */
424
+ delayInMinutes?: undefined;
414
425
  /** If set, the onAlarm event should fire every `periodInMinutes` minutes after the initial event specified by `when` or `delayInMinutes`. If not set, the alarm will only fire once. */
415
426
  periodInMinutes?: number | undefined;
416
427
  /** Time at which the alarm should fire, in milliseconds past the epoch (e.g. `Date.now() + n`). */
@@ -824,7 +835,7 @@ export namespace Browser {
824
835
  function removeTree(id: string, callback: () => void): void;
825
836
 
826
837
  interface SearchQuery {
827
- /** A string of words and quoted phrases that are matched against bookmark URLs and titles.*/
838
+ /** A string of words and quoted phrases that are matched against bookmark URLs and titles. */
828
839
  query?: string;
829
840
  /** The URL of the bookmark; matches verbatim. Note that folders have no URL. */
830
841
  url?: string;
@@ -854,7 +865,7 @@ export namespace Browser {
854
865
  function update(id: string, changes: UpdateChanges): Promise<BookmarkTreeNode>;
855
866
  function update(id: string, changes: UpdateChanges, callback: (result: BookmarkTreeNode) => void): void;
856
867
 
857
- /** Fired when a bookmark or folder changes. **Note:** Currently, only title and url changes trigger this.*/
868
+ /** Fired when a bookmark or folder changes. **Note:** Currently, only title and url changes trigger this. */
858
869
  const onChanged: events.Event<(id: string, changeInfo: { title: string; url?: string }) => void>;
859
870
 
860
871
  /** Fired when the children of a folder have changed their order due to the order being sorted in the UI. This is not called as a result of a move(). */
@@ -866,7 +877,7 @@ export namespace Browser {
866
877
  /** Fired when a bookmark import session is begun. Expensive observers should ignore onCreated updates until onImportEnded is fired. Observers should still handle other notifications immediately. */
867
878
  const onImportBegan: events.Event<() => void>;
868
879
 
869
- /** Fired when a bookmark import session is ended. */
880
+ /** Fired when a bookmark import session is ended. */
870
881
  const onImportEnded: events.Event<() => void>;
871
882
 
872
883
  /** Fired when a bookmark or folder is moved to a different parent folder. */
@@ -924,7 +935,7 @@ export namespace Browser {
924
935
  interface TitleDetails {
925
936
  /** The string the browser action should display when moused over. */
926
937
  title: string;
927
- /** Optional. Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
938
+ /** Optional. Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
928
939
  tabId?: number | null | undefined;
929
940
  }
930
941
 
@@ -956,7 +967,7 @@ export namespace Browser {
956
967
  interface PopupDetails {
957
968
  /** Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
958
969
  tabId?: number | null | undefined;
959
- /** The relative path to the HTML file to show in a popup. If set to the empty string (`''`), no popup is shown.*/
970
+ /** The relative path to the HTML file to show in a popup. If set to the empty string (`''`), no popup is shown. */
960
971
  popup: string;
961
972
  }
962
973
 
@@ -1062,7 +1073,10 @@ export namespace Browser {
1062
1073
 
1063
1074
  /** A set of data types. Missing data types are interpreted as `false`. */
1064
1075
  interface DataTypeSet {
1065
- /** Websites' WebSQL data. */
1076
+ /**
1077
+ * Websites' WebSQL data.
1078
+ * @deprecated since Chrome 139. Support for WebSQL has been removed. This data type will be ignored.
1079
+ */
1066
1080
  webSQL?: boolean | undefined;
1067
1081
  /** Websites' IndexedDB data. */
1068
1082
  indexedDB?: boolean | undefined;
@@ -1084,7 +1098,10 @@ export namespace Browser {
1084
1098
  cache?: boolean | undefined;
1085
1099
  /** Cache storage. */
1086
1100
  cacheStorage?: boolean | undefined;
1087
- /** Websites' appcaches. */
1101
+ /**
1102
+ * Websites' appcaches.
1103
+ * @deprecated since Chrome 98. Support for appcache has been removed. This data type will be ignored.
1104
+ */
1088
1105
  appcache?: boolean | undefined;
1089
1106
  /** Websites' file systems. */
1090
1107
  fileSystems?: boolean | undefined;
@@ -1183,6 +1200,7 @@ export namespace Browser {
1183
1200
  * Clears websites' WebSQL data.
1184
1201
  *
1185
1202
  * Can return its result via Promise in Manifest V3 or later since Chrome 96.
1203
+ * @deprecated since Chrome 139. Support for WebSQL has been removed. This function has no effect.
1186
1204
  */
1187
1205
  function removeWebSQL(options: RemovalOptions): Promise<void>;
1188
1206
  function removeWebSQL(options: RemovalOptions, callback: () => void): void;
@@ -1191,6 +1209,7 @@ export namespace Browser {
1191
1209
  * Clears websites' appcache data.
1192
1210
  *
1193
1211
  * Can return its result via Promise in Manifest V3 or later since Chrome 96.
1212
+ * @deprecated since Chrome 98. Support for appcache has been removed. This function has no effect.
1194
1213
  */
1195
1214
  function removeAppcache(options: RemovalOptions): Promise<void>;
1196
1215
  function removeAppcache(options: RemovalOptions, callback: () => void): void;
@@ -1312,7 +1331,7 @@ export namespace Browser {
1312
1331
  GENERAL_ERROR = "GENERAL_ERROR",
1313
1332
  }
1314
1333
 
1315
- /** @deprecated Replaced by {@link Algorithm}.*/
1334
+ /** @deprecated Replaced by {@link Algorithm}. */
1316
1335
  enum Hash {
1317
1336
  /** Specifies the MD5 and SHA1 hashing algorithms. */
1318
1337
  MD5_SHA1 = "MD5_SHA1",
@@ -1390,7 +1409,7 @@ export namespace Browser {
1390
1409
  error?: `${Error}` | undefined;
1391
1410
  }
1392
1411
 
1393
- /** @since Chrome 86 */
1412
+ /** @since Chrome 86 */
1394
1413
  interface SignatureRequest {
1395
1414
  /** Signature algorithm to be used. */
1396
1415
  algorithm: `${Algorithm}`;
@@ -1405,7 +1424,7 @@ export namespace Browser {
1405
1424
  interface SignRequest {
1406
1425
  /** The DER encoding of a X.509 certificate. The extension must sign `digest` using the associated private key. */
1407
1426
  certificate: ArrayBuffer;
1408
- /** The digest that must be signed. */
1427
+ /** The digest that must be signed. */
1409
1428
  digest: ArrayBuffer;
1410
1429
  /** Refers to the hash algorithm that was used to create `digest`. */
1411
1430
  hash: `${Hash}`;
@@ -1572,7 +1591,7 @@ export namespace Browser {
1572
1591
  resourceIdentifier?: ResourceIdentifier;
1573
1592
  /** Where to set the setting (default: regular). */
1574
1593
  scope?: `${Scope}`;
1575
- /** The pattern for the secondary URL. Defaults to matching all URLs. For details on the format of a pattern, see Content Setting Patterns.*/
1594
+ /** The pattern for the secondary URL. Defaults to matching all URLs. For details on the format of a pattern, see Content Setting Patterns. */
1576
1595
  secondaryPattern?: string;
1577
1596
  /** The setting applied by this rule. See the description of the individual ContentSetting objects for the possible values. */
1578
1597
  setting: T;
@@ -1683,7 +1702,7 @@ export namespace Browser {
1683
1702
 
1684
1703
  /** The only content type using resource identifiers is contentSettings.plugins. For more information, see Resource Identifiers. */
1685
1704
  interface ResourceIdentifier {
1686
- /** A human readable description of the resource. */
1705
+ /** A human readable description of the resource. */
1687
1706
  description?: string;
1688
1707
  /** The resource identifier for the given content type. */
1689
1708
  id: string;
@@ -1922,15 +1941,15 @@ export namespace Browser {
1922
1941
  checked?: boolean;
1923
1942
  /** List of contexts this menu item will appear in. Defaults to `['page']`. */
1924
1943
  contexts?: [`${ContextType}`, ...`${ContextType}`[]];
1925
- /** Restricts the item to apply only to documents or frames whose URL matches one of the given patterns. For details on pattern formats, see Match Patterns. */
1944
+ /** Restricts the item to apply only to documents or frames whose URL matches one of the given patterns. For details on pattern formats, see Match Patterns. */
1926
1945
  documentUrlPatterns?: string[];
1927
- /** Whether this context menu item is enabled or disabled. Defaults to `true`. */
1946
+ /** Whether this context menu item is enabled or disabled. Defaults to `true`. */
1928
1947
  enabled?: boolean;
1929
1948
  /** The unique ID to assign to this item. Mandatory for event pages. Cannot be the same as another ID for this extension. */
1930
1949
  id?: string;
1931
- /** The ID of a parent menu item; this makes the item a child of a previously added item. */
1950
+ /** The ID of a parent menu item; this makes the item a child of a previously added item. */
1932
1951
  parentId?: number | string;
1933
- /** Similar to `documentUrlPatterns`, filters based on the `src` attribute of `img`, `audio`, and `video` tags and the `href` attribute of `a` tags. */
1952
+ /** Similar to `documentUrlPatterns`, filters based on the `src` attribute of `img`, `audio`, and `video` tags and the `href` attribute of `a` tags. */
1934
1953
  targetUrlPatterns?: string[];
1935
1954
  /** The text to display in the item; this is _required_ unless `type` is `separator`. When the context is `selection`, use `%s` within the string to show the selected text. For example, if this parameter's value is "Translate '%s' to Pig Latin" and the user selects the word "cool", the context menu item for the selection is "Translate 'cool' to Pig Latin". */
1936
1955
  title?: string;
@@ -1964,7 +1983,7 @@ export namespace Browser {
1964
1983
  interface OnClickData {
1965
1984
  /** A flag indicating the state of a checkbox or radio item after it is clicked. */
1966
1985
  checked?: boolean;
1967
- /** A flag indicating whether the element is editable (text input, textarea, etc.). */
1986
+ /** A flag indicating whether the element is editable (text input, textarea, etc.). */
1968
1987
  editable: boolean;
1969
1988
  /**
1970
1989
  * The ID of the frame of the element where the context menu was clicked, if it was in a frame.
@@ -1981,7 +2000,7 @@ export namespace Browser {
1981
2000
  menuItemId: number | string;
1982
2001
  /** The URL of the page where the menu item was clicked. This property is not set if the click occurred in a context where there is no current page, such as in a launcher context menu. */
1983
2002
  pageUrl?: string;
1984
- /** The parent ID, if any, for the item clicked.*/
2003
+ /** The parent ID, if any, for the item clicked. */
1985
2004
  parentMenuItemId?: number | string;
1986
2005
  /** The text for the context selection, if any. */
1987
2006
  selectionText?: string | undefined;
@@ -2046,7 +2065,7 @@ export namespace Browser {
2046
2065
  * Manifest: "host_permissions"
2047
2066
  */
2048
2067
  export namespace cookies {
2049
- /** A cookie's 'SameSite' state (https://tools.ietf.org/html/draft-west-first-party-cookies). 'no_restriction' corresponds to a cookie set with 'SameSite=None', 'lax' to 'SameSite=Lax', and 'strict' to 'SameSite=Strict'. 'unspecified' corresponds to a cookie set without the SameSite attribute. **/
2068
+ /** A cookie's 'SameSite' state (https://tools.ietf.org/html/draft-west-first-party-cookies). 'no_restriction' corresponds to a cookie set with 'SameSite=None', 'lax' to 'SameSite=Lax', and 'strict' to 'SameSite=Strict'. 'unspecified' corresponds to a cookie set without the SameSite attribute. */
2050
2069
  enum SameSiteStatus {
2051
2070
  NO_RESTRICTION = "no_restriction",
2052
2071
  LAX = "lax",
@@ -2297,7 +2316,7 @@ export namespace Browser {
2297
2316
  * @since Chrome 125
2298
2317
  */
2299
2318
  interface DebuggerSession {
2300
- /** The id of the extension which you intend to debug. Attaching to an extension background page is only possible when the `--silent-debugger-extension-api` command-line switch is used.*/
2319
+ /** The id of the extension which you intend to debug. Attaching to an extension background page is only possible when the `--silent-debugger-extension-api` command-line switch is used. */
2301
2320
  extensionId?: string;
2302
2321
  /** The opaque id of the Chrome DevTools Protocol session. Identifies a child session within the root session identified by tabId, extensionId or targetId. */
2303
2322
  sessionId?: string;
@@ -2332,7 +2351,7 @@ export namespace Browser {
2332
2351
  title: string;
2333
2352
  /** Target URL. */
2334
2353
  url: string;
2335
- /** Target favicon URL. */
2354
+ /** Target favicon URL. */
2336
2355
  faviconUrl?: string;
2337
2356
  }
2338
2357
 
@@ -2495,7 +2514,7 @@ export namespace Browser {
2495
2514
  *
2496
2515
  * Permissions: "declarativeWebRequest"
2497
2516
  *
2498
- * MV2 only
2517
+ * Beta and MV2 only
2499
2518
  * @deprecated Check out the {@link declarativeNetRequest} API instead
2500
2519
  */
2501
2520
  export namespace declarativeWebRequest {
@@ -2550,9 +2569,9 @@ export namespace Browser {
2550
2569
  /** Matches if the MIME media type of a response (from the HTTP Content-Type header) is not contained in the list. */
2551
2570
  excludeContentType?: string[] | undefined;
2552
2571
  /** Matches if none of the request headers is matched by any of the HeaderFilters. */
2553
- excludeResponseHeaders?: HeaderFilter[] | undefined;
2572
+ excludeRequestHeaders?: HeaderFilter[] | undefined;
2554
2573
  /** Matches if none of the response headers is matched by any of the HeaderFilters. */
2555
- excludeResponseHeader?: HeaderFilter[] | undefined;
2574
+ excludeResponseHeaders?: HeaderFilter[] | undefined;
2556
2575
  /**
2557
2576
  * Matches if the conditions of the UrlFilter are fulfilled for the 'first party' URL of the request. The 'first party' URL of a request, when present, can be different from the request's target URL, and describes what is considered 'first party' for the sake of third-party checks for cookies.
2558
2577
  * @deprecated since Chrome 82
@@ -2619,7 +2638,7 @@ export namespace Browser {
2619
2638
  /** Edits one or more cookies of response. Note that it is preferred to use the Cookies API because this is computationally less expensive. */
2620
2639
  interface EditResponseCookie {
2621
2640
  /** Filter for cookies that will be modified. All empty entries are ignored. */
2622
- filter: ResponseCookie;
2641
+ filter: FilterResponseCookie;
2623
2642
  /** Attributes that shall be overridden in cookies that matched the filter. Attributes that are set to an empty string are removed. */
2624
2643
  modification: ResponseCookie;
2625
2644
  }
@@ -2663,7 +2682,7 @@ export namespace Browser {
2663
2682
  /** Existence of the Secure cookie attribute. */
2664
2683
  secure?: string | undefined;
2665
2684
  /** Filters session cookies. Session cookies have no lifetime specified in any of 'max-age' or 'expires' attributes. */
2666
- session?: boolean | undefined;
2685
+ sessionCookie?: boolean | undefined;
2667
2686
  /** Value of a cookie, may be padded in double-quotes. */
2668
2687
  value?: string | undefined;
2669
2688
  }
@@ -2814,11 +2833,28 @@ export namespace Browser {
2814
2833
  * Manifest: "devtools_page"
2815
2834
  */
2816
2835
  export namespace devtools.inspectedWindow {
2836
+ interface SetContentResult {
2837
+ code: string;
2838
+ description: string;
2839
+ details: string[];
2840
+ isError?: boolean;
2841
+ }
2842
+
2817
2843
  /** A resource within the inspected page, such as a document, a script, or an image. */
2818
2844
  interface Resource {
2819
2845
  /** The URL of the resource. */
2820
2846
  url: string;
2821
- /** Gets the content of the resource. */
2847
+ /**
2848
+ * Gets the content of the resource.
2849
+ *
2850
+ * Can return its result via Promise in Manifest V3 or later since Chrome 151.
2851
+ */
2852
+ getContent(): Promise<{
2853
+ /** Content of the resource (potentially encoded). */
2854
+ content: string;
2855
+ /** Empty if the content is not encoded, encoding name otherwise. Currently, only base64 is supported. */
2856
+ encoding: string;
2857
+ }>;
2822
2858
  getContent(
2823
2859
  callback: (
2824
2860
  /** Content of the resource (potentially encoded). */
@@ -2831,14 +2867,17 @@ export namespace Browser {
2831
2867
  * Sets the content of the resource.
2832
2868
  * @param content New content of the resource. Only resources with the text type are currently supported.
2833
2869
  * @param commit True if the user has finished editing the resource, and the new content of the resource should be persisted; false if this is a minor change sent in progress of the user editing the resource.
2870
+ *
2871
+ * Can return its result via Promise in Manifest V3 or later since Chrome 151.
2834
2872
  */
2835
2873
  setContent(
2836
2874
  content: string,
2837
2875
  commit: boolean,
2838
- callback?: (
2839
- /** Set to undefined if the resource content was set successfully; describes error otherwise. */
2840
- error?: object,
2841
- ) => void,
2876
+ ): Promise<undefined>;
2877
+ setContent(
2878
+ content: string,
2879
+ commit: boolean,
2880
+ callback: (result: SetContentResult) => void,
2842
2881
  ): void;
2843
2882
  }
2844
2883
 
@@ -2878,7 +2917,13 @@ export namespace Browser {
2878
2917
  * @param expression An expression to evaluate.
2879
2918
  * @param options The options parameter can contain one or more options.
2880
2919
  * @param callback A function called when evaluation completes.
2920
+ *
2921
+ * Can return its result via Promise in Manifest V3 or later since Chrome 151.
2881
2922
  */
2923
+ function eval<T = { [key: string]: unknown }>(
2924
+ expression: string,
2925
+ options?: EvalOptions,
2926
+ ): Promise<{ result: T; exceptionInfo: EvaluationExceptionInfo }>;
2882
2927
  function eval<T = { [key: string]: unknown }>(
2883
2928
  expression: string,
2884
2929
  callback?: (result: T, exceptionInfo: EvaluationExceptionInfo) => void,
@@ -2889,7 +2934,12 @@ export namespace Browser {
2889
2934
  callback?: (result: T, exceptionInfo: EvaluationExceptionInfo) => void,
2890
2935
  ): void;
2891
2936
 
2892
- /** Retrieves the list of resources from the inspected page. */
2937
+ /**
2938
+ * Retrieves the list of resources from the inspected page.
2939
+ *
2940
+ * Can return its result via Promise in Manifest V3 or later since Chrome 151.
2941
+ */
2942
+ function getResources(): Promise<Resource[]>;
2893
2943
  function getResources(callback: (resources: Resource[]) => void): void;
2894
2944
 
2895
2945
  /** Fired when a new resource is added to the inspected page. */
@@ -2922,7 +2972,17 @@ export namespace Browser {
2922
2972
  export namespace devtools.network {
2923
2973
  /** Represents a network request for a document resource (script, image and so on). See HAR Specification for reference. */
2924
2974
  interface Request extends HARFormatEntry {
2925
- /** Returns content of the response body. */
2975
+ /**
2976
+ * Returns content of the response body.
2977
+ *
2978
+ * Can return its result via Promise in Manifest V3 or later since Chrome 151.
2979
+ */
2980
+ getContent(): Promise<{
2981
+ /** Content of the response body (potentially encoded). */
2982
+ content: string;
2983
+ /** Empty if content is not encoded, encoding name otherwise. Currently, only base64 is supported. */
2984
+ encoding: string;
2985
+ }>;
2926
2986
  getContent(
2927
2987
  callback: (
2928
2988
  /** Content of the response body (potentially encoded). */
@@ -2933,7 +2993,12 @@ export namespace Browser {
2933
2993
  ): void;
2934
2994
  }
2935
2995
 
2936
- /** Returns HAR log that contains all known network requests. */
2996
+ /**
2997
+ * Returns HAR log that contains all known network requests.
2998
+ *
2999
+ * Can return its result via Promise in Manifest V3 or later since Chrome 151.
3000
+ */
3001
+ function getHAR(): Promise<HARFormatLog>;
2937
3002
  function getHAR(
2938
3003
  callback: (
2939
3004
  /** A HAR log. See HAR specification for details. */
@@ -3319,7 +3384,7 @@ export namespace Browser {
3319
3384
  enum OperationResult {
3320
3385
  /** An unknown or generic failure occurred. */
3321
3386
  UNKNOWN = "UNKNOWN",
3322
- /**The operation succeeded. */
3387
+ /** The operation succeeded. */
3323
3388
  SUCCESS = "SUCCESS",
3324
3389
  /** The operation is not supported. */
3325
3390
  UNSUPPORTED = "UNSUPPORTED",
@@ -3502,7 +3567,7 @@ export namespace Browser {
3502
3567
 
3503
3568
  /** @since Chrome 125 */
3504
3569
  interface SetOptionResult {
3505
- /** Indicates the name of the option that was set. */
3570
+ /** Indicates the name of the option that was set. */
3506
3571
  name: string;
3507
3572
  /** Indicates the result of setting the option. */
3508
3573
  result: `${OperationResult}`;
@@ -3534,7 +3599,7 @@ export namespace Browser {
3534
3599
  interface StartScanResponse<T> {
3535
3600
  /** If `result` is `SUCCESS`, provides a handle that can be used to read scan data or cancel the job. */
3536
3601
  job?: string;
3537
- /** The result of starting a scan. If the value of this is `SUCCESS`, the `job` property will be populated. */
3602
+ /** The result of starting a scan. If the value of this is `SUCCESS`, the `job` property will be populated. */
3538
3603
  result: `${OperationResult}`;
3539
3604
  /** Provides the same scanner handle that was passed to {@link startScan}. */
3540
3605
  scannerHandle: T;
@@ -5102,7 +5167,7 @@ export namespace Browser {
5102
5167
  requestId: number;
5103
5168
  }
5104
5169
 
5105
- /** Error codes used by providing extensions in response to requests as well as in case of errors when calling methods of the API. For success, `"OK"` must be used.*/
5170
+ /** Error codes used by providing extensions in response to requests as well as in case of errors when calling methods of the API. For success, `"OK"` must be used. */
5106
5171
  enum ProviderError {
5107
5172
  OK = "OK",
5108
5173
  FAILED = "FAILED",
@@ -5309,7 +5374,7 @@ export namespace Browser {
5309
5374
  ) => void
5310
5375
  >;
5311
5376
 
5312
- /** Raised when opening a file previously opened with `openRequestId` is requested to be closed.*/
5377
+ /** Raised when opening a file previously opened with `openRequestId` is requested to be closed. */
5313
5378
  const onCloseFileRequested: events.Event<
5314
5379
  (
5315
5380
  options: CloseFileRequestedOptions,
@@ -5754,7 +5819,7 @@ export namespace Browser {
5754
5819
  genericFamily: `${GenericFamily}`;
5755
5820
  /** The level of control this extension has over the setting. */
5756
5821
  levelOfControl: `${LevelOfControl}`;
5757
- /** Optional. The script code for which the font setting has changed. */
5822
+ /** Optional. The script code for which the font setting has changed. */
5758
5823
  script?: `${ScriptCode}`;
5759
5824
  /** The font ID. See the description in {@link getFont}. */
5760
5825
  fontId: string;
@@ -6213,7 +6278,8 @@ export namespace Browser {
6213
6278
  /** Gets the browser UI language of the browser. This is different from {@link i18n.getAcceptLanguages} which returns the preferred user languages. */
6214
6279
  function getUILanguage(): string;
6215
6280
 
6216
- /** Detects the language of the provided text using CLD.
6281
+ /**
6282
+ * Detects the language of the provided text using CLD.
6217
6283
  * @param text User input string to be translated.
6218
6284
  *
6219
6285
  * Can return its result via Promise in Manifest V3 or later since Chrome 99.
@@ -6343,14 +6409,17 @@ export namespace Browser {
6343
6409
  *
6344
6410
  * The Identity API caches access tokens in memory, so it's ok to call getAuthToken non-interactively any time a token is required. The token cache automatically handles expiration.
6345
6411
  *
6346
- * For a good user experience it is important interactive token requests are initiated by UI in your app explaining what the authorization is for. Failing to do this will cause your users to get authorization requests, or Chrome sign in screens if they are not signed in, with with no context. In particular, do not use getAuthToken interactively when your app is first launched.
6412
+ * For a good user experience it is important interactive token requests are initiated by UI in your app explaining what the authorization is for. Failing to do this will cause your users to get authorization requests, or Chrome sign in screens if they are not signed in, with no context. In particular, do not use getAuthToken interactively when your app is first launched.
6347
6413
  * @param details Token options.
6348
6414
  *
6349
6415
  * Can return its result via Promise since Chrome 105.
6350
6416
  */
6351
6417
  function getAuthToken(details?: TokenDetails): Promise<GetAuthTokenResult>;
6352
- function getAuthToken(details: TokenDetails, callback: (result: GetAuthTokenResult) => void): void;
6353
- function getAuthToken(callback: (result: GetAuthTokenResult) => void): void;
6418
+ function getAuthToken(
6419
+ details: TokenDetails | undefined,
6420
+ callback: (token?: string, grantedScopes?: string[]) => void,
6421
+ ): void;
6422
+ function getAuthToken(callback: (token?: string, grantedScopes?: string[]) => void): void;
6354
6423
 
6355
6424
  /**
6356
6425
  * Retrieves email address and obfuscated gaia id of the user signed into a profile.
@@ -6963,13 +7032,13 @@ export namespace Browser {
6963
7032
  /** This event is sent when an IME is deactivated. It signals that the IME will no longer be receiving onKeyPress events. */
6964
7033
  const onDeactivated: events.Event<(engineID: string) => void>;
6965
7034
 
6966
- /** This event is sent when the properties of the current InputContext change, such as the the type. It is sent to all extensions that are listening to this event, and enabled by the user. */
7035
+ /** This event is sent when the properties of the current InputContext change, such as the type. It is sent to all extensions that are listening to this event, and enabled by the user. */
6967
7036
  const onInputContextUpdate: events.Event<(context: InputContext) => void>;
6968
7037
 
6969
7038
  /** This event is sent when an IME is activated. It signals that the IME will be receiving onKeyPress events. */
6970
7039
  const onActivate: events.Event<(engineID: string, screen: `${ScreenType}`) => void>;
6971
7040
 
6972
- // /** This event is sent when focus enters a text box. It is sent to all extensions that are listening to this event, and enabled by the user. */
7041
+ /** This event is sent when focus enters a text box. It is sent to all extensions that are listening to this event, and enabled by the user. */
6973
7042
  const onFocus: events.Event<(context: InputContext) => void>;
6974
7043
 
6975
7044
  /** Called when the user selects a menu item */
@@ -7127,7 +7196,7 @@ export namespace Browser {
7127
7196
  function getSessionState(): Promise<`${SessionState}`>;
7128
7197
  function getSessionState(callback: (sessionState: `${SessionState}`) => void): void;
7129
7198
 
7130
- /** Dispatched when the session state changes. `sessionState` is the new session state.*/
7199
+ /** Dispatched when the session state changes. `sessionState` is the new session state. */
7131
7200
  const onSessionStateChanged: events.Event<(sessionState: `${SessionState}`) => void>;
7132
7201
  }
7133
7202
 
@@ -7232,7 +7301,7 @@ export namespace Browser {
7232
7301
  enum ExtensionType {
7233
7302
  EXTENSION = "extension",
7234
7303
  HOSTED_APP = "hosted_app",
7235
- PACKAGE_APP = "package_app",
7304
+ PACKAGED_APP = "packaged_app",
7236
7305
  LEGACY_PACKAGED_APP = "legacy_packaged_app",
7237
7306
  THEME = "theme",
7238
7307
  LOGIN_SCREEN_EXTENSION = "login_screen_extension",
@@ -7398,6 +7467,66 @@ export namespace Browser {
7398
7467
  const onEnabled: events.Event<(info: ExtensionInfo) => void>;
7399
7468
  }
7400
7469
 
7470
+ ////////////////////
7471
+ // MimeHandler
7472
+ ////////////////////
7473
+ /**
7474
+ * Use the `Browser.mimeHandler` API to handle MIME type streams in third-party extensions.
7475
+ * @since Chrome 151, MV3
7476
+ */
7477
+ export namespace mimeHandler {
7478
+ interface MimeHandlerOptions {
7479
+ /** Whether this handler is active for the given MIME type. */
7480
+ enabled: boolean;
7481
+ }
7482
+
7483
+ interface StreamInfo {
7484
+ /** True if loaded in an embedded context (iframe/embed/object). */
7485
+ embedded: boolean;
7486
+ /** The MIME type of the intercepted content. */
7487
+ mimeType: string;
7488
+ /** The original URL the user navigated to. */
7489
+ originalUrl: string;
7490
+ /** HTTP response headers as key-value pairs. */
7491
+ responseHeaders: { [key: string]: unknown };
7492
+ /** The URL to fetch the stream data from. */
7493
+ streamUrl: string;
7494
+ /** The tab ID containing the document. */
7495
+ tabId: number;
7496
+ }
7497
+
7498
+ /**
7499
+ * Aborts current stream handling and hands the content off to the user agent's native handler. After this call the extension frame will be torn down; callers should not expect further execution.
7500
+ *
7501
+ * Can return its result via Promise
7502
+ */
7503
+ function abortAndFallbackToNativeHandler(): Promise<void>;
7504
+ function abortAndFallbackToNativeHandler(callback: () => void): void;
7505
+
7506
+ /**
7507
+ * Reads the persisted options for a MIME type. Returns defaults (enabled=true) if none have been stored.
7508
+ * @param mimeType The MIME type whose options to read.
7509
+ *
7510
+ * Can return its result via Promise
7511
+ */
7512
+ function getMimeHandlerOptions(mimeType: string): Promise<MimeHandlerOptions>;
7513
+ function getMimeHandlerOptions(mimeType: string, callback: (options: MimeHandlerOptions) => void): void;
7514
+
7515
+ /** Retrieves stream information for the current MIME handler context. Must be called from within a MIME handler extension page. */
7516
+ function getStreamInfo(): Promise<StreamInfo>;
7517
+ function getStreamInfo(callback: (info: StreamInfo) => void): void;
7518
+
7519
+ /**
7520
+ * Sets the configuration options for a specified MIME type.
7521
+ * @param mimeType The MIME type to configure.
7522
+ * @param options The new options to use.
7523
+ *
7524
+ * Can return its result via Promise
7525
+ */
7526
+ function setMimeHandlerOptions(mimeType: string, options: MimeHandlerOptions): Promise<void>;
7527
+ function setMimeHandlerOptions(mimeType: string, options: MimeHandlerOptions, callback: () => void): void;
7528
+ }
7529
+
7401
7530
  ////////////////////
7402
7531
  // Notifications
7403
7532
  ////////////////////
@@ -7477,7 +7606,8 @@ export namespace Browser {
7477
7606
  * **Note:** This value is required for the {@link notifications.create}() method.
7478
7607
  */
7479
7608
  title?: string;
7480
- /** Which type of notification to display.
7609
+ /**
7610
+ * Which type of notification to display.
7481
7611
  *
7482
7612
  * **Note:** This value is required for the {@link notifications.create}() method.
7483
7613
  */
@@ -7941,7 +8071,7 @@ export namespace Browser {
7941
8071
  // Platform Keys
7942
8072
  ////////////////////
7943
8073
  /**
7944
- * Use the `Browser.platformKeys` API to access client certificates managed by the platform. If the user or policy grants the permission, an extension can use such a certficate in its custom authentication protocol. E.g. this allows usage of platform managed certificates in third party VPNs (see Browser.vpnProvider).
8074
+ * Use the `Browser.platformKeys` API to access client certificates managed by the platform. If the user or policy grants the permission, an extension can use such a certificate in its custom authentication protocol. E.g. this allows usage of platform managed certificates in third party VPNs (see Browser.vpnProvider).
7945
8075
  *
7946
8076
  * Permissions: "platformKeys"
7947
8077
  * @platform ChromeOS only
@@ -8103,7 +8233,7 @@ export namespace Browser {
8103
8233
  enum PrintError {
8104
8234
  /** Specifies that the operation was completed successfully. */
8105
8235
  OK = "OK",
8106
- /** Specifies that a general failure occured. */
8236
+ /** Specifies that a general failure occurred. */
8107
8237
  FAILED = "FAILED",
8108
8238
  /** Specifies that the print ticket is invalid. For example, the ticket is inconsistent with some capabilities, or the extension is not able to handle all settings from the ticket. */
8109
8239
  INVALID_TICKET = "INVALID_TICKET",
@@ -8485,6 +8615,17 @@ export namespace Browser {
8485
8615
  * Permissions: "privacy"
8486
8616
  */
8487
8617
  export namespace privacy {
8618
+ /**
8619
+ * Categories of Autofill data.
8620
+ * @since Chrome 151
8621
+ */
8622
+ enum AutofillBlockedType {
8623
+ CONTACT_INFO = "contact_info",
8624
+ PAYMENTS = "payments",
8625
+ IDENTITY_DOCS = "identity_docs",
8626
+ TRAVEL = "travel",
8627
+ }
8628
+
8488
8629
  /**
8489
8630
  * The IP handling policy of WebRTC.
8490
8631
  * @since Chrome 48
@@ -8893,7 +9034,7 @@ export namespace Browser {
8893
9034
  */
8894
9035
  export namespace runtime {
8895
9036
  interface LastError {
8896
- /** Details about the error which occurred. */
9037
+ /** Details about the error which occurred. */
8897
9038
  message?: string;
8898
9039
  }
8899
9040
 
@@ -8929,19 +9070,19 @@ export namespace Browser {
8929
9070
  * @since Chrome 44
8930
9071
  */
8931
9072
  enum PlatformArch {
8932
- /** Specifies the processer architecture as arm. */
9073
+ /** Specifies the processor architecture as arm. */
8933
9074
  ARM = "arm",
8934
- /** Specifies the processer architecture as arm64. */
9075
+ /** Specifies the processor architecture as arm64. */
8935
9076
  ARM64 = "arm64",
8936
- /** Specifies the processer architecture as x86-32. */
9077
+ /** Specifies the processor architecture as x86-32. */
8937
9078
  X86_32 = "x86-32",
8938
- /** Specifies the processer architecture as x86-64. */
9079
+ /** Specifies the processor architecture as x86-64. */
8939
9080
  X86_64 = "x86-64",
8940
- /** Specifies the processer architecture as mips. */
9081
+ /** Specifies the processor architecture as mips. */
8941
9082
  MIPS = "mips",
8942
- /** Specifies the processer architecture as mips64. */
9083
+ /** Specifies the processor architecture as mips64. */
8943
9084
  MIPS64 = "mips64",
8944
- /** Specifies the processer architecture as riscv64. */
9085
+ /** Specifies the processor architecture as riscv64. */
8945
9086
  RISCV64 = "riscv64",
8946
9087
  }
8947
9088
 
@@ -9048,7 +9189,7 @@ export namespace Browser {
9048
9189
  contextId: string;
9049
9190
  /** The type of context this corresponds to. */
9050
9191
  contextType: `${ContextType}`;
9051
- /** A UUID for the document associated with this context, or undefined if this context is hosted not in a document.*/
9192
+ /** A UUID for the document associated with this context, or undefined if this context is hosted not in a document. */
9052
9193
  documentId?: string;
9053
9194
  /** The origin of the document associated with this context, or undefined if the context is not hosted in a document. */
9054
9195
  documentOrigin?: string;
@@ -9167,9 +9308,11 @@ export namespace Browser {
9167
9308
  }
9168
9309
 
9169
9310
  interface ManifestAction {
9170
- default_icon?: ManifestIcons | undefined;
9311
+ default_icon?: ManifestIcons | string | undefined;
9171
9312
  default_title?: string | undefined;
9172
9313
  default_popup?: string | undefined;
9314
+ /** @default 'enabled' */
9315
+ default_state?: "enabled" | "disabled";
9173
9316
  }
9174
9317
 
9175
9318
  /** Source: https://developer.chrome.com/docs/extensions/reference/permissions-list */
@@ -9275,22 +9418,37 @@ export namespace Browser {
9275
9418
  | "webAuthenticationProxy"
9276
9419
  >;
9277
9420
 
9421
+ /** A search engine. */
9278
9422
  interface SearchProvider {
9423
+ /** Name of the search engine displayed to user. This is required if you don't set `prepopulated_id`. */
9279
9424
  name?: string | undefined;
9425
+ /** An omnibox keyword for the search engine. This is required if you don't set `prepopulated_id`. */
9280
9426
  keyword?: string | undefined;
9427
+ /** An icon URL for the search engine. This is required if you don't set `prepopulated_id`. */
9281
9428
  favicon_url?: string | undefined;
9429
+ /** The search URL the search engine uses. */
9282
9430
  search_url: string;
9431
+ /** The encoding used for search terms. This is required if you don't set `prepopulated_id`. */
9283
9432
  encoding?: string | undefined;
9433
+ /** The URL the search engine uses for suggestions. If this isn't used, the engine doesn't support suggestions. */
9284
9434
  suggest_url?: string | undefined;
9285
9435
  instant_url?: string | undefined;
9436
+ /** The URL the search engine uses for image search. If this isn't used, the engine doesn't support image search. */
9286
9437
  image_url?: string | undefined;
9438
+ /** The post parameters for `search_url`. */
9287
9439
  search_url_post_params?: string | undefined;
9440
+ /** The post parameters for `suggest_url`. */
9288
9441
  suggest_url_post_params?: string | undefined;
9442
+ /** The post parameters for `instant_url`. */
9289
9443
  instant_url_post_params?: string | undefined;
9444
+ /** The post parameters for `image_url`. */
9290
9445
  image_url_post_params?: string | undefined;
9446
+ /** A list of URL patterns that can be used in addition to `search_url`. */
9291
9447
  alternate_urls?: string[] | undefined;
9448
+ /** An ID for Chrome's built-in search engine. */
9292
9449
  prepopulated_id?: number | undefined;
9293
- is_default?: boolean | undefined;
9450
+ /** Specifies whether the search provider should be default. */
9451
+ is_default: boolean;
9294
9452
  }
9295
9453
 
9296
9454
  interface ManifestBase {
@@ -9313,10 +9471,12 @@ export namespace Browser {
9313
9471
  // Optional
9314
9472
  /** @deprecated As of February 2024, the `author` key is no longer supported by Chrome or the Chrome Web Store. If present, it's silently ignored. */
9315
9473
  author?: { email: string } | undefined;
9316
- /** Defines overrides for selected Chrome settings. */
9474
+ /** Defines overrides for selected Chrome settings. */
9317
9475
  chrome_settings_overrides?: {
9476
+ /** The new value for the homepage. */
9318
9477
  homepage?: string | undefined;
9319
9478
  search_provider?: SearchProvider | undefined;
9479
+ /** An array of length one containing a URL to be used as the startup page. */
9320
9480
  startup_pages?: string[] | undefined;
9321
9481
  } | undefined;
9322
9482
  /** Defines overrides for default Chrome pages. */
@@ -9328,13 +9488,16 @@ export namespace Browser {
9328
9488
  /** Defines keyboard shortcuts within the extension. */
9329
9489
  commands?: {
9330
9490
  [name: string]: {
9331
- suggested_key?: {
9332
- default?: string | undefined;
9333
- windows?: string | undefined;
9334
- mac?: string | undefined;
9335
- chromeos?: string | undefined;
9336
- linux?: string | undefined;
9337
- } | undefined;
9491
+ suggested_key?:
9492
+ | {
9493
+ default?: string | undefined;
9494
+ windows?: string | undefined;
9495
+ mac?: string | undefined;
9496
+ chromeos?: string | undefined;
9497
+ linux?: string | undefined;
9498
+ }
9499
+ | string
9500
+ | undefined;
9338
9501
  description?: string | undefined;
9339
9502
  global?: boolean | undefined;
9340
9503
  };
@@ -9350,7 +9513,7 @@ export namespace Browser {
9350
9513
  cross_origin_opener_policy?: { value: string } | undefined;
9351
9514
  current_locale?: string | undefined;
9352
9515
  /** Defines static rules for the declarativeNetRequest API, which allows blocking and modifying of network requests. */
9353
- declarative_net_request?: { rule_resources?: declarativeNetRequest.Ruleset[] } | undefined;
9516
+ declarative_net_request?: { rule_resources: declarativeNetRequest.Ruleset[] } | undefined;
9354
9517
  /** Defines pages that use the DevTools APIs. */
9355
9518
  devtools_page?: string | undefined;
9356
9519
  event_rules?:
@@ -9385,7 +9548,7 @@ export namespace Browser {
9385
9548
  /** Files app uses above information in order to render related UI elements appropriately. For example, if `configurable` is set to true, then a menu item for configuring volumes will be rendered. Similarly, if `multiple_mounts` is set to true, then Files app will allow to add more than one mount points from the UI. If `watchable` is false, then a refresh button will be rendered. Note, that if possible you should add support for watchers, so changes on the file system can be reflected immediately and automatically. */
9386
9549
  source: "file" | "device" | "network";
9387
9550
  } | undefined;
9388
- /** string specifying a URL for the extension's homepage. If this is undefined, the homepage defaults to the extension's Chrome Web Store page. This field is particularly useful if you host the extension on your own site. */
9551
+ /** string specifying a URL for the extension's homepage. If this is undefined, the homepage defaults to the extension's Chrome Web Store page. This field is particularly useful if you host the extension on your own site. */
9389
9552
  homepage_url?: string | undefined;
9390
9553
  /** Allows resources to be imported into the extension. */
9391
9554
  import?:
@@ -9422,20 +9585,13 @@ export namespace Browser {
9422
9585
  /** Allows the use of an OAuth 2.0 security ID. The value of this key must be an object with "client_id" and "scopes" properties. */
9423
9586
  oauth2?: {
9424
9587
  client_id: string;
9425
- scopes?: string[] | undefined;
9588
+ scopes: string[];
9426
9589
  } | undefined;
9427
9590
  offline_enabled?: boolean | undefined;
9428
9591
  /** Allows the extension to register a keyword in Chrome's address bar. */
9429
9592
  omnibox?: { keyword: string } | undefined;
9430
9593
  /** Specifies a path to an options.html file for the extension to use as an options page. */
9431
9594
  options_page?: string | undefined;
9432
- /** Specifies a path to an HTML file that lets a user change extension options from the Chrome Extensions page. */
9433
- options_ui?: {
9434
- /** Path to the options page, relative to the extension's root. */
9435
- page: string;
9436
- /** Specify as `false` to declare an embedded options page. If `true`, the extension's options page will be opened in a new tab rather than embedded in `chrome://extensions`. */
9437
- open_in_tab: boolean;
9438
- } | undefined;
9439
9595
  /** Lists technologies required to use the extension. */
9440
9596
  requirements?: {
9441
9597
  "3D"?: { features?: string[] | undefined } | undefined;
@@ -9471,8 +9627,8 @@ export namespace Browser {
9471
9627
  manifest_version: 2;
9472
9628
 
9473
9629
  // Pick one (or none)
9474
- browser_action?: ManifestAction | undefined;
9475
- page_action?: ManifestAction | undefined;
9630
+ browser_action?: Omit<ManifestAction, "default_state"> | undefined;
9631
+ page_action?: Omit<ManifestAction, "default_state"> | undefined;
9476
9632
 
9477
9633
  // Optional
9478
9634
  background?:
@@ -9498,6 +9654,15 @@ export namespace Browser {
9498
9654
  | undefined;
9499
9655
  /** Defines restrictions on the scripts, styles, and other resources an extension can use. */
9500
9656
  content_security_policy?: string | undefined;
9657
+ /** Specifies a path to an HTML file that lets a user change extension options from the Chrome Extensions page. */
9658
+ options_ui?: {
9659
+ /** Path to the options page, relative to the extension's root. */
9660
+ page: string;
9661
+ /** If `true`, a Chrome user agent stylesheet will be applied to your options page. Defaults to `false`. */
9662
+ chrome_style?: boolean | undefined;
9663
+ /** Specify as `false` to declare an embedded options page. If `true`, the extension's options page will be opened in a new tab rather than embedded in `chrome://extensions`. */
9664
+ open_in_tab?: boolean | undefined;
9665
+ } | undefined;
9501
9666
  /** Declares optional permissions for your extension. */
9502
9667
  optional_permissions?: (ManifestOptionalPermission | string)[] | undefined;
9503
9668
  /** Enables use of particular extension APIs. */
@@ -9561,6 +9726,25 @@ export namespace Browser {
9561
9726
  | undefined;
9562
9727
  /** Lists the web pages your extension is allowed to interact with, defined using URL match patterns. User permission for these sites is requested at install time. */
9563
9728
  host_permissions?: string[] | undefined;
9729
+ /** Specifies a path to an HTML file that lets a user change extension options from the Chrome Extensions page. */
9730
+ options_ui?: {
9731
+ /** Specifies the path to the options page, relative to the extension's root. */
9732
+ page: string;
9733
+ /** Indicates whether the extension's options page will be opened in a new tab. If set to `false`, the extension's options page is embedded in `chrome://extensions` rather than opened in a new tab. */
9734
+ open_in_tab?: boolean | undefined;
9735
+ } | undefined;
9736
+ /**
9737
+ * Maps MIME types to the extension pages that render them. As of Chrome 151, `application/pdf` is the only MIME type available to public handlers. Declaring an unsupported MIME type causes an installation warning.
9738
+ * @since Chrome 151
9739
+ */
9740
+ mime_types_handler?: {
9741
+ "application/pdf": {
9742
+ /** The HTML file to display when a document of the corresponding MIME type is opened. This file must be located within your extension. */
9743
+ handler_url: string;
9744
+ /** Specifies whether to handle documents embedded in `<embed>`, `<object>`, or `<iframe>` elements. Defaults to `false`, meaning the handler only receives top-level navigations. */
9745
+ can_embed?: boolean;
9746
+ };
9747
+ };
9564
9748
  /** Declares optional permissions for your extension. */
9565
9749
  optional_permissions?: ManifestOptionalPermission[] | undefined;
9566
9750
  /** Declares optional host permissions for your extension. */
@@ -10487,9 +10671,9 @@ export namespace Browser {
10487
10671
  }
10488
10672
 
10489
10673
  interface Bounds {
10490
- /** The x-coordinate of the upper-left corner. */
10674
+ /** The x-coordinate of the upper-left corner. */
10491
10675
  left: number;
10492
- /** The y-coordinate of the upper-left corner. */
10676
+ /** The y-coordinate of the upper-left corner. */
10493
10677
  top: number;
10494
10678
  /** The width of the display in pixels. */
10495
10679
  width: number;
@@ -10719,7 +10903,8 @@ export namespace Browser {
10719
10903
  dpiX: number;
10720
10904
  /** The number of pixels per inch along the y-axis. */
10721
10905
  dpiY: number;
10722
- /** The display's clockwise rotation in degrees relative to the vertical position.
10906
+ /**
10907
+ * The display's clockwise rotation in degrees relative to the vertical position.
10723
10908
  * Currently exposed only on ChromeOS. Will be set to 0 on other platforms.
10724
10909
  * A value of -1 will be interpreted as auto-rotate when the device is in a physical tablet state.
10725
10910
  * @platform ChromeOS only
@@ -10776,15 +10961,10 @@ export namespace Browser {
10776
10961
 
10777
10962
  interface MirrorModeInfo {
10778
10963
  /** The mirror mode that should be set. */
10779
- mode?: `${MirrorMode}`;
10780
- }
10781
-
10782
- interface MirrorModeInfoMixed extends MirrorModeInfo {
10783
- /** The mirror mode that should be set. */
10784
- mode: "mixed";
10785
- /** The id of the mirroring source display. */
10964
+ mode: `${MirrorMode}`;
10965
+ /** The id of the mirroring source display. This is only valid for 'mixed'. */
10786
10966
  mirroringSourceId?: string | undefined;
10787
- /** The ids of the mirroring destination displays. */
10967
+ /** The ids of the mirroring destination displays. This is only valid for 'mixed'. */
10788
10968
  mirroringDestinationIds?: string[] | undefined;
10789
10969
  }
10790
10970
 
@@ -10925,8 +11105,8 @@ export namespace Browser {
10925
11105
  * @param info The information of the mirror mode that should be applied to the display mode.
10926
11106
  * @since Chrome 65
10927
11107
  */
10928
- function setMirrorMode(info: MirrorModeInfo | MirrorModeInfoMixed, callback: () => void): void;
10929
- function setMirrorMode(info: MirrorModeInfo | MirrorModeInfoMixed): Promise<void>;
11108
+ function setMirrorMode(info: MirrorModeInfo, callback: () => void): void;
11109
+ function setMirrorMode(info: MirrorModeInfo): Promise<void>;
10930
11110
 
10931
11111
  /** Fired when anything changes to the display configuration. */
10932
11112
  const onDisplayChanged: Browser.events.Event<() => void>;
@@ -10989,7 +11169,7 @@ export namespace Browser {
10989
11169
 
10990
11170
  /** @since Chrome 71 */
10991
11171
  interface GetMediaStreamOptions {
10992
- /** Optional tab id of the tab which will later invoke `getUserMedia()` to consume the stream. If not specified then the resulting stream can be used only by the calling extension. The stream can only be used by frames in the given tab whose security origin matches the consumber tab's origin. The tab's origin must be a secure origin, e.g. HTTPS. */
11172
+ /** Optional tab id of the tab which will later invoke `getUserMedia()` to consume the stream. If not specified then the resulting stream can be used only by the calling extension. The stream can only be used by frames in the given tab whose security origin matches the consumer tab's origin. The tab's origin must be a secure origin, e.g. HTTPS. */
10993
11173
  consumerTabId?: number | undefined;
10994
11174
  /** Optional tab id of the tab which will be captured. If not specified then the current active tab will be selected. Only tabs for which the extension has been granted the `activeTab` permission can be used as the target tab. */
10995
11175
  targetTabId?: number | undefined;
@@ -11147,7 +11327,7 @@ export namespace Browser {
11147
11327
  * The last time the tab became active in its window as the number of milliseconds since epoch.
11148
11328
  * @since Chrome 121
11149
11329
  */
11150
- lastAccessed?: number | undefined;
11330
+ lastAccessed: number;
11151
11331
  }
11152
11332
 
11153
11333
  /** The tab's loading status. */
@@ -11263,7 +11443,7 @@ export namespace Browser {
11263
11443
  url?: string | undefined;
11264
11444
  /** Adds or removes the tab from the current selection. */
11265
11445
  highlighted?: boolean | undefined;
11266
- /** Whether the tab should be active. Does not affect whether the window is focused (see {@link windows.update}).*/
11446
+ /** Whether the tab should be active. Does not affect whether the window is focused (see {@link windows.update}). */
11267
11447
  active?: boolean | undefined;
11268
11448
  /**
11269
11449
  * Whether the tab should be selected.
@@ -11717,8 +11897,11 @@ export namespace Browser {
11717
11897
  function insertCSS(details: extensionTypes.InjectDetails): Promise<void>;
11718
11898
  function insertCSS(tabId: number | undefined, details: extensionTypes.InjectDetails): Promise<void>;
11719
11899
  function insertCSS(details: extensionTypes.InjectDetails, callback: () => void): void;
11720
- function insertCSS(tabId: number | undefined, details: extensionTypes.InjectDetails): Promise<void>;
11721
- function insertCSS(tabId: number, details: extensionTypes.InjectDetails, callback: () => void): void;
11900
+ function insertCSS(
11901
+ tabId: number | undefined,
11902
+ details: extensionTypes.InjectDetails,
11903
+ callback: () => void,
11904
+ ): void;
11722
11905
 
11723
11906
  /**
11724
11907
  * Highlights the given tabs and focuses on the first of group. Will appear to do nothing if the specified tab is currently active.
@@ -11797,7 +11980,7 @@ export namespace Browser {
11797
11980
  * Discards a tab from memory. Discarded tabs are still visible on the tab strip and are reloaded when activated.
11798
11981
  *
11799
11982
  * Can return its result via Promise in Manifest V3 or later since Chrome 88.
11800
- * @param tabId The ID of the tab to be discarded. If specified, the tab is discarded unless it is active or already discarded. If omitted, the browser discards the least important tab. This can fail if no discardable tabs exist..
11983
+ * @param tabId The ID of the tab to be discarded. If specified, the tab is discarded unless it is active or already discarded. If omitted, the browser discards the least important tab. This can fail if no discardable tabs exist.
11801
11984
  * @since Chrome 54
11802
11985
  */
11803
11986
  function discard(tabId?: number): Promise<Tab | undefined>;
@@ -12172,7 +12355,7 @@ export namespace Browser {
12172
12355
  voiceName?: string;
12173
12356
  }
12174
12357
 
12175
- /** @deprecated since Chrome 70. Gender is deprecated and is ignored.*/
12358
+ /** @deprecated since Chrome 70. Gender is deprecated and is ignored. */
12176
12359
  enum VoiceGender {
12177
12360
  FEMALE = "female",
12178
12361
  MALE = "male",
@@ -12639,7 +12822,7 @@ export namespace Browser {
12639
12822
  /** Triggered when a configuration created by the extension is removed by the platform. */
12640
12823
  const onConfigRemoved: events.Event<(id: string) => void>;
12641
12824
 
12642
- // /** Triggered when a configuration is created by the platform for the extension. */
12825
+ /** Triggered when a configuration is created by the platform for the extension. */
12643
12826
  const onConfigCreated: events.Event<
12644
12827
  (id: string, name: string, data: { [key: string]: unknown }) => void
12645
12828
  >;
@@ -12725,7 +12908,7 @@ export namespace Browser {
12725
12908
  interface GetRequest {
12726
12909
  /** The `PublicKeyCredentialRequestOptions` passed to `navigator.credentials.get()`, serialized as a JSON string. The serialization format is compatible with [`PublicKeyCredential.parseRequestOptionsFromJSON()`](https://w3c.github.io/webauthn/#sctn-parseRequestOptionsFromJSON). */
12727
12910
  requestDetailsJson: string;
12728
- /** An opaque identifier for the request. */
12911
+ /** An opaque identifier for the request. */
12729
12912
  requestId: number;
12730
12913
  }
12731
12914
 
@@ -12757,7 +12940,7 @@ export namespace Browser {
12757
12940
  *
12758
12941
  * The attached extension must call `detach()` once the remote desktop session has ended in order to resume regular WebAuthn request processing. Extensions automatically become detached if they are unloaded.
12759
12942
  *
12760
- * Refer to the `onRemoteSessionStateChange` event for signaling a change of remote session attachment from a native application to to the (possibly suspended) extension.
12943
+ * Refer to the `onRemoteSessionStateChange` event for signaling a change of remote session attachment from a native application to the (possibly suspended) extension.
12761
12944
  */
12762
12945
  function attach(): Promise<string | undefined>;
12763
12946
  function attach(callback: (error?: string | undefined) => void): void;
@@ -12779,7 +12962,7 @@ export namespace Browser {
12779
12962
  *
12780
12963
  * This method is typically called when the extension detects that a remote desktop session was terminated. Once this method returns, the extension ceases to be the active Web Authentication API request proxy.
12781
12964
  *
12782
- * Refer to the `onRemoteSessionStateChange` event for signaling a change of remote session attachment from a native application to to the (possibly suspended) extension.
12965
+ * Refer to the `onRemoteSessionStateChange` event for signaling a change of remote session attachment from a native application to the (possibly suspended) extension.
12783
12966
  */
12784
12967
  function detach(): Promise<string | undefined>;
12785
12968
  function detach(callback: (error?: string | undefined) => void): void;
@@ -12876,7 +13059,7 @@ export namespace Browser {
12876
13059
  );
12877
13060
 
12878
13061
  interface GetFrameResultDetails {
12879
- /** The URL currently associated with this frame, if the frame identified by the frameId existed at one point in the given tab. The fact that an URL is associated with a given frameId does not imply that the corresponding frame still exists. */
13062
+ /** The URL currently associated with this frame, if the frame identified by the frameId existed at one point in the given tab. The fact that a URL is associated with a given frameId does not imply that the corresponding frame still exists. */
12880
13063
  url: string;
12881
13064
  /** A UUID of the document loaded. */
12882
13065
  documentId: string;
@@ -12981,7 +13164,7 @@ export namespace Browser {
12981
13164
  documentId: string;
12982
13165
  /** Cause of the navigation. */
12983
13166
  transitionType: `${TransitionType}`;
12984
- /** A list of transition qualifiers.*/
13167
+ /** A list of transition qualifiers. */
12985
13168
  transitionQualifiers: `${TransitionQualifier}`[];
12986
13169
  }
12987
13170
 
@@ -13032,7 +13215,7 @@ export namespace Browser {
13032
13215
  /** Fired when a document, including the resources it refers to, is completely loaded and initialized. */
13033
13216
  const onCompleted: WebNavigationEvent<(details: WebNavigationFramedCallbackDetails) => void>;
13034
13217
 
13035
- // /** Fired when the frame's history was updated to a new URL. All future events for that frame will use the updated URL. */
13218
+ /** Fired when the frame's history was updated to a new URL. All future events for that frame will use the updated URL. */
13036
13219
  const onHistoryStateUpdated: WebNavigationEvent<
13037
13220
  (details: WebNavigationTransitionCallbackDetails) => void
13038
13221
  >;
@@ -13042,7 +13225,7 @@ export namespace Browser {
13042
13225
  (details: WebNavigationSourceCallbackDetails) => void
13043
13226
  >;
13044
13227
 
13045
- /** Fired when the contents of the tab is replaced by a different (usually previously pre-rendered) tab*/
13228
+ /** Fired when the contents of the tab is replaced by a different (usually previously pre-rendered) tab */
13046
13229
  const onTabReplaced: events.Event<(details: WebNavigationReplacementCallbackDetails) => void>;
13047
13230
 
13048
13231
  /** Fired when a navigation is about to occur. */
@@ -13335,7 +13518,7 @@ export namespace Browser {
13335
13518
  * @since Chrome 43
13336
13519
  */
13337
13520
  statusCode: number;
13338
- /** HTTP status line of the response or the 'HTTP/0.9 200 OK' string for HTTP/0.9 responses (i.e., responses that lack a status line) or an empty string if there are no headers.*/
13521
+ /** HTTP status line of the response or the 'HTTP/0.9 200 OK' string for HTTP/0.9 responses (i.e., responses that lack a status line) or an empty string if there are no headers. */
13339
13522
  statusLine: string;
13340
13523
  }
13341
13524
 
@@ -13350,7 +13533,7 @@ export namespace Browser {
13350
13533
  responseHeaders?: HttpHeader[];
13351
13534
  /** Standard HTTP status code returned by the server. */
13352
13535
  statusCode: number;
13353
- /** HTTP status line of the response or the 'HTTP/0.9 200 OK' string for HTTP/0.9 responses (i.e., responses that lack a status line) or an empty string if there are no headers.*/
13536
+ /** HTTP status line of the response or the 'HTTP/0.9 200 OK' string for HTTP/0.9 responses (i.e., responses that lack a status line) or an empty string if there are no headers. */
13354
13537
  statusLine: string;
13355
13538
  }
13356
13539
 
@@ -13382,7 +13565,7 @@ export namespace Browser {
13382
13565
  responseHeaders?: HttpHeader[];
13383
13566
  /** Standard HTTP status code returned by the server. */
13384
13567
  statusCode: number;
13385
- /** HTTP status line of the response or the 'HTTP/0.9 200 OK' string for HTTP/0.9 responses (i.e., responses that lack a status line) or an empty string if there are no headers.*/
13568
+ /** HTTP status line of the response or the 'HTTP/0.9 200 OK' string for HTTP/0.9 responses (i.e., responses that lack a status line) or an empty string if there are no headers. */
13386
13569
  statusLine: string;
13387
13570
  }
13388
13571
 
@@ -13405,7 +13588,7 @@ export namespace Browser {
13405
13588
  securityInfo?: SecurityInfo;
13406
13589
  /** Standard HTTP status code returned by the server. */
13407
13590
  statusCode: number;
13408
- /** HTTP status line of the response or the 'HTTP/0.9 200 OK' string for HTTP/0.9 responses (i.e., responses that lack a status line) or an empty string if there are no headers.*/
13591
+ /** HTTP status line of the response or the 'HTTP/0.9 200 OK' string for HTTP/0.9 responses (i.e., responses that lack a status line) or an empty string if there are no headers. */
13409
13592
  statusLine: string;
13410
13593
  }
13411
13594
 
@@ -13436,9 +13619,9 @@ export namespace Browser {
13436
13619
 
13437
13620
  const onActionIgnored: events.Event<
13438
13621
  (details: {
13439
- // The proposed action which was ignored.
13622
+ /** The proposed action which was ignored. */
13440
13623
  action: `${IgnoredActionType}`;
13441
- // The ID of the request. Request IDs are unique within a browser session. As a result, they could be used to relate different events of the same request.
13624
+ /** The ID of the request. Request IDs are unique within a browser session. As a result, they could be used to relate different events of the same request. */
13442
13625
  requestId: string;
13443
13626
  }) => void
13444
13627
  >;
@@ -13483,7 +13666,6 @@ export namespace Browser {
13483
13666
  ) => BlockingResponse | undefined,
13484
13667
  `${OnAuthRequiredOptions}`[]
13485
13668
  >;
13486
- // const onAuthRequired: WebAuthenticationChallengeEvent;
13487
13669
 
13488
13670
  /** Fired when the first byte of the response body is received. For HTTP requests, this means that the status line and response headers are available. */
13489
13671
  const onResponseStarted: WebRequestEvent<
@@ -14589,13 +14771,13 @@ export namespace Browser {
14589
14771
  /** @since Chrome 141 */
14590
14772
  type CloseOptions =
14591
14773
  | {
14592
- /** The tab in which to close the side panel. If a tab-specific side panel is open in the specified tab, it will be closed for that tab. At least one of this or `windowId` must be provided. */
14774
+ /** The tab in which to close the side panel. If a tab-specific side panel is open in the specified tab, it will be closed for that tab. At least one of this or `windowId` must be provided. */
14593
14775
  tabId: number;
14594
14776
  /** The window in which to close the side panel. If a global side panel is open in the specified window, it will be closed for all tabs in that window where no tab-specific panel is active. At least one of this or `tabId` must be provided. */
14595
14777
  windowId?: number | undefined;
14596
14778
  }
14597
14779
  | {
14598
- /** The tab in which to close the side panel. If a tab-specific side panel is open in the specified tab, it will be closed for that tab. At least one of this or `windowId` must be provided. */
14780
+ /** The tab in which to close the side panel. If a tab-specific side panel is open in the specified tab, it will be closed for that tab. At least one of this or `windowId` must be provided. */
14599
14781
  tabId?: number | undefined;
14600
14782
  /** The window in which to close the side panel. If a global side panel is open in the specified window, it will be closed for all tabs in that window where no tab-specific panel is active. At least one of this or `tabId` must be provided. */
14601
14783
  windowId: number;
@@ -14615,7 +14797,7 @@ export namespace Browser {
14615
14797
  /**
14616
14798
  * The tab in which to open the side panel.
14617
14799
  * If the corresponding tab has a tab-specific side panel, the panel will only be open for that tab.
14618
- * If there is not a tab-specific panel, the global panel will be open in the specified tab and any other tabs without a currently-open tab- specific panel.
14800
+ * If there is not a tab-specific panel, the global panel will be open in the specified tab and any other tabs without a currently-open tab-specific panel.
14619
14801
  * This will override any currently-active side panel (global or tab-specific) in the corresponding tab.
14620
14802
  * At least one of this and `windowId` must be provided. */
14621
14803
  tabId?: number | undefined;
@@ -14807,7 +14989,7 @@ export namespace Browser {
14807
14989
  interface WorldProperties {
14808
14990
  /** Specifies the world csp. The default is the `ISOLATED` world csp. */
14809
14991
  csp?: string | undefined;
14810
- /** Specifies whether messaging APIs are exposed. The default is `false`.*/
14992
+ /** Specifies whether messaging APIs are exposed. The default is `false`. */
14811
14993
  messaging?: boolean | undefined;
14812
14994
  /**
14813
14995
  * Specifies the ID of the specific user script world to update. If not provided, updates the properties of the default user script world. Values with leading underscores (`_`) are reserved.
@@ -14821,7 +15003,7 @@ export namespace Browser {
14821
15003
  ids?: string[] | undefined;
14822
15004
  }
14823
15005
 
14824
- // /** @since Chrome 135 */
15006
+ /** @since Chrome 135 */
14825
15007
  type InjectionTarget =
14826
15008
  & {
14827
15009
  /** The ID of the tab into which to inject. */
@@ -14859,13 +15041,13 @@ export namespace Browser {
14859
15041
  allFrames?: boolean | undefined;
14860
15042
  /** Specifies wildcard patterns for pages this user script will NOT be injected into. */
14861
15043
  excludeGlobs?: string[] | undefined;
14862
- /**Excludes pages that this user script would otherwise be injected into. See Match Patterns for more details on the syntax of these strings. */
15044
+ /** Excludes pages that this user script would otherwise be injected into. See Match Patterns for more details on the syntax of these strings. */
14863
15045
  excludeMatches?: string[] | undefined;
14864
15046
  /** The ID of the user script specified in the API call. This property must not start with a '_' as it's reserved as a prefix for generated script IDs. */
14865
15047
  id: string;
14866
15048
  /** Specifies wildcard patterns for pages this user script will be injected into. */
14867
15049
  includeGlobs?: string[] | undefined;
14868
- /** The list of ScriptSource objects defining sources of scripts to be injected into matching pages. This property must be specified for {@link register}, and when specified it must be a non-empty array.*/
15050
+ /** The list of ScriptSource objects defining sources of scripts to be injected into matching pages. This property must be specified for {@link register}, and when specified it must be a non-empty array. */
14869
15051
  js?: ScriptSource[] | undefined;
14870
15052
  /** Specifies which pages this user script will be injected into. See Match Patterns for more details on the syntax of these strings. This property must be specified for {@link register}. */
14871
15053
  matches?: string[] | undefined;