Web Inspector: do not use InspectorInstrumentation::hasFrontends() check when collect...
authorpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 27 Sep 2012 11:18:23 +0000 (11:18 +0000)
committerpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 27 Sep 2012 11:18:23 +0000 (11:18 +0000)
https://bugs.webkit.org/show_bug.cgi?id=96730

Reviewed by Vsevolod Vlasov.

- Introduced InspectorInstrumentation::console|timeline|runtime|canvasAgentEnabled
- Using it all over the place instead of the hasFrontend (the latter is now only used once to guard hot path)
- Introduced explicit "enabled" state of the console and runtime agents

* bindings/js/JSHTMLCanvasElementCustom.cpp:
(WebCore::JSHTMLCanvasElement::getContext):
* bindings/js/JSMainThreadExecState.h:
(WebCore::JSMainThreadExecState::instrumentFunctionCall):
* bindings/js/ScheduledAction.cpp:
(WebCore::ScheduledAction::create):
* bindings/js/ScriptCallStackFactory.cpp:
(WebCore::createScriptCallStackForConsole):
* bindings/js/ScriptCallStackFactory.h:
(WebCore):
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateCallWith):
* bindings/scripts/CodeGeneratorV8.pm:
(GenerateCallWith):
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::jsTestObjWithScriptArgumentsAndCallStackAttribute):
(WebCore::setJSTestObjWithScriptArgumentsAndCallStackAttribute):
(WebCore::jsTestObjPrototypeFunctionWithScriptArgumentsAndCallStack):
* bindings/scripts/test/V8/V8TestObj.cpp:
(WebCore::TestObjV8Internal::withScriptArgumentsAndCallStackAttributeAttrGetter):
(WebCore::TestObjV8Internal::withScriptArgumentsAndCallStackAttributeAttrSetter):
(WebCore::TestObjV8Internal::withScriptArgumentsAndCallStackCallback):
* bindings/v8/ScriptCallStackFactory.cpp:
(WebCore::createScriptCallStackForConsole):
* bindings/v8/ScriptCallStackFactory.h:
(WebCore):
* bindings/v8/ScriptController.cpp:
(WebCore::ScriptController::callFunctionWithInstrumentation):
* bindings/v8/V8DOMWindowShell.cpp:
(WebCore::V8DOMWindowShell::setIsolatedWorldSecurityOrigin):
* bindings/v8/V8WorkerContextEventListener.cpp:
(WebCore::V8WorkerContextEventListener::callListenerFunction):
* bindings/v8/custom/V8DOMWindowCustom.cpp:
(WebCore::WindowSetTimeoutImpl):
* bindings/v8/custom/V8HTMLCanvasElementCustom.cpp:
(WebCore::V8HTMLCanvasElement::getContextCallback):
* bindings/v8/custom/V8WorkerContextCustom.cpp:
(WebCore::SetTimeoutOrInterval):
* inspector/Inspector.json:
* inspector/InspectorConsoleAgent.cpp:
(WebCore):
(WebCore::InspectorConsoleAgent::InspectorConsoleAgent):
(WebCore::InspectorConsoleAgent::enable):
(WebCore::InspectorConsoleAgent::disable):
(WebCore::InspectorConsoleAgent::clearMessages):
(WebCore::InspectorConsoleAgent::clearFrontend):
(WebCore::InspectorConsoleAgent::addConsoleMessage):
* inspector/InspectorConsoleAgent.h:
(WebCore::InspectorConsoleAgent::enabled):
(InspectorConsoleAgent):
* inspector/InspectorController.cpp:
(WebCore::InspectorController::connectFrontend):
(WebCore::InspectorController::disconnectFrontend):
* inspector/InspectorInstrumentation.cpp:
(WebCore):
(WebCore::InspectorInstrumentation::canvasAgentEnabled):
(WebCore::InspectorInstrumentation::consoleAgentEnabled):
(WebCore::InspectorInstrumentation::runtimeAgentEnabled):
(WebCore::InspectorInstrumentation::timelineAgentEnabled):
* inspector/InspectorInstrumentation.h:
(InspectorInstrumentation):
(WebCore::InspectorInstrumentation::canvasAgentEnabled):
(WebCore::InspectorInstrumentation::consoleAgentEnabled):
(WebCore::InspectorInstrumentation::runtimeAgentEnabled):
(WebCore::InspectorInstrumentation::timelineAgentEnabled):
* inspector/InspectorRuntimeAgent.cpp:
(WebCore::InspectorRuntimeAgent::InspectorRuntimeAgent):
* inspector/InspectorRuntimeAgent.h:
(WebCore::InspectorRuntimeAgent::enabled):
(WebCore::InspectorRuntimeAgent::enable):
(WebCore::InspectorRuntimeAgent::disable):
(InspectorRuntimeAgent):
* inspector/PageRuntimeAgent.cpp:
(PageRuntimeAgentState):
(WebCore::PageRuntimeAgent::clearFrontend):
(WebCore::PageRuntimeAgent::restore):
(WebCore):
(WebCore::PageRuntimeAgent::enable):
(WebCore::PageRuntimeAgent::disable):
(WebCore::PageRuntimeAgent::didClearWindowObject):
(WebCore::PageRuntimeAgent::didCreateIsolatedContext):
(WebCore::PageRuntimeAgent::reportExecutionContextCreation):
* inspector/PageRuntimeAgent.h:
(PageRuntimeAgent):
* inspector/WorkerRuntimeAgent.cpp:
* inspector/WorkerRuntimeAgent.h:
* inspector/front-end/RuntimeModel.js:
(WebInspector.RuntimeModel.prototype._didLoadCachedResources):
* page/DOMWindow.cpp:
(WebCore::DOMWindow::postMessage):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@129751 268f45cc-cd09-0410-ab3c-d52691b4dbfc

