@wxt-dev/browser 0.2.2 → 0.2.5

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 +242 -62
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.5",
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.5",
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": "*",
@@ -181,14 +181,25 @@ 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 {
@@ -398,7 +409,7 @@ export namespace Browser {
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
415
  /** Length of time in minutes after which the {@link onAlarm} event should fire. */
@@ -406,11 +417,11 @@ export namespace Browser {
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
423
  /** Length of time in minutes after which the {@link onAlarm} event should fire. */
413
- delayInMinutes?: never | undefined;
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`). */
@@ -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;
@@ -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. */
@@ -6349,8 +6414,11 @@ export namespace Browser {
6349
6414
  * Can return its result via Promise since Chrome 105.
6350
6415
  */
6351
6416
  function getAuthToken(details?: TokenDetails): Promise<GetAuthTokenResult>;
6352
- function getAuthToken(details: TokenDetails, callback: (result: GetAuthTokenResult) => void): void;
6353
- function getAuthToken(callback: (result: GetAuthTokenResult) => void): void;
6417
+ function getAuthToken(
6418
+ details: TokenDetails | undefined,
6419
+ callback: (token?: string, grantedScopes?: string[]) => void,
6420
+ ): void;
6421
+ function getAuthToken(callback: (token?: string, grantedScopes?: string[]) => void): void;
6354
6422
 
6355
6423
  /**
6356
6424
  * Retrieves email address and obfuscated gaia id of the user signed into a profile.
@@ -7232,7 +7300,7 @@ export namespace Browser {
7232
7300
  enum ExtensionType {
7233
7301
  EXTENSION = "extension",
7234
7302
  HOSTED_APP = "hosted_app",
7235
- PACKAGE_APP = "package_app",
7303
+ PACKAGED_APP = "packaged_app",
7236
7304
  LEGACY_PACKAGED_APP = "legacy_packaged_app",
7237
7305
  THEME = "theme",
7238
7306
  LOGIN_SCREEN_EXTENSION = "login_screen_extension",
@@ -7398,6 +7466,66 @@ export namespace Browser {
7398
7466
  const onEnabled: events.Event<(info: ExtensionInfo) => void>;
7399
7467
  }
7400
7468
 
7469
+ ////////////////////
7470
+ // MimeHandler
7471
+ ////////////////////
7472
+ /**
7473
+ * Use the `Browser.mimeHandler` API to handle MIME type streams in third-party extensions.
7474
+ * @since Chrome 151, MV3
7475
+ */
7476
+ export namespace mimeHandler {
7477
+ interface MimeHandlerOptions {
7478
+ /** Whether this handler is active for the given MIME type. */
7479
+ enabled: boolean;
7480
+ }
7481
+
7482
+ interface StreamInfo {
7483
+ /** True if loaded in an embedded context (iframe/embed/object). */
7484
+ embedded: boolean;
7485
+ /** The MIME type of the intercepted content. */
7486
+ mimeType: string;
7487
+ /** The original URL the user navigated to. */
7488
+ originalUrl: string;
7489
+ /** HTTP response headers as key-value pairs. */
7490
+ responseHeaders: { [key: string]: unknown };
7491
+ /** The URL to fetch the stream data from. */
7492
+ streamUrl: string;
7493
+ /** The tab ID containing the document. */
7494
+ tabId: number;
7495
+ }
7496
+
7497
+ /**
7498
+ * 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.
7499
+ *
7500
+ * Can return its result via Promise
7501
+ */
7502
+ function abortAndFallbackToNativeHandler(): Promise<void>;
7503
+ function abortAndFallbackToNativeHandler(callback: () => void): void;
7504
+
7505
+ /**
7506
+ * Reads the persisted options for a MIME type. Returns defaults (enabled=true) if none have been stored.
7507
+ * @param mimeType The MIME type whose options to read.
7508
+ *
7509
+ * Can return its result via Promise
7510
+ */
7511
+ function getMimeHandlerOptions(mimeType: string): Promise<MimeHandlerOptions>;
7512
+ function getMimeHandlerOptions(mimeType: string, callback: (options: MimeHandlerOptions) => void): void;
7513
+
7514
+ /** Retrieves stream information for the current MIME handler context. Must be called from within a MIME handler extension page. */
7515
+ function getStreamInfo(): Promise<StreamInfo>;
7516
+ function getStreamInfo(callback: (info: StreamInfo) => void): void;
7517
+
7518
+ /**
7519
+ * Sets the configuration options for a specified MIME type.
7520
+ * @param mimeType The MIME type to configure.
7521
+ * @param options The new options to use.
7522
+ *
7523
+ * Can return its result via Promise
7524
+ */
7525
+ function setMimeHandlerOptions(mimeType: string, options: MimeHandlerOptions): Promise<void>;
7526
+ function setMimeHandlerOptions(mimeType: string, options: MimeHandlerOptions, callback: () => void): void;
7527
+ }
7528
+
7401
7529
  ////////////////////
7402
7530
  // Notifications
7403
7531
  ////////////////////
@@ -8485,6 +8613,17 @@ export namespace Browser {
8485
8613
  * Permissions: "privacy"
8486
8614
  */
8487
8615
  export namespace privacy {
8616
+ /**
8617
+ * Categories of Autofill data.
8618
+ * @since Chrome 151
8619
+ */
8620
+ enum AutofillBlockedType {
8621
+ CONTACT_INFO = "contact_info",
8622
+ PAYMENTS = "payments",
8623
+ IDENTITY_DOCS = "identity_docs",
8624
+ TRAVEL = "travel",
8625
+ }
8626
+
8488
8627
  /**
8489
8628
  * The IP handling policy of WebRTC.
8490
8629
  * @since Chrome 48
@@ -9167,9 +9306,11 @@ export namespace Browser {
9167
9306
  }
9168
9307
 
9169
9308
  interface ManifestAction {
9170
- default_icon?: ManifestIcons | undefined;
9309
+ default_icon?: ManifestIcons | string | undefined;
9171
9310
  default_title?: string | undefined;
9172
9311
  default_popup?: string | undefined;
9312
+ /** @default 'enabled' */
9313
+ default_state?: "enabled" | "disabled";
9173
9314
  }
9174
9315
 
9175
9316
  /** Source: https://developer.chrome.com/docs/extensions/reference/permissions-list */
@@ -9275,22 +9416,37 @@ export namespace Browser {
9275
9416
  | "webAuthenticationProxy"
9276
9417
  >;
9277
9418
 
9419
+ /** A search engine. */
9278
9420
  interface SearchProvider {
9421
+ /** Name of the search engine displayed to user. This is required if you don't set `prepopulated_id`. */
9279
9422
  name?: string | undefined;
9423
+ /** An omnibox keyword for the search engine. This is required if you don't set `prepopulated_id`. */
9280
9424
  keyword?: string | undefined;
9425
+ /** An icon URL for the search engine. This is required if you don't set `prepopulated_id`. */
9281
9426
  favicon_url?: string | undefined;
9427
+ /** The search URL the search engine uses. */
9282
9428
  search_url: string;
9429
+ /** The encoding used for search terms. This is required if you don't set `prepopulated_id`. */
9283
9430
  encoding?: string | undefined;
9431
+ /** The URL the search engine uses for suggestions. If this isn't used, the engine doesn't support suggestions. */
9284
9432
  suggest_url?: string | undefined;
9285
9433
  instant_url?: string | undefined;
9434
+ /** The URL the search engine uses for image search. If this isn't used, the engine doesn't support image search. */
9286
9435
  image_url?: string | undefined;
9436
+ /** The post parameters for `search_url`. */
9287
9437
  search_url_post_params?: string | undefined;
9438
+ /** The post parameters for `suggest_url`. */
9288
9439
  suggest_url_post_params?: string | undefined;
9440
+ /** The post parameters for `instant_url`. */
9289
9441
  instant_url_post_params?: string | undefined;
9442
+ /** The post parameters for `image_url`. */
9290
9443
  image_url_post_params?: string | undefined;
9444
+ /** A list of URL patterns that can be used in addition to `search_url`. */
9291
9445
  alternate_urls?: string[] | undefined;
9446
+ /** An ID for Chrome's built-in search engine. */
9292
9447
  prepopulated_id?: number | undefined;
9293
- is_default?: boolean | undefined;
9448
+ /** Specifies whether the search provider should be default. */
9449
+ is_default: boolean;
9294
9450
  }
9295
9451
 
9296
9452
  interface ManifestBase {
@@ -9315,8 +9471,10 @@ export namespace Browser {
9315
9471
  author?: { email: string } | undefined;
9316
9472
  /** Defines overrides for selected Chrome settings. */
9317
9473
  chrome_settings_overrides?: {
9474
+ /** The new value for the homepage. */
9318
9475
  homepage?: string | undefined;
9319
9476
  search_provider?: SearchProvider | undefined;
9477
+ /** An array of length one containing a URL to be used as the startup page. */
9320
9478
  startup_pages?: string[] | undefined;
9321
9479
  } | undefined;
9322
9480
  /** Defines overrides for default Chrome pages. */
@@ -9328,13 +9486,16 @@ export namespace Browser {
9328
9486
  /** Defines keyboard shortcuts within the extension. */
9329
9487
  commands?: {
9330
9488
  [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;
9489
+ suggested_key?:
9490
+ | {
9491
+ default?: string | undefined;
9492
+ windows?: string | undefined;
9493
+ mac?: string | undefined;
9494
+ chromeos?: string | undefined;
9495
+ linux?: string | undefined;
9496
+ }
9497
+ | string
9498
+ | undefined;
9338
9499
  description?: string | undefined;
9339
9500
  global?: boolean | undefined;
9340
9501
  };
@@ -9350,7 +9511,7 @@ export namespace Browser {
9350
9511
  cross_origin_opener_policy?: { value: string } | undefined;
9351
9512
  current_locale?: string | undefined;
9352
9513
  /** Defines static rules for the declarativeNetRequest API, which allows blocking and modifying of network requests. */
9353
- declarative_net_request?: { rule_resources?: declarativeNetRequest.Ruleset[] } | undefined;
9514
+ declarative_net_request?: { rule_resources: declarativeNetRequest.Ruleset[] } | undefined;
9354
9515
  /** Defines pages that use the DevTools APIs. */
9355
9516
  devtools_page?: string | undefined;
9356
9517
  event_rules?:
@@ -9422,20 +9583,13 @@ export namespace Browser {
9422
9583
  /** 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
9584
  oauth2?: {
9424
9585
  client_id: string;
9425
- scopes?: string[] | undefined;
9586
+ scopes: string[];
9426
9587
  } | undefined;
9427
9588
  offline_enabled?: boolean | undefined;
9428
9589
  /** Allows the extension to register a keyword in Chrome's address bar. */
9429
9590
  omnibox?: { keyword: string } | undefined;
9430
9591
  /** Specifies a path to an options.html file for the extension to use as an options page. */
9431
9592
  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
9593
  /** Lists technologies required to use the extension. */
9440
9594
  requirements?: {
9441
9595
  "3D"?: { features?: string[] | undefined } | undefined;
@@ -9471,8 +9625,8 @@ export namespace Browser {
9471
9625
  manifest_version: 2;
9472
9626
 
9473
9627
  // Pick one (or none)
9474
- browser_action?: ManifestAction | undefined;
9475
- page_action?: ManifestAction | undefined;
9628
+ browser_action?: Omit<ManifestAction, "default_state"> | undefined;
9629
+ page_action?: Omit<ManifestAction, "default_state"> | undefined;
9476
9630
 
9477
9631
  // Optional
9478
9632
  background?:
@@ -9498,6 +9652,15 @@ export namespace Browser {
9498
9652
  | undefined;
9499
9653
  /** Defines restrictions on the scripts, styles, and other resources an extension can use. */
9500
9654
  content_security_policy?: string | undefined;
9655
+ /** Specifies a path to an HTML file that lets a user change extension options from the Chrome Extensions page. */
9656
+ options_ui?: {
9657
+ /** Path to the options page, relative to the extension's root. */
9658
+ page: string;
9659
+ /** If `true`, a Chrome user agent stylesheet will be applied to your options page. Defaults to `false`. */
9660
+ chrome_style?: boolean | undefined;
9661
+ /** 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`. */
9662
+ open_in_tab?: boolean | undefined;
9663
+ } | undefined;
9501
9664
  /** Declares optional permissions for your extension. */
9502
9665
  optional_permissions?: (ManifestOptionalPermission | string)[] | undefined;
9503
9666
  /** Enables use of particular extension APIs. */
@@ -9561,6 +9724,25 @@ export namespace Browser {
9561
9724
  | undefined;
9562
9725
  /** 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
9726
  host_permissions?: string[] | undefined;
9727
+ /** Specifies a path to an HTML file that lets a user change extension options from the Chrome Extensions page. */
9728
+ options_ui?: {
9729
+ /** Specifies the path to the options page, relative to the extension's root. */
9730
+ page: string;
9731
+ /** 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. */
9732
+ open_in_tab?: boolean | undefined;
9733
+ } | undefined;
9734
+ /**
9735
+ * 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.
9736
+ * @since Chrome 151
9737
+ */
9738
+ mime_types_handler?: {
9739
+ "application/pdf": {
9740
+ /** The HTML file to display when a document of the corresponding MIME type is opened. This file must be located within your extension. */
9741
+ handler_url: string;
9742
+ /** Specifies whether to handle documents embedded in `<embed>`, `<object>`, or `<iframe>` elements. Defaults to `false`, meaning the handler only receives top-level navigations. */
9743
+ can_embed?: boolean;
9744
+ };
9745
+ };
9564
9746
  /** Declares optional permissions for your extension. */
9565
9747
  optional_permissions?: ManifestOptionalPermission[] | undefined;
9566
9748
  /** Declares optional host permissions for your extension. */
@@ -10776,15 +10958,10 @@ export namespace Browser {
10776
10958
 
10777
10959
  interface MirrorModeInfo {
10778
10960
  /** 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. */
10961
+ mode: `${MirrorMode}`;
10962
+ /** The id of the mirroring source display. This is only valid for 'mixed'. */
10786
10963
  mirroringSourceId?: string | undefined;
10787
- /** The ids of the mirroring destination displays. */
10964
+ /** The ids of the mirroring destination displays. This is only valid for 'mixed'. */
10788
10965
  mirroringDestinationIds?: string[] | undefined;
10789
10966
  }
10790
10967
 
@@ -10925,8 +11102,8 @@ export namespace Browser {
10925
11102
  * @param info The information of the mirror mode that should be applied to the display mode.
10926
11103
  * @since Chrome 65
10927
11104
  */
10928
- function setMirrorMode(info: MirrorModeInfo | MirrorModeInfoMixed, callback: () => void): void;
10929
- function setMirrorMode(info: MirrorModeInfo | MirrorModeInfoMixed): Promise<void>;
11105
+ function setMirrorMode(info: MirrorModeInfo, callback: () => void): void;
11106
+ function setMirrorMode(info: MirrorModeInfo): Promise<void>;
10930
11107
 
10931
11108
  /** Fired when anything changes to the display configuration. */
10932
11109
  const onDisplayChanged: Browser.events.Event<() => void>;
@@ -11147,7 +11324,7 @@ export namespace Browser {
11147
11324
  * The last time the tab became active in its window as the number of milliseconds since epoch.
11148
11325
  * @since Chrome 121
11149
11326
  */
11150
- lastAccessed?: number | undefined;
11327
+ lastAccessed: number;
11151
11328
  }
11152
11329
 
11153
11330
  /** The tab's loading status. */
@@ -11717,8 +11894,11 @@ export namespace Browser {
11717
11894
  function insertCSS(details: extensionTypes.InjectDetails): Promise<void>;
11718
11895
  function insertCSS(tabId: number | undefined, details: extensionTypes.InjectDetails): Promise<void>;
11719
11896
  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;
11897
+ function insertCSS(
11898
+ tabId: number | undefined,
11899
+ details: extensionTypes.InjectDetails,
11900
+ callback: () => void,
11901
+ ): void;
11722
11902
 
11723
11903
  /**
11724
11904
  * Highlights the given tabs and focuses on the first of group. Will appear to do nothing if the specified tab is currently active.