JavaScriptCallFrame.cpp [plain text]
#include "config.h"
#include "JavaScriptCallFrame.h"
#include "PlatformString.h"
#include <debugger/DebuggerCallFrame.h>
#include <runtime/JSGlobalObject.h>
#include <runtime/Completion.h>
#include <runtime/JSLock.h>
#include <runtime/JSObject.h>
#include <runtime/JSValue.h>
using namespace JSC;
namespace WebCore {
JavaScriptCallFrame::JavaScriptCallFrame(const DebuggerCallFrame& debuggerCallFrame, PassRefPtr<JavaScriptCallFrame> caller, intptr_t sourceID, int line)
: m_debuggerCallFrame(debuggerCallFrame)
, m_caller(caller)
, m_sourceID(sourceID)
, m_line(line)
, m_isValid(true)
{
}
JavaScriptCallFrame* JavaScriptCallFrame::caller()
{
return m_caller.get();
}
const JSC::ScopeChainNode* JavaScriptCallFrame::scopeChain() const
{
ASSERT(m_isValid);
if (!m_isValid)
return 0;
return m_debuggerCallFrame.scopeChain();
}
String JavaScriptCallFrame::functionName() const
{
ASSERT(m_isValid);
if (!m_isValid)
return String();
const UString* functionName = m_debuggerCallFrame.functionName();
if (!functionName)
return String();
return *functionName;
}
DebuggerCallFrame::Type JavaScriptCallFrame::type() const
{
ASSERT(m_isValid);
if (!m_isValid)
return DebuggerCallFrame::ProgramType;
return m_debuggerCallFrame.type();
}
JSObject* JavaScriptCallFrame::thisObject() const
{
ASSERT(m_isValid);
if (!m_isValid)
return 0;
return m_debuggerCallFrame.thisObject();
}
JSValuePtr JavaScriptCallFrame::evaluate(const UString& script, JSValuePtr& exception) const
{
ASSERT(m_isValid);
if (!m_isValid)
return jsNull();
JSLock lock(false);
return m_debuggerCallFrame.evaluate(script, exception);
}
}