@types/chrome 0.2.4 → 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 (3) hide show
  1. chrome/README.md +1 -1
  2. chrome/index.d.ts +150 -23
  3. chrome/package.json +2 -2
chrome/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for chrome (https://developer.chrome.com/
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/chrome.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Fri, 31 Jul 2026 19:30:21 GMT
11
+ * Last updated: Fri, 31 Jul 2026 22:47:24 GMT
12
12
  * Dependencies: [@types/filesystem](https://npmjs.com/package/@types/filesystem), [@types/har-format](https://npmjs.com/package/@types/har-format)
13
13
 
14
14
  # Credits
chrome/index.d.ts CHANGED
@@ -407,7 +407,7 @@ declare namespace chrome {
407
407
  /** 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. */
408
408
  periodInMinutes?: number | undefined;
409
409
  /** Time at which the alarm should fire, in milliseconds past the epoch (e.g. `Date.now() + n`). */
410
- when?: never | undefined;
410
+ when?: undefined;
411
411
  }
412
412
  | {
413
413
  /** Length of time in minutes after which the {@link onAlarm} event should fire. */
@@ -415,11 +415,11 @@ declare namespace chrome {
415
415
  /** 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. */
416
416
  periodInMinutes: number;
417
417
  /** Time at which the alarm should fire, in milliseconds past the epoch (e.g. `Date.now() + n`). */
418
- when?: number | undefined;
418
+ when?: undefined;
419
419
  }
420
420
  | {
421
421
  /** Length of time in minutes after which the {@link onAlarm} event should fire. */
422
- delayInMinutes?: never | undefined;
422
+ delayInMinutes?: undefined;
423
423
  /** 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. */
424
424
  periodInMinutes?: number | undefined;
425
425
  /** Time at which the alarm should fire, in milliseconds past the epoch (e.g. `Date.now() + n`). */
@@ -2831,11 +2831,28 @@ declare namespace chrome {
2831
2831
  * Manifest: "devtools_page"
2832
2832
  */
2833
2833
  export namespace devtools.inspectedWindow {
2834
+ interface SetContentResult {
2835
+ code: string;
2836
+ description: string;
2837
+ details: string[];
2838
+ isError?: boolean;
2839
+ }
2840
+
2834
2841
  /** A resource within the inspected page, such as a document, a script, or an image. */
2835
2842
  interface Resource {
2836
2843
  /** The URL of the resource. */
2837
2844
  url: string;
2838
- /** Gets the content of the resource. */
2845
+ /**
2846
+ * Gets the content of the resource.
2847
+ *
2848
+ * Can return its result via Promise in Manifest V3 or later since Chrome 151.
2849
+ */
2850
+ getContent(): Promise<{
2851
+ /** Content of the resource (potentially encoded). */
2852
+ content: string;
2853
+ /** Empty if the content is not encoded, encoding name otherwise. Currently, only base64 is supported.*/
2854
+ encoding: string;
2855
+ }>;
2839
2856
  getContent(
2840
2857
  callback: (
2841
2858
  /** Content of the resource (potentially encoded). */
@@ -2848,14 +2865,17 @@ declare namespace chrome {
2848
2865
  * Sets the content of the resource.
2849
2866
  * @param content New content of the resource. Only resources with the text type are currently supported.
2850
2867
  * @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.
2868
+ *
2869
+ * Can return its result via Promise in Manifest V3 or later since Chrome 151.
2851
2870
  */
2852
2871
  setContent(
2853
2872
  content: string,
2854
2873
  commit: boolean,
2855
- callback?: (
2856
- /** Set to undefined if the resource content was set successfully; describes error otherwise. */
2857
- error?: object,
2858
- ) => void,
2874
+ ): Promise<undefined>;
2875
+ setContent(
2876
+ content: string,
2877
+ commit: boolean,
2878
+ callback: (result: SetContentResult) => void,
2859
2879
  ): void;
2860
2880
  }
2861
2881
 
@@ -2895,7 +2915,13 @@ declare namespace chrome {
2895
2915
  * @param expression An expression to evaluate.
2896
2916
  * @param options The options parameter can contain one or more options.
2897
2917
  * @param callback A function called when evaluation completes.
2918
+ *
2919
+ * Can return its result via Promise in Manifest V3 or later since Chrome 151.
2898
2920
  */
2921
+ function eval<T = { [key: string]: unknown }>(
2922
+ expression: string,
2923
+ options?: EvalOptions,
2924
+ ): Promise<{ result: T; exceptionInfo: EvaluationExceptionInfo }>;
2899
2925
  function eval<T = { [key: string]: unknown }>(
2900
2926
  expression: string,
2901
2927
  callback?: (result: T, exceptionInfo: EvaluationExceptionInfo) => void,
@@ -2906,7 +2932,12 @@ declare namespace chrome {
2906
2932
  callback?: (result: T, exceptionInfo: EvaluationExceptionInfo) => void,
2907
2933
  ): void;
2908
2934
 
2909
- /** Retrieves the list of resources from the inspected page. */
2935
+ /**
2936
+ * Retrieves the list of resources from the inspected page.
2937
+ *
2938
+ * Can return its result via Promise in Manifest V3 or later since Chrome 151.
2939
+ */
2940
+ function getResources(): Promise<Resource[]>;
2910
2941
  function getResources(callback: (resources: Resource[]) => void): void;
2911
2942
 
2912
2943
  /** Fired when a new resource is added to the inspected page. */
@@ -2939,7 +2970,17 @@ declare namespace chrome {
2939
2970
  export namespace devtools.network {
2940
2971
  /** Represents a network request for a document resource (script, image and so on). See HAR Specification for reference. */
2941
2972
  interface Request extends HARFormatEntry {
2942
- /** Returns content of the response body. */
2973
+ /**
2974
+ * Returns content of the response body.
2975
+ *
2976
+ * Can return its result via Promise in Manifest V3 or later since Chrome 151.
2977
+ */
2978
+ getContent(): Promise<{
2979
+ /** Content of the response body (potentially encoded). */
2980
+ content: string;
2981
+ /** Empty if content is not encoded, encoding name otherwise. Currently, only base64 is supported. */
2982
+ encoding: string;
2983
+ }>;
2943
2984
  getContent(
2944
2985
  callback: (
2945
2986
  /** Content of the response body (potentially encoded). */
@@ -2950,7 +2991,12 @@ declare namespace chrome {
2950
2991
  ): void;
2951
2992
  }
2952
2993
 
2953
- /** Returns HAR log that contains all known network requests. */
2994
+ /**
2995
+ * Returns HAR log that contains all known network requests.
2996
+ *
2997
+ * Can return its result via Promise in Manifest V3 or later since Chrome 151.
2998
+ */
2999
+ function getHAR(): Promise<HARFormatLog>;
2954
3000
  function getHAR(
2955
3001
  callback: (
2956
3002
  /** A HAR log. See HAR specification for details. */
@@ -6366,8 +6412,11 @@ declare namespace chrome {
6366
6412
  * Can return its result via Promise since Chrome 105.
6367
6413
  */
6368
6414
  function getAuthToken(details?: TokenDetails): Promise<GetAuthTokenResult>;
6369
- function getAuthToken(details: TokenDetails, callback: (result: GetAuthTokenResult) => void): void;
6370
- function getAuthToken(callback: (result: GetAuthTokenResult) => void): void;
6415
+ function getAuthToken(
6416
+ details: TokenDetails | undefined,
6417
+ callback: (token?: string, grantedScopes?: string[]) => void,
6418
+ ): void;
6419
+ function getAuthToken(callback: (token?: string, grantedScopes?: string[]) => void): void;
6371
6420
 
6372
6421
  /**
6373
6422
  * Retrieves email address and obfuscated gaia id of the user signed into a profile.
@@ -7415,6 +7464,66 @@ declare namespace chrome {
7415
7464
  const onEnabled: events.Event<(info: ExtensionInfo) => void>;
7416
7465
  }
7417
7466
 
7467
+ ////////////////////
7468
+ // MimeHandler
7469
+ ////////////////////
7470
+ /**
7471
+ * Use the `chrome.mimeHandler` API to handle MIME type streams in third-party extensions.
7472
+ * @since Chrome 151, MV3
7473
+ */
7474
+ export namespace mimeHandler {
7475
+ interface MimeHandlerOptions {
7476
+ /** Whether this handler is active for the given MIME type. */
7477
+ enabled: boolean;
7478
+ }
7479
+
7480
+ interface StreamInfo {
7481
+ /** True if loaded in an embedded context (iframe/embed/object). */
7482
+ embedded: boolean;
7483
+ /** The MIME type of the intercepted content. */
7484
+ mimeType: string;
7485
+ /** The original URL the user navigated to. */
7486
+ originalUrl: string;
7487
+ /** HTTP response headers as key-value pairs. */
7488
+ responseHeaders: { [key: string]: unknown };
7489
+ /** The URL to fetch the stream data from. */
7490
+ streamUrl: string;
7491
+ /** The tab ID containing the document. */
7492
+ tabId: number;
7493
+ }
7494
+
7495
+ /**
7496
+ * 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.
7497
+ *
7498
+ * Can return its result via Promise
7499
+ */
7500
+ function abortAndFallbackToNativeHandler(): Promise<void>;
7501
+ function abortAndFallbackToNativeHandler(callback: () => void): void;
7502
+
7503
+ /**
7504
+ * Reads the persisted options for a MIME type. Returns defaults (enabled=true) if none have been stored.
7505
+ * @param mimeType The MIME type whose options to read.
7506
+ *
7507
+ * Can return its result via Promise
7508
+ */
7509
+ function getMimeHandlerOptions(mimeType: string): Promise<MimeHandlerOptions>;
7510
+ function getMimeHandlerOptions(mimeType: string, callback: (options: MimeHandlerOptions) => void): void;
7511
+
7512
+ /** Retrieves stream information for the current MIME handler context. Must be called from within a MIME handler extension page. */
7513
+ function getStreamInfo(): Promise<StreamInfo>;
7514
+ function getStreamInfo(callback: (info: StreamInfo) => void): void;
7515
+
7516
+ /**
7517
+ * Sets the configuration options for a specified MIME type.
7518
+ * @param mimeType The MIME type to configure.
7519
+ * @param options The new options to use.
7520
+ *
7521
+ * Can return its result via Promise
7522
+ */
7523
+ function setMimeHandlerOptions(mimeType: string, options: MimeHandlerOptions): Promise<void>;
7524
+ function setMimeHandlerOptions(mimeType: string, options: MimeHandlerOptions, callback: () => void): void;
7525
+ }
7526
+
7418
7527
  ////////////////////
7419
7528
  // Notifications
7420
7529
  ////////////////////
@@ -8502,6 +8611,17 @@ declare namespace chrome {
8502
8611
  * Permissions: "privacy"
8503
8612
  */
8504
8613
  export namespace privacy {
8614
+ /**
8615
+ * Categories of Autofill data.
8616
+ * @since Chrome 151
8617
+ */
8618
+ enum AutofillBlockedType {
8619
+ CONTACT_INFO = "contact_info",
8620
+ PAYMENTS = "payments",
8621
+ IDENTITY_DOCS = "identity_docs",
8622
+ TRAVEL = "travel",
8623
+ }
8624
+
8505
8625
  /**
8506
8626
  * The IP handling policy of WebRTC.
8507
8627
  * @since Chrome 48
@@ -9609,6 +9729,18 @@ declare namespace chrome {
9609
9729
  /** 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. */
9610
9730
  open_in_tab?: boolean | undefined;
9611
9731
  } | undefined;
9732
+ /**
9733
+ * 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.
9734
+ * @since Chrome 151
9735
+ */
9736
+ mime_types_handler?: {
9737
+ "application/pdf": {
9738
+ /** The HTML file to display when a document of the corresponding MIME type is opened. This file must be located within your extension. */
9739
+ handler_url: string;
9740
+ /** Specifies whether to handle documents embedded in `<embed>`, `<object>`, or `<iframe>` elements. Defaults to `false`, meaning the handler only receives top-level navigations. */
9741
+ can_embed?: boolean;
9742
+ };
9743
+ };
9612
9744
  /** Declares optional permissions for your extension. */
9613
9745
  optional_permissions?: ManifestOptionalPermission[] | undefined;
9614
9746
  /** Declares optional host permissions for your extension. */
@@ -10824,15 +10956,10 @@ declare namespace chrome {
10824
10956
 
10825
10957
  interface MirrorModeInfo {
10826
10958
  /** The mirror mode that should be set. */
10827
- mode?: `${MirrorMode}`;
10828
- }
10829
-
10830
- interface MirrorModeInfoMixed extends MirrorModeInfo {
10831
- /** The mirror mode that should be set. */
10832
- mode: "mixed";
10833
- /** The id of the mirroring source display. */
10959
+ mode: `${MirrorMode}`;
10960
+ /** The id of the mirroring source display. This is only valid for 'mixed'. */
10834
10961
  mirroringSourceId?: string | undefined;
10835
- /** The ids of the mirroring destination displays. */
10962
+ /** The ids of the mirroring destination displays. This is only valid for 'mixed'. */
10836
10963
  mirroringDestinationIds?: string[] | undefined;
10837
10964
  }
10838
10965
 
@@ -10973,8 +11100,8 @@ declare namespace chrome {
10973
11100
  * @param info The information of the mirror mode that should be applied to the display mode.
10974
11101
  * @since Chrome 65
10975
11102
  */
10976
- function setMirrorMode(info: MirrorModeInfo | MirrorModeInfoMixed, callback: () => void): void;
10977
- function setMirrorMode(info: MirrorModeInfo | MirrorModeInfoMixed): Promise<void>;
11103
+ function setMirrorMode(info: MirrorModeInfo, callback: () => void): void;
11104
+ function setMirrorMode(info: MirrorModeInfo): Promise<void>;
10978
11105
 
10979
11106
  /** Fired when anything changes to the display configuration. */
10980
11107
  const onDisplayChanged: chrome.events.Event<() => void>;
chrome/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/chrome",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
4
4
  "description": "TypeScript definitions for chrome",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/chrome",
6
6
  "license": "MIT",
@@ -94,6 +94,6 @@
94
94
  "@types/har-format": "*"
95
95
  },
96
96
  "peerDependencies": {},
97
- "typesPublisherContentHash": "95d0e80767c8eccf24fb23319a9a50f80476549772d641082f1d22a6a2df3825",
97
+ "typesPublisherContentHash": "e51c75dde3ead4663df9abefa0b6c0b7b91334e97ff04a090ec4665fd83ff079",
98
98
  "typeScriptVersion": "5.6"
99
99
  }