webext-schema 2.1.2 → 2.2.1

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.
@@ -4,7 +4,7 @@
4
4
 
5
5
  /* api */
6
6
  import { IS_WIN } from './constant.js';
7
- import { URL, fileURLToPath } from 'url';
7
+ import { fileURLToPath } from 'url';
8
8
  import { getType, isString } from './common.js';
9
9
  import fs, { promises as fsPromise } from 'fs';
10
10
  import path from 'path';
package/modules/update.js CHANGED
@@ -4,7 +4,6 @@
4
4
 
5
5
  /* api */
6
6
  import { CHAR, INDENT } from './constant.js';
7
- import { URL } from 'url';
8
7
  import JSON5 from 'json5';
9
8
  import { createFile } from './file-util.js';
10
9
  import { getType, isString } from './common.js';
package/package.json CHANGED
@@ -29,10 +29,10 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "camelize": "^1.0.0",
32
- "commander": "^9.0.0",
32
+ "commander": "^9.1.0",
33
33
  "decamelize": "^6.0.0",
34
- "json5": "^2.2.0",
35
- "node-fetch": "^3.2.2",
34
+ "json5": "^2.2.1",
35
+ "node-fetch": "^3.2.3",
36
36
  "sinon": "^13.0.1"
37
37
  },
38
38
  "devDependencies": {
@@ -44,9 +44,9 @@
44
44
  "eslint-plugin-jsdoc": "^37.9.7",
45
45
  "eslint-plugin-node": "^11.1.0",
46
46
  "eslint-plugin-promise": "^5.2.0",
47
- "mocha": "^9.2.1",
47
+ "mocha": "^9.2.2",
48
48
  "nock": "^13.2.4",
49
49
  "npm-run-all": "^4.1.5"
50
50
  },
51
- "version": "2.1.2"
51
+ "version": "2.2.1"
52
52
  }
@@ -5000,6 +5000,11 @@
5000
5000
  "type": "string",
5001
5001
  "optional": true,
5002
5002
  "description": "The title used for display if the tab is created in discarded mode."
5003
+ },
5004
+ "muted": {
5005
+ "type": "boolean",
5006
+ "optional": true,
5007
+ "description": "Whether the tab should be muted when created."
5003
5008
  }
5004
5009
  }
5005
5010
  },
@@ -13018,6 +13023,11 @@
13018
13023
  }
13019
13024
  ]
13020
13025
  },
