UNPKG

25.5 kBJavaScriptView Raw
1export function DomainDispatcher(domain) {
2 return (klass) => __registerDomainDispatcher(domain, klass);
3}
4// Heap
5// Heap domain exposes JavaScript heap attributes and capabilities.
6export var HeapDomain;
7(function (HeapDomain) {
8 class HeapFrontend {
9 // Information about the garbage collection.
10 garbageCollected(collection) {
11 __inspectorSendEvent(JSON.stringify({
12 method: 'Heap.garbageCollected',
13 params: { collection: collection },
14 }));
15 }
16 // Tracking started.
17 trackingStart(timestamp, snapshotData) {
18 __inspectorSendEvent(JSON.stringify({
19 method: 'Heap.trackingStart',
20 params: {
21 timestamp: timestamp,
22 snapshotData: snapshotData,
23 },
24 }));
25 }
26 // Tracking stopped.
27 trackingComplete(timestamp, snapshotData) {
28 __inspectorSendEvent(JSON.stringify({
29 method: 'Heap.trackingComplete',
30 params: {
31 timestamp: timestamp,
32 snapshotData: snapshotData,
33 },
34 }));
35 }
36 }
37 HeapDomain.HeapFrontend = HeapFrontend;
38})(HeapDomain || (HeapDomain = {}));
39// Debugger
40// Debugger domain exposes JavaScript debugging capabilities. It allows setting and removing breakpoints, stepping through execution, exploring stack traces, etc.
41export var DebuggerDomain;
42(function (DebuggerDomain) {
43 class DebuggerFrontend {
44 // Called when global has been cleared and debugger client should reset its state. Happens upon navigation or reload.
45 globalObjectCleared() {
46 __inspectorSendEvent(JSON.stringify({
47 method: 'Debugger.globalObjectCleared',
48 params: {},
49 }));
50 }
51 // Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger.
52 scriptParsed(scriptId, url, startLine, startColumn, endLine, endColumn, isContentScript, sourceURL, sourceMapURL) {
53 __inspectorSendEvent(JSON.stringify({
54 method: 'Debugger.scriptParsed',
55 params: {
56 scriptId: scriptId,
57 url: url,
58 startLine: startLine,
59 startColumn: startColumn,
60 endLine: endLine,
61 endColumn: endColumn,
62 isContentScript: isContentScript,
63 sourceURL: sourceURL,
64 sourceMapURL: sourceMapURL,
65 },
66 }));
67 }
68 // Fired when virtual machine fails to parse the script.
69 scriptFailedToParse(url, scriptSource, startLine, errorLine, errorMessage) {
70 __inspectorSendEvent(JSON.stringify({
71 method: 'Debugger.scriptFailedToParse',
72 params: {
73 url: url,
74 scriptSource: scriptSource,
75 startLine: startLine,
76 errorLine: errorLine,
77 errorMessage: errorMessage,
78 },
79 }));
80 }
81 // Fired when breakpoint is resolved to an actual script and location.
82 breakpointResolved(breakpointId, location) {
83 __inspectorSendEvent(JSON.stringify({
84 method: 'Debugger.breakpointResolved',
85 params: { breakpointId: breakpointId, location: location },
86 }));
87 }
88 // Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria.
89 paused(callFrames, reason /* XHR,DOM,EventListener,exception,assert,CSPViolation,DebuggerStatement,Breakpoint,PauseOnNextStatement,other */, data) {
90 __inspectorSendEvent(JSON.stringify({
91 method: 'Debugger.paused',
92 params: {
93 callFrames: callFrames,
94 reason: reason,
95 data: data,
96 },
97 }));
98 }
99 // Fired when the virtual machine resumed execution.
100 resumed() {
101 __inspectorSendEvent(JSON.stringify({ method: 'Debugger.resumed', params: {} }));
102 }
103 // Fires when a new probe sample is collected.
104 didSampleProbe(sample) {
105 __inspectorSendEvent(JSON.stringify({
106 method: 'Debugger.didSampleProbe',
107 params: { sample: sample },
108 }));
109 }
110 // Fired when a "sound" breakpoint action is triggered on a breakpoint.
111 playBreakpointActionSound(breakpointActionId) {
112 __inspectorSendEvent(JSON.stringify({
113 method: 'Debugger.playBreakpointActionSound',
114 params: { breakpointActionId: breakpointActionId },
115 }));
116 }
117 }
118 DebuggerDomain.DebuggerFrontend = DebuggerFrontend;
119})(DebuggerDomain || (DebuggerDomain = {}));
120// Runtime
121// Runtime domain exposes JavaScript runtime by means of remote evaluation and mirror objects. Evaluation results are returned as mirror object that expose object type, string representation and unique identifier that can be used for further object reference. Original objects are maintained in memory unless they are either explicitly released or are released along with the other objects in their object group.
122export var RuntimeDomain;
123(function (RuntimeDomain) {
124 class RuntimeFrontend {
125 // Issued when new execution context is created.
126 executionContextCreated(context) {
127 __inspectorSendEvent(JSON.stringify({
128 method: 'Runtime.executionContextCreated',
129 params: { context: context },
130 }));
131 }
132 }
133 RuntimeDomain.RuntimeFrontend = RuntimeFrontend;
134})(RuntimeDomain || (RuntimeDomain = {}));
135// Console
136// Console domain defines methods and events for interaction with the JavaScript console. Console collects messages created by means of the <a href='http://getfirebug.com/wiki/index.php/Console_API'>JavaScript Console API</a>. One needs to enable this domain using <code>enable</code> command in order to start receiving the console messages. Browser collects messages issued while console domain is not enabled as well and reports them using <code>messageAdded</code> notification upon enabling.
137export var ConsoleDomain;
138(function (ConsoleDomain) {
139 class ConsoleFrontend {
140 // Issued when new console message is added.
141 messageAdded(message) {
142 __inspectorSendEvent(JSON.stringify({
143 method: 'Console.messageAdded',
144 params: { message: message },
145 }));
146 }
147 // Issued when subsequent message(s) are equal to the previous one(s).
148 messageRepeatCountUpdated(count) {
149 __inspectorSendEvent(JSON.stringify({
150 method: 'Console.messageRepeatCountUpdated',
151 params: { count: count },
152 }));
153 }
154 // Issued when console is cleared. This happens either upon <code>clearMessages</code> command or after page navigation.
155 messagesCleared() {
156 __inspectorSendEvent(JSON.stringify({
157 method: 'Console.messagesCleared',
158 params: {},
159 }));
160 }
161 // Issued from console.takeHeapSnapshot.
162 heapSnapshot(timestamp, snapshotData, title) {
163 __inspectorSendEvent(JSON.stringify({
164 method: 'Console.heapSnapshot',
165 params: {
166 timestamp: timestamp,
167 snapshotData: snapshotData,
168 title: title,
169 },
170 }));
171 }
172 }
173 ConsoleDomain.ConsoleFrontend = ConsoleFrontend;
174})(ConsoleDomain || (ConsoleDomain = {}));
175// Page
176// Actions and events related to the inspected page belong to the page domain.
177export var PageDomain;
178(function (PageDomain) {
179 class PageFrontend {
180 domContentEventFired(timestamp) {
181 __inspectorSendEvent(JSON.stringify({
182 method: 'Page.domContentEventFired',
183 params: { timestamp: timestamp },
184 }));
185 }
186 loadEventFired(timestamp) {
187 __inspectorSendEvent(JSON.stringify({
188 method: 'Page.loadEventFired',
189 params: { timestamp: timestamp },
190 }));
191 }
192 // Fired once navigation of the frame has completed. Frame is now associated with the new loader.
193 frameNavigated(frame) {
194 __inspectorSendEvent(JSON.stringify({
195 method: 'Page.frameNavigated',
196 params: { frame: frame },
197 }));
198 }
199 // Fired when frame has been detached from its parent.
200 frameDetached(frameId) {
201 __inspectorSendEvent(JSON.stringify({
202 method: 'Page.frameDetached',
203 params: { frameId: frameId },
204 }));
205 }
206 // Fired when frame has started loading.
207 frameStartedLoading(frameId) {
208 __inspectorSendEvent(JSON.stringify({
209 method: 'Page.frameStartedLoading',
210 params: { frameId: frameId },
211 }));
212 }
213 // Fired when frame has stopped loading.
214 frameStoppedLoading(frameId) {
215 __inspectorSendEvent(JSON.stringify({
216 method: 'Page.frameStoppedLoading',
217 params: { frameId: frameId },
218 }));
219 }
220 // Fired when frame schedules a potential navigation.
221 frameScheduledNavigation(frameId, delay) {
222 __inspectorSendEvent(JSON.stringify({
223 method: 'Page.frameScheduledNavigation',
224 params: { frameId: frameId, delay: delay },
225 }));
226 }
227 // Fired when frame no longer has a scheduled navigation.
228 frameClearedScheduledNavigation(frameId) {
229 __inspectorSendEvent(JSON.stringify({
230 method: 'Page.frameClearedScheduledNavigation',
231 params: { frameId: frameId },
232 }));
233 }
234 // Fired when a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload) is about to open.
235 javascriptDialogOpening(message) {
236 __inspectorSendEvent(JSON.stringify({
237 method: 'Page.javascriptDialogOpening',
238 params: { message: message },
239 }));
240 }
241 // Fired when a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload) has been closed.
242 javascriptDialogClosed() {
243 __inspectorSendEvent(JSON.stringify({
244 method: 'Page.javascriptDialogClosed',
245 params: {},
246 }));
247 }
248 // Fired when the JavaScript is enabled/disabled on the page
249 scriptsEnabled(isEnabled) {
250 __inspectorSendEvent(JSON.stringify({
251 method: 'Page.scriptsEnabled',
252 params: { isEnabled: isEnabled },
253 }));
254 }
255 }
256 PageDomain.PageFrontend = PageFrontend;
257})(PageDomain || (PageDomain = {}));
258// Network
259// Network domain allows tracking network activities of the page. It exposes information about http, file, data and other requests and responses, their headers, bodies, timing, etc.
260export var NetworkDomain;
261(function (NetworkDomain) {
262 class NetworkFrontend {
263 // Fired when page is about to send HTTP request.
264 requestWillBeSent(requestId, frameId, loaderId, documentURL, request, timestamp, initiator, redirectResponse, type) {
265 __inspectorSendEvent(JSON.stringify({
266 method: 'Network.requestWillBeSent',
267 params: {
268 requestId: requestId,
269 frameId: frameId,
270 loaderId: loaderId,
271 documentURL: documentURL,
272 request: request,
273 timestamp: timestamp,
274 initiator: initiator,
275 redirectResponse: redirectResponse,
276 type: type,
277 },
278 }));
279 }
280 // Fired if request ended up loading from cache.
281 requestServedFromCache(requestId) {
282 __inspectorSendEvent(JSON.stringify({
283 method: 'Network.requestServedFromCache',
284 params: { requestId: requestId },
285 }));
286 }
287 // Fired when HTTP response is available.
288 responseReceived(requestId, frameId, loaderId, timestamp, type, response) {
289 __inspectorSendEvent(JSON.stringify({
290 method: 'Network.responseReceived',
291 params: {
292 requestId: requestId,
293 frameId: frameId,
294 loaderId: loaderId,
295 timestamp: timestamp,
296 type: type,
297 response: response,
298 },
299 }));
300 }
301 // Fired when data chunk was received over the network.
302 dataReceived(requestId, timestamp, dataLength, encodedDataLength) {
303 __inspectorSendEvent(JSON.stringify({
304 method: 'Network.dataReceived',
305 params: {
306 requestId: requestId,
307 timestamp: timestamp,
308 dataLength: dataLength,
309 encodedDataLength: encodedDataLength,
310 },
311 }));
312 }
313 // Fired when HTTP request has finished loading.
314 loadingFinished(requestId, timestamp, sourceMapURL) {
315 __inspectorSendEvent(JSON.stringify({
316 method: 'Network.loadingFinished',
317 params: {
318 requestId: requestId,
319 timestamp: timestamp,
320 sourceMapURL: sourceMapURL,
321 },
322 }));
323 }
324 // Fired when HTTP request has failed to load.
325 loadingFailed(requestId, timestamp, errorText, canceled) {
326 __inspectorSendEvent(JSON.stringify({
327 method: 'Network.loadingFailed',
328 params: {
329 requestId: requestId,
330 timestamp: timestamp,
331 errorText: errorText,
332 canceled: canceled,
333 },
334 }));
335 }
336 // Fired when HTTP request has been served from memory cache.
337 requestServedFromMemoryCache(requestId, frameId, loaderId, documentURL, timestamp, initiator, resource) {
338 __inspectorSendEvent(JSON.stringify({
339 method: 'Network.requestServedFromMemoryCache',
340 params: {
341 requestId: requestId,
342 frameId: frameId,
343 loaderId: loaderId,
344 documentURL: documentURL,
345 timestamp: timestamp,
346 initiator: initiator,
347 resource: resource,
348 },
349 }));
350 }
351 // Fired when WebSocket is about to initiate handshake.
352 webSocketWillSendHandshakeRequest(requestId, timestamp, request) {
353 __inspectorSendEvent(JSON.stringify({
354 method: 'Network.webSocketWillSendHandshakeRequest',
355 params: {
356 requestId: requestId,
357 timestamp: timestamp,
358 request: request,
359 },
360 }));
361 }
362 // Fired when WebSocket handshake response becomes available.
363 webSocketHandshakeResponseReceived(requestId, timestamp, response) {
364 __inspectorSendEvent(JSON.stringify({
365 method: 'Network.webSocketHandshakeResponseReceived',
366 params: {
367 requestId: requestId,
368 timestamp: timestamp,
369 response: response,
370 },
371 }));
372 }
373 // Fired upon WebSocket creation.
374 webSocketCreated(requestId, url) {
375 __inspectorSendEvent(JSON.stringify({
376 method: 'Network.webSocketCreated',
377 params: { requestId: requestId, url: url },
378 }));
379 }
380 // Fired when WebSocket is closed.
381 webSocketClosed(requestId, timestamp) {
382 __inspectorSendEvent(JSON.stringify({
383 method: 'Network.webSocketClosed',
384 params: { requestId: requestId, timestamp: timestamp },
385 }));
386 }
387 // Fired when WebSocket frame is received.
388 webSocketFrameReceived(requestId, timestamp, response) {
389 __inspectorSendEvent(JSON.stringify({
390 method: 'Network.webSocketFrameReceived',
391 params: {
392 requestId: requestId,
393 timestamp: timestamp,
394 response: response,
395 },
396 }));
397 }
398 // Fired when WebSocket frame error occurs.
399 webSocketFrameError(requestId, timestamp, errorMessage) {
400 __inspectorSendEvent(JSON.stringify({
401 method: 'Network.webSocketFrameError',
402 params: {
403 requestId: requestId,
404 timestamp: timestamp,
405 errorMessage: errorMessage,
406 },
407 }));
408 }
409 // Fired when WebSocket frame is sent.
410 webSocketFrameSent(requestId, timestamp, response) {
411 __inspectorSendEvent(JSON.stringify({
412 method: 'Network.webSocketFrameSent',
413 params: {
414 requestId: requestId,
415 timestamp: timestamp,
416 response: response,
417 },
418 }));
419 }
420 }
421 NetworkDomain.NetworkFrontend = NetworkFrontend;
422})(NetworkDomain || (NetworkDomain = {}));
423// DOM
424// This domain exposes DOM read/write operations. Each DOM Node is represented with its mirror object that has an <code>id</code>. This <code>id</code> can be used to get additional information on the Node, resolve it into the JavaScript object wrapper, etc. It is important that client receives DOM events only for the nodes that are known to the client. Backend keeps track of the nodes that were sent to the client and never sends the same node twice. It is client's responsibility to collect information about the nodes that were sent to the client.
425export var DOMDomain;
426(function (DOMDomain) {
427 class DOMFrontend {
428 // Fired when <code>Document</code> has been totally updated. Node ids are no longer valid.
429 documentUpdated() {
430 __inspectorSendEvent(JSON.stringify({ method: 'DOM.documentUpdated', params: {} }));
431 }
432 // Fired when backend wants to provide client with the missing DOM structure. This happens upon most of the calls requesting node ids.
433 setChildNodes(parentId, nodes) {
434 __inspectorSendEvent(JSON.stringify({
435 method: 'DOM.setChildNodes',
436 params: { parentId: parentId, nodes: nodes },
437 }));
438 }
439 // Fired when <code>Element</code>'s attribute is modified.
440 attributeModified(nodeId, name, value) {
441 __inspectorSendEvent(JSON.stringify({
442 method: 'DOM.attributeModified',
443 params: { nodeId: nodeId, name: name, value: value },
444 }));
445 }
446 // Fired when <code>Element</code>'s attribute is removed.
447 attributeRemoved(nodeId, name) {
448 __inspectorSendEvent(JSON.stringify({
449 method: 'DOM.attributeRemoved',
450 params: { nodeId: nodeId, name: name },
451 }));
452 }
453 // Fired when <code>Element</code>'s inline style is modified via a CSS property modification.
454 inlineStyleInvalidated(nodeIds) {
455 __inspectorSendEvent(JSON.stringify({
456 method: 'DOM.inlineStyleInvalidated',
457 params: { nodeIds: nodeIds },
458 }));
459 }
460 // Mirrors <code>DOMCharacterDataModified</code> event.
461 characterDataModified(nodeId, characterData) {
462 __inspectorSendEvent(JSON.stringify({
463 method: 'DOM.characterDataModified',
464 params: { nodeId: nodeId, characterData: characterData },
465 }));
466 }
467 // Fired when <code>Container</code>'s child node count has changed.
468 childNodeCountUpdated(nodeId, childNodeCount) {
469 __inspectorSendEvent(JSON.stringify({
470 method: 'DOM.childNodeCountUpdated',
471 params: { nodeId: nodeId, childNodeCount: childNodeCount },
472 }));
473 }
474 // Mirrors <code>DOMNodeInserted</code> event.
475 childNodeInserted(parentNodeId, previousNodeId, node) {
476 __inspectorSendEvent(JSON.stringify({
477 method: 'DOM.childNodeInserted',
478 params: {
479 parentNodeId: parentNodeId,
480 previousNodeId: previousNodeId,
481 node: node,
482 },
483 }));
484 }
485 // Mirrors <code>DOMNodeRemoved</code> event.
486 childNodeRemoved(parentNodeId, nodeId) {
487 __inspectorSendEvent(JSON.stringify({
488 method: 'DOM.childNodeRemoved',
489 params: { parentNodeId: parentNodeId, nodeId: nodeId },
490 }));
491 }
492 // Called when shadow root is pushed into the element.
493 shadowRootPushed(hostId, root) {
494 __inspectorSendEvent(JSON.stringify({
495 method: 'DOM.shadowRootPushed',
496 params: { hostId: hostId, root: root },
497 }));
498 }
499 // Called when shadow root is popped from the element.
500 shadowRootPopped(hostId, rootId) {
501 __inspectorSendEvent(JSON.stringify({
502 method: 'DOM.shadowRootPopped',
503 params: { hostId: hostId, rootId: rootId },
504 }));
505 }
506 // Called when a pseudo element is added to an element.
507 pseudoElementAdded(parentId, pseudoElement) {
508 __inspectorSendEvent(JSON.stringify({
509 method: 'DOM.pseudoElementAdded',
510 params: {
511 parentId: parentId,
512 pseudoElement: pseudoElement,
513 },
514 }));
515 }
516 // Called when a pseudo element is removed from an element.
517 pseudoElementRemoved(parentId, pseudoElementId) {
518 __inspectorSendEvent(JSON.stringify({
519 method: 'DOM.pseudoElementRemoved',
520 params: {
521 parentId: parentId,
522 pseudoElementId: pseudoElementId,
523 },
524 }));
525 }
526 }
527 DOMDomain.DOMFrontend = DOMFrontend;
528})(DOMDomain || (DOMDomain = {}));
529// CSS
530// This domain exposes CSS read/write operations. All CSS objects (stylesheets, rules, and styles) have an associated 'id' used in subsequent operations on the related object. Each object type has a specific 'id' structure, and those are not interchangeable between objects of different kinds. CSS objects can be loaded using the <code>get*ForNode()</code> calls (which accept a DOM node id). A client can also discover all the existing stylesheets with the <code>getAllStyleSheets()</code> method (or keeping track of the <code>styleSheetAdded</code>/<code>styleSheetRemoved</code> events) and subsequently load the required stylesheet contents using the <code>getStyleSheet[Text]()</code> methods.
531export var CSSDomain;
532(function (CSSDomain) {
533 class CSSFrontend {
534 // Fires whenever a MediaQuery result changes (for example, after a browser window has been resized.) The current implementation considers only viewport-dependent media features.
535 mediaQueryResultChanged() {
536 __inspectorSendEvent(JSON.stringify({
537 method: 'CSS.mediaQueryResultChanged',
538 params: {},
539 }));
540 }
541 // Fires whenever a web font gets loaded.
542 fontsUpdated() {
543 __inspectorSendEvent(JSON.stringify({ method: 'CSS.fontsUpdated', params: {} }));
544 }
545 // Fired whenever a stylesheet is changed as a result of the client operation.
546 styleSheetChanged(styleSheetId) {
547 __inspectorSendEvent(JSON.stringify({
548 method: 'CSS.styleSheetChanged',
549 params: { styleSheetId: styleSheetId },
550 }));
551 }
552 // Fired whenever an active document stylesheet is added.
553 styleSheetAdded(header) {
554 __inspectorSendEvent(JSON.stringify({
555 method: 'CSS.styleSheetAdded',
556 params: { header: header },
557 }));
558 }
559 // Fired whenever an active document stylesheet is removed.
560 styleSheetRemoved(styleSheetId) {
561 __inspectorSendEvent(JSON.stringify({
562 method: 'CSS.styleSheetRemoved',
563 params: { styleSheetId: styleSheetId },
564 }));
565 }
566 layoutEditorChange(styleSheetId, changeRange) {
567 __inspectorSendEvent(JSON.stringify({
568 method: 'CSS.layoutEditorChange',
569 params: {
570 styleSheetId: styleSheetId,
571 changeRange: changeRange,
572 },
573 }));
574 }
575 }
576 CSSDomain.CSSFrontend = CSSFrontend;
577})(CSSDomain || (CSSDomain = {}));
578//# sourceMappingURL=InspectorBackendCommands.js.map
\No newline at end of file