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 66 interface 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 willInsertDOMNode([Keep] Node* parent); 75 76 [DOM, DOMDebugger, Inline=FastReturn] 77 void didInsertDOMNode([Keep] Node*); 78 79 [DOMDebugger, DOM, Inline=FastReturn] 80 void willRemoveDOMNode([Keep] Node*); 81 82 [DOMDebugger, DOM, Inline=FastReturn] 83 void willModifyDOMAttr([Keep] Element*, const AtomicString& oldValue, const AtomicString& newValue); 84 85 [DOM, Inline=FastReturn] 86 void didModifyDOMAttr([Keep] Element*, const AtomicString& name, const AtomicString& value); 87 88 [DOM, Inline=FastReturn] 89 void didRemoveDOMAttr([Keep] Element*, const AtomicString& name); 90 91 [DOM, Inline=FastReturn] 92 void characterDataModified([Keep] CharacterData*); 93 94 [DOM, DOMDebugger, Inline=FastReturn] 95 void didInvalidateStyleAttr([Keep] Node*); 96 97 [CSS] 98 void documentDetached([Keep] Document*); 99 100 [CSS, Inline=FastReturn] 101 void willMutateRules(CSSStyleSheet*); 102 103 [CSS, Inline=FastReturn] 104 void didMutateRules([Keep] CSSStyleSheet*); 105 106 [CSS, Inline=FastReturn] 107 void willMutateStyle(CSSStyleDeclaration*); 108 109 [CSS, Inline=FastReturn] 110 void didMutateStyle([Keep] CSSStyleDeclaration*, bool); 111 112 [CSS, Inline=FastReturn] 113 void activeStyleSheetsUpdated([Keep] Document*); 114 115 [Console, PageRuntime] 116 void frameWindowDiscarded(LocalFrame*, LocalDOMWindow* domWindow); 117 118 [CSS, Inline=FastReturn] 119 void mediaQueryResultChanged(Document*); 120 121 [DOM, Inline=FastReturn] 122 void didPushShadowRoot([Keep] Element* host, ShadowRoot*); 123 124 [DOM, Inline=FastReturn] 125 void willPopShadowRoot([Keep] Element* host, ShadowRoot*); 126 127 [DOMDebugger, Inline=FastReturn] 128 void willSendXMLHttpRequest(ExecutionContext*, const String& url); 129 130 [DOMDebugger, Inline=FastReturn] 131 void didFireWebGLError(Element*, const String& errorName); 132 133 [DOMDebugger, Inline=FastReturn] 134 void didFireWebGLWarning(Element*); 135 136 [DOMDebugger, Inline=FastReturn] 137 void didFireWebGLErrorOrWarning(Element*, const String& message); 138 139 [DOMDebugger, Debugger, Timeline, Inline=FastReturn] 140 void didInstallTimer([Keep] ExecutionContext*, int timerId, int timeout, bool singleShot); 141 142 [DOMDebugger, Debugger, Timeline, Inline=FastReturn] 143 void didRemoveTimer([Keep] ExecutionContext*, int timerId); 144 145 [Timeline, Inline=FastReturn] 146 InspectorInstrumentationCookie willCallFunction([Keep] ExecutionContext*, int scriptId, const String& scriptName, int scriptLine); 147 148 [Timeline, Inline=FastReturn] 149 void didCallFunction(const InspectorInstrumentationCookie&); 150 151 [Timeline, Inline=FastReturn] 152 InspectorInstrumentationCookie willDispatchXHRReadyStateChangeEvent([Keep] ExecutionContext*, XMLHttpRequest*); 153 154 [Timeline, Inline=FastReturn] 155 void didDispatchXHRReadyStateChangeEvent(const InspectorInstrumentationCookie&); 156 157 [Timeline, Inline=FastReturn] 158 InspectorInstrumentationCookie willDispatchEvent([Keep] Document*, const Event&, LocalDOMWindow*, Node*, const EventPath&); 159 160 [Timeline, Inline=FastReturn] 161 void didDispatchEvent(const InspectorInstrumentationCookie&); 162 163 [Debugger, Inline=FastReturn] 164 void didEnqueueEvent([Keep] EventTarget*, Event*); 165 166 [Debugger, Inline=FastReturn] 167 void didRemoveEvent([Keep] EventTarget*, Event*); 168 169 [Debugger, DOMDebugger, Inline=FastReturn] 170 InspectorInstrumentationCookie willHandleEvent([Keep] EventTarget*, Event*, EventListener* listener, bool useCapture); 171 172 [Debugger, Inline=FastReturn] 173 void didHandleEvent(const InspectorInstrumentationCookie&); 174 175 [Timeline, Inline=FastReturn] 176 InspectorInstrumentationCookie willDispatchEventOnWindow(LocalFrame*, const Event&, LocalDOMWindow*); 177 178 [Timeline, Inline=FastReturn] 179 void didDispatchEventOnWindow(const InspectorInstrumentationCookie&); 180 181 [Debugger, Inline=FastReturn] 182 void didEnqueueMutationRecord([Keep] ExecutionContext*, MutationObserver*); 183 184 [Debugger, Inline=FastReturn] 185 void didClearAllMutationRecords([Keep] ExecutionContext*, MutationObserver*); 186 187 [Debugger, Inline=FastReturn] 188 void willDeliverMutationRecords([Keep] ExecutionContext*, MutationObserver*); 189 190 [Debugger, Inline=FastReturn] 191 void didDeliverMutationRecords(ExecutionContext*); 192 193 [Timeline, Inline=FastReturn] 194 InspectorInstrumentationCookie willEvaluateScript([Keep] LocalFrame*, const String& url, int lineNumber); 195 196 [Timeline, Inline=FastReturn] 197 void didEvaluateScript(const InspectorInstrumentationCookie&); 198 199 [PageRuntime, Inline=FastReturn] 200 void didCreateIsolatedContext([Keep] LocalFrame*, ScriptState*, SecurityOrigin*); 201 202 [DOMDebugger, Debugger, Timeline, Inline=FastReturn] 203 InspectorInstrumentationCookie willFireTimer([Keep] ExecutionContext*, int timerId); 204 205 [Debugger, Timeline, Inline=FastReturn] 206 void didFireTimer(const InspectorInstrumentationCookie&); 207 208 [Timeline, Inline=FastReturn] 209 void didInvalidateLayout([Keep] LocalFrame*); 210 211 [Timeline, Inline=FastReturn] 212 InspectorInstrumentationCookie willLayout([Keep] LocalFrame*); 213 214 [Timeline, Page, Inline=FastReturn] 215 void didLayout(const InspectorInstrumentationCookie&, RenderObject* root); 216 217 [Page, Inline=FastReturn] 218 void didScroll(Page*); 219 220 [Page, Inline=FastReturn] 221 void didResizeMainFrame(Page*); 222 223 [Timeline, Inline=FastReturn] 224 InspectorInstrumentationCookie willDispatchXHRLoadEvent([Keep] ExecutionContext*, XMLHttpRequest*); 225 226 [Timeline, Inline=FastReturn] 227 void didDispatchXHRLoadEvent(const InspectorInstrumentationCookie&); 228 229 [Timeline, Inline=FastReturn] 230 void willScrollLayer([Keep] RenderObject*); 231 232 [Timeline, Inline=FastReturn] 233 void didScrollLayer(RenderObject*); 234 235 [Timeline, Inline=FastReturn] 236 void willPaint([Keep] RenderObject*, const GraphicsLayer*); 237 238 [Timeline, Page, LayerTree, Inline=FastReturn] 239 void didPaint([Keep] RenderObject*, const GraphicsLayer*, GraphicsContext*, const LayoutRect&); 240 241 [Timeline, Inline=FastReturn] 242 void willPaintImage([Keep] RenderImage*); 243 244 [Timeline, Inline=FastReturn] 245 void didPaintImage(RenderImage*); 246 247 [Resource, Timeline, Inline=FastReturn] 248 InspectorInstrumentationCookie willRecalculateStyle([Keep] Document*); 249 250 [Timeline, Resource, Page, Inline=FastReturn] 251 void didRecalculateStyle(const InspectorInstrumentationCookie&, int elementCount); 252 253 [Timeline, Resource, Inline=FastReturn] 254 void didScheduleStyleRecalculation([Keep] Document*); 255 256 [Resource, Inline=FastReturn] 257 void applyUserAgentOverride(LocalFrame*, String* userAgent); 258 259 [Page, Inline=FastReturn] 260 bool applyViewportStyleOverride(Document*, StyleResolver*); 261 262 [Page, Inline=FastReturn] 263 void applyEmulatedMedia(LocalFrame*, String* media); 264 265 [Timeline, Resource] 266 void willSendRequest(LocalFrame*, unsigned long identifier, DocumentLoader*, ResourceRequest&, const ResourceResponse& redirectResponse, const FetchInitiatorInfo&); 267 268 [Resource] 269 void markResourceAsCached(Page*, unsigned long identifier); 270 271 [Timeline, Resource, Console] // Console should come AFTER Resource notification, front-end relies on this. 272 void didReceiveResourceResponse([Keep] LocalFrame*, unsigned long identifier, DocumentLoader*, const ResourceResponse&, ResourceLoader*); 273 274 [Inline=Forward] 275 void continueAfterXFrameOptionsDenied(LocalFrame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceResponse& r); 276 277 [Inline=Forward] 278 void continueWithPolicyDownload(LocalFrame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceResponse& r); 279 280 [Inline=Forward] 281 void continueWithPolicyIgnore(LocalFrame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceResponse& r); 282 283 [Timeline, Resource, Inline=FastReturn] 284 void didReceiveData([Keep] LocalFrame*, unsigned long identifier, const char* data, int dataLength, int encodedDataLength); 285 286 [Timeline, Resource] 287 void didFinishLoading(LocalFrame* frame, unsigned long identifier, DocumentLoader*, double finishTime, int64_t encodedDataLength); 288 289 [Resource] 290 void didReceiveCORSRedirectResponse([Keep] LocalFrame*, unsigned long identifier, DocumentLoader*, const ResourceResponse&, ResourceLoader*); 291 292 [Timeline, Resource, Console] // Console should come AFTER Resource notification, front-end relies on this. 293 void didFailLoading(LocalFrame* frame, unsigned long identifier, const ResourceError&); 294 295 [Resource] 296 void documentThreadableLoaderStartedLoadingForClient(ExecutionContext*, unsigned long identifier, ThreadableLoaderClient* client); 297 298 [Debugger, Resource] 299 void willLoadXHR(ExecutionContext*, XMLHttpRequest* xhr, ThreadableLoaderClient* client, const AtomicString& method, const KURL& url, bool async, PassRefPtr<FormData>, const HTTPHeaderMap& headers, bool includeCredentials); 300 301 [Resource] 302 void didFailXHRLoading(ExecutionContext*, XMLHttpRequest* xhr, ThreadableLoaderClient* client); 303 304 [Console, Resource] 305 void didFinishXHRLoading(ExecutionContext*, XMLHttpRequest* xhr, ThreadableLoaderClient* client, unsigned long identifier, ScriptString sourceString, const AtomicString& method, const String& url, const String& sendURL, unsigned sendLineNumber); 306 307 [Resource] 308 void scriptImported(ExecutionContext*, unsigned long identifier, const String& sourceString); 309 310 [Debugger] 311 void scriptExecutionBlockedByCSP(ExecutionContext*, const String& directiveText); 312 313 [Resource] 314 void didReceiveScriptResponse(ExecutionContext*, unsigned long identifier); 315 316 [Timeline, Inspector, DOM, Page] 317 void domContentLoadedEventFired([Keep] LocalFrame*); 318 319 [Timeline, Page] 320 void loadEventFired([Keep] LocalFrame*); 321 322 [Page] 323 void frameAttachedToParent([Keep] LocalFrame*); 324 325 [Canvas, Page] 326 void frameDetachedFromParent([Keep] LocalFrame*); 327 328 [Console, Resource, DOM, Canvas, Page, PageDebugger] 329 void didCommitLoad([Keep] LocalFrame*, DocumentLoader*); 330 331 [DOM, Inline=FastReturn] 332 void frameDocumentUpdated([Keep] LocalFrame*); 333 334 [Page] 335 void loaderDetachedFromFrame(LocalFrame*, DocumentLoader*); 336 337 [Page] 338 void frameStartedLoading([Keep] LocalFrame*); 339 340 [Page] 341 void frameStoppedLoading([Keep] LocalFrame*); 342 343 [Page, Resource] 344 void frameScheduledNavigation([Keep] LocalFrame*, double delay); 345 346 [Page, Resource] 347 void frameClearedScheduledNavigation([Keep] LocalFrame*); 348 349 [Page, Inline=FastReturn] 350 InspectorInstrumentationCookie willRunJavaScriptDialog(Page*, const String& message); 351 352 [Page, Inline=FastReturn] 353 void didRunJavaScriptDialog(const InspectorInstrumentationCookie&); 354 355 [Inline=Forward] 356 void willDestroyResource(Resource* cachedResource); 357 358 [Timeline, Inline=FastReturn] 359 InspectorInstrumentationCookie willWriteHTML([Keep] Document*, unsigned startLine); 360 361 [Timeline, Inline=FastReturn] 362 void didWriteHTML(const InspectorInstrumentationCookie&, unsigned endLine); 363 364 [DOMDebugger, Debugger, Timeline] 365 void didRequestAnimationFrame([Keep] Document*, int callbackId); 366 367 [DOMDebugger, Debugger, Timeline] 368 void didCancelAnimationFrame([Keep] Document*, int callbackId); 369 370 [DOMDebugger, Debugger, Timeline] 371 InspectorInstrumentationCookie willFireAnimationFrame([Keep] Document*, int callbackId); 372 373 [Timeline, Debugger, Inline=FastReturn] 374 void didFireAnimationFrame(const InspectorInstrumentationCookie&); 375 376 [DOMStorage, Inline=FastReturn] 377 void didDispatchDOMStorageEvent(Page* page, const String& key, const String& oldValue, const String& newValue, StorageType storageType, SecurityOrigin* securityOrigin); 378 379 [Worker] 380 void didStartWorkerGlobalScope(ExecutionContext*, WorkerGlobalScopeProxy* proxy, const KURL& url); 381 382 [WorkerRuntime] 383 void willEvaluateWorkerScript([Keep] WorkerGlobalScope* context, int workerThreadStartMode); 384 385 [Worker] 386 void workerGlobalScopeTerminated(ExecutionContext*, WorkerGlobalScopeProxy* proxy); 387 388 [Profiler, Timeline] 389 void willProcessTask(WorkerGlobalScope* context); 390 391 [Profiler, Timeline] 392 void didProcessTask(WorkerGlobalScope* context); 393 394 [Profiler] 395 void willEnterNestedRunLoop(WorkerGlobalScope* context); 396 397 [Profiler] 398 void didLeaveNestedRunLoop(WorkerGlobalScope* context); 399 400 [Resource, Timeline] 401 void didCreateWebSocket([Keep] Document*, unsigned long identifier, const KURL& requestURL, const String& protocol); 402 403 [Resource, Timeline] 404 void willSendWebSocketHandshakeRequest([Keep] Document*, unsigned long identifier, const WebSocketHandshakeRequest* request); 405 406 [Resource, Timeline] 407 void didReceiveWebSocketHandshakeResponse([Keep] Document*, unsigned long identifier, const WebSocketHandshakeRequest* request, const WebSocketHandshakeResponse* response); 408 409 [Resource, Timeline] 410 void didCloseWebSocket([Keep] Document*, unsigned long identifier); 411 412 [Resource] 413 void didReceiveWebSocketFrame(Document*, unsigned long identifier, int opCode, bool masked, const char* payload, size_t payloadLength); 414 415 [Resource] 416 void didSendWebSocketFrame(Document*, unsigned long identifier, int opCode, bool masked, const char* payload, size_t payloadLength); 417 418 [Resource] 419 void didReceiveWebSocketFrameError(Document*, unsigned long identifier, const String& errorMessage); 420 421 [ApplicationCache, Inline=FastReturn] 422 void networkStateChanged(Page*, bool online); 423 424 [ApplicationCache, Inline=FastReturn] 425 void updateApplicationCacheStatus([Keep] LocalFrame*); 426 427 [Timeline, Inline=FastReturn] 428 void willUpdateLayerTree(LocalFrame*); 429 [Timeline, LayerTree, Inline=FastReturn] 430 void layerTreeDidChange(LocalFrame*); 431 [Timeline, Inline=FastReturn] 432 void didUpdateLayerTree(LocalFrame*); 433 434 [DOM, Inline=FastReturn] 435 void pseudoElementCreated([Keep] PseudoElement*); 436 437 [DOM, Inline=FastReturn] 438 void pseudoElementDestroyed([Keep] PseudoElement*); 439 440 [DOMDebugger, Inline=FastReturn] 441 void willExecuteCustomElementCallback([Keep] Element*); 442 } 443 444 interface InspectorConsoleInstrumentation { 445 446 #include "core/inspector/ScriptArguments.h" 447 #include "core/inspector/ScriptCallStack.h" 448 449 // FIXME: Convert to ScriptArguments to match non-worker context. 450 // Use the same implementation as above as a similar method dispatched on Page. 451 [Console] 452 void addMessageToConsole(ExecutionContext* context, MessageSource source, MessageType type, MessageLevel level, const String& message, PassRefPtrWillBeRawPtr<ScriptCallStack> callStack, unsigned long requestIdentifier = 0); 453 454 // Use the same implementation as above as a similar method dispatched on Page. 455 [Console] 456 void addMessageToConsole(ExecutionContext* context, MessageSource source, MessageType type, MessageLevel level, const String& message, const String& scriptId, unsigned lineNumber, unsigned columnNumber, ScriptState* state, unsigned long requestIdentifier = 0); 457 458 [Console, Debugger] 459 void addMessageToConsole(ExecutionContext* context, MessageSource source, MessageType type, MessageLevel level, const String& message, ScriptState* state, PassRefPtrWillBeRawPtr<ScriptArguments> arguments, unsigned long requestIdentifier = 0); 460 461 [Console] 462 void consoleCount(ExecutionContext* context, ScriptState* state, PassRefPtrWillBeRawPtr<ScriptArguments> arguments); 463 464 [Timeline, Console] 465 void consoleTime([Keep] ExecutionContext* context, const String& title); 466 467 [Console, Timeline] 468 void consoleTimeEnd([Keep] ExecutionContext* context, const String& title, ScriptState* state); 469 470 [Timeline, Inline=FastReturn] 471 void consoleTimeStamp([Keep] ExecutionContext* context, const String& title); 472 473 [Console, Inline=FastReturn] 474 void consoleTimeline([Keep] ExecutionContext* context, const String& title, ScriptState* state); 475 476 [Console, Inline=FastReturn] 477 void consoleTimelineEnd([Keep] ExecutionContext* context, const String& title, ScriptState* state); 478 479 [Profiler, Inline=FastReturn] 480 void consoleProfile(ExecutionContext* context, const String& title, ScriptState* state); 481 482 [Profiler, Inline=FastReturn] 483 void consoleProfileEnd(ExecutionContext* context, const String& title, ScriptState* state); 484 } 485 486 interface InspectorOverrides { 487 [CSS, Inline=FastReturn] 488 bool forcePseudoState([Keep] Element* element, CSSSelector::PseudoType pseudoState); 489 490 [Worker, Inline=FastReturn] 491 bool shouldPauseDedicatedWorkerOnStart(ExecutionContext* context); 492 } 493 494 495 interface InspectorCanvasInstrumentation { 496 497 #include "bindings/v8/ScriptValue.h" 498 499 [Canvas] 500 ScriptValue wrapCanvas2DRenderingContextForInstrumentation(Document*, const ScriptValue&); 501 502 [Canvas] 503 ScriptValue wrapWebGLRenderingContextForInstrumentation(Document*, const ScriptValue&); 504 } 505