blob: d359496fa02bb8e888ca888fc6b7c542287c06cb [file] [log] [blame]
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
[
{
"namespace": "experimental.devtools.audits",
"description": "Use the <code>chrome.experimental.devtools.audits</code> API to add new audit categories to the Developer Tools' Audit panel.",
"nocompile": true,
"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 group of logically related audit checks.",
"events": [
{
"name": "onAuditStarted",
"type": "function",
"description": "If the category is enabled, this event is fired when the audit is started. The event handler is expected to initiate execution of the audit logic that will populate the <code>results</code> collection.",
"parameters": [
{ "name": "results", "$ref": "AuditResults" }
]
}
]
},
{
"id": "FormattedValue",
"type": "object",
"additionalProperties": { "type": "any" },
"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 $ref:AuditResults.createSnippet and $ref:AuditResults.createURL."
},
{
"id": "AuditResults",
"type": "object",
"description": "A collection of audit results for the current run of the audit category.",
"functions": [
{
"name": "addResult",
"type": "function",
"description": "Adds an audit result. The results are rendered as bulleted items under the audit category assoicated with the <code>AuditResults</code> object.",
"parameters": [
{
"name": "displayName",
"type": "string",
"description": "A concise, high-level description of the result."
},
{
"name": "description",
"type": "string",
"description": "A detailed description of what the displayName means."
},
{
"name": "severity",
"$ref": "AuditResultSeverity"
},
{
"name": "details",
"$ref": "AuditResultNode",
"optional": true,
"description": "A subtree that appears under the added result that may provide additional details on the violations found."
}
]
},
{
"name": "createResult",
"type": "function",
"description": "Creates a result node that may be used as the <code>details</code> parameters to the <code>addResult()</code> method.",
"parameters": [
{
"name": "content",
"choices": [
{ "type": "string" },
{ "$ref": "FormattedValue" }
],
"description": "Either string or formatted values returned by one of the AuditResult formatters (a URL, a snippet etc). If multiple arguments are passed, these will be concatenated into a single node."
}
],
"returns": {
"$ref": "AuditResultNode"
}
},
{
"name": "done",
"type": "function",
"description": "Signals the DevTools Audits panel that the run of this 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 created."
},
{
"name": "createURL",
"type": "function",
"description": "Render passed value as a URL in the Audits panel.",
"parameters": [
{ "name": "href", "type": "string", "description": "A URL that appears as the href value on the resulting link." },
{ "name": "displayText", "type": "string", "description": "Text that appears to the user.", "optional": true }
],
"returns": { "$ref": "FormattedValue" }
},
{
"name": "createSnippet",
"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 the 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 tree. Displays content and may optionally have children nodes.",
"functions": [
{
"name": "addChild",
"description": "Adds a child node to this node.",
"parameters": [
{
"name": "content",
"choices": [
{ "type": "string" },
{ "$ref": "FormattedValue" }
],
"description": "Either string or formatted values returned by one of the AuditResult formatters (URL, snippet etc). If multiple arguments are passed, these will be concatenated into a single node."
}
],
"returns": {
"$ref": "AuditResultNode"
}
}
],
"properties": {
"expanded": {
"type": "boolean",
"description": "If set, the subtree will always be expanded."
}
}
},
{
"id": "AuditResultSeverity",
"type": "object",
"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.",
"properties": {
"Info": {
"type": "string"
},
"Warning": {
"type": "string"
},
"Severe": {
"type": "string"
}
}
}
]
}
]