#include "config.h"
#include "ScriptCallStackFactory.h"
+#include "InspectorInstrumentation.h"
#include "JSDOMBinding.h"
#include "ScriptArguments.h"
#include "ScriptCallFrame.h"
namespace WebCore {
+class ScriptExecutionContext;
+
PassRefPtr<ScriptCallStack> createScriptCallStack(size_t, bool)
{
return 0;
exec->interpreter()->retrieveLastCaller(callFrame, signedLineNumber, sourceID, urlString, function);
UString functionName;
if (function)
- functionName = asFunction(function)->name(exec);
+ functionName = jsCast<JSFunction*>(function)->name(exec);
else {
// Caller is unknown, but if frames is empty we should still add the frame, because
// something called us, and gave us arguments.
return ScriptCallStack::create(frames);
}
+PassRefPtr<ScriptCallStack> createScriptCallStackForInspector(JSC::ExecState* exec)
+{
+ size_t maxStackSize = 1;
+ if (InspectorInstrumentation::hasFrontends()) {
+ ScriptExecutionContext* scriptExecutionContext = jsCast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->scriptExecutionContext();
+ if (InspectorInstrumentation::hasFrontendForScriptContext(scriptExecutionContext))
+ maxStackSize = ScriptCallStack::maxCallStackSizeToCapture;
+ }
+ return createScriptCallStack(exec, maxStackSize);
+}
+
PassRefPtr<ScriptArguments> createScriptArguments(JSC::ExecState* exec, unsigned skipArgumentCount)
{
Vector<ScriptValue> arguments;