13026
+ "granted_host_permissions": {
13027
+ "type": "boolean",
13028
+ "optional": true,
13029
+ "default": false
13030
+ },
13021
13031
  "host_permissions": {
13022
13032
  "min_manifest_version": 3,
13023
13033
  "type": "array",
@@ -14493,9 +14503,6 @@
14493
14503
  "permissions.json": [
14494
14504
  {
14495
14505
  "namespace": "permissions",
14496
- "permissions": [
14497
- "manifest:optional_permissions"
14498
- ],
14499
14506
  "types": [
14500
14507
  {
14501
14508
  "id": "Permissions",
@@ -15337,7 +15344,6 @@
15337
15344
  "functions": [
15338
15345
  {
15339
15346
  "name": "getBackgroundPage",
15340
- "max_manifest_version": 2,
15341
15347
  "type": "function",
15342
15348
  "description": "Retrieves the JavaScript 'window' object for the background page running inside the current extension/app. If the background page is an event page, the system will ensure it is loaded before calling the callback. If there is no background page, an error is set.",
15343
15349
  "async": "callback",
@@ -15748,13 +15754,11 @@
15748
15754
  },
15749
15755
  {
15750
15756
  "name": "onSuspend",
15751
- "unsupported": true,
15752
15757
  "type": "function",
15753
15758
  "description": "Sent to the event page just before it is unloaded. This gives the extension opportunity to do some clean up. Note that since the page is unloading, any asynchronous operations started while handling this event are not guaranteed to complete. If more activity for the event page occurs before it gets unloaded the onSuspendCanceled event will be sent and the page won't be unloaded. "
15754
15759
  },
15755
15760
  {
15756
15761
  "name": "onSuspendCanceled",
15757
- "unsupported": true,
15758
15762
  "type": "function",
15759
15763
  "description": "Sent after onSuspend to indicate that the app won't be unloaded after all."
15760
15764
  },
@@ -15943,6 +15947,10 @@
15943
15947
  "target": {
15944
15948
  "$ref": "InjectionTarget",
15945
15949
  "description": "Details specifying the target into which to inject the script."
15950
+ },
15951
+ "world": {
15952
+ "$ref": "ExecutionWorld",
15953
+ "optional": true
15946
15954
  }
15947
15955
  }
15948
15956
  },
@@ -16044,6 +16052,14 @@
16044
16052
  }
16045
16053
  }
16046
16054
  },
16055
+ {
16056
+ "id": "ExecutionWorld",
16057
+ "type": "string",
16058
+ "enum": [
16059
+ "ISOLATED"
16060
+ ],
16061
+ "description": "The JavaScript world for a script to execute within. We currently only support the <code>'ISOLATED'</code> world."
16062
+ },
16047
16063
  {
16048
16064
  "id": "RegisteredContentScript",
16049
16065
  "type": "object",
@@ -16084,8 +16100,22 @@
16084
16100
  "runAt": {
16085
16101
  "$ref": "extensionTypes.RunAt",
16086
16102
  "optional": true,
16087
- "default": "document_idle",
16088
16103
  "description": "Specifies when JavaScript files are injected into the web page. The preferred and default value is <code>document_idle</code>."
16104
+ },
16105
+ "persistAcrossSessions": {
16106
+ "type": "boolean",
16107
+ "enum": [
16108
+ false
16109
+ ],
16110
+ "description": "Specifies if this content script will persist into future sessions. This is currently NOT supported."
16111
+ },
16112
+ "css": {
16113
+ "type": "array",
16114
+ "optional": true,
16115
+ "description": "The list of CSS files to be injected into matching pages. These are injected in the order they appear in this array.",
16116
+ "items": {
16117
+ "$ref": "manifest.ExtensionURL"
16118
+ }
16089
16119
  }
16090
16120
  }
16091
16121
  }
@@ -16225,6 +16255,39 @@
16225
16255
  "parameters": []
16226
16256
  }
16227
16257
  ]
16258
+ },
16259
+ {
16260
+ "name": "updateContentScripts",
16261
+ "type": "function",
16262
+ "description": "Updates one or more content scripts for this extension.",
16263
+ "async": "callback",
16264
+ "parameters": [
16265
+ {
16266
+ "name": "scripts",
16267
+ "type": "array",
16268
+ "description": "Contains a list of scripts to be updated. If there are errors during script parsing/file validation, or if the IDs specified do not already exist, then no scripts are updated.",
16269
+ "items": {
16270
+ "type": "object",
16271
+ "$import": "RegisteredContentScript",
16272
+ "properties": {
16273
+ "persistAcrossSessions": {
16274
+ "type": "boolean",
16275
+ "optional": true,
16276
+ "enum": [
16277
+ false
16278
+ ],
16279
+ "description": "Specifies if this content script will persist into future sessions. This is currently NOT supported."
16280
+ }
16281
+ }
16282
+ }
16283
+ },
16284
+ {
16285
+ "name": "callback",
16286
+ "type": "function",
16287
+ "description": "Invoked when scripts have been updated.",
16288
+ "parameters": []
16289
+ }
16290
+ ]
16228
16291
  }
16229
16292
  ]
16230
16293
  }
@@ -17804,6 +17867,26 @@
17804
17867
  },
17805
17868
  "maxItems": 15,
17806
17869
  "optional": true
17870
+ },
17871
+ "color_scheme": {
17872
+ "optional": true,
17873
+ "type": "string",
17874
+ "enum": [
17875
+ "auto",
17876
+ "light",
17877
+ "dark",
17878
+ "system"
17879
+ ]
17880
+ },
17881
+ "content_color_scheme": {
17882
+ "optional": true,
17883
+ "type": "string",
17884
+ "enum": [
17885
+ "auto",
17886
+ "light",
17887
+ "dark",
17888
+ "system"
17889
+ ]
17807
17890
  }
