@wxt-dev/browser 0.0.323 → 0.0.324

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 +174 -229
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.0.323",
4
+ "version": "0.0.324",
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.0.323",
22
+ "@types/chrome": "0.0.324",
23
23
  "fs-extra": "^11.3.0",
24
24
  "nano-spawn": "^0.2.0",
25
25
  "tsx": "4.19.4",
@@ -152,20 +152,17 @@ export namespace Browser {
152
152
  * @since Chrome 88, MV3
153
153
  */
154
154
  export namespace action {
155
- /** @deprecated Use BadgeColorDetails instead. */
156
- export interface BadgeBackgroundColorDetails extends BadgeColorDetails {}
157
-
158
155
  export interface BadgeColorDetails {
159
- /** An array of four integers in the range [0,255] that make up the RGBA color of the badge. For example, opaque red is [255, 0, 0, 255]. Can also be a string with a CSS value, with opaque red being #FF0000 or #F00. */
156
+ /** An array of four integers in the range [0,255] that make up the RGBA color of the badge. For example, opaque red is `[255, 0, 0, 255]`. Can also be a string with a CSS value, with opaque red being `#FF0000` or `#F00`. */
160
157
  color: string | ColorArray;
161
- /** Optional. Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
158
+ /** Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
162
159
  tabId?: number | undefined;
163
160
  }
164
161
 
165
162
  export interface BadgeTextDetails {
166
- /** Any number of characters can be passed, but only about four can fit in the space. */
167
- text: string;
168
- /** Optional. Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
163
+ /** Any number of characters can be passed, but only about four can fit in the space. If an empty string (`''`) is passed, the badge text is cleared. If `tabId` is specified and `text` is null, the text for the specified tab is cleared and defaults to the global badge text. */
164
+ text?: string | undefined;
165
+ /** Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
169
166
  tabId?: number | undefined;
170
167
  }
171
168
 
@@ -174,33 +171,34 @@ export namespace Browser {
174
171
  export interface TitleDetails {
175
172
  /** The string the action should display when moused over. */
176
173
  title: string;
177
- /** Optional. Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
174
+ /** Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
178
175
  tabId?: number | undefined;
179
176
  }
180
177
 
181
178
  export interface PopupDetails {
182
- /** Optional. Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
179
+ /** Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
183
180
  tabId?: number | undefined;
184
- /** The html file to show in a popup. If set to the empty string (''), no popup is shown. */
181
+ /** The html file to show in a popup. If set to the empty string (`''`), no popup is shown. */
185
182
  popup: string;
186
183
  }
187
184
 
188
185
  export interface TabIconDetails {
189
- /** Optional. Either a relative image path or a dictionary {size -> relative image path} pointing to icon to be set. If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. If the number of image pixels that fit into one screen space unit equals scale, then image with size scale * 19 will be selected. Initially only scales 1 and 2 will be supported. At least one image must be specified. Note that 'details.path = foo' is equivalent to 'details.imageData = {'19': foo}' */
186
+ /** Either a relative image path or a dictionary {size -> relative image path} pointing to icon to be set. If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. If the number of image pixels that fit into one screen space unit equals `scale`, then image with size `scale` \* n will be selected, where n is the size of the icon in the UI. At least one image must be specified. Note that 'details.path = foo' is equivalent to 'details.path = {'16': foo}' */
190
187
  path?: string | { [index: number]: string } | undefined;
191
- /** Optional. Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
188
+ /** Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
192
189
  tabId?: number | undefined;
193
- /** Optional. Either an ImageData object or a dictionary {size -> ImageData} representing icon to be set. If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. If the number of image pixels that fit into one screen space unit equals scale, then image with size scale * 19 will be selected. Initially only scales 1 and 2 will be supported. At least one image must be specified. Note that 'details.imageData = foo' is equivalent to 'details.imageData = {'19': foo}' */
190
+ /** Either an ImageData object or a dictionary {size -> ImageData} representing icon to be set. If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. If the number of image pixels that fit into one screen space unit equals `scale`, then image with size `scale` \* n will be selected, where n is the size of the icon in the UI. At least one image must be specified. Note that 'details.imageData = foo' is equivalent to 'details.imageData = {'16': foo}' */
194
191
  imageData?: ImageData | { [index: number]: ImageData } | undefined;
195
192
  }
196
193
 
194
+ /** @since Chrome 99 */
197
195
  export interface OpenPopupOptions {
198
- /** Optional. The id of the window to open the action popup in. Defaults to the currently-active window if unspecified. */
196
+ /** The id of the window to open the action popup in. Defaults to the currently-active window if unspecified. */
199
197
  windowId?: number | undefined;
200
198
  }
201
199
 
202
200
  export interface TabDetails {
203
- /** Optional. The ID of the tab to query state for. If no tab is specified, the non-tab-specific state is returned. */
201
+ /** The ID of the tab to query state for. If no tab is specified, the non-tab-specific state is returned. */
204
202
  tabId?: number | undefined;
205
203
  }
206
204
 
@@ -220,232 +218,154 @@ export namespace Browser {
220
218
  }
221
219
 
222
220
  /**
223
- * @since Chrome 88
224
221
  * Disables the action for a tab.
225
- * @param tabId The id of the tab for which you want to modify the action.
226
- * @return The `disable` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
222
+ * @param tabId The ID of the tab for which you want to modify the action.
223
+ *
224
+ * Can return its result via Promise.
227
225
  */
228
226
  export function disable(tabId?: number): Promise<void>;
229
-
230
- /**
231
- * @since Chrome 88
232
- * Disables the action for a tab.
233
- * @param tabId The id of the tab for which you want to modify the action.
234
- * @param callback
235
- */
236
227
  export function disable(callback: () => void): void;
237
- export function disable(tabId: number, callback: () => void): void;
228
+ export function disable(tabId: number | undefined, callback: () => void): void;
238
229
 
239
230
  /**
240
- * @since Chrome 88
241
231
  * Enables the action for a tab. By default, actions are enabled.
242
- * @param tabId The id of the tab for which you want to modify the action.
243
- * @return The `enable` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
232
+ * @param tabId The ID of the tab for which you want to modify the action.
233
+ *
234
+ * Can return its result via Promise.
244
235
  */
245
236
  export function enable(tabId?: number): Promise<void>;
246
-
247
- /**
248
- * @since Chrome 88
249
- * Enables the action for a tab. By default, actions are enabled.
250
- * @param tabId The id of the tab for which you want to modify the action.
251
- * @param callback
252
- */
253
237
  export function enable(callback: () => void): void;
254
- export function enable(tabId: number, callback: () => void): void;
238
+ export function enable(tabId: number | undefined, callback: () => void): void;
255
239
 
256
240
  /**
257
- * @since Chrome 88
258
- * Gets the background color of the action.
259
- */
260
- export function getBadgeBackgroundColor(details: TabDetails, callback: (result: ColorArray) => void): void;
261
- /**
262
- * @since Chrome 88
263
241
  * Gets the background color of the action.
264
- * @return The `getBadgeBackgroundColor` method provides its result via callback or returned as a `Promise` (MV3 only).
242
+ *
243
+ * Can return its result via Promise.
265
244
  */
266
245
  export function getBadgeBackgroundColor(details: TabDetails): Promise<ColorArray>;
246
+ export function getBadgeBackgroundColor(details: TabDetails, callback: (result: ColorArray) => void): void;
267
247
 
268
248
  /**
269
- * @since Chrome 88
270
- * Gets the badge text of the action. If no tab is specified, the non-tab-specific badge text is returned.
271
- * If displayActionCountAsBadgeText is enabled, a placeholder text will be returned unless the
272
- * declarativeNetRequestFeedback permission is present or tab-specific badge text was provided.
273
- */
274
- export function getBadgeText(details: TabDetails, callback: (result: string) => void): void;
275
-
276
- /**
277
- * @since Chrome 88
278
- * Gets the badge text of the action. If no tab is specified, the non-tab-specific badge text is returned.
279
- * If displayActionCountAsBadgeText is enabled, a placeholder text will be returned unless the
280
- * declarativeNetRequestFeedback permission is present or tab-specific badge text was provided.
281
- * @return The `getBadgeText` method provides its result via callback or returned as a `Promise` (MV3 only).
249
+ * Gets the badge text of the action. If no tab is specified, the non-tab-specific badge text is returned. If {@link declarativeNetRequest.ExtensionActionOptions.displayActionCountAsBadgeText displayActionCountAsBadgeText} is enabled, a placeholder text will be returned unless the {@link runtime.ManifestPermissions declarativeNetRequestFeedback} permission is present or tab-specific badge text was provided.
250
+ *
251
+ * Can return its result via Promise.
282
252
  */
283
253
  export function getBadgeText(details: TabDetails): Promise<string>;
254
+ export function getBadgeText(details: TabDetails, callback: (result: string) => void): void;
284
255
 
285
256
  /**
286
- * @since Chrome 110
287
257
  * Gets the text color of the action.
288
- */
289
- export function getBadgeTextColor(details: TabDetails, callback: (result: ColorArray) => void): void;
290
-
291
- /**
258
+ *
259
+ * Can return its result via Promise.
292
260
  * @since Chrome 110
293
- * Gets the text color of the action.
294
- * @return The `getBadgeTextColor` method provides its result via callback or returned as a `Promise` (MV3 only).
295
261
  */
296
262
  export function getBadgeTextColor(details: TabDetails): Promise<ColorArray>;
263
+ export function getBadgeTextColor(details: TabDetails, callback: (result: ColorArray) => void): void;
297
264
 
298
265
  /**
299
- * @since Chrome 88
300
- * Gets the html document set as the popup for this action.
301
- */
302
- export function getPopup(details: TabDetails, callback: (result: string) => void): void;
303
-
304
- /**
305
- * @since Chrome 88
306
266
  * Gets the html document set as the popup for this action.
307
- * @return The `getPopup` method provides its result via callback or returned as a `Promise` (MV3 only).
267
+ *
268
+ * Can return its result via Promise.
308
269
  */
309
270
  export function getPopup(details: TabDetails): Promise<string>;
271
+ export function getPopup(details: TabDetails, callback: (result: string) => void): void;
310
272
 
311
273
  /**
312
- * @since Chrome 88
313
274
  * Gets the title of the action.
314
- */
315
- export function getTitle(details: TabDetails, callback: (result: string) => void): void;
316
-
317
- /**
318
- * @since Chrome 88
319
- * Gets the title of the action.
320
- * @return The `getTitle` method provides its result via callback or returned as a `Promise` (MV3 only).
275
+ *
276
+ * Can return its result via Promise.
321
277
  */
322
278
  export function getTitle(details: TabDetails): Promise<string>;
279
+ export function getTitle(details: TabDetails, callback: (result: string) => void): void;
323
280
 
324
281
  /**
325
- * @since Chrome 91
326
282
  * Returns the user-specified settings relating to an extension's action.
327
- */
328
- export function getUserSettings(callback: (userSettings: UserSettings) => void): void;
329
-
330
- /**
283
+ *
284
+ * Can return its result via Promise.
331
285
  * @since Chrome 91
332
- * Returns the user-specified settings relating to an extension's action.
333
- * @return The `getUserSettings` method provides its result via callback or returned as a `Promise` (MV3 only).
334
286
  */
335
287
  export function getUserSettings(): Promise<UserSettings>;
288
+ export function getUserSettings(callback: (userSettings: UserSettings) => void): void;
336
289
 
337
290
  /**
291
+ * Indicates whether the extension action is enabled for a tab (or globally if no `tabId` is provided). Actions enabled using only {@link declarativeContent} always return false.
292
+ *
293
+ * Can return its result via Promise.
338
294
  * @since Chrome 110
339
- * Indicates whether the extension action is enabled for a tab (or globally if no tabId is provided). Actions enabled using only declarativeContent always return false.
340
- */
341
- export function isEnabled(tabId: number | undefined, callback: (isEnabled: boolean) => void): void;
342
-
343
- /**
344
- * @since Chrome 110
345
- * Indicates whether the extension action is enabled for a tab (or globally if no tabId is provided). Actions enabled using only declarativeContent always return false.
346
- * @return True if the extension action is enabled.
347
295
  */
348
296
  export function isEnabled(tabId?: number): Promise<boolean>;
297
+ export function isEnabled(callback: (isEnabled: boolean) => void): void;
298
+ export function isEnabled(tabId: number | undefined, callback: (isEnabled: boolean) => void): void;
349
299
 
350
300
  /**
351
- * @since Chrome 99
352
- * Opens the extension's popup.
301
+ * Opens the extension's popup. Between Chrome 118 and Chrome 126, this is only available to policy installed extensions.
302
+ *
353
303
  * @param options Specifies options for opening the popup.
354
- * () => {...}
355
- * @return The `openPopup` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
304
+ *
305
+ * Can return its result via Promise.
306
+ * @since Chrome 127
356
307
  */
357
308
  export function openPopup(options?: OpenPopupOptions): Promise<void>;
358
-
359
- /**
360
- * @since Chrome 99
361
- * Opens the extension's popup.
362
- * @param options Specifies options for opening the popup.
363
- */
364
309
  export function openPopup(callback: () => void): void;
365
- export function openPopup(options: OpenPopupOptions, callback: () => void): void;
310
+ export function openPopup(options: OpenPopupOptions | undefined, callback: () => void): void;
366
311
 
367
312
  /**
368
- * @since Chrome 88
369
313
  * Sets the background color for the badge.
370
- * @return The `setBadgeBackgroundColor` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
314
+ *
315
+ * Can return its result via Promise.
371
316
  */
372
317
  export function setBadgeBackgroundColor(details: BadgeColorDetails): Promise<void>;
373
-
374
- /**
375
- * @since Chrome 88
376
- * Sets the background color for the badge.
377
- */
378
318
  export function setBadgeBackgroundColor(details: BadgeColorDetails, callback: () => void): void;
379
319
 
380
320
  /**
381
- * @since Chrome 88
382
321
  * Sets the badge text for the action. The badge is displayed on top of the icon.
383
- * @return The `setBadgeText` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
322
+ *
323
+ * Can return its result via Promise.
384
324
  */
385
325
  export function setBadgeText(details: BadgeTextDetails): Promise<void>;
386
-
387
- /**
388
- * @since Chrome 88
389
- * Sets the badge text for the action. The badge is displayed on top of the icon.
390
- */
391
326
  export function setBadgeText(details: BadgeTextDetails, callback: () => void): void;
392
327
 
393
328
  /**
394
- * @since Chrome 110
395
329
  * Sets the text color for the badge.
396
- * @return The `setBadgeTextColor` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
330
+ *
331
+ * Can return its result via Promise.
332
+ * @since Chrome 110
397
333
  */
398
334
  export function setBadgeTextColor(details: BadgeColorDetails): Promise<void>;
399
-
400
- /**
401
- * @since Chrome 100
402
- * Sets the text color for the badge.
403
- */
404
335
  export function setBadgeTextColor(details: BadgeColorDetails, callback: () => void): void;
405
336
 
406
337
  /**
407
- * @since Chrome 88
408
- * Sets the icon for the action. The icon can be specified either as the path to an image file or as the pixel data from a canvas element,
409
- * or as dictionary of either one of those. Either the path or the imageData property must be specified.
410
- * @return The `setIcon` method provides its result via callback or returned as a `Promise` (MV3 only). Since Chrome 96.
338
+ * Sets the icon for the action. The icon can be specified either as the path to an image file or as the pixel data from a canvas element, or as dictionary of either one of those. Either the path or the imageData property must be specified.
339
+ *
340
+ * Can return its result via Promise.
411
341
  */
412
342
  export function setIcon(details: TabIconDetails): Promise<void>;
413
343
  export function setIcon(details: TabIconDetails, callback: () => void): void;
414
344
 
415
345
  /**
416
- * @since Chrome 88
417
346
  * Sets the html document to be opened as a popup when the user clicks on the action's icon.
418
- * @return The `setPopup` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
347
+ *
348
+ * Can return its result via Promise.
419
349
  */
420
350
  export function setPopup(details: PopupDetails): Promise<void>;
421
-
422
- /**
423
- * @since Chrome 88
424
- * Sets the html document to be opened as a popup when the user clicks on the action's icon.
425
- */
426
351
  export function setPopup(details: PopupDetails, callback: () => void): void;
427
352
 
428
353
  /**
429
- * @since Chrome 88
430
354
  * Sets the title of the action. This shows up in the tooltip.
431
- * @return The `setTitle` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
355
+ *
356
+ * Can return its result via Promise.
432
357
  */
433
358
  export function setTitle(details: TitleDetails): Promise<void>;
434
-
435
- /**
436
- * @since Chrome 88
437
- * Sets the title of the action. This shows up in the tooltip.
438
- */
439
359
  export function setTitle(details: TitleDetails, callback: () => void): void;
440
360
 
441
361
  /** Fired when an action icon is clicked. This event will not fire if the action has a popup. */
442
- export const onClicked: Browser.events.Event<(tab: Browser.tabs.Tab) => void>;
362
+ export const onClicked: events.Event<(tab: Browser.tabs.Tab) => void>;
443
363
 
444
364
  /**
445
365
  * Fired when user-specified settings relating to an extension's action change.
446
366
  * @since Chrome 130
447
367
  */
448
- export const onUserSettingsChanged: Browser.events.Event<(change: UserSettingsChange) => void>;
368
+ export const onUserSettingsChanged: events.Event<(change: UserSettingsChange) => void>;
449
369
  }
450
370
 
451
371
  ////////////////////
@@ -4499,6 +4419,84 @@ export namespace Browser {
4499
4419
  export var onRequestExternal: OnRequestEvent;
4500
4420
  }
4501
4421
 
4422
+ ////////////////////
4423
+ // Extension Types
4424
+ ////////////////////
4425
+ /** The `Browser.extensionTypes` API contains type declarations for Chrome extensions. */
4426
+ export namespace extensionTypes {
4427
+ /**
4428
+ * The origin of injected CSS.
4429
+ * @since Chrome 66
4430
+ */
4431
+ export type CSSOrigin = "author" | "user";
4432
+
4433
+ /**
4434
+ * The document lifecycle of the frame.
4435
+ * @since Chrome 106
4436
+ */
4437
+ export type DocumentLifecycle = "prerender" | "active" | "cached" | "pending_deletion";
4438
+
4439
+ /**
4440
+ * The type of frame.
4441
+ * @since Chrome 106
4442
+ */
4443
+ export type FrameType = "outermost_frame" | "fenced_frame" | "sub_frame";
4444
+
4445
+ /** Details about the format and quality of an image. */
4446
+ export interface ImageDetails {
4447
+ /** The format of the resulting image. Default is `"jpeg"`. */
4448
+ format?: ImageFormat | undefined;
4449
+ /** When format is `"jpeg"`, controls the quality of the resulting image. This value is ignored for PNG images. As quality is decreased, the resulting image will have more visual artifacts, and the number of bytes needed to store it will decrease. */
4450
+ quality?: number | undefined;
4451
+ }
4452
+
4453
+ /**
4454
+ * The format of an image.
4455
+ * @since Chrome 44
4456
+ */
4457
+ export type ImageFormat = "jpeg" | "png";
4458
+
4459
+ /** Details of the script or CSS to inject. Either the code or the file property must be set, but both may not be set at the same time. */
4460
+ export interface InjectDetails {
4461
+ /** If allFrames is `true`, implies that the JavaScript or CSS should be injected into all frames of current page. By default, it's `false` and is only injected into the top frame. If `true` and `frameId` is set, then the code is inserted in the selected frame and all of its child frames. */
4462
+ allFrames?: boolean | undefined;
4463
+ /**
4464
+ * JavaScript or CSS code to inject.
4465
+ *
4466
+ * **Warning:** Be careful using the `code` parameter. Incorrect use of it may open your extension to cross site scripting attacks
4467
+ */
4468
+ code?: string | undefined;
4469
+ /**
4470
+ * The origin of the CSS to inject. This may only be specified for CSS, not JavaScript. Defaults to `"author"`.
4471
+ * @since Chrome 66
4472
+ */
4473
+ cssOrigin?: CSSOrigin | undefined;
4474
+ /** JavaScript or CSS file to inject. */
4475
+ file?: string | undefined;
4476
+ /**
4477
+ * The frame where the script or CSS should be injected. Defaults to 0 (the top-level frame).
4478
+ * @since Chrome 50
4479
+ */
4480
+ frameId?: number | undefined;
4481
+ /** If matchAboutBlank is true, then the code is also injected in about:blank and about:srcdoc frames if your extension has access to its parent document. Code cannot be inserted in top-level about:-frames. By default it is `false`. */
4482
+ matchAboutBlank?: boolean;
4483
+ /** The soonest that the JavaScript or CSS will be injected into the tab. Defaults to "document_idle". */
4484
+ runAt?: RunAt | undefined;
4485
+ }
4486
+
4487
+ /**
4488
+ * The soonest that the JavaScript or CSS will be injected into the tab.
4489
+ *
4490
+ * "document_start" : Script is injected after any files from css, but before any other DOM is constructed or any other script is run.
4491
+ *
4492
+ * "document_end" : Script is injected immediately after the DOM is complete, but before subresources like images and frames have loaded.
4493
+ *
4494
+ * "document_idle" : The browser chooses a time to inject the script between "document_end" and immediately after the `window.onload` event fires. The exact moment of injection depends on how complex the document is and how long it is taking to load, and is optimized for page load speed. Content scripts running at "document_idle" don't need to listen for the `window.onload` event; they are guaranteed to run after the DOM completes. If a script definitely needs to run after `window.onload`, the extension can check if `onload` has already fired by using the `document.readyState` property.
4495
+ * @since Chrome 44
4496
+ */
4497
+ export type RunAt = "document_start" | "document_end" | "document_idle";
4498
+ }
4499
+
4502
4500
  ////////////////////
4503
4501
  // File Browser Handler
4504
4502
  ////////////////////
@@ -8708,9 +8706,6 @@ export namespace Browser {
8708
8706
  export function addListener(callback: (info: OnReceiveErrorInfo) => void): void;
8709
8707
  }
8710
8708
 
8711
- type DocumentLifecycle = "prerender" | "active" | "cached" | "pending_deletion";
8712
- type FrameType = "outermost_frame" | "fenced_frame" | "sub_frame";
8713
-
8714
8709
  ////////////////////
8715
8710
  // Runtime
8716
8711
  ////////////////////
@@ -8866,7 +8861,7 @@ export namespace Browser {
8866
8861
  * The lifecycle the document that opened the connection is in at the time the port was created. Note that the lifecycle state of the document may have changed since port creation.
8867
8862
  * @since Chrome 106
8868
8863
  */
8869
- documentLifecycle?: DocumentLifecycle | undefined;
8864
+ documentLifecycle?: extensionTypes.DocumentLifecycle | undefined;
8870
8865
  /**
8871
8866
  * A UUID of the document that opened the connection.
8872
8867
  * @since Chrome 106
@@ -9700,7 +9695,7 @@ export namespace Browser {
9700
9695
  js?: string[];
9701
9696
  matches?: string[];
9702
9697
  persistAcrossSessions?: boolean;
9703
- runAt?: "document_start" | "document_end" | "document_idle";
9698
+ runAt?: extensionTypes.RunAt;
9704
9699
  world?: ExecutionWorld;
9705
9700
  }
9706
9701
 
@@ -11145,45 +11140,6 @@ export namespace Browser {
11145
11140
  defaultZoomFactor?: number | undefined;
11146
11141
  }
11147
11142
 
11148
- export interface InjectDetails {
11149
- /**
11150
- * Optional.
11151
- * If allFrames is true, implies that the JavaScript or CSS should be injected into all frames of current page. By default, it's false and is only injected into the top frame.
11152
- */
11153
- allFrames?: boolean | undefined;
11154
- /**
11155
- * Optional. JavaScript or CSS code to inject.
11156
- * Warning: Be careful using the code parameter. Incorrect use of it may open your extension to cross site scripting attacks.
11157
- */
11158
- code?: string | undefined;
11159
- /**
11160
- * Optional. The soonest that the JavaScript or CSS will be injected into the tab.
11161
- * One of: "document_start", "document_end", or "document_idle"
11162
- * @since Chrome 20
11163
- */
11164
- runAt?: string | undefined;
11165
- /** Optional. JavaScript or CSS file to inject. */
11166
- file?: string | undefined;
11167
- /**
11168
- * Optional.
11169
- * The frame where the script or CSS should be injected. Defaults to 0 (the top-level frame).
11170
- * @since Chrome 39
11171
- */
11172
- frameId?: number | undefined;
11173
- /**
11174
- * Optional.
11175
- * If matchAboutBlank is true, then the code is also injected in about:blank and about:srcdoc frames if your extension has access to its parent document. Code cannot be inserted in top-level about:-frames. By default it is false.
11176
- * @since Chrome 39
11177
- */
11178
- matchAboutBlank?: boolean | undefined;
11179
- /**
11180
- * Optional. The origin of the CSS to inject. This may only be specified for CSS, not JavaScript. Defaults to "author".
11181
- * One of: "author", or "user"
11182
- * @since Chrome 66
11183
- */
11184
- cssOrigin?: string | undefined;
11185
- }
11186
-
11187
11143
  export interface CreateProperties {
11188
11144
  /** Optional. The position the tab should take in the window. The provided value will be clamped to between zero and the number of tabs in the window. */
11189
11145
  index?: number | undefined;
@@ -11265,19 +11221,6 @@ export namespace Browser {
11265
11221
  autoDiscardable?: boolean | undefined;
11266
11222
  }
11267
11223
 
11268
- export interface CaptureVisibleTabOptions {
11269
- /**
11270
- * Optional.
11271
- * When format is "jpeg", controls the quality of the resulting image. This value is ignored for PNG images. As quality is decreased, the resulting image will have more visual artifacts, and the number of bytes needed to store it will decrease.
11272
- */
11273
- quality?: number | undefined;
11274
- /**
11275
- * Optional. The format of an image.
11276
- * One of: "jpeg", or "png"
11277
- */
11278
- format?: string | undefined;
11279
- }
11280
-
11281
11224
  export interface ReloadProperties {
11282
11225
  /** Optional. Whether using any local cache. Default is false. */
11283
11226
  bypassCache?: boolean | undefined;
@@ -11540,21 +11483,21 @@ export namespace Browser {
11540
11483
  * @param details Details of the script or CSS to inject. Either the code or the file property must be set, but both may not be set at the same time.
11541
11484
  * @return The `executeScript` method provides its result via callback or returned as a `Promise` (MV3 only). The result of the script in every injected frame.
11542
11485
  */
11543
- export function executeScript(details: InjectDetails): Promise<any[]>;
11486
+ export function executeScript(details: extensionTypes.InjectDetails): Promise<any[]>;
11544
11487
  /**
11545
11488
  * Injects JavaScript code into a page. For details, see the programmatic injection section of the content scripts doc.
11546
11489
  * @param details Details of the script or CSS to inject. Either the code or the file property must be set, but both may not be set at the same time.
11547
11490
  * @param callback Optional. Called after all the JavaScript has been executed.
11548
11491
  * Parameter result: The result of the script in every injected frame.
11549
11492
  */
11550
- export function executeScript(details: InjectDetails, callback?: (result: any[]) => void): void;
11493
+ export function executeScript(details: extensionTypes.InjectDetails, callback?: (result: any[]) => void): void;
11551
11494
  /**
11552
11495
  * Injects JavaScript code into a page. For details, see the programmatic injection section of the content scripts doc.
11553
11496
  * @param tabId Optional. The ID of the tab in which to run the script; defaults to the active tab of the current window.
11554
11497
  * @param details Details of the script or CSS to inject. Either the code or the file property must be set, but both may not be set at the same time.
11555
11498
  * @return The `executeScript` method provides its result via callback or returned as a `Promise` (MV3 only). The result of the script in every injected frame.
11556
11499
  */
11557
- export function executeScript(tabId: number, details: InjectDetails): Promise<any[]>;
11500
+ export function executeScript(tabId: number, details: extensionTypes.InjectDetails): Promise<any[]>;
11558
11501
  /**
11559
11502
  * Injects JavaScript code into a page. For details, see the programmatic injection section of the content scripts doc.
11560
11503
  * @param tabId Optional. The ID of the tab in which to run the script; defaults to the active tab of the current window.
@@ -11562,7 +11505,11 @@ export namespace Browser {
11562
11505
  * @param callback Optional. Called after all the JavaScript has been executed.
11563
11506
  * Parameter result: The result of the script in every injected frame.
11564
11507
  */
11565
- export function executeScript(tabId: number, details: InjectDetails, callback?: (result: any[]) => void): void;
11508
+ export function executeScript(
11509
+ tabId: number,
11510
+ details: extensionTypes.InjectDetails,
11511
+ callback?: (result: any[]) => void,
11512
+ ): void;
11566
11513
  /** Retrieves details about the specified tab. */
11567
11514
  export function get(tabId: number, callback: (tab: Tab) => void): void;
11568
11515
  /**
@@ -11737,14 +11684,17 @@ export namespace Browser {
11737
11684
  * @param options Optional. Details about the format and quality of an image.
11738
11685
  * @return The `captureVisibleTab` method provides its result via callback or returned as a `Promise` (MV3 only). A data URL which encodes an image of the visible area of the captured tab. May be assigned to the 'src' property of an HTML Image element for display.
11739
11686
  */
11740
- export function captureVisibleTab(options: CaptureVisibleTabOptions): Promise<string>;
11687
+ export function captureVisibleTab(options: extensionTypes.ImageDetails): Promise<string>;
11741
11688
  /**
11742
11689
  * Captures the visible area of the currently active tab in the specified window. You must have <all_urls> permission to use this method.
11743
11690
  * @param options Optional. Details about the format and quality of an image.
11744
11691
  * @param callback
11745
11692
  * Parameter dataUrl: A data URL which encodes an image of the visible area of the captured tab. May be assigned to the 'src' property of an HTML Image element for display.
11746
11693
  */
11747
- export function captureVisibleTab(options: CaptureVisibleTabOptions, callback: (dataUrl: string) => void): void;
11694
+ export function captureVisibleTab(
11695
+ options: extensionTypes.ImageDetails,
11696
+ callback: (dataUrl: string) => void,
11697
+ ): void;
11748
11698
  /**
11749
11699
  * Captures the visible area of the currently active tab in the specified window. You must have <all_urls> permission to use this method.
11750
11700
  * @param windowId Optional. The target window. Defaults to the current window.
@@ -11753,7 +11703,7 @@ export namespace Browser {
11753
11703
  */
11754
11704
  export function captureVisibleTab(
11755
11705
  windowId: number,
11756
- options: CaptureVisibleTabOptions,
11706
+ options: extensionTypes.ImageDetails,
11757
11707
  ): Promise<string>;
11758
11708
  /**
11759
11709
  * Captures the visible area of the currently active tab in the specified window. You must have <all_urls> permission to use this method.
@@ -11764,7 +11714,7 @@ export namespace Browser {
11764
11714
  */
11765
11715
  export function captureVisibleTab(
11766
11716
  windowId: number,
11767
- options: CaptureVisibleTabOptions,
11717
+ options: extensionTypes.ImageDetails,
11768
11718
  callback: (dataUrl: string) => void,
11769
11719
  ): void;
11770
11720
  /**
@@ -11881,27 +11831,27 @@ export namespace Browser {
11881
11831
  * @param details Details of the script or CSS to inject. Either the code or the file property must be set, but both may not be set at the same time.
11882
11832
  * @return The `insertCSS` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
11883
11833
  */
11884
- export function insertCSS(details: InjectDetails): Promise<void>;
11834
+ export function insertCSS(details: extensionTypes.InjectDetails): Promise<void>;
11885
11835
  /**
11886
11836
  * Injects CSS into a page. For details, see the programmatic injection section of the content scripts doc.
11887
11837
  * @param details Details of the script or CSS to inject. Either the code or the file property must be set, but both may not be set at the same time.
11888
11838
  * @param callback Optional. Called when all the CSS has been inserted.
11889
11839
  */
11890
- export function insertCSS(details: InjectDetails, callback: () => void): void;
11840
+ export function insertCSS(details: extensionTypes.InjectDetails, callback: () => void): void;
11891
11841
  /**
11892
11842
  * Injects CSS into a page. For details, see the programmatic injection section of the content scripts doc.
11893
11843
  * @param tabId Optional. The ID of the tab in which to insert the CSS; defaults to the active tab of the current window.
11894
11844
  * @param details Details of the script or CSS to inject. Either the code or the file property must be set, but both may not be set at the same time.
11895
11845
  * @return The `insertCSS` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
11896
11846
  */
11897
- export function insertCSS(tabId: number, details: InjectDetails): Promise<void>;
11847
+ export function insertCSS(tabId: number, details: extensionTypes.InjectDetails): Promise<void>;
11898
11848
  /**
11899
11849
  * Injects CSS into a page. For details, see the programmatic injection section of the content scripts doc.
11900
11850
  * @param tabId Optional. The ID of the tab in which to insert the CSS; defaults to the active tab of the current window.
11901
11851
  * @param details Details of the script or CSS to inject. Either the code or the file property must be set, but both may not be set at the same time.
11902
11852
  * @param callback Optional. Called when all the CSS has been inserted.
11903
11853
  */
11904
- export function insertCSS(tabId: number, details: InjectDetails, callback: () => void): void;
11854
+ export function insertCSS(tabId: number, details: extensionTypes.InjectDetails, callback: () => void): void;
11905
11855
  /**
11906
11856
  * Highlights the given tabs.
11907
11857
  * @since Chrome 16
@@ -12960,11 +12910,11 @@ export namespace Browser {
12960
12910
  /** A UUID of the document loaded. */
12961
12911
  documentId: string;
12962
12912
  /** The lifecycle the document is in. */
12963
- documentLifecycle: DocumentLifecycle;
12913
+ documentLifecycle: extensionTypes.DocumentLifecycle;
12964
12914
  /** True if the last navigation in this frame was interrupted by an error, i.e. the onErrorOccurred event fired. */
12965
12915
  errorOccurred: boolean;
12966
12916
  /** The type of frame the navigation occurred in. */
12967
- frameType: FrameType;
12917
+ frameType: extensionTypes.FrameType;
12968
12918
  /** A UUID of the parent document owning this frame. This is not set if there is no parent. */
12969
12919
  parentDocumentId?: string | undefined;
12970
12920
  /** ID of frame that wraps the frame. Set to -1 of no parent frame exists. */
@@ -13003,11 +12953,11 @@ export namespace Browser {
13003
12953
  /** 0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe. Frame IDs are unique for a given tab and process. */
13004
12954
  frameId: number;
13005
12955
  /** The type of frame the navigation occurred in. */
13006
- frameType: FrameType;
12956
+ frameType: extensionTypes.FrameType;
13007
12957
  /** A UUID of the document loaded. (This is not set for onBeforeNavigate callbacks.) */
13008
12958
  documentId?: string | undefined;
13009
12959
  /** The lifecycle the document is in. */
13010
- documentLifecycle: DocumentLifecycle;
12960
+ documentLifecycle: extensionTypes.DocumentLifecycle;
13011
12961
  /** A UUID of the parent document owning this frame. This is not set if there is no parent. */
13012
12962
  parentDocumentId?: string | undefined;
13013
12963
  /**
@@ -13290,8 +13240,8 @@ export namespace Browser {
13290
13240
  /** Optional. The HTTP request headers that are going to be sent out with this request. */
13291
13241
  requestHeaders?: HttpHeader[] | undefined;
13292
13242
  documentId: string;
13293
- documentLifecycle: DocumentLifecycle;
13294
- frameType: FrameType;
13243
+ documentLifecycle: extensionTypes.DocumentLifecycle;
13244
+ frameType: extensionTypes.FrameType;
13295
13245
  frameId: number;
13296
13246
  initiator?: string | undefined;
13297
13247
  parentDocumentId?: string | undefined;
@@ -14909,7 +14859,7 @@ export namespace Browser {
14909
14859
  /** Specifies which pages this user script will be injected into. See Match Patterns for more details on the syntax of these strings. This property must be specified for ${ref:register}. */
14910
14860
  matches?: string[];
14911
14861
  /** Specifies when JavaScript files are injected into the web page. The preferred and default value is document_idle */
14912
- runAt?: RunAt;
14862
+ runAt?: extensionTypes.RunAt;
14913
14863
  /** The JavaScript execution environment to run the script in. The default is `USER_SCRIPT` */
14914
14864
  world?: ExecutionWorld;
14915
14865
  /**
@@ -14943,11 +14893,6 @@ export namespace Browser {
14943
14893
  file?: string;
14944
14894
  }
14945
14895
 
14946
- /**
14947
- * Enum for the run-at property.
14948
- */
14949
- export type RunAt = "document_start" | "document_end" | "document_idle";
14950
-
14951
14896
  /**
14952
14897
  * Configures the `USER_SCRIPT` execution environment.
14953
14898
  *