2 * Copyright (C) 2013 Google Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
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
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.
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.
32 * CodeGeneratorInstrumentation.py uses this file as a source to generate
33 * InspectorInstrumentationInl.h and InspectorInstrumentationImpl.cpp
35 * The code below is not a correct IDL but a mix of IDL and C++.
37 * The syntax for an instrumentation method is as follows:
39 * [methodAttributes] returnValue methodName([paramAttr1] param1, [paramAttr2] param2, ...)
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.
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.
55 * returnValue: C++ return value. Only "void" and "InspectorInstrumentationCookie" are supported.
57 * methodName: C++ name for the public instrumentation method and agents methods.
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.
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.
66 interface InspectorInstrumentation {
68 #include "core/dom/PseudoElement.h"
70 [Page, Inspector, PageDebugger, PageRuntime]
71 void didClearDocumentOfWindowObject([Keep] LocalFrame*);
73 [DOMDebugger, Inline=FastReturn]
74 void willCloseWindow(ExecutionContext*);
76 [DOMDebugger, Inline=FastReturn]
77 void willInsertDOMNode([Keep] Node* parent);
79 [DOM, DOMDebugger, Inline=FastReturn]
80 void didInsertDOMNode([Keep] Node*);
82 [DOMDebugger, DOM, Inline=FastReturn]
83 void willRemoveDOMNode([Keep] Node*);
85 [DOMDebugger, DOM, Inline=FastReturn]
86 void willModifyDOMAttr([Keep] Element*, const AtomicString& oldValue, const AtomicString& newValue);
88 [DOM, Inline=FastReturn]
89 void didModifyDOMAttr([Keep] Element*, const AtomicString& name, const AtomicString& value);
91 [DOM, Inline=FastReturn]
92 void didRemoveDOMAttr([Keep] Element*, const AtomicString& name);
94 [DOM, Inline=FastReturn]
95 void characterDataModified([Keep] CharacterData*);
97 [DOM, DOMDebugger, Inline=FastReturn]
98 void didInvalidateStyleAttr([Keep] Node*);
101 void documentDetached([Keep] Document*);
103 [CSS, Inline=FastReturn]
104 void willMutateRules(CSSStyleSheet*);
106 [CSS, Inline=FastReturn]
107 void didMutateRules([Keep] CSSStyleSheet*);
109 [CSS, Inline=FastReturn]
110 void willMutateStyle(CSSStyleDeclaration*);
112 [CSS, Inline=FastReturn]
113 void didMutateStyle([Keep] CSSStyleDeclaration*, bool);
115 [CSS, Inline=FastReturn]
116 void activeStyleSheetsUpdated([Keep] Document*);
118 [Console, PageRuntime]
119 void frameWindowDiscarded(LocalFrame*, LocalDOMWindow* domWindow);
121 [CSS, Inline=FastReturn]
122 void mediaQueryResultChanged(Document*);
124 [DOM, Inline=FastReturn]
125 void didPushShadowRoot([Keep] Element* host, ShadowRoot*);
127 [DOM, Inline=FastReturn]
128 void willPopShadowRoot([Keep] Element* host, ShadowRoot*);
130 [DOMDebugger, Inline=FastReturn]
131 void willSendXMLHttpRequest(ExecutionContext*, const String& url);
133 [DOMDebugger, Inline=FastReturn]
134 void didFireWebGLError(Element*, const String& errorName);
136 [DOMDebugger, Inline=FastReturn]
137 void didFireWebGLWarning(Element*);
139 [DOMDebugger, Inline=FastReturn]
140 void didFireWebGLErrorOrWarning(Element*, const String& message);
142 [DOMDebugger, Debugger, Timeline, Inline=FastReturn]
143 void didInstallTimer([Keep] ExecutionContext*, int timerId, int timeout, bool singleShot);
145 [DOMDebugger, Debugger, Timeline, Inline=FastReturn]
146 void didRemoveTimer([Keep] ExecutionContext*, int timerId);
148 [Timeline, Inline=FastReturn]
149 InspectorInstrumentationCookie willCallFunction([Keep] ExecutionContext*, int scriptId, const String& scriptName, int scriptLine);
151 [Timeline, Inline=FastReturn]
152 void didCallFunction(const InspectorInstrumentationCookie&);
154 [Timeline, Inline=FastReturn]
155 InspectorInstrumentationCookie willDispatchXHRReadyStateChangeEvent([Keep] ExecutionContext*, XMLHttpRequest*);
157 [Timeline, Inline=FastReturn]
158 void didDispatchXHRReadyStateChangeEvent(const InspectorInstrumentationCookie&);
160 [Timeline, Inline=FastReturn]
161 InspectorInstrumentationCookie willDispatchEvent([Keep] Document*, const Event&, LocalDOMWindow*, Node*, const EventPath&);
163 [Timeline, Inline=FastReturn]
164 void didDispatchEvent(const InspectorInstrumentationCookie&);
166 [Debugger, Inline=FastReturn]
167 void didEnqueueEvent([Keep] EventTarget*, Event*);
169 [Debugger, Inline=FastReturn]
170 void didRemoveEvent([Keep] EventTarget*, Event*);
172 [Debugger, DOMDebugger, Inline=FastReturn]
173 InspectorInstrumentationCookie willHandleEvent([Keep] EventTarget*, Event*, EventListener* listener, bool useCapture);
175 [Debugger, Inline=FastReturn]
176 void didHandleEvent(const InspectorInstrumentationCookie&);
178 [Timeline, Inline=FastReturn]
179 InspectorInstrumentationCookie willDispatchEventOnWindow(LocalFrame*, const Event&, LocalDOMWindow*);
181 [Timeline, Inline=FastReturn]
182 void didDispatchEventOnWindow(const InspectorInstrumentationCookie&);
184 [Debugger, Inline=FastReturn]
185 void didEnqueueMutationRecord([Keep] ExecutionContext*, MutationObserver*);
187 [Debugger, Inline=FastReturn]
188 void didClearAllMutationRecords([Keep] ExecutionContext*, MutationObserver*);
190 [Debugger, Inline=FastReturn]
191 void willDeliverMutationRecords([Keep] ExecutionContext*, MutationObserver*);
193 [Debugger, Inline=FastReturn]
194 void didDeliverMutationRecords(ExecutionContext*);
196 [Debugger, Inline=FastReturn]
197 void didPostExecutionContextTask([Keep] ExecutionContext*, ExecutionContextTask*);
199 [Debugger, Inline=FastReturn]
200 void didKillAllExecutionContextTasks([Keep] ExecutionContext*);
202 [Debugger, Inline=FastReturn]
203 void willPerformExecutionContextTask([Keep] ExecutionContext*, ExecutionContextTask*);
205 [Debugger, Inline=FastReturn]
206 void didPerformExecutionContextTask(ExecutionContext*);
208 [Timeline, Inline=FastReturn]
209 InspectorInstrumentationCookie willEvaluateScript([Keep] LocalFrame*, const String& url, int lineNumber);
211 [Timeline, Inline=FastReturn]
212 void didEvaluateScript(const InspectorInstrumentationCookie&);
214 [PageRuntime, Inline=FastReturn]
215 void didCreateIsolatedContext([Keep] LocalFrame*, ScriptState*, SecurityOrigin*);
217 [DOMDebugger, Debugger, Timeline, Inline=FastReturn]
218 InspectorInstrumentationCookie willFireTimer([Keep] ExecutionContext*, int timerId);
220 [Debugger, Timeline, Inline=FastReturn]
221 void didFireTimer(const InspectorInstrumentationCookie&);
223 [Timeline, Inline=FastReturn]
224 void didInvalidateLayout([Keep] LocalFrame*);
226 [Timeline, Inline=FastReturn]
227 InspectorInstrumentationCookie willLayout([Keep] LocalFrame*);
229 [Timeline, Page, Inline=FastReturn]
230 void didLayout(const InspectorInstrumentationCookie&, RenderObject* root);
232 [Page, Inline=FastReturn]
233 void didScroll(Page*);
235 [Page, Inline=FastReturn]
236 void didResizeMainFrame(Page*);
238 [Timeline, Inline=FastReturn]
239 InspectorInstrumentationCookie willDispatchXHRLoadEvent([Keep] ExecutionContext*, XMLHttpRequest*);
241 [Timeline, Inline=FastReturn]
242 void didDispatchXHRLoadEvent(const InspectorInstrumentationCookie&);
244 [Debugger, Inline=FastReturn]
245 void didDispatchXHRLoadendEvent(ExecutionContext*, XMLHttpRequest*);
247 [Timeline, Inline=FastReturn]
248 void willScrollLayer([Keep] RenderObject*);
250 [Timeline, Inline=FastReturn]
251 void didScrollLayer(RenderObject*);
253 [Timeline, Inline=FastReturn]
254 void willPaint([Keep] RenderObject*, const GraphicsLayer*);
256 [Timeline, Page, LayerTree, Inline=FastReturn]
257 void didPaint([Keep] RenderObject*, const GraphicsLayer*, GraphicsContext*, const LayoutRect&);
259 [Timeline, Inline=FastReturn]
260 void willPaintImage([Keep] RenderImage*);
262 [Timeline, Inline=FastReturn]
263 void didPaintImage(RenderImage*);
265 [Resource, Timeline, Inline=FastReturn]
266 InspectorInstrumentationCookie willRecalculateStyle([Keep] Document*);
268 [Timeline, Resource, Page, Inline=FastReturn]
269 void didRecalculateStyle(const InspectorInstrumentationCookie&, int elementCount);
271 [Timeline, Resource, Inline=FastReturn]
272 void didScheduleStyleRecalculation([Keep] Document*);
274 [Resource, Inline=FastReturn]
275 void applyUserAgentOverride(LocalFrame*, String* userAgent);
277 [Page, Inline=FastReturn]
278 bool applyViewportStyleOverride(Document*, StyleResolver*);
280 [Page, Inline=FastReturn]
281 void applyEmulatedMedia(LocalFrame*, String* media);
284 void willSendRequest(LocalFrame*, unsigned long identifier, DocumentLoader*, ResourceRequest&, const ResourceResponse& redirectResponse, const FetchInitiatorInfo&);
287 void markResourceAsCached(Page*, unsigned long identifier);
289 [Timeline, Resource, Console] // Console should come AFTER Resource notification, front-end relies on this.
290 void didReceiveResourceResponse([Keep] LocalFrame*, unsigned long identifier, DocumentLoader*, const ResourceResponse&, ResourceLoader*);
293 void continueAfterXFrameOptionsDenied(LocalFrame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceResponse& r);
296 void continueWithPolicyIgnore(LocalFrame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceResponse& r);
298 [Timeline, Resource, Inline=FastReturn]
299 void didReceiveData([Keep] LocalFrame*, unsigned long identifier, const char* data, int dataLength, int encodedDataLength);
302 void didFinishLoading(LocalFrame* frame, unsigned long identifier, DocumentLoader*, double finishTime, int64_t encodedDataLength);
305 void didReceiveCORSRedirectResponse([Keep] LocalFrame*, unsigned long identifier, DocumentLoader*, const ResourceResponse&, ResourceLoader*);
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&);
311 void documentThreadableLoaderStartedLoadingForClient(ExecutionContext*, unsigned long identifier, ThreadableLoaderClient* client);
314 void willLoadXHR(ExecutionContext*, XMLHttpRequest* xhr, ThreadableLoaderClient* client, const AtomicString& method, const KURL& url, bool async, PassRefPtr<FormData>, const HTTPHeaderMap& headers, bool includeCredentials);
317 void didFailXHRLoading(ExecutionContext*, XMLHttpRequest* xhr, ThreadableLoaderClient* client);
320 void didFinishXHRLoading(ExecutionContext*, XMLHttpRequest* xhr, ThreadableLoaderClient* client, unsigned long identifier, ScriptString sourceString, const AtomicString& method, const String& url, const String& sendURL, unsigned sendLineNumber);
323 void scriptImported(ExecutionContext*, unsigned long identifier, const String& sourceString);
326 void scriptExecutionBlockedByCSP(ExecutionContext*, const String& directiveText);
329 void didReceiveScriptResponse(ExecutionContext*, unsigned long identifier);
331 [Timeline, Inspector, DOM, Page]
332 void domContentLoadedEventFired([Keep] LocalFrame*);
335 void loadEventFired([Keep] LocalFrame*);
338 void frameAttachedToParent([Keep] LocalFrame*);
341 void frameDetachedFromParent([Keep] LocalFrame*);
343 [Console, Resource, DOM, Canvas, Page, PageDebugger]
344 void didCommitLoad([Keep] LocalFrame*, DocumentLoader*);
346 [DOM, Inline=FastReturn]
347 void frameDocumentUpdated([Keep] LocalFrame*);
350 void loaderDetachedFromFrame(LocalFrame*, DocumentLoader*);
353 void frameStartedLoading([Keep] LocalFrame*);
356 void frameStoppedLoading([Keep] LocalFrame*);
359 void frameScheduledNavigation([Keep] LocalFrame*, double delay);
362 void frameClearedScheduledNavigation([Keep] LocalFrame*);
364 [Page, Inline=FastReturn]
365 InspectorInstrumentationCookie willRunJavaScriptDialog(Page*, const String& message);
367 [Page, Inline=FastReturn]
368 void didRunJavaScriptDialog(const InspectorInstrumentationCookie&);
371 void willDestroyResource(Resource* cachedResource);
373 [Timeline, Inline=FastReturn]
374 InspectorInstrumentationCookie willWriteHTML([Keep] Document*, unsigned startLine);
376 [Timeline, Inline=FastReturn]
377 void didWriteHTML(const InspectorInstrumentationCookie&, unsigned endLine);
379 [DOMDebugger, Debugger, Timeline]
380 void didRequestAnimationFrame([Keep] Document*, int callbackId);
382 [DOMDebugger, Debugger, Timeline]
383 void didCancelAnimationFrame([Keep] Document*, int callbackId);
385 [DOMDebugger, Debugger, Timeline]
386 InspectorInstrumentationCookie willFireAnimationFrame([Keep] Document*, int callbackId);
388 [Timeline, Debugger, Inline=FastReturn]
389 void didFireAnimationFrame(const InspectorInstrumentationCookie&);
391 [DOMStorage, Inline=FastReturn]
392 void didDispatchDOMStorageEvent(Page* page, const String& key, const String& oldValue, const String& newValue, StorageType storageType, SecurityOrigin* securityOrigin);
395 void didStartWorkerGlobalScope(ExecutionContext*, WorkerGlobalScopeProxy* proxy, const KURL& url);
398 void willEvaluateWorkerScript([Keep] WorkerGlobalScope* context, int workerThreadStartMode);
401 void workerGlobalScopeTerminated(ExecutionContext*, WorkerGlobalScopeProxy* proxy);
404 void willProcessTask(WorkerGlobalScope* context);
407 void didProcessTask(WorkerGlobalScope* context);
410 void willEnterNestedRunLoop(WorkerGlobalScope* context);
413 void didLeaveNestedRunLoop(WorkerGlobalScope* context);
416 void didCreateWebSocket([Keep] Document*, unsigned long identifier, const KURL& requestURL, const String& protocol);
419 void willSendWebSocketHandshakeRequest([Keep] Document*, unsigned long identifier, const WebSocketHandshakeRequest* request);
422 void didReceiveWebSocketHandshakeResponse([Keep] Document*, unsigned long identifier, const WebSocketHandshakeRequest* request, const WebSocketHandshakeResponse* response);
425 void didCloseWebSocket([Keep] Document*, unsigned long identifier);
428 void didReceiveWebSocketFrame(Document*, unsigned long identifier, int opCode, bool masked, const char* payload, size_t payloadLength);
431 void didSendWebSocketFrame(Document*, unsigned long identifier, int opCode, bool masked, const char* payload, size_t payloadLength);
434 void didReceiveWebSocketFrameError(Document*, unsigned long identifier, const String& errorMessage);
436 [ApplicationCache, Inline=FastReturn]
437 void networkStateChanged(Page*, bool online);
439 [ApplicationCache, Inline=FastReturn]
440 void updateApplicationCacheStatus([Keep] LocalFrame*);
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*);
449 [DOM, Inline=FastReturn]
450 void pseudoElementCreated([Keep] PseudoElement*);
452 [DOM, Inline=FastReturn]
453 void pseudoElementDestroyed([Keep] PseudoElement*);
455 [DOMDebugger, Inline=FastReturn]
456 void willExecuteCustomElementCallback([Keep] Element*);
458 [Debugger, Inline=FastReturn]
459 int traceAsyncOperationStarting([Keep] ExecutionContext*, const String& operationName);
461 [Debugger, Inline=FastReturn]
462 int traceAsyncOperationStarting([Keep] ExecutionContext*, const String& operationName, int prevOperationId);
464 [Debugger, Inline=FastReturn]
465 void traceAsyncOperationCompleted([Keep] ExecutionContext*, int operationId);
467 [Debugger, Inline=FastReturn]
468 InspectorInstrumentationCookie traceAsyncOperationCompletedCallbackStarting([Keep] ExecutionContext*, int operationId);
470 [Debugger, Inline=FastReturn]
471 InspectorInstrumentationCookie traceAsyncCallbackStarting([Keep] ExecutionContext*, int operationId);
473 [Debugger, Inline=FastReturn]
474 void traceAsyncCallbackCompleted(const InspectorInstrumentationCookie&);
477 interface InspectorConsoleInstrumentation {
479 #include "core/inspector/ScriptArguments.h"
481 class ConsoleMessage;
483 // Use the same implementation as above as a similar method dispatched on Page.
485 void addMessageToConsole(ExecutionContext* context, ConsoleMessage* consoleMessage);
488 void addConsoleAPIMessageToConsole(ExecutionContext* context, MessageType type, MessageLevel level, const String& message, ScriptState* state, PassRefPtrWillBeRawPtr<ScriptArguments> arguments, unsigned long requestIdentifier = 0);
491 void consoleCount(ExecutionContext* context, ScriptState* state, PassRefPtrWillBeRawPtr<ScriptArguments> arguments);
494 void consoleTime([Keep] ExecutionContext* context, const String& title);
497 void consoleTimeEnd([Keep] ExecutionContext* context, const String& title, ScriptState* state);
499 [Timeline, Inline=FastReturn]
500 void consoleTimeStamp([Keep] ExecutionContext* context, const String& title);
502 [Console, Inline=FastReturn]
503 void consoleTimeline([Keep] ExecutionContext* context, const String& title, ScriptState* state);
505 [Console, Inline=FastReturn]
506 void consoleTimelineEnd([Keep] ExecutionContext* context, const String& title, ScriptState* state);
508 [Profiler, Inline=FastReturn]
509 void consoleProfile([Keep] ExecutionContext* context, const String& title);
511 [Profiler, Inline=FastReturn]
512 void consoleProfileEnd(ExecutionContext* context, const String& title);
514 //FIXME: remove when we move console message storage from InspectorConsoleAgent to FrameConsole
516 void adoptWorkerConsoleMessages(ExecutionContext* context, WorkerGlobalScopeProxy* proxy);
519 interface InspectorOverrides {
520 [CSS, Inline=FastReturn]
521 bool forcePseudoState([Keep] Element* element, CSSSelector::PseudoType pseudoState);
523 [Worker, Inline=FastReturn]
524 bool shouldPauseDedicatedWorkerOnStart(ExecutionContext* context);
528 interface InspectorCanvasInstrumentation {
530 #include "bindings/core/v8/ScriptValue.h"
533 ScriptValue wrapCanvas2DRenderingContextForInstrumentation(Document*, const ScriptValue&);
536 ScriptValue wrapWebGLRenderingContextForInstrumentation(Document*, const ScriptValue&);