526fd41dcdf7f4b1fce0fb8ff5a3239475b96d2b
[WebKit-https.git] / Source / WebCore / inspector / front-end / ExtensionAPISchema.json
1 [
2   {
3     "namespace": "experimental.webInspector.panels",
4     "types": [
5       {
6         "id": "PanelWithSidebars",
7         "type": "object",
8         "isInstanceOf": "Panel",
9         "description": "A panel within Web Inspector UI that has sidebars.",
10         "functions": [
11           {
12             "name": "createSidebarPane",
13             "type": "function",
14             "description": "Creates a pane within panel's sidebar.",
15             "parameters": [
16               {
17                 "name": "title",
18                 "type": "string",
19                 "description": "A text that is displayed in sidebar caption."
20               },
21               {
22                 "name": "callback",
23                 "type": "function",
24                 "description": "A callback invoked when sidebar is created",
25                 "parameters": [
26                   {
27                     "name": "result",
28                     "description": "An ExtensionSidebarPane object for created sidebar pane",
29                     "$ref": "ExtensionSidebarPane"
30                   }
31                 ]
32               }
33             ]
34           }
35         ]
36       },
37       {
38         "id": "ElementsPanel",
39         "type": "object",
40         "isInstanceOf": "PanelWithSidebars",
41         "description": "Represents Elements panel",
42         "events": [
43           {
44             "name": "onSelectionChanged",
45             "description": "Fired when an objects is selected in the panel."
46           }
47         ]
48       },
49       {
50         "id": "ExtensionPanel",
51         "type": "object",
52         "isInstanceOf": "Panel",
53         "description": "Represents a panel created by extension",
54         "events": [
55           {
56             "name": "onSearch",
57             "description": "Fired upon a search action (start of a new search, search result navigation or search being canceled).",
58             "parameters": [
59               {
60                 "name": "action",
61                 "type": "string",
62                 "description": "Type of search action being performed."
63               },
64               {
65                 "name": "queryString",
66                 "type": "string",
67                 "optional": true,
68                 "description": "Query string (only for 'performSearch')"
69               }
70             ]
71           }
72         ]
73       },
74       {
75         "id": "ExtensionSidebarPane",
76         "type": "object",
77         "description": "A sidebar created by the extension.",
78         "functions": [
79           {
80             "name": "setHeight",
81             "type": "function",
82             "description": "Sets the height of the sidebar.",
83             "parameters": [
84               {
85                 "name": "height",
86                 "type": "string",
87                 "description": "A CSS-like size specification, e.g. '10px' or '12pt'"
88               }
89             ]
90           },
91           {
92             "name": "setExpression",
93             "type": "function",
94             "description": "Sets an expression that is evaluated within the inspected page. The result is displayed in the sidebar pane.",
95             "parameters": [
96               {
97                 "name": "expression",
98                 "type": "string",
99                 "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."
100               },
101               {
102                 "name": "rootTitle",
103                 "type": "string",
104                 "optional": true,
105                 "description": "An optional title for the root of the expression tree."
106               }
107             ]
108           },
109           {
110             "name": "setObject",
111             "type": "function",
112             "description": "Sets a JSON-compliant object to be displayed in the sidebar pane.",
113             "parameters": [
114               {
115                 "name": "jsonObject",
116                 "type": "string",
117                 "description": "An object to be displayed in context of the inspected page. Evaluated in the context of the caller (API client)."
118               },
119               {
120                 "name": "rootTitle",
121                 "type": "string",
122                 "optional": true,
123                 "description": "An optional title for the root of the expression tree."
124               }
125             ]
126           },
127           {
128             "name": "setPage",
129             "type": "function",
130             "description": "Sets an HTML page to be displayed in the sidebar pane.",
131             "parameters": [
132               {
133                 "name": "url",
134                 "type": "string",
135                 "description": "An URL of an extension page to display within the sidebar."
136               }
137             ]
138           }
139         ]
140       }
141     ],
142     "properties": {
143       "scripts": {
144         "$ref": "ScriptsPanel",
145         "description": "Scripts panel"
146       }
147     },
148     "functions": [
149       {
150         "name": "create",
151         "type": "function",
152         "description": "Creates an extension panel.",
153         "parameters": [
154           {
155             "name": "title",
156             "type": "string",
157             "description": "Title that is displayed under the extension icon in the toolbar."
158           },
159           {
160             "name": "iconURL",
161             "type": "string",
162             "description": "An URL of the toolbar icon."
163           },
164           {
165             "name": "pageURL",
166             "type": "string",
167             "description": "An URL of the page that represents this panel."
168           }
169         ],
170         "returns" : {
171           "$ref": "ExtensionPanel",
172           "description": "A panel that was created."
173         }
174       }
175     ]
176   },
177   {
178     "namespace": "experimental.webInspector.resources",
179     "types": [
180       {
181         "id": "Resource",
182         "type": "object",
183         "description": "Represents a resource (document, script, image etc). See HAR Specification for reference.",
184         "functions": [
185           {
186             "name": "getContent",
187             "type": "function",
188             "description": "Returns resource content.",
189             "parameters": [
190               {
191                 "name": "callback",
192                 "type": "function",
193                 "description": "A function that is called upon request completion.",
194                 "parameters": [
195                   {
196                     "name": "content",
197                     "type": "string",
198                     "description": "Resource content (potentially encoded)."
199                   },
200                   {
201                     "name": "encoding",
202                     "type": "string",
203                     "description": "Empty if content is not encoded, encoding name otherwise. Currently, only base64 supported."
204                   }
205                 ]
206               }
207             ]
208           }
209         ]
210       }
211     ],
212     "functions": [
213       {
214         "name": "getHAR",
215         "type": "function",
216         "description": "Returns HAR archive that contains all known resource objects.",
217         "parameters": [
218           {
219             "name": "callback",
220             "type": "function",
221             "description": "A function that is called upon request completion.",
222             "parameters": [
223               {
224                 "name": "har",
225                 "type": "object",
226                 "description": "A HAR archieve. See HAR specification for details."
227               }
228             ]
229           }
230         ]
231       }
232     ],
233     "events": [
234       {
235         "name": "onFinished",
236         "type": "function",
237         "description": "Fired when a resource request is finished and all resource data are available.",
238         "parameters": [
239           { "name": "resource", "$ref": "Resource" }
240         ]
241       }
242     ]
243   },
244   {
245     "namespace": "experimental.webInspector.audits",
246     "functions": [
247       {
248         "name": "addCategory",
249         "type": "function",
250         "description": "Adds an audit category.",
251         "parameters": [
252           { "name": "displayName", "type": "string", "description": "A display name for the category" },
253           { "name": "resultCount", "type": "number", "description": "The expected number of audit results in the category." }
254         ],
255         "returns": {
256           "$ref": "AuditCategory"
257         }
258       }
259     ],
260     "types": [
261       {
262         "id": "AuditCategory",
263         "type": "object",
264         "description": "A set of audit rules",
265         "events": [
266           {
267             "name": "onAuditStarted",
268             "type": "function",
269             "description": "Fired when the audit is started, if the category is enabled -- the extension is expected to begin executing audit rules.",
270             "parameters": [
271               { "name": "results", "$ref": "AuditResults" }
272             ]
273           }
274         ]
275       },
276       {
277         "id": "FormattedValue",
278         "type": "object",
279         "description": "A value returned from one of the formatters (an URL, code snippet etc), to be passed to createResult or addChild"
280       },
281       {
282         "id": "AuditResults",
283         "type": "object",
284         "description": "A collection of audit results for current run of the audit category",
285         "functions": [
286           {
287             "name": "addResult",
288             "type": "function",
289             "parameters": [
290               {
291                 "name": "displayName",
292                 "type": "string",
293                 "description": "A concise, high-level description of audit rule result"
294               },
295               {
296                 "name": "description",
297                 "type": "string",
298                 "description": "A detailed description of what the displayName means"
299               },
300               {
301                 "name": "severity",
302                 "$ref": "AuditResultSeverety"
303               },
304               {
305                 "name": "details",
306                 "$ref": "AuditResultNode",
307                 "optional": true,
308                 "description": "A subtree that appears under added result that may provide additional details on the violations found"
309               }
310             ]
311           },
312           {
313             "name": "createResult",
314             "type": "function",
315             "description": "Creates a result node that may be user as details parameters to addResult",
316             "parameters": [
317               {
318                 "name": "content ...",
319                 "choices": [
320                   { "type": "string" },
321                   { "$ref": "FormattedValue" }
322                 ],
323                 "description": "Either string or formatted values returned by one of AuditResult formatters (url, snippet etc)"
324               }
325             ],
326             "returns": {
327               "$ref": "AuditResultNode"
328             }
329           },
330           {
331             "name": "done",
332             "type": "function",
333             "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."
334           },
335           {
336             "name": "url",
337             "type": "function",
338             "description": "Render passed value as an URL in the Audits panel",
339             "parameters": [
340               { "name": "href", "type": "string", "description": "An URL that will appear as href value on resulting link" },
341               { "name": "displayText", "type": "string", "description": "A text that will appear to user", "optional": true }
342             ],
343             "returns": { "$ref": "FormattedValue" }
344           },
345           {
346             "name": "snippet",
347             "type": "function",
348             "description": "Render passed text as a code snippet in the Audits panel",
349             "parameters": [
350               { "name": "text", "type": "string", "description": "Snippet text" }
351             ],
352             "returns": { "$ref": "FormattedValue" }
353           }
354         ],
355         "properties": {
356           "Severity": {
357             "$ref": "AuditResultSeverity",
358             "description": "A class that contains possible values for audit result severities."
359           },
360           "text": {
361             "type": "string",
362             "description": "The contents of the node."
363           },
364           "children": {
365             "optional": true,
366             "type": "array",
367             "items": { "$ref": "AuditResultNode" },
368             "description": "Children of this node."
369           },
370           "expanded": {
371             "optional": "true",
372             "type": "boolean",
373             "description": "Whether the node is expanded by default."
374           }
375         }
376       },
377       {
378         "id": "AuditResultNode",
379         "type": "object",
380         "description": "A node in the audit result trees. Displays some content and optionally has children node",
381         "functions": [
382           {
383             "name": "addChild",
384             "description": "Adds another child node to this node",
385             "parameters": [
386               {
387                 "name": "content ...",
388                 "choices": [
389                   { "type": "string" },
390                   { "$ref": "FormattedValue" }
391                 ],
392                 "description": "Either string or formatted values returned by one of AuditResult formatters (url, snippet etc)"
393               }
394             ],
395             "returns": {
396               "$ref": "AuditResultNode"
397             }
398           }
399         ],
400         "properties": {
401           "expanded": {
402             "type": "boolean",
403             "description": "If set, the subtree will always be expanded"
404           }
405         }
406       },
407       {
408         "id": "AuditResultSeverity",
409         "type": "object",
410         "properties": {
411           "Info": {
412             "type": "string"
413           },
414           "Warning": {
415             "type": "string"
416           },
417           "Severe": {
418             "type": "string"
419           }
420         }
421       }
422     ]
423   }
424 ]
425