@types/chrome 0.0.303 → 0.0.304

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 +69 -1
  3. chrome/package.json +2 -2
chrome/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for chrome (http://developer.chrome.com/e
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/chrome.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Sat, 08 Feb 2025 01:29:12 GMT
11
+ * Last updated: Sat, 08 Feb 2025 13:04:27 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
@@ -6826,6 +6826,22 @@ declare namespace chrome {
6826
6826
  permissions?: chrome.runtime.ManifestPermissions[];
6827
6827
  }
6828
6828
 
6829
+ export interface AddHostAccessRequest {
6830
+ /** The id of a document where host access requests can be shown. Must be the top-level document within a tab. If provided, the request is shown on the tab of the specified document and is removed when the document navigates to a new origin. Adding a new request will override any existent request for `tabId`. This or `tabId` must be specified. */
6831
+ documentId?: string;
6832
+ /** The URL pattern where host access requests can be shown. If provided, host access requests will only be shown on URLs that match this pattern. */
6833
+ pattern?: string;
6834
+ /** The id of the tab where host access requests can be shown. If provided, the request is shown on the specified tab and is removed when the tab navigates to a new origin. Adding a new request will override an existent request for `documentId`. This or `documentId` must be specified. */
6835
+ tabId?: number;
6836
+ }
6837
+
6838
+ /**
6839
+ * Adds a host access request. Request will only be signaled to the user if extension can be granted access to the host in the request. Request will be reset on cross-origin navigation. When accepted, grants persistent access to the site’s top origin
6840
+ * @since Chrome 133
6841
+ */
6842
+ export function addHostAccessRequest(request: AddHostAccessRequest): Promise<void>;
6843
+ export function addHostAccessRequest(request: AddHostAccessRequest, callback: () => void): void;
6844
+
6829
6845
  /**
6830
6846
  * Checks if the extension has the specified permissions.
6831
6847
  * Can return its result via Promise in Manifest V3 or later since Chrome 96.
@@ -6858,6 +6874,22 @@ declare namespace chrome {
6858
6874
  export function remove(permissions: Permissions): Promise<boolean>;
6859
6875
  export function remove(permissions: Permissions, callback: (removed: boolean) => void): void;
6860
6876
 
6877
+ export interface RemoveHostAccessRequest {
6878
+ /** The id of a document where host access request will be removed. Must be the top-level document within a tab. This or `tabId` must be specified. */
6879
+ documentId?: string;
6880
+ /** The URL pattern where host access request will be removed. If provided, this must exactly match the pattern of an existing host access request. */
6881
+ pattern?: string;
6882
+ /** The id of the tab where host access request will be removed. This or `documentId` must be specified. */
6883
+ tabId?: number;
6884
+ }
6885
+
6886
+ /**
6887
+ * Removes a host access request, if existent.
6888
+ * @since Chrome 133
6889
+ */
6890
+ export function removeHostAccessRequest(request: RemoveHostAccessRequest): Promise<void>;
6891
+ export function removeHostAccessRequest(request: RemoveHostAccessRequest, callback: () => void): void;
6892
+
6861
6893
  /** Fired when access to permissions has been removed from the extension. */
6862
6894
  export const onRemoved: chrome.events.Event<(permissions: Permissions) => void>;
6863
6895
 
@@ -8629,7 +8661,7 @@ declare namespace chrome {
8629
8661
  export function connectNative(application: string): Port;
8630
8662
  /**
8631
8663
  * Retrieves the JavaScript 'window' object for the background page running inside the current extension/app. If the background page is an event page, the system will ensure it is loaded before calling the callback. If there is no background page, an error is set.
8632
- * @deprecated Background pages do not exist in MV3 extensions.
8664
+ * @deprecated Removed since Chrome 133. Background pages do not exist in MV3 extensions.
8633
8665
  */
8634
8666
  export function getBackgroundPage(): Promise<Window>;
8635
8667
  /** Retrieves the JavaScript 'window' object for the background page running inside the current extension/app. If the background page is an event page, the system will ensure it is loaded before calling the callback. If there is no background page, an error is set. */
@@ -13873,6 +13905,31 @@ declare namespace chrome {
13873
13905
  rulesMatchedInfo: MatchedRuleInfo[];
13874
13906
  }
13875
13907
 
13908
+ /** @since Chrome 103 */
13909
+ export interface TestMatchOutcomeResult {
13910
+ /** The rules (if any) that match the hypothetical request. */
13911
+ matchedRules: MatchedRule[];
13912
+ }
13913
+
13914
+ /** @since Chrome 103 */
13915
+ export interface TestMatchRequestDetails {
13916
+ /** The initiator URL (if any) for the hypothetical request. */
13917
+ initiator?: string;
13918
+ /** Standard HTTP method of the hypothetical request. Defaults to "get" for HTTP requests and is ignored for non-HTTP requests. */
13919
+ method?: `${RequestMethod}`;
13920
+ /**
13921
+ * The headers provided by a hypothetical response if the request does not get blocked or redirected before it is sent. Represented as an object which maps a header name to a list of string values. If not specified, the hypothetical response would return empty response headers, which can match rules which match on the non-existence of headers. E.g. `{"content-type": ["text/html; charset=utf-8", "multipart/form-data"]}`
13922
+ * @since Chrome 129
13923
+ */
13924
+ responseHeaders?: { [name: string]: unknown };
13925
+ /** The ID of the tab in which the hypothetical request takes place. Does not need to correspond to a real tab ID. Default is -1, meaning that the request isn't related to a tab. */
13926
+ tabId?: number;
13927
+ /** The resource type of the hypothetical request. */
13928
+ type: `${ResourceType}`;
13929
+ /** The URL of the hypothetical request. */
13930
+ url: string;
13931
+ }
13932
+
13876
13933
  /** Returns the number of static rules an extension can enable before the global static rule limit is reached. */
13877
13934
  export function getAvailableStaticRuleCount(callback: (count: number) => void): void;
13878
13935
 
@@ -13976,6 +14033,17 @@ declare namespace chrome {
13976
14033
  */
13977
14034
  export function setExtensionActionOptions(options: ExtensionActionOptions): Promise<void>;
13978
14035
 
14036
+ /**
14037
+ * Checks if any of the extension's declarativeNetRequest rules would match a hypothetical request. Note: Only available for unpacked extensions as this is only intended to be used during extension development.
14038
+ * @param request
14039
+ * @since Chrome 103
14040
+ */
14041
+ export function testMatchOutcome(request: TestMatchRequestDetails): Promise<TestMatchOutcomeResult>;
14042
+ export function testMatchOutcome(
14043
+ request: TestMatchRequestDetails,
14044
+ callback: (result: TestMatchOutcomeResult) => void,
14045
+ ): void;
14046
+
13979
14047
  /** Modifies the current set of dynamic rules for the extension.
13980
14048
  * The rules with IDs listed in options.removeRuleIds are first removed, and then the rules given in options.addRules are added.
13981
14049
  *
chrome/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/chrome",
3
- "version": "0.0.303",
3
+ "version": "0.0.304",
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": "8a782f9496839a30cef0c1af84aa70a3eca1b91f613b83a9c7fa2b99c06c1803",
97
+ "typesPublisherContentHash": "9a6de45752f32c8d5612b8a4a8e95cb162157553e5b4921ba39b600aa7ca6ff8",
98
98
  "typeScriptVersion": "5.0"
99
99
  }