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