-
Notifications
You must be signed in to change notification settings - Fork 29.9k
/
index.d.ts
9630 lines (8611 loc) · 426 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
interface WebExtEvent<TCallback extends (...args: any[]) => any> {
addListener(cb: TCallback): void;
removeListener(cb: TCallback): void;
hasListener(cb: TCallback): boolean;
}
/** Not allowed in: Content scripts, Devtools pages */
declare namespace browser._manifest {
/* _manifest types */
type PermissionPrivileged = _PermissionPrivileged;
interface ActionManifest {
default_title?: string | undefined;
default_icon?: IconPath | undefined;
/** Specifies icons to use for dark and light themes */
theme_icons?: ThemeIcons[] | undefined;
default_popup?: string | undefined;
/** Deprecated in Manifest V3. */
browser_style?: boolean | undefined;
/** Defines the location the browserAction will appear by default. The default location is navbar. */
default_area?: _ActionManifestDefaultArea | undefined;
}
/** Represents a WebExtension manifest.json file */
interface WebExtensionManifest {
/** Needs at least manifest version 3. */
action?: ActionManifest | undefined;
/** Not supported on manifest versions above 2. */
browser_action?: ActionManifest | undefined;
declarative_net_request?: _WebExtensionManifestDeclarativeNetRequest | undefined;
experiment_apis?: { [key: string]: experiments.ExperimentAPI } | undefined;
/** A list of protocol handler definitions. */
protocol_handlers?: ProtocolHandler[] | undefined;
default_locale?: string | undefined;
l10n_resources?: string[] | undefined;
minimum_chrome_version?: string | undefined;
minimum_opera_version?: string | undefined;
icons?: _WebExtensionManifestIcons | undefined;
incognito?: _WebExtensionManifestIncognito | undefined;
background?: {
page: ExtensionURL;
/** Not supported on manifest versions above 2. */
persistent?: boolean | undefined;
} | {
scripts: ExtensionURL[];
type?: _UndefinedType | undefined;
/** Not supported on manifest versions above 2. */
persistent?: boolean | undefined;
} | {
service_worker: ExtensionURL;
} | undefined;
options_ui?: _WebExtensionManifestOptionsUi | undefined;
content_scripts?: ContentScript[] | undefined;
content_security_policy?: string | {
/** The Content Security Policy used for extension pages. */
extension_pages?: string | undefined;
} | undefined;
permissions?: PermissionOrOrigin[] | Permission[] | undefined;
granted_host_permissions?: boolean | undefined;
/** Needs at least manifest version 3. */
host_permissions?: MatchPattern[] | undefined;
optional_permissions?: OptionalPermissionOrOrigin[] | undefined;
web_accessible_resources?:
| string[]
| Array<{
resources: string[];
matches?: MatchPattern[] | undefined;
extension_ids?: Array<ExtensionID | "*"> | undefined;
}>
| undefined;
hidden?: boolean | undefined;
page_action?: _WebExtensionManifestPageAction | undefined;
telemetry?: _WebExtensionManifestTelemetry | undefined;
theme_experiment?: ThemeExperiment | undefined;
/** Not supported on manifest versions above 2. */
user_scripts?: _WebExtensionManifestUserScripts | undefined;
chrome_settings_overrides?: _WebExtensionManifestChromeSettingsOverrides | undefined;
commands?: { [key: string]: _WebExtensionManifestCommands } | undefined;
devtools_page?: ExtensionURL | undefined;
omnibox?: _WebExtensionManifestOmnibox | undefined;
sidebar_action?: _WebExtensionManifestSidebarAction | undefined;
chrome_url_overrides?: _WebExtensionManifestChromeUrlOverrides | undefined;
manifest_version: number;
/**
* The applications property is deprecated, please use 'browser_specific_settings'
* Not supported on manifest versions above 2.
*/
applications?: DeprecatedApplications | undefined;
browser_specific_settings?: BrowserSpecificSettings | undefined;
name: string;
short_name?: string | undefined;
description?: string | undefined;
author?: string | undefined;
version: string;
homepage_url?: string | undefined;
install_origins?: string[] | undefined;
developer?: _WebExtensionManifestDeveloper | undefined;
}
type OptionalPermission = OptionalPermissionNoPrompt | _OptionalPermission;
type PermissionNoPrompt = OptionalPermissionNoPrompt | PermissionPrivileged | _PermissionNoPrompt;
type OptionalPermissionNoPrompt = _OptionalPermissionNoPrompt;
type Permission = string | PermissionNoPrompt | OptionalPermission | "declarativeNetRequest";
/** Represents a protocol handler definition. */
interface ProtocolHandler {
/**
* A user-readable title string for the protocol handler. This will be displayed to the user in interface objects as needed.
*/
name: string;
/**
* The protocol the site wishes to handle, specified as a string. For example, you can register to handle SMS text message links by registering to handle the "sms" scheme.
*/
protocol: string | _ProtocolHandlerProtocol;
/**
* The URL of the handler, as a string. This string should include "%s" as a placeholder which will be replaced with the escaped URL of the document to be handled. This URL might be a true URL, or it could be a phone number, email address, or so forth.
*/
uriTemplate: ExtensionURL | HttpURL;
}
/** Common properties for all manifest.json files */
interface ManifestBase {
manifest_version: number;
/**
* The applications property is deprecated, please use 'browser_specific_settings'
* Not supported on manifest versions above 2.
*/
applications?: DeprecatedApplications | undefined;
browser_specific_settings?: BrowserSpecificSettings | undefined;
name: string;
short_name?: string | undefined;
description?: string | undefined;
author?: string | undefined;
version: string;
homepage_url?: string | undefined;
install_origins?: string[] | undefined;
developer?: _ManifestBaseDeveloper | undefined;
}
/** Represents a WebExtension language pack manifest.json file */
interface WebExtensionLangpackManifest {
langpack_id: string;
languages: _WebExtensionLangpackManifestLanguages;
sources?: _WebExtensionLangpackManifestSources | undefined;
manifest_version: number;
/**
* The applications property is deprecated, please use 'browser_specific_settings'
* Not supported on manifest versions above 2.
*/
applications?: DeprecatedApplications | undefined;
browser_specific_settings?: BrowserSpecificSettings | undefined;
name: string;
short_name?: string | undefined;
description?: string | undefined;
author?: string | undefined;
version: string;
homepage_url?: string | undefined;
install_origins?: string[] | undefined;
developer?: _WebExtensionLangpackManifestDeveloper | undefined;
}
/** Represents a WebExtension dictionary manifest.json file */
interface WebExtensionDictionaryManifest {
dictionaries: _WebExtensionDictionaryManifestDictionaries;
manifest_version: number;
/**
* The applications property is deprecated, please use 'browser_specific_settings'
* Not supported on manifest versions above 2.
*/
applications?: DeprecatedApplications | undefined;
browser_specific_settings?: BrowserSpecificSettings | undefined;
name: string;
short_name?: string | undefined;
description?: string | undefined;
author?: string | undefined;
version: string;
homepage_url?: string | undefined;
install_origins?: string[] | undefined;
developer?: _WebExtensionDictionaryManifestDeveloper | undefined;
}
/** Represents a WebExtension site permissions manifest.json file */
interface WebExtensionSitePermissionsManifest {
site_permissions: SitePermission[];
install_origins?: [string] | undefined;
manifest_version: number;
/**
* The applications property is deprecated, please use 'browser_specific_settings'
* Not supported on manifest versions above 2.
*/
applications?: DeprecatedApplications | undefined;
browser_specific_settings?: BrowserSpecificSettings | undefined;
name: string;
short_name?: string | undefined;
description?: string | undefined;
author?: string | undefined;
version: string;
homepage_url?: string | undefined;
developer?: _WebExtensionSitePermissionsManifestDeveloper | undefined;
}
interface ThemeIcons {
/** A light icon to use for dark themes */
light: ExtensionURL;
/** The dark icon to use for light themes */
dark: ExtensionURL;
/** The size of the icons */
size: number;
}
type OptionalPermissionOrOrigin = OptionalPermission | MatchPattern;
type PermissionOrOrigin = Permission | MatchPattern;
type SitePermission = _SitePermission;
type HttpURL = string;
type ExtensionURL = string;
type ExtensionFileUrl = string;
type ImageDataOrExtensionURL = string;
type ExtensionID = string;
interface FirefoxSpecificProperties {
id?: ExtensionID | undefined;
update_url?: string | undefined;
strict_min_version?: string | undefined;
strict_max_version?: string | undefined;
}
interface GeckoAndroidSpecificProperties {
strict_min_version?: string | undefined;
strict_max_version?: string | undefined;
}
interface DeprecatedApplications {
gecko?: FirefoxSpecificProperties | undefined;
/** @deprecated Unsupported on Firefox at this time. */
gecko_android?: GeckoAndroidSpecificProperties | undefined;
}
interface BrowserSpecificSettings {
gecko?: FirefoxSpecificProperties | undefined;
gecko_android?: GeckoAndroidSpecificProperties | undefined;
}
type MatchPattern = MatchPatternRestricted | MatchPatternUnestricted | "<all_urls>";
/** Same as MatchPattern above, but excludes<all_urls></all_urls> */
type MatchPatternRestricted = string;
/**
* Mostly unrestricted match patterns for privileged add-ons. This should technically be rejected for unprivileged add-ons, but, reasons. The MatchPattern class will still refuse privileged schemes for those extensions.
*/
type MatchPatternUnestricted = string;
/**
* 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. Based on InjectDetails, but using underscore rather than camel case naming conventions.
*/
interface ContentScript {
matches: MatchPattern[];
exclude_matches?: MatchPattern[] | undefined;
include_globs?: string[] | undefined;
exclude_globs?: string[] | undefined;
/** The list of CSS files to inject */
css?: ExtensionURL[] | undefined;
/** The list of JS files to inject */
js?: ExtensionURL[] | undefined;
/**
* 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.
*/
all_frames?: boolean | undefined;
/**
* 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`.
*/
match_about_blank?: boolean | undefined;
/** The soonest that the JavaScript or CSS will be injected into the tab. Defaults to "document_idle". */
run_at?: extensionTypes.RunAt | undefined;
}
type IconPath = {
[key: number]: ExtensionFileUrl;
} | ExtensionFileUrl;
type IconImageData = {
[key: number]: ImageData;
} | ImageData;
type ImageData = any;
/** @deprecated An unexpected property was found in the WebExtension manifest. */
type UnrecognizedProperty = any;
/** Represents a native manifest file */
type NativeManifest = {
name: string;
description: string;
path: string;
type: "pkcs11" | "stdio";
allowed_extensions: ExtensionID[];
} | {
name: ExtensionID;
description: string;
data: { [key: string]: any };
type: "storage";
};
type ThemeColor = string | [number, number, number] | [number, number, number, number];
interface ThemeExperiment {
stylesheet?: ExtensionURL | undefined;
images?: { [key: string]: string } | undefined;
colors?: { [key: string]: string } | undefined;
properties?: { [key: string]: string } | undefined;
}
interface ThemeType {
images?: _ThemeTypeImages | undefined;
colors?: _ThemeTypeColors | undefined;
properties?: _ThemeType | undefined;
}
/** Contents of manifest.json for a static theme */
interface ThemeManifest {
theme: ThemeType;
dark_theme?: ThemeType | undefined;
default_locale?: string | undefined;
theme_experiment?: ThemeExperiment | undefined;
icons?: _ThemeManifestIcons | undefined;
}
type KeyName = string;
type _PermissionPrivileged =
| "activityLog"
| "mozillaAddons"
| "networkStatus"
| "telemetry"
| "normandyAddonStudy"
| "urlbar";
/** Defines the location the browserAction will appear by default. The default location is navbar. */
type _ActionManifestDefaultArea =
| "navbar"
| "menupanel"
| "tabstrip"
| "personaltoolbar";
interface _WebExtensionManifestDeclarativeNetRequestRuleResources {
/**
* A non-empty string uniquely identifying the ruleset. IDs beginning with '_' are reserved for internal use.
*/
id: string;
/** Whether the ruleset is enabled by default. */
enabled: boolean;
/** The path of the JSON ruleset relative to the extension directory. */
path: ExtensionURL;
}
interface _WebExtensionManifestDeclarativeNetRequest {
rule_resources: _WebExtensionManifestDeclarativeNetRequestRuleResources[];
}
interface _WebExtensionManifestIcons {
[key: number]: ExtensionFileUrl;
}
type _WebExtensionManifestIncognito = "not_allowed" | "spanning";
type _UndefinedType = "module" | "classic";
interface _WebExtensionManifestOptionsUi {
page: ExtensionURL;
/** Defaults to true in Manifest V2; Deprecated in Manifest V3. */
browser_style?: boolean | undefined;
/**
* chrome_style is ignored in Firefox. Its replacement (browser_style) has been deprecated.
* Not supported on manifest versions above 2.
*/
chrome_style?: boolean | undefined;
open_in_tab?: boolean | undefined;
}
interface _WebExtensionManifestPageAction {
default_title?: string | undefined;
default_icon?: IconPath | undefined;
default_popup?: string | undefined;
/** Deprecated in Manifest V3. */
browser_style?: boolean | undefined;
show_matches?: MatchPattern[] | undefined;
hide_matches?: MatchPatternRestricted[] | undefined;
pinned?: boolean | undefined;
}
interface _WebExtensionManifestTelemetryPublicKeyKey {
crv?: string | undefined;
kty?: string | undefined;
x?: string | undefined;
y?: string | undefined;
}
interface _WebExtensionManifestTelemetryPublicKey {
id: string;
key: _WebExtensionManifestTelemetryPublicKeyKey;
}
interface _WebExtensionManifestTelemetry {
ping_type: string;
schemaNamespace: string;
public_key: _WebExtensionManifestTelemetryPublicKey;
study_name?: string | undefined;
pioneer_id?: boolean | undefined;
}
/** Not supported on manifest versions above 2. */
interface _WebExtensionManifestUserScripts {
api_script?: ExtensionURL | undefined;
}
/** The type of param can be either "purpose" or "pref". */
type _WebExtensionManifestChromeSettingsOverridesSearchProviderParamsCondition = "purpose" | "pref";
/** The context that initiates a search, required if condition is "purpose". */
type _WebExtensionManifestChromeSettingsOverridesSearchProviderParamsPurpose =
| "contextmenu"
| "searchbar"
| "homepage"
| "keyword"
| "newtab";
interface _WebExtensionManifestChromeSettingsOverridesSearchProviderParams {
/** A url parameter name */
name: string;
/** The type of param can be either "purpose" or "pref". */
condition?: _WebExtensionManifestChromeSettingsOverridesSearchProviderParamsCondition | undefined;
/** The preference to retrieve the value from. */
pref?: string | undefined;
/** The context that initiates a search, required if condition is "purpose". */
purpose?: _WebExtensionManifestChromeSettingsOverridesSearchProviderParamsPurpose | undefined;
/** A url parameter value. */
value?: string | undefined;
}
interface _WebExtensionManifestChromeSettingsOverridesSearchProvider {
name: string;
keyword?: string | string[] | undefined;
search_url: string;
favicon_url?: string | undefined;
suggest_url?: string | undefined;
/** @deprecated Unsupported on Firefox at this time. */
instant_url?: string | undefined;
/** @deprecated Unsupported on Firefox at this time. */
image_url?: string | undefined;
/** GET parameters to the search_url as a query string. */
search_url_get_params?: string | undefined;
/** POST parameters to the search_url as a query string. */
search_url_post_params?: string | undefined;
/** GET parameters to the suggest_url as a query string. */
suggest_url_get_params?: string | undefined;
/** POST parameters to the suggest_url as a query string. */
suggest_url_post_params?: string | undefined;
/** @deprecated Unsupported on Firefox at this time. */
instant_url_post_params?: string | undefined;
/** @deprecated Unsupported on Firefox at this time. */
image_url_post_params?: string | undefined;
search_form?: string | undefined;
/** @deprecated Unsupported on Firefox at this time. */
alternate_urls?: string[] | undefined;
/** @deprecated Unsupported on Firefox. */
prepopulated_id?: number | undefined;
/** Encoding of the search term. */
encoding?: string | undefined;
/** Sets the default engine to a built-in engine only. */
is_default?: boolean | undefined;
/**
* A list of optional search url parameters. This allows the additon of search url parameters based on how the search is performed in Firefox.
*/
params?: _WebExtensionManifestChromeSettingsOverridesSearchProviderParams[] | undefined;
}
interface _WebExtensionManifestChromeSettingsOverrides {
homepage?: string | undefined;
search_provider?: _WebExtensionManifestChromeSettingsOverridesSearchProvider | undefined;
}
interface _WebExtensionManifestCommandsSuggestedKey {
default?: KeyName | undefined;
mac?: KeyName | undefined;
linux?: KeyName | undefined;
windows?: KeyName | undefined;
chromeos?: string | undefined;
android?: string | undefined;
ios?: string | undefined;
/** @deprecated Unknown platform name */
additionalProperties?: string | undefined;
}
interface _WebExtensionManifestCommands {
suggested_key?: _WebExtensionManifestCommandsSuggestedKey | undefined;
description?: string | undefined;
}
interface _WebExtensionManifestOmnibox {
keyword: string;
}
interface _WebExtensionManifestSidebarAction {
default_title?: string | undefined;
default_icon?: IconPath | undefined;
/** Defaults to true in Manifest V2; Deprecated in Manifest V3. */
browser_style?: boolean | undefined;
default_panel: string;
/** Whether or not the sidebar is opened at install. Default is `true`. */
open_at_install?: boolean | undefined;
}
interface _WebExtensionManifestChromeUrlOverrides {
newtab?: ExtensionURL | undefined;
/** @deprecated Unsupported on Firefox at this time. */
bookmarks?: ExtensionURL | undefined;
/** @deprecated Unsupported on Firefox at this time. */
history?: ExtensionURL | undefined;
}
interface _WebExtensionManifestDeveloper {
name?: string | undefined;
url?: string | undefined;
}
type _OptionalPermission =
| "browserSettings"
| "browsingData"
| "declarativeNetRequestFeedback"
| "downloads"
| "downloads.open"
| "management"
| "clipboardRead"
| "clipboardWrite"
| "geolocation"
| "notifications"
| "privacy"
| "proxy"
| "nativeMessaging"
| "webNavigation"
| "bookmarks"
| "devtools"
| "find"
| "history"
| "pkcs11"
| "sessions"
| "tabs"
| "tabHide"
| "topSites";
type _PermissionNoPrompt =
| "captivePortal"
| "contextualIdentities"
| "declarativeNetRequestWithHostAccess"
| "dns"
| "geckoProfiler"
| "identity"
| "alarms"
| "storage"
| "unlimitedStorage"
| "theme"
| "menus"
| "contextMenus";
type _OptionalPermissionNoPrompt =
| "cookies"
| "idle"
| "scripting"
| "webRequest"
| "webRequestBlocking"
| "webRequestFilterResponse"
| "webRequestFilterResponse.serviceWorkerScript"
| "menus.overrideContext"
| "search"
| "activeTab";
type _ProtocolHandlerProtocol =
| "bitcoin"
| "dat"
| "dweb"
| "ftp"
| "geo"
| "gopher"
| "im"
| "ipfs"
| "ipns"
| "irc"
| "ircs"
| "magnet"
| "mailto"
| "matrix"
| "mms"
| "news"
| "nntp"
| "sip"
| "sms"
| "smsto"
| "ssb"
| "ssh"
| "tel"
| "urn"
| "webcal"
| "wtai"
| "xmpp";
interface _ManifestBaseDeveloper {
name?: string | undefined;
url?: string | undefined;
}
interface _UndefinedChromeResources {
[key: string]: ExtensionURL | {
[key: string]: ExtensionURL;
};
}
interface _WebExtensionLangpackManifestLanguages {
[key: string]: {
chrome_resources: _UndefinedChromeResources;
version: string;
};
}
interface _WebExtensionLangpackManifestSources {
[key: string]: {
base_path: ExtensionURL;
paths?: string[] | undefined;
};
}
interface _WebExtensionLangpackManifestDeveloper {
name?: string | undefined;
url?: string | undefined;
}
interface _WebExtensionDictionaryManifestDictionaries {
[key: string]: string;
}
interface _WebExtensionDictionaryManifestDeveloper {
name?: string | undefined;
url?: string | undefined;
}
interface _WebExtensionSitePermissionsManifestDeveloper {
name?: string | undefined;
url?: string | undefined;
}
type _SitePermission = "midi" | "midi-sysex";
interface _ThemeTypeImages {
additional_backgrounds?: ImageDataOrExtensionURL[] | undefined;
/**
* @deprecated Unsupported images property, use 'theme.images.theme_frame', this alias is ignored in Firefox >= 70.
*/
headerURL?: ImageDataOrExtensionURL | undefined;
theme_frame?: ImageDataOrExtensionURL | undefined;
}
interface _ThemeTypeColors {
tab_selected?: ThemeColor | undefined;
/**
* @deprecated Unsupported colors property, use 'theme.colors.frame', this alias is ignored in Firefox >= 70.
*/
accentcolor?: ThemeColor | undefined;
frame?: ThemeColor | undefined;
frame_inactive?: ThemeColor | undefined;
/**
* @deprecated Unsupported color property, use 'theme.colors.tab_background_text', this alias is ignored in Firefox >= 70.
*/
textcolor?: ThemeColor | undefined;
tab_background_text?: ThemeColor | undefined;
tab_background_separator?: ThemeColor | undefined;
tab_loading?: ThemeColor | undefined;
tab_text?: ThemeColor | undefined;
tab_line?: ThemeColor | undefined;
toolbar?: ThemeColor | undefined;
/** This color property is an alias of 'bookmark_text'. */
toolbar_text?: ThemeColor | undefined;
bookmark_text?: ThemeColor | undefined;
toolbar_field?: ThemeColor | undefined;
toolbar_field_text?: ThemeColor | undefined;
toolbar_field_border?: ThemeColor | undefined;
/** @deprecated This color property is ignored in Firefox >= 89. */
toolbar_field_separator?: ThemeColor | undefined;
toolbar_top_separator?: ThemeColor | undefined;
toolbar_bottom_separator?: ThemeColor | undefined;
toolbar_vertical_separator?: ThemeColor | undefined;
icons?: ThemeColor | undefined;
icons_attention?: ThemeColor | undefined;
button_background_hover?: ThemeColor | undefined;
button_background_active?: ThemeColor | undefined;
popup?: ThemeColor | undefined;
popup_text?: ThemeColor | undefined;
popup_border?: ThemeColor | undefined;
toolbar_field_focus?: ThemeColor | undefined;
toolbar_field_text_focus?: ThemeColor | undefined;
toolbar_field_border_focus?: ThemeColor | undefined;
popup_highlight?: ThemeColor | undefined;
popup_highlight_text?: ThemeColor | undefined;
ntp_background?: ThemeColor | undefined;
ntp_card_background?: ThemeColor | undefined;
ntp_text?: ThemeColor | undefined;
sidebar?: ThemeColor | undefined;
sidebar_border?: ThemeColor | undefined;
sidebar_text?: ThemeColor | undefined;
sidebar_highlight?: ThemeColor | undefined;
sidebar_highlight_text?: ThemeColor | undefined;
toolbar_field_highlight?: ThemeColor | undefined;
toolbar_field_highlight_text?: ThemeColor | undefined;
}
type _ThemeTypeAdditionalBackgroundsAlignment =
| "bottom"
| "center"
| "left"
| "right"
| "top"
| "center bottom"
| "center center"
| "center top"
| "left bottom"
| "left center"
| "left top"
| "right bottom"
| "right center"
| "right top";
type _ThemeTypeAdditionalBackgroundsTiling =
| "no-repeat"
| "repeat"
| "repeat-x"
| "repeat-y";
type _ThemeTypeColorScheme =
| "auto"
| "light"
| "dark"
| "system";
type _ThemeTypeContentColorScheme =
| "auto"
| "light"
| "dark"
| "system";
interface _ThemeType {
additional_backgrounds_alignment?: _ThemeTypeAdditionalBackgroundsAlignment[] | undefined;
additional_backgrounds_tiling?: _ThemeTypeAdditionalBackgroundsTiling[] | undefined;
color_scheme?: _ThemeTypeColorScheme | undefined;
content_color_scheme?: _ThemeTypeContentColorScheme | undefined;
}
interface _ThemeManifestIcons {
[key: number]: string;
}
}
/**
* Monitor extension activity
*
* Permissions: `activityLog`
*
* Not allowed in: Content scripts, Devtools pages
*/
declare namespace browser.activityLog {
/**
* The type of log entry. api_call is a function call made by the extension and api_event is an event callback to the extension. content_script is logged when a content script is injected.
*/
type _OnExtensionActivityDetailsType =
| "api_call"
| "api_event"
| "content_script"
| "user_script";
/** The type of view where the activity occurred. Content scripts will not have a viewType. */
type _OnExtensionActivityDetailsViewType =
| "background"
| "popup"
| "sidebar"
| "tab"
| "devtools_page"
| "devtools_panel";
interface _OnExtensionActivityDetailsData {
/** A list of arguments passed to the call. */
args?: any[] | undefined;
/** The result of the call. */
result?: object | undefined;
/** The tab associated with this event if it is a tab or content script. */
tabId?: number | undefined;
/** If the type is content_script, this is the url of the script that was injected. */
url?: string | undefined;
}
interface _OnExtensionActivityDetails {
/** The date string when this call is triggered. */
timeStamp: extensionTypes.Date;
/**
* The type of log entry. api_call is a function call made by the extension and api_event is an event callback to the extension. content_script is logged when a content script is injected.
*/
type: _OnExtensionActivityDetailsType;
/** The type of view where the activity occurred. Content scripts will not have a viewType. */
viewType?: _OnExtensionActivityDetailsViewType | undefined;
/** The name of the api call or event, or the script url if this is a content or user script event. */
name: string;
data: _OnExtensionActivityDetailsData;
}
interface _ActivityLogOnExtensionActivityEvent<TCallback = (details: _OnExtensionActivityDetails) => void> {
addListener(cb: TCallback, id: string): void;
removeListener(cb: TCallback): void;
hasListener(cb: TCallback): boolean;
}
/* activityLog events */
/** Receives an activityItem for each logging event. */
const onExtensionActivity: _ActivityLogOnExtensionActivityEvent;
}
/**
* Permissions: `alarms`
*
* Not allowed in: Content scripts, Devtools pages
*/
declare namespace browser.alarms {
/* alarms types */
interface Alarm {
/** Name of this alarm. */
name: string;
/** Time when the alarm is scheduled to fire, in milliseconds past the epoch. */
scheduledTime: number;
/** When present, signals that the alarm triggers periodically after so many minutes. */
periodInMinutes?: number | undefined;
}
/**
* Details about the alarm. The alarm first fires either at 'when' milliseconds past the epoch (if 'when' is provided), after 'delayInMinutes' minutes from the current time (if 'delayInMinutes' is provided instead), or after 'periodInMinutes' minutes from the current time (if only 'periodInMinutes' is provided). Users should never provide both 'when' and 'delayInMinutes'. If 'periodInMinutes' is provided, then the alarm recurs repeatedly after that many minutes.
*/
interface _CreateAlarmInfo {
/** Time when the alarm is scheduled to first fire, in milliseconds past the epoch. */
when?: number | undefined;
/** Number of minutes from the current time after which the alarm should first fire. */
delayInMinutes?: number | undefined;
/** Number of minutes after which the alarm should recur repeatedly. */
periodInMinutes?: number | undefined;
}
/* alarms functions */
/**
* Creates an alarm. After the delay is expired, the onAlarm event is fired. If there is another alarm with the same name (or no name if none is specified), it will be cancelled and replaced by this alarm.
* @param alarmInfo Details about the alarm. The alarm first fires either at 'when' milliseconds past the epoch (if 'when' is provided), after 'delayInMinutes' minutes from the current time (if 'delayInMinutes' is provided instead), or after 'periodInMinutes' minutes from the current time (if only 'periodInMinutes' is provided). Users should never provide both 'when' and 'delayInMinutes'. If 'periodInMinutes' is provided, then the alarm recurs repeatedly after that many minutes.
*/
function create(alarmInfo: _CreateAlarmInfo): void;
/**
* Creates an alarm. After the delay is expired, the onAlarm event is fired. If there is another alarm with the same name (or no name if none is specified), it will be cancelled and replaced by this alarm.
* @param name Optional name to identify this alarm. Defaults to the empty string.
* @param alarmInfo Details about the alarm. The alarm first fires either at 'when' milliseconds past the epoch (if 'when' is provided), after 'delayInMinutes' minutes from the current time (if 'delayInMinutes' is provided instead), or after 'periodInMinutes' minutes from the current time (if only 'periodInMinutes' is provided). Users should never provide both 'when' and 'delayInMinutes'. If 'periodInMinutes' is provided, then the alarm recurs repeatedly after that many minutes.
*/
function create(name: string, alarmInfo: _CreateAlarmInfo): void;
/**
* Retrieves details about the specified alarm.
* @param [name] The name of the alarm to get. Defaults to the empty string.
*/
function get(name?: string): Promise<Alarm | undefined>;
/** Gets an array of all the alarms. */
function getAll(): Promise<Alarm[]>;
/**
* Clears the alarm with the given name.
* @param [name] The name of the alarm to clear. Defaults to the empty string.
*/
function clear(name?: string): Promise<boolean>;
/** Clears all alarms. */
function clearAll(): Promise<boolean>;
/* alarms events */
/**
* Fired when an alarm has expired. Useful for transient background pages.
* @param name The alarm that has expired.
*/
const onAlarm: WebExtEvent<(name: Alarm) => void>;
}
/**
* Use browser actions to put icons in the main browser toolbar, to the right of the address bar. In addition to its icon, a browser action can also have a tooltip, a badge, and a popup.
*
* Manifest keys: `action`, `browser_action`
*
* Needs at least manifest version 3.
*
* Not allowed in: Content scripts, Devtools pages
*/
declare namespace browser.action {
/* action types */
/**
* Specifies to which tab or window the value should be set, or from which one it should be retrieved. If no tab nor window is specified, the global value is set or retrieved.
*/
interface Details {
/**
* When setting a value, it will be specific to the specified tab, and will automatically reset when the tab navigates. When getting, specifies the tab to get the value from; if there is no tab-specific value, the window one will be inherited.
*/
tabId?: number | undefined;
/**
* When setting a value, it will be specific to the specified window. When getting, specifies the window to get the value from; if there is no window-specific value, the global one will be inherited.
*/
windowId?: number | undefined;
}
type ColorArray = [number, number, number, number];
/** Pixel data for an image. Must be an ImageData object (for example, from a `canvas` element). */
type ImageDataType = ImageData;
/**
* 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`.
*/
type ColorValue = string | ColorArray | null;
/** Information sent when a browser action is clicked. */
interface OnClickData {
/** An array of keyboard modifiers that were held while the menu item was clicked. */
modifiers: _OnClickDataModifiers[];
/** An integer value of button by which menu item was clicked. */
button?: number | undefined;
}
type _OnClickDataModifiers =
| "Shift"
| "Alt"
| "Command"
| "Ctrl"
| "MacCtrl";
/**
* Specifies to which tab or window the value should be set, or from which one it should be retrieved. If no tab nor window is specified, the global value is set or retrieved.
*/
interface _SetTitleDetails {
/** The string the browser action should display when moused over. */
title: string | null;
/**
* When setting a value, it will be specific to the specified tab, and will automatically reset when the tab navigates. When getting, specifies the tab to get the value from; if there is no tab-specific value, the window one will be inherited.
*/
tabId?: number | undefined;
/**
* When setting a value, it will be specific to the specified window. When getting, specifies the window to get the value from; if there is no window-specific value, the global one will be inherited.
*/
windowId?: number | undefined;
}
/** The collection of user-specified settings relating to an extension's action. */
interface _GetUserSettingsReturnUserSettings {
/**
* Whether the extension's action icon is visible on browser windows' top-level toolbar (i.e., whether the extension has been 'pinned' by the user).
*/
isOnToolbar?: boolean | undefined;
}
/**
* Specifies to which tab or window the value should be set, or from which one it should be retrieved. If no tab nor window is specified, the global value is set or retrieved.
*/
interface _SetIconDetails {
/**
* 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}'
*/
imageData?: ImageDataType | {
[key: number]: ImageDataType;
} | undefined;
/**
* 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}'
*/
path?: string | {
[key: number]: string;
} | undefined;
/**
* When setting a value, it will be specific to the specified tab, and will automatically reset when the tab navigates. When getting, specifies the tab to get the value from; if there is no tab-specific value, the window one will be inherited.
*/
tabId?: number | undefined;
/**
* When setting a value, it will be specific to the specified window. When getting, specifies the window to get the value from; if there is no window-specific value, the global one will be inherited.
*/
windowId?: number | undefined;
}
/**
* Specifies to which tab or window the value should be set, or from which one it should be retrieved. If no tab nor window is specified, the global value is set or retrieved.