32 files changed:
Source/WebCore/ChangeLog
Source/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp
Source/WebCore/bindings/js/JSMainThreadExecState.h
Source/WebCore/bindings/js/ScheduledAction.cpp
Source/WebCore/bindings/js/ScriptCallStackFactory.cpp
Source/WebCore/bindings/js/ScriptCallStackFactory.h
Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
Source/WebCore/bindings/scripts/CodeGeneratorV8.pm
Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp
Source/WebCore/bindings/v8/ScriptCallStackFactory.cpp
Source/WebCore/bindings/v8/ScriptCallStackFactory.h
Source/WebCore/bindings/v8/ScriptController.cpp
Source/WebCore/bindings/v8/V8DOMWindowShell.cpp
Source/WebCore/bindings/v8/V8WorkerContextEventListener.cpp
Source/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp
Source/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp
Source/WebCore/bindings/v8/custom/V8WorkerContextCustom.cpp
Source/WebCore/inspector/Inspector.json
Source/WebCore/inspector/InspectorConsoleAgent.cpp
Source/WebCore/inspector/InspectorConsoleAgent.h
Source/WebCore/inspector/InspectorController.cpp
Source/WebCore/inspector/InspectorInstrumentation.cpp
Source/WebCore/inspector/InspectorInstrumentation.h
Source/WebCore/inspector/InspectorRuntimeAgent.cpp
Source/WebCore/inspector/InspectorRuntimeAgent.h
Source/WebCore/inspector/PageRuntimeAgent.cpp
Source/WebCore/inspector/PageRuntimeAgent.h
Source/WebCore/inspector/WorkerRuntimeAgent.cpp
Source/WebCore/inspector/WorkerRuntimeAgent.h
Source/WebCore/inspector/front-end/RuntimeModel.js
Source/WebCore/page/DOMWindow.cpp

index 276c06f..ec6a702 100644 (file)
@@ -1,3 +1,105 @@
+2012-09-27  Pavel Feldman  <pfeldman@chromium.org>
+
+        Web Inspector: do not use InspectorInstrumentation::hasFrontends() check when collecting stacks
+        https://bugs.webkit.org/show_bug.cgi?id=96730
+
+        Reviewed by Vsevolod Vlasov.
+
+        - Introduced InspectorInstrumentation::console|timeline|runtime|canvasAgentEnabled
+        - Using it all over the place instead of the hasFrontend (the latter is now only used once to guard hot path)
+        - Introduced explicit "enabled" state of the console and runtime agents
+
+        * bindings/js/JSHTMLCanvasElementCustom.cpp:
+        (WebCore::JSHTMLCanvasElement::getContext):
+        * bindings/js/JSMainThreadExecState.h:
+        (WebCore::JSMainThreadExecState::instrumentFunctionCall):
+        * bindings/js/ScheduledAction.cpp:
+        (WebCore::ScheduledAction::create):
+        * bindings/js/ScriptCallStackFactory.cpp:
+        (WebCore::createScriptCallStackForConsole):
+        * bindings/js/ScriptCallStackFactory.h:
+        (WebCore):
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GenerateCallWith):
+        * bindings/scripts/CodeGeneratorV8.pm:
+        (GenerateCallWith):
+        * bindings/scripts/test/JS/JSTestObj.cpp:
+        (WebCore::jsTestObjWithScriptArgumentsAndCallStackAttribute):
+        (WebCore::setJSTestObjWithScriptArgumentsAndCallStackAttribute):
+        (WebCore::jsTestObjPrototypeFunctionWithScriptArgumentsAndCallStack):
+        * bindings/scripts/test/V8/V8TestObj.cpp:
+        (WebCore::TestObjV8Internal::withScriptArgumentsAndCallStackAttributeAttrGetter):
+        (WebCore::TestObjV8Internal::withScriptArgumentsAndCallStackAttributeAttrSetter):
+        (WebCore::TestObjV8Internal::withScriptArgumentsAndCallStackCallback):
+        * bindings/v8/ScriptCallStackFactory.cpp:
+        (WebCore::createScriptCallStackForConsole):
+        * bindings/v8/ScriptCallStackFactory.h:
+        (WebCore):
+        * bindings/v8/ScriptController.cpp:
+        (WebCore::ScriptController::callFunctionWithInstrumentation):
+        * bindings/v8/V8DOMWindowShell.cpp:
+        (WebCore::V8DOMWindowShell::setIsolatedWorldSecurityOrigin):
+        * bindings/v8/V8WorkerContextEventListener.cpp:
+        (WebCore::V8WorkerContextEventListener::callListenerFunction):
+        * bindings/v8/custom/V8DOMWindowCustom.cpp:
+        (WebCore::WindowSetTimeoutImpl):
+        * bindings/v8/custom/V8HTMLCanvasElementCustom.cpp:
+        (WebCore::V8HTMLCanvasElement::getContextCallback):
+        * bindings/v8/custom/V8WorkerContextCustom.cpp:
+        (WebCore::SetTimeoutOrInterval):
+        * inspector/Inspector.json:
+        * inspector/InspectorConsoleAgent.cpp:
+        (WebCore):
+        (WebCore::InspectorConsoleAgent::InspectorConsoleAgent):
+        (WebCore::InspectorConsoleAgent::enable):
+        (WebCore::InspectorConsoleAgent::disable):
+        (WebCore::InspectorConsoleAgent::clearMessages):
+        (WebCore::InspectorConsoleAgent::clearFrontend):
+        (WebCore::InspectorConsoleAgent::addConsoleMessage):
+        * inspector/InspectorConsoleAgent.h:
+        (WebCore::InspectorConsoleAgent::enabled):
+        (InspectorConsoleAgent):
+        * inspector/InspectorController.cpp:
+        (WebCore::InspectorController::connectFrontend):
+        (WebCore::InspectorController::disconnectFrontend):
+        * inspector/InspectorInstrumentation.cpp:
+        (WebCore):
+        (WebCore::InspectorInstrumentation::canvasAgentEnabled):
+        (WebCore::InspectorInstrumentation::consoleAgentEnabled):
+        (WebCore::InspectorInstrumentation::runtimeAgentEnabled):
+        (WebCore::InspectorInstrumentation::timelineAgentEnabled):
+        * inspector/InspectorInstrumentation.h:
+        (InspectorInstrumentation):
+        (WebCore::InspectorInstrumentation::canvasAgentEnabled):
+        (WebCore::InspectorInstrumentation::consoleAgentEnabled):
+        (WebCore::InspectorInstrumentation::runtimeAgentEnabled):
+        (WebCore::InspectorInstrumentation::timelineAgentEnabled):
+        * inspector/InspectorRuntimeAgent.cpp:
+        (WebCore::InspectorRuntimeAgent::InspectorRuntimeAgent):
+        * inspector/InspectorRuntimeAgent.h:
+        (WebCore::InspectorRuntimeAgent::enabled):
+        (WebCore::InspectorRuntimeAgent::enable):
+        (WebCore::InspectorRuntimeAgent::disable):
+        (InspectorRuntimeAgent):
+        * inspector/PageRuntimeAgent.cpp:
+        (PageRuntimeAgentState):
+        (WebCore::PageRuntimeAgent::clearFrontend):
+        (WebCore::PageRuntimeAgent::restore):
+        (WebCore):
+        (WebCore::PageRuntimeAgent::enable):
+        (WebCore::PageRuntimeAgent::disable):
+        (WebCore::PageRuntimeAgent::didClearWindowObject):
+        (WebCore::PageRuntimeAgent::didCreateIsolatedContext):
+        (WebCore::PageRuntimeAgent::reportExecutionContextCreation):
+        * inspector/PageRuntimeAgent.h:
+        (PageRuntimeAgent):
+        * inspector/WorkerRuntimeAgent.cpp:
+        * inspector/WorkerRuntimeAgent.h:
+        * inspector/front-end/RuntimeModel.js:
+        (WebInspector.RuntimeModel.prototype._didLoadCachedResources):
+        * page/DOMWindow.cpp:
+        (WebCore::DOMWindow::postMessage):
+
 2012-09-27  Allan Sandfeld Jensen  <allan.jensen@digia.com>
 
         Unify event handling of middle mouse button.
