@types/chrome 0.1.4 → 0.1.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 +51 -71
  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: Thu, 14 Aug 2025 07:35:10 GMT
11
+ * Last updated: Wed, 03 Sep 2025 07:03:15 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
@@ -2670,15 +2670,12 @@ declare namespace chrome {
2670
2670
  export interface Resource {
2671
2671
  /** The URL of the resource. */
2672
2672
  url: string;
2673
- /**
2674
- * Gets the content of the resource.
2675
- * @param callback A function that receives resource content when the request completes.
2676
- */
2673
+ /** Gets the content of the resource. */
2677
2674
  getContent(
2678
2675
  callback: (
2679
- /** Content of the resource (potentially encoded) */
2676
+ /** Content of the resource (potentially encoded). */
2680
2677
  content: string,
2681
- /** Empty if content is not encoded, encoding name otherwise. Currently, only base64 is supported. */
2678
+ /** Empty if the content is not encoded, encoding name otherwise. Currently, only base64 is supported. */
2682
2679
  encoding: string,
2683
2680
  ) => void,
2684
2681
  ): void;
@@ -2686,33 +2683,24 @@ declare namespace chrome {
2686
2683
  * Sets the content of the resource.
2687
2684
  * @param content New content of the resource. Only resources with the text type are currently supported.
2688
2685
  * @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.
2689
- * @param callback A function called upon request completion.
2690
2686
  */
2691
2687
  setContent(
2692
2688
  content: string,
2693
2689
  commit: boolean,
2694
2690
  callback?: (
2695
- /**
2696
- * Set to undefined if the resource content was set successfully; describes error otherwise.
2697
- */
2691
+ /** Set to undefined if the resource content was set successfully; describes error otherwise. */
2698
2692
  error?: object,
2699
2693
  ) => void,
2700
2694
  ): void;
2701
2695
  }
2702
2696
 
2703
2697
  export interface ReloadOptions {
2704
- /** Optional. If specified, the string will override the value of the User-Agent HTTP header that's sent while loading the resources of the inspected page. The string will also override the value of the navigator.userAgent property that's returned to any scripts that are running within the inspected page. */
2698
+ /** If specified, the string will override the value of the `User-Agent` HTTP header that's sent while loading the resources of the inspected page. The string will also override the value of the `navigator.userAgent` property that's returned to any scripts that are running within the inspected page. */
2705
2699
  userAgent?: string | undefined;
2706
- /** Optional. When true, the loader will ignore the cache for all inspected page resources loaded before the load event is fired. The effect is similar to pressing Ctrl+Shift+R in the inspected window or within the Developer Tools window. */
2700
+ /** When true, the loader will bypass the cache for all inspected page resources loaded before the `load` event is fired. The effect is similar to pressing Ctrl+Shift+R in the inspected window or within the Developer Tools window. */
2707
2701
  ignoreCache?: boolean | undefined;
2708
- /** Optional. If specified, the script will be injected into every frame of the inspected page immediately upon load, before any of the frame's scripts. The script will not be injected after subsequent reloads—for example, if the user presses Ctrl+R. */
2702
+ /** If specified, the script will be injected into every frame of the inspected page immediately upon load, before any of the frame's scripts. The script will not be injected after subsequent reloads—for example, if the user presses Ctrl+R. */
2709
2703
  injectedScript?: string | undefined;
2710
- /**
2711
- * Optional.
2712
- * If specified, this script evaluates into a function that accepts three string arguments: the source to preprocess, the URL of the source, and a function name if the source is an DOM event handler. The preprocessorerScript function should return a string to be compiled by Chrome in place of the input source. In the case that the source is a DOM event handler, the returned source must compile to a single JS function.
2713
- * @deprecated Deprecated since Chrome 41. Please avoid using this parameter, it will be removed soon.
2714
- */
2715
- preprocessorScript?: string | undefined;
2716
2704
  }
2717
2705
 
2718
2706
  export interface EvaluationExceptionInfo {
@@ -2730,59 +2718,48 @@ declare namespace chrome {
2730
2718
  value: string;
2731
2719
  }
2732
2720
 
2733
- export interface ResourceAddedEvent extends chrome.events.Event<(resource: Resource) => void> {}
2734
-
2735
- export interface ResourceContentCommittedEvent
2736
- extends chrome.events.Event<(resource: Resource, content: string) => void>
2737
- {}
2738
-
2739
- /** The ID of the tab being inspected. This ID may be used with chrome.tabs.* API. */
2740
- export var tabId: number;
2721
+ /** The ID of the tab being inspected. This ID may be used with {@link chrome.tabs} API. */
2722
+ export const tabId: number;
2741
2723
 
2742
2724
  /** Reloads the inspected page. */
2743
2725
  export function reload(reloadOptions?: ReloadOptions): void;
2726
+
2744
2727
  /**
2745
- * Evaluates a JavaScript expression in the context of the main frame of the inspected page. The expression must evaluate to a JSON-compliant object, otherwise an exception is thrown. The eval function can report either a DevTools-side error or a JavaScript exception that occurs during evaluation. In either case, the result parameter of the callback is undefined. In the case of a DevTools-side error, the isException parameter is non-null and has isError set to true and code set to an error code. In the case of a JavaScript error, isException is set to true and value is set to the string value of thrown object.
2728
+ * Evaluates a JavaScript expression in the context of the main frame of the inspected page. The expression must evaluate to a JSON-compliant object, otherwise an exception is thrown. The eval function can report either a DevTools-side error or a JavaScript exception that occurs during evaluation. In either case, the `result` parameter of the callback is `undefined`. In the case of a DevTools-side error, the `isException` parameter is non-null and has `isError` set to true and `code` set to an error code. In the case of a JavaScript error, `isException` is set to true and `value` is set to the string value of thrown object.
2729
+ *
2746
2730
  * @param expression An expression to evaluate.
2731
+ * @param options The options parameter can contain one or more options.
2747
2732
  * @param callback A function called when evaluation completes.
2748
- * Parameter result: The result of evaluation.
2749
- * Parameter exceptionInfo: An object providing details if an exception occurred while evaluating the expression.
2750
2733
  */
2751
- export function eval<T>(
2734
+ export function eval<T = { [key: string]: unknown }>(
2752
2735
  expression: string,
2753
2736
  callback?: (result: T, exceptionInfo: EvaluationExceptionInfo) => void,
2754
2737
  ): void;
2755
- /**
2756
- * Evaluates a JavaScript expression in the context of the main frame of the inspected page. The expression must evaluate to a JSON-compliant object, otherwise an exception is thrown. The eval function can report either a DevTools-side error or a JavaScript exception that occurs during evaluation. In either case, the result parameter of the callback is undefined. In the case of a DevTools-side error, the isException parameter is non-null and has isError set to true and code set to an error code. In the case of a JavaScript error, isException is set to true and value is set to the string value of thrown object.
2757
- * @param expression An expression to evaluate.
2758
- * @param options The options parameter can contain one or more options.
2759
- * @param callback A function called when evaluation completes.
2760
- * Parameter result: The result of evaluation.
2761
- * Parameter exceptionInfo: An object providing details if an exception occurred while evaluating the expression.
2762
- */
2763
- export function eval<T>(
2738
+ export function eval<T = { [key: string]: unknown }>(
2764
2739
  expression: string,
2765
- options?: EvalOptions,
2740
+ options: EvalOptions | undefined,
2766
2741
  callback?: (result: T, exceptionInfo: EvaluationExceptionInfo) => void,
2767
2742
  ): void;
2768
- /**
2769
- * Retrieves the list of resources from the inspected page.
2770
- * @param callback A function that receives the list of resources when the request completes.
2771
- */
2743
+
2744
+ /** Retrieves the list of resources from the inspected page. */
2772
2745
  export function getResources(callback: (resources: Resource[]) => void): void;
2773
2746
 
2774
2747
  /** Fired when a new resource is added to the inspected page. */
2775
- export var onResourceAdded: ResourceAddedEvent;
2748
+ export const onResourceAdded: events.Event<(resource: Resource) => void>;
2749
+
2776
2750
  /** Fired when a new revision of the resource is committed (e.g. user saves an edited version of the resource in the Developer Tools). */
2777
- export var onResourceContentCommitted: ResourceContentCommittedEvent;
2751
+ export const onResourceContentCommitted: events.Event<(resource: Resource, content: string) => void>;
2778
2752
 
2779
2753
  export interface EvalOptions {
2780
2754
  /** If specified, the expression is evaluated on the iframe whose URL matches the one specified. By default, the expression is evaluated in the top frame of the inspected page. */
2781
2755
  frameURL?: string | undefined;
2782
- /** Evaluate the expression in the context of the content script of the calling extension, provided that the content script is already injected into the inspected page. If not, the expression is not evaluated and the callback is invoked with the exception parameter set to an object that has the isError field set to true and the code field set to E_NOTFOUND. */
2756
+ /** Evaluate the expression in the context of the content script of the calling extension, provided that the content script is already injected into the inspected page. If not, the expression is not evaluated and the callback is invoked with the exception parameter set to an object that has the `isError` field set to true and the `code` field set to `E_NOTFOUND`. */
2783
2757
  useContentScriptContext?: boolean | undefined;
2784
- /** Evaluate the expression in the context of a content script of an extension that matches the specified origin. If given, contextSecurityOrigin overrides the 'true' setting on userContentScriptContext. */
2785
- contextSecurityOrigin?: string | undefined;
2758
+ /**
2759
+ * Evaluate the expression in the context of a content script of an extension that matches the specified origin. If given, scriptExecutionContext overrides the 'true' setting on useContentScriptContext.
2760
+ * @since Chrome 107
2761
+ */
2762
+ scriptExecutionContext?: string | undefined;
2786
2763
  }
2787
2764
  }
2788
2765
 
@@ -4198,44 +4175,47 @@ declare namespace chrome {
4198
4175
  */
4199
4176
  export namespace enterprise.deviceAttributes {
4200
4177
  /**
4201
- * @description Fetches the value of the device identifier of the directory API, that is generated by the server and identifies the cloud record of the device for querying in the cloud directory API.
4202
- * @param callback Called with the device identifier of the directory API when received.
4178
+ * Fetches the value of the device identifier of the directory API, that is generated by the server and identifies the cloud record of the device for querying in the cloud directory API. If the current user is not affiliated, returns an empty string.
4179
+ *
4180
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
4203
4181
  */
4182
+ export function getDirectoryDeviceId(): Promise<string>;
4204
4183
  export function getDirectoryDeviceId(callback: (deviceId: string) => void): void;
4184
+
4205
4185
  /**
4186
+ * Fetches the device's serial number. Please note the purpose of this API is to administrate the device (e.g. generating Certificate Sign Requests for device-wide certificates). This API may not be used for tracking devices without the consent of the device's administrator. If the current user is not affiliated, returns an empty string.
4187
+ *
4188
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
4206
4189
  * @since Chrome 66
4207
- * @description
4208
- * Fetches the device's serial number.
4209
- * Please note the purpose of this API is to administrate the device
4210
- * (e.g. generating Certificate Sign Requests for device-wide certificates).
4211
- * This API may not be used for tracking devices without the consent of the device's administrator.
4212
- * If the current user is not affiliated, returns an empty string.
4213
- * @param callback Called with the serial number of the device.
4214
4190
  */
4191
+ export function getDeviceSerialNumber(): Promise<string>;
4215
4192
  export function getDeviceSerialNumber(callback: (serialNumber: string) => void): void;
4193
+
4216
4194
  /**
4195
+ * Fetches the administrator-annotated Asset Id. If the current user is not affiliated or no Asset Id has been set by the administrator, returns an empty string.
4196
+ *
4197
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
4217
4198
  * @since Chrome 66
4218
- * @description
4219
- * Fetches the administrator-annotated Asset Id.
4220
- * If the current user is not affiliated or no Asset Id has been set by the administrator, returns an empty string.
4221
- * @param callback Called with the Asset ID of the device.
4222
4199
  */
4200
+ export function getDeviceAssetId(): Promise<string>;
4223
4201
  export function getDeviceAssetId(callback: (assetId: string) => void): void;
4202
+
4224
4203
  /**
4204
+ * Fetches the administrator-annotated Location. If the current user is not affiliated or no Annotated Location has been set by the administrator, returns an empty string.
4205
+ *
4206
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
4225
4207
  * @since Chrome 66
4226
- * @description
4227
- * Fetches the administrator-annotated Location.
4228
- * If the current user is not affiliated or no Annotated Location has been set by the administrator, returns an empty string.
4229
- * @param callback Called with the Annotated Location of the device.
4230
4208
  */
4209
+ export function getDeviceAnnotatedLocation(): Promise<string>;
4231
4210
  export function getDeviceAnnotatedLocation(callback: (annotatedLocation: string) => void): void;
4211
+
4232
4212
  /**
4213
+ * Fetches the device's hostname as set by DeviceHostnameTemplate policy. If the current user is not affiliated or no hostname has been set by the enterprise policy, returns an empty string.
4214
+ *
4215
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
4233
4216
  * @since Chrome 82
4234
- * @description
4235
- * Fetches the device's hostname as set by DeviceHostnameTemplate policy.
4236
- * If the current user is not affiliated or no hostname has been set by the enterprise policy, returns an empty string.
4237
- * @param callback Called with the hostname of the device.
4238
4217
  */
4218
+ export function getDeviceHostname(): Promise<string>;
4239
4219
  export function getDeviceHostname(callback: (hostname: string) => void): void;
4240
4220
  }
4241
4221
 
chrome/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/chrome",
3
- "version": "0.1.4",
3
+ "version": "0.1.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": "eb74f1a2e293946d48df085e621691e4fa23a2c5af6aea88f3ed4d5d1e7fefb6",
97
+ "typesPublisherContentHash": "e1fac3378e3f586d03c2f3829b254da0467a69917acf1c6921ddc3c4a76a1ebc",
98
98
  "typeScriptVersion": "5.2"
99
99
  }