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": "any", |
| 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": "any", |
| 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 ] |
OLD | NEW |