index 72bf386..e59c6b3 100644 (file)
@@ -78,7 +78,7 @@ JSValue JSHTMLCanvasElement::getContext(ExecState* exec)
     if (!context)
         return jsNull();
     JSValue jsValue = toJS(exec, globalObject(), WTF::getPtr(context));
-    if (InspectorInstrumentation::hasFrontends()) {
+    if (InspectorInstrumentation::canvasAgentEnabled(canvas->document())) {
         ScriptObject contextObject(exec, jsValue.getObject());
         ScriptObject wrapped;
         if (context->is2d())
index 109ce8b..297c953 100644 (file)
@@ -58,7 +58,7 @@ public:
 
     static inline InspectorInstrumentationCookie instrumentFunctionCall(ScriptExecutionContext* context, JSC::CallType callType, const JSC::CallData& callData)
     {
-        if (!InspectorInstrumentation::hasFrontends())
+        if (!InspectorInstrumentation::timelineAgentEnabled(context))
             return InspectorInstrumentationCookie();
         String resourceName;
         int lineNumber = 1;
index 7682051..26aa9fb 100644 (file)
@@ -55,7 +55,7 @@ PassOwnPtr<ScheduledAction> ScheduledAction::create(ExecState* exec, DOMWrapperW
     JSValue v = exec->argument(0);
     CallData callData;
     if (getCallData(v, callData) == CallTypeNone) {
-        RefPtr<ScriptCallStack> callStack(createScriptCallStackForInspector(exec));
+        RefPtr<ScriptCallStack> callStack(createScriptCallStackForConsole(exec));
         if (policy && !policy->allowEval(callStack.release()))
             return nullptr;
         String string = v.toString(exec)->value(exec);
index 4faeeed..193f64f 100644 (file)
@@ -104,12 +104,12 @@ PassRefPtr<ScriptCallStack> createScriptCallStack(JSC::ExecState* exec, size_t m
     return ScriptCallStack::create(frames);
 }
 
-PassRefPtr<ScriptCallStack> createScriptCallStackForInspector(JSC::ExecState* exec)
+PassRefPtr<ScriptCallStack> createScriptCallStackForConsole(JSC::ExecState* exec)
 {
     size_t maxStackSize = 1;
     if (InspectorInstrumentation::hasFrontends()) {
         ScriptExecutionContext* scriptExecutionContext = jsCast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->scriptExecutionContext();
-        if (InspectorInstrumentation::hasFrontendForScriptContext(scriptExecutionContext))
+        if (InspectorInstrumentation::consoleAgentEnabled(scriptExecutionContext))
             maxStackSize = ScriptCallStack::maxCallStackSizeToCapture;
     }
     return createScriptCallStack(exec, maxStackSize);
index 689d165..6e94b03 100644 (file)
@@ -44,7 +44,7 @@ class ScriptCallStack;
 
 PassRefPtr<ScriptCallStack> createScriptCallStack(size_t maxStackSize, bool emptyStackIsAllowed);
 PassRefPtr<ScriptCallStack> createScriptCallStack(JSC::ExecState*, size_t maxStackSize);
-PassRefPtr<ScriptCallStack> createScriptCallStackForInspector(JSC::ExecState*);
+PassRefPtr<ScriptCallStack> createScriptCallStackForConsole(JSC::ExecState*);
 PassRefPtr<ScriptArguments> createScriptArguments(JSC::ExecState*, unsigned skipArgumentCount);
 
 } // namespace WebCore
index e3766d3..65914b5 100644 (file)
@@ -2588,7 +2588,7 @@ sub GenerateCallWith
         push(@callWithArgs, "scriptArguments");
     }
     if ($codeGenerator->ExtendedAttributeContains($callWith, "CallStack")) {
-        push(@$outputArray, "    RefPtr<ScriptCallStack> callStack(createScriptCallStackForInspector(exec));\n");
+        push(@$outputArray, "    RefPtr<ScriptCallStack> callStack(createScriptCallStackForConsole(exec));\n");
         $implIncludes{"ScriptCallStack.h"} = 1;
         $implIncludes{"ScriptCallStackFactory.h"} = 1;
         push(@callWithArgs, "callStack");
index 0681056..86d3eb6 100644 (file)
@@ -1608,7 +1608,7 @@ sub GenerateCallWith
         AddToImplIncludes("ScriptArguments.h");
     }
     if ($codeGenerator->ExtendedAttributeContains($callWith, "CallStack")) {
-        push(@$outputArray, $indent . "RefPtr<ScriptCallStack> callStack(createScriptCallStackForInspector());\n");
+        push(@$outputArray, $indent . "RefPtr<ScriptCallStack> callStack(createScriptCallStackForConsole());\n");
         push(@$outputArray, $indent . "if (!callStack)\n");
         push(@$outputArray, $indent . "    return v8Undefined();\n");
         push(@callWithArgs, "callStack");
index 49a2fc7..77d4044 100644 (file)
@@ -769,7 +769,7 @@ JSValue jsTestObjWithScriptExecutionContextAndScriptStateWithSpacesAttribute(Exe
 JSValue jsTestObjWithScriptArgumentsAndCallStackAttribute(ExecState* exec, JSValue slotBase, PropertyName)
 {
     JSTestObj* castedThis = jsCast<JSTestObj*>(asObject(slotBase));
-    RefPtr<ScriptCallStack> callStack(createScriptCallStackForInspector(exec));
+    RefPtr<ScriptCallStack> callStack(createScriptCallStackForConsole(exec));
     TestObj* impl = static_cast<TestObj*>(castedThis->impl());
     JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl->withScriptArgumentsAndCallStackAttribute(callStack)));
     return result;
@@ -1284,7 +1284,7 @@ void setJSTestObjWithScriptArgumentsAndCallStackAttribute(ExecState* exec, JSObj
     UNUSED_PARAM(exec);
     JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
     TestObj* impl = static_cast<TestObj*>(castedThis->impl());
-    RefPtr<ScriptCallStack> callStack(createScriptCallStackForInspector(exec));
+    RefPtr<ScriptCallStack> callStack(createScriptCallStackForConsole(exec));
     impl->setWithScriptArgumentsAndCallStackAttribute(callStack, toTestObj(value));
 }
 
@@ -1846,7 +1846,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptArgumentsAndCal
     ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestObj::s_info);
     TestObj* impl = static_cast<TestObj*>(castedThis->impl());
     RefPtr<ScriptArguments> scriptArguments(createScriptArguments(exec, 0));
-    RefPtr<ScriptCallStack> callStack(createScriptCallStackForInspector(exec));
+    RefPtr<ScriptCallStack> callStack(createScriptCallStackForConsole(exec));
     impl->withScriptArgumentsAndCallStack(scriptArguments, callStack);
     return JSValue::encode(jsUndefined());
 }
index 8390f10..38e6f13 100644 (file)
@@ -695,7 +695,7 @@ static v8::Handle<v8::Value> withScriptArgumentsAndCallStackAttributeAttrGetter(
 {
     INC_STATS("DOM.TestObj.withScriptArgumentsAndCallStackAttribute._get");
     TestObj* imp = V8TestObj::toNative(info.Holder());
-    RefPtr<ScriptCallStack> callStack(createScriptCallStackForInspector());
+    RefPtr<ScriptCallStack> callStack(createScriptCallStackForConsole());
     if (!callStack)
         return v8Undefined();
     return toV8(imp->withScriptArgumentsAndCallStackAttribute(callStack), info.Holder(), info.GetIsolate());
@@ -706,7 +706,7 @@ static void withScriptArgumentsAndCallStackAttributeAttrSetter(v8::Local<v8::Str
     INC_STATS("DOM.TestObj.withScriptArgumentsAndCallStackAttribute._set");
     TestObj* imp = V8TestObj::toNative(info.Holder());
     TestObj* v = V8TestObj::HasInstance(value) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(value)) : 0;
-    RefPtr<ScriptCallStack> callStack(createScriptCallStackForInspector());
+    RefPtr<ScriptCallStack> callStack(createScriptCallStackForConsole());
     if (!callStack)
         return v8Undefined();
     imp->setWithScriptArgumentsAndCallStackAttribute(callStack, WTF::getPtr(v));
@@ -1336,7 +1336,7 @@ static v8::Handle<v8::Value> withScriptArgumentsAndCallStackCallback(const v8::A
     INC_STATS("DOM.TestObj.withScriptArgumentsAndCallStack");
     TestObj* imp = V8TestObj::toNative(args.Holder());
     RefPtr<ScriptArguments> scriptArguments(createScriptArguments(args, 0));
-    RefPtr<ScriptCallStack> callStack(createScriptCallStackForInspector());
+    RefPtr<ScriptCallStack> callStack(createScriptCallStackForConsole());
     if (!callStack)
         return v8Undefined();
     imp->withScriptArgumentsAndCallStack(scriptArguments, callStack);
index 5f32ba2..f56ed33 100644 (file)
@@ -105,12 +105,12 @@ PassRefPtr<ScriptCallStack> createScriptCallStack(size_t maxStackSize, bool empt
     return createScriptCallStack(stackTrace, maxStackSize, emptyStackIsAllowed);
 }
 
-PassRefPtr<ScriptCallStack> createScriptCallStackForInspector()
+PassRefPtr<ScriptCallStack> createScriptCallStackForConsole()
 {
     size_t maxStackSize = 1;
     if (InspectorInstrumentation::hasFrontends()) {
         ScriptExecutionContext* scriptExecutionContext = getScriptExecutionContext();
-        if (InspectorInstrumentation::hasFrontendForScriptContext(scriptExecutionContext))
+        if (InspectorInstrumentation::consoleAgentEnabled(scriptExecutionContext))
             maxStackSize = ScriptCallStack::maxCallStackSizeToCapture;
     }
     return createScriptCallStack(maxStackSize);
index 138fc37..e558e1b 100644 (file)
@@ -48,7 +48,7 @@ const v8::StackTrace::StackTraceOptions stackTraceOptions = static_cast<v8::Stac
 
 PassRefPtr<ScriptCallStack> createScriptCallStack(v8::Handle<v8::StackTrace>, size_t maxStackSize);
 PassRefPtr<ScriptCallStack> createScriptCallStack(size_t maxStackSize, bool emptyStackIsAllowed = false);
-PassRefPtr<ScriptCallStack> createScriptCallStackForInspector();
+PassRefPtr<ScriptCallStack> createScriptCallStackForConsole();
 PassRefPtr<ScriptArguments> createScriptArguments(const v8::Arguments& v8arguments, unsigned skipArgumentCount);
 
 } // namespace WebCore
index 4800ade..2fcaca6 100644 (file)
@@ -221,7 +221,7 @@ v8::Local<v8::Value> ScriptController::callFunctionWithInstrumentation(ScriptExe
         return handleMaxRecursionDepthExceeded();
 
     InspectorInstrumentationCookie cookie;
-    if (InspectorInstrumentation::hasFrontends() && context) {
+    if (InspectorInstrumentation::timelineAgentEnabled(context)) {
         String resourceName;
         int lineNumber;
         resourceInfo(function, resourceName, lineNumber);
index 81ea21a..1936ae8 100644 (file)
@@ -611,7 +611,7 @@ void V8DOMWindowShell::setIsolatedWorldSecurityOrigin(PassRefPtr<SecurityOrigin>
 {
     ASSERT(!m_world->isMainWorld());
     // FIXME: Should this be here?
-    if (!m_isolatedWorldShellSecurityOrigin && !context().IsEmpty() && InspectorInstrumentation::hasFrontends()) {
+    if (!m_isolatedWorldShellSecurityOrigin && !context().IsEmpty() && InspectorInstrumentation::runtimeAgentEnabled(m_frame)) {
         v8::HandleScope handleScope;
         ScriptState* scriptState = ScriptState::forContext(v8::Local<v8::Context>::New(context()));
         InspectorInstrumentation::didCreateIsolatedContext(m_frame, scriptState, securityOrigin.get());
index 62141d6..d9bb955 100644 (file)
@@ -95,7 +95,7 @@ v8::Local<v8::Value> V8WorkerContextEventListener::callListenerFunction(ScriptEx
         return v8::Local<v8::Value>();
 
     InspectorInstrumentationCookie cookie;
-    if (InspectorInstrumentation::hasFrontends()) {
+    if (InspectorInstrumentation::timelineAgentEnabled(context)) {
         String resourceName("undefined");
         int lineNumber = 1;
         v8::ScriptOrigin origin = handlerFunction->GetScriptOrigin();
index 0b468d4..1a91705 100644 (file)
@@ -128,7 +128,7 @@ v8::Handle<v8::Value> WindowSetTimeoutImpl(const v8::Arguments& args, bool singl
 
         id = DOMTimer::install(scriptContext, action.release(), timeout, singleShot);
     } else {
-        RefPtr<ScriptCallStack> callStack(createScriptCallStackForInspector());
+        RefPtr<ScriptCallStack> callStack(createScriptCallStackForConsole());
         if (imp->document() && !imp->document()->contentSecurityPolicy()->allowEval(callStack.release()))
             return v8Integer(0, args.GetIsolate());
         ASSERT(imp->frame());
index a6fb22a..14ad4ab 100644 (file)
@@ -87,7 +87,7 @@ v8::Handle<v8::Value> V8HTMLCanvasElement::getContextCallback(const v8::Argument
         return v8::Null(args.GetIsolate());
     else if (result->is2d()) {
         v8::Handle<v8::Value> v8Result = toV8(static_cast<CanvasRenderingContext2D*>(result), args.Holder(), args.GetIsolate());
-        if (InspectorInstrumentation::hasFrontends()) {
+        if (InspectorInstrumentation::canvasAgentEnabled(imp->document())) {
             ScriptState* scriptState = ScriptState::forContext(v8::Context::GetCurrent());
             ScriptObject context(scriptState, v8::Handle<v8::Object>::Cast(v8Result));
             ScriptObject wrapped = InspectorInstrumentation::wrapCanvas2DRenderingContextForInstrumentation(imp->document(), context);
@@ -105,7 +105,7 @@ v8::Handle<v8::Value> V8HTMLCanvasElement::getContextCallback(const v8::Argument
         perIsolateData->setShouldCollectGarbageSoon();
 
         v8::Handle<v8::Value> v8Result = toV8(static_cast<WebGLRenderingContext*>(result), args.Holder(), args.GetIsolate());
-        if (InspectorInstrumentation::hasFrontends()) {
+        if (InspectorInstrumentation::canvasAgentEnabled(imp->document())) {
             ScriptState* scriptState = ScriptState::forContext(v8::Context::GetCurrent());
             ScriptObject glContext(scriptState, v8::Handle<v8::Object>::Cast(v8Result));
             ScriptObject wrapped = InspectorInstrumentation::wrapWebGLRenderingContextForInstrumentation(imp->document(), glContext);
index 89ecdc9..ca93533 100644 (file)
@@ -67,7 +67,7 @@ v8::Handle<v8::Value> SetTimeoutOrInterval(const v8::Arguments& args, bool singl
     v8::Handle<v8::Context> v8Context = proxy->context();
     if (function->IsString()) {
         if (ContentSecurityPolicy* policy = workerContext->contentSecurityPolicy()) {
-            RefPtr<ScriptCallStack> callStack = createScriptCallStackForInspector();
+            RefPtr<ScriptCallStack> callStack = createScriptCallStackForConsole();
             if (!policy->allowEval(callStack.release()))
                 return v8Integer(0, args.GetIsolate());
         }
index 21d927c..b98a509 100644 (file)
                 "description": "Tells inspected instance(worker or page) that it can run in case it was started paused."
             },
             {
-                "name": "setReportExecutionContextCreation",
-                "parameters": [
-                    { "name": "enabled", "type": "boolean", "description": "Reporting enabled state." }
-                ],
+                "name": "enable",
+                "hidden": true,
+                "description": "Enables reporting of execution contexts creation by means of <code>executionContextCreated</code> event. When the reporting gets enabled the event will be sent immediately for each existing execution context."
+            },
+            {
+                "name": "disable",
                 "hidden": true,
-                "description": "Enables reporting about creation of execution contexts by means of <code>executionContextCreated</code> event. When the reporting gets enabled the event will be sent immediately for each existing execution context."
+                "description": "Disables reporting of execution contexts creation."
             }
-
         ],
         "events": [
             {
index aceb2da..f544b15 100644 (file)
@@ -42,6 +42,7 @@
 #include "ScriptArguments.h"
 #include "ScriptCallFrame.h"
 #include "ScriptCallStack.h"
+#include "ScriptController.h"
 #include "ScriptObject.h"
 #include "ScriptProfiler.h"
 #include <wtf/CurrentTime.h>
@@ -60,12 +61,15 @@ static const char monitoringXHR[] = "monitoringXHR";
 static const char consoleMessagesEnabled[] = "consoleMessagesEnabled";
 }
 
+int InspectorConsoleAgent::s_enabledAgentCount = 0;
+
 InspectorConsoleAgent::InspectorConsoleAgent(InstrumentingAgents* instrumentingAgents, InspectorState* state, InjectedScriptManager* injectedScriptManager)
     : InspectorBaseAgent<InspectorConsoleAgent>("Console", instrumentingAgents, state)
     , m_injectedScriptManager(injectedScriptManager)
     , m_frontend(0)
     , m_previousMessage(0)
     , m_expiredConsoleMessageCount(0)
+    , m_enabled(false)
 {
     m_instrumentingAgents->setInspectorConsoleAgent(this);
 }
@@ -80,6 +84,13 @@ InspectorConsoleAgent::~InspectorConsoleAgent()
 
 void InspectorConsoleAgent::enable(ErrorString*)
 {
+    if (m_enabled)
+        return;
+    m_enabled = true;
+    if (!s_enabledAgentCount)
+        ScriptController::setCaptureCallStackForUncaughtExceptions(true);
+    ++s_enabledAgentCount;
+
     m_state->setBoolean(ConsoleAgentState::consoleMessagesEnabled, true);
 
     if (m_expiredConsoleMessageCount) {
@@ -94,6 +105,11 @@ void InspectorConsoleAgent::enable(ErrorString*)
 
 void InspectorConsoleAgent::disable(ErrorString*)
 {
+    if (!m_enabled)
+        return;
+    m_enabled = false;
+    if (!(--s_enabledAgentCount))
+        ScriptController::setCaptureCallStackForUncaughtExceptions(false);
     m_state->setBoolean(ConsoleAgentState::consoleMessagesEnabled, false);
 }
 
@@ -103,7 +119,7 @@ void InspectorConsoleAgent::clearMessages(ErrorString*)
     m_expiredConsoleMessageCount = 0;
     m_previousMessage = 0;
     m_injectedScriptManager->releaseObjectGroup("console");
-    if (m_frontend && m_state->getBoolean(ConsoleAgentState::consoleMessagesEnabled))
+    if (m_frontend && m_enabled)
         m_frontend->messagesCleared();
 }
 
@@ -132,7 +148,8 @@ void InspectorConsoleAgent::setFrontend(InspectorFrontend* frontend)
 void InspectorConsoleAgent::clearFrontend()
 {
     m_frontend = 0;
-    m_state->setBoolean(ConsoleAgentState::consoleMessagesEnabled, false);
+    String errorString;
+    disable(&errorString);
 }
 
 void InspectorConsoleAgent::addMessageToConsole(MessageSource source, MessageType type, MessageLevel level, const String& message, PassRefPtr<ScriptArguments> arguments, PassRefPtr<ScriptCallStack> callStack)
@@ -279,12 +296,12 @@ void InspectorConsoleAgent::addConsoleMessage(PassOwnPtr<ConsoleMessage> console
 
     if (m_previousMessage && !isGroupMessage(m_previousMessage->type()) && m_previousMessage->isEqual(consoleMessage.get())) {
         m_previousMessage->incrementCount();
-        if (m_frontend && m_state->getBoolean(ConsoleAgentState::consoleMessagesEnabled))
+        if (m_frontend && m_enabled)
             m_previousMessage->updateRepeatCountInConsole(m_frontend);
     } else {
         m_previousMessage = consoleMessage.get();
         m_consoleMessages.append(consoleMessage);
-        if (m_frontend && m_state->getBoolean(ConsoleAgentState::consoleMessagesEnabled))
+        if (m_frontend && m_enabled)
             m_previousMessage->addToFrontend(m_frontend, m_injectedScriptManager, true);
     }
 
index 52be118..7f43393 100644 (file)
@@ -61,6 +61,7 @@ public:
     virtual void enable(ErrorString*);
     virtual void disable(ErrorString*);
     virtual void clearMessages(ErrorString*);
+    bool enabled() { return m_enabled; }
     void reset();
 
     virtual void setFrontend(InspectorFrontend*);
@@ -100,6 +101,9 @@ protected:
     int m_expiredConsoleMessageCount;
     HashMap<String, unsigned> m_counts;
     HashMap<String, double> m_times;
+    bool m_enabled;
+private:
+    static int s_enabledAgentCount;
 };
 
 } // namespace WebCore
index 5f2357a..51978ff 100644 (file)
@@ -223,8 +223,6 @@ void InspectorController::connectFrontend(InspectorFrontendChannel* frontendChan
     for (Agents::iterator it = m_agents.begin(); it != m_agents.end(); ++it)
         (*it)->setFrontend(frontend);
 
-    if (!InspectorInstrumentation::hasFrontends())
-        ScriptController::setCaptureCallStackForUncaughtExceptions(true);
     InspectorInstrumentation::frontendCreated();
 
     ASSERT(m_inspectorClient);
@@ -252,8 +250,6 @@ void InspectorController::disconnectFrontend()
     m_inspectorFrontend.clear();
 
     InspectorInstrumentation::frontendDeleted();
-    if (!InspectorInstrumentation::hasFrontends())
-        ScriptController::setCaptureCallStackForUncaughtExceptions(false);
 }
 
 void InspectorController::show()
index eb06071..4cb5e56 100644 (file)
@@ -46,6 +46,7 @@
 #include "InspectorApplicationCacheAgent.h"
 #include "InspectorDOMDebuggerAgent.h"
 #include "InspectorCSSAgent.h"
+#include "InspectorCanvasAgent.h"
 #include "InspectorConsoleAgent.h"
 #include "InspectorController.h"
 #include "WorkerInspectorController.h"
@@ -1134,23 +1135,34 @@ bool InspectorInstrumentation::collectingHTMLParseErrors(InstrumentingAgents* in
     return false;
 }
 
-bool InspectorInstrumentation::hasFrontendForScriptContext(ScriptExecutionContext* scriptExecutionContext)
+bool InspectorInstrumentation::canvasAgentEnabled(ScriptExecutionContext* scriptExecutionContext)
 {
-    if (!scriptExecutionContext)
+    if (!scriptExecutionContext || !hasFrontends())
         return false;
+    return instrumentingAgentsForContext(scriptExecutionContext)->inspectorCanvasAgent();
+}
 
-#if ENABLE(WORKERS)
-    if (scriptExecutionContext->isWorkerContext()) {
-        WorkerContext* workerContext = static_cast<WorkerContext*>(scriptExecutionContext);
-        WorkerInspectorController* workerInspectorController = workerContext->workerInspectorController();
-        return workerInspectorController && workerInspectorController->hasFrontend();
-    }
-#endif
+bool InspectorInstrumentation::consoleAgentEnabled(ScriptExecutionContext* scriptExecutionContext)
+{
+    if (!scriptExecutionContext || !hasFrontends())
+        return false;
+    InspectorConsoleAgent* consoleAgent = instrumentingAgentsForContext(scriptExecutionContext)->inspectorConsoleAgent();
+    return consoleAgent && consoleAgent->enabled();
+}
 
-    ASSERT(scriptExecutionContext->isDocument());
-    Document* document = static_cast<Document*>(scriptExecutionContext);
-    Page* page = document->page();
-    return page && page->inspectorController()->hasFrontend();
+bool InspectorInstrumentation::runtimeAgentEnabled(Frame* frame)
+{
+    if (!frame || !hasFrontends())
+        return false;
+    InspectorRuntimeAgent* runtimeAgent = instrumentingAgentsForFrame(frame)->inspectorRuntimeAgent();
+    return runtimeAgent && runtimeAgent->enabled();
+}
+
+bool InspectorInstrumentation::timelineAgentEnabled(ScriptExecutionContext* scriptExecutionContext)
+{
+    if (!scriptExecutionContext || !hasFrontends())
+        return false;
+    return instrumentingAgentsForContext(scriptExecutionContext)->inspectorTimelineAgent();
 }
 
 void InspectorInstrumentation::pauseOnNativeEventIfNeeded(InstrumentingAgents* instrumentingAgents, bool isDOMEvent, const String& eventName, bool synchronous)
index 400c443..8d57850 100644 (file)
@@ -263,11 +263,17 @@ public:
     static void frontendCreated() { s_frontendCounter += 1; }
     static void frontendDeleted() { s_frontendCounter -= 1; }
     static bool hasFrontends() { return s_frontendCounter; }
-    static bool hasFrontendForScriptContext(ScriptExecutionContext*);
+    static bool canvasAgentEnabled(ScriptExecutionContext*);
+    static bool consoleAgentEnabled(ScriptExecutionContext*);
+    static bool runtimeAgentEnabled(Frame*);
+    static bool timelineAgentEnabled(ScriptExecutionContext*);
     static bool collectingHTMLParseErrors(Page*);
 #else
     static bool hasFrontends() { return false; }
-    static bool hasFrontendForScriptContext(ScriptExecutionContext*) { return false; }
+    static bool canvasAgentEnabled(ScriptExecutionContext*) { return false; }
+    static bool consoleAgentEnabled(ScriptExecutionContext*) { return false; }
+    static bool runtimeAgentEnabled(Frame*) { return false; }
+    static bool timelineAgentEnabled(ScriptExecutionContext*) { return false; }
     static bool collectingHTMLParseErrors(Page*) { return false; }
 #endif
 
index 7e4fd4b..a3dfdde 100644 (file)
@@ -58,6 +58,7 @@ static bool asBool(const bool* const b)
 
 InspectorRuntimeAgent::InspectorRuntimeAgent(InstrumentingAgents* instrumentingAgents, InspectorState* state, InjectedScriptManager* injectedScriptManager)
     : InspectorBaseAgent<InspectorRuntimeAgent>("Runtime", instrumentingAgents, state)
+    , m_enabled(false)
     , m_injectedScriptManager(injectedScriptManager)
 #if ENABLE(JAVASCRIPT_DEBUGGER)
     , m_scriptDebugServer(0)
index f8e345e..66dbafd 100644 (file)
@@ -57,7 +57,10 @@ class InspectorRuntimeAgent : public InspectorBaseAgent<InspectorRuntimeAgent>,
 public:
     virtual ~InspectorRuntimeAgent();
 
+    bool enabled() { return m_enabled; }
     // Part of the protocol.
+    virtual void enable(ErrorString*) { m_enabled = true; }
+    virtual void disable(ErrorString*) { m_enabled = false; }
     virtual void evaluate(ErrorString*,
                   const String& expression,
                   const String* objectGroup,
@@ -95,6 +98,7 @@ protected:
     virtual void unmuteConsole() = 0;
 
     InjectedScriptManager* injectedScriptManager() { return m_injectedScriptManager; }
+    bool m_enabled;
 
 private:
     InjectedScriptManager* m_injectedScriptManager;
index 254957a..74c3b7f 100644 (file)
@@ -50,7 +50,7 @@ using WebCore::TypeBuilder::Runtime::ExecutionContextDescription;
 namespace WebCore {
 
 namespace PageRuntimeAgentState {
-static const char reportExecutionContextCreation[] = "reportExecutionContextCreation";
+static const char runtimeEnabled[] = "runtimeEnabled";
 };
 
 PageRuntimeAgent::PageRuntimeAgent(InstrumentingAgents* instrumentingAgents, InspectorState* state, InjectedScriptManager* injectedScriptManager, Page* page, InspectorPageAgent* pageAgent, InspectorAgent* inspectorAgent)
@@ -76,47 +76,44 @@ void PageRuntimeAgent::clearFrontend()
 {
     m_instrumentingAgents->setPageRuntimeAgent(0);
     m_frontend = 0;
-    m_state->setBoolean(PageRuntimeAgentState::reportExecutionContextCreation, false);
+    String errorString;
+    disable(&errorString);
 }
 
 void PageRuntimeAgent::restore()
 {
-    if (!m_state->getBoolean(PageRuntimeAgentState::reportExecutionContextCreation))
+    if (m_state->getBoolean(PageRuntimeAgentState::runtimeEnabled)) {
+        String error;
+        enable(&error);
+    }
+}
+
+void PageRuntimeAgent::enable(ErrorString* errorString)
+{
+    if (m_enabled)
         return;
+
+    InspectorRuntimeAgent::enable(errorString);
+    m_state->setBoolean(PageRuntimeAgentState::runtimeEnabled, true);
     // Only report existing contexts if the page did commit load, otherwise we may
     // unintentionally initialize contexts in the frames which may trigger some listeners
     // that are expected to be triggered only after the load is committed, see http://crbug.com/131623
-    if (m_inspectorAgent->didCommitLoadFired()) {
-        String error;
-        setReportExecutionContextCreation(&error, true);
-    }
+    if (m_inspectorAgent->didCommitLoadFired())
+        reportExecutionContextCreation();
 }
 
-void PageRuntimeAgent::setReportExecutionContextCreation(ErrorString*, bool enable)
+void PageRuntimeAgent::disable(ErrorString* errorString)
 {
-    m_state->setBoolean(PageRuntimeAgentState::reportExecutionContextCreation, enable);
-    if (!enable)
+    if (!m_enabled)
         return;
-    Vector<std::pair<ScriptState*, SecurityOrigin*> > isolatedContexts;
-    for (Frame* frame = m_inspectedPage->mainFrame(); frame; frame = frame->tree()->traverseNext()) {
-        if (!frame->script()->canExecuteScripts(NotAboutToExecuteScript))
-            continue;
-        String frameId = m_pageAgent->frameId(frame);
 
-        ScriptState* scriptState = mainWorldScriptState(frame);
-        notifyContextCreated(frameId, scriptState, 0, true);
-        frame->script()->collectIsolatedContexts(isolatedContexts);
-        if (isolatedContexts.isEmpty())
-            continue;
-        for (size_t i = 0; i< isolatedContexts.size(); i++)
-            notifyContextCreated(frameId, isolatedContexts[i].first, isolatedContexts[i].second, false);
-        isolatedContexts.clear();
-    }
+    InspectorRuntimeAgent::disable(errorString);
+    m_state->setBoolean(PageRuntimeAgentState::runtimeEnabled, false);
 }
 
 void PageRuntimeAgent::didClearWindowObject(Frame* frame)
 {
-    if (!m_state->getBoolean(PageRuntimeAgentState::reportExecutionContextCreation))
+    if (!m_enabled)
         return;
     ASSERT(m_frontend);
     String frameId = m_pageAgent->frameId(frame);
@@ -126,7 +123,7 @@ void PageRuntimeAgent::didClearWindowObject(Frame* frame)
 
 void PageRuntimeAgent::didCreateIsolatedContext(Frame* frame, ScriptState* scriptState, SecurityOrigin* origin)
 {
-    if (!m_state->getBoolean(PageRuntimeAgentState::reportExecutionContextCreation))
+    if (!m_enabled)
         return;
     ASSERT(m_frontend);
     String frameId = m_pageAgent->frameId(frame);
@@ -155,6 +152,25 @@ void PageRuntimeAgent::unmuteConsole()
     Console::unmute();
 }
 
+void PageRuntimeAgent::reportExecutionContextCreation()
+{
+    Vector<std::pair<ScriptState*, SecurityOrigin*> > isolatedContexts;
+    for (Frame* frame = m_inspectedPage->mainFrame(); frame; frame = frame->tree()->traverseNext()) {
+        if (!frame->script()->canExecuteScripts(NotAboutToExecuteScript))
+            continue;
+        String frameId = m_pageAgent->frameId(frame);
+
+        ScriptState* scriptState = mainWorldScriptState(frame);
+        notifyContextCreated(frameId, scriptState, 0, true);
+        frame->script()->collectIsolatedContexts(isolatedContexts);
+        if (isolatedContexts.isEmpty())
+            continue;
+        for (size_t i = 0; i< isolatedContexts.size(); i++)
+            notifyContextCreated(frameId, isolatedContexts[i].first, isolatedContexts[i].second, false);
+        isolatedContexts.clear();
+    }
+}
+
 void PageRuntimeAgent::notifyContextCreated(const String& frameId, ScriptState* scriptState, SecurityOrigin* securityOrigin, bool isPageContext)
 {
     ASSERT(securityOrigin || isPageContext);
index 9c92d80..5278aa7 100644 (file)
@@ -55,7 +55,8 @@ public:
     virtual void setFrontend(InspectorFrontend*);
     virtual void clearFrontend();
     virtual void restore();
-    virtual void setReportExecutionContextCreation(ErrorString*, bool);
+    virtual void enable(ErrorString*);
+    virtual void disable(ErrorString*);
 
     void didClearWindowObject(Frame*);
     void didCreateIsolatedContext(Frame*, ScriptState*, SecurityOrigin*);
@@ -66,6 +67,7 @@ private:
     virtual InjectedScript injectedScriptForEval(ErrorString*, const int* executionContextId);
     virtual void muteConsole();
     virtual void unmuteConsole();
+    void reportExecutionContextCreation();
     void notifyContextCreated(const String& frameId, ScriptState*, SecurityOrigin*, bool isPageContext);
 
     Page* m_inspectedPage;
index 30c0770..d74e2ac 100644 (file)
@@ -49,11 +49,6 @@ WorkerRuntimeAgent::~WorkerRuntimeAgent()
 {
 }
 
-void WorkerRuntimeAgent::setReportExecutionContextCreation(ErrorString* error, bool)
-{
-    *error = "Isolated contexts are not supported for workers.";
-}
-
 InjectedScript WorkerRuntimeAgent::injectedScriptForEval(ErrorString* error, const int* executionContextId)
 {
     if (executionContextId) {
index 6311093..9f1997b 100644 (file)
@@ -47,7 +47,6 @@ public:
         return adoptPtr(new WorkerRuntimeAgent(instrumentingAgents, state, injectedScriptManager, context));
     }
     virtual ~WorkerRuntimeAgent();
-    virtual void setReportExecutionContextCreation(ErrorString*, bool);
 
 private:
     WorkerRuntimeAgent(InstrumentingAgents*, InspectorState*, InjectedScriptManager*, WorkerContext*);
index f563356..b39d805 100644 (file)
@@ -95,7 +95,7 @@ WebInspector.RuntimeModel.prototype = {
     _didLoadCachedResources: function()
     {
         InspectorBackend.registerRuntimeDispatcher(new WebInspector.RuntimeDispatcher(this));
-        RuntimeAgent.setReportExecutionContextCreation(true);
+        RuntimeAgent.enable();
     },
 
     _executionContextCreated: function(context)
index c4651d7..6e96e97 100644 (file)
@@ -834,7 +834,7 @@ void DOMWindow::postMessage(PassRefPtr<SerializedScriptValue> message, const Mes
 
     // Capture stack trace only when inspector front-end is loaded as it may be time consuming.
     RefPtr<ScriptCallStack> stackTrace;
-    if (InspectorInstrumentation::hasFrontends())
+    if (InspectorInstrumentation::consoleAgentEnabled(sourceDocument))
         stackTrace = createScriptCallStack(ScriptCallStack::maxCallStackSizeToCapture, true);
 
     // Schedule the message.