1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
|
// 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": "devtools.inspectedWindow",
"allowedContexts": ["devtools", "devtools_only"],
"defaultContexts": ["devtools", "devtools_only"],
"description": "Use the <code>chrome.devtools.inspectedWindow</code> API to interact with the inspected window: obtain the tab ID for the inspected page, evaluate the code in the context of the inspected window, reload the page, or obtain the list of resources within the page.",
"nocompile": true,
"types": [
{
"id": "Resource",
"type": "object",
"description": "A resource within the inspected page, such as a document, a script, or an image.",
"properties": {
"url": {
"type": "string",
"description": "The URL of the resource."
}
},
"functions": [
{
"name": "getContent",
"unsupported": true,
"type": "function",
"async": "callback",
"description": "Gets the content of the resource.",
"parameters": [
{
"name": "callback",
"type": "function",
"description": "A function that receives resource content when the request completes.",
"parameters": [
{
"name": "content",
"type": "string",
"description": "Content of the resource (potentially encoded)."
},
{
"name": "encoding",
"type": "string",
"description": "Empty if content is not encoded, encoding name otherwise. Currently, only base64 is supported."
}
]
}
]
},
{
"name": "setContent",
"unsupported": true,
"type": "function",
"async": "callback",
"description": "Sets the content of the resource.",
"parameters": [
{
"name": "content",
"type": "string",
"description": "New content of the resource. Only resources with the text type are currently supported."
},
{
"name": "commit",
"type": "boolean",
"description": "True if the user has finished editing the resource, 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."
},
{
"name": "callback",
"type": "function",
"description": "A function called upon request completion.",
"optional": true,
"parameters": [
{
"name": "error",
"type": "object",
"additionalProperties": { "type": "any" },
"optional": true,
"description": "Set to undefined if the resource content was set successfully; describes error otherwise."
}
]
}
]
}
]
}
],
"properties": {
"tabId": {
"description": "The ID of the tab being inspected. This ID may be used with chrome.tabs.* API.",
"type": "integer"
}
},
"functions": [
{
"name": "eval",
"type": "function",
"description": "Evaluates a JavaScript expression in the context of the main frame of the inspected page. The expression must evaluate to a JSON-compliant object, otherwise an exception is thrown. The eval function can report either a DevTools-side error or a JavaScript exception that occurs during evaluation. In either case, the <code>result</code> parameter of the callback is <code>undefined</code>. In the case of a DevTools-side error, the <code>isException</code> parameter is non-null and has <code>isError</code> set to true and <code>code</code> set to an error code. In the case of a JavaScript error, <code>isException</code> is set to true and <code>value</code> is set to the string value of thrown object.",
"async": "callback",
"parameters": [
{
"name": "expression",
"type": "string",
"description": "An expression to evaluate."
},
{
"name": "options",
"type": "object",
"optional": true,
"description": "The options parameter can contain one or more options.",
"properties": {
"frameURL": {
"type": "string",
"unsupported": true,
"optional": true,
"description": "If specified, the expression is evaluated on the iframe whose URL matches the one specified. By default, the expression is evaluated in the top frame of the inspected page."
},
"useContentScriptContext": {
"type": "boolean",
"unsupported": true,
"optional": true,
"description": "Evaluate the expression in the context of the content script of the calling extension, provided that the content script is already injected into the inspected page. If not, the expression is not evaluated and the callback is invoked with the exception parameter set to an object that has the <code>isError</code> field set to true and the <code>code</code> field set to <code>E_NOTFOUND</code>."
},
"contextSecurityOrigin": {
"type": "string",
"unsupported": true,
"optional": true,
"description": "Evaluate the expression in the context of a content script of an extension that matches the specified origin. If given, contextSecurityOrigin overrides the 'true' setting on userContentScriptContext."
}
}
},
{
"name": "callback",
"type": "function",
"description": "A function called when evaluation completes.",
"optional": true,
"parameters": [
{
"name": "result",
"type": "any",
"description": "The result of evaluation."
},
{
"name": "exceptionInfo",
"type": "object",
"optional": true,
"description": "An object providing details if an exception occurred while evaluating the expression.",
"properties": {
"isError": {
"type": "boolean",
"description": "Set if the error occurred on the DevTools side before the expression is evaluated."
},
"code": {
"type": "string",
"description": "Set if the error occurred on the DevTools side before the expression is evaluated."
},
"description": {
"type": "string",
"description": "Set if the error occurred on the DevTools side before the expression is evaluated."
},
"details": {
"type": "array",
"items": { "type": "any" },
"description": "Set if the error occurred on the DevTools side before the expression is evaluated, contains the array of the values that may be substituted into the description string to provide more information about the cause of the error."
},
"isException": {
"type": "boolean",
"description": "Set if the evaluated code produces an unhandled exception."
},
"value": {
"type": "string",
"description": "Set if the evaluated code produces an unhandled exception."
}
}
}
]
}
]
},
{
"name": "reload",
"type": "function",
"description": "Reloads the inspected page.",
"parameters": [
{
"type": "object",
"name": "reloadOptions",
"optional": true,
"properties": {
"ignoreCache": {
"type": "boolean",
"optional": true,
"description": "When true, the loader will bypass 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 within the Developer Tools window."
},
"userAgent": {
"type": "string",
"optional": true,
"description": "If specified, the string will override the value of the <code>User-Agent</code> HTTP header that's sent while loading the resources 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 running within the inspected page."
},
"injectedScript": {
"type": "string",
"optional": true,
"description": "If specified, the script will be injected into every 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 example, if the user presses Ctrl+R."
},
"preprocessorScript": {
"unsupported": true,
"type": "string",
"deprecated": "Please avoid using this parameter, it will be removed soon.",
"optional": true,
"description": "If specified, this script evaluates into a function that accepts three string arguments: the source to preprocess, the URL of the source, and a function name if the source is an DOM event handler. The preprocessorerScript function should return a string to be compiled by Chrome in place of the input source. In the case that the source is a DOM event handler, the returned source must compile to a single JS function."
}
}
}
]
},
{
"name": "getResources",
"unsupported": true,
"type": "function",
"description": "Retrieves the list of resources from the inspected page.",
"unsupported": true,
"async": "callback",
"parameters": [
{
"name": "callback",
"type": "function",
"description": "A function that receives the list of resources when the request completes.",
"parameters": [
{
"name": "resources",
"type": "array",
"items": { "$ref": "Resource" },
"description": "The resources within the page."
}
]
}
]
}
],
"events": [
{
"name": "onResourceAdded",
"unsupported": true,
"type": "function",
"description": "Fired when a new resource is added to the inspected page.",
"parameters": [
{
"name": "resource",
"$ref": "Resource"
}
]
},
{
"name": "onResourceContentCommitted",
"unsupported": true,
"type": "function",
"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).",
"parameters": [
{
"name": "resource",
"$ref": "Resource"
},
{
"name": "content",
"type": "string",
"description": "New content of the resource."
}
]
}
]
}
]
|