17808
17891
  },
17809
17892
  "additionalProperties": {
@@ -1300,9 +1300,6 @@
1300
1300
  "permissions.json": [
1301
1301
  {
1302
1302
  "namespace": "permissions",
1303
- "permissions": [
1304
- "manifest:optional_permissions"
1305
- ],
1306
1303
  "types": [
1307
1304
  {
1308
1305
  "id": "Permissions",
@@ -1714,7 +1711,6 @@
1714
1711
  "functions": [
1715
1712
  {
1716
1713
  "name": "getBackgroundPage",
1717
- "max_manifest_version": 2,
1718
1714
  "type": "function",
1719
1715
  "description": "Retrieves the JavaScript 'window' object for the background page running inside the current extension/app. If the background page is an event page, the system will ensure it is loaded before calling the callback. If there is no background page, an error is set.",
1720
1716
  "async": "callback",
@@ -2125,13 +2121,11 @@
2125
2121
  },
2126
2122
  {
2127
2123
  "name": "onSuspend",
2128
- "unsupported": true,
2129
2124
  "type": "function",
2130
2125
  "description": "Sent to the event page just before it is unloaded. This gives the extension opportunity to do some clean up. Note that since the page is unloading, any asynchronous operations started while handling this event are not guaranteed to complete. If more activity for the event page occurs before it gets unloaded the onSuspendCanceled event will be sent and the page won't be unloaded. "
2131
2126
  },
2132
2127
  {
2133
2128
  "name": "onSuspendCanceled",
2134
- "unsupported": true,
2135
2129
  "type": "function",
2136
2130
  "description": "Sent after onSuspend to indicate that the app won't be unloaded after all."
2137
2131
  },
@@ -2638,6 +2632,26 @@
2638
2632
  },
2639
2633
  "maxItems": 15,
2640
2634
  "optional": true
2635
+ },
2636
+ "color_scheme": {
2637
+ "description": "If set, overrides the general 'toolbar theme'.",
2638
+ "optional": true,
2639
+ "type": "string",
2640
+ "enum": [
2641
+ "light",
2642
+ "dark",
2643
+ "auto"
2644
+ ]
2645
+ },
2646
+ "content_color_scheme": {
2647
+ "description": "If set, overrides the color scheme for the content area.",
2648
+ "optional": true,
2649
+ "type": "string",
2650
+ "enum": [
2651
+ "light",
2652
+ "dark",
2653
+ "auto"
2654
+ ]
2641
2655
  }
2642
2656
  },
2643
2657
  "additionalProperties": {
@@ -4837,7 +4851,7 @@
4837
4851
  "properties": {
4838
4852
  "aborted": {
4839
4853
  "type": "boolean",
4840
- "description": "Set this to true if the file upload was aborted.",
4854
+ "description": "Set this to true if the file upload was aborted by the user and an :ref:`cloudFile.onFileUploadAbort` event has been received. No error message will be shown to the user.",
4841
4855
  "optional": true
4842
4856
  },
4843
4857
  "error": {
@@ -5419,6 +5433,14 @@
5419
5433
  "description": "Whether the message is an HTML message or a plain text message.",
5420
5434
  "optional": true
5421
5435
  },
5436
+ "customHeaders": {
5437
+ "type": "array",
5438
+ "items": {
5439
+ "$ref": "CustomHeader"
5440
+ },
5441
+ "description": "Array of custom headers. Headers will be returned in ``Http-Header-Case`` (a.k.a. ``Train-Case``)",
5442
+ "optional": true
5443
+ },
5422
5444
  "attachments": {
5423
5445
  "type": "array",
5424
5446
  "items": {
@@ -5475,6 +5497,21 @@
5475
5497
  "description": "The size in bytes of this attachment. Read-only."
5476
5498
  }
5477
5499
  }
5500
+ },
5501
+ {
5502
+ "id": "CustomHeader",
5503
+ "type": "object",
5504
+ "description": "A custom header definition.",
5505
+ "properties": {
5506
+ "name": {
5507
+ "type": "string",
5508
+ "description": "Name of a custom header, must have a ``X-`` prefix.",
5509
+ "pattern": "^X-.*$"
5510
+ },
5511
+ "value": {
5512
+ "type": "string"
5513
+ }
5514
+ }
5478
5515
  }
5479
5516
  ],
5480
5517
  "events": [
@@ -10010,6 +10047,132 @@
10010
10047
  ]
10011
10048
  }
10012
10049
  ],
10050
+ "spacesToolbar.json": [
10051
+ {
10052
+ "namespace": "spacesToolbar",
10053
+ "types": [
10054
+ {
10055
+ "id": "ButtonProperties",
10056
+ "type": "object",
10057
+ "properties": {
10058
+ "badgeBackgroundColor": {
10059
+ "choices": [
10060
+ {
10061
+ "type": "string"
10062
+ },
10063
+ {
10064
+ "$ref": "ColorArray"
10065
+ }
10066
+ ],
10067
+ "optional": true,
10068
+ "description": "Sets the background color of the badge. Can be specified as an array of four integers in the range [0,255] that make up the RGBA color of the badge. For example, opaque red is <code>[255, 0, 0, 255]</code>. Can also be a string with an HTML color name (<code>red</code>) or a HEX color value (<code>#FF0000</code> or <code>#F00</code>). Reset when set to an empty string."
10069
+ },
10070
+ "badgeText": {
10071
+ "type": "string",
10072
+ "optional": true,
10073
+ "description": "Sets the badge text for the spaces toolbar button. The badge is displayed on top of the icon. Any number of characters can be set, but only about four can fit in the space. Removed when set to an empty string."
10074
+ },
10075
+ "defaultIcons": {
10076
+ "choices": [
10077
+ {
10078
+ "type": "string"
10079
+ },
10080
+ {
10081
+ "$ref": "manifest.IconPath"
10082
+ }
10083
+ ],
10084
+ "optional": true,
10085
+ "description": "Either a relative image path defining a single icon used for all sizes or an IconPathDictionary object defining dedicated icons for different sizes. At least the ``16px`` icon should be specified. The ``32px`` icon will be used on screens with a very high pixel density, if specified. Defaults to the extension icon, if set to an empty string."
10086
+ },
10087
+ "themeIcons": {
10088
+ "type": "array",
10089
+ "optional": true,
10090
+ "items": {
10091
+ "$ref": "manifest.ThemeIcons"
10092
+ },
10093
+ "description": "Specifies dark and light icons for the spaces toolbar button to be used with themes: The ``light`` icons will be used on dark backgrounds and vice versa. At least the set for ``16px`` icons should be specified. The set for ``32px`` icons will be used on screens with a very high pixel density, if specified."
10094
+ },
10095
+ "title": {
10096
+ "type": "string",
10097
+ "optional": true,
10098
+ "description": "The title for the spaces toolbar button, used in the tooltip of the button and as the displayed name in the overflow menu. Defaults to the name of the extension, if set to an empty string."
10099
+ },
10100
+ "url": {
10101
+ "type": "string",
10102
+ "optional": true,
10103
+ "description": "The page url, loaded into a tab when the button is clicked. Supported are ``https://`` and ``http://`` links, as well as links to WebExtension pages."
10104
+ }
10105
+ }
10106
+ },
10107
+ {
10108
+ "id": "ColorArray",
10109
+ "description": "An array of four integers in the range [0,255] that make up the RGBA color. For example, opaque red is <code>[255, 0, 0, 255]</code>.",
10110
+ "type": "array",
10111
+ "items": {
10112
+ "type": "integer",
10113
+ "minimum": 0,
10114
+ "maximum": 255
10115
+ },
10116
+ "minItems": 4,
10117
+ "maxItems": 4
10118
+ }
10119
+ ],
10120
+ "functions": [
10121
+ {
10122
+ "name": "addButton",
10123
+ "type": "function",
10124
+ "description": "Adds a new button to the spaces toolbar. Throws an exception, if the used ``id`` is not unique within the extension.",
10125
+ "async": true,
10126
+ "parameters": [
10127
+ {
10128
+ "name": "id",
10129
+ "type": "string",
10130
+ "pattern": "^[a-zA-Z0-9_]+$",
10131
+ "description": "The unique id to assign to this button. May only contain alphanumeric characters and underscores."
10132
+ },
10133
+ {
10134
+ "name": "properties",
10135
+ "description": "Properties of the new button. The ``url`` is mandatory.",
10136
+ "$ref": "spacesToolbar.ButtonProperties"
10137
+ }
10138
+ ]
10139
+ },
10140
+ {
10141
+ "name": "removeButton",
10142
+ "type": "function",
10143
+ "description": "Removes the specified button from the spaces toolbar. Throws an exception if the requested spaces toolbar button does not exist. If the tab of this button is currently open, it will be closed.",
10144
+ "async": true,
10145
+ "parameters": [
10146
+ {
10147
+ "name": "id",
10148
+ "type": "string",
10149
+ "pattern": "^[a-zA-Z0-9_]+$",
10150
+ "description": "The id of the button which is to be removed. May only contain alphanumeric characters and underscores."
10151
+ }
10152
+ ]
10153
+ },
10154
+ {
10155
+ "name": "updateButton",
10156
+ "type": "function",
10157
+ "description": "Updates properties of the specified spaces toolbar button. Throws an exception if the requested spaces toolbar button does not exist.",
10158
+ "async": true,
10159
+ "parameters": [
10160
+ {
10161
+ "name": "id",
10162
+ "type": "string",
10163
+ "description": "The id of the button which is to be updated. May only contain alphanumeric characters and underscores.",
10164
+ "pattern": "^[a-zA-Z0-9_]+$"
10165
+ },
10166
+ {
10167
+ "name": "properties",
10168
+ "description": "Only specified properties will be updated.",
10169
+ "$ref": "spacesToolbar.ButtonProperties"
10170
+ }
10171
+ ]
10172
+ }
10173
+ ]
10174
+ }
10175
+ ],
10013
10176
  "tabs.json": [
10014
10177
  {
10015
10178
  "namespace": "manifest",
@@ -15206,7 +15206,8 @@
15206
15206
  "s390x",
15207
15207
  "sparc64",
15208
15208
  "x86-32",
15209
- "x86-64"
15209
+ "x86-64",
15210
+ "noarch"
15210
15211
  ],
15211
15212
  "allowedContexts": [
15212
15213
  "content",
@@ -16028,6 +16029,65 @@
16028
16029
  "description": "Details specifying the target into which to inject the CSS."
16029
16030
  }
16030
16031
  }
16032
+ },
16033
+ {
16034
+ "id": "ContentScriptFilter",
16035
+ "type": "object",
16036
+ "properties": {
16037
+ "ids": {
16038
+ "type": "array",
16039
+ "optional": true,
16040
+ "description": "The IDs of specific scripts to retrieve with <code>getRegisteredContentScripts()</code> or to unregister with <code>unregisterContentScripts()</code>.",
16041
+ "items": {
16042
+ "type": "string"
16043
+ }
16044
+ }
16045
+ }
16046
+ },
16047
+ {
16048
+ "id": "RegisteredContentScript",
16049
+ "type": "object",
16050
+ "properties": {
16051
+ "allFrames": {
16052
+ "type": "boolean",
16053
+ "optional": true,
16054
+ "description": "If specified true, it will inject into all frames, even if the frame is not the top-most frame in the tab. Each frame is checked independently for URL requirements; it will not inject into child frames if the URL requirements are not met. Defaults to false, meaning that only the top frame is matched."
16055
+ },
16056
+ "excludeMatches": {
16057
+ "type": "array",
16058
+ "optional": true,
16059
+ "description": "Excludes pages that this content script would otherwise be injected into.",
16060
+ "items": {
16061
+ "type": "string"
16062
+ }
16063
+ },
16064
+ "id": {
16065
+ "type": "string",
16066
+ "description": "The id of the content script, specified in the API call."
16067
+ },
16068
+ "js": {
16069
+ "type": "array",
16070
+ "optional": true,
16071
+ "description": "The list of JavaScript files to be injected into matching pages. These are injected in the order they appear in this array.",
16072
+ "items": {
16073
+ "$ref": "manifest.ExtensionURL"
16074
+ }
16075
+ },
16076
+ "matches": {
16077
+ "type": "array",
16078
+ "optional": true,
16079
+ "description": "Specifies which pages this content script will be injected into. Must be specified for <code>registerContentScripts()</code>.",
16080
+ "items": {
16081
+ "type": "string"
16082
+ }
16083
+ },
16084
+ "runAt": {
16085
+ "$ref": "extensionTypes.RunAt",
16086
+ "optional": true,
16087
+ "default": "document_idle",
16088
+ "description": "Specifies when JavaScript files are injected into the web page. The preferred and default value is <code>document_idle</code>."
16089
+ }
16090
+ }
16031
16091
  }
