@wxt-dev/browser 0.1.1 → 0.1.4

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 +2 -2
  2. package/src/gen/index.d.ts +201 -244
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.1.1",
4
+ "version": "0.1.4",
5
5
  "type": "module",
6
6
  "main": "src/index.mjs",
7
7
  "types": "src/index.d.ts",
@@ -19,7 +19,7 @@
19
19
  "src"
20
20
  ],
21
21
  "devDependencies": {
22
- "@types/chrome": "0.1.1",
22
+ "@types/chrome": "0.1.4",
23
23
  "fs-extra": "^11.3.0",
24
24
  "nano-spawn": "^0.2.0",
25
25
  "tsx": "4.19.4",
@@ -1088,267 +1088,209 @@ export namespace Browser {
1088
1088
  */
1089
1089
  export namespace browsingData {
1090
1090
  export interface OriginTypes {
1091
- /** Optional. Extensions and packaged applications a user has installed (be _really_ careful!). */
1091
+ /** Extensions and packaged applications a user has installed (be _really_ careful!). */
1092
1092
  extension?: boolean | undefined;
1093
- /** Optional. Websites that have been installed as hosted applications (be careful!). */
1093
+ /** Websites that have been installed as hosted applications (be careful!). */
1094
1094
  protectedWeb?: boolean | undefined;
1095
- /** Optional. Normal websites. */
1095
+ /** Normal websites. */
1096
1096
  unprotectedWeb?: boolean | undefined;
1097
1097
  }
1098
1098
 
1099
1099
  /** Options that determine exactly what data will be removed. */
1100
1100
  export interface RemovalOptions {
1101
1101
  /**
1102
- * Optional.
1102
+ * When present, data for origins in this list is excluded from deletion. Can't be used together with `origins`. Only supported for cookies, storage and cache. Cookies are excluded for the whole registrable domain.
1103
1103
  * @since Chrome 74
1104
- * When present, data for origins in this list is excluded from deletion. Can't be used together with origins. Only supported for cookies, storage and cache. Cookies are excluded for the whole registrable domain.
1105
1104
  */
1106
1105
  excludeOrigins?: string[] | undefined;
1107
- /**
1108
- * Optional.
1109
- * An object whose properties specify which origin types ought to be cleared. If this object isn't specified, it defaults to clearing only "unprotected" origins. Please ensure that you _really_ want to remove application data before adding 'protectedWeb' or 'extensions'.
1110
- */
1106
+ /** An object whose properties specify which origin types ought to be cleared. If this object isn't specified, it defaults to clearing only "unprotected" origins. Please ensure that you _really_ want to remove application data before adding 'protectedWeb' or 'extensions'. */
1111
1107
  originTypes?: OriginTypes | undefined;
1112
1108
  /**
1113
- * Optional.
1114
- * @since Chrome 74
1115
1109
  * When present, only data for origins in this list is deleted. Only supported for cookies, storage and cache. Cookies are cleared for the whole registrable domain.
1110
+ * @since Chrome 74
1116
1111
  */
1117
- origins?: string[] | undefined;
1118
- /**
1119
- * Optional.
1120
- * Remove data accumulated on or after this date, represented in milliseconds since the epoch (accessible via the {@link Date.getTime} method). If absent, defaults to 0 (which would remove all browsing data).
1121
- */
1112
+ origins?: [string, ...string[]] | undefined;
1113
+ /** Remove data accumulated on or after this date, represented in milliseconds since the epoch (accessible via the {@link Date.getTime getTime} method of the JavaScript `Date` object). If absent, defaults to 0 (which would remove all browsing data). */
1122
1114
  since?: number | undefined;
1123
1115
  }
1124
1116
 
1125
- /**
1126
- * @since Chrome 27
1127
- * A set of data types. Missing data types are interpreted as false.
1128
- */
1117
+ /** A set of data types. Missing data types are interpreted as `false`. */
1129
1118
  export interface DataTypeSet {
1130
- /** Optional. Websites' WebSQL data. */
1119
+ /** Websites' WebSQL data. */
1131
1120
  webSQL?: boolean | undefined;
1132
- /** Optional. Websites' IndexedDB data. */
1121
+ /** Websites' IndexedDB data. */
1133
1122
  indexedDB?: boolean | undefined;
1134
- /** Optional. The browser's cookies. */
1123
+ /** The browser's cookies. */
1135
1124
  cookies?: boolean | undefined;
1136
- /** Optional. Stored passwords. */
1125
+ /** Stored passwords. */
1137
1126
  passwords?: boolean | undefined;
1138
1127
  /**
1139
- * @deprecated Deprecated since Chrome 76.
1140
- * Support for server-bound certificates has been removed. This data type will be ignored.
1141
- *
1142
- * Optional. Server-bound certificates.
1128
+ * Server-bound certificates.
1129
+ * @deprecated since Chrome 76. Support for server-bound certificates has been removed. This data type will be ignored.
1143
1130
  */
1144
1131
  serverBoundCertificates?: boolean | undefined;
1145
- /** Optional. The browser's download list. */
1132
+ /** The browser's download list. */
1146
1133
  downloads?: boolean | undefined;
1147
- /** Optional. The browser's cache. Note: when removing data, this clears the entire cache: it is not limited to the range you specify. */
1134
+ /** The browser's cache. */
1148
1135
  cache?: boolean | undefined;
1149
- /** Optional. The browser's cacheStorage. */
1136
+ /** Cache storage. */
1150
1137
  cacheStorage?: boolean | undefined;
1151
- /** Optional. Websites' appcaches. */
1138
+ /** Websites' appcaches. */
1152
1139
  appcache?: boolean | undefined;
1153
- /** Optional. Websites' file systems. */
1140
+ /** Websites' file systems. */
1154
1141
  fileSystems?: boolean | undefined;
1155
1142
  /**
1156
- * @deprecated Deprecated since Chrome 88.
1157
- * Support for Flash has been removed. This data type will be ignored.
1158
- *
1159
- * Optional. Plugins' data.
1143
+ * Plugins' data.
1144
+ * @deprecated since Chrome 88. Support for Flash has been removed. This data type will be ignored.
1160
1145
  */
1161
1146
  pluginData?: boolean | undefined;
1162
- /** Optional. Websites' local storage data. */
1147
+ /** Websites' local storage data. */
1163
1148
  localStorage?: boolean | undefined;
1164
- /** Optional. The browser's stored form data. */
1149
+ /** The browser's stored form data. */
1165
1150
  formData?: boolean | undefined;
1166
- /** Optional. The browser's history. */
1151
+ /** The browser's history. */
1167
1152
  history?: boolean | undefined;
1168
- /**
1169
- * Optional.
1170
- * @since Chrome 39
1171
- * Service Workers.
1172
- */
1153
+ /** Service Workers. */
1173
1154
  serviceWorkers?: boolean | undefined;
1174
1155
  }
1175
1156
 
1176
1157
  export interface SettingsResult {
1177
1158
  options: RemovalOptions;
1178
- /** All of the types will be present in the result, with values of true if they are both selected to be removed and permitted to be removed, otherwise false. */
1159
+ /** All of the types will be present in the result, with values of `true` if they are both selected to be removed and permitted to be removed, otherwise `false`. */
1179
1160
  dataToRemove: DataTypeSet;
1180
- /** All of the types will be present in the result, with values of true if they are permitted to be removed (e.g., by enterprise policy) and false if not. */
1161
+ /** All of the types will be present in the result, with values of `true` if they are permitted to be removed (e.g., by enterprise policy) and `false` if not. */
1181
1162
  dataRemovalPermitted: DataTypeSet;
1182
1163
  }
1183
1164
 
1184
1165
  /**
1185
- * @since Chrome 26
1186
1166
  * Reports which types of data are currently selected in the 'Clear browsing data' settings UI. Note: some of the data types included in this API are not available in the settings UI, and some UI settings control more than one data type listed here.
1187
- * @return The `settings` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
1167
+ *
1168
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
1188
1169
  */
1189
1170
  export function settings(): Promise<SettingsResult>;
1190
- /**
1191
- * @since Chrome 26
1192
- * Reports which types of data are currently selected in the 'Clear browsing data' settings UI. Note: some of the data types included in this API are not available in the settings UI, and some UI settings control more than one data type listed here.
1193
- */
1194
1171
  export function settings(callback: (result: SettingsResult) => void): void;
1172
+
1195
1173
  /**
1196
- * @deprecated Deprecated since Chrome 88.
1197
- * Support for Flash has been removed. This function has no effect.
1198
- *
1199
1174
  * Clears plugins' data.
1200
- * @return The `removePluginData` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
1201
- */
1202
- export function removePluginData(options: RemovalOptions): Promise<void>;
1203
- /**
1204
- * @deprecated Deprecated since Chrome 88.
1205
- * Support for Flash has been removed. This function has no effect.
1206
1175
  *
1207
- * Clears plugins' data.
1208
- * @param callback Called when plugins' data has been cleared.
1176
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
1177
+ * @deprecated since Chrome 88. Support for Flash has been removed. This function has no effect
1209
1178
  */
1179
+ export function removePluginData(options: RemovalOptions): Promise<void>;
1210
1180
  export function removePluginData(options: RemovalOptions, callback: () => void): void;
1181
+
1211
1182
  /**
1212
- * @since Chrome 72
1213
1183
  * Clears websites' service workers.
1214
- * @return The `removeServiceWorkers` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
1215
- */
1216
- export function removeServiceWorkers(options: RemovalOptions): Promise<void>;
1217
- /**
1184
+ *
1185
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
1218
1186
  * @since Chrome 72
1219
- * Clears websites' service workers.
1220
- * @param callback Called when the browser's service workers have been cleared.
1221
1187
  */
1188
+ export function removeServiceWorkers(options: RemovalOptions): Promise<void>;
1222
1189
  export function removeServiceWorkers(options: RemovalOptions, callback: () => void): void;
1190
+
1223
1191
  /**
1224
1192
  * Clears the browser's stored form data (autofill).
1225
- * @return The `removeFormData` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
1193
+ *
1194
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
1226
1195
  */
1227
1196
  export function removeFormData(options: RemovalOptions): Promise<void>;
1228
- /**
1229
- * Clears the browser's stored form data (autofill).
1230
- * @param callback Called when the browser's form data has been cleared.
1231
- */
1232
1197
  export function removeFormData(options: RemovalOptions, callback: () => void): void;
1198
+
1233
1199
  /**
1234
1200
  * Clears websites' file system data.
1235
- * @return The `removeFileSystems` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
1201
+ *
1202
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
1236
1203
  */
1237
1204
  export function removeFileSystems(options: RemovalOptions): Promise<void>;
1238
- /**
1239
- * Clears websites' file system data.
1240
- * @param callback Called when websites' file systems have been cleared.
1241
- */
1242
1205
  export function removeFileSystems(options: RemovalOptions, callback: () => void): void;
1206
+
1243
1207
  /**
1244
1208
  * Clears various types of browsing data stored in a user's profile.
1209
+ *
1210
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
1245
1211
  * @param dataToRemove The set of data types to remove.
1246
- * @return The `remove` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
1247
1212
  */
1248
1213
  export function remove(options: RemovalOptions, dataToRemove: DataTypeSet): Promise<void>;
1249
- /**
1250
- * Clears various types of browsing data stored in a user's profile.
1251
- * @param dataToRemove The set of data types to remove.
1252
- * @param callback Called when deletion has completed.
1253
- */
1254
1214
  export function remove(options: RemovalOptions, dataToRemove: DataTypeSet, callback: () => void): void;
1215
+
1255
1216
  /**
1256
1217
  * Clears the browser's stored passwords.
1257
- * @return The `removePasswords` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
1218
+ *
1219
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
1258
1220
  */
1259
1221
  export function removePasswords(options: RemovalOptions): Promise<void>;
1260
- /**
1261
- * Clears the browser's stored passwords.
1262
- * @param callback Called when the browser's passwords have been cleared.
1263
- */
1264
1222
  export function removePasswords(options: RemovalOptions, callback: () => void): void;
1223
+
1265
1224
  /**
1266
1225
  * Clears the browser's cookies and server-bound certificates modified within a particular timeframe.
1267
- * @return The `removeCookies` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
1226
+ *
1227
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
1268
1228
  */
1269
1229
  export function removeCookies(options: RemovalOptions): Promise<void>;
1270
- /**
1271
- * Clears the browser's cookies and server-bound certificates modified within a particular timeframe.
1272
- * @param callback Called when the browser's cookies and server-bound certificates have been cleared.
1273
- */
1274
1230
  export function removeCookies(options: RemovalOptions, callback: () => void): void;
1231
+
1275
1232
  /**
1276
1233
  * Clears websites' WebSQL data.
1277
- * @return The `removeWebSQL` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
1234
+ *
1235
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
1278
1236
  */
1279
1237
  export function removeWebSQL(options: RemovalOptions): Promise<void>;
1280
- /**
1281
- * Clears websites' WebSQL data.
1282
- * @param callback Called when websites' WebSQL databases have been cleared.
1283
- */
1284
1238
  export function removeWebSQL(options: RemovalOptions, callback: () => void): void;
1239
+
1285
1240
  /**
1286
1241
  * Clears websites' appcache data.
1287
- * @return The `removeAppcache` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
1242
+ *
1243
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
1288
1244
  */
1289
1245
  export function removeAppcache(options: RemovalOptions): Promise<void>;
1290
- /**
1291
- * Clears websites' appcache data.
1292
- * @param callback Called when websites' appcache data has been cleared.
1293
- */
1294
1246
  export function removeAppcache(options: RemovalOptions, callback: () => void): void;
1295
- /** Clears websites' cache storage data.
1296
- * @return The `removeCacheStorage` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
1247
+
1248
+ /**
1249
+ * Clears websites' cache storage data.
1250
+ *
1251
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
1297
1252
  */
1298
1253
  export function removeCacheStorage(options: RemovalOptions): Promise<void>;
1299
- /** Clears websites' cache storage data.
1300
- * @param callback Called when websites' appcache data has been cleared.
1301
- */
1302
1254
  export function removeCacheStorage(options: RemovalOptions, callback: () => void): void;
1255
+
1303
1256
  /**
1304
1257
  * Clears the browser's list of downloaded files (not the downloaded files themselves).
1305
- * @return The `removeDownloads` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
1258
+ *
1259
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
1306
1260
  */
1307
1261
  export function removeDownloads(options: RemovalOptions): Promise<void>;
1308
- /**
1309
- * Clears the browser's list of downloaded files (not the downloaded files themselves).
1310
- * @param callback Called when the browser's list of downloaded files has been cleared.
1311
- */
1312
1262
  export function removeDownloads(options: RemovalOptions, callback: () => void): void;
1263
+
1313
1264
  /**
1314
1265
  * Clears websites' local storage data.
1315
- * @return The `removeLocalStorage` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
1266
+ *
1267
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
1316
1268
  */
1317
1269
  export function removeLocalStorage(options: RemovalOptions): Promise<void>;
1318
- /**
1319
- * Clears websites' local storage data.
1320
- * @param callback Called when websites' local storage has been cleared.
1321
- */
1322
1270
  export function removeLocalStorage(options: RemovalOptions, callback: () => void): void;
1271
+
1323
1272
  /**
1324
1273
  * Clears the browser's cache.
1325
- * @return The `removeCache` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
1274
+ *
1275
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
1326
1276
  */
1327
1277
  export function removeCache(options: RemovalOptions): Promise<void>;
1328
- /**
1329
- * Clears the browser's cache.
1330
- * @param callback Called when the browser's cache has been cleared.
1331
- */
1332
1278
  export function removeCache(options: RemovalOptions, callback: () => void): void;
1279
+
1333
1280
  /**
1334
1281
  * Clears the browser's history.
1335
- * @return The `removeHistory` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
1282
+ *
1283
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
1336
1284
  */
1337
1285
  export function removeHistory(options: RemovalOptions): Promise<void>;
1338
- /**
1339
- * Clears the browser's history.
1340
- * @param callback Called when the browser's history has cleared.
1341
- */
1342
1286
  export function removeHistory(options: RemovalOptions, callback: () => void): void;
1287
+
1343
1288
  /**
1344
1289
  * Clears websites' IndexedDB data.
1345
- * @return The `removeIndexedDB` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
1290
+ *
1291
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
1346
1292
  */
1347
1293
  export function removeIndexedDB(options: RemovalOptions): Promise<void>;
1348
- /**
1349
- * Clears websites' IndexedDB data.
1350
- * @param callback Called when websites' IndexedDB data has been cleared.
1351
- */
1352
1294
  export function removeIndexedDB(options: RemovalOptions, callback: () => void): void;
1353
1295
  }
1354
1296
 
@@ -1602,29 +1544,24 @@ export namespace Browser {
1602
1544
  */
1603
1545
  export namespace commands {
1604
1546
  export interface Command {
1605
- /** Optional. The name of the Extension Command */
1606
- name?: string | undefined;
1607
- /** Optional. The Extension Command description */
1608
- description?: string | undefined;
1609
- /** Optional. The shortcut active for this command, or blank if not active. */
1610
- shortcut?: string | undefined;
1547
+ /** The name of the Extension Command */
1548
+ name?: string;
1549
+ /** The Extension Command description */
1550
+ description?: string;
1551
+ /** The shortcut active for this command, or blank if not active. */
1552
+ shortcut?: string;
1611
1553
  }
1612
1554
 
1613
- export interface CommandEvent extends Browser.events.Event<(command: string, tab: Browser.tabs.Tab) => void> {}
1614
-
1615
1555
  /**
1616
- * Returns all the registered extension commands for this extension and their shortcut (if active).
1617
- * @return The `getAll` method provides its result via callback or returned as a `Promise` (MV3 only).
1556
+ * Returns all the registered extension commands for this extension and their shortcut (if active). Before Chrome 110, this command did not return `_execute_action`.
1557
+ *
1558
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
1618
1559
  */
1619
1560
  export function getAll(): Promise<Command[]>;
1620
- /**
1621
- * Returns all the registered extension commands for this extension and their shortcut (if active).
1622
- * @param callback Called to return the registered commands.
1623
- */
1624
1561
  export function getAll(callback: (commands: Command[]) => void): void;
1625
1562
 
1626
1563
  /** Fired when a registered command is activated using a keyboard shortcut. */
1627
- export var onCommand: CommandEvent;
1564
+ export const onCommand: events.Event<(command: string, tab?: tabs.Tab) => void>;
1628
1565
  }
1629
1566
 
1630
1567
  ////////////////////
@@ -2151,7 +2088,12 @@ export namespace Browser {
2151
2088
  */
2152
2089
  export namespace cookies {
2153
2090
  /** A cookie's 'SameSite' state (https://tools.ietf.org/html/draft-west-first-party-cookies). 'no_restriction' corresponds to a cookie set with 'SameSite=None', 'lax' to 'SameSite=Lax', and 'strict' to 'SameSite=Strict'. 'unspecified' corresponds to a cookie set without the SameSite attribute. **/
2154
- export type SameSiteStatus = "unspecified" | "no_restriction" | "lax" | "strict";
2091
+ export enum SameSiteStatus {
2092
+ NO_RESTRICTION = "no_restriction",
2093
+ LAX = "lax",
2094
+ STRICT = "strict",
2095
+ UNSPECIFIED = "unspecified",
2096
+ }
2155
2097
 
2156
2098
  /** Represents information about an HTTP cookie. */
2157
2099
  export interface Cookie {
@@ -2172,8 +2114,8 @@ export namespace Browser {
2172
2114
  session: boolean;
2173
2115
  /** True if the cookie is a host-only cookie (i.e. a request's host must exactly match the domain of the cookie). */
2174
2116
  hostOnly: boolean;
2175
- /** Optional. The expiration date of the cookie as the number of seconds since the UNIX epoch. Not provided for session cookies. */
2176
- expirationDate?: number | undefined;
2117
+ /** The expiration date of the cookie as the number of seconds since the UNIX epoch. Not provided for session cookies. */
2118
+ expirationDate?: number;
2177
2119
  /** The path of the cookie. */
2178
2120
  path: string;
2179
2121
  /** True if the cookie is marked as HttpOnly (i.e. the cookie is inaccessible to client-side scripts). */
@@ -2184,10 +2126,13 @@ export namespace Browser {
2184
2126
  * The cookie's same-site status (i.e. whether the cookie is sent with cross-site requests).
2185
2127
  * @since Chrome 51
2186
2128
  */
2187
- sameSite: SameSiteStatus;
2129
+ sameSite: `${SameSiteStatus}`;
2188
2130
  }
2189
2131
 
2190
- /** Represents a partitioned cookie's partition key. */
2132
+ /**
2133
+ * Represents a partitioned cookie's partition key.
2134
+ * @since Chrome 119
2135
+ */
2191
2136
  export interface CookiePartitionKey {
2192
2137
  /**
2193
2138
  * Indicates if the cookie was set in a cross-cross site context. This prevents a top-level site embedded in a cross-site context from accessing cookies set by the top-level site in a same-site context.
@@ -2207,31 +2152,31 @@ export namespace Browser {
2207
2152
  }
2208
2153
 
2209
2154
  export interface GetAllDetails {
2210
- /** Optional. Restricts the retrieved cookies to those whose domains match or are subdomains of this one. */
2155
+ /** Restricts the retrieved cookies to those whose domains match or are subdomains of this one. */
2211
2156
  domain?: string | undefined;
2212
- /** Optional. Filters the cookies by name. */
2157
+ /** Filters the cookies by name. */
2213
2158
  name?: string | undefined;
2214
2159
  /**
2215
2160
  * The partition key for reading or modifying cookies with the Partitioned attribute.
2216
2161
  * @since Chrome 119
2217
2162
  */
2218
2163
  partitionKey?: CookiePartitionKey | undefined;
2219
- /** Optional. Restricts the retrieved cookies to those that would match the given URL. */
2164
+ /** Restricts the retrieved cookies to those that would match the given URL. */
2220
2165
  url?: string | undefined;
2221
- /** Optional. The cookie store to retrieve cookies from. If omitted, the current execution context's cookie store will be used. */
2166
+ /** The cookie store to retrieve cookies from. If omitted, the current execution context's cookie store will be used. */
2222
2167
  storeId?: string | undefined;
2223
- /** Optional. Filters out session vs. persistent cookies. */
2168
+ /** Filters out session vs. persistent cookies. */
2224
2169
  session?: boolean | undefined;
2225
- /** Optional. Restricts the retrieved cookies to those whose path exactly matches this string. */
2170
+ /** Restricts the retrieved cookies to those whose path exactly matches this string. */
2226
2171
  path?: string | undefined;
2227
- /** Optional. Filters the cookies by their Secure property. */
2172
+ /** Filters the cookies by their Secure property. */
2228
2173
  secure?: boolean | undefined;
2229
2174
  }
2230
2175
 
2231
2176
  export interface SetDetails {
2232
- /** Optional. The domain of the cookie. If omitted, the cookie becomes a host-only cookie. */
2177
+ /** The domain of the cookie. If omitted, the cookie becomes a host-only cookie. */
2233
2178
  domain?: string | undefined;
2234
- /** Optional. The name of the cookie. Empty by default if omitted. */
2179
+ /** The name of the cookie. Empty by default if omitted. */
2235
2180
  name?: string | undefined;
2236
2181
  /**
2237
2182
  * The partition key for reading or modifying cookies with the Partitioned attribute.
@@ -2240,26 +2185,29 @@ export namespace Browser {
2240
2185
  partitionKey?: CookiePartitionKey | undefined;
2241
2186
  /** The request-URI to associate with the setting of the cookie. This value can affect the default domain and path values of the created cookie. If host permissions for this URL are not specified in the manifest file, the API call will fail. */
2242
2187
  url: string;
2243
- /** Optional. The ID of the cookie store in which to set the cookie. By default, the cookie is set in the current execution context's cookie store. */
2188
+ /** The ID of the cookie store in which to set the cookie. By default, the cookie is set in the current execution context's cookie store. */
2244
2189
  storeId?: string | undefined;
2245
- /** Optional. The value of the cookie. Empty by default if omitted. */
2190
+ /** The value of the cookie. Empty by default if omitted. */
2246
2191
  value?: string | undefined;
2247
- /** Optional. The expiration date of the cookie as the number of seconds since the UNIX epoch. If omitted, the cookie becomes a session cookie. */
2192
+ /** The expiration date of the cookie as the number of seconds since the UNIX epoch. If omitted, the cookie becomes a session cookie. */
2248
2193
  expirationDate?: number | undefined;
2249
- /** Optional. The path of the cookie. Defaults to the path portion of the url parameter. */
2194
+ /** The path of the cookie. Defaults to the path portion of the url parameter. */
2250
2195
  path?: string | undefined;
2251
- /** Optional. Whether the cookie should be marked as HttpOnly. Defaults to false. */
2196
+ /** Whether the cookie should be marked as HttpOnly. Defaults to false. */
2252
2197
  httpOnly?: boolean | undefined;
2253
- /** Optional. Whether the cookie should be marked as Secure. Defaults to false. */
2198
+ /** Whether the cookie should be marked as Secure. Defaults to false. */
2254
2199
  secure?: boolean | undefined;
2255
2200
  /**
2256
- * Optional. The cookie's same-site status. Defaults to "unspecified", i.e., if omitted, the cookie is set without specifying a SameSite attribute.
2201
+ * The cookie's same-site status. Defaults to "unspecified", i.e., if omitted, the cookie is set without specifying a SameSite attribute.
2257
2202
  * @since Chrome 51
2258
2203
  */
2259
- sameSite?: SameSiteStatus | undefined;
2204
+ sameSite?: `${SameSiteStatus}` | undefined;
2260
2205
  }
2261
2206
 
2262
- /** Details to identify the cookie. */
2207
+ /**
2208
+ * Details to identify the cookie.
2209
+ * @since Chrome 88
2210
+ */
2263
2211
  export interface CookieDetails {
2264
2212
  /** The name of the cookie to access. */
2265
2213
  name: string;
@@ -2279,11 +2227,8 @@ export namespace Browser {
2279
2227
  cookie: Cookie;
2280
2228
  /** True if a cookie was removed. */
2281
2229
  removed: boolean;
2282
- /**
2283
- * @since Chrome 12
2284
- * The underlying reason behind the cookie's change.
2285
- */
2286
- cause: string;
2230
+ /** The underlying reason behind the cookie's change. */
2231
+ cause: `${OnChangedCause}`;
2287
2232
  }
2288
2233
 
2289
2234
  /**
@@ -2292,30 +2237,37 @@ export namespace Browser {
2292
2237
  */
2293
2238
  export interface FrameDetails {
2294
2239
  /** The unique identifier for the document. If the frameId and/or tabId are provided they will be validated to match the document found by provided document ID. */
2295
- documentId?: string;
2240
+ documentId?: string | undefined;
2296
2241
  /** The unique identifier for the frame within the tab. */
2297
- frameId?: number;
2242
+ frameId?: number | undefined;
2298
2243
  /* The unique identifier for the tab containing the frame. */
2299
- tabId?: number;
2244
+ tabId?: number | undefined;
2300
2245
  }
2301
2246
 
2302
- export interface CookieChangedEvent extends Browser.events.Event<(changeInfo: CookieChangeInfo) => void> {}
2303
-
2304
2247
  /**
2305
- * Lists all existing cookie stores.
2306
- * Parameter cookieStores: All the existing cookie stores.
2248
+ * The underlying reason behind the cookie's change. If a cookie was inserted, or removed via an explicit call to "Browser.cookies.remove", "cause" will be "explicit". If a cookie was automatically removed due to expiry, "cause" will be "expired". If a cookie was removed due to being overwritten with an already-expired expiration date, "cause" will be set to "expired_overwrite". If a cookie was automatically removed due to garbage collection, "cause" will be "evicted". If a cookie was automatically removed due to a "set" call that overwrote it, "cause" will be "overwrite". Plan your response accordingly.
2249
+ * @since Chrome 44
2307
2250
  */
2308
- export function getAllCookieStores(callback: (cookieStores: CookieStore[]) => void): void;
2251
+ export enum OnChangedCause {
2252
+ EVICTED = "evicted",
2253
+ EXPIRED = "expired",
2254
+ EXPLICIT = "explicit",
2255
+ EXPIRED_OVERWRITE = "expired_overwrite",
2256
+ OVERWRITE = "overwrite",
2257
+ }
2309
2258
 
2310
2259
  /**
2311
2260
  * Lists all existing cookie stores.
2312
- * @return The `getAllCookieStores` method provides its result via callback or returned as a `Promise` (MV3 only).
2261
+ *
2262
+ * Can return its result via Promise in Manifest V3 or later.
2313
2263
  */
2314
2264
  export function getAllCookieStores(): Promise<CookieStore[]>;
2265
+ export function getAllCookieStores(callback: (cookieStores: CookieStore[]) => void): void;
2315
2266
 
2316
2267
  /**
2317
2268
  * The partition key for the frame indicated.
2318
- * Can return its result via Promise in Manifest V3
2269
+ *
2270
+ * Can return its result via Promise in Manifest V3 or later.
2319
2271
  * @since Chrome 132
2320
2272
  */
2321
2273
  export function getPartitionKey(details: FrameDetails): Promise<{ partitionKey: CookiePartitionKey }>;
@@ -2325,62 +2277,41 @@ export namespace Browser {
2325
2277
  ): void;
2326
2278
 
2327
2279
  /**
2328
- * Retrieves all cookies from a single cookie store that match the given information. The cookies returned will be sorted, with those with the longest path first. If multiple cookies have the same path length, those with the earliest creation time will be first.
2329
- * @param details Information to filter the cookies being retrieved.
2330
- * Parameter cookies: All the existing, unexpired cookies that match the given cookie info.
2331
- */
2332
- export function getAll(details: GetAllDetails, callback: (cookies: Cookie[]) => void): void;
2333
-
2334
- /**
2335
- * Retrieves all cookies from a single cookie store that match the given information. The cookies returned will be sorted, with those with the longest path first. If multiple cookies have the same path length, those with the earliest creation time will be first.
2336
- * @param details Information to filter the cookies being retrieved.
2337
- * @return The `getAll` method provides its result via callback or returned as a `Promise` (MV3 only).
2280
+ * Retrieves all cookies from a single cookie store that match the given information. The cookies returned will be sorted, with those with the longest path first. If multiple cookies have the same path length, those with the earliest creation time will be first. This method only retrieves cookies for domains that the extension has host permissions to
2281
+ * @param details Information to identify the cookie to remove.
2282
+ *
2283
+ * Can return its result via Promise in Manifest V3 or later.
2338
2284
  */
2339
2285
  export function getAll(details: GetAllDetails): Promise<Cookie[]>;
2286
+ export function getAll(details: GetAllDetails, callback: (cookies: Cookie[]) => void): void;
2340
2287
 
2341
2288
  /**
2342
2289
  * Sets a cookie with the given cookie data; may overwrite equivalent cookies if they exist.
2343
2290
  * @param details Details about the cookie being set.
2344
- * @return The `set` method provides its result via callback or returned as a `Promise` (MV3 only).
2291
+ *
2292
+ * Can return its result via Promise in Manifest V3 or later.
2345
2293
  */
2346
2294
  export function set(details: SetDetails): Promise<Cookie | null>;
2347
-
2348
- /**
2349
- * Sets a cookie with the given cookie data; may overwrite equivalent cookies if they exist.
2350
- * @param details Details about the cookie being set.
2351
- * Optional parameter cookie: Contains details about the cookie that's been set. If setting failed for any reason, this will be "null", and "Browser.runtime.lastError" will be set.
2352
- */
2353
2295
  export function set(details: SetDetails, callback: (cookie: Cookie | null) => void): void;
2354
2296
 
2355
2297
  /**
2356
2298
  * Deletes a cookie by name.
2357
- * @param details Information to identify the cookie to remove.
2358
- * @return The `remove` method provides its result via callback or returned as a `Promise` (MV3 only).
2299
+ *
2300
+ * Can return its result via Promise in Manifest V3 or later.
2359
2301
  */
2360
2302
  export function remove(details: CookieDetails): Promise<CookieDetails>;
2361
-
2362
- /**
2363
- * Deletes a cookie by name.
2364
- * @param details Information to identify the cookie to remove.
2365
- */
2366
2303
  export function remove(details: CookieDetails, callback?: (details: CookieDetails) => void): void;
2367
2304
 
2368
2305
  /**
2369
2306
  * Retrieves information about a single cookie. If more than one cookie of the same name exists for the given URL, the one with the longest path will be returned. For cookies with the same path length, the cookie with the earliest creation time will be returned.
2370
- * @param details Details to identify the cookie being retrieved.
2371
- * Parameter cookie: Contains details about the cookie. This parameter is null if no such cookie was found.
2372
- */
2373
- export function get(details: CookieDetails, callback: (cookie: Cookie | null) => void): void;
2374
-
2375
- /**
2376
- * Retrieves information about a single cookie. If more than one cookie of the same name exists for the given URL, the one with the longest path will be returned. For cookies with the same path length, the cookie with the earliest creation time will be returned.
2377
- * @param details Details to identify the cookie being retrieved.
2378
- * @return The `get` method provides its result via callback or returned as a `Promise` (MV3 only).
2307
+ *
2308
+ * Can return its result via Promise in Manifest V3 or later.
2379
2309
  */
2380
2310
  export function get(details: CookieDetails): Promise<Cookie | null>;
2311
+ export function get(details: CookieDetails, callback: (cookie: Cookie | null) => void): void;
2381
2312
 
2382
2313
  /** Fired when a cookie is set or removed. As a special case, note that updating a cookie's properties is implemented as a two step process: the cookie to be updated is first removed entirely, generating a notification with "cause" of "overwrite" . Afterwards, a new cookie is written with the updated values, generating a second notification with "cause" "explicit". */
2383
- export var onChanged: CookieChangedEvent;
2314
+ export const onChanged: events.Event<(changeInfo: CookieChangeInfo) => void>;
2384
2315
  }
2385
2316
 
2386
2317
  ////////////////////
@@ -2688,31 +2619,39 @@ export namespace Browser {
2688
2619
  * Permissions: "desktopCapture"
2689
2620
  */
2690
2621
  export namespace desktopCapture {
2691
- /** Contains properties that describe the stream. */
2622
+ /** Enum used to define set of desktop media sources used in {@link chooseDesktopMedia}. */
2623
+ export enum DesktopCaptureSourceType {
2624
+ SCREEN = "screen",
2625
+ WINDOW = "window",
2626
+ TAB = "tab",
2627
+ AUDIO = "audio",
2628
+ }
2629
+
2630
+ /**
2631
+ * Contains properties that describe the stream.
2632
+ * @since Chrome 57
2633
+ */
2692
2634
  export interface StreamOptions {
2693
2635
  /** True if "audio" is included in parameter sources, and the end user does not uncheck the "Share audio" checkbox. Otherwise false, and in this case, one should not ask for audio stream through getUserMedia call. */
2694
2636
  canRequestAudioTrack: boolean;
2695
2637
  }
2696
2638
  /**
2697
2639
  * Shows desktop media picker UI with the specified set of sources.
2698
- * @param sources Set of sources that should be shown to the user.
2699
- * Parameter streamId: An opaque string that can be passed to getUserMedia() API to generate media stream that corresponds to the source selected by the user. If user didn't select any source (i.e. canceled the prompt) then the callback is called with an empty streamId. The created streamId can be used only once and expires after a few seconds when it is not used.
2640
+ * @param sources Set of sources that should be shown to the user. The sources order in the set decides the tab order in the picker.
2641
+ * @param targetTab Optional tab for which the stream is created. If not specified then the resulting stream can be used only by the calling extension. The stream can only be used by frames in the given tab whose security origin matches `tab.url`. The tab's origin must be a secure origin, e.g. HTTPS.
2642
+ * @param callback streamId: An opaque string that can be passed to `getUserMedia()` API to generate media stream that corresponds to the source selected by the user. If user didn't select any source (i.e. canceled the prompt) then the callback is called with an empty `streamId`. The created `streamId` can be used only once and expires after a few seconds when it is not used.
2643
+ * @return An id that can be passed to cancelChooseDesktopMedia() in case the prompt need to be canceled.
2700
2644
  */
2701
2645
  export function chooseDesktopMedia(
2702
- sources: string[],
2646
+ sources: `${DesktopCaptureSourceType}`[],
2703
2647
  callback: (streamId: string, options: StreamOptions) => void,
2704
2648
  ): number;
2705
- /**
2706
- * Shows desktop media picker UI with the specified set of sources.
2707
- * @param sources Set of sources that should be shown to the user.
2708
- * @param targetTab Optional tab for which the stream is created. If not specified then the resulting stream can be used only by the calling extension. The stream can only be used by frames in the given tab whose security origin matches tab.url.
2709
- * Parameter streamId: An opaque string that can be passed to getUserMedia() API to generate media stream that corresponds to the source selected by the user. If user didn't select any source (i.e. canceled the prompt) then the callback is called with an empty streamId. The created streamId can be used only once and expires after a few seconds when it is not used.
2710
- */
2711
2649
  export function chooseDesktopMedia(
2712
- sources: string[],
2713
- targetTab: Browser.tabs.Tab,
2650
+ sources: `${DesktopCaptureSourceType}`[],
2651
+ targetTab: tabs.Tab | undefined,
2714
2652
  callback: (streamId: string, options: StreamOptions) => void,
2715
2653
  ): number;
2654
+
2716
2655
  /**
2717
2656
  * Hides desktop media picker dialog shown by chooseDesktopMedia().
2718
2657
  * @param desktopMediaRequestId Id returned by chooseDesktopMedia()
@@ -2928,7 +2867,7 @@ export namespace Browser {
2928
2867
 
2929
2868
  export interface PanelSearchEvent extends Browser.events.Event<(action: string, queryString?: string) => void> {}
2930
2869
 
2931
- /** Represents a panel created by extension. */
2870
+ /** Represents a panel created by an extension. */
2932
2871
  export interface ExtensionPanel {
2933
2872
  /**
2934
2873
  * Appends a button to the status bar of the panel.
@@ -4327,6 +4266,24 @@ export namespace Browser {
4327
4266
  export function getHardwarePlatformInfo(callback: (info: HardwarePlatformInfo) => void): void;
4328
4267
  }
4329
4268
 
4269
+ ////////////////////
4270
+ // Enterprise Login
4271
+ ////////////////////
4272
+ /**
4273
+ * Use the `Browser.enterprise.login` API to exit Managed Guest sessions. Note: This API is only available to extensions installed by enterprise policy in ChromeOS Managed Guest sessions.
4274
+ *
4275
+ * Permissions: "enterprise.login"
4276
+ *
4277
+ * Note: Only available to policy installed extensions.
4278
+ * @platform ChromeOS only
4279
+ * @since Chrome 139
4280
+ */
4281
+ export namespace enterprise.login {
4282
+ /** Exits the current managed guest session. */
4283
+ export function exitCurrentManagedGuestSession(): Promise<void>;
4284
+ export function exitCurrentManagedGuestSession(callback: () => void): void;
4285
+ }
4286
+
4330
4287
  ////////////////////
4331
4288
  // Enterprise Networking Attributes
4332
4289
  ////////////////////
@@ -8345,10 +8302,7 @@ export namespace Browser {
8345
8302
  */
8346
8303
  relatedWebsiteSetsEnabled: Browser.types.ChromeSetting<boolean>;
8347
8304
 
8348
- /**
8349
- * If disabled, Chrome blocks third-party sites from setting cookies.
8350
- * The value of this preference is of type boolean, and the default value is `true`.
8351
- */
8305
+ /** If disabled, Chrome blocks third-party sites from setting cookies. The value of this preference is of type boolean, and the default value is `true`. Extensions may not enable this API in Incognito mode, where third-party cookies are blocked and can only be allowed at the site level. If you try setting this API to true in Incognito, it will throw an error. */
8352
8306
  thirdPartyCookiesAllowed: Browser.types.ChromeSetting<boolean>;
8353
8307
 
8354
8308
  /**
@@ -8639,6 +8593,8 @@ export namespace Browser {
8639
8593
  MIPS = "mips",
8640
8594
  /** Specifies the processer architecture as mips64. */
8641
8595
  MIPS64 = "mips64",
8596
+ /** Specifies the processer architecture as riscv64. */
8597
+ RISCV64 = "riscv64",
8642
8598
  }
8643
8599
 
8644
8600
  /**
@@ -8805,7 +8761,7 @@ export namespace Browser {
8805
8761
  /** The machine's processor architecture. */
8806
8762
  arch: `${PlatformArch}`;
8807
8763
  /** The native client architecture. This may be different from arch on some platforms. */
8808
- nacl_arch: `${PlatformNaclArch}`;
8764
+ nacl_arch?: `${PlatformNaclArch}`;
8809
8765
  }
8810
8766
 
8811
8767
  /** An object which allows two way communication with other pages. */
@@ -8894,6 +8850,7 @@ export namespace Browser {
8894
8850
  | "downloads.ui"
8895
8851
  | "enterprise.deviceAttributes"
8896
8852
  | "enterprise.hardwarePlatform"
8853
+ | "enterprise.login"
8897
8854
  | "enterprise.networkingAttributes"
8898
8855
  | "enterprise.platformKeys"
8899
8856
  | "experimental"
@@ -9917,14 +9874,14 @@ export namespace Browser {
9917
9874
  */
9918
9875
  get<T = { [key: string]: any }>(callback: (items: T) => void): void;
9919
9876
  /**
9920
- * Sets the desired access level for the storage area. The default will be only trusted contexts.
9877
+ * Sets the desired access level for the storage area. By default, session storage is restricted to trusted contexts (extension pages and service workers), while managed, local, and sync storage allow access from both trusted and untrusted contexts.
9921
9878
  * @param accessOptions An object containing an accessLevel key which contains the access level of the storage area.
9922
9879
  * @return A void Promise.
9923
9880
  * @since Chrome 102
9924
9881
  */
9925
9882
  setAccessLevel(accessOptions: { accessLevel: AccessLevel }): Promise<void>;
9926
9883
  /**
9927
- * Sets the desired access level for the storage area. The default will be only trusted contexts.
9884
+ * Sets the desired access level for the storage area. By default, session storage is restricted to trusted contexts (extension pages and service workers), while managed, local, and sync storage allow access from both trusted and untrusted contexts.
9928
9885
  * @param accessOptions An object containing an accessLevel key which contains the access level of the storage area.
9929
9886
  * @param callback Optional.
9930
9887
  * @since Chrome 102