1/*
2* Copyright (C) 2013 Google Inc. All rights reserved.
3*
4* Redistribution and use in source and binary forms, with or without
5* modification, are permitted provided that the following conditions are
6* met:
7*
8*     * Redistributions of source code must retain the above copyright
9* notice, this list of conditions and the following disclaimer.
10*     * Redistributions in binary form must reproduce the above
11* copyright notice, this list of conditions and the following disclaimer
12* in the documentation and/or other materials provided with the
13* distribution.
14*     * Neither the name of Google Inc. nor the names of its
15* contributors may be used to endorse or promote products derived from
16* this software without specific prior written permission.
17*
18* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29*/
30
31/*
32* CodeGeneratorInstrumentation.py uses this file as a source to generate
33* InspectorInstrumentationInl.h and InspectorInstrumentationImpl.cpp
34*
35* The code below is not a correct IDL but a mix of IDL and C++.
36*
37* The syntax for an instrumentation method is as follows:
38*
39*    [methodAttributes] returnValue methodName([paramAttr1] param1, [paramAttr2] param2, ...)
40*
41* Where:
42*   methodAttributes - optional list of method attributes.
43*       Attributes containing "=" are code generation options:
44*           Inline=Custom - do not generate the public inline method.
45*           Inline=FastReturn - return early from the inline method if there are no frontends.
46*           Inline=Forward - generate a simple forwarding inline method that does not
47                             modify the parameter list (implies Inline=FastReturn)
48*       Attributes without "=" are the names of the agents to be invoked.
49*           Examples: DOM, Page, Debugger.
50*
51*   paramAttr - optional attribute controlling the parameters handling (one attribute per parameter max).
52*       Keep - pass first parameter (used to access the InstrumentingAgents instance) to agents.
53*       FastReturn - return early from the inline method if this parameter is 0/false.
54*
55*   returnValue: C++ return value. Only "void" and "InspectorInstrumentationCookie" are supported.
56*
57*   methodName: C++ name for the public instrumentation method and agents methods.
58*
59*   paramList: C++ parameter list with optional names. Names will be deduced from types if omitted but you have to
60*        specify explicit names for multiple parameters of the same type.
61*
62* Parameters with type PassRefPtr<T> are converted to raw pointers,
63* so reference will not be passed or released until all agents are notified.
64*/
65
66interface InspectorInstrumentation {
67
68#include "core/dom/PseudoElement.h"
69
70    [Page, Inspector, PageDebugger, PageRuntime]
71    void didClearDocumentOfWindowObject([Keep] LocalFrame*);
72
73    [DOMDebugger, Inline=FastReturn]
74    void willCloseWindow(ExecutionContext*);
75
76    [DOMDebugger, Inline=FastReturn]
77    void willInsertDOMNode([Keep] Node* parent);
78
79    [DOM, DOMDebugger, Inline=FastReturn]
80    void didInsertDOMNode([Keep] Node*);
81
82    [DOMDebugger, DOM, Inline=FastReturn]
83    void willRemoveDOMNode([Keep] Node*);
84
85    [DOMDebugger, DOM, Inline=FastReturn]
86    void willModifyDOMAttr([Keep] Element*, const AtomicString& oldValue, const AtomicString& newValue);
87
88    [DOM, Inline=FastReturn]
89    void didModifyDOMAttr([Keep] Element*, const AtomicString& name, const AtomicString& value);
90
91    [DOM, Inline=FastReturn]
92    void didRemoveDOMAttr([Keep] Element*, const AtomicString& name);
93
94    [DOM, Inline=FastReturn]
95    void characterDataModified([Keep] CharacterData*);
96
97    [DOM, DOMDebugger, Inline=FastReturn]
98    void didInvalidateStyleAttr([Keep] Node*);
99
100    [CSS]
101    void documentDetached([Keep] Document*);
102
103    [CSS, Inline=FastReturn]
104    void willMutateRules(CSSStyleSheet*);
105
106    [CSS, Inline=FastReturn]
107    void didMutateRules([Keep] CSSStyleSheet*);
108
109    [CSS, Inline=FastReturn]
110    void willMutateStyle(CSSStyleDeclaration*);
111
112    [CSS, Inline=FastReturn]
113    void didMutateStyle([Keep] CSSStyleDeclaration*, bool);
114
115    [CSS, Inline=FastReturn]
116    void activeStyleSheetsUpdated([Keep] Document*);
117
118    [Console, PageRuntime]
119    void frameWindowDiscarded(LocalFrame*, LocalDOMWindow* domWindow);
120
121    [CSS, Inline=FastReturn]
122    void mediaQueryResultChanged(Document*);
123
124    [DOM, Inline=FastReturn]
125    void didPushShadowRoot([Keep] Element* host, ShadowRoot*);
126
127    [DOM, Inline=FastReturn]
128    void willPopShadowRoot([Keep] Element* host, ShadowRoot*);
129
130    [DOMDebugger, Inline=FastReturn]
131    void willSendXMLHttpRequest(ExecutionContext*, const String& url);
132
133    [DOMDebugger, Inline=FastReturn]
134    void didFireWebGLError(Element*, const String& errorName);
135
136    [DOMDebugger, Inline=FastReturn]
137    void didFireWebGLWarning(Element*);
138
139    [DOMDebugger, Inline=FastReturn]
140    void didFireWebGLErrorOrWarning(Element*, const String& message);
141
142    [DOMDebugger, Debugger, Timeline, Inline=FastReturn]
143    void didInstallTimer([Keep] ExecutionContext*, int timerId, int timeout, bool singleShot);
144
145    [DOMDebugger, Debugger, Timeline, Inline=FastReturn]
146    void didRemoveTimer([Keep] ExecutionContext*, int timerId);
147
148    [Timeline, Inline=FastReturn]
149    InspectorInstrumentationCookie willCallFunction([Keep] ExecutionContext*, int scriptId, const String& scriptName, int scriptLine);
150
151    [Timeline, Inline=FastReturn]
152    void didCallFunction(const InspectorInstrumentationCookie&);
153
154    [Timeline, Inline=FastReturn]
155    InspectorInstrumentationCookie willDispatchXHRReadyStateChangeEvent([Keep] ExecutionContext*, XMLHttpRequest*);
156
157    [Timeline, Inline=FastReturn]
158    void didDispatchXHRReadyStateChangeEvent(const InspectorInstrumentationCookie&);
159
160    [Timeline, Inline=FastReturn]
161    InspectorInstrumentationCookie willDispatchEvent([Keep] Document*, const Event&, LocalDOMWindow*, Node*, const EventPath&);
162
163    [Timeline, Inline=FastReturn]
164    void didDispatchEvent(const InspectorInstrumentationCookie&);
165
166    [Debugger, Inline=FastReturn]
167    void didEnqueueEvent([Keep] EventTarget*, Event*);
168
169    [Debugger, Inline=FastReturn]
170    void didRemoveEvent([Keep] EventTarget*, Event*);
171
172    [Debugger, DOMDebugger, Inline=FastReturn]
173    InspectorInstrumentationCookie willHandleEvent([Keep] EventTarget*, Event*, EventListener* listener, bool useCapture);
174
175    [Debugger, Inline=FastReturn]
176    void didHandleEvent(const InspectorInstrumentationCookie&);
177
178    [Timeline, Inline=FastReturn]
179    InspectorInstrumentationCookie willDispatchEventOnWindow(LocalFrame*, const Event&, LocalDOMWindow*);
180
181    [Timeline, Inline=FastReturn]
182    void didDispatchEventOnWindow(const InspectorInstrumentationCookie&);
183
184    [Debugger, Inline=FastReturn]
185    void didEnqueueMutationRecord([Keep] ExecutionContext*, MutationObserver*);
186
187    [Debugger, Inline=FastReturn]
188    void didClearAllMutationRecords([Keep] ExecutionContext*, MutationObserver*);
189
190    [Debugger, Inline=FastReturn]
191    void willDeliverMutationRecords([Keep] ExecutionContext*, MutationObserver*);
192
193    [Debugger, Inline=FastReturn]
194    void didDeliverMutationRecords(ExecutionContext*);
195
196    [Debugger, Inline=FastReturn]
197    void didPostExecutionContextTask([Keep] ExecutionContext*, ExecutionContextTask*);
198
199    [Debugger, Inline=FastReturn]
200    void didKillAllExecutionContextTasks([Keep] ExecutionContext*);
201
202    [Debugger, Inline=FastReturn]
203    void willPerformExecutionContextTask([Keep] ExecutionContext*, ExecutionContextTask*);
204
205    [Debugger, Inline=FastReturn]
206    void didPerformExecutionContextTask(ExecutionContext*);
207
208    [Timeline, Inline=FastReturn]
209    InspectorInstrumentationCookie willEvaluateScript([Keep] LocalFrame*, const String& url, int lineNumber);
210
211    [Timeline, Inline=FastReturn]
212    void didEvaluateScript(const InspectorInstrumentationCookie&);
213
214    [PageRuntime, Inline=FastReturn]
215    void didCreateIsolatedContext([Keep] LocalFrame*, ScriptState*, SecurityOrigin*);
216
217    [DOMDebugger, Debugger, Timeline, Inline=FastReturn]
218    InspectorInstrumentationCookie willFireTimer([Keep] ExecutionContext*, int timerId);
219
220    [Debugger, Timeline, Inline=FastReturn]
221    void didFireTimer(const InspectorInstrumentationCookie&);
222
223    [Timeline, Inline=FastReturn]
224    void didInvalidateLayout([Keep] LocalFrame*);
225
226    [Timeline, Inline=FastReturn]
227    InspectorInstrumentationCookie willLayout([Keep] LocalFrame*);
228
229    [Timeline, Page, Inline=FastReturn]
230    void didLayout(const InspectorInstrumentationCookie&, RenderObject* root);
231
232    [Page, Inline=FastReturn]
233    void didScroll(Page*);
234
235    [Page, Inline=FastReturn]
236    void didResizeMainFrame(Page*);
237
238    [Timeline, Inline=FastReturn]
239    InspectorInstrumentationCookie willDispatchXHRLoadEvent([Keep] ExecutionContext*, XMLHttpRequest*);
240
241    [Timeline, Inline=FastReturn]
242    void didDispatchXHRLoadEvent(const InspectorInstrumentationCookie&);
243
244    [Debugger, Inline=FastReturn]
245    void didDispatchXHRLoadendEvent(ExecutionContext*, XMLHttpRequest*);
246
247    [Timeline, Inline=FastReturn]
248    void willScrollLayer([Keep] RenderObject*);
249
250    [Timeline, Inline=FastReturn]
251    void didScrollLayer(RenderObject*);
252
253    [Timeline, Inline=FastReturn]
254    void willPaint([Keep] RenderObject*, const GraphicsLayer*);
255
256    [Timeline, Page, LayerTree, Inline=FastReturn]
257    void didPaint([Keep] RenderObject*, const GraphicsLayer*, GraphicsContext*, const LayoutRect&);
258
259    [Timeline, Inline=FastReturn]
260    void willPaintImage([Keep] RenderImage*);
261
262    [Timeline, Inline=FastReturn]
263    void didPaintImage(RenderImage*);
264
265    [Resource, Timeline, Inline=FastReturn]
266    InspectorInstrumentationCookie willRecalculateStyle([Keep] Document*);
267
268    [Timeline, Resource, Page, Inline=FastReturn]
269    void didRecalculateStyle(const InspectorInstrumentationCookie&, int elementCount);
270
271    [Timeline, Resource, Inline=FastReturn]
272    void didScheduleStyleRecalculation([Keep] Document*);
273
274    [Resource, Inline=FastReturn]
275    void applyUserAgentOverride(LocalFrame*, String* userAgent);
276
277    [Page, Inline=FastReturn]
278    bool applyViewportStyleOverride(Document*, StyleResolver*);
279
280    [Page, Inline=FastReturn]
281    void applyEmulatedMedia(LocalFrame*, String* media);
282
283    [Timeline, Resource]
284    void willSendRequest(LocalFrame*, unsigned long identifier, DocumentLoader*, ResourceRequest&, const ResourceResponse& redirectResponse, const FetchInitiatorInfo&);
285
286    [Resource]
287    void markResourceAsCached(Page*, unsigned long identifier);
288
289    [Timeline, Resource]
290    void didReceiveResourceResponse([Keep] LocalFrame*, unsigned long identifier, DocumentLoader*, const ResourceResponse&, ResourceLoader*);
291
292    [Inline=Forward]
293    void continueAfterXFrameOptionsDenied(LocalFrame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceResponse& r);
294
295    [Inline=Forward]
296    void continueWithPolicyIgnore(LocalFrame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceResponse& r);
297
298    [Timeline, Resource, Inline=FastReturn]
299    void didReceiveData([Keep] LocalFrame*, unsigned long identifier, const char* data, int dataLength, int encodedDataLength);
300
301    [Timeline, Resource]
302    void didFinishLoading(LocalFrame* frame, unsigned long identifier, DocumentLoader*, double finishTime, int64_t encodedDataLength);
303
304    [Resource]
305    void didReceiveCORSRedirectResponse([Keep] LocalFrame*, unsigned long identifier, DocumentLoader*, const ResourceResponse&, ResourceLoader*);
306
307    [Timeline, Resource, Console] // Console should come AFTER Resource notification, front-end relies on this.
308    void didFailLoading(LocalFrame* frame, unsigned long identifier, const ResourceError&);
309
310    [Resource]
311    void documentThreadableLoaderStartedLoadingForClient(ExecutionContext*, unsigned long identifier, ThreadableLoaderClient* client);
312
313    [Debugger, Resource]
314    void willLoadXHR(ExecutionContext*, XMLHttpRequest* xhr, ThreadableLoaderClient* client, const AtomicString& method, const KURL& url, bool async, PassRefPtr<FormData>, const HTTPHeaderMap& headers, bool includeCredentials);
315
316    [Resource]
317    void didFailXHRLoading(ExecutionContext*, XMLHttpRequest* xhr, ThreadableLoaderClient* client);
318
319    [Console, Resource]
320    void didFinishXHRLoading(ExecutionContext*, XMLHttpRequest* xhr, ThreadableLoaderClient* client, unsigned long identifier, ScriptString sourceString, const AtomicString& method, const String& url, const String& sendURL, unsigned sendLineNumber);
321
322    [Resource]
323    void scriptImported(ExecutionContext*, unsigned long identifier, const String& sourceString);
324
325    [Debugger]
326    void scriptExecutionBlockedByCSP(ExecutionContext*, const String& directiveText);
327
328    [Resource]
329    void didReceiveScriptResponse(ExecutionContext*, unsigned long identifier);
330
331    [Timeline, Inspector, DOM, Page]
332    void domContentLoadedEventFired([Keep] LocalFrame*);
333
334    [Timeline, Page]
335    void loadEventFired([Keep] LocalFrame*);
336
337    [Page]
338    void frameAttachedToParent([Keep] LocalFrame*);
339
340    [Canvas, Page]
341    void frameDetachedFromParent([Keep] LocalFrame*);
342
343    [Resource, DOM, Canvas, Page, PageDebugger]
344    void didCommitLoad([Keep] LocalFrame*, DocumentLoader*);
345
346    [DOM, Inline=FastReturn]
347    void frameDocumentUpdated([Keep] LocalFrame*);
348
349    [Page]
350    void loaderDetachedFromFrame(LocalFrame*, DocumentLoader*);
351
352    [Page]
353    void frameStartedLoading([Keep] LocalFrame*);
354
355    [Page]
356    void frameStoppedLoading([Keep] LocalFrame*);
357
358    [Page, Resource]
359    void frameScheduledNavigation([Keep] LocalFrame*, double delay);
360
361    [Page, Resource]
362    void frameClearedScheduledNavigation([Keep] LocalFrame*);
363
364    [Page, Inline=FastReturn]
365    InspectorInstrumentationCookie willRunJavaScriptDialog(Page*, const String& message);
366
367    [Page, Inline=FastReturn]
368    void didRunJavaScriptDialog(const InspectorInstrumentationCookie&);
369
370    [Inline=Forward]
371    void willDestroyResource(Resource* cachedResource);
372
373    [Timeline, Inline=FastReturn]
374    InspectorInstrumentationCookie willWriteHTML([Keep] Document*, unsigned startLine);
375
376    [Timeline, Inline=FastReturn]
377    void didWriteHTML(const InspectorInstrumentationCookie&, unsigned endLine);
378
379    [DOMDebugger, Debugger, Timeline]
380    void didRequestAnimationFrame([Keep] Document*, int callbackId);
381
382    [DOMDebugger, Debugger, Timeline]
383    void didCancelAnimationFrame([Keep] Document*, int callbackId);
384
385    [DOMDebugger, Debugger, Timeline]
386    InspectorInstrumentationCookie willFireAnimationFrame([Keep] Document*, int callbackId);
387
388    [Timeline, Debugger, Inline=FastReturn]
389    void didFireAnimationFrame(const InspectorInstrumentationCookie&);
390
391    [DOMStorage, Inline=FastReturn]
392    void didDispatchDOMStorageEvent(Page* page, const String& key, const String& oldValue, const String& newValue, StorageType storageType, SecurityOrigin* securityOrigin);
393
394    [Worker]
395    void didStartWorker(ExecutionContext*, WorkerInspectorProxy* proxy, const KURL& url);
396
397    [Worker]
398    void workerTerminated(ExecutionContext*, WorkerInspectorProxy* proxy);
399
400    [WorkerRuntime]
401    void willEvaluateWorkerScript([Keep] WorkerGlobalScope* context, int workerThreadStartMode);
402
403    [Profiler, Timeline]
404    void willProcessTask(WorkerGlobalScope* context);
405
406    [Profiler, Timeline]
407    void didProcessTask(WorkerGlobalScope* context);
408
409    [Profiler]
410    void willEnterNestedRunLoop(WorkerGlobalScope* context);
411
412    [Profiler]
413    void didLeaveNestedRunLoop(WorkerGlobalScope* context);
414
415    [Resource, Timeline]
416    void didCreateWebSocket([Keep] Document*, unsigned long identifier, const KURL& requestURL, const String& protocol);
417
418    [Resource, Timeline]
419    void willSendWebSocketHandshakeRequest([Keep] Document*, unsigned long identifier, const WebSocketHandshakeRequest* request);
420
421    [Resource, Timeline]
422    void didReceiveWebSocketHandshakeResponse([Keep] Document*, unsigned long identifier, const WebSocketHandshakeRequest* request, const WebSocketHandshakeResponse* response);
423
424    [Resource, Timeline]
425    void didCloseWebSocket([Keep] Document*, unsigned long identifier);
426
427    [Resource]
428    void didReceiveWebSocketFrame(Document*, unsigned long identifier, int opCode, bool masked, const char* payload, size_t payloadLength);
429
430    [Resource]
431    void didSendWebSocketFrame(Document*, unsigned long identifier, int opCode, bool masked, const char* payload, size_t payloadLength);
432
433    [Resource]
434    void didReceiveWebSocketFrameError(Document*, unsigned long identifier, const String& errorMessage);
435
436    [ApplicationCache, Inline=FastReturn]
437    void networkStateChanged(Page*, bool online);
438
439    [ApplicationCache, Inline=FastReturn]
440    void updateApplicationCacheStatus([Keep] LocalFrame*);
441
442    [Timeline, Inline=FastReturn]
443    void willUpdateLayerTree(LocalFrame*);
444    [Timeline, LayerTree, Inline=FastReturn]
445    void layerTreeDidChange(LocalFrame*);
446    [Timeline, Inline=FastReturn]
447    void didUpdateLayerTree(LocalFrame*);
448
449    [DOM, Inline=FastReturn]
450    void pseudoElementCreated([Keep] PseudoElement*);
451
452    [DOM, Inline=FastReturn]
453    void pseudoElementDestroyed([Keep] PseudoElement*);
454
455    [DOMDebugger, Inline=FastReturn]
456    void willExecuteCustomElementCallback([Keep] Element*);
457
458    [Debugger, Inline=FastReturn]
459    int traceAsyncOperationStarting([Keep] ExecutionContext*, const String& operationName);
460
461    [Debugger, Inline=FastReturn]
462    int traceAsyncOperationStarting([Keep] ExecutionContext*, const String& operationName, int prevOperationId);
463
464    [Debugger, Inline=FastReturn]
465    void traceAsyncOperationCompleted([Keep] ExecutionContext*, int operationId);
466
467    [Debugger, Inline=FastReturn]
468    InspectorInstrumentationCookie traceAsyncOperationCompletedCallbackStarting([Keep] ExecutionContext*, int operationId);
469
470    [Debugger, Inline=FastReturn]
471    InspectorInstrumentationCookie traceAsyncCallbackStarting([Keep] ExecutionContext*, int operationId);
472
473    [Debugger, Inline=FastReturn]
474    void traceAsyncCallbackCompleted(const InspectorInstrumentationCookie&);
475}
476
477interface InspectorConsoleInstrumentation {
478
479#include "core/inspector/ScriptArguments.h"
480
481class ConsoleMessage;
482
483    [Console, Debugger]
484    void addMessageToConsole(ExecutionContext* context, ConsoleMessage* consoleMessage);
485
486    [Timeline]
487    void consoleTime([Keep] ExecutionContext* context, const String& title);
488
489    [Timeline]
490    void consoleTimeEnd([Keep] ExecutionContext* context, const String& title, ScriptState* state);
491
492    [Timeline, Inline=FastReturn]
493    void consoleTimeStamp([Keep] ExecutionContext* context, const String& title);
494
495    [Console, Inline=FastReturn]
496    void consoleTimeline([Keep] ExecutionContext* context, const String& title, ScriptState* state);
497
498    [Console, Inline=FastReturn]
499    void consoleTimelineEnd([Keep] ExecutionContext* context, const String& title, ScriptState* state);
500
501    [Profiler, Inline=FastReturn]
502    void consoleProfile([Keep] ExecutionContext* context, const String& title);
503
504    [Profiler, Inline=FastReturn]
505    void consoleProfileEnd(ExecutionContext* context, const String& title);
506
507    [Console]
508    void consoleMessagesCleared(ExecutionContext* context);
509}
510
511interface InspectorOverrides {
512    [CSS, Inline=FastReturn]
513    bool forcePseudoState([Keep] Element* element, CSSSelector::PseudoType pseudoState);
514
515    [Worker, Inline=FastReturn]
516    bool shouldPauseDedicatedWorkerOnStart(ExecutionContext* context);
517
518    [Resource, Inline=FastReturn]
519    bool shouldForceCORSPreflight(Document*);
520}
521
522
523interface InspectorCanvasInstrumentation {
524
525#include "bindings/core/v8/ScriptValue.h"
526
527    [Canvas]
528    ScriptValue wrapCanvas2DRenderingContextForInstrumentation(Document*, const ScriptValue&);
529
530    [Canvas]
531    ScriptValue wrapWebGLRenderingContextForInstrumentation(Document*, const ScriptValue&);
532}
533