| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 [ | |
| 6 { | |
| 7 "namespace": "devtools.inspectedWindow", | |
| 8 "nocompile": true, | |
| 9 "types": [ | |
| 10 { | |
| 11 "id": "Resource", | |
| 12 "type": "object", | |
| 13 "description": "A resource within the inspected page, such as a document
, a script, or an image.", | |
| 14 "properties": { | |
| 15 "url": { | |
| 16 "type": "string", | |
| 17 "description": "The URL of the resource." | |
| 18 } | |
| 19 }, | |
| 20 "functions": [ | |
| 21 { | |
| 22 "name": "getContent", | |
| 23 "type": "function", | |
| 24 "description": "Gets the content of the resource.", | |
| 25 "parameters": [ | |
| 26 { | |
| 27 "name": "callback", | |
| 28 "type": "function", | |
| 29 "description": "A function that receives resource content when t
he request completes.", | |
| 30 "parameters": [ | |
| 31 { | |
| 32 "name": "content", | |
| 33 "type": "string", | |
| 34 "description": "Content of the resource (potentially encoded
)." | |
| 35 }, | |
| 36 { | |
| 37 "name": "encoding", | |
| 38 "type": "string", | |
| 39 "description": "Empty if content is not encoded, encoding na
me otherwise. Currently, only base64 is supported." | |
| 40 } | |
| 41 ] | |
| 42 } | |
| 43 ] | |
| 44 }, | |
| 45 { | |
| 46 "name": "setContent", | |
| 47 "type": "function", | |
| 48 "description": "Sets the content of the resource.", | |
| 49 "parameters": [ | |
| 50 { | |
| 51 "name": "content", | |
| 52 "type": "string", | |
| 53 "description": "New content of the resource. Only resources with
the text type are currently supported." | |
| 54 }, | |
| 55 { | |
| 56 "name": "commit", | |
| 57 "type": "boolean", | |
| 58 "description": "True if the user has finished editing the resour
ce, and the new content of the resource should be persisted; false if this is a
minor change sent in progress of the user editing the resource." | |
| 59 }, | |
| 60 { | |
| 61 "name": "callback", | |
| 62 "type": "function", | |
| 63 "description": "A function called upon request completion.", | |
| 64 "optional": true, | |
| 65 "parameters": [ | |
| 66 { | |
| 67 "name": "error", | |
| 68 "type": "object", | |
| 69 "optional": true, | |
| 70 "description": "Set to undefined if the resource content was
set successfully; describes error otherwise." | |
| 71 } | |
| 72 ] | |
| 73 } | |
| 74 ] | |
| 75 } | |
| 76 ] | |
| 77 } | |
| 78 ], | |
| 79 "properties": { | |
| 80 "tabId": { | |
| 81 "description": "The ID of the tab being inspected. This ID may be used w
ith chrome.tabs.* API.", | |
| 82 "type": "integer" | |
| 83 } | |
| 84 }, | |
| 85 "functions": [ | |
| 86 { | |
| 87 "name": "eval", | |
| 88 "type": "function", | |
| 89 "description": "Evaluates a JavaScript expression in the context of the
main frame of the inspected page. The expression must evaluate to a JSON-complia
nt object, otherwise an exception is thrown.", | |
| 90 "parameters": [ | |
| 91 { | |
| 92 "name": "expression", | |
| 93 "type": "string", | |
| 94 "description": "An expression to evaluate." | |
| 95 }, | |
| 96 { | |
| 97 "name": "callback", | |
| 98 "type": "function", | |
| 99 "description": "A function called when evaluation completes.", | |
| 100 "optional": true, | |
| 101 "parameters": [ | |
| 102 { | |
| 103 "name": "result", | |
| 104 "type": "object", | |
| 105 "description": "The result of evaluation." | |
| 106 }, | |
| 107 { | |
| 108 "name": "isException", | |
| 109 "type": "boolean", | |
| 110 "description": "Set if an exception was caught while evaluating
the expression." | |
| 111 } | |
| 112 ] | |
| 113 } | |
| 114 ] | |
| 115 }, | |
| 116 { | |
| 117 "name": "reload", | |
| 118 "type": "function", | |
| 119 "description": "Reloads the inspected page.", | |
| 120 "parameters": [ | |
| 121 { | |
| 122 "type": "object", | |
| 123 "name": "reloadOptions", | |
| 124 "optional": true, | |
| 125 "properties": { | |
| 126 "ignoreCache": { | |
| 127 "type": "boolean", | |
| 128 "optional": true, | |
| 129 "description": "When true, the loader will ignore the cache for
all inspected page resources loaded before the <code>load</code> event is fired.
The effect is similar to pressing Ctrl+Shift+R in the inspected window or withi
n the Developer Tools window." | |
| 130 }, | |
| 131 "userAgent": { | |
| 132 "type": "string", | |
| 133 "optional": true, | |
| 134 "description": "If specified, the string will override the value
of the <code>User-Agent</code> HTTP header that's sent while loading the resour
ces of the inspected page. The string will also override the value of the <code>
navigator.userAgent</code> property that's returned to any scripts that are runn
ing within the inspected page." | |
| 135 }, | |
| 136 "injectedScript": { | |
| 137 "type": "string", | |
| 138 "optional": true, | |
| 139 "description": "If specified, the script will be injected into e
very frame of the inspected page immediately upon load, before any of the frame'
s scripts. The script will not be injected after subsequent reloads—for ex
ample, if the user presses Ctrl+R." | |
| 140 } | |
| 141 } | |
| 142 } | |
| 143 ] | |
| 144 }, | |
| 145 { | |
| 146 "name": "getResources", | |
| 147 "type": "function", | |
| 148 "description": "Retrieves the list of resources from the inspected page.
", | |
| 149 "parameters": [ | |
| 150 { | |
| 151 "name": "callback", | |
| 152 "type": "function", | |
| 153 "description": "A function that receives the list of resources when
the request completes.", | |
| 154 "parameters": [ | |
| 155 { | |
| 156 "name": "resources", | |
| 157 "type": "array", | |
| 158 "items": { "$ref": "Resource" }, | |
| 159 "description": "The resources within the page." | |
| 160 } | |
| 161 ] | |
| 162 } | |
| 163 ] | |
| 164 } | |
| 165 ], | |
| 166 "events": [ | |
| 167 { | |
| 168 "name": "onResourceAdded", | |
| 169 "description": "Fired when a new resource is added to the inspected page
.", | |
| 170 "parameters": [ | |
| 171 { | |
| 172 "name": "resource", | |
| 173 "$ref": "Resource" | |
| 174 } | |
| 175 ] | |
| 176 }, | |
| 177 { | |
| 178 "name": "onResourceContentCommitted", | |
| 179 "description": "Fired when a new revision of the resource is committed (
e.g. user saves an edited version of the resource in the Developer Tools).", | |
| 180 "parameters": [ | |
| 181 { | |
| 182 "name": "resource", | |
| 183 "$ref": "Resource" | |
| 184 }, | |
| 185 { | |
| 186 "name": "content", | |
| 187 "type": "string", | |
| 188 "description": "New content of the resource." | |
| 189 } | |
| 190 ] | |
| 191 } | |
| 192 ] | |
| 193 }, | |
| 194 { | |
| 195 "namespace": "devtools.panels", | |
| 196 "nocompile": true, | |
| 197 "types": [ | |
| 198 { | |
| 199 "id": "ElementsPanel", | |
| 200 "type": "object", | |
| 201 "description": "Represents the Elements panel.", | |
| 202 "events": [ | |
| 203 { | |
| 204 "name": "onSelectionChanged", | |
| 205 "description": "Fired when an object is selected in the panel." | |
| 206 } | |
| 207 ], | |
| 208 "functions": [ | |
| 209 { | |
| 210 "name": "createSidebarPane", | |
| 211 "type": "function", | |
| 212 "description": "Creates a pane within panel's sidebar.", | |
| 213 "parameters": [ | |
| 214 { | |
| 215 "name": "title", | |
| 216 "type": "string", | |
| 217 "description": "Text that is displayed in sidebar caption." | |
| 218 }, | |
| 219 { | |
| 220 "name": "callback", | |
| 221 "type": "function", | |
| 222 "description": "A callback invoked when the sidebar is created."
, | |
| 223 "optional": true, | |
| 224 "parameters": [ | |
| 225 { | |
| 226 "name": "result", | |
| 227 "description": "An ExtensionSidebarPane object for created s
idebar pane.", | |
| 228 "$ref": "ExtensionSidebarPane" | |
| 229 } | |
| 230 ] | |
| 231 } | |
| 232 ] | |
| 233 } | |
| 234 ] | |
| 235 }, | |
| 236 { | |
| 237 "id": "ExtensionPanel", | |
| 238 "type": "object", | |
| 239 "description": "Represents a panel created by extension.", | |
| 240 "functions": [ | |
| 241 { | |
| 242 "name": "createStatusBarButton", | |
| 243 "description": "Appends a button to the status bar of the panel.", | |
| 244 "parameters": [ | |
| 245 { | |
| 246 "name": "iconPath", | |
| 247 "type": "string", | |
| 248 "description": "Path to the icon of the button. The file should
contain a 64x24-pixel image composed of two 32x24 icons. The left icon is used w
hen the button is inactive; the right icon is displayed when the button is press
ed." | |
| 249 }, | |
| 250 { | |
| 251 "name": "tooltipText", | |
| 252 "type": "string", | |
| 253 "description": "Text shown as a tooltip when user hovers the mou
se over the button." | |
| 254 }, | |
| 255 { | |
| 256 "name": "disabled", | |
| 257 "type": "boolean", | |
| 258 "description": "Whether the button is disabled." | |
| 259 } | |
| 260 ], | |
| 261 "returns": { "$ref": "Button" } | |
| 262 } | |
| 263 ], | |
| 264 "events": [ | |
| 265 { | |
| 266 "name": "onSearch", | |
| 267 "description": "Fired upon a search action (start of a new search, s
earch result navigation, or search being canceled).", | |
| 268 "parameters": [ | |
| 269 { | |
| 270 "name": "action", | |
| 271 "type": "string", | |
| 272 "description": "Type of search action being performed." | |
| 273 }, | |
| 274 { | |
| 275 "name": "queryString", | |
| 276 "type": "string", | |
| 277 "optional": true, | |
| 278 "description": "Query string (only for 'performSearch')." | |
| 279 } | |
| 280 ] | |
| 281 }, | |
| 282 { | |
| 283 "name": "onShown", | |
| 284 "type": "function", | |
| 285 "description": "Fired when the user switches to the panel.", | |
| 286 "parameters": [ | |
| 287 { | |
| 288 "name": "window", | |
| 289 "type": "Window", | |
| 290 "description": "The <code>window</code> object of panel's page." | |
| 291 } | |
| 292 ] | |
| 293 }, | |
| 294 { | |
| 295 "name": "onHidden", | |
| 296 "type": "function", | |
| 297 "description": "Fired when the user switches away from the panel." | |
| 298 } | |
| 299 ] | |
| 300 }, | |
| 301 { | |
| 302 "id": "ExtensionSidebarPane", | |
| 303 "type": "object", | |
| 304 "description": "A sidebar created by the extension.", | |
| 305 "functions": [ | |
| 306 { | |
| 307 "name": "setHeight", | |
| 308 "type": "function", | |
| 309 "description": "Sets the height of the sidebar.", | |
| 310 "parameters": [ | |
| 311 { | |
| 312 "name": "height", | |
| 313 "type": "string", | |
| 314 "description": "A CSS-like size specification, such as <code>'10
0px'</code> or <code>'12ex'</code>." | |
| 315 } | |
| 316 ] | |
| 317 }, | |
| 318 { | |
| 319 "name": "setExpression", | |
| 320 "type": "function", | |
| 321 "description": "Sets an expression that is evaluated within the insp
ected page. The result is displayed in the sidebar pane.", | |
| 322 "parameters": [ | |
| 323 { | |
| 324 "name": "expression", | |
| 325 "type": "string", | |
| 326 "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." | |
| 327 }, | |
| 328 { | |
| 329 "name": "rootTitle", | |
| 330 "type": "string", | |
| 331 "optional": true, | |
| 332 "description": "An optional title for the root of the expression
tree." | |
| 333 }, | |
| 334 { | |
| 335 "name": "callback", | |
| 336 "type": "function", | |
| 337 "optional": true, | |
| 338 "description": "A callback invoked after the sidebar pane is upd
ated with the expression evaluation results." | |
| 339 } | |
| 340 ] | |
| 341 }, | |
| 342 { | |
| 343 "name": "setObject", | |
| 344 "type": "function", | |
| 345 "description": "Sets a JSON-compliant object to be displayed in the
sidebar pane.", | |
| 346 "parameters": [ | |
| 347 { | |
| 348 "name": "jsonObject", | |
| 349 "type": "string", | |
| 350 "description": "An object to be displayed in context of the insp
ected page. Evaluated in the context of the caller (API client)." | |
| 351 }, | |
| 352 { | |
| 353 "name": "rootTitle", | |
| 354 "type": "string", | |
| 355 "optional": true, | |
| 356 "description": "An optional title for the root of the expression
tree." | |
| 357 }, | |
| 358 { | |
| 359 "name": "callback", | |
| 360 "type": "function", | |
| 361 "optional": true, | |
| 362 "description": "A callback invoked after the sidebar is updated
with the object." | |
| 363 } | |
| 364 ] | |
| 365 }, | |
| 366 { | |
| 367 "name": "setPage", | |
| 368 "type": "function", | |
| 369 "description": "Sets an HTML page to be displayed in the sidebar pan
e.", | |
| 370 "parameters": [ | |
| 371 { | |
| 372 "name": "path", | |
| 373 "type": "string", | |
| 374 "description": "Relative path of an extension page to display wi
thin the sidebar." | |
| 375 } | |
| 376 ] | |
| 377 } | |
| 378 ], | |
| 379 "events": [ | |
| 380 { | |
| 381 "name": "onShown", | |
| 382 "type": "function", | |
| 383 "description": "Fired when the sidebar pane becomes visible as a res
ult of user switching to the panel that hosts it.", | |
| 384 "parameters": [ | |
| 385 { | |
| 386 "name": "window", | |
| 387 "type": "Window", | |
| 388 "optional": true, | |
| 389 "description": "The <code>window</code> object of the sidebar pa
ge, if one was set with the <code>setPage()</code> method." | |
| 390 } | |
| 391 ] | |
| 392 }, | |
| 393 { | |
| 394 "name": "onHidden", | |
| 395 "type": "function", | |
| 396 "description": "Fired when the sidebar pane becomes hidden as a resu
lt of the user switching away from the panel that hosts the sidebar pane." | |
| 397 } | |
| 398 ] | |
| 399 }, | |
| 400 { | |
| 401 "id": "Button", | |
| 402 "type": "object", | |
| 403 "description": "A button created by the extension.", | |
| 404 "functions": [ | |
| 405 { | |
| 406 "name": "update", | |
| 407 "description": "Updates the attributes of the button. If some of the
arguments are omitted or <code>null</code>, the corresponding attributes are no
t updated.", | |
| 408 "parameters": [ | |
| 409 { | |
| 410 "name": "iconPath", | |
| 411 "type": "string", | |
| 412 "optional": true, | |
| 413 "description": "Path to the new icon of the button." | |
| 414 }, | |
| 415 { | |
| 416 "name": "tooltipText", | |
| 417 "type": "string", | |
| 418 "optional": true, | |
| 419 "description": "Text shown as a tooltip when user hovers the mou
se over the button." | |
| 420 }, | |
| 421 { | |
| 422 "name": "disabled", | |
| 423 "type": "boolean", | |
| 424 "optional": true, | |
| 425 "description": "Whether the button is disabled." | |
| 426 } | |
| 427 ] | |
| 428 } | |
| 429 ], | |
| 430 "events": [ | |
| 431 { | |
| 432 "name": "onClicked", | |
| 433 "type": "function", | |
| 434 "description": "Fired when the button is clicked." | |
| 435 } | |
| 436 ] | |
| 437 } | |
| 438 ], | |
| 439 "properties": { | |
| 440 "elements": { | |
| 441 "$ref": "ElementsPanel", | |
| 442 "description": "Elements panel." | |
| 443 } | |
| 444 }, | |
| 445 "functions": [ | |
| 446 { | |
| 447 "name": "create", | |
| 448 "type": "function", | |
| 449 "description": "Creates an extension panel.", | |
| 450 "parameters": [ | |
| 451 { | |
| 452 "name": "title", | |
| 453 "type": "string", | |
| 454 "description": "Title that is displayed next to the extension icon i
n the Developer Tools toolbar." | |
| 455 }, | |
| 456 { | |
| 457 "name": "iconPath", | |
| 458 "type": "string", | |
| 459 "description": "Path of the panel's icon relative to the extension d
irectory." | |
| 460 }, | |
| 461 { | |
| 462 "name": "pagePath", | |
| 463 "type": "string", | |
| 464 "description": "Path of the panel's HTML page relative to the extens
ion directory." | |
| 465 }, | |
| 466 { | |
| 467 "name": "callback", | |
| 468 "type": "function", | |
| 469 "optional": true, | |
| 470 "description": "A function that is called when the panel is created.
", | |
| 471 "parameters": [ | |
| 472 { | |
| 473 "name": "panel", | |
| 474 "description": "An ExtensionPanel object representing the create
d panel.", | |
| 475 "$ref": "ExtensionPanel" | |
| 476 } | |
| 477 ] | |
| 478 } | |
| 479 ] | |
| 480 }, | |
| 481 { | |
| 482 "name": "setOpenResourceHandler", | |
| 483 "type": "function", | |
| 484 "description": "Specifies the function to be called when the user clicks
a resource link in the Developer Tools window. To unset the handler, either cal
l the method with no parameters or pass null as the parameter.", | |
| 485 "parameters": [ | |
| 486 { | |
| 487 "name": "callback", | |
| 488 "type": "function", | |
| 489 "optional": true, | |
| 490 "description": "A function that is called when the user clicks on a
valid resource link in Developer Tools window. Note that if the user clicks an i
nvalid URL or an XHR, this function is not called.", | |
| 491 "parameters": [ | |
| 492 { | |
| 493 "name": "devtools.inspectedWindow.Resource", | |
| 494 "type": "object", | |
| 495 "description": "A <a href=\"devtools.inspectedWindow.html#type-R
esource\">Resource</a> object for the resource that was clicked." | |
| 496 } | |
| 497 ] | |
| 498 } | |
| 499 ] | |
| 500 } | |
| 501 ] | |
| 502 }, | |
| 503 { | |
| 504 "namespace": "devtools.network", | |
| 505 "nocompile": true, | |
| 506 "types": [ | |
| 507 { | |
| 508 "id": "Request", | |
| 509 "type": "object", | |
| 510 "description": "Represents a network request for a document resource (sc
ript, image and so on). See HAR Specification for reference.", | |
| 511 "functions": [ | |
| 512 { | |
| 513 "name": "getContent", | |
| 514 "type": "function", | |
| 515 "description": "Returns content of the response body.", | |
| 516 "parameters": [ | |
| 517 { | |
| 518 "name": "callback", | |
| 519 "type": "function", | |
| 520 "description": "A function that receives the response body when
the request completes.", | |
| 521 "parameters": [ | |
| 522 { | |
| 523 "name": "content", | |
| 524 "type": "string", | |
| 525 "description": "Content of the response body (potentially en
coded)." | |
| 526 }, | |
| 527 { | |
| 528 "name": "encoding", | |
| 529 "type": "string", | |
| 530 "description": "Empty if content is not encoded, encoding na
me otherwise. Currently, only base64 is supported." | |
| 531 } | |
| 532 ] | |
| 533 } | |
| 534 ] | |
| 535 } | |
| 536 ] | |
| 537 } | |
| 538 ], | |
| 539 "functions": [ | |
| 540 { | |
| 541 "name": "getHAR", | |
| 542 "type": "function", | |
| 543 "description": "Returns HAR log that contains all known network requests
.", | |
| 544 "parameters": [ | |
| 545 { | |
| 546 "name": "callback", | |
| 547 "type": "function", | |
| 548 "description": "A function that receives the HAR log when the reques
t completes.", | |
| 549 "parameters": [ | |
| 550 { | |
| 551 "name": "harLog", | |
| 552 "type": "object", | |
| 553 "description": "A HAR log. See HAR specification for details." | |
| 554 } | |
| 555 ] | |
| 556 } | |
| 557 ] | |
| 558 } | |
| 559 ], | |
| 560 "events": [ | |
| 561 { | |
| 562 "name": "onRequestFinished", | |
| 563 "type": "function", | |
| 564 "description": "Fired when a network request is finished and all request
data are available.", | |
| 565 "parameters": [ | |
| 566 { "name": "request", "$ref": "Request", "description": "Description of
a network request in the form of a HAR entry. See HAR specification for details
." } | |
| 567 ] | |
| 568 }, | |
| 569 { | |
| 570 "name": "onNavigated", | |
| 571 "type": "function", | |
| 572 "description": "Fired when the inspected window navigates to a new page.
", | |
| 573 "parameters": [ | |
| 574 { | |
| 575 "name": "url", | |
| 576 "type": "string", | |
| 577 "description": "URL of the new page." | |
| 578 } | |
| 579 ] | |
| 580 } | |
| 581 ] | |
| 582 }, | |
| 583 { | |
| 584 "namespace": "experimental.devtools.console", | |
| 585 "nocompile": true, | |
| 586 "functions": [ | |
| 587 { | |
| 588 "name": "addMessage", | |
| 589 "type": "function", | |
| 590 "description": "Adds a message to the console.", | |
| 591 "parameters": [ | |
| 592 { "name": "severity", "$ref": "Severity", "description": "The severity
of the message." }, | |
| 593 { "name": "text", "type": "string", "description": "The text of the me
ssage." } | |
| 594 ] | |
| 595 }, | |
| 596 { | |
| 597 "name": "getMessages", | |
| 598 "type": "function", | |
| 599 "description": "Retrieves console messages.", | |
| 600 "parameters": [ | |
| 601 { | |
| 602 "name": "callback", | |
| 603 "type": "function", | |
| 604 "description": "A function that receives console messages when the r
equest completes.", | |
| 605 "parameters": [ | |
| 606 { | |
| 607 "name": "messages", | |
| 608 "type": "array", | |
| 609 "items": { "$ref": "ConsoleMessage" }, | |
| 610 "description": "Console messages." | |
| 611 } | |
| 612 ] | |
| 613 } | |
| 614 ] | |
| 615 } | |
| 616 ], | |
| 617 "types": [ | |
| 618 { | |
| 619 "id": "ConsoleMessage", | |
| 620 "type": "object", | |
| 621 "description": "A console message.", | |
| 622 "properties": { | |
| 623 "severity": { | |
| 624 "$ref": "Severity", | |
| 625 "description": "Message severity." | |
| 626 }, | |
| 627 "text": { | |
| 628 "type": "string", | |
| 629 "description": "The text of the console message, as represented by t
he first argument to the console.log() or a similar method (no parameter substit
ution performed)." | |
| 630 }, | |
| 631 "url": { | |
| 632 "type": "string", | |
| 633 "optional": true, | |
| 634 "description": "The URL of the script that originated the message, i
f available." | |
| 635 }, | |
| 636 "line": { | |
| 637 "type": "number", | |
| 638 "optional": true, | |
| 639 "description": "The number of the line where the message originated,
if available." | |
| 640 } | |
| 641 } | |
| 642 }, | |
| 643 { | |
| 644 "id": "Severity", | |
| 645 "type": "object", | |
| 646 "properties": { | |
| 647 "Tip": { | |
| 648 "type": "string" | |
| 649 }, | |
| 650 "Debug": { | |
| 651 "type": "string" | |
| 652 }, | |
| 653 "Log": { | |
| 654 "type": "string" | |
| 655 }, | |
| 656 "Warning": { | |
| 657 "type": "string" | |
| 658 }, | |
| 659 "Error": { | |
| 660 "type": "string" | |
| 661 } | |
| 662 } | |
| 663 } | |
| 664 ], | |
| 665 "events": [ | |
| 666 { | |
| 667 "name": "onMessageAdded", | |
| 668 "type": "function", | |
| 669 "description": "Fired when a new message is added to the console.", | |
| 670 "parameters": [ | |
| 671 { "name": "message", "$ref": "ConsoleMessage" } | |
| 672 ] | |
| 673 } | |
| 674 ] | |
| 675 }, | |
| 676 { | |
| 677 "namespace": "experimental.devtools.audits", | |
| 678 "nocompile": true, | |
| 679 "functions": [ | |
| 680 { | |
| 681 "name": "addCategory", | |
| 682 "type": "function", | |
| 683 "description": "Adds an audit category.", | |
| 684 "parameters": [ | |
| 685 { "name": "displayName", "type": "string", "description": "A display n
ame for the category." }, | |
| 686 { "name": "resultCount", "type": "number", "description": "The expecte
d number of audit results in the category." } | |
| 687 ], | |
| 688 "returns": { | |
| 689 "$ref": "AuditCategory" | |
| 690 } | |
| 691 } | |
| 692 ], | |
| 693 "types": [ | |
| 694 { | |
| 695 "id": "AuditCategory", | |
| 696 "type": "object", | |
| 697 "description": "A group of logically related audit checks.", | |
| 698 "events": [ | |
| 699 { | |
| 700 "name": "onAuditStarted", | |
| 701 "type": "function", | |
| 702 "description": "If the category is enabled, this event is fired when
the audit is started. The event handler is expected to initiate execution of th
e audit logic that will populate the <code>results</code> collection.", | |
| 703 "parameters": [ | |
| 704 { "name": "results", "$ref": "AuditResults" } | |
| 705 ] | |
| 706 } | |
| 707 ] | |
| 708 }, | |
| 709 { | |
| 710 "id": "FormattedValue", | |
| 711 "type": "object", | |
| 712 "description": "A value returned from one of the formatters (a URL, code
snippet etc), to be passed to <code>createResult()</code> or <code>addChild()</
code>. See <a href=\"#method-AuditResults-createSnippet\"><code>createSnippet()<
/code></a> and <a href=\"#method-AuditResults-createURL\"><code>createURL()</cod
e></a>." | |
| 713 }, | |
| 714 { | |
| 715 "id": "AuditResults", | |
| 716 "type": "object", | |
| 717 "description": "A collection of audit results for the current run of the
audit category.", | |
| 718 "functions": [ | |
| 719 { | |
| 720 "name": "addResult", | |
| 721 "type": "function", | |
| 722 "description": "Adds an audit result. The results are rendered as bu
lleted items under the audit category assoicated with the <code>AuditResults</co
de> object.", | |
| 723 "parameters": [ | |
| 724 { | |
| 725 "name": "displayName", | |
| 726 "type": "string", | |
| 727 "description": "A concise, high-level description of the result.
" | |
| 728 }, | |
| 729 { | |
| 730 "name": "description", | |
| 731 "type": "string", | |
| 732 "description": "A detailed description of what the displayName m
eans." | |
| 733 }, | |
| 734 { | |
| 735 "name": "severity", | |
| 736 "$ref": "AuditResultSeverity" | |
| 737 }, | |
| 738 { | |
| 739 "name": "details", | |
| 740 "$ref": "AuditResultNode", | |
| 741 "optional": true, | |
| 742 "description": "A subtree that appears under the added result th
at may provide additional details on the violations found." | |
| 743 } | |
| 744 ] | |
| 745 }, | |
| 746 { | |
| 747 "name": "createResult", | |
| 748 "type": "function", | |
| 749 "description": "Creates a result node that may be used as the <code>
details</code> parameters to the <code>addResult()</code> method.", | |
| 750 "parameters": [ | |
| 751 { | |
| 752 "name": "content ...", | |
| 753 "choices": [ | |
| 754 { "type": "string" }, | |
| 755 { "$ref": "FormattedValue" } | |
| 756 ], | |
| 757 "description": "Either string or formatted values returned by on
e of the AuditResult formatters (a URL, a snippet etc). If multiple arguments ar
e passed, these will be concatenated into a single node." | |
| 758 } | |
| 759 ], | |
| 760 "returns": { | |
| 761 "$ref": "AuditResultNode" | |
| 762 } | |
| 763 }, | |
| 764 { | |
| 765 "name": "done", | |
| 766 "type": "function", | |
| 767 "description": "Signals the DevTools Audits panel that the run of th
is category is over. The audit run also completes automatically when the number
of added top-level results is equal to that declared when AuditCategory was crea
ted." | |
| 768 }, | |
| 769 { | |
| 770 "name": "createURL", | |
| 771 "type": "function", | |
| 772 "description": "Render passed value as a URL in the Audits panel.", | |
| 773 "parameters": [ | |
| 774 { "name": "href", "type": "string", "description": "A URL that app
ears as the href value on the resulting link." }, | |
| 775 { "name": "displayText", "type": "string", "description": "Text th
at appears to the user.", "optional": true } | |
| 776 ], | |
| 777 "returns": { "$ref": "FormattedValue" } | |
| 778 }, | |
| 779 { | |
| 780 "name": "createSnippet", | |
| 781 "type": "function", | |
| 782 "description": "Render passed text as a code snippet in the Audits p
anel.", | |
| 783 "parameters": [ | |
| 784 { "name": "text", "type": "string", "description": "Snippet text."
} | |
| 785 ], | |
| 786 "returns": { "$ref": "FormattedValue" } | |
| 787 } | |
| 788 ], | |
| 789 "properties": { | |
| 790 "Severity": { | |
| 791 "$ref": "AuditResultSeverity", | |
| 792 "description": "A class that contains possible values for the audit
result severities." | |
| 793 }, | |
| 794 "text": { | |
| 795 "type": "string", | |
| 796 "description": "The contents of the node." | |
| 797 }, | |
| 798 "children": { | |
| 799 "optional": true, | |
| 800 "type": "array", | |
| 801 "items": { "$ref": "AuditResultNode" }, | |
| 802 "description": "Children of this node." | |
| 803 }, | |
| 804 "expanded": { | |
| 805 "optional": "true", | |
| 806 "type": "boolean", | |
| 807 "description": "Whether the node is expanded by default." | |
| 808 } | |
| 809 } | |
| 810 }, | |
| 811 { | |
| 812 "id": "AuditResultNode", | |
| 813 "type": "object", | |
| 814 "description": "A node in the audit result tree. Displays content and ma
y optionally have children nodes.", | |
| 815 "functions": [ | |
| 816 { | |
| 817 "name": "addChild", | |
| 818 "description": "Adds a child node to this node.", | |
| 819 "parameters": [ | |
| 820 { | |
| 821 "name": "content ...", | |
| 822 "choices": [ | |
| 823 { "type": "string" }, | |
| 824 { "$ref": "FormattedValue" } | |
| 825 ], | |
| 826 "description": "Either string or formatted values returned by on
e of the AuditResult formatters (URL, snippet etc). If multiple arguments are pa
ssed, these will be concatenated into a single node." | |
| 827 } | |
| 828 ], | |
| 829 "returns": { | |
| 830 "$ref": "AuditResultNode" | |
| 831 } | |
| 832 } | |
| 833 ], | |
| 834 "properties": { | |
| 835 "expanded": { | |
| 836 "type": "boolean", | |
| 837 "description": "If set, the subtree will always be expanded." | |
| 838 } | |
| 839 } | |
| 840 }, | |
| 841 { | |
| 842 "id": "AuditResultSeverity", | |
| 843 "type": "object", | |
| 844 "description": "This type contains possible values for a result severity
. The results of different severities are distinguished by colored bullets near
the result's display name.", | |
| 845 "properties": { | |
| 846 "Info": { | |
| 847 "type": "string" | |
| 848 }, | |
| 849 "Warning": { | |
| 850 "type": "string" | |
| 851 }, | |
| 852 "Severe": { | |
| 853 "type": "string" | |
| 854 } | |
| 855 } | |
| 856 } | |
| 857 ] | |
| 858 } | |
| 859 ] | |
| OLD | NEW |