Skip to content

Commit 4d7098d

Browse files
authored
🤖 Merge PR DefinitelyTyped#74358 [chrome] update since Chrome 144 + update sidePanel namespace by @erwanjugand
1 parent 370cc5b commit 4d7098d

2 files changed

Lines changed: 68 additions & 4 deletions

File tree

‎types/chrome/index.d.ts‎

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,7 +1029,7 @@ declare namespace chrome {
10291029
cookies?: boolean | undefined;
10301030
/**
10311031
* Stored passwords.
1032-
* @deprecated Support for password deletion through extensions has been removed. This data type will be ignored.
1032+
* @deprecated since Chrome 144. Support for password deletion through extensions has been removed. This data type will be ignored.
10331033
*/
10341034
passwords?: boolean | undefined;
10351035
/**
@@ -1125,7 +1125,7 @@ declare namespace chrome {
11251125
* Clears the browser's stored passwords.
11261126
*
11271127
* Can return its result via Promise in Manifest V3 or later since Chrome 96.
1128-
* @deprecated Support for password deletion through extensions has been removed. This function has no effect.
1128+
* @deprecated since Chrome 144. Support for password deletion through extensions has been removed. This function has no effect.
11291129
*/
11301130
export function removePasswords(options: RemovalOptions): Promise<void>;
11311131
export function removePasswords(options: RemovalOptions, callback: () => void): void;
@@ -3779,6 +3779,8 @@ declare namespace chrome {
37793779
BLOCKED_SCAN_FAILED = "blockedScanFailed",
37803780
/** For use by the Secure Enterprise Browser extension. When required, Chrome will block the download to disc and download the file directly to Google Drive. */
37813781
FORCE_SAVE_TO_GDRIVE = "forceSaveToGdrive",
3782+
/** For use by the Secure Enterprise Browser extension. When required, Chrome will block the download to disc and download the file directly to OneDrive. */
3783+
FORCE_SAVE_TO_ONEDRIVE = "forceSaveToOnedrive",
37823784
}
37833785

37843786
export interface DownloadItem {
@@ -13085,6 +13087,10 @@ declare namespace chrome {
1308513087
EXTRA_HEADERS = "extraHeaders",
1308613088
/** Specifies that the response headers should be included in the event. */
1308713089
RESPONSE_HEADERS = "responseHeaders",
13090+
/** Specifies that the SecurityInfo should be included in the event. */
13091+
SECURITY_INFO = "securityInfo",
13092+
/** Specifies that the SecurityInfo with raw bytes of certificates should be included in the event. */
13093+
SECURITY_INFO_RAW_DER = "securityInfoRawDer",
1308813094
}
1308913095

1309013096
/** @since Chrome 44 */
@@ -13145,6 +13151,23 @@ declare namespace chrome {
1314513151
OTHER = "other",
1314613152
}
1314713153

13154+
/** @since Chrome 144 */
13155+
export interface SecurityInfo {
13156+
/** A list of certificates */
13157+
certificates: {
13158+
/** Fingerprints of the certificate. */
13159+
fingerprint: {
13160+
/** sha256 fingerprint of the certificate. */
13161+
sha256: string;
13162+
};
13163+
/** Raw bytes of DER encoded server certificate */
13164+
rawDER?: ArrayBuffer;
13165+
}[];
13166+
13167+
/** State of the connection. One of secure, insecure, broken. */
13168+
state: string;
13169+
}
13170+
1314813171
/** Contains data uploaded in a URL request. */
1314913172
export interface UploadData {
1315013173
/** An ArrayBuffer with a copy of the data. */
@@ -13282,6 +13305,11 @@ declare namespace chrome {
1328213305
export interface OnHeadersReceivedDetails extends WebRequestDetails {
1328313306
/** The HTTP response headers that have been received with this response. */
1328413307
responseHeaders?: HttpHeader[];
13308+
/**
13309+
* Information about the TLS/QUIC connection used for the underlying connection. Only provided if `securityInfo` is specified in the `extraInfoSpec` parameter.
13310+
* @since Chrome 144
13311+
*/
13312+
securityInfo?: SecurityInfo;
1328513313
/** Standard HTTP status code returned by the server. */
1328613314
statusCode: number;
1328713315
/** 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.*/
@@ -14541,6 +14569,14 @@ declare namespace chrome {
1454114569
default_path: string;
1454214570
}
1454314571

14572+
/**
14573+
* Closes the extension's side panel. This is a no-op if the panel is already closed.
14574+
* @param options Specifies the context in which to close the side panel.
14575+
* @since Chrome 141
14576+
*/
14577+
export function close(options: CloseOptions): Promise<void>;
14578+
export function close(options: CloseOptions, callback: () => void): void;
14579+
1454414580
/**
1454514581
* Returns the side panel's current layout.
1454614582
* @since Chrome 140
@@ -14593,6 +14629,12 @@ declare namespace chrome {
1459314629
export function setPanelBehavior(behavior: PanelBehavior): Promise<void>;
1459414630
export function setPanelBehavior(behavior: PanelBehavior, callback: () => void): void;
1459514631

14632+
/**
14633+
* Fired when the extension's side panel is closed.
14634+
* @since Chrome 142
14635+
*/
14636+
const onClosed: events.Event<(info: PanelClosedInfo) => void>;
14637+
1459614638
/**
1459714639
* Fired when the extension's side panel is opened.
1459814640
* @since Chrome 141

‎types/chrome/test/index.ts‎

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4920,6 +4920,7 @@ function testDownloads() {
49204920
chrome.downloads.DangerType.DEEP_SCANNED_SAFE === "deepScannedSafe";
49214921
chrome.downloads.DangerType.FILE === "file";
49224922
chrome.downloads.DangerType.FORCE_SAVE_TO_GDRIVE === "forceSaveToGdrive";
4923+
chrome.downloads.DangerType.FORCE_SAVE_TO_ONEDRIVE === "forceSaveToOnedrive";
49234924
chrome.downloads.DangerType.HOST === "host";
49244925
chrome.downloads.DangerType.PASSWORD_PROTECTED === "passwordProtected";
49254926
chrome.downloads.DangerType.PROMPT_FOR_LOCAL_PASSWORD_SCANNING === "promptForLocalPasswordScanning";
@@ -5080,7 +5081,7 @@ function testDownloads() {
50805081
result.byExtensionName; // $ExpectType string | undefined
50815082
result.bytesReceived; // $ExpectType number
50825083
result.canResume; // $ExpectType boolean
5083-
result.danger; // $ExpectType "file" | "url" | "content" | "uncommon" | "host" | "unwanted" | "safe" | "accepted" | "allowlistedByPolicy" | "asyncScanning" | "asyncLocalPasswordScanning" | "passwordProtected" | "blockedTooLarge" | "sensitiveContentWarning" | "sensitiveContentBlock" | "deepScannedFailed" | "deepScannedSafe" | "deepScannedOpenedDangerous" | "promptForScanning" | "promptForLocalPasswordScanning" | "accountCompromise" | "blockedScanFailed" | "forceSaveToGdrive"
5084+
result.danger; // $ExpectType "file" | "url" | "content" | "uncommon" | "host" | "unwanted" | "safe" | "accepted" | "allowlistedByPolicy" | "asyncScanning" | "asyncLocalPasswordScanning" | "passwordProtected" | "blockedTooLarge" | "sensitiveContentWarning" | "sensitiveContentBlock" | "deepScannedFailed" | "deepScannedSafe" | "deepScannedOpenedDangerous" | "promptForScanning" | "promptForLocalPasswordScanning" | "accountCompromise" | "blockedScanFailed" | "forceSaveToGdrive" | "forceSaveToOnedrive"
50845085
result.endTime; // $ExpectType string | undefined
50855086
result.error; // $ExpectType "CRASH" | "FILE_ACCESS_DENIED" | "FILE_BLOCKED" | "FILE_FAILED" | "FILE_HASH_MISMATCH" | "FILE_NAME_TOO_LONG" | "FILE_NO_SPACE" | "FILE_SAME_AS_SOURCE" | "FILE_SECURITY_CHECK_FAILED" | "FILE_TOO_LARGE" | "FILE_TOO_SHORT" | "FILE_TRANSIENT_ERROR" | "FILE_VIRUS_INFECTED" | "NETWORK_DISCONNECTED" | "NETWORK_FAILED" | "NETWORK_INVALID_REQUEST" | "NETWORK_SERVER_DOWN" | "NETWORK_TIMEOUT" | "SERVER_BAD_CONTENT" | "SERVER_CERT_PROBLEM" | "SERVER_CONTENT_LENGTH_MISMATCH" | "SERVER_CROSS_ORIGIN_REDIRECT" | "SERVER_FAILED" | "SERVER_FORBIDDEN" | "SERVER_NO_RANGE" | "SERVER_UNAUTHORIZED" | "SERVER_UNREACHABLE" | "USER_CANCELED" | "USER_SHUTDOWN" | undefined
50865087
result.estimatedEndTime; // $ExpectType string | undefined
@@ -5138,7 +5139,7 @@ function testDownloads() {
51385139
downloadItem.byExtensionName; // $ExpectType string | undefined
51395140
downloadItem.bytesReceived; // $ExpectType number
51405141
downloadItem.canResume; // $ExpectType boolean
5141-
downloadItem.danger; // $ExpectType "file" | "url" | "content" | "uncommon" | "host" | "unwanted" | "safe" | "accepted" | "allowlistedByPolicy" | "asyncScanning" | "asyncLocalPasswordScanning" | "passwordProtected" | "blockedTooLarge" | "sensitiveContentWarning" | "sensitiveContentBlock" | "deepScannedFailed" | "deepScannedSafe" | "deepScannedOpenedDangerous" | "promptForScanning" | "promptForLocalPasswordScanning" | "accountCompromise" | "blockedScanFailed" | "forceSaveToGdrive"
5142+
downloadItem.danger; // $ExpectType "file" | "url" | "content" | "uncommon" | "host" | "unwanted" | "safe" | "accepted" | "allowlistedByPolicy" | "asyncScanning" | "asyncLocalPasswordScanning" | "passwordProtected" | "blockedTooLarge" | "sensitiveContentWarning" | "sensitiveContentBlock" | "deepScannedFailed" | "deepScannedSafe" | "deepScannedOpenedDangerous" | "promptForScanning" | "promptForLocalPasswordScanning" | "accountCompromise" | "blockedScanFailed" | "forceSaveToGdrive" | "forceSaveToOnedrive"
51425143
downloadItem.endTime; // $ExpectType string | undefined
51435144
downloadItem.error; // $ExpectType "CRASH" | "FILE_ACCESS_DENIED" | "FILE_BLOCKED" | "FILE_FAILED" | "FILE_HASH_MISMATCH" | "FILE_NAME_TOO_LONG" | "FILE_NO_SPACE" | "FILE_SAME_AS_SOURCE" | "FILE_SECURITY_CHECK_FAILED" | "FILE_TOO_LARGE" | "FILE_TOO_SHORT" | "FILE_TRANSIENT_ERROR" | "FILE_VIRUS_INFECTED" | "NETWORK_DISCONNECTED" | "NETWORK_FAILED" | "NETWORK_INVALID_REQUEST" | "NETWORK_SERVER_DOWN" | "NETWORK_TIMEOUT" | "SERVER_BAD_CONTENT" | "SERVER_CERT_PROBLEM" | "SERVER_CONTENT_LENGTH_MISMATCH" | "SERVER_CROSS_ORIGIN_REDIRECT" | "SERVER_FAILED" | "SERVER_FORBIDDEN" | "SERVER_NO_RANGE" | "SERVER_UNAUTHORIZED" | "SERVER_UNREACHABLE" | "USER_CANCELED" | "USER_SHUTDOWN" | undefined
51445145
downloadItem.estimatedEndTime; // $ExpectType string | undefined
@@ -6198,6 +6199,15 @@ function testSidePanel() {
61986199
chrome.sidePanel.Side.LEFT === "left";
61996200
chrome.sidePanel.Side.RIGHT === "right";
62006201

6202+
const closeOptions: chrome.sidePanel.CloseOptions = {
6203+
tabId: 123,
6204+
};
6205+
6206+
chrome.sidePanel.close(closeOptions); // $ExpectType Promise<void>
6207+
chrome.sidePanel.close(closeOptions, () => void 0); // $ExpectType void
6208+
// @ts-expect-error
6209+
chrome.sidePanel.close(closeOptions, () => {}).then(() => {});
6210+
62016211
chrome.sidePanel.getLayout(); // $ExpectType Promise<PanelLayout>
62026212
chrome.sidePanel.getLayout((layout) => { // $ExpectType void
62036213
layout.side; // $ExpectType "left" | "right"
@@ -6265,6 +6275,12 @@ function testSidePanel() {
62656275
// @ts-expect-error
62666276
chrome.sidePanel.setPanelBehavior(setPanelBehavior, () => {}).then(() => {});
62676277

6278+
checkChromeEvent(chrome.sidePanel.onClosed, (info) => {
6279+
info.path; // $ExpectType string
6280+
info.tabId; // $ExpectType number | undefined
6281+
info.windowId; // $ExpectType number
6282+
});
6283+
62686284
checkChromeEvent(chrome.sidePanel.onOpened, (info) => {
62696285
info.path; // $ExpectType string
62706286
info.tabId; // $ExpectType number | undefined
@@ -6857,6 +6873,8 @@ function testWebRequest() {
68576873
chrome.webRequest.OnHeadersReceivedOptions.BLOCKING === "blocking";
68586874
chrome.webRequest.OnHeadersReceivedOptions.EXTRA_HEADERS === "extraHeaders";
68596875
chrome.webRequest.OnHeadersReceivedOptions.RESPONSE_HEADERS === "responseHeaders";
6876+
chrome.webRequest.OnHeadersReceivedOptions.SECURITY_INFO === "securityInfo";
6877+
chrome.webRequest.OnHeadersReceivedOptions.SECURITY_INFO_RAW_DER === "securityInfoRawDer";
68606878

68616879
chrome.webRequest.OnResponseStartedOptions.EXTRA_HEADERS === "extraHeaders";
68626880
chrome.webRequest.OnResponseStartedOptions.RESPONSE_HEADERS === "responseHeaders";
@@ -7064,6 +7082,10 @@ function testWebRequest() {
70647082
details.responseHeaders?.[0].name; // $ExpectType string | undefined
70657083
details.responseHeaders?.[0].value; // $ExpectType string | undefined
70667084
details.responseHeaders?.[0].binaryValue; // $ExpectType ArrayBuffer | undefined
7085+
details.securityInfo; // $ExpectType SecurityInfo | undefined
7086+
details.securityInfo!.certificates![0].fingerprint.sha256; // $ExpectType string
7087+
details.securityInfo!.certificates![0].rawDER; // $ExpectType ArrayBuffer | undefined
7088+
details.securityInfo!.state; // $ExpectType string
70677089
details.statusCode; // $ExpectType number
70687090
details.statusLine; // $ExpectType string
70697091
details.tabId; // $ExpectType number

0 commit comments

Comments
 (0)