@wxt-dev/browser 0.2.0 → 0.2.5
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 +4 -5
- package/src/gen/index.d.ts +285 -72
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.2.
|
|
4
|
+
"version": "0.2.5",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.mjs",
|
|
7
7
|
"types": "src/index.d.ts",
|
|
@@ -25,11 +25,10 @@
|
|
|
25
25
|
"src"
|
|
26
26
|
],
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@types/chrome": "0.2.
|
|
29
|
-
"@types/node": "^
|
|
30
|
-
"nano-spawn": "^2.0.0",
|
|
28
|
+
"@types/chrome": "0.2.5",
|
|
29
|
+
"@types/node": "^22",
|
|
31
30
|
"typescript": "^6.0.3",
|
|
32
|
-
"vitest": "^4.1.
|
|
31
|
+
"vitest": "^4.1.10"
|
|
33
32
|
},
|
|
34
33
|
"dependencies": {
|
|
35
34
|
"@types/filesystem": "*",
|
package/src/gen/index.d.ts
CHANGED
|
@@ -181,14 +181,25 @@ export namespace Browser {
|
|
|
181
181
|
popup: string;
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
184
|
+
type TabIconDetails =
|
|
185
|
+
& {
|
|
186
|
+
/** Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */
|
|
187
|
+
tabId?: number | null | undefined;
|
|
188
|
+
}
|
|
189
|
+
& (
|
|
190
|
+
| {
|
|
191
|
+
/** Either an ImageData object or a dictionary {size -> ImageData} representing an icon to be set. If the icon is specified as a dictionary, the image used is chosen depending on the screen's pixel density. If the number of image pixels that fit into one screen space unit equals `scale`, then an image with size `scale` \* n is 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}' */
|
|
192
|
+
imageData: ImageData | { [index: number]: ImageData };
|
|
193
|
+
/** Either a relative image path or a dictionary {size -> relative image path} pointing to an icon to be set. If the icon is specified as a dictionary, the image used is chosen depending on the screen's pixel density. If the number of image pixels that fit into one screen space unit equals `scale`, then an image with size `scale` \* n is 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}' */
|
|
194
|
+
path?: string | { [index: string]: string } | undefined;
|
|
195
|
+
}
|
|
196
|
+
| {
|
|
197
|
+
/** Either an ImageData object or a dictionary {size -> ImageData} representing an icon to be set. If the icon is specified as a dictionary, the image used is chosen depending on the screen's pixel density. If the number of image pixels that fit into one screen space unit equals `scale`, then an image with size `scale` \* n is 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}' */
|
|
198
|
+
imageData?: ImageData | { [index: number]: ImageData } | undefined;
|
|
199
|
+
/** Either a relative image path or a dictionary {size -> relative image path} pointing to an icon to be set. If the icon is specified as a dictionary, the image used is chosen depending on the screen's pixel density. If the number of image pixels that fit into one screen space unit equals `scale`, then an image with size `scale` \* n is 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}' */
|
|
200
|
+
path: string | { [index: string]: string };
|
|
201
|
+
}
|
|
202
|
+
);
|
|
192
203
|
|
|
193
204
|
/** @since Chrome 99 */
|
|
194
205
|
interface OpenPopupOptions {
|
|
@@ -383,22 +394,53 @@ export namespace Browser {
|
|
|
383
394
|
* Permissions: "alarms"
|
|
384
395
|
*/
|
|
385
396
|
export namespace alarms {
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
397
|
+
type AlarmCreateInfo =
|
|
398
|
+
& {
|
|
399
|
+
/**
|
|
400
|
+
* Whether the alarm should persist across sessions (browser restarts). In Chrome, this defaults to true to match historical behavior, but you should set this explicitly to maximize compatibility across browsers.
|
|
401
|
+
* @since Chrome 150
|
|
402
|
+
*/
|
|
403
|
+
persistAcrossSessions?: boolean | undefined;
|
|
404
|
+
}
|
|
405
|
+
& (
|
|
406
|
+
| {
|
|
407
|
+
/** Length of time in minutes after which the {@link onAlarm} event should fire. */
|
|
408
|
+
delayInMinutes: number;
|
|
409
|
+
/** If set, the onAlarm event should fire every `periodInMinutes` minutes after the initial event specified by `when` or `delayInMinutes`. If not set, the alarm will only fire once. */
|
|
410
|
+
periodInMinutes?: number | undefined;
|
|
411
|
+
/** Time at which the alarm should fire, in milliseconds past the epoch (e.g. `Date.now() + n`). */
|
|
412
|
+
when?: undefined;
|
|
413
|
+
}
|
|
414
|
+
| {
|
|
415
|
+
/** Length of time in minutes after which the {@link onAlarm} event should fire. */
|
|
416
|
+
delayInMinutes?: number | undefined;
|
|
417
|
+
/** If set, the onAlarm event should fire every `periodInMinutes` minutes after the initial event specified by `when` or `delayInMinutes`. If not set, the alarm will only fire once. */
|
|
418
|
+
periodInMinutes: number;
|
|
419
|
+
/** Time at which the alarm should fire, in milliseconds past the epoch (e.g. `Date.now() + n`). */
|
|
420
|
+
when?: undefined;
|
|
421
|
+
}
|
|
422
|
+
| {
|
|
423
|
+
/** Length of time in minutes after which the {@link onAlarm} event should fire. */
|
|
424
|
+
delayInMinutes?: undefined;
|
|
425
|
+
/** If set, the onAlarm event should fire every `periodInMinutes` minutes after the initial event specified by `when` or `delayInMinutes`. If not set, the alarm will only fire once. */
|
|
426
|
+
periodInMinutes?: number | undefined;
|
|
427
|
+
/** Time at which the alarm should fire, in milliseconds past the epoch (e.g. `Date.now() + n`). */
|
|
428
|
+
when: number;
|
|
429
|
+
}
|
|
430
|
+
);
|
|
394
431
|
|
|
395
432
|
interface Alarm {
|
|
433
|
+
/** Name of this alarm. */
|
|
434
|
+
name: string;
|
|
396
435
|
/** If not null, the alarm is a repeating alarm and will fire again in `periodInMinutes` minutes. */
|
|
397
436
|
periodInMinutes?: number;
|
|
437
|
+
/**
|
|
438
|
+
* Whether the alarm should persist across sessions (browser restarts).
|
|
439
|
+
* @since Chrome 150
|
|
440
|
+
*/
|
|
441
|
+
persistAcrossSessions: boolean;
|
|
398
442
|
/** Time at which this alarm was scheduled to fire, in milliseconds past the epoch (e.g. `Date.now() + n`). For performance reasons, the alarm may have been delayed an arbitrary amount beyond this. */
|
|
399
443
|
scheduledTime: number;
|
|
400
|
-
/** Name of this alarm. */
|
|
401
|
-
name: string;
|
|
402
444
|
}
|
|
403
445
|
|
|
404
446
|
/**
|
|
@@ -1031,7 +1073,10 @@ export namespace Browser {
|
|
|
1031
1073
|
|
|
1032
1074
|
/** A set of data types. Missing data types are interpreted as `false`. */
|
|
1033
1075
|
interface DataTypeSet {
|
|
1034
|
-
/**
|
|
1076
|
+
/**
|
|
1077
|
+
* Websites' WebSQL data.
|
|
1078
|
+
* @deprecated since Chrome 139. Support for WebSQL has been removed. This data type will be ignored.
|
|
1079
|
+
*/
|
|
1035
1080
|
webSQL?: boolean | undefined;
|
|
1036
1081
|
/** Websites' IndexedDB data. */
|
|
1037
1082
|
indexedDB?: boolean | undefined;
|
|
@@ -1053,7 +1098,10 @@ export namespace Browser {
|
|
|
1053
1098
|
cache?: boolean | undefined;
|
|
1054
1099
|
/** Cache storage. */
|
|
1055
1100
|
cacheStorage?: boolean | undefined;
|
|
1056
|
-
/**
|
|
1101
|
+
/**
|
|
1102
|
+
* Websites' appcaches.
|
|
1103
|
+
* @deprecated since Chrome 98. Support for appcache has been removed. This data type will be ignored.
|
|
1104
|
+
*/
|
|
1057
1105
|
appcache?: boolean | undefined;
|
|
1058
1106
|
/** Websites' file systems. */
|
|
1059
1107
|
fileSystems?: boolean | undefined;
|
|
@@ -1152,6 +1200,7 @@ export namespace Browser {
|
|
|
1152
1200
|
* Clears websites' WebSQL data.
|
|
1153
1201
|
*
|
|
1154
1202
|
* Can return its result via Promise in Manifest V3 or later since Chrome 96.
|
|
1203
|
+
* @deprecated since Chrome 139. Support for WebSQL has been removed. This function has no effect.
|
|
1155
1204
|
*/
|
|
1156
1205
|
function removeWebSQL(options: RemovalOptions): Promise<void>;
|
|
1157
1206
|
function removeWebSQL(options: RemovalOptions, callback: () => void): void;
|
|
@@ -1160,6 +1209,7 @@ export namespace Browser {
|
|
|
1160
1209
|
* Clears websites' appcache data.
|
|
1161
1210
|
*
|
|
1162
1211
|
* Can return its result via Promise in Manifest V3 or later since Chrome 96.
|
|
1212
|
+
* @deprecated since Chrome 98. Support for appcache has been removed. This function has no effect.
|
|
1163
1213
|
*/
|
|
1164
1214
|
function removeAppcache(options: RemovalOptions): Promise<void>;
|
|
1165
1215
|
function removeAppcache(options: RemovalOptions, callback: () => void): void;
|
|
@@ -2464,7 +2514,7 @@ export namespace Browser {
|
|
|
2464
2514
|
*
|
|
2465
2515
|
* Permissions: "declarativeWebRequest"
|
|
2466
2516
|
*
|
|
2467
|
-
* MV2 only
|
|
2517
|
+
* Beta and MV2 only
|
|
2468
2518
|
* @deprecated Check out the {@link declarativeNetRequest} API instead
|
|
2469
2519
|
*/
|
|
2470
2520
|
export namespace declarativeWebRequest {
|
|
@@ -2519,9 +2569,9 @@ export namespace Browser {
|
|
|
2519
2569
|
/** Matches if the MIME media type of a response (from the HTTP Content-Type header) is not contained in the list. */
|
|
2520
2570
|
excludeContentType?: string[] | undefined;
|
|
2521
2571
|
/** Matches if none of the request headers is matched by any of the HeaderFilters. */
|
|
2522
|
-
|
|
2572
|
+
excludeRequestHeaders?: HeaderFilter[] | undefined;
|
|
2523
2573
|
/** Matches if none of the response headers is matched by any of the HeaderFilters. */
|
|
2524
|
-
|
|
2574
|
+
excludeResponseHeaders?: HeaderFilter[] | undefined;
|
|
2525
2575
|
/**
|
|
2526
2576
|
* Matches if the conditions of the UrlFilter are fulfilled for the 'first party' URL of the request. The 'first party' URL of a request, when present, can be different from the request's target URL, and describes what is considered 'first party' for the sake of third-party checks for cookies.
|
|
2527
2577
|
* @deprecated since Chrome 82
|
|
@@ -2588,7 +2638,7 @@ export namespace Browser {
|
|
|
2588
2638
|
/** Edits one or more cookies of response. Note that it is preferred to use the Cookies API because this is computationally less expensive. */
|
|
2589
2639
|
interface EditResponseCookie {
|
|
2590
2640
|
/** Filter for cookies that will be modified. All empty entries are ignored. */
|
|
2591
|
-
filter:
|
|
2641
|
+
filter: FilterResponseCookie;
|
|
2592
2642
|
/** Attributes that shall be overridden in cookies that matched the filter. Attributes that are set to an empty string are removed. */
|
|
2593
2643
|
modification: ResponseCookie;
|
|
2594
2644
|
}
|
|
@@ -2632,7 +2682,7 @@ export namespace Browser {
|
|
|
2632
2682
|
/** Existence of the Secure cookie attribute. */
|
|
2633
2683
|
secure?: string | undefined;
|
|
2634
2684
|
/** Filters session cookies. Session cookies have no lifetime specified in any of 'max-age' or 'expires' attributes. */
|
|
2635
|
-
|
|
2685
|
+
sessionCookie?: boolean | undefined;
|
|
2636
2686
|
/** Value of a cookie, may be padded in double-quotes. */
|
|
2637
2687
|
value?: string | undefined;
|
|
2638
2688
|
}
|
|
@@ -2783,11 +2833,28 @@ export namespace Browser {
|
|
|
2783
2833
|
* Manifest: "devtools_page"
|
|
2784
2834
|
*/
|
|
2785
2835
|
export namespace devtools.inspectedWindow {
|
|
2836
|
+
interface SetContentResult {
|
|
2837
|
+
code: string;
|
|
2838
|
+
description: string;
|
|
2839
|
+
details: string[];
|
|
2840
|
+
isError?: boolean;
|
|
2841
|
+
}
|
|
2842
|
+
|
|
2786
2843
|
/** A resource within the inspected page, such as a document, a script, or an image. */
|
|
2787
2844
|
interface Resource {
|
|
2788
2845
|
/** The URL of the resource. */
|
|
2789
2846
|
url: string;
|
|
2790
|
-
/**
|
|
2847
|
+
/**
|
|
2848
|
+
* Gets the content of the resource.
|
|
2849
|
+
*
|
|
2850
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 151.
|
|
2851
|
+
*/
|
|
2852
|
+
getContent(): Promise<{
|
|
2853
|
+
/** Content of the resource (potentially encoded). */
|
|
2854
|
+
content: string;
|
|
2855
|
+
/** Empty if the content is not encoded, encoding name otherwise. Currently, only base64 is supported.*/
|
|
2856
|
+
encoding: string;
|
|
2857
|
+
}>;
|
|
2791
2858
|
getContent(
|
|
2792
2859
|
callback: (
|
|
2793
2860
|
/** Content of the resource (potentially encoded). */
|
|
@@ -2800,14 +2867,17 @@ export namespace Browser {
|
|
|
2800
2867
|
* Sets the content of the resource.
|
|
2801
2868
|
* @param content New content of the resource. Only resources with the text type are currently supported.
|
|
2802
2869
|
* @param commit True if the user has finished editing the resource, and the new content of the resource should be persisted; false if this is a minor change sent in progress of the user editing the resource.
|
|
2870
|
+
*
|
|
2871
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 151.
|
|
2803
2872
|
*/
|
|
2804
2873
|
setContent(
|
|
2805
2874
|
content: string,
|
|
2806
2875
|
commit: boolean,
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2876
|
+
): Promise<undefined>;
|
|
2877
|
+
setContent(
|
|
2878
|
+
content: string,
|
|
2879
|
+
commit: boolean,
|
|
2880
|
+
callback: (result: SetContentResult) => void,
|
|
2811
2881
|
): void;
|
|
2812
2882
|
}
|
|
2813
2883
|
|
|
@@ -2847,7 +2917,13 @@ export namespace Browser {
|
|
|
2847
2917
|
* @param expression An expression to evaluate.
|
|
2848
2918
|
* @param options The options parameter can contain one or more options.
|
|
2849
2919
|
* @param callback A function called when evaluation completes.
|
|
2920
|
+
*
|
|
2921
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 151.
|
|
2850
2922
|
*/
|
|
2923
|
+
function eval<T = { [key: string]: unknown }>(
|
|
2924
|
+
expression: string,
|
|
2925
|
+
options?: EvalOptions,
|
|
2926
|
+
): Promise<{ result: T; exceptionInfo: EvaluationExceptionInfo }>;
|
|
2851
2927
|
function eval<T = { [key: string]: unknown }>(
|
|
2852
2928
|
expression: string,
|
|
2853
2929
|
callback?: (result: T, exceptionInfo: EvaluationExceptionInfo) => void,
|
|
@@ -2858,7 +2934,12 @@ export namespace Browser {
|
|
|
2858
2934
|
callback?: (result: T, exceptionInfo: EvaluationExceptionInfo) => void,
|
|
2859
2935
|
): void;
|
|
2860
2936
|
|
|
2861
|
-
/**
|
|
2937
|
+
/**
|
|
2938
|
+
* Retrieves the list of resources from the inspected page.
|
|
2939
|
+
*
|
|
2940
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 151.
|
|
2941
|
+
*/
|
|
2942
|
+
function getResources(): Promise<Resource[]>;
|
|
2862
2943
|
function getResources(callback: (resources: Resource[]) => void): void;
|
|
2863
2944
|
|
|
2864
2945
|
/** Fired when a new resource is added to the inspected page. */
|
|
@@ -2891,7 +2972,17 @@ export namespace Browser {
|
|
|
2891
2972
|
export namespace devtools.network {
|
|
2892
2973
|
/** Represents a network request for a document resource (script, image and so on). See HAR Specification for reference. */
|
|
2893
2974
|
interface Request extends HARFormatEntry {
|
|
2894
|
-
/**
|
|
2975
|
+
/**
|
|
2976
|
+
* Returns content of the response body.
|
|
2977
|
+
*
|
|
2978
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 151.
|
|
2979
|
+
*/
|
|
2980
|
+
getContent(): Promise<{
|
|
2981
|
+
/** Content of the response body (potentially encoded). */
|
|
2982
|
+
content: string;
|
|
2983
|
+
/** Empty if content is not encoded, encoding name otherwise. Currently, only base64 is supported. */
|
|
2984
|
+
encoding: string;
|
|
2985
|
+
}>;
|
|
2895
2986
|
getContent(
|
|
2896
2987
|
callback: (
|
|
2897
2988
|
/** Content of the response body (potentially encoded). */
|
|
@@ -2902,7 +2993,12 @@ export namespace Browser {
|
|
|
2902
2993
|
): void;
|
|
2903
2994
|
}
|
|
2904
2995
|
|
|
2905
|
-
/**
|
|
2996
|
+
/**
|
|
2997
|
+
* Returns HAR log that contains all known network requests.
|
|
2998
|
+
*
|
|
2999
|
+
* Can return its result via Promise in Manifest V3 or later since Chrome 151.
|
|
3000
|
+
*/
|
|
3001
|
+
function getHAR(): Promise<HARFormatLog>;
|
|
2906
3002
|
function getHAR(
|
|
2907
3003
|
callback: (
|
|
2908
3004
|
/** A HAR log. See HAR specification for details. */
|
|
@@ -6318,8 +6414,11 @@ export namespace Browser {
|
|
|
6318
6414
|
* Can return its result via Promise since Chrome 105.
|
|
6319
6415
|
*/
|
|
6320
6416
|
function getAuthToken(details?: TokenDetails): Promise<GetAuthTokenResult>;
|
|
6321
|
-
function getAuthToken(
|
|
6322
|
-
|
|
6417
|
+
function getAuthToken(
|
|
6418
|
+
details: TokenDetails | undefined,
|
|
6419
|
+
callback: (token?: string, grantedScopes?: string[]) => void,
|
|
6420
|
+
): void;
|
|
6421
|
+
function getAuthToken(callback: (token?: string, grantedScopes?: string[]) => void): void;
|
|
6323
6422
|
|
|
6324
6423
|
/**
|
|
6325
6424
|
* Retrieves email address and obfuscated gaia id of the user signed into a profile.
|
|
@@ -7201,7 +7300,7 @@ export namespace Browser {
|
|
|
7201
7300
|
enum ExtensionType {
|
|
7202
7301
|
EXTENSION = "extension",
|
|
7203
7302
|
HOSTED_APP = "hosted_app",
|
|
7204
|
-
|
|
7303
|
+
PACKAGED_APP = "packaged_app",
|
|
7205
7304
|
LEGACY_PACKAGED_APP = "legacy_packaged_app",
|
|
7206
7305
|
THEME = "theme",
|
|
7207
7306
|
LOGIN_SCREEN_EXTENSION = "login_screen_extension",
|
|
@@ -7367,6 +7466,66 @@ export namespace Browser {
|
|
|
7367
7466
|
const onEnabled: events.Event<(info: ExtensionInfo) => void>;
|
|
7368
7467
|
}
|
|
7369
7468
|
|
|
7469
|
+
////////////////////
|
|
7470
|
+
// MimeHandler
|
|
7471
|
+
////////////////////
|
|
7472
|
+
/**
|
|
7473
|
+
* Use the `Browser.mimeHandler` API to handle MIME type streams in third-party extensions.
|
|
7474
|
+
* @since Chrome 151, MV3
|
|
7475
|
+
*/
|
|
7476
|
+
export namespace mimeHandler {
|
|
7477
|
+
interface MimeHandlerOptions {
|
|
7478
|
+
/** Whether this handler is active for the given MIME type. */
|
|
7479
|
+
enabled: boolean;
|
|
7480
|
+
}
|
|
7481
|
+
|
|
7482
|
+
interface StreamInfo {
|
|
7483
|
+
/** True if loaded in an embedded context (iframe/embed/object). */
|
|
7484
|
+
embedded: boolean;
|
|
7485
|
+
/** The MIME type of the intercepted content. */
|
|
7486
|
+
mimeType: string;
|
|
7487
|
+
/** The original URL the user navigated to. */
|
|
7488
|
+
originalUrl: string;
|
|
7489
|
+
/** HTTP response headers as key-value pairs. */
|
|
7490
|
+
responseHeaders: { [key: string]: unknown };
|
|
7491
|
+
/** The URL to fetch the stream data from. */
|
|
7492
|
+
streamUrl: string;
|
|
7493
|
+
/** The tab ID containing the document. */
|
|
7494
|
+
tabId: number;
|
|
7495
|
+
}
|
|
7496
|
+
|
|
7497
|
+
/**
|
|
7498
|
+
* Aborts current stream handling and hands the content off to the user agent's native handler. After this call the extension frame will be torn down; callers should not expect further execution.
|
|
7499
|
+
*
|
|
7500
|
+
* Can return its result via Promise
|
|
7501
|
+
*/
|
|
7502
|
+
function abortAndFallbackToNativeHandler(): Promise<void>;
|
|
7503
|
+
function abortAndFallbackToNativeHandler(callback: () => void): void;
|
|
7504
|
+
|
|
7505
|
+
/**
|
|
7506
|
+
* Reads the persisted options for a MIME type. Returns defaults (enabled=true) if none have been stored.
|
|
7507
|
+
* @param mimeType The MIME type whose options to read.
|
|
7508
|
+
*
|
|
7509
|
+
* Can return its result via Promise
|
|
7510
|
+
*/
|
|
7511
|
+
function getMimeHandlerOptions(mimeType: string): Promise<MimeHandlerOptions>;
|
|
7512
|
+
function getMimeHandlerOptions(mimeType: string, callback: (options: MimeHandlerOptions) => void): void;
|
|
7513
|
+
|
|
7514
|
+
/** Retrieves stream information for the current MIME handler context. Must be called from within a MIME handler extension page. */
|
|
7515
|
+
function getStreamInfo(): Promise<StreamInfo>;
|
|
7516
|
+
function getStreamInfo(callback: (info: StreamInfo) => void): void;
|
|
7517
|
+
|
|
7518
|
+
/**
|
|
7519
|
+
* Sets the configuration options for a specified MIME type.
|
|
7520
|
+
* @param mimeType The MIME type to configure.
|
|
7521
|
+
* @param options The new options to use.
|
|
7522
|
+
*
|
|
7523
|
+
* Can return its result via Promise
|
|
7524
|
+
*/
|
|
7525
|
+
function setMimeHandlerOptions(mimeType: string, options: MimeHandlerOptions): Promise<void>;
|
|
7526
|
+
function setMimeHandlerOptions(mimeType: string, options: MimeHandlerOptions, callback: () => void): void;
|
|
7527
|
+
}
|
|
7528
|
+
|
|
7370
7529
|
////////////////////
|
|
7371
7530
|
// Notifications
|
|
7372
7531
|
////////////////////
|
|
@@ -7606,7 +7765,7 @@ export namespace Browser {
|
|
|
7606
7765
|
* Creates a new offscreen document for the extension.
|
|
7607
7766
|
* @param parameters The parameters describing the offscreen document to create.
|
|
7608
7767
|
*
|
|
7609
|
-
* Can return its result via Promise
|
|
7768
|
+
* Can return its result via Promise.
|
|
7610
7769
|
*/
|
|
7611
7770
|
function createDocument(parameters: CreateParameters): Promise<void>;
|
|
7612
7771
|
function createDocument(parameters: CreateParameters, callback: () => void): void;
|
|
@@ -7614,7 +7773,7 @@ export namespace Browser {
|
|
|
7614
7773
|
/**
|
|
7615
7774
|
* Closes the currently-open offscreen document for the extension.
|
|
7616
7775
|
*
|
|
7617
|
-
* Can return its result via Promise
|
|
7776
|
+
* Can return its result via Promise.
|
|
7618
7777
|
*/
|
|
7619
7778
|
function closeDocument(): Promise<void>;
|
|
7620
7779
|
function closeDocument(callback: () => void): void;
|
|
@@ -7622,7 +7781,8 @@ export namespace Browser {
|
|
|
7622
7781
|
/**
|
|
7623
7782
|
* Determines whether the extension has an active document.
|
|
7624
7783
|
*
|
|
7625
|
-
* Can return its result via Promise
|
|
7784
|
+
* Can return its result via Promise.
|
|
7785
|
+
* @since Chrome 150
|
|
7626
7786
|
*/
|
|
7627
7787
|
function hasDocument(): Promise<boolean>;
|
|
7628
7788
|
function hasDocument(callback: (result: boolean) => void): void;
|
|
@@ -8453,6 +8613,17 @@ export namespace Browser {
|
|
|
8453
8613
|
* Permissions: "privacy"
|
|
8454
8614
|
*/
|
|
8455
8615
|
export namespace privacy {
|
|
8616
|
+
/**
|
|
8617
|
+
* Categories of Autofill data.
|
|
8618
|
+
* @since Chrome 151
|
|
8619
|
+
*/
|
|
8620
|
+
enum AutofillBlockedType {
|
|
8621
|
+
CONTACT_INFO = "contact_info",
|
|
8622
|
+
PAYMENTS = "payments",
|
|
8623
|
+
IDENTITY_DOCS = "identity_docs",
|
|
8624
|
+
TRAVEL = "travel",
|
|
8625
|
+
}
|
|
8626
|
+
|
|
8456
8627
|
/**
|
|
8457
8628
|
* The IP handling policy of WebRTC.
|
|
8458
8629
|
* @since Chrome 48
|
|
@@ -9135,9 +9306,11 @@ export namespace Browser {
|
|
|
9135
9306
|
}
|
|
9136
9307
|
|
|
9137
9308
|
interface ManifestAction {
|
|
9138
|
-
default_icon?: ManifestIcons | undefined;
|
|
9309
|
+
default_icon?: ManifestIcons | string | undefined;
|
|
9139
9310
|
default_title?: string | undefined;
|
|
9140
9311
|
default_popup?: string | undefined;
|
|
9312
|
+
/** @default 'enabled' */
|
|
9313
|
+
default_state?: "enabled" | "disabled";
|
|
9141
9314
|
}
|
|
9142
9315
|
|
|
9143
9316
|
/** Source: https://developer.chrome.com/docs/extensions/reference/permissions-list */
|
|
@@ -9184,6 +9357,7 @@ export namespace Browser {
|
|
|
9184
9357
|
| "identity"
|
|
9185
9358
|
| "identity.email"
|
|
9186
9359
|
| "idle"
|
|
9360
|
+
| "input"
|
|
9187
9361
|
| "loginState"
|
|
9188
9362
|
| "management"
|
|
9189
9363
|
| "nativeMessaging"
|
|
@@ -9242,22 +9416,37 @@ export namespace Browser {
|
|
|
9242
9416
|
| "webAuthenticationProxy"
|
|
9243
9417
|
>;
|
|
9244
9418
|
|
|
9419
|
+
/** A search engine. */
|
|
9245
9420
|
interface SearchProvider {
|
|
9421
|
+
/** Name of the search engine displayed to user. This is required if you don't set `prepopulated_id`. */
|
|
9246
9422
|
name?: string | undefined;
|
|
9423
|
+
/** An omnibox keyword for the search engine. This is required if you don't set `prepopulated_id`. */
|
|
9247
9424
|
keyword?: string | undefined;
|
|
9425
|
+
/** An icon URL for the search engine. This is required if you don't set `prepopulated_id`. */
|
|
9248
9426
|
favicon_url?: string | undefined;
|
|
9427
|
+
/** The search URL the search engine uses. */
|
|
9249
9428
|
search_url: string;
|
|
9429
|
+
/** The encoding used for search terms. This is required if you don't set `prepopulated_id`. */
|
|
9250
9430
|
encoding?: string | undefined;
|
|
9431
|
+
/** The URL the search engine uses for suggestions. If this isn't used, the engine doesn't support suggestions. */
|
|
9251
9432
|
suggest_url?: string | undefined;
|
|
9252
9433
|
instant_url?: string | undefined;
|
|
9434
|
+
/** The URL the search engine uses for image search. If this isn't used, the engine doesn't support image search. */
|
|
9253
9435
|
image_url?: string | undefined;
|
|
9436
|
+
/** The post parameters for `search_url`. */
|
|
9254
9437
|
search_url_post_params?: string | undefined;
|
|
9438
|
+
/** The post parameters for `suggest_url`. */
|
|
9255
9439
|
suggest_url_post_params?: string | undefined;
|
|
9440
|
+
/** The post parameters for `instant_url`. */
|
|
9256
9441
|
instant_url_post_params?: string | undefined;
|
|
9442
|
+
/** The post parameters for `image_url`. */
|
|
9257
9443
|
image_url_post_params?: string | undefined;
|
|
9444
|
+
/** A list of URL patterns that can be used in addition to `search_url`. */
|
|
9258
9445
|
alternate_urls?: string[] | undefined;
|
|
9446
|
+
/** An ID for Chrome's built-in search engine. */
|
|
9259
9447
|
prepopulated_id?: number | undefined;
|
|
9260
|
-
|
|
9448
|
+
/** Specifies whether the search provider should be default. */
|
|
9449
|
+
is_default: boolean;
|
|
9261
9450
|
}
|
|
9262
9451
|
|
|
9263
9452
|
interface ManifestBase {
|
|
@@ -9282,8 +9471,10 @@ export namespace Browser {
|
|
|
9282
9471
|
author?: { email: string } | undefined;
|
|
9283
9472
|
/** Defines overrides for selected Chrome settings. */
|
|
9284
9473
|
chrome_settings_overrides?: {
|
|
9474
|
+
/** The new value for the homepage. */
|
|
9285
9475
|
homepage?: string | undefined;
|
|
9286
9476
|
search_provider?: SearchProvider | undefined;
|
|
9477
|
+
/** An array of length one containing a URL to be used as the startup page. */
|
|
9287
9478
|
startup_pages?: string[] | undefined;
|
|
9288
9479
|
} | undefined;
|
|
9289
9480
|
/** Defines overrides for default Chrome pages. */
|
|
@@ -9295,13 +9486,16 @@ export namespace Browser {
|
|
|
9295
9486
|
/** Defines keyboard shortcuts within the extension. */
|
|
9296
9487
|
commands?: {
|
|
9297
9488
|
[name: string]: {
|
|
9298
|
-
suggested_key?:
|
|
9299
|
-
|
|
9300
|
-
|
|
9301
|
-
|
|
9302
|
-
|
|
9303
|
-
|
|
9304
|
-
|
|
9489
|
+
suggested_key?:
|
|
9490
|
+
| {
|
|
9491
|
+
default?: string | undefined;
|
|
9492
|
+
windows?: string | undefined;
|
|
9493
|
+
mac?: string | undefined;
|
|
9494
|
+
chromeos?: string | undefined;
|
|
9495
|
+
linux?: string | undefined;
|
|
9496
|
+
}
|
|
9497
|
+
| string
|
|
9498
|
+
| undefined;
|
|
9305
9499
|
description?: string | undefined;
|
|
9306
9500
|
global?: boolean | undefined;
|
|
9307
9501
|
};
|
|
@@ -9317,7 +9511,7 @@ export namespace Browser {
|
|
|
9317
9511
|
cross_origin_opener_policy?: { value: string } | undefined;
|
|
9318
9512
|
current_locale?: string | undefined;
|
|
9319
9513
|
/** Defines static rules for the declarativeNetRequest API, which allows blocking and modifying of network requests. */
|
|
9320
|
-
declarative_net_request?: { rule_resources
|
|
9514
|
+
declarative_net_request?: { rule_resources: declarativeNetRequest.Ruleset[] } | undefined;
|
|
9321
9515
|
/** Defines pages that use the DevTools APIs. */
|
|
9322
9516
|
devtools_page?: string | undefined;
|
|
9323
9517
|
event_rules?:
|
|
@@ -9389,20 +9583,13 @@ export namespace Browser {
|
|
|
9389
9583
|
/** Allows the use of an OAuth 2.0 security ID. The value of this key must be an object with "client_id" and "scopes" properties. */
|
|
9390
9584
|
oauth2?: {
|
|
9391
9585
|
client_id: string;
|
|
9392
|
-
scopes
|
|
9586
|
+
scopes: string[];
|
|
9393
9587
|
} | undefined;
|
|
9394
9588
|
offline_enabled?: boolean | undefined;
|
|
9395
9589
|
/** Allows the extension to register a keyword in Chrome's address bar. */
|
|
9396
9590
|
omnibox?: { keyword: string } | undefined;
|
|
9397
9591
|
/** Specifies a path to an options.html file for the extension to use as an options page. */
|
|
9398
9592
|
options_page?: string | undefined;
|
|
9399
|
-
/** Specifies a path to an HTML file that lets a user change extension options from the Chrome Extensions page. */
|
|
9400
|
-
options_ui?: {
|
|
9401
|
-
/** Path to the options page, relative to the extension's root. */
|
|
9402
|
-
page: string;
|
|
9403
|
-
/** Specify as `false` to declare an embedded options page. If `true`, the extension's options page will be opened in a new tab rather than embedded in `chrome://extensions`. */
|
|
9404
|
-
open_in_tab: boolean;
|
|
9405
|
-
} | undefined;
|
|
9406
9593
|
/** Lists technologies required to use the extension. */
|
|
9407
9594
|
requirements?: {
|
|
9408
9595
|
"3D"?: { features?: string[] | undefined } | undefined;
|
|
@@ -9438,8 +9625,8 @@ export namespace Browser {
|
|
|
9438
9625
|
manifest_version: 2;
|
|
9439
9626
|
|
|
9440
9627
|
// Pick one (or none)
|
|
9441
|
-
browser_action?: ManifestAction | undefined;
|
|
9442
|
-
page_action?: ManifestAction | undefined;
|
|
9628
|
+
browser_action?: Omit<ManifestAction, "default_state"> | undefined;
|
|
9629
|
+
page_action?: Omit<ManifestAction, "default_state"> | undefined;
|
|
9443
9630
|
|
|
9444
9631
|
// Optional
|
|
9445
9632
|
background?:
|
|
@@ -9465,6 +9652,15 @@ export namespace Browser {
|
|
|
9465
9652
|
| undefined;
|
|
9466
9653
|
/** Defines restrictions on the scripts, styles, and other resources an extension can use. */
|
|
9467
9654
|
content_security_policy?: string | undefined;
|
|
9655
|
+
/** Specifies a path to an HTML file that lets a user change extension options from the Chrome Extensions page. */
|
|
9656
|
+
options_ui?: {
|
|
9657
|
+
/** Path to the options page, relative to the extension's root. */
|
|
9658
|
+
page: string;
|
|
9659
|
+
/** If `true`, a Chrome user agent stylesheet will be applied to your options page. Defaults to `false`. */
|
|
9660
|
+
chrome_style?: boolean | undefined;
|
|
9661
|
+
/** Specify as `false` to declare an embedded options page. If `true`, the extension's options page will be opened in a new tab rather than embedded in `chrome://extensions`. */
|
|
9662
|
+
open_in_tab?: boolean | undefined;
|
|
9663
|
+
} | undefined;
|
|
9468
9664
|
/** Declares optional permissions for your extension. */
|
|
9469
9665
|
optional_permissions?: (ManifestOptionalPermission | string)[] | undefined;
|
|
9470
9666
|
/** Enables use of particular extension APIs. */
|
|
@@ -9528,6 +9724,25 @@ export namespace Browser {
|
|
|
9528
9724
|
| undefined;
|
|
9529
9725
|
/** Lists the web pages your extension is allowed to interact with, defined using URL match patterns. User permission for these sites is requested at install time. */
|
|
9530
9726
|
host_permissions?: string[] | undefined;
|
|
9727
|
+
/** Specifies a path to an HTML file that lets a user change extension options from the Chrome Extensions page. */
|
|
9728
|
+
options_ui?: {
|
|
9729
|
+
/** Specifies the path to the options page, relative to the extension's root. */
|
|
9730
|
+
page: string;
|
|
9731
|
+
/** Indicates whether the extension's options page will be opened in a new tab. If set to `false`, the extension's options page is embedded in `chrome://extensions` rather than opened in a new tab. */
|
|
9732
|
+
open_in_tab?: boolean | undefined;
|
|
9733
|
+
} | undefined;
|
|
9734
|
+
/**
|
|
9735
|
+
* Maps MIME types to the extension pages that render them. As of Chrome 151, `application/pdf` is the only MIME type available to public handlers. Declaring an unsupported MIME type causes an installation warning.
|
|
9736
|
+
* @since Chrome 151
|
|
9737
|
+
*/
|
|
9738
|
+
mime_types_handler?: {
|
|
9739
|
+
"application/pdf": {
|
|
9740
|
+
/** The HTML file to display when a document of the corresponding MIME type is opened. This file must be located within your extension. */
|
|
9741
|
+
handler_url: string;
|
|
9742
|
+
/** Specifies whether to handle documents embedded in `<embed>`, `<object>`, or `<iframe>` elements. Defaults to `false`, meaning the handler only receives top-level navigations. */
|
|
9743
|
+
can_embed?: boolean;
|
|
9744
|
+
};
|
|
9745
|
+
};
|
|
9531
9746
|
/** Declares optional permissions for your extension. */
|
|
9532
9747
|
optional_permissions?: ManifestOptionalPermission[] | undefined;
|
|
9533
9748
|
/** Declares optional host permissions for your extension. */
|
|
@@ -10743,15 +10958,10 @@ export namespace Browser {
|
|
|
10743
10958
|
|
|
10744
10959
|
interface MirrorModeInfo {
|
|
10745
10960
|
/** The mirror mode that should be set. */
|
|
10746
|
-
mode
|
|
10747
|
-
|
|
10748
|
-
|
|
10749
|
-
interface MirrorModeInfoMixed extends MirrorModeInfo {
|
|
10750
|
-
/** The mirror mode that should be set. */
|
|
10751
|
-
mode: "mixed";
|
|
10752
|
-
/** The id of the mirroring source display. */
|
|
10961
|
+
mode: `${MirrorMode}`;
|
|
10962
|
+
/** The id of the mirroring source display. This is only valid for 'mixed'. */
|
|
10753
10963
|
mirroringSourceId?: string | undefined;
|
|
10754
|
-
/** The ids of the mirroring destination displays. */
|
|
10964
|
+
/** The ids of the mirroring destination displays. This is only valid for 'mixed'. */
|
|
10755
10965
|
mirroringDestinationIds?: string[] | undefined;
|
|
10756
10966
|
}
|
|
10757
10967
|
|
|
@@ -10892,8 +11102,8 @@ export namespace Browser {
|
|
|
10892
11102
|
* @param info The information of the mirror mode that should be applied to the display mode.
|
|
10893
11103
|
* @since Chrome 65
|
|
10894
11104
|
*/
|
|
10895
|
-
function setMirrorMode(info: MirrorModeInfo
|
|
10896
|
-
function setMirrorMode(info: MirrorModeInfo
|
|
11105
|
+
function setMirrorMode(info: MirrorModeInfo, callback: () => void): void;
|
|
11106
|
+
function setMirrorMode(info: MirrorModeInfo): Promise<void>;
|
|
10897
11107
|
|
|
10898
11108
|
/** Fired when anything changes to the display configuration. */
|
|
10899
11109
|
const onDisplayChanged: Browser.events.Event<() => void>;
|
|
@@ -11114,7 +11324,7 @@ export namespace Browser {
|
|
|
11114
11324
|
* The last time the tab became active in its window as the number of milliseconds since epoch.
|
|
11115
11325
|
* @since Chrome 121
|
|
11116
11326
|
*/
|
|
11117
|
-
lastAccessed
|
|
11327
|
+
lastAccessed: number;
|
|
11118
11328
|
}
|
|
11119
11329
|
|
|
11120
11330
|
/** The tab's loading status. */
|
|
@@ -11684,8 +11894,11 @@ export namespace Browser {
|
|
|
11684
11894
|
function insertCSS(details: extensionTypes.InjectDetails): Promise<void>;
|
|
11685
11895
|
function insertCSS(tabId: number | undefined, details: extensionTypes.InjectDetails): Promise<void>;
|
|
11686
11896
|
function insertCSS(details: extensionTypes.InjectDetails, callback: () => void): void;
|
|
11687
|
-
function insertCSS(
|
|
11688
|
-
|
|
11897
|
+
function insertCSS(
|
|
11898
|
+
tabId: number | undefined,
|
|
11899
|
+
details: extensionTypes.InjectDetails,
|
|
11900
|
+
callback: () => void,
|
|
11901
|
+
): void;
|
|
11689
11902
|
|
|
11690
11903
|
/**
|
|
11691
11904
|
* Highlights the given tabs and focuses on the first of group. Will appear to do nothing if the specified tab is currently active.
|