Bug 1745818 - Treat host permissions as optional in mv3, r=robwu
[gecko.git] / toolkit / components / extensions / schemas / manifest.json
blob50aa34a73e49c9401b9e7e267c784df05f85b3ff
2   {
3     "namespace": "manifest",
4     "permissions": [],
5     "types": [
6       {
7         "id": "ManifestBase",
8         "type": "object",
9         "description": "Common properties for all manifest.json files",
10         "properties": {
11           "manifest_version": {
12             "type": "integer",
13             "minimum": 2,
14             "maximum": 3,
15             "postprocess": "manifestVersionCheck"
16           },
18           "applications": {
19             "$ref": "BrowserSpecificSettings",
20             "description": "The applications property is deprecated, please use 'browser_specific_settings'",
21             "optional": true
22           },
24           "browser_specific_settings": {
25             "$ref": "BrowserSpecificSettings",
26             "optional": true
27           },
29           "name": {
30             "type": "string",
31             "optional": false,
32             "preprocess": "localize"
33           },
35           "short_name": {
36             "type": "string",
37             "optional": true,
38             "preprocess": "localize"
39           },
41           "description": {
42             "type": "string",
43             "optional": true,
44             "preprocess": "localize"
45           },
47           "author": {
48             "type": "string",
49             "optional": true,
50             "preprocess": "localize",
51             "onError": "warn"
52           },
54           "version": {
55             "type": "string",
56             "optional": false
57           },
59           "homepage_url": {
60             "type": "string",
61             "format": "url",
62             "optional": true,
63             "preprocess": "localize"
64           },
66           "install_origins": {
67             "type": "array",
68             "optional": true,
69             "items": {
70               "type": "string",
71               "format": "origin"
72             }
73           },
75           "developer": {
76             "type": "object",
77             "optional": true,
78             "properties": {
79               "name": {
80                 "type": "string",
81                 "optional": true,
82                 "preprocess": "localize"
83               },
84               "url": {
85                 "type": "string",
86                 "format": "url",
87                 "optional": true,
88                 "preprocess": "localize",
89                 "onError": "warn"
90               }
91             }
92           }
93         }
94       },
95       {
96         "id": "WebExtensionManifest",
97         "type": "object",
98         "description": "Represents a WebExtension manifest.json file",
100         "$import": "ManifestBase",
101         "properties": {
102           "minimum_chrome_version":{
103             "type": "string",
104             "optional": true
105           },
107           "minimum_opera_version":{
108             "type": "string",
109             "optional": true
110           },
112           "icons": {
113             "type": "object",
114             "optional": true,
115             "patternProperties": {
116               "^[1-9]\\d*$": { "$ref": "ExtensionFileUrl" }
117             }
118           },
120           "incognito": {
121             "type": "string",
122             "enum": ["not_allowed", "spanning"],
123             "default": "spanning",
124             "optional": true
125           },
127           "background": {
128             "choices": [
129               {
130                 "type": "object",
131                 "properties": {
132                   "page": { "$ref": "ExtensionURL" },
133                   "persistent": {
134                     "optional": true,
135                     "type": "boolean",
136                     "max_manifest_version": 2,
137                     "default": true
138                   }
139                 },
140                 "additionalProperties": { "$ref": "UnrecognizedProperty" }
141               },
142               {
143                 "type": "object",
144                 "properties": {
145                   "scripts": {
146                     "type": "array",
147                     "items": { "$ref": "ExtensionURL" }
148                   },
149                   "persistent": {
150                     "optional": true,
151                     "type": "boolean",
152                     "max_manifest_version": 2,
153                     "default": true
154                   }
155                 },
156                 "additionalProperties": { "$ref": "UnrecognizedProperty" }
157               },
158               {
159                 "type": "object",
160                 "properties": {
161                   "service_worker": { "$ref": "ExtensionURL" }
162                 },
163                 "postprocess": "requireBackgroundServiceWorkerEnabled"
164               }
165             ],
166             "optional": true
167           },
169           "options_ui": {
170             "type": "object",
172             "optional": true,
174             "properties": {
175               "page": { "$ref": "ExtensionURL" },
176               "browser_style": {
177                 "type": "boolean",
178                 "optional": true,
179                 "default": true
180               },
181               "chrome_style": {
182                 "type": "boolean",
183                 "optional": true
184               },
185               "open_in_tab": {
186                 "type": "boolean",
187                 "optional": true
188               }
189             },
191             "additionalProperties": {
192               "type": "any",
193               "deprecated": "An unexpected property was found in the WebExtension manifest"
194             }
195           },
197           "content_scripts": {
198             "type": "array",
199             "optional": true,
200             "items": { "$ref": "ContentScript" }
201           },
203           "content_security_policy": {
204             "optional": true,
205             "onError": "warn",
206             "choices": [
207               {
208                 "max_manifest_version": 2,
209                 "type": "string",
210                 "format": "contentSecurityPolicy"
211               },
212               {
213                 "min_manifest_version": 3,
214                 "type": "object",
215                 "additionalProperties": {
216                   "$ref": "UnrecognizedProperty"
217                 },
218                 "properties": {
219                   "extension_pages": {
220                     "type": "string",
221                     "optional": true,
222                     "format": "contentSecurityPolicy",
223                     "description": "The Content Security Policy used for extension pages."
224                   }
225                 }
226               }
227             ]
228           },
230           "permissions": {
231             "default": [],
232             "optional": true,
233             "choices": [
234               {
235                 "max_manifest_version": 2,
236                 "type": "array",
237                 "items": {
238                   "$ref": "PermissionOrOrigin",
239                   "onError": "warn"
240                 }
241               },
242               {
243                 "min_manifest_version": 3,
244                 "type": "array",
245                 "items": {
246                   "$ref": "Permission",
247                   "onError": "warn"
248                 }
249               }
250             ]
251           },
253           "granted_host_permissions": {
254             "type": "boolean",
255             "optional": true,
256             "default": false
257           },
259           "host_permissions": {
260             "min_manifest_version": 3,
261             "type": "array",
262             "items": {
263               "$ref": "MatchPattern",
264               "onError": "warn"
265             },
266             "optional": true,
267             "default": []
268           },
270           "optional_permissions": {
271             "type": "array",
272             "items": {
273               "$ref": "OptionalPermissionOrOrigin",
274               "onError": "warn"
275             },
276             "optional": true,
277             "default": []
278           },
280           "web_accessible_resources": {
281             "optional": true,
282             "choices": [
283               {
284                 "max_manifest_version": 2,
285                 "type": "array",
286                 "items": { "type": "string" }
287               },
288               {
289                 "min_manifest_version": 3,
290                 "type": "array",
291                 "items": {
292                   "type": "object",
293                   "properties": {
294                     "resources": {
295                       "type": "array",
296                       "items": { "type": "string" }
297                     },
298                     "matches": {
299                       "type": "array",
300                       "items": { "$ref": "MatchPatternRestricted" }
301                     }
302                   }
303                 }
304               }
305             ]
306           },
308           "hidden": {
309             "type": "boolean",
310             "optional": true,
311             "default": false
312           }
313         },
315         "additionalProperties": { "$ref": "UnrecognizedProperty" }
316       },
317       {
318         "id": "WebExtensionLangpackManifest",
319         "type": "object",
320         "description": "Represents a WebExtension language pack manifest.json file",
322         "$import": "ManifestBase",
323         "properties": {
324           "homepage_url": {
325             "type": "string",
326             "format": "url",
327             "optional": true,
328             "preprocess": "localize"
329           },
331           "langpack_id": {
332             "type": "string",
333             "pattern": "^[a-zA-Z][a-zA-Z-]+$"
334           },
336           "languages": {
337             "type": "object",
338             "patternProperties": {
339               "^[a-z]{2}[a-zA-Z-]*$": {
340                 "type": "object",
341                 "properties": {
342                   "chrome_resources": {
343                     "type": "object",
344                     "patternProperties": {
345                       "^[a-zA-Z-.]+$": {
346                         "choices": [
347                           {
348                             "$ref": "ExtensionURL"
349                           },
350                           {
351                             "type": "object",
352                             "patternProperties": {
353                               "^[a-z]+$": {
354                                 "$ref": "ExtensionURL"
355                               }
356                             }
357                           }
358                         ]
359                       }
360                     }
361                   },
362                   "version": {
363                     "type": "string"
364                   }
365                 }
366               }
367             }
368           },
369           "sources": {
370             "type": "object",
371             "optional": true,
372             "patternProperties": {
373               "^[a-z]+$": {
374                 "type": "object",
375                 "properties": {
376                   "base_path": {
377                     "$ref": "ExtensionURL"
378                   },
379                   "paths": {
380                     "type": "array",
381                     "items": {
382                       "type": "string",
383                       "format": "strictRelativeUrl"
384                     },
385                     "optional": true
386                   }
387                 }
388               }
389             }
390           }
391         }
392       },
393       {
394         "id": "WebExtensionDictionaryManifest",
395         "type": "object",
396         "description": "Represents a WebExtension dictionary manifest.json file",
398         "$import": "ManifestBase",
399         "properties": {
400           "homepage_url": {
401             "type": "string",
402             "format": "url",
403             "optional": true,
404             "preprocess": "localize"
405           },
407           "dictionaries": {
408             "type": "object",
409             "patternProperties": {
410               "^[a-z]{2}[a-zA-Z-]*$": {
411                 "type": "string",
412                 "format": "strictRelativeUrl",
413                 "pattern": "\\.dic$"
414               }
415             }
416           }
417         }
418       },
419       {
420         "id": "WebExtensionSitePermissionsManifest",
421         "type": "object",
422         "description": "Represents a WebExtension site permissions manifest.json file",
424         "$import": "ManifestBase",
425         "properties": {
426           "site_permissions": {
427             "type": "array",
428             "minItems": 1,
429             "items": {
430               "$ref": "SitePermission"
431             }
432           },
433           "install_origins": {
434             "type": "array",
435             "minItems": 1,
436             "maxItems": 1,
437             "items": {
438               "type": "string",
439               "format": "origin"
440             }
441           }
442         }
443       },
444       {
445         "id": "ThemeIcons",
446         "type": "object",
447         "properties": {
448           "light": {
449             "$ref": "ExtensionURL",
450             "description": "A light icon to use for dark themes"
451           },
452           "dark": {
453             "$ref": "ExtensionURL",
454             "description": "The dark icon to use for light themes"
455           },
456           "size": {
457             "type": "integer",
458             "description": "The size of the icons"
459           }
460         },
461         "additionalProperties": { "$ref": "UnrecognizedProperty" }
462       },
463       {
464         "id": "OptionalPermissionNoPrompt",
465         "choices": [
466           {
467             "type": "string",
468             "enum": [
469               "idle"
470             ]
471           }
472         ]
473       },
474       {
475         "id": "OptionalPermission",
476         "choices": [
477           { "$ref": "OptionalPermissionNoPrompt" },
478           {
479             "type": "string",
480             "enum": [
481               "clipboardRead",
482               "clipboardWrite",
483               "geolocation",
484               "notifications"
485             ]
486           }
487         ]
488       },
489       {
490         "id": "OptionalPermissionOrOrigin",
491         "choices": [
492           { "$ref": "OptionalPermission" },
493           { "$ref": "MatchPattern" }
494         ]
495       },
496       {
497         "id": "PermissionNoPrompt",
498         "choices": [
499           { "$ref": "OptionalPermission" },
500           {
501             "type": "string",
502             "enum": [
503               "alarms",
504               "mozillaAddons",
505               "storage",
506               "unlimitedStorage"
507             ]
508           }
509         ]
510       },
511       {
512         "id": "Permission",
513         "choices": [
514           { "$ref": "PermissionNoPrompt" },
515           { "$ref": "OptionalPermission" }
516         ]
517       },
518       {
519         "id": "PermissionOrOrigin",
520         "choices": [
521           { "$ref": "Permission" },
522           { "$ref": "MatchPattern" }
523         ]
524       },
525       {
526         "id": "SitePermission",
527         "choices": [
528           {
529             "type": "string",
530             "enum": [
531               "midi",
532               "midi-sysex"
533             ]
534           }
535         ]
536       },
537       {
538         "id": "HttpURL",
539         "type": "string",
540         "format": "url",
541         "pattern": "^https?://.*$"
542       },
543       {
544         "id": "ExtensionURL",
545         "type": "string",
546         "format": "strictRelativeUrl"
547       },
548       {
549         "id": "ExtensionFileUrl",
550         "type": "string",
551         "format": "strictRelativeUrl",
552         "pattern": "\\S",
553         "preprocess": "localize"
554       },
555       {
556         "id": "ImageDataOrExtensionURL",
557         "type": "string",
558         "format": "imageDataOrStrictRelativeUrl"
559       },
560       {
561         "id": "ExtensionID",
562         "choices": [
563           {
564             "type": "string",
565             "pattern": "(?i)^\\{[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\\}$"
566           },
567           {
568             "type": "string",
569             "pattern": "(?i)^[a-z0-9-._]*@[a-z0-9-._]+$"
570           }
571         ]
572       },
573       {
574         "id": "FirefoxSpecificProperties",
575         "type": "object",
576         "properties": {
577           "id": {
578             "$ref": "ExtensionID",
579             "optional": true
580           },
582           "update_url": {
583             "type": "string",
584             "format": "url",
585             "optional": true
586           },
588           "strict_min_version": {
589             "type": "string",
590             "optional": true
591           },
593           "strict_max_version": {
594             "type": "string",
595             "optional": true
596           }
597         }
598       },
599       {
600         "id": "BrowserSpecificSettings",
601         "type": "object",
602         "properties": {
603           "gecko": {
604             "$ref": "FirefoxSpecificProperties",
605             "optional": true
606           }
607         },
608         "additionalProperties": { "type": "any" }
609       },
610       {
611         "id": "MatchPattern",
612         "choices": [
613           {
614             "type": "string",
615             "enum": ["<all_urls>"]
616           },
617           {
618             "$ref": "MatchPatternRestricted"
619           },
620           {
621             "$ref": "MatchPatternUnestricted"
622           }
623         ]
624       },
625       {
626         "id": "MatchPatternRestricted",
627         "description": "Same as MatchPattern above, but excludes <all_urls>",
628         "choices": [
629           {
630             "type": "string",
631             "pattern": "^(https?|wss?|file|ftp|\\*)://(\\*|\\*\\.[^*/]+|[^*/]+)/.*$"
632           },
633           {
634             "type": "string",
635             "pattern": "^file:///.*$"
636           }
637         ]
638       },
639       {
640         "id": "MatchPatternUnestricted",
641         "description": "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.",
642         "choices": [
643           {
644             "type": "string",
645             "pattern": "^resource://(\\*|\\*\\.[^*/]+|[^*/]+)/.*$|^about:"
646           }
647         ]
648       },
649       {
650         "id": "ContentScript",
651         "type": "object",
652         "description": "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.",
653         "additionalProperties": { "$ref": "UnrecognizedProperty" },
654         "properties": {
655           "matches": {
656             "type": "array",
657             "optional": false,
658             "minItems": 1,
659             "items": { "$ref": "MatchPattern" }
660           },
661           "exclude_matches": {
662             "type": "array",
663             "optional": true,
664             "minItems": 1,
665             "items": { "$ref": "MatchPattern" }
666           },
667           "include_globs": {
668             "type": "array",
669             "optional": true,
670             "items": { "type": "string" }
671           },
672           "exclude_globs": {
673             "type": "array",
674             "optional": true,
675             "items": { "type": "string" }
676           },
677           "css": {
678             "type": "array",
679             "optional": true,
680             "description": "The list of CSS files to inject",
681             "items": { "$ref": "ExtensionURL" }
682           },
683           "js": {
684             "type": "array",
685             "optional": true,
686             "description": "The list of JS files to inject",
687             "items": { "$ref": "ExtensionURL" }
688           },
689           "all_frames": {"type": "boolean", "optional": true, "description": "If allFrames is <code>true</code>, implies that the JavaScript or CSS should be injected into all frames of current page. By default, it's <code>false</code> and is only injected into the top frame."},
690           "match_about_blank": {"type": "boolean", "optional": true, "description": "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 <code>false</code>."},
691           "run_at": {
692             "$ref": "extensionTypes.RunAt",
693             "optional": true,
694             "default": "document_idle",
695             "description": "The soonest that the JavaScript or CSS will be injected into the tab. Defaults to \"document_idle\"."
696           }
697         }
698       },
699       {
700         "id": "IconPath",
701         "choices": [
702           {
703             "type": "object",
704             "patternProperties": {
705               "^[1-9]\\d*$": { "$ref": "ExtensionFileUrl" }
706             },
707             "additionalProperties": false
708           },
709           { "$ref": "ExtensionFileUrl" }
710         ]
711       },
712       {
713         "id": "IconImageData",
714         "choices": [
715           {
716             "type": "object",
717             "patternProperties": {
718               "^[1-9]\\d*$": { "$ref": "ImageData" }
719             },
720             "additionalProperties": false
721           },
722           { "$ref": "ImageData" }
723         ]
724       },
725       {
726         "id": "ImageData",
727         "type": "object",
728         "isInstanceOf": "ImageData",
729         "postprocess": "convertImageDataToURL"
730       },
731       {
732         "id": "UnrecognizedProperty",
733         "type": "any",
734         "deprecated": "An unexpected property was found in the WebExtension manifest."
735       }
736     ]
737   }