16032
16092
  ],
16033
16093
  "functions": [
@@ -16095,6 +16155,76 @@
16095
16155
  "parameters": []
16096
16156
  }
16097
16157
  ]
16158
+ },
16159
+ {
16160
+ "name": "registerContentScripts",
16161
+ "type": "function",
16162
+ "description": "Registers one or more content scripts for this extension.",
16163
+ "async": "callback",
16164
+ "parameters": [
16165
+ {
16166
+ "name": "scripts",
16167
+ "type": "array",
16168
+ "description": "Contains a list of scripts to be registered. If there are errors during script parsing/file validation, or if the IDs specified already exist, then no scripts are registered.",
16169
+ "items": {
16170
+ "$ref": "RegisteredContentScript"
16171
+ }
16172
+ },
16173
+ {
16174
+ "name": "callback",
16175
+ "type": "function",
16176
+ "description": "Invoked upon completion of the registration.",
16177
+ "parameters": []
16178
+ }
16179
+ ]
16180
+ },
16181
+ {
16182
+ "name": "getRegisteredContentScripts",
16183
+ "type": "function",
16184
+ "description": "Returns all dynamically registered content scripts for this extension that match the given filter.",
16185
+ "async": "callback",
16186
+ "parameters": [
16187
+ {
16188
+ "name": "filter",
16189
+ "$ref": "ContentScriptFilter",
16190
+ "optional": true,
16191
+ "description": "An object to filter the extension's dynamically registered scripts."
16192
+ },
16193
+ {
16194
+ "name": "callback",
16195
+ "type": "function",
16196
+ "description": "The resulting array contains the registered content scripts.",
16197
+ "parameters": [
16198
+ {
16199
+ "name": "scripts",
16200
+ "type": "array",
16201
+ "items": {
16202
+ "$ref": "RegisteredContentScript"
16203
+ }
16204
+ }
16205
+ ]
16206
+ }
16207
+ ]
16208
+ },
16209
+ {
16210
+ "name": "unregisterContentScripts",
16211
+ "type": "function",
16212
+ "description": "Unregisters one or more content scripts for this extension.",
16213
+ "async": "callback",
16214
+ "parameters": [
16215
+ {
16216
+ "name": "filter",
16217
+ "$ref": "ContentScriptFilter",
16218
+ "optional": true,
16219
+ "description": "If specified, only unregisters dynamic content scripts which match the filter. Otherwise, all of the extension's dynamic content scripts are unregistered."
16220
+ },
16221
+ {
16222
+ "name": "callback",
16223
+ "type": "function",
16224
+ "description": "Invoked upon completion of the unregistration.",
16225
+ "parameters": []
16226
+ }
16227
+ ]
16098
16228
  }
16099
16229
  ]
16100
16230
  }