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