2011-04-06 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": "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             "name": "callback",
171             "type": "function",
172             "description": "A function that is called upon request completion.",
173             "parameters": [
174               {
175                 "name": "panel",
176                 "description": "An ExtensionPanel object representing the created panel.",
177                 "$ref": "ExtensionPanel"
178               }
179             ]
180           }
181         ]
182       }
183     ]
184   },
185   {
186     "namespace": "experimental.webInspector.resources",
187     "types": [
188       {
189         "id": "Resource",
190         "type": "object",
191         "description": "Represents a resource (document, script, image etc). See HAR Specification for reference.",
192         "functions": [
193           {
194             "name": "getContent",
195             "type": "function",
196             "description": "Returns resource content.",
197             "parameters": [
198               {
199                 "name": "callback",
200                 "type": "function",
201                 "description": "A function that is called upon request completion.",
202                 "parameters": [
203                   {
204                     "name": "content",
205                     "type": "string",
206                     "description": "Resource content (potentially encoded)."
207                   },
208                   {
209                     "name": "encoding",
210                     "type": "string",
211                     "description": "Empty if content is not encoded, encoding name otherwise. Currently, only base64 supported."
212                   }
213                 ]
214               }
215             ]
216           }
217         ]
218       }
219     ],
220     "functions": [
221       {
222         "name": "getHAR",
223         "type": "function",
224         "description": "Returns HAR archive that contains all known resource objects.",
225         "parameters": [
226           {
227             "name": "callback",
228             "type": "function",
229             "description": "A function that is called upon request completion.",
230             "parameters": [
231               {
232                 "name": "har",
233                 "type": "object",
234                 "description": "A HAR archieve. See HAR specification for details."
235               }
236             ]
237           }
238         ]
239       }
240     ],
241     "events": [
242       {
243         "name": "onFinished",
244         "type": "function",
245         "description": "Fired when a resource request is finished and all resource data are available.",
246         "parameters": [
247           { "name": "resource", "$ref": "Resource" }
248         ]
249       },
250       {
251         "name": "onNavigation",
252         "type": "function",
253         "description": "Fired when an inspected window navigates to a new URL.",
254         "parameters": [
255           {
256             "name": "url",
257             "type": "stirng",
258             "description": "URL of the new page."
259           }
260         ]
261       }
262     ]
263   },
264   {
265     "namespace": "experimental.webInspector.audits",
266     "functions": [
267       {
268         "name": "addCategory",
269         "type": "function",
270         "description": "Adds an audit category.",
271         "parameters": [
272           { "name": "displayName", "type": "string", "description": "A display name for the category" },
273           { "name": "resultCount", "type": "number", "description": "The expected number of audit results in the category." }
274         ],
275         "returns": {
276           "$ref": "AuditCategory"
277         }
278       }
279     ],
280     "types": [
281       {
282         "id": "AuditCategory",
283         "type": "object",
284         "description": "A set of audit rules",
285         "events": [
286           {
287             "name": "onAuditStarted",
288             "type": "function",
289             "description": "Fired when the audit is started, if the category is enabled -- the extension is expected to begin executing audit rules.",
290             "parameters": [
291               { "name": "results", "$ref": "AuditResults" }
292             ]
293           }
294         ]
295       },
296       {
297         "id": "FormattedValue",
298         "type": "object",
299         "description": "A value returned from one of the formatters (an URL, code snippet etc), to be passed to createResult or addChild"
300       },
301       {
302         "id": "AuditResults",
303         "type": "object",
304         "description": "A collection of audit results for current run of the audit category",
305         "functions": [
306           {
307             "name": "addResult",
308             "type": "function",
309             "parameters": [
310               {
311                 "name": "displayName",
312                 "type": "string",
313                 "description": "A concise, high-level description of audit rule result"
314               },
315               {
316                 "name": "description",
317                 "type": "string",
318                 "description": "A detailed description of what the displayName means"
319               },
320               {
321                 "name": "severity",
322                 "$ref": "AuditResultSeverety"
323               },
324               {
325                 "name": "details",
326                 "$ref": "AuditResultNode",
327                 "optional": true,
328                 "description": "A subtree that appears under added result that may provide additional details on the violations found"
329               }
330             ]
331           },
332           {
333             "name": "createResult",
334             "type": "function",
335             "description": "Creates a result node that may be user as details parameters to addResult",
336             "parameters": [
337               {
338                 "name": "content ...",
339                 "choices": [
340                   { "type": "string" },
341                   { "$ref": "FormattedValue" }
342                 ],
343                 "description": "Either string or formatted values returned by one of AuditResult formatters (url, snippet etc)"
344               }
345             ],
346             "returns": {
347               "$ref": "AuditResultNode"
348             }
349           },
350           {
351             "name": "done",
352             "type": "function",
353             "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."
354           },
355           {
356             "name": "url",
357             "type": "function",
358             "description": "Render passed value as an URL in the Audits panel",
359             "parameters": [
360               { "name": "href", "type": "string", "description": "An URL that will appear as href value on resulting link" },
361               { "name": "displayText", "type": "string", "description": "A text that will appear to user", "optional": true }
362             ],
363             "returns": { "$ref": "FormattedValue" }
364           },
365           {
366             "name": "snippet",
367             "type": "function",
368             "description": "Render passed text as a code snippet in the Audits panel",
369             "parameters": [
370               { "name": "text", "type": "string", "description": "Snippet text" }
371             ],
372             "returns": { "$ref": "FormattedValue" }
373           }
374         ],
375         "properties": {
376           "Severity": {
377             "$ref": "AuditResultSeverity",
378             "description": "A class that contains possible values for audit result severities."
379           },
380           "text": {
381             "type": "string",
382             "description": "The contents of the node."
383           },
384           "children": {
385             "optional": true,
386             "type": "array",
387             "items": { "$ref": "AuditResultNode" },
388             "description": "Children of this node."
389           },
390           "expanded": {
391             "optional": "true",
392             "type": "boolean",
393             "description": "Whether the node is expanded by default."
394           }
395         }
396       },
397       {
398         "id": "AuditResultNode",
399         "type": "object",
400         "description": "A node in the audit result trees. Displays some content and optionally has children node",
401         "functions": [
402           {
403             "name": "addChild",
404             "description": "Adds another child node to this node",
405             "parameters": [
406               {
407                 "name": "content ...",
408                 "choices": [
409                   { "type": "string" },
410                   { "$ref": "FormattedValue" }
411                 ],
412                 "description": "Either string or formatted values returned by one of AuditResult formatters (url, snippet etc)"
413               }
414             ],
415             "returns": {
416               "$ref": "AuditResultNode"
417             }
418           }
419         ],
420         "properties": {
421           "expanded": {
422             "type": "boolean",
423             "description": "If set, the subtree will always be expanded"
424           }
425         }
426       },
427       {
428         "id": "AuditResultSeverity",
429         "type": "object",
430         "properties": {
431           "Info": {
432             "type": "string"
433           },
434           "Warning": {
435             "type": "string"
436           },
437           "Severe": {
438             "type": "string"
439           }
440         }
441       }
442     ]
443   }
444 ]
445