ecc57a2a97bf6b85acee206597343c255c8a5778
[WebKit-https.git] / Source / WebCore / inspector / InspectorInstrumentation.cpp
1 /*
2 * Copyright (C) 2011 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 #include "config.h"
32 #include "InspectorInstrumentation.h"
33
34 #if ENABLE(INSPECTOR)
35
36 #include "DOMWindow.h"
37 #include "Database.h"
38 #include "DocumentLoader.h"
39 #include "Event.h"
40 #include "EventContext.h"
41 #include "InspectorAgent.h"
42 #include "InspectorApplicationCacheAgent.h"
43 #include "InspectorDOMDebuggerAgent.h"
44 #include "InspectorCSSAgent.h"
45 #include "InspectorConsoleAgent.h"
46 #include "InspectorDatabaseAgent.h"
47 #include "InspectorDOMAgent.h"
48 #include "InspectorDOMStorageAgent.h"
49 #include "InspectorDebuggerAgent.h"
50 #include "InspectorPageAgent.h"
51 #include "InspectorProfilerAgent.h"
52 #include "InspectorResourceAgent.h"
53 #include "InspectorTimelineAgent.h"
54 #include "InspectorWorkerAgent.h"
55 #include "InstrumentingAgents.h"
56 #include "ScriptArguments.h"
57 #include "ScriptCallStack.h"
58 #include "ScriptProfile.h"
59 #include "XMLHttpRequest.h"
60 #include <wtf/StdLibExtras.h>
61 #include <wtf/text/CString.h>
62
63 namespace WebCore {
64
65 static const char* const listenerEventCategoryType = "listener";
66 static const char* const instrumentationEventCategoryType = "instrumentation";
67
68 static const char* const setTimerEventName = "setTimer";
69 static const char* const clearTimerEventName = "clearTimer";
70 static const char* const timerFiredEventName = "timerFired";
71
72 int InspectorInstrumentation::s_frontendCounter = 0;
73
74 static bool eventHasListeners(const AtomicString& eventType, DOMWindow* window, Node* node, const Vector<EventContext>& ancestors)
75 {
76     if (window && window->hasEventListeners(eventType))
77         return true;
78
79     if (node->hasEventListeners(eventType))
80         return true;
81
82     for (size_t i = 0; i < ancestors.size(); i++) {
83         Node* ancestor = ancestors[i].node();
84         if (ancestor->hasEventListeners(eventType))
85             return true;
86     }
87
88     return false;
89 }
90
91 void InspectorInstrumentation::didClearWindowObjectInWorldImpl(InstrumentingAgents* instrumentingAgents, Frame* frame, DOMWrapperWorld* world)
92 {
93     if (InspectorPageAgent* pageAgent = instrumentingAgents->inspectorPageAgent())
94         pageAgent->didClearWindowObjectInWorld(frame, world);
95     if (InspectorAgent* inspectorAgent = instrumentingAgents->inspectorAgent())
96         inspectorAgent->didClearWindowObjectInWorld(frame, world);
97 }
98
99 void InspectorInstrumentation::inspectedPageDestroyedImpl(InstrumentingAgents* instrumentingAgents)
100 {
101     if (InspectorAgent* inspectorAgent = instrumentingAgents->inspectorAgent())
102         inspectorAgent->inspectedPageDestroyed();
103 }
104
105 void InspectorInstrumentation::willInsertDOMNodeImpl(InstrumentingAgents* instrumentingAgents, Node* node, Node* parent)
106 {
107 #if ENABLE(JAVASCRIPT_DEBUGGER)
108     if (InspectorDOMDebuggerAgent* domDebuggerAgent = instrumentingAgents->inspectorDOMDebuggerAgent())
109         domDebuggerAgent->willInsertDOMNode(node, parent);
110 #endif
111 }
112
113 void InspectorInstrumentation::didInsertDOMNodeImpl(InstrumentingAgents* instrumentingAgents, Node* node)
114 {
115     if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent())
116         domAgent->didInsertDOMNode(node);
117 #if ENABLE(JAVASCRIPT_DEBUGGER)
118     if (InspectorDOMDebuggerAgent* domDebuggerAgent = instrumentingAgents->inspectorDOMDebuggerAgent())
119         domDebuggerAgent->didInsertDOMNode(node);
120 #endif
121 }
122
123 void InspectorInstrumentation::willRemoveDOMNodeImpl(InstrumentingAgents* instrumentingAgents, Node* node)
124 {
125 #if ENABLE(JAVASCRIPT_DEBUGGER)
126     if (InspectorDOMDebuggerAgent* domDebuggerAgent = instrumentingAgents->inspectorDOMDebuggerAgent())
127         domDebuggerAgent->willRemoveDOMNode(node);
128 #endif
129 }
130
131 void InspectorInstrumentation::didRemoveDOMNodeImpl(InstrumentingAgents* instrumentingAgents, Node* node)
132 {
133 #if ENABLE(JAVASCRIPT_DEBUGGER)
134     if (InspectorDOMDebuggerAgent* domDebuggerAgent = instrumentingAgents->inspectorDOMDebuggerAgent())
135         domDebuggerAgent->didRemoveDOMNode(node);
136 #endif
137     if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent())
138         domAgent->didRemoveDOMNode(node);
139 }
140
141 void InspectorInstrumentation::willModifyDOMAttrImpl(InstrumentingAgents* instrumentingAgents, Element* element)
142 {
143 #if ENABLE(JAVASCRIPT_DEBUGGER)
144     if (InspectorDOMDebuggerAgent* domDebuggerAgent = instrumentingAgents->inspectorDOMDebuggerAgent())
145         domDebuggerAgent->willModifyDOMAttr(element);
146 #endif
147 }
148
149 void InspectorInstrumentation::didModifyDOMAttrImpl(InstrumentingAgents* instrumentingAgents, Element* element)
150 {
151     if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent())
152         domAgent->didModifyDOMAttr(element);
153 }
154
155 void InspectorInstrumentation::didInvalidateStyleAttrImpl(InstrumentingAgents* instrumentingAgents, Node* node)
156 {
157     if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent())
158         domAgent->didInvalidateStyleAttr(node);
159 #if ENABLE(JAVASCRIPT_DEBUGGER)
160     if (InspectorDOMDebuggerAgent* domDebuggerAgent = instrumentingAgents->inspectorDOMDebuggerAgent())
161         domDebuggerAgent->didInvalidateStyleAttr(node);
162 #endif
163 }
164
165 void InspectorInstrumentation::frameWindowDiscardedImpl(InstrumentingAgents* instrumentingAgents, DOMWindow* window)
166 {
167     if (InspectorConsoleAgent* consoleAgent = instrumentingAgents->inspectorConsoleAgent())
168         consoleAgent->frameWindowDiscarded(window);
169 }
170
171 void InspectorInstrumentation::mouseDidMoveOverElementImpl(InstrumentingAgents* instrumentingAgents, const HitTestResult& result, unsigned modifierFlags)
172 {
173     if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent())
174         domAgent->mouseDidMoveOverElement(result, modifierFlags);
175 }
176
177 bool InspectorInstrumentation::handleMousePressImpl(InstrumentingAgents* instrumentingAgents)
178 {
179     if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent())
180         return domAgent->handleMousePress();
181     return false;
182 }
183
184 bool InspectorInstrumentation::forcePseudoStateImpl(InstrumentingAgents* instrumentingAgents, Element* element, CSSSelector::PseudoType pseudoState)
185 {
186     if (InspectorCSSAgent* cssAgent = instrumentingAgents->inspectorCSSAgent())
187         return cssAgent->forcePseudoState(element, pseudoState);
188     return false;
189 }
190
191 void InspectorInstrumentation::characterDataModifiedImpl(InstrumentingAgents* instrumentingAgents, CharacterData* characterData)
192 {
193     if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent())
194         domAgent->characterDataModified(characterData);
195 }
196
197 void InspectorInstrumentation::willSendXMLHttpRequestImpl(InstrumentingAgents* instrumentingAgents, const String& url)
198 {
199 #if ENABLE(JAVASCRIPT_DEBUGGER)
200     if (InspectorDOMDebuggerAgent* domDebuggerAgent = instrumentingAgents->inspectorDOMDebuggerAgent())
201         domDebuggerAgent->willSendXMLHttpRequest(url);
202 #endif
203 }
204
205 void InspectorInstrumentation::didScheduleResourceRequestImpl(InstrumentingAgents* instrumentingAgents, const String& url)
206 {
207     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
208         timelineAgent->didScheduleResourceRequest(url);
209 }
210
211 void InspectorInstrumentation::didInstallTimerImpl(InstrumentingAgents* instrumentingAgents, int timerId, int timeout, bool singleShot)
212 {
213     pauseOnNativeEventIfNeeded(instrumentingAgents, instrumentationEventCategoryType, setTimerEventName, true);
214     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
215         timelineAgent->didInstallTimer(timerId, timeout, singleShot);
216 }
217
218 void InspectorInstrumentation::didRemoveTimerImpl(InstrumentingAgents* instrumentingAgents, int timerId)
219 {
220     pauseOnNativeEventIfNeeded(instrumentingAgents, instrumentationEventCategoryType, clearTimerEventName, true);
221     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
222         timelineAgent->didRemoveTimer(timerId);
223 }
224
225 InspectorInstrumentationCookie InspectorInstrumentation::willCallFunctionImpl(InstrumentingAgents* instrumentingAgents, const String& scriptName, int scriptLine)
226 {
227 #if USE(JSC) // It is disabled for JSC see WK-BUG 40119
228     return InspectorInstrumentationCookie();
229 #else
230     int timelineAgentId = 0;
231     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent()) {
232         timelineAgent->willCallFunction(scriptName, scriptLine);
233         timelineAgentId = timelineAgent->id();
234     }
235     return InspectorInstrumentationCookie(instrumentingAgents, timelineAgentId);
236 #endif
237 }
238
239 void InspectorInstrumentation::didCallFunctionImpl(const InspectorInstrumentationCookie& cookie)
240 {
241     if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
242         timelineAgent->didCallFunction();
243 }
244
245 InspectorInstrumentationCookie InspectorInstrumentation::willChangeXHRReadyStateImpl(InstrumentingAgents* instrumentingAgents, XMLHttpRequest* request)
246 {
247     int timelineAgentId = 0;
248     InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent();
249     if (timelineAgent && request->hasEventListeners(eventNames().readystatechangeEvent)) {
250         timelineAgent->willChangeXHRReadyState(request->url().string(), request->readyState());
251         timelineAgentId = timelineAgent->id();
252     }
253     return InspectorInstrumentationCookie(instrumentingAgents, timelineAgentId);
254 }
255
256 void InspectorInstrumentation::didChangeXHRReadyStateImpl(const InspectorInstrumentationCookie& cookie)
257 {
258     if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
259         timelineAgent->didChangeXHRReadyState();
260 }
261
262 InspectorInstrumentationCookie InspectorInstrumentation::willDispatchEventImpl(InstrumentingAgents* instrumentingAgents, const Event& event, DOMWindow* window, Node* node, const Vector<EventContext>& ancestors)
263 {
264     pauseOnNativeEventIfNeeded(instrumentingAgents, listenerEventCategoryType, event.type(), false);
265
266     int timelineAgentId = 0;
267     InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent();
268     if (timelineAgent && eventHasListeners(event.type(), window, node, ancestors)) {
269         timelineAgent->willDispatchEvent(event);
270         timelineAgentId = timelineAgent->id();
271     }
272     return InspectorInstrumentationCookie(instrumentingAgents, timelineAgentId);
273 }
274
275 void InspectorInstrumentation::didDispatchEventImpl(const InspectorInstrumentationCookie& cookie)
276 {
277     cancelPauseOnNativeEvent(cookie.first);
278
279     if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
280         timelineAgent->didDispatchEvent();
281 }
282
283 InspectorInstrumentationCookie InspectorInstrumentation::willDispatchEventOnWindowImpl(InstrumentingAgents* instrumentingAgents, const Event& event, DOMWindow* window)
284 {
285     pauseOnNativeEventIfNeeded(instrumentingAgents, listenerEventCategoryType, event.type(), false);
286
287     int timelineAgentId = 0;
288     InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent();
289     if (timelineAgent && window->hasEventListeners(event.type())) {
290         timelineAgent->willDispatchEvent(event);
291         timelineAgentId = timelineAgent->id();
292     }
293     return InspectorInstrumentationCookie(instrumentingAgents, timelineAgentId);
294 }
295
296 void InspectorInstrumentation::didDispatchEventOnWindowImpl(const InspectorInstrumentationCookie& cookie)
297 {
298     cancelPauseOnNativeEvent(cookie.first);
299
300     if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
301         timelineAgent->didDispatchEvent();
302 }
303
304 InspectorInstrumentationCookie InspectorInstrumentation::willEvaluateScriptImpl(InstrumentingAgents* instrumentingAgents, const String& url, int lineNumber)
305 {
306     int timelineAgentId = 0;
307     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent()) {
308         timelineAgent->willEvaluateScript(url, lineNumber);
309         timelineAgentId = timelineAgent->id();
310     }
311     return InspectorInstrumentationCookie(instrumentingAgents, timelineAgentId);
312 }
313
314 void InspectorInstrumentation::didEvaluateScriptImpl(const InspectorInstrumentationCookie& cookie)
315 {
316     if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
317         timelineAgent->didEvaluateScript();
318 }
319
320 InspectorInstrumentationCookie InspectorInstrumentation::willFireTimerImpl(InstrumentingAgents* instrumentingAgents, int timerId)
321 {
322     pauseOnNativeEventIfNeeded(instrumentingAgents, instrumentationEventCategoryType, timerFiredEventName, false);
323
324     int timelineAgentId = 0;
325     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent()) {
326         timelineAgent->willFireTimer(timerId);
327         timelineAgentId = timelineAgent->id();
328     }
329     return InspectorInstrumentationCookie(instrumentingAgents, timelineAgentId);
330 }
331
332 void InspectorInstrumentation::didFireTimerImpl(const InspectorInstrumentationCookie& cookie)
333 {
334     cancelPauseOnNativeEvent(cookie.first);
335
336     if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
337         timelineAgent->didFireTimer();
338 }
339
340 InspectorInstrumentationCookie InspectorInstrumentation::willLayoutImpl(InstrumentingAgents* instrumentingAgents)
341 {
342     int timelineAgentId = 0;
343     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent()) {
344         timelineAgent->willLayout();
345         timelineAgentId = timelineAgent->id();
346     }
347     return InspectorInstrumentationCookie(instrumentingAgents, timelineAgentId);
348 }
349
350 void InspectorInstrumentation::didLayoutImpl(const InspectorInstrumentationCookie& cookie)
351 {
352     if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
353         timelineAgent->didLayout();
354 }
355
356 InspectorInstrumentationCookie InspectorInstrumentation::willLoadXHRImpl(InstrumentingAgents* instrumentingAgents, XMLHttpRequest* request)
357 {
358     int timelineAgentId = 0;
359     InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent();
360     if (timelineAgent && request->hasEventListeners(eventNames().loadEvent)) {
361         timelineAgent->willLoadXHR(request->url());
362         timelineAgentId = timelineAgent->id();
363     }
364     return InspectorInstrumentationCookie(instrumentingAgents, timelineAgentId);
365 }
366
367 void InspectorInstrumentation::didLoadXHRImpl(const InspectorInstrumentationCookie& cookie)
368 {
369     if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
370         timelineAgent->didLoadXHR();
371 }
372
373 InspectorInstrumentationCookie InspectorInstrumentation::willPaintImpl(InstrumentingAgents* instrumentingAgents, const LayoutRect& rect)
374 {
375     int timelineAgentId = 0;
376     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent()) {
377         timelineAgent->willPaint(rect);
378         timelineAgentId = timelineAgent->id();
379     }
380     return InspectorInstrumentationCookie(instrumentingAgents, timelineAgentId);
381 }
382
383 void InspectorInstrumentation::didPaintImpl(const InspectorInstrumentationCookie& cookie)
384 {
385     if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
386         timelineAgent->didPaint();
387 }
388
389 InspectorInstrumentationCookie InspectorInstrumentation::willRecalculateStyleImpl(InstrumentingAgents* instrumentingAgents)
390 {
391     int timelineAgentId = 0;
392     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent()) {
393         timelineAgent->willRecalculateStyle();
394         timelineAgentId = timelineAgent->id();
395     }
396     if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
397         resourceAgent->willRecalculateStyle();
398     return InspectorInstrumentationCookie(instrumentingAgents, timelineAgentId);
399 }
400
401 void InspectorInstrumentation::didRecalculateStyleImpl(const InspectorInstrumentationCookie& cookie)
402 {
403     if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
404         timelineAgent->didRecalculateStyle();
405     InstrumentingAgents* instrumentingAgents = cookie.first;
406     if (!instrumentingAgents)
407         return;
408     if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
409         resourceAgent->didRecalculateStyle();
410 }
411
412 void InspectorInstrumentation::didScheduleStyleRecalculationImpl(InstrumentingAgents* instrumentingAgents, Document* document)
413 {
414     if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
415         resourceAgent->didScheduleStyleRecalculation(document);
416 }
417
418 void InspectorInstrumentation::applyUserAgentOverrideImpl(InstrumentingAgents* instrumentingAgents, String* userAgent)
419 {
420     if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
421         resourceAgent->applyUserAgentOverride(userAgent);
422 }
423
424 void InspectorInstrumentation::willSendRequestImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, DocumentLoader* loader, ResourceRequest& request, const ResourceResponse& redirectResponse)
425 {
426     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
427         timelineAgent->willSendResourceRequest(identifier, request);
428     if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
429         resourceAgent->willSendRequest(identifier, loader, request, redirectResponse);
430 }
431
432 void InspectorInstrumentation::continueAfterPingLoaderImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, DocumentLoader* loader, ResourceRequest& request, const ResourceResponse& response)
433 {
434     willSendRequestImpl(instrumentingAgents, identifier, loader, request, response);
435 }
436
437 void InspectorInstrumentation::markResourceAsCachedImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier)
438 {
439     if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
440         resourceAgent->markResourceAsCached(identifier);
441 }
442
443 void InspectorInstrumentation::didLoadResourceFromMemoryCacheImpl(InstrumentingAgents* instrumentingAgents, DocumentLoader* loader, CachedResource* cachedResource)
444 {
445     InspectorAgent* inspectorAgent = instrumentingAgents->inspectorAgent();
446     if (!inspectorAgent || !inspectorAgent->enabled())
447         return;
448     if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
449         resourceAgent->didLoadResourceFromMemoryCache(loader, cachedResource);
450 }
451
452 InspectorInstrumentationCookie InspectorInstrumentation::willReceiveResourceDataImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier)
453 {
454     int timelineAgentId = 0;
455     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent()) {
456         timelineAgent->willReceiveResourceData(identifier);
457         timelineAgentId = timelineAgent->id();
458     }
459     return InspectorInstrumentationCookie(instrumentingAgents, timelineAgentId);
460 }
461
462 void InspectorInstrumentation::didReceiveResourceDataImpl(const InspectorInstrumentationCookie& cookie)
463 {
464     if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
465         timelineAgent->didReceiveResourceData();
466 }
467
468 InspectorInstrumentationCookie InspectorInstrumentation::willReceiveResourceResponseImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, const ResourceResponse& response)
469 {
470     int timelineAgentId = 0;
471     InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent();
472     if (timelineAgent) {
473         timelineAgent->willReceiveResourceResponse(identifier, response);
474         timelineAgentId = timelineAgent->id();
475     }
476     return InspectorInstrumentationCookie(instrumentingAgents, timelineAgentId);
477 }
478
479 void InspectorInstrumentation::didReceiveResourceResponseImpl(const InspectorInstrumentationCookie& cookie, unsigned long identifier, DocumentLoader* loader, const ResourceResponse& response)
480 {
481     if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
482         timelineAgent->didReceiveResourceResponse();
483     if (!loader)
484         return;
485     InstrumentingAgents* instrumentingAgents = cookie.first;
486     if (!instrumentingAgents)
487         return;
488     if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
489         resourceAgent->didReceiveResponse(identifier, loader, response);
490     if (InspectorConsoleAgent* consoleAgent = instrumentingAgents->inspectorConsoleAgent())
491         consoleAgent->didReceiveResponse(identifier, response); // This should come AFTER resource notification, front-end relies on this.
492 }
493
494 void InspectorInstrumentation::didReceiveResourceResponseButCanceledImpl(Frame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceResponse& r)
495 {
496     InspectorInstrumentationCookie cookie = InspectorInstrumentation::willReceiveResourceResponse(frame, identifier, r);
497     InspectorInstrumentation::didReceiveResourceResponse(cookie, identifier, loader, r);
498 }
499
500 void InspectorInstrumentation::continueAfterXFrameOptionsDeniedImpl(Frame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceResponse& r)
501 {
502     didReceiveResourceResponseButCanceledImpl(frame, loader, identifier, r);
503 }
504
505 void InspectorInstrumentation::continueWithPolicyDownloadImpl(Frame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceResponse& r)
506 {
507     didReceiveResourceResponseButCanceledImpl(frame, loader, identifier, r);
508 }
509
510 void InspectorInstrumentation::continueWithPolicyIgnoreImpl(Frame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceResponse& r)
511 {
512     didReceiveResourceResponseButCanceledImpl(frame, loader, identifier, r);
513 }
514
515 void InspectorInstrumentation::didReceiveDataImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, const char* data, int dataLength, int encodedDataLength)
516 {
517     if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
518         resourceAgent->didReceiveData(identifier, data, dataLength, encodedDataLength);
519 }
520
521 void InspectorInstrumentation::didFinishLoadingImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, DocumentLoader* loader, double finishTime)
522 {
523     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
524         timelineAgent->didFinishLoadingResource(identifier, false, finishTime);
525     if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
526         resourceAgent->didFinishLoading(identifier, loader, finishTime);
527 }
528
529 void InspectorInstrumentation::didFailLoadingImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, DocumentLoader* loader, const ResourceError& error)
530 {
531     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
532         timelineAgent->didFinishLoadingResource(identifier, true, 0);
533     if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
534         resourceAgent->didFailLoading(identifier, loader, error);
535     if (InspectorConsoleAgent* consoleAgent = instrumentingAgents->inspectorConsoleAgent())
536         consoleAgent->didFailLoading(identifier, error); // This should come AFTER resource notification, front-end relies on this.
537 }
538
539 void InspectorInstrumentation::resourceRetrievedByXMLHttpRequestImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber)
540 {
541     if (InspectorConsoleAgent* consoleAgent = instrumentingAgents->inspectorConsoleAgent())
542         consoleAgent->resourceRetrievedByXMLHttpRequest(url, sendURL, sendLineNumber);
543     if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
544         resourceAgent->setInitialXHRContent(identifier, sourceString);
545 }
546
547 void InspectorInstrumentation::didReceiveXHRResponseImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier)
548 {
549     if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
550         resourceAgent->didReceiveXHRResponse(identifier);
551 }
552
553 void InspectorInstrumentation::willLoadXHRSynchronouslyImpl(InstrumentingAgents* instrumentingAgents)
554 {
555     if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
556         resourceAgent->willLoadXHRSynchronously();
557 }
558
559 void InspectorInstrumentation::didLoadXHRSynchronouslyImpl(InstrumentingAgents* instrumentingAgents)
560 {
561     if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
562         resourceAgent->didLoadXHRSynchronously();
563 }
564
565 void InspectorInstrumentation::scriptImportedImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, const String& sourceString)
566 {
567     if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
568         resourceAgent->setInitialScriptContent(identifier, sourceString);
569 }
570
571 void InspectorInstrumentation::didReceiveScriptResponseImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier)
572 {
573     if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
574         resourceAgent->didReceiveScriptResponse(identifier);
575 }
576
577 void InspectorInstrumentation::domContentLoadedEventFiredImpl(InstrumentingAgents* instrumentingAgents, Frame* frame)
578 {
579     if (frame->page()->mainFrame() != frame)
580         return;
581
582     if (InspectorAgent* inspectorAgent = instrumentingAgents->inspectorAgent())
583         inspectorAgent->domContentLoadedEventFired();
584
585     if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent())
586         domAgent->mainFrameDOMContentLoaded();
587
588     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
589         timelineAgent->didMarkDOMContentEvent();
590
591     if (InspectorPageAgent* pageAgent = instrumentingAgents->inspectorPageAgent())
592         pageAgent->domContentEventFired();
593 }
594
595 void InspectorInstrumentation::loadEventFiredImpl(InstrumentingAgents* instrumentingAgents, Frame* frame)
596 {
597     if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent())
598         domAgent->loadEventFired(frame->document());
599
600     if (frame->page()->mainFrame() != frame)
601         return;
602
603     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
604         timelineAgent->didMarkLoadEvent();
605
606     if (InspectorPageAgent* pageAgent = instrumentingAgents->inspectorPageAgent())
607         pageAgent->loadEventFired();
608 }
609
610 void InspectorInstrumentation::frameDetachedFromParentImpl(InstrumentingAgents* instrumentingAgents, Frame* frame)
611 {
612     if (InspectorPageAgent* pageAgent = instrumentingAgents->inspectorPageAgent())
613         pageAgent->frameDetached(frame);
614 }
615
616 void InspectorInstrumentation::didCommitLoadImpl(InstrumentingAgents* instrumentingAgents, Page* page, DocumentLoader* loader)
617 {
618     InspectorAgent* inspectorAgent = instrumentingAgents->inspectorAgent();
619     if (!inspectorAgent || !inspectorAgent->enabled())
620         return;
621
622     Frame* mainFrame = page->mainFrame();
623     if (loader->frame() == mainFrame) {
624         if (InspectorConsoleAgent* consoleAgent = instrumentingAgents->inspectorConsoleAgent())
625             consoleAgent->reset();
626
627         if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
628             resourceAgent->mainFrameNavigated(loader);
629
630 #if ENABLE(JAVASCRIPT_DEBUGGER)
631         if (InspectorDebuggerAgent* debuggerAgent = instrumentingAgents->inspectorDebuggerAgent()) {
632             KURL url = inspectorAgent->inspectedURLWithoutFragment();
633             debuggerAgent->inspectedURLChanged(url);
634         }
635 #endif
636 #if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
637         if (InspectorProfilerAgent* profilerAgent = instrumentingAgents->inspectorProfilerAgent()) {
638             profilerAgent->stopUserInitiatedProfiling(true);
639             profilerAgent->resetState();
640         }
641 #endif
642         if (InspectorCSSAgent* cssAgent = instrumentingAgents->inspectorCSSAgent())
643             cssAgent->reset();
644 #if ENABLE(SQL_DATABASE)
645         if (InspectorDatabaseAgent* databaseAgent = instrumentingAgents->inspectorDatabaseAgent())
646             databaseAgent->clearResources();
647 #endif
648 #if ENABLE(DOM_STORAGE)
649         if (InspectorDOMStorageAgent* domStorageAgent = instrumentingAgents->inspectorDOMStorageAgent())
650             domStorageAgent->clearResources();
651 #endif
652         if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent())
653             domAgent->setDocument(mainFrame->document());
654
655         inspectorAgent->didCommitLoad();
656     }
657     if (InspectorPageAgent* pageAgent = instrumentingAgents->inspectorPageAgent())
658         pageAgent->frameNavigated(loader);
659 }
660
661 void InspectorInstrumentation::loaderDetachedFromFrameImpl(InstrumentingAgents* instrumentingAgents, DocumentLoader* loader)
662 {
663     if (InspectorPageAgent* inspectorPageAgent = instrumentingAgents->inspectorPageAgent())
664         inspectorPageAgent->loaderDetachedFromFrame(loader);
665 }
666
667 InspectorInstrumentationCookie InspectorInstrumentation::willWriteHTMLImpl(InstrumentingAgents* instrumentingAgents, unsigned int length, unsigned int startLine)
668 {
669     int timelineAgentId = 0;
670     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent()) {
671         timelineAgent->willWriteHTML(length, startLine);
672         timelineAgentId = timelineAgent->id();
673     }
674     return InspectorInstrumentationCookie(instrumentingAgents, timelineAgentId);
675 }
676
677 void InspectorInstrumentation::didWriteHTMLImpl(const InspectorInstrumentationCookie& cookie, unsigned int endLine)
678 {
679     if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
680         timelineAgent->didWriteHTML(endLine);
681 }
682
683 void InspectorInstrumentation::addMessageToConsoleImpl(InstrumentingAgents* instrumentingAgents, MessageSource source, MessageType type, MessageLevel level, const String& message, PassRefPtr<ScriptArguments> arguments, PassRefPtr<ScriptCallStack> callStack)
684 {
685     if (InspectorConsoleAgent* consoleAgent = instrumentingAgents->inspectorConsoleAgent())
686         consoleAgent->addMessageToConsole(source, type, level, message, arguments, callStack);
687 }
688
689 void InspectorInstrumentation::addMessageToConsoleImpl(InstrumentingAgents* instrumentingAgents, MessageSource source, MessageType type, MessageLevel level, const String& message, unsigned lineNumber, const String& scriptId)
690 {
691     if (InspectorConsoleAgent* consoleAgent = instrumentingAgents->inspectorConsoleAgent())
692         consoleAgent->addMessageToConsole(source, type, level, message, lineNumber, scriptId);
693 }
694
695 void InspectorInstrumentation::consoleCountImpl(InstrumentingAgents* instrumentingAgents, PassRefPtr<ScriptArguments> arguments, PassRefPtr<ScriptCallStack> stack)
696 {
697     if (InspectorConsoleAgent* consoleAgent = instrumentingAgents->inspectorConsoleAgent())
698         consoleAgent->count(arguments, stack);
699 }
700
701 void InspectorInstrumentation::startConsoleTimingImpl(InstrumentingAgents* instrumentingAgents, const String& title)
702 {
703     if (InspectorConsoleAgent* consoleAgent = instrumentingAgents->inspectorConsoleAgent())
704         consoleAgent->startTiming(title);
705 }
706
707 void InspectorInstrumentation::stopConsoleTimingImpl(InstrumentingAgents* instrumentingAgents, const String& title, PassRefPtr<ScriptCallStack> stack)
708 {
709     if (InspectorConsoleAgent* consoleAgent = instrumentingAgents->inspectorConsoleAgent())
710         consoleAgent->stopTiming(title, stack);
711 }
712
713 void InspectorInstrumentation::consoleTimeStampImpl(InstrumentingAgents* instrumentingAgents, PassRefPtr<ScriptArguments> arguments)
714 {
715     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent()) {
716         String message;
717         arguments->getFirstArgumentAsString(message);
718         timelineAgent->didTimeStamp(message);
719      }
720 }
721
722 #if ENABLE(JAVASCRIPT_DEBUGGER)
723 void InspectorInstrumentation::addStartProfilingMessageToConsoleImpl(InstrumentingAgents* instrumentingAgents, const String& title, unsigned lineNumber, const String& sourceURL)
724 {
725     if (InspectorProfilerAgent* profilerAgent = instrumentingAgents->inspectorProfilerAgent())
726         profilerAgent->addStartProfilingMessageToConsole(title, lineNumber, sourceURL);
727 }
728
729 void InspectorInstrumentation::addProfileImpl(InstrumentingAgents* instrumentingAgents, RefPtr<ScriptProfile> profile, PassRefPtr<ScriptCallStack> callStack)
730 {
731     if (InspectorProfilerAgent* profilerAgent = instrumentingAgents->inspectorProfilerAgent()) {
732         const ScriptCallFrame& lastCaller = callStack->at(0);
733         profilerAgent->addProfile(profile, lastCaller.lineNumber(), lastCaller.sourceURL());
734     }
735 }
736
737 String InspectorInstrumentation::getCurrentUserInitiatedProfileNameImpl(InstrumentingAgents* instrumentingAgents, bool incrementProfileNumber)
738 {
739     if (InspectorProfilerAgent* profilerAgent = instrumentingAgents->inspectorProfilerAgent())
740         return profilerAgent->getCurrentUserInitiatedProfileName(incrementProfileNumber);
741     return "";
742 }
743
744 bool InspectorInstrumentation::profilerEnabledImpl(InstrumentingAgents* instrumentingAgents)
745 {
746     if (InspectorProfilerAgent* profilerAgent = instrumentingAgents->inspectorProfilerAgent())
747         return profilerAgent->enabled();
748     return false;
749 }
750 #endif
751
752 #if ENABLE(SQL_DATABASE)
753 void InspectorInstrumentation::didOpenDatabaseImpl(InstrumentingAgents* instrumentingAgents, PassRefPtr<Database> database, const String& domain, const String& name, const String& version)
754 {
755     InspectorAgent* inspectorAgent = instrumentingAgents->inspectorAgent();
756     if (!inspectorAgent || !inspectorAgent->enabled())
757         return;
758     if (InspectorDatabaseAgent* dbAgent = instrumentingAgents->inspectorDatabaseAgent())
759         dbAgent->didOpenDatabase(database, domain, name, version);
760 }
761 #endif
762
763 #if ENABLE(DOM_STORAGE)
764 void InspectorInstrumentation::didUseDOMStorageImpl(InstrumentingAgents* instrumentingAgents, StorageArea* storageArea, bool isLocalStorage, Frame* frame)
765 {
766     InspectorAgent* inspectorAgent = instrumentingAgents->inspectorAgent();
767     if (!inspectorAgent || !inspectorAgent->enabled())
768         return;
769     if (InspectorDOMStorageAgent* domStorageAgent = instrumentingAgents->inspectorDOMStorageAgent())
770         domStorageAgent->didUseDOMStorage(storageArea, isLocalStorage, frame);
771 }
772 #endif
773
774 #if ENABLE(WORKERS)
775 void InspectorInstrumentation::didStartWorkerContextImpl(InstrumentingAgents* instrumentingAgents, WorkerContextProxy* workerContextProxy, const KURL& url)
776 {
777     if (InspectorWorkerAgent* workerAgent = instrumentingAgents->inspectorWorkerAgent())
778         workerAgent->didStartWorkerContext(workerContextProxy, url);
779 }
780
781 void InspectorInstrumentation::didCreateWorkerImpl(InstrumentingAgents* instrumentingAgents, intptr_t id, const String& url, bool isSharedWorker)
782 {
783     if (InspectorAgent* inspectorAgent = instrumentingAgents->inspectorAgent())
784         inspectorAgent->didCreateWorker(id, url, isSharedWorker);
785 }
786
787 void InspectorInstrumentation::didDestroyWorkerImpl(InstrumentingAgents* instrumentingAgents, intptr_t id)
788 {
789     if (InspectorAgent* inspectorAgent = instrumentingAgents->inspectorAgent())
790         inspectorAgent->didDestroyWorker(id);
791 }
792
793 void InspectorInstrumentation::workerContextTerminatedImpl(InstrumentingAgents* instrumentingAgents, WorkerContextProxy* proxy)
794 {
795     if (InspectorWorkerAgent* workerAgent = instrumentingAgents->inspectorWorkerAgent())
796         workerAgent->workerContextTerminated(proxy);
797 }
798 #endif
799
800 #if ENABLE(WEB_SOCKETS)
801 void InspectorInstrumentation::didCreateWebSocketImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, const KURL& requestURL, const KURL&)
802 {
803     InspectorAgent* inspectorAgent = instrumentingAgents->inspectorAgent();
804     if (!inspectorAgent || !inspectorAgent->enabled())
805         return;
806     if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
807         resourceAgent->didCreateWebSocket(identifier, requestURL);
808 }
809
810 void InspectorInstrumentation::willSendWebSocketHandshakeRequestImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, const WebSocketHandshakeRequest& request)
811 {
812     if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
813         resourceAgent->willSendWebSocketHandshakeRequest(identifier, request);
814 }
815
816 void InspectorInstrumentation::didReceiveWebSocketHandshakeResponseImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, const WebSocketHandshakeResponse& response)
817 {
818     if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
819         resourceAgent->didReceiveWebSocketHandshakeResponse(identifier, response);
820 }
821
822 void InspectorInstrumentation::didCloseWebSocketImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier)
823 {
824     if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
825         resourceAgent->didCloseWebSocket(identifier);
826 }
827 #endif
828
829 void InspectorInstrumentation::networkStateChangedImpl(InstrumentingAgents* instrumentingAgents)
830 {
831     if (InspectorApplicationCacheAgent* applicationCacheAgent = instrumentingAgents->inspectorApplicationCacheAgent())
832         applicationCacheAgent->networkStateChanged();
833 }
834
835 void InspectorInstrumentation::updateApplicationCacheStatusImpl(InstrumentingAgents* instrumentingAgents, Frame* frame)
836 {
837     if (InspectorApplicationCacheAgent* applicationCacheAgent = instrumentingAgents->inspectorApplicationCacheAgent())
838         applicationCacheAgent->updateApplicationCacheStatus(frame);
839 }
840
841 bool InspectorInstrumentation::collectingHTMLParseErrors(InstrumentingAgents* instrumentingAgents)
842 {
843     if (InspectorAgent* inspectorAgent = instrumentingAgents->inspectorAgent())
844         return inspectorAgent->hasFrontend();
845     return false;
846 }
847
848 void InspectorInstrumentation::pauseOnNativeEventIfNeeded(InstrumentingAgents* instrumentingAgents, const String& categoryType, const String& eventName, bool synchronous)
849 {
850 #if ENABLE(JAVASCRIPT_DEBUGGER)
851     if (InspectorDOMDebuggerAgent* domDebuggerAgent = instrumentingAgents->inspectorDOMDebuggerAgent())
852         domDebuggerAgent->pauseOnNativeEventIfNeeded(categoryType, eventName, synchronous);
853 #endif
854 }
855
856 void InspectorInstrumentation::cancelPauseOnNativeEvent(InstrumentingAgents* instrumentingAgents)
857 {
858 #if ENABLE(JAVASCRIPT_DEBUGGER)
859     if (InspectorDebuggerAgent* debuggerAgent = instrumentingAgents->inspectorDebuggerAgent())
860         debuggerAgent->cancelPauseOnNextStatement();
861 #endif
862 }
863
864 void InspectorInstrumentation::didRegisterAnimationFrameCallbackImpl(InstrumentingAgents* instrumentingAgents, int callbackId)
865 {
866     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
867         timelineAgent->didRegisterAnimationFrameCallback(callbackId);
868 }
869
870 void InspectorInstrumentation::didCancelAnimationFrameCallbackImpl(InstrumentingAgents* instrumentingAgents, int callbackId)
871 {
872     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
873         timelineAgent->didCancelAnimationFrameCallback(callbackId);
874 }
875
876 InspectorInstrumentationCookie InspectorInstrumentation::willFireAnimationFrameEventImpl(InstrumentingAgents* instrumentingAgents, int callbackId)
877 {
878     int timelineAgentId = 0;
879     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent()) {
880         timelineAgent->willFireAnimationFrameEvent(callbackId);
881         timelineAgentId = timelineAgent->id();
882     }
883     return InspectorInstrumentationCookie(instrumentingAgents, timelineAgentId);
884 }
885
886 void InspectorInstrumentation::didFireAnimationFrameEventImpl(const InspectorInstrumentationCookie& cookie)
887 {
888     if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
889         timelineAgent->didFireAnimationFrameEvent();
890 }
891
892 InspectorTimelineAgent* InspectorInstrumentation::retrieveTimelineAgent(const InspectorInstrumentationCookie& cookie)
893 {
894     if (!cookie.first)
895         return 0;
896     InspectorTimelineAgent* timelineAgent = cookie.first->inspectorTimelineAgent();
897     if (timelineAgent && timelineAgent->id() == cookie.second)
898         return timelineAgent;
899     return 0;
900 }
901
902 InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForPage(Page* page)
903 {
904     if (!page)
905         return 0;
906     return instrumentationForPage(page);
907 }
908
909 } // namespace WebCore
910
911 #endif // !ENABLE(INSPECTOR)