Source code

Revision control

Other Tools

1
[
2
{
3
"namespace": "manifest",
4
"types": [{
5
"$extend": "Permission",
6
"choices": [{
7
"type": "string",
8
"enum": [
9
"telemetry"
10
]
11
}]
12
}]
13
},
14
{
15
"namespace": "telemetry",
16
"description": "Use the <code>browser.telemetry</code> API to send telemetry data to the Mozilla Telemetry service. Restricted to Mozilla privileged webextensions.",
17
"types": [{
18
"id": "ScalarType",
19
"type": "string",
20
"enum": ["count", "string", "boolean"],
21
"description": "Type of scalar: 'count' for numeric values, 'string' for string values, 'boolean' for boolean values. Maps to <code>nsITelemetry.SCALAR_TYPE_*</code>."
22
}, {
23
"id": "ScalarData",
24
"type": "object",
25
"description": "Represents registration data for a Telemetry scalar.",
26
"properties": {
27
"kind": {
28
"$ref": "ScalarType"
29
},
30
"keyed": {
31
"type": "boolean",
32
"optional": true,
33
"default": false,
34
"description": "True if this is a keyed scalar."
35
},
36
"record_on_release": {
37
"type": "boolean",
38
"optional": true,
39
"default": false,
40
"description": "True if this data should be recorded on release."
41
},
42
"expired": {
43
"type": "boolean",
44
"optional": true,
45
"default": false,
46
"description": "True if this scalar entry is expired. This allows recording it without error, but it will be discarded."
47
}
48
}
49
}, {
50
"id": "EventData",
51
"type": "object",
52
"description": "Represents registration data for a Telemetry event.",
53
"properties": {
54
"methods": {
55
"type": "array",
56
"items": { "type": "string" },
57
"description": "List of methods for this event entry."
58
},
59
"objects": {
60
"type": "array",
61
"items": { "type": "string" },
62
"description": "List of objects for this event entry."
63
},
64
"extra_keys": {
65
"type": "array",
66
"items": { "type": "string" },
67
"description": "List of allowed extra keys for this event entry."
68
},
69
"record_on_release": {
70
"type": "boolean",
71
"optional": true,
72
"default": false,
73
"description": "True if this data should be recorded on release."
74
},
75
"expired": {
76
"type": "boolean",
77
"optional": true,
78
"default": false,
79
"description": "True if this event entry is expired. This allows recording it without error, but it will be discarded."
80
}
81
}
82
}],
83
"permissions": ["telemetry"],
84
"functions": [{
85
"name": "submitPing",
86
"type": "function",
87
"description": "Submits a custom ping to the Telemetry back-end. See <code>submitExternalPing</code> inside TelemetryController.jsm for more details.",
88
"async": true,
89
"parameters": [
90
{
91
"name": "type",
92
"type": "string",
93
"pattern": "^[a-z0-9][a-z0-9-]+[a-z0-9]$",
94
"description": "The type of the ping."
95
},
96
{
97
"name": "message",
98
"type": "object",
99
"additionalProperties": { "type": "any" },
100
"description": "The data payload for the ping."
101
},
102
{
103
"description": "Options object.",
104
"name": "options",
105
"type": "object",
106
"properties": {
107
"addClientId": {
108
"type": "boolean",
109
"optional": true,
110
"default": false,
111
"description": "True if the ping should contain the client id."
112
},
113
"addEnvironment": {
114
"type": "boolean",
115
"optional": true,
116
"default": false,
117
"description": "True if the ping should contain the environment data."
118
},
119
"overrideEnvironment": {
120
"type": "object",
121
"additionalProperties": { "type": "any" },
122
"optional": true,
123
"default": false,
124
"description": "Set to override the environment data."
125
},
126
"usePingSender": {
127
"type": "boolean",
128
"optional": true,
129
"default": false,
130
"description": "If true, send the ping using the PingSender."
131
}
132
}
133
}
134
]
135
},
136
{
137
"name": "canUpload",
138
"type": "function",
139
"description": "Checks if Telemetry upload is enabled.",
140
"parameters": [],
141
"async": true
142
},
143
{
144
"name": "scalarAdd",
145
"type": "function",
146
"description": "Adds the value to the given scalar.",
147
"async": true,
148
"parameters": [
149
{
150
"name": "name",
151
"type": "string",
152
"description": "The scalar name."
153
},
154
{
155
"name": "value",
156
"type": "integer",
157
"minimum": 1,
158
"description": "The numeric value to add to the scalar. Only unsigned integers supported."
159
}
160
]
161
},
162
{
163
"name": "scalarSet",
164
"type": "function",
165
"description": "Sets the named scalar to the given value. Throws if the value type doesn't match the scalar type.",
166
"async": true,
167
"parameters": [
168
{
169
"name": "name",
170
"type": "string",
171
"description": "The scalar name"
172
},
173
{
174
"name": "value",
175
"description": "The value to set the scalar to",
176
"choices": [
177
{ "type": "string" },
178
{ "type": "boolean" },
179
{ "type": "integer" },
180
{ "type": "object", "additionalProperties": { "type": "any" } }
181
]
182
}
183
]
184
},
185
{
186
"name": "scalarSetMaximum",
187
"type": "function",
188
"description": "Sets the scalar to the maximum of the current and the passed value",
189
"async": true,
190
"parameters": [
191
{
192
"name": "name",
193
"type": "string",
194
"description": "The scalar name."
195
},
196
{
197
"name": "value",
198
"type": "integer",
199
"minimum": 0,
200
"description": "The numeric value to set the scalar to. Only unsigned integers supported."
201
}
202
]
203
},
204
{
205
"name": "recordEvent",
206
"type": "function",
207
"description": "Record an event in Telemetry. Throws when trying to record an unknown event.",
208
"async": true,
209
"parameters": [
210
{
211
"name": "category",
212
"type": "string",
213
"description": "The category name."
214
},
215
{
216
"name": "method",
217
"type": "string",
218
"description": "The method name."
219
},
220
{
221
"name": "object",
222
"type": "string",
223
"description": "The object name."
224
},
225
{
226
"name": "value",
227
"type": "string",
228
"optional": true,
229
"description": "An optional string value to record."
230
},
231
{
232
"name": "extra",
233
"type": "object",
234
"optional": true,
235
"description": "An optional object of the form (string -> string). It should only contain registered extra keys.",
236
"additionalProperties": { "type": "string" }
237
}
238
]
239
},
240
241
{
242
"name": "registerScalars",
243
"type": "function",
244
"description": "Register new scalars to record them from addons. See nsITelemetry.idl for more details.",
245
"async": true,
246
"parameters": [
247
{
248
"name": "category",
249
"type": "string",
250
"description": "The unique category the scalars are registered in."
251
},
252
{
253
"name": "data",
254
"type": "object",
255
"additionalProperties": { "$ref": "ScalarData" },
256
"description": "An object that contains registration data for multiple scalars. Each property name is the scalar name, and the corresponding property value is an object of ScalarData type."
257
}
258
]
259
},
260
{
261
"name": "registerEvents",
262
"type": "function",
263
"description": "Register new events to record them from addons. See nsITelemetry.idl for more details.",
264
"async": true,
265
"parameters": [
266
{
267
"name": "category",
268
"type": "string",
269
"description": "The unique category the events are registered in."
270
},
271
{
272
"name": "data",
273
"type": "object",
274
"additionalProperties": { "$ref": "EventData" },
275
"description": "An object that contains registration data for 1+ events. Each property name is the category name, and the corresponding property value is an object of EventData type."
276
}
277
]
278
},
279
{
280
"name": "setEventRecordingEnabled",
281
"type": "function",
282
"description": "Enable recording of events in a category. Events default to recording disabled. This allows to toggle recording for all events in the specified category.",
283
"async": true,
284
"parameters": [
285
{
286
"name": "category",
287
"type": "string",
288
"description": "The category name."
289
},
290
{
291
"name": "enabled",
292
"type": "boolean",
293
"description": "Whether recording is enabled for events in that category."
294
}
295
]
296
}]
297
}
298
]