@wxt-dev/browser 0.0.322 → 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.
- package/package.json +2 -2
- package/src/gen/index.d.ts +315 -371
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.
|
|
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.
|
|
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",
|
package/src/gen/index.d.ts
CHANGED
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
/// <reference path="./har-format/index.d.ts" />
|
|
5
5
|
/// <reference path="./chrome-cast/index.d.ts" />
|
|
6
6
|
|
|
7
|
+
// Helpers
|
|
8
|
+
type SetRequired<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;
|
|
9
|
+
|
|
7
10
|
////////////////////
|
|
8
11
|
// Global object
|
|
9
12
|
////////////////////
|
|
@@ -149,20 +152,17 @@ export namespace Browser {
|
|
|
149
152
|
* @since Chrome 88, MV3
|
|
150
153
|
*/
|
|
151
154
|
export namespace action {
|
|
152
|
-
/** @deprecated Use BadgeColorDetails instead. */
|
|
153
|
-
export interface BadgeBackgroundColorDetails extends BadgeColorDetails {}
|
|
154
|
-
|
|
155
155
|
export interface BadgeColorDetails {
|
|
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]
|
|
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`. */
|
|
157
157
|
color: string | ColorArray;
|
|
158
|
-
/**
|
|
158
|
+
/** Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
|
|
159
159
|
tabId?: number | undefined;
|
|
160
160
|
}
|
|
161
161
|
|
|
162
162
|
export interface BadgeTextDetails {
|
|
163
|
-
/** Any number of characters can be passed, but only about four can fit in the space. */
|
|
164
|
-
text
|
|
165
|
-
/**
|
|
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. */
|
|
166
166
|
tabId?: number | undefined;
|
|
167
167
|
}
|
|
168
168
|
|
|
@@ -171,33 +171,34 @@ export namespace Browser {
|
|
|
171
171
|
export interface TitleDetails {
|
|
172
172
|
/** The string the action should display when moused over. */
|
|
173
173
|
title: string;
|
|
174
|
-
/**
|
|
174
|
+
/** Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
|
|
175
175
|
tabId?: number | undefined;
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
export interface PopupDetails {
|
|
179
|
-
/**
|
|
179
|
+
/** Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
|
|
180
180
|
tabId?: number | undefined;
|
|
181
|
-
/** 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. */
|
|
182
182
|
popup: string;
|
|
183
183
|
}
|
|
184
184
|
|
|
185
185
|
export interface TabIconDetails {
|
|
186
|
-
/**
|
|
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}' */
|
|
187
187
|
path?: string | { [index: number]: string } | undefined;
|
|
188
|
-
/**
|
|
188
|
+
/** Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
|
|
189
189
|
tabId?: number | undefined;
|
|
190
|
-
/**
|
|
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}' */
|
|
191
191
|
imageData?: ImageData | { [index: number]: ImageData } | undefined;
|
|
192
192
|
}
|
|
193
193
|
|
|
194
|
+
/** @since Chrome 99 */
|
|
194
195
|
export interface OpenPopupOptions {
|
|
195
|
-
/**
|
|
196
|
+
/** The id of the window to open the action popup in. Defaults to the currently-active window if unspecified. */
|
|
196
197
|
windowId?: number | undefined;
|
|
197
198
|
}
|
|
198
199
|
|
|
199
200
|
export interface TabDetails {
|
|
200
|
-
/**
|
|
201
|
+
/** The ID of the tab to query state for. If no tab is specified, the non-tab-specific state is returned. */
|
|
201
202
|
tabId?: number | undefined;
|
|
202
203
|
}
|
|
203
204
|
|
|
@@ -217,232 +218,154 @@ export namespace Browser {
|
|
|
217
218
|
}
|
|
218
219
|
|
|
219
220
|
/**
|
|
220
|
-
* @since Chrome 88
|
|
221
221
|
* Disables the action for a tab.
|
|
222
|
-
* @param tabId The
|
|
223
|
-
*
|
|
222
|
+
* @param tabId The ID of the tab for which you want to modify the action.
|
|
223
|
+
*
|
|
224
|
+
* Can return its result via Promise.
|
|
224
225
|
*/
|
|
225
226
|
export function disable(tabId?: number): Promise<void>;
|
|
226
|
-
|
|
227
|
-
/**
|
|
228
|
-
* @since Chrome 88
|
|
229
|
-
* Disables the action for a tab.
|
|
230
|
-
* @param tabId The id of the tab for which you want to modify the action.
|
|
231
|
-
* @param callback
|
|
232
|
-
*/
|
|
233
227
|
export function disable(callback: () => void): void;
|
|
234
|
-
export function disable(tabId: number, callback: () => void): void;
|
|
228
|
+
export function disable(tabId: number | undefined, callback: () => void): void;
|
|
235
229
|
|
|
236
230
|
/**
|
|
237
|
-
* @since Chrome 88
|
|
238
231
|
* Enables the action for a tab. By default, actions are enabled.
|
|
239
|
-
* @param tabId The
|
|
240
|
-
*
|
|
232
|
+
* @param tabId The ID of the tab for which you want to modify the action.
|
|
233
|
+
*
|
|
234
|
+
* Can return its result via Promise.
|
|
241
235
|
*/
|
|
242
236
|
export function enable(tabId?: number): Promise<void>;
|
|
243
|
-
|
|
244
|
-
/**
|
|
245
|
-
* @since Chrome 88
|
|
246
|
-
* Enables the action for a tab. By default, actions are enabled.
|
|
247
|
-
* @param tabId The id of the tab for which you want to modify the action.
|
|
248
|
-
* @param callback
|
|
249
|
-
*/
|
|
250
237
|
export function enable(callback: () => void): void;
|
|
251
|
-
export function enable(tabId: number, callback: () => void): void;
|
|
238
|
+
export function enable(tabId: number | undefined, callback: () => void): void;
|
|
252
239
|
|
|
253
240
|
/**
|
|
254
|
-
* @since Chrome 88
|
|
255
|
-
* Gets the background color of the action.
|
|
256
|
-
*/
|
|
257
|
-
export function getBadgeBackgroundColor(details: TabDetails, callback: (result: ColorArray) => void): void;
|
|
258
|
-
/**
|
|
259
|
-
* @since Chrome 88
|
|
260
241
|
* Gets the background color of the action.
|
|
261
|
-
*
|
|
242
|
+
*
|
|
243
|
+
* Can return its result via Promise.
|
|
262
244
|
*/
|
|
263
245
|
export function getBadgeBackgroundColor(details: TabDetails): Promise<ColorArray>;
|
|
246
|
+
export function getBadgeBackgroundColor(details: TabDetails, callback: (result: ColorArray) => void): void;
|
|
264
247
|
|
|
265
248
|
/**
|
|
266
|
-
* @
|
|
267
|
-
*
|
|
268
|
-
*
|
|
269
|
-
* declarativeNetRequestFeedback permission is present or tab-specific badge text was provided.
|
|
270
|
-
*/
|
|
271
|
-
export function getBadgeText(details: TabDetails, callback: (result: string) => void): void;
|
|
272
|
-
|
|
273
|
-
/**
|
|
274
|
-
* @since Chrome 88
|
|
275
|
-
* Gets the badge text of the action. If no tab is specified, the non-tab-specific badge text is returned.
|
|
276
|
-
* If displayActionCountAsBadgeText is enabled, a placeholder text will be returned unless the
|
|
277
|
-
* declarativeNetRequestFeedback permission is present or tab-specific badge text was provided.
|
|
278
|
-
* @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.
|
|
279
252
|
*/
|
|
280
253
|
export function getBadgeText(details: TabDetails): Promise<string>;
|
|
254
|
+
export function getBadgeText(details: TabDetails, callback: (result: string) => void): void;
|
|
281
255
|
|
|
282
256
|
/**
|
|
283
|
-
* @since Chrome 110
|
|
284
257
|
* Gets the text color of the action.
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
/**
|
|
258
|
+
*
|
|
259
|
+
* Can return its result via Promise.
|
|
289
260
|
* @since Chrome 110
|
|
290
|
-
* Gets the text color of the action.
|
|
291
|
-
* @return The `getBadgeTextColor` method provides its result via callback or returned as a `Promise` (MV3 only).
|
|
292
261
|
*/
|
|
293
262
|
export function getBadgeTextColor(details: TabDetails): Promise<ColorArray>;
|
|
263
|
+
export function getBadgeTextColor(details: TabDetails, callback: (result: ColorArray) => void): void;
|
|
294
264
|
|
|
295
265
|
/**
|
|
296
|
-
* @since Chrome 88
|
|
297
|
-
* Gets the html document set as the popup for this action.
|
|
298
|
-
*/
|
|
299
|
-
export function getPopup(details: TabDetails, callback: (result: string) => void): void;
|
|
300
|
-
|
|
301
|
-
/**
|
|
302
|
-
* @since Chrome 88
|
|
303
266
|
* Gets the html document set as the popup for this action.
|
|
304
|
-
*
|
|
267
|
+
*
|
|
268
|
+
* Can return its result via Promise.
|
|
305
269
|
*/
|
|
306
270
|
export function getPopup(details: TabDetails): Promise<string>;
|
|
271
|
+
export function getPopup(details: TabDetails, callback: (result: string) => void): void;
|
|
307
272
|
|
|
308
273
|
/**
|
|
309
|
-
* @since Chrome 88
|
|
310
|
-
* Gets the title of the action.
|
|
311
|
-
*/
|
|
312
|
-
export function getTitle(details: TabDetails, callback: (result: string) => void): void;
|
|
313
|
-
|
|
314
|
-
/**
|
|
315
|
-
* @since Chrome 88
|
|
316
274
|
* Gets the title of the action.
|
|
317
|
-
*
|
|
275
|
+
*
|
|
276
|
+
* Can return its result via Promise.
|
|
318
277
|
*/
|
|
319
278
|
export function getTitle(details: TabDetails): Promise<string>;
|
|
279
|
+
export function getTitle(details: TabDetails, callback: (result: string) => void): void;
|
|
320
280
|
|
|
321
281
|
/**
|
|
322
|
-
* @since Chrome 91
|
|
323
282
|
* Returns the user-specified settings relating to an extension's action.
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
/**
|
|
283
|
+
*
|
|
284
|
+
* Can return its result via Promise.
|
|
328
285
|
* @since Chrome 91
|
|
329
|
-
* Returns the user-specified settings relating to an extension's action.
|
|
330
|
-
* @return The `getUserSettings` method provides its result via callback or returned as a `Promise` (MV3 only).
|
|
331
286
|
*/
|
|
332
287
|
export function getUserSettings(): Promise<UserSettings>;
|
|
288
|
+
export function getUserSettings(callback: (userSettings: UserSettings) => void): void;
|
|
333
289
|
|
|
334
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.
|
|
335
294
|
* @since Chrome 110
|
|
336
|
-
* 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.
|
|
337
|
-
*/
|
|
338
|
-
export function isEnabled(tabId: number | undefined, callback: (isEnabled: boolean) => void): void;
|
|
339
|
-
|
|
340
|
-
/**
|
|
341
|
-
* @since Chrome 110
|
|
342
|
-
* 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.
|
|
343
|
-
* @return True if the extension action is enabled.
|
|
344
295
|
*/
|
|
345
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;
|
|
346
299
|
|
|
347
300
|
/**
|
|
348
|
-
*
|
|
349
|
-
*
|
|
301
|
+
* Opens the extension's popup. Between Chrome 118 and Chrome 126, this is only available to policy installed extensions.
|
|
302
|
+
*
|
|
350
303
|
* @param options Specifies options for opening the popup.
|
|
351
|
-
*
|
|
352
|
-
*
|
|
304
|
+
*
|
|
305
|
+
* Can return its result via Promise.
|
|
306
|
+
* @since Chrome 127
|
|
353
307
|
*/
|
|
354
308
|
export function openPopup(options?: OpenPopupOptions): Promise<void>;
|
|
355
|
-
|
|
356
|
-
/**
|
|
357
|
-
* @since Chrome 99
|
|
358
|
-
* Opens the extension's popup.
|
|
359
|
-
* @param options Specifies options for opening the popup.
|
|
360
|
-
*/
|
|
361
309
|
export function openPopup(callback: () => void): void;
|
|
362
|
-
export function openPopup(options: OpenPopupOptions, callback: () => void): void;
|
|
310
|
+
export function openPopup(options: OpenPopupOptions | undefined, callback: () => void): void;
|
|
363
311
|
|
|
364
312
|
/**
|
|
365
|
-
* @since Chrome 88
|
|
366
313
|
* Sets the background color for the badge.
|
|
367
|
-
*
|
|
314
|
+
*
|
|
315
|
+
* Can return its result via Promise.
|
|
368
316
|
*/
|
|
369
317
|
export function setBadgeBackgroundColor(details: BadgeColorDetails): Promise<void>;
|
|
370
|
-
|
|
371
|
-
/**
|
|
372
|
-
* @since Chrome 88
|
|
373
|
-
* Sets the background color for the badge.
|
|
374
|
-
*/
|
|
375
318
|
export function setBadgeBackgroundColor(details: BadgeColorDetails, callback: () => void): void;
|
|
376
319
|
|
|
377
320
|
/**
|
|
378
|
-
* @since Chrome 88
|
|
379
321
|
* Sets the badge text for the action. The badge is displayed on top of the icon.
|
|
380
|
-
*
|
|
322
|
+
*
|
|
323
|
+
* Can return its result via Promise.
|
|
381
324
|
*/
|
|
382
325
|
export function setBadgeText(details: BadgeTextDetails): Promise<void>;
|
|
383
|
-
|
|
384
|
-
/**
|
|
385
|
-
* @since Chrome 88
|
|
386
|
-
* Sets the badge text for the action. The badge is displayed on top of the icon.
|
|
387
|
-
*/
|
|
388
326
|
export function setBadgeText(details: BadgeTextDetails, callback: () => void): void;
|
|
389
327
|
|
|
390
328
|
/**
|
|
391
|
-
* @since Chrome 110
|
|
392
329
|
* Sets the text color for the badge.
|
|
393
|
-
*
|
|
330
|
+
*
|
|
331
|
+
* Can return its result via Promise.
|
|
332
|
+
* @since Chrome 110
|
|
394
333
|
*/
|
|
395
334
|
export function setBadgeTextColor(details: BadgeColorDetails): Promise<void>;
|
|
396
|
-
|
|
397
|
-
/**
|
|
398
|
-
* @since Chrome 100
|
|
399
|
-
* Sets the text color for the badge.
|
|
400
|
-
*/
|
|
401
335
|
export function setBadgeTextColor(details: BadgeColorDetails, callback: () => void): void;
|
|
402
336
|
|
|
403
337
|
/**
|
|
404
|
-
*
|
|
405
|
-
*
|
|
406
|
-
*
|
|
407
|
-
* @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.
|
|
408
341
|
*/
|
|
409
342
|
export function setIcon(details: TabIconDetails): Promise<void>;
|
|
410
343
|
export function setIcon(details: TabIconDetails, callback: () => void): void;
|
|
411
344
|
|
|
412
345
|
/**
|
|
413
|
-
* @since Chrome 88
|
|
414
346
|
* Sets the html document to be opened as a popup when the user clicks on the action's icon.
|
|
415
|
-
*
|
|
347
|
+
*
|
|
348
|
+
* Can return its result via Promise.
|
|
416
349
|
*/
|
|
417
350
|
export function setPopup(details: PopupDetails): Promise<void>;
|
|
418
|
-
|
|
419
|
-
/**
|
|
420
|
-
* @since Chrome 88
|
|
421
|
-
* Sets the html document to be opened as a popup when the user clicks on the action's icon.
|
|
422
|
-
*/
|
|
423
351
|
export function setPopup(details: PopupDetails, callback: () => void): void;
|
|
424
352
|
|
|
425
353
|
/**
|
|
426
|
-
* @since Chrome 88
|
|
427
354
|
* Sets the title of the action. This shows up in the tooltip.
|
|
428
|
-
*
|
|
355
|
+
*
|
|
356
|
+
* Can return its result via Promise.
|
|
429
357
|
*/
|
|
430
358
|
export function setTitle(details: TitleDetails): Promise<void>;
|
|
431
|
-
|
|
432
|
-
/**
|
|
433
|
-
* @since Chrome 88
|
|
434
|
-
* Sets the title of the action. This shows up in the tooltip.
|
|
435
|
-
*/
|
|
436
359
|
export function setTitle(details: TitleDetails, callback: () => void): void;
|
|
437
360
|
|
|
438
361
|
/** Fired when an action icon is clicked. This event will not fire if the action has a popup. */
|
|
439
|
-
export const onClicked:
|
|
362
|
+
export const onClicked: events.Event<(tab: Browser.tabs.Tab) => void>;
|
|
440
363
|
|
|
441
364
|
/**
|
|
442
365
|
* Fired when user-specified settings relating to an extension's action change.
|
|
443
366
|
* @since Chrome 130
|
|
444
367
|
*/
|
|
445
|
-
export const onUserSettingsChanged:
|
|
368
|
+
export const onUserSettingsChanged: events.Event<(change: UserSettingsChange) => void>;
|
|
446
369
|
}
|
|
447
370
|
|
|
448
371
|
////////////////////
|
|
@@ -4496,6 +4419,84 @@ export namespace Browser {
|
|
|
4496
4419
|
export var onRequestExternal: OnRequestEvent;
|
|
4497
4420
|
}
|
|
4498
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
|
+
|
|
4499
4500
|
////////////////////
|
|
4500
4501
|
// File Browser Handler
|
|
4501
4502
|
////////////////////
|
|
@@ -7021,181 +7022,177 @@ export namespace Browser {
|
|
|
7021
7022
|
* Permissions: "notifications"
|
|
7022
7023
|
*/
|
|
7023
7024
|
export namespace notifications {
|
|
7024
|
-
export
|
|
7025
|
-
|
|
7026
|
-
|
|
7025
|
+
export interface NotificationButton {
|
|
7026
|
+
/** @deprecated since Chrome 59. Button icons not visible for Mac OS X users. */
|
|
7027
|
+
iconUrl?: string;
|
|
7027
7028
|
title: string;
|
|
7028
|
-
iconUrl?: string | undefined;
|
|
7029
7029
|
}
|
|
7030
7030
|
|
|
7031
|
-
export interface
|
|
7032
|
-
/** Title of one item of a list notification. */
|
|
7033
|
-
title: string;
|
|
7031
|
+
export interface NotificationItem {
|
|
7034
7032
|
/** Additional details about this item. */
|
|
7035
7033
|
message: string;
|
|
7034
|
+
/** Title of one item of a list notification. */
|
|
7035
|
+
title: string;
|
|
7036
7036
|
}
|
|
7037
7037
|
|
|
7038
|
-
export
|
|
7039
|
-
|
|
7040
|
-
|
|
7041
|
-
|
|
7042
|
-
|
|
7043
|
-
|
|
7044
|
-
|
|
7045
|
-
|
|
7046
|
-
|
|
7047
|
-
|
|
7048
|
-
|
|
7049
|
-
|
|
7050
|
-
|
|
7051
|
-
|
|
7052
|
-
|
|
7053
|
-
|
|
7054
|
-
|
|
7055
|
-
|
|
7056
|
-
|
|
7057
|
-
|
|
7058
|
-
|
|
7059
|
-
|
|
7060
|
-
|
|
7061
|
-
|
|
7062
|
-
|
|
7063
|
-
|
|
7064
|
-
|
|
7065
|
-
|
|
7066
|
-
|
|
7067
|
-
|
|
7068
|
-
|
|
7069
|
-
|
|
7070
|
-
|
|
7071
|
-
|
|
7072
|
-
|
|
7073
|
-
|
|
7074
|
-
|
|
7075
|
-
|
|
7076
|
-
|
|
7077
|
-
|
|
7078
|
-
|
|
7079
|
-
|
|
7080
|
-
|
|
7081
|
-
|
|
7082
|
-
|
|
7083
|
-
|
|
7084
|
-
|
|
7085
|
-
|
|
7086
|
-
|
|
7087
|
-
|
|
7088
|
-
|
|
7089
|
-
|
|
7090
|
-
|
|
7091
|
-
|
|
7092
|
-
|
|
7093
|
-
|
|
7094
|
-
|
|
7095
|
-
|
|
7096
|
-
|
|
7097
|
-
|
|
7098
|
-
|
|
7099
|
-
|
|
7100
|
-
|
|
7101
|
-
/**
|
|
7102
|
-
* Optional.
|
|
7103
|
-
* A URL to the sender's avatar, app icon, or a thumbnail for image notifications.
|
|
7104
|
-
* URLs can be a data URL, a blob URL, or a URL relative to a resource within this extension's .crx file. Required for notifications.create method.
|
|
7105
|
-
*/
|
|
7106
|
-
iconUrl?: string | undefined;
|
|
7107
|
-
/** Optional. Main notification content. Required for notifications.create method. */
|
|
7108
|
-
message?: string | undefined;
|
|
7109
|
-
/** Optional. Which type of notification to display. Required for notifications.create method. */
|
|
7110
|
-
type?: TemplateType | undefined;
|
|
7111
|
-
/** Optional. Title of the notification (e.g. sender name for email). Required for notifications.create method. */
|
|
7112
|
-
title?: string | undefined;
|
|
7113
|
-
});
|
|
7114
|
-
|
|
7115
|
-
export interface NotificationClosedEvent
|
|
7116
|
-
extends Browser.events.Event<(notificationId: string, byUser: boolean) => void>
|
|
7117
|
-
{}
|
|
7118
|
-
|
|
7119
|
-
export interface NotificationClickedEvent extends Browser.events.Event<(notificationId: string) => void> {}
|
|
7038
|
+
export interface NotificationOptions {
|
|
7039
|
+
/**
|
|
7040
|
+
* A URL to the app icon mask. URLs have the same restrictions as {@link notifications.NotificationOptions.iconUrl iconUrl}.
|
|
7041
|
+
*
|
|
7042
|
+
* The app icon mask should be in alpha channel, as only the alpha channel of the image will be considered.
|
|
7043
|
+
* @deprecated since Chrome 59. The app icon mask is not visible for Mac OS X users.
|
|
7044
|
+
*/
|
|
7045
|
+
appIconMaskUrl?: string;
|
|
7046
|
+
/** Text and icons for up to two notification action buttons. */
|
|
7047
|
+
buttons?: NotificationButton[];
|
|
7048
|
+
/** Alternate notification content with a lower-weight font. */
|
|
7049
|
+
contextMessage?: string;
|
|
7050
|
+
/** A timestamp associated with the notification, in milliseconds past the epoch (e.g. `Date.now() + n`). */
|
|
7051
|
+
eventTime?: number;
|
|
7052
|
+
/**
|
|
7053
|
+
* A URL to the sender's avatar, app icon, or a thumbnail for image notifications.
|
|
7054
|
+
*
|
|
7055
|
+
* URLs can be a data URL, a blob URL, or a URL relative to a resource within this extension's .crx file
|
|
7056
|
+
*
|
|
7057
|
+
* **Note:** This value is required for the {@link notifications.create}() method.
|
|
7058
|
+
*/
|
|
7059
|
+
iconUrl?: string;
|
|
7060
|
+
/**
|
|
7061
|
+
* A URL to the image thumbnail for image-type notifications. URLs have the same restrictions as {@link notifications.NotificationOptions.iconUrl iconUrl}.
|
|
7062
|
+
* @deprecated since Chrome 59. The image is not visible for Mac OS X users.
|
|
7063
|
+
*/
|
|
7064
|
+
imageUrl?: string;
|
|
7065
|
+
/** @deprecated since Chrome 67. This UI hint is ignored as of Chrome 67 */
|
|
7066
|
+
isClickable?: boolean;
|
|
7067
|
+
/** Items for multi-item notifications. Users on Mac OS X only see the first item. */
|
|
7068
|
+
items?: NotificationItem[];
|
|
7069
|
+
/**
|
|
7070
|
+
* Main notification content.
|
|
7071
|
+
*
|
|
7072
|
+
* **Note:** This value is required for the {@link notifications.create}() method.
|
|
7073
|
+
*/
|
|
7074
|
+
message?: string;
|
|
7075
|
+
/** Priority ranges from -2 to 2. -2 is lowest priority. 2 is highest. Zero is default. On platforms that don't support a notification center (Windows, Linux & Mac), -2 and -1 result in an error as notifications with those priorities will not be shown at all. */
|
|
7076
|
+
priority?: number;
|
|
7077
|
+
/** Current progress ranges from 0 to 100. */
|
|
7078
|
+
progress?: number;
|
|
7079
|
+
/**
|
|
7080
|
+
* Indicates that the notification should remain visible on screen until the user activates or dismisses the notification. This defaults to false.
|
|
7081
|
+
* @since Chrome 50
|
|
7082
|
+
*/
|
|
7083
|
+
requireInteraction?: boolean;
|
|
7084
|
+
/**
|
|
7085
|
+
* Indicates that no sounds or vibrations should be made when the notification is being shown. This defaults to false.
|
|
7086
|
+
* @since Chrome 70
|
|
7087
|
+
*/
|
|
7088
|
+
silent?: boolean;
|
|
7089
|
+
/**
|
|
7090
|
+
* Title of the notification (e.g. sender name for email).
|
|
7091
|
+
*
|
|
7092
|
+
* **Note:** This value is required for the {@link notifications.create}() method.
|
|
7093
|
+
*/
|
|
7094
|
+
title?: string;
|
|
7095
|
+
/** Which type of notification to display.
|
|
7096
|
+
*
|
|
7097
|
+
* **Note:** This value is required for the {@link notifications.create}() method.
|
|
7098
|
+
*/
|
|
7099
|
+
type?: `${TemplateType}`;
|
|
7100
|
+
}
|
|
7120
7101
|
|
|
7121
|
-
|
|
7122
|
-
extends Browser.events.Event<(notificationId: string, buttonIndex: number) => void>
|
|
7123
|
-
{}
|
|
7102
|
+
type NotificationCreateOptions = SetRequired<NotificationOptions, "type" | "title" | "message" | "iconUrl">;
|
|
7124
7103
|
|
|
7125
|
-
export
|
|
7104
|
+
export enum PermissionLevel {
|
|
7105
|
+
/** Specifies that the user has elected to show notifications from the app or extension. This is the default at install time. */
|
|
7106
|
+
GRANTED = "granted",
|
|
7107
|
+
/** Specifies that the user has elected not to show notifications from the app or extension. */
|
|
7108
|
+
DENIED = "denied",
|
|
7109
|
+
}
|
|
7126
7110
|
|
|
7127
|
-
export
|
|
7111
|
+
export enum TemplateType {
|
|
7112
|
+
/** Contains an icon, title, message, expandedMessage, and up to two buttons. */
|
|
7113
|
+
BASIC = "basic",
|
|
7114
|
+
/** Contains an icon, title, message, expandedMessage, image, and up to two buttons. */
|
|
7115
|
+
IMAGE = "image",
|
|
7116
|
+
/** Contains an icon, title, message, items, and up to two buttons. Users on Mac OS X only see the first item. */
|
|
7117
|
+
LIST = "list",
|
|
7118
|
+
/** Contains an icon, title, message, progress, and up to two buttons. */
|
|
7119
|
+
PROGRESS = "progress",
|
|
7120
|
+
}
|
|
7128
7121
|
|
|
7129
|
-
/** The notification closed, either by the system or by user action. */
|
|
7130
|
-
export var onClosed: NotificationClosedEvent;
|
|
7131
|
-
/** The user clicked in a non-button area of the notification. */
|
|
7132
|
-
export var onClicked: NotificationClickedEvent;
|
|
7133
|
-
/** The user pressed a button in the notification. */
|
|
7134
|
-
export var onButtonClicked: NotificationButtonClickedEvent;
|
|
7135
7122
|
/**
|
|
7136
|
-
*
|
|
7137
|
-
* @
|
|
7138
|
-
|
|
7139
|
-
|
|
7140
|
-
/**
|
|
7141
|
-
* The user clicked on a link for the app's notification settings.
|
|
7142
|
-
* @since Chrome 32
|
|
7123
|
+
* Clears the specified notification.
|
|
7124
|
+
* @param notificationId The id of the notification to be cleared. This is returned by {@link notifications.create} method.
|
|
7125
|
+
*
|
|
7126
|
+
* Can return its result via Promise since Chrome 116
|
|
7143
7127
|
*/
|
|
7144
|
-
export
|
|
7128
|
+
export function clear(notificationId: string): Promise<boolean>;
|
|
7129
|
+
export function clear(notificationId: string, callback: (wasCleared: boolean) => void): void;
|
|
7145
7130
|
|
|
7146
7131
|
/**
|
|
7147
7132
|
* Creates and displays a notification.
|
|
7148
|
-
* @param notificationId Identifier of the notification. If not set or empty, an ID will automatically be generated. If it matches an existing notification, this method first clears that notification before proceeding with the create operation.
|
|
7149
|
-
*
|
|
7133
|
+
* @param notificationId Identifier of the notification. If not set or empty, an ID will automatically be generated. If it matches an existing notification, this method first clears that notification before proceeding with the create operation. The identifier may not be longer than 500 characters.
|
|
7134
|
+
*
|
|
7135
|
+
* The `notificationId` parameter is required before Chrome 42.
|
|
7150
7136
|
* @param options Contents of the notification.
|
|
7151
|
-
*
|
|
7152
|
-
*
|
|
7137
|
+
*
|
|
7138
|
+
* Can return its result via Promise since Chrome 116
|
|
7153
7139
|
*/
|
|
7140
|
+
export function create(notificationId: string, options: NotificationCreateOptions): Promise<string>;
|
|
7141
|
+
export function create(options: NotificationCreateOptions): Promise<string>;
|
|
7154
7142
|
export function create(
|
|
7155
7143
|
notificationId: string,
|
|
7156
|
-
options:
|
|
7157
|
-
callback
|
|
7144
|
+
options: NotificationCreateOptions,
|
|
7145
|
+
callback: (notificationId: string) => void,
|
|
7158
7146
|
): void;
|
|
7147
|
+
export function create(options: NotificationCreateOptions, callback: (notificationId: string) => void): void;
|
|
7148
|
+
|
|
7159
7149
|
/**
|
|
7160
|
-
*
|
|
7161
|
-
*
|
|
7162
|
-
*
|
|
7163
|
-
|
|
7164
|
-
|
|
7165
|
-
|
|
7150
|
+
* Retrieves all the notifications of this app or extension.
|
|
7151
|
+
*
|
|
7152
|
+
* Can return its result via Promise since Chrome 116
|
|
7153
|
+
*/
|
|
7154
|
+
export function getAll(): Promise<{ [key: string]: true }>;
|
|
7155
|
+
export function getAll(callback: (notifications: { [key: string]: true }) => void): void;
|
|
7156
|
+
|
|
7157
|
+
/**
|
|
7158
|
+
* Retrieves whether the user has enabled notifications from this app or extension.
|
|
7159
|
+
*
|
|
7160
|
+
* Can return its result via Promise since Chrome 116
|
|
7166
7161
|
*/
|
|
7167
|
-
export function
|
|
7162
|
+
export function getPermissionLevel(): Promise<`${PermissionLevel}`>;
|
|
7163
|
+
export function getPermissionLevel(callback: (level: `${PermissionLevel}`) => void): void;
|
|
7164
|
+
|
|
7168
7165
|
/**
|
|
7169
7166
|
* Updates an existing notification.
|
|
7170
|
-
* @param notificationId The id of the notification to be updated. This is returned by notifications.create method.
|
|
7167
|
+
* @param notificationId The id of the notification to be updated. This is returned by {@link notifications.create} method.
|
|
7171
7168
|
* @param options Contents of the notification to update to.
|
|
7172
|
-
*
|
|
7173
|
-
*
|
|
7169
|
+
*
|
|
7170
|
+
* Can return its result via Promise since Chrome 116
|
|
7174
7171
|
*/
|
|
7172
|
+
export function update(notificationId: string, options: NotificationOptions): Promise<boolean>;
|
|
7175
7173
|
export function update(
|
|
7176
7174
|
notificationId: string,
|
|
7177
7175
|
options: NotificationOptions,
|
|
7178
|
-
callback
|
|
7176
|
+
callback: (wasUpdated: boolean) => void,
|
|
7179
7177
|
): void;
|
|
7178
|
+
|
|
7179
|
+
/** The user pressed a button in the notification. */
|
|
7180
|
+
export const onButtonClicked: events.Event<(notificationId: string, buttonIndex: number) => void>;
|
|
7181
|
+
|
|
7182
|
+
/** The user clicked in a non-button area of the notification. */
|
|
7183
|
+
export const onClicked: events.Event<(notificationId: string) => void>;
|
|
7184
|
+
|
|
7185
|
+
/** The notification closed, either by the system or by user action. */
|
|
7186
|
+
export const onClosed: events.Event<(notificationId: string, byUser: boolean) => void>;
|
|
7187
|
+
|
|
7188
|
+
/** The user changes the permission level. As of Chrome 47, only ChromeOS has UI that dispatches this event. */
|
|
7189
|
+
export const onPermissionLevelChanged: events.Event<(level: `${PermissionLevel}`) => void>;
|
|
7190
|
+
|
|
7180
7191
|
/**
|
|
7181
|
-
*
|
|
7182
|
-
* @
|
|
7183
|
-
* @param callback Called to indicate whether a matching notification existed.
|
|
7184
|
-
* The callback is required before Chrome 42.
|
|
7185
|
-
*/
|
|
7186
|
-
export function clear(notificationId: string, callback?: (wasCleared: boolean) => void): void;
|
|
7187
|
-
/**
|
|
7188
|
-
* Retrieves all the notifications.
|
|
7189
|
-
* @since Chrome 29
|
|
7190
|
-
* @param callback Returns the set of notification_ids currently in the system.
|
|
7191
|
-
*/
|
|
7192
|
-
export function getAll(callback: (notifications: { [key: string]: true }) => void): void;
|
|
7193
|
-
/**
|
|
7194
|
-
* Retrieves whether the user has enabled notifications from this app or extension.
|
|
7195
|
-
* @since Chrome 32
|
|
7196
|
-
* @param callback Returns the current permission level.
|
|
7192
|
+
* The user clicked on a link for the app's notification settings. As of Chrome 47, only ChromeOS has UI that dispatches this event. As of Chrome 65, that UI has been removed from ChromeOS, too.
|
|
7193
|
+
* @deprecated since Chrome 65. Custom notification settings button is no longer supported.
|
|
7197
7194
|
*/
|
|
7198
|
-
export
|
|
7195
|
+
export const onShowSettings: events.Event<() => void>;
|
|
7199
7196
|
}
|
|
7200
7197
|
|
|
7201
7198
|
////////////////////
|
|
@@ -8709,9 +8706,6 @@ export namespace Browser {
|
|
|
8709
8706
|
export function addListener(callback: (info: OnReceiveErrorInfo) => void): void;
|
|
8710
8707
|
}
|
|
8711
8708
|
|
|
8712
|
-
type DocumentLifecycle = "prerender" | "active" | "cached" | "pending_deletion";
|
|
8713
|
-
type FrameType = "outermost_frame" | "fenced_frame" | "sub_frame";
|
|
8714
|
-
|
|
8715
8709
|
////////////////////
|
|
8716
8710
|
// Runtime
|
|
8717
8711
|
////////////////////
|
|
@@ -8867,7 +8861,7 @@ export namespace Browser {
|
|
|
8867
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.
|
|
8868
8862
|
* @since Chrome 106
|
|
8869
8863
|
*/
|
|
8870
|
-
documentLifecycle?: DocumentLifecycle | undefined;
|
|
8864
|
+
documentLifecycle?: extensionTypes.DocumentLifecycle | undefined;
|
|
8871
8865
|
/**
|
|
8872
8866
|
* A UUID of the document that opened the connection.
|
|
8873
8867
|
* @since Chrome 106
|
|
@@ -9701,7 +9695,7 @@ export namespace Browser {
|
|
|
9701
9695
|
js?: string[];
|
|
9702
9696
|
matches?: string[];
|
|
9703
9697
|
persistAcrossSessions?: boolean;
|
|
9704
|
-
runAt?:
|
|
9698
|
+
runAt?: extensionTypes.RunAt;
|
|
9705
9699
|
world?: ExecutionWorld;
|
|
9706
9700
|
}
|
|
9707
9701
|
|
|
@@ -11146,45 +11140,6 @@ export namespace Browser {
|
|
|
11146
11140
|
defaultZoomFactor?: number | undefined;
|
|
11147
11141
|
}
|
|
11148
11142
|
|
|
11149
|
-
export interface InjectDetails {
|
|
11150
|
-
/**
|
|
11151
|
-
* Optional.
|
|
11152
|
-
* 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.
|
|
11153
|
-
*/
|
|
11154
|
-
allFrames?: boolean | undefined;
|
|
11155
|
-
/**
|
|
11156
|
-
* Optional. JavaScript or CSS code to inject.
|
|
11157
|
-
* Warning: Be careful using the code parameter. Incorrect use of it may open your extension to cross site scripting attacks.
|
|
11158
|
-
*/
|
|
11159
|
-
code?: string | undefined;
|
|
11160
|
-
/**
|
|
11161
|
-
* Optional. The soonest that the JavaScript or CSS will be injected into the tab.
|
|
11162
|
-
* One of: "document_start", "document_end", or "document_idle"
|
|
11163
|
-
* @since Chrome 20
|
|
11164
|
-
*/
|
|
11165
|
-
runAt?: string | undefined;
|
|
11166
|
-
/** Optional. JavaScript or CSS file to inject. */
|
|
11167
|
-
file?: string | undefined;
|
|
11168
|
-
/**
|
|
11169
|
-
* Optional.
|
|
11170
|
-
* The frame where the script or CSS should be injected. Defaults to 0 (the top-level frame).
|
|
11171
|
-
* @since Chrome 39
|
|
11172
|
-
*/
|
|
11173
|
-
frameId?: number | undefined;
|
|
11174
|
-
/**
|
|
11175
|
-
* Optional.
|
|
11176
|
-
* 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.
|
|
11177
|
-
* @since Chrome 39
|
|
11178
|
-
*/
|
|
11179
|
-
matchAboutBlank?: boolean | undefined;
|
|
11180
|
-
/**
|
|
11181
|
-
* Optional. The origin of the CSS to inject. This may only be specified for CSS, not JavaScript. Defaults to "author".
|
|
11182
|
-
* One of: "author", or "user"
|
|
11183
|
-
* @since Chrome 66
|
|
11184
|
-
*/
|
|
11185
|
-
cssOrigin?: string | undefined;
|
|
11186
|
-
}
|
|
11187
|
-
|
|
11188
11143
|
export interface CreateProperties {
|
|
11189
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. */
|
|
11190
11145
|
index?: number | undefined;
|
|
@@ -11266,19 +11221,6 @@ export namespace Browser {
|
|
|
11266
11221
|
autoDiscardable?: boolean | undefined;
|
|
11267
11222
|
}
|
|
11268
11223
|
|
|
11269
|
-
export interface CaptureVisibleTabOptions {
|
|
11270
|
-
/**
|
|
11271
|
-
* Optional.
|
|
11272
|
-
* 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.
|
|
11273
|
-
*/
|
|
11274
|
-
quality?: number | undefined;
|
|
11275
|
-
/**
|
|
11276
|
-
* Optional. The format of an image.
|
|
11277
|
-
* One of: "jpeg", or "png"
|
|
11278
|
-
*/
|
|
11279
|
-
format?: string | undefined;
|
|
11280
|
-
}
|
|
11281
|
-
|
|
11282
11224
|
export interface ReloadProperties {
|
|
11283
11225
|
/** Optional. Whether using any local cache. Default is false. */
|
|
11284
11226
|
bypassCache?: boolean | undefined;
|
|
@@ -11541,21 +11483,21 @@ export namespace Browser {
|
|
|
11541
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.
|
|
11542
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.
|
|
11543
11485
|
*/
|
|
11544
|
-
export function executeScript(details: InjectDetails): Promise<any[]>;
|
|
11486
|
+
export function executeScript(details: extensionTypes.InjectDetails): Promise<any[]>;
|
|
11545
11487
|
/**
|
|
11546
11488
|
* Injects JavaScript code into a page. For details, see the programmatic injection section of the content scripts doc.
|
|
11547
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.
|
|
11548
11490
|
* @param callback Optional. Called after all the JavaScript has been executed.
|
|
11549
11491
|
* Parameter result: The result of the script in every injected frame.
|
|
11550
11492
|
*/
|
|
11551
|
-
export function executeScript(details: InjectDetails, callback?: (result: any[]) => void): void;
|
|
11493
|
+
export function executeScript(details: extensionTypes.InjectDetails, callback?: (result: any[]) => void): void;
|
|
11552
11494
|
/**
|
|
11553
11495
|
* Injects JavaScript code into a page. For details, see the programmatic injection section of the content scripts doc.
|
|
11554
11496
|
* @param tabId Optional. The ID of the tab in which to run the script; defaults to the active tab of the current window.
|
|
11555
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.
|
|
11556
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.
|
|
11557
11499
|
*/
|
|
11558
|
-
export function executeScript(tabId: number, details: InjectDetails): Promise<any[]>;
|
|
11500
|
+
export function executeScript(tabId: number, details: extensionTypes.InjectDetails): Promise<any[]>;
|
|
11559
11501
|
/**
|
|
11560
11502
|
* Injects JavaScript code into a page. For details, see the programmatic injection section of the content scripts doc.
|
|
11561
11503
|
* @param tabId Optional. The ID of the tab in which to run the script; defaults to the active tab of the current window.
|
|
@@ -11563,7 +11505,11 @@ export namespace Browser {
|
|
|
11563
11505
|
* @param callback Optional. Called after all the JavaScript has been executed.
|
|
11564
11506
|
* Parameter result: The result of the script in every injected frame.
|
|
11565
11507
|
*/
|
|
11566
|
-
export function executeScript(
|
|
11508
|
+
export function executeScript(
|
|
11509
|
+
tabId: number,
|
|
11510
|
+
details: extensionTypes.InjectDetails,
|
|
11511
|
+
callback?: (result: any[]) => void,
|
|
11512
|
+
): void;
|
|
11567
11513
|
/** Retrieves details about the specified tab. */
|
|
11568
11514
|
export function get(tabId: number, callback: (tab: Tab) => void): void;
|
|
11569
11515
|
/**
|
|
@@ -11738,14 +11684,17 @@ export namespace Browser {
|
|
|
11738
11684
|
* @param options Optional. Details about the format and quality of an image.
|
|
11739
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.
|
|
11740
11686
|
*/
|
|
11741
|
-
export function captureVisibleTab(options:
|
|
11687
|
+
export function captureVisibleTab(options: extensionTypes.ImageDetails): Promise<string>;
|
|
11742
11688
|
/**
|
|
11743
11689
|
* Captures the visible area of the currently active tab in the specified window. You must have <all_urls> permission to use this method.
|
|
11744
11690
|
* @param options Optional. Details about the format and quality of an image.
|
|
11745
11691
|
* @param callback
|
|
11746
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.
|
|
11747
11693
|
*/
|
|
11748
|
-
export function captureVisibleTab(
|
|
11694
|
+
export function captureVisibleTab(
|
|
11695
|
+
options: extensionTypes.ImageDetails,
|
|
11696
|
+
callback: (dataUrl: string) => void,
|
|
11697
|
+
): void;
|
|
11749
11698
|
/**
|
|
11750
11699
|
* Captures the visible area of the currently active tab in the specified window. You must have <all_urls> permission to use this method.
|
|
11751
11700
|
* @param windowId Optional. The target window. Defaults to the current window.
|
|
@@ -11754,7 +11703,7 @@ export namespace Browser {
|
|
|
11754
11703
|
*/
|
|
11755
11704
|
export function captureVisibleTab(
|
|
11756
11705
|
windowId: number,
|
|
11757
|
-
options:
|
|
11706
|
+
options: extensionTypes.ImageDetails,
|
|
11758
11707
|
): Promise<string>;
|
|
11759
11708
|
/**
|
|
11760
11709
|
* Captures the visible area of the currently active tab in the specified window. You must have <all_urls> permission to use this method.
|
|
@@ -11765,7 +11714,7 @@ export namespace Browser {
|
|
|
11765
11714
|
*/
|
|
11766
11715
|
export function captureVisibleTab(
|
|
11767
11716
|
windowId: number,
|
|
11768
|
-
options:
|
|
11717
|
+
options: extensionTypes.ImageDetails,
|
|
11769
11718
|
callback: (dataUrl: string) => void,
|
|
11770
11719
|
): void;
|
|
11771
11720
|
/**
|
|
@@ -11882,27 +11831,27 @@ export namespace Browser {
|
|
|
11882
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.
|
|
11883
11832
|
* @return The `insertCSS` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
|
|
11884
11833
|
*/
|
|
11885
|
-
export function insertCSS(details: InjectDetails): Promise<void>;
|
|
11834
|
+
export function insertCSS(details: extensionTypes.InjectDetails): Promise<void>;
|
|
11886
11835
|
/**
|
|
11887
11836
|
* Injects CSS into a page. For details, see the programmatic injection section of the content scripts doc.
|
|
11888
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.
|
|
11889
11838
|
* @param callback Optional. Called when all the CSS has been inserted.
|
|
11890
11839
|
*/
|
|
11891
|
-
export function insertCSS(details: InjectDetails, callback: () => void): void;
|
|
11840
|
+
export function insertCSS(details: extensionTypes.InjectDetails, callback: () => void): void;
|
|
11892
11841
|
/**
|
|
11893
11842
|
* Injects CSS into a page. For details, see the programmatic injection section of the content scripts doc.
|
|
11894
11843
|
* @param tabId Optional. The ID of the tab in which to insert the CSS; defaults to the active tab of the current window.
|
|
11895
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.
|
|
11896
11845
|
* @return The `insertCSS` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
|
|
11897
11846
|
*/
|
|
11898
|
-
export function insertCSS(tabId: number, details: InjectDetails): Promise<void>;
|
|
11847
|
+
export function insertCSS(tabId: number, details: extensionTypes.InjectDetails): Promise<void>;
|
|
11899
11848
|
/**
|
|
11900
11849
|
* Injects CSS into a page. For details, see the programmatic injection section of the content scripts doc.
|
|
11901
11850
|
* @param tabId Optional. The ID of the tab in which to insert the CSS; defaults to the active tab of the current window.
|
|
11902
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.
|
|
11903
11852
|
* @param callback Optional. Called when all the CSS has been inserted.
|
|
11904
11853
|
*/
|
|
11905
|
-
export function insertCSS(tabId: number, details: InjectDetails, callback: () => void): void;
|
|
11854
|
+
export function insertCSS(tabId: number, details: extensionTypes.InjectDetails, callback: () => void): void;
|
|
11906
11855
|
/**
|
|
11907
11856
|
* Highlights the given tabs.
|
|
11908
11857
|
* @since Chrome 16
|
|
@@ -12961,11 +12910,11 @@ export namespace Browser {
|
|
|
12961
12910
|
/** A UUID of the document loaded. */
|
|
12962
12911
|
documentId: string;
|
|
12963
12912
|
/** The lifecycle the document is in. */
|
|
12964
|
-
documentLifecycle: DocumentLifecycle;
|
|
12913
|
+
documentLifecycle: extensionTypes.DocumentLifecycle;
|
|
12965
12914
|
/** True if the last navigation in this frame was interrupted by an error, i.e. the onErrorOccurred event fired. */
|
|
12966
12915
|
errorOccurred: boolean;
|
|
12967
12916
|
/** The type of frame the navigation occurred in. */
|
|
12968
|
-
frameType: FrameType;
|
|
12917
|
+
frameType: extensionTypes.FrameType;
|
|
12969
12918
|
/** A UUID of the parent document owning this frame. This is not set if there is no parent. */
|
|
12970
12919
|
parentDocumentId?: string | undefined;
|
|
12971
12920
|
/** ID of frame that wraps the frame. Set to -1 of no parent frame exists. */
|
|
@@ -13004,11 +12953,11 @@ export namespace Browser {
|
|
|
13004
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. */
|
|
13005
12954
|
frameId: number;
|
|
13006
12955
|
/** The type of frame the navigation occurred in. */
|
|
13007
|
-
frameType: FrameType;
|
|
12956
|
+
frameType: extensionTypes.FrameType;
|
|
13008
12957
|
/** A UUID of the document loaded. (This is not set for onBeforeNavigate callbacks.) */
|
|
13009
12958
|
documentId?: string | undefined;
|
|
13010
12959
|
/** The lifecycle the document is in. */
|
|
13011
|
-
documentLifecycle: DocumentLifecycle;
|
|
12960
|
+
documentLifecycle: extensionTypes.DocumentLifecycle;
|
|
13012
12961
|
/** A UUID of the parent document owning this frame. This is not set if there is no parent. */
|
|
13013
12962
|
parentDocumentId?: string | undefined;
|
|
13014
12963
|
/**
|
|
@@ -13291,8 +13240,8 @@ export namespace Browser {
|
|
|
13291
13240
|
/** Optional. The HTTP request headers that are going to be sent out with this request. */
|
|
13292
13241
|
requestHeaders?: HttpHeader[] | undefined;
|
|
13293
13242
|
documentId: string;
|
|
13294
|
-
documentLifecycle: DocumentLifecycle;
|
|
13295
|
-
frameType: FrameType;
|
|
13243
|
+
documentLifecycle: extensionTypes.DocumentLifecycle;
|
|
13244
|
+
frameType: extensionTypes.FrameType;
|
|
13296
13245
|
frameId: number;
|
|
13297
13246
|
initiator?: string | undefined;
|
|
13298
13247
|
parentDocumentId?: string | undefined;
|
|
@@ -14910,7 +14859,7 @@ export namespace Browser {
|
|
|
14910
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}. */
|
|
14911
14860
|
matches?: string[];
|
|
14912
14861
|
/** Specifies when JavaScript files are injected into the web page. The preferred and default value is document_idle */
|
|
14913
|
-
runAt?: RunAt;
|
|
14862
|
+
runAt?: extensionTypes.RunAt;
|
|
14914
14863
|
/** The JavaScript execution environment to run the script in. The default is `USER_SCRIPT` */
|
|
14915
14864
|
world?: ExecutionWorld;
|
|
14916
14865
|
/**
|
|
@@ -14944,11 +14893,6 @@ export namespace Browser {
|
|
|
14944
14893
|
file?: string;
|
|
14945
14894
|
}
|
|
14946
14895
|
|
|
14947
|
-
/**
|
|
14948
|
-
* Enum for the run-at property.
|
|
14949
|
-
*/
|
|
14950
|
-
export type RunAt = "document_start" | "document_end" | "document_idle";
|
|
14951
|
-
|
|
14952
14896
|
/**
|
|
14953
14897
|
* Configures the `USER_SCRIPT` execution environment.
|
|
14954
14898
|
*
|