summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/inspector/front-end/ExtensionAPISchema.json
blob: 28084ba902e0c266676b1df5e23e4833c495b2fe (plain)
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
[
  {
    "namespace": "experimental.webInspector.inspectedWindow",
    "description": "Provides access to the window being inspected.",
    "functions": [
      {
        "name": "eval",
        "type": "function",
        "description": "Evaluates a JavaScript expression in the context of inspected page (NOTE: the expression must evaluate to a JSON-compliant object, otherwise the exception is thrown)",
        "parameters": [
          {
            "name": "expression",
            "type": "string",
            "description": "An expression to evaluate."
          },
          {
            "name": "callback",
            "type": "function",
            "description": "A function called when evaluation completes.",
            "parameters": [
              {
                "name": "result",
                "type": "object",
                "description": "The result of evaluation"
              },
              {
                "name": "isException",
                "type": "boolean",
                "description": "Set if an exception was caught while evaluating the expression"
              }
            ]
          }
        ]
      }
    ],
    "events": [
      {
        "name": "onDOMContentLoaded",
        "type": "function",
        "description": "Fired after DOMContentLoaded event on inspected page is fired."
      },
      {
        "name": "onLoaded",
        "type": "function",
        "description": "Fired after load event on inspected page is fired."
      },
      {
        "name": "onNavigated",
        "type": "function",
        "description": "Fired when navigation occurs in the window being inspected."
      }
    ]
  },
  {
    "namespace": "experimental.webInspector.panels",
    "types": [
      {
        "id": "PanelWithSidebars",
        "type": "object",
        "isInstanceOf": "Panel",
        "description": "A panel within Web Inspector UI that has sidebars.",
        "functions": [
          {
            "name": "createSidebarPane",
            "type": "function",
            "description": "Creates a pane within panel's sidebar.",
            "parameters": [
              {
                "name": "title",
                "type": "string",
                "description": "A text that is displayed in sidebar caption."
              },
              {
                "name": "url",
                "type": "string",
                "description": "An URL of the page that represents the sidebar."
              },
              {
                "name": "callback",
                "type": "function",
                "description": "A callback invoked when sidebar is created",
                "parameters": [
                  {
                    "name": "result",
                    "description": "An ExtensionSidebarPane object for created sidebar pane",
                    "$ref": "ExtensionSidebarPane"
                  }
                ]
              }
            ]
          },
          {
            "name": "createWatchExpressionSidebarPane",
            "type": "function",
            "description": "Creates a pane with an object property tree (similar to a watch sidebar pane).",
            "parameters": [
              {
                "name": "title",
                "type": "string",
                "description": "A text that is displayed in sidebar caption."
              },
              {
                "name": "callback",
                "type": "function",
                "description": "A callback invoked when sidebar is created",
                "parameters": [
                  {
                    "name": "result",
                    "description": "A WatchExpressionSidebarPane object for created sidebar pane",
                    "$ref": "WatchExpressionSidebarPane"
                  }
                ]
              }
            ]
          }
        ]
      },
      {
        "id": "ElementsPanel",
        "type": "object",
        "isInstanceOf": "PanelWithSidebars",
        "description": "Represents Elements panel",
        "events": [
          {
            "name": "onSelectionChanged",
            "description": "Fired when an objects is selected in the panel."
          }
        ]
      },
      {
        "id": "ExtensionPanel",
        "type": "object",
        "isInstanceOf": "Panel",
        "description": "Represents a panel created by extension",
        "events": [
          {
            "name": "onSearch",
            "description": "Fired upon a search action (start of a new search, search result navigation or search being canceled).",
            "parameters": [
              {
                "name": "action",
                "type": "string",
                "description": "Type of search action being performed."
              },
              {
                "name": "queryString",
                "type": "string",
                "optional": true,
                "description": "Query string (only for 'performSearch')"
              }
            ]
          }
       	]
      },
      {
        "id": "ExtensionSidebarPane",
        "type": "object",
        "description": "A sidebar created by the extension.",
        "functions": [
          {
            "name": "setHeight",
            "type": "function",
            "description": "Sets the height of the sidebar.",
            "parameters": [
              {
                "name": "height",
                "type": "string",
                "description": "A CSS-like size specification, e.g. '10px' or '12pt'"
              }
            ]
          }
        ]
      },
      {
        "id": "WatchExpressionSidebarPane",
        "type": "object",
        "description": "A sidebar created by the extension.",
        "functions": [
          {
            "name": "setHeight",
            "type": "function",
            "description": "Sets the height of the sidebar.",
            "parameters": [
              {
                "name": "height",
                "type": "string",
                "description": "A CSS-like size specification, e.g. '10px' or '12pt'"
              }
            ]
          },
          {
            "name": "setExpression",
            "type": "function",
            "description": "Sets an expression that is evaluated within the inspected page. The result is displayed in the sidebar pane.",
            "parameters": [
              {
                "name": "expression",
                "type": "string",
                "description": "An expression to be evaluated in context of the inspected page. JavaScript objects and DOM nodes are displayed in an expandable tree similar to the console/watch."
              },
              {
                "name": "rootTitle",
                "type": "string",
                "optional": true,
                "description": "An optional title for the root of the expression tree."
              }
            ]
          },
          {
            "name": "setObject",
            "type": "function",
            "description": "Sets a JSON-compliant object to be displayed in the sidebar pane.",
            "parameters": [
              {
                "name": "jsonObject",
                "type": "string",
                "description": "An object to be displayed in context of the inspected page. Evaluated in the context of the caller (API client)."
              },
              {
                "name": "rootTitle",
                "type": "string",
                "optional": true,
                "description": "An optional title for the root of the expression tree."
              }
            ]
          }
        ]
      }
    ],
    "properties": {
      "scripts": {
        "$ref": "ScriptsPanel",
        "description": "Scripts panel"
      }
    },
    "functions": [
      {
        "name": "create",
        "type": "function",
        "description": "Creates an extension panel.",
        "parameters": [
          {
            "name": "title",
            "type": "string",
            "description": "Title that is displayed under the extension icon in the toolbar."
          },
          {
            "name": "iconURL",
            "type": "string",
            "description": "An URL of the toolbar icon."
          },
          {
            "name": "pageURL",
            "type": "string",
            "description": "An URL of the page that represents this panel."
          }
        ],
        "returns" : {
          "$ref": "ExtensionPanel",
          "description": "A panel that was created."
        }
      }
    ]
  },
  {
    "namespace": "experimental.webInspector.resources",
    "types": [
      {
        "id": "Resource",
        "type": "object",
        "description": "Represents a resource (document, script, image etc). See HAR Specification for reference.",
        "functions": [
          {
            "name": "getContent",
            "type": "function",
            "description": "Returns resource content.",
            "parameters": [
              {
                "name": "callback",
                "type": "function",
                "description": "A function that is called upon request completion.",
                "parameters": [
                  {
                    "name": "content",
                    "type": "string",
                    "description": "Resource content (potentially encoded)."
                  },
                  {
                    "name": "encoding",
                    "type": "string",
                    "description": "Empty if content is not encoded, encoding name otherwise. Currently, only base64 supported."
                  }
                ]
              }
            ]
          }
        ]
      }
    ],
    "functions": [
      {
        "name": "getHAR",
        "type": "function",
        "description": "Returns HAR archive that contains all known resource objects.",
        "parameters": [
          {
            "name": "callback",
            "type": "function",
            "description": "A function that is called upon request completion.",
            "parameters": [
              {
                "name": "har",
                "type": "object",
                "description": "A HAR archieve. See HAR specification for details."
              }
            ]
          }
        ]
      }
    ],
    "events": [
      {
        "name": "onFinished",
        "type": "function",
        "description": "Fired when a resource request is finished and all resource data are available.",
        "parameters": [
          { "name": "resource", "$ref": "Resource" }
        ]
      }
    ]
  },
  {
    "namespace": "experimental.webInspector.audits",
    "functions": [
      {
        "name": "addCategory",
        "type": "function",
        "description": "Adds an audit category.",
        "parameters": [
          { "name": "displayName", "type": "string", "description": "A display name for the category" },
          { "name": "resultCount", "type": "number", "description": "The expected number of audit results in the category." }
        ],
        "returns": {
          "$ref": "AuditCategory"
        }
      }
    ],
    "types": [
      {
        "id": "AuditCategory",
        "type": "object",
        "description": "A set of audit rules",
        "events": [
          {
            "name": "onAuditStarted",
            "type": "function",
            "description": "Fired when the audit is started, if the category is enabled -- the extension is expected to begin executing audit rules.",
            "parameters": [
              { "name": "results", "$ref": "AuditResults" }
            ]
          }
        ]
      },
      {
        "id": "FormattedValue",
        "type": "object",
        "description": "A value returned from one of the formatters (an URL, code snippet etc), to be passed to createResult or addChild"
      },
      {
        "id": "AuditResults",
        "type": "object",
        "description": "A collection of audit results for current run of the audit category",
        "functions": [
          {
            "name": "addResult",
            "type": "function",
            "parameters": [
              {
                "name": "displayName",
                "type": "string",
                "description": "A concise, high-level description of audit rule result"
              },
              {
                "name": "description",
                "type": "string",
                "description": "A detailed description of what the displayName means"
              },
              {
                "name": "severity",
                "$ref": "AuditResultSeverety"
              },
              {
                "name": "details",
                "$ref": "AuditResultNode",
                "optional": true,
                "description": "A subtree that appears under added result that may provide additional details on the violations found"
              }
            ]
          },
          {
            "name": "createResult",
            "type": "function",
            "description": "Creates a result node that may be user as details parameters to addResult",
            "parameters": [
              {
                "name": "content ...",
                "choices": [
                  { "type": "string" },
                  { "$ref": "FormattedValue" }
                ],
                "description": "Either string or formatted values returned by one of AuditResult formatters (url, snippet etc)"
              }
            ],
            "returns": {
              "$ref": "AuditResultNode"
            }
          },
          {
            "name": "done",
            "type": "function",
            "description": "Signals the WebInspector Audits panel that the run of this category is over. Normally the run completes automatically when a number of added top-level results is equal to that declared when AuditCategory was created."
          },
          {
            "name": "url",
            "type": "function",
            "description": "Render passed value as an URL in the Audits panel",
            "parameters": [
              { "name": "href", "type": "string", "description": "An URL that will appear as href value on resulting link" },
              { "name": "displayText", "type": "string", "description": "A text that will appear to user", "optional": true }
            ],
            "returns": { "$ref": "FormattedValue" }
          },
          {
            "name": "snippet",
            "type": "function",
            "description": "Render passed text as a code snippet in the Audits panel",
            "parameters": [
              { "name": "text", "type": "string", "description": "Snippet text" }
            ],
            "returns": { "$ref": "FormattedValue" }
          }
        ],
        "properties": {
          "Severity": {
            "$ref": "AuditResultSeverity",
            "description": "A class that contains possible values for audit result severities."
          },
          "text": {
            "type": "string",
            "description": "The contents of the node."
          },
          "children": {
            "optional": true,
            "type": "array",
            "items": { "$ref": "AuditResultNode" },
            "description": "Children of this node."
          },
          "expanded": {
            "optional": "true",
            "type": "boolean",
            "description": "Whether the node is expanded by default."
          }
        }
      },
      {
        "id": "AuditResultNode",
        "type": "object",
        "description": "A node in the audit result trees. Displays some content and optionally has children node",
        "functions": [
          {
            "name": "addChild",
            "description": "Adds another child node to this node",
            "parameters": [
              {
                "name": "content ...",
                "choices": [
                  { "type": "string" },
                  { "$ref": "FormattedValue" }
                ],
                "description": "Either string or formatted values returned by one of AuditResult formatters (url, snippet etc)"
              }
            ],
            "returns": {
              "$ref": "AuditResultNode"
            }
          }
        ],
        "properties": {
          "expanded": {
            "type": "boolean",
            "description": "If set, the subtree will always be expanded"
          }
        }
      },
      {
        "id": "AuditResultSeverity",
        "type": "object",
        "properties": {
          "Info": {
            "type": "string"
          },
          "Warning": {
            "type": "string"
          },
          "Severe": {
            "type": "string"
          }
        }
      }
    ]
  }
]